Commit a3d1e509 by Stefan Marr

Adopting superficial changes from RTruffleSOM

Signed-off-by: Stefan Marr <git@stefan-marr.de>
1 parent 0c323fe0
......@@ -13,5 +13,7 @@ def _signature(ivkbl, frame, interpreter):
class MethodPrimitives(Primitives):
def install_primitives(self):
self._install_instance_primitive(Primitive("holder", self._universe, _holder))
self._install_instance_primitive(Primitive("signature", self._universe, _signature))
self._install_instance_primitive(Primitive("holder",
self._universe, _holder))
self._install_instance_primitive(Primitive("signature",
self._universe, _signature))
......@@ -14,5 +14,7 @@ def _signature(ivkbl, frame, interpreter):
class PrimitivePrimitives(Primitives):
def install_primitives(self):
self._install_instance_primitive(Primitive("holder", self._universe, _holder))
self._install_instance_primitive(Primitive("signature", self._universe, _signature))
self._install_instance_primitive(Primitive("holder",
self._universe, _holder))
self._install_instance_primitive(Primitive("signature",
self._universe, _signature))
......@@ -8,7 +8,7 @@ def _concat(ivkbl, frame, interpreter):
argument = frame.pop()
rcvr = frame.pop()
frame.push(interpreter.get_universe().new_string(rcvr.get_embedded_string()
+ argument.get_embedded_string()))
+ argument.get_embedded_string()))
def _asSymbol(ivkbl, frame, interpreter):
......
......@@ -10,4 +10,5 @@ def _asString(ivkbl, frame, interpreter):
class SymbolPrimitives(Primitives):
def install_primitives(self):
self._install_instance_primitive(Primitive("asString", self._universe, _asString))
self._install_instance_primitive(Primitive("asString", self._universe,
_asString))
......@@ -37,13 +37,13 @@ class Method(AbstractObject):
self._holder = None
def is_primitive(self):
@staticmethod
def is_primitive():
return False
def is_invokable(self):
"""In the RPython version, we use this method to identify methods
and primitives
"""
@staticmethod
def is_invokable():
""" We use this method to identify methods and primitives """
return True
def get_number_of_locals(self):
......@@ -114,7 +114,8 @@ class Method(AbstractObject):
raise e
def __str__(self):
return "Method(" + self.get_holder().get_name().get_string() + ">>" + str(self.get_signature()) + ")"
return ("Method(" + self.get_holder().get_name().get_string() + ">>" +
str(self.get_signature()) + ")")
def get_class(self, universe):
return universe.methodClass
......
from som.vmobjects.abstract_object import AbstractObject
class Primitive(AbstractObject):
_immutable_fields_ = ["_invoke", "_is_empty", "_signature", "_holder"]
......@@ -15,13 +16,13 @@ class Primitive(AbstractObject):
inv = self._invoke
inv(self, frame, interpreter)
def is_primitive(self):
@staticmethod
def is_primitive():
return True
def is_invokable(self):
"""In the RPython version, we use this method to identify methods
and primitives
"""
@staticmethod
def is_invokable():
""" We use this method to identify methods and primitives """
return True
def get_signature(self):
......@@ -52,4 +53,4 @@ def empty_primitive(signature_string, universe):
def _invoke(ivkbl, frame, interpreter):
""" Write a warning to the screen """
print "Warning: undefined primitive %s called" % ivkbl.get_signature().get_string()
print "Warning: undefined primitive %s called" % str(ivkbl.get_signature())
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!