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

Avoid pop when not necessary, but might keep objects alive, let them escape


Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent afdcafac
......@@ -69,9 +69,15 @@ class Frame(object):
def get_number_of_arguments(self):
return self._method.get_number_of_arguments()
def top(self):
stack_pointer = jit.promote(self._stack_pointer)
assert 0 <= stack_pointer < len(self._stack)
return self._stack[stack_pointer]
def pop(self):
""" Pop an object from the expression stack and return it """
stack_pointer = self._stack_pointer
stack_pointer = jit.promote(self._stack_pointer)
assert 0 <= stack_pointer < len(self._stack)
self._stack_pointer = stack_pointer - 1
result = self._stack[stack_pointer]
self._stack[stack_pointer] = None
......@@ -81,6 +87,7 @@ class Frame(object):
def push(self, value):
""" Push an object onto the expression stack """
stack_pointer = jit.promote(self._stack_pointer) + 1
assert 0 <= stack_pointer < len(self._stack)
self._stack[stack_pointer] = value
self._stack_pointer = stack_pointer
......
......@@ -106,12 +106,12 @@ class Interpreter(object):
receiver.send_does_not_understand(frame, signature, self._universe, self)
def _do_return_local(self, frame):
return frame.pop()
return frame.top()
@jit.unroll_safe
def _do_return_non_local(self, frame):
# get result from stack
result = frame.pop()
result = frame.top()
# Compute the context for the non-local return
context = frame.get_outer_context()
......@@ -127,7 +127,7 @@ class Interpreter(object):
# ... and execute the escapedBlock message instead
sender.send_escaped_block(frame, block, self._universe, self)
return frame.pop()
return frame.top()
raise ReturnException(result, 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