Armin Rigo  committed fde7e26

Revert the last usage of rerased in the jit. It just doesn't work. Fix
it differently.

  • Participants
  • Parent commits 71db844
  • Branches remove-globals-in-jit

Comments (0)

Files changed (2)

File pypy/jit/metainterp/

 from pypy.objspace.flow.model import Constant, Variable
 from pypy.rlib.objectmodel import we_are_translated
 from pypy.rlib.debug import debug_start, debug_stop, debug_print
-from pypy.rlib import rstack, rerased
+from pypy.rlib import rstack
 from pypy.rlib.jit import JitDebugInfo, Counters
 from pypy.conftest import option
 from pypy.tool.sourcetools import func_with_new_name
         return res
+class AllVirtuals:
+    def __init__(self, list):
+        self.list = list
+    def hide(self, cpu):
+        ptr = cpu.ts.cast_instance_to_base_ref(self)
+        return cpu.ts.cast_to_ref(ptr)
+    @staticmethod
+    def show(cpu, gcref):
+        from pypy.rpython.annlowlevel import cast_base_ptr_to_instance
+        ptr = cpu.ts.cast_to_baseclass(gcref)
+        return cast_base_ptr_to_instance(AllVirtuals, ptr)
 class ResumeGuardForcedDescr(ResumeGuardDescr):
     def __init__(self, metainterp_sd, jitdriver_sd):
         # handle_async_forcing() just a moment ago.
         from pypy.jit.metainterp.blackhole import resume_in_blackhole
         hidden_all_virtuals = metainterp_sd.cpu.get_savedata_ref(deadframe)
-        all_virtuals = av_unerase(hidden_all_virtuals)
+        obj =, hidden_all_virtuals)
+        all_virtuals = obj.list
         if all_virtuals is None:
             all_virtuals = []
         assert jitdriver_sd is self.jitdriver_sd
         # The virtualizable data was stored on the real virtualizable above.
         # Handle all_virtuals: keep them for later blackholing from the
         # future failure of the GUARD_NOT_FORCED
-        hidden_all_virtuals = av_erase(all_virtuals)
+        obj = AllVirtuals(all_virtuals)
+        hidden_all_virtuals = obj.hide(metainterp_sd.cpu)
         metainterp_sd.cpu.set_savedata_ref(deadframe, hidden_all_virtuals)
     def fetch_data(self, key):
         return res
-av_erase, av_unerase = rerased.new_erasing_pair('all_virtuals')
 class AbstractResumeGuardCounters(object):
     # Completely custom algorithm for now: keep 5 pairs (value, counter),

File pypy/rlib/

         _about_ = unerase
         def compute_result_annotation(self, s_obj):
-            # unerase() accepts a GCREF which is normally SomeErased,
-            # tracked directly from a corresponding erase().  For corner
-            # cases, we might get a random GCREF too (only when translated).
-            if isinstance(s_obj, annmodel.SomePtr):
-                assert annmodel.SomePtr(llmemory.GCREF).contains(s_obj)
-            else:
-                assert SomeErased().contains(s_obj)
+            assert SomeErased().contains(s_obj)
             return identity.leave_tunnel(self.bookkeeper)
         def specialize_call(self, hop):
 # ---------- implementation-specific ----------
 class Erased(object):
-    _TYPE = llmemory.GCREF
     def __init__(self, x, identity):
         self._x = x
         self._identity = identity