Module jvm
[hide private]
[frames] | no frames]

Module jvm

source code

Classes [hide private]
  JAR
  CpInfo
Generic class to manage constant info object
  MethodRef
  InterfaceMethodRef
  FieldRef
  Class
  Utf8
  String
  Integer
  Float
  Long
  Double
  NameAndType
  EmptyConstant
  FieldInfo
An object which represents a Field
  MethodInfo
An object which represents a Method
  CreateString
Create a specific String constant by given the name index
  CreateInteger
Create a specific Integer constant by given the name index
  CreateClass
Create a specific Class constant by given the name index
  CreateNameAndType
Create a specific NameAndType constant by given the name and the descriptor index
  CreateFieldRef
Create a specific FieldRef constant by given the class and the NameAndType index
  CreateMethodRef
Create a specific MethodRef constant by given the class and the NameAndType index
  CreateCodeAttributeInfo
Create a specific CodeAttributeInfo by given bytecodes (into an human readable format)
  CreateFieldInfo
Create a specific FieldInfo by given the name, the prototype of the "new" field
  CreateMethodInfo
Create a specific MethodInfo by given the name, the prototype and the code (into an human readable format) of the "new" method
  JBC
JBC manages each bytecode with the value, name, raw buffer and special functions
  JavaCode
JavaCode manages a list of bytecode to a specific method, by decoding a raw buffer and transform each bytecode into a JBC object
  BasicAttribute
  CodeAttribute
  SourceFileAttribute
  LineNumberTableAttribute
  LocalVariableTableAttribute
  LocalVariableTypeTableAttribute
  SourceDebugExtensionAttribute
  DeprecatedAttribute
  SyntheticAttribute
  SignatureAttribute
  RuntimeVisibleAnnotationsAttribute
  RuntimeInvisibleAnnotationsAttribute
  RuntimeVisibleParameterAnnotationsAttribute
  RuntimeInvisibleParameterAnnotationsAttribute
  ParameterAnnotation
  AnnotationDefaultAttribute
  Annotation
  ElementValuePair
  ElementValue
  ArrayValue
  ExceptionsAttribute
  VerificationTypeInfo
  FullFrame
  ChopFrame
  SameFrame
  SameLocals1StackItemFrame
  SameLocals1StackItemFrameExtended
  SameFrameExtended
  AppendFrame
  StackMapTableAttribute
  InnerClassesDesc
  InnerClassesAttribute
  ConstantValueAttribute
  EnclosingMethodAttribute
  AttributeInfo
AttributeInfo manages each attribute info (Code, SourceFile ....)
  ClassManager
ClassManager can be used by all classes to get more information
  JVMFormat
An object which is the main class to handle properly a class file.
Functions [hide private]
 
special_F0(x) source code
 
special_F0R(x) source code
 
special_F1(x) source code
 
special_F1R(x) source code
 
special_F2(x) source code
 
special_F2R(x) source code
 
special_F3(x) source code
 
special_F3R(x) source code
 
special_F4(x) source code
 
special_F4R(x) source code
 
specialSwitch(x) source code
 
formatFD(v) source code
 
TableSwitch(idx, raw_format) source code
 
LookupSwitch(idx, raw_format) source code
 
EXTRACT_INFORMATION_SIMPLE(op_value)
Extract information (special functions) about a bytecode
source code
 
EXTRACT_INFORMATION_VARIABLE(idx, op_value, raw_format) source code
 
determineNext(i, end, m) source code
 
classToJclass(x) source code
Variables [hide private]
  FD = {'B': 'byte', 'C': 'char', 'D': 'double', 'F': 'float', '...
  JAVA_OPCODES = {0: ['nop'], 1: ['aconst_null'], 2: ['iconst_m1...
  INVERT_JAVA_OPCODES = {'aaload': 50, 'aastore': 83, 'aconst_nu...
  BRANCH_JVM_OPCODES = ['goto', 'goto_w', 'if_acmpeq', 'if_icmpe...
  BRANCH2_JVM_OPCODES = ['goto', 'goto.', 'jsr', 'jsr.', 'if.', ...
  MATH_JVM_OPCODES = {'.add': '+', '.and': '&', '.div': '/', '.m...
  MATH_JVM_RE = [(re.compile(r'.shl'), '<<'), (re.compile(r'.xor...
  INVOKE_JVM_OPCODES = ['invoke.']
  FIELD_READ_JVM_OPCODES = ['get.']
  FIELD_WRITE_JVM_OPCODES = ['put.']
  BREAK_JVM_OPCODES = ['invoke.', 'put.', '.store', 'iinc', 'pop...
  INTEGER_INSTRUCTIONS = ['bipush', 'sipush']
  METHOD_INFO = ['>HHHH', <class 'jvm.MethodInfo'>]
  ATTRIBUTE_INFO = ['>HL', <class 'jvm.AttributeInfo'>]
  FIELD_INFO = ['>HHHH', <class 'jvm.FieldInfo'>]
  LINE_NUMBER_TABLE = ['>HH', <class 'jvm.LineNumberTable'>]
  EXCEPTION_TABLE = ['>HHHH', <class 'jvm.ExceptionTable'>]
  LOCAL_VARIABLE_TABLE = ['>HHHHH', <class 'jvm.LocalVariableTab...
  LOCAL_VARIABLE_TYPE_TABLE = ['>HHHHH', <class 'jvm.LocalVariab...
  CODE_LOW_STRUCT = ['>HHL', <class 'jvm.LOW'>]
  ARRAY_TYPE = {4: 'T_BOOLEAN', 5: 'T_CHAR', 6: 'T_FLOAT', 7: 'T...
  INVERT_ARRAY_TYPE = {'T': 11}
  ACC_CLASS_FLAGS = {1: ['ACC_PUBLIC', 'Declared public; may be ...
  INVERT_ACC_CLASS_FLAGS = {'ACC_ABSTRACT': 1024, 'ACC_FINAL': 1...
  ACC_FIELD_FLAGS = {1: ['ACC_PUBLIC', 'Declared public; may be ...
  INVERT_ACC_FIELD_FLAGS = {'ACC_FINAL': 16, 'ACC_PRIVATE': 2, '...
  ACC_METHOD_FLAGS = {1: ['ACC_PUBLIC', 'Declared public; may be...
  INVERT_ACC_METHOD_FLAGS = {'ACC_ABSTRACT': 1024, 'ACC_FINAL': ...
  CONSTANT_INFO = {1: ['CONSTANT_Utf8', '>BH', <class 'jvm.CONST...
  INVERT_CONSTANT_INFO = {'CONSTANT_Class': 7, 'CONSTANT_Double'...
  ITEM_Top = 0
  ITEM_Integer = 1
  ITEM_Float = 2
  ITEM_Long = 4
  ITEM_Double = 3
  ITEM_Null = 5
  ITEM_UninitializedThis = 6
  ITEM_Object = 7
  ITEM_Uninitialized = 8
  VERIFICATION_TYPE_INFO = {0: ['Top_variable_info', '>B', <clas...
  ENUM_CONST_VALUE = ['>HH', <class 'jvm.EnumConstValue'>]
  ATTRIBUTE_INFO_DESCR = {'AnnotationDefault': <class 'jvm.Annot...
  __package__ = None
  i = '.add'
  k = 12
Variables Details [hide private]

FD

Value:
{'B': 'byte',
 'C': 'char',
 'D': 'double',
 'F': 'float',
 'I': 'int',
 'J': 'long',
 'S': 'short',
 'V': 'void',
...

JAVA_OPCODES

Value:
{0: ['nop'],
 1: ['aconst_null'],
 2: ['iconst_m1'],
 3: ['iconst_0'],
 4: ['iconst_1'],
 5: ['iconst_2'],
 6: ['iconst_3'],
 7: ['iconst_4'],
...

INVERT_JAVA_OPCODES

Value:
{'aaload': 50,
 'aastore': 83,
 'aconst_null': 1,
 'aload': 25,
 'aload_0': 42,
 'aload_1': 43,
 'aload_2': 44,
 'aload_3': 45,
...

BRANCH_JVM_OPCODES

Value:
['goto',
 'goto_w',
 'if_acmpeq',
 'if_icmpeq',
 'if_icmpne',
 'if_icmplt',
 'if_icmpge',
 'if_icmpgt',
...

BRANCH2_JVM_OPCODES

Value:
['goto',
 'goto.',
 'jsr',
 'jsr.',
 'if.',
 'return',
 '.return',
 'tableswitch',
...

MATH_JVM_OPCODES

Value:
{'.add': '+',
 '.and': '&',
 '.div': '/',
 '.mul': '*',
 '.or': '|',
 '.shl': '<<',
 '.shr': '>>',
 '.sub': '-',
...

MATH_JVM_RE

Value:
[(re.compile(r'.shl'), '<<'),
 (re.compile(r'.xor'), '^'),
 (re.compile(r'.shr'), '>>'),
 (re.compile(r'.mul'), '*'),
 (re.compile(r'.div'), '/'),
 (re.compile(r'.sub'), '-'),
 (re.compile(r'.and'), '&'),
 (re.compile(r'.or'), '|'),
...

BREAK_JVM_OPCODES

Value:
['invoke.', 'put.', '.store', 'iinc', 'pop', '.return', 'if.']

LOCAL_VARIABLE_TABLE

Value:
['>HHHHH', <class 'jvm.LocalVariableTable'>]

LOCAL_VARIABLE_TYPE_TABLE

Value:
['>HHHHH', <class 'jvm.LocalVariableTypeTable'>]

ARRAY_TYPE

Value:
{4: 'T_BOOLEAN',
 5: 'T_CHAR',
 6: 'T_FLOAT',
 7: 'T_DOUBLE',
 8: 'T_BYTE',
 9: 'T_SHORT',
 10: 'T_INT',
 11: 'T_LONG'}

ACC_CLASS_FLAGS

Value:
{1: ['ACC_PUBLIC',
     'Declared public; may be accessed from outside its package.'],
 16: ['ACC_FINAL', 'Declared final; no subclasses allowed.'],
 32: ['ACC_SUPER',
      'Treat superclass methods specially when invoked by the invokesp\
ecial instruction.'],
 512: ['ACC_INTERFACE', 'Is an interface, not a class.'],
 1024: ['ACC_ABSTRACT', 'Declared abstract; may not be instantiated.']\
...

INVERT_ACC_CLASS_FLAGS

Value:
{'ACC_ABSTRACT': 1024,
 'ACC_FINAL': 16,
 'ACC_INTERFACE': 512,
 'ACC_PUBLIC': 1,
 'ACC_SUPER': 32}

ACC_FIELD_FLAGS

Value:
{1: ['ACC_PUBLIC',
     'Declared public; may be accessed from outside its package.'],
 2: ['ACC_PRIVATE',
     'Declared private; usable only within the defining class.'],
 4: ['ACC_PROTECTED',
     'Declared protected; may be accessed within subclasses.'],
 8: ['ACC_STATIC', 'Declared static.'],
 16: ['ACC_FINAL', 'Declared final; no further assignment after initia\
...

INVERT_ACC_FIELD_FLAGS

Value:
{'ACC_FINAL': 16,
 'ACC_PRIVATE': 2,
 'ACC_PROTECTED': 4,
 'ACC_PUBLIC': 1,
 'ACC_STATIC': 8,
 'ACC_TRANSIENT': 128,
 'ACC_VOLATILE': 64}

ACC_METHOD_FLAGS

Value:
{1: ['ACC_PUBLIC',
     'Declared public; may be accessed from outside its package.'],
 2: ['ACC_PRIVATE',
     'Declared private; accessible only within the defining class.'],
 4: ['ACC_PROTECTED',
     'Declared protected; may be accessed within subclasses.'],
 8: ['ACC_STATIC', 'Declared static.'],
 16: ['ACC_FINAL', 'Declared final; may not be overridden.'],
...

INVERT_ACC_METHOD_FLAGS

Value:
{'ACC_ABSTRACT': 1024,
 'ACC_FINAL': 16,
 'ACC_NATIVE': 256,
 'ACC_PRIVATE': 2,
 'ACC_PROTECTED': 4,
 'ACC_PUBLIC': 1,
 'ACC_STATIC': 8,
 'ACC_STRICT': 2048,
...

CONSTANT_INFO

Value:
{1: ['CONSTANT_Utf8',
     '>BH',
     <class 'jvm.CONSTANT_Utf8_info'>,
     <class 'jvm.Utf8'>],
 3: ['CONSTANT_Integer',
     '>BL',
     <class 'jvm.CONSTANT_Integer_info'>,
     <class 'jvm.Integer'>],
...

INVERT_CONSTANT_INFO

Value:
{'CONSTANT_Class': 7,
 'CONSTANT_Double': 6,
 'CONSTANT_Fieldref': 9,
 'CONSTANT_Float': 4,
 'CONSTANT_Integer': 3,
 'CONSTANT_InterfaceMethodref': 11,
 'CONSTANT_Long': 5,
 'CONSTANT_Methodref': 10,
...

VERIFICATION_TYPE_INFO

Value:
{0: ['Top_variable_info', '>B', <class 'jvm.Top_variable_info'>],
 1: ['Integer_variable_info',
     '>B',
     <class 'jvm.Integer_variable_info'>],
 2: ['Float_variable_info', '>B', <class 'jvm.Float_variable_info'>],
 3: ['Double_variable_info', '>B', <class 'jvm.Double_variable_info'>]\
,
 4: ['Long_variable_info', '>B', <class 'jvm.Long_variable_info'>],
...

ATTRIBUTE_INFO_DESCR

Value:
{'AnnotationDefault': <class 'jvm.AnnotationDefaultAttribute'>,
 'Code': <class 'jvm.CodeAttribute'>,
 'ConstantValue': <class 'jvm.ConstantValueAttribute'>,
 'Deprecated': <class 'jvm.DeprecatedAttribute'>,
 'EnclosingMethod': <class 'jvm.EnclosingMethodAttribute'>,
 'Exceptions': <class 'jvm.ExceptionsAttribute'>,
 'InnerClasses': <class 'jvm.InnerClassesAttribute'>,
 'LineNumberTable': <class 'jvm.LineNumberTableAttribute'>,
...