blob: 81daacd41a43891ff0b0e3ad88bb15f72fe29189 [file] [log] [blame]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;; Type definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; A virtual table is an array of function pointers.
%VT = type [0 x i32 (...)*]
;;; The root of all Java Objects: a VT and a lock.
%JavaObject = type { %VT*, i8* }
;;; Types for Java arrays. A size of 0 means an undefined size.
%JavaArray = type { %JavaObject, i8* }
%ArrayDouble = type { %JavaObject, i8*, [0 x double] }
%ArrayFloat = type { %JavaObject, i8*, [0 x float] }
%ArrayLong = type { %JavaObject, i8*, [0 x i64] }
%ArrayObject = type { %JavaObject, i8*, [0 x %JavaObject*] }
%ArraySInt16 = type { %JavaObject, i8*, [0 x i16] }
%ArraySInt32 = type { %JavaObject, i8*, [0 x i32] }
%ArraySInt8 = type { %JavaObject, i8*, [0 x i8] }
%ArrayUInt16 = type { %JavaObject, i8*, [0 x i16] }
%ArrayUInt32 = type { %JavaObject, i8*, [0 x i32] }
%ArrayUInt8 = type { %JavaObject, i8*, [0 x i8] }
;;; The task class mirror.
;;; Field 1: The class state
;;; Field 2: The initialization state
;;; Field 3: The static instance
%TaskClassMirror = type { i8, i1, i8* }
%JavaThread = type { %MutatorThread, i8*, %JavaObject*, i8* }
%Attribut = type { %UTF8*, i32, i32 }
%UTF8 = type { %JavaObject, i8*, [0 x i16] }
%JavaField = type { i8*, i16, %UTF8*, %UTF8*, %Attribut*, i16, %JavaClass*, i32,
i16 }
%CodeLineInfo = type { i8*, i16, i16, %JavaMethod*, %CodeLineInfo* }
%JavaMethod = type { i8*, i16, %Attribut*, i16, %JavaClass*,
%UTF8*, %UTF8*, i8, i8*, %CodeLineInfo*, i16, i32 }
%JavaClassPrimitive = type { %JavaCommonClass, i32 }
%JavaClassArray = type { %JavaCommonClass, %JavaCommonClass* }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; Constant calls for Jnjvm runtime internal objects field accesses ;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; j3RuntimeInitialiseClass - Initialises the class.
declare %JavaClass* @j3RuntimeInitialiseClass(%JavaClass*)
;;; arrayLength - Get the length of an array.
declare i32 @arrayLength(%JavaObject*) readnone
;;; getVT - Get the VT of the object.
declare %VT* @getVT(%JavaObject*) readnone
;;; getIMT - Get the IMT of the VT.
declare %VT* @getIMT(%VT*) readnone
;;; getClass - Get the class of an object.
declare %JavaCommonClass* @getClass(%JavaObject*) readnone
;;; getLock - Get the lock of an object.
declare i8* @getLock(%JavaObject*)
;;; getVTFromCommonClass - Get the VT of a class from its runtime
;;; representation.
declare %VT* @getVTFromCommonClass(%JavaCommonClass*) readnone
;;; getVTFromClass - Get the VT of a class from its runtime representation.
declare %VT* @getVTFromClass(%JavaClass*) readnone
;;; getVTFromClassArray - Get the VT of an array class from its runtime
;;; representation.
declare %VT* @getVTFromClassArray(%JavaClassArray*) readnone
;;; getObjectSizeFromClass - Get the size of a class from its runtime
;;; representation.
declare i32 @getObjectSizeFromClass(%JavaClass*) readnone
;;; getBaseClassVTFromVT - Get the VT of the base class of an array, or the
;;; VT of the array class of a regular class.
declare %VT* @getBaseClassVTFromVT(%VT*) readnone
;;; getDisplay - Get the display array of this VT.
declare %VT** @getDisplay(%VT*) readnone
;;; getVTInDisplay - Get the super class at the given offset.
declare %VT* @getVTInDisplay(%VT**, i32) readnone
;;; getDepth - Get the depth of the VT.
declare i32 @getDepth(%VT*) readnone
;;; getStaticInstance - Get the static instance of this class.
declare i8* @getStaticInstance(%JavaClass*) readnone
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;; Generic Runtime methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; j3InterfaceLookup - Used for interface calls.
declare i8* @j3InterfaceLookup(%JavaClass*, i32, ...)
;;; j3MultiCallNew - Allocate multi-dimensional arrays. This will go to
;;; allocation specific methods.
declare %JavaObject* @j3MultiCallNew(%JavaCommonClass*, i32, ...)
;;; initialisationCheck - Checks if the class has been initialized and
;;; initializes if not. This is used for initialization barriers in an isolate
;;; environment, and in some specific scenario in a single environment.
declare %JavaClass* @initialisationCheck(%JavaClass*) readnone
;;; forceInitialisationCheck - Force to check initialization. The difference
;;; between this function and the initialisationCheck function is that the
;;; latter is readnone and can thus be removed. This function is removed
;;; by Jnjvm after the GVN pass, therefore it does not have an actual
;;; implementation.
declare void @forceInitialisationCheck(%JavaClass*)
;;; forceLoadedCheck - Force to check if the class was loaded. Since we do
;;; not want to run Java code in a callback, we have to make sure the class
;;; of the method that we want to compile is loaded. This is used for
;;; the invokespecial bytecode.
declare void @forceLoadedCheck(%JavaCommonClass*)
;;; getConstantPoolAt - Get the value in the constant pool of this class.
;;; This function is removed by Jnjvm after the GVn pass, therefore it does
;;; not have an actual implementation.
declare i8* @getConstantPoolAt(i8* (%JavaClass*, i32, ...)*, i8**,
%JavaClass*, i32, ...) readnone
;;; j3VirtualTableLookup - Look up the offset in a virtual table of a
;;; specific function.
declare i32 @j3VirtualTableLookup(%JavaClass*, i32, i32*, %JavaObject*)
;;; j3ClassLookup - Look up a specific class. The function takes a class and
;;; an index to lookup in the constant pool and returns and stores it in the
;;; constant pool cache.
declare i8* @j3ClassLookup(%JavaClass*, i32, ...)
;;; j3VirtualFieldLookup - Look up a specific virtual field.
declare i8* @j3VirtualFieldLookup(%JavaClass*, i32, ...)
;;; j3StaticFieldLookup - Look up a specific static field.
declare i8* @j3StaticFieldLookup(%JavaClass*, i32, ...)
;;; j3StringLookup - Find the isolate-specific string at the given offset in
;;; the constant pool.
declare i8* @j3StringLookup(%JavaClass*, i32, ...) readnone
;;; j3JavaObjectAquire - This function is called when starting a synchronized
;;; block or method.
declare void @j3JavaObjectAquire(%JavaObject*)
;;; j3JavaObjectRelease - This function is called when leaving a synchronized
;;; block or method.
declare void @j3JavaObjectRelease(%JavaObject*)
;;; j3OverflowThinLock - Change a thin lock to a fat lock when the thin lock
;;; overflows
declare void @j3OverflowThinLock(%JavaObject*)
;;; isAssignableFrom - Returns if a type is a subtype of another type.
declare i1 @isAssignableFrom(%VT*, %VT*) readnone
;;; isSecondaryClass - Returns if a type is a secondary super type of
;;; another type.
declare i1 @isSecondaryClass(%VT*, %VT*) readnone
;;; getClassDelegatee - Returns the java/lang/Class representation of the
;;; class. This method is lowered to the GEP to the class delegatee in
;;; the common class.
declare %JavaObject* @getClassDelegatee(%JavaCommonClass*) readnone
;;; j3RuntimeDelegatee - Returns the java/lang/Class representation of the
;;; class. This method is called if the class delegatee has not been created
;;; yet.
declare %JavaObject* @j3RuntimeDelegatee(%JavaCommonClass*) readnone
;;; j3GetArrayClass - Get the array user class of the user class.
declare %JavaClassArray* @j3GetArrayClass(%JavaCommonClass*,
%JavaClassArray**) readnone
declare i8 @getFinalInt8Field(i8*) readnone
declare i16 @getFinalInt16Field(i16*) readnone
declare i32 @getFinalInt32Field(i32*) readnone
declare i64 @getFinalLongField(i64*) readnone
declare double @getFinalDoubleField(double*) readnone
declare float @getFinalFloatField(float*) readnone
declare %JavaObject* @getFinalObjectField(%JavaObject**) readnone
declare i8* @j3ResolveVirtualStub(%JavaObject*)
declare i8* @j3ResolveSpecialStub()
declare i8* @j3ResolveStaticStub()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Exception methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
declare %JavaObject* @j3NullPointerException()
declare %JavaObject* @j3ClassCastException(%JavaObject*, %JavaCommonClass*)
declare %JavaObject* @j3IndexOutOfBoundsException(%JavaObject*, i32)
declare %JavaObject* @j3NegativeArraySizeException(i32)
declare %JavaObject* @j3OutOfMemoryError(i32)
declare %JavaObject* @j3StackOverflowError()
declare %JavaObject* @j3ArrayStoreException(%VT*)
declare %JavaObject* @j3ArithmeticException()
declare void @j3ThrowException(%JavaObject*)
declare void @j3ThrowExceptionFromJIT()
declare void @j3EndJNI(i32**)
declare void @j3StartJNI(i32*, i32**, i8*)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Debugging methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
declare void @j3PrintExecution(i32, i32, %JavaMethod*)
declare void @j3PrintMethodStart(%JavaMethod*)
declare void @j3PrintMethodEnd(%JavaMethod*)