aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'rpython/translator')
-rw-r--r--rpython/translator/c/funcgen.py6
-rw-r--r--rpython/translator/c/node.py8
-rw-r--r--rpython/translator/sandbox/test/test_sandbox.py15
3 files changed, 27 insertions, 2 deletions
diff --git a/rpython/translator/c/funcgen.py b/rpython/translator/c/funcgen.py
index dc13fcdc10..1015118990 100644
--- a/rpython/translator/c/funcgen.py
+++ b/rpython/translator/c/funcgen.py
@@ -842,6 +842,12 @@ class FunctionCodeGenerator(object):
def OP_JIT_FFI_SAVE_RESULT(self, op):
return '/* JIT_FFI_SAVE_RESULT %s */' % op
+ def OP_JIT_ENTER_PORTAL_FRAME(self, op):
+ return '/* JIT_ENTER_PORTAL_FRAME %s */' % op
+
+ def OP_JIT_LEAVE_PORTAL_FRAME(self, op):
+ return '/* JIT_LEAVE_PORTAL_FRAME %s */' % op
+
def OP_GET_GROUP_MEMBER(self, op):
typename = self.db.gettype(op.result.concretetype)
return '%s = (%s)_OP_GET_GROUP_MEMBER(%s, %s);' % (
diff --git a/rpython/translator/c/node.py b/rpython/translator/c/node.py
index c8bd2a2f05..dd604b86e3 100644
--- a/rpython/translator/c/node.py
+++ b/rpython/translator/c/node.py
@@ -546,7 +546,7 @@ class StructNode(ContainerNode):
if needs_gcheader(T):
gct = self.db.gctransformer
if gct is not None:
- self.gc_init = gct.gcheader_initdata(self)
+ self.gc_init = gct.gcheader_initdata(self.obj)
db.getcontainernode(self.gc_init)
else:
self.gc_init = None
@@ -677,7 +677,7 @@ class ArrayNode(ContainerNode):
if needs_gcheader(T):
gct = self.db.gctransformer
if gct is not None:
- self.gc_init = gct.gcheader_initdata(self)
+ self.gc_init = gct.gcheader_initdata(self.obj)
db.getcontainernode(self.gc_init)
else:
self.gc_init = None
@@ -913,6 +913,7 @@ class ExternalFuncNode(FuncNodeBase):
return []
def new_funcnode(db, T, obj, forcename=None):
+ from rpython.rtyper.rtyper import llinterp_backend
if db.sandbox:
if (getattr(obj, 'external', None) is not None and
not obj._safe_not_sandboxed):
@@ -934,6 +935,9 @@ def new_funcnode(db, T, obj, forcename=None):
return ExternalFuncNode(db, T, obj, name)
elif hasattr(obj._callable, "c_name"):
return ExternalFuncNode(db, T, obj, name) # this case should only be used for entrypoints
+ elif db.translator.rtyper.backend is llinterp_backend:
+ # on llinterp, anything goes
+ return ExternalFuncNode(db, T, obj, name)
else:
raise ValueError("don't know how to generate code for %r" % (obj,))
diff --git a/rpython/translator/sandbox/test/test_sandbox.py b/rpython/translator/sandbox/test/test_sandbox.py
index 58e70667d8..ed46da595f 100644
--- a/rpython/translator/sandbox/test/test_sandbox.py
+++ b/rpython/translator/sandbox/test/test_sandbox.py
@@ -292,6 +292,21 @@ def test_unsafe_mmap():
rescode = pipe.wait()
assert rescode == 0
+def test_environ_items():
+ def entry_point(argv):
+ print os.environ.items()
+ return 0
+
+ exe = compile(entry_point)
+ g, f = run_in_subprocess(exe)
+ expect(f, g, "ll_os.ll_os_envitems", (), [])
+ expect(f, g, "ll_os.ll_os_write", (1, "[]\n"), 3)
+ g.close()
+ tail = f.read()
+ f.close()
+ assert tail == ""
+
+
class TestPrintedResults:
def run(self, entry_point, args, expected):