Commits

Tobias Pape  committed f0ea960 Merge

merge default

  • Participants
  • Parent commits ee25b9f, 0f7c194

Comments (0)

Files changed (6)

File spyvm/interpreter.py

 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
     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)
 
             (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"),

File spyvm/objspace.py

         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):

File spyvm/targettinybenchsmalltalk.py

 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
 
 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, [])

File spyvm/test/jit.py

 
 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
         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)

File spyvm/test/test_interpreter.py

     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"])

File spyvm/todo.txt

 
 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