[pypy-svn] r27507 - in pypy/dist/pypy/rpython: lltypesystem memory memory/test
mwh at codespeak.net
mwh at codespeak.net
Sat May 20 15:57:15 CEST 2006
Author: mwh
Date: Sat May 20 15:57:12 2006
New Revision: 27507
Modified:
pypy/dist/pypy/rpython/lltypesystem/lloperation.py
pypy/dist/pypy/rpython/memory/gc.py
pypy/dist/pypy/rpython/memory/gctransform.py
pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py
Log:
the boring bits of the x_become operation, no actual implementation yet.
Modified: pypy/dist/pypy/rpython/lltypesystem/lloperation.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/lloperation.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/lloperation.py Sat May 20 15:57:12 2006
@@ -321,6 +321,11 @@
# implemented by the Mark&Sweep GC
'gc_x_swap_pool': LLOp(canraise=(MemoryError,)),
'gc_x_clone': LLOp(canraise=(MemoryError,)),
+ # this one is even more experimental; only implemented with the
+ # Mark&Sweep GC, and likely only useful when combined with
+ # stackless:
+ 'gc_x_become': LLOp(canraise=(RuntimeError,)),
+
# __________ stackless operation(s) __________
Modified: pypy/dist/pypy/rpython/memory/gc.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gc.py (original)
+++ pypy/dist/pypy/rpython/memory/gc.py Sat May 20 15:57:12 2006
@@ -455,6 +455,8 @@
# reinstall the pool that was current at the beginning of x_clone()
clonedata.pool = self.x_swap_pool(curpool)
+ def x_become(self, target_addr, source_addr):
+ pass
class SemiSpaceGC(GCBase):
_alloc_flavor_ = "raw"
Modified: pypy/dist/pypy/rpython/memory/gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py Sat May 20 15:57:12 2006
@@ -903,7 +903,11 @@
annmodel.s_None,
minimal_transform = False)
- self.annotate_more_helpers(annhelper)
+ self.x_become_ptr = getfn(
+ GCClass.x_become.im_func,
+ [s_gc, annmodel.SomeAddress(), annmodel.SomeAddress()],
+ annmodel.s_None,
+ minimal_transform = False)
annhelper.finish() # at this point, annotate all mix-level helpers
annhelper.backend_optimize()
@@ -921,9 +925,6 @@
FLDTYPE = getattr(HDR, fldname)
fields.append((fldname, FLDTYPE))
- def annotate_more_helpers(self, annhelper):
- pass
-
def build_stack_root_iterator(self):
gcdata = self.gcdata
sizeofaddr = llmemory.sizeof(llmemory.Address)
@@ -1190,6 +1191,14 @@
op.result)
return [newop]
+ def replace_gc_x_become(self, op, livevars, block):
+ [v_target, v_source] = op.args
+ newop = SpaceOperation("direct_call",
+ [self.x_become_ptr, self.c_const_gc,
+ v_target, v_source],
+ op.result)
+ return [newop]
+
def push_alive_nopyobj(self, var):
return []
@@ -1276,9 +1285,6 @@
# nothing left to inline during code generation
self.inline = False
- def annotate_more_helpers(self, annhelper):
- pass
-
def replace_and_inline_malloc_already_now(self):
for graph in self.translator.graphs:
any_malloc = False
Modified: pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py (original)
+++ pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py Sat May 20 15:57:12 2006
@@ -334,6 +334,23 @@
class transformerclass(gctransform.StacklessFrameworkGCTransformer):
GC_PARAMS = {'start_heap_size': 4096 }
+ def test_x_become(self):
+ S = lltype.GcStruct("S", ('x', lltype.Signed))
+ def f():
+ x = lltype.malloc(S)
+ x.x = 10
+ y = lltype.malloc(S)
+ y.x = 20
+ z = x
+ llop.gc_x_become(lltype.Void,
+ llmemory.cast_ptr_to_adr(x),
+ llmemory.cast_ptr_to_adr(y))
+ return z.x
+ run = self.runner(f)
+ res = run([])
+ # not implemented yet!
+ #assert res == 20
+
def test_tree_cloning(self):
py.test.skip("aaaaaaaaaaaaaaaaaaaaaaargh later")
import os
More information about the Pypy-commit
mailing list