[pypy-commit] pypy faster-rstruct-2: hoorray! Implement the last bits of gc_store_indexed in llgraph and finally the test passes :)
antocuni
pypy.commits at gmail.com
Fri May 12 10:29:17 EDT 2017
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: faster-rstruct-2
Changeset: r91262:0b70e69aebec
Date: 2017-05-12 00:59 +0200
http://bitbucket.org/pypy/pypy/changeset/0b70e69aebec/
Log: hoorray! Implement the last bits of gc_store_indexed in llgraph and
finally the test passes :)
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
@@ -747,11 +747,21 @@
return llop.gc_load_indexed(longlong.FLOATSTORAGE,
struct, index, scale, base_ofs)
- def bh_gc_store_indexed_i(self, struct, index, scale, base_ofs, val, bytes):
+ def bh_gc_store_indexed_i(self, struct, index, scale, base_ofs, val, bytes,
+ descr):
T = self._get_int_type_from_size(bytes)
val = lltype.cast_primitive(T, val)
llop.gc_store_indexed(lltype.Void, struct, index, scale, base_ofs, val)
+ def bh_gc_store_indexed(self, struct, index, scale, base_ofs, val, bytes,
+ descr):
+ if descr.A.OF == lltype.Float:
+ XXX
+ self.bh_raw_store_f(struct, offset, newvalue, descr)
+ else:
+ self.bh_gc_store_indexed_i(struct, index, scale, base_ofs,
+ val, bytes, descr)
+
def bh_increment_debug_counter(self, addr):
p = rffi.cast(rffi.CArrayPtr(lltype.Signed), addr)
p[0] += 1
diff --git a/rpython/jit/metainterp/executor.py b/rpython/jit/metainterp/executor.py
--- a/rpython/jit/metainterp/executor.py
+++ b/rpython/jit/metainterp/executor.py
@@ -264,7 +264,8 @@
import pdb;pdb.set_trace()
else:
intval = valuebox.getint()
- cpu.bh_gc_store_indexed_i(addr, index, scale, base_ofs, intval, bytes)
+ cpu.bh_gc_store_indexed_i(addr, index, scale, base_ofs, intval, bytes,
+ arraydescr)
def exec_new_with_vtable(cpu, descr):
diff --git a/rpython/jit/metainterp/test/test_llop.py b/rpython/jit/metainterp/test/test_llop.py
--- a/rpython/jit/metainterp/test/test_llop.py
+++ b/rpython/jit/metainterp/test/test_llop.py
@@ -29,9 +29,12 @@
return longlong.int2singlefloat(res)
return res
- def newlist_and_gc_store(self, TYPE, value):
+ def newlist_and_gc_store(self, TYPE, value, expected):
def f(value):
- return newlist_and_gc_store(TYPE, value)
+ lst = newlist_and_gc_store(TYPE, value)
+ got = ''.join(lst)
+ assert got == expected
+ return len(got)
return self.interp_operations(f, [value], supports_singlefloats=True)
diff --git a/rpython/rtyper/test/test_llop.py b/rpython/rtyper/test/test_llop.py
--- a/rpython/rtyper/test/test_llop.py
+++ b/rpython/rtyper/test/test_llop.py
@@ -48,9 +48,7 @@
def test_gc_store_indexed(self):
expected = struct.pack('i', 0x12345678)
- lst = self.newlist_and_gc_store(rffi.INT, 0x12345678)
- buf = ''.join(lst)
- assert buf == expected
+ self.newlist_and_gc_store(rffi.INT, 0x12345678, expected)
class TestDirect(BaseLLOpTest):
@@ -58,8 +56,10 @@
def gc_load_from_string(self, TYPE, buf, offset):
return str_gc_load(TYPE, buf, offset)
- def newlist_and_gc_store(self, TYPE, value):
- return newlist_and_gc_store(TYPE, value)
+ def newlist_and_gc_store(self, TYPE, value, expected):
+ got = newlist_and_gc_store(TYPE, value)
+ got = ''.join(got)
+ assert got == expected
class TestRTyping(BaseLLOpTest, BaseRtypingTest):
@@ -68,8 +68,9 @@
return str_gc_load(TYPE, buf, offset)
return self.interpret(fn, [offset])
- def newlist_and_gc_store(self, TYPE, value):
+ def newlist_and_gc_store(self, TYPE, value, expected):
def fn(value):
return newlist_and_gc_store(TYPE, value)
ll_res = self.interpret(fn, [value])
- return list(ll_res.items)
+ got = ''.join(ll_res.items)
+ assert got == expected
diff --git a/rpython/translator/c/test/test_llop.py b/rpython/translator/c/test/test_llop.py
--- a/rpython/translator/c/test/test_llop.py
+++ b/rpython/translator/c/test/test_llop.py
@@ -26,7 +26,7 @@
x = fn(buf, offset)
return lltype.cast_primitive(TYPE, x)
- def newlist_and_gc_store(self, TYPE, value):
+ def newlist_and_gc_store(self, TYPE, value, expected):
if TYPE not in self.cache:
assert isinstance(TYPE, lltype.Primitive)
if TYPE in (lltype.Float, lltype.SingleFloat):
@@ -43,4 +43,5 @@
self.cache[TYPE] = fn
#
fn = self.cache[TYPE]
- return fn(value)
+ got = fn(value)
+ assert got == expected
More information about the pypy-commit
mailing list