diff -aruN shujit-0.7.8/ChangeLog shujit/ChangeLog --- shujit-0.7.8/ChangeLog Thu Nov 22 00:43:36 2001 +++ shujit/ChangeLog Fri Nov 30 10:41:05 2001 @@ -1,5 +1,27 @@ $Id$ +[20011130] + +0.7.9 リリース。 + +[20011129] + +0.7.6 以降の版で、TYA 付属のベンチマーク Sieve のスコアが非常に低くなっていた。 +[Thanks Maxim Sobolev ] +[20011017] の変更で、invokeJITCompiledMethod() (invoker.c) にて +#define DIRECT_INVOCATION の場合も restack をスキップするようにしたところ、 +このスキップのために遅くなっていた。 +この修整は誤修整で、invocationHelper() (runtime.c) にてネイティブスタックから +JVM スタックへの restack が行われているため、本来は、その逆の restack を +スキップする必要はなかった。 +[20011017] の問題の本当の原因は、次の通り。 +インライン展開時に caller 側の methodblock->maxstack が callee 側よりも +小さい場合に、ee->current_frame->current_method は caller 側となるため、 +小さい maxstack が採用されてしまい、JVM スタック上の値が破壊されていた。 +これを防ぐために、インライン展開時に caller 側 maxstack を補整するようにした。 +しかし、maxstack の書き換えがインタプリタ側で何か問題を起こすかもしれない。 +(invoker.c, runtime.c) + [20011122] 0.7.8 リリース。 diff -aruN shujit-0.7.8/README shujit/README --- shujit-0.7.8/README Wed Nov 21 22:54:26 2001 +++ shujit/README Fri Nov 30 10:40:29 2001 @@ -13,9 +13,9 @@ Working on the following platforms is confirmed. - Linux - - Blackdown JDK 1.3.1 FCS, GCC 3.0.1, glibc 2.2.4 and Linux 2.4.15-pre8 - - Blackdown JDK 1.2.2 FCS, GCC 3.0.1, glibc 2.2.4 and Linux 2.4.15-pre8 - - JDK 1.1.8v3, GCC 3.0.1, glibc 2.2.4 and Linux 2.4.15-pre8 + - Blackdown JDK 1.3.1 FCS, GCC 3.0.1, glibc 2.2.4 and Linux 2.4.17-pre1 + - Blackdown JDK 1.2.2 FCS, GCC 3.0.1, glibc 2.2.4 and Linux 2.4.17-pre1 + - JDK 1.1.8v3, GCC 3.0.1, glibc 2.2.4 and Linux 2.4.17-pre1 - JDK 1.1.7v1a, egcs 1.1.2, libc 5.4.38 and Linux 2.0.35 - FreeBSD @@ -25,7 +25,7 @@ * Installation With Java 2, you have to place the libshujit.so on -jdk1.2.2/jre/lib/i386/ or make a symbolic link in the +j2sdk1.X.X/jre/lib/i386/ or make a symbolic link in the directory. With JDK 1.1.X, copy the libshujit.so to the @@ -49,16 +49,16 @@ You need the following tools to compile this JIT. - JDK 1.1.X, 1.2.X or 1.3.X Classic VM - ShuJIT works with Sun's Classic VM included in these JDK. + ShuJIT works with Sun's Classic VM of these JDK. Other JVMs, i.e. IBM JDK and HotSpot VMs, are not supported. - GCC 2.9X, 3.0.1 or egcs You can examine the version number of your GCC with -v option. % gcc -v GCC 2.7.X cannot compile shuJIT correctly. - objdump (in GNU binutils) - Most Linux distributions and ELF FreeBSD systems have it. + Most Linux distributions and ELF FreeBSD systems have this. - Ruby - A script which generate some tables was written in Ruby. + A script which generate some tables is written in Ruby. See http://www.ruby-lang.org/ - GNU make diff -aruN shujit-0.7.8/compile.c shujit/compile.c --- shujit-0.7.8/compile.c Wed Nov 21 22:35:37 2001 +++ shujit/compile.c Fri Nov 30 12:28:15 2001 @@ -3230,7 +3230,7 @@ arg += 4; // 6 byte -> 2 byte carg = (char)arg; - if (arg == ((int32_t)carg)) { // -128 <= (arg + 3) <= 127 + if (arg == ((int32_t)carg)) { // -128 <= (arg + 4) <= 127 p--; p[0] = p[1] - 0x10; p[1] = carg; // jXX XX *((int32_t *)(p + 2)) = 0x909002eb; // 0x90: nop diff -aruN shujit-0.7.8/compiler.h shujit/compiler.h --- shujit-0.7.8/compiler.h Wed Nov 21 22:34:29 2001 +++ shujit/compiler.h Fri Nov 30 12:27:53 2001 @@ -25,7 +25,7 @@ #define _COMPILER_H_ -#define VERSION "0.7.8" +#define VERSION "0.7.9" #include "config.h" diff -aruN shujit-0.7.8/invoker.c shujit/invoker.c --- shujit-0.7.8/invoker.c Wed Nov 21 15:58:32 2001 +++ shujit/invoker.c Thu Nov 29 12:04:24 2001 @@ -355,6 +355,10 @@ // creates a new frame CREATE_JAVAFRAME(ee, mb, old_frame, frame, args_size, mb->nlocals, mb->maxstack); +#ifndef DIRECT_INVOCATION + frame->returnpc = (unsigned char *)-1; + // mark as a frame for compiled code +#endif #ifdef DIRECT_INVOCATION frame->constant_pool = NULL; @@ -363,10 +367,13 @@ // call - if (((int)old_frame->returnpc) == -1) { // called by compiled method +#ifndef DIRECT_INVOCATION + if (((int)old_frame->returnpc) == -1) { + // called by compiled method var_base = var_base_read_only; goto restack2native_done; } +#endif // called by normal Java or native method // restack from JVM stack to native stack diff -aruN shujit-0.7.8/optimize.c shujit/optimize.c --- shujit-0.7.8/optimize.c Tue Nov 20 13:06:21 2001 +++ shujit/optimize.c Thu Nov 29 16:44:11 2001 @@ -462,6 +462,11 @@ #endif inlined = TRUE; + // adjust caller's methodblock->maxstack + // to avoid corruption of JVM stack + if (mb->maxstack < method->maxstack) + mb->maxstack = method->maxstack; + inlined_pctable = inlined_info->pctable; sysAssert(inlined_pctable != NULL); diff -aruN shujit-0.7.8/runtime.c shujit/runtime.c --- shujit-0.7.8/runtime.c Tue Nov 20 17:56:55 2001 +++ shujit/runtime.c Thu Nov 29 01:00:07 2001 @@ -47,9 +47,6 @@ int retsize; int access; - // mark as invoked by JIT compiled code - cur_frame->returnpc = (unsigned char *)-1; - // get CompiledCodeInfo info = (CodeInfo *)method->CompiledCodeInfo; #ifdef RUNTIME_DEBUG @@ -167,7 +164,7 @@ #endif // RUNTIME_DEBUG -#define CALL_INVOKER(TAG) \ +#define CALL_INVOKER \ {\ register int ret asm("eax");\ ret = ((bool_t (*)(JHandle*,struct methodblock*,int,ExecEnv*,stack_item*))\ @@ -178,7 +175,7 @@ invoker = method->invoker; #ifndef DIRECT_INVOCATION if (invoker == sym_invokeJITCompiledMethod) { // compiled method is called - CALL_INVOKER(compiled); + CALL_INVOKER; goto invhelper_finish; } #endif // DIRECT_INVOCATION @@ -771,7 +768,7 @@ argsizes++; } - CALL_INVOKER(normal); + CALL_INVOKER; if ((invoker == sym_invokeJavaMethod) || (invoker == sym_invokeSynchronizedJavaMethod)) { diff -aruN shujit-0.7.8/txt/codesize shujit/txt/codesize --- shujit-0.7.8/txt/codesize Tue Sep 19 21:19:59 2000 +++ shujit/txt/codesize Fri Nov 30 10:52:05 2001 @@ -38,6 +38,18 @@ native code size / num of inst: 22.8934505 native code size / byte code size: 10.49922861 +[2001年 11月 30日 (0.7.9 + 1.1.8v3, systhreshold=1)] +num compiled method: 470 +num bytecode: 27179 +size bytecode: 59772 +size native code: 614029 +size native code / num bytecode: 22.59203797 +size native code / size bytecode: 10.27285351 +size throw entry: 175168 +all generated: 789197 +all generated / num bytecode: 29.03701387 +all generated / size bytecode: 13.20345647 + % java DoNothing @@ -64,6 +76,18 @@ native code size / num of inst: 20.88145897 native code size / byte code size: 11.6440678 +[2001年 11月 30日 (0.7.9 + 1.1.8v3, systhreshold=1)] +num compiled method: 13 +num bytecode: 327 +size bytecode: 586 +size native code: 6682 +size native code / num bytecode: 20.43425076 +size native code / size bytecode: 11.40273038 +size throw entry: 2144 +all generated: 8826 +all generated / num bytecode: 26.99082569 +all generated / size bytecode: 15.06143345 + 2. E2 暗号化 diff -aruN shujit-0.7.8/txt/memo shujit/txt/memo --- shujit-0.7.8/txt/memo Wed Nov 21 14:37:17 2001 +++ shujit/txt/memo Fri Nov 30 10:55:57 2001 @@ -22,14 +22,14 @@ - コンパイル中のメソッドが呼ばれた場合の対策。 インタプリタで実行され、_quick への変換が起こり、pctable と食い違う恐れ。 - sysMalloc(), sysRealloc() の例外処理。 - - SunOS 5, Win32 に移植。 - - SignalError() の第 3引数として文字列を渡しているものをチェック。 + - Win32, Solaris 2 に移植。 - UseLosslessQuickOpcodes = FALSE でよいようにする。 invokevirtual{,object}_quick で無理がある。 インタプリタに実行させた場合に、optop が返り値の分増やされない あらかじめ methodblock を取得する必要があるが、それができない。 調査 + - SignalError() の第 3引数として文字列を渡しているものを調べあげる。 - invokeignored_quick への書き換え規則。 最適化