diff -aruN shujit-0.7.10/ChangeLog shujit/ChangeLog --- shujit-0.7.10/ChangeLog Tue Dec 25 11:17:48 2001 +++ shujit/ChangeLog Wed Mar 13 14:00:24 2002 @@ -1,5 +1,78 @@ $Id$ +[20020313] + +FreeBSD JDK 1.3.1-p6 のシグナルまわりの問題に対する workaround ([20020312]) +が、configure で自動的に有効になるようにした。 +(configure.in, config.h.in) + +JIT 生成コードを包含するメモリ上の範囲を +compiledcode_min, compiledcode_max として保持するようにした。 +シグナルハンドラにて、プログラムカウンタがこの範囲に収まっていない場合、 +JIT 側で扱うべきではないので、ただちに return FALSE するようにした。 +ただし、SIGFPE の場合は JIT 生成コードの外 (__divdi3(), __moddi3()) で +発生したものも扱う必要があるので、return FALSE しない。 +(compile.c, compiler.h, signal.c) + +0.7.11 リリース。 + +[20020312] + +FreeBSD JDK 1.3.1 patchlevel 6 が、どこかで SIGTRAP を +sigprocmask(SIG_BLOCK, ...) してしまっている模様。 +この問題を回避するためのマクロ WORKAROUND_FOR_FREEBSD_131P6 を +compiler.h に用意。 +jEdit 3.2.2 が起動時に固まるという現象となって表れていた。 +再現するには、compiler.h にて METHOD_INLINING を #undef して、 +この回避策を無効化する。 +(runtime.c, compiler.h) + +[20020302] + +invocationHelper() (runtime.c) にて DIRECT_INV_NATIVE のコードで +ネイティブメソッドを呼び出した際、ネイティブメソッド中で例外が発生していても +EE()->current_frame->optop を増やしてしまっていた。 +例外が発生していない場合にのみ増やすように修整。 +(runtime.c) + +[20020301] + +invoker がどれかを判定する際に、invokeJNINativeMethod() の代替である +invoke_OII_I() などの custom invoker も、きちんと +invokeJNINativeMethod() であると判定するようにした。 +JIT 初期化時に、これら custom invoker のアドレスの最大値と最小値を取得し、 +判定時は invoker 関数のアドレスをこれらと比較するようにした。 +(compiler.c, compiler.h, runtime.c) + +[20020217] + +searchCatchFrame() (runtime.c) にて、 +Java スタックをクリアしてしまっていたのを止めた。 +つまり、ee->current_frame->optop = ee->current_frame->ostack を削除。 +この関数は、例外発生時だけでなく、末尾再帰かどうかの判定の際 +(makePCTable() (compile.c)) にも呼ばれる。 +その場合にはクリアしてしまうとまずい。 +Xindice 1.0rc1 (旧名 dbXML) で発覚。 +org.openorb.CORBA.Any#write_value のコンパイル中、 +inlining 対象である org.openorb.io.StreamHelper#copy_stream の +内部命令列を作る際、ある invokestatic が末尾再帰かどうか判定するために +searchCatchFrame() が呼ばれていた。 +(runtime.c) + +[20020118] + +configure.in を整形。 +libgdbm, libndbm を探すために、パスを指定したいがために AC_CHECK_PROG を +使っていたが、本来のライブラリ探しルーチン AC_CHECK_LIB を使うようにした。 +(configure.in) + +[20020116] + +シンボルのアドレスを探す際、FreeBSD, NetBSD だけでなく、 +Linux でも libjvm.so 中を明示的に探すようにした。 +Java Plugin で必要になった。 +(linker.c) + [20011225] 0.7.10 リリース。 diff -aruN shujit-0.7.10/README shujit/README --- shujit-0.7.10/README Tue Dec 25 10:59:13 2001 +++ shujit/README Wed Mar 13 13:49:34 2002 @@ -6,30 +6,29 @@ ShuJIT is a Java Just-in-Time compiler for Sun Microsystems' Classic VM (i.e. JDK, Java 2 SDK, JRE) and Intel x86 processors. -It supports Linux, FreeBSD and NetBSD. +It supports FreeBSD, Linux and NetBSD. * Platforms Working on the following platforms is confirmed. +- FreeBSD + - JDK 1.3.1 patchlevel 6, GCC 2.95.3 and FreeBSD 4.5-STABLE + - JDK 1.1.8 (ELF, V1999-11-9), GCC 2.95.3 and FreeBSD 4.5-STABLE + - Linux - - 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 + - Blackdown JDK 1.3.1_02a, GCC 3.1 20020307, glibc 2.2.4, Linux 2.4.19-pre2 + - Blackdown JDK 1.2.2, GCC 3.1 20020307, glibc 2.2.4 and Linux 2.4.19-pre2 + - JDK 1.1.8v3, GCC 3.1 20020307, glibc 2.2.4 and Linux 2.4.19-pre2 - 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 - * Installation With Java 2, you have to place the libshujit.so on -j2sdk1.X.X/jre/lib/i386/ or make a symbolic link in the -directory. +j2sdk1.X.X/jre/lib/i386/ or make a symbolic link in the path. -With JDK 1.1.X, copy the libshujit.so to the -path in LD_LIBRARY_PATH variable or the path on which -libjava.so exists +With JDK 1.1.X, copy the libshujit.so to the path in LD_LIBRARY_PATH +variable or the path on which libjava.so exists (ex. /usr/local/jdk1.1.8/lib/i686/green_threads/). * Run Java programs with shuJIT. @@ -45,12 +44,12 @@ * Compilation -You need the following tools to compile this JIT. +You need the following tools to compile shuJIT. -- JDK 1.1.X, 1.2.X or 1.3.X Classic VM - ShuJIT works with Sun's Classic VM of these JDK. +- JDK 1.3.X, 1.2.X or 1.1.X Classic VM + ShuJIT works with Sun's Classic VM which these JDKs have. Other JVMs, i.e. IBM JDK and HotSpot VMs, are not supported. -- GCC 2.9X, 3.0.1 or egcs +- GCC 3.X, 2.9X or egcs You can examine the version number of your GCC with -v option. % gcc -v GCC 2.7.X cannot compile shuJIT correctly. @@ -62,11 +61,13 @@ - GNU make 1. Run configure script. - % ./configure + % ./configure + If you want to use SSE2 instructions of Pentium 4 processor, type + % ./configure --enable-sse2 2. Type `make'. You will get libshujit.so - % make + % make Or, on FreeBSD systems - % gmake + % gmake Type `make debug' to obtain libshujit_g.so, which is for debugging. * Bugs and Problems @@ -83,16 +84,16 @@ * Thanks -Thanks all folks around me and the following people: +Thanks all folks around me and especially the following people: -OHARA Takuzo (compilation on FreeBSD) -TAKAHASHI Hideaki (bug report and debug) -TANAKA Keishiro (test on FreeBSD) -NEYAMA Ryo (test on Linux) -MIURA Toshitaka (preparation of FreeBSD) -KATO Jun'ya (preparation of FreeBSD) -MARUYAMA Fuyuhiko (discussion and code) -SHIMOKAWA Toshihiko (preparetion of FreeBSD) +Takuzo O'hara (compilation on FreeBSD) +Hideaki Takahashi (bug report and debug) +Keishiro Tanaka (test on FreeBSD) +Ryo Neyama (test on Linux) +Toshitaka Miura (preparation of FreeBSD) +Jun'ya Kato (preparation of FreeBSD) +Fuyuhiko Maruyama (discussion and code) +Toshihiko Shimokawa (preparetion of FreeBSD) and my wife Mari. diff -aruN shujit-0.7.10/code.c shujit/code.c --- shujit-0.7.10/code.c Fri Dec 7 14:53:15 2001 +++ shujit/code.c Wed Mar 13 14:04:21 2002 @@ -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 Kazuyuki Shudo + Copyright (C) 1998,1999,2000,2001,2002 Kazuyuki Shudo This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -155,10 +155,14 @@ # define OBJ_DEBUG(OBJ) \ if (runtime_debug) {\ DEBUG_IN;\ + OBJ_METHODTABLE(OBJ, %edi);\ + /*MT_CLASSDESCRIPTOR(%edi, %edi);*/\ + /*CB_NAME(%edi, %edi);*/\ + asm("pushl %edi");\ asm("pushl " #OBJ);\ - PUSH_CONSTSTR(" obj: 0x%08x\n");\ + PUSH_CONSTSTR(" obj: 0x%08x mt: 0x%08x\n");\ asm("call " SYMBOL(printf) "@PLT\n\t"\ - "addl $8,%esp");\ + "addl $12,%esp");\ FFLUSH;\ DEBUG_OUT;\ } @@ -5811,35 +5815,68 @@ "exc_handler_shift_1:\n\t" "cmpl $1,%ecx\n\t" // if (handler_state == 1) "jne exc_handler_shift_2\n\t" - "popl %edx\n\t" - "jmp exc_handler_shift_done\n\t" + "popl %edx"); +#ifdef RUNTIME_DEBUG + if (runtime_debug) { + DEBUG_IN; + asm("pushl %edx"); + PUSH_CONSTSTR(" st1 edx: %x\n"); + asm("call " SYMBOL(printf) "@PLT\n\t" + "addl $8,%esp"); + DEBUG_OUT; + } +#endif + asm("jmp exc_handler_shift_done\n\t" "exc_handler_shift_2:\n\t" "cmpl $3,%ecx\n\t" // if (handler_state == 3) "jne exc_handler_shift_3\n\t" - "popl %ecx\n\t" - "jmp exc_handler_shift_done\n\t" + "popl %ecx"); +#ifdef RUNTIME_DEBUG + if (runtime_debug) { + DEBUG_IN; + asm("pushl %ecx"); + PUSH_CONSTSTR(" st3 ecx: %x\n"); + asm("call " SYMBOL(printf) "@PLT\n\t" + "addl $8,%esp"); + FFLUSH; + DEBUG_OUT; + } +#endif + asm("jmp exc_handler_shift_done\n\t" "exc_handler_shift_3:\n\t" "cmpl $2,%ecx\n\t" // if (handler_stat == 2) "jne exc_handler_shift_4\n\t" "popl %ecx\n\t" - "xorl %edx,%edx\n\t" - "jmp exc_handler_shift_done\n\t" + "xorl %edx,%edx"); +#ifdef RUNTIME_DEBUG + if (runtime_debug) { + DEBUG_IN; + asm("pushl %ecx"); + PUSH_CONSTSTR(" st2 ecx: %x\n"); + asm("call " SYMBOL(printf) "@PLT\n\t" + "addl $8,%esp"); + FFLUSH; + DEBUG_OUT; + } +#endif + asm("jmp exc_handler_shift_done\n\t" "exc_handler_shift_4:\n\t" "cmpl $4,%ecx\n\t" // if (handler_stat == 4) "jne exc_handler_shift_done\n\t" "popl %edx\n\t" - "xorl %ecx,%ecx\n\t" - "exc_handler_shift_done:"); - + "xorl %ecx,%ecx"); #ifdef RUNTIME_DEBUG - DEBUG_IN; - asm("pushl %ecx\n\tpushl %edx"); - PUSH_CONSTSTR(" edx: %x, ecx: %x\n"); - asm("call " SYMBOL(printf) "@PLT\n\t" - "addl $12,%esp"); - FFLUSH; - DEBUG_OUT; + if (runtime_debug) { + DEBUG_IN; + asm("pushl %edx"); + PUSH_CONSTSTR(" st4 edx: %x\n"); + asm("call " SYMBOL(printf) "@PLT\n\t" + "addl $8,%esp"); + FFLUSH; + DEBUG_OUT; + } #endif + asm("exc_handler_shift_done:"); COMPILEDCODE(%edi); // edi = mb->CompiledCode asm("addl " CATCHFRAME_COMPILED_CATCHFRAME(%eax) ",%edi"); diff -aruN shujit-0.7.10/compile.c shujit/compile.c --- shujit-0.7.10/compile.c Sat Dec 1 19:32:24 2001 +++ shujit/compile.c Wed Mar 13 08:38:35 2002 @@ -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 Kazuyuki Shudo + Copyright (C) 1998,1999,2000,2001,2002 Kazuyuki Shudo This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,6 +43,12 @@ // +// Global Variables +// +unsigned char *compiledcode_min, *compiledcode_max; + + +// // Local Functions // static int makePCTable(CompilerContext *cc); @@ -151,6 +157,9 @@ if (acc & ACC_STRICT) printf(" strictfp"); printf("\n"); + printf(" nlocals: %d\n", mb->nlocals); + printf(" maxstack: %d\n", mb->maxstack); + # ifdef METAVM printf(" remote flag: 0x%x (%x)\n", GET_REMOTE_FLAG(cc->ee) & 0xff, EE()); printf(" remote addr: 0x%x\n", REMOTE_ADDR(cc->ee)); @@ -267,9 +276,14 @@ info->code_size = code_size; { - char *code = (void *)sysMalloc(code_size); + unsigned char *code = (void *)sysMalloc(code_size); memcpy(code, cc->buffer, code_size); mb->CompiledCode = code; + + if (code < compiledcode_min) + compiledcode_min = code; + if (compiledcode_max < (code + code_size)) + compiledcode_max = code + code_size; } #ifdef COMPILE_DEBUG if (compile_debug) { @@ -2908,6 +2922,9 @@ #ifdef COMPILE_DEBUG if (compile_debug) { + printf(" 0x%x %s#%s %s\n", method, + cbName(fieldclass(&method->fb)), + method->fb.name, method->fb.signature); printf(" offset in table: %d\n", method->fb.u.offset); fflush(stdout); } @@ -3063,7 +3080,9 @@ { struct methodblock *method; int32_t args_size; + sysAssert(operand != -1); + if (!CONSTANT_POOL_TYPE_TABLE_IS_RESOLVED(type_table, operand)) if (!ResolveClassConstantFromClass2( fieldclass(&mb->fb), operand, cc->ee, @@ -3072,8 +3091,10 @@ ret = 1; goto writecode_done; } + method = constant_pool[operand].mb; args_size = method->args_size; + #ifdef COMPILE_DEBUG if (compile_debug) { printf(" %s#%s %s\n", cbName(fieldclass(&method->fb)), diff -aruN shujit-0.7.10/compiler.c shujit/compiler.c --- shujit-0.7.10/compiler.c Fri Dec 7 11:27:16 2001 +++ shujit/compiler.c Tue Mar 12 17:56:13 2002 @@ -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 Kazuyuki Shudo + Copyright (C) 1998,1999,2000,2001,2002 Kazuyuki Shudo This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,12 +54,16 @@ // // Global Variables // -#if JDK_VER >= 12 +#if defined(linux) && (JDK_VER >= 12) extern int _JVM_native_threads; #endif sys_mon_t *global_monitor; +#if JDK_VER >= 12 +bool_t executejava_in_asm; +#endif + #ifndef IGNORE_DISABLE bool_t compiler_enabled = TRUE; #endif @@ -116,6 +120,9 @@ void *sym_invokeNativeMethod, *sym_invokeSynchronizedNativeMethod; void *sym_invokeJNINativeMethod, *sym_invokeJNISynchronizedNativeMethod; void *sym_invokeLazyNativeMethod; +#if JDK_VER >= 12 +uint32_t sym_invokeJNI_min, sym_invokeJNI_max; +#endif #ifdef CODE_DB # ifdef GDBM GDBM_FILE (*sym_dbm_open)(char *,int,int,int,void (*)()); @@ -172,7 +179,7 @@ #ifdef COMPILE_DEBUG printf("java_lang_Compiler_start() called.\n"); printf(" ee: 0x%x\n", ee); -# if JDK_VER >= 12 +# if defined(linux) && (JDK_VER >= 12) printf(" _JVM_native_threads: %s\n", _JVM_native_threads ? "true":"false"); # endif fflush(stdout); @@ -184,6 +191,31 @@ sysMonitorInit(global_monitor); +#if JDK_VER >= 12 + // judge whether interpreter (asm or C) is used +# ifdef DEBUG + executejava_in_asm = FALSE; +# else + if (pExecuteJava == ExecuteJava_C) + executejava_in_asm = FALSE; + else if (pExecuteJava == ExecuteJava) + executejava_in_asm = TRUE; + else { + printf("FATAL: could not determine whether interpreter is used, C version or asm version.\n"); + JVM_Exit(1); + } +# endif // DEBUG +#ifdef COMPILE_DEBUG + printf("interpreter: "); + if (executejava_in_asm) + printf("asm version.\n"); + else + printf("C version.\n"); + fflush(stdout); +#endif +#endif // JDK_VER + + #if JDK_VER < 12 // prevent unloading of java.lang.Compiler class { @@ -331,6 +363,7 @@ } #endif + // show credit if (!OPT_SETQ(OPT_QUIET)) { fprintf(stderr, CREDIT); @@ -371,6 +404,41 @@ RESOLVE_A_INVOKER(invokeJNISynchronizedNativeMethod); RESOLVE_A_INVOKER(invokeLazyNativeMethod); + +#if JDK_VER >= 12 + { + char *custom_invoker_names[] = { +// in TERSE_SIG_* (see include-old/signature.h) + "\x1\x8\x8\xb\x8", "\x1\x1\xb\x1", "\xb\x1", "\x1\x8\x8\xb\xa", + "\xb\x2", "\x1\x8\x1\x8\x8\xb\xa", "\x1\xb\x1", "\x3\xb\x3", + "\xb\xa", "\x8\x8\x8\x8\xb\xa", "\x1\xb\xa", "\x8\xb\xa", "\xb\x8", + "\xb\x4", NULL +// in string (see src/share/javavm/include/invokers.txt) +// "OII_I", "OO_O", "V_O", "OII_V", +// "V_J", "OIOII_V", "O_O", "D_D", +// "V_V", "IIII_V", "O_V", "I_V", "V_I", +// "V_Z", NULL + }; + uint32_t sym; + char *p; + int i; + + sym_invokeJNI_min = (uint32_t)-1; + sym_invokeJNI_max = 0; + + i = 0; + while (p = custom_invoker_names[i]) { + sym = (uint32_t)getCustomInvoker(p); + if (sym) { + if (sym > sym_invokeJNI_max) sym_invokeJNI_max = sym; + if (sym < sym_invokeJNI_min) sym_invokeJNI_min = sym; + } + i++; + } + } +#endif // JDK_VER + + #ifdef COMPILE_DEBUG # define SHOW_A_INVOKER(NAME) \ printf(" " #NAME ":\t0x%08x\n", (int)sym_##NAME) diff -aruN shujit-0.7.10/compiler.h shujit/compiler.h --- shujit-0.7.10/compiler.h Tue Dec 25 11:49:47 2001 +++ shujit/compiler.h Wed Mar 13 10:01:09 2002 @@ -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,2001 Kazuyuki Shudo + Copyright (C) 1996,1997,1998,1999,2000,2001,2002 Kazuyuki Shudo This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ #define _COMPILER_H_ -#define VERSION "0.7.10" +#define VERSION "0.7.11" #include "config.h" @@ -490,6 +490,10 @@ // in compiler.c extern sys_mon_t *global_monitor; +#if JDK_VER >= 12 +extern bool_t executejava_in_asm; +#endif + #ifndef IGNORE_DISABLE extern bool_t compiler_enabled; #endif // IGNORE_DISABLE @@ -501,6 +505,10 @@ extern ClassClass *classJavaLangNoSuchFieldError; extern ClassClass *classJavaLangNoSuchMethodError; +// in compile.c + +extern unsigned char *compiledcode_min, *compiledcode_max; + // in signal.c #if (defined(EXC_BY_SIGNAL) || defined(GET_SIGCONTEXT)) && defined(SEARCH_SIGCONTEXT) extern int sc_nest; @@ -588,6 +596,9 @@ extern void *sym_invokeJNINativeMethod; extern void *sym_invokeJNISynchronizedNativeMethod; extern void *sym_invokeLazyNativeMethod; +#if JDK_VER >= 12 +extern uint32_t sym_invokeJNI_min, sym_invokeJNI_max; +#endif #ifdef CODE_DB # ifdef GDBM extern GDBM_FILE (*sym_dbm_open)(char *,int,int,int,void (*)()); @@ -616,9 +627,6 @@ 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(GET_SIGCONTEXT) -extern void showSigcontext(SIGCONTEXT_T *sc); -#endif // EXC_BY_SIGNAL || GET_SIGCONTEXT // in code.c extern volatile void assembledCode( diff -aruN shujit-0.7.10/computil.c shujit/computil.c --- shujit-0.7.10/computil.c Thu Sep 20 20:30:49 2001 +++ shujit/computil.c Fri Mar 1 22:07:29 2002 @@ -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 Kazuyuki Shudo + Copyright (C) 1998,1999,2000,2001,2002 Kazuyuki Shudo This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -71,6 +71,12 @@ ELIF_A_INVOKER(invokeJNINativeMethod); ELIF_A_INVOKER(invokeJNISynchronizedNativeMethod); ELIF_A_INVOKER(invokeLazyNativeMethod); +#if JDK_VER >= 12 + else if (((uint32_t)inv >= sym_invokeJNI_min) && + ((uint32_t)inv <= sym_invokeJNI_max)) { + ret = ""; + } +#endif else ret = ""; return ret; diff -aruN shujit-0.7.10/config.h.in shujit/config.h.in --- shujit-0.7.10/config.h.in Tue Dec 25 11:36:44 2001 +++ shujit/config.h.in Wed Mar 13 07:15:48 2002 @@ -46,3 +46,6 @@ // defined if shuJIT is built to support MetaVM #undef METAVM #undef METAVM_NO_ARRAY + +// workaround for a bug of FreeBSD JDK 1.3.1 patchlevel 6 +#undef WORKAROUND_FOR_FREEBSD_131P6 diff -aruN shujit-0.7.10/configure shujit/configure --- shujit-0.7.10/configure Tue Dec 25 11:37:03 2001 +++ shujit/configure Wed Mar 13 12:31:53 2002 @@ -657,79 +657,108 @@ : else - # Extract the first word of "libgdbm.so", so it can be a program name with args. -set dummy libgdbm.so; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:664: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ac_libgdbm'+set}'`\" = set"; then + LIBS="$LIBS -L/usr/local/lib" + echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6 +echo "configure:663: checking for gdbm_open in -lgdbm" >&5 +ac_lib_var=`echo gdbm'_'gdbm_open | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ac_libgdbm"; then - ac_cv_prog_ac_libgdbm="$ac_libgdbm" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/local/lib:/usr/lib:/lib" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_ac_libgdbm="yes" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ac_libgdbm" && ac_cv_prog_ac_libgdbm="no" -fi -fi -ac_libgdbm="$ac_cv_prog_ac_libgdbm" -if test -n "$ac_libgdbm"; then - echo "$ac_t""$ac_libgdbm" 1>&6 + ac_save_LIBS="$LIBS" +LIBS="-lgdbm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" else - echo "$ac_t""no" 1>&6 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" fi +rm -f conftest* +LIBS="$ac_save_LIBS" - if test "$ac_libgdbm" = "yes"; then - cat >> confdefs.h <<\EOF +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + ac_libgdbm=yes + cat >> confdefs.h <<\EOF #define GDBM 1 EOF - else - ac_libgdbm= - # Extract the first word of "libndbm.so", so it can be a program name with args. -set dummy libndbm.so; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:701: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_ac_libndbm'+set}'`\" = set"; then + +else + echo "$ac_t""no" 1>&6 + + ac_libgdbm= + echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6 +echo "configure:709: checking for dbm_open in -lndbm" >&5 +ac_lib_var=`echo ndbm'_'dbm_open | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$ac_libndbm"; then - ac_cv_prog_ac_libndbm="$ac_libndbm" # Let the user override the test. + ac_save_LIBS="$LIBS" +LIBS="-lndbm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/local/lib:/usr/lib:/lib" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_ac_libndbm="yes" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_ac_libndbm" && ac_cv_prog_ac_libndbm="no" + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" fi +rm -f conftest* +LIBS="$ac_save_LIBS" + fi -ac_libndbm="$ac_cv_prog_ac_libndbm" -if test -n "$ac_libndbm"; then - echo "$ac_t""$ac_libndbm" 1>&6 +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + + ac_libndbm=yes + cat >> confdefs.h <<\EOF +#define NDBM 1 +EOF + + else echo "$ac_t""no" 1>&6 + + ac_libndbm= + ac_libndbm=yes + fi - if test "$ac_libndbm" != "yes"; then - ac_libndbm=yes - fi - fi - ac_codedb=yes - cat >> confdefs.h <<\EOF + +fi + + ac_codedb=yes + cat >> confdefs.h <<\EOF #define CODE_DB 1 EOF @@ -744,8 +773,8 @@ if test "${enable_sse2+set}" = set; then enableval="$enable_sse2" - ac_sse2=yes - cat >> confdefs.h <<\EOF + ac_sse2=yes + cat >> confdefs.h <<\EOF #define USE_SSE2 1 EOF @@ -759,8 +788,8 @@ if test "${enable_moba+set}" = set; then enableval="$enable_moba" - ac_moba=yes - cat >> confdefs.h <<\EOF + ac_moba=yes + cat >> confdefs.h <<\EOF #define MOBA 1 EOF @@ -774,13 +803,13 @@ if test "${enable_metavm_no_array+set}" = set; then enableval="$enable_metavm_no_array" - ac_metavm=yes - ac_metavm_no_array=yes - cat >> confdefs.h <<\EOF + ac_metavm=yes + ac_metavm_no_array=yes + cat >> confdefs.h <<\EOF #define METAVM 1 EOF - cat >> confdefs.h <<\EOF + cat >> confdefs.h <<\EOF #define METAVM_NO_ARRAY 1 EOF @@ -793,8 +822,8 @@ if test "${enable_metavm+set}" = set; then enableval="$enable_metavm" - ac_metavm=yes - cat >> confdefs.h <<\EOF + ac_metavm=yes + cat >> confdefs.h <<\EOF #define METAVM 1 EOF @@ -806,7 +835,7 @@ echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:810: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:839: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -833,7 +862,7 @@ fi echo $ac_n "checking C compiler""... $ac_c" 1>&6 -echo "configure:837: checking C compiler" >&5 +echo "configure:866: checking C compiler" >&5 ac_cc=no if test -n "$CC"; then if test -f "$CC"; then @@ -842,7 +871,7 @@ # Extract the first word of "$CC", so it can be a program name with args. set dummy $CC; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:846: checking for $ac_word" >&5 +echo "configure:875: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -883,7 +912,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:887: checking for $ac_word" >&5 +echo "configure:916: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -937,7 +966,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:941: checking for $ac_word" >&5 +echo "configure:970: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_objdump'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -975,12 +1004,12 @@ if test "$ac_ruby" = no; then - { echo "configure: error: Compilation needs objdump (provided by GNU binutils)." 1>&2; exit 1; } + { echo "configure: error: Objdump (provided by GNU binutils) is required." 1>&2; exit 1; } fi # Extract the first word of "ruby", so it can be a program name with args. set dummy ruby; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:984: checking for $ac_word" >&5 +echo "configure:1013: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_ruby'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1014,13 +1043,13 @@ fi if test "$ac_ruby" = no; then - { echo "configure: error: Compilation needs ruby (see http://www.ruby-lang.org/)." 1>&2; exit 1; } + { echo "configure: error: Ruby (see http://www.ruby-lang.org/) is required." 1>&2; exit 1; } fi # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1024: checking for $ac_word" >&5 +echo "configure:1053: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_strip'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1057,7 +1086,7 @@ # Extract the first word of "ci", so it can be a program name with args. set dummy ci; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1061: checking for $ac_word" >&5 +echo "configure:1090: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_ci'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1094,7 +1123,7 @@ # Extract the first word of "co", so it can be a program name with args. set dummy co; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1098: checking for $ac_word" >&5 +echo "configure:1127: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_co'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1131,7 +1160,7 @@ # Extract the first word of "mv", so it can be a program name with args. set dummy mv; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1135: checking for $ac_word" >&5 +echo "configure:1164: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_mv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1168,7 +1197,7 @@ # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1172: checking for $ac_word" >&5 +echo "configure:1201: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_rm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1205,7 +1234,7 @@ # Extract the first word of "wc", so it can be a program name with args. set dummy wc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1209: checking for $ac_word" >&5 +echo "configure:1238: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_wc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1242,7 +1271,7 @@ # Extract the first word of "etags", so it can be a program name with args. set dummy etags; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1246: checking for $ac_word" >&5 +echo "configure:1275: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_etags'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1280,7 +1309,7 @@ # Extract the first word of "which", so it can be a program name with args. set dummy which; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1284: checking for $ac_word" >&5 +echo "configure:1313: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_which'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1318,7 +1347,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1322: checking for $ac_word" >&5 +echo "configure:1351: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_grep'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1357,7 +1386,7 @@ # Extract the first word of "sed", so it can be a program name with args. set dummy sed; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1361: checking for $ac_word" >&5 +echo "configure:1390: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_sed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1395,7 +1424,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1399: checking for $ac_word" >&5 +echo "configure:1428: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1427,7 +1456,7 @@ echo $ac_n "checking version of gcc""... $ac_c" 1>&6 -echo "configure:1431: checking version of gcc" >&5 +echo "configure:1460: checking version of gcc" >&5 ac_gccver_string=`$ac_cc -v 2>&1 | $ac_grep 'gcc version'` case `echo $ac_gccver_string | $AWK '{print $3}' | $ac_sed 's/.*-//'` in [3-9].*) @@ -1447,7 +1476,7 @@ ac_gccver=291 ;; 2.7*|2.6*|2.5*|2.4*) - echo "$ac_t""gcc <= 2.7" 1>&6 + echo "$ac_t""gcc <= 2.7" 1>&6 ac_gccver=270 ;; *) @@ -1467,7 +1496,7 @@ echo $ac_n "checking install path of JDK""... $ac_c" 1>&6 -echo "configure:1471: checking install path of JDK" >&5 +echo "configure:1500: checking install path of JDK" >&5 # Check whether --with-jdk or --without-jdk was given. if test "${with_jdk+set}" = set; then withval="$with_jdk" @@ -1485,7 +1514,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1489: checking for $ac_word" >&5 +echo "configure:1518: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_java'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1528,7 +1557,7 @@ # Extract the first word of "javac", so it can be a program name with args. set dummy javac; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1532: checking for $ac_word" >&5 +echo "configure:1561: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_javac'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1565,7 +1594,7 @@ # Extract the first word of "javah", so it can be a program name with args. set dummy javah; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1569: checking for $ac_word" >&5 +echo "configure:1598: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_javah'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1602,7 +1631,7 @@ # Extract the first word of "jar", so it can be a program name with args. set dummy jar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1606: checking for $ac_word" >&5 +echo "configure:1635: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_jar'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1639,7 +1668,7 @@ # Extract the first word of "javadoc", so it can be a program name with args. set dummy javadoc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1643: checking for $ac_word" >&5 +echo "configure:1672: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ac_javadoc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1675,8 +1704,8 @@ echo $ac_n "checking version of JDK""... $ac_c" 1>&6 -echo "configure:1679: checking version of JDK" >&5 -ac_jver_string=`$ac_java -Djava.compiler= -version 2>&1` +echo "configure:1708: checking version of JDK" >&5 +ac_jver_string=`$ac_java -Djava.compiler= -version 2>&1 | $ac_grep 'version'` case "$ac_jver_string" in *\"1.1*) ac_jver=11 @@ -1689,6 +1718,21 @@ *\"1.3*) ac_jver=12 echo "$ac_t""JDK 1.3" 1>&6 + + case $host_os in + freebsd*) + case $ac_jver_string in + *\"1.3.1-p6\") + echo "$ac_t""a workaround for a problem of FreeBSD JDK 1.3.1-p6 enabled" 1>&6 + cat >> confdefs.h <<\EOF +#define WORKAROUND_FOR_FREEBSD_131P6 1 +EOF + + ;; + esac + ;; + esac + ;; *) { echo "configure: error: unrecognized." 1>&2; exit 1; } @@ -1727,30 +1771,30 @@ echo $ac_n "checking asm or C, which version of interpreter is used""... $ac_c" 1>&6 -echo "configure:1731: checking asm or C, which version of interpreter is used" >&5 +echo "configure:1775: checking asm or C, which version of interpreter is used" >&5 # Check whether --enable-c-interpreter or --disable-c-interpreter was given. if test "${enable_c_interpreter+set}" = set; then enableval="$enable_c_interpreter" - ac_executejava_in_asm=no + ac_executejava_in_asm=no else - ac_executejava_in_asm=yes - case "$host_os" in - netbsd*) - ac_executejava_in_asm=no - ;; - freebsd*) - ac_jver_string=`$ac_java -Djava.compiler= -fullversion 2>&1` - ac_jver_string=`echo $ac_jver_string | sed 's+.*:\([0-9]*\)/\([0-9]*\)/.*+\1/\2+'` - echo -n "(date: $ac_jver_string) " - case "$ac_jver_string" in - 1998/*|1999/3|1999/4|1999/6|1999/7) - ac_executejava_in_asm=no - esac - ;; - esac + ac_executejava_in_asm=yes + case "$host_os" in + netbsd*) + ac_executejava_in_asm=no + ;; + freebsd*) + ac_jver_string=`$ac_java -Djava.compiler= -fullversion 2>&1` + ac_jver_string=`echo $ac_jver_string | sed 's+.*:\([0-9]*\)/\([0-9]*\)/.*+\1/\2+'` + echo -n "(date: $ac_jver_string) " + case "$ac_jver_string" in + 1998/*|1999/3|1999/4|1999/6|1999/7) + ac_executejava_in_asm=no + esac + ;; + esac fi @@ -1767,9 +1811,9 @@ echo $ac_n "checking version of libc""... $ac_c" 1>&6 -echo "configure:1771: checking version of libc" >&5 +echo "configure:1815: checking version of libc" >&5 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1773: checking how to run the C preprocessor" >&5 +echo "configure:1817: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1784,13 +1828,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1794: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1838: \"$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 : @@ -1801,13 +1845,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1855: \"$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 : @@ -1818,13 +1862,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1828: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1872: \"$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 : @@ -1849,11 +1893,11 @@ echo "$ac_t""$CPP" 1>&6 cat > conftest.$ac_ext < - version of glibc is __GLIBC__ + #include + version of glibc is __GLIBC__ EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | @@ -1874,21 +1918,21 @@ fi echo $ac_n "checking POSIX.1b Scheduling Interface""... $ac_c" 1>&6 -echo "configure:1878: checking POSIX.1b Scheduling Interface" >&5 +echo "configure:1922: checking POSIX.1b Scheduling Interface" >&5 ac_posix_sched= ac_safe=`echo "sched.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sched.h""... $ac_c" 1>&6 -echo "configure:1882: checking for sched.h" >&5 +echo "configure:1926: checking for sched.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:1892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1936: \"$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* @@ -1905,13 +1949,13 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 - echo $ac_n "checking for sched_setscheduler""... $ac_c" 1>&6 -echo "configure:1910: checking for sched_setscheduler" >&5 + echo $ac_n "checking for sched_setscheduler""... $ac_c" 1>&6 +echo "configure:1954: checking for sched_setscheduler" >&5 if eval "test \"`echo '$''{'ac_cv_func_sched_setscheduler'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_sched_setscheduler=yes" else @@ -1949,12 +1993,12 @@ if eval "test \"`echo '$ac_cv_func_'sched_setscheduler`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_posix_sched=yes - cat >> confdefs.h <<\EOF + ac_posix_sched=yes + cat >> confdefs.h <<\EOF #define HAVE_POSIX_SCHED 1 EOF - + else echo "$ac_t""no" 1>&6 fi @@ -1968,20 +2012,20 @@ echo $ac_n "checking whether the header exists""... $ac_c" 1>&6 -echo "configure:1972: checking whether the header exists" >&5 +echo "configure:2016: checking whether the header exists" >&5 ac_safe=`echo "stdint.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for stdint.h""... $ac_c" 1>&6 -echo "configure:1975: checking for stdint.h" >&5 +echo "configure:2019: checking for stdint.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:1985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2029: \"$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* @@ -1998,7 +2042,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF + cat >> confdefs.h <<\EOF #define HAVE_STDINT_H 1 EOF @@ -2009,20 +2053,20 @@ echo $ac_n "checking whether the header exists""... $ac_c" 1>&6 -echo "configure:2013: checking whether the header exists" >&5 +echo "configure:2057: 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 +echo "configure:2060: 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; } +{ (eval echo configure:2070: \"$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* @@ -2039,7 +2083,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF + cat >> confdefs.h <<\EOF #define HAVE_SYS_TYPES_H 1 EOF @@ -2050,7 +2094,7 @@ echo $ac_n "checking type of an argument of monitorEnter()""... $ac_c" 1>&6 -echo "configure:2054: checking type of an argument of monitorEnter()" >&5 +echo "configure:2098: 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:2063: checking whether the header exists" >&5 +echo "configure:2107: 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 @@ -2071,7 +2115,7 @@ fi echo $ac_n "checking whether the JDK_HOME/include/green_threads directory exists""... $ac_c" 1>&6 -echo "configure:2075: checking whether the JDK_HOME/include/green_threads directory exists" >&5 +echo "configure:2119: 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 @@ -2232,9 +2276,8 @@ s%@build_cpu@%$build_cpu%g s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g -s%@ac_libgdbm@%$ac_libgdbm%g -s%@ac_libndbm@%$ac_libndbm%g s%@ac_codedb@%$ac_codedb%g +s%@ac_libgdbm@%$ac_libgdbm%g s%@ac_sse2@%$ac_sse2%g s%@ac_moba@%$ac_moba%g s%@ac_metavm@%$ac_metavm%g diff -aruN shujit-0.7.10/configure.in shujit/configure.in --- shujit-0.7.10/configure.in Tue Dec 25 11:35:05 2001 +++ shujit/configure.in Wed Mar 13 12:31:46 2002 @@ -1,3 +1,5 @@ +dnl Process this file with autoconf to produce a configure script for shuJIT + AC_INIT(compiler.c) AC_CONFIG_HEADER(config.h) @@ -10,21 +12,29 @@ [ --disable-codedb disable code DB ], [], [ - AC_CHECK_PROG(ac_libgdbm, libgdbm.so, yes, no, /usr/local/lib:/usr/lib:/lib) - if test "$ac_libgdbm" = "yes"; then - AC_DEFINE(GDBM) - else - ac_libgdbm= - AC_CHECK_PROG(ac_libndbm, libndbm.so, yes, no,/usr/local/lib:/usr/lib:/lib) - if test "$ac_libndbm" != "yes"; then - dnl AC_MSG_ERROR(could find neither gdbm nor ndbm) - dnl default is NDBM - ac_libndbm=yes - dnl AC_DEFINE(GDBM) - fi - fi - ac_codedb=yes - AC_DEFINE(CODE_DB) + LIBS="$LIBS -L/usr/local/lib" + AC_CHECK_LIB(gdbm, gdbm_open, + [ + ac_libgdbm=yes + AC_DEFINE(GDBM) + ], + [ + ac_libgdbm= + AC_CHECK_LIB(ndbm, dbm_open, + [ + ac_libndbm=yes + AC_DEFINE(NDBM) + ], + [ + ac_libndbm= + dnl AC_MSG_ERROR(could find neither gdbm nor ndbm) + dnl default is NDBM + ac_libndbm=yes + dnl AC_DEFINE(GDBM) + ]) + ]) + ac_codedb=yes + AC_DEFINE(CODE_DB) ]) AC_SUBST(ac_codedb) AC_SUBST(ac_libgdbm) @@ -34,8 +44,8 @@ [ --enable-sse2 use SSE2 instructions instead of x87 ], [ - ac_sse2=yes - AC_DEFINE(USE_SSE2) + ac_sse2=yes + AC_DEFINE(USE_SSE2) ], []) AC_SUBST(ac_sse2) @@ -45,8 +55,8 @@ [ --enable-moba support thread migration ], [ - ac_moba=yes - AC_DEFINE(MOBA) + ac_moba=yes + AC_DEFINE(MOBA) ], []) AC_SUBST(ac_moba) @@ -56,17 +66,17 @@ [ --enable-metavm-no-array enable MetaVM and arrays are passed by value ], [ - ac_metavm=yes - ac_metavm_no_array=yes - AC_DEFINE(METAVM) - AC_DEFINE(METAVM_NO_ARRAY) + ac_metavm=yes + ac_metavm_no_array=yes + AC_DEFINE(METAVM) + AC_DEFINE(METAVM_NO_ARRAY) ], [ ac_metavm_no_array= ]) AC_ARG_ENABLE(metavm, [ --enable-metavm enable MetaVM ], [ - ac_metavm=yes - AC_DEFINE(METAVM) + ac_metavm=yes + AC_DEFINE(METAVM) ]) AC_SUBST(ac_metavm) AC_SUBST(ac_metavm_no_array) @@ -101,11 +111,11 @@ AC_PATH_PROGS(ac_objdump, objdump, no) AC_SUBST(ac_objdump) if test "$ac_ruby" = no; then - AC_MSG_ERROR(Compilation needs objdump (provided by GNU binutils).) + AC_MSG_ERROR(Objdump (provided by GNU binutils) is required.) fi AC_PATH_PROG(ac_ruby, ruby, no) if test "$ac_ruby" = no; then - AC_MSG_ERROR(Compilation needs ruby (see http://www.ruby-lang.org/).) + AC_MSG_ERROR(Ruby (see http://www.ruby-lang.org/) is required.) fi AC_SUBST(ac_ruby) AC_PATH_PROG(ac_strip, strip, no) @@ -151,6 +161,7 @@ ac_gccver=291 ;; 2.7*|2.6*|2.5*|2.4*) + dnl AC_MSG_ERROR(GCC 2.95 or newer is required.) AC_MSG_RESULT(gcc <= 2.7) ac_gccver=270 ;; @@ -188,7 +199,7 @@ AC_SUBST(ac_javadoc) AC_MSG_CHECKING(version of JDK) -ac_jver_string=`$ac_java -Djava.compiler= -version 2>&1` +ac_jver_string=`$ac_java -Djava.compiler= -version 2>&1 | $ac_grep 'version'` case "$ac_jver_string" in *\"1.1*) ac_jver=11 @@ -201,6 +212,19 @@ *\"1.3*) ac_jver=12 AC_MSG_RESULT(JDK 1.3) + + case $host_os in + freebsd*) + case $ac_jver_string in + *\"1.3.1-p6\") +dnl shold be `1.3.1-p*' ? + AC_MSG_RESULT(a workaround for a problem of FreeBSD JDK 1.3.1-p6 enabled) + AC_DEFINE(WORKAROUND_FOR_FREEBSD_131P6) + ;; + esac + ;; + esac + ;; *) AC_MSG_ERROR(unrecognized.) @@ -239,26 +263,26 @@ AC_ARG_ENABLE(c-interpreter, [ --enable-c-interpreter the JDK uses C version of interpreter ], [ - ac_executejava_in_asm=no + ac_executejava_in_asm=no ], [ - ac_executejava_in_asm=yes - case "$host_os" in - netbsd*) - ac_executejava_in_asm=no - ;; - freebsd*) - ac_jver_string=`$ac_java -Djava.compiler= -fullversion 2>&1` + ac_executejava_in_asm=yes + case "$host_os" in + netbsd*) + ac_executejava_in_asm=no + ;; + freebsd*) + ac_jver_string=`$ac_java -Djava.compiler= -fullversion 2>&1` changequote(, )dnl - ac_jver_string=`echo $ac_jver_string | sed 's+.*:\([0-9]*\)/\([0-9]*\)/.*+\1/\2+'` + ac_jver_string=`echo $ac_jver_string | sed 's+.*:\([0-9]*\)/\([0-9]*\)/.*+\1/\2+'` changequote([, ])dnl - echo -n "(date: $ac_jver_string) " - case "$ac_jver_string" in - 1998/*|1999/3|1999/4|1999/6|1999/7) - ac_executejava_in_asm=no - esac - ;; - esac + echo -n "(date: $ac_jver_string) " + case "$ac_jver_string" in + 1998/*|1999/3|1999/4|1999/6|1999/7) + ac_executejava_in_asm=no + esac + ;; + esac ]) if test "$ac_executejava_in_asm" = "yes"; then AC_MSG_RESULT(assembly code version) @@ -273,8 +297,8 @@ AC_MSG_CHECKING(version of libc) AC_EGREP_CPP(version of glibc is 2, [ - #include - version of glibc is __GLIBC__ + #include + version of glibc is __GLIBC__ ], ac_glibc2=yes) if test "$ac_glibc2" = "yes"; then @@ -288,11 +312,11 @@ ac_posix_sched= AC_CHECK_HEADER(sched.h, [ - AC_CHECK_FUNC(sched_setscheduler, - [ - ac_posix_sched=yes - AC_DEFINE(HAVE_POSIX_SCHED) - ]) + AC_CHECK_FUNC(sched_setscheduler, + [ + ac_posix_sched=yes + AC_DEFINE(HAVE_POSIX_SCHED) + ]) ]) @@ -301,13 +325,13 @@ AC_MSG_CHECKING(whether the header exists) AC_CHECK_HEADER(stdint.h, [ - AC_DEFINE(HAVE_STDINT_H) + 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_DEFINE(HAVE_SYS_TYPES_H) ]) AC_MSG_CHECKING(type of an argument of monitorEnter()) diff -aruN shujit-0.7.10/invoker.c shujit/invoker.c --- shujit-0.7.10/invoker.c Fri Dec 7 15:21:51 2001 +++ shujit/invoker.c Wed Mar 13 09:08:26 2002 @@ -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 Kazuyuki Shudo + Copyright (C) 1998,1999,2000,2001,2002 Kazuyuki Shudo This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -120,8 +120,10 @@ #ifdef COMPILE_DEBUG if (invoker != sym_compileAndInvokeMethod) printf(" the method is being compiled now.\n"); +# ifndef IGNORE_DISABLE else if (!compiler_enabled) printf(" compiler disabled.\n"); +# endif #endif SYS_MONITOR_EXIT(self, mon); goto candi_call_normal_method; @@ -268,33 +270,39 @@ } #ifdef EXECUTEJAVA_IN_ASM - // This operation is required - // only with x86 assembly ver. of executeJava.c - retsize = ((CodeInfo *)mb->CompiledCodeInfo)->ret_size; - if (retsize != 0) { - optop = cur_frame->optop; - if (retsize == 1) { - optop[0] = old_optop[-1]; +#if JDK_VER >= 12 + if (executejava_in_asm) { +#endif + // This operation is required + // only with x86 assembly ver. of executeJava.c + retsize = ((CodeInfo *)mb->CompiledCodeInfo)->ret_size; + if (retsize != 0) { + optop = cur_frame->optop; + if (retsize == 1) { + optop[0] = old_optop[-1]; # ifdef RUNTIME_DEBUG - if (runtime_debug) { - printf(" optop[0]: %08x\n", optop[0].i); - fflush(stdout); - } + if (runtime_debug) { + printf(" optop[0]: %08x\n", optop[0].i); + fflush(stdout); + } # endif - optop++; - } - else { // retsize == 2 - optop[0] = old_optop[-2]; optop[1] = old_optop[-1]; -# ifdef RUNTIME_DEBUG - if (runtime_debug) { - printf(" optop[0,1]: %08x,%08x\n", optop[0].i, optop[1].i); - fflush(stdout); + optop++; } + else { // retsize == 2 + optop[0] = old_optop[-2]; optop[1] = old_optop[-1]; +# ifdef RUNTIME_DEBUG + if (runtime_debug) { + printf(" optop[0,1]: %08x,%08x\n", optop[0].i, optop[1].i); + fflush(stdout); + } # endif - optop += 2; - } - cur_frame->optop = optop; - } // if (retsize != 0) + optop += 2; + } + cur_frame->optop = optop; + } // if (retsize != 0) +#if JDK_VER >= 12 + } // if (executejava_in_asm) +#endif #endif // EXECUTEJAVA_IN_ASM } // normal Java method @@ -539,7 +547,7 @@ if (!mb) return FALSE; -#if 1 +#if 0 if ((!strcmp(cbName(fieldclass(&mb->fb)), "java/lang/Compiler"))) debugp = TRUE; else if ((!strcmp(cbName(fieldclass(&mb->fb)), "java/lang/Object")) @@ -561,6 +569,17 @@ else if ((!strcmp(cbName(fieldclass(&mb->fb)), "NET/shudo/metavm/Skeleton"))) debugp = TRUE; #endif +#if 0 + else if ((!strcmp(cbName(fieldclass(&mb->fb)), "org/openorb/CORBA/Any")) + && (!strcmp(mb->fb.name, "write_value") || + !strncmp(mb->fb.name, "insert_", 7) || + !strcmp(mb->fb.name, "type") || + !strcmp(mb->fb.name, ""))) + debugp = TRUE; + else if ((!strcmp(cbName(fieldclass(&mb->fb)), "org/openorb/io/StreamHelper")) + && (!strcmp(mb->fb.name, "copy_stream"))) + debugp = TRUE; +#endif # if 0 else if (!strcmp(mb->fb.name, "main")) debugp = TRUE; diff -aruN shujit-0.7.10/linker.c shujit/linker.c --- shujit-0.7.10/linker.c Sat Sep 1 23:10:21 2001 +++ shujit/linker.c Fri Mar 1 21:18:57 2002 @@ -2,7 +2,7 @@ This file is part of shuJIT, Just In Time compiler for Sun Java Virtual Machine. - Copyright (C) 1999,2000 Kazuyuki Shudo + Copyright (C) 1999,2000,2002 Kazuyuki Shudo This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -106,8 +106,10 @@ SEARCH_LIB("java", "", java_handle); SEARCH_LIB(JIT_LIB_NAME, "", jit_handle); -#if (defined(__FreeBSD__) || defined(__NetBSD__))&& (JDK_VER >= 12) +#if JDK_VER >= 12 SEARCH_LIB("jvm", "classic/", jvm_handle); + // FreeBSD always need search through libjvm.so. + // Linux needs this only for Java Plugin. #endif } diff -aruN shujit-0.7.10/runtime.c shujit/runtime.c --- shujit-0.7.10/runtime.c Fri Dec 7 15:03:46 2001 +++ shujit/runtime.c Wed Mar 13 08:25:55 2002 @@ -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 Kazuyuki Shudo + Copyright (C) 1998,1999,2000,2001,2002 Kazuyuki Shudo This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -185,7 +185,12 @@ #ifdef DIRECT_INV_NATIVE if ((invoker == sym_invokeJNINativeMethod) || - (invoker == sym_invokeJNISynchronizedNativeMethod)) { + (invoker == sym_invokeJNISynchronizedNativeMethod) +# if JDK_VER >= 12 + || (((uint32_t)invoker >= sym_invokeJNI_min) && + ((uint32_t)invoker <= sym_invokeJNI_max)) +# endif + ) { // JNI native method JavaFrame *old_frame, *frame; stack_item *optop; @@ -524,7 +529,7 @@ { register stack_item *eax asm("%eax"); - old_frame->optop = eax; + optop = eax; } ee->current_frame = old_frame; @@ -539,8 +544,11 @@ fflush(stdout); } #endif - if (!exceptionOccurred(ee)) + if (!exceptionOccurred(ee)) { + old_frame->optop = optop; + // update frame->optop only in case that an exception occurred goto invhelper_finish; + } goto invhelper_return; } #endif // DIRECT_INV_NATIVE @@ -728,7 +736,7 @@ { register stack_item *eax asm("%eax"); - old_frame->optop = eax; + optop = eax; } #if 0 ee->current_frame = old_frame; @@ -745,8 +753,11 @@ fflush(stdout); } #endif - if (!exceptionOccurred(ee)) + if (!exceptionOccurred(ee)) { + old_frame->optop = optop; + // update frame->optop only in case that an exception occurred goto invhelper_finish; + } goto invhelper_return; } else @@ -768,6 +779,16 @@ argsizes++; } +#if defined(WORKAROUND_FOR_FREEBSD_131P6) && (JDK_VER >= 12) && (defined(__FreeBSD__) || defined(__NetBSD__)) + // unblock SIGTRAP to get around a problem of FreeBSD JDK 1.3.1-p6 + { + sigset_t set; + sigemptyset(&set); + sigaddset(&set, SIGTRAP); + sigprocmask(SIG_UNBLOCK, &set, NULL); + } +#endif + CALL_INVOKER; if ((invoker == sym_invokeJavaMethod) || @@ -824,20 +845,28 @@ } #ifdef EXECUTEJAVA_IN_ASM - // This operation is required - // only with x86 assembly ver. of executeJava.c - { - stack_item *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; +#if JDK_VER >= 12 + if (executejava_in_asm) { +#endif + // This operation is required + // only with x86 assembly ver. of executeJava.c + { + stack_item *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; } - cur_frame->optop = optop; } - } +#if JDK_VER >= 12 + } // if (executejava_in_asm) #endif +#endif // EXECUTEJAVA_IN_ASM } // normal Java method } // normal Java or native method or compileAndInvokeMethod() @@ -1223,9 +1252,6 @@ #endif exceptionClear(ee); - // clear stack - ee->current_frame->optop = ee->current_frame->ostack; - return cf; } else { @@ -1258,25 +1284,34 @@ printf(" %s#%s %s 0x%x ", cbName(fieldclass(&frameMb->fb)), frameMb->fb.name, frameMb->fb.signature, (int)frameMb); fflush(stdout); - if (frame->lastpc) - printf("pc: %d", frame->lastpc - frameMb->code); - fflush(stdout); - if (frameMb->invoker == sym_invokeJITCompiledMethod) - printf(" (compiled)"); + if (frameMb->invoker == sym_invokeJITCompiledMethod) { + if (frame->lastpc) + printf("pc: %ld (compiled)", + frame->lastpc - (int)frameMb->CompiledCode); + } else if ((frameMb->invoker == sym_invokeNativeMethod) || (frameMb->invoker == sym_invokeSynchronizedNativeMethod)) printf(" (old native)"); else if ((frameMb->invoker == sym_invokeJNINativeMethod) || - (frameMb->invoker == sym_invokeJNISynchronizedNativeMethod)) + (frameMb->invoker == sym_invokeJNISynchronizedNativeMethod) +#if JDK_VER >= 12 + || (((uint32_t)frameMb->invoker >= sym_invokeJNI_min) && + ((uint32_t)frameMb->invoker <= sym_invokeJNI_max)) +#endif + ) { printf(" (JNI native)"); - printf("\n"); - fflush(stdout); + } + else { // invoke{,Synchronized}JavaMethod + if (frame->lastpc) + printf("pc: %ld", frame->lastpc - frameMb->code); + } } else { - printf(" (null) lastpc: 0x%08x\n", (int)frame->lastpc); - fflush(stdout); + printf(" (null) lastpc: 0x%08x", (int)frame->lastpc); } + printf(" optop: 0x%x\n", (int)frame->optop); + fflush(stdout); frame = frame->prev; diff -aruN shujit-0.7.10/signal.c shujit/signal.c --- shujit-0.7.10/signal.c Fri Dec 7 15:00:31 2001 +++ shujit/signal.c Wed Mar 13 10:09:04 2002 @@ -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 Kazuyuki Shudo + Copyright (C) 1998,1999,2000,2001,2002 Kazuyuki Shudo This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,6 +40,9 @@ // static void showFPUEnv(FILE *, char *indent, char fpuenv[28]); #define fillFPUEnv(FPUENV) asm("fstenv %0" : "=m" (FPUENV)) +#if defined(EXC_BY_SIGNAL) || defined(GET_SIGCONTEXT) +static void showSigcontext(SIGCONTEXT_T *sc); +#endif // EXC_BY_SIGNAL || GET_SIGCONTEXT // @@ -242,6 +245,16 @@ if ((sig != SIGSEGV) && (sig != SIGFPE) && (sig != SIGTRAP)) return FALSE; + if ((sig != SIGFPE) && // handle SIGFPE in __divdi3() and __moddi3() + (((unsigned char *)SIGCONTEXT(sc, eip) < compiledcode_min) || + (compiledcode_max < (unsigned char *)SIGCONTEXT(sc, eip)))) { + + printf("FATAL: Signal %d occurred out of JIT compiled code.\n", sig); + showSigcontext(sc); + fflush(stdout); + + return FALSE; + } // // calculate offset in compiled code @@ -657,7 +670,7 @@ /* * show contents of structure sigcontext */ -void showSigcontext(SIGCONTEXT_T *sc) { +static void showSigcontext(SIGCONTEXT_T *sc) { printf("SS: %04x, CS: %04x, DS: %04x, ES: %04x, FS: %04x, GS: %04x\n", #if defined(__FreeBSD__) || defined(__NetBSD__) SIGCONTEXT(sc, ss) & 0xffff, SIGCONTEXT(sc, cs) & 0xffff, @@ -694,12 +707,27 @@ } { unsigned char *eip = (unsigned char *)SIGCONTEXT(sc, eip); - if (eip) - printf("(EIP): %02x %02x %02x %02x %02x %02x %02x %02x" - " %02x %02x %02x %02x %02x %02x %02x %02x\n", - *eip,*(eip+1),*(eip+2),*(eip+3),*(eip+4),*(eip+5),*(eip+6),*(eip+7), - *(eip+8),*(eip+9),*(eip+10),*(eip+11),*(eip+12),*(eip+13), - *(eip+14),*(eip+15)); + if (eip) { + int i; + + if (*(eip-1) == 0xcc) { + // INT $3 + eip--; + printf("(EIP-1):"); + } + else if ((*(eip-2) == 0xcd) && (*(eip-1) == 0x80)) { + // INT $XX + eip -= 2; + printf("(EIP-2):"); + } + else + printf("(EIP):"); + + for (i = 0; i < 8; i++) printf(" %02x", eip[i]); + printf(" "); + for (; i < 16; i++) printf(" %02x", eip[i]); + printf("\n"); + } } printf("trapno: %02x\n", SIGCONTEXT(sc, trapno));