aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-01-19 20:31:41 +0100
committerCarl Friedrich Bolz-Tereick <cfbolz@gmx.de>2021-01-19 20:31:41 +0100
commit5a0702978ca5585514de296fe4b721db1418594e (patch)
treef4664d14528ce9eba307e2e489d98a460f676b0e /rpython
parentsome more tests for specialized classes (diff)
parentfix a bug in the heapcache around nonstandard virtualizables (it doesn't occur (diff)
downloadpypy-5a0702978ca5585514de296fe4b721db1418594e.tar.gz
pypy-5a0702978ca5585514de296fe4b721db1418594e.tar.bz2
pypy-5a0702978ca5585514de296fe4b721db1418594e.zip
merge default
Diffstat (limited to 'rpython')
-rw-r--r--rpython/doc/conf.py6
-rw-r--r--rpython/jit/metainterp/heapcache.py4
-rw-r--r--rpython/jit/metainterp/pyjitpl.py4
-rw-r--r--rpython/jit/metainterp/test/test_heapcache.py24
-rw-r--r--rpython/rlib/rdtoa.py4
-rw-r--r--rpython/rtyper/lltypesystem/rffi.py7
6 files changed, 33 insertions, 16 deletions
diff --git a/rpython/doc/conf.py b/rpython/doc/conf.py
index c8c845e0cb..9216d2a41e 100644
--- a/rpython/doc/conf.py
+++ b/rpython/doc/conf.py
@@ -73,16 +73,16 @@ master_doc = 'index'
# General information about the project.
project = u'RPython'
-copyright = u'2016, The PyPy Project'
+copyright = u'2021, The PyPy Project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-version = '4.0'
+version = '7.3'
# The full version, including alpha/beta/rc tags.
-release = '4.0.0'
+release = '7.3.3'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/rpython/jit/metainterp/heapcache.py b/rpython/jit/metainterp/heapcache.py
index e63b268beb..80a6be7c50 100644
--- a/rpython/jit/metainterp/heapcache.py
+++ b/rpython/jit/metainterp/heapcache.py
@@ -437,10 +437,12 @@ class HeapCache(object):
return
self._set_flag(box, HF_KNOWN_NULLITY)
- def is_nonstandard_virtualizable(self, box):
+ def is_known_nonstandard_virtualizable(self, box):
return self._check_flag(box, HF_NONSTD_VABLE) or self._check_flag(box, HF_SEEN_ALLOCATION)
def nonstandard_virtualizables_now_known(self, box):
+ if isinstance(box, Const):
+ return
self._set_flag(box, HF_NONSTD_VABLE)
def is_unescaped(self, box):
diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
index eb402805a3..ead579c98f 100644
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -917,7 +917,7 @@ class MIFrame(object):
def _nonstandard_virtualizable(self, pc, box, fielddescr):
# returns True if 'box' is actually not the "standard" virtualizable
# that is stored in metainterp.virtualizable_boxes[-1]
- if self.metainterp.heapcache.is_nonstandard_virtualizable(box):
+ if self.metainterp.heapcache.is_known_nonstandard_virtualizable(box):
self.metainterp.staticdata.profiler.count_ops(rop.PTR_EQ, Counters.HEAPCACHED_OPS)
return True
if box is self.metainterp.forced_virtualizable:
@@ -1833,7 +1833,7 @@ class MIFrame(object):
standard_box = self.metainterp.virtualizable_boxes[-1]
if standard_box is vref_box:
return vref_box
- if self.metainterp.heapcache.is_nonstandard_virtualizable(vref_box):
+ if self.metainterp.heapcache.is_known_nonstandard_virtualizable(vref_box):
self.metainterp.staticdata.profiler.count_ops(rop.PTR_EQ, Counters.HEAPCACHED_OPS)
return None
eqbox = self.metainterp.execute_and_record(rop.PTR_EQ, None, vref_box, standard_box)
diff --git a/rpython/jit/metainterp/test/test_heapcache.py b/rpython/jit/metainterp/test/test_heapcache.py
index c6cd32d6d1..344c7baf4f 100644
--- a/rpython/jit/metainterp/test/test_heapcache.py
+++ b/rpython/jit/metainterp/test/test_heapcache.py
@@ -103,25 +103,33 @@ class TestHeapCache(object):
h = HeapCache()
box1 = RefFrontendOp(1)
box2 = RefFrontendOp(2)
- assert not h.is_nonstandard_virtualizable(box1)
- assert not h.is_nonstandard_virtualizable(box2)
+ assert not h.is_known_nonstandard_virtualizable(box1)
+ assert not h.is_known_nonstandard_virtualizable(box2)
h.nonstandard_virtualizables_now_known(box1)
- assert h.is_nonstandard_virtualizable(box1)
- assert not h.is_nonstandard_virtualizable(box2)
+ assert h.is_known_nonstandard_virtualizable(box1)
+ assert not h.is_known_nonstandard_virtualizable(box2)
h.reset()
- assert not h.is_nonstandard_virtualizable(box1)
- assert not h.is_nonstandard_virtualizable(box2)
+ assert not h.is_known_nonstandard_virtualizable(box1)
+ assert not h.is_known_nonstandard_virtualizable(box2)
+
+ def test_nonstandard_virtualizable_const(self):
+ h = HeapCache()
+ # rare but not impossible situation for some interpreters: we have a
+ # *constant* nonstandard virtualizable
+ c_box = ConstPtr(ConstPtr.value)
+ h.nonstandard_virtualizables_now_known(c_box) # should not crash
+ assert not h.is_known_nonstandard_virtualizable(c_box)
def test_nonstandard_virtualizable_allocation(self):
h = HeapCache()
box1 = RefFrontendOp(1)
h.new(box1)
# we've seen the allocation, so it's not the virtualizable
- assert h.is_nonstandard_virtualizable(box1)
+ assert h.is_known_nonstandard_virtualizable(box1)
h.reset()
- assert not h.is_nonstandard_virtualizable(box1)
+ assert not h.is_known_nonstandard_virtualizable(box1)
def test_heapcache_fields(self):
h = HeapCache()
diff --git a/rpython/rlib/rdtoa.py b/rpython/rlib/rdtoa.py
index cf88a26ffb..9f83a01ced 100644
--- a/rpython/rlib/rdtoa.py
+++ b/rpython/rlib/rdtoa.py
@@ -39,7 +39,7 @@ eci = ExternalCompilationInfo(
_INT_LIMIT = 0x7ffff000
dg_strtod = rffi.llexternal(
- '_PyPy_dg_strtod', [rffi.CCHARP, rffi.CCHARPP], rffi.DOUBLE,
+ '_PyPy_dg_strtod', [rffi.CONST_CCHARP, rffi.CCHARPP], rffi.DOUBLE,
compilation_info=eci, sandboxsafe=True)
dg_dtoa = rffi.llexternal(
@@ -62,7 +62,7 @@ def strtod(input):
# break some tests because this function is used by the GC
ll_input, llobj, flag = rffi.get_nonmovingbuffer_ll_final_null(input)
try:
- result = dg_strtod(ll_input, end_ptr)
+ result = dg_strtod(rffi.cast(rffi.CONST_CCHARP, ll_input), end_ptr)
endpos = (rffi.cast(lltype.Signed, end_ptr[0]) -
rffi.cast(lltype.Signed, ll_input))
diff --git a/rpython/rtyper/lltypesystem/rffi.py b/rpython/rtyper/lltypesystem/rffi.py
index 59d977c3ee..8196f19dff 100644
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -1049,6 +1049,13 @@ def constcharpsize2str(cp, size):
return charpsize2str(cp, size)
constcharpsize2str._annenforceargs_ = [lltype.SomePtr(CONST_CCHARP), int]
+def str2constcharp(s):
+ """
+ Like str2charp, but returns a CONST_CCHARP instead
+ """
+ cp = str2charp(s)
+ return cast(CONST_CCHARP, cp)
+str2constcharp._annenforceargs_ = [str]
@not_rpython
def _deprecated_get_nonmovingbuffer(*args):