[pypy-commit] pypy optresult-unroll: whack at tests a bit so they're runnable
fijal
noreply at buildbot.pypy.org
Mon Aug 24 10:28:37 CEST 2015
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: optresult-unroll
Changeset: r79180:3a31270fcdd4
Date: 2015-08-24 10:24 +0200
http://bitbucket.org/pypy/pypy/changeset/3a31270fcdd4/
Log: whack at tests a bit so they're runnable
diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py
--- a/rpython/jit/backend/llgraph/runner.py
+++ b/rpython/jit/backend/llgraph/runner.py
@@ -92,8 +92,7 @@
def __init__(self, S, vtable, runner):
self.S = S
self._is_object = vtable is not None
- self.all_fielddescrs = heaptracker.all_fielddescrs(runner, S,
- get_field_descr=LLGraphCPU.fielddescrof)
+ self.vtable = vtable
def get_all_fielddescrs(self):
return self.all_fielddescrs
@@ -103,7 +102,7 @@
def get_vtable(self):
return heaptracker.adr2int(llmemory.cast_ptr_to_adr(
- self._corresponding_vtable))
+ self.vtable))
def count_fields_if_immutable(self):
return heaptracker.count_fields_if_immutable(self.S)
@@ -223,6 +222,8 @@
self.fieldname = fieldname
self.FIELD = getattr(A.OF, fieldname)
self.arraydescr = runner.arraydescrof(A)
+ assert not heaptracker.has_gcstruct_a_vtable(A)
+ runner.sizeof(A.OF, None)
self.fielddescr = runner.fielddescrof(A.OF, fieldname)
def get_arraydescr(self):
@@ -414,6 +415,8 @@
except KeyError:
descr = SizeDescr(S, vtable, self)
self.descrs[key] = descr
+ descr.all_fielddescrs = heaptracker.all_fielddescrs(self, S,
+ get_field_descr=LLGraphCPU.fielddescrof)
return descr
def fielddescrof(self, S, fieldname):
@@ -423,8 +426,8 @@
except KeyError:
descr = FieldDescr(S, fieldname)
self.descrs[key] = descr
- is_obj = heaptracker.has_gcstruct_a_vtable(S)
- descr.parent_descr = self.sizeof(S, is_obj)
+ vtable = self.descrs[('size', S)].vtable
+ descr.parent_descr = self.sizeof(S, vtable)
if self.vinfo_for_tests is not None:
descr.vinfo = self.vinfo_for_tests
return descr
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_util.py b/rpython/jit/metainterp/optimizeopt/test/test_util.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_util.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_util.py
@@ -121,9 +121,9 @@
myptr2 = lltype.cast_opaque_ptr(llmemory.GCREF, lltype.malloc(NODE))
nullptr = lltype.nullptr(llmemory.GCREF.TO)
#nodebox2 = InputArgRef(lltype.cast_opaque_ptr(llmemory.GCREF, node2))
- nodesize = cpu.sizeof(NODE, True)
- nodesize2 = cpu.sizeof(NODE2, True)
- nodesize3 = cpu.sizeof(NODE3, True)
+ nodesize = cpu.sizeof(NODE, node_vtable)
+ nodesize2 = cpu.sizeof(NODE2, node_vtable2)
+ nodesize3 = cpu.sizeof(NODE3, node_vtable3)
valuedescr = cpu.fielddescrof(NODE, 'value')
floatdescr = cpu.fielddescrof(NODE, 'floatval')
chardescr = cpu.fielddescrof(NODE, 'charval')
@@ -139,7 +139,7 @@
QUASI = lltype.GcStruct('QUASIIMMUT', ('inst_field', lltype.Signed),
('mutate_field', rclass.OBJECTPTR),
hints={'immutable_fields': accessor})
- quasisize = cpu.sizeof(QUASI, False)
+ quasisize = cpu.sizeof(QUASI, None)
quasi = lltype.malloc(QUASI, immortal=True)
quasi.inst_field = -4247
quasifielddescr = cpu.fielddescrof(QUASI, 'inst_field')
@@ -151,6 +151,7 @@
('ref', lltype.Ptr(OBJECT)))
nodeobj = lltype.malloc(NODEOBJ)
nodeobjvalue = lltype.cast_opaque_ptr(llmemory.GCREF, nodeobj)
+ cpu.sizeof(NODEOBJ, None)
refdescr = cpu.fielddescrof(NODEOBJ, 'ref')
INTOBJ_NOIMMUT = lltype.GcStruct('INTOBJ_NOIMMUT', ('parent', OBJECT),
@@ -160,15 +161,16 @@
hints={'immutable': True})
intobj_noimmut_vtable = lltype.malloc(OBJECT_VTABLE, immortal=True)
intobj_immut_vtable = lltype.malloc(OBJECT_VTABLE, immortal=True)
+ noimmut_descr = cpu.sizeof(INTOBJ_NOIMMUT, intobj_noimmut_vtable)
+ immut_descr = cpu.sizeof(INTOBJ_IMMUT, intobj_immut_vtable)
noimmut_intval = cpu.fielddescrof(INTOBJ_NOIMMUT, 'intval')
immut_intval = cpu.fielddescrof(INTOBJ_IMMUT, 'intval')
- noimmut_descr = cpu.sizeof(INTOBJ_NOIMMUT, True)
- immut_descr = cpu.sizeof(INTOBJ_IMMUT, True)
PTROBJ_IMMUT = lltype.GcStruct('PTROBJ_IMMUT', ('parent', OBJECT),
('ptrval', lltype.Ptr(OBJECT)),
hints={'immutable': True})
ptrobj_immut_vtable = lltype.malloc(OBJECT_VTABLE, immortal=True)
+ cpu.sizeof(PTROBJ_IMMUT, None)
immut_ptrval = cpu.fielddescrof(PTROBJ_IMMUT, 'ptrval')
arraydescr = cpu.arraydescrof(lltype.GcArray(lltype.Signed))
@@ -178,7 +180,7 @@
# a GcStruct not inheriting from OBJECT
S = lltype.GcStruct('TUPLE', ('a', lltype.Signed), ('abis', lltype.Signed),
('b', lltype.Ptr(NODE)))
- ssize = cpu.sizeof(S, False)
+ ssize = cpu.sizeof(S, None)
adescr = cpu.fielddescrof(S, 'a')
abisdescr = cpu.fielddescrof(S, 'abis')
bdescr = cpu.fielddescrof(S, 'b')
@@ -193,15 +195,16 @@
('inst_w_seq', llmemory.GCREF), ('inst_index', lltype.Signed),
('inst_w_list', llmemory.GCREF), ('inst_length', lltype.Signed),
('inst_start', lltype.Signed), ('inst_step', lltype.Signed))
+ w_root_vtable = lltype.malloc(OBJECT_VTABLE, immortal=True)
+ cpu.sizeof(W_ROOT, w_root_vtable)
inst_w_seq = cpu.fielddescrof(W_ROOT, 'inst_w_seq')
inst_index = cpu.fielddescrof(W_ROOT, 'inst_index')
inst_length = cpu.fielddescrof(W_ROOT, 'inst_length')
inst_start = cpu.fielddescrof(W_ROOT, 'inst_start')
inst_step = cpu.fielddescrof(W_ROOT, 'inst_step')
inst_w_list = cpu.fielddescrof(W_ROOT, 'inst_w_list')
- w_root_vtable = lltype.malloc(OBJECT_VTABLE, immortal=True)
- tsize = cpu.sizeof(T, False)
+ tsize = cpu.sizeof(T, None)
cdescr = cpu.fielddescrof(T, 'c')
ddescr = cpu.fielddescrof(T, 'd')
arraydescr3 = cpu.arraydescrof(lltype.GcArray(lltype.Ptr(NODE)))
@@ -214,10 +217,10 @@
SIMPLE = lltype.GcStruct('simple',
('parent', OBJECT),
('value', lltype.Signed))
- simpledescr = cpu.sizeof(SIMPLE, True)
+ simple_vtable = lltype.malloc(OBJECT_VTABLE, immortal=True)
+ simpledescr = cpu.sizeof(SIMPLE, simple_vtable)
simplevalue = cpu.fielddescrof(SIMPLE, 'value')
- simple_vtable = lltype.malloc(OBJECT_VTABLE, immortal=True)
- usize = cpu.sizeof(U, True)
+ usize = cpu.sizeof(U, u_vtable)
onedescr = cpu.fielddescrof(U, 'one')
FUNC = lltype.FuncType([lltype.Signed], lltype.Signed)
@@ -349,7 +352,7 @@
jit_virtual_ref_vtable = vrefinfo.jit_virtual_ref_vtable
jvr_vtable_adr = llmemory.cast_ptr_to_adr(jit_virtual_ref_vtable)
- vref_descr = cpu.sizeof(vrefinfo.JIT_VIRTUAL_REF, False)
+ vref_descr = cpu.sizeof(vrefinfo.JIT_VIRTUAL_REF, None)
namespace = locals()
More information about the pypy-commit
mailing list