def execute(self, vm): stack = vm.stack m = vm.current_method() if stack.get_frame_count() < 1: raise StackStateException('Not enough values on the stack') # handle referencetype case value = stack.pop() if self.targetName is None: variable = m.locals[self.index] if isinstance(value, ReferenceType): value.name = variable.name # fixme - set other properties? m.locals[self.index] = value else: m.locals[self.index].value = value.value else: for x in range(len(m.locals)): if m.locals[x].name == self.targetName: if isinstance(value, ReferenceType): value.name = variable.name # fixme - set other properties? m.locals[x] = value else: m.locals[x].value = value.value
def execute(self, vm): stack = vm.stack if stack.get_frame_count() < 2: raise StackStateException('Not enough values on the stack') rhs = stack.pop() lhs = stack.pop() stack.push(Variable(lhs.value * rhs.value))
def execute(self, vm): stack = vm.stack m = vm.current_method() if stack.get_frame_count() < 1: raise StackStateException('Not enough values on the stack') array = vm.stack.pop() result = Variable(array.length) result.type = Types.UInt32 vm.stack.push(result)
def execute(self, vm): stack = vm.stack m = vm.current_method() if stack.get_frame_count() < 2: raise StackStateException('Not enough values on the stack') index = vm.stack.pop() array = vm.stack.pop() vm.stack.push(array.values[index.value])
def execute(self, vm): stack = vm.stack if stack.get_frame_count() < 2: raise StackStateException('Not enough values on the stack') v2 = stack.pop() v1 = stack.pop() if v1.value == v2.value: stack.push(Variable(1)) else: stack.push(Variable(0))
def execute(self, vm): stack = vm.stack if stack.get_frame_count() < 1: raise StackStateException('Not enough values on the stack') input = stack.pop() result = None if self.suffix == 'i4': result = self.convert_to_i4(input) else: raise Exception('Unimplemented conversion ' + self.suffix) stack.push(result)
def execute(self, vm): stack = vm.stack m = vm.current_method() if stack.get_frame_count() < 1: raise StackStateException('Not enough values on the stack') object = vm.stack.pop() for fieldIndex in range(len(object.fieldNames)): fieldName = object.fieldNames[fieldIndex] if fieldName == self.fieldName: vm.stack.push(object.fields[fieldIndex]) return raise Exception("Field " + self.fieldName + " not found!")
def execute(self, vm): stack = vm.stack if stack.get_frame_count() < 1: raise StackStateException('Not enough values on the stack') stack.pop()