diff -aruN shujit-0.7.13/ChangeLog shujit/ChangeLog --- shujit-0.7.13/ChangeLog 2002-07-17 17:51:08.000000000 +0900 +++ shujit/ChangeLog 2003-01-20 10:22:54.000000000 +0900 @@ -1,5 +1,57 @@ $Id$ +[20030120] + +gcc 3.2 の dead code elimination が +exceptionHandlerWrapper() (code.c) の handler_state = cf->state を +除去してしまっていた。 +Blackdown JDK 1.1.8 で発覚。 +この処理をアセンブリコードで記述した。 +(code.c, code.h) + +0.7.14 リリース。 + +[20030106] + +java.lang.Math#exp() の special inlining を有効にした。 +(see [19991004]) +asin, acos, exp は、x87 命令での演算結果と fdlibm による結果が異なるので、 +JDK 1.2 以降の場合にのみ、special inlining が有効になるようにした。 +(opcodes_internal.h, code.c, compile.c, gentable.rb) + +java.lang.Math#{asin,acos}() に対しても +special inlining (see [19990822]) を適用するようにした。 +(opcodes_internal.h, code.c, compile.c, gentable.rb) + +java.lang.Math#abs() と java.lang.StrictMath#abs に対しても +special inlining (see [19990822]) を適用するようにした。 +そのために、内部命令 abs_int, abs_long, abs_float, abs_double を追加。 +(opcodes_internal.h, code.c, compile.c, gentable.rb) + +[20021030] + +コンストラクタ呼び出しに対しては null check を省いていたが (see [20000821])、 +JDK 1.1.X 以前では省かないようにした。 +具体的には、内部命令 invokeignored_static_quick ではなく、 +invokeignored_quick を生成するように変更した。 +1.3.1 では、null に対するコンストラクタ呼び出しは +bytecode verifier が検出して例外が throw される。 +しかし、1.1.8 では verifier にひっかからない。null check が必要。 +(compile.c) + +[20020816] + +コード書き換えでジャンプ命令を上書きする際に (see [20000821])、 +MOV 命令ではなく XCHG 命令を使うようにした。 +(code.c) + +[20020814] + +シグナルで例外 (NullPointerException と ArithmeticException) が +検出された回数を数えて実行終了後に表示するマクロ +COUNT_EXC_SIGNAL を用意した。 +(signal.c, compiler.h, compiler.c) + [20020717] 0.7.13 リリース。 diff -aruN shujit-0.7.13/GNUmakefile shujit/GNUmakefile --- shujit-0.7.13/GNUmakefile 2002-07-17 17:51:31.000000000 +0900 +++ shujit/GNUmakefile 2003-01-20 10:28:43.000000000 +0900 @@ -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.13/README shujit/README --- shujit-0.7.13/README 2002-07-17 18:10:38.000000000 +0900 +++ shujit/README 2003-01-19 23:33:06.000000000 +0900 @@ -13,13 +13,12 @@ Working on the following platforms is confirmed. - FreeBSD - - JDK 1.3.1 patchlevel 6, GCC 2.95.3 and FreeBSD 4.6-STABLE - - JDK 1.1.8 (ELF, V1999-11-9), GCC 2.95.3 and FreeBSD 4.6-STABLE + - JDK 1.3.1 patchlevel 7, GCC 2.95.4 and FreeBSD 4.6-STABLE + - JDK 1.1.8 (ELF, V1999-11-9), GCC 2.95.4 and FreeBSD 4.6-STABLE - Linux - - Blackdown JDK 1.3.1_02b, GCC 3.1 20020314, glibc 2.2.5, Linux 2.4.19-pre10 - - Blackdown JDK 1.2.2, GCC 3.1 20020314, glibc 2.2.5 and Linux 2.4.19-pre10 - - JDK 1.1.8v3, GCC 3.1 20020314, glibc 2.2.5 and Linux 2.4.19-pre10 + - Blackdown JDK 1.3.1_02b, GCC 3.2 20020903, glibc 2.2.93, Linux 2.4.21-pre3 + - JDK 1.1.8v3, GCC 3.2 20020903, glibc 2.2.93 and Linux 2.4.21-pre3 - JDK 1.1.7v1a, egcs 1.1.2, libc 5.4.38 and Linux 2.0.35 * Installation diff -aruN shujit-0.7.13/code.c shujit/code.c --- shujit-0.7.13/code.c 2002-07-16 14:41:28.000000000 +0900 +++ shujit/code.c 2003-01-20 10:20:12.000000000 +0900 @@ -2,7 +2,7 @@ This file is part of shuJIT, Just In Time compiler for Sun Java Virtual Machine. - Copyright (C) 1998,1999,2000,2001,2002 Kazuyuki Shudo + Copyright (C) 1998,1999,2000,2001,2002,2003 Kazuyuki Shudo This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -3933,7 +3933,7 @@ // stuff to rewrite code for opc_{get,put}static #define GETSTATIC_PATCH_OFFSET "0x2c" -#define GETSTATIC_PATCH_DATA "0x33" +#define GETSTATIC_PATCH_DATA "0x35" #undef INITCLASS_GETSTATIC // redefine INITCLASS_GETSTATIC @@ -3963,7 +3963,8 @@ asm(".byte 0xe8\n\t.long 0\n\t" /* call */\ "popl %edi");\ asm("subl $" GETSTATIC_PATCH_OFFSET ",%edi\n\t"\ - "movw $" GETSTATIC_PATCH_DATA "eb,(%edi)"); /* jmp XX */\ + "movw $" GETSTATIC_PATCH_DATA "eb,%ax\n\t" /* jmp XX */\ + "xchg %ax,(%edi)");\ \ asm(LABEL "_initclass_done:") #endif // (INITCLASS_IN_COMPILATION && !PATCH_ON_JUMP) || PATCH_WITH_SIGTRAP @@ -4142,7 +4143,7 @@ // stuff to rewrite code for opc_invokestatic # define INVOKESTATIC_PATCH_OFFSET "0x28" -# define INVOKESTATIC_PATCH_DATA "0x2f" +# define INVOKESTATIC_PATCH_DATA "0x33" #if (defined(INITCLASS_IN_COMPILATION) && !defined(PATCH_ON_JUMP)) || defined(PATCH_WITH_SIGTRAP) # define INITCLASS_INVOKESTATIC(LABEL) @@ -4170,7 +4171,10 @@ asm(".byte 0xe8\n\t.long 0\n\t" /* call */\ "popl %edi");\ asm("subl $" INVOKESTATIC_PATCH_OFFSET ",%edi\n\t"\ - "movw $" INVOKESTATIC_PATCH_DATA "eb,(%edi)"); /* jmp XX */\ + "pushl %eax\n\t"\ + "movw $" INVOKESTATIC_PATCH_DATA "eb,%ax\n\t" /* jmp XX */\ + "xchg %ax,(%edi)\n\t"\ + "popl %eax");\ \ asm(LABEL "_initclass_done:") #endif // INITCLASS_IN_COMPILATION || !PATCH_ON_JUMP || PATCH_WITH_SIGTRAP @@ -4479,7 +4483,7 @@ // inv_int_obj is same as inv_spe_obj #define INVINTF_PATCH_OFFSET "0x17" -#define INVINTF_PATCH_DATA "0x1e" +#define INVINTF_PATCH_DATA "0x22" #define INVINTF_PATCH1() \ asm(".short 0x9090") @@ -4488,7 +4492,10 @@ asm(".byte 0xe8\n\t.long 0\n\t" /* call */\ "popl %edi"); /* here, can break edi */\ asm("subl $" INVINTF_PATCH_OFFSET ",%edi\n\t"\ - "movw $" INVINTF_PATCH_DATA "eb,(%edi)") /* jmp XX */ + "pushl %eax\n\t"\ + "movw $" INVINTF_PATCH_DATA "eb,%ax\n\t" /* jmp XX */\ + "xchg %ax,(%edi)\n\t"\ + "popl %eax"); // const: guessptr, imethod CODE(opc_invokeinterface, invokeinterface, STANY, STSTA, OPC_THROW) { @@ -4707,7 +4714,7 @@ // stuff to rewrite code for opc_new #define NEW_PATCH_OFFSET "0x2d" -#define NEW_PATCH_DATA "0x34" +#define NEW_PATCH_DATA "0x36" #if !defined(PATCH_ON_JUMP) || defined(PATCH_WITH_SIGTRAP) # define NEW_PATCH(CB_REG, LABEL, STATE) @@ -4739,7 +4746,8 @@ asm(".byte 0xe8\n\t.long 0\n\t" /* call */\ "popl %edi");\ asm("subl $" NEW_PATCH_OFFSET ",%edi\n\t"\ - "movw $" NEW_PATCH_DATA "eb,(%edi)"); /* jmp XX */\ + "movw $" NEW_PATCH_DATA "eb,%ax\n\t" /* jmp XX */\ + "xchg %ax,(%edi)");\ \ asm(LABEL "_once_done:") #endif @@ -5587,20 +5595,6 @@ "fpatan\n\t"\ "fstpl (%esp)") #define JMATH_ATAN_ST0 JMATH_DIRECT_ST0("fld1\n\tfpatan") -#define JMATH_EXP_ST0 \ - asm("fldl (%esp)\n\t"\ - "fldl2e\n\t"\ - "fmul %st(1),%st\n\t"\ - "fst %st(1)\n\t"\ - "frndint\n\t"\ - "fxch %st(1)\n\t"\ - "fsub %st(1),%st\n\t"\ - "f2xm1\n\t"\ - "fld1\n\t"\ - "faddp %st,%st(1)\n\t"\ - "fscale\n\t"\ - "fstpl (%esp)\n\t"\ - "ffreep %st(0)") #define JMATH_LOG_ST0 JMATH_DIRECT_ST0("fldln2\n\tfxch %st(1)\n\tfyl2x") #define JMATH_FLOOR_CEIL_ST0(ROP) \ asm("fldl (%esp)\n\t"\ @@ -5618,6 +5612,41 @@ JMATH_FLOOR_CEIL_ST0("andw $0xf3ff,%ax\n\torw $0x0400,%ax") #define JMATH_CEIL_ST0 \ JMATH_FLOOR_CEIL_ST0("andw $0xf3ff,%ax\n\torw $0x0800,%ax") +#if JDK_VER >= 12 +#define JMATH_EXP_ST0 \ + asm("fldl (%esp)\n\t"\ + "fldl2e\n\t"\ + "fmul %st(1),%st\n\t"\ + "fst %st(1)\n\t"\ + "frndint\n\t"\ + "fxch %st(1)\n\t"\ + "fsub %st(1),%st\n\t"\ + "f2xm1\n\t"\ + "fld1\n\t"\ + "faddp %st,%st(1)\n\t"\ + "fscale\n\t"\ + "fstpl (%esp)\n\t"\ + "ffreep %st(0)") +#define JMATH_ASIN_ST0 \ + asm("fldl (%esp)\n\t"\ + "fld %st(0)\n\t"\ + "fmul %st(0)\n\t" /* x^2 */\ + "fld1\n\t"\ + "fsubp\n\t" /* 1 - x^2 */\ + "fsqrt\n\t" /* sqrt(1 - x^2) */\ + "fpatan\n\t" /* atan(x / sqrt(1 - x^2)) */\ + "fstpl (%esp)") +#define JMATH_ACOS_ST0 \ + asm("fldl (%esp)\n\t"\ + "fld %st(0)\n\t"\ + "fmul %st(0)\n\t" /* x^2 */\ + "fld1\n\t"\ + "fsubp\n\t" /* 1 - x^2 */\ + "fsqrt\n\t" /* sqrt(1 - x^2) */\ + "fxch %st(1)\n\t"\ + "fpatan\n\t" /* atan(sqrt(1 - x^2) / x) */\ + "fstpl (%esp)") +#endif // JDK_VER >= 12 #define CODE_JMATH(vop, VOP) \ CODE(opc_##vop, vop, ST0, ST0, OPC_NONE) {\ @@ -5648,10 +5677,111 @@ CODE_JMATH(tan, TAN); CODE_JMATH(atan2, ATAN2); CODE_JMATH(atan, ATAN); -// CODE_JMATH(exp, EXP); CODE_JMATH(log, LOG); CODE_JMATH(floor, FLOOR); CODE_JMATH(ceil, CEIL); +#if JDK_VER >= 12 + CODE_JMATH(exp, EXP); + CODE_JMATH(asin, ASIN); + CODE_JMATH(acos, ACOS); +#endif // JDK_VER >= 12 + +#define ABS_INT(REG) \ + asm("testl " #REG "," #REG "\n\t"\ + ".byte 0x79,0x02\n\t" /* jns */\ + "neg " #REG) + + CODE(opc_abs_int, abs_int, ST0, ST1, OPC_NONE) { + asm("movl (%esp),%edx"); + ABS_INT(%edx); + } + CODE(opc_abs_int, abs_int, ST1, STSTA, OPC_NONE) { + ABS_INT(%edx); + } + CODE(opc_abs_int, abs_int, ST2, STSTA, OPC_NONE) { + ABS_INT(%ecx); + } + CODE(opc_abs_int, abs_int, ST3, STSTA, OPC_NONE) { + ABS_INT(%ecx); + } + CODE(opc_abs_int, abs_int, ST4, STSTA, OPC_NONE) { + ABS_INT(%edx); + } + +#define ABS_LONG_ST2 \ + asm("testl %edx,%edx\n\t"\ + ".byte 0x79,0x7\n\t" /* jns */\ + "neg %ecx\n\t"\ + "adc $0,%edx\n\t"\ + "neg %edx") +#define ABS_LONG_ST4 \ + asm("testl %ecx,%ecx\n\t"\ + ".byte 0x79,0x7\n\t" /* jns */\ + "neg %edx\n\t"\ + "adc $0,%ecx\n\t"\ + "neg %ecx") + + CODE(opc_abs_long, abs_long, ST0, ST2, OPC_NONE) { + asm("popl %ecx\n\t" + "popl %edx"); // now state 2 + ABS_LONG_ST2; + } + CODE(opc_abs_long, abs_long, ST1, ST4, OPC_NONE) { + asm("popl %ecx"); // now state 4 + ABS_LONG_ST4; + } + CODE(opc_abs_long, abs_long, ST2, ST2, OPC_NONE) { + ABS_LONG_ST2; + } + CODE(opc_abs_long, abs_long, ST3, ST2, OPC_NONE) { + asm("popl %edx"); // now state 2 + ABS_LONG_ST2; + } + CODE(opc_abs_long, abs_long, ST4, ST4, OPC_NONE) { + ABS_LONG_ST4; + } + +#define ABS_FLOAT(REG) asm("andl $0x7fffffff," #REG); + + CODE(opc_abs_float, abs_float, ST0, ST1, OPC_NONE) { + asm("movl (%esp),%edx"); + ABS_FLOAT(%edx); + } + CODE(opc_abs_float, abs_float, ST1, STSTA, OPC_NONE) { + ABS_FLOAT(%edx); + } + CODE(opc_abs_float, abs_float, ST2, STSTA, OPC_NONE) { + ABS_FLOAT(%ecx); + } + CODE(opc_abs_float, abs_float, ST3, STSTA, OPC_NONE) { + ABS_FLOAT(%ecx); + } + CODE(opc_abs_float, abs_float, ST4, STSTA, OPC_NONE) { + ABS_FLOAT(%edx); + } + +#define ABS_DOUBLE_ST2 asm("andl $0x7fffffff,%edx"); +#define ABS_DOUBLE_ST4 asm("andl $0x7fffffff,%edx"); + + CODE(opc_abs_double, abs_double, ST0, ST2, OPC_NONE) { + asm("popl %ecx\n\t" + "popl %edx"); // now state 2 + ABS_DOUBLE_ST2; + } + CODE(opc_abs_double, abs_double, ST1, ST4, OPC_NONE) { + asm("popl %ecx"); // now state 4 + ABS_DOUBLE_ST4; + } + CODE(opc_abs_double, abs_double, ST2, ST2, OPC_NONE) { + ABS_DOUBLE_ST2; + } + CODE(opc_abs_double, abs_double, ST3, ST2, OPC_NONE) { + asm("popl %edx"); // now state 2 + ABS_DOUBLE_ST2; + } + CODE(opc_abs_double, abs_double, ST4, ST4, OPC_NONE) { + ABS_DOUBLE_ST4; + } #if JDK_VER >= 12 @@ -5799,12 +5929,16 @@ register struct CatchFrame_w_state *cf asm("eax"); register int32_t handler_state asm("ecx"); - handler_state = cf->state; + asm("movswl " CATCHFRAME_COMPILED_STATE(%eax) ",%ecx"); + // handler_state = cf->state; #ifdef RUNTIME_DEBUG if (runtime_debug) { DEBUG_IN; - printf(" exc handler state: %d\n", handler_state); - fflush(stdout); + asm("pushl %ecx"); + PUSH_CONSTSTR(" exc handler state: %d\n"); + asm("call " SYMBOL(printf) "@PLT\n\t" + "addl $8,%esp"); + FFLUSH; DEBUG_OUT; } #endif diff -aruN shujit-0.7.13/code.h shujit/code.h --- shujit-0.7.13/code.h 2002-07-16 14:41:52.000000000 +0900 +++ shujit/code.h 2003-01-20 10:30:32.000000000 +0900 @@ -2,7 +2,7 @@ This file is part of shuJIT, Just In Time compiler for Sun Java Virtual Machine. - Copyright (C) 1998,1999,2000,2001,2002 Kazuyuki Shudo + Copyright (C) 1998,1999,2000,2001,2002,2003 Kazuyuki Shudo This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -402,8 +402,10 @@ #if JDK_VER >= 12 #define CATCHFRAME_COMPILED_CATCHFRAME(CF) "8(" #CF ")" +#define CATCHFRAME_COMPILED_STATE(CF) "14(" #CF ")" #else #define CATCHFRAME_COMPILED_CATCHFRAME(CF) "12(" #CF ")" +#define CATCHFRAME_COMPILED_STATE(CF) "18(" #CF ")" #endif // JDK_VER diff -aruN shujit-0.7.13/compile.c shujit/compile.c --- shujit-0.7.13/compile.c 2002-07-16 14:42:57.000000000 +0900 +++ shujit/compile.c 2003-01-06 20:15:21.000000000 +0900 @@ -2,7 +2,7 @@ This file is part of shuJIT, Just In Time compiler for Sun Java Virtual Machine. - Copyright (C) 1998,1999,2000,2001,2002 Kazuyuki Shudo + Copyright (C) 1998,1999,2000,2001,2002,2003 Kazuyuki Shudo This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -907,10 +907,13 @@ if (!(method->fb.access & (ACC_NATIVE | ACC_ABSTRACT)) && (method->code[0] == opc_return)) { unsigned char *bytepc = methodcode + byteoff; - int toNullCheck = ((method->fb.access & ACC_STATIC) == 0) && - (strcmp(method->fb.name, "") != 0); + int toNullCheck = ((method->fb.access & ACC_STATIC) == 0) +#if JDK_VER >= 12 + && (strcmp(method->fb.name, "") != 0) +#endif + ; // condition: !static && !constructor - // omit null checks for constructors + // omit null checks for constructors if JDK is 1.2 or later #ifdef NO_NULL_AND_ARRAY_CHECK processAnOpcode(cc, opc_invokeignored_static_quick, byteoff); #else @@ -1048,13 +1051,14 @@ // special inlining bool_t inlined = FALSE; struct methodblock *method = constant_pool[operand].mb; + char *cname = cbName(fieldclass(&method->fb)); - if (!strcmp(cbName(fieldclass(&method->fb)), "java/lang/Math")) { + if (!strcmp(cname, "java/lang/Math")) { char *mname = method->fb.name; + char *sig = method->fb.signature; # ifdef COMPILE_DEBUG if (compile_debug) { - printf(" invocation of a method of java.lang.Math#%s.\n", - mname); + printf(" invocation of Math#%s.\n", mname); } # endif if (!strcmp(mname, "sqrt")) { @@ -1075,12 +1079,6 @@ else if (!strcmp(mname, "atan")) { inlined = TRUE; processAnOpcode(cc, opc_atan, byteoff); } -#if 0 - // behavior of pre-assembled code differs from an interpreter. - else if (!strcmp(mname, "exp")) { - inlined = TRUE; processAnOpcode(cc, opc_exp, byteoff); - } -#endif else if (!strcmp(mname, "log")) { inlined = TRUE; processAnOpcode(cc, opc_log, byteoff); } @@ -1090,7 +1088,51 @@ else if (!strcmp(mname, "ceil")) { inlined = TRUE; processAnOpcode(cc, opc_ceil, byteoff); } +# if JDK_VER >= 12 + else if (!strcmp(mname, "exp")) { + // behavior of pre-assembled code differs from an interpreter. + inlined = TRUE; processAnOpcode(cc, opc_exp, byteoff); + } + else if (!strcmp(mname, "asin")) { + // behavior of pre-assembled code differs from an interpreter. + inlined = TRUE; processAnOpcode(cc, opc_asin, byteoff); + } + else if (!strcmp(mname, "acos")) { + // behavior of pre-assembled code differs from an interpreter. + inlined = TRUE; processAnOpcode(cc, opc_acos, byteoff); + } +# endif // JDK_VER >= 12 } // if "java/lang/Math" + + if (!strcmp(cname, "java/lang/Math") || + !strcmp(cname, "java/lang/StrictMath")) { + char *mname = method->fb.name; + char *sig = method->fb.signature; +# ifdef COMPILE_DEBUG + if (compile_debug) { + printf(" invocation of Math or StrictMath#%s.\n", mname); + } +# endif + if (!strcmp(mname, "abs")) { + if (!strcmp(sig, "(I)I")) { + inlined = TRUE; + processAnOpcode(cc, opc_abs_int, byteoff); + } + else if (!strcmp(sig, "(J)J")) { + inlined = TRUE; + processAnOpcode(cc, opc_abs_long, byteoff); + } + else if (!strcmp(sig, "(F)F")) { + inlined = TRUE; + processAnOpcode(cc, opc_abs_float, byteoff); + } + else if (!strcmp(sig, "(D)D")) { + inlined = TRUE; + processAnOpcode(cc, opc_abs_double, byteoff); + } + } + } // if "java/lang/Math" or "java/lang/StrictMath" + if (!inlined) #endif // SPECIAL_INLINING { diff -aruN shujit-0.7.13/compiler.c shujit/compiler.c --- shujit-0.7.13/compiler.c 2002-07-16 14:42:05.000000000 +0900 +++ shujit/compiler.c 2002-08-14 19:39:55.000000000 +0900 @@ -21,7 +21,7 @@ $Id$ */ -#include // for getenv(),atoi() +#include // for getenv(),atoi(),atexit() #include // for gdbm_open(), stat() #include // for stat() #include // for memset() @@ -680,6 +680,12 @@ #endif // CODE_DB +#if defined(EXC_BY_SIGNAL) && defined(COUNT_EXC_SIGNAL) + // for printing the number of exceptions by signal + atexit(showExcSignalCount); +#endif + + // for strictfp // check the FPU roundig precision { diff -aruN shujit-0.7.13/compiler.h shujit/compiler.h --- shujit-0.7.13/compiler.h 2002-07-16 14:42:28.000000000 +0900 +++ shujit/compiler.h 2003-01-06 19:15:11.000000000 +0900 @@ -25,7 +25,7 @@ #define _COMPILER_H_ -#define VERSION "0.7.13" +#define VERSION "0.7.14" #include "config.h" @@ -120,6 +120,8 @@ #undef SLACK_ACCESS_CONTROL // omit null check and array bound check. #undef NO_NULL_AND_ARRAY_CHECK +// at exit, print the number of exceptions by signal +#undef COUNT_EXC_SIGNAL #undef COUNT_TSC @@ -633,6 +635,9 @@ bool_t examineSigcontextNestCount(int sig, void *info, void *uc0); #endif bool_t signalHandler(int sig, void *info, void *uc0); +#if defined(EXC_BY_SIGNAL) && defined(COUNT_EXC_SIGNAL) +void showExcSignalCount(); +#endif // in code.c extern volatile void assembledCode( diff -aruN shujit-0.7.13/gentable.rb shujit/gentable.rb --- shujit-0.7.13/gentable.rb 2001-12-01 18:46:18.000000000 +0900 +++ shujit/gentable.rb 2003-01-06 20:10:28.000000000 +0900 @@ -4,7 +4,7 @@ CONST_C_FNAME = 'constants.c' CONST_H_FNAME = 'constants.h' -NOPCODES = 329 +NOPCODES = 336 NSTATES = 5 STANY = 5 STSTA = 5 diff -aruN shujit-0.7.13/opcodes_internal.h shujit/opcodes_internal.h --- shujit-0.7.13/opcodes_internal.h 2002-07-16 14:54:32.000000000 +0900 +++ shujit/opcodes_internal.h 2003-01-06 20:25:37.000000000 +0900 @@ -2,7 +2,7 @@ This file is part of shuJIT, Just In Time compiler for Sun Java Virtual Machine. - Copyright (C) 1996,1997,1998,1999,2000 Kazuyuki Shudo + Copyright (C) 1996,1997,1998,1999,2000,2003 Kazuyuki Shudo This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -149,11 +149,17 @@ #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_abs_int 328 +#define opc_abs_long 329 +#define opc_abs_float 330 +#define opc_abs_double 331 +#define opc_exp 332 +#define opc_asin 333 +#define opc_acos 334 -#define opc_java_io_bufferedinputstream_ensureopen 328 +#define opc_java_io_bufferedinputstream_ensureopen 335 -#define NOPCODES 329 +#define NOPCODES 336 diff -aruN shujit-0.7.13/optimize.c shujit/optimize.c --- shujit-0.7.13/optimize.c 2002-07-16 14:54:22.000000000 +0900 +++ shujit/optimize.c 2002-09-22 18:46:40.000000000 +0900 @@ -2,7 +2,7 @@ This file is part of shuJIT, Just In Time compiler for Sun Java Virtual Machine. - Copyright (C) 2000,2001 Kazuyuki Shudo + Copyright (C) 2000,2001,2002 Kazuyuki Shudo This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -398,6 +398,8 @@ case opc_invokespecial: case opc_invokestatic: case opc_invokestatic_quick: + // `invokevirtual ' is also inlined + // because it has been translated to `invokespecial' in makePCTable(). { struct methodblock *method = constant_pool[operand].mb; CodeInfo *inlined_info; diff -aruN shujit-0.7.13/signal.c shujit/signal.c --- shujit-0.7.13/signal.c 2002-07-16 14:54:12.000000000 +0900 +++ shujit/signal.c 2002-08-14 19:38:15.000000000 +0900 @@ -92,6 +92,11 @@ static int ucontext_used = 0; #endif +#if defined(EXC_BY_SIGNAL) && defined(COUNT_EXC_SIGNAL) +static int exc_signal_count = 0; +#endif + + #if (defined(EXC_BY_SIGNAL) || defined(GET_SIGCONTEXT)) && defined(SEARCH_SIGCONTEXT) bool_t examineSigcontextNestCount(int sig, void *info, void *uc0) { @@ -357,6 +362,9 @@ # endif // CAUSE_STACKOVERFLOW { SignalError(NULL, JAVAPKG "NullPointerException", 0); +#ifdef COUNT_EXC_SIGNAL + exc_signal_count++; +#endif } } break; @@ -368,6 +376,9 @@ if (SIGCONTEXT(sc, ecx) /* divisor */ == 0) { // ArithmeticException occurred SignalError(NULL, JAVAPKG "ArithmeticException", "/ by zero"); +#ifdef COUNT_EXC_SIGNAL + exc_signal_count++; +#endif } else if ((SIGCONTEXT(sc, eax) /* dividend */ == 0x80000000) && (SIGCONTEXT(sc, ecx) /* divisor */ == -1)) { @@ -406,6 +417,9 @@ if (!((*(sp + 2)) | (*(sp + 3)))) { // ArithmeticException occurred SignalError(NULL, JAVAPKG "ArithmeticException", "/ by zero"); +#ifdef COUNT_EXC_SIGNAL + exc_signal_count++; +#endif } #if 0 // In this case, @@ -782,3 +796,11 @@ } } #endif // EXC_BY_SIGNAL || GET_SIGCONTEXT + + +#if defined(EXC_BY_SIGNAL) && defined(COUNT_EXC_SIGNAL) +void showExcSignalCount() { + printf("# of exceptions by signal: %d\n", exc_signal_count); + fflush(stdout); +} +#endif // EXC_BY_SIGNAL && COUNT_EXC_SIGNAL