Author: Armin Rigo <ar...@tunes.org>
Branch: stmgc-c7
Changeset: r70311:9fd001585246
Date: 2014-03-27 19:24 +0100
http://bitbucket.org/pypy/pypy/changeset/9fd001585246/

Log:    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.

diff --git a/rpython/jit/metainterp/compile.py 
b/rpython/jit/metainterp/compile.py
--- a/rpython/jit/metainterp/compile.py
+++ b/rpython/jit/metainterp/compile.py
@@ -1,6 +1,5 @@
 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
@@ -594,7 +593,7 @@
                 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)
diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py
--- a/rpython/rlib/objectmodel.py
+++ b/rpython/rlib/objectmodel.py
@@ -572,7 +572,7 @@
         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"
diff --git a/rpython/rtyper/llinterp.py b/rpython/rtyper/llinterp.py
--- a/rpython/rtyper/llinterp.py
+++ b/rpython/rtyper/llinterp.py
@@ -749,8 +749,6 @@
         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)
diff --git a/rpython/rtyper/lltypesystem/lloperation.py 
b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -399,7 +399,6 @@
     '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),
diff --git a/rpython/translator/c/funcgen.py b/rpython/translator/c/funcgen.py
--- a/rpython/translator/c/funcgen.py
+++ b/rpython/translator/c/funcgen.py
@@ -666,7 +666,6 @@
     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)
diff --git a/rpython/translator/c/src/int.h b/rpython/translator/c/src/int.h
--- a/rpython/translator/c/src/int.h
+++ b/rpython/translator/c/src/int.h
@@ -224,6 +224,7 @@
 #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)
diff --git a/rpython/translator/stm/inevitable.py 
b/rpython/translator/stm/inevitable.py
--- a/rpython/translator/stm/inevitable.py
+++ b/rpython/translator/stm/inevitable.py
@@ -10,9 +10,7 @@
     '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',
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to