diff -aruN shujit-0.2.6/ChangeLog shujit/ChangeLog --- shujit-0.2.6/ChangeLog Thu Jan 21 10:43:44 1999 +++ shujit/ChangeLog Sat Jan 30 20:34:58 1999 @@ -1,5 +1,43 @@ $Id$ +[19990130] + +signal を利用して null check を削減した。 +ある場合に SIGSEGV or SIGBUS を NullPointerException と見倣す。 +(code.c, code.h, compiler.c compiler.h) + +pre-assembled code の頭に、そのコードが NullPointerException を +throw し得るかどうかのフラグを加えた。 +(code.h, code.c, gentable.rb) + +構造体 CodeInfo 関係の関数を runtime.c から computil.c に移した。 +(runtime.c, computil.c) + +構造体 CompilerContext のメンバであった +exc_handler_nativeoff, finish_return_nativeoff +を構造体 CodeInfo に移した。 +signal handler から例外ハンドラのアドレスを見付けるために +実行中にも exc_handler_nativeoff が必要となったため。 +(compiler.h, compile.c) + +0.2.7 リリース。 + +[19990127] + +long 型の shift 命令 (lshl, lshr, lushr) の pre-assembled code の +バグを修整。やはり egcs-1.0.3 が生成するコードがベース。 +(code.c) + +writeCode() (compile.c) 中の、生成したコードを書き込むアドレス +cc->bufp をキャッシュする変数 bufp の値が、バッファ拡張の際に +obsolete になるバグを修整。 +数ヵ月前にも同様のバグに悩まされた記憶が… +(compile.c) + +上記修整に伴い、マクロ lastBufend()、構造体 +CompilerContext のメンバ lastbufp_off が不要になり、削除。 +(compiler.h, computil.c) + [19990121] pre-assembled code 中のラベル名のスペルミスを訂正。 @@ -25,6 +63,10 @@ (invoker.c) 0.2.6 リリース。 + +long 型の shift 命令 (lshl, lshr, lushr) の pre-assembled code を、 +gcc-2.7.2.3 の生成するものから egcs-1.0.3 のそれに変更した。 +(code.c) [19990120] diff -aruN shujit-0.2.6/README shujit/README --- shujit-0.2.6/README Sun Jan 10 09:10:22 1999 +++ shujit/README Sat Jan 30 20:26:11 1999 @@ -13,8 +13,8 @@ Working on the following platforms is confirmed. - Linux - - JDK 1.1.7v1a, egcs 1.0.3, glibc2.0.7 and Linux 2.0.36 - - JDK 1.1.7v1a, egcs 1.0.3, libc5.4.44 and Linux 2.1.124 + - JDK 1.1.7v1a, egcs 1.0.3, glibc2.0.7 and Linux 2.2.1 + - JDK 1.1.7v1a, egcs 1.0.3, libc5.4.38 and Linux 2.0.35 - FreeBSD - JDK 1.1.7 (V98-12-21) gcc 2.7.2.1 and FreeBSD 2.2.7R @@ -42,6 +42,7 @@ - JDK 1.1.X - EGCS (not 2.92.5-19981015) or GCC 2.7.X + I recommend GCC 2.7 on FreeBSD. - objdump (in GNU binutils) Most Linux distributions contains these utilities. - Ruby diff -aruN shujit-0.2.6/code.c shujit/code.c --- shujit-0.2.6/code.c Thu Jan 21 07:54:38 1999 +++ shujit/code.c Sat Jan 30 17:11:22 1999 @@ -27,13 +27,14 @@ volatile void assembledCode( - JHandle *o, struct methodblock *mb, int args_size, ExecEnv *ee + JHandle *o /* 8(%ebp) */ , struct methodblock *mb /* 12(%ebp) */, + int args_size, ExecEnv *ee #ifdef RUNTIME_DEBUG , int runtime_debug #endif ) { - /* ee: 0x14(%ebp) */ - int32_t bytepcoff; /* to handle exceptions */ + int32_t bytepcoff; /* -4(%ebp) */ + /* to handle exceptions */ /* %esi: stack_item *vars */ @@ -63,148 +64,148 @@ # define FILL_CACHE_DEBUG1(OPTOP1_REG, OPTOP2_REG) #endif - CODE(opc_fill_cache, fill_cache, ST0, ST2) { + CODE(opc_fill_cache, fill_cache, ST0, ST2, 0) { __asm__("popl %ecx\n\tpopl %edx"); FILL_CACHE_DEBUG1(%ecx, %edx); } - CODE(opc_fill_cache, fill_cache, ST1, ST4) { + CODE(opc_fill_cache, fill_cache, ST1, ST4, 0) { __asm__("popl %ecx"); FILL_CACHE_DEBUG1(%edx, %ecx); } - CODE(opc_fill_cache, fill_cache, ST2, ST2) { + CODE(opc_fill_cache, fill_cache, ST2, ST2, 0) { FILL_CACHE_DEBUG1(%ecx, %edx); } - CODE(opc_fill_cache, fill_cache, ST3, ST2) { + CODE(opc_fill_cache, fill_cache, ST3, ST2, 0) { __asm__("popl %edx"); FILL_CACHE_DEBUG1(%ecx, %edx); } - CODE(opc_fill_cache, fill_cache, ST4, ST4) { + CODE(opc_fill_cache, fill_cache, ST4, ST4, 0) { FILL_CACHE_DEBUG1(%edx, %ecx); } /* to another state */ - CODE(opc_stateto0, stateto00, ST0, ST0) {} - CODE(opc_stateto0, stateto10, ST1, ST0) { __asm__("pushl %edx"); } - CODE(opc_stateto0, stateto20, ST2, ST0) { + CODE(opc_stateto0, stateto00, ST0, ST0, 0) {} + CODE(opc_stateto0, stateto10, ST1, ST0, 0) { __asm__("pushl %edx"); } + CODE(opc_stateto0, stateto20, ST2, ST0, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); } - CODE(opc_stateto0, stateto30, ST3, ST0) { __asm__("pushl %ecx"); } - CODE(opc_stateto0, stateto40, ST4, ST0) { + CODE(opc_stateto0, stateto30, ST3, ST0, 0) { __asm__("pushl %ecx"); } + CODE(opc_stateto0, stateto40, ST4, ST0, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); } - CODE(opc_stateto1, stateto01, ST0, ST1) { __asm__("popl %edx"); } - CODE(opc_stateto1, stateto11, ST1, ST1) {} - CODE(opc_stateto1, stateto21, ST2, ST1) { + CODE(opc_stateto1, stateto01, ST0, ST1, 0) { __asm__("popl %edx"); } + CODE(opc_stateto1, stateto11, ST1, ST1, 0) {} + CODE(opc_stateto1, stateto21, ST2, ST1, 0) { __asm__("pushl %edx\n\t" "movl %ecx,%edx"); } - CODE(opc_stateto1, stateto31, ST3, ST1) { __asm__("movl %ecx,%edx"); } - CODE(opc_stateto1, stateto41, ST4, ST1) { __asm__("pushl %ecx"); } - CODE(opc_stateto2, stateto02, ST0, ST2) { + CODE(opc_stateto1, stateto31, ST3, ST1, 0) { __asm__("movl %ecx,%edx"); } + CODE(opc_stateto1, stateto41, ST4, ST1, 0) { __asm__("pushl %ecx"); } + CODE(opc_stateto2, stateto02, ST0, ST2, 0) { __asm__("popl %ecx\n\t" "popl %edx"); } - CODE(opc_stateto2, stateto12, ST1, ST2) { + CODE(opc_stateto2, stateto12, ST1, ST2, 0) { __asm__("movl %edx,%ecx\n\t" "popl %edx"); } - CODE(opc_stateto2, stateto22, ST2, ST2) {} - CODE(opc_stateto2, stateto32, ST3, ST2) { __asm__("popl %edx"); } - CODE(opc_stateto2, stateto42, ST4, ST2) { __asm__("xchg %edx,%ecx"); } - CODE(opc_stateto3, stateto03, ST0, ST3) { __asm__("popl %ecx"); } - CODE(opc_stateto3, stateto13, ST1, ST3) { __asm__("movl %edx,%ecx"); } - CODE(opc_stateto3, stateto23, ST2, ST3) { __asm__("pushl %edx"); } - CODE(opc_stateto3, stateto33, ST3, ST3) {} - CODE(opc_stateto3, stateto43, ST4, ST3) { + CODE(opc_stateto2, stateto22, ST2, ST2, 0) {} + CODE(opc_stateto2, stateto32, ST3, ST2, 0) { __asm__("popl %edx"); } + CODE(opc_stateto2, stateto42, ST4, ST2, 0) { __asm__("xchg %edx,%ecx"); } + CODE(opc_stateto3, stateto03, ST0, ST3, 0) { __asm__("popl %ecx"); } + CODE(opc_stateto3, stateto13, ST1, ST3, 0) { __asm__("movl %edx,%ecx"); } + CODE(opc_stateto3, stateto23, ST2, ST3, 0) { __asm__("pushl %edx"); } + CODE(opc_stateto3, stateto33, ST3, ST3, 0) {} + CODE(opc_stateto3, stateto43, ST4, ST3, 0) { __asm__("pushl %ecx\n\t" "movl %edx,%ecx"); } - CODE(opc_stateto4, stateto04, ST0, ST4) { + CODE(opc_stateto4, stateto04, ST0, ST4, 0) { __asm__("popl %edx\n\t" "popl %ecx"); } - CODE(opc_stateto4, stateto14, ST1, ST4) { __asm__("popl %ecx"); } - CODE(opc_stateto4, stateto24, ST2, ST4) { __asm__("xchg %edx,%ecx"); } - CODE(opc_stateto4, stateto34, ST3, ST4) { + CODE(opc_stateto4, stateto14, ST1, ST4, 0) { __asm__("popl %ecx"); } + CODE(opc_stateto4, stateto24, ST2, ST4, 0) { __asm__("xchg %edx,%ecx"); } + CODE(opc_stateto4, stateto34, ST3, ST4, 0) { __asm__("movl %ecx,%edx\n\t" "popl %ecx"); } - CODE(opc_stateto4, stateto44, ST4, ST4) {} + CODE(opc_stateto4, stateto44, ST4, ST4, 0) {} /* to another state and jump */ #define JUMP_TO_ACCUMULATOR __asm__("jmp *%eax") - CODE(opc_goto_st0, goto_st00, ST0, ST0) { + CODE(opc_goto_st0, goto_st00, ST0, ST0, 0) { JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st0, goto_st10, ST1, ST0) { + CODE(opc_goto_st0, goto_st10, ST1, ST0, 0) { __asm__("pushl %edx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st0, goto_st20, ST2, ST0) { + CODE(opc_goto_st0, goto_st20, ST2, ST0, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st0, goto_st30, ST3, ST0) { + CODE(opc_goto_st0, goto_st30, ST3, ST0, 0) { __asm__("pushl %ecx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st0, goto_st40, ST4, ST0) { + CODE(opc_goto_st0, goto_st40, ST4, ST0, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st1, goto_st01, ST0, ST1) { + CODE(opc_goto_st1, goto_st01, ST0, ST1, 0) { __asm__("popl %edx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st1, goto_st11, ST1, ST1) { + CODE(opc_goto_st1, goto_st11, ST1, ST1, 0) { JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st1, goto_st21, ST2, ST1) { + CODE(opc_goto_st1, goto_st21, ST2, ST1, 0) { __asm__("pushl %edx\n\t" "movl %ecx,%edx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st1, goto_st31, ST3, ST1) { + CODE(opc_goto_st1, goto_st31, ST3, ST1, 0) { __asm__("movl %ecx,%edx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st1, goto_st41, ST4, ST1) { + CODE(opc_goto_st1, goto_st41, ST4, ST1, 0) { __asm__("pushl %ecx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st2, goto_st02, ST0, ST2) { + CODE(opc_goto_st2, goto_st02, ST0, ST2, 0) { __asm__("popl %ecx\n\t" "popl %edx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st2, goto_st12, ST1, ST2) { + CODE(opc_goto_st2, goto_st12, ST1, ST2, 0) { __asm__("movl %edx,%ecx\n\t" "popl %edx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st2, goto_st22, ST2, ST2) { + CODE(opc_goto_st2, goto_st22, ST2, ST2, 0) { JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st2, goto_st32, ST3, ST2) { + CODE(opc_goto_st2, goto_st32, ST3, ST2, 0) { __asm__("popl %edx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st2, goto_st42, ST4, ST2) { + CODE(opc_goto_st2, goto_st42, ST4, ST2, 0) { __asm__("xchg %edx,%ecx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st3, goto_st03, ST0, ST3) { + CODE(opc_goto_st3, goto_st03, ST0, ST3, 0) { __asm__("popl %ecx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st3, goto_st13, ST1, ST3) { + CODE(opc_goto_st3, goto_st13, ST1, ST3, 0) { __asm__("movl %edx,%ecx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st3, goto_st23, ST2, ST3) { + CODE(opc_goto_st3, goto_st23, ST2, ST3, 0) { __asm__("pushl %edx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st3, goto_st33, ST3, ST3) { + CODE(opc_goto_st3, goto_st33, ST3, ST3, 0) { JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st3, goto_st43, ST4, ST3) { + CODE(opc_goto_st3, goto_st43, ST4, ST3, 0) { __asm__("pushl %ecx\n\t" "movl %edx,%ecx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st4, goto_st04, ST0, ST4) { + CODE(opc_goto_st4, goto_st04, ST0, ST4, 0) { __asm__("popl %edx\n\t" "popl %ecx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st4, goto_st14, ST1, ST4) { + CODE(opc_goto_st4, goto_st14, ST1, ST4, 0) { __asm__("popl %ecx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st4, goto_st24, ST2, ST4) { + CODE(opc_goto_st4, goto_st24, ST2, ST4, 0) { __asm__("xchg %edx,%ecx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st4, goto_st34, ST3, ST4) { + CODE(opc_goto_st4, goto_st34, ST3, ST4, 0) { __asm__("movl %ecx,%edx\n\t" "popl %ecx"); JUMP_TO_ACCUMULATOR; } - CODE(opc_goto_st4, goto_st44, ST4, ST4) { + CODE(opc_goto_st4, goto_st44, ST4, ST4, 0) { JUMP_TO_ACCUMULATOR; } @@ -213,7 +214,7 @@ */ /* method head */ - CODE_WITHOUT_DEBUG(opc_methodhead, head, STANY, STSTA) { + CODE_WITHOUT_DEBUG(opc_methodhead, head, STANY, STSTA, 0) { __asm__("pushl %ebp\n\t" "movl %esp,%ebp\n\t" "subl $4,%esp\n\t" /* 4 * #local_var */ @@ -283,7 +284,7 @@ } /* method tail */ - CODE(opc_methodtail, tail, STANY, STSTA) { + CODE(opc_methodtail, tail, STANY, STSTA, 0) { __asm__("leal -20(%ebp),%esp"); /* -4 * (#local_var + #registers_on_stack) */ __asm__("popl %esi\n\t" @@ -295,7 +296,7 @@ } /* exception handler */ - CODE(opc_exception_handler, exception_handler, STANY, STSTA) { + CODE(opc_exception_handler, exception_handler, STANY, STSTA, 0) { #ifdef RUNTIME_DEBUG __asm__("pushl %0" : : "m" (runtime_debug)); #endif @@ -377,35 +378,35 @@ } /* nop */ - CODE(opc_nop, nop, STANY, STSTA) { + CODE(opc_nop, nop, STANY, STSTA, 0) { } /* iconst_0 */ - CODE(opc_iconst_0, [ifa]const_0, ST0, ST1) { __asm__("xorl %edx,%edx"); } - CODE(opc_iconst_0, [ifa]const_0, ST1, ST2) { __asm__("xorl %ecx,%ecx"); } - CODE(opc_iconst_0, [ifa]const_0, ST2, ST4) { + CODE(opc_iconst_0, [ifa]const_0, ST0, ST1, 0) { __asm__("xorl %edx,%edx"); } + CODE(opc_iconst_0, [ifa]const_0, ST1, ST2, 0) { __asm__("xorl %ecx,%ecx"); } + CODE(opc_iconst_0, [ifa]const_0, ST2, ST4, 0) { __asm__("pushl %edx\n\t" "xorl %edx,%edx"); } - CODE(opc_iconst_0, [ifa]const_0, ST3, ST4) { __asm__("xorl %edx,%edx"); } - CODE(opc_iconst_0, [ifa]const_0, ST4, ST2) { + CODE(opc_iconst_0, [ifa]const_0, ST3, ST4, 0) { __asm__("xorl %edx,%edx"); } + CODE(opc_iconst_0, [ifa]const_0, ST4, ST2, 0) { __asm__("pushl %ecx\n\t" "xorl %ecx,%ecx"); } /* iconst_m1, iconst_[1-5] */ #define CODE_ICONST_N(S, N) \ - CODE(opc_iconst_##S, iconst_##S, ST0, ST1) {\ + CODE(opc_iconst_##S, iconst_##S, ST0, ST1, 0) {\ __asm__("movl $" #N ",%edx"); }\ - CODE(opc_iconst_##S, iconst_##S, ST1, ST2) {\ + CODE(opc_iconst_##S, iconst_##S, ST1, ST2, 0) {\ __asm__("movl $" #N ",%ecx"); }\ - CODE(opc_iconst_##S, iconst_##S, ST2, ST4){\ + CODE(opc_iconst_##S, iconst_##S, ST2, ST4, 0){\ __asm__("pushl %edx\n\t"\ "movl $" #N ",%edx");\ }\ - CODE(opc_iconst_##S, iconst_##S, ST3, ST4) {\ + CODE(opc_iconst_##S, iconst_##S, ST3, ST4, 0) {\ __asm__("movl $" #N ",%edx"); }\ - CODE(opc_iconst_##S, iconst_##S, ST4, ST2) {\ + CODE(opc_iconst_##S, iconst_##S, ST4, ST2, 0) {\ __asm__("pushl %ecx\n\t"\ "movl $" #N ",%ecx");\ } @@ -418,27 +419,27 @@ CODE_ICONST_N(5, 5); /* lconst_0 */ - CODE(opc_lconst_0, [ld]const_0, ST0, ST2) { + CODE(opc_lconst_0, [ld]const_0, ST0, ST2, 0) { __asm__("xorl %edx,%edx\n\t" "xorl %ecx,%ecx"); } - CODE(opc_lconst_0, [ld]const_0, ST1, ST2) { + CODE(opc_lconst_0, [ld]const_0, ST1, ST2, 0) { __asm__("pushl %edx\n\t" "xorl %edx,%edx\n\t" "xorl %ecx,%ecx"); } - CODE(opc_lconst_0, [ld]const_0, ST2, ST2) { + CODE(opc_lconst_0, [ld]const_0, ST2, ST2, 0) { __asm__("pushl %edx\n\t" "pushl %ecx\n\t" "xorl %edx,%edx\n\t" "xorl %ecx,%ecx"); } - CODE(opc_lconst_0, [ld]const_0, ST3, ST2) { + CODE(opc_lconst_0, [ld]const_0, ST3, ST2, 0) { __asm__("pushl %ecx\n\t" "xorl %edx,%edx\n\t" "xorl %ecx,%ecx"); } - CODE(opc_lconst_0, [ld]const_0, ST4, ST2) { + CODE(opc_lconst_0, [ld]const_0, ST4, ST2, 0) { __asm__("pushl %ecx\n\t" "pushl %edx\n\t" "xorl %ecx,%ecx\n\t" @@ -456,62 +457,62 @@ "xorl %ecx,%ecx") /* now state 4 */ - CODE(opc_lconst_1, lconst_1, ST0, ST2) { + CODE(opc_lconst_1, lconst_1, ST0, ST2, 0) { LCONST_ST02; } - CODE(opc_lconst_1, lconst_1, ST1, ST2) { + CODE(opc_lconst_1, lconst_1, ST1, ST2, 0) { __asm__("pushl %edx"); /* now state 0 */ LCONST_ST02; } - CODE(opc_lconst_1, lconst_1, ST2, ST4) { + CODE(opc_lconst_1, lconst_1, ST2, ST4, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); /* now state 0 */ LCONST_ST04; } - CODE(opc_lconst_1, lconst_1, ST3, ST4) { + CODE(opc_lconst_1, lconst_1, ST3, ST4, 0) { __asm__("pushl %ecx"); /* now state 0 */ LCONST_ST04; } - CODE(opc_lconst_1, lconst_1, ST4, ST2) { + CODE(opc_lconst_1, lconst_1, ST4, ST2, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); /* now state 0 */ LCONST_ST02; } /* fconst_1 */ - CODE(opc_fconst_1, fconst_1, ST0, ST1) { + CODE(opc_fconst_1, fconst_1, ST0, ST1, 0) { __asm__("movl $0x3f800000,%edx"); } - CODE(opc_fconst_1, fconst_1, ST1, ST2) { + CODE(opc_fconst_1, fconst_1, ST1, ST2, 0) { __asm__("movl $0x3f800000,%ecx"); } - CODE(opc_fconst_1, fconst_1, ST2, ST4) { + CODE(opc_fconst_1, fconst_1, ST2, ST4, 0) { __asm__("pushl %edx\n\t" "movl $0x3f800000,%edx"); } - CODE(opc_fconst_1, fconst_1, ST3, ST4) { + CODE(opc_fconst_1, fconst_1, ST3, ST4, 0) { __asm__("movl $0x3f800000,%edx"); } - CODE(opc_fconst_1, fconst_1, ST4, ST2) { + CODE(opc_fconst_1, fconst_1, ST4, ST2, 0) { __asm__("pushl %ecx\n\t" "movl $0x3f800000,%ecx"); } /* fconst_2 */ - CODE(opc_fconst_2, fconst_2, ST0, ST1) { + CODE(opc_fconst_2, fconst_2, ST0, ST1, 0) { __asm__("movl $0x40000000,%edx"); } - CODE(opc_fconst_2, fconst_2, ST1, ST2) { + CODE(opc_fconst_2, fconst_2, ST1, ST2, 0) { __asm__("movl $0x40000000,%ecx"); } - CODE(opc_fconst_2, fconst_2, ST2, ST4) { + CODE(opc_fconst_2, fconst_2, ST2, ST4, 0) { __asm__("pushl %edx\n\t" "movl $0x40000000,%edx"); } - CODE(opc_fconst_2, fconst_2, ST3, ST4) { + CODE(opc_fconst_2, fconst_2, ST3, ST4, 0) { __asm__("movl $0x40000000,%edx"); } - CODE(opc_fconst_2, fconst_2, ST4, ST2) { + CODE(opc_fconst_2, fconst_2, ST4, ST2, 0) { __asm__("pushl %ecx\n\t" "movl $0x40000000,%ecx"); } @@ -525,23 +526,23 @@ __asm__("movl $0x3ff00000,%ecx\n\t" /* high word */\ "xorl %edx,%edx") /* low word */ - CODE(opc_dconst_1, dconst_1, ST0, ST2) { + CODE(opc_dconst_1, dconst_1, ST0, ST2, 0) { DCONST_ST02; } - CODE(opc_dconst_1, dconst_1, ST1, ST4) { + CODE(opc_dconst_1, dconst_1, ST1, ST4, 0) { __asm__("pushl %edx"); /* now state 0 */ DCONST_ST04; } - CODE(opc_dconst_1, dconst_1, ST2, ST2) { + CODE(opc_dconst_1, dconst_1, ST2, ST2, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); /* now state 0 */ DCONST_ST02; } - CODE(opc_dconst_1, dconst_1, ST3, ST2) { + CODE(opc_dconst_1, dconst_1, ST3, ST2, 0) { __asm__("pushl %ecx"); /* now state 0 */ DCONST_ST02; } - CODE(opc_dconst_1, dconst_1, ST4, ST4) { + CODE(opc_dconst_1, dconst_1, ST4, ST4, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); /* now state 0 */ DCONST_ST04; @@ -568,24 +569,24 @@ # define BIPUSH_DEBUG1(REG) #endif /* const: value */ - CODE(opc_bipush, a_const, ST0, ST1) { + CODE(opc_bipush, a_const, ST0, ST1, 0) { __asm__("movl $" STR(CONST) ",%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_bipush, a_const, ST1, ST2) { + CODE(opc_bipush, a_const, ST1, ST2, 0) { __asm__("movl $" STR(CONST) ",%ecx"); BIPUSH_DEBUG1(%ecx); } - CODE(opc_bipush, a_const, ST2, ST4) { + CODE(opc_bipush, a_const, ST2, ST4, 0) { __asm__("pushl %edx\n\t" "movl $" STR(CONST) ",%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_bipush, a_const, ST3, ST4) { + CODE(opc_bipush, a_const, ST3, ST4, 0) { __asm__("movl $" STR(CONST) ",%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_bipush, a_const, ST4, ST2) { + CODE(opc_bipush, a_const, ST4, ST2, 0) { __asm__("pushl %ecx\n\t" "movl $" STR(CONST) ",%ecx"); BIPUSH_DEBUG1(%ecx); @@ -611,31 +612,31 @@ # define LDC2_W_DEBUG1(OPTOP1_REG, OPTOP2_REG) #endif - CODE(opc_ldc2_w, ldc2_w, ST0, ST2) { + CODE(opc_ldc2_w, ldc2_w, ST0, ST2, 0) { __asm__("movl $" STR(CONST) ",%edx\n\t" "movl $" STR(CONST) ",%ecx"); LDC2_W_DEBUG1(%ecx, %edx); } - CODE(opc_ldc2_w, ldc2_w, ST1, ST4) { + CODE(opc_ldc2_w, ldc2_w, ST1, ST4, 0) { __asm__("pushl %edx\n\t" "movl $" STR(CONST) ",%ecx\n\t" "movl $" STR(CONST) ",%edx"); LDC2_W_DEBUG1(%edx, %ecx); } - CODE(opc_ldc2_w, ldc2_w, ST2, ST2) { + CODE(opc_ldc2_w, ldc2_w, ST2, ST2, 0) { __asm__("pushl %edx\n\t" "pushl %ecx\n\t" "movl $" STR(CONST) ",%edx\n\t" "movl $" STR(CONST) ",%ecx"); LDC2_W_DEBUG1(%ecx, %edx); } - CODE(opc_ldc2_w, ldc2_w, ST3, ST2) { + CODE(opc_ldc2_w, ldc2_w, ST3, ST2, 0) { __asm__("pushl %ecx\n\t" "movl $" STR(CONST) ",%edx\n\t" "movl $" STR(CONST) ",%ecx"); LDC2_W_DEBUG1(%ecx, %edx); } - CODE(opc_ldc2_w, ldc2_w, ST4, ST4) { + CODE(opc_ldc2_w, ldc2_w, ST4, ST4, 0) { __asm__("pushl %ecx\n\t" "pushl %edx\n\t" "movl $" STR(CONST) ",%ecx\n\t" @@ -668,24 +669,24 @@ #else # define ILOAD_DEBUG1(VAL) #endif - CODE(opc_iload, [ifa]load, ST0, ST1) { + CODE(opc_iload, [ifa]load, ST0, ST1, 0) { __asm__("movl " STR(CONST) "(%esi),%edx"); ILOAD_DEBUG1(%edx); } - CODE(opc_iload, [ifa]load, ST1, ST2) { + CODE(opc_iload, [ifa]load, ST1, ST2, 0) { __asm__("movl " STR(CONST) "(%esi),%ecx"); ILOAD_DEBUG1(%ecx); } - CODE(opc_iload, [ifa]load, ST2, ST4) { + CODE(opc_iload, [ifa]load, ST2, ST4, 0) { __asm__("pushl %edx\n\t" "movl " STR(CONST) "(%esi),%edx"); ILOAD_DEBUG1(%edx); } - CODE(opc_iload, [ifa]load, ST3, ST4) { + CODE(opc_iload, [ifa]load, ST3, ST4, 0) { __asm__("movl " STR(CONST) "(%esi),%edx"); ILOAD_DEBUG1(%edx); } - CODE(opc_iload, [ifa]load, ST4, ST2) { + CODE(opc_iload, [ifa]load, ST4, ST2, 0) { __asm__("pushl %ecx\n\t" "movl " STR(CONST) "(%esi),%ecx"); ILOAD_DEBUG1(%ecx); @@ -724,23 +725,23 @@ "movl " STR(CONST) "(%esi),%ecx");\ LLOAD_DEBUG1(%edx, %ecx) - CODE(opc_lload, [ld]load, ST0, ST2) { + CODE(opc_lload, [ld]load, ST0, ST2, 0) { LLOAD_ST02; } - CODE(opc_lload, [ld]load, ST1, ST2) { + CODE(opc_lload, [ld]load, ST1, ST2, 0) { __asm__("pushl %edx"); /* now state 0 */ LLOAD_ST02; } - CODE(opc_lload, [ld]load, ST2, ST4) { + CODE(opc_lload, [ld]load, ST2, ST4, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); /* now state 0 */ LLOAD_ST04; } - CODE(opc_lload, [ld]load, ST3, ST4) { + CODE(opc_lload, [ld]load, ST3, ST4, 0) { __asm__("pushl %ecx"); /* now state 0 */ LLOAD_ST04; } - CODE(opc_lload, [ld]load, ST4, ST2) { + CODE(opc_lload, [ld]load, ST4, ST2, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); /* now state 0 */ LLOAD_ST02; @@ -748,24 +749,24 @@ /* iload_[0-3] */ #define CODE_ILOAD_N(N, OFF) \ - CODE(opc_iload_##N, [ifa]load_##N, ST0, ST1) {\ + CODE(opc_iload_##N, [ifa]load_##N, ST0, ST1, 0) {\ __asm__("movl " #OFF "(%esi),%edx");\ BIPUSH_DEBUG1(%edx);\ }\ - CODE(opc_iload_##N, [ifa]load_##N, ST1, ST2) {\ + CODE(opc_iload_##N, [ifa]load_##N, ST1, ST2, 0) {\ __asm__("movl " #OFF "(%esi),%ecx");\ BIPUSH_DEBUG1(%ecx);\ }\ - CODE(opc_iload_##N, [ifa]load_##N, ST2, ST4) {\ + CODE(opc_iload_##N, [ifa]load_##N, ST2, ST4, 0) {\ __asm__("pushl %edx\n\t"\ "movl " #OFF "(%esi),%edx");\ BIPUSH_DEBUG1(%edx);\ }\ - CODE(opc_iload_##N, [ifa]load_##N, ST3, ST4) {\ + CODE(opc_iload_##N, [ifa]load_##N, ST3, ST4, 0) {\ __asm__("movl " #OFF "(%esi),%edx");\ BIPUSH_DEBUG1(%edx);\ }\ - CODE(opc_iload_##N, [ifa]load_##N, ST4, ST2) {\ + CODE(opc_iload_##N, [ifa]load_##N, ST4, ST2, 0) {\ __asm__("pushl %ecx\n\t"\ "movl " #OFF "(%esi),%ecx");\ BIPUSH_DEBUG1(%ecx);\ @@ -787,23 +788,23 @@ LDC2_W_DEBUG1(%edx, %ecx) #define CODE_LLOAD_N(N, OFF1, OFF2) \ - CODE(opc_lload_##N, [ld]load_##N, ST0, ST2) {\ + CODE(opc_lload_##N, [ld]load_##N, ST0, ST2, 0) {\ LLOAD_N_ST02(OFF1, OFF2);\ }\ - CODE(opc_lload_##N, [ld]load_##N, ST1, ST2) {\ + CODE(opc_lload_##N, [ld]load_##N, ST1, ST2, 0) {\ __asm__("pushl %edx"); /* now state 0 */\ LLOAD_N_ST02(OFF1, OFF2);\ }\ - CODE(opc_lload_##N, [ld]load_##N, ST2, ST4) {\ + CODE(opc_lload_##N, [ld]load_##N, ST2, ST4, 0) {\ __asm__("pushl %edx\n\t"\ "pushl %ecx"); /* now state 0 */\ LLOAD_N_ST04(OFF1, OFF2);\ }\ - CODE(opc_lload_##N, [ld]load_##N, ST3, ST4) {\ + CODE(opc_lload_##N, [ld]load_##N, ST3, ST4, 0) {\ __asm__("pushl %ecx"); /* now state 0 */\ LLOAD_N_ST04(OFF1, OFF2);\ }\ - CODE(opc_lload_##N, [ld]load_##N, ST4, ST2) {\ + CODE(opc_lload_##N, [ld]load_##N, ST4, ST2, 0) {\ __asm__("pushl %ecx\n\t"\ "pushl %edx"); /* now state 0 */\ LLOAD_N_ST02(OFF1, OFF2);\ @@ -820,7 +821,7 @@ /* array_check */ #if 0 - CODE(opc_array_check, array_check, ST[24], ST[24]) { + CODE(opc_array_check, array_check, ST[24], ST[24], 1) { if (!h) { SIGNAL_ERROR0(NullPointerException); } if ((index < 0) || (index >= obj_length(h))) { @@ -876,21 +877,21 @@ /* destroy %edi */ /* edi = obj_length(handle) */ - CODE(opc_array_check, array_check, ST2, ST2) { + CODE(opc_array_check, array_check, ST2, ST2, 1) { ARRAY_CHECK(%edx, %ecx, "arychk_st2", 2); } - CODE(opc_array_check, array_check, ST4, ST4) { + CODE(opc_array_check, array_check, ST4, ST4, 1) { ARRAY_CHECK(%ecx, %edx, "arychk_st4", 4); } /* iaload */ /* compile: fill_cache, array_check, iaload */ - CODE(opc_iaload, [ifa]aload, ST2, ST1) { + CODE(opc_iaload, [ifa]aload, ST2, ST1, 0) { UNHAND(%edx, %eax); __asm__("movl (%eax,%ecx,4),%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_iaload, [ifa]aload, ST4, ST3) { + CODE(opc_iaload, [ifa]aload, ST4, ST3, 0) { UNHAND(%ecx, %eax); __asm__("movl (%eax,%edx,4),%ecx"); BIPUSH_DEBUG1(%ecx); @@ -898,14 +899,14 @@ /* laload */ /* compile: fill_cache, array_check, laload */ - CODE(opc_laload, [ld]aload, ST2, ST4) { + CODE(opc_laload, [ld]aload, ST2, ST4, 0) { UNHAND(%edx, %eax); __asm__("leal (%eax,%ecx,8),%edi\n\t" "movl (%edi),%edx\n\t" "movl 4(%edi),%ecx"); LDC2_W_DEBUG1(%edx, %ecx); } - CODE(opc_laload, [ld]aload, ST4, ST2) { + CODE(opc_laload, [ld]aload, ST4, ST2, 0) { UNHAND(%ecx, %eax); __asm__("leal (%eax,%edx,8),%edi\n\t" "movl (%edi),%ecx\n\t" @@ -916,7 +917,7 @@ /* baload */ /* compile: fill_cache, array_check, baload */ #if 0 - CODE(opc_baload, baload, ST2, ST1) { + CODE(opc_baload, baload, ST2, ST1, 0) { register HArrayOfByte *h asm("edx"); register int index asm("ecx"); register ArrayOfByte *array asm("eax"); @@ -925,12 +926,12 @@ edx.i = array->body[index]; } #endif - CODE(opc_baload, baload, ST2, ST1) { + CODE(opc_baload, baload, ST2, ST1, 0) { UNHAND(%edx, %eax); __asm__("movsbl (%eax,%ecx),%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_baload, baload, ST4, ST3) { + CODE(opc_baload, baload, ST4, ST3, 0) { UNHAND(%ecx, %eax); __asm__("movsbl (%eax,%edx),%ecx"); BIPUSH_DEBUG1(%ecx); @@ -939,7 +940,7 @@ /* caload */ /* compile: fill_cache, array_check, caload */ #if 0 - CODE(opc_caload, caload, ST2, ST1) { + CODE(opc_caload, caload, ST2, ST1, 0) { register HArrayOfChar *h asm("edx"); register int index asm("ecx"); register ArrayOfChar *array asm("eax"); @@ -948,12 +949,12 @@ edx.i = array->body[index]; } #endif - CODE(opc_caload, caload, ST2, ST1) { + CODE(opc_caload, caload, ST2, ST1, 0) { UNHAND(%edx, %eax); __asm__("movzwl (%eax,%ecx,2),%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_caload, caload, ST4, ST3) { + CODE(opc_caload, caload, ST4, ST3, 0) { UNHAND(%ecx, %eax); __asm__("movzwl (%eax,%edx,2),%ecx"); BIPUSH_DEBUG1(%ecx); @@ -962,7 +963,7 @@ /* saload */ /* compile: fill_cache, array_check, saload */ #if 0 - CODE(opc_saload, saload, ST2, ST1) { + CODE(opc_saload, saload, ST2, ST1, 0) { register HArrayOfShort *h asm("edx"); register int index asm("ecx"); register ArrayOfShort *array asm("eax"); @@ -971,12 +972,12 @@ edx.i = array->body[index]; } #endif - CODE(opc_saload, saload, ST2, ST1) { + CODE(opc_saload, saload, ST2, ST1, 0) { UNHAND(%edx, %eax); __asm__("movswl (%eax,%ecx,2),%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_saload, saload, ST4, ST3) { + CODE(opc_saload, saload, ST4, ST3, 0) { UNHAND(%ecx, %eax); __asm__("movswl (%eax,%edx,2),%ecx"); BIPUSH_DEBUG1(%ecx); @@ -984,24 +985,24 @@ /* istore */ /* const: index * 4 */ - CODE(opc_istore, [ifa]store, ST0, ST0) { + CODE(opc_istore, [ifa]store, ST0, ST0, 0) { __asm__("popl %edx\n\t" "movl %edx," STR(CONST) "(%esi)"); ILOAD_DEBUG1(%edx); } - CODE(opc_istore, [ifa]store, ST1, ST0) { + CODE(opc_istore, [ifa]store, ST1, ST0, 0) { __asm__("movl %edx," STR(CONST) "(%esi)"); ILOAD_DEBUG1(%edx); } - CODE(opc_istore, [ifa]store, ST2, ST1) { + CODE(opc_istore, [ifa]store, ST2, ST1, 0) { __asm__("movl %ecx," STR(CONST) "(%esi)"); ILOAD_DEBUG1(%ecx); } - CODE(opc_istore, [ifa]store, ST3, ST0) { + CODE(opc_istore, [ifa]store, ST3, ST0, 0) { __asm__("movl %ecx," STR(CONST) "(%esi)"); ILOAD_DEBUG1(%ecx); } - CODE(opc_istore, [ifa]store, ST4, ST3) { + CODE(opc_istore, [ifa]store, ST4, ST3, 0) { __asm__("movl %edx," STR(CONST) "(%esi)"); ILOAD_DEBUG1(%edx); } @@ -1009,12 +1010,12 @@ /* lstore */ /* const: index * 4, (index + 1) * 4 */ /* compile: fill_cache, lstore */ - CODE(opc_lstore, [ld]store, ST2, ST0) { + CODE(opc_lstore, [ld]store, ST2, ST0, 0) { __asm__("movl %ecx," STR(CONST) "(%esi)\n\t" "movl %edx," STR(CONST) "(%esi)"); LLOAD_DEBUG1(%ecx, %edx); } - CODE(opc_lstore, [ld]store, ST4, ST0) { + CODE(opc_lstore, [ld]store, ST4, ST0, 0) { __asm__("movl %edx," STR(CONST) "(%esi)\n\t" "movl %ecx," STR(CONST) "(%esi)"); LLOAD_DEBUG1(%edx, %ecx); @@ -1022,24 +1023,24 @@ /* istore_[0-3] */ #define CODE_ISTORE_N(N, OFF) \ - CODE(opc_istore_##N, [ifa]store_##N, ST0, ST0) {\ + CODE(opc_istore_##N, [ifa]store_##N, ST0, ST0, 0) {\ __asm__("popl %edx\n\t" /* now state 1 */\ "movl %edx," #OFF "(%esi)");\ BIPUSH_DEBUG1(%edx);\ }\ - CODE(opc_istore_##N, [ifa]store_##N, ST1, ST0) {\ + CODE(opc_istore_##N, [ifa]store_##N, ST1, ST0, 0) {\ __asm__("movl %edx," #OFF "(%esi)");\ BIPUSH_DEBUG1(%edx);\ }\ - CODE(opc_istore_##N, [ifa]store_##N, ST2, ST1) {\ + CODE(opc_istore_##N, [ifa]store_##N, ST2, ST1, 0) {\ __asm__("movl %ecx," #OFF "(%esi)");\ BIPUSH_DEBUG1(%ecx);\ }\ - CODE(opc_istore_##N, [ifa]store_##N, ST3, ST0) {\ + CODE(opc_istore_##N, [ifa]store_##N, ST3, ST0, 0) {\ __asm__("movl %ecx," #OFF "(%esi)");\ BIPUSH_DEBUG1(%ecx);\ }\ - CODE(opc_istore_##N, [ifa]store_##N, ST4, ST3) {\ + CODE(opc_istore_##N, [ifa]store_##N, ST4, ST3, 0) {\ __asm__("movl %edx," #OFF "(%esi)");\ BIPUSH_DEBUG1(%edx);\ } @@ -1060,23 +1061,23 @@ LDC2_W_DEBUG1(%edx, %ecx) #define CODE_LSTORE_N(N, OFF1, OFF2) \ - CODE(opc_lstore_##N, [ld]store_##N, ST0, ST0) {\ + CODE(opc_lstore_##N, [ld]store_##N, ST0, ST0, 0) {\ __asm__("popl %ecx\n\t"\ "popl %edx"); /* now state 2 */\ LSTORE_N_ST2(OFF1, OFF2);\ }\ - CODE(opc_lstore_##N, [ld]store_##N, ST1, ST0) {\ + CODE(opc_lstore_##N, [ld]store_##N, ST1, ST0, 0) {\ __asm__("popl %ecx"); /* now state 4 */\ LSTORE_N_ST4(OFF1, OFF2);\ }\ - CODE(opc_lstore_##N, [ld]store_##N, ST2, ST0) {\ + CODE(opc_lstore_##N, [ld]store_##N, ST2, ST0, 0) {\ LSTORE_N_ST2(OFF1, OFF2);\ }\ - CODE(opc_lstore_##N, [ld]store_##N, ST3, ST0) {\ + CODE(opc_lstore_##N, [ld]store_##N, ST3, ST0, 0) {\ __asm__("popl %edx"); /* now state 2 */\ LSTORE_N_ST2(OFF1, OFF2);\ }\ - CODE(opc_lstore_##N, [ld]store_##N, ST4, ST0) {\ + CODE(opc_lstore_##N, [ld]store_##N, ST4, ST0, 0) {\ LSTORE_N_ST4(OFF1, OFF2);\ } @@ -1087,33 +1088,33 @@ /* iastore */ /* compile: iastore1, fill_cache, array_check, iastore */ - CODE(opc_iastore1, [ifa]astore1, ST0, ST0) { + CODE(opc_iastore1, [ifa]astore1, ST0, ST0, 0) { __asm__("popl %eax"); BIPUSH_DEBUG1(%eax); } - CODE(opc_iastore1, [ifa]astore1, ST1, ST0) { + CODE(opc_iastore1, [ifa]astore1, ST1, ST0, 0) { __asm__("movl %edx,%eax"); BIPUSH_DEBUG1(%eax); } - CODE(opc_iastore1, [ifa]astore1, ST2, ST1) { + CODE(opc_iastore1, [ifa]astore1, ST2, ST1, 0) { __asm__("movl %ecx,%eax"); BIPUSH_DEBUG1(%eax); } - CODE(opc_iastore1, [ifa]astore1, ST3, ST0) { + CODE(opc_iastore1, [ifa]astore1, ST3, ST0, 0) { __asm__("movl %ecx,%eax"); BIPUSH_DEBUG1(%eax); } - CODE(opc_iastore1, [ifa]astore1, ST4, ST3) { + CODE(opc_iastore1, [ifa]astore1, ST4, ST3, 0) { __asm__("movl %edx,%eax"); BIPUSH_DEBUG1(%eax); } /* eax: value */ - CODE(opc_iastore, [ifa]astore, ST2, ST0) { + CODE(opc_iastore, [ifa]astore, ST2, ST0, 0) { UNHAND(%edx, %edi); __asm__("movl %eax,(%edi,%ecx,4)"); /* array->body[ecx] = eax */ } - CODE(opc_iastore, [ifa]astore, ST4, ST0) { + CODE(opc_iastore, [ifa]astore, ST4, ST0, 0) { UNHAND(%ecx, %edi); __asm__("movl %eax,(%edi,%edx,4)"); /* array->body[edx] = eax */ } @@ -1162,12 +1163,12 @@ # define AASTORE_TEST(OBJ, STATE) #endif /* NO_CHECK */ - CODE(opc_aastore, aastore, ST2, ST0) { + CODE(opc_aastore, aastore, ST2, ST0, 0) { UNHAND(%edx, %edx); AASTORE_TEST(%edx, 2); __asm__("movl %eax,(%edx,%ecx,4)");/* array->body[ecx] = eax */ } - CODE(opc_aastore, aastore, ST4, ST0) { + CODE(opc_aastore, aastore, ST4, ST0, 0) { UNHAND(%ecx, %ecx); AASTORE_TEST(%ecx, 4); __asm__("movl %eax,(%ecx,%edx,4)");/* array->body[ecx] = eax */ @@ -1176,7 +1177,7 @@ /* lastore */ /* compile: fill_cache, lastore */ #define CODE_LASTORE(OPTOP1_REG, OPTOP2_REG, STATE) \ - CODE(opc_lastore, [ld]astore, ST##STATE, ST0) {\ + CODE(opc_lastore, [ld]astore, ST##STATE, ST0, 1) {\ __asm__("popl %eax\n\t"\ "movl (%esp),%edi");\ ARRAY_CHECK(%edi, %eax, "lastore_st" #STATE, STATE);\ @@ -1193,12 +1194,12 @@ /* bastore */ /* compile: iastore1, fill_cache, array_check, bastore */ - CODE(opc_bastore, bastore, ST2, ST0) { + CODE(opc_bastore, bastore, ST2, ST0, 0) { UNHAND(%edx, %edi); __asm__("movb %al,(%edi,%ecx)"); BIPUSH_DEBUG1(%eax); } - CODE(opc_bastore, bastore, ST4, ST0) { + CODE(opc_bastore, bastore, ST4, ST0, 0) { UNHAND(%ecx, %edi); __asm__("movb %al,(%edi,%edx)"); BIPUSH_DEBUG1(%eax); @@ -1206,12 +1207,12 @@ /* castore */ /* compile: iastore1, fill_cache, array_check, castore */ - CODE(opc_castore, castore, ST2, ST0) { + CODE(opc_castore, castore, ST2, ST0, 0) { UNHAND(%edx, %edi); __asm__("movw %ax,(%edi,%ecx,2)"); BIPUSH_DEBUG1(%eax); } - CODE(opc_castore, castore, ST4, ST0) { + CODE(opc_castore, castore, ST4, ST0, 0) { UNHAND(%ecx, %edi); __asm__("movw %ax,(%edi,%edx,2)"); BIPUSH_DEBUG1(%eax); @@ -1219,65 +1220,65 @@ /* sastore */ /* compile: iastore1, fill_cache, array_check, sastore */ - CODE(opc_sastore, sastore, ST2, ST0) { + CODE(opc_sastore, sastore, ST2, ST0, 0) { UNHAND(%edx, %edi); __asm__("movw %ax,(%edi,%ecx,2)"); BIPUSH_DEBUG1(%eax); } - CODE(opc_sastore, sastore, ST4, ST0) { + CODE(opc_sastore, sastore, ST4, ST0, 0) { UNHAND(%ecx, %edi); __asm__("movw %ax,(%edi,%edx,2)"); BIPUSH_DEBUG1(%eax); } /* pop */ - CODE(opc_pop, pop, ST0, ST0) { + CODE(opc_pop, pop, ST0, ST0, 0) { __asm__("addl $4,%esp"); } - CODE(opc_pop, pop, ST1, ST0) {} - CODE(opc_pop, pop, ST2, ST1) {} - CODE(opc_pop, pop, ST3, ST0) {} - CODE(opc_pop, pop, ST4, ST3) {} + CODE(opc_pop, pop, ST1, ST0, 0) {} + CODE(opc_pop, pop, ST2, ST1, 0) {} + CODE(opc_pop, pop, ST3, ST0, 0) {} + CODE(opc_pop, pop, ST4, ST3, 0) {} /* pop2 */ - CODE(opc_pop2, pop2, ST0, ST0) { + CODE(opc_pop2, pop2, ST0, ST0, 0) { __asm__("addl $8,%esp"); } - CODE(opc_pop2, pop2, ST1, ST0) { + CODE(opc_pop2, pop2, ST1, ST0, 0) { __asm__("addl $4,%esp"); } - CODE(opc_pop2, pop2, ST2, ST0) {} - CODE(opc_pop2, pop2, ST3, ST0) { + CODE(opc_pop2, pop2, ST2, ST0, 0) {} + CODE(opc_pop2, pop2, ST3, ST0, 0) { __asm__("addl $4,%esp"); } - CODE(opc_pop2, pop2, ST4, ST0) {} + CODE(opc_pop2, pop2, ST4, ST0, 0) {} /* dup */ - CODE(opc_dup, dup, ST0, ST1) { + CODE(opc_dup, dup, ST0, ST1, 0) { __asm__("movl (%esp),%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_dup, dup, ST1, ST2) { + CODE(opc_dup, dup, ST1, ST2, 0) { __asm__("movl %edx,%ecx"); BIPUSH_DEBUG1(%ecx); } - CODE(opc_dup, dup, ST2, ST2) { + CODE(opc_dup, dup, ST2, ST2, 0) { __asm__("pushl %edx\n\t" "movl %ecx,%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_dup, dup, ST3, ST2) { + CODE(opc_dup, dup, ST3, ST2, 0) { __asm__("movl %ecx,%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_dup, dup, ST4, ST2) { + CODE(opc_dup, dup, ST4, ST2, 0) { __asm__("pushl %ecx\n\t" "movl %edx,%ecx"); BIPUSH_DEBUG1(%ecx); } /* dup_x1 */ - CODE(opc_dup_x1, dup_x1, ST0, ST2) { + CODE(opc_dup_x1, dup_x1, ST0, ST2, 0) { #if 0 __asm__("popl %ecx\n\t" /* now state 3 */ "movl (%esp),%edx\n\t" @@ -1288,7 +1289,7 @@ "pushl %ecx"); #endif } - CODE(opc_dup_x1, dup_x1, ST1, ST4) { + CODE(opc_dup_x1, dup_x1, ST1, ST4, 0) { #if 0 __asm__("movl (%esp),%ecx\n\t" "movl %edx,(%esp)"); @@ -1297,10 +1298,10 @@ "pushl %edx"); #endif } - CODE(opc_dup_x1, dup_x1, ST2, ST2) { + CODE(opc_dup_x1, dup_x1, ST2, ST2, 0) { __asm__("pushl %ecx"); } - CODE(opc_dup_x1, dup_x1, ST3, ST2) { + CODE(opc_dup_x1, dup_x1, ST3, ST2, 0) { #if 0 __asm__("movl (%esp),%edx\n\t" "movl %ecx,(%esp)"); @@ -1309,7 +1310,7 @@ "pushl %ecx"); #endif } - CODE(opc_dup_x1, dup_x1, ST4, ST4) { + CODE(opc_dup_x1, dup_x1, ST4, ST4, 0) { __asm__("pushl %edx"); } @@ -1325,28 +1326,28 @@ "pushl %eax") #endif - CODE(opc_dup_x2, dup_x2, ST0, ST2) { + CODE(opc_dup_x2, dup_x2, ST0, ST2, 0) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ DUP_X2_ST24(%ecx); } - CODE(opc_dup_x2, dup_x2, ST1, ST4) { + CODE(opc_dup_x2, dup_x2, ST1, ST4, 0) { __asm__("popl %ecx"); /* now state 4 */ DUP_X2_ST24(%edx); } - CODE(opc_dup_x2, dup_x2, ST2, ST2) { + CODE(opc_dup_x2, dup_x2, ST2, ST2, 0) { DUP_X2_ST24(%ecx); } - CODE(opc_dup_x2, dup_x2, ST3, ST2) { + CODE(opc_dup_x2, dup_x2, ST3, ST2, 0) { __asm__("popl %edx"); /* now state 2 */ DUP_X2_ST24(%ecx); } - CODE(opc_dup_x2, dup_x2, ST4, ST4) { + CODE(opc_dup_x2, dup_x2, ST4, ST4, 0) { DUP_X2_ST24(%edx); } /* dup2 */ - CODE(opc_dup2, dup2, ST0, ST2) { + CODE(opc_dup2, dup2, ST0, ST2, 0) { #if 0 __asm__("movl (%esp),%ecx\n\t" "movl 4(%esp),%edx"); @@ -1356,19 +1357,19 @@ "subl $8,%esp"); #endif } - CODE(opc_dup2, dup2, ST1, ST4) { + CODE(opc_dup2, dup2, ST1, ST4, 0) { __asm__("movl (%esp),%ecx\n\t" "pushl %edx"); } - CODE(opc_dup2, dup2, ST2, ST2) { + CODE(opc_dup2, dup2, ST2, ST2, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); } - CODE(opc_dup2, dup2, ST3, ST2) { + CODE(opc_dup2, dup2, ST3, ST2, 0) { __asm__("movl (%esp),%edx\n\t" "pushl %ecx"); } - CODE(opc_dup2, dup2, ST4, ST4) { + CODE(opc_dup2, dup2, ST4, ST4, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); } @@ -1380,23 +1381,23 @@ "pushl " #OPTOP1_REG "\n\t" /* optop[-4] = optop[-1] */\ "pushl %eax") /* optop[-3] = eax */ - CODE(opc_dup2_x1, dup2_x1, ST0, ST2) { + CODE(opc_dup2_x1, dup2_x1, ST0, ST2, 0) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ DUP2_X1_ST24(%ecx, %edx); } - CODE(opc_dup2_x1, dup2_x1, ST1, ST4) { + CODE(opc_dup2_x1, dup2_x1, ST1, ST4, 0) { __asm__("popl %ecx"); /* now state 4 */ DUP2_X1_ST24(%edx, %ecx); } - CODE(opc_dup2_x1, dup2_x1, ST2, ST2) { + CODE(opc_dup2_x1, dup2_x1, ST2, ST2, 0) { DUP2_X1_ST24(%ecx, %edx); } - CODE(opc_dup2_x1, dup2_x1, ST3, ST2) { + CODE(opc_dup2_x1, dup2_x1, ST3, ST2, 0) { __asm__("popl %edx"); /* now state 2 */ DUP2_X1_ST24(%ecx, %edx); } - CODE(opc_dup2_x1, dup2_x1, ST4, ST4) { + CODE(opc_dup2_x1, dup2_x1, ST4, ST4, 0) { DUP2_X1_ST24(%edx, %ecx); } @@ -1409,39 +1410,39 @@ "pushl %edi\n\t" /* optop[-2] = edi */\ "pushl %eax"); /* optop[-1] = eax */ - CODE(opc_dup2_x2, dup2_x2, ST0, ST2) { + CODE(opc_dup2_x2, dup2_x2, ST0, ST2, 0) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ DUP2_X2_ST24(%ecx, %edx); } - CODE(opc_dup2_x2, dup2_x2, ST1, ST4) { + CODE(opc_dup2_x2, dup2_x2, ST1, ST4, 0) { __asm__("popl %ecx"); /* now state 4 */ DUP2_X2_ST24(%edx, %ecx); } - CODE(opc_dup2_x2, dup2_x2, ST2, ST2) { + CODE(opc_dup2_x2, dup2_x2, ST2, ST2, 0) { DUP2_X2_ST24(%ecx, %edx); } - CODE(opc_dup2_x2, dup2_x2, ST3, ST2) { + CODE(opc_dup2_x2, dup2_x2, ST3, ST2, 0) { __asm__("popl %edx"); /* now state 2 */ DUP2_X2_ST24(%ecx, %edx); } - CODE(opc_dup2_x2, dup2_x2, ST4, ST4) { + CODE(opc_dup2_x2, dup2_x2, ST4, ST4, 0) { DUP2_X2_ST24(%edx, %ecx); } /* swap */ - CODE(opc_swap, swap, ST0, ST4) { + CODE(opc_swap, swap, ST0, ST4, 0) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ } - CODE(opc_swap, swap, ST1, ST2) { + CODE(opc_swap, swap, ST1, ST2, 0) { __asm__("popl %ecx"); /* now state 4 */ } - CODE(opc_swap, swap, ST2, ST4) {} - CODE(opc_swap, swap, ST3, ST4) { + CODE(opc_swap, swap, ST2, ST4, 0) {} + CODE(opc_swap, swap, ST3, ST4, 0) { __asm__("popl %edx"); /* now state 2 */ } - CODE(opc_swap, swap, ST4, ST2) {} + CODE(opc_swap, swap, ST4, ST2, 0) {} /* iadd, isub, imul, iand, ior, ixor */ #ifdef RUNTIME_DEBUG @@ -1461,27 +1462,27 @@ #endif #define CODE_ARITH_INT(VOP, ROP, SYM) \ - CODE(opc_i##VOP, i##VOP, ST0, ST1) {\ + CODE(opc_i##VOP, i##VOP, ST0, ST1, 0) {\ __asm__("popl %ecx\n\t"\ "popl %edx"); /* now state 2 */\ ARITH_INT_DEBUG1(%edx, %ecx, SYM);\ __asm__(#ROP "l %ecx,%edx");\ }\ - CODE(opc_i##VOP, i##VOP, ST1, ST3) {\ + CODE(opc_i##VOP, i##VOP, ST1, ST3, 0) {\ __asm__("popl %ecx"); /* now state 4 */\ ARITH_INT_DEBUG1(%ecx, %edx, SYM);\ __asm__(#ROP "l %edx,%ecx");\ }\ - CODE(opc_i##VOP, i##VOP, ST2, ST1) {\ + CODE(opc_i##VOP, i##VOP, ST2, ST1, 0) {\ ARITH_INT_DEBUG1(%edx, %ecx, SYM);\ __asm__(#ROP "l %ecx,%edx");\ }\ - CODE(opc_i##VOP, i##VOP, ST3, ST1) {\ + CODE(opc_i##VOP, i##VOP, ST3, ST1, 0) {\ __asm__("popl %edx"); /* now state 2 */\ ARITH_INT_DEBUG1(%edx, %ecx, SYM);\ __asm__(#ROP "l %ecx,%edx");\ }\ - CODE(opc_i##VOP, i##VOP, ST4, ST3) {\ + CODE(opc_i##VOP, i##VOP, ST4, ST3, 0) {\ ARITH_INT_DEBUG1(%ecx, %edx, SYM);\ __asm__(#ROP "l %edx,%ecx");\ } @@ -1501,7 +1502,7 @@ __asm__("i" #VOP "_st" #STATE "_1:") #define CODE_ARITH_INT_TEST(VOP, RESULT_REG) \ - CODE(opc_i##VOP, i##VOP, ST0, ST3) {\ + CODE(opc_i##VOP, i##VOP, ST0, ST3, 0) {\ __asm__("popl %ecx"); /* now state 3 */\ INT_TEST(VOP, 0, %ecx);\ __asm__("popl %eax\n\t"\ @@ -1510,7 +1511,7 @@ "idivl %ecx\n\t"\ "movl " #RESULT_REG ",%ecx");\ }\ - CODE(opc_i##VOP, i##VOP, ST1, ST3) {\ + CODE(opc_i##VOP, i##VOP, ST1, ST3, 0) {\ INT_TEST(VOP, 1, %edx);\ __asm__("popl %eax\n\t"\ "movl %edx,%ecx\n\t"\ @@ -1518,21 +1519,21 @@ "idivl %ecx\n\t"\ "movl " #RESULT_REG ",%ecx");\ }\ - CODE(opc_i##VOP, i##VOP, ST2, ST3) {\ + CODE(opc_i##VOP, i##VOP, ST2, ST3, 0) {\ INT_TEST(VOP, 2, %ecx);\ __asm__("movl %edx,%eax\n\t"\ "cdq\n\t"\ "idivl %ecx\n\t"\ "movl " #RESULT_REG ",%ecx");\ }\ - CODE(opc_i##VOP, i##VOP, ST3, ST3) {\ + CODE(opc_i##VOP, i##VOP, ST3, ST3, 0) {\ INT_TEST(VOP, 3, %ecx);\ __asm__("popl %eax\n\t"\ "cdq\n\t"\ "idivl %ecx\n\t" /* %eax ... %edx = %edx:%eax / %ecx */\ "movl " #RESULT_REG ",%ecx");\ }\ - CODE(opc_i##VOP, i##VOP, ST4, ST3) {\ + CODE(opc_i##VOP, i##VOP, ST4, ST3, 0) {\ INT_TEST(VOP, 4, %edx);\ __asm__("movl %ecx,%eax\n\t"\ "movl %edx,%ecx\n\t"\ @@ -1571,27 +1572,27 @@ #ROP2 "l %edi," #OPTOP2_REG) /* [32:63] */ #define CODE_ARITH_LONG_SUB(VOP, ROP1, ROP2, SYM) \ - CODE(opc_l##VOP, l##VOP, ST0, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST0, ST2, 0) {\ __asm__("popl %eax\n\t"\ "popl %edi");\ ARITH_LONG_SUB(ROP1, ROP2, %ecx, %edx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST1, ST4) {\ + CODE(opc_l##VOP, l##VOP, ST1, ST4, 0) {\ __asm__("movl %edx,%eax\n\t"\ "popl %edi");\ ARITH_LONG_SUB(ROP1, ROP2, %edx, %ecx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST2, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST2, ST2, 0) {\ __asm__("movl %ecx,%eax\n\t"\ "movl %edx,%edi");\ ARITH_LONG_SUB(ROP1, ROP2, %ecx, %edx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST3, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST3, ST2, 0) {\ __asm__("movl %ecx,%eax\n\t"\ "popl %edi");\ ARITH_LONG_SUB(ROP1, ROP2, %ecx, %edx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST4, ST4) {\ + CODE(opc_l##VOP, l##VOP, ST4, ST4, 0) {\ __asm__("movl %edx,%eax\n\t"\ "movl %ecx,%edi");\ ARITH_LONG_SUB(ROP1, ROP2, %edx, %ecx, SYM);\ @@ -1605,23 +1606,23 @@ #ROP2 "l %edi," #OPTOP2_REG) /* [32:63] */ #define CODE_ARITH_LONG(VOP, ROP1, ROP2, SYM) \ - CODE(opc_l##VOP, l##VOP, ST0, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST0, ST2, 0) {\ __asm__("popl %ecx\n\t"\ "popl %edx"); /* now state 2 */\ ARITH_LONG(ROP1, ROP2, %ecx, %edx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST1, ST4) {\ + CODE(opc_l##VOP, l##VOP, ST1, ST4, 0) {\ __asm__("popl %ecx"); /* now state 4 */\ ARITH_LONG(ROP1, ROP2, %edx, %ecx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST2, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST2, ST2, 0) {\ ARITH_LONG(ROP1, ROP2, %ecx, %edx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST3, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST3, ST2, 0) {\ __asm__("popl %edx"); /* now state 2 */\ ARITH_LONG(ROP1, ROP2, %ecx, %edx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST4, ST4) {\ + CODE(opc_l##VOP, l##VOP, ST4, ST4, 0) {\ ARITH_LONG(ROP1, ROP2, %edx, %ecx, SYM);\ } @@ -1667,27 +1668,27 @@ "movl -4(%esp),%edx\n\t" /* now state 2 */\ "addl $8,%esp") - CODE(opc_lmul, lmul, ST0, ST2) { + CODE(opc_lmul, lmul, ST0, ST2, 0) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ ARITH_LONG_CALL_DEBUG1(%ecx, %edx, "*"); LMUL_ST24(%ecx, %ecx, %edi); } - CODE(opc_lmul, lmul, ST1, ST2) { + CODE(opc_lmul, lmul, ST1, ST2, 0) { __asm__("popl %ecx"); /* now state 4 */ ARITH_LONG_CALL_DEBUG1(%edx, %ecx, "*"); LMUL_ST24(%edx, %edi, %ecx); } - CODE(opc_lmul, lmul, ST2, ST2) { + CODE(opc_lmul, lmul, ST2, ST2, 0) { ARITH_LONG_CALL_DEBUG1(%ecx, %edx, "*"); LMUL_ST24(%ecx, %ecx, %edi); } - CODE(opc_lmul, lmul, ST3, ST2) { + CODE(opc_lmul, lmul, ST3, ST2, 0) { __asm__("popl %edx"); /* now state 2 */ ARITH_LONG_CALL_DEBUG1(%ecx, %edx, "*"); LMUL_ST24(%ecx, %ecx, %edi); } - CODE(opc_lmul, lmul, ST4, ST2) { + CODE(opc_lmul, lmul, ST4, ST2, 0) { ARITH_LONG_CALL_DEBUG1(%edx, %ecx, "*"); LMUL_ST24(%edx, %edi, %ecx); } @@ -1719,27 +1720,27 @@ /* now state [24] */ #define CODE_ARITH_LONG_TEST(VOP, ROP, SYM) \ - CODE(opc_l##VOP, l##VOP, ST0, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST0, ST2, 0) {\ __asm__("popl %ecx\n\t"\ "popl %edx"); /* now state 2 */\ LONG_TEST_ST24(VOP, 0);\ ARITH_LONG_CALL_ST24(ROP, %ecx, %edx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST1, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST1, ST2, 0) {\ __asm__("popl %ecx"); /* now state 4 */\ LONG_TEST_ST24(VOP, 1);\ ARITH_LONG_CALL_ST24(ROP, %edx, %ecx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST2, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST2, ST2, 0) {\ LONG_TEST_ST24(VOP, 2);\ ARITH_LONG_CALL_ST24(ROP, %ecx, %edx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST3, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST3, ST2, 0) {\ __asm__("popl %edx"); /* now state 2 */\ LONG_TEST_ST24(VOP, 3);\ ARITH_LONG_CALL_ST24(ROP, %ecx, %edx, SYM);\ }\ - CODE(opc_l##VOP, l##VOP, ST4, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST4, ST2, 0) {\ LONG_TEST_ST24(VOP, 4);\ ARITH_LONG_CALL_ST24(ROP, %edx, %ecx, SYM);\ } @@ -1781,7 +1782,7 @@ #endif #define CODE_ARITH_FLOAT(VOP, ROP, SYM) \ - CODE(opc_f##VOP, f##VOP, ST0, ST0) {\ + CODE(opc_f##VOP, f##VOP, ST0, ST0, 0) {\ ARITH_FLOAT_DEBUG1(SYM);\ __asm__("flds 4(%esp)\n\t"\ "f" #ROP "s (%esp)\n\t"\ @@ -1789,7 +1790,7 @@ "fstps (%esp)");\ ARITH_FLOAT_DEBUG2;\ }\ - CODE(opc_f##VOP, f##VOP, ST1, ST0) {\ + CODE(opc_f##VOP, f##VOP, ST1, ST0, 0) {\ __asm__("flds (%esp)\n\t"\ "pushl %edx");\ ARITH_FLOAT_DEBUG1(SYM);\ @@ -1798,7 +1799,7 @@ "fstps (%esp)");\ ARITH_FLOAT_DEBUG2;\ }\ - CODE(opc_f##VOP, f##VOP, ST2, ST0) {\ + CODE(opc_f##VOP, f##VOP, ST2, ST0, 0) {\ __asm__("pushl %edx\n\t"\ "flds (%esp)\n\t"\ "pushl %ecx");\ @@ -1808,7 +1809,7 @@ "fstps (%esp)");\ ARITH_FLOAT_DEBUG2;\ }\ - CODE(opc_f##VOP, f##VOP, ST3, ST0) {\ + CODE(opc_f##VOP, f##VOP, ST3, ST0, 0) {\ __asm__("flds (%esp)\n\t"\ "pushl %ecx");\ ARITH_FLOAT_DEBUG1(SYM);\ @@ -1817,7 +1818,7 @@ "fstps (%esp)");\ ARITH_FLOAT_DEBUG2;\ }\ - CODE(opc_f##VOP, f##VOP, ST4, ST0) {\ + CODE(opc_f##VOP, f##VOP, ST4, ST0, 0) {\ __asm__("pushl %ecx\n\t"\ "flds (%esp)\n\t"\ "pushl %edx\n\t"\ @@ -1877,23 +1878,23 @@ /* now state 0 */ #define CODE_ARITH_DOUBLE(VOP, ROP, SYM) \ - CODE(opc_d##VOP, d##VOP, ST0, ST0) {\ + CODE(opc_d##VOP, d##VOP, ST0, ST0, 0) {\ __asm__("popl %ecx\n\t"\ "popl %edx"); /* now state 2 */\ DOUBLE_ST24(ROP, %ecx, %edx, SYM);\ }\ - CODE(opc_d##VOP, d##VOP, ST1, ST0) {\ + CODE(opc_d##VOP, d##VOP, ST1, ST0, 0) {\ __asm__("popl %ecx"); /* now state 4 */\ DOUBLE_ST24(ROP, %edx, %ecx, SYM);\ }\ - CODE(opc_d##VOP, d##VOP, ST2, ST0) {\ + CODE(opc_d##VOP, d##VOP, ST2, ST0, 0) {\ DOUBLE_ST24(ROP, %ecx, %edx, SYM);\ }\ - CODE(opc_d##VOP, d##VOP, ST3, ST0) {\ + CODE(opc_d##VOP, d##VOP, ST3, ST0, 0) {\ __asm__("popl %edx"); /* now state 2 */\ DOUBLE_ST24(ROP, %ecx, %edx, SYM);\ }\ - CODE(opc_d##VOP, d##VOP, ST4, ST0) {\ + CODE(opc_d##VOP, d##VOP, ST4, ST0, 0) {\ DOUBLE_ST24(ROP, %edx, %ecx, SYM);\ } @@ -1919,21 +1920,21 @@ ARITH_FLOAT_DEBUG2 /* now state 0 */ - CODE(opc_frem, frem, ST0, ST0) { FREM_ST0; } - CODE(opc_frem, frem, ST1, ST0) { + CODE(opc_frem, frem, ST0, ST0, 0) { FREM_ST0; } + CODE(opc_frem, frem, ST1, ST0, 0) { __asm__("pushl %edx"); /* now state 0 */ FREM_ST0; } - CODE(opc_frem, frem, ST2, ST0) { + CODE(opc_frem, frem, ST2, ST0, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); /* now state 0 */ FREM_ST0; } - CODE(opc_frem, frem, ST3, ST0) { + CODE(opc_frem, frem, ST3, ST0, 0) { __asm__("pushl %ecx"); /* now state 0 */ FREM_ST0; } - CODE(opc_frem, frem, ST4, ST0) { + CODE(opc_frem, frem, ST4, ST0, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); /* now state 0 */ FREM_ST0; @@ -1957,45 +1958,45 @@ ARITH_DOUBLE_DEBUG2 /* now state 0 */ - CODE(opc_drem, drem, ST0, ST0) { + CODE(opc_drem, drem, ST0, ST0, 0) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ DREM_ST24(%ecx, %edx); } - CODE(opc_drem, drem, ST1, ST0) { + CODE(opc_drem, drem, ST1, ST0, 0) { __asm__("popl %ecx"); /* now state 4 */ DREM_ST24(%edx, %ecx); } - CODE(opc_drem, drem, ST2, ST0) { + CODE(opc_drem, drem, ST2, ST0, 0) { DREM_ST24(%ecx, %edx); } - CODE(opc_drem, drem, ST3, ST0) { + CODE(opc_drem, drem, ST3, ST0, 0) { __asm__("popl %edx"); /* now state 2 */ DREM_ST24(%ecx, %edx); } - CODE(opc_drem, drem, ST4, ST0) { + CODE(opc_drem, drem, ST4, ST0, 0) { DREM_ST24(%edx, %ecx); } /* ineg */ - CODE(opc_ineg, ineg, ST0, ST1) { + CODE(opc_ineg, ineg, ST0, ST1, 0) { __asm__("popl %edx\n\t" /* now state 1 */ "negl %edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_ineg, ineg, ST1, ST1) { + CODE(opc_ineg, ineg, ST1, ST1, 0) { __asm__("negl %edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_ineg, ineg, ST2, ST2) { + CODE(opc_ineg, ineg, ST2, ST2, 0) { __asm__("negl %ecx"); BIPUSH_DEBUG1(%ecx); } - CODE(opc_ineg, ineg, ST3, ST3) { + CODE(opc_ineg, ineg, ST3, ST3, 0) { __asm__("negl %ecx"); BIPUSH_DEBUG1(%ecx); } - CODE(opc_ineg, ineg, ST4, ST4) { + CODE(opc_ineg, ineg, ST4, ST4, 0) { __asm__("negl %edx"); BIPUSH_DEBUG1(%edx); } @@ -2008,23 +2009,23 @@ LDC2_W_DEBUG1(OPTOP1_REG, OPTOP2_REG) /* now state [24] */ - CODE(opc_lneg, lneg, ST0, ST2) { + CODE(opc_lneg, lneg, ST0, ST2, 0) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ LNEG_ST24(%ecx, %edx); } - CODE(opc_lneg, lneg, ST1, ST4) { + CODE(opc_lneg, lneg, ST1, ST4, 0) { __asm__("popl %ecx"); /* now state 4 */ LNEG_ST24(%edx, %ecx); } - CODE(opc_lneg, lneg, ST2, ST2) { + CODE(opc_lneg, lneg, ST2, ST2, 0) { LNEG_ST24(%ecx, %edx); } - CODE(opc_lneg, lneg, ST3, ST2) { + CODE(opc_lneg, lneg, ST3, ST2, 0) { __asm__("popl %edx"); /* now state 2 */ LNEG_ST24(%ecx, %edx); } - CODE(opc_lneg, lneg, ST4, ST4) { + CODE(opc_lneg, lneg, ST4, ST4, 0) { LNEG_ST24(%edx, %ecx); } @@ -2035,23 +2036,23 @@ "fstps (%esp)") /* now state 0 */ - CODE(opc_fneg, fneg, ST0, ST0) { + CODE(opc_fneg, fneg, ST0, ST0, 0) { FNEG_ST0; } - CODE(opc_fneg, fneg, ST1, ST0) { + CODE(opc_fneg, fneg, ST1, ST0, 0) { __asm__("pushl %edx"); /* now state 0 */ FNEG_ST0; } - CODE(opc_fneg, fneg, ST2, ST0) { + CODE(opc_fneg, fneg, ST2, ST0, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); /* now state 0 */ FNEG_ST0; } - CODE(opc_fneg, fneg, ST3, ST0) { + CODE(opc_fneg, fneg, ST3, ST0, 0) { __asm__("pushl %ecx"); /* now state 0 */ FNEG_ST0; } - CODE(opc_fneg, fneg, ST4, ST0) { + CODE(opc_fneg, fneg, ST4, ST0, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); /* now state 0 */ FNEG_ST0; @@ -2064,23 +2065,23 @@ "fstpl (%esp)") /* now state 0 */ - CODE(opc_dneg, dneg, ST0, ST0) { + CODE(opc_dneg, dneg, ST0, ST0, 0) { DNEG_ST0; } - CODE(opc_dneg, dneg, ST1, ST0) { + CODE(opc_dneg, dneg, ST1, ST0, 0) { __asm__("pushl %edx"); /* now state 0 */ DNEG_ST0; } - CODE(opc_dneg, dneg, ST2, ST0) { + CODE(opc_dneg, dneg, ST2, ST0, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); /* now state 0 */ DNEG_ST0; } - CODE(opc_dneg, dneg, ST3, ST0) { + CODE(opc_dneg, dneg, ST3, ST0, 0) { __asm__("pushl %ecx"); /* now state 0 */ DNEG_ST0; } - CODE(opc_dneg, dneg, ST4, ST0) { + CODE(opc_dneg, dneg, ST4, ST0, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); /* now state 0 */ DNEG_ST0; @@ -2092,28 +2093,28 @@ /* now state 1 */ #define CODE_SHIFT_INT(VOP, ROP) \ - CODE(opc_i##VOP, i##VOP, ST0, ST1) {\ + CODE(opc_i##VOP, i##VOP, ST0, ST1, 0) {\ __asm__("popl %ecx\n\t"\ "popl %edx"); /* now state 2 */\ SHIFT_INT_ST2(ROP);\ BIPUSH_DEBUG1(%edx);\ }\ - CODE(opc_i##VOP, i##VOP, ST1, ST1) {\ + CODE(opc_i##VOP, i##VOP, ST1, ST1, 0) {\ __asm__("movl %edx,%ecx\n\t"\ "popl %edx\n\t"); /* now state 2 */\ SHIFT_INT_ST2(ROP);\ BIPUSH_DEBUG1(%edx);\ }\ - CODE(opc_i##VOP, i##VOP, ST2, ST1) {\ + CODE(opc_i##VOP, i##VOP, ST2, ST1, 0) {\ SHIFT_INT_ST2(ROP);\ BIPUSH_DEBUG1(%edx);\ }\ - CODE(opc_i##VOP, i##VOP, ST3, ST1) {\ + CODE(opc_i##VOP, i##VOP, ST3, ST1, 0) {\ __asm__("popl %edx"); /* now state 2 */\ SHIFT_INT_ST2(ROP);\ BIPUSH_DEBUG1(%edx);\ }\ - CODE(opc_i##VOP, i##VOP, ST4, ST1) {\ + CODE(opc_i##VOP, i##VOP, ST4, ST1, 0) {\ __asm__("xchg %ecx,%edx"); /* now state 2 */\ SHIFT_INT_ST2(ROP);\ BIPUSH_DEBUG1(%edx);\ @@ -2124,11 +2125,33 @@ CODE_SHIFT_INT(ushr, shr); /* lshl, lshr, lushr */ -#define SHIFT_LONG(ROP64, ROP32, OP2_REG, OP3_REG) \ - /*\ - * %cl is shift count.\ - * OP2 and OP3 are %eax and %edx.\ - */\ + /* + * %cl is shift count. + * OP2 and OP3 are %eax and %edx. + */ +#if 1 /* code generated by egcs-1.0.3 */ +#define SHIFT_SIGNED_LONG(ROP64, ROP32, OP2_REG, OP3_REG, LABEL) \ + __asm__(#ROP64 "l %cl," #OP2_REG "," #OP3_REG "\n\t"\ + #ROP32 "l %cl," #OP2_REG "\n\t"\ + "testb $0x20,%cl\n\t"\ + "jz " LABEL "\n\t"\ + "movl " #OP2_REG "," #OP3_REG "\n\t"\ + #ROP32 "l $0x1f," #OP2_REG "\n\t"\ + LABEL ":\n\t"\ + "movl %eax,%ecx") + /* now state 2 or 4 */ +#define SHIFT_UNSIGNED_LONG(ROP64, ROP32, OP2_REG, OP3_REG, LABEL) \ + __asm__(#ROP64 "l %cl," #OP2_REG "," #OP3_REG "\n\t"\ + #ROP32 "l %cl," #OP2_REG "\n\t"\ + "testb $0x20,%cl\n\t"\ + "jz " LABEL "\n\t"\ + "movl " #OP2_REG "," #OP3_REG "\n\t"\ + "xorl " #OP2_REG "," #OP2_REG "\n\t" /* clear OP2_REG */\ + LABEL ":\n\t"\ + "movl %eax,%ecx") + /* now state 2 or 4 */ +#else /* code generated by gcc-2.7.2.3 */ +#define SHIFT_LONG(ROP64, ROP32, OP2_REG, OP3_REG, LABEL) \ __asm__("rorb %cl\n\t"\ #ROP64 "l %cl," #OP2_REG "," #OP3_REG "\n\t"\ #ROP32 "l %cl," #OP2_REG "\n\t"\ @@ -2139,44 +2162,45 @@ #ROP32 "l %cl," #OP2_REG "\n\t"\ "movl %eax,%ecx") /* now state 2 or 4 */ +#endif -#define CODE_SHIFT_LONG(VOP, ROP64, ROP32, REG_A, REG_B) \ - CODE(opc_l##VOP, l##VOP, ST0, ST2) {\ +#define CODE_SHIFT_LONG(SIGNEDP, VOP, ROP64, ROP32, REG_A, REG_B) \ + CODE(opc_l##VOP, l##VOP, ST0, ST2, 0) {\ __asm__("popl %ecx\n\t" /* ecx = shift count */\ "popl %eax\n\t" /* eax = [0:31] */\ "popl %edx"); /* edx = [32:63] */\ - SHIFT_LONG(ROP64, ROP32, REG_A, REG_B);\ + SHIFT_##SIGNEDP##_LONG(ROP64, ROP32, REG_A, REG_B, #VOP "_st0");\ LDC2_W_DEBUG1(%ecx, %edx);\ }\ - CODE(opc_l##VOP, l##VOP, ST1, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST1, ST2, 0) {\ __asm__("movl %edx,%ecx\n\t" /* ecx = shift count (%edx) */\ "popl %eax\n\t" /* eax = [0:31] */\ "popl %edx"); /* edx = [32:63] */\ - SHIFT_LONG(ROP64, ROP32, REG_A, REG_B);\ + SHIFT_##SIGNEDP##_LONG(ROP64, ROP32, REG_A, REG_B, #VOP "_st1");\ LDC2_W_DEBUG1(%ecx, %edx);\ }\ - CODE(opc_l##VOP, l##VOP, ST2, ST4) {\ + CODE(opc_l##VOP, l##VOP, ST2, ST4, 0) {\ __asm__("popl %eax"); /* eax = [32:63] */\ - SHIFT_LONG(ROP64, ROP32, REG_B, REG_A);\ + SHIFT_##SIGNEDP##_LONG(ROP64, ROP32, REG_B, REG_A, #VOP "_st2");\ LDC2_W_DEBUG1(%edx, %ecx);\ }\ - CODE(opc_l##VOP, l##VOP, ST3, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST3, ST2, 0) {\ __asm__("popl %eax\n\t" /* eax = [0:31] */\ "popl %edx"); /* edx = [32:63] */\ - SHIFT_LONG(ROP64, ROP32, REG_A, REG_B);\ + SHIFT_##SIGNEDP##_LONG(ROP64, ROP32, REG_A, REG_B, #VOP "_st3");\ LDC2_W_DEBUG1(%ecx, %edx);\ }\ - CODE(opc_l##VOP, l##VOP, ST4, ST2) {\ + CODE(opc_l##VOP, l##VOP, ST4, ST2, 0) {\ __asm__("movl %ecx,%eax\n\t" /* eax = [0:31] (ecx) */\ "movl %edx,%ecx\n\t" /* ecx = shift count (edx) */\ "popl %edx"); /* edx = [32:63] */\ - SHIFT_LONG(ROP64, ROP32, REG_A, REG_B);\ + SHIFT_##SIGNEDP##_LONG(ROP64, ROP32, REG_A, REG_B, #VOP "_st4");\ LDC2_W_DEBUG1(%ecx, %edx);\ } - CODE_SHIFT_LONG(shl, shld, shl, %eax, %edx); - CODE_SHIFT_LONG(shr, shrd, sar, %edx, %eax); - CODE_SHIFT_LONG(ushr, shrd, shr, %edx, %eax); + CODE_SHIFT_LONG(UNSIGNED, shl, shld, shl, %eax, %edx); + CODE_SHIFT_LONG(SIGNED, shr, shrd, sar, %edx, %eax); + CODE_SHIFT_LONG(UNSIGNED, ushr, shrd, shr, %edx, %eax); /* iinc */ /* const: (signed char *pc)[2], pc[1] * 4 */ @@ -2200,31 +2224,31 @@ # define IINC_DEBUG1 #endif - CODE(opc_iinc, iinc, STANY, STSTA) { + CODE(opc_iinc, iinc, STANY, STSTA, 0) { __asm__("addl $" STR(CONST) "," STR(CONST) "(%esi)"); IINC_DEBUG1; } /* i2l */ - CODE(opc_i2l, i2l, ST0, ST2) { + CODE(opc_i2l, i2l, ST0, ST2, 0) { __asm__("popl %edx\n\t" /* now state 1 */ "movl %edx,%ecx\n\t" "sarl $31,%edx"); } - CODE(opc_i2l, i2l, ST1, ST2) { + CODE(opc_i2l, i2l, ST1, ST2, 0) { __asm__("movl %edx,%ecx\n\t" "sarl $31,%edx"); } - CODE(opc_i2l, i2l, ST2, ST4) { + CODE(opc_i2l, i2l, ST2, ST4, 0) { __asm__("pushl %edx\n\t" /* now state 3 */ "movl %ecx,%edx\n\t" "sarl $31,%ecx"); } - CODE(opc_i2l, i2l, ST3, ST4) { + CODE(opc_i2l, i2l, ST3, ST4, 0) { __asm__("movl %ecx,%edx\n\t" "sarl $31,%ecx"); } - CODE(opc_i2l, i2l, ST4, ST2) { + CODE(opc_i2l, i2l, ST4, ST2, 0) { __asm__("pushl %ecx\n\t" /* now state 1 */ "movl %edx,%ecx\n\t" "sarl $31,%edx"); @@ -2235,23 +2259,23 @@ __asm__("fildl (%esp)\n\t"\ "fstps (%esp)") - CODE(opc_i2f, i2f, ST0, ST0) { + CODE(opc_i2f, i2f, ST0, ST0, 0) { I2F_ST0; } - CODE(opc_i2f, i2f, ST1, ST0) { + CODE(opc_i2f, i2f, ST1, ST0, 0) { __asm__("pushl %edx"); /* now state 0 */ I2F_ST0; } - CODE(opc_i2f, i2f, ST2, ST0) { + CODE(opc_i2f, i2f, ST2, ST0, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); /* now state 0 */ I2F_ST0; } - CODE(opc_i2f, i2f, ST3, ST0) { + CODE(opc_i2f, i2f, ST3, ST0, 0) { __asm__("pushl %ecx"); /* now state 0 */ I2F_ST0; } - CODE(opc_i2f, i2f, ST4, ST0) { + CODE(opc_i2f, i2f, ST4, ST0, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); /* now state 0 */ I2F_ST0; @@ -2263,41 +2287,41 @@ "fstpl -4(%esp)\n\t"\ "subl $4,%esp") - CODE(opc_i2d, i2d, ST0, ST0) { + CODE(opc_i2d, i2d, ST0, ST0, 0) { I2D_ST0; } - CODE(opc_i2d, i2d, ST1, ST0) { + CODE(opc_i2d, i2d, ST1, ST0, 0) { __asm__("pushl %edx"); /* now state 0 */ I2D_ST0; } - CODE(opc_i2d, i2d, ST2, ST0) { + CODE(opc_i2d, i2d, ST2, ST0, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); /* now state 0 */ I2D_ST0; } - CODE(opc_i2d, i2d, ST3, ST0) { + CODE(opc_i2d, i2d, ST3, ST0, 0) { __asm__("pushl %ecx"); /* now state 0 */ I2D_ST0; } - CODE(opc_i2d, i2d, ST4, ST0) { + CODE(opc_i2d, i2d, ST4, ST0, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); /* now state 0 */ I2D_ST0; } /* l2i */ - CODE(opc_l2i, l2i, ST0, ST1) { + CODE(opc_l2i, l2i, ST0, ST1, 0) { __asm__("popl %edx\n\t" /* now state 1 */ "addl $4,%esp"); } - CODE(opc_l2i, l2i, ST1, ST1) { + CODE(opc_l2i, l2i, ST1, ST1, 0) { __asm__("addl $4,%esp"); } - CODE(opc_l2i, l2i, ST2, ST3) {} - CODE(opc_l2i, l2i, ST3, ST3) { + CODE(opc_l2i, l2i, ST2, ST3, 0) {} + CODE(opc_l2i, l2i, ST3, ST3, 0) { __asm__("addl $4,%esp"); } - CODE(opc_l2i, l2i, ST4, ST1) {} + CODE(opc_l2i, l2i, ST4, ST1, 0) {} /* l2f */ #define L2F_ST0 \ @@ -2305,23 +2329,23 @@ "fstps 4(%esp)\n\t"\ "addl $4,%esp") - CODE(opc_l2f, l2f, ST0, ST0) { + CODE(opc_l2f, l2f, ST0, ST0, 0) { L2F_ST0; } - CODE(opc_l2f, l2f, ST1, ST0) { + CODE(opc_l2f, l2f, ST1, ST0, 0) { __asm__("pushl %edx"); /* now state 0 */ L2F_ST0; } - CODE(opc_l2f, l2f, ST2, ST0) { + CODE(opc_l2f, l2f, ST2, ST0, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); /* now state 0 */ L2F_ST0; } - CODE(opc_l2f, l2f, ST3, ST0) { + CODE(opc_l2f, l2f, ST3, ST0, 0) { __asm__("pushl %ecx"); /* now state 0 */ L2F_ST0; } - CODE(opc_l2f, l2f, ST4, ST0) { + CODE(opc_l2f, l2f, ST4, ST0, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); /* now state 0 */ L2F_ST0; @@ -2332,23 +2356,23 @@ __asm__("fildll (%esp)\n\t"\ "fstpl (%esp)") - CODE(opc_l2d, l2d, ST0, ST0) { + CODE(opc_l2d, l2d, ST0, ST0, 0) { L2D_ST0; } - CODE(opc_l2d, l2d, ST1, ST0) { + CODE(opc_l2d, l2d, ST1, ST0, 0) { __asm__("pushl %edx"); /* now state 0 */ L2D_ST0; } - CODE(opc_l2d, l2d, ST2, ST0) { + CODE(opc_l2d, l2d, ST2, ST0, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); /* now state 0 */ L2D_ST0; } - CODE(opc_l2d, l2d, ST3, ST0) { + CODE(opc_l2d, l2d, ST3, ST0, 0) { __asm__("pushl %ecx"); /* now state 0 */ L2D_ST0; } - CODE(opc_l2d, l2d, ST4, ST0) { + CODE(opc_l2d, l2d, ST4, ST0, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); /* now state 0 */ L2D_ST0; @@ -2425,27 +2449,27 @@ /* now state 2 */ #define CODE_REAL2INT(vop, VOP, RET_TYPE, LAST_STATE) \ - CODE(opc_##vop, vop, ST0, ST##LAST_STATE) {\ + CODE(opc_##vop, vop, ST0, ST##LAST_STATE, 0) {\ REAL2INT_##VOP##_ST0;\ REAL2INT_CHECK_##RET_TYPE(vop, 0);\ }\ - CODE(opc_##vop, vop, ST1, ST##LAST_STATE) {\ + CODE(opc_##vop, vop, ST1, ST##LAST_STATE, 0) {\ __asm__("pushl %edx"); /* now state 0 */\ REAL2INT_##VOP##_ST0;\ REAL2INT_CHECK_##RET_TYPE(vop, 1);\ }\ - CODE(opc_##vop, vop, ST2, ST##LAST_STATE) {\ + CODE(opc_##vop, vop, ST2, ST##LAST_STATE, 0) {\ __asm__("pushl %edx\n\t"\ "pushl %ecx"); /* now state 0 */\ REAL2INT_##VOP##_ST0;\ REAL2INT_CHECK_##RET_TYPE(vop, 2);\ }\ - CODE(opc_##vop, vop, ST3, ST##LAST_STATE) {\ + CODE(opc_##vop, vop, ST3, ST##LAST_STATE, 0) {\ __asm__("pushl %ecx"); /* now state 0 */\ REAL2INT_##VOP##_ST0;\ REAL2INT_CHECK_##RET_TYPE(vop, 3);\ }\ - CODE(opc_##vop, vop, ST4, ST##LAST_STATE) {\ + CODE(opc_##vop, vop, ST4, ST##LAST_STATE, 0) {\ __asm__("pushl %ecx\n\t"\ "pushl %edx"); /* now state 0 */\ REAL2INT_##VOP##_ST0;\ @@ -2463,23 +2487,23 @@ "fstpl -4(%esp)\n\t"\ "subl $4,%esp") - CODE(opc_f2d, f2d, ST0, ST0) { + CODE(opc_f2d, f2d, ST0, ST0, 0) { F2D_ST0; } - CODE(opc_f2d, f2d, ST1, ST0) { + CODE(opc_f2d, f2d, ST1, ST0, 0) { __asm__("pushl %edx"); /* now state 0 */\ F2D_ST0; } - CODE(opc_f2d, f2d, ST2, ST0) { + CODE(opc_f2d, f2d, ST2, ST0, 0) { __asm__("pushl %edx\n\t"\ "pushl %ecx"); /* now state 0 */\ F2D_ST0; } - CODE(opc_f2d, f2d, ST3, ST0) { + CODE(opc_f2d, f2d, ST3, ST0, 0) { __asm__("pushl %ecx"); /* now state 0 */\ F2D_ST0; } - CODE(opc_f2d, f2d, ST4, ST0) { + CODE(opc_f2d, f2d, ST4, ST0, 0) { __asm__("pushl %ecx\n\t"\ "pushl %edx"); /* now state 0 */\ F2D_ST0; @@ -2491,23 +2515,23 @@ "fstps 4(%esp)\n\t"\ "addl $4,%esp") - CODE(opc_d2f, d2f, ST0, ST0) { + CODE(opc_d2f, d2f, ST0, ST0, 0) { D2F_ST0; } - CODE(opc_d2f, d2f, ST1, ST0) { + CODE(opc_d2f, d2f, ST1, ST0, 0) { __asm__("pushl %edx"); /* now state 0 */\ D2F_ST0; } - CODE(opc_d2f, d2f, ST2, ST0) { + CODE(opc_d2f, d2f, ST2, ST0, 0) { __asm__("pushl %edx\n\t"\ "pushl %ecx"); /* now state 0 */\ D2F_ST0; } - CODE(opc_d2f, d2f, ST3, ST0) { + CODE(opc_d2f, d2f, ST3, ST0, 0) { __asm__("pushl %ecx"); /* now state 0 */\ D2F_ST0; } - CODE(opc_d2f, d2f, ST4, ST0) { + CODE(opc_d2f, d2f, ST4, ST0, 0) { __asm__("pushl %ecx\n\t"\ "pushl %edx"); /* now state 0 */\ D2F_ST0; @@ -2525,20 +2549,20 @@ "sar $16," #REG) #define CODE_I2BCS(vop, VOP) \ - CODE(opc_##vop, vop, ST0, ST1) {\ + CODE(opc_##vop, vop, ST0, ST1, 0) {\ __asm__("popl %edx"); /* now state 1 */\ VOP(%edx);\ }\ - CODE(opc_##vop, vop, ST1, ST1) {\ + CODE(opc_##vop, vop, ST1, ST1, 0) {\ VOP(%edx);\ }\ - CODE(opc_##vop, vop, ST2, ST2) {\ + CODE(opc_##vop, vop, ST2, ST2, 0) {\ VOP(%ecx);\ }\ - CODE(opc_##vop, vop, ST3, ST3) {\ + CODE(opc_##vop, vop, ST3, ST3, 0) {\ VOP(%ecx);\ }\ - CODE(opc_##vop, vop, ST4, ST4) {\ + CODE(opc_##vop, vop, ST4, ST4, 0) {\ VOP(%edx);\ } @@ -2565,23 +2589,23 @@ "lcmp_st" #STATE "_done:") /* now state 1 */ - CODE(opc_lcmp, lcmp, ST0, ST1) { + CODE(opc_lcmp, lcmp, ST0, ST1, 0) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ LCMP_ST24(%ecx, %edx, 0); } - CODE(opc_lcmp, lcmp, ST1, ST1) { + CODE(opc_lcmp, lcmp, ST1, ST1, 0) { __asm__("popl %ecx"); /* now state 4 */ LCMP_ST24(%edx, %ecx, 1); } - CODE(opc_lcmp, lcmp, ST2, ST1) { + CODE(opc_lcmp, lcmp, ST2, ST1, 0) { LCMP_ST24(%ecx, %edx, 2); } - CODE(opc_lcmp, lcmp, ST3, ST1) { + CODE(opc_lcmp, lcmp, ST3, ST1, 0) { __asm__("popl %edx"); /* now state 2 */ LCMP_ST24(%ecx, %edx, 3); } - CODE(opc_lcmp, lcmp, ST4, ST1) { + CODE(opc_lcmp, lcmp, ST4, ST1, 0) { LCMP_ST24(%edx, %ecx, 4); } @@ -2658,27 +2682,27 @@ /* now state 1 */ #define CODE_FLOAT_CMP(vop, VOP, SUF) \ - CODE(opc_##vop, vop, ST0, ST1) {\ + CODE(opc_##vop, vop, ST0, ST1, 0) {\ VOP##_COMPARE_ST0;\ FLOAT_CMP_ST0(SUF, #VOP "_st0");\ }\ - CODE(opc_##vop, vop, ST1, ST1) {\ + CODE(opc_##vop, vop, ST1, ST1, 0) {\ __asm__("pushl %edx"); /* now state 0 */\ VOP##_COMPARE_ST0;\ FLOAT_CMP_ST0(SUF, #VOP "_st1");\ }\ - CODE(opc_##vop, vop, ST2, ST1) {\ + CODE(opc_##vop, vop, ST2, ST1, 0) {\ __asm__("pushl %edx\n\t"\ "pushl %ecx"); /* now state 0 */\ VOP##_COMPARE_ST0;\ FLOAT_CMP_ST0(SUF, #VOP "_st2");\ }\ - CODE(opc_##vop, vop, ST3, ST1) {\ + CODE(opc_##vop, vop, ST3, ST1, 0) {\ __asm__("pushl %ecx"); /* now state 0 */\ VOP##_COMPARE_ST0;\ FLOAT_CMP_ST0(SUF, #VOP "_st3");\ }\ - CODE(opc_##vop, vop, ST4, ST1) {\ + CODE(opc_##vop, vop, ST4, ST1, 0) {\ __asm__("pushl %ecx\n\t"\ "pushl %edx"); /* now state 0 */\ VOP##_COMPARE_ST0;\ @@ -2712,20 +2736,20 @@ /* jump: #JP_ROP STR(ADDR_JP) */ #define CODE_IF(VOP, JP_ROP) \ - CODE(opc_if##VOP, if##VOP, ST0, ST0) {\ + CODE(opc_if##VOP, if##VOP, ST0, ST0, 0) {\ __asm__("popl %eax");\ IF(%eax, JP_ROP);\ }\ - CODE(opc_if##VOP, if##VOP, ST1, ST0) {\ + CODE(opc_if##VOP, if##VOP, ST1, ST0, 0) {\ IF(%edx, JP_ROP);\ }\ - CODE(opc_if##VOP, if##VOP, ST2, ST1) {\ + CODE(opc_if##VOP, if##VOP, ST2, ST1, 0) {\ IF(%ecx, JP_ROP);\ }\ - CODE(opc_if##VOP, if##VOP, ST3, ST0) {\ + CODE(opc_if##VOP, if##VOP, ST3, ST0, 0) {\ IF(%ecx, JP_ROP);\ }\ - CODE(opc_if##VOP, if##VOP, ST4, ST3) {\ + CODE(opc_if##VOP, if##VOP, ST4, ST3, 0) {\ IF(%edx, JP_ROP);\ } @@ -2760,23 +2784,23 @@ /* now state 0 */ #define CODE_IF_ICMP(VOP, JP_ROP) \ - CODE(opc_if_icmp##VOP, if_icmp##VOP, ST0, ST0) {\ + CODE(opc_if_icmp##VOP, if_icmp##VOP, ST0, ST0, 0) {\ __asm__("popl %ecx\n\t"\ "popl %edx"); /* now state 2 */\ IF_ICMP_ST24(%ecx, %edx, JP_ROP);\ }\ - CODE(opc_if_icmp##VOP, if_icmp##VOP, ST1, ST0) {\ + CODE(opc_if_icmp##VOP, if_icmp##VOP, ST1, ST0, 0) {\ __asm__("popl %ecx"); /* now state 4 */\ IF_ICMP_ST24(%edx, %ecx, JP_ROP);\ }\ - CODE(opc_if_icmp##VOP, if_icmp##VOP, ST2, ST0) {\ + CODE(opc_if_icmp##VOP, if_icmp##VOP, ST2, ST0, 0) {\ IF_ICMP_ST24(%ecx, %edx, JP_ROP);\ }\ - CODE(opc_if_icmp##VOP, if_icmp##VOP, ST3, ST0) {\ + CODE(opc_if_icmp##VOP, if_icmp##VOP, ST3, ST0, 0) {\ __asm__("popl %edx"); /* now state 2 */\ IF_ICMP_ST24(%ecx, %edx, JP_ROP);\ }\ - CODE(opc_if_icmp##VOP, if_icmp##VOP, ST4, ST0) {\ + CODE(opc_if_icmp##VOP, if_icmp##VOP, ST4, ST0, 0) {\ IF_ICMP_ST24(%edx, %ecx, JP_ROP);\ } @@ -2788,7 +2812,7 @@ CODE_IF_ICMP(le, jle); /* goto */ - CODE(opc_goto, goto, STANY, STSTA) { + CODE(opc_goto, goto, STANY, STSTA, 0) { /* jump: "jmp " STR(ADDR_JP) */ } @@ -2814,27 +2838,27 @@ JSR_DEBUG1(REG) /* jump: "jmp " STR(ADDR_JP) */ - CODE(opc_jsr, jsr, ST0, ST1) { + CODE(opc_jsr, jsr, ST0, ST1, 0) { JSR(%edx); } - CODE(opc_jsr, jsr, ST1, ST2) { + CODE(opc_jsr, jsr, ST1, ST2, 0) { JSR(%ecx); } - CODE(opc_jsr, jsr, ST2, ST4) { + CODE(opc_jsr, jsr, ST2, ST4, 0) { __asm__("pushl %edx"); /* now state 3 */ JSR(%edx); } - CODE(opc_jsr, jsr, ST3, ST4) { + CODE(opc_jsr, jsr, ST3, ST4, 0) { JSR(%edx); } - CODE(opc_jsr, jsr, ST4, ST2) { + CODE(opc_jsr, jsr, ST4, ST2, 0) { __asm__("pushl %ecx"); /* now state 1 */ JSR(%ecx); } /* ret */ /* const: index * 4 */ - CODE(opc_ret, ret, STANY, STSTA) { + CODE(opc_ret, ret, STANY, STSTA, 0) { __asm__("movl " STR(CONST) "(%esi),%eax"); /* eax = vars[index] */ ILOAD_DEBUG1(%eax); COMPILEDCODE(%edi); /* edi = mb->CompiledCode */ @@ -2900,20 +2924,20 @@ \ __asm__("jmp *4(%edi)") - CODE(opc_tableswitch, tableswitch, ST0, ST0) { + CODE(opc_tableswitch, tableswitch, ST0, ST0, 0) { __asm__("popl %edx"); /* now state 1 */ TBLSW(%edx, 0); } - CODE(opc_tableswitch, tableswitch, ST1, ST0) { + CODE(opc_tableswitch, tableswitch, ST1, ST0, 0) { TBLSW(%edx, 1); } - CODE(opc_tableswitch, tableswitch, ST2, ST1) { + CODE(opc_tableswitch, tableswitch, ST2, ST1, 0) { TBLSW(%ecx, 2); } - CODE(opc_tableswitch, tableswitch, ST3, ST0) { + CODE(opc_tableswitch, tableswitch, ST3, ST0, 0) { TBLSW(%ecx, 3); } - CODE(opc_tableswitch, tableswitch, ST4, ST3) { + CODE(opc_tableswitch, tableswitch, ST4, ST3, 0) { TBLSW(%edx, 4); } @@ -2979,20 +3003,20 @@ __asm__("jmp *8(%edi)") - CODE(opc_lookupswitch, lookupswitch, ST0, ST0) { + CODE(opc_lookupswitch, lookupswitch, ST0, ST0, 0) { __asm__("popl %edx"); /* now state 1 */ LUSW(%edx, 0); } - CODE(opc_lookupswitch, lookupswitch, ST1, ST0) { + CODE(opc_lookupswitch, lookupswitch, ST1, ST0, 0) { LUSW(%edx, 1); } - CODE(opc_lookupswitch, lookupswitch, ST2, ST1) { + CODE(opc_lookupswitch, lookupswitch, ST2, ST1, 0) { LUSW(%ecx, 2); } - CODE(opc_lookupswitch, lookupswitch, ST3, ST0) { + CODE(opc_lookupswitch, lookupswitch, ST3, ST0, 0) { LUSW(%ecx, 3); } - CODE(opc_lookupswitch, lookupswitch, ST4, ST3) { + CODE(opc_lookupswitch, lookupswitch, ST4, ST3, 0) { LUSW(%edx, 4); } @@ -3011,20 +3035,20 @@ BIPUSH_DEBUG1(OPTOP1_REG);\ __asm__("jmp " STR(ADDR_FIN)) - CODE(opc_ireturn, [ifa]return, ST0, ST0) { + CODE(opc_ireturn, [ifa]return, ST0, ST0, 0) { __asm__("popl %edx"); /* now state 1 */ IRETURN(%edx); } - CODE(opc_ireturn, [ifa]return, ST1, ST0) { + CODE(opc_ireturn, [ifa]return, ST1, ST0, 0) { IRETURN(%edx); } - CODE(opc_ireturn, [ifa]return, ST2, ST1) { + CODE(opc_ireturn, [ifa]return, ST2, ST1, 0) { IRETURN(%ecx); } - CODE(opc_ireturn, [ifa]return, ST3, ST0) { + CODE(opc_ireturn, [ifa]return, ST3, ST0, 0) { IRETURN(%ecx); } - CODE(opc_ireturn, [ifa]return, ST4, ST3) { + CODE(opc_ireturn, [ifa]return, ST4, ST3, 0) { IRETURN(%edx); } @@ -3045,51 +3069,51 @@ LDC2_W_DEBUG1(OPTOP1_REG, OPTOP2_REG);\ __asm__("jmp " STR(ADDR_FIN)) - CODE(opc_lreturn, [ld]return, ST0, ST0) { + CODE(opc_lreturn, [ld]return, ST0, ST0, 0) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ LRETURN(%ecx, %edx); } - CODE(opc_lreturn, [ld]return, ST1, ST0) { + CODE(opc_lreturn, [ld]return, ST1, ST0, 0) { __asm__("popl %ecx"); /* now state 4 */ LRETURN(%edx, %ecx); } - CODE(opc_lreturn, [ld]return, ST2, ST0) { + CODE(opc_lreturn, [ld]return, ST2, ST0, 0) { LRETURN(%ecx, %edx); } - CODE(opc_lreturn, [ld]return, ST3, ST0) { + CODE(opc_lreturn, [ld]return, ST3, ST0, 0) { __asm__("popl %edx"); /* now state 2 */ LRETURN(%ecx, %edx); } - CODE(opc_lreturn, [ld]return, ST4, ST0) { + CODE(opc_lreturn, [ld]return, ST4, ST0, 0) { LRETURN(%edx, %ecx); } /* return */ - CODE(opc_return, return, STANY, STSTA) { + CODE(opc_return, return, STANY, STSTA, 0) { __asm__("jmp " STR(ADDR_FIN)); } /* getstatic */ /* const: address */ - CODE(opc_getstatic, getstatic, ST0, ST1) { + CODE(opc_getstatic, getstatic, ST0, ST1, 0) { __asm__("movl (" STR(CONST) "),%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_getstatic, getstatic, ST1, ST2) { + CODE(opc_getstatic, getstatic, ST1, ST2, 0) { __asm__("movl (" STR(CONST) "),%ecx"); BIPUSH_DEBUG1(%ecx); } - CODE(opc_getstatic, getstatic, ST2, ST4) { + CODE(opc_getstatic, getstatic, ST2, ST4, 0) { __asm__("pushl %edx\n\t" /* now state 3 */ "movl (" STR(CONST) "),%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_getstatic, getstatic, ST3, ST4) { + CODE(opc_getstatic, getstatic, ST3, ST4, 0) { __asm__("movl (" STR(CONST) "),%edx"); BIPUSH_DEBUG1(%edx); } - CODE(opc_getstatic, getstatic, ST4, ST2) { + CODE(opc_getstatic, getstatic, ST4, ST2, 0) { __asm__("pushl %ecx\n\t" /* now state 1 */ "movl (" STR(CONST) "),%ecx"); BIPUSH_DEBUG1(%ecx); @@ -3099,23 +3123,23 @@ #define GETSTATIC2_ST0(LOW_REG, HIGH_REG) \ __asm__("movl (" STR(CONST) ")," #LOW_REG "\n\t"\ "movl (" STR(CONST) ")," #HIGH_REG) - CODE(opc_getstatic2, getstatic2, ST0, ST2) { + CODE(opc_getstatic2, getstatic2, ST0, ST2, 0) { GETSTATIC2_ST0(%ecx, %edx); } - CODE(opc_getstatic2, getstatic2, ST1, ST2) { + CODE(opc_getstatic2, getstatic2, ST1, ST2, 0) { __asm__("pushl %edx"); /* now state 0 */ GETSTATIC2_ST0(%ecx, %edx); } - CODE(opc_getstatic2, getstatic2, ST2, ST4) { + CODE(opc_getstatic2, getstatic2, ST2, ST4, 0) { __asm__("pushl %edx\n\t"\ "pushl %ecx"); /* now state 0 */\ GETSTATIC2_ST0(%edx, %ecx); } - CODE(opc_getstatic2, getstatic2, ST3, ST4) { + CODE(opc_getstatic2, getstatic2, ST3, ST4, 0) { __asm__("pushl %ecx"); /* now state 0 */\ GETSTATIC2_ST0(%edx, %ecx); } - CODE(opc_getstatic2, getstatic2, ST4, ST2) { + CODE(opc_getstatic2, getstatic2, ST4, ST2, 0) { __asm__("pushl %ecx\n\t"\ "pushl %edx"); /* now state 0 */\ GETSTATIC2_ST0(%ecx, %edx); @@ -3123,24 +3147,24 @@ /* putstatic */ /* const: address */ - CODE(opc_putstatic, putstatic, ST0, ST0) { + CODE(opc_putstatic, putstatic, ST0, ST0, 0) { __asm__("popl %edx\n\t" /* now state 1 */ "movl %edx,(" STR(CONST) ")"); BIPUSH_DEBUG1(%edx); } - CODE(opc_putstatic, putstatic, ST1, ST0) { + CODE(opc_putstatic, putstatic, ST1, ST0, 0) { __asm__("movl %edx,(" STR(CONST) ")"); BIPUSH_DEBUG1(%edx); } - CODE(opc_putstatic, putstatic, ST2, ST1) { + CODE(opc_putstatic, putstatic, ST2, ST1, 0) { __asm__("movl %ecx,(" STR(CONST) ")"); BIPUSH_DEBUG1(%ecx); } - CODE(opc_putstatic, putstatic, ST3, ST0) { + CODE(opc_putstatic, putstatic, ST3, ST0, 0) { __asm__("movl %ecx,(" STR(CONST) ")"); BIPUSH_DEBUG1(%ecx); } - CODE(opc_putstatic, putstatic, ST4, ST3) { + CODE(opc_putstatic, putstatic, ST4, ST3, 0) { __asm__("movl %edx,(" STR(CONST) ")"); BIPUSH_DEBUG1(%edx); } @@ -3151,23 +3175,23 @@ "movl " #OPTOP2_REG ",(" STR(CONST) ")") /* now state 0 */ - CODE(opc_putstatic2, putstatic2, ST0, ST0) { + CODE(opc_putstatic2, putstatic2, ST0, ST0, 0) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ PUTSTATIC2(%ecx, %edx); } - CODE(opc_putstatic2, putstatic2, ST1, ST0) { + CODE(opc_putstatic2, putstatic2, ST1, ST0, 0) { __asm__("popl %ecx"); /* now state 4 */ PUTSTATIC2(%edx, %ecx); } - CODE(opc_putstatic2, putstatic2, ST2, ST0) { + CODE(opc_putstatic2, putstatic2, ST2, ST0, 0) { PUTSTATIC2(%ecx, %edx); } - CODE(opc_putstatic2, putstatic2, ST3, ST0) { + CODE(opc_putstatic2, putstatic2, ST3, ST0, 0) { __asm__("popl %edx"); /* now state 2 */ PUTSTATIC2(%ecx, %edx); } - CODE(opc_putstatic2, putstatic2, ST4, ST0) { + CODE(opc_putstatic2, putstatic2, ST4, ST0, 0) { PUTSTATIC2(%edx, %ecx); } @@ -3217,7 +3241,7 @@ # define JITDO_GETFIELD(HANDLE, TGT, LABEL) #endif /* JITDO */ - CODE(opc_getfield, getfield, ST0, ST3) { + CODE(opc_getfield, getfield, ST0, ST3, 1) { __asm__("popl %edx"); /* now state 1 */ FIELD_ACC(%edx, getfield, 0); JITDO_GETFIELD(%edx, %ecx, "getfield_st0"); @@ -3225,28 +3249,28 @@ __asm__("getfield_st0_done:"); ILOAD_DEBUG1(%ecx); } - CODE(opc_getfield, getfield, ST1, ST3) { + CODE(opc_getfield, getfield, ST1, ST3, 1) { FIELD_ACC(%edx, getfield, 1); JITDO_GETFIELD(%edx, %ecx, "getfield_st1"); OBJ_GETSLOT(%edx, %eax, %ecx); __asm__("getfield_st1_done:"); ILOAD_DEBUG1(%ecx); } - CODE(opc_getfield, getfield, ST2, ST2) { + CODE(opc_getfield, getfield, ST2, ST2, 1) { FIELD_ACC(%ecx, getfield, 2); JITDO_GETFIELD(%ecx, %ecx, "getfield_st2"); OBJ_GETSLOT(%ecx, %eax, %ecx); __asm__("getfield_st2_done:"); ILOAD_DEBUG1(%ecx); } - CODE(opc_getfield, getfield, ST3, ST1) { + CODE(opc_getfield, getfield, ST3, ST1, 1) { FIELD_ACC(%ecx, getfield, 3); JITDO_GETFIELD(%ecx, %edx, "getfield_st3"); OBJ_GETSLOT(%ecx, %eax, %edx); __asm__("getfield_st3_done:"); ILOAD_DEBUG1(%edx); } - CODE(opc_getfield, getfield, ST4, ST4) { + CODE(opc_getfield, getfield, ST4, ST4, 1) { FIELD_ACC(%edx, getfield, 4); JITDO_GETFIELD(%edx, %edx, "getfield_st4"); OBJ_GETSLOT(%edx, %eax, %edx); @@ -3274,7 +3298,7 @@ #endif /* JITDO */ /* const: slot */ - CODE(opc_getfield2, getfield2, ST0, ST2) { + CODE(opc_getfield2, getfield2, ST0, ST2, 1) { __asm__("popl %edx"); /* now state 1 */ FIELD_ACC(%edx, getfield2, 0); JITDO_GETFIELD2(%edx, %ecx, %edx, "getfield2_st0"); @@ -3282,14 +3306,14 @@ __asm__("getfield2_st0_done:"); LLOAD_DEBUG1(%ecx, %edx); } - CODE(opc_getfield2, getfield2, ST1, ST2) { + CODE(opc_getfield2, getfield2, ST1, ST2, 1) { FIELD_ACC(%edx, getfield2, 1); JITDO_GETFIELD2(%edx, %ecx, %edx, "getfield2_st1"); OBJ_GETSLOT2(%edx, %eax, %ecx, %edx); __asm__("getfield2_st1_done:"); LLOAD_DEBUG1(%ecx, %edx); } - CODE(opc_getfield2, getfield2, ST2, ST4) { + CODE(opc_getfield2, getfield2, ST2, ST4, 1) { __asm__("pushl %edx"); /* now state 3 */ FIELD_ACC(%ecx, getfield2, 2); JITDO_GETFIELD2(%ecx, %edx, %ecx, "getfield2_st2"); @@ -3297,14 +3321,14 @@ __asm__("getfield2_st2_done:"); LLOAD_DEBUG1(%edx, %ecx); } - CODE(opc_getfield2, getfield2, ST3, ST4) { + CODE(opc_getfield2, getfield2, ST3, ST4, 1) { FIELD_ACC(%ecx, getfield2, 3); JITDO_GETFIELD2(%ecx, %edx, %ecx, "getfield2_st3"); OBJ_GETSLOT2(%ecx, %eax, %edx, %ecx); __asm__("getfield2_st3_done:"); LLOAD_DEBUG1(%edx, %ecx); } - CODE(opc_getfield2, getfield2, ST4, ST2) { + CODE(opc_getfield2, getfield2, ST4, ST2, 1) { __asm__("pushl %ecx"); /* now state 1 */ FIELD_ACC(%edx, getfield2, 4); JITDO_GETFIELD2(%edx, %ecx, %edx, "getfield2_st4"); @@ -3346,27 +3370,27 @@ OBJ_SETSLOT(OPTOP2_REG, %eax, OPTOP1_REG);\ __asm__("putfield_st" #STATE "_done:") - CODE(opc_putfield, putfield, ST0, ST0) { + CODE(opc_putfield, putfield, ST0, ST0, 1) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ PUTFIELD_ST24(%ecx, %edx, 0); ILOAD_DEBUG1(%ecx); } - CODE(opc_putfield, putfield, ST1, ST0) { + CODE(opc_putfield, putfield, ST1, ST0, 1) { __asm__("popl %ecx"); /* now state 4 */ PUTFIELD_ST24(%edx, %ecx, 1); ILOAD_DEBUG1(%edx); } - CODE(opc_putfield, putfield, ST2, ST0) { + CODE(opc_putfield, putfield, ST2, ST0, 1) { PUTFIELD_ST24(%ecx, %edx, 2); ILOAD_DEBUG1(%ecx); } - CODE(opc_putfield, putfield, ST3, ST0) { + CODE(opc_putfield, putfield, ST3, ST0, 1) { __asm__("popl %edx"); /* now state 2 */ PUTFIELD_ST24(%ecx, %edx, 3); ILOAD_DEBUG1(%ecx); } - CODE(opc_putfield, putfield, ST4, ST0) { + CODE(opc_putfield, putfield, ST4, ST0, 1) { PUTFIELD_ST24(%edx, %ecx, 4); ILOAD_DEBUG1(%edx); } @@ -3402,27 +3426,27 @@ OBJ_SETSLOT2(%edi, %eax, OPTOP1_REG, OPTOP2_REG);\ __asm__("putfild2_st" #STATE "_done:") - CODE(opc_putfield2, putfield2, ST0, ST0) { + CODE(opc_putfield2, putfield2, ST0, ST0, 1) { __asm__("popl %ecx\n\t" "popl %edx"); /* now state 2 */ PUTFIELD2_ST24(%ecx, %edx, 0); LLOAD_DEBUG1(%ecx, %edx); } - CODE(opc_putfield2, putfield2, ST1, ST0) { + CODE(opc_putfield2, putfield2, ST1, ST0, 1) { __asm__("popl %ecx"); /* now state 4 */ PUTFIELD2_ST24(%edx, %ecx, 1); LLOAD_DEBUG1(%edx, %ecx); } - CODE(opc_putfield2, putfield2, ST2, ST0) { + CODE(opc_putfield2, putfield2, ST2, ST0, 1) { PUTFIELD2_ST24(%ecx, %edx, 2); LLOAD_DEBUG1(%ecx, %edx); } - CODE(opc_putfield2, putfield2, ST3, ST0) { + CODE(opc_putfield2, putfield2, ST3, ST0, 1) { __asm__("popl %edx"); /* now state 2 */ PUTFIELD2_ST24(%ecx, %edx, 3); LLOAD_DEBUG1(%ecx, %edx); } - CODE(opc_putfield2, putfield2, ST4, ST0) { + CODE(opc_putfield2, putfield2, ST4, ST0, 1) { PUTFIELD2_ST24(%edx, %ecx, 4); LLOAD_DEBUG1(%edx, %ecx); } @@ -3586,24 +3610,24 @@ "pushl %edx"); /* obj */\ CALL_INVOKEMETHOD(LABEL) -#define CODE_INVOKE(vop, VOP) \ - CODE(opc_invoke##vop, invoke##vop, ST0, ST0) {\ +#define CODE_INVOKE(vop, VOP, THROW_EXC) \ + CODE(opc_invoke##vop, invoke##vop, ST0, ST0, THROW_EXC) {\ INVOKE_ST0(VOP, #vop "_st0");\ }\ - CODE(opc_invoke##vop, invoke##vop, ST1, ST0) {\ + CODE(opc_invoke##vop, invoke##vop, ST1, ST0, THROW_EXC) {\ __asm__("pushl %edx"); /* now state 0 */\ INVOKE_ST0(VOP, #vop "_st1");\ }\ - CODE(opc_invoke##vop, invoke##vop, ST2, ST0) {\ + CODE(opc_invoke##vop, invoke##vop, ST2, ST0, THROW_EXC) {\ __asm__("pushl %edx\n\t"\ "pushl %ecx"); /* now state 0 */\ INVOKE_ST0(VOP, #vop "_st2");\ }\ - CODE(opc_invoke##vop, invoke##vop, ST3, ST0) {\ + CODE(opc_invoke##vop, invoke##vop, ST3, ST0, THROW_EXC) {\ __asm__("pushl %ecx"); /* now state 0 */\ INVOKE_ST0(VOP, #vop "_st3");\ }\ - CODE(opc_invoke##vop, invoke##vop, ST4, ST0) {\ + CODE(opc_invoke##vop, invoke##vop, ST4, ST0, THROW_EXC) {\ __asm__("pushl %ecx\n\t"\ "pushl %edx"); /* now state 0 */\ INVOKE_ST0(VOP, #vop "_st4");\ @@ -3717,10 +3741,10 @@ #endif - CODE_INVOKE(virtual, VIRTUAL); - CODE_INVOKE(special, SPECIAL); - CODE_INVOKE(static, STATIC); - CODE_INVOKE(interface, INTERFACE); + CODE_INVOKE(virtual, VIRTUAL, 1); + CODE_INVOKE(special, SPECIAL, 1); + CODE_INVOKE(static, STATIC, 0); + CODE_INVOKE(interface, INTERFACE, 1); #if 0 /* how to get methodblock */ # if 0 @@ -3745,14 +3769,14 @@ /* invokevirtual_quick */ /* const: args_size, methodIndex, retsize */ - CODE_INVOKE(virtual_quick, VIRTUAL); + CODE_INVOKE(virtual_quick, VIRTUAL, 1); /* invokevirtualobject_quick */ /* const: args_size, methodIndex, retsize */ - CODE_INVOKE(virtualobject_quick, VIRTUAL); + CODE_INVOKE(virtualobject_quick, VIRTUAL, 1); /* xxxunusedxxx */ - CODE(opc_xxxunusedxxx, xxxunusesxxx, STANY, STSTA) {} + CODE(opc_xxxunusedxxx, xxxunusesxxx, STANY, STSTA, 0) {} /* new */ /* cosnt: cb */ @@ -3846,7 +3870,6 @@ "jnz " LABEL "_local");\ \ /* call proxy_new() */\ - __asm__("pushl %edi");\ FUNCCALL_IN(STATE);\ __asm__("pushl " #CB_REG "\n\t"\ "pushl " EE_REMOTE_ADDR(%edi) "\n\t"\ @@ -3854,7 +3877,6 @@ "call " SYMBOL(proxy_new) "@PLT\n\t"\ "addl $12,%esp");\ FUNCCALL_OUT(STATE);\ - __asm__("popl %edi");\ \ JUMP_IF_EXC_HASNT_OCCURRED(%edi /* is ee */, LABEL "_done");\ SIGNAL_ERROR_JUMP(STATE);\ @@ -3934,20 +3956,20 @@ __asm__("movl %eax," #DST_REG) - CODE(opc_new, new, ST0, ST1) { + CODE(opc_new, new, ST0, ST1, 0) { NEW(%edx, %edx, NEW_REWRITE_OFFSET_0, "new_st0", 0); } - CODE(opc_new, new, ST1, ST2) { + CODE(opc_new, new, ST1, ST2, 0) { NEW(%ecx, %ecx, NEW_REWRITE_OFFSET_1, "new_st1", 1); } - CODE(opc_new, new, ST2, ST4) { + CODE(opc_new, new, ST2, ST4, 0) { __asm__("pushl %edx"); /* now state 3 */ NEW(%edx, %edx, NEW_REWRITE_OFFSET_2, "new_st2", 3); } - CODE(opc_new, new, ST3, ST4) { + CODE(opc_new, new, ST3, ST4, 0) { NEW(%edx, %edx, NEW_REWRITE_OFFSET_3, "new_st3", 3); } - CODE(opc_new, new, ST4, ST2) { + CODE(opc_new, new, ST4, ST2, 0) { __asm__("pushl %ecx"); /* now state 1 */ NEW(%ecx, %ecx, NEW_REWRITE_OFFSET_4, "new_st4", 1); } @@ -3998,20 +4020,20 @@ __asm__(LABEL "_done:\n\t"\ "movl %eax," #OPTOP1_REG) /* store to dst. */ - CODE(opc_newarray, newarray, ST0, ST1) { + CODE(opc_newarray, newarray, ST0, ST1, 0) { __asm__("popl %edx"); /* now state 1 */ NEWARRAY(%edx, "newarray_st0", 1); } - CODE(opc_newarray, newarray, ST1, ST1) { + CODE(opc_newarray, newarray, ST1, ST1, 0) { NEWARRAY(%edx, "newarray_st1", 1); } - CODE(opc_newarray, newarray, ST2, ST2) { + CODE(opc_newarray, newarray, ST2, ST2, 0) { NEWARRAY(%ecx, "newarray_st2", 2); } - CODE(opc_newarray, newarray, ST3, ST3) { + CODE(opc_newarray, newarray, ST3, ST3, 0) { NEWARRAY(%ecx, "newarray_st3", 3); } - CODE(opc_newarray, newarray, ST4, ST4) { + CODE(opc_newarray, newarray, ST4, ST4, 0) { NEWARRAY(%edx, "newarray_st4", 4); } @@ -4037,59 +4059,49 @@ /* unhand(array)->body[count] = clazz of elements */\ __asm__("movl %eax," #OPTOP1_REG) /* store to dst. */ - CODE(opc_anewarray, anewarray, ST0, ST1) { + CODE(opc_anewarray, anewarray, ST0, ST1, 0) { __asm__("popl %edx"); /* now state 1 */ ANEWARRAY(%edx, "anewarray_st0", 1); } - CODE(opc_anewarray, anewarray, ST1, ST1) { + CODE(opc_anewarray, anewarray, ST1, ST1, 0) { ANEWARRAY(%edx, "anewarray_st1", 1); } - CODE(opc_anewarray, anewarray, ST2, ST2) { + CODE(opc_anewarray, anewarray, ST2, ST2, 0) { ANEWARRAY(%ecx, "anewarray_st2", 2); } - CODE(opc_anewarray, anewarray, ST3, ST3) { + CODE(opc_anewarray, anewarray, ST3, ST3, 0) { ANEWARRAY(%ecx, "anewarray_st3", 3); } - CODE(opc_anewarray, anewarray, ST4, ST4) { + CODE(opc_anewarray, anewarray, ST4, ST4, 0) { ANEWARRAY(%edx, "anewarray_st4", 4); } /* arraylength */ -#ifndef NO_CHECK -# define ARRAYLENGTH_TEST(OPTOP1_REG, STATE) \ - __asm__("testl " #OPTOP1_REG "," #OPTOP1_REG "\n\t"\ - "jnz arylen_st" #STATE "_1");\ - SIGNAL_ERROR0(NullPointerException, STATE);\ - __asm__("arylen_st" #STATE "_1:") -#else -# define ARRAYLENGTH_TEST(OPTOP1_REG, STATE) -#endif /* NO_CHECK */ - - CODE(opc_arraylength, arraylength, ST0, ST3) { + CODE(opc_arraylength, arraylength, ST0, ST3, 1) { __asm__("popl %edx"); /* now state 1 */ - ARRAYLENGTH_TEST(%edx, 0); + NULL_TEST(%edx, "arylen_null_st0", 0); OBJ_LENGTH(%edx, %ecx); } - CODE(opc_arraylength, arraylength, ST1, ST3) { - ARRAYLENGTH_TEST(%edx, 1); + CODE(opc_arraylength, arraylength, ST1, ST3, 1) { + NULL_TEST(%edx, "arylen_null_st1", 1); OBJ_LENGTH(%edx, %ecx); } - CODE(opc_arraylength, arraylength, ST2, ST2) { - ARRAYLENGTH_TEST(%ecx, 2); + CODE(opc_arraylength, arraylength, ST2, ST2, 1) { + NULL_TEST(%ecx, "arylen_null_st2", 2); OBJ_LENGTH(%ecx, %ecx); } - CODE(opc_arraylength, arraylength, ST3, ST1) { - ARRAYLENGTH_TEST(%ecx, 3); + CODE(opc_arraylength, arraylength, ST3, ST1, 1) { + NULL_TEST(%ecx, "arylen_null_st3", 3); OBJ_LENGTH(%ecx, %edx); } - CODE(opc_arraylength, arraylength, ST4, ST4) { - ARRAYLENGTH_TEST(%edx, 4); + CODE(opc_arraylength, arraylength, ST4, ST4, 1) { + NULL_TEST(%edx, "arylen_null_st4", 4); OBJ_LENGTH(%edx, %edx); } /* athrow */ #define ATHROW(OPTOP1_REG, STATE) \ - NULL_TEST(OPTOP1_REG, "athrow_st" #STATE "_1", STATE);\ + NULL_TEST_CANT_BE_ELIMINATED(OPTOP1_REG, "athrow_st" #STATE "_1", STATE);\ \ /* macro exceptionThrow(ee, obj) */\ {\ @@ -4104,20 +4116,20 @@ bytepcoff = BYTEPCOFF;\ __asm__("jmp " STR(ADDR_EXC)) - CODE(opc_athrow, athrow, ST0, ST1) { + CODE(opc_athrow, athrow, ST0, ST1, 1) { __asm__("popl %edx"); /* now state 1 */ ATHROW(%edx, 0); } - CODE(opc_athrow, athrow, ST1, ST1) { + CODE(opc_athrow, athrow, ST1, ST1, 1) { ATHROW(%edx, 1); } - CODE(opc_athrow, athrow, ST2, ST2) { + CODE(opc_athrow, athrow, ST2, ST2, 1) { ATHROW(%ecx, 2); } - CODE(opc_athrow, athrow, ST3, ST3) { + CODE(opc_athrow, athrow, ST3, ST3, 1) { ATHROW(%ecx, 3); } - CODE(opc_athrow, athrow, ST4, ST4) { + CODE(opc_athrow, athrow, ST4, ST4, 1) { ATHROW(%edx, 4); } @@ -4162,20 +4174,20 @@ SIGNAL_ERROR0(ClassCastException, STATE);\ __asm__(LABEL "_done:") - CODE(opc_checkcast, checkcast, ST0, ST1) { + CODE(opc_checkcast, checkcast, ST0, ST1, 0) { __asm__("popl %edx"); /* now state 1 */ CHECKCAST(edx, "checkcast_st0", 1); } - CODE(opc_checkcast, checkcast, ST1, ST1) { + CODE(opc_checkcast, checkcast, ST1, ST1, 0) { CHECKCAST(edx, "checkcast_st1", 1); } - CODE(opc_checkcast, checkcast, ST2, ST2) { + CODE(opc_checkcast, checkcast, ST2, ST2, 0) { CHECKCAST(ecx, "checkcast_st2", 2); } - CODE(opc_checkcast, checkcast, ST3, ST3) { + CODE(opc_checkcast, checkcast, ST3, ST3, 0) { CHECKCAST(ecx, "checkcast_st3", 3); } - CODE(opc_checkcast, checkcast, ST4, ST4) { + CODE(opc_checkcast, checkcast, ST4, ST4, 0) { CHECKCAST(edx, "checkcast_st4", 4); } @@ -4220,26 +4232,26 @@ __asm__("movl %eax,%" #OPTOP1_REG "\n\t"\ LABEL "_done:") - CODE(opc_instanceof, instanceof, ST0, ST1) { + CODE(opc_instanceof, instanceof, ST0, ST1, 0) { __asm__("popl %edx"); /* now state 1 */ INSTANCEOF(edx, "instanceof_st0", 1); } - CODE(opc_instanceof, instanceof, ST1, ST1) { + CODE(opc_instanceof, instanceof, ST1, ST1, 0) { INSTANCEOF(edx, "instanceof_st1", 1); } - CODE(opc_instanceof, instanceof, ST2, ST2) { + CODE(opc_instanceof, instanceof, ST2, ST2, 0) { INSTANCEOF(ecx, "instanceof_st2", 2); } - CODE(opc_instanceof, instanceof, ST3, ST3) { + CODE(opc_instanceof, instanceof, ST3, ST3, 0) { INSTANCEOF(ecx, "instanceof_st3", 3); } - CODE(opc_instanceof, instanceof, ST4, ST4) { + CODE(opc_instanceof, instanceof, ST4, ST4, 0) { INSTANCEOF(edx, "instanceof_st4", 4); } /* monitorenter, monitorexit */ #define MONITOR(OPTOP1_REG, FUNCNAME, LABEL, STATE) \ - NULL_TEST(OPTOP1_REG, LABEL "_1", STATE);\ + NULL_TEST_CANT_BE_ELIMINATED(OPTOP1_REG, LABEL "_1", STATE);\ OBJ_MONITOR(OPTOP1_REG, OPTOP1_REG);\ FUNCCALL_IN(STATE);\ __asm__("pushl " #OPTOP1_REG "\n\t"\ @@ -4248,20 +4260,20 @@ FUNCCALL_OUT(STATE) #define CODE_MONITOR(vop, FUNCNAME) \ - CODE(opc_##vop, ##vop, ST0, ST0) {\ + CODE(opc_##vop, ##vop, ST0, ST0, 1) {\ __asm__("popl %edx"); /* now state 1 */\ MONITOR(%edx, FUNCNAME, #vop "_st0", 0);\ }\ - CODE(opc_##vop, ##vop, ST1, ST0) {\ + CODE(opc_##vop, ##vop, ST1, ST0, 1) {\ MONITOR(%edx, FUNCNAME, #vop "_st1", 0);\ }\ - CODE(opc_##vop, ##vop, ST2, ST1) {\ + CODE(opc_##vop, ##vop, ST2, ST1, 1) {\ MONITOR(%ecx, FUNCNAME, #vop "_st2", 1);\ }\ - CODE(opc_##vop, ##vop, ST3, ST0) {\ + CODE(opc_##vop, ##vop, ST3, ST0, 1) {\ MONITOR(%ecx, FUNCNAME, #vop "_st3", 0);\ }\ - CODE(opc_##vop, ##vop, ST4, ST3) {\ + CODE(opc_##vop, ##vop, ST4, ST3, 1) {\ MONITOR(%edx, FUNCNAME, #vop "_st4", 3);\ } @@ -4311,23 +4323,23 @@ MULTIANEWARRAY_TEST(STATE);\ __asm__("movl %eax," #DST_REG) - CODE(opc_multianewarray, multianewarray, ST0, ST1) { + CODE(opc_multianewarray, multianewarray, ST0, ST1, 0) { MULTIANEWARRAY_ST0(%edx, 0); } - CODE(opc_multianewarray, multianewarray, ST1, ST1) { + CODE(opc_multianewarray, multianewarray, ST1, ST1, 0) { __asm__("pushl %edx"); /* now state 0 */ MULTIANEWARRAY_ST0(%edx, 1); } - CODE(opc_multianewarray, multianewarray, ST2, ST1) { + CODE(opc_multianewarray, multianewarray, ST2, ST1, 0) { __asm__("pushl %edx\n\t" "pushl %ecx"); /* now state 0 */ MULTIANEWARRAY_ST0(%edx, 2); } - CODE(opc_multianewarray, multianewarray, ST3, ST1) { + CODE(opc_multianewarray, multianewarray, ST3, ST1, 0) { __asm__("pushl %ecx"); /* now state 0 */ MULTIANEWARRAY_ST0(%edx, 3); } - CODE(opc_multianewarray, multianewarray, ST4, ST1) { + CODE(opc_multianewarray, multianewarray, ST4, ST1, 0) { __asm__("pushl %ecx\n\t" "pushl %edx"); /* now state 0 */ MULTIANEWARRAY_ST0(%edx, 4); @@ -4349,23 +4361,23 @@ "leal (%esp,%edi,4),%esp") #define CODE_INVOKEIGNORED(suffix, SUFFIX) \ - CODE(opc_invokeignored_##suffix, invokeignored_##suffix, ST0, ST0) {\ + CODE(opc_invokeignored_##suffix, invokeignored_##suffix, ST0, ST0, 0) {\ INVOKEIGNORED_##SUFFIX##_ST0(0);\ }\ - CODE(opc_invokeignored_##suffix, invokeignored_##suffix, ST1, ST0) {\ + CODE(opc_invokeignored_##suffix, invokeignored_##suffix, ST1, ST0, 0) {\ __asm__("pushl %edx"); /* now state 0 */\ INVOKEIGNORED_##SUFFIX##_ST0(1);\ }\ - CODE(opc_invokeignored_##suffix, invokeignored_##suffix, ST2, ST0) {\ + CODE(opc_invokeignored_##suffix, invokeignored_##suffix, ST2, ST0, 0) {\ __asm__("pushl %edx\n\t"\ "pushl %ecx"); /* now state 0 */\ INVOKEIGNORED_##SUFFIX##_ST0(2);\ }\ - CODE(opc_invokeignored_##suffix, invokeignored_##suffix, ST3, ST0) {\ + CODE(opc_invokeignored_##suffix, invokeignored_##suffix, ST3, ST0, 0) {\ __asm__("pushl %ecx"); /* now state 0 */\ INVOKEIGNORED_##SUFFIX##_ST0(3);\ }\ - CODE(opc_invokeignored_##suffix, invokeignored_##suffix, ST4, ST0) {\ + CODE(opc_invokeignored_##suffix, invokeignored_##suffix, ST4, ST0, 0) {\ __asm__("pushl %ecx\n\t"\ "pushl %edx"); /* now state 0 */\ INVOKEIGNORED_##SUFFIX##_ST0(4);\ @@ -4386,39 +4398,39 @@ FUNCCALL_OUT(STATE);\ __asm__("movl %eax," #DST_REG) - CODE(opc_new_quick, new_quick, ST0, ST1) { + CODE(opc_new_quick, new_quick, ST0, ST1, 0) { NEW_QUICK(%edx, 0); } - CODE(opc_new_quick, new_quick, ST1, ST2) { + CODE(opc_new_quick, new_quick, ST1, ST2, 0) { NEW_QUICK(%ecx, 1); } - CODE(opc_new_quick, new_quick, ST2, ST4) { + CODE(opc_new_quick, new_quick, ST2, ST4, 0) { __asm__("pushl %edx"); /* now state 3 */ NEW_QUICK(%edx, 3); } - CODE(opc_new_quick, new_quick, ST3, ST4) { + CODE(opc_new_quick, new_quick, ST3, ST4, 0) { NEW_QUICK(%edx, 3); } - CODE(opc_new_quick, new_quick, ST4, ST2) { + CODE(opc_new_quick, new_quick, ST4, ST2, 0) { __asm__("pushl %ecx"); /* now state 1 */ NEW_QUICK(%ecx, 1); } /* nonnull_quick */ - CODE(opc_nonnull_quick, nonnull_quick, ST0, ST0) { + CODE(opc_nonnull_quick, nonnull_quick, ST0, ST0, 0) { __asm__("popl %edx"); /* now state 1 */ NULL_TEST(%edx, "nonnull_quick_st0_1", 0); } - CODE(opc_nonnull_quick, nonnull_quick, ST1, ST0) { + CODE(opc_nonnull_quick, nonnull_quick, ST1, ST0, 0) { NULL_TEST(%edx, "nonnull_quick_st1_1", 1); } - CODE(opc_nonnull_quick, nonnull_quick, ST2, ST1) { + CODE(opc_nonnull_quick, nonnull_quick, ST2, ST1, 0) { NULL_TEST(%ecx, "nonnull_quick_st2_1", 2); } - CODE(opc_nonnull_quick, nonnull_quick, ST3, ST0) { + CODE(opc_nonnull_quick, nonnull_quick, ST3, ST0, 0) { NULL_TEST(%ecx, "nonnull_quick_st3_1", 3); } - CODE(opc_nonnull_quick, nonnull_quick, ST4, ST3) { + CODE(opc_nonnull_quick, nonnull_quick, ST4, ST3, 0) { NULL_TEST(%edx, "nonnull_quick_st4_1", 4); } diff -aruN shujit-0.2.6/code.h shujit/code.h --- shujit-0.2.6/code.h Wed Jan 20 09:12:30 1999 +++ shujit/code.h Sat Jan 30 19:13:26 1999 @@ -165,14 +165,17 @@ SIGNAL_ERROR_CORE(KIND, STATE) -#ifndef NO_CHECK -# define NULL_TEST(REG, LABEL, STATE) \ +#define NULL_TEST_CANT_BE_ELIMINATED(REG, LABEL, STATE) \ __asm__("testl " #REG "," #REG "\n\t"\ "jnz " LABEL);\ SIGNAL_ERROR0(NullPointerException, STATE);\ __asm__(LABEL ":") + +#if !defined(NO_CHECK) && !defined(EXC_BY_SIGNAL) +# define NULL_TEST(REG, LABEL, STATE) \ + NULL_TEST_CANT_BE_ELIMINATED(REG, LABEL, STATE) #else -# define NULL_TEST(REG, LABEL) +# define NULL_TEST(REG, LABEL, STATE) #endif @@ -203,18 +206,18 @@ # define CODE_DEBUG(LABEL) #endif -#define CODE(OPCODE, LABEL, STATE, NEXTST) \ - _CODE(OPCODE, LABEL, STATE, NEXTST); -#define CODE_WITHOUT_DEBUG(OPCODE, LABEL, STATE, NEXTST) \ - _CODE_WITHOUT_DEBUG(OPCODE, LABEL, STATE, NEXTST); +#define CODE(OPCODE, LABEL, STATE, NEXTST, THROW_EXC) \ + _CODE(OPCODE, LABEL, STATE, NEXTST, THROW_EXC); +#define CODE_WITHOUT_DEBUG(OPCODE, LABEL, STATE, NEXTST, THROW_EXC) \ + _CODE_WITHOUT_DEBUG(OPCODE, LABEL, STATE, NEXTST, THROW_EXC); -#define _CODE(OPCODE, LABEL, STATE, NEXTST) \ - _CODE_WITHOUT_DEBUG(OPCODE, LABEL, STATE, NEXTST);\ +#define _CODE(OPCODE, LABEL, STATE, NEXTST, THROW_EXC) \ + _CODE_WITHOUT_DEBUG(OPCODE, LABEL, STATE, NEXTST, THROW_EXC);\ CODE_DEBUG(#LABEL "(" #STATE ">" #NEXTST ")") -#define _CODE_WITHOUT_DEBUG(OPCODE, LABEL, STATE, NEXTST) \ +#define _CODE_WITHOUT_DEBUG(OPCODE, LABEL, STATE, NEXTST, THROW_EXC) \ __asm__(\ ".byte 0xf1\n\t"\ - ".byte 0xe9," #OPCODE ",0," #STATE "," #NEXTST) + ".byte 0xe9," #OPCODE "," #STATE "," #NEXTST "," #THROW_EXC) #define CODEEND __asm__(".byte 0xf1,0xf1") diff -aruN shujit-0.2.6/compile.c shujit/compile.c --- shujit-0.2.6/compile.c Thu Jan 7 05:19:23 1999 +++ shujit/compile.c Sat Jan 30 16:53:06 1999 @@ -675,6 +675,7 @@ static int writeCode(CompilerContext *cc) { struct methodblock *mb = cc->mb; + CodeInfo *info = (CodeInfo *)(mb->CompiledCodeInfo); cp_item_type *constant_pool = cbConstantPool(fieldclass(&mb->fb)); unsigned char *type_table = constant_pool[CONSTANT_POOL_TYPE_TABLE_INDEX].type; @@ -686,7 +687,7 @@ int i; CodeTable *codep; - unsigned char *bufp; + unsigned char *bufp; int insn_head_off; for (i = 0; i < cc->pctablelen; i++) { pctable = cc->pctable + i; @@ -711,18 +712,35 @@ #endif if (opcode == opc_exception_handler) { - cc->exc_handler_nativeoff = nativeoff; + info->exc_handler_nativeoff = nativeoff; } else if (opcode == opc_methodtail) { - cc->finish_return_nativeoff = nativeoff; + info->finish_return_nativeoff = nativeoff; } + insn_head_off = cc->bufp - cc->buffer; + /* save to resolve constants */ - writeToBuffer(cc, - (unsigned char *)assembledCode + codep->offset, codep->length); - pctable->nativeoff = nativeoff; - bufp = lastBufend(cc); - + /* write native code to buffer */ + { + unsigned char *nativecode = + (unsigned char *)assembledCode + codep->offset; + writeToBuffer(cc, nativecode, codep->length); + pctable->nativeoff = nativeoff; + +#ifdef EXC_BY_SIGNAL + if (nativecode[-1]) { + /* these native code may throw NullPointerException */ + throwtableAdd(info, + nativeoff, nativeoff + codep->length, pctable->byteoff); +#ifdef RUNTIME_DEBUG + printf("throwtableAdd(): opc %x, byte 0x%x, native 0x%x - 0x%x\n", + opcode, pctable->byteoff, nativeoff, nativeoff + codep->length); + fflush(stdout); +#endif + } +#endif /* EXC_BY_SIGNAL */ + } nativeoff += codep->length; @@ -731,7 +749,7 @@ and update nativeoff. */ if ((opc_ifeq <= opcode) && (opcode <= opc_ret)) /* || ((opc_ifnull <= opcode) && (opcode <= opc_ifnonnull)) */ - /* || ((opcode == opc_goto_w) && (opcode == opc_jsr_w)) */ { + /* || (opcode == opc_goto_w) || (opcode == opc_jsr_w)) */ { int tgtoff = -1; int tgtstate; int laststate; @@ -855,6 +873,8 @@ /* resolve constants */ /* attention: var. nativeoff is already updated. */ + bufp = cc->buffer + insn_head_off; + switch (opcode) { case opc_bipush: { @@ -1383,6 +1403,7 @@ * set absolute/relative addresses into compiled code. */ static void resolveExcRetSw(CompilerContext *cc) { + CodeInfo *info = (CodeInfo *)(cc->mb->CompiledCodeInfo); unsigned char *nativeCode = cc->buffer; pcentry *pctable = cc->pctable; @@ -1428,7 +1449,7 @@ /* resolve jump to exception handler */ i = 0; if (jumpexc_table[opcode][state][i] > 0) { - unsigned int exc_off = cc->exc_handler_nativeoff; + unsigned int exc_off = info->exc_handler_nativeoff; unsigned int arg_off; int32_t relative_off; while (jumpexc_table[opcode][state][i] > 0) { @@ -1448,7 +1469,7 @@ /* resolve jump to finishing of method */ i = 0; if (jumpret_table[opcode][state][i] > 0) { - unsigned int fin_off = cc->finish_return_nativeoff; + unsigned int fin_off = info->finish_return_nativeoff; unsigned int arg_off; int32_t relative_off; while (jumpret_table[opcode][state][i] > 0) { diff -aruN shujit-0.2.6/compiler.c shujit/compiler.c --- shujit-0.2.6/compiler.c Mon Jan 18 00:48:06 1999 +++ shujit/compiler.c Sat Jan 30 20:19:23 1999 @@ -25,6 +25,19 @@ */ bool_t compiler_enabled = TRUE; +#if defined(EXC_BY_SIGNAL) && defined(SEARCH_SIGCONTEXT) +# ifdef linux +unsigned short reg_gs; +unsigned short reg_fs; +# endif +unsigned short reg_es; +unsigned short reg_ds; +# ifdef __FreeBSD__ +unsigned short reg_cs; +unsigned short reg_ss; +# endif +#endif + int opt_quiet = 0; int opt_outcode = 0; int opt_codesize = 0; @@ -44,7 +57,11 @@ * Local Functions */ static void initializeClass(ClassClass *); +#ifdef __FreeBSD__ +static void signalHandler(int sig, int code, void *uc); +#else static void signalHandler(int sig, void *info, void *uc); +#endif static void freeClass(ClassClass *); static unsigned char *compiledCodePC(JavaFrame *, struct methodblock *); static bool_t pcInCompiledCode(unsigned char *pc, struct methodblock *); @@ -147,6 +164,31 @@ /* initialization */ +#if defined(EXC_BY_SIGNAL) && defined(SEARCH_SIGCONTEXT) +#ifdef linux + __asm__("movw %%gs,%0" : "=m" (reg_gs)); + __asm__("movw %%fs,%0" : "=m" (reg_fs)); +#endif + __asm__("movw %%es,%0" : "=m" (reg_es)); + __asm__("movw %%ds,%0" : "=m" (reg_ds)); +#ifdef __FreeBSD__ + __asm__("movw %%cs,%0" : "=m" (reg_cs)); + __asm__("movw %%ss,%0" : "=m" (reg_ss)); +#endif + +#ifdef RUNTIME_DEBUG +#ifdef linux + printf("segment registers (gs,fs,es,ds): %04x, %04x, %04x, %04x\n", + reg_gs, reg_fs, reg_es, reg_ds); +#endif /* linux */ +#ifdef __FreeBSD__ + printf("segment registers (es,ds,cs,ss): %04x, %04x, %04x, %04x\n", + reg_es, reg_ds, reg_cs, reg_ss); +#endif /* __FreeBSD__ */ + fflush(stdout); +#endif +#endif /* EXC_BY_SIGNAL && SEARCH_SIGCONTEXT */ + #ifdef __FreeBSD__ /* to get addresses of functions in lib[cm] with sysDynamicLink() */ /* libc for __divdi3, __moddi3, printf, fflush */ @@ -279,87 +321,134 @@ } +#ifdef __FreeBSD__ +static void signalHandler(int sig, int code, void *uc) { +#else static void signalHandler(int sig, void *info, void *uc) { -#ifdef RUNTIME_DEBUG - printf("signalHandler for compiled code. (sig: %d)\n", sig); #endif +#ifdef EXC_BY_SIGNAL +# ifdef SEARCH_SIGCONTEXT + int32_t first_local_variable; + static int sc_offset = 0; + int32_t *ptr = ((int32_t *)&first_local_variable) + 4; + /* 4: first...variable, esp, 2 arguments */ +# endif /* SEARCH_SIGCONTEXT */ + sigcontext *sc; + struct methodblock *mb; + CodeInfo *codeinfo; + int native_off; + throwentry *tentry; +#endif /* EXC_BY_SIGNAL */ - if ((sig == SIGSEGV) || (sig == SIGBUS)) { - showStackFrames(EE()); - } +#ifdef RUNTIME_DEBUG + printf("Signal handler for compiled code called. (sig: %d)\n", sig); + showStackFrames(EE()); +#endif #ifdef EXC_BY_SIGNAL -#define SEARCH_WIDTH 100 -#ifndef USER_DS -# define USER_DS __USER_DS +#ifdef SEARCH_SIGCONTEXT + /* get signal context */ + ptr = ((int32_t *)&first_local_variable) + 4; + /* 4: first...variable, esp, 2 arguments */ + if (sc_offset > 0) { + sc = (sigcontext *)(ptr + sc_offset); + } + else { /* must search */ +#define SEARCH_WIDTH 50 + for (sc_offset = 0; sc_offset < SEARCH_WIDTH - 3; sc_offset++) { +#ifdef __FreeBSD__ + if ( (*((unsigned short *)(ptr)) == reg_es) && + (*((unsigned short *)(ptr + 1)) == reg_ds) && + (*((unsigned short *)(ptr + 2)) == reg_cs) && + (*((unsigned short *)(ptr + 3)) == reg_ss) ) { + sc_offset -= 7; + ptr -= 7; + break; + } +#else + if ( (*((unsigned short *)(ptr)) == reg_gs) && + (*((unsigned short *)(ptr + 1)) == reg_fs) && + (*((unsigned short *)(ptr + 2)) == reg_es) && + (*((unsigned short *)(ptr + 3)) == reg_ds) ) + break; #endif - { - struct sigcontext *sc; -#if 0 - int *ptr = (int *)uc - SEARCH_WIDTH; - int i; - - for (i = 0; i < SEARCH_WIDTH - 3; i++) { - if (ptr[0] == USER_DS) - if (ptr[1] == USER_DS) - if (ptr[2] == USER_DS) - if (ptr[3] == USER_DS) - break; - else ptr += 4; - else ptr += 3; - else ptr += 2; - else ptr += 1; + else + ptr += 1; } - if (i >= SEARCH_WIDTH - 3) { + if (sc_offset >= SEARCH_WIDTH - 3) { printf("FATAL: struct sigcontext is not found."); exit(1); } - sc = (struct sigcontext *)ptr; -#else - printf("sizeof(struct sigcontext): %d\n", sizeof(struct sigcontext)); - sc = (struct sigcontext *)(((char *)uc) - sizeof(struct sigcontext)); - printf("uc, sc: 0x%08x, 0x%08x\n", (int)uc, (int)sc); + sc = (sigcontext *)ptr; +#ifdef RUNTIME_DEBUG + printf("sc_offset: %d\n", sc_offset); #endif - - showSigcontext(sc); } +#else /* SEARCH_SIGCONTEXT*/ + sc = (sigcontext *)uc; +#endif /* SEARCH_SIGCONTEXT*/ +#ifdef RUNTIME_DEBUG + printf("sc: 0x%08x\n"); fflush(stdout); + showSigcontext(sc); +#endif -#ifdef SA_SIGINFO - if (info) { - ExecEnv *ee = EE(); - siginfo_t *si = (siginfo_t *)info; - - printf("si_signo: %d\n", si->si_signo); - printf("si_errno: %d\n", si->si_errno); - printf("si_code: 0x%08x\n", si->si_code); - switch (sig) { - case SIGILL: case SIGFPE: case SIGSEGV: case SIGBUS: - { - JavaFrame *frame; - struct methodblock *mb; + if ((sig == SIGSEGV) || (sig == SIGBUS)) { + /* NullPointerException occurred */ + SignalError(EE(), JAVAPKG "NullPointerException", 0); + /* set ee->exception.exc, exception object */ - frame = ee->current_frame; - if (frame) { - mb = frame->current_method; + mb = (struct methodblock *) *(((int32_t *)sc->SC_EBP) + 3); + /* mb is second argument of assembledCode(): 0xc(%ebp) */ +#ifdef RUNTIME_DEBUG + printf("method(0x%x): %s#%s %s\n", (int)mb, + cbName(mb->fb.clazz), mb->fb.name, mb->fb.signature); + fflush(stdout); +#endif + codeinfo = (CodeInfo *)(mb->CompiledCodeInfo); + native_off = + ((unsigned char *)sc->SC_EIP) - ((unsigned char *)mb->CompiledCode); +#ifdef RUNTIME_DEBUG + printf("native off: 0x%08x\n", native_off); + fflush(stdout); +#endif + tentry = throwtableGet(codeinfo, native_off); +#ifdef RUNTIME_DEBUG + printf("throwentry: "); + if (tentry) + printf("start: 0x%x, end: 0x%x, byteoff: 0x%x\n", + tentry->start, tentry->end, tentry->byteoff); + else + printf(" (null)\n"); + fflush(stdout); +#endif - printf("%s#%s %s\n", cbName(fieldclass(&mb->fb)), - mb->fb.name, mb->fb.signature); - printf(" CompiledCode: 0x%08x\n", (int)mb->CompiledCode); - } - } - { - void *addr = si->si_addr; - printf("addr: 0x%08x\n", (int)addr); - } - break; - } - } +#ifdef __FreeBSD__ + /* re-initialize signal handler */ + intrInitMD(); #endif -#endif /* EXC_BY_SIGNAL */ - printf("Signal %d is caught.\n", sig); - fflush(stdout); + /* set (int32_t)bytepcoff (local variable of assembledCode) */ + *(((int32_t *)sc->SC_EBP) - 1) = tentry->byteoff; + + /* jump to exception handler */ + { + register uint32_t orig_sp asm("ecx"); + register uint32_t orig_bp asm("edx"); + register uint32_t exc_handler asm("eax"); + + exc_handler = + (uint32_t)(mb->CompiledCode + codeinfo->exc_handler_nativeoff); + orig_sp = sc->SC_ESP; + orig_bp = sc->SC_EBP; + + __asm__("movl %%ecx,%%esp\n\t" + "movl %%edx,%%ebp\n\t" + "jmp *%%eax" + : : "r" (orig_sp), "r" (orig_bp), "r" (exc_handler)); + } /* jump to exception handler */ + } /* if ((sig == SIGSEGV) || (sig == SIGBUS)) */ +#endif /* EXC_BY_SIGNAL */ } diff -aruN shujit-0.2.6/compiler.h shujit/compiler.h --- shujit-0.2.6/compiler.h Thu Jan 21 08:16:40 1999 +++ shujit/compiler.h Sat Jan 30 20:20:27 1999 @@ -79,7 +79,7 @@ /* * OS dependent macro definition */ -#undef EXC_BY_SIGNAL /* not implemented yet */ +#define EXC_BY_SIGNAL #if defined (linux) # define EXECUTEJAVA_IN_ASM @@ -88,21 +88,41 @@ # else # define RESOLVE_SYMBOL_ON_CODE # endif +# define SEARCH_SIGCONTEXT #elif defined (__FreeBSD__) # undef EXECUTEJAVA_IN_ASM # undef RESOLVE_SYMBOL_ON_CODE +# undef SEARCH_SIGCONTEXT #else # undef EXECUTEJAVA_IN_ASM # undef RESOLVE_SYMBOL_ON_CODE +# undef SEARCH_SIGCONTEXT #endif #ifdef EXC_BY_SIGNAL # if defined(linux) # include /* for struct sigcontext */ -# include /* for macro __USER_DS */ +# include /* for kernel version */ +# if LINUX_VERSION_CODE < ((2<<16)+(1<<8)+(0)) +typedef struct sigcontext_struct sigcontext; /* 2.0.X */ +# else +typedef struct sigcontext sigcontext; /* 2.1.X, 2.2.X */ +# endif +# define SC_EIP eip +# define SC_EBP ebp +# define SC_ESP esp # elif defined(__FreeBSD__) # include /* for struct sigcontext */ +typedef struct sigcontext sigcontext; +# define SC_EIP sc_eip +# define SC_EBP sc_ebp +# define SC_ESP sc_esp +# else +typedef struct sigcontext sigcontext; +# define SC_EIP eip +# define SC_EBP ebp +# define SC_ESP esp # endif #endif @@ -147,10 +167,28 @@ } CatchFrame_w_state; +#ifdef EXC_BY_SIGNAL +typedef struct throw_entry { + unsigned int start; + unsigned int end; + unsigned int byteoff; +} throwentry; +#endif /* EXC_BY_SIGNAL */ + typedef struct compiled_code_info { int code_size; int ret_size; char *argsizes; + + unsigned int exc_handler_nativeoff; + unsigned int finish_return_nativeoff; + +#ifdef EXC_BY_SIGNAL +#define DEFAULT_THROWTABLE_SIZE 8 + throwentry *throwtable; + int throwtablelen; + int throwtablesize; +#endif /* EXC_BY_SIGNAL */ } CodeInfo; @@ -170,15 +208,11 @@ ExecEnv *ee; struct methodblock *mb; - unsigned int exc_handler_nativeoff; - unsigned int finish_return_nativeoff; - /* buffer for compiled code */ #define DEFAULT_BUF_SIZE 8192 unsigned char *buffer; int buf_size; unsigned char *bufp; - int lastbufp_off; /* program counter table */ #define DEFAULT_PCTABLE_SIZE 100 @@ -197,8 +231,20 @@ /* * Global Variables */ - /* in compiler.c */ +#if defined(EXC_BY_SIGNAL) && defined(SEARCH_SIGCONTEXT) +# ifdef linux +extern unsigned short reg_gs; +extern unsigned short reg_fs; +# endif +extern unsigned short reg_es; +extern unsigned short reg_ds; +# ifdef __FreeBSD__ +extern unsigned short reg_cs; +extern unsigned short reg_ss; +# endif +#endif + extern bool_t compiler_enabled; extern int opt_quiet; @@ -248,7 +294,6 @@ extern void resetCompilerContext(CompilerContext *cc); extern void writeToBuffer(CompilerContext *cc, void *, size_t); -#define lastBufend(cc) ((cc)->buffer + (cc)->lastbufp_off) extern void cancelOnBuffer(CompilerContext *cc, size_t); extern void ensureBufferSize(CompilerContext *cc, size_t req); @@ -262,6 +307,14 @@ extern void jptableAdd(CompilerContext *cc, unsigned int tgtoff, unsigned int argoff); +extern CodeInfo *prepareCompiledCodeInfo(ExecEnv *ee, struct methodblock *mb); +extern void freeCompiledCodeInfo(CodeInfo *info); +#ifdef EXC_BY_SIGNAL +extern void throwtableAdd(CodeInfo *info, + unsigned int start, unsigned int end, unsigned int byteoff); +extern throwentry *throwtableGet(CodeInfo *info, unsigned int nativeoff); +#endif /* EXC_BY_SIGNAL */ + /* in invoker.c */ extern bool_t compileAndInvokeMethod( @@ -273,12 +326,12 @@ extern int compileMethod(struct methodblock *mb); extern void freeMethod(struct methodblock *mb); #ifdef RESOLVE_SYMBOL_ON_CODE -void initFunctionSymbols(); +extern void initFunctionSymbols(); #endif /* in runtime.c */ #ifdef EXC_BY_SIGNAL -extern void showSigcontext(struct sigcontext *sc); +extern void showSigcontext(sigcontext *sc); #endif extern int invokeMethod( #ifdef RUNTIME_DEBUG @@ -293,7 +346,7 @@ #endif ExecEnv *ee, JHandle *obj, struct methodblock *imethod, unsigned char *guessptr); -JHandle *multianewarray( +extern JHandle *multianewarray( #ifdef RUNTIME_DEBUG int runtime_debug, #endif @@ -305,8 +358,6 @@ , int runtime_debug #endif ); -extern CodeInfo *prepareCompiledCodeInfo(ExecEnv *ee, struct methodblock *mb); -void freeCompiledCodeInfo(CodeInfo *info); extern void showStackFrames(ExecEnv *ee); #ifdef RUNTIME_DEBUG extern void showExcStackTrace(JHandle *throwable); diff -aruN shujit-0.2.6/computil.c shujit/computil.c --- shujit-0.2.6/computil.c Wed Jan 6 12:13:54 1999 +++ shujit/computil.c Sat Jan 30 15:43:09 1999 @@ -61,8 +61,6 @@ printf(" buffer: 0x%08x\n", (int)cc->buffer); printf(" bufp : 0x%08x offset:0x%x(%d)\n", (int)cc->bufp, cc->bufp - cc->buffer, cc->bufp - cc->buffer); - printf(" lastbufp: offset:0x%x(%d)\n", - cc->lastbufp_off, cc->lastbufp_off); printf(" pctable: 0x%08x\n", cc->pctable); printf(" jptable: 0x%08x\n", cc->jptable); } @@ -133,13 +131,10 @@ void resetCompilerContext(CompilerContext *cc) { - cc->bufp = cc->buffer; cc->lastbufp_off = 0; + cc->bufp = cc->buffer; cc->pctablelen = 0; cc->jptablelen = 0; - - cc->exc_handler_nativeoff = -1; - cc->finish_return_nativeoff = -1; } @@ -152,7 +147,6 @@ ensureBufferSize(cc, len); memcpy(cc->bufp, ptr, len); - cc->lastbufp_off = cc->bufp - cc->buffer; cc->bufp += len; #ifdef BUF_DEBUG printf("writeToBuffer() done.\n"); @@ -206,7 +200,9 @@ pcentry *entryp; if (cc->pctablelen >= cc->pctablesize) { /* extend table size */ - do { cc->pctablesize <<= 1; } while (cc->pctablelen >= cc->pctablesize); + do + cc->pctablesize <<= 1; + while (cc->pctablelen >= cc->pctablesize); cc->pctable = (pcentry *)sysRealloc(cc->pctable, sizeof(pcentry) * cc->pctablesize); } @@ -264,16 +260,15 @@ entryp = cc->pctable + index; if (entryp->byteoff == byteoff) { /* found */ - while (index-- >= 0) { - if ((cc->pctable + index)->byteoff == byteoff) - entryp--; - else + while (--index >= 0) { + if ((cc->pctable + index)->byteoff != byteoff) break; } - return entryp; + index++; + return cc->pctable + index; } - if (l == h) return (unsigned int)0; /* not found */ + if (l == h) return NULL; /* not found */ if (entryp->byteoff < byteoff) l = index + 1; @@ -311,3 +306,134 @@ (cc->jptablelen)++; } + + +CodeInfo *prepareCompiledCodeInfo(ExecEnv *ee, struct methodblock *method) { + CodeInfo *info = (CodeInfo *)method->CompiledCodeInfo; + if (!info) { + info = (CodeInfo *)sysMalloc(sizeof(CodeInfo)); + memset(info, 0, sizeof(CodeInfo)); /* fill zero into CodeInfo */ + method->CompiledCodeInfo = (void *)info; + } + if (!info->argsizes) { +#define AS_CHUNK_SIZE 256 + char *sig = method->fb.signature + 1; + char sizearr[AS_CHUNK_SIZE]; + int index = 0, len = 0; + + if (!(method->fb.access & ACC_STATIC)) + sizearr[index++] = 1; /* receiver */ + + while (*sig != ')') { + if ((*sig == 'D') || (*sig == 'J')) { /* long or double */ + sizearr[index++] = 2; + sig++; + } + else { + sizearr[index++] = 1; + if (*sig == 'L') while (*(sig++) != ';'); + else if (*sig == '[') { + do { sig++; } while (*sig == '['); + if (*sig == 'L') while (*(sig++) != ';'); + else sig++; + } + else + sig++; + } + + if (index >= AS_CHUNK_SIZE) { + if (info->argsizes) + info->argsizes = sysRealloc(info->argsizes, len + AS_CHUNK_SIZE); + else + info->argsizes = sysMalloc(len + AS_CHUNK_SIZE); + memcpy(info->argsizes + len, sizearr, AS_CHUNK_SIZE); + len += AS_CHUNK_SIZE; + index = 0; + } + } /* while (*sig != ')') */ + + sizearr[index++] = 0; /* terminate */ + + if (info->argsizes) + info->argsizes = sysRealloc(info->argsizes, len + index); + else + info->argsizes = sysMalloc(len + index); + memcpy(info->argsizes + len, sizearr, index); + + sig++; + if (*sig == 'V') + info->ret_size = 0; + else if ((*sig == 'D') || (*sig == 'J')) + info->ret_size = 2; + else + info->ret_size = 1; + } + +#ifdef EXC_BY_SIGNAL + info->throwtablesize = DEFAULT_THROWTABLE_SIZE; + info->throwtablelen = 0; + info->throwtable = + (throwentry *)sysMalloc(sizeof(throwentry) * DEFAULT_THROWTABLE_SIZE); +#endif /* EXC_BY_SIGNAL */ + + return info; +} + + +void freeCompiledCodeInfo(CodeInfo *info) { + if (info) { +#ifdef EXC_BY_SIGNAL + if (info->throwtable) sysFree(info->throwtable); +#endif /* EXC_BY_SIGNAL */ + if (info->argsizes) sysFree(info->argsizes); + sysFree(info); + } +} + + +#ifdef EXC_BY_SIGNAL +void throwtableAdd(CodeInfo *info, + unsigned int start, unsigned int end, unsigned int byteoff) { + throwentry *entryp; + + if (info->throwtablelen >= info->throwtablesize) { /* extend table size */ + do + info->throwtablesize <<= 1; + while (info->throwtablelen >= info->throwtablesize); + info->throwtable = (throwentry *)sysRealloc(info->throwtable, + sizeof(throwentry) * info->throwtablesize); + } + + entryp = info->throwtable + info->throwtablelen; + entryp->start = start; + entryp->end = end; + entryp->byteoff = byteoff; + + (info->throwtablelen)++; +} + + +throwentry *throwtableGet(CodeInfo *info, unsigned int nativeoff) { + int l = 0; + int h = info->throwtablelen; + int index; + throwentry *entryp; + + while (1) { + index = l + ((h - l) >> 1); + + entryp = info->throwtable + index; + if ((entryp->start <= nativeoff) && (nativeoff < entryp->end)) { + /* found */ + return entryp; + } + + if (l == h) return NULL; /* not found */ + + if (entryp->end <= nativeoff) + l = index + 1; + else + h = index; + } +} +#endif /* EXC_BY_SIGNAL */ diff -aruN shujit-0.2.6/gentable.rb shujit/gentable.rb --- shujit-0.2.6/gentable.rb Sat Jan 9 12:24:06 1999 +++ shujit/gentable.rb Sat Jan 30 14:30:17 1999 @@ -155,9 +155,9 @@ break if elems[2] == '(bad)' - opcode = elems[2].hex() + (elems[3].hex() << 8) - init_state = elems[4].hex() - after_state = elems[5].hex() + opcode = elems[2].hex()# + (elems[3].hex() << 8) + init_state = elems[3].hex() + after_state = elems[4].hex() #print "addr: #{code_addr}, opcode: #{opcode}, init_state: #{init_state}, after_state: #{after_state}\n" diff -aruN shujit-0.2.6/invoker.c shujit/invoker.c --- shujit-0.2.6/invoker.c Thu Jan 21 09:56:05 1999 +++ shujit/invoker.c Sat Jan 30 16:16:49 1999 @@ -177,7 +177,7 @@ /* %esp -= mb->nlocals * 4 */ #ifdef RUNTIME_DEBUG -# if 0 +# if 1 runtime_debug = 1; # else if ((!strcmp(cbName(mb->fb.clazz), "java/util/ResourceBundle")) @@ -189,8 +189,8 @@ else if ((!strcmp(cbName(mb->fb.clazz), "sun/tools/tree/ArrayExpression")) && (!strcmp(mb->fb.name, "codeValue"))) runtime_debug = 1; - else if ((!strcmp(cbName(mb->fb.clazz), "java/lang/Runtime")) - && (!strcmp(mb->fb.name, "loadLibrary"))) + else if ((!strcmp(cbName(mb->fb.clazz), "NET/shudo/jitdo/ThreadPool$AThread")) + && (!strcmp(mb->fb.name, "run"))) runtime_debug = 1; else runtime_debug = 0; diff -aruN shujit-0.2.6/rate_codesize.rb shujit/rate_codesize.rb --- shujit-0.2.6/rate_codesize.rb Mon Sep 21 11:50:09 1998 +++ shujit/rate_codesize.rb Sun Jan 24 03:20:05 1999 @@ -8,12 +8,23 @@ # 2. You'll get the file `jit_codesize' running Java program with JIT compiler. # 3. % rate_codesize.rb jit_codesize -DEFAULT_FNAME = 'jit_codesize' +filename = 'jit_codesize' ninst = 0 byte_size = 0 native_size = 0 +if $*[0] + filename = $*[0] +end + +#print "#{filename}\n" + +begin + f = open(filename, "r") + $stdin = f +end + while gets() next if /^#/ chomp!() @@ -21,6 +32,10 @@ ninst += elems[0].to_i() byte_size += elems[1].to_i() native_size += elems[2].to_i() +end + +if f then + f.close end print "num of byte code inst: #{ninst}\n" diff -aruN shujit-0.2.6/runtime.c shujit/runtime.c --- shujit-0.2.6/runtime.c Mon Jan 18 00:46:12 1999 +++ shujit/runtime.c Sat Jan 30 20:19:33 1999 @@ -21,7 +21,7 @@ /* * show contents of structure sigcontext */ -void showSigcontext(struct sigcontext *sc) { +void showSigcontext(sigcontext *sc) { printf("EAX: %08x, ECX: %08x, EDX: %08x, EBX: %08x\n", #if defined(linux) sc->eax, sc->ecx, sc->edx, sc->ebx @@ -58,6 +58,8 @@ sc->sc_ss, sc->sc_cs, sc->sc_ds, sc->sc_es #endif ); + + fflush(stdout); } #endif /* EXC_BY_SIGNAL */ @@ -333,7 +335,7 @@ if ((mtable == proxy_methodtable) && (REMOTE_FLAG(ee))) { /* obj instanceof Proxy*/ cb = unhand((HNET_shudo_jitdo_Proxy *)obj)->clazz; - mtable = cbMethodtable(cb); + mtable = cbMethodTable(cb); } #endif } @@ -423,7 +425,10 @@ #ifdef RUNTIME_DEBUG if (runtime_debug) { - printf(" searchCatchFrame() called.\n"); fflush(stdout); + printf(" searchCatchFrame() called:\n" + " ee: 0x%x, mb: 0x%x, 0x%x\n", + (int)ee, (int)mb, bytepcoff); + fflush(stdout); } #endif @@ -434,8 +439,12 @@ #ifdef RUNTIME_DEBUG if (runtime_debug) { JHandle *exc = ee->exception.exc; - printf(" exc: 0x%08x(%s)\n", + printf(" exc: "); + if (exc) + printf("0x%08x(%s)\n", (int)exc, cbName(exc->methods->classdescriptor)); + else + printf(" is NULL !!!\n"); printf(" bytepcoff %d\n", bytepcoff); fflush(stdout); } @@ -531,79 +540,6 @@ } #endif return NULL; - } -} - - -CodeInfo *prepareCompiledCodeInfo(ExecEnv *ee, struct methodblock *method) { - CodeInfo *info = (CodeInfo *)method->CompiledCodeInfo; - if (!info) { - info = (CodeInfo *)sysMalloc(sizeof(CodeInfo)); - memset(info, 0, sizeof(CodeInfo)); /* fill zero into CodeInfo */ - method->CompiledCodeInfo = (void *)info; - } - if (!info->argsizes) { -#define AS_CHUNK_SIZE 256 - char *sig = method->fb.signature + 1; - char sizearr[AS_CHUNK_SIZE]; - int index = 0, len = 0; - - if (!(method->fb.access & ACC_STATIC)) - sizearr[index++] = 1; /* receiver */ - - while (*sig != ')') { - if ((*sig == 'D') || (*sig == 'J')) { /* long or double */ - sizearr[index++] = 2; - sig++; - } - else { - sizearr[index++] = 1; - if (*sig == 'L') while (*(sig++) != ';'); - else if (*sig == '[') { - do { sig++; } while (*sig == '['); - if (*sig == 'L') while (*(sig++) != ';'); - else sig++; - } - else - sig++; - } - - if (index >= AS_CHUNK_SIZE) { - if (info->argsizes) - info->argsizes = sysRealloc(info->argsizes, len + AS_CHUNK_SIZE); - else - info->argsizes = sysMalloc(len + AS_CHUNK_SIZE); - memcpy(info->argsizes + len, sizearr, AS_CHUNK_SIZE); - len += AS_CHUNK_SIZE; - index = 0; - } - } /* while (*sig != ')') */ - - sizearr[index++] = 0; /* terminate */ - - if (info->argsizes) - info->argsizes = sysRealloc(info->argsizes, len + index); - else - info->argsizes = sysMalloc(len + index); - memcpy(info->argsizes + len, sizearr, index); - - sig++; - if (*sig == 'V') - info->ret_size = 0; - else if ((*sig == 'D') || (*sig == 'J')) - info->ret_size = 2; - else - info->ret_size = 1; - } - - return info; -} - - -void freeCompiledCodeInfo(CodeInfo *info) { - if (info) { - if (info->argsizes) free(info->argsizes); - free(info); } } diff -aruN shujit-0.2.6/txt/benchmark-SS3000 shujit/txt/benchmark-SS3000 --- shujit-0.2.6/txt/benchmark-SS3000 Thu Jan 21 10:04:35 1999 +++ shujit/txt/benchmark-SS3000 Sat Jan 30 20:05:24 1999 @@ -12,17 +12,17 @@ Iview Valetta.jpg 456 482 647 msec (*) 非常にばらつく TYA12: 4833-10668, 990104: 773-7469 - plain TYA12v3 990120 -Sieve 96 317 398 times -TestOpcodeField 4037 1310 1309 msec -TestOpcodeStatic 3095 429 258 msec -TestFinalStatic 12299 7362(*) 1116(*) msec -Iview Valetta.jpg 447 460 631 msec + plain TYA12v3 990120 990130 +Sieve 96 317 398 421 times +TestOpcodeField 4037 1310 1309 1202 msec +TestOpcodeStatic 3095 429 258 258 msec +TestFinalStatic 12299 7362(*) 1116(*) 772(*) msec +Iview Valetta.jpg 447 460 631 576 msec [Linpack Benchmark -- Java Version] -plain TYA12 990104 -1.973 5.086 4.213 +plain TYA12 990104 990130 +1.973 5.086 4.213 4.488 [E2 1MB 暗号化] @@ -33,10 +33,10 @@ 192 859 362 465 256 855 384 481 - plain TYA12v3 990120 -128 809 348 398 -192 827 351 382 -256 853 348 400 + plain TYA12v3 990120 990130 +128 809 348 398 373 +192 827 351 382 349 +256 853 348 400 359 [CaffeineMark 3.0] @@ -68,15 +68,15 @@ (*) EXCEPTIONS_BY_SIGNALS を #undef shuJIT - 990104 990106 990120 990120 990121 -Sieve 890 891 892 879 891 -Loop 1712 1710 1703 1712 1712 -Logic 2882 2891 2881 2885 2877 -String 1015 1007 1017 1004 1116 -Float 1038 1030 1043 1046 1030 -Method 146 144 189 187 199 -Graphics472 481 495 513 494 -Image 303 304 298 294 303 -Dialog 63 63 63 65 68 -CM3 567 567 582 587 600 + 990104 990106 990120 990120 990121 990130 +Sieve 890 891 892 879 891 915 +Loop 1712 1710 1703 1712 1712 1893 +Logic 2882 2891 2881 2885 2877 2884 +String 1015 1007 1017 1004 1116 1113 +Float 1038 1030 1043 1046 1030 1121 +Method 146 144 189 187 199 198 +Graphics472 481 495 513 494 549 +Image 303 304 298 294 303 326 +Dialog 63 63 63 65 68 63 +CM3 567 567 582 587 600 621 (cmplclinit) diff -aruN shujit-0.2.6/txt/dumpss.c shujit/txt/dumpss.c --- shujit-0.2.6/txt/dumpss.c Thu Jan 1 00:00:00 1970 +++ shujit/txt/dumpss.c Sat Jan 30 17:17:55 1999 @@ -0,0 +1,20 @@ +/* dump segment registers */ + +#include + +int main(int argc, char **argv) { + register unsigned short s asm("ax"); + +#define PRINT_SS(REG) \ + __asm__("movw %" #REG ",%ax");\ + printf(#REG ": %04x\n", (int)s) + + PRINT_SS(gs); + PRINT_SS(fs); + PRINT_SS(es); + PRINT_SS(ds); + PRINT_SS(cs); + PRINT_SS(ss); + + return 0; +} diff -aruN shujit-0.2.6/txt/jdk117v1a_for_glibc2.0.110.diff shujit/txt/jdk117v1a_for_glibc2.0.110.diff --- shujit-0.2.6/txt/jdk117v1a_for_glibc2.0.110.diff Thu Jan 1 00:00:00 1970 +++ shujit/txt/jdk117v1a_for_glibc2.0.110.diff Fri Jan 29 00:49:08 1999 @@ -0,0 +1,22 @@ +--- ./include/genunix/timeval_md.h.orig Fri Jan 29 09:40:10 1999 ++++ ./include/genunix/timeval_md.h Fri Jan 29 09:42:12 1999 +@@ -17,13 +17,16 @@ + + #ifdef __GLIBC__ + #define __need_timeval +-#include ++#endif /* __GLIBC__ */ ++ ++#include /* for struct timeval */ + typedef struct timeval timeval_t; +-#else ++ ++#if 0 + typedef struct { + long tv_sec; /* seconds */ + long tv_usec; /* microseconds (NOT milliseconds) */ + } timeval_t; +-#endif /* __GLIBC__ */ ++#endif + + #endif