Author: Tobias Pape <tob...@netshed.de> Branch: Changeset: r35:f0ea960b893b Date: 2013-02-18 15:06 +0100 http://bitbucket.org/pypy/lang-smalltalk/changeset/f0ea960b893b/
Log: merge default diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py --- a/spyvm/interpreter.py +++ b/spyvm/interpreter.py @@ -1,9 +1,7 @@ import py from spyvm.shadow import ContextPartShadow, MethodContextShadow, BlockContextShadow -from spyvm import model, constants, primitives -from spyvm.shadow import ContextPartShadow -from spyvm import conftest -from spyvm import wrapper +from spyvm import model, constants, primitives, conftest, wrapper +from spyvm.tool.bitmanipulation import splitter from rpython.rlib import jit from rpython.rlib import objectmodel, unroll @@ -370,9 +368,41 @@ def popStackBytecode(self, interp): self.pop() + # closure bytecodes + def pushNewArrayPopIntoArray(self, interp): + popIntoArray, arraySize = splitter[1, 7](self.getbytecode()) + newArray = None + #if popIntoArray == 1: + # newArray = interp.space.wrap_list(self.pop_and_return_n(arraySize)) + #else: + # newArray = interp.space.w_Array.as_class_get_shadow(interp.space).new(arraySize) + self.push(newArray) + raise MissingBytecode("not yet implemented: pushNewArray") + def experimentalBytecode(self, interp): raise MissingBytecode("experimentalBytecode") + def pushTempAtInTempVectorAt(self, interp): + k = self.getbytecode() + j = self.getbytecode() + raise MissingBytecode("not yet implemented: pushTempAt k inTempVectorAt j") + + def storeTempAtInTempVectorAt(self, interp): + k = self.getbytecode() + j = self.getbytecode() + raise MissingBytecode("not yet implemented: storeTempAt k inTempVectorAt j") + + def popAndStoreTempAtInTempVectorAt(self, interp): + k = self.getbytecode() + j = self.getbytecode() + raise MissingBytecode("not yet implemented: popAndstoreTempAt k inTempVectorAt j") + + def pushClosureNumCopiedNumArgsBlockSize(self, interp): + l, k = splitter[4, 4](self.getbytecode()) + j = self.getbytecode() + i = self.getbytecode() + raise MissingBytecode("not yet implemented: pushClosureNumCopied l numArgs k blockSize ij") + def jump(self,offset): self.store_pc(self.pc() + offset) @@ -505,7 +535,12 @@ (135, "popStackBytecode"), (136, "duplicateTopBytecode"), (137, "pushActiveContextBytecode"), - (138, 143, "experimentalBytecode"), + (138, "pushNewArrayPopIntoArray"), + (139, "experimentalBytecode"), + (140, "pushTempAtInTempVectorAt"), + (141, "storeTempAtInTempVectorAt"), + (142, "popAndStoreTempAtInTempVectorAt"), + (143, "pushClosureNumCopiedNumArgsBlockSize"), (144, 151, "shortUnconditionalJump"), (152, 159, "shortConditionalJump"), (160, 167, "longUnconditionalJump"), diff --git a/spyvm/objspace.py b/spyvm/objspace.py --- a/spyvm/objspace.py +++ b/spyvm/objspace.py @@ -205,9 +205,9 @@ a wrapped smalltalk array """ lstlen = len(lst_w) - res = self.w_Array.as_class_get_shadow().new(lstlen) + res = self.w_Array.as_class_get_shadow(self).new(lstlen) for i in range(lstlen): - res.storevarpointer(i, lit[i]) + res.storevarpointer(i, lst_w[i]) return res def unwrap_int(self, w_value): diff --git a/spyvm/targettinybenchsmalltalk.py b/spyvm/targettinybenchsmalltalk.py --- a/spyvm/targettinybenchsmalltalk.py +++ b/spyvm/targettinybenchsmalltalk.py @@ -1,6 +1,6 @@ import os, sys from spyvm import model, interpreter, primitives, shadow, constants -from spyvm.tool.analyseimage import create_squeakimage +from spyvm.tool.analyseimage import create_squeakimage, create_testimage from rpython.jit.codewriter.policy import JitPolicy @@ -19,13 +19,13 @@ def tinyBenchmarks(): from spyvm import objspace space = objspace.ObjSpace() - image = create_squeakimage(space) + image = create_testimage(space) interp = interpreter.Interpreter(space) w_object = model.W_SmallInteger(0) s_class = w_object.shadow_of_my_class(space) - w_method = s_class.lookup("tinyBenchmarks") + w_method = s_class.lookup("loopTest") assert w_method w_frame = w_method.create_frame(space, w_object, []) diff --git a/spyvm/test/jit.py b/spyvm/test/jit.py --- a/spyvm/test/jit.py +++ b/spyvm/test/jit.py @@ -16,7 +16,7 @@ from spyvm import model, interpreter, primitives, shadow from spyvm import objspace -from spyvm.tool.analyseimage import create_testimage +from spyvm.tool.analyseimage import create_squeakimage, create_testimage mockclass = objspace.bootstrap_class @@ -77,5 +77,4 @@ def interp_w(): interp.interpret() - self.meta_interp(interp_w, [], listcomp=True, listops=True, backendopt=True) - + self.meta_interp(interp_w, [], listcomp=True, listops=True, backendopt=True) \ No newline at end of file diff --git a/spyvm/test/test_interpreter.py b/spyvm/test/test_interpreter.py --- a/spyvm/test/test_interpreter.py +++ b/spyvm/test/test_interpreter.py @@ -829,3 +829,14 @@ test_storeAndPopReceiverVariableBytecode() test_bc_objectAtAndAtPut() option.bc_trace = bc_trace + +# Closure Bytecodes +def test_bc_pushNewArrayPopIntoArray(bytecode=pushNewArrayPopIntoArray): + py.test.skip("Fails, since pushNewArrayPopIntoArray is not yet implemented") + interp = new_interpreter(bytecode + chr(0x83)) + context = interp.s_active_context() + context.push(fakeliterals("egg")) + context.push(fakeliterals("bar")) + context.push(fakeliterals("baz")) + interp.step(interp.s_active_context()) + assert context.pop() == fakeliterals(["egg", "bar", "baz"]) \ No newline at end of file diff --git a/spyvm/todo.txt b/spyvm/todo.txt --- a/spyvm/todo.txt +++ b/spyvm/todo.txt @@ -21,3 +21,7 @@ Shadows: [ ] Fix invalidation of methoddictshadow when the w_self of its values array changes + +Lars ToDo +[ ] Tests for the new bytecodes. +[ ] Guess method names for JIT debugging, e.g. changing MethodDictShadow _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit