Commit 279f216d authored by Stefan Marr's avatar Stefan Marr

Only expose signature and holder to SOM language level

The other elements such as number of locals, maximum number of stack elements, and number of method fields are not available on all SOM VMs.

These information should be made available by a VM-specific mirror object.
Signed-off-by: 's avatarStefan Marr <git@stefan-marr.de>
parent b2d20680
......@@ -7,11 +7,9 @@ from som.interpreter.bytecodes import bytecode_length
class Method(Array):
# Static field indices and number of method fields
NUMBER_OF_LOCALS_INDEX = 1 + Array.CLASS_INDEX
MAXIMUM_NUMBER_OF_STACK_ELEMENTS_INDEX = 1 + NUMBER_OF_LOCALS_INDEX
SIGNATURE_INDEX = 1 + MAXIMUM_NUMBER_OF_STACK_ELEMENTS_INDEX
HOLDER_INDEX = 1 + SIGNATURE_INDEX
NUMBER_OF_METHOD_FIELDS = 1 + HOLDER_INDEX
SIGNATURE_INDEX = 1 + Array.CLASS_INDEX
HOLDER_INDEX = 1 + SIGNATURE_INDEX
NUMBER_OF_METHOD_FIELDS = 1 + HOLDER_INDEX
def __init__(self, nilObject):
......@@ -26,6 +24,9 @@ class Method(Array):
self._bytecodes = None
self._inline_cache_class = None
self._inline_cache_invokable = None
self._number_of_locals = -1
self._maximum_number_of_stack_elements = -1
def is_primitive(self):
return False
......@@ -38,19 +39,19 @@ class Method(Array):
def get_number_of_locals(self):
# Get the number of locals (converted to a Java integer)
return self.get_field(self.NUMBER_OF_LOCALS_INDEX)
return self._number_of_locals
def set_number_of_locals(self, value):
# Set the number of locals
self.set_field(self.NUMBER_OF_LOCALS_INDEX, value)
self._number_of_locals = value
def get_maximum_number_of_stack_elements(self):
# Get the maximum number of stack elements
return self.get_field(self.MAXIMUM_NUMBER_OF_STACK_ELEMENTS_INDEX)
return self._maximum_number_of_stack_elements
def set_maximum_number_of_stack_elements(self, value):
# Set the maximum number of stack elements
self.set_field(self.MAXIMUM_NUMBER_OF_STACK_ELEMENTS_INDEX, value)
self._maximum_number_of_stack_elements = value
def get_signature(self):
# Get the signature of this method by reading the field with signature
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment