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 import jit
class Bytecodes(object):
......@@ -58,12 +59,15 @@ class Bytecodes(object):
0, # return_local
0 ] # return_non_local
def bytecode_length(bytecode):
assert bytecode >= 0 and bytecode <= len(Bytecodes._bytecode_length)
return Bytecodes._bytecode_length[bytecode]
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):
return -number_of_arguments_of_message_send + 1 # +1 in order to account for the return value
......@@ -71,17 +75,13 @@ def bytecode_stack_effect(bytecode, number_of_arguments_of_message_send = 0):
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
def bytecode_as_str(bytecode):
if not isinstance(bytecode, int):
raise ValueError('bytecode is expected to be an integer.')
if bytecode > len(_bytecode_names):
raise ValueError('No Bytecode defined for the value %d.' % bytecode)
assert bytecode >= 0 and bytecode < len(_bytecode_names)
return _bytecode_names[bytecode]
def _sorted_bytecode_names(cls):
from __future__ import absolute_import
from rpython.rlib import jit
from som.vmobjects.array import Array
class Method(Array):
......@@ -40,7 +42,7 @@ class Method(Array):
return True
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
def get_maximum_number_of_stack_elements(self):
......@@ -86,8 +88,10 @@ class Method(Array):
# Get the number of bytecodes in this method
return len(self._bytecodes)
def get_bytecode(self, index):
# Get the bytecode at the given index
assert 0 <= index and index < len(self._bytecodes)
return ord(self._bytecodes[index])
def set_bytecode(self, index, value):
......@@ -104,10 +108,14 @@ class Method(Array):
def __str__(self):
return "Method(" + self.get_holder().get_name().get_string() + ">>" + str(self.get_signature()) + ")"
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]
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]
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