[pypy-svn] r27523 - in pypy/dist/pypy: rpython rpython/module translator/stackless translator/stackless/test
arigo at codespeak.net
arigo at codespeak.net
Sun May 21 10:14:51 CEST 2006
Author: arigo
Date: Sun May 21 10:14:47 2006
New Revision: 27523
Modified:
pypy/dist/pypy/rpython/extfunctable.py
pypy/dist/pypy/rpython/module/ll_stackless.py
pypy/dist/pypy/rpython/rstack.py
pypy/dist/pypy/translator/stackless/code.py
pypy/dist/pypy/translator/stackless/frame.py
pypy/dist/pypy/translator/stackless/test/test_clone.py
pypy/dist/pypy/translator/stackless/transform.py
Log:
Remove the reccopy() of frames, made obsolete by the gc_x_clone() approach.
Modified: pypy/dist/pypy/rpython/extfunctable.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunctable.py (original)
+++ pypy/dist/pypy/rpython/extfunctable.py Sun May 21 10:14:47 2006
@@ -254,9 +254,7 @@
declare(rstack.stack_capture, rstack.frame_stack_top, 'll_stack/capture')
frametop_type_info = declaregcptrtype(rstack.frame_stack_top,'frame_stack_top',
switch = (rstack.frame_stack_top,
- 'll_stackless/switch'),
- clone = (rstack.frame_stack_top,
- 'll_stackless/clone'))
+ 'll_stackless/switch'))
# ___________________________________________________________
# javascript
Modified: pypy/dist/pypy/rpython/module/ll_stackless.py
==============================================================================
--- pypy/dist/pypy/rpython/module/ll_stackless.py (original)
+++ pypy/dist/pypy/rpython/module/ll_stackless.py Sun May 21 10:14:47 2006
@@ -18,10 +18,3 @@
else:
return to_opaque_object(newframetop)
ll_stackless_switch.suggested_primitive = True
-
-
-def ll_stackless_clone(opaqueframetop):
- frametop = from_opaque_object(opaqueframetop)
- newframetop = frametop.clone()
- return to_opaque_object(newframetop)
-ll_stackless_clone.suggested_primitive = True
Modified: pypy/dist/pypy/rpython/rstack.py
==============================================================================
--- pypy/dist/pypy/rpython/rstack.py (original)
+++ pypy/dist/pypy/rpython/rstack.py Sun May 21 10:14:47 2006
@@ -32,5 +32,3 @@
class frame_stack_top(object):
def switch(self):
raise NotImplementedError("only works in translated versions")
- def clone(self):
- raise NotImplementedError("only works in translated versions")
Modified: pypy/dist/pypy/translator/stackless/code.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/code.py (original)
+++ pypy/dist/pypy/translator/stackless/code.py Sun May 21 10:14:47 2006
@@ -55,13 +55,6 @@
# ____________________________________________________________
-def ll_frame_clone(oldstate):
- oldframe = lltype.cast_opaque_ptr(lltype.Ptr(STATE_HEADER), oldstate)
- newframe = frame.ll_frame_reccopy(oldframe)
- return lltype.cast_opaque_ptr(frame.OPAQUE_STATE_HEADER_PTR, newframe)
-
-# ____________________________________________________________
-
def yield_current_frame_to_caller():
if global_state.restart_substate == -1:
# normal entry point for yield_current_frame_to_caller()
Modified: pypy/dist/pypy/translator/stackless/frame.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/frame.py (original)
+++ pypy/dist/pypy/translator/stackless/frame.py Sun May 21 10:14:47 2006
@@ -63,44 +63,17 @@
def make_state_header_type(name, *fields):
- fnname = 'll_reccopy_%s' % (name,)
- source = ['def %s(frame):' % (fnname,),
- ' frame = lltype.cast_pointer(lltype.Ptr(FRAME), frame)',
- ' newframe = lltype.malloc(FRAME)',
- ' if frame.header.f_back:',
- ' newframe.header.f_back = ll_frame_reccopy(',
- ' frame.header.f_back)',
- ' newframe.header.f_restart = frame.header.f_restart']
- for name, _ in fields:
- source.append(' newframe.%s = frame.%s' % (name, name))
- source.append(' return lltype.cast_pointer(lltype.Ptr(STATE_HEADER),')
- source.append(' newframe)')
- source.append('')
- miniglobals = {'lltype': lltype,
- 'll_frame_reccopy': ll_frame_reccopy,
- 'STATE_HEADER': STATE_HEADER,
- }
- exec compile2('\n'.join(source)) in miniglobals
- extras = {
- 'adtmeths': {'reccopy': miniglobals[fnname]}
- }
- FRAME = lltype.GcStruct(name,
- ('header', STATE_HEADER),
- *fields, **extras)
- miniglobals['FRAME'] = FRAME
- return FRAME
+ return lltype.GcStruct(name,
+ ('header', STATE_HEADER),
+ *fields)
# ____________________________________________________________
# master array giving information about the restart points
# (STATE_HEADER.frameinfo is an index into this array)
-RECCOPY_FUNC = lltype.FuncType([lltype.Ptr(STATE_HEADER)],
- lltype.Ptr(STATE_HEADER))
-
FRAME_INFO = lltype.Struct('frame_info',
('fnaddr', llmemory.Address),
- ('info', lltype.Signed),
- ('reccopy', lltype.Ptr(RECCOPY_FUNC)))
+ ('info', lltype.Signed))
FRAME_INFO_ARRAY = lltype.Array(FRAME_INFO)
def decodestate(index):
@@ -117,12 +90,6 @@
finfo.info) # retval_type
decodestate.stackless_explicit = True
-def ll_frame_reccopy(frame):
- from pypy.translator.stackless.code import global_state
- masterarray = global_state.masterarray
- finfo = masterarray[frame.f_restart]
- return finfo.reccopy(frame)
-
class RestartInfo(object):
@@ -130,7 +97,7 @@
self.func_or_graph = func_or_graph
self.frame_types = frame_types
- def compress(self, rtyper, mix):
+ def compress(self, rtyper):
if self.frame_types:
bk = rtyper.annotator.bookkeeper
graph = self.func_or_graph
@@ -145,12 +112,6 @@
]
for i in range(1, len(self.frame_types)):
result.append({'info': i})
- for i in range(len(self.frame_types)):
- reccopy = self.frame_types[i].reccopy
- s_header = annmodel.SomePtr(lltype.Ptr(STATE_HEADER))
- fnptr = mix.delayedfunction(reccopy, [s_header],
- s_header)
- result[i]['reccopy'] = fnptr
else:
result = []
return result
Modified: pypy/dist/pypy/translator/stackless/test/test_clone.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/test/test_clone.py (original)
+++ pypy/dist/pypy/translator/stackless/test/test_clone.py Sun May 21 10:14:47 2006
@@ -4,6 +4,7 @@
def test_simple():
+ import py; py.test.skip("to be rewritten with gc_x_clone")
def g(lst):
lst.append(1)
parent = rstack.yield_current_frame_to_caller()
Modified: pypy/dist/pypy/translator/stackless/transform.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/transform.py (original)
+++ pypy/dist/pypy/translator/stackless/transform.py Sun May 21 10:14:47 2006
@@ -197,9 +197,6 @@
ll_stackless.ll_stackless_switch:
mixlevelannotator.constfunc(
code.ll_frame_switch, [s_StatePtr], s_StatePtr),
- ll_stackless.ll_stackless_clone:
- mixlevelannotator.constfunc(
- code.ll_frame_clone, [s_StatePtr], s_StatePtr),
ll_stack.ll_stack_unwind:
mixlevelannotator.constfunc(
code.ll_stack_unwind, [], annmodel.s_None),
@@ -230,8 +227,6 @@
lltype.typeOf(null_state))
self.c_gc_nocollect = model.Constant("gc_nocollect", lltype.Void)
- self.reccopyannotator = MixLevelHelperAnnotator(translator.rtyper)
-
# register the prebuilt restartinfos
for restartinfo in frame.RestartInfo.prebuilt:
self.register_restart_info(restartinfo)
@@ -577,13 +572,12 @@
def register_restart_info(self, restartinfo):
rtyper = self.translator.rtyper
- for frame_info_dict in restartinfo.compress(rtyper, self.reccopyannotator):
+ for frame_info_dict in restartinfo.compress(rtyper):
self.masterarray1.append(frame_info_dict)
def finish(self):
# compute the final masterarray by copying over the masterarray1,
# which is a list of dicts of attributes
- self.reccopyannotator.finish()
masterarray = lltype.malloc(frame.FRAME_INFO_ARRAY,
len(self.masterarray1),
immortal=True)
More information about the Pypy-commit
mailing list