[vmkit-commits] [vmkit] r54731 - /vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Wed Aug 13 05:01:43 PDT 2008
Author: geoffray
Date: Wed Aug 13 07:01:40 2008
New Revision: 54731
URL: http://llvm.org/viewvc/llvm-project?rev=54731&view=rev
Log:
Commentify.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h?rev=54731&r1=54730&r2=54731&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h Wed Aug 13 07:01:40 2008
@@ -40,6 +40,10 @@
typedef JavaArray* (*arrayCtor_t)(uint32 len, CommonClass* cl, Jnjvm* vm);
+
+/// AssessorDesc - Description of a Java assessor: these are the letters found
+/// in Java signatures, e.g. "I" or "(".
+///
class AssessorDesc {
public:
static VirtualTable *VT;
@@ -59,42 +63,135 @@
static const char I_BOOL;
static const char I_SEP;
+ /// doTrace - Is this assessor for garbage collected objects? True for
+ /// the "L" assessor and the "[" assessor.
+ ///
bool doTrace;
+
+ /// byteId - Letter reprensenting this assessor.
+ ///
char byteId;
+
+ /// nbb - Number of bytes of instances of this assessor (e.g. 4 for "I").
+ ///
uint32 nbb;
+
+ /// nbw - Number of words of instances if this assessor (e.g. 8 for "D").
+ ///
uint32 nbw;
+
+ /// numId - A byte identifier from 0 to the number of assessors.
+ ///
uint8 numId;
+ /// asciizName - The name of the assessor in asciiz, e.g. "void" for "V".
+ ///
const char* asciizName;
+
+ /// UTF8Name - The name of the assessor in UTF8, e.g. "void" for "V".
+ ///
+ const UTF8* UTF8Name;
+
+ /// classType - The primitive Java class of this assessor. This class
+ /// is internal to the JVM.
+ ///
CommonClass* classType;
+
+ /// assocClassName - The associated class name, e.g. "java/lang/Integer" for
+ /// "I".
+ ///
const UTF8* assocClassName;
- const UTF8* UTF8Name;
+
+ /// arrayClass - The primitive array class of the assessor, e.g. I[] for "I".
+ ///
ClassArray* arrayClass;
+
+ /// arrayCtor - The constructor of an array of this assessor.
+ ///
arrayCtor_t arrayCtor;
+//===----------------------------------------------------------------------===//
+//
+// The set of assessors in Java. This set is unique and there are no other
+// assessors.
+//
+//===----------------------------------------------------------------------===//
+
+
+ /// dParg - The "(" assessor.
+ ///
static AssessorDesc* dParg;
+
+ /// dPard - The ")" assessor.
+ ///
static AssessorDesc* dPard;
+
+ /// dVoid - The "V" assessor.
+ ///
static AssessorDesc* dVoid;
+
+ /// dBool - The "Z" assessor.
+ ///
static AssessorDesc* dBool;
+
+ /// dByte - The "B" assessor.
+ ///
static AssessorDesc* dByte;
+
+ /// dChar - The "C" assessor.
+ ///
static AssessorDesc* dChar;
+
+ /// dShort - The "S" assessor.
+ ///
static AssessorDesc* dShort;
+
+ /// dInt - The "I" assessor.
+ ///
static AssessorDesc* dInt;
+
+ /// dFloat - The "F" assessor.
+ ///
static AssessorDesc* dFloat;
+
+ /// dLong - The "J" assessor.
+ ///
static AssessorDesc* dLong;
+
+ /// dDouble - The "D" assessor.
+ ///
static AssessorDesc* dDouble;
+
+ /// dTab - The "[" assessor.
+ ///
static AssessorDesc* dTab;
+
+ /// dRef - The "L" assessor.
+ ///
static AssessorDesc* dRef;
+//===----------------------------------------------------------------------===//
+//
+// End of assessors.
+//
+//===----------------------------------------------------------------------===//
+
+ /// AssessorDesc - Construct an assessor.
+ ///
AssessorDesc(bool dt, char bid, uint32 nb, uint32 nw,
const char* name,
Jnjvm* vm, uint8 nid,
const char* assocName, ClassArray* cl,
arrayCtor_t ctor);
+
+ /// initialise - Construct all assessors.
+ ///
static void initialise(Jnjvm* vm);
+ /// printString - Print the assessor for debugging purposes.
+ ///
const char* printString() const;
static void analyseIntern(const UTF8* name, uint32 pos,
@@ -119,48 +216,130 @@
};
+/// Typedef - Each class has a Typedef representation. A Typedef is also a class
+/// which has not been loaded yet. Typedefs are hashed on the name of the class.
+/// Hashing is for memory purposes, not for comparison.
+///
class Typedef {
public:
+
+ /// keyName - The name of the Typedef. It is the representation of a class
+ /// in a Java signature, e.g. "Ljava/lang/Object;".
+ ///
const UTF8* keyName;
+
+ /// pseudoAssocClassName - The real name of the class this Typedef
+ /// represents, e.g. "java/lang/Object"
+ ///
const UTF8* pseudoAssocClassName;
+
+ /// funcs - The assessor for this Typedef. All Typedef must have the dRef
+ /// or the dTab assessor, except the primive Typedefs.
+ ///
const AssessorDesc* funcs;
+
+ /// isolate - Which isolate constructed me?
+ ///
Jnjvm* isolate;
+ /// printString - Print the Typedef for debugging purposes.
+ ///
const char* printString() const;
+ /// assocClass - Given the loaded, try to load the class represented by this
+ /// Typedef.
+ ///
CommonClass* assocClass(JavaObject* loader);
- void typePrint(mvm::PrintBuffer* buf);
+
+ /// humanPrintArgs - Prints the list of typedef in a human readable form.
+ ///
static void humanPrintArgs(const std::vector<Typedef*>*,
mvm::PrintBuffer* buf);
+
+ /// typeDup - Create a new Typedef.
+ ///
static Typedef* typeDup(const UTF8* name, Jnjvm* vm);
+
+ /// tPrintBuf - Prints the name of the class this Typedef represents.
+ ///
void tPrintBuf(mvm::PrintBuffer* buf) const;
};
+/// Signdef - This class represents a Java signature. Each Java method has a
+/// Java signature. Signdefs are hashed for memory purposes, not equality
+/// purposes.
+///
class Signdef {
private:
- intptr_t _staticCallBuf;
- intptr_t _virtualCallBuf;
- intptr_t _staticCallAP;
- intptr_t _virtualCallAP;
+ /// _staticCallBuf - A dynamically generated method which calls a static Java
+ /// function with the specific signature and receive the arguments in a
+ /// buffer.
+ ///
+ intptr_t _staticCallBuf;
intptr_t staticCallBuf();
+
+ /// _virtualCallBuf - A dynamically generated method which calls a virtual
+ /// Java function with the specific signature and receive the arguments in a
+ /// buffer.
+ ///
+ intptr_t _virtualCallBuf;
intptr_t virtualCallBuf();
+
+ /// _staticCallAP - A dynamically generated method which calls a static Java
+ /// function with the specific signature and receive the arguments in a
+ /// variable argument handle.
+ ///
+ intptr_t _staticCallAP;
intptr_t staticCallAP();
+
+ /// _virtualCallBuf - A dynamically generated method which calls a virtual
+ /// Java function with the specific signature and receive the arguments in a
+ /// variable argument handle.
+ ///
+ intptr_t _virtualCallAP;
intptr_t virtualCallAP();
public:
+
+ /// args - The arguments as Typedef of this signature.
+ ///
std::vector<Typedef*> args;
+
+ /// ret - The Typedef return of this signature.
+ ///
Typedef* ret;
+
+ /// isolate - The isolate that defined the signature.
+ ///
Jnjvm* isolate;
+
+ /// keyName - The Java name of the signature, e.g. "()V".
+ ///
const UTF8* keyName;
+ /// printString - Print the signature for debugging purposes.
+ ///
const char* printString() const;
+ /// printWithSign - Print the signature of a method with the method's class
+ /// and name.
+ ///
void printWithSign(CommonClass* cl, const UTF8* name, mvm::PrintBuffer* buf);
+
+ /// signDup - Create a new Signdef.
+ ///
static Signdef* signDup(const UTF8* name, Jnjvm* vm);
+//===----------------------------------------------------------------------===//
+//
+// Inline calls to get the dynamically generated functions to call Java
+// functions. Note that this calls the JIT.
+//
+//===----------------------------------------------------------------------===//
+
intptr_t getStaticCallBuf() {
if(!_staticCallBuf) return staticCallBuf();
return _staticCallBuf;
@@ -197,8 +376,19 @@
_virtualCallAP = code;
}
-
+//===----------------------------------------------------------------------===//
+//
+// End of inlined methods of getting dynamically generated functions.
+//
+//===----------------------------------------------------------------------===//
+
+
+ /// JInfo - Holds info useful for the JIT.
+ ///
mvm::JITInfo* JInfo;
+
+ /// getInfo - Get the JIT info of this signature. The info is created lazely.
+ ///
template<typename Ty>
Ty *getInfo() {
if (!JInfo) {
More information about the vmkit-commits
mailing list