[pypy-svn] r25627 - in pypy/dist/pypy/translator/stackless: . test
mwh at codespeak.net
mwh at codespeak.net
Sun Apr 9 17:06:39 CEST 2006
Author: mwh
Date: Sun Apr 9 17:06:38 2006
New Revision: 25627
Modified:
pypy/dist/pypy/translator/stackless/code.py
pypy/dist/pypy/translator/stackless/test/test_transform.py
Log:
clean up stackless.code.call_function by using unsafe_call
Modified: pypy/dist/pypy/translator/stackless/code.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/code.py (original)
+++ pypy/dist/pypy/translator/stackless/code.py Sun Apr 9 17:06:38 2006
@@ -1,4 +1,4 @@
-from pypy.rpython.lltypesystem import lltype, llmemory
+from pypy.rpython.lltypesystem import lltype, llmemory, lloperation
from pypy.rpython import rarithmetic
STATE_HEADER = lltype.GcStruct('state_header',
@@ -25,32 +25,24 @@
global_state = StacklessData()
-void_void_func = lltype.Ptr(lltype.FuncType([], lltype.Void))
-long_void_func = lltype.Ptr(lltype.FuncType([lltype.Signed], lltype.Signed))
-longlong_void_func = lltype.Ptr(lltype.FuncType([], lltype.SignedLongLong))
-float_void_func = lltype.Ptr(lltype.FuncType([], lltype.Float))
-pointer_void_func = lltype.Ptr(lltype.FuncType([], llmemory.Address) )
-
def call_function(fn, signature):
if signature == 'void':
- fn2 = llmemory.cast_adr_to_ptr(fn, void_void_func)
- fn2()
+ lloperation.llop.unsafe_call(lltype.Void, fn)
elif signature == 'long':
- fn3 = llmemory.cast_adr_to_ptr(fn, long_void_func)
- global_state.retval_long = fn3(0)
+ global_state.retval_long = lloperation.llop.unsafe_call(
+ lltype.Signed, fn)
elif signature == 'longlong':
- fn3 = llmemory.cast_adr_to_ptr(fn, longlong_void_func)
- global_state.retval_longlong = fn3()
+ global_state.retval_longlong = lloperation.llop.unsafe_call(
+ lltype.SignedLongLong, fn)
elif signature == 'float':
- fn3 = llmemory.cast_adr_to_ptr(fn, float_void_func)
- global_state.retval_double = fn3()
+ global_state.retval_double = lloperation.llop.unsafe_call(
+ lltype.Float, fn)
elif signature == 'pointer':
- fn5 = llmemory.cast_adr_to_ptr(fn, pointer_void_func)
- global_state.retval_void_p = fn5()
+ global_state.retval_void_p = lloperation.llop.unsafe_call(
+ llmemory.Address, fn)
null_address = llmemory.fakeaddress(None)
-
class UnwindException(Exception):
def __init__(self):
self.frame_top = null_state # points to frame that first caught
Modified: pypy/dist/pypy/translator/stackless/test/test_transform.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/test/test_transform.py (original)
+++ pypy/dist/pypy/translator/stackless/test/test_transform.py Sun Apr 9 17:06:38 2006
@@ -87,8 +87,7 @@
## from pypy.rpython.llinterp import LLInterpreter
## interp = LLInterpreter(t.rtyper)
## res = interp.eval_graph(graphof(t, entry_point), [ll_list])
-## print res
-## return
+## return str(res)
cbuilder = CStandaloneBuilder(t, entry_point)#, gcpolicy=gc.BoehmGcPolicy)
cbuilder.generate_source()
More information about the Pypy-commit
mailing list