[llvm-commits] [vmkit] r48832 - in /vmkit/trunk: ./ include/mvm/ include/mvm/Threads/ lib/JnJVM/Classpath/ lib/JnJVM/VMCore/ lib/Mvm/ lib/Mvm/Allocator/ lib/Mvm/GCMmap2/
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Wed Mar 26 11:39:45 PDT 2008
Author: geoffray
Date: Wed Mar 26 13:39:44 2008
New Revision: 48832
URL: http://llvm.org/viewvc/llvm-project?rev=48832&view=rev
Log:
Make vmkit compile on x86_64. Initial patch by Torok Edwin.
Modified:
vmkit/trunk/include/mvm/Method.h
vmkit/trunk/include/mvm/Object.h
vmkit/trunk/include/mvm/PrintBuffer.h
vmkit/trunk/include/mvm/Threads/Key.h
vmkit/trunk/lib/JnJVM/Classpath/Classpath.h.in
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp
vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h
vmkit/trunk/lib/JnJVM/VMCore/LowerArrayLength.cpp
vmkit/trunk/lib/JnJVM/VMCore/Zip.cpp
vmkit/trunk/lib/JnJVM/VMCore/Zip.h
vmkit/trunk/lib/Mvm/Allocator/gcalloc.cc
vmkit/trunk/lib/Mvm/Allocator/gcalloc.h
vmkit/trunk/lib/Mvm/Allocator/gcchunk.cc
vmkit/trunk/lib/Mvm/Allocator/gcchunk.h
vmkit/trunk/lib/Mvm/Allocator/gcmapper.cc
vmkit/trunk/lib/Mvm/Allocator/gcmapper.h
vmkit/trunk/lib/Mvm/EscapeAnalysis.cpp
vmkit/trunk/lib/Mvm/GCMmap2/gc.cc
vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cc
vmkit/trunk/lib/Mvm/Object.cc
vmkit/trunk/vmkit-llvm-svn.patch
Modified: vmkit/trunk/include/mvm/Method.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Method.h?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Method.h (original)
+++ vmkit/trunk/include/mvm/Method.h Wed Mar 26 13:39:44 2008
@@ -47,11 +47,11 @@
inline Method *method(Method *m, size_t nbb) {
return
- (Method *)gcset((gc **)((unsigned int)this + nbb + 4 - sizeof(Method *)), m);
+ (Method *)gcset((gc **)((uintptr_t)this + nbb), m);
}
inline Method *method(size_t nbb) {
- return ((Method **)((unsigned int)this + nbb + 4 - sizeof(Method *)))[0];
+ return ((Method **)((uintptr_t)this + nbb))[0];
}
inline Method *method(Method *m) { return method(m, objectSize()); }
@@ -68,12 +68,12 @@
inline void *frameRegister(void *m, size_t nbb) {
return
- (void *)gcset((gc **)((unsigned int)this + nbb + 4 - sizeof(void *)),
+ (void *)gcset((gc **)((uintptr_t)this + nbb),
(Object*)m);
}
inline void *frameRegister(size_t nbb) {
- return ((void **)((unsigned int)this + nbb + 4 - sizeof(void *)))[0];
+ return ((void **)((uintptr_t)this + nbb))[0];
}
inline void *frameRegister(void *m) { return frameRegister(m, objectSize()); }
Modified: vmkit/trunk/include/mvm/Object.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Object.h?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Object.h (original)
+++ vmkit/trunk/include/mvm/Object.h Wed Mar 26 13:39:44 2008
@@ -12,6 +12,7 @@
#include <assert.h>
+#include "types.h"
#include "mvm/GC/GC.h"
namespace mvm {
@@ -56,7 +57,7 @@
virtual void destroyer(size_t) {}
virtual void tracer(size_t) {}
virtual void print(PrintBuffer *buf) const;
- virtual int hashCode(){ return (int)this;}
+ virtual intptr_t hashCode(){ return (intptr_t)this;}
protected:
static Object **rootTable;
Modified: vmkit/trunk/include/mvm/PrintBuffer.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/PrintBuffer.h?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/PrintBuffer.h (original)
+++ vmkit/trunk/include/mvm/PrintBuffer.h Wed Mar 26 13:39:44 2008
@@ -113,7 +113,7 @@
inline PrintBuffer *writePtr(void *p) {
char buf[32];
- sprintf(buf, "%08x", (int)p);
+ sprintf(buf, "%p", p);
return write(buf);
}
Modified: vmkit/trunk/include/mvm/Threads/Key.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Key.h?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Threads/Key.h (original)
+++ vmkit/trunk/include/mvm/Threads/Key.h Wed Mar 26 13:39:44 2008
@@ -20,7 +20,7 @@
class ThreadKey {
public:
- void * val;
+ pthread_key_t val;
ThreadKey(void (*_destr)(void *));
ThreadKey();
Modified: vmkit/trunk/lib/JnJVM/Classpath/Classpath.h.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/Classpath.h.in?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/Classpath.h.in (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/Classpath.h.in Wed Mar 26 13:39:44 2008
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
-char* GNUClasspathLibs = "@classpathlibs@";
-char* GNUClasspathGlibj = "@classpathglibj@";
-char* GNUClasspathVersion = "@gnuclasspathversion@";
+const char* GNUClasspathLibs = "@classpathlibs@";
+const char* GNUClasspathGlibj = "@classpathglibj@";
+const char* GNUClasspathVersion = "@gnuclasspathversion@";
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp Wed Mar 26 13:39:44 2008
@@ -103,7 +103,7 @@
jclass clazz,
#endif
jobject obj) {
- return (jint)obj;
+ return (jint)(intptr_t)obj;
}
}
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp Wed Mar 26 13:39:44 2008
@@ -72,7 +72,7 @@
bool native = isNative(meth->access);
JavaObject* res = (*Classpath::newStackTraceElement)();
- Classpath::initStackTraceElement->invokeIntSpecial(res, sourceName, (int)ip, className, methodName, native);
+ Classpath::initStackTraceElement->invokeIntSpecial(res, sourceName, (uint32)ip, className, methodName, native);
return res;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaBacktrace.cpp Wed Mar 26 13:39:44 2008
@@ -125,15 +125,15 @@
mvm::jit::executionEngine->getGlobalValueAtAddress(begIp + 1);
if (glob) {
if (llvm::isa<llvm::Function>(glob)) {
- printf("; 0x%08x in %s\n", (uint32) ip,
+ printf("; 0x%p in %s\n", ip,
((llvm::Function*)glob)->getNameStr().c_str());
} else JavaThread::get()->isolate->unknownError("in global variable?");
- } else printf("; 0x%08x in stub\n", (uint32) ip);
+ } else printf("; 0x%p in stub\n", ip);
} else {
Dl_info info;
int res = dladdr(begIp, &info);
if (res != 0) {
- printf("; 0x%08x in %s\n", (uint32) ip, info.dli_fname);
+ printf("; 0x%p in %s\n", ip, info.dli_fname);
}
}
fp = debug_frame_caller_fp(fp);
@@ -156,18 +156,18 @@
mvm::Method* m = c->method();
JavaMethod* meth = (JavaMethod*)m->definition();
if (meth)
- printf("; 0x%08x in %s\n", (uint32) ips[n - 1], meth->printString());
+ printf("; 0x%p in %s\n", ips[n - 1], meth->printString());
else
- printf("; 0x%08x in %s\n", (uint32) ips[n - 1], ((llvm::Function*)glob)->getNameStr().c_str());
+ printf("; 0x%p in %s\n", ips[n - 1], ((llvm::Function*)glob)->getNameStr().c_str());
} else JavaThread::get()->isolate->unknownError("in global variable?");
- } else printf("; 0x%08x in stub\n", (uint32) ips[n - 1]);
+ } else printf("; 0x%p in stub\n", ips[n - 1]);
} else {
Dl_info info;
int res = dladdr(begIp, &info);
if (res != 0) {
- printf("; 0x%08x in %s\n", (uint32) ips[n - 1], info.dli_fname);
+ printf("; 0x%p in %s\n", ips[n - 1], info.dli_fname);
} else {
- printf("; 0x%08x in Unknown\n", (uint32) ips[n - 1]);
+ printf("; 0x%p in Unknown\n", ips[n - 1]);
}
}
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Wed Mar 26 13:39:44 2008
@@ -63,14 +63,14 @@
assert(0 && "implement me");
}
-extern "C" int strnstr(char *haystack, char *needle) {
+extern "C" int strnstr(const char *haystack, const char *needle) {
char * res = strstr(haystack, needle);
- if (res) return (int)res - (int)haystack;
+ if (res) return res - haystack;
else return -1;
}
-static char* findInformation(ArrayUInt8* manifest, char* entry, uint32 len) {
+static char* findInformation(ArrayUInt8* manifest, const char* entry, uint32 len) {
uint8* ptr = manifest->elements;
sint32 index = strnstr((char*)ptr, entry);
if (index != -1) {
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp Wed Mar 26 13:39:44 2008
@@ -199,14 +199,14 @@
pos++;
} else {
AssessorDesc * typeIntern = dTab;
- while (name->at(++pos) == I_TAB);
+ while (name->at(++pos) == I_TAB) {}
analyseIntern(name, pos, 1, typeIntern, pos);
}
ass = dTab;
ret = pos;
} else if (cur == I_REF) {
if (meth != 2) {
- while (name->at(++pos) != I_END_REF);
+ while (name->at(++pos) != I_END_REF) {}
}
ass = dRef;
ret = pos + 1;
Modified: vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LockedMap.h Wed Mar 26 13:39:44 2008
@@ -30,8 +30,6 @@
class JavaObject;
class Jnjvm;
-class llvm::Function;
-class llvm::GlobalVariable;
template<class Key, class Container, class Compare>
class LockedMap : public mvm::Object {
Modified: vmkit/trunk/lib/JnJVM/VMCore/LowerArrayLength.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LowerArrayLength.cpp?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LowerArrayLength.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LowerArrayLength.cpp Wed Mar 26 13:39:44 2008
@@ -21,7 +21,7 @@
using namespace llvm;
-namespace {
+namespace mvm {
class VISIBILITY_HIDDEN LowerArrayLength : public FunctionPass {
public:
@@ -33,7 +33,6 @@
};
char LowerArrayLength::ID = 0;
RegisterPass<LowerArrayLength> X("LowerArrayLength", "Lower Array length");
-}
bool LowerArrayLength::runOnFunction(Function& F) {
bool Changed = false;
@@ -63,10 +62,8 @@
return Changed;
}
-namespace mvm {
-LowerArrayLength* createLowerArrayLengthPass() {
+FunctionPass* createLowerArrayLengthPass() {
return new LowerArrayLength();
}
-
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/Zip.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Zip.cpp?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Zip.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Zip.cpp Wed Mar 26 13:39:44 2008
@@ -37,7 +37,7 @@
return 0;
}
-ZipFile* ZipArchive::getFile(char* filename) {
+ZipFile* ZipArchive::getFile(const char* filename) {
ZipFile* res = filetable->lookup(filename);
return res;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/Zip.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Zip.h?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Zip.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Zip.h Wed Mar 26 13:39:44 2008
@@ -59,7 +59,7 @@
static ZipArchive* hashedArchive(char* archname);
static ZipArchive* singleArchive(char* archname);
- ZipFile* getFile(char* filename);
+ ZipFile* getFile(const char* filename);
int readFile(ArrayUInt8* array, const ZipFile* file);
void remove();
Modified: vmkit/trunk/lib/Mvm/Allocator/gcalloc.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/gcalloc.cc?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Allocator/gcalloc.cc (original)
+++ vmkit/trunk/lib/Mvm/Allocator/gcalloc.cc Wed Mar 26 13:39:44 2008
@@ -8,40 +8,42 @@
//===----------------------------------------------------------------------===//
#include "gcalloc.h"
+#include "types.h"
-GCChunkNode *GCAllocator::alloc_headers(size_t headers_nbb, void *base, size_t depl, size_t filled) {
+GCChunkNode *GCAllocator::alloc_headers(uintptr_t headers_nbb, void *base,
+ uintptr_t depl, uintptr_t filled) {
GCChunkNode *headers;
- size_t rounded = GCMappedArea::round(headers_nbb);
+ uintptr_t rounded = GCMappedArea::round(headers_nbb);
if(headers_nbb == rounded)
headers = (GCChunkNode *)(new GCMappedArea(&headers_area, rounded))->area();
else {
headers = used_headers;
- used_headers = (GCChunkNode *)((unsigned int)used_headers + headers_nbb);
+ used_headers = (GCChunkNode *)((uintptr_t)used_headers + headers_nbb);
if(used_headers >= max_headers) {
headers = (GCChunkNode *)(new GCMappedArea(&headers_area, used_headers_nbb))->area();
- used_headers = (GCChunkNode *)((unsigned int)headers + headers_nbb);
- max_headers = (GCChunkNode *)((unsigned int)headers + used_headers_nbb);
+ used_headers = (GCChunkNode *)((uintptr_t)headers + headers_nbb);
+ max_headers = (GCChunkNode *)((uintptr_t)headers + used_headers_nbb);
}
}
register GCChunkNode *cur = headers;
- register GCChunkNode *lim = (GCChunkNode *)((unsigned int)headers + headers_nbb);
+ register GCChunkNode *lim = (GCChunkNode *)((uintptr_t)headers + headers_nbb);
register GCChunkNode *max = lim - (1 + filled);
for(;cur<max; cur++) {
cur->initialise(cur+1, base);
- base = (void *)((unsigned int)base + depl);
+ base = (void *)((uintptr_t)base + depl);
}
for(;cur<lim; cur++) {
cur->initialise(0, base);
- base = (void *)((unsigned int)base + depl);
+ base = (void *)((uintptr_t)base + depl);
}
return headers;
}
-GCChunkNode *GCAllocator::alloc_list(GCFreeList *fl, size_t n) {
+GCChunkNode *GCAllocator::alloc_list(GCFreeList *fl, uintptr_t n) {
GCChunkNode *headers;
- size_t area_nbb;
+ uintptr_t area_nbb;
void *area_ptr;
GCPage *page;
@@ -54,7 +56,7 @@
headers = page->headers();
} else {
- size_t chunk_nbb = fl->chunk_nbb();
+ uintptr_t chunk_nbb = fl->chunk_nbb();
/* on alloue un Descripteur */
page = new GCPage(&normal_area, area_nbb = fl->area_nbb(), chunk_nbb);
@@ -122,8 +124,8 @@
GCHash::unlink();
}
-void *GCAllocator::operator new(size_t req) {
- size_t nbb = GCMappedArea::round(req);
+void *GCAllocator::operator new(uintptr_t req) {
+ uintptr_t nbb = GCMappedArea::round(req);
GCAllocator *res = (GCAllocator *)GCMappedArea::do_mmap(nbb);
res->my_size = nbb;
return res;
Modified: vmkit/trunk/lib/Mvm/Allocator/gcalloc.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/gcalloc.h?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Allocator/gcalloc.h (original)
+++ vmkit/trunk/lib/Mvm/Allocator/gcalloc.h Wed Mar 26 13:39:44 2008
@@ -13,18 +13,19 @@
#include <string.h> /* memset */
#include "gcchunk.h"
+#include "types.h"
class GCFreeList {
GCChunkNode *_list;
- size_t _chunk_nbb;
- size_t _area_nbb;
- size_t _nb_chunks;
- size_t _headers_nbb;
- size_t _filled;
+ uintptr_t _chunk_nbb;
+ uintptr_t _area_nbb;
+ uintptr_t _nb_chunks;
+ uintptr_t _headers_nbb;
+ uintptr_t _filled;
public:
inline GCFreeList() { _chunk_nbb = 0; _nb_chunks = 1; }
- inline void initialise(size_t n, size_t area) {
+ inline void initialise(uintptr_t n, uintptr_t area) {
_list = 0;
_chunk_nbb = n;
_area_nbb = GCMappedArea::round(area); /* taille en pages utilisée pour une free-list */
@@ -37,11 +38,11 @@
inline GCChunkNode *list() { return _list; }
inline void list(GCChunkNode *l) { _list = l; }
- inline size_t nb_chunks() { return _nb_chunks; }
- inline size_t chunk_nbb() { return _chunk_nbb; }
- inline size_t area_nbb() { return _area_nbb; }
- inline size_t headers_nbb() { return _headers_nbb; }
- inline size_t filled() { return _filled; }
+ inline uintptr_t nb_chunks() { return _nb_chunks; }
+ inline uintptr_t chunk_nbb() { return _chunk_nbb; }
+ inline uintptr_t area_nbb() { return _area_nbb; }
+ inline uintptr_t headers_nbb() { return _headers_nbb; }
+ inline uintptr_t filled() { return _filled; }
inline void reject(GCChunkNode *header) {
header->next(_list);
@@ -66,13 +67,13 @@
GCFreeList lin_lists[nb_lin];
GCFreeList mmap_list;
- inline size_t linEntry(size_t n) { return (n - max_exp - 1)>>lin_step_log; }
+ inline uintptr_t linEntry(uintptr_t n) { return (n - max_exp - 1)>>lin_step_log; }
public:
GCFreeListFinder();
- static inline bool isMmaped(size_t n) { return n>max_lin; }
+ static inline bool isMmaped(uintptr_t n) { return n>max_lin; }
- inline GCFreeList *find(size_t n) {
+ inline GCFreeList *find(uintptr_t n) {
return isMmaped(n) ? &mmap_list : (n>max_exp) ? lin_lists + linEntry(n) : exp_lists[n];
}
};
@@ -80,7 +81,7 @@
class GCAllocator {
static const unsigned int used_headers_nbb = (PAGE_SIZE + (4096*sizeof(GCChunkNode)) - 1) & -PAGE_SIZE;
- size_t my_size;
+ uintptr_t my_size;
GCFreeListFinder undefined_finder;
GCFreeListFinder zero_filled_finder;
@@ -90,18 +91,18 @@
GCChunkNode *used_headers; /* une liste de headers pour les prochaines alloc_list */
GCChunkNode *max_headers; /* la limite */
- GCChunkNode *alloc_headers(size_t, void *, size_t, size_t);
- GCChunkNode *alloc_list(GCFreeList *, size_t);
+ GCChunkNode *alloc_headers(uintptr_t, void *, uintptr_t, uintptr_t);
+ GCChunkNode *alloc_list(GCFreeList *, uintptr_t);
public:
GCAllocator();
~GCAllocator();
- void *operator new(size_t);
+ void *operator new(uintptr_t);
void operator delete(void *);
inline GCPage *o2page(void *ptr) { return GCHash::get(ptr); }
- inline GCChunkNode *alloc_chunk(size_t n, bool isCol, unsigned int m) {
+ inline GCChunkNode *alloc_chunk(uintptr_t n, bool isCol, unsigned int m) {
GCFreeList *fl = undefined_finder.find(n);
register GCChunkNode *res = fl->list();
@@ -133,32 +134,32 @@
reject_chunk(o2page(header->chunk()), header);
}
- inline GCChunkNode *stupid_realloc_chunk(GCChunkNode *old_header, size_t new_nbb) {
+ inline GCChunkNode *stupid_realloc_chunk(GCChunkNode *old_header, uintptr_t new_nbb) {
GCChunkNode *new_header = alloc_chunk(new_nbb, old_header->isCollectable(), old_header->mark());
- size_t old = old_header->nbb();
- size_t nbb = old < new_nbb ? old : new_nbb;
+ uintptr_t old = old_header->nbb();
+ uintptr_t nbb = old < new_nbb ? old : new_nbb;
memcpy(new_header->chunk(), old_header->chunk(), nbb);
return new_header;
}
- inline GCChunkNode *realloc_chunk(GCPage *page, GCChunkNode *old_header, size_t new_nbb) {
+ inline GCChunkNode *realloc_chunk(GCPage *page, GCChunkNode *old_header, uintptr_t new_nbb) {
GCChunkNode *new_header = old_header;
- size_t max_nbb = page->chunk_nbb();
+ uintptr_t max_nbb = page->chunk_nbb();
if(GCFreeListFinder::isMmaped(max_nbb))
if(GCFreeListFinder::isMmaped(new_nbb)) {
/* le plus compliqué, on essaye de faire un mremap d'un petit bout... */
- size_t rounded = GCMappedArea::round(new_nbb);
- size_t old_nbb = page->nbb();
+ uintptr_t rounded = GCMappedArea::round(new_nbb);
+ uintptr_t old_nbb = page->nbb();
signed int depl = rounded - page->nbb();
if(depl)
if(page->mremap(rounded) == -1) /* perdu */
return new_header = stupid_realloc_chunk(old_header, new_nbb);
else {
if(depl > 0)
- GCHash::hash_unprotected(page, (void *)((unsigned int)page->area() + old_nbb), depl, depl);
+ GCHash::hash_unprotected(page, (void *)((uintptr_t)page->area() + old_nbb), depl, depl);
else
- GCHash::hash_unprotected(page, (void *)((unsigned int)page->area() + rounded), -depl, 0);
+ GCHash::hash_unprotected(page, (void *)((uintptr_t)page->area() + rounded), -depl, 0);
}
page->chunk_nbb(rounded);
old_header->nbb(new_nbb);
@@ -172,7 +173,7 @@
return new_header;
}
- inline void *alloc(size_t sz) { return alloc_chunk(sz, 0, 0)->chunk(); }
+ inline void *alloc(uintptr_t sz) { return alloc_chunk(sz, 0, 0)->chunk(); }
inline void free(void *ptr) {
GCPage *page = o2page(ptr);
@@ -184,7 +185,7 @@
reject_chunk(page, header);
}
- inline void *realloc(void *ptr, size_t nbb) {
+ inline void *realloc(void *ptr, uintptr_t nbb) {
GCPage *page = o2page(ptr);
GCChunkNode *header = page->o2node(ptr, GCChunkNode::maskNotCollectable);
Modified: vmkit/trunk/lib/Mvm/Allocator/gcchunk.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/gcchunk.cc?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Allocator/gcchunk.cc (original)
+++ vmkit/trunk/lib/Mvm/Allocator/gcchunk.cc Wed Mar 26 13:39:44 2008
@@ -38,8 +38,8 @@
}
void GCHash::hash_unprotected(GCPage *desc, void *base, unsigned int nbb, unsigned int nbb_map) {
- unsigned int entry = GCHashConst::set_entry(base);
- unsigned int cur_sz = GCHashConst::set_entry_2_ptr(entry + 1) - (unsigned int)base; /* taille restante */
+ uintptr_t entry = GCHashConst::set_entry(base);
+ uintptr_t cur_sz = GCHashConst::set_entry_2_ptr(entry + 1) - (uintptr_t)base; /* taille restante */
cur_sz = ((cur_sz < nbb) ? cur_sz : nbb); /* on prends le min avec nbb */
// printf("Hash %p (%p %p %d) in entry %d with %d/%d\n", desc, desc->area(), base, desc->nbb(), entry, cur_sz, nbb_map);
@@ -54,7 +54,7 @@
sets[entry] = ∅
}
entry++;
- base = (void *)((unsigned int)base + cur_sz);
+ base = (void *)((uintptr_t)base + cur_sz);
nbb -= cur_sz;
nbb_map = (nbb_map < cur_sz) ? 0 : nbb_map - cur_sz;
cur_sz = (nbb < GCHashConst::set_nbb) ? nbb : GCHashConst::set_nbb;
Modified: vmkit/trunk/lib/Mvm/Allocator/gcchunk.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/gcchunk.h?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Allocator/gcchunk.h (original)
+++ vmkit/trunk/lib/Mvm/Allocator/gcchunk.h Wed Mar 26 13:39:44 2008
@@ -11,6 +11,7 @@
#define _GC_CHUNK_H_
#include "gcmapper.h"
+#include "types.h"
class gc; /* object collectable */
class gc_header; /* entete locale */
@@ -20,7 +21,7 @@
GCChunkNode *_prev; /* bit 0-1: l'age, les autres: le previous */
GCChunkNode *_next;
void * _chunk;
- size_t _nbb_mark; /* nbb = 0 <=> ce chunk est libre */
+ uintptr_t _nbb_mark; /* nbb = 0 <=> ce chunk est libre */
/* bit 0-2: la marque */
/* bit 3: est-on collectable */
@@ -41,9 +42,9 @@
inline void free() { _nbb_mark = 0; }
- inline void nbb(size_t n, bool isCol, int m) { _nbb_mark = (n << 4) | ((isCol & 0x1) << 3) | m; }
- inline void nbb(size_t n) { _nbb_mark = (n << 4) | (_nbb_mark & 0xf); }
- inline size_t nbb() { return _nbb_mark >> 4; }
+ inline void nbb(uintptr_t n, bool isCol, int m) { _nbb_mark = (n << 4) | ((isCol & 0x1) << 3) | m; }
+ inline void nbb(uintptr_t n) { _nbb_mark = (n << 4) | (_nbb_mark & 0xf); }
+ inline uintptr_t nbb() { return _nbb_mark >> 4; }
/* pas de verification de debordement!!!! */
inline void _mark(unsigned int m) { _nbb_mark = m | (_nbb_mark & -8); }
@@ -101,7 +102,7 @@
static GCChunkNode empty;
GCChunkNode *_headers;
- size_t _chunk_nbb;
+ uintptr_t _chunk_nbb;
public:
static void initialise();
@@ -111,30 +112,30 @@
_chunk_nbb = ((unsigned int)-1) >> 1; /* on évite le /0 */
}
- inline GCPage(GCMappedArea *p, size_t mapped_nbb, size_t cnbb)
+ inline GCPage(GCMappedArea *p, uintptr_t mapped_nbb, uintptr_t cnbb)
: GCMappedArea(p, mapped_nbb) {
_chunk_nbb = cnbb;
}
inline ~GCPage() {} /* FAIRE LE UNMAP A LA MAIN!!!!! */
- inline size_t chunk_nbb() { return _chunk_nbb; }
- inline void chunk_nbb(size_t n) { _chunk_nbb = n; }
+ inline uintptr_t chunk_nbb() { return _chunk_nbb; }
+ inline void chunk_nbb(uintptr_t n) { _chunk_nbb = n; }
inline GCChunkNode *headers() { return _headers; }
inline void headers(GCChunkNode *h) { _headers = h;; }
inline GCChunkNode *o2node(void *ptr, signed int mask) {
- register unsigned int entry = ((unsigned int)ptr - (unsigned int)area())/_chunk_nbb;
+ register uintptr_t entry = ((uintptr_t)ptr - (uintptr_t)area())/_chunk_nbb;
register GCChunkNode *res = _headers + entry;
- return ((unsigned int)ptr - (unsigned int)res->chunk() < res->nbb())
+ return ((uintptr_t)ptr - (uintptr_t)res->chunk() < res->nbb())
&& (res->isCollectable() == mask)
? res : 0;
}
inline gc_header *o2header(void *ptr, signed int mask) {
- register unsigned int entry = ((unsigned int)ptr - (unsigned int)area())/_chunk_nbb;
+ register uintptr_t entry = ((uintptr_t)ptr - (uintptr_t)area())/_chunk_nbb;
register GCChunkNode *res = _headers + entry;
- return ((unsigned int)ptr - (unsigned int)res->chunk() < res->nbb())
+ return ((uintptr_t)ptr - (uintptr_t)res->chunk() < res->nbb())
&& (res->isCollectable() == mask)
? res->chunk() : 0;
}
@@ -143,7 +144,7 @@
class GCDescriptorMappedChunk : public GCPage {
GCChunkNode header;
public:
- inline GCDescriptorMappedChunk(GCMappedArea *p, size_t mapped_nbb, size_t cnbb)
+ inline GCDescriptorMappedChunk(GCMappedArea *p, uintptr_t mapped_nbb, uintptr_t cnbb)
: GCPage(p, mapped_nbb, cnbb) {
header.initialise(0, area());
headers(&header);
@@ -159,9 +160,9 @@
static const unsigned int nb_set_per_hash = 1 << hash_bits;
static const unsigned int set_nbb = 1 << (set_bits + desc_bits);
- static unsigned int desc_entry(void * ptr) { return ((unsigned int)ptr >> desc_bits) & (( 1 << set_bits) - 1); }
- static unsigned int set_entry(void *ptr) { return (unsigned int)ptr >> (set_bits + desc_bits); }
- static unsigned int set_entry_2_ptr(unsigned int entry) { return entry << (set_bits + desc_bits); }
+ static uintptr_t desc_entry(void * ptr) { return ((uintptr_t)ptr >> desc_bits) & (( 1 << set_bits) - 1); }
+ static uintptr_t set_entry(void *ptr) { return (uintptr_t)ptr >> (set_bits + desc_bits); }
+ static uintptr_t set_entry_2_ptr(uintptr_t entry) { return entry << (set_bits + desc_bits); }
};
class GCHashSet {
@@ -169,12 +170,12 @@
GCPage *pages[GCHashConst::nb_desc_per_set];
public:
- void *operator new(size_t);
- void operator delete(void *, size_t);
+ void *operator new(uintptr_t);
+ void operator delete(void *, uintptr_t);
GCHashSet();
- void hash(GCPage *, void *, size_t, size_t, unsigned int *);
+ void hash(GCPage *, void *, uintptr_t, uintptr_t, unsigned int *);
inline GCPage *get(void *ptr) { return pages[GCHashConst::desc_entry(ptr)]; }
};
@@ -184,7 +185,7 @@
static unsigned int used[GCHashConst::nb_set_per_hash];
static GCHashSet empty;
static bool inited;
- static size_t nb_link;
+ static uintptr_t nb_link;
public:
static void unlink() { nb_link--; }
Modified: vmkit/trunk/lib/Mvm/Allocator/gcmapper.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/gcmapper.cc?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Allocator/gcmapper.cc (original)
+++ vmkit/trunk/lib/Mvm/Allocator/gcmapper.cc Wed Mar 26 13:39:44 2008
@@ -82,7 +82,7 @@
void *res = ::mremap(_mapped_area, _mapped_nbb, n, 0);
#endif
- if((int)res == -1)
+ if((intptr_t)res == -1)
return -1;
_mapped_area = res;
_mapped_nbb = n;
@@ -97,13 +97,13 @@
/* pbm : on n'a vraiment plus rien :) */
area = (GCMappedArea *)::do_mmap(PAGE_SIZE);
area->initialise(area, PAGE_SIZE);
- area_stack->fill((unsigned int)(area + 1), PAGE_SIZE - sizeof(GCMappedArea));
+ area_stack->fill((uintptr_t)(area + 1), PAGE_SIZE - sizeof(GCMappedArea));
area->append(&base_area);
area = (GCMappedArea *)area_stack->alloc();
}
area->mmap(PAGE_SIZE);
area->append(&base_area);
- s->fill((unsigned int)area->area(), area->nbb());
+ s->fill((uintptr_t)area->area(), area->nbb());
return s->alloc();
}
Modified: vmkit/trunk/lib/Mvm/Allocator/gcmapper.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Allocator/gcmapper.h?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Allocator/gcmapper.h (original)
+++ vmkit/trunk/lib/Mvm/Allocator/gcmapper.h Wed Mar 26 13:39:44 2008
@@ -12,6 +12,7 @@
#include "gcerror.h"
#include "osdep.h"
+#include "types.h"
class GCMinAlloc;
@@ -19,28 +20,28 @@
public:
inline GCMin() {}
inline ~GCMin() {}
- inline void *operator new(size_t);
- inline void operator delete(void *, size_t);
+ inline void *operator new(uintptr_t);
+ inline void operator delete(void *, uintptr_t);
};
class GCMappedArea : public GCMin {
GCMappedArea *_prev;
GCMappedArea *_next;
void *_mapped_area;
- size_t _mapped_nbb;
+ uintptr_t _mapped_nbb;
public:
- static size_t round(size_t n) { return (n + PAGE_SIZE - 1) & -PAGE_SIZE; }
+ static uintptr_t round(uintptr_t n) { return (n + PAGE_SIZE - 1) & -PAGE_SIZE; }
GCMappedArea *prev() { return _prev; }
GCMappedArea *next() { return _next; }
inline GCMappedArea() { _prev = _next = this; }
- inline GCMappedArea(size_t n) { _prev = _next = this; mmap(n); }
- inline GCMappedArea(GCMappedArea *p, size_t n) { append(p); mmap(n); }
+ inline GCMappedArea(uintptr_t n) { _prev = _next = this; mmap(n); }
+ inline GCMappedArea(GCMappedArea *p, uintptr_t n) { append(p); mmap(n); }
- inline void initialise(void *p, size_t n) { _mapped_area = p; _mapped_nbb = n; }
- inline size_t nbb() const { return _mapped_nbb; }
+ inline void initialise(void *p, uintptr_t n) { _mapped_area = p; _mapped_nbb = n; }
+ inline uintptr_t nbb() const { return _mapped_nbb; }
inline void *area() { return _mapped_area; }
inline void append(GCMappedArea *p) {
@@ -56,23 +57,23 @@
}
GCMappedArea * munmap();
- GCMappedArea * mmap(size_t sz);
- int mremap(size_t sz);
+ GCMappedArea * mmap(uintptr_t sz);
+ int mremap(uintptr_t sz);
- static void *do_mmap(size_t sz);
- static void do_munmap(void *, size_t sz);
+ static void *do_mmap(uintptr_t sz);
+ static void do_munmap(void *, uintptr_t sz);
};
class GCMinAllocStack {
- unsigned int current;
+ uintptr_t current;
unsigned int max;
unsigned int *free_list;
unsigned short nbb;
public:
- inline void initialise(size_t n) { nbb = n; current = max = 0; free_list = 0; }
+ inline void initialise(uintptr_t n) { nbb = n; current = max = 0; free_list = 0; }
- inline void fill(unsigned int st, size_t n) {
+ inline void fill(unsigned int st, uintptr_t n) {
current = st;
max = st + n;
}
@@ -83,9 +84,9 @@
}
inline void *alloc() {
- register unsigned int res;
+ register uintptr_t res;
if(free_list) {
- res = (unsigned int)free_list;
+ res = (uintptr_t)free_list;
free_list = *((unsigned int **)res);
} else {
res = current;
@@ -94,14 +95,14 @@
return 0;
}
- return (void *)res;
+ return (void*)res;
}
};
class GCMinAlloc {
- static const size_t log_max_min_alloc = 6; /* 64 octets */
- static const size_t max_min_alloc = (1 << log_max_min_alloc);
- static const size_t log_step = 2;
+ static const uintptr_t log_max_min_alloc = 6; /* 64 octets */
+ static const uintptr_t max_min_alloc = (1 << log_max_min_alloc);
+ static const uintptr_t log_step = 2;
/* piles d'allocations */
static GCMinAllocStack _stacks[max_min_alloc >> log_step];
@@ -116,11 +117,11 @@
static void initialise();
static void destroy();
- static inline void *minalloc(size_t);
- static inline void minfree(void *, size_t);
+ static inline void *minalloc(uintptr_t);
+ static inline void minfree(void *, uintptr_t);
};
-inline void *GCMinAlloc::minalloc(size_t nbb) {
+inline void *GCMinAlloc::minalloc(uintptr_t nbb) {
GCMinAllocStack *s = stacks[nbb];
void *res = s->alloc();
@@ -129,15 +130,15 @@
return res;
}
-inline void GCMinAlloc::minfree(void *ptr, size_t nbb) {
+inline void GCMinAlloc::minfree(void *ptr, uintptr_t nbb) {
stacks[nbb]->inject_free(ptr);
}
-inline void *GCMin::operator new(size_t nbb) {
+inline void *GCMin::operator new(uintptr_t nbb) {
return GCMinAlloc::minalloc(nbb);
}
-inline void GCMin::operator delete(void *ptr, size_t nbb) {
+inline void GCMin::operator delete(void *ptr, uintptr_t nbb) {
GCMinAlloc::minfree(ptr, nbb);
}
Modified: vmkit/trunk/lib/Mvm/EscapeAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/EscapeAnalysis.cpp?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/EscapeAnalysis.cpp (original)
+++ vmkit/trunk/lib/Mvm/EscapeAnalysis.cpp Wed Mar 26 13:39:44 2008
@@ -37,7 +37,6 @@
};
char EscapeAnalysis::ID = 0;
RegisterPass<EscapeAnalysis> X("EscapeAnalysis", "Escape Analysis Pass");
-}
bool EscapeAnalysis::runOnFunction(Function& F) {
bool Changed = false;
@@ -61,13 +60,8 @@
return Changed;
}
-namespace mvm {
-EscapeAnalysis* createEscapeAnalysisPass(Function* alloc, Function* init) {
- return new EscapeAnalysis(alloc, init);
-}
-}
static bool escapes(Instruction* Ins, std::map<AllocaInst*, bool>& visited) {
for (Value::use_iterator I = Ins->use_begin(), E = Ins->use_end();
@@ -142,3 +136,11 @@
}
return false;
}
+}
+
+namespace mvm {
+FunctionPass* createEscapeAnalysisPass(llvm::Function* alloc, llvm::Function* init) {
+
+ return new EscapeAnalysis(alloc, init);
+}
+}
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gc.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gc.cc?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gc.cc (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gc.cc Wed Mar 26 13:39:44 2008
@@ -87,8 +87,8 @@
}
int gc::byteOffset(void *obj) {
- int beg = (int)GCCollector::begOf(obj);
- int off = (int)obj;
+ int beg = (intptr_t)GCCollector::begOf(obj);
+ intptr_t off = (intptr_t)obj;
return (off-beg);
}
Modified: vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cc?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cc (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gcinit.cc Wed Mar 26 13:39:44 2008
@@ -86,6 +86,8 @@
# endif
# elif defined(__i386__)
" movl %%ebp, %0 "
+# elif defined(__amd64__)
+ " movq %%rbp, %0 "
# else
# error:
# error: I do not know how to read the frame pointer on this machine
Modified: vmkit/trunk/lib/Mvm/Object.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Object.cc?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Object.cc (original)
+++ vmkit/trunk/lib/Mvm/Object.cc Wed Mar 26 13:39:44 2008
@@ -132,12 +132,12 @@
write("<In Object [");
beg->print(this);
write("] -- offset ");
- writeS4((int)obj - (int)beg);
+ writeS4((intptr_t)obj - (intptr_t)beg);
write(">");
}
} else {
write("<DirectValue: ");
- writeS4((int)obj);
+ writeS4((intptr_t)obj);
write(">");
}
return this;
Modified: vmkit/trunk/vmkit-llvm-svn.patch
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/vmkit-llvm-svn.patch?rev=48832&r1=48831&r2=48832&view=diff
==============================================================================
--- vmkit/trunk/vmkit-llvm-svn.patch (original)
+++ vmkit/trunk/vmkit-llvm-svn.patch Wed Mar 26 13:39:44 2008
@@ -87,8 +87,8 @@
+ initConstantPool(F.getConstantPool());
+ initJumpTableInfo(F.getJumpTableInfo());
+
-+ ConstantPoolBase = (void*)(((unsigned) ConstantPoolBase) + CurBufferPtr);
-+ JumpTableBase = (void*)(((unsigned) JumpTableBase) + CurBufferPtr);
++ ConstantPoolBase = (void*)(((uintptr_t) ConstantPoolBase) + CurBufferPtr);
++ JumpTableBase = (void*)(((uintptr_t) JumpTableBase) + CurBufferPtr);
+ }
+
+ virtual bool finishFunction(MachineFunction &F) {
More information about the llvm-commits
mailing list