Author: Tim Felgentreff <timfelgentr...@gmail.com> Branch: Changeset: r142:189f3b3f83e5 Date: 2013-03-08 10:16 +0100 http://bitbucket.org/pypy/lang-smalltalk/changeset/189f3b3f83e5/
Log: Merge default diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -1,3 +1,7 @@ syntax: glob *.py[co] *~ +pypy-c-jit-62116-b027d4428675-linux +images/Squeak* +targetimageloadingsmalltalk-c +images/package-cache diff --git a/images/minitest.image b/images/minitest.image index 5753d32adc6e5ca83c6b7bf990258090ca1812d7..11fbf4e52f946020cefb4e771afc7a950f001596 GIT binary patch [cut] diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py --- a/spyvm/interpreter.py +++ b/spyvm/interpreter.py @@ -33,7 +33,7 @@ get_printable_location=get_printable_location ) - def __init__(self, space, image=None, image_name="", max_stack_depth=500): + def __init__(self, space, image=None, image_name="", max_stack_depth=100): self.space = space self.image = image self.image_name = image_name @@ -72,10 +72,17 @@ s_new_context.push(nlr.value) def c_loop(self, s_context): + # padding = ' ' * (self.max_stack_depth - self.remaining_stack_depth) + # print padding + s_context.short_str() + old_pc = 0 while True: pc = s_context._pc method = s_context.s_method() - + if pc < old_pc: + self.jit_driver.can_enter_jit( + pc=pc, self=self, method=method, + s_context=s_context) + old_pc = pc self.jit_driver.jit_merge_point( pc=pc, self=self, method=method, s_context=s_context) diff --git a/spyvm/shadow.py b/spyvm/shadow.py --- a/spyvm/shadow.py +++ b/spyvm/shadow.py @@ -532,6 +532,7 @@ self._temps_and_stack[ptr] = w_v self._stack_ptr = ptr + 1 + @jit.unroll_safe def push_all(self, lst): for elt in lst: self.push(elt) @@ -690,6 +691,10 @@ # A blockcontext doesn't have any temps return 0 + def short_str(self): + return 'BlockContext of %s (%i)' % (self.w_method().get_identifier_string(), + self.pc() + 1) + class MethodContextShadow(ContextPartShadow): _attr_ = ['w_closure_or_nil', '_w_receiver', '__w_method'] @@ -836,6 +841,10 @@ retval += "\nStack : " + str(self.stack()) return retval + def short_str(self): + block = '[] of' if self.is_closure_context() else '' + return '%s %s (%i)' % (block, self.w_method().get_identifier_string(), self.pc() + 1) + class CompiledMethodShadow(object): _immutable_fields_ = ["_w_self", "bytecode", "literals[*]", "bytecodeoffset", diff --git a/spyvm/test/jit.py b/spyvm/test/jit.py --- a/spyvm/test/jit.py +++ b/spyvm/test/jit.py @@ -4,7 +4,7 @@ # view jit. # -import sys +import sys, os from rpython import conftest class o: view = False @@ -15,8 +15,9 @@ from spyvm import model, interpreter, primitives, shadow -from spyvm import objspace +from spyvm import objspace, squeakimage from spyvm.tool.analyseimage import create_squeakimage, create_testimage +from rpython.rlib.streamio import open_file_as_stream mockclass = objspace.bootstrap_class @@ -46,7 +47,7 @@ # Tests # -# sys.setrecursionlimit(100000) +sys.setrecursionlimit(5000) class TestLLtype(LLJitMixin): @@ -54,19 +55,12 @@ from spyvm import objspace space = objspace.ObjSpace() + image = create_testimage(space) interp = interpreter.Interpreter(space, image) - - - counter = 0 - - w_selector = interp.perform(space.wrap_string("loopTest"), "asSymbol") - w_object = model.W_SmallInteger(0) - s_class = w_object.shadow_of_my_class(space) - s_method = s_class.lookup(w_selector) - s_frame = s_method.create_frame(space, w_object, []) - + w_selector = interp.perform(space.wrap_string('loopTest'), "asSymbol") + assert isinstance(w_selector, model.W_BytesObject) def interp_w(): - interp.loop(s_frame.w_self()) + interp.perform(model.W_SmallInteger(1000), w_selector) self.meta_interp(interp_w, [], listcomp=True, listops=True, backendopt=True, inline=True) diff --git a/targetimageloadingsmalltalk.py b/targetimageloadingsmalltalk.py --- a/targetimageloadingsmalltalk.py +++ b/targetimageloadingsmalltalk.py @@ -11,10 +11,12 @@ def _run_benchmark(interp, number, benchmark): w_object = model.W_SmallInteger(number) try: - interp.perform(w_object, benchmark) + w_result = interp.perform(w_object, benchmark) except interpreter.ReturnFromTopLevel, e: w_result = e.object + if w_result: assert isinstance(w_result, model.W_BytesObject) + print '\n' print w_result.as_string() return 0 return -1 _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit