Commits

Armin Rigo committed 9fd0015

Revert of some old and recent checkins, getting rid of cast_current_ptr_to_int again. It's not
different any more from the trunk's cast_ptr_to_int, which gets us the address of the GC object, which
might still be moving once but which is otherwise coherent.

Comments (0)

Files changed (7)

rpython/jit/metainterp/compile.py

 import weakref
 from rpython.rtyper.lltypesystem import lltype, llmemory
-from rpython.rtyper.lltypesystem.lloperation import llop
 from rpython.rtyper.annlowlevel import cast_instance_to_gcref
 from rpython.rlib.objectmodel import we_are_translated
 from rpython.rlib.debug import debug_start, debug_stop, debug_print
                 intval = metainterp_sd.cpu.get_int_value(deadframe, index)
             elif typetag == self.TY_REF:
                 refval = metainterp_sd.cpu.get_ref_value(deadframe, index)
-                intval = llop.cast_current_ptr_to_int(lltype.Signed, refval)
+                intval = lltype.cast_ptr_to_int(refval)
             elif typetag == self.TY_FLOAT:
                 floatval = metainterp_sd.cpu.get_float_value(deadframe, index)
                 intval = longlong.gethash_fast(floatval)

rpython/rlib/objectmodel.py

         hop.exception_cannot_occur()
         from rpython.rtyper.lltypesystem import lltype
         if isinstance(vobj.concretetype, lltype.Ptr):
-            return hop.genop('cast_current_ptr_to_int', [vobj],
+            return hop.genop('cast_ptr_to_int', [vobj],
                              resulttype = lltype.Signed)
         from rpython.rtyper.error import TyperError
         raise TyperError("current_object_addr_as_int() cannot be applied to"

rpython/rtyper/llinterp.py

         checkptr(ptr1)
         return lltype.cast_ptr_to_int(ptr1)
 
-    op_cast_current_ptr_to_int = op_cast_ptr_to_int
-
     def op_cast_opaque_ptr(self, RESTYPE, obj):
         checkptr(obj)
         return lltype.cast_opaque_ptr(RESTYPE, obj)

rpython/rtyper/lltypesystem/lloperation.py

     'ptr_iszero':           LLOp(canfold=True),
     'cast_ptr_to_int':      LLOp(sideeffects=False),
     'cast_int_to_ptr':      LLOp(sideeffects=False),
-    'cast_current_ptr_to_int': LLOp(sideeffects=False),  # gcptr->int, approx.
     'direct_fieldptr':      LLOp(canfold=True),
     'direct_arrayitems':    LLOp(canfold=True),
     'direct_ptradd':        LLOp(canfold=True),

rpython/translator/c/funcgen.py

     OP_CAST_ADR_TO_PTR = OP_CAST_POINTER
     OP_CAST_OPAQUE_PTR = OP_CAST_POINTER
     OP_CAST_PTR_TO_ADR = OP_CAST_POINTER
-    OP_CAST_PTR_TO_INT = OP_CAST_POINTER
 
     def OP_CAST_INT_TO_PTR(self, op):
         TYPE = self.lltypemap(op.result)

rpython/translator/c/src/int.h

 #define OP_CAST_INT_TO_LONGLONGLONG(x,r) r = (__int128)(x)
 #define OP_CAST_CHAR_TO_INT(x,r)    r = (Signed)((unsigned char)(x))
 #define OP_CAST_INT_TO_CHAR(x,r)    r = (char)(x)
+#define OP_CAST_PTR_TO_INT(x,r)     r = (Signed)(x)
 #define OP_CAST_CURRENT_PTR_TO_INT(x,r)  r = (Signed)(x)
 
 #define OP_TRUNCATE_LONGLONG_TO_INT(x,r) r = (Signed)(x)

rpython/translator/stm/inevitable.py

     'debug_print', 'debug_assert',
     'debug_start', 'debug_stop', 'have_debug_prints',
     'cast_opaque_ptr', 'hint',
-    'stack_current', 'gc_stack_bottom',
-    'cast_current_ptr_to_int',   # this variant of 'cast_ptr_to_int' is ok
-    'cast_ptr_to_int',           # only for non-gc, crashes in genc for gc
+    'stack_current', 'gc_stack_bottom', 'cast_ptr_to_int',
     'jit_force_virtual', 'jit_force_virtualizable',
     'jit_force_quasi_immutable', 'jit_marker', 'jit_is_virtual',
     'jit_record_known_class',