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.6% of users enabled 2FA.

Commit 3610d639 authored by Stefan Marr's avatar Stefan Marr
Browse files

In Frame: previous_frame, context, and method are now proper fields and not instance fields anymore



Decouples language from implementation, and gives JITs etc more grip on the implementation.
Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent e82e23f2
Subproject commit 52ca605afc001e0f774871d027550ff2491422c3
Subproject commit 692cfb135a04b47a2393cbae7c7b72f4d8c0869e
from som.primitives.primitives import Primitives
from som.vmobjects.primitive import Primitive
def _method(ivkbl, frame, interpreter):
rcvr = frame.pop()
frame.push(rcvr.get_method())
def _previous_frame(ivkbl, frame, interpreter):
rcvr = frame.pop()
frame.push(rcvr.get_previous_frame())
class FramePrimitives(Primitives):
def install_primitives(self):
self._install_instance_primitive(Primitive("method",
self._universe, _method))
self._install_instance_primitive(Primitive("previousFrame",
self._universe, _previous_frame))
\ No newline at end of file
......@@ -14,48 +14,37 @@ from som.vmobjects.array import Array
class Frame(Array):
# Static field indices and number of frame fields
PREVIOUS_FRAME_INDEX = Array.NUMBER_OF_OBJECT_FIELDS
CONTEXT_INDEX = 1 + PREVIOUS_FRAME_INDEX
METHOD_INDEX = 1 + CONTEXT_INDEX
NUMBER_OF_FRAME_FIELDS = 1 + METHOD_INDEX
NUMBER_OF_FRAME_FIELDS = Array.NUMBER_OF_OBJECT_FIELDS
def __init__(self, nilObject, num_elements, method, context, previous_frame):
Array.__init__(self, nilObject, num_elements)
self._stack_pointer = 0
self._bytecode_index = 0
self._local_offset = 0
self._set_method(method)
self._set_context(context)
self._set_previous_frame(previous_frame if previous_frame else nilObject)
self._method = method
self._context = context
self._previous_frame = previous_frame if previous_frame else nilObject
def get_previous_frame(self):
# Get the previous frame by reading the field with previous frame index
return self.get_field(self.PREVIOUS_FRAME_INDEX)
def _set_previous_frame(self, value):
# Set the previous frame by writing to the field with previous frame index
self.set_field(self.PREVIOUS_FRAME_INDEX, value)
return self._previous_frame
def clear_previous_frame(self, nilObject):
# Set the previous frame to nil
self.set_field(self.PREVIOUS_FRAME_INDEX, nilObject)
self._previous_frame = nilObject
def has_previous_frame(self, nilObject):
return self.get_field(self.PREVIOUS_FRAME_INDEX) != nilObject
return self._previous_frame != nilObject
def is_bootstrap_frame(self, nilObject):
return not self.has_previous_frame(nilObject)
def get_context(self):
# Get the context by reading the field with context index
return self.get_field(self.CONTEXT_INDEX)
def _set_context(self, value):
# Set the context by writing to the field with context index
self.set_field(self.CONTEXT_INDEX, value)
return self._context
def has_context(self, nilObject):
return self.get_field(self.CONTEXT_INDEX) != nilObject
return self._context != nilObject
def _get_context(self, level):
# Get the context frame at the given level
......@@ -85,11 +74,7 @@ class Frame(Array):
def get_method(self):
# Get the method by reading the field with method index
return self.get_field(self.METHOD_INDEX)
def _set_method(self, value):
# Set the method by writing to the field with method index
self.set_field(self.METHOD_INDEX, value)
return self._method
def _get_default_number_of_fields(self):
# Return the default number of fields in a frame
......
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