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

Make some key functions elidable



Taken from krono/PySOM@9ae38c02b87c20e5e3df865be4d542238d95f335 and krono/PySOM@9af3f0be15d662c80c9f20a6ab337c669ec0d677
Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent 748f4def
from rpython.rlib.unroll import unrolling_iterable from rpython.rlib.unroll import unrolling_iterable
from rpython.rlib import jit
class Bytecodes(object): class Bytecodes(object):
...@@ -58,12 +59,15 @@ class Bytecodes(object): ...@@ -58,12 +59,15 @@ class Bytecodes(object):
0, # return_local 0, # return_local
0 ] # return_non_local 0 ] # return_non_local
@jit.elidable
def bytecode_length(bytecode): def bytecode_length(bytecode):
assert bytecode >= 0 and bytecode <= len(Bytecodes._bytecode_length)
return Bytecodes._bytecode_length[bytecode] return Bytecodes._bytecode_length[bytecode]
@jit.elidable
def bytecode_stack_effect(bytecode, number_of_arguments_of_message_send = 0): def bytecode_stack_effect(bytecode, number_of_arguments_of_message_send = 0):
assert bytecode >= 0 and bytecode < len(Bytecodes._bytecode_stack_effect)
if bytecode_stack_effect_depends_on_send(bytecode): if bytecode_stack_effect_depends_on_send(bytecode):
return -number_of_arguments_of_message_send + 1 # +1 in order to account for the return value return -number_of_arguments_of_message_send + 1 # +1 in order to account for the return value
else: else:
...@@ -71,18 +75,14 @@ def bytecode_stack_effect(bytecode, number_of_arguments_of_message_send = 0): ...@@ -71,18 +75,14 @@ def bytecode_stack_effect(bytecode, number_of_arguments_of_message_send = 0):
def bytecode_stack_effect_depends_on_send(bytecode): def bytecode_stack_effect_depends_on_send(bytecode):
assert bytecode >= 0 and bytecode <= Bytecodes._num_bytecodes assert bytecode >= 0 and bytecode < len(Bytecodes._bytecode_stack_effect)
return Bytecodes._bytecode_stack_effect[bytecode] == Bytecodes._stack_effect_depends_on_message return Bytecodes._bytecode_stack_effect[bytecode] == Bytecodes._stack_effect_depends_on_message
@jit.elidable
def bytecode_as_str(bytecode): def bytecode_as_str(bytecode):
if not isinstance(bytecode, int): assert bytecode >= 0 and bytecode < len(_bytecode_names)
raise ValueError('bytecode is expected to be an integer.') return _bytecode_names[bytecode]
if bytecode > len(_bytecode_names):
raise ValueError('No Bytecode defined for the value %d.' % bytecode)
else:
return _bytecode_names[bytecode]
def _sorted_bytecode_names(cls): def _sorted_bytecode_names(cls):
"NOT_RPYTHON" "NOT_RPYTHON"
......
from __future__ import absolute_import from __future__ import absolute_import
from rpython.rlib import jit
from som.vmobjects.array import Array from som.vmobjects.array import Array
class Method(Array): class Method(Array):
...@@ -40,7 +42,7 @@ class Method(Array): ...@@ -40,7 +42,7 @@ class Method(Array):
return True return True
def get_number_of_locals(self): def get_number_of_locals(self):
# Get the number of locals (converted to a Java integer) # Get the number of locals
return self._number_of_locals return self._number_of_locals
def get_maximum_number_of_stack_elements(self): def get_maximum_number_of_stack_elements(self):
...@@ -86,8 +88,10 @@ class Method(Array): ...@@ -86,8 +88,10 @@ class Method(Array):
# Get the number of bytecodes in this method # Get the number of bytecodes in this method
return len(self._bytecodes) return len(self._bytecodes)
@jit.elidable
def get_bytecode(self, index): def get_bytecode(self, index):
# Get the bytecode at the given index # Get the bytecode at the given index
assert 0 <= index and index < len(self._bytecodes)
return ord(self._bytecodes[index]) return ord(self._bytecodes[index])
def set_bytecode(self, index, value): def set_bytecode(self, index, value):
...@@ -104,10 +108,14 @@ class Method(Array): ...@@ -104,10 +108,14 @@ class Method(Array):
def __str__(self): def __str__(self):
return "Method(" + self.get_holder().get_name().get_string() + ">>" + str(self.get_signature()) + ")" return "Method(" + self.get_holder().get_name().get_string() + ">>" + str(self.get_signature()) + ")"
@jit.elidable
def get_inline_cache_class(self, bytecode_index): def get_inline_cache_class(self, bytecode_index):
assert 0 <= bytecode_index and bytecode_index < len(self._inline_cache_class)
return self._inline_cache_class[bytecode_index] return self._inline_cache_class[bytecode_index]
@jit.elidable
def get_inline_cache_invokable(self, bytecode_index): def get_inline_cache_invokable(self, bytecode_index):
assert 0 <= bytecode_index and bytecode_index < len(self._inline_cache_invokable)
return self._inline_cache_invokable[bytecode_index] return self._inline_cache_invokable[bytecode_index]
def set_inline_cache(self, bytecode_index, receiver_class, invokable): def set_inline_cache(self, bytecode_index, receiver_class, invokable):
......
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