[llvm-commits] [vmkit] r52412 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaArray.cpp JavaArray.h LockedMap.h
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Tue Jun 17 09:30:12 PDT 2008
Author: geoffray
Date: Tue Jun 17 11:30:12 2008
New Revision: 52412
URL: http://llvm.org/viewvc/llvm-project?rev=52412&view=rev
Log:
Custom allocation of UTF8.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h
vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp?rev=52412&r1=52411&r2=52412&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp Tue Jun 17 11:30:12 2008
@@ -150,14 +150,17 @@
return buf;
}
+void* UTF8::operator new(size_t sz, sint32 size) {
+ return malloc(sz + size * sizeof(uint16));
+}
+
const UTF8* UTF8::acons(sint32 n, ClassArray* cl, Jnjvm* vm) {
if (n < 0)
negativeArraySizeException(n);
else if (n > JavaArray::MaxArraySize)
outOfMemoryError(n);
- UTF8* res = (UTF8*) malloc(sizeof(UTF8) + n * sizeof(uint16));
- ((void**)res)[0] = ArrayUInt16::VT;
+ UTF8* res = new (n) UTF8();
res->initialise(cl);
res->size = n;
- return (const UTF8*)res;
+ return (const UTF8*)res;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h?rev=52412&r1=52411&r2=52412&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h Tue Jun 17 11:30:12 2008
@@ -113,6 +113,7 @@
#endif
virtual void print(mvm::PrintBuffer* buf) const;
+ void* operator new(size_t sz, sint32 size);
};
} // end namespace jnjvm
Modified: vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h?rev=52412&r1=52411&r2=52412&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Tue Jun 17 11:30:12 2008
@@ -119,7 +119,7 @@
~UTF8Map() {
delete lock;
for (iterator i = map.begin(), e = map.end(); i!= e; ++i) {
- free((void*)i->second);
+ delete(i->second);
}
}
More information about the llvm-commits
mailing list