[pypy-commit] pypy stm-thread-2: Fixes

arigo noreply at buildbot.pypy.org
Wed Oct 3 15:21:02 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread-2
Changeset: r57765:c68951e7edec
Date: 2012-10-03 15:20 +0200
http://bitbucket.org/pypy/pypy/changeset/c68951e7edec/

Log:	Fixes

diff --git a/pypy/jit/backend/x86/stmtlocal.py b/pypy/jit/backend/x86/stmtlocal.py
--- a/pypy/jit/backend/x86/stmtlocal.py
+++ b/pypy/jit/backend/x86/stmtlocal.py
@@ -55,21 +55,28 @@
                                                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_ident()
+    id = get_thread_ident(cpu)
     return cpu.assembler.asmtlocals[id]
 
 def prepare_asm_tlocal(cpu):
-    id = get_ident()
+    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 rffi.cast(lltype.Signed, tgt)
+    return tgt
 
 def fail_boxes_ptr_addr(tlocal, num):
     tgt = llmemory.cast_ptr_to_adr(tlocal)
@@ -81,5 +88,6 @@
 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 rffi.cast(lltype.Signed, tgt)
+    return tgt


More information about the pypy-commit mailing list