# New Ticket Created by Ron Blaschke # Please include the string: [perl #44765] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=44765 >
Problem: JIT code ist currently optimized to reuse the interpreter on the stack. At least Visual C++ 8.0 when optimizing is known to use the arguments location on the stack as scratch. Other compilers may do the same. Solution: Don't reuse the interpreter on the stack, put on a fresh copy. I've left the optimized solution in place, guarded with C<PARROT_JIT_STACK_REUSE_INTERP>. Only define this if you know for sure your compiler never uses the arguments location as scratch space. Changed Files: src/jit/i386/jit_emit.h Test Result: Windows XP Visual C++ 8.0, optimized build Parrot r20678 Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t/src/atomic.t 4 1024 4 4 100.00% 1-4 t/src/basic.t 3 768 3 3 100.00% 1-3 t/src/compiler.t 5 1280 6 5 83.33% 2-6 t/src/exit.t 1 256 1 1 100.00% 1 t/src/extend.t 15 3840 16 15 93.75% 1-15 t/src/hash.t 11 2816 11 11 100.00% 1-11 t/src/io.t 17 4352 20 17 85.00% 1-15 18 20 t/src/list.t 2 512 2 2 100.00% 1-2 t/src/sprintf.t 3 768 3 3 100.00% 1-3 t/src/string.t 2 512 3 2 66.67% 2-3 12 tests and 603 subtests skipped. Failed 10/310 test scripts, 96.77% okay. 63/7465 subtests failed, 99.16% okay. NMAKE : fatal error U1077: 'C:\Perl\bin\perl.exe' : return code '0xff' Stop. Please ignore the t/src test failures, they are unrelated. For example: # Failed test (t/src/sprintf.t at line 44) t/src/sprintf.....................................NOK 2# 'link -nologo -nodefaultlib -debug -machine:x86 -debug t/sr c/sprintf_3.obj src\parrot_config.obj -out:t\src\sprintf_3.exe -Lblib\lib libparrot$(A) kernel32.lib ws2_32.lib msvcrt .lib oldnames.lib gmp.lib readline.lib' failed with exit code 80 # Failed to build 't\src\sprintf_3.exe': LINK : warning LNK4044: unrecognized option '/Lblib\lib'; ignored # LINK : fatal error LNK1104: cannot open file 'libparrot$(A).obj' Ron
Index: src/jit/i386/jit_emit.h =================================================================== --- src/jit/i386/jit_emit.h (revision 20678) +++ src/jit/i386/jit_emit.h (working copy) @@ -3600,27 +3600,55 @@ if (cur_op >= jit_op_count()) { cur_op = CORE_OPS_wrapper__; } - /* - * op functions have the signature (cur_op, interp) - * we use the interpreter already on stack and only push the - * cur_op - */ if ((++check & 0x7) == 0) { /* * every 8 ??? normal ops, we emit a check for event processing */ + +# ifdef PARROT_JIT_STACK_REUSE_INTERP + /* + * op functions have the signature (cur_op, interp) + * we use the interpreter already on stack and only push the + * cur_op + */ +# else + /* push interpreter */ + Parrot_jit_emit_get_INTERP(interp, jit_info->native_ptr, emit_ECX); + emitm_pushl_r(jit_info->native_ptr, emit_ECX); +# endif + emitm_pushl_i(jit_info->native_ptr, CORE_OPS_check_events); call_func(jit_info, (void (*)(void))interp->op_func_table[CORE_OPS_check_events]); +# ifdef PARROT_JIT_STACK_REUSE_INTERP emitm_addb_i_r(jit_info->native_ptr, 4, emit_ESP); +# else + emitm_addb_i_r(jit_info->native_ptr, 8, emit_ESP); +# endif } + +# ifdef PARROT_JIT_STACK_REUSE_INTERP + /* + * op functions have the signature (cur_op, interp) + * we use the interpreter already on stack and only push the + * cur_op + */ +# else + Parrot_jit_emit_get_INTERP(interp, jit_info->native_ptr, emit_ECX); + emitm_pushl_r(jit_info->native_ptr, emit_ECX); +# endif + emitm_pushl_i(jit_info->native_ptr, jit_info->cur_op); call_func(jit_info, (void (*)(void))interp->op_func_table[cur_op]); +# ifdef PARROT_JIT_STACK_REUSE_INTERP emitm_addb_i_r(jit_info->native_ptr, 4, emit_ESP); +# else + emitm_addb_i_r(jit_info->native_ptr, 8, emit_ESP); +# endif } # endif /* JIT_CGP */