[pypy-commit] lang-smalltalk storage: Moved the step-method inside the interpreter like a regular method.
anton_gulenko
noreply at buildbot.pypy.org
Wed May 14 14:51:02 CEST 2014
Author: Anton Gulenko <anton.gulenko at googlemail.com>
Branch: storage
Changeset: r816:5654d57f2f04
Date: 2014-05-12 13:04 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/5654d57f2f04/
Log: Moved the step-method inside the interpreter like a regular method.
diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -126,7 +126,20 @@
self.loop_bytecodes(s_new_frame, may_context_switch)
finally:
self.remaining_stack_depth += 1
-
+
+ def step(self, context):
+ bytecode = context.fetch_next_bytecode()
+ for entry in UNROLLING_BYTECODE_RANGES:
+ if len(entry) == 2:
+ bc, methname = entry
+ if bytecode == bc:
+ return getattr(context, methname)(self, bytecode)
+ else:
+ start, stop, methname = entry
+ if start <= bytecode <= stop:
+ return getattr(context, methname)(self, bytecode)
+ assert 0, "unreachable"
+
# ============== Methods for handling user interrupts ==============
def jitted_check_for_interrupt(self, s_frame):
@@ -820,6 +833,8 @@
(208, 255, "sendLiteralSelectorBytecode"),
]
+from rpython.rlib.unroll import unrolling_iterable
+UNROLLING_BYTECODE_RANGES = unrolling_iterable(BYTECODE_RANGES)
def initialize_bytecode_names():
result = [None] * 256
@@ -849,23 +864,6 @@
# this table is only used for creating named bytecodes in tests and printing
BYTECODE_TABLE = initialize_bytecode_table()
-from rpython.rlib.unroll import unrolling_iterable
-unrolling_ranges = unrolling_iterable(BYTECODE_RANGES)
-def bytecode_step_translated(self, context):
- bytecode = context.fetch_next_bytecode()
- for entry in unrolling_ranges:
- if len(entry) == 2:
- bc, methname = entry
- if bytecode == bc:
- return getattr(context, methname)(self, bytecode)
- else:
- start, stop, methname = entry
- if start <= bytecode <= stop:
- return getattr(context, methname)(self, bytecode)
- assert 0, "unreachable"
-
-Interpreter.step = bytecode_step_translated
-
# Smalltalk debugging facilities, patching Interpreter and ContextPartShadow
# in order to enable tracing/jumping for message sends etc.
def debugging():
More information about the pypy-commit
mailing list