Author: Armin Rigo <[email protected]>
Branch: remove-globals-in-jit
Changeset: r58968:fde7e26f592d
Date: 2012-11-17 09:40 +0100
http://bitbucket.org/pypy/pypy/changeset/fde7e26f592d/
Log: Revert the last usage of rerased in the jit. It just doesn't work.
Fix it differently.
diff --git a/pypy/jit/metainterp/compile.py b/pypy/jit/metainterp/compile.py
--- a/pypy/jit/metainterp/compile.py
+++ b/pypy/jit/metainterp/compile.py
@@ -4,7 +4,7 @@
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
@@ -648,6 +648,18 @@
self.copy_all_attributes_into(res)
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):
@@ -661,7 +673,8 @@
# 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 = AllVirtuals.show(metainterp_sd.cpu, hidden_all_virtuals)
+ all_virtuals = obj.list
if all_virtuals is None:
all_virtuals = []
assert jitdriver_sd is self.jitdriver_sd
@@ -697,7 +710,8 @@
# 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):
@@ -723,8 +737,6 @@
self.copy_all_attributes_into(res)
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),
diff --git a/pypy/rlib/rerased.py b/pypy/rlib/rerased.py
--- a/pypy/rlib/rerased.py
+++ b/pypy/rlib/rerased.py
@@ -110,13 +110,7 @@
_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):
@@ -136,7 +130,6 @@
# ---------- implementation-specific ----------
class Erased(object):
- _TYPE = llmemory.GCREF
def __init__(self, x, identity):
self._x = x
self._identity = identity
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit