diff -aruN shujit-0.7.9/ChangeLog shujit/ChangeLog --- shujit-0.7.9/ChangeLog Fri Nov 30 10:41:05 2001 +++ shujit/ChangeLog Tue Dec 25 11:17:48 2001 @@ -1,5 +1,29 @@ $Id$ +[20011225] + +0.7.10 リリース。 + +[20011207] + +最近の gcc でコンパイルできるようにした。 +「gcc version 3.1 20011127 (Red Hat Linux Rawhide 3.1-0.10)」 +invocationHelper() (runtime.c) の末尾にて %edx が破壊されるように +なってしまっていたため、この破壊を避けるために +invocationHelper() の宣言を返り値を返さないもの (void) に変更。 +(runtime.c, compiler.h) + +[20011201] + +#define PATCH_ON_JUMP の際に、 +呼び出されたメソッドがインライン展開されていた場合、 +そのメソッドを定義しているクラスが初期化されないという問題が起きていた。 +クラスを初期化する内部命令 init_class を設けて、 +インライン展開するメソッドが static メソッドである場合には +内部命令 inlined_enter の直後に init_class を挿入するようにした。 +#define PATCH_WITH_SIGTRAP の場合は、きちんと初期化するようになっていた。 +(code.c, compile.c) + [20011130] 0.7.9 リリース。 diff -aruN shujit-0.7.9/GNUmakefile shujit/GNUmakefile --- shujit-0.7.9/GNUmakefile Fri Nov 30 11:54:51 2001 +++ shujit/GNUmakefile Tue Dec 25 12:20:24 2001 @@ -20,7 +20,7 @@ # command -CC = /usr/bin/gcc3 +CC = /usr/bin/gcc LD_DYNAMIC = ${CC} -shared# for GCC and GNU binutils #LD_DYNAMIC = ld -Bdynamic# for SunOS 4 ASFLAGS = diff -aruN shujit-0.7.9/README shujit/README --- shujit-0.7.9/README Fri Nov 30 10:40:29 2001 +++ shujit/README Tue Dec 25 10:59:13 2001 @@ -13,14 +13,13 @@ 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.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 + - Blackdown JDK 1.3.1, GCC 3.1 20011127, glibc 2.2.4 and Linux 2.4.17 + - Blackdown JDK 1.2.2, GCC 3.1 20011127, glibc 2.2.4 and Linux 2.4.17 + - JDK 1.1.8v3, GCC 3.1 20011127, glibc 2.2.4 and Linux 2.4.17 - JDK 1.1.7v1a, egcs 1.1.2, libc 5.4.38 and Linux 2.0.35 - FreeBSD - JDK 1.1.8 (ELF, V1999-11-9), GCC 2.95.2 and FreeBSD 4.3-STABLE - - JDK 1.2.2 patch10, GCC 2.95.2 and FreeBSD 5.0-CURRENT * Installation diff -aruN shujit-0.7.9/code.c shujit/code.c --- shujit-0.7.9/code.c Wed Nov 28 22:58:12 2001 +++ shujit/code.c Fri Dec 7 14:53:15 2001 @@ -4635,6 +4635,14 @@ } # endif } + + +# if defined(PATCH_ON_JUMP) && !defined(PATCH_WITH_SIGTRAP) && !defined(INITCLASS_IN_COMPILATION) + // const: cb + CODE(opc_init_class, init_class, STANY, STSTA, OPC_THROW) { + INITCLASS_GETSTATIC("init_class"); + } +# endif #endif // METHOD_INLINING diff -aruN shujit-0.7.9/compile.c shujit/compile.c --- shujit-0.7.9/compile.c Fri Nov 30 12:28:15 2001 +++ shujit/compile.c Sat Dec 1 19:32:24 2001 @@ -4012,28 +4012,37 @@ #ifdef METHOD_INLINING case opc_inlined_enter: - // maintain methodblock - pushToStack(stack, (long)mb); - if (!CONSTANT_POOL_TYPE_TABLE_IS_RESOLVED(type_table, operand)) { - if (!ResolveClassConstantFromClass2( + // maintain methodblock + pushToStack(stack, (long)mb); + if (!CONSTANT_POOL_TYPE_TABLE_IS_RESOLVED(type_table, operand)) { + if (!ResolveClassConstantFromClass2( fieldclass(&mb->fb), operand, cc->ee, (1 << CONSTANT_InterfaceMethodref) | (1 << CONSTANT_Methodref), FALSE)) { - ret = 1; - goto resolvedyn_done; - } + ret = 1; + goto resolvedyn_done; } - mb = constant_pool[operand].mb; - constant_pool = cbConstantPool(fieldclass(&mb->fb)); - type_table = constant_pool[CONSTANT_POOL_TYPE_TABLE_INDEX].type; + } + mb = constant_pool[operand].mb; + constant_pool = cbConstantPool(fieldclass(&mb->fb)); + type_table = constant_pool[CONSTANT_POOL_TYPE_TABLE_INDEX].type; break; case opc_inlined_exit: - // maintain methodblock - mb = (struct methodblock *)popFromStack(stack); - constant_pool = cbConstantPool(fieldclass(&mb->fb)); - type_table = constant_pool[CONSTANT_POOL_TYPE_TABLE_INDEX].type; + // maintain methodblock + mb = (struct methodblock *)popFromStack(stack); + constant_pool = cbConstantPool(fieldclass(&mb->fb)); + type_table = constant_pool[CONSTANT_POOL_TYPE_TABLE_INDEX].type; break; + +# if defined(PATCH_ON_JUMP) && !defined(PATCH_WITH_SIGTRAP) && !defined(INITCLASS_IN_COMPILATION) + case opc_init_class: + { + ClassClass *cb = fieldclass(&mb->fb); // mb has been set + memcpy(bufp + constant_table[opcode][state][0], &cb, 4); + } + break; +# endif #endif // METHOD_INLINING } // switch (opcode) } // for (i = 0; i < pctableLen(cc); i++) diff -aruN shujit-0.7.9/compiler.c shujit/compiler.c --- shujit-0.7.9/compiler.c Thu Nov 15 16:44:11 2001 +++ shujit/compiler.c Fri Dec 7 11:27:16 2001 @@ -607,8 +607,8 @@ fprintf(stderr, "disable codedb.\n"); OPT_RESET(OPT_CODEDB); if (db_page >= 0) close(db_page); JVM_Exit(1); - codedb_init_done: } +codedb_init_done: #endif // CODE_DB diff -aruN shujit-0.7.9/compiler.h shujit/compiler.h --- shujit-0.7.9/compiler.h Fri Nov 30 12:27:53 2001 +++ shujit/compiler.h Tue Dec 25 11:49:47 2001 @@ -25,7 +25,7 @@ #define _COMPILER_H_ -#define VERSION "0.7.9" +#define VERSION "0.7.10" #include "config.h" @@ -33,6 +33,8 @@ // for {,u}int{8,16,32}_t types #ifdef HAVE_STDINT_H # include +#elif defined(__FreeBSD__) && defined(HAVE_SYS_TYPES_H) +# include #else typedef unsigned char uint8_t; #endif @@ -77,10 +79,6 @@ # if __FreeBSD__ <= 2 typedef u_int16_t uint16_t; # endif -# if (__FreeBSD__ >= 5) && (JDK_VER == 11) -typedef unsigned int uint_t; - // FreeBSD/JDK 1.1.8 does not typedef this on FreeBSD >= 5 -# endif #endif @@ -751,7 +749,7 @@ #endif // CODE_DB // in runtime.c -extern int invocationHelper( +extern void invocationHelper( JHandle *obj, struct methodblock *method, int args_size, ExecEnv *ee, stack_item *var_base #ifdef RUNTIME_DEBUG diff -aruN shujit-0.7.9/config.h.in shujit/config.h.in --- shujit-0.7.9/config.h.in Mon Oct 22 16:51:13 2001 +++ shujit/config.h.in Tue Dec 25 11:36:44 2001 @@ -20,6 +20,8 @@ // whether the exists #undef HAVE_STDINT_H +// whether the exists +#undef HAVE_SYS_TYPES_H // whether the exists #undef HAVE_UCONTEXT_H diff -aruN shujit-0.7.9/configure shujit/configure --- shujit-0.7.9/configure Tue Nov 20 14:22:56 2001 +++ shujit/configure Tue Dec 25 11:37:03 2001 @@ -2008,8 +2008,49 @@ fi +echo $ac_n "checking whether the header exists""... $ac_c" 1>&6 +echo "configure:2013: checking whether the header exists" >&5 +ac_safe=`echo "sys/types.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/types.h""... $ac_c" 1>&6 +echo "configure:2016: checking for sys/types.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2026: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + cat >> confdefs.h <<\EOF +#define HAVE_SYS_TYPES_H 1 +EOF + + +else + echo "$ac_t""no" 1>&6 +fi + + echo $ac_n "checking type of an argument of monitorEnter()""... $ac_c" 1>&6 -echo "configure:2013: checking type of an argument of monitorEnter()" >&5 +echo "configure:2054: checking type of an argument of monitorEnter()" >&5 ac_monitor_t=`$ac_grep monitorEnter $ac_jincdir1/monitor.h | $ac_sed 's/(/ /' | $ac_sed "s/.* \(.*\));.*/\1/"` echo "$ac_t""$ac_monitor_t" 1>&6 cat >> confdefs.h < header exists""... $ac_c" 1>&6 -echo "configure:2022: checking whether the header exists" >&5 +echo "configure:2063: checking whether the header exists" >&5 if test -f "/usr/include/asm/ucontext.h"; then echo "$ac_t""exists" 1>&6 cat >> confdefs.h <<\EOF @@ -2030,7 +2071,7 @@ fi echo $ac_n "checking whether the JDK_HOME/include/green_threads directory exists""... $ac_c" 1>&6 -echo "configure:2034: checking whether the JDK_HOME/include/green_threads directory exists" >&5 +echo "configure:2075: checking whether the JDK_HOME/include/green_threads directory exists" >&5 if test -d "$ac_jincdir1/green_threads"; then echo "$ac_t""exists" 1>&6 cat >> confdefs.h <<\EOF diff -aruN shujit-0.7.9/configure.in shujit/configure.in --- shujit-0.7.9/configure.in Tue Nov 20 14:19:00 2001 +++ shujit/configure.in Tue Dec 25 11:35:05 2001 @@ -304,6 +304,12 @@ AC_DEFINE(HAVE_STDINT_H) ]) +AC_MSG_CHECKING(whether the header exists) +AC_CHECK_HEADER(sys/types.h, + [ + AC_DEFINE(HAVE_SYS_TYPES_H) + ]) + AC_MSG_CHECKING(type of an argument of monitorEnter()) ac_monitor_t=`$ac_grep monitorEnter $ac_jincdir1/monitor.h | $ac_sed 's/(/ /' | $ac_sed "s/.* \(.*\));.*/\1/"` AC_MSG_RESULT($ac_monitor_t) diff -aruN shujit-0.7.9/gentable.rb shujit/gentable.rb --- shujit-0.7.9/gentable.rb Wed Nov 21 16:31:00 2001 +++ shujit/gentable.rb Sat Dec 1 18:46:18 2001 @@ -4,7 +4,7 @@ CONST_C_FNAME = 'constants.c' CONST_H_FNAME = 'constants.h' -NOPCODES = 328 +NOPCODES = 329 NSTATES = 5 STANY = 5 STSTA = 5 diff -aruN shujit-0.7.9/opcodes_internal.h shujit/opcodes_internal.h --- shujit-0.7.9/opcodes_internal.h Wed Nov 21 16:30:55 2001 +++ shujit/opcodes_internal.h Sat Dec 1 19:20:13 2001 @@ -137,21 +137,23 @@ #define opc_inlined_enter 315 // 0x13b #define opc_inlined_exit 316 +#define opc_init_class 317 + // for MetaVM -#define opc_metavm_init 317 +#define opc_metavm_init 318 // for special inlining -#define opc_sqrt 318 // 0x13e -#define opc_sin 319 -#define opc_cos 320 -#define opc_tan 321 -#define opc_atan2 322 -#define opc_atan 323 -//#define opc_exp 324 -#define opc_log 324 -#define opc_floor 325 -#define opc_ceil 326 +#define opc_sqrt 319 // 0x13f +#define opc_sin 320 +#define opc_cos 321 +#define opc_tan 322 +#define opc_atan2 323 +#define opc_atan 324 +//#define opc_exp 325 +#define opc_log 325 +#define opc_floor 326 +#define opc_ceil 327 -#define opc_java_io_bufferedinputstream_ensureopen 327 +#define opc_java_io_bufferedinputstream_ensureopen 328 -#define NOPCODES 328 +#define NOPCODES 329 diff -aruN shujit-0.7.9/optimize.c shujit/optimize.c --- shujit-0.7.9/optimize.c Thu Nov 29 16:44:11 2001 +++ shujit/optimize.c Sat Dec 1 19:29:35 2001 @@ -529,6 +529,13 @@ i++; } +#if defined(PATCH_ON_JUMP) && !defined(PATCH_WITH_SIGTRAP) && !defined(INITCLASS_IN_COMPILATION) + if (method->fb.access & ACC_STATIC) { + pctableInsert(cc, insert_point, opc_init_class, -1, + byteoff, 0, -1); + i++; + } +#endif pctableInsert(cc, insert_point, opc_inlined_enter, operand, byteoff, 0, -1); pctableInsert(cc, insert_point, opc_stateto0, -1, diff -aruN shujit-0.7.9/runtime.c shujit/runtime.c --- shujit-0.7.9/runtime.c Thu Nov 29 01:00:07 2001 +++ shujit/runtime.c Fri Dec 7 15:03:46 2001 @@ -32,9 +32,9 @@ /* - * returns: ee->exceptionKind + * returns: none */ -int invocationHelper( +void invocationHelper( JHandle *obj, struct methodblock *method, int args_size, ExecEnv *ee, stack_item *var_base #ifdef RUNTIME_DEBUG @@ -884,6 +884,8 @@ asm("movl %0,%%edx" : : "m" (optop[0].i) : "edx"); asm("movl %0,%%ecx" : : "m" (optop[1].i) : "ecx"); + return; + // same as: // if (retsize == 1) { // %edx = frame->optop[-1].i; // state 1 @@ -895,11 +897,8 @@ // } } - return EXCKIND_NONE; // 0 - - invhelper_return: - return ee->exceptionKind; + return; } diff -aruN shujit-0.7.9/signal.c shujit/signal.c --- shujit-0.7.9/signal.c Fri Nov 16 04:11:27 2001 +++ shujit/signal.c Fri Dec 7 15:00:31 2001 @@ -310,8 +310,8 @@ ebp = (uint32_t *)ebp[0]; } // for (i = 0; i < IP_SEARCH_COUNT; ... goto signal_handler_error; - tentry_is_found: } + tentry_is_found: #if defined(RUNTIME_DEBUG) || defined(COMPILE_DEBUG) printf("throwentry: "); fflush(stdout); diff -aruN shujit-0.7.9/stack.c shujit/stack.c --- shujit-0.7.9/stack.c Wed Sep 19 21:28:32 2001 +++ shujit/stack.c Tue Dec 25 11:10:16 2001 @@ -27,11 +27,6 @@ #include "config.h" -#if (__FreeBSD__ >= 5) && (JDK_VER == 11) -typedef unsigned int uint_t; - // FreeBSD/JDK 1.1.8 does not typedef this on FreeBSD >= 5 -#endif - #ifndef HAVE_GREENTHR_HEADER # define NATIVE // for Linux/JDK 1.1.8v1 #endif diff -aruN shujit-0.7.9/txt/memo shujit/txt/memo --- shujit-0.7.9/txt/memo Fri Nov 30 10:55:57 2001 +++ shujit/txt/memo Tue Dec 25 11:14:32 2001 @@ -4,7 +4,7 @@ このポーリングはマクロ EXC_CHECK_IN_LOOP で有効になる。 - Native Threads だと Forte for Java 3.0 CE の起動中に 様々な箇所でデッドロックする。この問題を解決する。 - TYA 1.7v3 でも同様。 + TYA 1.7v3 やインタプリタでも同様。 「Loading Applet ...」でよく止まる。 - SSE2 対応の性能テスト Math.sqrt(), 四則演算 @@ -153,7 +153,7 @@ 0 〜 0x00ffffff / 0x3f800001 (1.0 + e) and 0x3f7fffff (1.0 - e) では、 丸め精度が single でも double でも差は出ない。 - strictfp。 - native と両立する? + native methods と両立する? - 対象となるバイトコード命令。 (fadd, dadd, fsub, dsub,) fmul, dmul, fdiv, ddiv, frem, drem frem, drem は対象とせずともよい。precise に計算できるので。