[pypy-svn] r67256 - in pypy/branch/pyjitpl5-less-is_oo/pypy/jit: backend backend/cli backend/llgraph backend/llvm backend/test backend/x86 backend/x86/test metainterp
antocuni at codespeak.net
antocuni at codespeak.net
Thu Aug 27 18:11:52 CEST 2009
Author: antocuni
Date: Thu Aug 27 18:11:51 2009
New Revision: 67256
Modified:
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/cli/runner.py
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llgraph/llimpl.py
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llgraph/runner.py
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llvm/runner.py
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/model.py
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/test/runner_test.py
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/runner.py
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/test/test_regalloc.py
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/test/test_runner.py
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/compile.py
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/history.py
pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/warmspot.py
Log:
- rename set_future_value_{obj,ptr} to *_ref; the same for get_lastest_value_{obj,ptr)
- unify ExitFrameWithExceptionDescr{Obj,Ptr}
ExitFrameWithExceptionDescrRef
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/cli/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/cli/runner.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/cli/runner.py Thu Aug 27 18:11:51 2009
@@ -105,14 +105,14 @@
def set_future_value_int(self, index, intvalue):
self.get_inputargs().set_int(index, intvalue)
- def set_future_value_obj(self, index, objvalue):
+ def set_future_value_ref(self, index, objvalue):
obj = dotnet.cast_to_native_object(objvalue)
self.get_inputargs().set_obj(index, obj)
def get_latest_value_int(self, index):
return self.get_inputargs().get_int(index)
- def get_latest_value_obj(self, index):
+ def get_latest_value_ref(self, index):
obj = self.get_inputargs().get_obj(index)
return dotnet.cast_from_native_object(obj)
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llgraph/llimpl.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llgraph/llimpl.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llgraph/llimpl.py Thu Aug 27 18:11:51 2009
@@ -866,12 +866,7 @@
assert len(_future_values) == index
_future_values.append(value)
-def set_future_value_ptr(index, value):
- del _future_values[index:]
- assert len(_future_values) == index
- _future_values.append(value)
-
-def set_future_value_obj(index, value):
+def set_future_value_ref(index, value):
del _future_values[index:]
assert len(_future_values) == index
_future_values.append(value)
@@ -1274,8 +1269,7 @@
setannotation(new_frame, s_Frame)
setannotation(frame_clear, annmodel.s_None)
setannotation(set_future_value_int, annmodel.s_None)
-setannotation(set_future_value_ptr, annmodel.s_None)
-setannotation(set_future_value_obj, annmodel.s_None)
+setannotation(set_future_value_ref, annmodel.s_None)
setannotation(frame_execute, annmodel.SomeInteger())
setannotation(frame_int_getvalue, annmodel.SomeInteger())
setannotation(frame_ptr_getvalue, annmodel.SomePtr(llmemory.GCREF))
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llgraph/runner.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llgraph/runner.py Thu Aug 27 18:11:51 2009
@@ -187,19 +187,13 @@
def set_future_value_int(self, index, intvalue):
llimpl.set_future_value_int(index, intvalue)
- def set_future_value_ptr(self, index, ptrvalue):
- llimpl.set_future_value_ptr(index, ptrvalue)
-
- def set_future_value_obj(self, index, objvalue):
- llimpl.set_future_value_obj(index, objvalue)
+ def set_future_value_ref(self, index, objvalue):
+ llimpl.set_future_value_ref(index, objvalue)
def get_latest_value_int(self, index):
return llimpl.frame_int_getvalue(self.latest_frame, index)
- def get_latest_value_ptr(self, index):
- return llimpl.frame_ptr_getvalue(self.latest_frame, index)
-
- def get_latest_value_obj(self, index):
+ def get_latest_value_ref(self, index):
return llimpl.frame_ptr_getvalue(self.latest_frame, index)
# ----------
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llvm/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llvm/runner.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/llvm/runner.py Thu Aug 27 18:11:51 2009
@@ -310,7 +310,7 @@
p = rffi.cast(lltype.Ptr(self.SIGNED_VALUE), self.in_out_args[index])
p[0] = intvalue
- def set_future_value_ptr(self, index, ptrvalue):
+ def set_future_value_ref(self, index, ptrvalue):
p = rffi.cast(lltype.Ptr(self.POINTER_VALUE), self.in_out_args[index])
p[0] = ptrvalue
@@ -331,7 +331,7 @@
p = rffi.cast(lltype.Ptr(self.SIGNED_VALUE), self.in_out_args[index])
return p[0]
- def get_latest_value_ptr(self, index):
+ def get_latest_value_ref(self, index):
p = rffi.cast(lltype.Ptr(self.POINTER_VALUE), self.in_out_args[index])
return p[0]
@@ -679,7 +679,7 @@
if calldescr.res_index < 0:
return None
elif calldescr.res_index == self.SIZE_GCPTR:
- return BoxPtr(self.get_latest_value_ptr(0))
+ return BoxPtr(self.get_latest_value_ref(0))
else:
return BoxInt(self.get_latest_value_int(0))
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/model.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/model.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/model.py Thu Aug 27 18:11:51 2009
@@ -23,11 +23,7 @@
"""Set the value for the index'th argument for the loop to run."""
raise NotImplementedError
- def set_future_value_ptr(self, index, ptrvalue):
- """Set the value for the index'th argument for the loop to run."""
- raise NotImplementedError
-
- def set_future_value_obj(self, index, objvalue):
+ def set_future_value_ref(self, index, objvalue):
"""Set the value for the index'th argument for the loop to run."""
raise NotImplementedError
@@ -36,14 +32,9 @@
lastest rop.FAIL. Returns an int."""
raise NotImplementedError
- def get_latest_value_ptr(self, index):
- """Returns the value for the index'th argument to the
- lastest rop.FAIL. Returns a ptr."""
- raise NotImplementedError
-
- def get_latest_value_obj(self, index):
+ def get_latest_value_ref(self, index):
"""Returns the value for the index'th argument to the
- lastest rop.FAIL. Returns an obj."""
+ lastest rop.FAIL. Returns a ptr or an obj."""
raise NotImplementedError
def get_exception(self):
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/test/runner_test.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/test/runner_test.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/test/runner_test.py Thu Aug 27 18:11:51 2009
@@ -24,10 +24,10 @@
self.cpu.set_future_value_int(j, box.getint())
j += 1
elif isinstance(box, BoxPtr):
- self.cpu.set_future_value_ptr(j, box.getref_base())
+ self.cpu.set_future_value_ref(j, box.getref_base())
j += 1
elif isinstance(box, BoxObj):
- self.cpu.set_future_value_obj(j, box.getref_base())
+ self.cpu.set_future_value_ref(j, box.getref_base())
j += 1
res = self.cpu.execute_operations(loop)
if res is loop.operations[-1]:
@@ -37,7 +37,7 @@
if result_type == 'int':
return BoxInt(self.cpu.get_latest_value_int(0))
elif result_type == 'ptr':
- return BoxPtr(self.cpu.get_latest_value_ptr(0))
+ return BoxPtr(self.cpu.get_latest_value_ref(0))
elif result_type == 'void':
return None
else:
@@ -885,7 +885,7 @@
self.cpu.set_future_value_int(0, 1)
self.cpu.execute_operations(loop)
assert self.cpu.get_latest_value_int(0) == 0
- assert self.cpu.get_latest_value_ptr(1) == xptr
+ assert self.cpu.get_latest_value_ref(1) == xptr
self.cpu.clear_exception()
self.cpu.set_future_value_int(0, 0)
self.cpu.execute_operations(loop)
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/runner.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/runner.py Thu Aug 27 18:11:51 2009
@@ -216,14 +216,14 @@
assert index < MAX_FAIL_BOXES, "overflow!"
self.assembler.fail_boxes_int[index] = intvalue
- def set_future_value_ptr(self, index, ptrvalue):
+ def set_future_value_ref(self, index, ptrvalue):
assert index < MAX_FAIL_BOXES, "overflow!"
self.assembler.fail_boxes_ptr[index] = ptrvalue
def get_latest_value_int(self, index):
return self.assembler.fail_boxes_int[index]
- def get_latest_value_ptr(self, index):
+ def get_latest_value_ref(self, index):
ptrvalue = self.assembler.fail_boxes_ptr[index]
# clear after reading
self.assembler.fail_boxes_ptr[index] = lltype.nullptr(
@@ -465,7 +465,7 @@
if size == 0:
return None
elif ptr:
- return BoxPtr(self.get_latest_value_ptr(0))
+ return BoxPtr(self.get_latest_value_ref(0))
else:
return BoxInt(self.get_latest_value_int(0))
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/test/test_regalloc.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/test/test_regalloc.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/test/test_regalloc.py Thu Aug 27 18:11:51 2009
@@ -177,7 +177,7 @@
else:
assert isinstance(lltype.typeOf(arg), lltype.Ptr)
llgcref = lltype.cast_opaque_ptr(llmemory.GCREF, arg)
- self.cpu.set_future_value_ptr(i, llgcref)
+ self.cpu.set_future_value_ref(i, llgcref)
if run:
self.cpu.execute_operations(loop)
return loop
@@ -190,7 +190,7 @@
index in range(0, end)]
def getptr(self, index, T):
- gcref = self.cpu.get_latest_value_ptr(index)
+ gcref = self.cpu.get_latest_value_ref(index)
return lltype.cast_opaque_ptr(T, gcref)
def attach_bridge(self, ops, loop, guard_op):
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/test/test_runner.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/test/test_runner.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/backend/x86/test/test_runner.py Thu Aug 27 18:11:51 2009
@@ -332,7 +332,7 @@
if op == rop.INT_IS_TRUE:
self.cpu.set_future_value_int(0, b.value)
else:
- self.cpu.set_future_value_ptr(0, b.value)
+ self.cpu.set_future_value_ref(0, b.value)
r = self.cpu.execute_operations(loop)
result = self.cpu.get_latest_value_int(0)
if guard == rop.GUARD_FALSE:
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/compile.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/compile.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/compile.py Thu Aug 27 18:11:51 2009
@@ -155,7 +155,7 @@
assert metainterp_sd.result_type == 'ptr'
resultbox = fail_op.args[0]
if isinstance(resultbox, BoxPtr):
- result = metainterp_sd.cpu.get_latest_value_ptr(0)
+ result = metainterp_sd.cpu.get_latest_value_ref(0)
else:
assert isinstance(resultbox, history.Const)
result = resultbox.getref_base()
@@ -166,40 +166,29 @@
assert metainterp_sd.result_type == 'obj'
resultbox = fail_op.args[0]
if isinstance(resultbox, BoxObj):
- result = metainterp_sd.cpu.get_latest_value_obj(0)
+ result = metainterp_sd.cpu.get_latest_value_ref(0)
else:
assert isinstance(resultbox, history.Const)
result = resultbox.getref_base()
raise metainterp_sd.DoneWithThisFrameObj(result)
-class ExitFrameWithExceptionDescrPtr(AbstractDescr):
+class ExitFrameWithExceptionDescrRef(AbstractDescr):
def handle_fail_op(self, metainterp_sd, fail_op):
assert len(fail_op.args) == 1
valuebox = fail_op.args[0]
- if isinstance(valuebox, BoxPtr):
- value = metainterp_sd.cpu.get_latest_value_ptr(0)
- else:
- assert isinstance(valuebox, history.Const)
- value = valuebox.getref_base()
- raise metainterp_sd.ExitFrameWithExceptionRef(metainterp_sd.cpu, value)
-
-class ExitFrameWithExceptionDescrObj(AbstractDescr):
- def handle_fail_op(self, metainterp_sd, fail_op):
- assert len(fail_op.args) == 1
- valuebox = fail_op.args[0]
- if isinstance(valuebox, BoxObj):
- value = metainterp_sd.cpu.get_latest_value_obj(0)
+ cpu = metainterp_sd.cpu
+ if isinstance(valuebox, cpu.ts.BoxRef):
+ value = cpu.get_latest_value_ref(0)
else:
assert isinstance(valuebox, history.Const)
value = valuebox.getref_base()
- raise metainterp_sd.ExitFrameWithExceptionRef(metainterp_sd.cpu, value)
+ raise metainterp_sd.ExitFrameWithExceptionRef(cpu, value)
done_with_this_frame_descr_void = DoneWithThisFrameDescrVoid()
done_with_this_frame_descr_int = DoneWithThisFrameDescrInt()
done_with_this_frame_descr_ptr = DoneWithThisFrameDescrPtr()
done_with_this_frame_descr_obj = DoneWithThisFrameDescrObj()
-exit_frame_with_exception_descr_ptr = ExitFrameWithExceptionDescrPtr()
-exit_frame_with_exception_descr_obj = ExitFrameWithExceptionDescrObj()
+exit_frame_with_exception_descr_ref = ExitFrameWithExceptionDescrRef()
class TerminatingLoop(TreeLoop):
pass
@@ -234,13 +223,13 @@
_loop = TerminatingLoop('exit_frame_with_exception_ptr')
_loop.specnodes = [prebuiltNotSpecNode]
_loop.inputargs = [BoxPtr()]
-_loop.finishdescr = exit_frame_with_exception_descr_ptr
+_loop.finishdescr = exit_frame_with_exception_descr_ref
loops_exit_frame_with_exception_ptr = [_loop]
_loop = TerminatingLoop('exit_frame_with_exception_obj')
_loop.specnodes = [prebuiltNotSpecNode]
_loop.inputargs = [BoxObj()]
-_loop.finishdescr = exit_frame_with_exception_descr_obj
+_loop.finishdescr = exit_frame_with_exception_descr_ref
loops_exit_frame_with_exception_obj = [_loop]
del _loop
@@ -279,10 +268,10 @@
srcvalue = cpu.get_latest_value_int(i)
box.changevalue_int(srcvalue)
elif not cpu.is_oo and isinstance(box, BoxPtr):
- srcvalue = cpu.get_latest_value_ptr(i)
+ srcvalue = cpu.get_latest_value_ref(i)
box.changevalue_ptr(srcvalue)
elif cpu.is_oo and isinstance(box, BoxObj):
- srcvalue = cpu.get_latest_value_obj(i)
+ srcvalue = cpu.get_latest_value_ref(i)
box.changevalue_obj(srcvalue)
elif isinstance(box, Const):
pass # we don't need to do anything
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/history.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/history.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/history.py Thu Aug 27 18:11:51 2009
@@ -309,7 +309,7 @@
return bool(self.value)
def set_future_value(self, cpu, j):
- cpu.set_future_value_ptr(j, self.value)
+ cpu.set_future_value_ref(j, self.value)
def equals(self, other):
return self.value == other.getref_base()
@@ -355,7 +355,7 @@
return bool(self.value)
def set_future_value(self, cpu, j):
- cpu.set_future_value_obj(j, self.value)
+ cpu.set_future_value_ref(j, self.value)
## def getaddr(self, cpu):
## # so far this is used only when calling
@@ -500,7 +500,7 @@
return bool(self.value)
def set_future_value(self, cpu, j):
- cpu.set_future_value_ptr(j, self.value)
+ cpu.set_future_value_ref(j, self.value)
def repr_rpython(self):
return repr_rpython(self, 'bp')
@@ -545,7 +545,7 @@
return bool(self.value)
def set_future_value(self, cpu, j):
- cpu.set_future_value_obj(j, self.value)
+ cpu.set_future_value_ref(j, self.value)
def repr_rpython(self):
return repr_rpython(self, 'bo')
Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/warmspot.py (original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/warmspot.py Thu Aug 27 18:11:51 2009
@@ -691,10 +691,10 @@
cpu = metainterp_sd.cpu
if typecode == 'ptr':
ptrvalue = lltype.cast_opaque_ptr(llmemory.GCREF, value)
- cpu.set_future_value_ptr(j, ptrvalue)
+ cpu.set_future_value_ref(j, ptrvalue)
elif typecode == 'obj':
objvalue = ootype.cast_to_object(value)
- cpu.set_future_value_obj(j, objvalue)
+ cpu.set_future_value_ref(j, objvalue)
elif typecode == 'int':
intvalue = lltype.cast_primitive(lltype.Signed, value)
cpu.set_future_value_int(j, intvalue)
More information about the Pypy-commit
mailing list