Commit 0130fa97 authored by Stefan Marr's avatar Stefan Marr

Merge pull request #2 from cfbolz/master

enable the main loop jit driver again
parents fb770d20 e6acc57b
...@@ -147,24 +147,25 @@ class Interpreter(object): ...@@ -147,24 +147,25 @@ class Interpreter(object):
@jit.unroll_safe @jit.unroll_safe
def interpret(self, method, frame): def interpret(self, method, frame):
bc_idx = 0 current_bc_idx = 0
# Iterate through the bytecodes
while True: while True:
current_bc_idx = bc_idx # since methods cannot contain loops (all loops are done via primitives)
# profiling only needs to be done on pc = 0
# jitdriver.jit_merge_point(bytecode_index=current_bc_idx, if current_bc_idx == 0:
# interp=self, jitdriver.can_enter_jit(bytecode_index=current_bc_idx, interp=self, method=method, frame=frame)
# method=method, jitdriver.jit_merge_point(bytecode_index=current_bc_idx,
# frame=frame) interp=self,
method=method,
frame=frame)
bytecode = method.get_bytecode(current_bc_idx) bytecode = method.get_bytecode(current_bc_idx)
# Get the length of the current bytecode # Get the length of the current bytecode
bc_length = bytecode_length(bytecode) bc_length = bytecode_length(bytecode)
# Compute the next bytecode index # Compute the next bytecode index
bc_idx = current_bc_idx + bc_length next_bc_idx = current_bc_idx + bc_length
# Handle the current bytecode # Handle the current bytecode
if bytecode == Bytecodes.halt: # BC: 0 if bytecode == Bytecodes.halt: # BC: 0
...@@ -200,6 +201,8 @@ class Interpreter(object): ...@@ -200,6 +201,8 @@ class Interpreter(object):
elif bytecode == Bytecodes.return_non_local: # BC:15 elif bytecode == Bytecodes.return_non_local: # BC:15
return self._do_return_non_local(frame) return self._do_return_non_local(frame)
current_bc_idx = next_bc_idx
def new_frame(self, prev_frame, method, context): def new_frame(self, prev_frame, method, context):
return self._universe.new_frame(prev_frame, method, context) return self._universe.new_frame(prev_frame, method, context)
...@@ -248,7 +251,16 @@ jitdriver = jit.JitDriver( ...@@ -248,7 +251,16 @@ jitdriver = jit.JitDriver(
greens=['bytecode_index', 'interp', 'method'], greens=['bytecode_index', 'interp', 'method'],
reds=['frame'], reds=['frame'],
# virtualizables=['frame'], # virtualizables=['frame'],
get_printable_location=get_printable_location) get_printable_location=get_printable_location,
# the next line is a workaround around a likely bug in RPython
# for some reason, the inlining heuristics default to "never inline" when
# two different jit drivers are involved (in our case, the primitive
# driver, and this one).
# the next line says that calls involving this jitdriver should always be
# inlined once (which means that things like Integer>>< will be inlined
# into a while loop again, when enabling this drivers).
should_unroll_one_iteration = lambda bytecode_index, inter, method: True)
#reds=['tape']) #reds=['tape'])
def jitpolicy(driver): def jitpolicy(driver):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment