diff -aruN shujit-0.4.1/ChangeLog shujit/ChangeLog --- shujit-0.4.1/ChangeLog Sun Feb 6 18:35:21 2000 +++ shujit/ChangeLog Mon Feb 21 20:05:58 2000 @@ -1,5 +1,22 @@ $Id$ +[20000221] + +0.4.2 リリース。 + +[20000214] + +オプション cmplatload がきちんと働くようにした。 +initializeClass() にて、compileClass() を +メソッドの JIT 向け初期化処理の後で呼ぶようにした。 +また、JIT の初期化時にすでにロードされているクラスは、 +すべてを初期化してからコンパイルするようにした。 +(compiler.c) + +[20000210] + +0.4.1 リリース。 + [20000206] JNI のネイティブメソッドを直接呼び出す際に(see [19990827])、 diff -aruN shujit-0.4.1/README shujit/README --- shujit-0.4.1/README Thu Feb 10 15:43:48 2000 +++ shujit/README Mon Feb 21 21:38:17 2000 @@ -13,8 +13,8 @@ Working on the following platforms is confirmed. - Linux - - Blackdown JDK 1.2.2 RC4, gcc 2.95.2, glibc2.1.2 and Linux 2.2.15pre5 - - JDK 1.2 pre-release 2, egcs 1.0.3, glibc2.0.7 and Linux 2.2.13pre7 + - Blackdown JDK 1.2.2 RC4, gcc 2.95.2, glibc2.1.2 and Linux 2.2.15pre7 + - JDK 1.1.8v1, gcc 2.95.2, glibc2.1.2 and Linux 2.2.15pre7 - JDK 1.1.7v1a, egcs 1.1.2, libc5.4.38 and Linux 2.0.35 - FreeBSD diff -aruN shujit-0.4.1/compile.c shujit/compile.c --- shujit-0.4.1/compile.c Thu Dec 23 12:58:06 1999 +++ shujit/compile.c Mon Feb 14 11:35:36 2000 @@ -82,6 +82,24 @@ fflush(stdout); } + if (!mb->code) { /* mb->code is NULL */ +#ifdef COMPILE_DEBUG + printf(" mb->code is NULL: %s#%s\n", + cbName(mb->fb.clazz), mb->fb.name, mb->fb.signature); + fflush(stdout); +#endif + return 1; /* failure */ + } + + if (mb->invoker == sym_invokeJITCompiledMethod) { /* already compiled */ +#ifdef COMPILE_DEBUG + printf(" already compiled: %s#%s\n", + cbName(mb->fb.clazz), mb->fb.name, mb->fb.signature); + fflush(stdout); +#endif + return 0; /* success */ + } + cc = getCompilerContext(mb); #ifdef COMPILE_DEBUG compile_debug = cc->compile_debug; @@ -510,13 +528,6 @@ fflush(stdout); } #endif - - if (!mb->code) { -#ifdef COMPILE_DEBUG - printf(" mb->code is NULL. cannot compile.\n"); fflush(stdout); -#endif - return 1; /* failure */ - } /* translate an opcode to an internal opcode */ switch (opcode) { diff -aruN shujit-0.4.1/compiler.c shujit/compiler.c --- shujit-0.4.1/compiler.c Tue Dec 28 18:58:04 1999 +++ shujit/compiler.c Mon Feb 14 16:06:24 2000 @@ -110,13 +110,16 @@ /* * Local Functions */ -static void initializeClass(ClassClass *); +static void initializeClassForJIT(ClassClass *); +static void initializeClassHook(ClassClass *); static void freeClass(ClassClass *); static unsigned char *compiledCodePC(JavaFrame *, struct methodblock *); static bool_t pcInCompiledCode(unsigned char *pc, struct methodblock *); static JavaFrame *framePrev(JavaFrame *frame, JavaFrame *frame_buf); +#ifndef IGNORE_DISABLE static void compilerEnable(); static void compilerDisable(); +#endif /* IGNORE_DISABLE */ static bool_t compileClass(ClassClass *); static bool_t compileClasses(Hjava_lang_String *); static HObject *compilerCommand(HObject *); @@ -339,7 +342,7 @@ #endif - /* initialize the classes which is already loaded */ + /* initialize all classes already loaded */ if (!OPT_SETQ(OPT_DONTCMPLVMCLZ)) { ClassClass **clazzptr; int i; @@ -353,13 +356,34 @@ printf("%d classes is already loaded.\n", nbinclasses); fflush(stdout); #endif + + /* initialize */ for (i = nbinclasses, clazzptr = binclasses; --i >= 0; clazzptr++) { #ifdef COMPILE_DEBUG - printf("classes already in VM: %s\n", cbName(*clazzptr)); + printf("init. a class in VM: %x,%s\n", *clazzptr, cbName(*clazzptr)); fflush(stdout); #endif - initializeClass(*clazzptr); + initializeClassForJIT(*clazzptr); } + + if (OPT_SETQ(OPT_CMPLATLOAD)) { + /* compile */ + ClassClass **classes; + classes = (ClassClass **)sysMalloc(sizeof(ClassClass *) * nbinclasses); + memcpy(classes, binclasses, sizeof(ClassClass *) * nbinclasses); + + clazzptr = classes; + for (i = nbinclasses, clazzptr = classes; --i >= 0; clazzptr++) { +#ifdef COMPILE_DEBUG + printf("compile a class in VM: %x,%s\n", *clazzptr, cbName(*clazzptr)); + fflush(stdout); +#endif + compileClass(*clazzptr); + } + + sysFree(classes); + } + #if JDK_VER >= 12 BINCLASS_UNLOCK(sysThreadSelf()); #else @@ -401,7 +425,7 @@ /* set up link vector */ #if JDK_VER < 12 - *(char **)vector[1] = (char *)initializeClass; + *(char **)vector[1] = (char *)initializeClassHook; *(char **)vector[2] = (char *)sym_invokeJITCompiledMethod; *(char **)vector[3] = (char *)signalHandler; *(char **)vector[4] = (char *)freeClass; @@ -431,7 +455,7 @@ { JITInterface6 *ji6 = (JITInterface6 *)jitinterface; - *ji6->p_InitializeForCompiler = initializeClass; + *ji6->p_InitializeForCompiler = initializeClassHook; *ji6->p_invokeCompiledMethod = sym_invokeJITCompiledMethod; *ji6->p_CompiledCodeSignalHandler = signalHandler; *ji6->p_CompilerFreeClass = freeClass; @@ -550,13 +574,9 @@ /* * Initialize the class at the time one is loaded. */ -void initializeClass(ClassClass *cb) { +static void initializeClassForJIT(ClassClass *cb) { struct methodblock *mb; int mb_count; -#ifdef COMPILE_DEBUG - printf("initializeClass(%s) called.\n", cbName(cb)); - fflush(stdout); -#endif #ifdef METAVM /* force a loaded class to implement java.io.Serializable */ @@ -574,11 +594,6 @@ } #endif - if (OPT_SETQ(OPT_CMPLATLOAD)) { - compileClass(cb); - return; - } - mb = cbMethods(cb); mb_count = cbMethodsCount(cb); for (; mb_count-- > 0; mb++) { @@ -594,15 +609,30 @@ INITIALIZE_METHOD(mb); } +} + + +static void initializeClassHook(ClassClass *cb) { +#ifdef COMPILE_DEBUG + printf("initializeClassHook(%s) called.\n", cbName(cb)); + fflush(stdout); +#endif + + initializeClassForJIT(cb); + + if (OPT_SETQ(OPT_CMPLATLOAD)) { /* have to done after initialization */ + compileClass(cb); + } + #ifdef COMPILE_DEBUG - printf("initializeClass(%s) done.\n", cbName(cb)); + printf("initializeClassHook(%s) done.\n", cbName(cb)); fflush(stdout); #endif } /* - * Freeing class staffs related to the compiler. + * Freeing class stuffs related to the compiler. */ static void freeClass(ClassClass *cb) { struct methodblock *mb = cbMethods(cb); @@ -703,16 +733,6 @@ if (!(mb->CompiledCodeInfo)) prepareCompiledCodeInfo(EE(), mb); if (access & ACC_NATIVE) continue; - - if (!(mb->code)) { -#ifdef COMPILE_DEBUG - printf("mb->code is NULL: %s#%s %s\n", - cbName(mb->fb.clazz), mb->fb.name, mb->fb.signature); - fflush(stdout); -#endif - INITIALIZE_METHOD(mb); - continue; - } if (compileMethod(mb)) return FALSE; } diff -aruN shujit-0.4.1/txt/memo shujit/txt/memo --- shujit-0.4.1/txt/memo Mon Oct 18 01:58:43 1999 +++ shujit/txt/memo Mon Feb 21 20:09:35 2000 @@ -78,12 +78,12 @@ native と両立する? - 対象となるバイトコード命令。 (fadd, dadd, fsub, dsub,) fmul, dmul, fdiv, ddiv, frem, drem - frem, drem はどうすべき? + frem, drem は対象とせずともよい。precise に計算できるので。 - test suite が欲しい。 overflow, underflow およびそれに起因する 2度丸め。 - クラスが strictfp だった場合、コンストラクタが strictfp になるか確認。 - - javac ではいつでも strictfp にしてしまう? - JDK 1.2 pre-release 2 for Linux はだめ。 + - javac の strictfp 対応。 + Java 2 SDK 1.3 RC1 付属の javac (in tools.jar) でも対応していない。 - C, Fortran などで strictfp。 - 参考文献。 - Proving the IEEE Correctness of Iterative