[pypy-commit] lang-smalltalk storage-context-state-v3: Calling stack_frame from loop()
anton_gulenko
noreply at buildbot.pypy.org
Mon Jul 28 10:11:30 CEST 2014
Author: Anton Gulenko <anton.gulenko at googlemail.com>
Branch: storage-context-state-v3
Changeset: r993:da722243ee58
Date: 2014-07-26 23:38 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/da722243ee58/
Log: Calling stack_frame from loop()
diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -98,7 +98,7 @@
while True:
s_sender = s_new_context.s_sender()
try:
- self.loop_bytecodes(s_new_context)
+ self.stack_frame(s_new_context, None)
raise Exception("loop_bytecodes left without raising...")
except ContextSwitchException, e:
if self.is_tracing() or self.trace_important:
@@ -114,6 +114,23 @@
s_new_context = s_sender
s_new_context.push(nlr.value)
+ # This is a wrapper around loop_bytecodes that cleanly enters/leaves the frame
+ # and handles the stack overflow protection mechanism.
+ def stack_frame(self, s_frame, s_sender, may_context_switch=True):
+ try:
+ if self.is_tracing():
+ self.stack_depth += 1
+ if s_frame._s_sender is None and s_sender is not None:
+ s_frame.store_s_sender(s_sender, raise_error=False)
+ # Now (continue to) execute the context bytecodes
+ self.loop_bytecodes(s_frame, may_context_switch)
+ except rstackovf.StackOverflow:
+ rstackovf.check_stack_overflow()
+ raise StackOverflow(s_frame)
+ finally:
+ if self.is_tracing():
+ self.stack_depth -= 1
+
def loop_bytecodes(self, s_context, may_context_switch=True):
old_pc = 0
if not jit.we_are_jitted() and may_context_switch:
@@ -145,23 +162,6 @@
s_context._activate_unwind_context(self)
raise nlr
- # This is a wrapper around loop_bytecodes that cleanly enters/leaves the frame
- # and handles the stack overflow protection mechanism.
- def stack_frame(self, s_frame, s_sender, may_context_switch=True):
- try:
- if self.is_tracing():
- self.stack_depth += 1
- if s_frame._s_sender is None and s_sender is not None:
- s_frame.store_s_sender(s_sender, raise_error=False)
- # Now (continue to) execute the context bytecodes
- self.loop_bytecodes(s_frame, may_context_switch)
- except rstackovf.StackOverflow:
- rstackovf.check_stack_overflow()
- raise StackOverflow(s_frame)
- finally:
- if self.is_tracing():
- self.stack_depth -= 1
-
def step(self, context):
bytecode = context.fetch_next_bytecode()
for entry in UNROLLING_BYTECODE_RANGES:
More information about the pypy-commit
mailing list