diff -aruN shujit-0.5.0/ChangeLog shujit/ChangeLog --- shujit-0.5.0/ChangeLog Tue Apr 25 19:30:35 2000 +++ shujit/ChangeLog Wed Apr 26 00:45:21 2000 @@ -1,8 +1,33 @@ $Id$ +[20000426] + +0.5.1 リリース。 + [20000425] 0.5.0 リリース。 + +JDK 1.1 用の関数 InitClass() (in runtime.c) にて、 +ResolveClass() (JDK 内関数) を呼ぶ前に methodblock->info を +初期化しておくようにした。 +このために initializeClassForJIT() (in compiler.c) のインタフェースを変えた。 +ResolveClass() が InitializeForCompiler() (JDK 内関数) を呼ぶ前に +methodblock->info が要求されて SIGSEGV が発生していた。 +JPython 1.1 で発覚。 +[Thanks 高橋秀明さん for a bug report] +(runtime.c, compiler.c, compiler.h) + +lookupswitch 命令で npairs が 0 の場合を想定していなかったのを修整。 +JPython 1.1 で発覚。 +[Thanks 高橋秀明さん for a bug report] +(code.c) + +浮動小数点数のストア、ロードを除去する最適化を、 +単精度数については行わないようにした。 +丸め精度を倍精度に設定したままで +Java 言語仕様が定めるセマンティクスを守るため。 +(optimize.c) [20000424] diff -aruN shujit-0.5.0/code.c shujit/code.c --- shujit-0.5.0/code.c Mon Apr 24 03:23:32 2000 +++ shujit/code.c Wed Apr 26 00:06:49 2000 @@ -3311,12 +3311,14 @@ /* edi = addr. of the table */\ LUSW_DEBUG1(KEY);\ asm(\ + "testl %eax,%eax\n\t"\ LABEL "_loop:\n\t"\ + "jz " LABEL "_loopend\n\t"\ "cmpl (%edi)," #KEY "\n\t"\ "je " LABEL "_loopend\n\t"\ "addl $12,%edi\n\t"\ "decl %eax\n\t"\ - "jnz " LABEL "_loop\n\t"\ + "jmp " LABEL "_loop\n\t"\ LABEL "_loopend:");\ LUSW_DEBUG2;\ asm("movl 4(%edi),%eax");\ diff -aruN shujit-0.5.0/compile.c shujit/compile.c --- shujit-0.5.0/compile.c Mon Apr 24 16:38:23 2000 +++ shujit/compile.c Wed Apr 26 00:33:33 2000 @@ -2161,7 +2161,7 @@ printf(" clz initialized: %s\n",\ (CB_INITIALIZED(method->fb.clazz) ? "true" : "false"));\ if (!(method->CompiledCodeInfo)) {\ - printf(" WARNING: method->CompiledCodeInfo is NULL. (writeCode())\n");\ + printf(" WARNING: CompiledCodeInfo is NULL. (writeCode())\n");\ fflush(stdout);\ }\ } diff -aruN shujit-0.5.0/compiler.c shujit/compiler.c --- shujit-0.5.0/compiler.c Sun Apr 23 03:31:23 2000 +++ shujit/compiler.c Wed Apr 26 00:44:34 2000 @@ -110,7 +110,6 @@ /* * Local Functions */ -static void initializeClassForJIT(ClassClass *); static void initializeClassHook(ClassClass *); static void freeClass(ClassClass *); static unsigned char *compiledCodePC(JavaFrame *, struct methodblock *); @@ -124,12 +123,6 @@ static bool_t compileClasses(Hjava_lang_String *); static HObject *compilerCommand(HObject *); -#define INITIALIZE_METHOD(MB) \ - if (OPT_SETQ(OPT_CMPLCLINIT) || strcmp((MB)->fb.name, "")) {\ - (MB)->invoker = sym_compileAndInvokeMethod;\ - (MB)->CompiledCode = NULL;\ - } - /* * Initialization of the compiler. @@ -294,7 +287,7 @@ printf("init. a class in VM: %x,%s\n", *clazzptr, cbName(*clazzptr)); fflush(stdout); #endif - initializeClassForJIT(*clazzptr); + initializeClassForJIT(*clazzptr, TRUE); } if (OPT_SETQ(OPT_CMPLATLOAD)) { @@ -499,13 +492,9 @@ /* - * Local Functions - */ - -/* * Initialize the class at the time one is loaded. */ -static void initializeClassForJIT(ClassClass *cb) { +void initializeClassForJIT(ClassClass *cb, bool_t initInvoker) { struct methodblock *mb; int mb_count; @@ -538,18 +527,30 @@ if (access & ACC_NATIVE) continue; - INITIALIZE_METHOD(mb); + if (!initInvoker) continue; + + /* initialize invoker */ + if ((OPT_SETQ(OPT_CMPLCLINIT) || strcmp(mb->fb.name, "")) && + (mb->invoker != sym_compileAndInvokeMethod) && /* not init.ed yet */ + (mb->invoker != sym_invokeJITCompiledMethod)) { /* not compiled yet */ + mb->invoker = sym_compileAndInvokeMethod; + mb->CompiledCode = NULL; + } } } +/* + * Local Functions + */ + static void initializeClassHook(ClassClass *cb) { #ifdef COMPILE_DEBUG printf("initializeClassHook(%s) called.\n", cbName(cb)); fflush(stdout); #endif - initializeClassForJIT(cb); + initializeClassForJIT(cb, TRUE); if (OPT_SETQ(OPT_CMPLATLOAD)) { /* have to done after initialization */ compileClass(cb); diff -aruN shujit-0.5.0/compiler.h shujit/compiler.h --- shujit-0.5.0/compiler.h Mon Apr 24 16:39:30 2000 +++ shujit/compiler.h Wed Apr 26 00:35:29 2000 @@ -162,13 +162,13 @@ /* feature control */ +#define GET_SIGCONTEXT #define NULLEXC_BY_SIGNAL #define ARITHEXC_BY_SIGNAL -#define GET_SIGCONTEXT -#define FORCE_DOUBLE_PRECISION #define OPTIMIZE_INTERNAL_CODE #define SPECIAL_INLINING #define DIRECT_INV_NATIVE +#define FORCE_DOUBLE_PRECISION #undef NO_REWRITE #undef INITCLASS_IN_COMPILING #undef IGNORE_DISABLE @@ -506,7 +506,7 @@ #endif; /* in code.c */ -/* for strictfp */ +/* for the precise floating-point semantics, i.e. strictfp */ #undef STRICT_PRELOAD /* It has a preload to preload scales into FPU register yet. */ #define STRICT_USE_FSCALE @@ -593,6 +593,9 @@ /* * Global Functions */ +/* in compiler.c */ +void initializeClassForJIT(ClassClass *, bool_t initInvoker); + /* in signal.c */ #if (defined(EXC_BY_SIGNAL) || defined(GET_SIGCONTEXT)) && defined(SEARCH_SIGCONTEXT) #ifdef __FreeBSD__ diff -aruN shujit-0.5.0/invoker.c shujit/invoker.c --- shujit-0.5.0/invoker.c Mon Apr 24 16:34:25 2000 +++ shujit/invoker.c Wed Apr 26 00:14:38 2000 @@ -562,18 +562,6 @@ else if ((!strcmp(cbName(mb->fb.clazz), "java/lang/FloatingDecimal")) && (!strcmp(mb->fb.name, ""))) runtime_debug = 1; - else if ((!strcmp(cbName(mb->fb.clazz), "java/util/Hashtable")) - && (!strcmp(mb->fb.name, "get"))) - runtime_debug = 1; - else if ((!strcmp(cbName(mb->fb.clazz), "java/awt/FlowLayout")) - && (!strcmp(mb->fb.name, "setAlignment"))) - runtime_debug = 1; - else if ((!strcmp(cbName(mb->fb.clazz), "Linpack"))) - runtime_debug = 1; - else if ((!strcmp(cbName(mb->fb.clazz), "StrictfpBenchmark"))) - runtime_debug = 1; - else if ((!strcmp(cbName(mb->fb.clazz), "StrictfpTest"))) - runtime_debug = 1; #if 1 else if (!strcmp(mb->fb.name, "main")) runtime_debug = 1; diff -aruN shujit-0.5.0/optimize.c shujit/optimize.c --- shujit-0.5.0/optimize.c Tue Apr 25 00:22:06 2000 +++ shujit/optimize.c Wed Apr 26 00:39:47 2000 @@ -79,6 +79,8 @@ } break; +#if 0 /* single-precision operations need store-reload + for the precise floating-point semantics */ case opc_fst: /* combine FPU store and load instructions */ GET_2_ENTRIES; @@ -95,6 +97,7 @@ pctableNDelete(cc, i + 1, 2); } break; +#endif case opc_iload: /* load a float value to a FPU register directly */ diff -aruN shujit-0.5.0/runtime.c shujit/runtime.c --- shujit-0.5.0/runtime.c Fri Apr 21 18:16:35 2000 +++ shujit/runtime.c Tue Apr 25 23:50:12 2000 @@ -49,7 +49,9 @@ info = (CodeInfo *)method->CompiledCodeInfo; if (!info) { - printf("WARNING: method->CompiledCodeInfo is NULL. (invocationHelper())\n"); + printf("WARNING: CompiledCodeInfo is NULL. (invocationHelper())\n"); + printf(" %s#%s %s\n", cbName(method->fb.clazz), + method->fb.name, method->fb.signature); fflush(stdout); } #endif @@ -1028,6 +1030,11 @@ printf("InitClass(%s).\n", (cb?cbName(cb):"(null)")); fflush(stdout); #endif + + initializeClassForJIT(cb, FALSE); + /* This is necessary because methodblock->info can be required + before ResolveClass() calls InitializeForCompiler() */ + ResolveClass(cb, &detail); } #endif /* JDK_VER */