[pypy-commit] pypy optresult: fixes
fijal
noreply at buildbot.pypy.org
Mon Jun 15 13:09:07 CEST 2015
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: optresult
Changeset: r78112:efd889daffae
Date: 2015-06-15 13:07 +0200
http://bitbucket.org/pypy/pypy/changeset/efd889daffae/
Log: fixes
diff --git a/rpython/jit/backend/llsupport/descr.py b/rpython/jit/backend/llsupport/descr.py
--- a/rpython/jit/backend/llsupport/descr.py
+++ b/rpython/jit/backend/llsupport/descr.py
@@ -72,6 +72,7 @@
def get_size_descr(gccache, STRUCT, vtable):
cache = gccache._cache_size
+ assert not isinstance(vtable, bool)
try:
return cache[STRUCT]
except KeyError:
@@ -197,7 +198,7 @@
cachedict = cache.setdefault(STRUCT, {})
cachedict[fieldname] = fielddescr
fielddescr.parent_descr = get_size_descr(gccache, STRUCT,
- heaptracker.get_vtable_for_gcstruct(STRUCT))
+ heaptracker.get_vtable_for_gcstruct(gccache, STRUCT))
return fielddescr
def get_type_flag(TYPE):
diff --git a/rpython/jit/codewriter/heaptracker.py b/rpython/jit/codewriter/heaptracker.py
--- a/rpython/jit/codewriter/heaptracker.py
+++ b/rpython/jit/codewriter/heaptracker.py
@@ -60,10 +60,14 @@
# xxx hack: from a GcStruct representing an instance's
# lowleveltype, return the corresponding vtable pointer.
# Returns None if the GcStruct does not belong to an instance.
- assert isinstance(GCSTRUCT, lltype.GcStruct)
+ if not isinstance(GCSTRUCT, lltype.GcStruct):
+ return None
if not has_gcstruct_a_vtable(GCSTRUCT):
return None
setup_cache_gcstruct2vtable(gccache)
+ if not hasattr(gccache, '_cache_gcstruct2vtable'):
+ # boehm and stuff
+ return lltype.malloc(GCSTRUCT.typeptr.TO, flavor='raw', immortal=True)
return gccache._cache_gcstruct2vtable[GCSTRUCT]
def setup_cache_gcstruct2vtable(gccache):
@@ -89,7 +93,7 @@
def register_known_gctype(cpu, vtable, STRUCT):
# register the correspondance 'vtable' <-> 'STRUCT' in the cpu
- sizedescr = cpu.sizeof(STRUCT, has_gcstruct_a_vtable(STRUCT))
+ sizedescr = cpu.sizeof(STRUCT, vtable)
assert sizedescr.as_vtable_size_descr() is sizedescr
if getattr(sizedescr, '_corresponding_vtable', None):
assert sizedescr._corresponding_vtable == vtable
diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py
--- a/rpython/jit/codewriter/jtransform.py
+++ b/rpython/jit/codewriter/jtransform.py
@@ -1601,7 +1601,7 @@
descrs = (self.cpu.arraydescrof(ARRAY),
self.cpu.fielddescrof(LIST, 'length'),
self.cpu.fielddescrof(LIST, 'items'),
- self.cpu.sizeof(LIST, False))
+ self.cpu.sizeof(LIST, None))
else:
prefix = 'do_fixed_'
if self._array_of_voids(LIST):
diff --git a/rpython/jit/metainterp/optimizeopt/TODO b/rpython/jit/metainterp/optimizeopt/TODO
--- a/rpython/jit/metainterp/optimizeopt/TODO
+++ b/rpython/jit/metainterp/optimizeopt/TODO
@@ -1,3 +1,5 @@
* arraylen_gc is not handling length bound optimization at all (we need to
wait till unrolling for tests)
* mark_opaque_pointer is ignored (which is fine until unrolling)
+* clean up and unify _corresponding_vtable and vtable fields on SizeDescr
+ and check if all the usecases are necessary
\ No newline at end of file
diff --git a/rpython/jit/metainterp/virtualref.py b/rpython/jit/metainterp/virtualref.py
--- a/rpython/jit/metainterp/virtualref.py
+++ b/rpython/jit/metainterp/virtualref.py
@@ -20,6 +20,9 @@
self.jit_virtual_ref_vtable = lltype.malloc(rclass.OBJECT_VTABLE,
zero=True, flavor='raw',
immortal=True)
+ if hasattr(self.cpu, 'gc_ll_descr'):
+ heaptracker.setup_cache_gcstruct2vtable(self.cpu.gc_ll_descr)
+ self.cpu.gc_ll_descr._cache_gcstruct2vtable[self.JIT_VIRTUAL_REF] = self.jit_virtual_ref_vtable
self.descr = self.cpu.sizeof(self.JIT_VIRTUAL_REF,
vtable=self.jit_virtual_ref_vtable)
self.jit_virtual_ref_vtable.name = rclass.alloc_array_name(
@@ -29,9 +32,6 @@
adr = heaptracker.adr2int(adr)
self.jit_virtual_ref_const_class = history.ConstInt(adr)
fielddescrof = self.cpu.fielddescrof
- if hasattr(self.cpu, 'gc_ll_descr'):
- heaptracker.setup_cache_gcstruct2vtable(self.cpu.gc_ll_descr)
- self.cpu.gc_ll_descr._cache_gcstruct2vtable[self.JIT_VIRTUAL_REF] = self.jit_virtual_ref_vtable
self.descr_virtual_token = fielddescrof(self.JIT_VIRTUAL_REF,
'virtual_token')
self.descr_forced = fielddescrof(self.JIT_VIRTUAL_REF, 'forced')
More information about the pypy-commit
mailing list