def fix_opcodes(opcodes): for key, value in opcodes.iteritems(): if type(value) is str: value = InstructionList([PushAllArgs, value, StoreResult, CheckLength]) elif value == []: value = InstructionList([CheckLength]) elif value is not None: if StoreResult not in value: value.append(StoreResult) if CheckLength not in value: value.append(CheckLength) value = InstructionList(value) opcodes[key] = value
def fix_opcodes(opcodes): for key, value in opcodes.iteritems(): if type(value) is str: value = InstructionList([PushAllArgs, value, StoreResult, CheckLength]) elif value == []: value = InstructionList([CheckLength]) elif value is not None: if StoreResult not in value: value.append(StoreResult) if CheckLength not in value: value.append(CheckLength) value = InstructionList(value) opcodes[key] = value
'ullong_lt': 'clt.un', 'ullong_le': _not('cgt.un'), 'ullong_eq': 'ceq', 'ullong_ne': _not('ceq'), 'ullong_gt': 'cgt.un', 'ullong_ge': _not('clt.un'), 'ullong_lshift': [PushAllArgs, 'conv.u4', 'shl'], 'ullong_rshift': [PushAllArgs, 'conv.i4', 'shr'], } opcodes = misc_ops.copy() opcodes.update(unary_ops) opcodes.update(binary_ops) for key, value in opcodes.iteritems(): if type(value) is str: value = InstructionList([PushAllArgs, value, StoreResult]) elif value is not None: if value is not Ignore and StoreResult not in value and not isinstance( value[0], MapException): value.append(StoreResult) value = InstructionList(value) opcodes[key] = value
'ullong_mod': 'rem.un', 'ullong_lt': 'clt.un', 'ullong_le': _not('cgt.un'), 'ullong_eq': 'ceq', 'ullong_ne': _not('ceq'), 'ullong_gt': 'cgt.un', 'ullong_ge': _not('clt.un'), 'ullong_lshift': [PushAllArgs, 'conv.u4', 'shl'], 'ullong_rshift': [PushAllArgs, 'conv.i4', 'shr'], 'ullong_and': 'and', 'ullong_or': 'or', 'oois': 'ceq', 'ooisnot': _not('ceq'), } opcodes = misc_ops.copy() opcodes.update(unary_ops) opcodes.update(binary_ops) for key, value in opcodes.iteritems(): if type(value) is str: value = InstructionList([PushAllArgs, value, StoreResult]) elif value is not None: if value is not Ignore and StoreResult not in value and not isinstance(value[0], MapException): value.append(StoreResult) value = InstructionList(value) opcodes[key] = value