Commits

Armin Rigo  committed 03f18cc

Fixes following the merge.

  • Participants
  • Parent commits de5da9b
  • Branches stm-thread-2

Comments (0)

Files changed (3)

File pypy/jit/backend/x86/assembler.py

         if guardtok.is_guard_not_forced:
             mc.writechar(chr(self.CODE_FORCED))
         self.write_failure_recovery_description(mc, guardtok.failargs,
-                                                guardtok.fail_locs,
-                                                fail_index)
+                                                guardtok.fail_locs)
+        # write the fail_index too
+        mc.writeimm32(fail_index)
+        # for testing the decoding, write a final byte 0xCC
         if not we_are_translated():
+            mc.writechar('\xCC')
             faillocs = [loc for loc in guardtok.fail_locs if loc is not None]
             guardtok.faildescr._x86_debug_faillocs = faillocs
         return startpos
     CODE_INPUTARG   = 8 | DESCR_SPECIAL
     CODE_FORCED     = 12 | DESCR_SPECIAL
 
-    def write_failure_recovery_description(self, mc, failargs, locs,
-                                           fail_index):
+    def write_failure_recovery_description(self, mc, failargs, locs):
         for i in range(len(failargs)):
             arg = failargs[i]
             if arg is not None:

File pypy/jit/backend/x86/runner.py

         return self.assembler.assemble_bridge(faildescr, inputargs, operations,
                                               original_loop_token, log=log)
 
-    def clear_latest_values(self, count):
-        asmtlocal = stmtlocal.get_asm_tlocal(self)
-        null = lltype.nullptr(llmemory.GCREF.TO)
-        for index in range(count):
-            asmtlocal.fail_boxes_ptr[index] = null
-
     def make_execute_token(self, *ARGS):
         FUNCPTR = lltype.Ptr(lltype.FuncType(ARGS, llmemory.GCREF))
         #
         def execute_token(executable_token, *args):
-            stmtlocal.prepare_asm_tlocal(self)
             clt = executable_token.compiled_loop_token
             assert len(args) == clt._debug_nbargs
             #

File pypy/jit/backend/x86/stmtlocal.py

-#
-# This is hopefully a temporary hack for x86 and x86-64
-#
-
-from pypy.rpython.lltypesystem import lltype, rffi, llmemory
-from pypy.rpython import annlowlevel
-from pypy.jit.codewriter import longlong
+from pypy.rpython.lltypesystem import lltype, rffi
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.jit.backend.x86.arch import WORD
-from pypy.rlib.objectmodel import we_are_translated
-from pypy.rlib import rgc
-from pypy.module.thread.ll_thread import get_ident
 
 
 if WORD == 4:
         mc.writechar('\x65')   # %gs:
     else:
         mc.writechar('\x64')   # %fs:
-
-# ____________________________________________________________
-
-
-FAILARGS_LIMIT = 1000     # xxx repeated constant
-
-ASSEMBLER_THREAD_LOCAL = lltype.GcStruct(
-    'ASSEMBLER_THREAD_LOCAL',
-    ('fail_ebp', lltype.Signed),
-    ('fail_boxes_count', lltype.Signed),
-    ('fail_boxes_ptr', lltype.FixedSizeArray(llmemory.GCREF, FAILARGS_LIMIT)),
-    ('fail_boxes_int', lltype.FixedSizeArray(lltype.Signed, FAILARGS_LIMIT)),
-    ('fail_boxes_float', lltype.FixedSizeArray(longlong.FLOATSTORAGE,
-                                               FAILARGS_LIMIT)),
-    )
-
-def get_thread_ident(cpu):
-    if cpu.with_threads:
-        return get_ident()
-    else:
-        return 0
-
-@rgc.no_collect
-def get_asm_tlocal(cpu):
-    id = get_thread_ident(cpu)
-    return cpu.assembler.asmtlocals[id]
-
-def prepare_asm_tlocal(cpu):
-    id = get_thread_ident(cpu)
-    if id not in cpu.assembler.asmtlocals:
-        cpu.assembler.asmtlocals[id] = lltype.malloc(ASSEMBLER_THREAD_LOCAL)
-
-def fail_boxes_int_addr(tlocal, num):
-    tgt = llmemory.cast_ptr_to_adr(tlocal)
-    tgt += rffi.offsetof(ASSEMBLER_THREAD_LOCAL, 'fail_boxes_int')
-    tgt = rffi.cast(lltype.Signed, tgt)
-    tgt += num * rffi.sizeof(lltype.Signed)
-    return tgt
-
-def fail_boxes_ptr_addr(tlocal, num):
-    tgt = llmemory.cast_ptr_to_adr(tlocal)
-    tgt += rffi.offsetof(ASSEMBLER_THREAD_LOCAL, 'fail_boxes_ptr')
-    tgt = rffi.cast(lltype.Signed, tgt)
-    tgt += num * rffi.sizeof(llmemory.GCREF)
-    return tgt
-
-def fail_boxes_float_addr(tlocal, num):
-    tgt = llmemory.cast_ptr_to_adr(tlocal)
-    tgt += rffi.offsetof(ASSEMBLER_THREAD_LOCAL, 'fail_boxes_float')
-    tgt = rffi.cast(lltype.Signed, tgt)
-    tgt += num * rffi.sizeof(longlong.FLOATSTORAGE)
-    return tgt