Author: Anton Gulenko <[email protected]>
Branch: storage
Changeset: r818:05fd9bfcba9c
Date: 2014-05-14 13:09 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/05fd9bfcba9c/
Log: Appended *Bytecode to some bytecode names for consistency.
diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -204,7 +204,7 @@
w_method = model.W_CompiledMethod(self.space, header=512)
w_method.literalatput0(self.space, 1, w_selector)
assert len(arguments_w) <= 7
- w_method.setbytes([chr(131), chr(len(arguments_w) << 5 + 0),
chr(124)]) #returnTopFromMethod
+ w_method.setbytes([chr(131), chr(len(arguments_w) << 5 + 0),
chr(124)]) #returnTopFromMethodBytecode
w_method.set_lookup_class_and_name(w_receiver.getclass(self.space),
"Interpreter.perform")
s_frame = MethodContextShadow(self.space, None, w_method, w_receiver,
[])
s_frame.push(w_receiver)
@@ -459,22 +459,22 @@
self.mark_returned()
raise nlr
- def returnReceiver(self, interp, current_bytecode):
+ def returnReceiverBytecode(self, interp, current_bytecode):
return self._return(self.w_receiver(), interp,
self.s_home().s_sender())
- def returnTrue(self, interp, current_bytecode):
+ def returnTrueBytecode(self, interp, current_bytecode):
return self._return(interp.space.w_true, interp,
self.s_home().s_sender())
- def returnFalse(self, interp, current_bytecode):
+ def returnFalseBytecode(self, interp, current_bytecode):
return self._return(interp.space.w_false, interp,
self.s_home().s_sender())
- def returnNil(self, interp, current_bytecode):
+ def returnNilBytecode(self, interp, current_bytecode):
return self._return(interp.space.w_nil, interp,
self.s_home().s_sender())
- def returnTopFromMethod(self, interp, current_bytecode):
+ def returnTopFromMethodBytecode(self, interp, current_bytecode):
return self._return(self.pop(), interp, self.s_home().s_sender())
- def returnTopFromBlock(self, interp, current_bytecode):
+ def returnTopFromBlockBytecode(self, interp, current_bytecode):
return self._return(self.pop(), interp, self.s_sender())
def unknownBytecode(self, interp, current_bytecode):
@@ -662,23 +662,23 @@
def shortJumpPosition(self, current_bytecode):
return (current_bytecode & 7) + 1
- def shortUnconditionalJump(self, interp, current_bytecode):
+ def shortUnconditionalJumpBytecode(self, interp, current_bytecode):
self.jump(self.shortJumpPosition(current_bytecode))
- def shortConditionalJump(self, interp, current_bytecode):
+ def shortConditionalJumpBytecode(self, interp, current_bytecode):
# The conditional jump is "jump on false"
self.jumpConditional(interp, False,
self.shortJumpPosition(current_bytecode))
- def longUnconditionalJump(self, interp, current_bytecode):
+ def longUnconditionalJumpBytecode(self, interp, current_bytecode):
self.jump((((current_bytecode & 7) - 4) << 8) +
self.fetch_next_bytecode())
def longJumpPosition(self, current_bytecode):
return ((current_bytecode & 3) << 8) + self.fetch_next_bytecode()
- def longJumpIfTrue(self, interp, current_bytecode):
+ def longJumpIfTrueBytecode(self, interp, current_bytecode):
self.jumpConditional(interp, True,
self.longJumpPosition(current_bytecode))
- def longJumpIfFalse(self, interp, current_bytecode):
+ def longJumpIfFalseBytecode(self, interp, current_bytecode):
self.jumpConditional(interp, False,
self.longJumpPosition(current_bytecode))
bytecodePrimAdd = make_call_primitive_bytecode(primitives.ADD, "+", 1)
@@ -769,12 +769,12 @@
(117, "pushConstantZeroBytecode"),
(118, "pushConstantOneBytecode"),
(119, "pushConstantTwoBytecode"),
- (120, "returnReceiver"),
- (121, "returnTrue"),
- (122, "returnFalse"),
- (123, "returnNil"),
- (124, "returnTopFromMethod"),
- (125, "returnTopFromBlock"),
+ (120, "returnReceiverBytecode"),
+ (121, "returnTrueBytecode"),
+ (122, "returnFalseBytecode"),
+ (123, "returnNilBytecode"),
+ (124, "returnTopFromMethodBytecode"),
+ (125, "returnTopFromBlockBytecode"),
(126, "unknownBytecode"),
(127, "unknownBytecode"),
(128, "extendedPushBytecode"),
@@ -793,11 +793,11 @@
(141, "storeRemoteTempLongBytecode"),
(142, "storeAndPopRemoteTempLongBytecode"),
(143, "pushClosureCopyCopiedValuesBytecode"),
- (144, 151, "shortUnconditionalJump"),
- (152, 159, "shortConditionalJump"),
- (160, 167, "longUnconditionalJump"),
- (168, 171, "longJumpIfTrue"),
- (172, 175, "longJumpIfFalse"),
+ (144, 151, "shortUnconditionalJumpBytecode"),
+ (152, 159, "shortConditionalJumpBytecode"),
+ (160, 167, "longUnconditionalJumpBytecode"),
+ (168, 171, "longJumpIfTrueBytecode"),
+ (172, 175, "longJumpIfFalseBytecode"),
(176, "bytecodePrimAdd"),
(177, "bytecodePrimSubtract"),
(178, "bytecodePrimLessThan"),
diff --git a/spyvm/test/jit.py b/spyvm/test/jit.py
--- a/spyvm/test/jit.py
+++ b/spyvm/test/jit.py
@@ -122,7 +122,7 @@
# ===== These entry-points pre-load the image and directly execute a
single frame.
# func = preload_perform(imagename, model.W_SmallInteger(1000),
'loopTest2')
# func = preload_perform(imagename, model.W_SmallInteger(777), 'name')
- # func = preload_execute_frame(imagename, [returnReceiver], [],
[model.W_SmallInteger(42)])
+ # func = preload_execute_frame(imagename,
[returnReceiverBytecodeBytecode], [], [model.W_SmallInteger(42)])
# ===== These execute the complete interpreter
# ===== XXX These do not work because loading the image file while
meta-interpreting always leads to
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
@@ -413,11 +413,11 @@
# w_object - the actual object we will be sending the method to
# bytecodes - the bytecode to be executed
def sendBytecodesTest(w_class, w_object, bytecodes):
- for bytecode, result in [ (returnReceiver, w_object),
- (returnTrue, space.w_true),
- (returnFalse, space.w_false),
- (returnNil, space.w_nil),
- (returnTopFromMethod, space.w_one) ]:
+ for bytecode, result in [ (returnReceiverBytecode, w_object),
+ (returnTrueBytecode, space.w_true),
+ (returnFalseBytecode, space.w_false),
+ (returnNilBytecode, space.w_nil),
+ (returnTopFromMethodBytecode, space.w_one) ]:
shadow = w_class.as_class_get_shadow(space)
w_method = model.W_CompiledMethod(space, 2)
w_method.bytes = pushConstantOneBytecode + bytecode
@@ -457,7 +457,7 @@
method.setliterals(literals)
shadow.installmethod(literals[0], method)
w_object = shadow.new()
- w_frame, s_frame = new_frame(sendLiteralSelectorBytecode(16) +
returnTopFromMethod)
+ w_frame, s_frame = new_frame(sendLiteralSelectorBytecode(16) +
returnTopFromMethodBytecode)
s_frame.w_method().setliterals(literals)
s_frame.push(w_object)
s_frame.push(space.wrap_int(8))
@@ -494,8 +494,8 @@
assert point.x() == 0
assert point.y() == 1
-def test_longJumpIfTrue():
- w_frame, s_frame = new_frame(longJumpIfTrue(0) + chr(15) +
longJumpIfTrue(0) + chr(15))
+def test_longJumpIfTrueBytecode():
+ w_frame, s_frame = new_frame(longJumpIfTrueBytecode(0) + chr(15) +
longJumpIfTrueBytecode(0) + chr(15))
s_frame.push(space.w_false)
pc = s_frame.pc() + 2
step_in_interp(s_frame)
@@ -505,9 +505,9 @@
step_in_interp(s_frame)
assert s_frame.pc() == pc + 15
-def test_longJumpIfFalse():
- w_frame, s_frame = new_frame(pushConstantTrueBytecode + longJumpIfFalse(0)
+ chr(15) +
- pushConstantFalseBytecode + longJumpIfFalse(0) +
chr(15))
+def test_longJumpIfFalseBytecode():
+ w_frame, s_frame = new_frame(pushConstantTrueBytecode +
longJumpIfFalseBytecode(0) + chr(15) +
+ pushConstantFalseBytecode +
longJumpIfFalseBytecode(0) + chr(15))
step_in_interp(s_frame)
pc = s_frame.pc() + 2
step_in_interp(s_frame)
@@ -517,21 +517,21 @@
step_in_interp(s_frame)
assert s_frame.pc() == pc + 15
-def test_longUnconditionalJump():
- w_frame, s_frame = new_frame(longUnconditionalJump(4) + chr(15))
+def test_longUnconditionalJumpBytecode():
+ w_frame, s_frame = new_frame(longUnconditionalJumpBytecode(4) + chr(15))
pc = s_frame.pc() + 2
step_in_interp(s_frame)
assert s_frame.pc() == pc + 15
-def test_shortUnconditionalJump():
+def test_shortUnconditionalJumpBytecode():
w_frame, s_frame = new_frame(chr(145))
pc = s_frame.pc() + 1
step_in_interp(s_frame)
assert s_frame.pc() == pc + 2
-def test_shortConditionalJump():
- w_frame, s_frame = new_frame(pushConstantTrueBytecode +
shortConditionalJump(3) +
- pushConstantFalseBytecode +
shortConditionalJump(3))
+def test_shortConditionalJumpBytecode():
+ w_frame, s_frame = new_frame(pushConstantTrueBytecode +
shortConditionalJumpBytecode(3) +
+ pushConstantFalseBytecode +
shortConditionalJumpBytecode(3))
step_in_interp(s_frame)
pc = s_frame.pc() + 1
step_in_interp(s_frame)
diff --git a/targetimageloadingsmalltalk.py b/targetimageloadingsmalltalk.py
--- a/targetimageloadingsmalltalk.py
+++ b/targetimageloadingsmalltalk.py
@@ -111,7 +111,7 @@
w_selector = interp.perform(space.wrap_string(benchmark), "asSymbol")
w_method = model.W_CompiledMethod(space, header=512)
w_method.literalatput0(space, 1, w_selector)
- w_method.setbytes([chr(131), chr(argcount << 5), chr(124)])
#returnTopFromMethod
+ w_method.setbytes([chr(131), chr(argcount << 5), chr(124)])
#returnTopFromMethodBytecodeBytecode
s_frame = shadow.MethodContextShadow(space, None, w_method, w_receiver, [])
s_frame.push(w_receiver)
if not stringarg == "":
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit