[pypy-commit] pypy default: Remove the deprecated (and not working) feature llop.call_at_startup,
arigo
pypy.commits at gmail.com
Wed Feb 1 02:47:51 EST 2017
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r89864:6fdd39fa2ae8
Date: 2017-02-01 08:47 +0100
http://bitbucket.org/pypy/pypy/changeset/6fdd39fa2ae8/
Log: Remove the deprecated (and not working) feature
llop.call_at_startup, which I forgot in the rpython-hash branch. Fix
test.
diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -539,7 +539,6 @@
'decode_arg_def': LLOp(canraise=(Exception,)),
'getslice': LLOp(canraise=(Exception,)),
'check_and_clear_exc': LLOp(),
- 'call_at_startup': LLOp(canrun=True),
'threadlocalref_addr': LLOp(), # get (or make) addr of tl
'threadlocalref_get': LLOp(sideeffects=False), # read field (no check)
diff --git a/rpython/rtyper/lltypesystem/opimpl.py b/rpython/rtyper/lltypesystem/opimpl.py
--- a/rpython/rtyper/lltypesystem/opimpl.py
+++ b/rpython/rtyper/lltypesystem/opimpl.py
@@ -742,9 +742,6 @@
def op_gc_move_out_of_nursery(obj):
return obj
-def op_call_at_startup(init_func):
- pass # do nothing
-
# ____________________________________________________________
def get_op_impl(opname):
diff --git a/rpython/translator/c/database.py b/rpython/translator/c/database.py
--- a/rpython/translator/c/database.py
+++ b/rpython/translator/c/database.py
@@ -60,7 +60,6 @@
self.completed = False
self.instrument_ncounter = 0
- self.call_at_startup = set()
def gettypedefnode(self, T, varlength=None):
if varlength is None:
diff --git a/rpython/translator/c/funcgen.py b/rpython/translator/c/funcgen.py
--- a/rpython/translator/c/funcgen.py
+++ b/rpython/translator/c/funcgen.py
@@ -941,18 +941,3 @@
cdecl(typename, ''),
self.expr(op.args[0]),
self.expr(op.result))
-
- def OP_CALL_AT_STARTUP(self, op):
- c = op.args[0]
- if not isinstance(c, Constant):
- # Bah, maybe it comes from a same_as(const) just before...
- # Can occur if running without backendopts
- for op1 in self._current_block.operations:
- if op1.result is op.args[0]:
- assert op1.opname == "same_as"
- c = op1.args[0]
- break
- assert isinstance(c, Constant)
- func = self.expr(c)
- self.db.call_at_startup.add(func)
- return '/* call_at_startup %s */' % (func,)
diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py
--- a/rpython/translator/c/test/test_standalone.py
+++ b/rpython/translator/c/test/test_standalone.py
@@ -1063,23 +1063,39 @@
assert out.strip() == expected
def test_call_at_startup(self):
- from rpython.rtyper.lltypesystem import lltype
- from rpython.rtyper.lltypesystem.lloperation import llop
- from rpython.rtyper.annlowlevel import llhelper
+ from rpython.rtyper.extregistry import ExtRegistryEntry
+
class State:
seen = 0
state = State()
def startup():
state.seen += 1
- F = lltype.Ptr(lltype.FuncType([], lltype.Void))
+ def enablestartup():
+ "NOT_RPYTHON"
def entry_point(argv):
state.seen += 100
assert state.seen == 101
print 'ok'
- ll = llhelper(F, startup)
- llop.call_at_startup(lltype.Void, ll)
+ enablestartup()
return 0
+ class Entry(ExtRegistryEntry):
+ _about_ = enablestartup
+
+ def compute_result_annotation(self):
+ bk = self.bookkeeper
+ s_callable = bk.immutablevalue(startup)
+ key = (enablestartup,)
+ bk.emulate_pbc_call(key, s_callable, [])
+
+ def specialize_call(self, hop):
+ hop.exception_cannot_occur()
+ bk = hop.rtyper.annotator.bookkeeper
+ s_callable = bk.immutablevalue(startup)
+ r_callable = hop.rtyper.getrepr(s_callable)
+ ll_init = r_callable.get_unique_llfn().value
+ bk.annotator.translator._call_at_startup.append(ll_init)
+
t, cbuilder = self.compile(entry_point)
out = cbuilder.cmdexec('')
assert out.strip() == 'ok'
More information about the pypy-commit
mailing list