WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 23f54217 authored by Carl Friedrich Bolz's avatar Carl Friedrich Bolz
Browse files

don't store _local_offset

retrieving it from the method is fine
parent cd7e32db
......@@ -23,7 +23,6 @@ class Frame(Array):
Array.__init__(self, nilObject, num_elements)
self._stack_pointer = 0
self._bytecode_index = 0
self._local_offset = 0
self._method = method
self._context = context
self._previous_frame = previous_frame if previous_frame else nilObject
......@@ -78,6 +77,9 @@ class Frame(Array):
# Get the method by reading the field with method index
return self._method
def get_number_of_arguments(self):
return self.get_method().get_number_of_arguments()
def _get_default_number_of_fields(self):
# Return the default number of fields in a frame
return self.NUMBER_OF_FRAME_FIELDS
......@@ -104,10 +106,9 @@ class Frame(Array):
def reset_stack_pointer(self):
# arguments are stored in front of local variables
self._local_offset = self.get_method().get_number_of_arguments()
# Set the stack pointer to its initial value thereby clearing the stack
self.set_stack_pointer(self._local_offset +
self.set_stack_pointer(self.get_number_of_arguments() +
self.get_method().get_number_of_locals().get_embedded_integer() - 1)
def get_bytecode_index(self):
......@@ -129,10 +130,10 @@ class Frame(Array):
self.set_indexable_field(self.get_stack_pointer() - index, value)
def _get_local(self, index):
return self.get_indexable_field(self._local_offset + index)
return self.get_indexable_field(self.get_number_of_arguments() + index)
def _set_local(self, index, value):
self.set_indexable_field(self._local_offset + index, value)
self.set_indexable_field(self.get_number_of_arguments() + index, value)
def get_local(self, index, context_level):
# Get the local with the given index in the given context
......
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