[vmkit-commits] [vmkit] r53139 - in /vmkit/trunk/lib/JnJVM: Classpath/ClasspathVMClassLoader.cpp.inc VMCore/JavaClass.cpp VMCore/JavaClass.h VMCore/JavaJIT.cpp VMCore/Jnjvm.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Fri Jul 4 13:47:55 PDT 2008


Author: geoffray
Date: Fri Jul  4 15:47:54 2008
New Revision: 53139

URL: http://llvm.org/viewvc/llvm-project?rev=53139&view=rev
Log:
Typo & comment.


Modified:
    vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc
    vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
    vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
    vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp

Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc?rev=53139&r1=53138&r2=53139&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc Fri Jul  4 15:47:54 2008
@@ -94,7 +94,7 @@
   Class* cl = vm->constructClass(name, (JavaObject*)loader);
 
   if (cl->status == hashed) {
-    cl->aquire();
+    cl->acquire();
     if (cl->status == hashed) {
       cl->bytes = (ArrayUInt8*)bytes;
       cl->status = loaded;

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=53139&r1=53138&r2=53139&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Fri Jul  4 15:47:54 2008
@@ -283,7 +283,7 @@
 void* JavaMethod::_compiledPtr() {
   if (code != 0) return code;
   else {
-    classDef->aquire();
+    classDef->acquire();
     if (code == 0) {
       code = 
         classDef->isolate->TheModuleProvider->materializeFunction(this);

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=53139&r1=53138&r2=53139&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Fri Jul  4 15:47:54 2008
@@ -63,13 +63,25 @@
   
 };
 
-
+/// CommonClass - This class is the root class of all Java classes. It is
+/// currently GC-allocated in JnJVM, but will be permanently allocated when the
+/// class loader finalizer method will be defined.
+///
 class CommonClass : public mvm::Object {
 private:
 
+
+/// FieldCmp - Internal class for field and method lookup in a class.
+///
 class FieldCmp {
 public:
+  
+  /// name - The name of the field/method
+  ///
   const UTF8* name;
+
+  /// type - The type of the field/method.
+  ///
   const UTF8* type;
 
   FieldCmp(const UTF8* n, const UTF8* t) : name(n), type(t) {}
@@ -83,23 +95,44 @@
 
 public:
   
-  /// virtualSize - The size of instances of this class.
-  ///
+//===----------------------------------------------------------------------===//
+//
+// Do not reorder these fields or add new ones! the LLVM runtime assumes that
+// classes have the following beginning layout.
+//
+//===----------------------------------------------------------------------===//
+
+  
+  /// virtualSize - The size of instances of this class. Array classes do
+  /// not need this information, but to simplify accessing this field in
+  /// the JIT, we put this in here.
+  /// 
   uint32 virtualSize;
 
-  /// virtualVT - The virtual table of instances of this class.
+  /// virtualVT - The virtual table of instances of this class. Like the
+  /// virtualSize field, array classes do not need this information. But we
+  /// simplify JIT generation to set it here.
   ///
   VirtualTable* virtualVT;
   
-  /// display - The class hierarchy of supers for this class.
+  /// display - The class hierarchy of supers for this class. Array classes
+  /// do not need it.
   ///
   CommonClass** display;
   
   /// depth - The depth of this class in its class hierarchy. 
-  /// display[depth] contains the class.
+  /// display[depth] contains the class. Array classes do not need it.
   ///
   uint32 depth;
+
+
+//===----------------------------------------------------------------------===//
+//
+// New fields can be added from now, or reordered.
+//
+//===----------------------------------------------------------------------===//
   
+
   /// virtualTableSize - The size of the virtual table of this class.
   ///
   uint32 virtualTableSize;
@@ -192,65 +225,134 @@
   ///
   method_map staticMethods;
   
-
+  /// constructMethod - Add a new method in this class method map.
+  ///
   JavaMethod* constructMethod(const UTF8* name, const UTF8* type,
                               uint32 access);
   
+  /// constructField - Add a new field in this class field map.
+  ///
   JavaField* constructField(const UTF8* name, const UTF8* type,
                             uint32 access);
 
+  /// printClassName - Adds a string representation of this class in the
+  /// given buffer.
+  ///
   static void printClassName(const UTF8* name, mvm::PrintBuffer* buf);
   
-  void aquire() {
+  /// acquire - Acquire this class lock.
+  ///
+  void acquire() {
     lockVar->lock();
   }
   
+  /// release - Release this class lock.
+  ///
   void release() {
     lockVar->unlock();  
   }
 
+  /// waitClass - Wait for the class to be loaded/initialized/resolved.
+  ///
   void waitClass() {
     condVar->wait(lockVar);
   }
-
+  
+  /// broadcastClass - Unblock threads that were waiting on the class being
+  /// loaded/initialized/resolved.
+  ///
   void broadcastClass() {
     condVar->broadcast();  
   }
 
+  /// ownerClass - Is the current thread the owner of this thread?
+  ///
   bool ownerClass() {
     return mvm::Lock::selfOwner(lockVar);    
   }
   
+  /// lookupMethodDontThrow - Lookup a method in the method map of this class.
+  /// Do not throw if the method is not found.
+  ///
   JavaMethod* lookupMethodDontThrow(const UTF8* name, const UTF8* type,
                                     bool isStatic, bool recurse);
   
+  /// lookupMethod - Lookup a method and throw an exception if not found.
+  ///
   JavaMethod* lookupMethod(const UTF8* name, const UTF8* type, bool isStatic,
                            bool recurse);
   
+  /// lookupFieldDontThrow - Lookup a field in the field map of this class. Do
+  /// not throw if the field is not found.
+  ///
   JavaField* lookupFieldDontThrow(const UTF8* name, const UTF8* type,
                                   bool isStatic, bool recurse);
   
+  /// lookupField - Lookup a field and throw an exception if not found.
+  ///
   JavaField* lookupField(const UTF8* name, const UTF8* type, bool isStatic,
                          bool recurse);
 
-
+  /// print - Print the class for debugging purposes.
+  ///
   virtual void print(mvm::PrintBuffer *buf) const;
+  
+  /// tracer - The tracer of this GC-allocated class.
+  ///
   virtual void TRACER;
 
+  /// inheritName - Does this class in its class hierarchy inherits
+  /// the given name? Equality is on the name. This function does not take
+  /// into account array classes.
+  ///
   bool inheritName(const UTF8* Tname);
+
+  /// isOfTypeName - Does this class inherits the given name? Equality is on
+  /// the name. This function takes into account array classes.
+  ///
   bool isOfTypeName(const UTF8* Tname);
+
+  /// implements - Does this class implement the given class? Returns true if
+  /// the class is in the interface class hierarchy.
+  ///
   bool implements(CommonClass* cl);
+  
+  /// instantationOfArray - If this class is an array class, does its subclass
+  /// implements the given array class subclass?
+  ///
   bool instantiationOfArray(ClassArray* cl);
+  
+  /// subclassOf - If this class is a regular class, is it a subclass of the
+  /// given class?
+  ///
   bool subclassOf(CommonClass* cl);
+
+  /// isAssignableFrom - Is this class assignable from the given class? The
+  /// classes may be of any type.
+  ///
   bool isAssignableFrom(CommonClass* cl);
+
+  /// getClassDelegatee - Return the java/lang/Class representation of this
+  /// class.
+  ///
   JavaObject* getClassDelegatee();
+
+  /// initialiseClass - If the class has a static initializer and has not been
+  /// initialized yet, call it.
   void initialiseClass();
+
+  /// resolveClass - If the class has not been resolved yet, resolve it.
+  ///
   void resolveClass(bool doClinit);
 
 #ifndef MULTIPLE_VM
+  /// getStatus - Get the resolution/initialization status of this class.
+  ///
   JavaState* getStatus() {
     return &status;
   }
+  /// isReady - Has this class been initialized?
+  ///
   bool isReady() {
     return status == ready;
   }
@@ -260,16 +362,33 @@
     return *getStatus() == ready;
   }
 #endif
+
+  /// isResolved - Has this class been resolved?
+  ///
   bool isResolved() {
     return status >= resolved;
   }
   
+  /// CommonClass - Create a class with th given name.
+  ///
   CommonClass(Jnjvm* vm, const UTF8* name, bool isArray);
   
+  /// VT - The virtual table of instances of this class (TODO: should be
+  /// removed).
+  ///
   static VirtualTable* VT;
+
+  /// jnjvmClassLoader - The bootstrap class loader (null).
+  ///
   static JavaObject* jnjvmClassLoader;
   
+  /// ~CommonClass - Free memory used by this class, and remove it from
+  /// metadata.
+  ///
   ~CommonClass();
+
+  /// CommonClass - Default constructor.
+  ///
   CommonClass();
 
 };

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=53139&r1=53138&r2=53139&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Fri Jul  4 15:47:54 2008
@@ -905,7 +905,7 @@
   
   // We don't need the lock here, and Java requires to load the classes in the
   // try clause, which may require compilation. Therefore we release the lock
-  // and aquire it after the exception table is read.
+  // and acquire it after the exception table is read.
   mvm::jit::executionEngine->lock.release();
   for (uint16 i = 0; i < nbe - sync; ++i) {
     Exception* ex = new Exception();
@@ -1090,7 +1090,7 @@
   if (type == JavaCtpInfo::ConstantString) {
     Value* toPush = 0;
     if (ctpInfo->ctpRes[index] == 0) {
-      compilingClass->aquire();
+      compilingClass->acquire();
       if (ctpInfo->ctpRes[index] == 0) {
         const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]);
         void* val = 0;

Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=53139&r1=53138&r2=53139&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Fri Jul  4 15:47:54 2008
@@ -319,7 +319,7 @@
   if (cl->isArray || cl->isPrimitive) {
     *status = ready;
   } else if (!(*status == ready)) {
-    cl->aquire();
+    cl->acquire();
     JavaState* status = cl->getStatus();
     if (*status == ready) {
       cl->release();
@@ -381,7 +381,7 @@
 
 void Jnjvm::resolveClass(CommonClass* cl, bool doClinit) {
   if (cl->status < resolved) {
-    cl->aquire();
+    cl->acquire();
     int status = cl->status;
     if (status >= resolved) {
       cl->release();
@@ -399,7 +399,7 @@
         cl->status = readed;
         cl->release();
         loadParents((Class*)cl);
-        cl->aquire(); 
+        cl->acquire(); 
         cl->status = prepared;
         TheModule->resolveVirtualClass((Class*)cl);
         cl->status = resolved;
@@ -429,7 +429,7 @@
       if (bytes) {
         if (!cl) cl = bootstrapVM->constructClass(bootstrapName, loader);
         if (cl->status == hashed) {
-          cl->aquire();
+          cl->acquire();
           if (cl->status == hashed) {
             cl->status = loaded;
             ((Class*)cl)->bytes = bytes;
@@ -782,7 +782,7 @@
 
 #ifndef MULTIPLE_VM
 JavaObject* Jnjvm::getClassDelegatee(CommonClass* cl) {
-  cl->aquire();
+  cl->acquire();
   if (!(cl->delegatee)) {
     JavaObject* delegatee = (*Classpath::newClass)(this);
     cl->delegatee = delegatee;
@@ -799,7 +799,7 @@
 }
 #else
 JavaObject* Jnjvm::getClassDelegatee(CommonClass* cl) {
-  cl->aquire();
+  cl->acquire();
   JavaObject* val = delegatees->lookup(cl);
   if (!val) {
     val = (*Classpath::newClass)(this);





More information about the vmkit-commits mailing list