[llvm-commits] [vmkit] r51039 - in /vmkit/trunk/lib/JnJVM: Classpath/ClasspathVMRuntime.cpp VMCore/JavaArray.cpp VMCore/JavaArray.h VMCore/JavaJIT.cpp VMCore/LockedMap.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue May 13 07:26:11 PDT 2008


Author: geoffray
Date: Tue May 13 09:26:11 2008
New Revision: 51039

URL: http://llvm.org/viewvc/llvm-project?rev=51039&view=rev
Log:
Simplify UTF8 class


Modified:
    vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h
    vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
    vmkit/trunk/lib/JnJVM/VMCore/LockedMap.cpp

Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp?rev=51039&r1=51038&r2=51039&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMRuntime.cpp Tue May 13 09:26:11 2008
@@ -46,7 +46,7 @@
   sint32 lgPre = vm->prelib->size;
   sint32 lgPost = vm->postlib->size;
 
-  UTF8* res = UTF8::acons(lgPre + lgLib + lgPost, JavaArray::ofChar, vm);
+  UTF8* res = (UTF8*)UTF8::acons(lgPre + lgLib + lgPost, JavaArray::ofChar, vm);
 
   memmove(res->elements, vm->prelib->elements, lgPre * sizeof(uint16));
   memmove(&(res->elements[lgPre]), &(utf8Lib->elements[stLib]), lgLib * sizeof(uint16));

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp Tue May 13 09:26:11 2008
@@ -94,36 +94,15 @@
 ARRAYCLASS(ArrayLong,   sint64, 8)
 ARRAYCLASS(ArrayFloat,  float, 4)
 ARRAYCLASS(ArrayDouble, double, 8)
-ARRAYCLASS(UTF8, uint16, 2)
-
-AT(ArrayObject, JavaObject*)
+ARRAYCLASS(ArrayObject, JavaObject*, sizeof(JavaObject*))
 
 #undef ARRAYCLASS
 #undef ACONS
 #undef AT
 
-ArrayObject *ArrayObject::acons(sint32 n, ClassArray* atype, Jnjvm* vm) {
-  if (n < 0)
-    JavaThread::get()->isolate->negativeArraySizeException(n);
-  else if (n > JavaArray::MaxArraySize)
-    JavaThread::get()->isolate->outOfMemoryError(n);
-  ArrayObject* res = (ArrayObject*)
-#ifndef MULTIPLE_VM
-    (Object*) operator new(sizeof(ArrayObject) + n * sizeof(JavaObject*), JavaObject::VT);
-#else
-    (Object*) vm->allocateObject(sizeof(ArrayObject) + n * sizeof(JavaObject*), JavaObject::VT);
-#endif
-  res->initialise(atype);
-  res->size = n;
-  res->setVirtualTable(ArrayObject::VT);
-  return res;
-}
-
-
 void JavaArray::print(mvm::PrintBuffer *buf) const {
   assert(0 && "should not be here");
 }
-
   
 void ArrayUInt8::print(mvm::PrintBuffer *buf) const {
   buf->write("Array<");

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h Tue May 13 09:26:11 2008
@@ -85,31 +85,15 @@
 ARRAYCLASS(ArrayLong,   sint64);
 ARRAYCLASS(ArrayFloat,  float);
 ARRAYCLASS(ArrayDouble, double);
+ARRAYCLASS(ArrayObject, JavaObject*);
 
 #undef ARRAYCLASS
 
-class ArrayObject : public JavaArray {
+class UTF8 : public ArrayUInt16 {
 public:
   static VirtualTable* VT;
-  static const llvm::Type* llvmType;
-  JavaObject* elements[0];
-  static ArrayObject *acons(sint32 n, ClassArray* cl, Jnjvm* vm);
-  JavaObject* at(sint32) const;
-  void setAt(sint32, JavaObject*);
-  virtual void print(mvm::PrintBuffer* buf) const;
-  virtual void TRACER;
-};
-
-class UTF8 : public JavaArray {
-public:
-  static VirtualTable* VT;
-  uint16 elements[0];
 
   static const llvm::Type* llvmType;
-  static UTF8* acons(sint32 n, ClassArray* cl, Jnjvm* vm);
-  
-  unsigned short int at(sint32) const;
-  void setAt(sint32, uint16);
   
   virtual void print(mvm::PrintBuffer* buf) const;
 

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Tue May 13 09:26:11 2008
@@ -1010,7 +1010,7 @@
           val = (void*)utf8;
           compilingClass->isolate->protectModule->lock();
           gv =
-            new GlobalVariable(UTF8::llvmType, false, 
+            new GlobalVariable(ArrayUInt16::llvmType, false, 
                                GlobalValue::ExternalLinkage,
                                constantUTF8Null, "",
                                compilingClass->isolate->module);

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LockedMap.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LockedMap.cpp Tue May 13 09:26:11 2008
@@ -90,7 +90,7 @@
   }
 
   if (res == 0) {
-    UTF8* tmp = UTF8::acons(size, JavaArray::ofChar, vm);
+    UTF8* tmp = (UTF8*)UTF8::acons(size, JavaArray::ofChar, vm);
     for (sint32 i = 0; i < size; i++) {
       tmp->setAt(i, asciiz[i]);
     }
@@ -119,7 +119,7 @@
   }
 
   if (res == 0) {
-    UTF8* tmp = UTF8::acons(size, JavaArray::ofChar, vm);
+    UTF8* tmp = (UTF8*)UTF8::acons(size, JavaArray::ofChar, vm);
     memcpy(tmp->elements, buf, len * sizeof(uint16));
     res = (const UTF8*)tmp;
     map.insert(std::make_pair(key, res));





More information about the llvm-commits mailing list