Module JClassLow

module JClassLow: sig .. end

Low level representation of a Java class file.


Low level bytecode instructions.

type opcode = 
| OpNop
| OpAConstNull
| OpIConst of int32
| OpLConst of int64
| OpFConst of float
| OpDConst of float
| OpBIPush of int
| OpSIPush of int
| OpLdc1 of int
| OpLdc1w of int
| OpLdc2w of int
| OpLoad of JBasics.jvm_basic_type * int
| OpALoad of int
| OpArrayLoad of [ `Double | `Float | `Int | `Long ]
| OpAALoad
| OpBALoad
| OpCALoad
| OpSALoad
| OpStore of JBasics.jvm_basic_type * int
| OpAStore of int
| OpArrayStore of [ `Double | `Float | `Int | `Long ]
| OpAAStore
| OpBAStore
| OpCAStore
| OpSAStore
| OpPop
| OpPop2
| OpDup
| OpDupX1
| OpDupX2
| OpDup2
| OpDup2X1
| OpDup2X2
| OpSwap
| OpAdd of JBasics.jvm_basic_type
| OpSub of JBasics.jvm_basic_type
| OpMult of JBasics.jvm_basic_type
| OpDiv of JBasics.jvm_basic_type
| OpRem of JBasics.jvm_basic_type
| OpNeg of JBasics.jvm_basic_type
| OpIShl
| OpLShl
| OpIShr
| OpLShr
| OpIUShr
| OpLUShr
| OpIAnd
| OpLAnd
| OpIOr
| OpLOr
| OpIXor
| OpLXor
| OpIInc of int * int (*

index, increment

*)
| OpI2L
| OpI2F
| OpI2D
| OpL2I
| OpL2F
| OpL2D
| OpF2I
| OpF2L
| OpF2D
| OpD2I
| OpD2L
| OpD2F
| OpI2B
| OpI2C
| OpI2S
| OpLCmp
| OpFCmpL
| OpFCmpG
| OpDCmpL
| OpDCmpG
| OpIfEq of int
| OpIfNe of int
| OpIfLt of int
| OpIfGe of int
| OpIfGt of int
| OpIfLe of int
| OpICmpEq of int
| OpICmpNe of int
| OpICmpLt of int
| OpICmpGe of int
| OpICmpGt of int
| OpICmpLe of int
| OpACmpEq of int
| OpACmpNe of int
| OpGoto of int
| OpJsr of int
| OpRet of int
| OpTableSwitch of int * int32 * int32 * int array
| OpLookupSwitch of int * (int32 * int) list
| OpReturn of JBasics.jvm_basic_type
| OpAReturn
| OpReturnVoid
| OpGetStatic of int
| OpPutStatic of int
| OpGetField of int
| OpPutField of int
| OpInvokeVirtual of int
| OpInvokeNonVirtual of int
| OpInvokeStatic of int
| OpInvokeInterface of int * int (*

count

*)
| OpInvokeDynamic of int
| OpNew of int
| OpNewArray of JBasics.java_basic_type
| OpANewArray of int
| OpArrayLength
| OpThrow
| OpCheckCast of int
| OpInstanceOf of int
| OpMonitorEnter
| OpMonitorExit
| OpAMultiNewArray of int * int (*

ClassInfo, dims

*)
| OpIfNull of int
| OpIfNonNull of int
| OpGotoW of int
| OpJsrW of int
| OpBreakpoint
| OpInvalid

Instruction.

type opcodes = opcode array 

Flags, attributes and low-level structure of class files.

type common_flag = [ `AccFinal | `AccPublic | `AccRFU of int | `AccSynthetic ] 
type inner_flag = [ `AccAbstract
| `AccAnnotation
| `AccEnum
| `AccFinal
| `AccInterface
| `AccPrivate
| `AccProtected
| `AccPublic
| `AccRFU of int
| `AccStatic
| `AccSynthetic ]
type field_flag = [ `AccEnum
| `AccFinal
| `AccPrivate
| `AccProtected
| `AccPublic
| `AccRFU of int
| `AccStatic
| `AccSynthetic
| `AccTransient
| `AccVolatile ]
type method_flag = [ `AccAbstract
| `AccBridge
| `AccFinal
| `AccNative
| `AccPrivate
| `AccProtected
| `AccPublic
| `AccRFU of int
| `AccStatic
| `AccStrict
| `AccSynchronized
| `AccSynthetic
| `AccVarArgs ]
type class_flag = [ `AccAbstract
| `AccAnnotation
| `AccEnum
| `AccFinal
| `AccInterface
| `AccModule
| `AccPublic
| `AccRFU of int
| `AccSuper
| `AccSynthetic ]
type access_flag = [ `AccAbstract
| `AccAnnotation
| `AccBridge
| `AccEnum
| `AccFinal
| `AccInterface
| `AccModule
| `AccNative
| `AccPrivate
| `AccProtected
| `AccPublic
| `AccRFU of int
| `AccStatic
| `AccStrict
| `AccSuper
| `AccSynchronized
| `AccSynthetic
| `AccTransient
| `AccVarArgs
| `AccVolatile ]
type mp_flags = [ `AccFinal | `AccMandated | `AccRFU of int | `AccSynthetic ] 
type method_parameters = {
   name : string option;
   flags : mp_flags list;
}
type code = {
   c_max_stack : int;
   c_max_locals : int;
   c_code : opcodes;
   c_exc_tbl : JCode.exception_handler list;
   c_attributes : attribute list;
}
type attribute = 
| AttributeSourceFile of string
| AttributeConstant of JClass.constant_attribute
| AttributeCode of code Stdlib.Lazy.t
| AttributeExceptions of JBasics.class_name list
| AttributeInnerClasses of (JBasics.class_name option * JBasics.class_name option * string option *
inner_flag list)
list
(*

inner_class_info, outer_class_info, inner_name, inner_class_access_flags

*)
| AttributeSynthetic
| AttributeLineNumberTable of (int * int) list
| AttributeLocalVariableTable of (int * int * string * JBasics.value_type * int) list (*

start_pc, length, name, type, index

*)
| AttributeLocalVariableTypeTable of (int * int * string * JSignature.fieldTypeSignature * int) list (*

(start_pc, length, name, type, index), LocalVariableTable for generics, described in the JVM Spec 1.5, ยง4.8.13

*)
| AttributeDeprecated
| AttributeSignature of string (*

Introduced in Java 5 for generics (JVMS).

*)
| AttributeEnclosingMethod of (JBasics.class_name * (string * JBasics.descriptor) option) (*

Introduced in Java 5 for local classes (classes defined in a method body) (JVMS).

*)
| AttributeSourceDebugExtension of string (*

Introduced in Java 5 for debugging purpose (no semantics defined) (JVMS).

*)
| AttributeStackMapTable of JBasics.stackmap_frame list (*

DFr : Addition for 1.6 stackmap.

*)
| AttributeRuntimeVisibleAnnotations of JBasics.annotation list
| AttributeRuntimeInvisibleAnnotations of JBasics.annotation list
| AttributeRuntimeVisibleParameterAnnotations of JBasics.annotation list list
| AttributeRuntimeInvisibleParameterAnnotations of JBasics.annotation list list
| AttributeAnnotationDefault of JBasics.element_value
| AttributeBootstrapMethods of JBasics.bootstrap_method list
| AttributeMethodParameters of method_parameters list
| AttributeUnknown of string * string
type jfield = {
   f_name : string;
   f_descriptor : JBasics.value_type;
   f_flags : field_flag list;
   f_attributes : attribute list;
}
type jmethod = {
   m_name : string;
   m_descriptor : JBasics.method_descriptor;
   m_flags : method_flag list;
   m_attributes : attribute list;
}
type jclass = {
   j_name : JBasics.class_name;
   j_super : JBasics.class_name option;
   j_interfaces : JBasics.class_name list;
   j_consts : JBasics.constant array;
   j_flags : class_flag list;
   j_fields : jfield list;
   j_methods : jmethod list;
   j_attributes : attribute list;
   j_bootstrap_table : JBasics.bootstrap_method array;
   j_version : JBasics.version;
}