[vmkit-commits] [vmkit] r108430 - in /vmkit/trunk: lib/J3/VMCore/JavaObject.cpp tools/j3/Makefile tools/testAllocator/Main.cpp tools/testAllocator/Makefile tools/testCollector/Main.cpp tools/testCollector/Makefile tools/vmjc/Makefile

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Jul 15 10:35:48 PDT 2010


Author: geoffray
Date: Thu Jul 15 12:35:47 2010
New Revision: 108430

URL: http://llvm.org/viewvc/llvm-project?rev=108430&view=rev
Log:
Patch for 64 bits by Minas Abrahamyan!


Modified:
    vmkit/trunk/lib/J3/VMCore/JavaObject.cpp
    vmkit/trunk/tools/j3/Makefile
    vmkit/trunk/tools/testAllocator/Main.cpp
    vmkit/trunk/tools/testAllocator/Makefile
    vmkit/trunk/tools/testCollector/Main.cpp
    vmkit/trunk/tools/testCollector/Makefile
    vmkit/trunk/tools/vmjc/Makefile

Modified: vmkit/trunk/lib/J3/VMCore/JavaObject.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaObject.cpp?rev=108430&r1=108429&r2=108430&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaObject.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaObject.cpp Thu Jul 15 12:35:47 2010
@@ -25,7 +25,7 @@
 /// hashCode - Return the hash code of this object.
 uint32_t JavaObject::hashCode(JavaObject* self) {
   llvm_gcroot(self, 0);
-  if (!mvm::MovesObject) return (uint32_t)self;
+  if (!mvm::MovesObject) return (uint32_t)(long)self;
 
   uintptr_t oldLock = self->lock.lock;
   uintptr_t val = (oldLock & mvm::HashMask) >> mvm::GCBits;

Modified: vmkit/trunk/tools/j3/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/j3/Makefile?rev=108430&r1=108429&r2=108430&view=diff
==============================================================================
--- vmkit/trunk/tools/j3/Makefile (original)
+++ vmkit/trunk/tools/j3/Makefile Thu Jul 15 12:35:47 2010
@@ -34,7 +34,7 @@
 else
 
 USEDLIBS = J3.a Classpath.a J3.a J3Compiler.a Allocator.a \
-	   Mvm.a MvmCompiler.a $(GCLIB).a CommonThread.a
+	   Mvm.a MvmCompiler.a $(GCLIB).a Allocator.a CommonThread.a
 
   ifeq ($(ISOLATE_SHARING_BUILD), 1) 
     USEDLIBS += Isolate

Modified: vmkit/trunk/tools/testAllocator/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/testAllocator/Main.cpp?rev=108430&r1=108429&r2=108430&view=diff
==============================================================================
--- vmkit/trunk/tools/testAllocator/Main.cpp (original)
+++ vmkit/trunk/tools/testAllocator/Main.cpp Thu Jul 15 12:35:47 2010
@@ -14,6 +14,28 @@
 #include <math.h>
 #include <sys/time.h>
 
+#include <sys/resource.h>
+void set_stack_size(uint Mbs)
+{
+    const rlim_t kStackSize = Mbs * 1024 * 1024;
+    struct rlimit rl;
+    int result;
+
+    result = getrlimit(RLIMIT_STACK, &rl);
+    if (result == 0)
+    {
+        if (rl.rlim_cur < kStackSize)
+        {
+            rl.rlim_cur = kStackSize;
+            result = setrlimit(RLIMIT_STACK, &rl);
+            if (result != 0)
+              fprintf(stderr, "setrlimit returned result = %d\n", result);
+            else
+              fprintf(stderr, "setrlimit OK\n");
+        }
+    }
+}
+
 unsigned int rand(unsigned int min, unsigned int max) {
 	return (unsigned int)nearbyint((((double)(max - min))*::rand())/(RAND_MAX + 1.0)) + min;
 }
@@ -61,8 +83,8 @@
 			nf++;
 	}
 
-	printf("; %d allocations (%d reallocations, %d free, %d chunks)\n", na, nr, nf, no);
-	printf(";   Allocated: %d bytes, current %d bytes\n", totAllocated, curAllocated);
+	printf("; %lu allocations (%lu reallocations, %lu free, %lu chunks)\n", na, nr, nf, no);
+	printf(";   Allocated: %lu bytes, current %lu bytes\n", totAllocated, curAllocated);
 	
 	struct timeval diff;
 	timersub(end, start, &diff);
@@ -71,7 +93,7 @@
 }
 
 void mesureAllocateur() {
-	size_t n = 512*1024;
+	size_t n = 512*1024; //512K 4bytes==2Mb, times3=6Mb; for x86_64:12Mb
 	size_t* vals = (size_t*)alloca(sizeof(size_t) * n);
 	size_t* reallocs = (size_t*)alloca(sizeof(size_t) * n);
 	size_t* frees = (size_t*)alloca(sizeof(size_t) * n);
@@ -116,6 +138,8 @@
 }
 
 int main(int argc, char **argv) {
+	if( sizeof(size_t) > 4) //bogus check for 64bits
+	  set_stack_size(16); //update min stack size to 16 MB for mesureAllocateur()
 	mesureAllocateur();
 
 	GCHash::destroy();

Modified: vmkit/trunk/tools/testAllocator/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/testAllocator/Makefile?rev=108430&r1=108429&r2=108430&view=diff
==============================================================================
--- vmkit/trunk/tools/testAllocator/Makefile (original)
+++ vmkit/trunk/tools/testAllocator/Makefile Thu Jul 15 12:35:47 2010
@@ -9,7 +9,7 @@
 LEVEL = ../..
 
 TOOLNAME = testAllocator
-USEDLIBS = Allocator
+USEDLIBS = Allocator.a
 
 include $(LEVEL)/Makefile.common
 

Modified: vmkit/trunk/tools/testCollector/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/testCollector/Main.cpp?rev=108430&r1=108429&r2=108430&view=diff
==============================================================================
--- vmkit/trunk/tools/testCollector/Main.cpp (original)
+++ vmkit/trunk/tools/testCollector/Main.cpp Thu Jul 15 12:35:47 2010
@@ -7,37 +7,29 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "mvm/GC/GC.h"
+#include "MvmGC.h"
 #include "mvm/Threads/Thread.h"
 #include <stdio.h>
 
-mvm::Key<mvm::Thread>* mvm::Thread::threadKey = 0;
-
 void destr(gc *me, size_t sz) {
- 	printf("Destroy %p\n", me);
+ 	printf("Destroy %p\n", (void*)me);
 }
 
 void trace(gc *me, size_t sz) {
-	// 	printf("Trace %p\n", me);
+	// printf("Trace %p\n", (void*)me);
 }
 
 void marker(void*) {
-	//	printf("Marker...\n");
+	// printf("Marker...\n");
 }
 
 int main(int argc, char **argv) {
-  mvm::Thread::initialise();
-  Collector::initialise(marker, 0);
+  mvm::Collector::initialise();
 #ifdef MULTIPLE_GC
   mvm::Thread::get()->GC->destroy();
 #else
-  Collector::destroy();
+  mvm::Collector::destroy();
 #endif
   return 0;
 }
 
-
-
-
-
-

Modified: vmkit/trunk/tools/testCollector/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/testCollector/Makefile?rev=108430&r1=108429&r2=108430&view=diff
==============================================================================
--- vmkit/trunk/tools/testCollector/Makefile (original)
+++ vmkit/trunk/tools/testCollector/Makefile Thu Jul 15 12:35:47 2010
@@ -8,8 +8,10 @@
 ##===----------------------------------------------------------------------===##
 LEVEL = ../..
 
-TOOLNAME = CollectorTest
-USEDLIBS = Allocator GCMmap2 CommonThread
+TOOLNAME = testCollector
+USEDLIBS=GCMmap2.a CommonThread.a Allocator.a GCMmap2.a Mvm.a GCMmap2.a
+
+LINK_COMPONENTS = support
 
 include $(LEVEL)/Makefile.common
 

Modified: vmkit/trunk/tools/vmjc/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/vmjc/Makefile?rev=108430&r1=108429&r2=108430&view=diff
==============================================================================
--- vmkit/trunk/tools/vmjc/Makefile (original)
+++ vmkit/trunk/tools/vmjc/Makefile Thu Jul 15 12:35:47 2010
@@ -26,7 +26,7 @@
 else
 
   USEDLIBS = J3.a Classpath.a J3.a J3Compiler.a Allocator.a \
-	     Mvm.a MvmCompiler.a $(GCLIB).a CommonThread.a
+	     Mvm.a MvmCompiler.a $(GCLIB).a Allocator.a CommonThread.a
 endif
 
 LINK_COMPONENTS = jit nativecodegen scalaropts instrumentation ipa ipo bitwriter bitreader asmparser linker





More information about the vmkit-commits mailing list