diff -aruN shujit-0.2/ChangeLog shujit/ChangeLog --- shujit-0.2/ChangeLog Sat Sep 26 17:15:56 1998 +++ shujit/ChangeLog Mon Sep 28 19:43:16 1998 @@ -1,5 +1,17 @@ $Id$ +[19980928] + +FreeBSD で関数 fmod() のアドレスを解決できていなかったので、 +libc と同様に libm もあらかじめ sysAddDLSegment() しておくようにした。 +(compiler.c) + +[19980927] + +オプション dontcmplvmcls を用意。 +JIT 初期化時に既にロードされているクラスはコンパイルしない。 +(compiler.c, compiler.h) + [19980926] new 命令で、native code が自身を書き換える際のオフセット、 diff -aruN shujit-0.2/README shujit/README --- shujit-0.2/README Sat Sep 26 17:22:19 1998 +++ shujit/README Mon Sep 28 19:57:13 1998 @@ -1,6 +1,6 @@ shuJIT: JIT compiler for JDK/x86 http://www.shudo.net/shujit/ - Kazuyuki SHUDO + SHUDO Kazuyuki * Platforms @@ -64,4 +64,12 @@ * Thanks -Thanks all folks around me, especially my wife Mari. +Thanks all folks around me and the following people: + +MIURA Toshitaka (preparation of FreeBSD) +TANAKA Keishiro (testing on FreeBSD) +and my wife Mari. + + +SHUDO Kazuyuki/首藤一幸 私をたばねないで あらせいとうの花のように + shudoh@muraoka.info.waseda.ac.jp diff -aruN shujit-0.2/code.h shujit/code.h --- shujit-0.2/code.h Tue Sep 22 20:00:40 1998 +++ shujit/code.h Mon Sep 28 19:42:09 1998 @@ -52,14 +52,15 @@ /* * OS dependence */ -#ifndef WIN32 -# define _drem fmod -#endif #if defined(linux) || (defined(sun) && defined(__svr4__)) # define SYMBOL(SYM) STR(SYM) #elif defined(__FreeBSD__) # define SYMBOL(SYM) "_" STR(SYM) +#endif + +#ifndef WIN32 +# define _drem SYMBOL(fmod) #endif diff -aruN shujit-0.2/compiler.c shujit/compiler.c --- shujit-0.2/compiler.c Sat Sep 26 16:17:01 1998 +++ shujit/compiler.c Mon Sep 28 19:42:09 1998 @@ -23,6 +23,7 @@ int opt_quiet = 0; int opt_outcode = 0; int opt_codesize = 0; +int opt_dontcmplvmcls = 0; /* @@ -79,6 +80,8 @@ opt_outcode = 1; else if (!strncmp(opt, "codesize", 9)) opt_codesize = 1; + else if (!strncmp(opt, "dontcmplvmcls", 12)) + opt_dontcmplvmcls = 1; opt = strtok(NULL, ", "); } } @@ -113,27 +116,35 @@ /* initialization */ #ifdef __FreeBSD__ - /* to get addresses of functions in libc with sysDynamicLink() */ + /* to get addresses of functions in lib[cm] with sysDynamicLink() */ + /* libc for __divdi3, moddi3, printf, fflush */ if (!sysAddDLSegment("/usr/lib/libc.so.3.1")) { if (!sysAddDLSegment("/usr/lib/libc.so.3.0")) { - printf(" shuJIT can't find libc.so.3.1 or 3.0 on this system.\n" - " You must edit compiler.c and re-compile" - " if you use libc on your system.\n"); + printf("fatal: JIT compiler can't find libc.so.3.1 or 3.0.\n" + " You must edit compiler.c and re-compile" + " if you use libc on your system.\n"); sysExit(1); } } + /* libm for fmod */ + if (!sysAddDLSegment("/usr/lib/libm.so.2.0")) { + printf("fatal: JIT compiler can't find libm.so.2.0.\n" + " You must edit compiler.c and re-compile" + " if you use libc on your system.\n"); + sysExit(1); + } #endif #ifdef RESOLVE_SYMBOL_ON_CODE initFunctionSymbols(); #endif -#undef DONT_INITIALIZE_CLASSES_IN_JVM -#ifndef DONT_INITIALIZE_CLASSES_IN_JVM - BINCLASS_LOCK(); - { + /* compile the classes which is already loaded */ + if (!opt_dontcmplvmcls) { ClassClass **clazzptr; int i; + + BINCLASS_LOCK(); for (i = nbinclasses, clazzptr = binclasses; --i >= 0; clazzptr++) { #ifdef COMPILE_DEBUG printf("classes already in VM: %s\n", cbName(*clazzptr)); @@ -141,9 +152,8 @@ #endif initializeClass(*clazzptr); } + BINCLASS_UNLOCK(); } - BINCLASS_UNLOCK(); -#endif UseLosslessQuickOpcodes = FALSE; /* prohibit generating lossy opcodes */ diff -aruN shujit-0.2/compiler.h shujit/compiler.h --- shujit-0.2/compiler.h Sat Sep 26 17:27:09 1998 +++ shujit/compiler.h Sun Sep 27 14:17:07 1998 @@ -181,9 +181,14 @@ extern bool_t compiler_enabled; extern int opt_quiet; + /* suppress initial message and some outputs */ extern int opt_outcode; + /* write generated code to code__.s */ extern int opt_codesize; - + /* write code size of each methods to the file jit_codesize */ +extern int opt_dontcmplvmcls; + /* suppress compilation classes + which is already loaded when JIT is initialized */ /* * Global Functions diff -aruN shujit-0.2/runtime.c shujit/runtime.c --- shujit-0.2/runtime.c Fri Sep 25 17:55:25 1998 +++ shujit/runtime.c Sun Sep 27 14:08:05 1998 @@ -187,16 +187,18 @@ #ifdef EXECUTEJAVA_IN_ASM /* These operation is required with only x86 assembly ver. of executeJava.c */ - optop = cur_frame->optop; - if (retsize == 1) { - optop[0] = old_optop[-1]; optop++; + if (retsize != 0) { + optop = cur_frame->optop; + if (retsize == 1) { + optop[0] = old_optop[-1]; optop++; + } + else { /* retsize == 2 */ + optop[0] = old_optop[-2]; optop[1] = old_optop[-1]; optop += 2; + } + cur_frame->optop = optop; } - else if (retsize == 2) { - optop[0] = old_optop[-2]; optop[1] = old_optop[-1]; optop += 2; - } - cur_frame->optop = optop; #endif - } + } /* normal Java method */ #ifdef RUNTIME_DEBUG if (runtime_debug) {