Commit 5d001264 authored by Stefan Marr's avatar Stefan Marr

Sync whitespace in primitives

Signed-off-by: 's avatarStefan Marr <git@stefan-marr.de>
parent 4a9f0d81
...@@ -5,17 +5,20 @@ def _at(ivkbl, frame, interpreter): ...@@ -5,17 +5,20 @@ def _at(ivkbl, frame, interpreter):
i = frame.pop() i = frame.pop()
rcvr = frame.pop() rcvr = frame.pop()
frame.push(rcvr.get_indexable_field(i.get_embedded_integer() - 1)) frame.push(rcvr.get_indexable_field(i.get_embedded_integer() - 1))
def _atPut(ivkbl, frame, interpreter): def _atPut(ivkbl, frame, interpreter):
value = frame.pop() value = frame.pop()
index = frame.pop() index = frame.pop()
rcvr = frame.get_stack_element(0) rcvr = frame.get_stack_element(0)
rcvr.set_indexable_field(index.get_embedded_integer() - 1, value) rcvr.set_indexable_field(index.get_embedded_integer() - 1, value)
def _length(ivkbl, frame, interpreter): def _length(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(interpreter.get_universe().new_integer(rcvr.get_number_of_indexable_fields())) frame.push(interpreter.get_universe().new_integer(rcvr.get_number_of_indexable_fields()))
def _new(ivkbl, frame, interpreter): def _new(ivkbl, frame, interpreter):
length = frame.pop() length = frame.pop()
frame.pop() # not required frame.pop() # not required
......
...@@ -8,11 +8,13 @@ def _asString(ivkbl, frame, interpreter): ...@@ -8,11 +8,13 @@ def _asString(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(interpreter.get_universe().new_string(str(rcvr.get_embedded_biginteger()))) frame.push(interpreter.get_universe().new_string(str(rcvr.get_embedded_biginteger())))
def _sqrt(ivkbl, frame, interpreter): def _sqrt(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(interpreter.get_universe().new_double( frame.push(interpreter.get_universe().new_double(
math.sqrt(rcvr.get_embedded_biginteger()))) math.sqrt(rcvr.get_embedded_biginteger())))
def _plus(ivkbl, frame, interpreter): def _plus(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -24,6 +26,7 @@ def _plus(ivkbl, frame, interpreter): ...@@ -24,6 +26,7 @@ def _plus(ivkbl, frame, interpreter):
else: else:
frame.push(interpreter.get_universe().new_biginteger(result)) frame.push(interpreter.get_universe().new_biginteger(result))
def _minus(ivkbl, frame, interpreter): def _minus(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -35,6 +38,7 @@ def _minus(ivkbl, frame, interpreter): ...@@ -35,6 +38,7 @@ def _minus(ivkbl, frame, interpreter):
else: else:
frame.push(interpreter.get_universe().new_biginteger(result)) frame.push(interpreter.get_universe().new_biginteger(result))
def _mult(ivkbl, frame, interpreter): def _mult(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -46,6 +50,7 @@ def _mult(ivkbl, frame, interpreter): ...@@ -46,6 +50,7 @@ def _mult(ivkbl, frame, interpreter):
else: else:
frame.push(interpreter.get_universe().new_biginteger(result)) frame.push(interpreter.get_universe().new_biginteger(result))
def _div(ivkbl, frame, interpreter): def _div(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -57,6 +62,7 @@ def _div(ivkbl, frame, interpreter): ...@@ -57,6 +62,7 @@ def _div(ivkbl, frame, interpreter):
else: else:
frame.push(interpreter.get_universe().new_biginteger(result)) frame.push(interpreter.get_universe().new_biginteger(result))
def _mod(ivkbl, frame, interpreter): def _mod(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -71,6 +77,7 @@ def _and(ivkbl, frame, interpreter): ...@@ -71,6 +77,7 @@ def _and(ivkbl, frame, interpreter):
# Do operation: # Do operation:
frame.push(interpreter.get_universe().new_biginteger(left.get_embedded_biginteger() & right_obj.get_embedded_value())) frame.push(interpreter.get_universe().new_biginteger(left.get_embedded_biginteger() & right_obj.get_embedded_value()))
def _equals(ivkbl, frame, interpreter): def _equals(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -81,6 +88,7 @@ def _equals(ivkbl, frame, interpreter): ...@@ -81,6 +88,7 @@ def _equals(ivkbl, frame, interpreter):
else: else:
frame.push(interpreter.get_universe().falseObject) frame.push(interpreter.get_universe().falseObject)
def _lessThan(ivkbl, frame, interpreter): def _lessThan(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
......
...@@ -23,8 +23,6 @@ jitdriver = jit.JitDriver( ...@@ -23,8 +23,6 @@ jitdriver = jit.JitDriver(
get_printable_location=get_printable_location) get_printable_location=get_printable_location)
def _execute_block(frame, block, block_method, interpreter, universe): def _execute_block(frame, block, block_method, interpreter, universe):
b = universe.new_block(block_method, block.get_context()) b = universe.new_block(block_method, block.get_context())
frame.push(b) frame.push(b)
...@@ -32,6 +30,7 @@ def _execute_block(frame, block, block_method, interpreter, universe): ...@@ -32,6 +30,7 @@ def _execute_block(frame, block, block_method, interpreter, universe):
block_evaluate(b, interpreter, frame) block_evaluate(b, interpreter, frame)
return frame.pop() return frame.pop()
def _whileLoop(frame, interpreter, while_type): def _whileLoop(frame, interpreter, while_type):
loop_body = frame.pop() loop_body = frame.pop()
loop_condition = frame.pop() loop_condition = frame.pop()
...@@ -55,9 +54,11 @@ def _whileLoop(frame, interpreter, while_type): ...@@ -55,9 +54,11 @@ def _whileLoop(frame, interpreter, while_type):
frame.push(universe.nilObject) frame.push(universe.nilObject)
def _whileFalse(ivkbl, frame, interpreter): def _whileFalse(ivkbl, frame, interpreter):
_whileLoop(frame, interpreter, interpreter.get_universe().falseObject) _whileLoop(frame, interpreter, interpreter.get_universe().falseObject)
def _whileTrue(ivkbl, frame, interpreter): def _whileTrue(ivkbl, frame, interpreter):
_whileLoop(frame, interpreter, interpreter.get_universe().trueObject) _whileLoop(frame, interpreter, interpreter.get_universe().trueObject)
......
from som.primitives.primitives import Primitives from som.primitives.primitives import Primitives
from som.vmobjects.primitive import Primitive from som.vmobjects.primitive import Primitive
def _new(ivkbl, frame, interpreter): def _new(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(interpreter.get_universe().new_instance(rcvr)) frame.push(interpreter.get_universe().new_instance(rcvr))
def _name(ivkbl, frame, interpreter): def _name(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(rcvr.get_name()) frame.push(rcvr.get_name())
def _super_class(ivkbl, frame, interpreter): def _super_class(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(rcvr.get_super_class()) frame.push(rcvr.get_super_class())
def _methods(ivkbl, frame, interpreter): def _methods(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(rcvr.get_instance_invokables()) frame.push(rcvr.get_instance_invokables())
def _fields(ivkbl, frame, interpreter): def _fields(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(rcvr.get_instance_fields()) frame.push(rcvr.get_instance_fields())
......
...@@ -8,6 +8,7 @@ from som.vmobjects.integer import Integer ...@@ -8,6 +8,7 @@ from som.vmobjects.integer import Integer
import math import math
def _coerce_to_double(obj, universe): def _coerce_to_double(obj, universe):
if isinstance(obj, Double): if isinstance(obj, Double):
return obj return obj
...@@ -15,39 +16,47 @@ def _coerce_to_double(obj, universe): ...@@ -15,39 +16,47 @@ def _coerce_to_double(obj, universe):
return universe.new_double(float(obj.get_embedded_integer())) return universe.new_double(float(obj.get_embedded_integer()))
raise ValueError("Cannot coerce %s to Double!" % obj) raise ValueError("Cannot coerce %s to Double!" % obj)
def _asString(ivkbl, frame, interpreter): def _asString(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
d = rcvr.get_embedded_double() d = rcvr.get_embedded_double()
s = formatd(d, "g", DTSF_STR_PRECISION, DTSF_ADD_DOT_0) s = formatd(d, "g", DTSF_STR_PRECISION, DTSF_ADD_DOT_0)
frame.push(interpreter.get_universe().new_string(s)) frame.push(interpreter.get_universe().new_string(s))
def _sqrt(ivkbl, frame, interpreter): def _sqrt(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(interpreter.get_universe().new_double(math.sqrt(rcvr.get_embedded_double()))) frame.push(interpreter.get_universe().new_double(math.sqrt(rcvr.get_embedded_double())))
def _plus(ivkbl, frame, interpreter): def _plus(ivkbl, frame, interpreter):
op1 = _coerce_to_double(frame.pop(), interpreter.get_universe()) op1 = _coerce_to_double(frame.pop(), interpreter.get_universe())
op2 = frame.pop() op2 = frame.pop()
frame.push(interpreter.get_universe().new_double(op1.get_embedded_double() frame.push(interpreter.get_universe().new_double(op1.get_embedded_double()
+ op2.get_embedded_double())) + op2.get_embedded_double()))
def _minus(ivkbl, frame, interpreter): def _minus(ivkbl, frame, interpreter):
op1 = _coerce_to_double(frame.pop(), interpreter.get_universe()) op1 = _coerce_to_double(frame.pop(), interpreter.get_universe())
op2 = frame.pop() op2 = frame.pop()
frame.push(interpreter.get_universe().new_double(op2.get_embedded_double() frame.push(interpreter.get_universe().new_double(op2.get_embedded_double()
- op1.get_embedded_double())) - op1.get_embedded_double()))
def _mult(ivkbl, frame, interpreter): def _mult(ivkbl, frame, interpreter):
op1 = _coerce_to_double(frame.pop(), interpreter.get_universe()) op1 = _coerce_to_double(frame.pop(), interpreter.get_universe())
op2 = frame.pop() op2 = frame.pop()
frame.push(interpreter.get_universe().new_double(op2.get_embedded_double() frame.push(interpreter.get_universe().new_double(op2.get_embedded_double()
* op1.get_embedded_double())) * op1.get_embedded_double()))
def _doubleDiv(ivkbl, frame, interpreter): def _doubleDiv(ivkbl, frame, interpreter):
op1 = _coerce_to_double(frame.pop(), interpreter.get_universe()) op1 = _coerce_to_double(frame.pop(), interpreter.get_universe())
op2 = frame.pop() op2 = frame.pop()
frame.push(interpreter.get_universe().new_double(op2.get_embedded_double() frame.push(interpreter.get_universe().new_double(op2.get_embedded_double()
/ op1.get_embedded_double())) / op1.get_embedded_double()))
def _mod(ivkbl, frame, interpreter): def _mod(ivkbl, frame, interpreter):
op1 = _coerce_to_double(frame.pop(), interpreter.get_universe()) op1 = _coerce_to_double(frame.pop(), interpreter.get_universe())
op2 = frame.pop() op2 = frame.pop()
...@@ -57,6 +66,7 @@ def _mod(ivkbl, frame, interpreter): ...@@ -57,6 +66,7 @@ def _mod(ivkbl, frame, interpreter):
r = math.fmod(o1, o2) r = math.fmod(o1, o2)
frame.push(interpreter.get_universe().new_double(r)) frame.push(interpreter.get_universe().new_double(r))
def _equals(ivkbl, frame, interpreter): def _equals(ivkbl, frame, interpreter):
op1 = _coerce_to_double(frame.pop(), interpreter.get_universe()) op1 = _coerce_to_double(frame.pop(), interpreter.get_universe())
op2 = frame.pop() op2 = frame.pop()
...@@ -65,6 +75,7 @@ def _equals(ivkbl, frame, interpreter): ...@@ -65,6 +75,7 @@ def _equals(ivkbl, frame, interpreter):
else: else:
frame.push(interpreter.get_universe().falseObject) frame.push(interpreter.get_universe().falseObject)
def _lessThan(ivkbl, frame, interpreter): def _lessThan(ivkbl, frame, interpreter):
op1 = _coerce_to_double(frame.pop(), interpreter.get_universe()) op1 = _coerce_to_double(frame.pop(), interpreter.get_universe())
op2 = frame.pop() op2 = frame.pop()
...@@ -73,6 +84,7 @@ def _lessThan(ivkbl, frame, interpreter): ...@@ -73,6 +84,7 @@ def _lessThan(ivkbl, frame, interpreter):
else: else:
frame.push(interpreter.get_universe().falseObject) frame.push(interpreter.get_universe().falseObject)
def _and(ivkbl, frame, interpreter): def _and(ivkbl, frame, interpreter):
op1 = _coerce_to_double(frame.pop(), interpreter.get_universe()) op1 = _coerce_to_double(frame.pop(), interpreter.get_universe())
op2 = frame.pop() op2 = frame.pop()
...@@ -82,6 +94,7 @@ def _and(ivkbl, frame, interpreter): ...@@ -82,6 +94,7 @@ def _and(ivkbl, frame, interpreter):
result = float(left & right) result = float(left & right)
frame.push(interpreter.get_universe().new_double(result)) frame.push(interpreter.get_universe().new_double(result))
def _bitXor(ivkbl, frame, interpreter): def _bitXor(ivkbl, frame, interpreter):
op1 = _coerce_to_double(frame.pop(), interpreter.get_universe()) op1 = _coerce_to_double(frame.pop(), interpreter.get_universe())
op2 = frame.pop() op2 = frame.pop()
...@@ -91,11 +104,13 @@ def _bitXor(ivkbl, frame, interpreter): ...@@ -91,11 +104,13 @@ def _bitXor(ivkbl, frame, interpreter):
result = float(left ^ right) result = float(left ^ right)
frame.push(interpreter.get_universe().new_double(result)) frame.push(interpreter.get_universe().new_double(result))
def _round(ivkbl, frame, interpreter): def _round(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
int_value = int(round_double(rcvr.get_embedded_double(), 0)) int_value = int(round_double(rcvr.get_embedded_double(), 0))
frame.push(interpreter.get_universe().new_integer(int_value)) frame.push(interpreter.get_universe().new_integer(int_value))
class DoublePrimitives(Primitives): class DoublePrimitives(Primitives):
def install_primitives(self): def install_primitives(self):
......
...@@ -8,6 +8,7 @@ from som.vmobjects.block import block_evaluate ...@@ -8,6 +8,7 @@ from som.vmobjects.block import block_evaluate
import math import math
def _push_long_result(frame, result, universe): def _push_long_result(frame, result, universe):
# Check with integer bounds and push: # Check with integer bounds and push:
if integer_value_fits(result): if integer_value_fits(result):
...@@ -15,20 +16,24 @@ def _push_long_result(frame, result, universe): ...@@ -15,20 +16,24 @@ def _push_long_result(frame, result, universe):
else: else:
frame.push(universe.new_biginteger(result)) frame.push(universe.new_biginteger(result))
def _resend_as_biginteger(frame, operator, left, right, universe): def _resend_as_biginteger(frame, operator, left, right, universe):
left_biginteger = universe.new_biginteger(left.get_embedded_integer()) left_biginteger = universe.new_biginteger(left.get_embedded_integer())
operands = [right] operands = [right]
left_biginteger.send(frame, operator, operands, universe, universe.get_interpreter()) left_biginteger.send(frame, operator, operands, universe, universe.get_interpreter())
def _resend_as_double(frame, operator, left, right, universe): def _resend_as_double(frame, operator, left, right, universe):
left_double = universe.new_double(left.get_embedded_integer()) left_double = universe.new_double(left.get_embedded_integer())
operands = [right] operands = [right]
left_double.send(frame, operator, operands, universe, universe.get_interpreter()) left_double.send(frame, operator, operands, universe, universe.get_interpreter())
def _asString(ivkbl, frame, interpreter): def _asString(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(interpreter.get_universe().new_string(str(rcvr.get_embedded_integer()))) frame.push(interpreter.get_universe().new_string(str(rcvr.get_embedded_integer())))
def _sqrt(ivkbl, frame, interpreter): def _sqrt(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
res = math.sqrt(rcvr.get_embedded_integer()) res = math.sqrt(rcvr.get_embedded_integer())
...@@ -37,11 +42,13 @@ def _sqrt(ivkbl, frame, interpreter): ...@@ -37,11 +42,13 @@ def _sqrt(ivkbl, frame, interpreter):
else: else:
frame.push(interpreter.get_universe().new_double(res)) frame.push(interpreter.get_universe().new_double(res))
def _atRandom(ivkbl, frame, interpreter): def _atRandom(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(interpreter.get_universe().new_integer(int( frame.push(interpreter.get_universe().new_integer(int(
rcvr.get_embedded_integer() * interpreter.get_universe().random.random()))) rcvr.get_embedded_integer() * interpreter.get_universe().random.random())))
def _plus(ivkbl, frame, interpreter): def _plus(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -58,6 +65,7 @@ def _plus(ivkbl, frame, interpreter): ...@@ -58,6 +65,7 @@ def _plus(ivkbl, frame, interpreter):
result = left.get_embedded_integer() + right.get_embedded_integer() result = left.get_embedded_integer() + right.get_embedded_integer()
_push_long_result(frame, result, interpreter.get_universe()) _push_long_result(frame, result, interpreter.get_universe())
def _minus(ivkbl, frame, interpreter): def _minus(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -74,6 +82,7 @@ def _minus(ivkbl, frame, interpreter): ...@@ -74,6 +82,7 @@ def _minus(ivkbl, frame, interpreter):
result = left.get_embedded_integer() - right.get_embedded_integer() result = left.get_embedded_integer() - right.get_embedded_integer()
_push_long_result(frame, result, interpreter.get_universe()) _push_long_result(frame, result, interpreter.get_universe())
def _mult(ivkbl, frame, interpreter): def _mult(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -90,6 +99,7 @@ def _mult(ivkbl, frame, interpreter): ...@@ -90,6 +99,7 @@ def _mult(ivkbl, frame, interpreter):
result = left.get_embedded_integer() * right.get_embedded_integer() result = left.get_embedded_integer() * right.get_embedded_integer()
_push_long_result(frame, result, interpreter.get_universe()) _push_long_result(frame, result, interpreter.get_universe())
def _doubleDiv(ivkbl, frame, interpreter): def _doubleDiv(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -106,6 +116,7 @@ def _doubleDiv(ivkbl, frame, interpreter): ...@@ -106,6 +116,7 @@ def _doubleDiv(ivkbl, frame, interpreter):
result = float(left.get_embedded_integer()) / float(right.get_embedded_integer()) result = float(left.get_embedded_integer()) / float(right.get_embedded_integer())
frame.push(interpreter.get_universe().new_double(result)) frame.push(interpreter.get_universe().new_double(result))
def _intDiv(ivkbl, frame, interpreter): def _intDiv(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -122,6 +133,7 @@ def _intDiv(ivkbl, frame, interpreter): ...@@ -122,6 +133,7 @@ def _intDiv(ivkbl, frame, interpreter):
result = left.get_embedded_integer() / right.get_embedded_integer() result = left.get_embedded_integer() / right.get_embedded_integer()
_push_long_result(frame, result, interpreter.get_universe()) _push_long_result(frame, result, interpreter.get_universe())
def _mod(ivkbl, frame, interpreter): def _mod(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -136,6 +148,7 @@ def _mod(ivkbl, frame, interpreter): ...@@ -136,6 +148,7 @@ def _mod(ivkbl, frame, interpreter):
# Do operation: # Do operation:
_push_long_result(frame, left.get_embedded_integer() % right_obj.get_embedded_integer(), interpreter.get_universe()) _push_long_result(frame, left.get_embedded_integer() % right_obj.get_embedded_integer(), interpreter.get_universe())
def _and(ivkbl, frame, interpreter): def _and(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -174,6 +187,7 @@ def _equals(ivkbl, frame, interpreter): ...@@ -174,6 +187,7 @@ def _equals(ivkbl, frame, interpreter):
else: else:
frame.push(interpreter.get_universe().falseObject) frame.push(interpreter.get_universe().falseObject)
def _lessThan(ivkbl, frame, interpreter): def _lessThan(ivkbl, frame, interpreter):
right_obj = frame.pop() right_obj = frame.pop()
left = frame.pop() left = frame.pop()
...@@ -190,6 +204,7 @@ def _lessThan(ivkbl, frame, interpreter): ...@@ -190,6 +204,7 @@ def _lessThan(ivkbl, frame, interpreter):
else: else:
frame.push(interpreter.get_universe().falseObject) frame.push(interpreter.get_universe().falseObject)
def _fromString(ivkbl, frame, interpreter): def _fromString(ivkbl, frame, interpreter):
param = frame.pop() param = frame.pop()
frame.pop() frame.pop()
...@@ -219,8 +234,10 @@ def _bitXor(ivkbl, frame, interpreter): ...@@ -219,8 +234,10 @@ def _bitXor(ivkbl, frame, interpreter):
frame.push(interpreter.get_universe().new_integer(result)) frame.push(interpreter.get_universe().new_integer(result))
from rpython.rlib import jit from rpython.rlib import jit
def get_printable_location(interpreter, block_method): def get_printable_location(interpreter, block_method):
from som.vmobjects.method import Method from som.vmobjects.method import Method
assert isinstance(block_method, Method) assert isinstance(block_method, Method)
......
from som.primitives.primitives import Primitives from som.primitives.primitives import Primitives
from som.vmobjects.primitive import Primitive from som.vmobjects.primitive import Primitive
def _holder(ivkbl, frame, interpreter): def _holder(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(rcvr.get_holder()) frame.push(rcvr.get_holder())
def _signature(ivkbl, frame, interpreter): def _signature(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(rcvr.get_signature()) frame.push(rcvr.get_signature())
......
...@@ -6,6 +6,7 @@ from som.vmobjects.object import Object ...@@ -6,6 +6,7 @@ from som.vmobjects.object import Object
from som.vmobjects.primitive import Primitive from som.vmobjects.primitive import Primitive
from som.vmobjects.array import Array from som.vmobjects.array import Array
def _equals(ivkbl, frame, interpreter): def _equals(ivkbl, frame, interpreter):
op1 = frame.pop() op1 = frame.pop()
op2 = frame.pop() op2 = frame.pop()
...@@ -14,11 +15,13 @@ def _equals(ivkbl, frame, interpreter): ...@@ -14,11 +15,13 @@ def _equals(ivkbl, frame, interpreter):
else: else:
frame.push(interpreter.get_universe().falseObject) frame.push(interpreter.get_universe().falseObject)
def _hashcode(ivkbl, frame, interpreter): def _hashcode(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
frame.push(interpreter.get_universe().new_integer( frame.push(interpreter.get_universe().new_integer(
compute_identity_hash(rcvr))) compute_identity_hash(rcvr)))
def _objectSize(ivkbl, frame, interpreter): def _objectSize(ivkbl, frame, interpreter):
rcvr = frame.pop() rcvr = frame.pop()
size = 0 size = 0
...@@ -30,6 +33,7 @@ def _objectSize(ivkbl, frame, interpreter): ...@@ -30,6 +33,7 @@ def _objectSize(ivkbl, frame, interpreter):
frame.push(interpreter.get_universe().new_integer(size)) frame.push(interpreter.get_universe().new_integer(size))
def _perform(ivkbl, frame, interpreter): def _perform(ivkbl, frame, interpreter):
selector = frame.pop() selector = frame.pop()
rcvr = frame.get_stack_element(0) rcvr = frame.get_stack_element(0)
...@@ -37,6 +41,7 @@ def _perform(ivkbl, frame, interpreter): ...@@ -37,6 +41,7 @@ def _perform(ivkbl, frame, interpreter):
invokable = rcvr.get_class(interpreter.get_universe()).lookup_invokable(selector) invokable = rcvr.get_class(interpreter.get_universe()).lookup_invokable(selector)
invokable.invoke(frame, interpreter) invokable.invoke(frame, interpreter)
def _performInSuperclass(ivkbl, frame, interpreter): def _performInSuperclass(ivkbl, frame, interpreter):
clazz = frame.pop() clazz = frame.pop()
selector = frame.pop() selector = frame.pop()
...@@ -45,6 +50,7 @@ def _performInSuperclass(ivkbl, frame, interpreter): ...@@ -45,6 +50,7 @@ def _performInSuperclass(ivkbl, frame, interpreter):
invokable = clazz.lookup_invokable(selector) invokable = clazz.lookup_invokable(selector)
invokable.invoke(frame, interpreter) invokable.invoke(frame, interpreter)
def _performWithArguments(ivkbl, frame, interpreter): def _performWithArguments(ivkbl, frame, interpreter):
args = frame.pop() args = frame.pop()
selector = frame.pop() selector = frame.pop()
...@@ -56,12 +62,14 @@ def _performWithArguments(ivkbl, frame, interpreter): ...@@ -56,12 +62,14 @@ def _performWithArguments(ivkbl, frame, interpreter):
invokable = rcvr.get_class(interpreter.get_universe()).lookup_invokable(selector) invokable = rcvr.get_class(interpreter.get_universe()).lookup_invokable(selector)
invokable.invoke(frame, interpreter) invokable.invoke(frame, interpreter)
def _instVarAt(ivkbl, frame, interpreter): def _instVarAt(ivkbl, frame, interpreter):
idx = frame.pop() idx = frame.pop()
rcvr = frame.pop() rcvr = frame.pop()
frame.push(rcvr.get_field(idx.get_embedded_integer() - 1)) frame.push(rcvr.get_field(idx.get_embedded_integer() - 1))
def _instVarAtPut(ivkbl, frame, interpreter): def _instVarAtPut(ivkbl, frame, interpreter):
val = frame.pop() val = frame.pop()
idx = frame.pop() idx = frame.pop()
...@@ -69,6 +77,7 @@ def _instVarAtPut(ivkbl, frame, interpreter): ...@@ -69,6 +77,7 @@ def _instVarAtPut(ivkbl, frame, interpreter):