[llvm-commits] [vmkit] r50855 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaArray.cpp JavaClass.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Thu May 8 09:05:34 PDT 2008
Author: geoffray
Date: Thu May 8 11:05:34 2008
New Revision: 50855
URL: http://llvm.org/viewvc/llvm-project?rev=50855&view=rev
Log:
Do not memset to zero newly-allocated objets. The allocator
already does it.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp?rev=50855&r1=50854&r2=50855&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaArray.cpp Thu May 8 11:05:34 2008
@@ -52,7 +52,6 @@
(Object*) operator new(sizeof(name) + n * primSize, name::VT); \
res->initialise(atype); \
res->size = n; \
- memset(res->elements, 0, primSize * n); \
return res; \
}
#else
@@ -66,7 +65,6 @@
(Object*) vm->allocateObject(sizeof(name) + n * primSize, name::VT); \
res->initialise(atype); \
res->size = n; \
- memset(res->elements, 0, primSize * n); \
return res; \
}
#endif
@@ -117,7 +115,6 @@
#endif
res->initialise(atype);
res->size = n;
- memset(res->elements, 0, sizeof(JavaObject*) * n);
res->setVirtualTable(ArrayObject::VT);
return res;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=50855&r1=50854&r2=50855&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Thu May 8 11:05:34 2008
@@ -354,27 +354,27 @@
#ifndef MULTIPLE_VM
JavaObject* Class::doNew(Jnjvm* vm) {
JavaObject* res = (JavaObject*)gc::operator new(virtualSize, virtualVT);
- memcpy(res, virtualInstance, virtualSize);
+ res->classOf = this;
return res;
}
// Copy doNew because LLVM wants two different pointers (for simplicity)
JavaObject* Class::doNewUnknown(Jnjvm* vm) {
JavaObject* res = (JavaObject*)gc::operator new(virtualSize, virtualVT);
- memcpy(res, virtualInstance, virtualSize);
+ res->classOf = this;
return res;
}
#else
JavaObject* Class::doNew(Jnjvm* vm) {
JavaObject* res = (JavaObject*)vm->allocateObject(virtualSize, virtualVT);
- memcpy(res, virtualInstance, virtualSize);
+ res->classOf = this;
return res;
}
// Copy doNew because LLVM wants two different pointers (for simplicity)
JavaObject* Class::doNewUnknown(Jnjvm* vm) {
JavaObject* res = (JavaObject*)vm->allocateObject(virtualSize, virtualVT);
- memcpy(res, virtualInstance, virtualSize);
+ res->classOf = this;
return res;
}
#endif
More information about the llvm-commits
mailing list