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 9fc5b63b authored by Stefan Marr's avatar Stefan Marr
Browse files

Refactored and hopefully completed startup procedure of interpreter

Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent 1cc2298c
...@@ -71,6 +71,18 @@ class Universe(object): ...@@ -71,6 +71,18 @@ class Universe(object):
def metaclassClass(self): def metaclassClass(self):
return self._metaclassClass return self._metaclassClass
def execute_method(self, class_name, selector):
clazz = self.load_class(self.symbol_for(class_name))
# Lookup the invokable on class
invokable = clazz.get_class().lookup_invokable(self.symbol_for(selector))
bootstrap_method = self._create_bootstrap_method()
bootstrap_frame = self._create_bootstrap_frame(bootstrap_method, clazz)
return self.start(bootstrap_frame, invokable)
def _create_bootstrap_method(self): def _create_bootstrap_method(self):
# Create a fake bootstrap method to simplify later frame traversal # Create a fake bootstrap method to simplify later frame traversal
...@@ -80,14 +92,44 @@ class Universe(object): ...@@ -80,14 +92,44 @@ class Universe(object):
bootstrap_method.set_maximum_number_of_stack_elements(self.new_integer(2)) bootstrap_method.set_maximum_number_of_stack_elements(self.new_integer(2))
bootstrap_method.set_holder(self._systemClass) bootstrap_method.set_holder(self._systemClass)
def _create_bootstrap_frame(self, bootstrap_method, receiver, arguments = None):
# Create a fake bootstrap frame with the system object on the stack
bootstrap_frame = self._interpreter.push_new_frame(bootstrap_method)
if arguments:
# Convert the arguments into an array
arguments_array = self.new_array_from_list(arguments)
def interpret(self, arguments): def interpret(self, arguments):
# Check for command line switches # Check for command line switches
arguments = self.handle_arguments(arguments) arguments = self.handle_arguments(arguments)
# Initialize the known universe # Initialize the known universe
self.initialize(arguments) system_object = self._initialize_object_system()
bootstrap_method = self._create_bootstrap_method()
# Start the shell if no filename is given
if len(arguments) == 0:
shell = Shell(self, self._interpreter)
bootstrap_frame = self._create_bootstrap_frame(bootstrap_method, system_object, arguments)
# Lookup the initialize invokable on the system class
initialize = self._systemClass.lookup_invokable(self.symbol_for("initialize:"))
self.start(bootstrap_frame, initialize)
def start(self, bootstrap_frame, invokable):
# Invoke the initialize invokable
invokable.invoke(bootstrap_frame, self._interpreter)
self.start() # Start the interpreter
return self._interpreter.start()
def handle_arguments(self, arguments): def handle_arguments(self, arguments):
got_classpath = False got_classpath = False
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