From nicolas.geoffray at lip6.fr Sun Aug 1 05:24:47 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 12:24:47 -0000 Subject: [vmkit-commits] [vmkit] r109972 - /vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Message-ID: <20100801122447.B4F922A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 07:24:47 2010 New Revision: 109972 URL: http://llvm.org/viewvc/llvm-project?rev=109972&view=rev Log: Create a CamlFrameDecoder to refactorize caml frame decoding. Modified: vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Modified: vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp?rev=109972&r1=109971&r2=109972&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp (original) +++ vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Sun Aug 1 07:24:47 2010 @@ -110,38 +110,72 @@ CamlFrame frames[1]; }; +struct CamlFrameDecoder { + CamlFrames* frames ; + uint32 currentDescriptor; + CamlFrame* currentFrame; + Dl_info info; + + CamlFrameDecoder(CamlFrames* frames) { + this->frames = frames; + currentDescriptor = 0; + currentFrame = &(frames->frames[0]); + int res = dladdr(currentFrame->ReturnAddress, &info); + assert(res != 0 && "No frame"); + } + + bool hasNext() { + return currentDescriptor < frames->NumDescriptors; + } + + void advance() { + ++currentDescriptor; + if (!hasNext()) return; + currentFrame = (CamlFrame*) ((char*)currentFrame + + (currentFrame->NumLiveOffsets % 2) * sizeof(uint16_t) + + currentFrame->NumLiveOffsets * sizeof(uint16_t) + + sizeof(void*) + sizeof(uint16_t) + sizeof(uint16_t)); + int res = dladdr(currentFrame->ReturnAddress, &info); + assert(res != 0 && "No frame"); + } + + CamlFrame* next(void** funcAddress, const char** funcName) { + assert(hasNext()); + CamlFrame* result = currentFrame; + *funcAddress = info.dli_saddr; + *funcName = info.dli_sname; + + // Skip the remaining ones. + do { + advance(); + } while (hasNext() && (info.dli_saddr == *funcAddress)); + + // Skip the entries that start at another method. + while (hasNext() && (info.dli_saddr == currentFrame->ReturnAddress)) { + advance(); + } + + while (hasNext() && (info.dli_saddr == NULL)) { + advance(); + } + return result; + } +}; + void SharedStartFunctionMap::initialize() { CamlFrames* frames = (CamlFrames*)dlsym(SELF_HANDLE, "camlVmkitoptimized__frametable"); - Dl_info info; - void* previousPtr = 0; - const char* previousName = 0; StaticAllocator = new BumpPtrAllocator(); + const char* name = NULL; + void* address = NULL; if (frames != NULL) { - CamlFrame* currentFrame = &(frames->frames[0]); - CamlFrame* previousFrame = currentFrame; - for (uint16_t i = 0; i < frames->NumDescriptors; i++) { - int res = dladdr(currentFrame->ReturnAddress, &info); - if (res != 0) { - if (previousPtr && info.dli_saddr != previousPtr && - previousFrame->ReturnAddress != previousPtr) { // This test is to avoid adding a frame to a method - // that does not have one but starts just where the previous - // method ends. - StaticCamlMethodInfo* MI = - new(*StaticAllocator, "StaticCamlMethodInfo") - StaticCamlMethodInfo(previousFrame, previousPtr, previousName); - addMethodInfo(MI, previousPtr); - } - previousName = info.dli_sname; - previousFrame = currentFrame; - previousPtr = info.dli_saddr; - } - - currentFrame = (CamlFrame*) ((char*)currentFrame + - (currentFrame->NumLiveOffsets % 2) * sizeof(uint16_t) + - currentFrame->NumLiveOffsets * sizeof(uint16_t) + - sizeof(void*) + sizeof(uint16_t) + sizeof(uint16_t)); + CamlFrameDecoder decoder(frames); + while (decoder.hasNext()) { + CamlFrame* frame = decoder.next(&address, &name); + StaticCamlMethodInfo* MI = new(*StaticAllocator, "StaticCamlMethodInfo") + StaticCamlMethodInfo(frame, address, name); + addMethodInfo(MI, address); } } } From nicolas.geoffray at lip6.fr Sun Aug 1 05:41:16 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 12:41:16 -0000 Subject: [vmkit-commits] [vmkit] r109973 - in /vmkit/trunk/lib: J3/Classpath/ClasspathConstructor.inc J3/Classpath/ClasspathMethod.inc J3/Classpath/ClasspathVMThread.inc J3/Compiler/JavaAOTCompiler.cpp J3/VMCore/JavaClass.cpp J3/VMCore/JavaRuntimeJIT.cpp J3/VMCore/Jnjvm.cpp Mvm/StaticGCPass/StaticGCPass.cpp Message-ID: <20100801124116.F28F02A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 07:41:16 2010 New Revision: 109973 URL: http://llvm.org/viewvc/llvm-project?rev=109973&view=rev Log: Methods that use gc_root should not be made static. Make StaticGCPass ensure they are not. Modified: vmkit/trunk/lib/J3/Classpath/ClasspathConstructor.inc vmkit/trunk/lib/J3/Classpath/ClasspathMethod.inc vmkit/trunk/lib/J3/Classpath/ClasspathVMThread.inc vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/trunk/lib/J3/VMCore/JavaClass.cpp vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp Modified: vmkit/trunk/lib/J3/Classpath/ClasspathConstructor.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathConstructor.inc?rev=109973&r1=109972&r2=109973&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Classpath/ClasspathConstructor.inc (original) +++ vmkit/trunk/lib/J3/Classpath/ClasspathConstructor.inc Sun Aug 1 07:41:16 2010 @@ -69,14 +69,14 @@ return res; } -static JavaObject* proceedConstructor(JavaObjectConstructor* cons, - ArrayObject* args, - JavaObject* Clazz, jint index) +JavaObject* proceedConstructor(JavaObjectConstructor* cons, + ArrayObject* args, + JavaObject* Clazz, jint index) __attribute__ ((noinline)); -static JavaObject* proceedConstructor(JavaObjectConstructor* cons, - ArrayObject* args, - JavaObject* Clazz, jint index) { +JavaObject* proceedConstructor(JavaObjectConstructor* cons, + ArrayObject* args, + JavaObject* Clazz, jint index) { JavaObject* res = 0; JavaObject* excp = 0; Modified: vmkit/trunk/lib/J3/Classpath/ClasspathMethod.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathMethod.inc?rev=109973&r1=109972&r2=109973&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Classpath/ClasspathMethod.inc (original) +++ vmkit/trunk/lib/J3/Classpath/ClasspathMethod.inc Sun Aug 1 07:41:16 2010 @@ -90,12 +90,12 @@ return res; } -static JavaObject* proceedMethod(JavaObjectMethod* Meth, JavaObject* obj, - ArrayObject* args, JavaObject* Cl, jint index) +JavaObject* proceedMethod(JavaObjectMethod* Meth, JavaObject* obj, + ArrayObject* args, JavaObject* Cl, jint index) __attribute__((noinline)); -static JavaObject* proceedMethod(JavaObjectMethod* Meth, JavaObject* obj, - ArrayObject* args, JavaObject* Cl, jint index) { +JavaObject* proceedMethod(JavaObjectMethod* Meth, JavaObject* obj, + ArrayObject* args, JavaObject* Cl, jint index) { JavaObject* res = 0; JavaObject* exc = 0; Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMThread.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMThread.inc?rev=109973&r1=109972&r2=109973&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Classpath/ClasspathVMThread.inc (original) +++ vmkit/trunk/lib/J3/Classpath/ClasspathVMThread.inc Sun Aug 1 07:41:16 2010 @@ -32,7 +32,7 @@ return JavaThread::get()->currentThread(); } -static void start(JavaThread* thread) { +void start(JavaThread* thread) { JavaObjectVMThread* vmThread = NULL; JavaObject* javaThread = NULL; Modified: vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=109973&r1=109972&r2=109973&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Sun Aug 1 07:41:16 2010 @@ -1901,10 +1901,10 @@ -static void extractFiles(ArrayUInt8* bytes, - JavaAOTCompiler* M, - JnjvmBootstrapLoader* bootstrapLoader, - std::vector& classes) { +void extractFiles(ArrayUInt8* bytes, + JavaAOTCompiler* M, + JnjvmBootstrapLoader* bootstrapLoader, + std::vector& classes) { ZipArchive archive(bytes, bootstrapLoader->allocator); mvm::ThreadAllocator allocator; Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.cpp?rev=109973&r1=109972&r2=109973&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaClass.cpp Sun Aug 1 07:41:16 2010 @@ -716,7 +716,7 @@ } -static void internalLoadExceptions(JavaMethod& meth) { +void internalLoadExceptions(JavaMethod& meth) { Attribut* codeAtt = meth.lookupAttribut(Attribut::codeAttribut); Modified: vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=109973&r1=109972&r2=109973&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp Sun Aug 1 07:41:16 2010 @@ -252,8 +252,8 @@ } // Throws if one of the dimension is negative. -static JavaObject* multiCallNewIntern(UserClassArray* cl, uint32 len, - sint32* dims, Jnjvm* vm) { +JavaObject* multiCallNewIntern(UserClassArray* cl, uint32 len, + sint32* dims, Jnjvm* vm) { assert(len > 0 && "Negative size given by VMKit"); JavaObject* _res = cl->doNew(dims[0], vm); Modified: vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp?rev=109973&r1=109972&r2=109973&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp Sun Aug 1 07:41:16 2010 @@ -487,8 +487,8 @@ } -static JavaString* CreateNoSuchMsg(CommonClass* cl, const UTF8* name, - Jnjvm* vm) { +JavaString* CreateNoSuchMsg(CommonClass* cl, const UTF8* name, + Jnjvm* vm) { ArrayUInt16* msg = NULL; JavaString* str = NULL; llvm_gcroot(msg, 0); @@ -564,7 +564,7 @@ upcalls->InitAbstractMethodError, str); } -static JavaString* CreateUnableToLoad(const UTF8* name, Jnjvm* vm) { +JavaString* CreateUnableToLoad(const UTF8* name, Jnjvm* vm) { ArrayUInt16* msg = NULL; JavaString* str = NULL; llvm_gcroot(msg, 0); @@ -603,7 +603,7 @@ return str; } -static JavaString* CreateUnableToLoad(JavaString* name, Jnjvm* vm) { +JavaString* CreateUnableToLoad(JavaString* name, Jnjvm* vm) { JavaString* str = NULL; ArrayUInt16* msg = NULL; llvm_gcroot(msg, 0); @@ -828,8 +828,8 @@ } -static char* findInformation(Jnjvm* vm, ArrayUInt8* manifest, const char* entry, - uint32 len) { +char* findInformation(Jnjvm* vm, ArrayUInt8* manifest, const char* entry, + uint32 len) { llvm_gcroot(manifest, 0); sint32 index = sys_strnstr((char*)ArrayUInt8::getElements(manifest), entry); if (index != -1) { Modified: vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp?rev=109973&r1=109972&r2=109973&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp (original) +++ vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp Sun Aug 1 07:41:16 2010 @@ -14,6 +14,8 @@ #include "llvm/Pass.h" #include "llvm/Support/raw_ostream.h" +#include + using namespace llvm; namespace { @@ -47,6 +49,7 @@ F->eraseFromParent(); } + bool error = false; for (Value::use_iterator I = gcrootFun->use_begin(), E = gcrootFun->use_end(); I != E; ++I) { if (Instruction* II = dyn_cast(I)) { @@ -57,9 +60,17 @@ } for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { + if (I->hasGC() && I->hasInternalLinkage()) { + error = true; + fprintf(stderr, "Method %s has static linkage but uses gc_root. " + "Functions using gc_root should not have static linkage.\n", + I->getName().data()); + } if (I->hasGC() && !strcmp(I->getGC(), "vmkit")) I->setGC("ocaml"); } + if (error) abort(); + return true; } From nicolas.geoffray at lip6.fr Sun Aug 1 05:42:54 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 12:42:54 -0000 Subject: [vmkit-commits] [vmkit] r109974 - /vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp Message-ID: <20100801124254.82ADD2A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 07:42:54 2010 New Revision: 109974 URL: http://llvm.org/viewvc/llvm-project?rev=109974&view=rev Log: Add some asserts and code cleanup. Modified: vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp Modified: vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp?rev=109974&r1=109973&r2=109974&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp (original) +++ vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp Sun Aug 1 07:42:54 2010 @@ -25,12 +25,12 @@ } extern "C" uintptr_t Java_org_j3_mmtk_ObjectModel_readAvailableBitsWord__Lorg_vmmagic_unboxed_ObjectReference_2 (JavaObject* OM, JavaObject* obj) { - return ((uintptr_t*)obj)[1]; + return obj->lock.lock; } extern "C" void Java_org_j3_mmtk_ObjectModel_writeAvailableBitsWord__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Word_2 ( JavaObject* OM, JavaObject* obj, uintptr_t val) { - ((uintptr_t*)obj)[1] = val; + obj->lock.lock = val; } extern "C" JavaObject* Java_org_j3_mmtk_ObjectModel_objectStartRef__Lorg_vmmagic_unboxed_ObjectReference_2 (JavaObject* OM, JavaObject* obj) { @@ -43,20 +43,17 @@ extern "C" uint8_t Java_org_j3_mmtk_ObjectModel_readAvailableByte__Lorg_vmmagic_unboxed_ObjectReference_2 (JavaObject* OM, JavaObject* obj) { #if defined(__PPC__) - return ((uint8_t*)obj)[7] & mvm::GCBitMask; + return ((uint8_t*)obj)[7]; #else - return ((uint8_t*)obj)[4] & mvm::GCBitMask; + return ((uint8_t*)obj)[4]; #endif } extern "C" void Java_org_j3_mmtk_ObjectModel_writeAvailableByte__Lorg_vmmagic_unboxed_ObjectReference_2B (JavaObject* OM, JavaObject* obj, uint8_t val) { - assert((val & mvm::NonLockBitsMask) == val && "GC bits do not fit"); #if defined(__PPC__) - ((uint8_t*)obj)[7] &= ~mvm::GCBitMask; - ((uint8_t*)obj)[7] |= val; + ((uint8_t*)obj)[7] = val; #else - ((uint8_t*)obj)[4] &= ~mvm::GCBitMask; - ((uint8_t*)obj)[4] |= val; + ((uint8_t*)obj)[4] = val; #endif } @@ -65,13 +62,13 @@ } extern "C" uintptr_t Java_org_j3_mmtk_ObjectModel_prepareAvailableBits__Lorg_vmmagic_unboxed_ObjectReference_2 (JavaObject* OM, JavaObject* obj) { - return ((uintptr_t*)obj)[1]; + return obj->lock.lock; } extern "C" uint8_t Java_org_j3_mmtk_ObjectModel_attemptAvailableBits__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Word_2Lorg_vmmagic_unboxed_Word_2( JavaObject* OM, JavaObject* obj, intptr_t oldValue, intptr_t newValue) { - return __sync_bool_compare_and_swap(((intptr_t*)obj) + 1, oldValue, newValue); + return __sync_bool_compare_and_swap(&(obj->lock.lock), oldValue, newValue); } extern "C" void Java_org_j3_bindings_Bindings_memcpy__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2I( @@ -110,7 +107,9 @@ } } size = llvm::RoundUpToAlignment(size, sizeof(void*)); - return JnJVM_org_j3_bindings_Bindings_copy__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2II(src, VT, size, allocator); + uintptr_t res = JnJVM_org_j3_bindings_Bindings_copy__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2II(src, VT, size, allocator); + assert((((uintptr_t*)res)[1] & ~mvm::GCBitMask) == (((uintptr_t*)src)[1] & ~mvm::GCBitMask)); + return res; } extern "C" void Java_org_j3_mmtk_ObjectModel_copyTo__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Address_2 ( From nicolas.geoffray at lip6.fr Sun Aug 1 05:49:41 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 12:49:41 -0000 Subject: [vmkit-commits] [vmkit] r109975 - in /vmkit/trunk/lib/J3/Classpath: ClasspathVMSystemProperties.inc ClasspathVMThrowable.inc Message-ID: <20100801124941.622E82A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 07:49:41 2010 New Revision: 109975 URL: http://llvm.org/viewvc/llvm-project?rev=109975&view=rev Log: Change static methods to non-static. Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMSystemProperties.inc vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMSystemProperties.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMSystemProperties.inc?rev=109975&r1=109974&r2=109975&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Classpath/ClasspathVMSystemProperties.inc (original) +++ vmkit/trunk/lib/J3/Classpath/ClasspathVMSystemProperties.inc Sun Aug 1 07:49:41 2010 @@ -24,8 +24,8 @@ extern "C" { -static void setProperty(Jnjvm* vm, JavaObject* prop, const char* key, - const char* val) { +void setProperty(Jnjvm* vm, JavaObject* prop, const char* key, + const char* val) { JavaString* Val = 0; JavaString* Key = 0; @@ -40,7 +40,7 @@ vm, (UserClass*)JavaObject::getClass(prop), prop, &Key, &Val); } -static void setUnameProp(Jnjvm* vm, JavaObject* prop) { +void setUnameProp(Jnjvm* vm, JavaObject* prop) { llvm_gcroot(prop, 0); Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc?rev=109975&r1=109974&r2=109975&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc (original) +++ vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc Sun Aug 1 07:49:41 2010 @@ -83,7 +83,7 @@ } -static JavaObject* consStackElement(JavaMethod* meth, void* ip) { +JavaObject* consStackElement(JavaMethod* meth, void* ip) { JavaString* methodName = 0; JavaString* className = 0; From nicolas.geoffray at lip6.fr Sun Aug 1 05:50:27 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 12:50:27 -0000 Subject: [vmkit-commits] [vmkit] r109976 - /vmkit/trunk/lib/J3/VMCore/JavaObject.cpp Message-ID: <20100801125027.756AA2A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 07:50:27 2010 New Revision: 109976 URL: http://llvm.org/viewvc/llvm-project?rev=109976&view=rev Log: Bugfix in hashCode for movable collectors. Modified: vmkit/trunk/lib/J3/VMCore/JavaObject.cpp Modified: vmkit/trunk/lib/J3/VMCore/JavaObject.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaObject.cpp?rev=109976&r1=109975&r2=109976&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaObject.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaObject.cpp Sun Aug 1 07:50:27 2010 @@ -20,30 +20,44 @@ using namespace j3; -uint16_t JavaObject::hashCodeGenerator = 1; +static const int hashCodeIncrement = mvm::GCBitMask + 1; +uint16_t JavaObject::hashCodeGenerator = hashCodeIncrement; /// hashCode - Return the hash code of this object. uint32_t JavaObject::hashCode(JavaObject* self) { llvm_gcroot(self, 0); if (!mvm::MovesObject) return (uint32_t)(long)self; - uintptr_t oldLock = self->lock.lock; - uintptr_t val = (oldLock & mvm::HashMask) >> mvm::GCBits; - if (val) return val ^ (uintptr_t)getClass(self); - if (hashCodeGenerator >= (mvm::HashMask >> mvm::GCBits)) { - val = hashCodeGenerator = 1; - } else { - val = ++hashCodeGenerator; + uintptr_t header = self->lock.lock; + uintptr_t GCBits = header & mvm::GCBitMask; + uintptr_t val = header & mvm::HashMask; + if (val != 0) { + return val ^ (uintptr_t)getClass(self); + } + val = hashCodeGenerator; + hashCodeGenerator += hashCodeIncrement; + val = val % mvm::HashMask; + if (val == 0) { + // It is possible that in the same time, a thread is in this method and + // gets the same hash code value than this thread. This is fine. + val = hashCodeIncrement; + hashCodeGenerator += hashCodeIncrement; } + assert(val > mvm::GCBitMask); + assert(val <= mvm::HashMask); + assert(val != hashCodeGenerator); do { - uintptr_t oldLock = self->lock.lock; - uintptr_t newLock = (val << mvm::GCBits) | oldLock; - __sync_val_compare_and_swap(&(self->lock.lock), oldLock, newLock); - } while ((self->lock.lock & mvm::HashMask) == 0); - - return ((self->lock.lock & mvm::HashMask) >> mvm::GCBits) ^ - (uintptr_t)getClass(self); + header = self->lock.lock; + if ((header & mvm::HashMask) != 0) break; + uintptr_t newHeader = header | val; + assert((newHeader & ~mvm::HashMask) == header); + __sync_val_compare_and_swap(&(self->lock.lock), header, newHeader); + } while (true); + + assert((self->lock.lock & mvm::HashMask) != 0); + assert(GCBits == (self->lock.lock & mvm::GCBitMask)); + return (self->lock.lock & mvm::HashMask) ^ (uintptr_t)getClass(self); } From nicolas.geoffray at lip6.fr Sun Aug 1 06:01:37 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 13:01:37 -0000 Subject: [vmkit-commits] [vmkit] r109977 - in /vmkit/trunk/lib/J3/Compiler: JavaJIT.cpp JavaJIT.h JavaJITOpcodes.cpp Message-ID: <20100801130138.035FE2A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 08:01:37 2010 New Revision: 109977 URL: http://llvm.org/viewvc/llvm-project?rev=109977&view=rev Log: All loads on objects must be volatile, to cooperate with the GC (LLVM optimizations may delete these loads if they are not marked volatile). Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp vmkit/trunk/lib/J3/Compiler/JavaJIT.h vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=109977&r1=109976&r2=109977&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Sun Aug 1 08:01:37 2010 @@ -204,7 +204,7 @@ Args.push_back(GV); Value* targetObject = getTarget(virtualType->param_end(), signature->nbArguments + 1); - Args.push_back(new LoadInst(targetObject, "", false, currentBlock)); + Args.push_back(new LoadInst(targetObject, "", true, currentBlock)); load = invoke(intrinsics->VirtualLookupFunction, Args, "", currentBlock); node->addIncoming(load, currentBlock); BranchInst::Create(endResolveVirtual, currentBlock); @@ -494,7 +494,7 @@ BranchInst::Create(endBlock, loadBlock, cmp, currentBlock); currentBlock = loadBlock; - result = new LoadInst(result, "", currentBlock); + result = new LoadInst(result, "", true, currentBlock); new StoreInst(result, ResultObject, "", currentBlock); endNode->addIncoming(result, currentBlock); @@ -730,7 +730,7 @@ Value* obj = 0; if (isVirtual(compilingMethod->access)) { assert(thisObject != NULL && "beginSynchronize without this"); - obj = new LoadInst(thisObject, "", false, currentBlock); + obj = new LoadInst(thisObject, "", true, currentBlock); } else { obj = TheCompiler->getJavaClassPtr(compilingClass); obj = new LoadInst(obj, "", false, currentBlock); @@ -742,7 +742,7 @@ Value* obj = 0; if (isVirtual(compilingMethod->access)) { assert(thisObject != NULL && "endSynchronize without this"); - obj = new LoadInst(thisObject, "", false, currentBlock); + obj = new LoadInst(thisObject, "", true, currentBlock); } else { obj = TheCompiler->getJavaClassPtr(compilingClass); obj = new LoadInst(obj, "", false, currentBlock); @@ -1038,6 +1038,19 @@ opcodeInfos[i].exceptionBlock = endExceptionBlock; } + Instruction* returnValue = NULL; + if (returnType == intrinsics->JavaObjectType && + TheCompiler->useCooperativeGC()) { + returnValue = new AllocaInst(intrinsics->JavaObjectType, "", + currentBlock); + Instruction* cast = + new BitCastInst(returnValue, intrinsics->ptrPtrType, "", currentBlock); + Value* GCArgs[2] = { cast, intrinsics->constantPtrNull }; + + CallInst::Create(intrinsics->llvm_gc_gcroot, GCArgs, GCArgs + 2, "", + currentBlock); + } + for (int i = 0; i < maxLocals; i++) { intLocals.push_back(new AllocaInst(Type::getInt32Ty(*llvmContext), "", currentBlock)); new StoreInst(Constant::getNullValue(Type::getInt32Ty(*llvmContext)), intLocals.back(), false, currentBlock); @@ -1208,8 +1221,9 @@ endNode = llvm::PHINode::Create(returnType, "", endBlock); } - if (isSynchro(compilingMethod->access)) + if (isSynchro(compilingMethod->access)) { beginSynchronize(); + } if (TheCompiler->useCooperativeGC()) { Value* threadId = getCurrentThread(intrinsics->MutatorThreadType); @@ -1280,26 +1294,14 @@ } currentBlock = endBlock; - - Instruction* returnValue = NULL; - if (returnType == intrinsics->JavaObjectType && - TheCompiler->useCooperativeGC()) { - returnValue = new AllocaInst(intrinsics->JavaObjectType, "", - func->begin()->begin()); - Instruction* cast = - new BitCastInst(returnValue, intrinsics->ptrPtrType, ""); - cast->insertAfter(returnValue); - Value* GCArgs[2] = { cast, intrinsics->constantPtrNull }; - - Instruction* call = - CallInst::Create(intrinsics->llvm_gc_gcroot, GCArgs, GCArgs + 2, ""); - call->insertAfter(cast); + if (returnValue != NULL) { new StoreInst(endNode, returnValue, currentBlock); } - - if (isSynchro(compilingMethod->access)) + + if (isSynchro(compilingMethod->access)) { endSynchronize(); + } #if JNJVM_EXECUTE > 0 { @@ -1336,10 +1338,8 @@ currentBlock->eraseFromParent(); } else { if (returnType != Type::getVoidTy(*llvmContext)) { - if (returnType == intrinsics->JavaObjectType && - TheCompiler->useCooperativeGC()) { - assert(returnValue && "No return value set"); - Value* obj = new LoadInst(returnValue, "", false, currentBlock); + if (returnValue != NULL) { + Value* obj = new LoadInst(returnValue, "", true, currentBlock); ReturnInst::Create(*llvmContext, obj, currentBlock); } else { ReturnInst::Create(*llvmContext, endNode, currentBlock); @@ -1388,7 +1388,7 @@ const UTF8* name = compilingClass->ctpInfo->UTF8At(AR.AnnotationNameIndex); if (name->equals(TheCompiler->InlinePragma)) { - llvmFunction->addFnAttr(Attribute::AlwaysInline); + llvmFunction->addFnAttr(Attribute::NoInline); } else if (name->equals(TheCompiler->NoInlinePragma)) { llvmFunction->addFnAttr(Attribute::NoInline); } @@ -2057,7 +2057,7 @@ currentBlock); #endif } else { - object = new LoadInst(object, false, currentBlock); + object = new LoadInst(object, "", true, currentBlock); JITVerifyNull(object); type = LCI->getVirtualType(); } @@ -2086,7 +2086,7 @@ Value* ptr = getConstantPoolAt(index, func, returnType, 0, true); if (!stat) { - object = new LoadInst(object, false, currentBlock); + object = new LoadInst(object, "", true, currentBlock); Value* tmp = new BitCastInst(object, Pty, "", currentBlock); Value* args[2] = { zero, ptr }; ptr = GetElementPtrInst::Create(tmp, args, args + 2, "", currentBlock); @@ -2194,9 +2194,9 @@ JavaObject::getClass(val) : NULL; push(V, false, cl); } else { - Value* V = CallInst::Create(intrinsics->GetFinalObjectFieldFunction, ptr, - "", currentBlock); - + // Do not call getFinalObject, as the object may move in-between two + // loads of this static. + Value* V = new LoadInst(ptr, "", currentBlock); JnjvmClassLoader* JCL = compilingClass->classLoader; push(V, false, sign->findAssocClass(JCL)); } @@ -2260,32 +2260,31 @@ // In init methods, the fields have not been set yet. if (!compilingMethod->name->equals(JBL->initName)) { JavaField* field = compilingClass->ctpInfo->lookupField(index, false); - if (field) final = isFinal(field->access); + if (field) { + final = isFinal(field->access) && sign->isPrimitive(); + } if (final) { Function* F = 0; - if (sign->isPrimitive()) { - const PrimitiveTypedef* prim = (PrimitiveTypedef*)sign; - if (prim->isInt()) { - F = intrinsics->GetFinalInt32FieldFunction; - } else if (prim->isByte()) { - F = intrinsics->GetFinalInt8FieldFunction; - } else if (prim->isBool()) { - F = intrinsics->GetFinalInt8FieldFunction; - } else if (prim->isShort()) { - F = intrinsics->GetFinalInt16FieldFunction; - } else if (prim->isChar()) { - F = intrinsics->GetFinalInt16FieldFunction; - } else if (prim->isLong()) { - F = intrinsics->GetFinalLongFieldFunction; - } else if (prim->isFloat()) { - F = intrinsics->GetFinalFloatFieldFunction; - } else if (prim->isDouble()) { - F = intrinsics->GetFinalDoubleFieldFunction; - } else { - abort(); - } + assert(sign->isPrimitive()); + const PrimitiveTypedef* prim = (PrimitiveTypedef*)sign; + if (prim->isInt()) { + F = intrinsics->GetFinalInt32FieldFunction; + } else if (prim->isByte()) { + F = intrinsics->GetFinalInt8FieldFunction; + } else if (prim->isBool()) { + F = intrinsics->GetFinalInt8FieldFunction; + } else if (prim->isShort()) { + F = intrinsics->GetFinalInt16FieldFunction; + } else if (prim->isChar()) { + F = intrinsics->GetFinalInt16FieldFunction; + } else if (prim->isLong()) { + F = intrinsics->GetFinalLongFieldFunction; + } else if (prim->isFloat()) { + F = intrinsics->GetFinalFloatFieldFunction; + } else if (prim->isDouble()) { + F = intrinsics->GetFinalDoubleFieldFunction; } else { - F = intrinsics->GetFinalObjectFieldFunction; + abort(); } push(CallInst::Create(F, ptr, "", currentBlock), sign->isUnsigned(), cl); } Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.h?rev=109977&r1=109976&r2=109977&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaJIT.h (original) +++ vmkit/trunk/lib/J3/Compiler/JavaJIT.h Sun Aug 1 08:01:37 2010 @@ -314,19 +314,19 @@ llvm::Value* top() { CommonClass* cl = stack.back(); if (cl == upcalls->OfInt) { - return new llvm::LoadInst(intStack[currentStackIndex - 1], false, + return new llvm::LoadInst(intStack[currentStackIndex - 1], "", false, currentBlock); } else if (cl == upcalls->OfFloat) { - return new llvm::LoadInst(floatStack[currentStackIndex - 1], false, + return new llvm::LoadInst(floatStack[currentStackIndex - 1], "", false, currentBlock); } else if (cl == upcalls->OfDouble) { - return new llvm::LoadInst(doubleStack[currentStackIndex - 1], false, + return new llvm::LoadInst(doubleStack[currentStackIndex - 1], "", false, currentBlock); } else if (cl == upcalls->OfLong) { - return new llvm::LoadInst(longStack[currentStackIndex - 1], false, + return new llvm::LoadInst(longStack[currentStackIndex - 1], "", false, currentBlock); } else { - return new llvm::LoadInst(objectStack[currentStackIndex - 1], false, + return new llvm::LoadInst(objectStack[currentStackIndex - 1], "", true, currentBlock); } } Modified: vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=109977&r1=109976&r2=109977&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Sun Aug 1 08:01:37 2010 @@ -274,133 +274,133 @@ break; case ILOAD : - push(new LoadInst(intLocals[WREAD_U1(reader, false, i, wide)], "", + push(new LoadInst(intLocals[WREAD_U1(reader, false, i, wide)], "", false, currentBlock), false); break; case LLOAD : - push(new LoadInst(longLocals[WREAD_U1(reader, false, i, wide)], "", + push(new LoadInst(longLocals[WREAD_U1(reader, false, i, wide)], "", false, currentBlock), false); push(intrinsics->constantZero, false); break; case FLOAD : - push(new LoadInst(floatLocals[WREAD_U1(reader, false, i, wide)], "", + push(new LoadInst(floatLocals[WREAD_U1(reader, false, i, wide)], "", false, currentBlock), false); break; case DLOAD : - push(new LoadInst(doubleLocals[WREAD_U1(reader, false, i, wide)], "", + push(new LoadInst(doubleLocals[WREAD_U1(reader, false, i, wide)], "", false, currentBlock), false); push(intrinsics->constantZero, false); break; case ALOAD : - push(new LoadInst(objectLocals[WREAD_U1(reader, false, i, wide)], "", + push(new LoadInst(objectLocals[WREAD_U1(reader, false, i, wide)], "", true, currentBlock), false); break; case ILOAD_0 : - push(new LoadInst(intLocals[0], "", currentBlock), false); + push(new LoadInst(intLocals[0], "", false, currentBlock), false); break; case ILOAD_1 : - push(new LoadInst(intLocals[1], "", currentBlock), false); + push(new LoadInst(intLocals[1], "", false, currentBlock), false); break; case ILOAD_2 : - push(new LoadInst(intLocals[2], "", currentBlock), false); + push(new LoadInst(intLocals[2], "", false, currentBlock), false); break; case ILOAD_3 : - push(new LoadInst(intLocals[3], "", currentBlock), false); + push(new LoadInst(intLocals[3], "", false, currentBlock), false); break; case LLOAD_0 : - push(new LoadInst(longLocals[0], "", currentBlock), + push(new LoadInst(longLocals[0], "", false, currentBlock), false); push(intrinsics->constantZero, false); break; case LLOAD_1 : - push(new LoadInst(longLocals[1], "", currentBlock), + push(new LoadInst(longLocals[1], "", false, currentBlock), false); push(intrinsics->constantZero, false); break; case LLOAD_2 : - push(new LoadInst(longLocals[2], "", currentBlock), + push(new LoadInst(longLocals[2], "", false, currentBlock), false); push(intrinsics->constantZero, false); break; case LLOAD_3 : - push(new LoadInst(longLocals[3], "", currentBlock), + push(new LoadInst(longLocals[3], "", false, currentBlock), false); push(intrinsics->constantZero, false); break; case FLOAD_0 : - push(new LoadInst(floatLocals[0], "", currentBlock), + push(new LoadInst(floatLocals[0], "", false, currentBlock), false); break; case FLOAD_1 : - push(new LoadInst(floatLocals[1], "", currentBlock), + push(new LoadInst(floatLocals[1], "", false, currentBlock), false); break; case FLOAD_2 : - push(new LoadInst(floatLocals[2], "", currentBlock), + push(new LoadInst(floatLocals[2], "", false, currentBlock), false); break; case FLOAD_3 : - push(new LoadInst(floatLocals[3], "", currentBlock), + push(new LoadInst(floatLocals[3], "", false, currentBlock), false); break; case DLOAD_0 : - push(new LoadInst(doubleLocals[0], "", currentBlock), + push(new LoadInst(doubleLocals[0], "", false, currentBlock), false); push(intrinsics->constantZero, false); break; case DLOAD_1 : - push(new LoadInst(doubleLocals[1], "", currentBlock), + push(new LoadInst(doubleLocals[1], "", false, currentBlock), false); push(intrinsics->constantZero, false); break; case DLOAD_2 : - push(new LoadInst(doubleLocals[2], "", currentBlock), + push(new LoadInst(doubleLocals[2], "", false, currentBlock), false); push(intrinsics->constantZero, false); break; case DLOAD_3 : - push(new LoadInst(doubleLocals[3], "", currentBlock), + push(new LoadInst(doubleLocals[3], "", false, currentBlock), false); push(intrinsics->constantZero, false); break; case ALOAD_0 : - push(new LoadInst(objectLocals[0], "", currentBlock), + push(new LoadInst(objectLocals[0], "", true, currentBlock), false); break; case ALOAD_1 : - push(new LoadInst(objectLocals[1], "", currentBlock), + push(new LoadInst(objectLocals[1], "", true, currentBlock), false); break; case ALOAD_2 : - push(new LoadInst(objectLocals[2], "", currentBlock), + push(new LoadInst(objectLocals[2], "", true, currentBlock), false); break; case ALOAD_3 : - push(new LoadInst(objectLocals[3], "", currentBlock), + push(new LoadInst(objectLocals[3], "", true, currentBlock), false); break; @@ -686,10 +686,10 @@ // Get val and object and don't pop them: IsAssignableFromFunction // may go into runtime and we don't want values in registers at that // point. - Value* val = new LoadInst(objectStack[currentStackIndex - 1], false, - currentBlock); - Value* obj = new LoadInst(objectStack[currentStackIndex - 3], false, - currentBlock); + Value* val = new LoadInst(objectStack[currentStackIndex - 1], "", + true, currentBlock); + Value* obj = new LoadInst(objectStack[currentStackIndex - 3], "", + true, currentBlock); Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, val, intrinsics->JavaObjectNullConstant, ""); @@ -1868,7 +1868,7 @@ case RET : { uint8 local = reader.readU1(); i += 1; - Value* _val = new LoadInst(objectLocals[local], "", currentBlock); + Value* _val = new LoadInst(objectLocals[local], "", true, currentBlock); Value* val = new PtrToIntInst(_val, Type::getInt32Ty(*llvmContext), "", currentBlock); SwitchInst* inst = SwitchInst::Create(val, jsrs[0], jsrs.size(), currentBlock); From nicolas.geoffray at lip6.fr Sun Aug 1 06:22:21 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 13:22:21 -0000 Subject: [vmkit-commits] [vmkit] r109978 - in /vmkit/trunk: include/j3/J3Intrinsics.h lib/J3/Compiler/J3Intrinsics.cpp lib/J3/Compiler/LowerConstantCalls.cpp Message-ID: <20100801132221.2B1162A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 08:22:20 2010 New Revision: 109978 URL: http://llvm.org/viewvc/llvm-project?rev=109978&view=rev Log: Remove getFinalObjectField, as it does not work with copying GCs. Also, ensure that all loads on Java objects are volatile. Modified: vmkit/trunk/include/j3/J3Intrinsics.h vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp Modified: vmkit/trunk/include/j3/J3Intrinsics.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/J3Intrinsics.h?rev=109978&r1=109977&r2=109978&view=diff ============================================================================== --- vmkit/trunk/include/j3/J3Intrinsics.h (original) +++ vmkit/trunk/include/j3/J3Intrinsics.h Sun Aug 1 08:22:20 2010 @@ -116,7 +116,6 @@ llvm::Function* GetFinalLongFieldFunction; llvm::Function* GetFinalFloatFieldFunction; llvm::Function* GetFinalDoubleFieldFunction; - llvm::Function* GetFinalObjectFieldFunction; llvm::Constant* JavaArraySizeOffsetConstant; llvm::Constant* JavaArrayElementsOffsetConstant; Modified: vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp?rev=109978&r1=109977&r2=109978&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp Sun Aug 1 08:22:20 2010 @@ -225,7 +225,6 @@ GetFinalLongFieldFunction = module->getFunction("getFinalLongField"); GetFinalFloatFieldFunction = module->getFunction("getFinalFloatField"); GetFinalDoubleFieldFunction = module->getFunction("getFinalDoubleField"); - GetFinalObjectFieldFunction = module->getFunction("getFinalObjectField"); #ifdef ISOLATE_SHARING GetCtpClassFunction = module->getFunction("getCtpClass"); Modified: vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp?rev=109978&r1=109977&r2=109978&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp Sun Aug 1 08:22:20 2010 @@ -197,6 +197,13 @@ } continue; } + // Make sure all Loads on objects are volatile to cooperate with the GC. + if (LoadInst* LI = dyn_cast(I)) { + if (LI->getType() == intrinsics->JavaObjectType && + dyn_cast(LI->getPointerOperand()) != NULL) { + assert(LI->isVolatile()); + } + } CallSite Call = CallSite::get(I); Instruction* CI = Call.getInstruction(); @@ -577,8 +584,7 @@ V == intrinsics->GetFinalInt32FieldFunction || V == intrinsics->GetFinalLongFieldFunction || V == intrinsics->GetFinalFloatFieldFunction || - V == intrinsics->GetFinalDoubleFieldFunction || - V == intrinsics->GetFinalObjectFieldFunction) { + V == intrinsics->GetFinalDoubleFieldFunction) { Changed = true; Value* val = Call.getArgument(0); Value* res = new LoadInst(val, "", CI); From nicolas.geoffray at lip6.fr Sun Aug 1 06:34:18 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 13:34:18 -0000 Subject: [vmkit-commits] [vmkit] r109979 - /vmkit/trunk/lib/J3/VMCore/Jni.cpp Message-ID: <20100801133418.B34C22A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 08:34:18 2010 New Revision: 109979 URL: http://llvm.org/viewvc/llvm-project?rev=109979&view=rev Log: Change static methods to non-statics. Modified: vmkit/trunk/lib/J3/VMCore/Jni.cpp Modified: vmkit/trunk/lib/J3/VMCore/Jni.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Jni.cpp?rev=109979&r1=109978&r2=109979&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/Jni.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/Jni.cpp Sun Aug 1 08:34:18 2010 @@ -22,12 +22,12 @@ using namespace j3; -static Jnjvm* myVM(JNIEnv* env) { +Jnjvm* myVM(JNIEnv* env) { return JavaThread::get()->getJVM(); } -static UserClass* getClassFromStaticMethod(Jnjvm* vm, JavaMethod* meth, - JavaObject* clazz) { +UserClass* getClassFromStaticMethod(Jnjvm* vm, JavaMethod* meth, + JavaObject* clazz) { llvm_gcroot(clazz, 0); #ifdef ISOLATE_SHARING return (UserClass*)UserCommonClass::resolvedImplClass(vm, clazz, false); From nicolas.geoffray at lip6.fr Sun Aug 1 06:46:00 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 13:46:00 -0000 Subject: [vmkit-commits] [vmkit] r109980 - /vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll Message-ID: <20100801134600.BB2F12A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 08:46:00 2010 New Revision: 109980 URL: http://llvm.org/viewvc/llvm-project?rev=109980&view=rev Log: Methods that return a JavaObject should not be marked readnone, as that object may have moved in-between the calls. Modified: vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll Modified: vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll?rev=109980&r1=109979&r2=109980&view=diff ============================================================================== --- vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll (original) +++ vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll Sun Aug 1 08:46:00 2010 @@ -150,8 +150,7 @@ ;;; j3StaticFieldLookup - Look up a specific static field. declare i8* @j3StaticFieldLookup(%JavaClass*, i32, ...) -;;; j3StringLookup - Find the isolate-specific string at the given offset in -;;; the constant pool. +;;; j3StringLookup - Get a pointer on a string. declare i8* @j3StringLookup(%JavaClass*, i32, ...) readnone ;;; j3JavaObjectAquire - This function is called when starting a synchronized @@ -176,12 +175,12 @@ ;;; getClassDelegatee - Returns the java/lang/Class representation of the ;;; class. This method is lowered to the GEP to the class delegatee in ;;; the common class. -declare %JavaObject* @getClassDelegatee(%JavaCommonClass*) readnone +declare %JavaObject* @getClassDelegatee(%JavaCommonClass*) ;;; j3RuntimeDelegatee - Returns the java/lang/Class representation of the ;;; class. This method is called if the class delegatee has not been created ;;; yet. -declare %JavaObject* @j3RuntimeDelegatee(%JavaCommonClass*) readnone +declare %JavaObject* @j3RuntimeDelegatee(%JavaCommonClass*) ;;; j3GetArrayClass - Get the array user class of the user class. declare %VT* @j3GetArrayClass(%JavaClass*, i32, %VT**) readnone @@ -192,7 +191,6 @@ declare i64 @getFinalLongField(i64*) readnone declare double @getFinalDoubleField(double*) readnone declare float @getFinalFloatField(float*) readnone -declare %JavaObject* @getFinalObjectField(%JavaObject**) readnone declare i8* @j3ResolveVirtualStub(%JavaObject*) declare i8* @j3ResolveSpecialStub() From nicolas.geoffray at lip6.fr Sun Aug 1 07:45:04 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 14:45:04 -0000 Subject: [vmkit-commits] [vmkit] r109981 - in /vmkit/trunk/mmtk/config/copyms: ./ MMTkInline.inc ObjectHeader.h Selected.java Message-ID: <20100801144504.D5FB42A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 09:45:04 2010 New Revision: 109981 URL: http://llvm.org/viewvc/llvm-project?rev=109981&view=rev Log: New supported collector: copyms. Added: vmkit/trunk/mmtk/config/copyms/ vmkit/trunk/mmtk/config/copyms/MMTkInline.inc vmkit/trunk/mmtk/config/copyms/ObjectHeader.h vmkit/trunk/mmtk/config/copyms/Selected.java Added: vmkit/trunk/mmtk/config/copyms/MMTkInline.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/config/copyms/MMTkInline.inc?rev=109981&view=auto ============================================================================== --- vmkit/trunk/mmtk/config/copyms/MMTkInline.inc (added) +++ vmkit/trunk/mmtk/config/copyms/MMTkInline.inc Sun Aug 1 09:45:04 2010 @@ -0,0 +1,542 @@ +// Generated by llvm2cpp - DO NOT MODIFY! + + +Function* makeLLVMFunction(Module *mod) { + +// Type Definitions +PointerType* PointerTy_0 = PointerType::get(IntegerType::get(mod->getContext(), 8), 0); + +std::vectorFuncTy_1_args; +FuncTy_1_args.push_back(IntegerType::get(mod->getContext(), 32)); +FuncTy_1_args.push_back(PointerTy_0); +FunctionType* FuncTy_1 = FunctionType::get( + /*Result=*/PointerTy_0, + /*Params=*/FuncTy_1_args, + /*isVarArg=*/false); + +std::vectorFuncTy_3_args; +FuncTy_3_args.push_back(IntegerType::get(mod->getContext(), 32)); +FunctionType* FuncTy_3 = FunctionType::get( + /*Result=*/PointerTy_0, + /*Params=*/FuncTy_3_args, + /*isVarArg=*/false); + +PointerType* PointerTy_2 = PointerType::get(FuncTy_3, 0); + +std::vectorStructTy_struct_mvm__MutatorThread_fields; +std::vectorStructTy_struct_mvm__Thread_fields; +std::vectorStructTy_struct_mvm__CircularBase_fields; +std::vectorFuncTy_7_args; +FunctionType* FuncTy_7 = FunctionType::get( + /*Result=*/IntegerType::get(mod->getContext(), 32), + /*Params=*/FuncTy_7_args, + /*isVarArg=*/true); + +PointerType* PointerTy_6 = PointerType::get(FuncTy_7, 0); + +PointerType* PointerTy_5 = PointerType::get(PointerTy_6, 0); + +StructTy_struct_mvm__CircularBase_fields.push_back(PointerTy_5); +PATypeHolder StructTy_struct_mvm__CircularBase_fwd = OpaqueType::get(mod->getContext()); +PointerType* PointerTy_8 = PointerType::get(StructTy_struct_mvm__CircularBase_fwd, 0); + +StructTy_struct_mvm__CircularBase_fields.push_back(PointerTy_8); +StructTy_struct_mvm__CircularBase_fields.push_back(PointerTy_8); +StructType* StructTy_struct_mvm__CircularBase = StructType::get(mod->getContext(), StructTy_struct_mvm__CircularBase_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::CircularBase", StructTy_struct_mvm__CircularBase); +cast(StructTy_struct_mvm__CircularBase_fwd.get())->refineAbstractTypeTo(StructTy_struct_mvm__CircularBase); +StructTy_struct_mvm__CircularBase = cast(StructTy_struct_mvm__CircularBase_fwd.get()); + + +StructTy_struct_mvm__Thread_fields.push_back(StructTy_struct_mvm__CircularBase); +StructTy_struct_mvm__Thread_fields.push_back(IntegerType::get(mod->getContext(), 32)); +std::vectorStructTy_struct_mvm__VirtualMachine_fields; +StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_5); +std::vectorStructTy_struct_mvm__BumpPtrAllocator_fields; +std::vectorStructTy_struct_mvm__SpinLock_fields; +StructTy_struct_mvm__SpinLock_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructType* StructTy_struct_mvm__SpinLock = StructType::get(mod->getContext(), StructTy_struct_mvm__SpinLock_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::SpinLock", StructTy_struct_mvm__SpinLock); + +StructTy_struct_mvm__BumpPtrAllocator_fields.push_back(StructTy_struct_mvm__SpinLock); +std::vectorStructTy_struct_llvm__BumpPtrAllocator_fields; +StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(IntegerType::get(mod->getContext(), 32)); +std::vectorStructTy_struct_gcRoot_fields; +StructTy_struct_gcRoot_fields.push_back(PointerTy_5); +StructType* StructTy_struct_gcRoot = StructType::get(mod->getContext(), StructTy_struct_gcRoot_fields, /*isPacked=*/false); +mod->addTypeName("struct.gcRoot", StructTy_struct_gcRoot); + +PointerType* PointerTy_11 = PointerType::get(StructTy_struct_gcRoot, 0); + +StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(PointerTy_11); +std::vectorStructTy_struct_llvm__MemSlab_fields; +StructTy_struct_llvm__MemSlab_fields.push_back(IntegerType::get(mod->getContext(), 32)); +PATypeHolder PointerTy_12_fwd = OpaqueType::get(mod->getContext()); +StructTy_struct_llvm__MemSlab_fields.push_back(PointerTy_12_fwd); +StructType* StructTy_struct_llvm__MemSlab = StructType::get(mod->getContext(), StructTy_struct_llvm__MemSlab_fields, /*isPacked=*/false); +mod->addTypeName("struct.llvm::MemSlab", StructTy_struct_llvm__MemSlab); + +PointerType* PointerTy_12 = PointerType::get(StructTy_struct_llvm__MemSlab, 0); +cast(PointerTy_12_fwd.get())->refineAbstractTypeTo(PointerTy_12); +PointerTy_12 = cast(PointerTy_12_fwd.get()); + + +StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(PointerTy_12); +StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(PointerTy_0); +StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(PointerTy_0); +StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructType* StructTy_struct_llvm__BumpPtrAllocator = StructType::get(mod->getContext(), StructTy_struct_llvm__BumpPtrAllocator_fields, /*isPacked=*/false); +mod->addTypeName("struct.llvm::BumpPtrAllocator", StructTy_struct_llvm__BumpPtrAllocator); + +StructTy_struct_mvm__BumpPtrAllocator_fields.push_back(StructTy_struct_llvm__BumpPtrAllocator); +StructType* StructTy_struct_mvm__BumpPtrAllocator = StructType::get(mod->getContext(), StructTy_struct_mvm__BumpPtrAllocator_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::BumpPtrAllocator", StructTy_struct_mvm__BumpPtrAllocator); + +PointerType* PointerTy_10 = PointerType::get(StructTy_struct_mvm__BumpPtrAllocator, 0); + +StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_10); +PATypeHolder StructTy_struct_mvm__Thread_fwd = OpaqueType::get(mod->getContext()); +PointerType* PointerTy_13 = PointerType::get(StructTy_struct_mvm__Thread_fwd, 0); + +StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_13); +StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__SpinLock); +std::vectorStructTy_struct_mvm__ReferenceQueue_fields; +std::vectorStructTy_struct_gc_fields; +StructTy_struct_gc_fields.push_back(StructTy_struct_gcRoot); +StructType* StructTy_struct_gc = StructType::get(mod->getContext(), StructTy_struct_gc_fields, /*isPacked=*/false); +mod->addTypeName("struct.gc", StructTy_struct_gc); + +PointerType* PointerTy_15 = PointerType::get(StructTy_struct_gc, 0); + +PointerType* PointerTy_14 = PointerType::get(PointerTy_15, 0); + +StructTy_struct_mvm__ReferenceQueue_fields.push_back(PointerTy_14); +StructTy_struct_mvm__ReferenceQueue_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct_mvm__ReferenceQueue_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct_mvm__ReferenceQueue_fields.push_back(StructTy_struct_mvm__SpinLock); +StructTy_struct_mvm__ReferenceQueue_fields.push_back(IntegerType::get(mod->getContext(), 8)); +StructType* StructTy_struct_mvm__ReferenceQueue = StructType::get(mod->getContext(), StructTy_struct_mvm__ReferenceQueue_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::ReferenceQueue", StructTy_struct_mvm__ReferenceQueue); + +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__ReferenceQueue); +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__ReferenceQueue); +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__ReferenceQueue); +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__SpinLock); +StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_14); +StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_14); +StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); +std::vectorStructTy_struct_mvm__Cond_fields; +std::vectorStructTy_union_pthread_cond_t_fields; +std::vectorStructTy_struct__2__13_fields; +StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 64)); +StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 64)); +StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 64)); +StructTy_struct__2__13_fields.push_back(PointerTy_0); +StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructType* StructTy_struct__2__13 = StructType::get(mod->getContext(), StructTy_struct__2__13_fields, /*isPacked=*/false); +mod->addTypeName("struct..2._13", StructTy_struct__2__13); + +StructTy_union_pthread_cond_t_fields.push_back(StructTy_struct__2__13); +ArrayType* ArrayTy_16 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 1); + +StructTy_union_pthread_cond_t_fields.push_back(ArrayTy_16); +StructType* StructTy_union_pthread_cond_t = StructType::get(mod->getContext(), StructTy_union_pthread_cond_t_fields, /*isPacked=*/false); +mod->addTypeName("union.pthread_cond_t", StructTy_union_pthread_cond_t); + +StructTy_struct_mvm__Cond_fields.push_back(StructTy_union_pthread_cond_t); +StructType* StructTy_struct_mvm__Cond = StructType::get(mod->getContext(), StructTy_struct_mvm__Cond_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::Cond", StructTy_struct_mvm__Cond); + +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__Cond); +std::vectorStructTy_struct_mvm__LockNormal_fields; +std::vectorStructTy_struct_mvm__Lock_fields; +StructTy_struct_mvm__Lock_fields.push_back(PointerTy_5); +StructTy_struct_mvm__Lock_fields.push_back(PointerTy_13); +std::vectorStructTy_union_pthread_mutex_t_fields; +std::vectorStructTy_struct__1__pthread_mutex_s_fields; +StructTy_struct__1__pthread_mutex_s_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct__1__pthread_mutex_s_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct__1__pthread_mutex_s_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct__1__pthread_mutex_s_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct__1__pthread_mutex_s_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct__1__pthread_mutex_s_fields.push_back(StructTy_struct_mvm__SpinLock); +StructType* StructTy_struct__1__pthread_mutex_s = StructType::get(mod->getContext(), StructTy_struct__1__pthread_mutex_s_fields, /*isPacked=*/false); +mod->addTypeName("struct..1__pthread_mutex_s", StructTy_struct__1__pthread_mutex_s); + +StructTy_union_pthread_mutex_t_fields.push_back(StructTy_struct__1__pthread_mutex_s); +StructType* StructTy_union_pthread_mutex_t = StructType::get(mod->getContext(), StructTy_union_pthread_mutex_t_fields, /*isPacked=*/false); +mod->addTypeName("union.pthread_mutex_t", StructTy_union_pthread_mutex_t); + +StructTy_struct_mvm__Lock_fields.push_back(StructTy_union_pthread_mutex_t); +StructType* StructTy_struct_mvm__Lock = StructType::get(mod->getContext(), StructTy_struct_mvm__Lock_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::Lock", StructTy_struct_mvm__Lock); + +StructTy_struct_mvm__LockNormal_fields.push_back(StructTy_struct_mvm__Lock); +StructType* StructTy_struct_mvm__LockNormal = StructType::get(mod->getContext(), StructTy_struct_mvm__LockNormal_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::LockNormal", StructTy_struct_mvm__LockNormal); + +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__LockNormal); +StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_14); +StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__LockNormal); +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__Cond); +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__SpinLock); +StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_11); +std::vectorStructTy_struct_mvm__CollectionRV_fields; +StructTy_struct_mvm__CollectionRV_fields.push_back(StructTy_struct_mvm__LockNormal); +StructTy_struct_mvm__CollectionRV_fields.push_back(StructTy_struct_mvm__Cond); +StructTy_struct_mvm__CollectionRV_fields.push_back(StructTy_struct_mvm__Cond); +StructTy_struct_mvm__CollectionRV_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct_mvm__CollectionRV_fields.push_back(IntegerType::get(mod->getContext(), 8)); +StructTy_struct_mvm__CollectionRV_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructType* StructTy_struct_mvm__CollectionRV = StructType::get(mod->getContext(), StructTy_struct_mvm__CollectionRV_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::CollectionRV", StructTy_struct_mvm__CollectionRV); + +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__CollectionRV); +std::vectorStructTy_struct_mvm__StartEndFunctionMap_fields; +std::vectorStructTy_struct_mvm__FunctionMap_fields; +std::vectorStructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields; +std::vectorStructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields; +std::vectorStructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false__fields; +std::vectorStructTy_struct___gnu_cxx__new_allocator_gc___fields; +StructTy_struct___gnu_cxx__new_allocator_gc___fields.push_back(IntegerType::get(mod->getContext(), 8)); +StructType* StructTy_struct___gnu_cxx__new_allocator_gc__ = StructType::get(mod->getContext(), StructTy_struct___gnu_cxx__new_allocator_gc___fields, /*isPacked=*/true); +mod->addTypeName("struct.__gnu_cxx::new_allocator", StructTy_struct___gnu_cxx__new_allocator_gc__); + +StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false__fields.push_back(StructTy_struct___gnu_cxx__new_allocator_gc__); +std::vectorStructTy_struct_std___Rb_tree_node_base_fields; +StructTy_struct_std___Rb_tree_node_base_fields.push_back(IntegerType::get(mod->getContext(), 32)); +PATypeHolder StructTy_struct_std___Rb_tree_node_base_fwd = OpaqueType::get(mod->getContext()); +PointerType* PointerTy_17 = PointerType::get(StructTy_struct_std___Rb_tree_node_base_fwd, 0); + +StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_17); +StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_17); +StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_17); +StructType* StructTy_struct_std___Rb_tree_node_base = StructType::get(mod->getContext(), StructTy_struct_std___Rb_tree_node_base_fields, /*isPacked=*/false); +mod->addTypeName("struct.std::_Rb_tree_node_base", StructTy_struct_std___Rb_tree_node_base); +cast(StructTy_struct_std___Rb_tree_node_base_fwd.get())->refineAbstractTypeTo(StructTy_struct_std___Rb_tree_node_base); +StructTy_struct_std___Rb_tree_node_base = cast(StructTy_struct_std___Rb_tree_node_base_fwd.get()); + + +StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false__fields.push_back(StructTy_struct_std___Rb_tree_node_base); +StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false__fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructType* StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false_ = StructType::get(mod->getContext(), StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false__fields, /*isPacked=*/false); +mod->addTypeName("struct.std::_Rb_tree,std::_Select1st >,std::less,std::allocator > >::_Rb_tree_impl,false>", StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false_); + +StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields.push_back(StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false_); +StructType* StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______ = StructType::get(mod->getContext(), StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields, /*isPacked=*/false); +mod->addTypeName("struct.std::_Rb_tree,std::_Select1st >,std::less,std::allocator > >", StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______); + +StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields.push_back(StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______); +StructType* StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______ = StructType::get(mod->getContext(), StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields, /*isPacked=*/false); +mod->addTypeName("struct.std::map,std::allocator > >", StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______); + +StructTy_struct_mvm__FunctionMap_fields.push_back(StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______); +StructTy_struct_mvm__FunctionMap_fields.push_back(StructTy_struct_mvm__SpinLock); +StructType* StructTy_struct_mvm__FunctionMap = StructType::get(mod->getContext(), StructTy_struct_mvm__FunctionMap_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::FunctionMap", StructTy_struct_mvm__FunctionMap); + +StructTy_struct_mvm__StartEndFunctionMap_fields.push_back(StructTy_struct_mvm__FunctionMap); +StructType* StructTy_struct_mvm__StartEndFunctionMap = StructType::get(mod->getContext(), StructTy_struct_mvm__StartEndFunctionMap_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::StartEndFunctionMap", StructTy_struct_mvm__StartEndFunctionMap); + +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__StartEndFunctionMap); +StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__StartEndFunctionMap); +StructType* StructTy_struct_mvm__VirtualMachine = StructType::get(mod->getContext(), StructTy_struct_mvm__VirtualMachine_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::VirtualMachine", StructTy_struct_mvm__VirtualMachine); + +PointerType* PointerTy_9 = PointerType::get(StructTy_struct_mvm__VirtualMachine, 0); + +StructTy_struct_mvm__Thread_fields.push_back(PointerTy_9); +StructTy_struct_mvm__Thread_fields.push_back(PointerTy_0); +StructTy_struct_mvm__Thread_fields.push_back(IntegerType::get(mod->getContext(), 8)); +StructTy_struct_mvm__Thread_fields.push_back(IntegerType::get(mod->getContext(), 8)); +StructTy_struct_mvm__Thread_fields.push_back(IntegerType::get(mod->getContext(), 8)); +StructTy_struct_mvm__Thread_fields.push_back(PointerTy_0); +StructTy_struct_mvm__Thread_fields.push_back(PointerTy_0); +std::vectorFuncTy_19_args; +FuncTy_19_args.push_back(PointerTy_13); +FunctionType* FuncTy_19 = FunctionType::get( + /*Result=*/Type::getVoidTy(mod->getContext()), + /*Params=*/FuncTy_19_args, + /*isVarArg=*/false); + +PointerType* PointerTy_18 = PointerType::get(FuncTy_19, 0); + +StructTy_struct_mvm__Thread_fields.push_back(PointerTy_18); +std::vectorStructTy_struct_mvm__KnownFrame_fields; +PATypeHolder PointerTy_20_fwd = OpaqueType::get(mod->getContext()); +StructTy_struct_mvm__KnownFrame_fields.push_back(PointerTy_20_fwd); +StructTy_struct_mvm__KnownFrame_fields.push_back(PointerTy_0); +StructType* StructTy_struct_mvm__KnownFrame = StructType::get(mod->getContext(), StructTy_struct_mvm__KnownFrame_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::KnownFrame", StructTy_struct_mvm__KnownFrame); + +PointerType* PointerTy_20 = PointerType::get(StructTy_struct_mvm__KnownFrame, 0); +cast(PointerTy_20_fwd.get())->refineAbstractTypeTo(PointerTy_20); +PointerTy_20 = cast(PointerTy_20_fwd.get()); + + +StructTy_struct_mvm__Thread_fields.push_back(PointerTy_20); +std::vectorStructTy_struct_mvm__ExceptionBuffer_fields; +PATypeHolder PointerTy_21_fwd = OpaqueType::get(mod->getContext()); +StructTy_struct_mvm__ExceptionBuffer_fields.push_back(PointerTy_21_fwd); +std::vectorStructTy_struct___jmp_buf_tag_fields; +ArrayType* ArrayTy_23 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 6); + +StructTy_struct___jmp_buf_tag_fields.push_back(ArrayTy_23); +StructTy_struct___jmp_buf_tag_fields.push_back(IntegerType::get(mod->getContext(), 32)); +std::vectorStructTy_struct___sigset_t_fields; +ArrayType* ArrayTy_24 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 32); + +StructTy_struct___sigset_t_fields.push_back(ArrayTy_24); +StructType* StructTy_struct___sigset_t = StructType::get(mod->getContext(), StructTy_struct___sigset_t_fields, /*isPacked=*/false); +mod->addTypeName("struct.__sigset_t", StructTy_struct___sigset_t); + +StructTy_struct___jmp_buf_tag_fields.push_back(StructTy_struct___sigset_t); +StructType* StructTy_struct___jmp_buf_tag = StructType::get(mod->getContext(), StructTy_struct___jmp_buf_tag_fields, /*isPacked=*/false); +mod->addTypeName("struct.__jmp_buf_tag", StructTy_struct___jmp_buf_tag); + +ArrayType* ArrayTy_22 = ArrayType::get(StructTy_struct___jmp_buf_tag, 1); + +StructTy_struct_mvm__ExceptionBuffer_fields.push_back(ArrayTy_22); +StructType* StructTy_struct_mvm__ExceptionBuffer = StructType::get(mod->getContext(), StructTy_struct_mvm__ExceptionBuffer_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::ExceptionBuffer", StructTy_struct_mvm__ExceptionBuffer); + +PointerType* PointerTy_21 = PointerType::get(StructTy_struct_mvm__ExceptionBuffer, 0); +cast(PointerTy_21_fwd.get())->refineAbstractTypeTo(PointerTy_21); +PointerTy_21 = cast(PointerTy_21_fwd.get()); + + +StructTy_struct_mvm__Thread_fields.push_back(PointerTy_21); +StructType* StructTy_struct_mvm__Thread = StructType::get(mod->getContext(), StructTy_struct_mvm__Thread_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::Thread", StructTy_struct_mvm__Thread); +cast(StructTy_struct_mvm__Thread_fwd.get())->refineAbstractTypeTo(StructTy_struct_mvm__Thread); +StructTy_struct_mvm__Thread = cast(StructTy_struct_mvm__Thread_fwd.get()); + + +StructTy_struct_mvm__MutatorThread_fields.push_back(StructTy_struct_mvm__Thread); +StructTy_struct_mvm__MutatorThread_fields.push_back(StructTy_struct_mvm__BumpPtrAllocator); +StructTy_struct_mvm__MutatorThread_fields.push_back(IntegerType::get(mod->getContext(), 32)); +StructTy_struct_mvm__MutatorThread_fields.push_back(PointerTy_18); +StructType* StructTy_struct_mvm__MutatorThread = StructType::get(mod->getContext(), StructTy_struct_mvm__MutatorThread_fields, /*isPacked=*/false); +mod->addTypeName("struct.mvm::MutatorThread", StructTy_struct_mvm__MutatorThread); + +PointerType* PointerTy_4 = PointerType::get(StructTy_struct_mvm__MutatorThread, 0); + +PointerType* PointerTy_25 = PointerType::get(IntegerType::get(mod->getContext(), 32), 0); + +std::vectorStructTy_struct_j3__JavaObject_fields; +StructTy_struct_j3__JavaObject_fields.push_back(StructTy_struct_gc); +StructTy_struct_j3__JavaObject_fields.push_back(StructTy_struct_mvm__SpinLock); +StructType* StructTy_struct_j3__JavaObject = StructType::get(mod->getContext(), StructTy_struct_j3__JavaObject_fields, /*isPacked=*/false); +mod->addTypeName("struct.j3::JavaObject", StructTy_struct_j3__JavaObject); + +PointerType* PointerTy_26 = PointerType::get(StructTy_struct_j3__JavaObject, 0); + +std::vectorStructTy_JavaObject_fields; +ArrayType* ArrayTy_VT = ArrayType::get(PointerTy_6, 0); +mod->addTypeName("VT", ArrayTy_VT); + +PointerType* PointerTy_29 = PointerType::get(ArrayTy_VT, 0); + +StructTy_JavaObject_fields.push_back(PointerTy_29); +StructTy_JavaObject_fields.push_back(PointerTy_0); +StructType* StructTy_JavaObject = StructType::get(mod->getContext(), StructTy_JavaObject_fields, /*isPacked=*/false); +mod->addTypeName("JavaObject", StructTy_JavaObject); + +PointerType* PointerTy_28 = PointerType::get(StructTy_JavaObject, 0); + +PointerType* PointerTy_27 = PointerType::get(PointerTy_28, 0); + +PointerType* PointerTy_30 = PointerType::get(PointerTy_0, 0); + +PointerType* PointerTy_31 = PointerType::get(PointerTy_29, 0); + +std::vectorFuncTy_33_args; +FuncTy_33_args.push_back(PointerTy_28); +FuncTy_33_args.push_back(PointerTy_28); +FuncTy_33_args.push_back(PointerTy_28); +FuncTy_33_args.push_back(IntegerType::get(mod->getContext(), 32)); +FuncTy_33_args.push_back(IntegerType::get(mod->getContext(), 32)); +FunctionType* FuncTy_33 = FunctionType::get( + /*Result=*/PointerTy_28, + /*Params=*/FuncTy_33_args, + /*isVarArg=*/false); + +PointerType* PointerTy_32 = PointerType::get(FuncTy_33, 0); + + +// Function Declarations + +Function* func_llvm_frameaddress = Function::Create( + /*Type=*/FuncTy_3, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"llvm.frameaddress", mod); // (external, no body) +func_llvm_frameaddress->setCallingConv(CallingConv::C); +AttrListPtr func_llvm_frameaddress_PAL; +{ + SmallVector Attrs; + AttributeWithIndex PAWI; + PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind | Attribute::ReadNone; + Attrs.push_back(PAWI); + func_llvm_frameaddress_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); + +} +func_llvm_frameaddress->setAttributes(func_llvm_frameaddress_PAL); + +Function* func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II = Function::Create( + /*Type=*/FuncTy_33, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II", mod); +func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II->setCallingConv(CallingConv::C); +AttrListPtr func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II_PAL; +{ + SmallVector Attrs; + AttributeWithIndex PAWI; + PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoInline; + Attrs.push_back(PAWI); + func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); + +} +func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II->setAttributes(func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II_PAL); + +// Global Variable Declarations + +// Constant Definitions +ConstantInt* const_int32_34 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("3"), 10)); +ConstantInt* const_int32_35 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-4"), 10)); +ConstantInt* const_int32_36 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("0"), 10)); +ConstantInt* const_int32_37 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2146435072"), 10)); +ConstantInt* const_int32_38 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2"), 10)); +ConstantInt* const_int32_39 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("5"), 10)); +ConstantInt* const_int32_40 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1"), 10)); + +// Global Variable Definitions + +Function* func_gcmalloc = Function::Create( + /*Type=*/FuncTy_1, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Name=*/"gcmalloc", mod); +func_gcmalloc->setCallingConv(CallingConv::C); +AttrListPtr func_gcmalloc_PAL; +{ + SmallVector Attrs; + AttributeWithIndex PAWI; + PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; + Attrs.push_back(PAWI); + func_gcmalloc_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); + +} +func_gcmalloc->setAttributes(func_gcmalloc_PAL); +Function::arg_iterator args = func_gcmalloc->arg_begin(); +Value* int32_sz = args++; +int32_sz->setName("sz"); +Value* ptr_VT = args++; +ptr_VT->setName("VT"); + +BasicBlock* label_entry = BasicBlock::Create(mod->getContext(), "entry",func_gcmalloc,0); +BasicBlock* label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2.exit.i.i.i",func_gcmalloc,0); +BasicBlock* label_false_IFEQ_i_i_i = BasicBlock::Create(mod->getContext(), "false IFEQ.i.i.i",func_gcmalloc,0); +BasicBlock* label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit = BasicBlock::Create(mod->getContext(), "JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2.exit",func_gcmalloc,0); + +// Block entry (label_entry) +BinaryOperator* int32_41 = BinaryOperator::Create(Instruction::Add, int32_sz, const_int32_34, "", label_entry); +BinaryOperator* int32_42 = BinaryOperator::Create(Instruction::And, int32_41, const_int32_35, "", label_entry); +CallInst* ptr_43 = CallInst::Create(func_llvm_frameaddress, const_int32_36, "", label_entry); +ptr_43->setCallingConv(CallingConv::C); +ptr_43->setTailCall(true); +AttrListPtr ptr_43_PAL; +{ + SmallVector Attrs; + AttributeWithIndex PAWI; + PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; + Attrs.push_back(PAWI); + ptr_43_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); + +} +ptr_43->setAttributes(ptr_43_PAL); + +CastInst* int32_44 = new PtrToIntInst(ptr_43, IntegerType::get(mod->getContext(), 32), "", label_entry); +BinaryOperator* int32_45 = BinaryOperator::Create(Instruction::And, int32_44, const_int32_37, "", label_entry); +CastInst* ptr_46 = new IntToPtrInst(int32_45, PointerTy_4, "", label_entry); +std::vector ptr_47_indices; +ptr_47_indices.push_back(const_int32_36); +ptr_47_indices.push_back(const_int32_38); +Instruction* ptr_47 = GetElementPtrInst::Create(ptr_46, ptr_47_indices.begin(), ptr_47_indices.end(), "", label_entry); +LoadInst* int32_48 = new LoadInst(ptr_47, "", false, label_entry); +CastInst* ptr_49 = new IntToPtrInst(int32_48, PointerTy_26, "", label_entry); +GetElementPtrInst* ptr_50 = GetElementPtrInst::Create(ptr_49, const_int32_39, "", label_entry); +CastInst* ptr_51 = new BitCastInst(ptr_50, PointerTy_27, "", label_entry); +LoadInst* ptr_52 = new LoadInst(ptr_51, "", false, label_entry); +GetElementPtrInst* ptr_53 = GetElementPtrInst::Create(ptr_52, const_int32_40, "", label_entry); +CastInst* ptr_54 = new BitCastInst(ptr_53, PointerTy_27, "", label_entry); +LoadInst* ptr_55 = new LoadInst(ptr_54, "", false, label_entry); +CastInst* int32_56 = new PtrToIntInst(ptr_55, IntegerType::get(mod->getContext(), 32), "", label_entry); +BinaryOperator* int32_57 = BinaryOperator::Create(Instruction::Add, int32_56, int32_42, "", label_entry); +CastInst* ptr_58 = new IntToPtrInst(int32_57, PointerTy_28, "", label_entry); +std::vector ptr_59_indices; +ptr_59_indices.push_back(const_int32_40); +ptr_59_indices.push_back(const_int32_40); +Instruction* ptr_59 = GetElementPtrInst::Create(ptr_52, ptr_59_indices.begin(), ptr_59_indices.end(), "", label_entry); +LoadInst* ptr_60 = new LoadInst(ptr_59, "", false, label_entry); +CastInst* ptr_61 = new BitCastInst(ptr_60, PointerTy_28, "", label_entry); +ICmpInst* int1_62 = new ICmpInst(*label_entry, ICmpInst::ICMP_UGT, ptr_58, ptr_61, ""); +BranchInst::Create(label_false_IFEQ_i_i_i, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i, int1_62, label_entry); + +// Block JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2.exit.i.i.i (label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i) +std::vector ptr_64_indices; +ptr_64_indices.push_back(const_int32_40); +ptr_64_indices.push_back(const_int32_36); +Instruction* ptr_64 = GetElementPtrInst::Create(ptr_52, ptr_64_indices.begin(), ptr_64_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i); +CastInst* ptr__c_i_i_i = new IntToPtrInst(int32_57, PointerTy_29, ".c.i.i.i", label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i); + new StoreInst(ptr__c_i_i_i, ptr_64, false, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i); +BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i); + +// Block false IFEQ.i.i.i (label_false_IFEQ_i_i_i) +std::vector ptr_67_params; +ptr_67_params.push_back(ptr_52); +ptr_67_params.push_back(ptr_55); +ptr_67_params.push_back(ptr_58); +ptr_67_params.push_back(const_int32_36); +ptr_67_params.push_back(const_int32_36); +CallInst* ptr_67 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II, ptr_67_params.begin(), ptr_67_params.end(), "", label_false_IFEQ_i_i_i); +ptr_67->setCallingConv(CallingConv::C); +ptr_67->setTailCall(true); +AttrListPtr ptr_67_PAL; +{ + SmallVector Attrs; + AttributeWithIndex PAWI; + PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; + Attrs.push_back(PAWI); + ptr_67_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); + +} +ptr_67->setAttributes(ptr_67_PAL); + +BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_false_IFEQ_i_i_i); + +// Block JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2.exit (label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit) +PHINode* ptr_69 = PHINode::Create(PointerTy_28, "", label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit); +ptr_69->reserveOperandSpace(2); +ptr_69->addIncoming(ptr_55, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i); +ptr_69->addIncoming(ptr_67, label_false_IFEQ_i_i_i); + +std::vector ptr_70_indices; +ptr_70_indices.push_back(const_int32_36); +ptr_70_indices.push_back(const_int32_36); +Instruction* ptr_70 = GetElementPtrInst::Create(ptr_69, ptr_70_indices.begin(), ptr_70_indices.end(), "", label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit); +CastInst* ptr__c_i = new BitCastInst(ptr_VT, PointerTy_29, ".c.i", label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit); + new StoreInst(ptr__c_i, ptr_70, false, label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit); +CastInst* ptr_tmp1 = new BitCastInst(ptr_69, PointerTy_0, "tmp1", label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit); +ReturnInst::Create(mod->getContext(), ptr_tmp1, label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit); +return func_gcmalloc; +} Added: vmkit/trunk/mmtk/config/copyms/ObjectHeader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/config/copyms/ObjectHeader.h?rev=109981&view=auto ============================================================================== --- vmkit/trunk/mmtk/config/copyms/ObjectHeader.h (added) +++ vmkit/trunk/mmtk/config/copyms/ObjectHeader.h Sun Aug 1 09:45:04 2010 @@ -0,0 +1,37 @@ +//===----- ObjectHeader.h - Macros for describing an object header --------===// +// +// The VMKit project +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef MVM_OBJECT_HEADER_H +#define MVM_OBJECT_HEADER_H + +#include + +namespace mvm { +#if (__WORDSIZE == 64) + static const uint64_t FatMask = 0x8000000000000000; +#else + static const uint64_t FatMask = 0x80000000; +#endif + + static const uint64_t ThinCountMask = 0xFF000; + static const uint64_t ThinCountShift = 12; + static const uint64_t ThinCountAdd = 0x1000; + + static const uint64_t NonLockBitsMask = 0xFFF; + static const uint64_t HashMask = 0xFF0; + static const uint64_t GCBitMask = 0xF; + + static const uint32_t NonLockBits = 12; + static const uint32_t HashBits = 8; + static const uint32_t GCBits = 4; + + static const bool MovesObject = true; +} + +#endif // MVM_OBJECT_HEADER_H Added: vmkit/trunk/mmtk/config/copyms/Selected.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/config/copyms/Selected.java?rev=109981&view=auto ============================================================================== --- vmkit/trunk/mmtk/config/copyms/Selected.java (added) +++ vmkit/trunk/mmtk/config/copyms/Selected.java Sun Aug 1 09:45:04 2010 @@ -0,0 +1,68 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.j3.config; + +import org.mmtk.utility.Log; + +import org.vmmagic.pragma.*; + +public class Selected { + public static final String name = "org.mmtk.plan.copyms.CopyMS"; + @Uninterruptible + public static final class Plan extends org.mmtk.plan.copyms.CopyMS + { + private static final Plan plan = new Plan(); + + @Inline + public static Plan get() { return plan; } + } + + @Uninterruptible + public static final class Constraints extends org.mmtk.plan.copyms.CopyMSConstraints + { + private static final Constraints constraints = new Constraints(); + + @Inline + public static Constraints get() { return constraints; } + } + + @Uninterruptible + public static class Collector extends org.mmtk.plan.copyms.CopyMSCollector + { + private static final Collector bootstrapCollector = new Collector(); + + public static void staticCollect() { + bootstrapCollector.collect(); + } + + public Collector() {} + @Inline + public static Collector get() { + return bootstrapCollector; + } + } + + @Uninterruptible + public static class Mutator extends org.mmtk.plan.copyms.CopyMSMutator + { + // Unused mutator used by the AOT compiler to know what instances + // will be alive during MMTk execution. This allows to inline + // virtual calls of singleton objects. + private static final Mutator unusedMutator = new Mutator(); + + public Mutator() {} + + @Inline + public static native Mutator get(); + } +} From nicolas.geoffray at lip6.fr Sun Aug 1 09:01:21 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 16:01:21 -0000 Subject: [vmkit-commits] [vmkit] r109982 - in /vmkit/trunk: include/mvm/Threads/Thread.h lib/Mvm/CommonThread/CollectionRV.cpp Message-ID: <20100801160121.BABCC2A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 11:01:21 2010 New Revision: 109982 URL: http://llvm.org/viewvc/llvm-project?rev=109982&view=rev Log: Emit atomic operations when changing states in thread. Modified: vmkit/trunk/include/mvm/Threads/Thread.h vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp Modified: vmkit/trunk/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Thread.h?rev=109982&r1=109981&r2=109982&view=diff ============================================================================== --- vmkit/trunk/include/mvm/Threads/Thread.h (original) +++ vmkit/trunk/include/mvm/Threads/Thread.h Sun Aug 1 11:01:21 2010 @@ -251,7 +251,8 @@ ++level; void* temp = __builtin_frame_address(0); while (level--) temp = ((void**)temp)[0]; - lastSP = temp; + // The cas is not necessary, but it does a memory barrier. + __sync_bool_compare_and_swap(&lastSP, 0, temp); if (doYield) joinRVBeforeEnter(); assert(lastSP && "No last SP when entering uncooperative code"); } @@ -262,7 +263,8 @@ if (isMvmThread()) { if (!inRV) { assert(!lastSP && "SP already set when entering uncooperative code"); - lastSP = SP; + // The cas is not necessary, but it does a memory barrier. + __sync_bool_compare_and_swap(&lastSP, 0, SP); if (doYield) joinRVBeforeEnter(); assert(lastSP && "No last SP when entering uncooperative code"); } @@ -273,7 +275,8 @@ if (isMvmThread()) { if (!inRV) { assert(lastSP && "No last SP when leaving uncooperative code"); - lastSP = 0; + // The cas is not necessary, but it does a memory barrier. + __sync_bool_compare_and_swap(&lastSP, lastSP, 0); // A rendezvous has just been initiated, join it. if (doYield) joinRVAfterLeave(); assert(!lastSP && "SP has a value after leaving uncooperative code"); Modified: vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp?rev=109982&r1=109981&r2=109982&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp Sun Aug 1 11:01:21 2010 @@ -59,8 +59,10 @@ assert(!cur->joinedRV); cur = (mvm::Thread*)cur->next(); } while (cur != self); + + // The CAS is not necessary but it does a memory barrier. + __sync_bool_compare_and_swap(&(self->joinedRV), false, true); - self->joinedRV = true; // Lookup currently blocked threads. for (cur = (mvm::Thread*)self->next(); cur != self; cur = (mvm::Thread*)cur->next()) { From nicolas.geoffray at lip6.fr Sun Aug 1 10:51:10 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 01 Aug 2010 17:51:10 -0000 Subject: [vmkit-commits] [vmkit] r109983 - in /vmkit/trunk/lib: J3/Compiler/JavaJIT.cpp J3/Compiler/LowerConstantCalls.cpp Mvm/Compiler/EscapeAnalysis.cpp Mvm/JITGCPass/JITGCPass.cpp Mvm/StaticGCPass/StaticGCPass.cpp Message-ID: <20100801175110.2F50B2A6C12C@llvm.org> Author: geoffray Date: Sun Aug 1 12:51:09 2010 New Revision: 109983 URL: http://llvm.org/viewvc/llvm-project?rev=109983&view=rev Log: Move to new LLVM API. Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp vmkit/trunk/lib/Mvm/JITGCPass/JITGCPass.cpp vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=109983&r1=109982&r2=109983&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Sun Aug 1 12:51:09 2010 @@ -758,8 +758,8 @@ unsigned uses = temp->getNumUses(); if (!uses) { temp->eraseFromParent(); - } else if (uses == 1 && dyn_cast(temp->use_begin())) { - dyn_cast(temp->use_begin())->eraseFromParent(); + } else if (uses == 1 && dyn_cast(*(temp->use_begin()))) { + dyn_cast(*(temp->use_begin()))->eraseFromParent(); temp->eraseFromParent(); } } @@ -773,8 +773,8 @@ unsigned uses = temp->getNumUses(); if (!uses) { temp->eraseFromParent(); - } else if (uses == 1 && dyn_cast(temp->use_begin())) { - dyn_cast(temp->use_begin())->eraseFromParent(); + } else if (uses == 1 && dyn_cast(*(temp->use_begin()))) { + dyn_cast(*(temp->use_begin()))->eraseFromParent(); temp->eraseFromParent(); } else { if (coop) { Modified: vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp?rev=109983&r1=109982&r2=109983&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp Sun Aug 1 12:51:09 2010 @@ -161,8 +161,8 @@ bool ToDelete = true; for (Value::use_iterator UI = AI->use_begin(), UE = AI->use_end(); UI != UE; ++UI) { - if (dyn_cast(UI)) continue; - if (BitCastInst* BI = dyn_cast(UI)) { + if (dyn_cast(*UI)) continue; + if (BitCastInst* BI = dyn_cast(*UI)) { if (BI->hasOneUse()) { CallSite Call = CallSite::get(*(BI->use_begin())); Instruction* CI = Call.getInstruction(); Modified: vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp?rev=109983&r1=109982&r2=109983&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp (original) +++ vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp Sun Aug 1 12:51:09 2010 @@ -83,7 +83,7 @@ bool escapesLoop = false; for (Value::use_iterator U = I->use_begin(), E = I->use_end(); U != E; ++U) { - if (Instruction* II = dyn_cast(U)) { + if (Instruction* II = dyn_cast(*U)) { BasicBlock* BBU = II->getParent(); if (!CurLoop->contains(BBU)) { escapesLoop = true; @@ -114,7 +114,7 @@ static bool escapes(Value* Ins, std::map& visited) { for (Value::use_iterator I = Ins->use_begin(), E = Ins->use_end(); I != E; ++I) { - if (Instruction* II = dyn_cast(I)) { + if (Instruction* II = dyn_cast(*I)) { if (II->getOpcode() == Instruction::Call || II->getOpcode() == Instruction::Invoke) { Modified: vmkit/trunk/lib/Mvm/JITGCPass/JITGCPass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/JITGCPass/JITGCPass.cpp?rev=109983&r1=109982&r2=109983&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/JITGCPass/JITGCPass.cpp (original) +++ vmkit/trunk/lib/Mvm/JITGCPass/JITGCPass.cpp Sun Aug 1 12:51:09 2010 @@ -48,7 +48,7 @@ for (Value::use_iterator I = gcrootFun->use_begin(), E = gcrootFun->use_end(); I != E; ++I) { - if (Instruction* II = dyn_cast(I)) { + if (Instruction* II = dyn_cast(*I)) { Function* F = II->getParent()->getParent(); if (!F->hasGC()) F->setGC("vmkit"); } Modified: vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp?rev=109983&r1=109982&r2=109983&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp (original) +++ vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp Sun Aug 1 12:51:09 2010 @@ -52,7 +52,7 @@ bool error = false; for (Value::use_iterator I = gcrootFun->use_begin(), E = gcrootFun->use_end(); I != E; ++I) { - if (Instruction* II = dyn_cast(I)) { + if (Instruction* II = dyn_cast(*I)) { Function* F = II->getParent()->getParent(); if (F->hasGC()) F->clearGC(); F->setGC("ocaml"); From nicolas.geoffray at lip6.fr Tue Aug 3 13:34:02 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 03 Aug 2010 20:34:02 -0000 Subject: [vmkit-commits] [vmkit] r110136 - /vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Message-ID: <20100803203402.EA46C2A6C12C@llvm.org> Author: geoffray Date: Tue Aug 3 15:34:02 2010 New Revision: 110136 URL: http://llvm.org/viewvc/llvm-project?rev=110136&view=rev Log: Do not print a function name that we don't have. Modified: vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Modified: vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp?rev=110136&r1=110135&r2=110136&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp (original) +++ vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Tue Aug 3 15:34:02 2010 @@ -47,7 +47,7 @@ void DefaultMethodInfo::print(void* ip, void* addr) { Dl_info info; int res = dladdr(ip, &info); - if (res != 0) { + if (res != 0 && info.dli_sname != NULL) { fprintf(stderr, "; %p (%p) in %s\n", ip, addr, info.dli_sname); } else { fprintf(stderr, "; %p in Unknown method\n", ip); From nicolas.geoffray at gmail.com Tue Aug 3 13:40:54 2010 From: nicolas.geoffray at gmail.com (nicolas geoffray) Date: Tue, 3 Aug 2010 22:40:54 +0200 Subject: [vmkit-commits] Debug logger patch (PRINT_DEBUG()) and how to turn it on/off In-Reply-To: References: Message-ID: Hi Minas, On Fri, Jul 23, 2010 at 2:30 PM, Minas Abrahamyan wrote: > Hi Nicolas, > > So, I've seen, that you preferred not to checkin logger (reanimated) > parts, the patch I've gave. > I will submit parts of it, there is some code that I think is only necessary when debugging a specific issue that I would like to remove. > And also didn't received any answer about how do you see the use of > runtime reconfiguration of logger. > There are many places in the VM that are not performance critical where we could get runtime debugging. VMKit does not support jdwp, but that may be an example on where to put runtime debugging. Nicolas > > The only scenario I can imagine for runtime is something similar to > -verbose key of 'java' utility: > <<< > -verbose[:class|gc|jni] > enable verbose output > >>> > > Also: > <<< > -Xloggc: log GC status to a file with time stamps > >>> > But this is quite a different story. > > I would prefer, in any case, to have also an option to turn off all > logging for optimized Release version, for performance. > > Regards, > Minas > > On Wed, Jul 21, 2010 at 3:15 AM, Minas Abrahamyan > wrote: > > Hi Nicolas, > > > > I think it is better to check it in anyway, since it will free me from > > unnecessary merges of that debug logging: > > since I have it, and seen it usefulness, I won't get to renounce from > > its benefits. > > Beside that, IMO, it is easier to get working after changes on > > something working than while inserting new functionality without tests > > > > What is the point reconfigurable at runtime logger? > > Debugging logs are running in debug versions, sometime - in releases > > too, but could be switched off in final release version, > > Reserving place and functions for runtime-featured logging, could have > > impact on performance... or at least it is needed a global flag/define > > to turn them totally off. (Now that define is DEBUG) > > > > -Minas > > > > On Tue, Jul 20, 2010 at 9:05 PM, nicolas geoffray > > wrote: > >> Thanks very much Minas! > >> Actually, when it comes to debugging, I would love to be able to pass > the > >> debug level information at runtime rather than at compile-time. If you > can > >> come up with a better framework for debugging than what is currently > there, > >> that would be great. In other words, I would rather change the framework > >> rather than improving it :) > >> Still, I will take a look at your patch. > >> Thanks! > >> Nicolas > >> > >> On Mon, Jul 19, 2010 at 8:18 PM, Minas Abrahamyan > > >> wrote: > >>> > >>> Hi all, > >>> > >>> Printing of debug messages is very useful for debugging of any kind; > >>> This patch allows to print them again, as it was possible few ages ago > :) > >>> Maybe not everything in right include files here, but that is better > >>> than absence of debug logs > >>> > >>> To apply: > >>> $ cd vmkit > >>> $ patch -p1 <../vmkit_debuglog.patch > >>> > >>> To turn on: uncomment vmkit/include/debug.h line 13: > >>> #define DEBUG 10 > >>> > >>> To turn off - comment it back: > >>> //#define DEBUG 10 > >>> > >>> To manage VMCore subsystem logs generation: > >>> In vmkit/lib/J3/VMCore/JnjvmConfig.h, lines 43-47: > >>> #define JNJVM_LOAD 3 > >>> #define JNJVM_COMPILE 2 > >>> > >>> JNJVM_LOAD - class loading debug level, 1-4, when 0 it is turned off > >>> JNJVM_COMPILE - methods compiling debug level, when 0 it is turned off > >>> > >>> To add new logging messages, insert something like: > >>> PRINT_DEBUG(symb, level, color, printf-like-argslist) > >>> Fotr example: > >>> PRINT_DEBUG(JNJVM_LOAD, 0, COLOR_NORMAL, "Jnjvm::loadBootstrap(){\n"); > >>> where > >>> symb - is subsystem debug level, > >>> level - is current message required level; > >>> Message is printed only if symb>level; subsystem logging level is > >>> bigger than necessary by current message level; > >>> COLOR_NORMAL - is default color. > >>> ( In fact it supports fancy colour printing on terminal, through > >>> third argument, but I'm not using it.) > >>> > >>> In this example Message will be printed if DEBUG is defined, and > >>> JNJVM_LOAD >0. > >>> > >>> PRINT_DEBUG prints to stderr. > >>> > >>> == > >>> Nicolas, please review and apply this patch. > >>> Thanks. > >>> > >>> -Minas > >>> > >>> _______________________________________________ > >>> vmkit-commits mailing list > >>> vmkit-commits at cs.uiuc.edu > >>> http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits > >>> > >> > >> > >> _______________________________________________ > >> vmkit-commits mailing list > >> vmkit-commits at cs.uiuc.edu > >> http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits > >> > >> > > > > _______________________________________________ > vmkit-commits mailing list > vmkit-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicolas.geoffray at lip6.fr Tue Aug 3 13:53:35 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 03 Aug 2010 20:53:35 -0000 Subject: [vmkit-commits] [vmkit] r110146 - in /vmkit/trunk: lib/Mvm/MMTk/MutatorThread.h mmtk/mmtk-alloc/Selected.cpp mmtk/mmtk-j3/ActivePlan.cpp Message-ID: <20100803205335.3E2E22A6C12C@llvm.org> Author: geoffray Date: Tue Aug 3 15:53:35 2010 New Revision: 110146 URL: http://llvm.org/viewvc/llvm-project?rev=110146&view=rev Log: Make thread creation and destruction safe when there is a GC happening. Modified: vmkit/trunk/lib/Mvm/MMTk/MutatorThread.h vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp vmkit/trunk/mmtk/mmtk-j3/ActivePlan.cpp Modified: vmkit/trunk/lib/Mvm/MMTk/MutatorThread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MutatorThread.h?rev=110146&r1=110145&r2=110146&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/MMTk/MutatorThread.h (original) +++ vmkit/trunk/lib/Mvm/MMTk/MutatorThread.h Tue Aug 3 15:53:35 2010 @@ -18,7 +18,9 @@ class MutatorThread : public mvm::Thread { public: - MutatorThread() : mvm::Thread() {} + MutatorThread() : mvm::Thread() { + MutatorContext = 0; + } mvm::BumpPtrAllocator Allocator; uintptr_t MutatorContext; Modified: vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp?rev=110146&r1=110145&r2=110146&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp (original) +++ vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp Tue Aug 3 15:53:35 2010 @@ -74,7 +74,9 @@ th->MutatorContext = JnJVM_org_j3_bindings_Bindings_allocateMutator__I((int32_t)_th->getThreadID()); th->realRoutine(_th); - JnJVM_org_j3_bindings_Bindings_freeMutator__Lorg_mmtk_plan_MutatorContext_2(th->MutatorContext); + uintptr_t context = th->MutatorContext; + th->MutatorContext = 0; + JnJVM_org_j3_bindings_Bindings_freeMutator__Lorg_mmtk_plan_MutatorContext_2(context); } bool Collector::isLive(gc* ptr, uintptr_t closure) { Modified: vmkit/trunk/mmtk/mmtk-j3/ActivePlan.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/ActivePlan.cpp?rev=110146&r1=110145&r2=110146&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-j3/ActivePlan.cpp (original) +++ vmkit/trunk/mmtk/mmtk-j3/ActivePlan.cpp Tue Aug 3 15:53:35 2010 @@ -34,6 +34,9 @@ A->current = (mvm::MutatorThread*)A->current->next(); } + if (A->current->MutatorContext == 0) { + return Java_org_j3_mmtk_ActivePlan_getNextMutator__(A); + } return (JavaObject*)A->current->MutatorContext; } From nicolas.geoffray at lip6.fr Tue Aug 3 14:17:00 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 03 Aug 2010 21:17:00 -0000 Subject: [vmkit-commits] [vmkit] r110147 - /vmkit/trunk/mmtk/mmtk-j3/VM.cpp Message-ID: <20100803211700.DFA192A6C12C@llvm.org> Author: geoffray Date: Tue Aug 3 16:17:00 2010 New Revision: 110147 URL: http://llvm.org/viewvc/llvm-project?rev=110147&view=rev Log: Fix signature of method. Modified: vmkit/trunk/mmtk/mmtk-j3/VM.cpp Modified: vmkit/trunk/mmtk/mmtk-j3/VM.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/VM.cpp?rev=110147&r1=110146&r2=110147&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-j3/VM.cpp (original) +++ vmkit/trunk/mmtk/mmtk-j3/VM.cpp Tue Aug 3 16:17:00 2010 @@ -37,7 +37,7 @@ abort(); } -extern "C" void Java_org_j3_runtime_VM__1assert__Z (bool cond) { +extern "C" void Java_org_j3_runtime_VM__1assert__Z (uint8_t cond) { ASSERT(cond); } From actong88 at gmail.com Sat Aug 7 23:59:09 2010 From: actong88 at gmail.com (Allan Tong) Date: Sun, 8 Aug 2010 02:59:09 -0400 Subject: [vmkit-commits] fix ThreadAllocator regression Message-ID: Attached patch fixes a regression caused by replacing alloca with ThreadAllocator. The threadAllocator goes out of scope too early, causing the temporary UTF8 object to be freed prematurely before it has actually had a chance to be used. Note I also removed the allocation failure check, mostly because it doesn't seem to be possible for ThreadAllocator to return a NULL (or at least it'll segfault long before returning). I'm not really sure what the strategy is for handling allocation failures. It seems most of the code base simply ignores that possibility. If you do choose to keep the allocation failure check, at the very least it should be moved ahead of the temp->size assignment. I had an earlier patch that simply replaced the whole thing with a call to asciizConstructUTF8, but I wasn't sure if that was correct since it would hash the name even if it couldn't find the class. Is hashUTF8 only supposed to map strings of classes that are actually loaded? - Allan -------------- next part -------------- A non-text attachment was scrubbed... Name: loadClassFromAsciiz.patch Type: text/x-patch Size: 1005 bytes Desc: not available URL: From nicolas.geoffray at lip6.fr Mon Aug 9 15:14:31 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Mon, 09 Aug 2010 22:14:31 -0000 Subject: [vmkit-commits] [vmkit] r110612 - /vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp Message-ID: <20100809221431.3E4DF2A6C12C@llvm.org> Author: geoffray Date: Mon Aug 9 17:14:31 2010 New Revision: 110612 URL: http://llvm.org/viewvc/llvm-project?rev=110612&view=rev Log: Move the threadAllocator so that it does not get deallocated too early. Patch by Allan Tong! Modified: vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp Modified: vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=110612&r1=110611&r2=110612&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp Mon Aug 9 17:14:31 2010 @@ -535,14 +535,13 @@ bool doResolve, bool doThrow) { const UTF8* name = hashUTF8->lookupAsciiz(asciiz); + mvm::ThreadAllocator threadAllocator; if (!name) name = bootstrapLoader->hashUTF8->lookupAsciiz(asciiz); if (!name) { - mvm::ThreadAllocator threadAllocator; uint32 size = strlen(asciiz); UTF8* temp = (UTF8*)threadAllocator.Allocate( sizeof(UTF8) + size * sizeof(uint16)); temp->size = size; - if (!temp) return 0; for (uint32 i = 0; i < size; ++i) { temp->elements[i] = asciiz[i]; From nicolas.geoffray at gmail.com Mon Aug 9 15:17:59 2010 From: nicolas.geoffray at gmail.com (nicolas geoffray) Date: Tue, 10 Aug 2010 00:17:59 +0200 Subject: [vmkit-commits] fix ThreadAllocator regression In-Reply-To: References: Message-ID: Thanks very much Allan for finding the bug and fixing it! About checking for allocation failure, we should definitely not check at this place but in the allocator, and just die if the allocation fails. The previous code is a left-over of some attempts to cope with exception handling. For the hash map of UTF8, you are right: we want to avoid creating an UTF8 in the map if it is not needed. The reason why we have this limitation is to implement class loader isolation, so that one class loader can not pollute the map of another class loader. Nicolas On Sun, Aug 8, 2010 at 8:59 AM, Allan Tong wrote: > Attached patch fixes a regression caused by replacing alloca with > ThreadAllocator. The threadAllocator goes out of scope too early, > causing the temporary UTF8 object to be freed prematurely before it > has actually had a chance to be used. > > Note I also removed the allocation failure check, mostly because it > doesn't seem to be possible for ThreadAllocator to return a NULL (or > at least it'll segfault long before returning). I'm not really sure > what the strategy is for handling allocation failures. It seems most > of the code base simply ignores that possibility. If you do choose to > keep the allocation failure check, at the very least it should be > moved ahead of the temp->size assignment. > > I had an earlier patch that simply replaced the whole thing with a > call to asciizConstructUTF8, but I wasn't sure if that was correct > since it would hash the name even if it couldn't find the class. Is > hashUTF8 only supposed to map strings of classes that are actually > loaded? > > - Allan > > _______________________________________________ > vmkit-commits mailing list > vmkit-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicolas.geoffray at lip6.fr Tue Aug 10 13:16:01 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 10 Aug 2010 20:16:01 -0000 Subject: [vmkit-commits] [vmkit] r110715 - /vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Message-ID: <20100810201601.AF11B2A6C12C@llvm.org> Author: geoffray Date: Tue Aug 10 15:16:01 2010 New Revision: 110715 URL: http://llvm.org/viewvc/llvm-project?rev=110715&view=rev Log: Work on pointersize instead of int32. Patch by Allan Tong! Modified: vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Modified: vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=110715&r1=110714&r2=110715&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Tue Aug 10 15:16:01 2010 @@ -1561,8 +1561,11 @@ Array, ""); Constant* CI = - ConstantExpr::getPtrToInt(GV, Type::getInt32Ty(getLLVMContext())); - CI = ConstantExpr::getAdd(CI, JavaIntrinsics.constantOne); + ConstantExpr::getPtrToInt(GV, JavaIntrinsics.pointerSizeType); + CI = ConstantExpr::getAdd(CI, + ConstantExpr::getIntegerCast(JavaIntrinsics.constantOne, + JavaIntrinsics.pointerSizeType, + false)); CI = ConstantExpr::getIntToPtr(CI, PTy); IElemts.push_back(CI); } From nicolas.geoffray at lip6.fr Fri Aug 13 22:53:13 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sat, 14 Aug 2010 05:53:13 -0000 Subject: [vmkit-commits] [vmkit] r111069 - in /vmkit/trunk: lib/J3/Compiler/LowerConstantCalls.cpp lib/Mvm/Compiler/EscapeAnalysis.cpp lib/Mvm/Compiler/InlineMalloc.cpp lib/Mvm/Compiler/LoopSafePoints.cpp lib/Mvm/JITGCPass/JITGCPass.cpp lib/Mvm/StaticGCPass/StaticGCPass.cpp mmtk/magic/LowerJavaRT.cpp mmtk/magic/LowerMagic.cpp Message-ID: <20100814055313.5A5A12A6C12C@llvm.org> Author: geoffray Date: Sat Aug 14 00:53:13 2010 New Revision: 111069 URL: http://llvm.org/viewvc/llvm-project?rev=111069&view=rev Log: Move to new LLVM API. Modified: vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp vmkit/trunk/lib/Mvm/Compiler/InlineMalloc.cpp vmkit/trunk/lib/Mvm/Compiler/LoopSafePoints.cpp vmkit/trunk/lib/Mvm/JITGCPass/JITGCPass.cpp vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp vmkit/trunk/mmtk/magic/LowerJavaRT.cpp vmkit/trunk/mmtk/magic/LowerMagic.cpp Modified: vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp?rev=111069&r1=111068&r2=111069&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp Sat Aug 14 00:53:13 2010 @@ -28,7 +28,7 @@ public: static char ID; JavaLLVMCompiler* TheCompiler; - LowerConstantCalls(JavaLLVMCompiler* Compiler) : FunctionPass((intptr_t)&ID), + LowerConstantCalls(JavaLLVMCompiler* Compiler) : FunctionPass(ID), TheCompiler(Compiler) { } virtual bool runOnFunction(Function &F); Modified: vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp?rev=111069&r1=111068&r2=111069&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp (original) +++ vmkit/trunk/lib/Mvm/Compiler/EscapeAnalysis.cpp Sat Aug 14 00:53:13 2010 @@ -33,7 +33,7 @@ public: static char ID; uint64_t pageSize; - EscapeAnalysis() : FunctionPass((intptr_t)&ID) { + EscapeAnalysis() : FunctionPass(ID) { pageSize = getpagesize(); } Modified: vmkit/trunk/lib/Mvm/Compiler/InlineMalloc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/InlineMalloc.cpp?rev=111069&r1=111068&r2=111069&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Compiler/InlineMalloc.cpp (original) +++ vmkit/trunk/lib/Mvm/Compiler/InlineMalloc.cpp Sat Aug 14 00:53:13 2010 @@ -27,7 +27,7 @@ class InlineMalloc : public FunctionPass { public: static char ID; - InlineMalloc() : FunctionPass((intptr_t)&ID) {} + InlineMalloc() : FunctionPass(ID) {} virtual bool runOnFunction(Function &F); private: Modified: vmkit/trunk/lib/Mvm/Compiler/LoopSafePoints.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/LoopSafePoints.cpp?rev=111069&r1=111068&r2=111069&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Compiler/LoopSafePoints.cpp (original) +++ vmkit/trunk/lib/Mvm/Compiler/LoopSafePoints.cpp Sat Aug 14 00:53:13 2010 @@ -21,7 +21,7 @@ public: static char ID; - LoopSafePoints() : LoopPass((intptr_t)&ID) {} + LoopSafePoints() : LoopPass(ID) {} virtual bool runOnLoop(Loop* L, LPPassManager& LPM); Modified: vmkit/trunk/lib/Mvm/JITGCPass/JITGCPass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/JITGCPass/JITGCPass.cpp?rev=111069&r1=111068&r2=111069&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/JITGCPass/JITGCPass.cpp (original) +++ vmkit/trunk/lib/Mvm/JITGCPass/JITGCPass.cpp Sat Aug 14 00:53:13 2010 @@ -22,7 +22,7 @@ public: static char ID; - JITGCPass() : ModulePass((intptr_t)&ID) {} + JITGCPass() : ModulePass(ID) {} virtual bool runOnModule(Module& M); Modified: vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp?rev=111069&r1=111068&r2=111069&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp (original) +++ vmkit/trunk/lib/Mvm/StaticGCPass/StaticGCPass.cpp Sat Aug 14 00:53:13 2010 @@ -24,7 +24,7 @@ public: static char ID; - StaticGCPass() : ModulePass((intptr_t)&ID) {} + StaticGCPass() : ModulePass(ID) {} virtual bool runOnModule(Module& M); Modified: vmkit/trunk/mmtk/magic/LowerJavaRT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/magic/LowerJavaRT.cpp?rev=111069&r1=111068&r2=111069&view=diff ============================================================================== --- vmkit/trunk/mmtk/magic/LowerJavaRT.cpp (original) +++ vmkit/trunk/mmtk/magic/LowerJavaRT.cpp Sat Aug 14 00:53:13 2010 @@ -25,7 +25,7 @@ class LowerJavaRT : public ModulePass { public: static char ID; - LowerJavaRT() : ModulePass((intptr_t)&ID) { } + LowerJavaRT() : ModulePass(ID) { } virtual bool runOnModule(Module &M); private: Modified: vmkit/trunk/mmtk/magic/LowerMagic.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/magic/LowerMagic.cpp?rev=111069&r1=111068&r2=111069&view=diff ============================================================================== --- vmkit/trunk/mmtk/magic/LowerMagic.cpp (original) +++ vmkit/trunk/mmtk/magic/LowerMagic.cpp Sat Aug 14 00:53:13 2010 @@ -27,7 +27,7 @@ class LowerMagic : public FunctionPass { public: static char ID; - LowerMagic() : FunctionPass((intptr_t)&ID) { } + LowerMagic() : FunctionPass(ID) { } virtual bool runOnFunction(Function &F); private: From nicolas.geoffray at lip6.fr Sat Aug 14 05:15:49 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sat, 14 Aug 2010 12:15:49 -0000 Subject: [vmkit-commits] [vmkit] r111071 - /vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Message-ID: <20100814121549.61EF72A6C12C@llvm.org> Author: geoffray Date: Sat Aug 14 07:15:49 2010 New Revision: 111071 URL: http://llvm.org/viewvc/llvm-project?rev=111071&view=rev Log: Don't use (the small) alternate stack for segfault, otherwise we can't have a backtrace. Modified: vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Modified: vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp?rev=111071&r1=111070&r2=111071&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Sat Aug 14 07:15:49 2010 @@ -284,13 +284,6 @@ void Thread::internalThreadStart(mvm::Thread* th) { th->baseSP = (void*)&th; - // Set an alternate stack for handling stack overflows from VM code. - stack_t sigsegvStack; - sigsegvStack.ss_size = getpagesize(); - sigsegvStack.ss_flags = 0; - sigsegvStack.ss_sp = (void*)th; - sigaltstack(&sigsegvStack, NULL); - // Set the SIGSEGV handler to diagnose errors. struct sigaction sa; sigset_t mask; From nicolas.geoffray at lip6.fr Sat Aug 14 05:25:41 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sat, 14 Aug 2010 12:25:41 -0000 Subject: [vmkit-commits] [vmkit] r111072 - in /vmkit/trunk/mmtk: config/marksweep/ java/src/org/j3/mmtk/ java/src/org/jikesrvm/ java/src/org/mmtk/plan/ java/src/org/mmtk/plan/generational/ java/src/org/mmtk/plan/generational/copying/ java/src/org/mmtk/plan/generational/immix/ java/src/org/mmtk/plan/generational/marksweep/ java/src/org/mmtk/plan/immix/ java/src/org/mmtk/plan/markcompact/ java/src/org/mmtk/plan/marksweep/ java/src/org/mmtk/plan/poisoned/ java/src/org/mmtk/plan/refcount/ java/src/org/mmtk/plan/refcount/generational... Message-ID: <20100814122542.76C222A6C12C@llvm.org> Author: geoffray Date: Sat Aug 14 07:25:41 2010 New Revision: 111072 URL: http://llvm.org/viewvc/llvm-project?rev=111072&view=rev Log: Update to MMTk 3.1.1. Added: vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/ vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriers.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersCollector.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersConstraints.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersMutator.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactCollector.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/ForwardingWord.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/HeaderByte.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/options/PerfEvents.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/PerfEvent.java Removed: vmkit/trunk/mmtk/java/src/org/mmtk/utility/options/PerfMetric.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/PerfCounter.java Modified: vmkit/trunk/mmtk/config/marksweep/MMTkInline.inc vmkit/trunk/mmtk/java/src/org/j3/mmtk/Barriers.java vmkit/trunk/mmtk/java/src/org/j3/mmtk/Statistics.java vmkit/trunk/mmtk/java/src/org/jikesrvm/Magic.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/MutatorContext.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/Plan.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/PlanConstraints.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/SimpleMutator.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/Gen.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenCollector.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenConstraints.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenMatureTraceLocal.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenMutator.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenNurseryTraceLocal.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/copying/GenCopyCollector.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/copying/GenCopyMutator.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/immix/GenImmixCollector.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/marksweep/GenMSCollector.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/immix/ImmixDefragTraceLocal.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/immix/ImmixTraceLocal.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MC.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCCollector.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCConstraints.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCMutator.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/marksweep/MSTraceLocal.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/poisoned/PoisonedConstraints.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/poisoned/PoisonedMutator.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/RCBaseConstraints.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/RCBaseMutator.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/generational/GenRCCollector.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/SSCollector.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/gctrace/GCTraceConstraints.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/gctrace/GCTraceMutator.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixConstraints.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixMutator.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixNurseryTraceLocal.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMS.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSConstraints.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSMutator.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSNurseryTraceLocal.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/CopySpace.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/ImmortalSpace.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/LargeObjectSpace.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactLocal.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactSpace.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkSweepSpace.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/SegregatedFreeListSpace.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/Space.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/ImmixSpace.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/Line.java vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/ObjectHeader.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/Constants.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/alloc/BumpPointer.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/heap/FreeListPageResource.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/heap/Map.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/heap/Mmapper.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/options/Options.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/Counter.java vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/Stats.java vmkit/trunk/mmtk/java/src/org/mmtk/vm/Barriers.java vmkit/trunk/mmtk/java/src/org/mmtk/vm/Debug.java vmkit/trunk/mmtk/java/src/org/mmtk/vm/Statistics.java vmkit/trunk/mmtk/mmtk-j3/Statistics.cpp vmkit/trunk/mmtk/mmtk-j3/VM.cpp Modified: vmkit/trunk/mmtk/config/marksweep/MMTkInline.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/config/marksweep/MMTkInline.inc?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/config/marksweep/MMTkInline.inc (original) +++ vmkit/trunk/mmtk/config/marksweep/MMTkInline.inc Sat Aug 14 07:25:41 2010 @@ -14,724 +14,61 @@ /*Params=*/FuncTy_1_args, /*isVarArg=*/false); -std::vectorFuncTy_3_args; -FuncTy_3_args.push_back(IntegerType::get(mod->getContext(), 32)); -FunctionType* FuncTy_3 = FunctionType::get( - /*Result=*/PointerTy_0, - /*Params=*/FuncTy_3_args, - /*isVarArg=*/false); - -PointerType* PointerTy_2 = PointerType::get(FuncTy_3, 0); - -std::vectorStructTy_struct_mvm__MutatorThread_fields; -std::vectorStructTy_struct_mvm__Thread_fields; -std::vectorStructTy_struct_mvm__CircularBase_fields; -std::vectorFuncTy_7_args; -FunctionType* FuncTy_7 = FunctionType::get( +std::vectorStructTy_JavaObject_fields; +std::vectorFuncTy_5_args; +FunctionType* FuncTy_5 = FunctionType::get( /*Result=*/IntegerType::get(mod->getContext(), 32), - /*Params=*/FuncTy_7_args, + /*Params=*/FuncTy_5_args, /*isVarArg=*/true); -PointerType* PointerTy_6 = PointerType::get(FuncTy_7, 0); - -PointerType* PointerTy_5 = PointerType::get(PointerTy_6, 0); - -StructTy_struct_mvm__CircularBase_fields.push_back(PointerTy_5); -PATypeHolder StructTy_struct_mvm__CircularBase_fwd = OpaqueType::get(mod->getContext()); -PointerType* PointerTy_8 = PointerType::get(StructTy_struct_mvm__CircularBase_fwd, 0); - -StructTy_struct_mvm__CircularBase_fields.push_back(PointerTy_8); -StructTy_struct_mvm__CircularBase_fields.push_back(PointerTy_8); -StructType* StructTy_struct_mvm__CircularBase = StructType::get(mod->getContext(), StructTy_struct_mvm__CircularBase_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::CircularBase", StructTy_struct_mvm__CircularBase); -cast(StructTy_struct_mvm__CircularBase_fwd.get())->refineAbstractTypeTo(StructTy_struct_mvm__CircularBase); -StructTy_struct_mvm__CircularBase = cast(StructTy_struct_mvm__CircularBase_fwd.get()); - - -StructTy_struct_mvm__Thread_fields.push_back(StructTy_struct_mvm__CircularBase); -StructTy_struct_mvm__Thread_fields.push_back(IntegerType::get(mod->getContext(), 32)); -std::vectorStructTy_struct_mvm__VirtualMachine_fields; -StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_5); -std::vectorStructTy_struct_mvm__BumpPtrAllocator_fields; -std::vectorStructTy_struct_mvm__SpinLock_fields; -StructTy_struct_mvm__SpinLock_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructType* StructTy_struct_mvm__SpinLock = StructType::get(mod->getContext(), StructTy_struct_mvm__SpinLock_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::SpinLock", StructTy_struct_mvm__SpinLock); - -StructTy_struct_mvm__BumpPtrAllocator_fields.push_back(StructTy_struct_mvm__SpinLock); -std::vectorStructTy_struct_llvm__BumpPtrAllocator_fields; -StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(IntegerType::get(mod->getContext(), 32)); -std::vectorStructTy_struct_gcRoot_fields; -StructTy_struct_gcRoot_fields.push_back(PointerTy_5); -StructType* StructTy_struct_gcRoot = StructType::get(mod->getContext(), StructTy_struct_gcRoot_fields, /*isPacked=*/false); -mod->addTypeName("struct.gcRoot", StructTy_struct_gcRoot); - -PointerType* PointerTy_11 = PointerType::get(StructTy_struct_gcRoot, 0); - -StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(PointerTy_11); -std::vectorStructTy_struct_llvm__MemSlab_fields; -StructTy_struct_llvm__MemSlab_fields.push_back(IntegerType::get(mod->getContext(), 32)); -PATypeHolder PointerTy_12_fwd = OpaqueType::get(mod->getContext()); -StructTy_struct_llvm__MemSlab_fields.push_back(PointerTy_12_fwd); -StructType* StructTy_struct_llvm__MemSlab = StructType::get(mod->getContext(), StructTy_struct_llvm__MemSlab_fields, /*isPacked=*/false); -mod->addTypeName("struct.llvm::MemSlab", StructTy_struct_llvm__MemSlab); - -PointerType* PointerTy_12 = PointerType::get(StructTy_struct_llvm__MemSlab, 0); -cast(PointerTy_12_fwd.get())->refineAbstractTypeTo(PointerTy_12); -PointerTy_12 = cast(PointerTy_12_fwd.get()); - - -StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(PointerTy_12); -StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(PointerTy_0); -StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(PointerTy_0); -StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructType* StructTy_struct_llvm__BumpPtrAllocator = StructType::get(mod->getContext(), StructTy_struct_llvm__BumpPtrAllocator_fields, /*isPacked=*/false); -mod->addTypeName("struct.llvm::BumpPtrAllocator", StructTy_struct_llvm__BumpPtrAllocator); - -StructTy_struct_mvm__BumpPtrAllocator_fields.push_back(StructTy_struct_llvm__BumpPtrAllocator); -StructType* StructTy_struct_mvm__BumpPtrAllocator = StructType::get(mod->getContext(), StructTy_struct_mvm__BumpPtrAllocator_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::BumpPtrAllocator", StructTy_struct_mvm__BumpPtrAllocator); - -PointerType* PointerTy_10 = PointerType::get(StructTy_struct_mvm__BumpPtrAllocator, 0); - -StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_10); -PATypeHolder StructTy_struct_mvm__Thread_fwd = OpaqueType::get(mod->getContext()); -PointerType* PointerTy_13 = PointerType::get(StructTy_struct_mvm__Thread_fwd, 0); - -StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_13); -StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__SpinLock); -std::vectorStructTy_struct_mvm__ReferenceQueue_fields; -std::vectorStructTy_struct_gc_fields; -StructTy_struct_gc_fields.push_back(StructTy_struct_gcRoot); -StructType* StructTy_struct_gc = StructType::get(mod->getContext(), StructTy_struct_gc_fields, /*isPacked=*/false); -mod->addTypeName("struct.gc", StructTy_struct_gc); - -PointerType* PointerTy_15 = PointerType::get(StructTy_struct_gc, 0); - -PointerType* PointerTy_14 = PointerType::get(PointerTy_15, 0); - -StructTy_struct_mvm__ReferenceQueue_fields.push_back(PointerTy_14); -StructTy_struct_mvm__ReferenceQueue_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct_mvm__ReferenceQueue_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct_mvm__ReferenceQueue_fields.push_back(StructTy_struct_mvm__SpinLock); -StructTy_struct_mvm__ReferenceQueue_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructType* StructTy_struct_mvm__ReferenceQueue = StructType::get(mod->getContext(), StructTy_struct_mvm__ReferenceQueue_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::ReferenceQueue", StructTy_struct_mvm__ReferenceQueue); - -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__ReferenceQueue); -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__ReferenceQueue); -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__ReferenceQueue); -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__SpinLock); -StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_14); -StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_14); -StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); -std::vectorStructTy_struct_mvm__Cond_fields; -std::vectorStructTy_union_pthread_cond_t_fields; -std::vectorStructTy_struct__2__13_fields; -StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 64)); -StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 64)); -StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 64)); -StructTy_struct__2__13_fields.push_back(PointerTy_0); -StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct__2__13_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructType* StructTy_struct__2__13 = StructType::get(mod->getContext(), StructTy_struct__2__13_fields, /*isPacked=*/false); -mod->addTypeName("struct..2._13", StructTy_struct__2__13); - -StructTy_union_pthread_cond_t_fields.push_back(StructTy_struct__2__13); -ArrayType* ArrayTy_16 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 1); - -StructTy_union_pthread_cond_t_fields.push_back(ArrayTy_16); -StructType* StructTy_union_pthread_cond_t = StructType::get(mod->getContext(), StructTy_union_pthread_cond_t_fields, /*isPacked=*/false); -mod->addTypeName("union.pthread_cond_t", StructTy_union_pthread_cond_t); - -StructTy_struct_mvm__Cond_fields.push_back(StructTy_union_pthread_cond_t); -StructType* StructTy_struct_mvm__Cond = StructType::get(mod->getContext(), StructTy_struct_mvm__Cond_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::Cond", StructTy_struct_mvm__Cond); - -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__Cond); -std::vectorStructTy_struct_mvm__LockNormal_fields; -std::vectorStructTy_struct_mvm__Lock_fields; -StructTy_struct_mvm__Lock_fields.push_back(PointerTy_5); -StructTy_struct_mvm__Lock_fields.push_back(PointerTy_13); -std::vectorStructTy_union_pthread_mutex_t_fields; -std::vectorStructTy_struct__1__pthread_mutex_s_fields; -StructTy_struct__1__pthread_mutex_s_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct__1__pthread_mutex_s_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct__1__pthread_mutex_s_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct__1__pthread_mutex_s_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct__1__pthread_mutex_s_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct__1__pthread_mutex_s_fields.push_back(StructTy_struct_mvm__SpinLock); -StructType* StructTy_struct__1__pthread_mutex_s = StructType::get(mod->getContext(), StructTy_struct__1__pthread_mutex_s_fields, /*isPacked=*/false); -mod->addTypeName("struct..1__pthread_mutex_s", StructTy_struct__1__pthread_mutex_s); - -StructTy_union_pthread_mutex_t_fields.push_back(StructTy_struct__1__pthread_mutex_s); -StructType* StructTy_union_pthread_mutex_t = StructType::get(mod->getContext(), StructTy_union_pthread_mutex_t_fields, /*isPacked=*/false); -mod->addTypeName("union.pthread_mutex_t", StructTy_union_pthread_mutex_t); - -StructTy_struct_mvm__Lock_fields.push_back(StructTy_union_pthread_mutex_t); -StructType* StructTy_struct_mvm__Lock = StructType::get(mod->getContext(), StructTy_struct_mvm__Lock_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::Lock", StructTy_struct_mvm__Lock); - -StructTy_struct_mvm__LockNormal_fields.push_back(StructTy_struct_mvm__Lock); -StructType* StructTy_struct_mvm__LockNormal = StructType::get(mod->getContext(), StructTy_struct_mvm__LockNormal_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::LockNormal", StructTy_struct_mvm__LockNormal); - -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__LockNormal); -StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_14); -StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct_mvm__VirtualMachine_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__LockNormal); -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__Cond); -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__SpinLock); -StructTy_struct_mvm__VirtualMachine_fields.push_back(PointerTy_11); -std::vectorStructTy_struct_mvm__CollectionRV_fields; -StructTy_struct_mvm__CollectionRV_fields.push_back(StructTy_struct_mvm__LockNormal); -StructTy_struct_mvm__CollectionRV_fields.push_back(StructTy_struct_mvm__Cond); -StructTy_struct_mvm__CollectionRV_fields.push_back(StructTy_struct_mvm__Cond); -StructTy_struct_mvm__CollectionRV_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct_mvm__CollectionRV_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructTy_struct_mvm__CollectionRV_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructType* StructTy_struct_mvm__CollectionRV = StructType::get(mod->getContext(), StructTy_struct_mvm__CollectionRV_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::CollectionRV", StructTy_struct_mvm__CollectionRV); - -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__CollectionRV); -std::vectorStructTy_struct_mvm__StartEndFunctionMap_fields; -std::vectorStructTy_struct_mvm__FunctionMap_fields; -std::vectorStructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields; -std::vectorStructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields; -std::vectorStructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false__fields; -std::vectorStructTy_struct___gnu_cxx__new_allocator_gc___fields; -StructTy_struct___gnu_cxx__new_allocator_gc___fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructType* StructTy_struct___gnu_cxx__new_allocator_gc__ = StructType::get(mod->getContext(), StructTy_struct___gnu_cxx__new_allocator_gc___fields, /*isPacked=*/true); -mod->addTypeName("struct.__gnu_cxx::new_allocator", StructTy_struct___gnu_cxx__new_allocator_gc__); - -StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false__fields.push_back(StructTy_struct___gnu_cxx__new_allocator_gc__); -std::vectorStructTy_struct_std___Rb_tree_node_base_fields; -StructTy_struct_std___Rb_tree_node_base_fields.push_back(IntegerType::get(mod->getContext(), 32)); -PATypeHolder StructTy_struct_std___Rb_tree_node_base_fwd = OpaqueType::get(mod->getContext()); -PointerType* PointerTy_17 = PointerType::get(StructTy_struct_std___Rb_tree_node_base_fwd, 0); - -StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_17); -StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_17); -StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_17); -StructType* StructTy_struct_std___Rb_tree_node_base = StructType::get(mod->getContext(), StructTy_struct_std___Rb_tree_node_base_fields, /*isPacked=*/false); -mod->addTypeName("struct.std::_Rb_tree_node_base", StructTy_struct_std___Rb_tree_node_base); -cast(StructTy_struct_std___Rb_tree_node_base_fwd.get())->refineAbstractTypeTo(StructTy_struct_std___Rb_tree_node_base); -StructTy_struct_std___Rb_tree_node_base = cast(StructTy_struct_std___Rb_tree_node_base_fwd.get()); - - -StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false__fields.push_back(StructTy_struct_std___Rb_tree_node_base); -StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false__fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructType* StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false_ = StructType::get(mod->getContext(), StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false__fields, /*isPacked=*/false); -mod->addTypeName("struct.std::_Rb_tree,std::_Select1st >,std::less,std::allocator > >::_Rb_tree_impl,false>", StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false_); - -StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields.push_back(StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_________Rb_tree_impl_std__less_const_char__false_); -StructType* StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______ = StructType::get(mod->getContext(), StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields, /*isPacked=*/false); -mod->addTypeName("struct.std::_Rb_tree,std::_Select1st >,std::less,std::allocator > >", StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______); - -StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields.push_back(StructTy_struct_std___Rb_tree_const_char_std__pair_const_char__j3__ClassPrimitive___std___Select1st_std__pair_const_char__j3__ClassPrimitive_____std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______); -StructType* StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______ = StructType::get(mod->getContext(), StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields, /*isPacked=*/false); -mod->addTypeName("struct.std::map,std::allocator > >", StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______); - -StructTy_struct_mvm__FunctionMap_fields.push_back(StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive______); -StructTy_struct_mvm__FunctionMap_fields.push_back(StructTy_struct_mvm__SpinLock); -StructType* StructTy_struct_mvm__FunctionMap = StructType::get(mod->getContext(), StructTy_struct_mvm__FunctionMap_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::FunctionMap", StructTy_struct_mvm__FunctionMap); - -StructTy_struct_mvm__StartEndFunctionMap_fields.push_back(StructTy_struct_mvm__FunctionMap); -StructType* StructTy_struct_mvm__StartEndFunctionMap = StructType::get(mod->getContext(), StructTy_struct_mvm__StartEndFunctionMap_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::StartEndFunctionMap", StructTy_struct_mvm__StartEndFunctionMap); - -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__StartEndFunctionMap); -StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__StartEndFunctionMap); -StructType* StructTy_struct_mvm__VirtualMachine = StructType::get(mod->getContext(), StructTy_struct_mvm__VirtualMachine_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::VirtualMachine", StructTy_struct_mvm__VirtualMachine); - -PointerType* PointerTy_9 = PointerType::get(StructTy_struct_mvm__VirtualMachine, 0); - -StructTy_struct_mvm__Thread_fields.push_back(PointerTy_9); -StructTy_struct_mvm__Thread_fields.push_back(PointerTy_0); -StructTy_struct_mvm__Thread_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructTy_struct_mvm__Thread_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructTy_struct_mvm__Thread_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructTy_struct_mvm__Thread_fields.push_back(PointerTy_0); -StructTy_struct_mvm__Thread_fields.push_back(PointerTy_0); -std::vectorFuncTy_19_args; -FuncTy_19_args.push_back(PointerTy_13); -FunctionType* FuncTy_19 = FunctionType::get( - /*Result=*/Type::getVoidTy(mod->getContext()), - /*Params=*/FuncTy_19_args, - /*isVarArg=*/false); - -PointerType* PointerTy_18 = PointerType::get(FuncTy_19, 0); - -StructTy_struct_mvm__Thread_fields.push_back(PointerTy_18); -std::vectorStructTy_struct_mvm__KnownFrame_fields; -PATypeHolder PointerTy_20_fwd = OpaqueType::get(mod->getContext()); -StructTy_struct_mvm__KnownFrame_fields.push_back(PointerTy_20_fwd); -StructTy_struct_mvm__KnownFrame_fields.push_back(PointerTy_0); -StructType* StructTy_struct_mvm__KnownFrame = StructType::get(mod->getContext(), StructTy_struct_mvm__KnownFrame_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::KnownFrame", StructTy_struct_mvm__KnownFrame); - -PointerType* PointerTy_20 = PointerType::get(StructTy_struct_mvm__KnownFrame, 0); -cast(PointerTy_20_fwd.get())->refineAbstractTypeTo(PointerTy_20); -PointerTy_20 = cast(PointerTy_20_fwd.get()); - - -StructTy_struct_mvm__Thread_fields.push_back(PointerTy_20); -std::vectorStructTy_struct_mvm__ExceptionBuffer_fields; -PATypeHolder PointerTy_21_fwd = OpaqueType::get(mod->getContext()); -StructTy_struct_mvm__ExceptionBuffer_fields.push_back(PointerTy_21_fwd); -std::vectorStructTy_struct___jmp_buf_tag_fields; -ArrayType* ArrayTy_23 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 6); +PointerType* PointerTy_4 = PointerType::get(FuncTy_5, 0); -StructTy_struct___jmp_buf_tag_fields.push_back(ArrayTy_23); -StructTy_struct___jmp_buf_tag_fields.push_back(IntegerType::get(mod->getContext(), 32)); -std::vectorStructTy_struct___sigset_t_fields; -ArrayType* ArrayTy_24 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 32); - -StructTy_struct___sigset_t_fields.push_back(ArrayTy_24); -StructType* StructTy_struct___sigset_t = StructType::get(mod->getContext(), StructTy_struct___sigset_t_fields, /*isPacked=*/false); -mod->addTypeName("struct.__sigset_t", StructTy_struct___sigset_t); - -StructTy_struct___jmp_buf_tag_fields.push_back(StructTy_struct___sigset_t); -StructType* StructTy_struct___jmp_buf_tag = StructType::get(mod->getContext(), StructTy_struct___jmp_buf_tag_fields, /*isPacked=*/false); -mod->addTypeName("struct.__jmp_buf_tag", StructTy_struct___jmp_buf_tag); - -ArrayType* ArrayTy_22 = ArrayType::get(StructTy_struct___jmp_buf_tag, 1); - -StructTy_struct_mvm__ExceptionBuffer_fields.push_back(ArrayTy_22); -StructType* StructTy_struct_mvm__ExceptionBuffer = StructType::get(mod->getContext(), StructTy_struct_mvm__ExceptionBuffer_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::ExceptionBuffer", StructTy_struct_mvm__ExceptionBuffer); - -PointerType* PointerTy_21 = PointerType::get(StructTy_struct_mvm__ExceptionBuffer, 0); -cast(PointerTy_21_fwd.get())->refineAbstractTypeTo(PointerTy_21); -PointerTy_21 = cast(PointerTy_21_fwd.get()); - - -StructTy_struct_mvm__Thread_fields.push_back(PointerTy_21); -StructType* StructTy_struct_mvm__Thread = StructType::get(mod->getContext(), StructTy_struct_mvm__Thread_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::Thread", StructTy_struct_mvm__Thread); -cast(StructTy_struct_mvm__Thread_fwd.get())->refineAbstractTypeTo(StructTy_struct_mvm__Thread); -StructTy_struct_mvm__Thread = cast(StructTy_struct_mvm__Thread_fwd.get()); - - -StructTy_struct_mvm__MutatorThread_fields.push_back(StructTy_struct_mvm__Thread); -StructTy_struct_mvm__MutatorThread_fields.push_back(StructTy_struct_mvm__BumpPtrAllocator); -StructTy_struct_mvm__MutatorThread_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_struct_mvm__MutatorThread_fields.push_back(PointerTy_18); -StructType* StructTy_struct_mvm__MutatorThread = StructType::get(mod->getContext(), StructTy_struct_mvm__MutatorThread_fields, /*isPacked=*/false); -mod->addTypeName("struct.mvm::MutatorThread", StructTy_struct_mvm__MutatorThread); - -PointerType* PointerTy_4 = PointerType::get(StructTy_struct_mvm__MutatorThread, 0); - -PointerType* PointerTy_25 = PointerType::get(IntegerType::get(mod->getContext(), 32), 0); - -std::vectorStructTy_struct_j3__JavaObject_fields; -StructTy_struct_j3__JavaObject_fields.push_back(StructTy_struct_gc); -StructTy_struct_j3__JavaObject_fields.push_back(StructTy_struct_mvm__SpinLock); -StructType* StructTy_struct_j3__JavaObject = StructType::get(mod->getContext(), StructTy_struct_j3__JavaObject_fields, /*isPacked=*/false); -mod->addTypeName("struct.j3::JavaObject", StructTy_struct_j3__JavaObject); - -PointerType* PointerTy_26 = PointerType::get(StructTy_struct_j3__JavaObject, 0); - -std::vectorFuncTy_28_args; -FunctionType* FuncTy_28 = FunctionType::get( - /*Result=*/Type::getVoidTy(mod->getContext()), - /*Params=*/FuncTy_28_args, - /*isVarArg=*/false); - -PointerType* PointerTy_27 = PointerType::get(FuncTy_28, 0); - -std::vectorStructTy_JavaObject_fields; -ArrayType* ArrayTy_VT = ArrayType::get(PointerTy_6, 0); +ArrayType* ArrayTy_VT = ArrayType::get(PointerTy_4, 0); mod->addTypeName("VT", ArrayTy_VT); -PointerType* PointerTy_31 = PointerType::get(ArrayTy_VT, 0); +PointerType* PointerTy_3 = PointerType::get(ArrayTy_VT, 0); -StructTy_JavaObject_fields.push_back(PointerTy_31); +StructTy_JavaObject_fields.push_back(PointerTy_3); StructTy_JavaObject_fields.push_back(PointerTy_0); StructType* StructTy_JavaObject = StructType::get(mod->getContext(), StructTy_JavaObject_fields, /*isPacked=*/false); mod->addTypeName("JavaObject", StructTy_JavaObject); -PointerType* PointerTy_30 = PointerType::get(StructTy_JavaObject, 0); - -PointerType* PointerTy_29 = PointerType::get(PointerTy_30, 0); - -PointerType* PointerTy_32 = PointerType::get(PointerTy_0, 0); - -std::vectorFuncTy_34_args; -FuncTy_34_args.push_back(PointerTy_30); -FuncTy_34_args.push_back(IntegerType::get(mod->getContext(), 32)); -FuncTy_34_args.push_back(IntegerType::get(mod->getContext(), 32)); -FuncTy_34_args.push_back(IntegerType::get(mod->getContext(), 32)); -FunctionType* FuncTy_34 = FunctionType::get( - /*Result=*/PointerTy_30, - /*Params=*/FuncTy_34_args, - /*isVarArg=*/false); - -PointerType* PointerTy_33 = PointerType::get(FuncTy_34, 0); - -PointerType* PointerTy_35 = PointerType::get(PointerTy_31, 0); - -std::vectorFuncTy_37_args; -FuncTy_37_args.push_back(PointerTy_30); -FuncTy_37_args.push_back(PointerTy_30); -FuncTy_37_args.push_back(PointerTy_30); -FuncTy_37_args.push_back(IntegerType::get(mod->getContext(), 32)); -FuncTy_37_args.push_back(IntegerType::get(mod->getContext(), 32)); -FunctionType* FuncTy_37 = FunctionType::get( - /*Result=*/PointerTy_30, - /*Params=*/FuncTy_37_args, - /*isVarArg=*/false); - -PointerType* PointerTy_36 = PointerType::get(FuncTy_37, 0); +PointerType* PointerTy_2 = PointerType::get(StructTy_JavaObject, 0); -PointerType* PointerTy_38 = PointerType::get(StructTy_struct_mvm__SpinLock, 0); - -std::vectorStructTy_40_fields; -std::vectorStructTy_41_fields; -std::vectorStructTy_42_fields; -StructTy_42_fields.push_back(StructTy_JavaObject); -StructTy_42_fields.push_back(PointerTy_30); -StructTy_42_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_42_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_42_fields.push_back(IntegerType::get(mod->getContext(), 32)); -StructTy_42_fields.push_back(PointerTy_30); -StructTy_42_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructTy_42_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructTy_42_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructTy_42_fields.push_back(PointerTy_30); -StructTy_42_fields.push_back(PointerTy_30); -StructTy_42_fields.push_back(PointerTy_30); -StructTy_42_fields.push_back(PointerTy_30); -StructTy_42_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructType* StructTy_42 = StructType::get(mod->getContext(), StructTy_42_fields, /*isPacked=*/false); - -StructTy_41_fields.push_back(StructTy_42); -StructTy_41_fields.push_back(PointerTy_30); -StructTy_41_fields.push_back(PointerTy_30); -StructTy_41_fields.push_back(PointerTy_30); -StructTy_41_fields.push_back(PointerTy_30); -StructTy_41_fields.push_back(PointerTy_30); -StructTy_41_fields.push_back(PointerTy_30); -StructTy_41_fields.push_back(PointerTy_30); -StructType* StructTy_41 = StructType::get(mod->getContext(), StructTy_41_fields, /*isPacked=*/false); - -StructTy_40_fields.push_back(StructTy_41); -StructTy_40_fields.push_back(PointerTy_30); -StructTy_40_fields.push_back(PointerTy_30); -StructTy_40_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructTy_40_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructType* StructTy_40 = StructType::get(mod->getContext(), StructTy_40_fields, /*isPacked=*/false); - -PointerType* PointerTy_39 = PointerType::get(StructTy_40, 0); - -std::vectorStructTy_44_fields; -StructTy_44_fields.push_back(StructTy_42); -StructTy_44_fields.push_back(PointerTy_30); -StructType* StructTy_44 = StructType::get(mod->getContext(), StructTy_44_fields, /*isPacked=*/false); - -PointerType* PointerTy_43 = PointerType::get(StructTy_44, 0); - -std::vectorStructTy_46_fields; -std::vectorStructTy_47_fields; -StructTy_47_fields.push_back(StructTy_42); -StructType* StructTy_47 = StructType::get(mod->getContext(), StructTy_47_fields, /*isPacked=*/false); - -StructTy_46_fields.push_back(StructTy_47); -StructTy_46_fields.push_back(PointerTy_30); -StructTy_46_fields.push_back(IntegerType::get(mod->getContext(), 8)); -StructTy_46_fields.push_back(PointerTy_30); -StructType* StructTy_46 = StructType::get(mod->getContext(), StructTy_46_fields, /*isPacked=*/false); - -PointerType* PointerTy_45 = PointerType::get(StructTy_46, 0); - -std::vectorStructTy_49_fields; -StructTy_49_fields.push_back(PointerTy_30); -StructTy_49_fields.push_back(PointerTy_30); -StructTy_49_fields.push_back(PointerTy_30); -StructTy_49_fields.push_back(PointerTy_30); -StructType* StructTy_49 = StructType::get(mod->getContext(), StructTy_49_fields, /*isPacked=*/false); - -PointerType* PointerTy_48 = PointerType::get(StructTy_49, 0); - -std::vectorFuncTy_51_args; -FuncTy_51_args.push_back(IntegerType::get(mod->getContext(), 1)); -FuncTy_51_args.push_back(IntegerType::get(mod->getContext(), 1)); -FuncTy_51_args.push_back(IntegerType::get(mod->getContext(), 1)); -FuncTy_51_args.push_back(IntegerType::get(mod->getContext(), 1)); -FuncTy_51_args.push_back(IntegerType::get(mod->getContext(), 1)); -FunctionType* FuncTy_51 = FunctionType::get( - /*Result=*/Type::getVoidTy(mod->getContext()), - /*Params=*/FuncTy_51_args, - /*isVarArg=*/false); - -PointerType* PointerTy_50 = PointerType::get(FuncTy_51, 0); - -std::vectorFuncTy_53_args; -FuncTy_53_args.push_back(PointerTy_25); -FuncTy_53_args.push_back(IntegerType::get(mod->getContext(), 32)); -FuncTy_53_args.push_back(IntegerType::get(mod->getContext(), 32)); -FunctionType* FuncTy_53 = FunctionType::get( - /*Result=*/IntegerType::get(mod->getContext(), 32), - /*Params=*/FuncTy_53_args, +std::vectorFuncTy_7_args; +FuncTy_7_args.push_back(IntegerType::get(mod->getContext(), 32)); +FuncTy_7_args.push_back(PointerTy_2); +FunctionType* FuncTy_7 = FunctionType::get( + /*Result=*/PointerTy_2, + /*Params=*/FuncTy_7_args, /*isVarArg=*/false); -PointerType* PointerTy_52 = PointerType::get(FuncTy_53, 0); +PointerType* PointerTy_6 = PointerType::get(FuncTy_7, 0); // Function Declarations -Function* func_llvm_frameaddress = Function::Create( - /*Type=*/FuncTy_3, +Function* func_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2 = Function::Create( + /*Type=*/FuncTy_7, /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"llvm.frameaddress", mod); // (external, no body) -func_llvm_frameaddress->setCallingConv(CallingConv::C); -AttrListPtr func_llvm_frameaddress_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind | Attribute::ReadNone; - Attrs.push_back(PAWI); - func_llvm_frameaddress_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -func_llvm_frameaddress->setAttributes(func_llvm_frameaddress_PAL); - -Function* func_abort = Function::Create( - /*Type=*/FuncTy_28, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"abort", mod); // (external, no body) -func_abort->setCallingConv(CallingConv::C); -AttrListPtr func_abort_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoReturn | Attribute::NoUnwind; - Attrs.push_back(PAWI); - func_abort_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -func_abort->setAttributes(func_abort_PAL); - -Function* func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III = Function::Create( - /*Type=*/FuncTy_34, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III", mod); -func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III->setCallingConv(CallingConv::C); -AttrListPtr func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III_PAL; + /*Name=*/"JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2", mod); +func_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2->setCallingConv(CallingConv::C); +AttrListPtr func_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_PAL; { SmallVector Attrs; AttributeWithIndex PAWI; PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoInline; Attrs.push_back(PAWI); - func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); + func_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); } -func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III->setAttributes(func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III_PAL); - -Function* func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II = Function::Create( - /*Type=*/FuncTy_37, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II", mod); -func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II->setCallingConv(CallingConv::C); -AttrListPtr func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoInline; - Attrs.push_back(PAWI); - func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II->setAttributes(func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II_PAL); - -Function* func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III = Function::Create( - /*Type=*/FuncTy_34, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III", mod); -func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III->setCallingConv(CallingConv::C); -AttrListPtr func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoInline; - Attrs.push_back(PAWI); - func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III->setAttributes(func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III_PAL); - -Function* func_llvm_memory_barrier = Function::Create( - /*Type=*/FuncTy_51, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"llvm.memory.barrier", mod); // (external, no body) -func_llvm_memory_barrier->setCallingConv(CallingConv::C); -AttrListPtr func_llvm_memory_barrier_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - func_llvm_memory_barrier_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -func_llvm_memory_barrier->setAttributes(func_llvm_memory_barrier_PAL); - -Function* func_llvm_atomic_cmp_swap_i32_p0i32 = Function::Create( - /*Type=*/FuncTy_53, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"llvm.atomic.cmp.swap.i32.p0i32", mod); // (external, no body) -func_llvm_atomic_cmp_swap_i32_p0i32->setCallingConv(CallingConv::C); -AttrListPtr func_llvm_atomic_cmp_swap_i32_p0i32_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 1U; PAWI.Attrs = 0 | Attribute::NoCapture; - Attrs.push_back(PAWI); - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - func_llvm_atomic_cmp_swap_i32_p0i32_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -func_llvm_atomic_cmp_swap_i32_p0i32->setAttributes(func_llvm_atomic_cmp_swap_i32_p0i32_PAL); - -Function* func__ZN3mvm6Thread5yieldEv = Function::Create( - /*Type=*/FuncTy_28, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"_ZN3mvm6Thread5yieldEv", mod); // (external, no body) -func__ZN3mvm6Thread5yieldEv->setCallingConv(CallingConv::C); -AttrListPtr func__ZN3mvm6Thread5yieldEv_PAL; -func__ZN3mvm6Thread5yieldEv->setAttributes(func__ZN3mvm6Thread5yieldEv_PAL); +func_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2->setAttributes(func_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_PAL); // Global Variable Declarations -GlobalVariable* gvar_struct_finalObject67 = new GlobalVariable(/*Module=*/*mod, -/*Type=*/StructTy_40, -/*isConstant=*/false, -/*Linkage=*/GlobalValue::ExternalLinkage, -/*Initializer=*/0, // has initializer, specified below -/*Name=*/"finalObject67"); - -GlobalVariable* gvar_struct_finalObject2 = new GlobalVariable(/*Module=*/*mod, -/*Type=*/StructTy_44, -/*isConstant=*/false, -/*Linkage=*/GlobalValue::ExternalLinkage, -/*Initializer=*/0, // has initializer, specified below -/*Name=*/"finalObject2"); - -GlobalVariable* gvar_struct_finalObject32 = new GlobalVariable(/*Module=*/*mod, -/*Type=*/StructTy_46, -/*isConstant=*/false, -/*Linkage=*/GlobalValue::ExternalLinkage, -/*Initializer=*/0, // has initializer, specified below -/*Name=*/"finalObject32"); - -GlobalVariable* gvar_struct_org_mmtk_utility_DoublyLinkedList_static = new GlobalVariable(/*Module=*/*mod, -/*Type=*/StructTy_49, -/*isConstant=*/false, -/*Linkage=*/GlobalValue::ExternalLinkage, -/*Initializer=*/0, // has initializer, specified below -/*Name=*/"org_mmtk_utility_DoublyLinkedList_static"); - -GlobalVariable* gvar_struct_finalObject85 = new GlobalVariable(/*Module=*/*mod, -/*Type=*/StructTy_40, -/*isConstant=*/false, -/*Linkage=*/GlobalValue::ExternalLinkage, -/*Initializer=*/0, // has initializer, specified below -/*Name=*/"finalObject85"); - -GlobalVariable* gvar_struct_finalObject101 = new GlobalVariable(/*Module=*/*mod, -/*Type=*/StructTy_46, -/*isConstant=*/false, -/*Linkage=*/GlobalValue::ExternalLinkage, -/*Initializer=*/0, // has initializer, specified below -/*Name=*/"finalObject101"); - -GlobalVariable* gvar_struct_finalObject122 = new GlobalVariable(/*Module=*/*mod, -/*Type=*/StructTy_40, -/*isConstant=*/false, -/*Linkage=*/GlobalValue::ExternalLinkage, -/*Initializer=*/0, // has initializer, specified below -/*Name=*/"finalObject122"); - // Constant Definitions -ConstantInt* const_int32_54 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("3"), 10)); -ConstantInt* const_int32_55 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-4"), 10)); -ConstantInt* const_int32_56 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("0"), 10)); -ConstantInt* const_int32_57 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2146435072"), 10)); -ConstantInt* const_int32_58 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2"), 10)); -ConstantInt* const_int32_59 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("8193"), 10)); -ConstantInt* const_int32_60 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("4"), 10)); -ConstantInt* const_int32_61 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("7"), 10)); -ConstantInt* const_int32_62 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("8"), 10)); -ConstantInt* const_int32_63 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-1"), 10)); -ConstantInt* const_int32_64 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("63"), 10)); -ConstantInt* const_int32_65 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("127"), 10)); -ConstantInt* const_int32_66 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("255"), 10)); -ConstantInt* const_int32_67 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("511"), 10)); -ConstantInt* const_int32_68 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2047"), 10)); -ConstantInt* const_int32_69 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("10"), 10)); -ConstantInt* const_int32_70 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("32"), 10)); -ConstantInt* const_int32_71 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("12"), 10)); -ConstantInt* const_int32_72 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("5"), 10)); -ConstantInt* const_int32_73 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("16"), 10)); -ConstantInt* const_int32_74 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("6"), 10)); -ConstantInt* const_int32_75 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("20"), 10)); -ConstantInt* const_int32_76 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("26"), 10)); -ConstantInt* const_int32_77 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1"), 10)); -ConstantPointerNull* const_ptr_78 = ConstantPointerNull::get(PointerTy_31); -ConstantInt* const_int32_79 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-16"), 10)); -std::vector const_ptr_80_indices; -const_ptr_80_indices.push_back(const_int32_56); -const_ptr_80_indices.push_back(const_int32_58); -Constant* const_ptr_80 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject67, &const_ptr_80_indices[0], const_ptr_80_indices.size()); -ConstantInt* const_int32_81 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-2"), 10)); -std::vector const_ptr_82_indices; -const_ptr_82_indices.push_back(const_int32_56); -const_ptr_82_indices.push_back(const_int32_77); -Constant* const_ptr_82 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject2, &const_ptr_82_indices[0], const_ptr_82_indices.size()); -std::vector const_ptr_83_indices; -const_ptr_83_indices.push_back(const_int32_56); -const_ptr_83_indices.push_back(const_int32_77); -Constant* const_ptr_83 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject32, &const_ptr_83_indices[0], const_ptr_83_indices.size()); -std::vector const_ptr_84_indices; -const_ptr_84_indices.push_back(const_int32_56); -const_ptr_84_indices.push_back(const_int32_54); -Constant* const_ptr_84 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject32, &const_ptr_84_indices[0], const_ptr_84_indices.size()); -ConstantInt* const_int32_85 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-32"), 10)); -ConstantPointerNull* const_ptr_86 = ConstantPointerNull::get(PointerTy_0); -std::vector const_ptr_87_indices; -const_ptr_87_indices.push_back(const_int32_56); -const_ptr_87_indices.push_back(const_int32_58); -Constant* const_ptr_87 = ConstantExpr::getGetElementPtr(gvar_struct_org_mmtk_utility_DoublyLinkedList_static, &const_ptr_87_indices[0], const_ptr_87_indices.size()); -ConstantPointerNull* const_ptr_88 = ConstantPointerNull::get(PointerTy_30); -ConstantInt* const_int32_89 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1000"), 10)); -ConstantInt* const_int1_90 = ConstantInt::get(mod->getContext(), APInt(1, StringRef("-1"), 10)); -std::vector const_ptr_91_indices; -const_ptr_91_indices.push_back(const_int32_56); -const_ptr_91_indices.push_back(const_int32_58); -Constant* const_ptr_91 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject85, &const_ptr_91_indices[0], const_ptr_91_indices.size()); -std::vector const_ptr_92_indices; -const_ptr_92_indices.push_back(const_int32_56); -const_ptr_92_indices.push_back(const_int32_77); -Constant* const_ptr_92 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject101, &const_ptr_92_indices[0], const_ptr_92_indices.size()); -std::vector const_ptr_93_indices; -const_ptr_93_indices.push_back(const_int32_56); -const_ptr_93_indices.push_back(const_int32_54); -Constant* const_ptr_93 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject101, &const_ptr_93_indices[0], const_ptr_93_indices.size()); -std::vector const_ptr_94_indices; -const_ptr_94_indices.push_back(const_int32_56); -const_ptr_94_indices.push_back(const_int32_58); -Constant* const_ptr_94 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject122, &const_ptr_94_indices[0], const_ptr_94_indices.size()); +ConstantInt* const_int32_8 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("3"), 10)); +ConstantInt* const_int32_9 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-4"), 10)); // Global Variable Definitions @@ -757,1155 +94,29 @@ ptr_VT->setName("VT"); BasicBlock* label_entry = BasicBlock::Create(mod->getContext(), "entry",func_gcmalloc,0); -BasicBlock* label_tableswitch_i_i1_i = BasicBlock::Create(mod->getContext(), "tableswitch.i.i1.i",func_gcmalloc,0); -BasicBlock* label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II.exit.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_4_i_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*4.i.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_6_i_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*6.i.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_7_i_i1_i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*7.i.i1.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_8_i_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*8.i.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_9_i_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*9.i.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT16_i_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT16.i.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT17_i_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT17.i.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT18_i_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT18.i.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT19_i_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT19.i.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT20_i_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT20.i.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I.exit.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF__i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IFNE_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IFNE.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II.exit.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2.exit.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IFEQ_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IFEQ.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_tableswitch3_i_i4_i = BasicBlock::Create(mod->getContext(), "tableswitch3.i.i4.i",func_gcmalloc,0); -BasicBlock* label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II.exit.i5.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_4_i_i_i6_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*4.i.i.i6.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_6_i_i_i7_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*6.i.i.i7.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_7_i_i1_i8_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*7.i.i1.i8.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_8_i_i_i9_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*8.i.i.i9.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_9_i_i_i10_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*9.i.i.i10.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT16_i_i_i11_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT16.i.i.i11.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT17_i_i_i12_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT17.i.i.i12.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT18_i_i_i13_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT18.i.i.i13.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT19_i_i_i14_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT19.i.i.i14.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT20_i_i_i15_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT20.i.i.i15.i.i.i",func_gcmalloc,0); -BasicBlock* label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I.exit.i16.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF__i17_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*.i17.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IFNE_i21_i_i_i = BasicBlock::Create(mod->getContext(), "false IFNE.i21.i.i.i",func_gcmalloc,0); -BasicBlock* label_tableswitch5_i_i6_i = BasicBlock::Create(mod->getContext(), "tableswitch5.i.i6.i",func_gcmalloc,0); -BasicBlock* label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II.exit.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_4_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*4.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_6_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*6.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_7_i_i1_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*7.i.i1.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_8_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*8.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_9_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*9.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT16_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT16.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT17_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT17.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT18_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT18.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT19_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT19.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IF_ICMPGT20_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IF_ICMPGT20.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I.exit.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF__i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*.i.i.i",func_gcmalloc,0); -BasicBlock* label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III.exit.i.i",func_gcmalloc,0); -BasicBlock* label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII.exit.i",func_gcmalloc,0); -BasicBlock* label_tableswitch_i_i_i = BasicBlock::Create(mod->getContext(), "tableswitch.i.i.i",func_gcmalloc,0); -BasicBlock* label_tableswitch1_i_i_i = BasicBlock::Create(mod->getContext(), "tableswitch1.i.i.i",func_gcmalloc,0); -BasicBlock* label_tableswitch2_i_i_i = BasicBlock::Create(mod->getContext(), "tableswitch2.i.i.i",func_gcmalloc,0); -BasicBlock* label_tableswitch3_i_i_i = BasicBlock::Create(mod->getContext(), "tableswitch3.i.i.i",func_gcmalloc,0); -BasicBlock* label_true_IF_NULL_i1_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "true IF*NULL.i1.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_1_i3_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*1.i3.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_true_IFNULL_i5_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "true IFNULL.i5.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_bb_i_i34_i = BasicBlock::Create(mod->getContext(), "bb.i.i34.i",func_gcmalloc,0); -BasicBlock* label_bb1_i_i35_i = BasicBlock::Create(mod->getContext(), "bb1.i.i35.i",func_gcmalloc,0); -BasicBlock* label_bb2_i_i36_i = BasicBlock::Create(mod->getContext(), "bb2.i.i36.i",func_gcmalloc,0); -BasicBlock* label_bb4_preheader_i_i37_i = BasicBlock::Create(mod->getContext(), "bb4.preheader.i.i37.i",func_gcmalloc,0); -BasicBlock* label_bb3_i_i38_i = BasicBlock::Create(mod->getContext(), "bb3.i.i38.i",func_gcmalloc,0); -BasicBlock* label_false_IFNE_i7_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IFNE.i7.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_true_IFNULL3_i8_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "true IFNULL3.i8.i.i.i.i.i",func_gcmalloc,0); -BasicBlock* label_tableswitch4_i_i_i = BasicBlock::Create(mod->getContext(), "tableswitch4.i.i.i",func_gcmalloc,0); -BasicBlock* label_tableswitch5_i_i_i = BasicBlock::Create(mod->getContext(), "tableswitch5.i.i.i",func_gcmalloc,0); -BasicBlock* label_true_IF_NULL_i1_i_i3_i_i_i = BasicBlock::Create(mod->getContext(), "true IF*NULL.i1.i.i3.i.i.i",func_gcmalloc,0); -BasicBlock* label_GOTO_or_IF_1_i3_i_i5_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*1.i3.i.i5.i.i.i",func_gcmalloc,0); -BasicBlock* label_true_IFNULL_i5_i_i6_i_i_i = BasicBlock::Create(mod->getContext(), "true IFNULL.i5.i.i6.i.i.i",func_gcmalloc,0); -BasicBlock* label_bb_i_i_i = BasicBlock::Create(mod->getContext(), "bb.i.i.i",func_gcmalloc,0); -BasicBlock* label_bb1_i_i_i = BasicBlock::Create(mod->getContext(), "bb1.i.i.i",func_gcmalloc,0); -BasicBlock* label_bb2_i_i_i = BasicBlock::Create(mod->getContext(), "bb2.i.i.i",func_gcmalloc,0); -BasicBlock* label_bb4_preheader_i_i_i = BasicBlock::Create(mod->getContext(), "bb4.preheader.i.i.i",func_gcmalloc,0); -BasicBlock* label_bb3_i_i_i = BasicBlock::Create(mod->getContext(), "bb3.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IFNE_i7_i_i8_i_i_i = BasicBlock::Create(mod->getContext(), "false IFNE.i7.i.i8.i.i.i",func_gcmalloc,0); -BasicBlock* label_true_IFNULL3_i8_i_i9_i_i_i = BasicBlock::Create(mod->getContext(), "true IFNULL3.i8.i.i9.i.i.i",func_gcmalloc,0); -BasicBlock* label_false_IFNE_i_i = BasicBlock::Create(mod->getContext(), "false IFNE.i.i",func_gcmalloc,0); -BasicBlock* label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit = BasicBlock::Create(mod->getContext(), "JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2.exit",func_gcmalloc,0); // Block entry (label_entry) -BinaryOperator* int32_95 = BinaryOperator::Create(Instruction::Add, int32_sz, const_int32_54, "", label_entry); -BinaryOperator* int32_96 = BinaryOperator::Create(Instruction::And, int32_95, const_int32_55, "", label_entry); -CallInst* ptr_97 = CallInst::Create(func_llvm_frameaddress, const_int32_56, "", label_entry); -ptr_97->setCallingConv(CallingConv::C); -ptr_97->setTailCall(true); -AttrListPtr ptr_97_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - ptr_97_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -ptr_97->setAttributes(ptr_97_PAL); - -CastInst* int32_98 = new PtrToIntInst(ptr_97, IntegerType::get(mod->getContext(), 32), "", label_entry); -BinaryOperator* int32_99 = BinaryOperator::Create(Instruction::And, int32_98, const_int32_57, "", label_entry); -CastInst* ptr_100 = new IntToPtrInst(int32_99, PointerTy_4, "", label_entry); -std::vector ptr_101_indices; -ptr_101_indices.push_back(const_int32_56); -ptr_101_indices.push_back(const_int32_58); -Instruction* ptr_101 = GetElementPtrInst::Create(ptr_100, ptr_101_indices.begin(), ptr_101_indices.end(), "", label_entry); -LoadInst* int32_102 = new LoadInst(ptr_101, "", false, label_entry); -CastInst* ptr_103 = new IntToPtrInst(int32_102, PointerTy_26, "", label_entry); -ICmpInst* int1_104 = new ICmpInst(*label_entry, ICmpInst::ICMP_SLT, int32_96, const_int32_59, ""); -SelectInst* int32_storemerge_i_i = SelectInst::Create(int1_104, const_int32_56, const_int32_60, "storemerge.i.i", label_entry); -SwitchInst* void_105 = SwitchInst::Create(int32_storemerge_i_i, label_tableswitch_i_i1_i, 7, label_entry); -void_105->addCase(const_int32_56, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i); -void_105->addCase(const_int32_58, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i); -void_105->addCase(const_int32_54, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -void_105->addCase(const_int32_60, label_tableswitch3_i_i4_i); -void_105->addCase(const_int32_61, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i); -void_105->addCase(const_int32_62, label_tableswitch5_i_i6_i); - - -// Block tableswitch.i.i1.i (label_tableswitch_i_i1_i) -CallInst* void_106 = CallInst::Create(func_abort, "", label_tableswitch_i_i1_i); -void_106->setCallingConv(CallingConv::C); -void_106->setTailCall(true); -AttrListPtr void_106_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoReturn | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_106_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_106->setAttributes(void_106_PAL); - -new UnreachableInst(mod->getContext(), label_tableswitch_i_i1_i); - -// Block JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II.exit.i.i.i.i (label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i) -GetElementPtrInst* ptr_108 = GetElementPtrInst::Create(ptr_103, const_int32_60, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i); -CastInst* ptr_109 = new BitCastInst(ptr_108, PointerTy_29, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i); -LoadInst* ptr_110 = new LoadInst(ptr_109, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i); -BinaryOperator* int32_111 = BinaryOperator::Create(Instruction::Add, int32_96, const_int32_63, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i); -ICmpInst* int1_112 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i, ICmpInst::ICMP_SGT, int32_111, const_int32_64, ""); -BranchInst::Create(label_GOTO_or_IF_4_i_i_i_i_i_i, label_false_IF_ICMPGT16_i_i_i_i_i_i, int1_112, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i); - -// Block GOTO or IF*4.i.i.i.i.i.i (label_GOTO_or_IF_4_i_i_i_i_i_i) -ICmpInst* int1_114 = new ICmpInst(*label_GOTO_or_IF_4_i_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_111, const_int32_65, ""); -BranchInst::Create(label_GOTO_or_IF_6_i_i_i_i_i_i, label_false_IF_ICMPGT17_i_i_i_i_i_i, int1_114, label_GOTO_or_IF_4_i_i_i_i_i_i); - -// Block GOTO or IF*6.i.i.i.i.i.i (label_GOTO_or_IF_6_i_i_i_i_i_i) -ICmpInst* int1_116 = new ICmpInst(*label_GOTO_or_IF_6_i_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_111, const_int32_66, ""); -BranchInst::Create(label_GOTO_or_IF_7_i_i1_i_i_i_i, label_false_IF_ICMPGT18_i_i_i_i_i_i, int1_116, label_GOTO_or_IF_6_i_i_i_i_i_i); - -// Block GOTO or IF*7.i.i1.i.i.i.i (label_GOTO_or_IF_7_i_i1_i_i_i_i) -ICmpInst* int1_118 = new ICmpInst(*label_GOTO_or_IF_7_i_i1_i_i_i_i, ICmpInst::ICMP_SGT, int32_111, const_int32_67, ""); -BranchInst::Create(label_GOTO_or_IF_8_i_i_i_i_i_i, label_false_IF_ICMPGT19_i_i_i_i_i_i, int1_118, label_GOTO_or_IF_7_i_i1_i_i_i_i); - -// Block GOTO or IF*8.i.i.i.i.i.i (label_GOTO_or_IF_8_i_i_i_i_i_i) -ICmpInst* int1_120 = new ICmpInst(*label_GOTO_or_IF_8_i_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_111, const_int32_68, ""); -BranchInst::Create(label_GOTO_or_IF_9_i_i_i_i_i_i, label_false_IF_ICMPGT20_i_i_i_i_i_i, int1_120, label_GOTO_or_IF_8_i_i_i_i_i_i); - -// Block GOTO or IF*9.i.i.i.i.i.i (label_GOTO_or_IF_9_i_i_i_i_i_i) -BinaryOperator* int32_122 = BinaryOperator::Create(Instruction::AShr, int32_111, const_int32_69, "", label_GOTO_or_IF_9_i_i_i_i_i_i); -BinaryOperator* int32_123 = BinaryOperator::Create(Instruction::Add, int32_122, const_int32_70, "", label_GOTO_or_IF_9_i_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i, label_GOTO_or_IF_9_i_i_i_i_i_i); - -// Block false IF_ICMPGT16.i.i.i.i.i.i (label_false_IF_ICMPGT16_i_i_i_i_i_i) -BinaryOperator* int32_125 = BinaryOperator::Create(Instruction::AShr, int32_111, const_int32_58, "", label_false_IF_ICMPGT16_i_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i, label_false_IF_ICMPGT16_i_i_i_i_i_i); - -// Block false IF_ICMPGT17.i.i.i.i.i.i (label_false_IF_ICMPGT17_i_i_i_i_i_i) -BinaryOperator* int32_127 = BinaryOperator::Create(Instruction::AShr, int32_111, const_int32_60, "", label_false_IF_ICMPGT17_i_i_i_i_i_i); -BinaryOperator* int32_128 = BinaryOperator::Create(Instruction::Add, int32_127, const_int32_71, "", label_false_IF_ICMPGT17_i_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i, label_false_IF_ICMPGT17_i_i_i_i_i_i); - -// Block false IF_ICMPGT18.i.i.i.i.i.i (label_false_IF_ICMPGT18_i_i_i_i_i_i) -BinaryOperator* int32_130 = BinaryOperator::Create(Instruction::AShr, int32_111, const_int32_72, "", label_false_IF_ICMPGT18_i_i_i_i_i_i); -BinaryOperator* int32_131 = BinaryOperator::Create(Instruction::Add, int32_130, const_int32_73, "", label_false_IF_ICMPGT18_i_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i, label_false_IF_ICMPGT18_i_i_i_i_i_i); - -// Block false IF_ICMPGT19.i.i.i.i.i.i (label_false_IF_ICMPGT19_i_i_i_i_i_i) -BinaryOperator* int32_133 = BinaryOperator::Create(Instruction::AShr, int32_111, const_int32_74, "", label_false_IF_ICMPGT19_i_i_i_i_i_i); -BinaryOperator* int32_134 = BinaryOperator::Create(Instruction::Add, int32_133, const_int32_75, "", label_false_IF_ICMPGT19_i_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i, label_false_IF_ICMPGT19_i_i_i_i_i_i); - -// Block false IF_ICMPGT20.i.i.i.i.i.i (label_false_IF_ICMPGT20_i_i_i_i_i_i) -BinaryOperator* int32_136 = BinaryOperator::Create(Instruction::AShr, int32_111, const_int32_62, "", label_false_IF_ICMPGT20_i_i_i_i_i_i); -BinaryOperator* int32_137 = BinaryOperator::Create(Instruction::Add, int32_136, const_int32_76, "", label_false_IF_ICMPGT20_i_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i, label_false_IF_ICMPGT20_i_i_i_i_i_i); - -// Block JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I.exit.i.i.i.i (label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i) -PHINode* int32_139 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i); -int32_139->reserveOperandSpace(6); -int32_139->addIncoming(int32_125, label_false_IF_ICMPGT16_i_i_i_i_i_i); -int32_139->addIncoming(int32_128, label_false_IF_ICMPGT17_i_i_i_i_i_i); -int32_139->addIncoming(int32_131, label_false_IF_ICMPGT18_i_i_i_i_i_i); -int32_139->addIncoming(int32_134, label_false_IF_ICMPGT19_i_i_i_i_i_i); -int32_139->addIncoming(int32_137, label_false_IF_ICMPGT20_i_i_i_i_i_i); -int32_139->addIncoming(int32_123, label_GOTO_or_IF_9_i_i_i_i_i_i); - -std::vector ptr_140_indices; -ptr_140_indices.push_back(const_int32_77); -ptr_140_indices.push_back(const_int32_77); -Instruction* ptr_140 = GetElementPtrInst::Create(ptr_110, ptr_140_indices.begin(), ptr_140_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i); -LoadInst* ptr_141 = new LoadInst(ptr_140, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i); -BinaryOperator* int32_142 = BinaryOperator::Create(Instruction::Add, int32_139, const_int32_77, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i); -CastInst* ptr_143 = new BitCastInst(ptr_141, PointerTy_25, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i); -GetElementPtrInst* ptr_144 = GetElementPtrInst::Create(ptr_143, int32_142, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i); -LoadInst* int32_145 = new LoadInst(ptr_144, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i); -CastInst* ptr_146 = new IntToPtrInst(int32_145, PointerTy_30, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i); -ICmpInst* int1_147 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i, ICmpInst::ICMP_EQ, int32_145, const_int32_56, ""); -BranchInst::Create(label_GOTO_or_IF__i_i_i_i, label_false_IFNE_i_i_i_i, int1_147, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i); - -// Block GOTO or IF*.i.i.i.i (label_GOTO_or_IF__i_i_i_i) -std::vector ptr_149_params; -ptr_149_params.push_back(ptr_110); -ptr_149_params.push_back(int32_96); -ptr_149_params.push_back(const_int32_56); -ptr_149_params.push_back(const_int32_56); -CallInst* ptr_149 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III, ptr_149_params.begin(), ptr_149_params.end(), "", label_GOTO_or_IF__i_i_i_i); -ptr_149->setCallingConv(CallingConv::C); -ptr_149->setTailCall(true); -AttrListPtr ptr_149_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - ptr_149_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -ptr_149->setAttributes(ptr_149_PAL); - -BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, label_GOTO_or_IF__i_i_i_i); - -// Block false IFNE.i.i.i.i (label_false_IFNE_i_i_i_i) -CastInst* ptr_151 = new IntToPtrInst(int32_145, PointerTy_29, "", label_false_IFNE_i_i_i_i); -LoadInst* ptr_152 = new LoadInst(ptr_151, "", false, label_false_IFNE_i_i_i_i); -CastInst* int32_153 = new PtrToIntInst(ptr_152, IntegerType::get(mod->getContext(), 32), "", label_false_IFNE_i_i_i_i); - new StoreInst(int32_153, ptr_144, false, label_false_IFNE_i_i_i_i); -std::vector ptr_155_indices; -ptr_155_indices.push_back(const_int32_56); -ptr_155_indices.push_back(const_int32_56); -Instruction* ptr_155 = GetElementPtrInst::Create(ptr_146, ptr_155_indices.begin(), ptr_155_indices.end(), "", label_false_IFNE_i_i_i_i); - new StoreInst(const_ptr_78, ptr_155, false, label_false_IFNE_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, label_false_IFNE_i_i_i_i); - -// Block JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II.exit.i.i.i.i (label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i) -GetElementPtrInst* ptr_158 = GetElementPtrInst::Create(ptr_103, const_int32_58, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -CastInst* ptr_159 = new BitCastInst(ptr_158, PointerTy_29, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -LoadInst* ptr_160 = new LoadInst(ptr_159, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -GetElementPtrInst* ptr_161 = GetElementPtrInst::Create(ptr_160, const_int32_77, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -CastInst* ptr_162 = new BitCastInst(ptr_161, PointerTy_29, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -LoadInst* ptr_163 = new LoadInst(ptr_162, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -CastInst* int32_164 = new PtrToIntInst(ptr_163, IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -BinaryOperator* int32_165 = BinaryOperator::Create(Instruction::Add, int32_164, int32_96, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -CastInst* ptr_166 = new IntToPtrInst(int32_165, PointerTy_30, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -std::vector ptr_167_indices; -ptr_167_indices.push_back(const_int32_77); -ptr_167_indices.push_back(const_int32_77); -Instruction* ptr_167 = GetElementPtrInst::Create(ptr_160, ptr_167_indices.begin(), ptr_167_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -LoadInst* ptr_168 = new LoadInst(ptr_167, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -CastInst* ptr_169 = new BitCastInst(ptr_168, PointerTy_30, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); -ICmpInst* int1_170 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i, ICmpInst::ICMP_UGT, ptr_166, ptr_169, ""); -BranchInst::Create(label_false_IFEQ_i_i_i_i, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i_i, int1_170, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i); - -// Block JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2.exit.i.i.i.i (label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i_i) -std::vector ptr_172_indices; -ptr_172_indices.push_back(const_int32_77); -ptr_172_indices.push_back(const_int32_56); -Instruction* ptr_172 = GetElementPtrInst::Create(ptr_160, ptr_172_indices.begin(), ptr_172_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i_i); -CastInst* ptr__c_i_i_i_i = new IntToPtrInst(int32_165, PointerTy_31, ".c.i.i.i.i", label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i_i); - new StoreInst(ptr__c_i_i_i_i, ptr_172, false, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i_i); - -// Block false IFEQ.i.i.i.i (label_false_IFEQ_i_i_i_i) -std::vector ptr_175_params; -ptr_175_params.push_back(ptr_160); -ptr_175_params.push_back(ptr_163); -ptr_175_params.push_back(ptr_166); -ptr_175_params.push_back(const_int32_56); -ptr_175_params.push_back(const_int32_56); -CallInst* ptr_175 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II, ptr_175_params.begin(), ptr_175_params.end(), "", label_false_IFEQ_i_i_i_i); -ptr_175->setCallingConv(CallingConv::C); -ptr_175->setTailCall(true); -AttrListPtr ptr_175_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - ptr_175_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -ptr_175->setAttributes(ptr_175_PAL); - -BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, label_false_IFEQ_i_i_i_i); - -// Block tableswitch3.i.i4.i (label_tableswitch3_i_i4_i) -std::vector ptr_177_indices; -ptr_177_indices.push_back(const_int32_58); -ptr_177_indices.push_back(const_int32_77); -Instruction* ptr_177 = GetElementPtrInst::Create(ptr_103, ptr_177_indices.begin(), ptr_177_indices.end(), "", label_tableswitch3_i_i4_i); -CastInst* ptr_178 = new BitCastInst(ptr_177, PointerTy_32, "", label_tableswitch3_i_i4_i); -LoadInst* ptr_179 = new LoadInst(ptr_178, "", false, label_tableswitch3_i_i4_i); -CastInst* ptr_180 = new BitCastInst(ptr_179, PointerTy_30, "", label_tableswitch3_i_i4_i); -std::vector ptr_181_params; -ptr_181_params.push_back(ptr_180); -ptr_181_params.push_back(int32_96); -ptr_181_params.push_back(const_int32_56); -ptr_181_params.push_back(const_int32_56); -CallInst* ptr_181 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III, ptr_181_params.begin(), ptr_181_params.end(), "", label_tableswitch3_i_i4_i); -ptr_181->setCallingConv(CallingConv::C); -ptr_181->setTailCall(true); -AttrListPtr ptr_181_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - ptr_181_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -ptr_181->setAttributes(ptr_181_PAL); - -BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, label_tableswitch3_i_i4_i); - -// Block JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II.exit.i5.i.i.i (label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i) -GetElementPtrInst* ptr_183 = GetElementPtrInst::Create(ptr_103, const_int32_54, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i); -CastInst* ptr_184 = new BitCastInst(ptr_183, PointerTy_29, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i); -LoadInst* ptr_185 = new LoadInst(ptr_184, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i); -BinaryOperator* int32_186 = BinaryOperator::Create(Instruction::Add, int32_96, const_int32_63, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i); -ICmpInst* int1_187 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i, ICmpInst::ICMP_SGT, int32_186, const_int32_64, ""); -BranchInst::Create(label_GOTO_or_IF_4_i_i_i6_i_i_i, label_false_IF_ICMPGT16_i_i_i11_i_i_i, int1_187, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i); - -// Block GOTO or IF*4.i.i.i6.i.i.i (label_GOTO_or_IF_4_i_i_i6_i_i_i) -ICmpInst* int1_189 = new ICmpInst(*label_GOTO_or_IF_4_i_i_i6_i_i_i, ICmpInst::ICMP_SGT, int32_186, const_int32_65, ""); -BranchInst::Create(label_GOTO_or_IF_6_i_i_i7_i_i_i, label_false_IF_ICMPGT17_i_i_i12_i_i_i, int1_189, label_GOTO_or_IF_4_i_i_i6_i_i_i); - -// Block GOTO or IF*6.i.i.i7.i.i.i (label_GOTO_or_IF_6_i_i_i7_i_i_i) -ICmpInst* int1_191 = new ICmpInst(*label_GOTO_or_IF_6_i_i_i7_i_i_i, ICmpInst::ICMP_SGT, int32_186, const_int32_66, ""); -BranchInst::Create(label_GOTO_or_IF_7_i_i1_i8_i_i_i, label_false_IF_ICMPGT18_i_i_i13_i_i_i, int1_191, label_GOTO_or_IF_6_i_i_i7_i_i_i); - -// Block GOTO or IF*7.i.i1.i8.i.i.i (label_GOTO_or_IF_7_i_i1_i8_i_i_i) -ICmpInst* int1_193 = new ICmpInst(*label_GOTO_or_IF_7_i_i1_i8_i_i_i, ICmpInst::ICMP_SGT, int32_186, const_int32_67, ""); -BranchInst::Create(label_GOTO_or_IF_8_i_i_i9_i_i_i, label_false_IF_ICMPGT19_i_i_i14_i_i_i, int1_193, label_GOTO_or_IF_7_i_i1_i8_i_i_i); - -// Block GOTO or IF*8.i.i.i9.i.i.i (label_GOTO_or_IF_8_i_i_i9_i_i_i) -ICmpInst* int1_195 = new ICmpInst(*label_GOTO_or_IF_8_i_i_i9_i_i_i, ICmpInst::ICMP_SGT, int32_186, const_int32_68, ""); -BranchInst::Create(label_GOTO_or_IF_9_i_i_i10_i_i_i, label_false_IF_ICMPGT20_i_i_i15_i_i_i, int1_195, label_GOTO_or_IF_8_i_i_i9_i_i_i); - -// Block GOTO or IF*9.i.i.i10.i.i.i (label_GOTO_or_IF_9_i_i_i10_i_i_i) -BinaryOperator* int32_197 = BinaryOperator::Create(Instruction::AShr, int32_186, const_int32_69, "", label_GOTO_or_IF_9_i_i_i10_i_i_i); -BinaryOperator* int32_198 = BinaryOperator::Create(Instruction::Add, int32_197, const_int32_70, "", label_GOTO_or_IF_9_i_i_i10_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i, label_GOTO_or_IF_9_i_i_i10_i_i_i); - -// Block false IF_ICMPGT16.i.i.i11.i.i.i (label_false_IF_ICMPGT16_i_i_i11_i_i_i) -BinaryOperator* int32_200 = BinaryOperator::Create(Instruction::AShr, int32_186, const_int32_58, "", label_false_IF_ICMPGT16_i_i_i11_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i, label_false_IF_ICMPGT16_i_i_i11_i_i_i); - -// Block false IF_ICMPGT17.i.i.i12.i.i.i (label_false_IF_ICMPGT17_i_i_i12_i_i_i) -BinaryOperator* int32_202 = BinaryOperator::Create(Instruction::AShr, int32_186, const_int32_60, "", label_false_IF_ICMPGT17_i_i_i12_i_i_i); -BinaryOperator* int32_203 = BinaryOperator::Create(Instruction::Add, int32_202, const_int32_71, "", label_false_IF_ICMPGT17_i_i_i12_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i, label_false_IF_ICMPGT17_i_i_i12_i_i_i); - -// Block false IF_ICMPGT18.i.i.i13.i.i.i (label_false_IF_ICMPGT18_i_i_i13_i_i_i) -BinaryOperator* int32_205 = BinaryOperator::Create(Instruction::AShr, int32_186, const_int32_72, "", label_false_IF_ICMPGT18_i_i_i13_i_i_i); -BinaryOperator* int32_206 = BinaryOperator::Create(Instruction::Add, int32_205, const_int32_73, "", label_false_IF_ICMPGT18_i_i_i13_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i, label_false_IF_ICMPGT18_i_i_i13_i_i_i); - -// Block false IF_ICMPGT19.i.i.i14.i.i.i (label_false_IF_ICMPGT19_i_i_i14_i_i_i) -BinaryOperator* int32_208 = BinaryOperator::Create(Instruction::AShr, int32_186, const_int32_74, "", label_false_IF_ICMPGT19_i_i_i14_i_i_i); -BinaryOperator* int32_209 = BinaryOperator::Create(Instruction::Add, int32_208, const_int32_75, "", label_false_IF_ICMPGT19_i_i_i14_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i, label_false_IF_ICMPGT19_i_i_i14_i_i_i); - -// Block false IF_ICMPGT20.i.i.i15.i.i.i (label_false_IF_ICMPGT20_i_i_i15_i_i_i) -BinaryOperator* int32_211 = BinaryOperator::Create(Instruction::AShr, int32_186, const_int32_62, "", label_false_IF_ICMPGT20_i_i_i15_i_i_i); -BinaryOperator* int32_212 = BinaryOperator::Create(Instruction::Add, int32_211, const_int32_76, "", label_false_IF_ICMPGT20_i_i_i15_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i, label_false_IF_ICMPGT20_i_i_i15_i_i_i); - -// Block JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I.exit.i16.i.i.i (label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i) -PHINode* int32_214 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i); -int32_214->reserveOperandSpace(6); -int32_214->addIncoming(int32_200, label_false_IF_ICMPGT16_i_i_i11_i_i_i); -int32_214->addIncoming(int32_203, label_false_IF_ICMPGT17_i_i_i12_i_i_i); -int32_214->addIncoming(int32_206, label_false_IF_ICMPGT18_i_i_i13_i_i_i); -int32_214->addIncoming(int32_209, label_false_IF_ICMPGT19_i_i_i14_i_i_i); -int32_214->addIncoming(int32_212, label_false_IF_ICMPGT20_i_i_i15_i_i_i); -int32_214->addIncoming(int32_198, label_GOTO_or_IF_9_i_i_i10_i_i_i); - -std::vector ptr_215_indices; -ptr_215_indices.push_back(const_int32_77); -ptr_215_indices.push_back(const_int32_77); -Instruction* ptr_215 = GetElementPtrInst::Create(ptr_185, ptr_215_indices.begin(), ptr_215_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i); -LoadInst* ptr_216 = new LoadInst(ptr_215, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i); -BinaryOperator* int32_217 = BinaryOperator::Create(Instruction::Add, int32_214, const_int32_77, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i); -CastInst* ptr_218 = new BitCastInst(ptr_216, PointerTy_25, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i); -GetElementPtrInst* ptr_219 = GetElementPtrInst::Create(ptr_218, int32_217, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i); -LoadInst* int32_220 = new LoadInst(ptr_219, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i); -CastInst* ptr_221 = new IntToPtrInst(int32_220, PointerTy_30, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i); -ICmpInst* int1_222 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i, ICmpInst::ICMP_EQ, int32_220, const_int32_56, ""); -BranchInst::Create(label_GOTO_or_IF__i17_i_i_i, label_false_IFNE_i21_i_i_i, int1_222, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i); - -// Block GOTO or IF*.i17.i.i.i (label_GOTO_or_IF__i17_i_i_i) -std::vector ptr_224_params; -ptr_224_params.push_back(ptr_185); -ptr_224_params.push_back(int32_96); -ptr_224_params.push_back(const_int32_56); -ptr_224_params.push_back(const_int32_56); -CallInst* ptr_224 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III, ptr_224_params.begin(), ptr_224_params.end(), "", label_GOTO_or_IF__i17_i_i_i); -ptr_224->setCallingConv(CallingConv::C); -ptr_224->setTailCall(true); -AttrListPtr ptr_224_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - ptr_224_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -ptr_224->setAttributes(ptr_224_PAL); - -BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, label_GOTO_or_IF__i17_i_i_i); - -// Block false IFNE.i21.i.i.i (label_false_IFNE_i21_i_i_i) -CastInst* ptr_226 = new IntToPtrInst(int32_220, PointerTy_29, "", label_false_IFNE_i21_i_i_i); -LoadInst* ptr_227 = new LoadInst(ptr_226, "", false, label_false_IFNE_i21_i_i_i); -CastInst* int32_228 = new PtrToIntInst(ptr_227, IntegerType::get(mod->getContext(), 32), "", label_false_IFNE_i21_i_i_i); - new StoreInst(int32_228, ptr_219, false, label_false_IFNE_i21_i_i_i); -std::vector ptr_230_indices; -ptr_230_indices.push_back(const_int32_56); -ptr_230_indices.push_back(const_int32_56); -Instruction* ptr_230 = GetElementPtrInst::Create(ptr_221, ptr_230_indices.begin(), ptr_230_indices.end(), "", label_false_IFNE_i21_i_i_i); - new StoreInst(const_ptr_78, ptr_230, false, label_false_IFNE_i21_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, label_false_IFNE_i21_i_i_i); - -// Block tableswitch5.i.i6.i (label_tableswitch5_i_i6_i) -std::vector ptr_233_indices; -ptr_233_indices.push_back(const_int32_54); -ptr_233_indices.push_back(const_int32_77); -Instruction* ptr_233 = GetElementPtrInst::Create(ptr_103, ptr_233_indices.begin(), ptr_233_indices.end(), "", label_tableswitch5_i_i6_i); -CastInst* ptr_234 = new BitCastInst(ptr_233, PointerTy_32, "", label_tableswitch5_i_i6_i); -LoadInst* ptr_235 = new LoadInst(ptr_234, "", false, label_tableswitch5_i_i6_i); -CastInst* ptr_236 = new BitCastInst(ptr_235, PointerTy_30, "", label_tableswitch5_i_i6_i); -std::vector ptr_237_params; -ptr_237_params.push_back(ptr_236); -ptr_237_params.push_back(int32_96); -ptr_237_params.push_back(const_int32_56); -ptr_237_params.push_back(const_int32_56); -CallInst* ptr_237 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III, ptr_237_params.begin(), ptr_237_params.end(), "", label_tableswitch5_i_i6_i); -ptr_237->setCallingConv(CallingConv::C); -ptr_237->setTailCall(true); -AttrListPtr ptr_237_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - ptr_237_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -ptr_237->setAttributes(ptr_237_PAL); - -BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, label_tableswitch5_i_i6_i); - -// Block JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II.exit.i.i.i (label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i) -std::vector ptr_239_indices; -ptr_239_indices.push_back(const_int32_60); -ptr_239_indices.push_back(const_int32_77); -Instruction* ptr_239 = GetElementPtrInst::Create(ptr_103, ptr_239_indices.begin(), ptr_239_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i); -CastInst* ptr_240 = new BitCastInst(ptr_239, PointerTy_32, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i); -LoadInst* ptr_241 = new LoadInst(ptr_240, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i); -CastInst* ptr_242 = new BitCastInst(ptr_241, PointerTy_30, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i); -BinaryOperator* int32_243 = BinaryOperator::Create(Instruction::Add, int32_96, const_int32_63, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i); -ICmpInst* int1_244 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i, ICmpInst::ICMP_SGT, int32_243, const_int32_64, ""); -BranchInst::Create(label_GOTO_or_IF_4_i_i_i_i_i, label_false_IF_ICMPGT16_i_i_i_i_i, int1_244, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i); - -// Block GOTO or IF*4.i.i.i.i.i (label_GOTO_or_IF_4_i_i_i_i_i) -ICmpInst* int1_246 = new ICmpInst(*label_GOTO_or_IF_4_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_243, const_int32_65, ""); -BranchInst::Create(label_GOTO_or_IF_6_i_i_i_i_i, label_false_IF_ICMPGT17_i_i_i_i_i, int1_246, label_GOTO_or_IF_4_i_i_i_i_i); - -// Block GOTO or IF*6.i.i.i.i.i (label_GOTO_or_IF_6_i_i_i_i_i) -ICmpInst* int1_248 = new ICmpInst(*label_GOTO_or_IF_6_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_243, const_int32_66, ""); -BranchInst::Create(label_GOTO_or_IF_7_i_i1_i_i_i, label_false_IF_ICMPGT18_i_i_i_i_i, int1_248, label_GOTO_or_IF_6_i_i_i_i_i); - -// Block GOTO or IF*7.i.i1.i.i.i (label_GOTO_or_IF_7_i_i1_i_i_i) -ICmpInst* int1_250 = new ICmpInst(*label_GOTO_or_IF_7_i_i1_i_i_i, ICmpInst::ICMP_SGT, int32_243, const_int32_67, ""); -BranchInst::Create(label_GOTO_or_IF_8_i_i_i_i_i, label_false_IF_ICMPGT19_i_i_i_i_i, int1_250, label_GOTO_or_IF_7_i_i1_i_i_i); - -// Block GOTO or IF*8.i.i.i.i.i (label_GOTO_or_IF_8_i_i_i_i_i) -ICmpInst* int1_252 = new ICmpInst(*label_GOTO_or_IF_8_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_243, const_int32_68, ""); -BranchInst::Create(label_GOTO_or_IF_9_i_i_i_i_i, label_false_IF_ICMPGT20_i_i_i_i_i, int1_252, label_GOTO_or_IF_8_i_i_i_i_i); - -// Block GOTO or IF*9.i.i.i.i.i (label_GOTO_or_IF_9_i_i_i_i_i) -BinaryOperator* int32_254 = BinaryOperator::Create(Instruction::AShr, int32_243, const_int32_69, "", label_GOTO_or_IF_9_i_i_i_i_i); -BinaryOperator* int32_255 = BinaryOperator::Create(Instruction::Add, int32_254, const_int32_70, "", label_GOTO_or_IF_9_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i, label_GOTO_or_IF_9_i_i_i_i_i); - -// Block false IF_ICMPGT16.i.i.i.i.i (label_false_IF_ICMPGT16_i_i_i_i_i) -BinaryOperator* int32_257 = BinaryOperator::Create(Instruction::AShr, int32_243, const_int32_58, "", label_false_IF_ICMPGT16_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i, label_false_IF_ICMPGT16_i_i_i_i_i); - -// Block false IF_ICMPGT17.i.i.i.i.i (label_false_IF_ICMPGT17_i_i_i_i_i) -BinaryOperator* int32_259 = BinaryOperator::Create(Instruction::AShr, int32_243, const_int32_60, "", label_false_IF_ICMPGT17_i_i_i_i_i); -BinaryOperator* int32_260 = BinaryOperator::Create(Instruction::Add, int32_259, const_int32_71, "", label_false_IF_ICMPGT17_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i, label_false_IF_ICMPGT17_i_i_i_i_i); - -// Block false IF_ICMPGT18.i.i.i.i.i (label_false_IF_ICMPGT18_i_i_i_i_i) -BinaryOperator* int32_262 = BinaryOperator::Create(Instruction::AShr, int32_243, const_int32_72, "", label_false_IF_ICMPGT18_i_i_i_i_i); -BinaryOperator* int32_263 = BinaryOperator::Create(Instruction::Add, int32_262, const_int32_73, "", label_false_IF_ICMPGT18_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i, label_false_IF_ICMPGT18_i_i_i_i_i); - -// Block false IF_ICMPGT19.i.i.i.i.i (label_false_IF_ICMPGT19_i_i_i_i_i) -BinaryOperator* int32_265 = BinaryOperator::Create(Instruction::AShr, int32_243, const_int32_74, "", label_false_IF_ICMPGT19_i_i_i_i_i); -BinaryOperator* int32_266 = BinaryOperator::Create(Instruction::Add, int32_265, const_int32_75, "", label_false_IF_ICMPGT19_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i, label_false_IF_ICMPGT19_i_i_i_i_i); - -// Block false IF_ICMPGT20.i.i.i.i.i (label_false_IF_ICMPGT20_i_i_i_i_i) -BinaryOperator* int32_268 = BinaryOperator::Create(Instruction::AShr, int32_243, const_int32_62, "", label_false_IF_ICMPGT20_i_i_i_i_i); -BinaryOperator* int32_269 = BinaryOperator::Create(Instruction::Add, int32_268, const_int32_76, "", label_false_IF_ICMPGT20_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i, label_false_IF_ICMPGT20_i_i_i_i_i); - -// Block JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I.exit.i.i.i (label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i) -PHINode* int32_271 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i); -int32_271->reserveOperandSpace(6); -int32_271->addIncoming(int32_257, label_false_IF_ICMPGT16_i_i_i_i_i); -int32_271->addIncoming(int32_260, label_false_IF_ICMPGT17_i_i_i_i_i); -int32_271->addIncoming(int32_263, label_false_IF_ICMPGT18_i_i_i_i_i); -int32_271->addIncoming(int32_266, label_false_IF_ICMPGT19_i_i_i_i_i); -int32_271->addIncoming(int32_269, label_false_IF_ICMPGT20_i_i_i_i_i); -int32_271->addIncoming(int32_255, label_GOTO_or_IF_9_i_i_i_i_i); - -GetElementPtrInst* ptr_272 = GetElementPtrInst::Create(ptr_241, const_int32_71, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i); -CastInst* ptr_273 = new BitCastInst(ptr_272, PointerTy_32, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i); -LoadInst* ptr_274 = new LoadInst(ptr_273, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i); -BinaryOperator* int32_275 = BinaryOperator::Create(Instruction::Add, int32_271, const_int32_77, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i); -CastInst* ptr_276 = new BitCastInst(ptr_274, PointerTy_25, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i); -GetElementPtrInst* ptr_277 = GetElementPtrInst::Create(ptr_276, int32_275, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i); -LoadInst* int32_278 = new LoadInst(ptr_277, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i); -CastInst* ptr_279 = new IntToPtrInst(int32_278, PointerTy_30, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i); -ICmpInst* int1_280 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i, ICmpInst::ICMP_EQ, int32_278, const_int32_56, ""); -BranchInst::Create(label_GOTO_or_IF__i_i_i, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i, int1_280, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i); - -// Block GOTO or IF*.i.i.i (label_GOTO_or_IF__i_i_i) -std::vector ptr_282_params; -ptr_282_params.push_back(ptr_242); -ptr_282_params.push_back(int32_96); -ptr_282_params.push_back(const_int32_56); -ptr_282_params.push_back(const_int32_56); -CallInst* ptr_282 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III, ptr_282_params.begin(), ptr_282_params.end(), "", label_GOTO_or_IF__i_i_i); -ptr_282->setCallingConv(CallingConv::C); -ptr_282->setTailCall(true); -AttrListPtr ptr_282_PAL; +BinaryOperator* int32_10 = BinaryOperator::Create(Instruction::Add, int32_sz, const_int32_8, "", label_entry); +BinaryOperator* int32_11 = BinaryOperator::Create(Instruction::And, int32_10, const_int32_9, "", label_entry); +CastInst* ptr_tmp = new BitCastInst(ptr_VT, PointerTy_2, "tmp", label_entry); +std::vector ptr_12_params; +ptr_12_params.push_back(int32_11); +ptr_12_params.push_back(ptr_tmp); +CallInst* ptr_12 = CallInst::Create(func_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2, ptr_12_params.begin(), ptr_12_params.end(), "", label_entry); +ptr_12->setCallingConv(CallingConv::C); +ptr_12->setTailCall(true); +AttrListPtr ptr_12_PAL; { SmallVector Attrs; AttributeWithIndex PAWI; PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; Attrs.push_back(PAWI); - ptr_282_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); + ptr_12_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); } -ptr_282->setAttributes(ptr_282_PAL); - -BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, label_GOTO_or_IF__i_i_i); - -// Block JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III.exit.i.i (label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i) -CastInst* ptr_284 = new IntToPtrInst(int32_278, PointerTy_29, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i); -LoadInst* ptr_285 = new LoadInst(ptr_284, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i); -CastInst* int32_286 = new PtrToIntInst(ptr_285, IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i); - new StoreInst(int32_286, ptr_277, false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i); -std::vector ptr_288_indices; -ptr_288_indices.push_back(const_int32_56); -ptr_288_indices.push_back(const_int32_56); -Instruction* ptr_288 = GetElementPtrInst::Create(ptr_279, ptr_288_indices.begin(), ptr_288_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i); - new StoreInst(const_ptr_78, ptr_288, false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i); -BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i); - -// Block JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII.exit.i (label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i) -PHINode* ptr_291 = PHINode::Create(PointerTy_30, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i); -ptr_291->reserveOperandSpace(10); -ptr_291->addIncoming(ptr_237, label_tableswitch5_i_i6_i); -ptr_291->addIncoming(ptr_224, label_GOTO_or_IF__i17_i_i_i); -ptr_291->addIncoming(ptr_181, label_tableswitch3_i_i4_i); -ptr_291->addIncoming(ptr_163, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i_i); -ptr_291->addIncoming(ptr_175, label_false_IFEQ_i_i_i_i); -ptr_291->addIncoming(ptr_149, label_GOTO_or_IF__i_i_i_i); -ptr_291->addIncoming(ptr_279, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i); -ptr_291->addIncoming(ptr_282, label_GOTO_or_IF__i_i_i); -ptr_291->addIncoming(ptr_146, label_false_IFNE_i_i_i_i); -ptr_291->addIncoming(ptr_221, label_false_IFNE_i21_i_i_i); - -std::vector ptr_292_indices; -ptr_292_indices.push_back(const_int32_56); -ptr_292_indices.push_back(const_int32_56); -Instruction* ptr_292 = GetElementPtrInst::Create(ptr_291, ptr_292_indices.begin(), ptr_292_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i); -CastInst* ptr__c_i = new BitCastInst(ptr_VT, PointerTy_31, ".c.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i); - new StoreInst(ptr__c_i, ptr_292, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i); -SwitchInst* void_294 = SwitchInst::Create(int32_storemerge_i_i, label_tableswitch_i_i_i, 7, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i); -void_294->addCase(const_int32_56, label_false_IFNE_i_i); -void_294->addCase(const_int32_58, label_tableswitch1_i_i_i); -void_294->addCase(const_int32_54, label_tableswitch2_i_i_i); -void_294->addCase(const_int32_60, label_tableswitch3_i_i_i); -void_294->addCase(const_int32_61, label_tableswitch4_i_i_i); -void_294->addCase(const_int32_62, label_tableswitch5_i_i_i); - - -// Block tableswitch.i.i.i (label_tableswitch_i_i_i) -CallInst* void_295 = CallInst::Create(func_abort, "", label_tableswitch_i_i_i); -void_295->setCallingConv(CallingConv::C); -void_295->setTailCall(true); -AttrListPtr void_295_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoReturn | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_295_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_295->setAttributes(void_295_PAL); - -new UnreachableInst(mod->getContext(), label_tableswitch_i_i_i); - -// Block tableswitch1.i.i.i (label_tableswitch1_i_i_i) -std::vector ptr_297_indices; -ptr_297_indices.push_back(const_int32_56); -ptr_297_indices.push_back(const_int32_77); -Instruction* ptr_297 = GetElementPtrInst::Create(ptr_291, ptr_297_indices.begin(), ptr_297_indices.end(), "", label_tableswitch1_i_i_i); -CastInst* ptr_298 = new BitCastInst(ptr_297, PointerTy_25, "", label_tableswitch1_i_i_i); -LoadInst* int32_299 = new LoadInst(ptr_298, "", false, label_tableswitch1_i_i_i); -BinaryOperator* int32_300 = BinaryOperator::Create(Instruction::And, int32_299, const_int32_79, "", label_tableswitch1_i_i_i); -LoadInst* ptr_301 = new LoadInst(const_ptr_80, "", false, label_tableswitch1_i_i_i); -CastInst* int32_302 = new PtrToIntInst(ptr_301, IntegerType::get(mod->getContext(), 32), "", label_tableswitch1_i_i_i); -BinaryOperator* int32_303 = BinaryOperator::Create(Instruction::Or, int32_302, int32_300, "", label_tableswitch1_i_i_i); -CastInst* ptr__c5 = new IntToPtrInst(int32_303, PointerTy_0, ".c5", label_tableswitch1_i_i_i); - new StoreInst(ptr__c5, ptr_297, false, label_tableswitch1_i_i_i); -BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_tableswitch1_i_i_i); - -// Block tableswitch2.i.i.i (label_tableswitch2_i_i_i) -std::vector ptr_306_indices; -ptr_306_indices.push_back(const_int32_56); -ptr_306_indices.push_back(const_int32_77); -Instruction* ptr_306 = GetElementPtrInst::Create(ptr_291, ptr_306_indices.begin(), ptr_306_indices.end(), "", label_tableswitch2_i_i_i); -CastInst* ptr_307 = new BitCastInst(ptr_306, PointerTy_25, "", label_tableswitch2_i_i_i); -LoadInst* int32_308 = new LoadInst(ptr_307, "", false, label_tableswitch2_i_i_i); -BinaryOperator* int32_309 = BinaryOperator::Create(Instruction::And, int32_308, const_int32_81, "", label_tableswitch2_i_i_i); -LoadInst* ptr_310 = new LoadInst(const_ptr_82, "", false, label_tableswitch2_i_i_i); -CastInst* int32_311 = new PtrToIntInst(ptr_310, IntegerType::get(mod->getContext(), 32), "", label_tableswitch2_i_i_i); -BinaryOperator* int32_312 = BinaryOperator::Create(Instruction::Or, int32_311, int32_309, "", label_tableswitch2_i_i_i); -CastInst* ptr__c4 = new IntToPtrInst(int32_312, PointerTy_0, ".c4", label_tableswitch2_i_i_i); - new StoreInst(ptr__c4, ptr_306, false, label_tableswitch2_i_i_i); -BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_tableswitch2_i_i_i); - -// Block tableswitch3.i.i.i (label_tableswitch3_i_i_i) -std::vector ptr_315_indices; -ptr_315_indices.push_back(const_int32_56); -ptr_315_indices.push_back(const_int32_77); -Instruction* ptr_315 = GetElementPtrInst::Create(ptr_291, ptr_315_indices.begin(), ptr_315_indices.end(), "", label_tableswitch3_i_i_i); -CastInst* ptr_316 = new BitCastInst(ptr_315, PointerTy_25, "", label_tableswitch3_i_i_i); -LoadInst* int32_317 = new LoadInst(ptr_316, "", false, label_tableswitch3_i_i_i); -BinaryOperator* int32_318 = BinaryOperator::Create(Instruction::And, int32_317, const_int32_55, "", label_tableswitch3_i_i_i); -LoadInst* ptr_319 = new LoadInst(const_ptr_83, "", false, label_tableswitch3_i_i_i); -CastInst* int32_320 = new PtrToIntInst(ptr_319, IntegerType::get(mod->getContext(), 32), "", label_tableswitch3_i_i_i); -BinaryOperator* int32_321 = BinaryOperator::Create(Instruction::Or, int32_318, const_int32_58, "", label_tableswitch3_i_i_i); -BinaryOperator* int32_322 = BinaryOperator::Create(Instruction::Or, int32_321, int32_320, "", label_tableswitch3_i_i_i); -CastInst* ptr__c3 = new IntToPtrInst(int32_322, PointerTy_0, ".c3", label_tableswitch3_i_i_i); - new StoreInst(ptr__c3, ptr_315, false, label_tableswitch3_i_i_i); -LoadInst* ptr_324 = new LoadInst(const_ptr_84, "", false, label_tableswitch3_i_i_i); -CastInst* int32_325 = new PtrToIntInst(ptr_291, IntegerType::get(mod->getContext(), 32), "", label_tableswitch3_i_i_i); -BinaryOperator* int32_326 = BinaryOperator::Create(Instruction::And, int32_325, const_int32_85, "", label_tableswitch3_i_i_i); -CastInst* ptr_327 = new IntToPtrInst(int32_326, PointerTy_30, "", label_tableswitch3_i_i_i); -std::vector ptr_328_indices; -ptr_328_indices.push_back(const_int32_58); -ptr_328_indices.push_back(const_int32_77); -Instruction* ptr_328 = GetElementPtrInst::Create(ptr_324, ptr_328_indices.begin(), ptr_328_indices.end(), "", label_tableswitch3_i_i_i); -LoadInst* ptr_329 = new LoadInst(ptr_328, "", false, label_tableswitch3_i_i_i); -GetElementPtrInst* ptr_330 = GetElementPtrInst::Create(ptr_329, const_int32_71, "", label_tableswitch3_i_i_i); -CastInst* ptr_331 = new BitCastInst(ptr_330, PointerTy_32, "", label_tableswitch3_i_i_i); -LoadInst* ptr_332 = new LoadInst(ptr_331, "", false, label_tableswitch3_i_i_i); -ICmpInst* int1_333 = new ICmpInst(*label_tableswitch3_i_i_i, ICmpInst::ICMP_EQ, ptr_332, const_ptr_86, ""); -BranchInst::Create(label_true_IF_NULL_i1_i_i_i_i_i, label_true_IFNULL_i5_i_i_i_i_i, int1_333, label_tableswitch3_i_i_i); - -// Block true IF*NULL.i1.i.i.i.i.i (label_true_IF_NULL_i1_i_i_i_i_i) -std::vector ptr_335_indices; -ptr_335_indices.push_back(const_int32_56); -ptr_335_indices.push_back(const_int32_56); -Instruction* ptr_335 = GetElementPtrInst::Create(ptr_327, ptr_335_indices.begin(), ptr_335_indices.end(), "", label_true_IF_NULL_i1_i_i_i_i_i); - new StoreInst(const_ptr_78, ptr_335, false, label_true_IF_NULL_i1_i_i_i_i_i); -GetElementPtrInst* ptr_337 = GetElementPtrInst::Create(ptr_329, const_int32_62, "", label_true_IF_NULL_i1_i_i_i_i_i); -CastInst* ptr_338 = new BitCastInst(ptr_337, PointerTy_29, "", label_true_IF_NULL_i1_i_i_i_i_i); -LoadInst* ptr_339 = new LoadInst(ptr_338, "", false, label_true_IF_NULL_i1_i_i_i_i_i); -LoadInst* ptr_340 = new LoadInst(const_ptr_87, "", false, label_true_IF_NULL_i1_i_i_i_i_i); -CastInst* int32_341 = new PtrToIntInst(ptr_340, IntegerType::get(mod->getContext(), 32), "", label_true_IF_NULL_i1_i_i_i_i_i); -BinaryOperator* int32_342 = BinaryOperator::Create(Instruction::Add, int32_341, int32_326, "", label_true_IF_NULL_i1_i_i_i_i_i); -CastInst* ptr_343 = new IntToPtrInst(int32_342, PointerTy_29, "", label_true_IF_NULL_i1_i_i_i_i_i); - new StoreInst(ptr_339, ptr_343, false, label_true_IF_NULL_i1_i_i_i_i_i); -LoadInst* ptr_345 = new LoadInst(ptr_338, "", false, label_true_IF_NULL_i1_i_i_i_i_i); -ICmpInst* int1_346 = new ICmpInst(*label_true_IF_NULL_i1_i_i_i_i_i, ICmpInst::ICMP_EQ, ptr_345, const_ptr_88, ""); -BranchInst::Create(label_GOTO_or_IF_1_i3_i_i_i_i_i, label_false_IFNE_i7_i_i_i_i_i, int1_346, label_true_IF_NULL_i1_i_i_i_i_i); - -// Block GOTO or IF*1.i3.i.i.i.i.i (label_GOTO_or_IF_1_i3_i_i_i_i_i) -CastInst* ptr_348 = new BitCastInst(ptr_337, PointerTy_35, "", label_GOTO_or_IF_1_i3_i_i_i_i_i); -CastInst* ptr__c1_i2_i_i_i_i_i = new IntToPtrInst(int32_326, PointerTy_31, ".c1.i2.i.i.i.i.i", label_GOTO_or_IF_1_i3_i_i_i_i_i); - new StoreInst(ptr__c1_i2_i_i_i_i_i, ptr_348, false, label_GOTO_or_IF_1_i3_i_i_i_i_i); -LoadInst* ptr_350 = new LoadInst(ptr_331, "", false, label_GOTO_or_IF_1_i3_i_i_i_i_i); -ICmpInst* int1_351 = new ICmpInst(*label_GOTO_or_IF_1_i3_i_i_i_i_i, ICmpInst::ICMP_EQ, ptr_350, const_ptr_86, ""); -BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_true_IFNULL3_i8_i_i_i_i_i, int1_351, label_GOTO_or_IF_1_i3_i_i_i_i_i); - -// Block true IFNULL.i5.i.i.i.i.i (label_true_IFNULL_i5_i_i_i_i_i) -GetElementPtrInst* ptr_353 = GetElementPtrInst::Create(ptr_332, const_int32_62, "", label_true_IFNULL_i5_i_i_i_i_i); -CastInst* ptr_354 = new BitCastInst(ptr_353, PointerTy_25, "", label_true_IFNULL_i5_i_i_i_i_i); -BranchInst::Create(label_bb2_i_i36_i, label_true_IFNULL_i5_i_i_i_i_i); - -// Block bb.i.i34.i (label_bb_i_i34_i) -Argument* fwdref_357 = new Argument(IntegerType::get(mod->getContext(), 1)); -BranchInst::Create(label_true_IF_NULL_i1_i_i_i_i_i, label_bb1_i_i35_i, fwdref_357, label_bb_i_i34_i); - -// Block bb1.i.i35.i (label_bb1_i_i35_i) -Argument* fwdref_359 = new Argument(IntegerType::get(mod->getContext(), 32)); -BinaryOperator* int32_358 = BinaryOperator::Create(Instruction::Add, fwdref_359, const_int32_77, "", label_bb1_i_i35_i); -BranchInst::Create(label_bb2_i_i36_i, label_bb1_i_i35_i); - -// Block bb2.i.i36.i (label_bb2_i_i36_i) -PHINode* int32_361 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_bb2_i_i36_i); -int32_361->reserveOperandSpace(2); -int32_361->addIncoming(const_int32_56, label_true_IFNULL_i5_i_i_i_i_i); -int32_361->addIncoming(int32_358, label_bb1_i_i35_i); - -ICmpInst* int1_362 = new ICmpInst(*label_bb2_i_i36_i, ICmpInst::ICMP_ULT, int32_361, const_int32_89, ""); -std::vector void_363_params; -void_363_params.push_back(const_int1_90); -void_363_params.push_back(const_int1_90); -void_363_params.push_back(const_int1_90); -void_363_params.push_back(const_int1_90); -void_363_params.push_back(const_int1_90); -CallInst* void_363 = CallInst::Create(func_llvm_memory_barrier, void_363_params.begin(), void_363_params.end(), "", label_bb2_i_i36_i); -void_363->setCallingConv(CallingConv::C); -void_363->setTailCall(true); -AttrListPtr void_363_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_363_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_363->setAttributes(void_363_PAL); - -std::vector int32_364_params; -int32_364_params.push_back(ptr_354); -int32_364_params.push_back(const_int32_56); -int32_364_params.push_back(const_int32_77); -CallInst* int32_364 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_364_params.begin(), int32_364_params.end(), "", label_bb2_i_i36_i); -int32_364->setCallingConv(CallingConv::C); -int32_364->setTailCall(true); -AttrListPtr int32_364_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - int32_364_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -int32_364->setAttributes(int32_364_PAL); - -std::vector void_365_params; -void_365_params.push_back(const_int1_90); -void_365_params.push_back(const_int1_90); -void_365_params.push_back(const_int1_90); -void_365_params.push_back(const_int1_90); -void_365_params.push_back(const_int1_90); -CallInst* void_365 = CallInst::Create(func_llvm_memory_barrier, void_365_params.begin(), void_365_params.end(), "", label_bb2_i_i36_i); -void_365->setCallingConv(CallingConv::C); -void_365->setTailCall(true); -AttrListPtr void_365_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_365_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_365->setAttributes(void_365_PAL); - -ICmpInst* int1_366 = new ICmpInst(*label_bb2_i_i36_i, ICmpInst::ICMP_EQ, int32_364, const_int32_56, ""); -BranchInst::Create(label_bb_i_i34_i, label_bb4_preheader_i_i37_i, int1_362, label_bb2_i_i36_i); - -// Block bb4.preheader.i.i37.i (label_bb4_preheader_i_i37_i) -BranchInst::Create(label_true_IF_NULL_i1_i_i_i_i_i, label_bb3_i_i38_i, int1_366, label_bb4_preheader_i_i37_i); - -// Block bb3.i.i38.i (label_bb3_i_i38_i) -CallInst* void_369 = CallInst::Create(func__ZN3mvm6Thread5yieldEv, "", label_bb3_i_i38_i); -void_369->setCallingConv(CallingConv::C); -void_369->setTailCall(true); -AttrListPtr void_369_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_369_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_369->setAttributes(void_369_PAL); - -std::vector void_370_params; -void_370_params.push_back(const_int1_90); -void_370_params.push_back(const_int1_90); -void_370_params.push_back(const_int1_90); -void_370_params.push_back(const_int1_90); -void_370_params.push_back(const_int1_90); -CallInst* void_370 = CallInst::Create(func_llvm_memory_barrier, void_370_params.begin(), void_370_params.end(), "", label_bb3_i_i38_i); -void_370->setCallingConv(CallingConv::C); -void_370->setTailCall(true); -AttrListPtr void_370_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_370_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_370->setAttributes(void_370_PAL); - -std::vector int32_371_params; -int32_371_params.push_back(ptr_354); -int32_371_params.push_back(const_int32_56); -int32_371_params.push_back(const_int32_77); -CallInst* int32_371 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_371_params.begin(), int32_371_params.end(), "", label_bb3_i_i38_i); -int32_371->setCallingConv(CallingConv::C); -int32_371->setTailCall(true); -AttrListPtr int32_371_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - int32_371_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -int32_371->setAttributes(int32_371_PAL); - -std::vector void_372_params; -void_372_params.push_back(const_int1_90); -void_372_params.push_back(const_int1_90); -void_372_params.push_back(const_int1_90); -void_372_params.push_back(const_int1_90); -void_372_params.push_back(const_int1_90); -CallInst* void_372 = CallInst::Create(func_llvm_memory_barrier, void_372_params.begin(), void_372_params.end(), "", label_bb3_i_i38_i); -void_372->setCallingConv(CallingConv::C); -void_372->setTailCall(true); -AttrListPtr void_372_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_372_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_372->setAttributes(void_372_PAL); - -ICmpInst* int1_373 = new ICmpInst(*label_bb3_i_i38_i, ICmpInst::ICMP_EQ, int32_371, const_int32_56, ""); -BranchInst::Create(label_true_IF_NULL_i1_i_i_i_i_i, label_bb3_i_i38_i, int1_373, label_bb3_i_i38_i); - -// Block false IFNE.i7.i.i.i.i.i (label_false_IFNE_i7_i_i_i_i_i) -std::vector ptr_375_indices; -ptr_375_indices.push_back(const_int32_56); -ptr_375_indices.push_back(const_int32_56); -Instruction* ptr_375 = GetElementPtrInst::Create(ptr_345, ptr_375_indices.begin(), ptr_375_indices.end(), "", label_false_IFNE_i7_i_i_i_i_i); -CastInst* ptr__c_i6_i_i_i_i_i = new IntToPtrInst(int32_326, PointerTy_31, ".c.i6.i.i.i.i.i", label_false_IFNE_i7_i_i_i_i_i); - new StoreInst(ptr__c_i6_i_i_i_i_i, ptr_375, false, label_false_IFNE_i7_i_i_i_i_i); -BranchInst::Create(label_GOTO_or_IF_1_i3_i_i_i_i_i, label_false_IFNE_i7_i_i_i_i_i); - -// Block true IFNULL3.i8.i.i.i.i.i (label_true_IFNULL3_i8_i_i_i_i_i) -GetElementPtrInst* ptr_378 = GetElementPtrInst::Create(ptr_350, const_int32_62, "", label_true_IFNULL3_i8_i_i_i_i_i); -CastInst* ptr_379 = new BitCastInst(ptr_378, PointerTy_25, "", label_true_IFNULL3_i8_i_i_i_i_i); - new StoreInst(const_int32_56, ptr_379, false, label_true_IFNULL3_i8_i_i_i_i_i); -BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_true_IFNULL3_i8_i_i_i_i_i); - -// Block tableswitch4.i.i.i (label_tableswitch4_i_i_i) -std::vector ptr_382_indices; -ptr_382_indices.push_back(const_int32_56); -ptr_382_indices.push_back(const_int32_77); -Instruction* ptr_382 = GetElementPtrInst::Create(ptr_291, ptr_382_indices.begin(), ptr_382_indices.end(), "", label_tableswitch4_i_i_i); -CastInst* ptr_383 = new BitCastInst(ptr_382, PointerTy_25, "", label_tableswitch4_i_i_i); -LoadInst* int32_384 = new LoadInst(ptr_383, "", false, label_tableswitch4_i_i_i); -BinaryOperator* int32_385 = BinaryOperator::Create(Instruction::And, int32_384, const_int32_79, "", label_tableswitch4_i_i_i); -LoadInst* ptr_386 = new LoadInst(const_ptr_91, "", false, label_tableswitch4_i_i_i); -CastInst* int32_387 = new PtrToIntInst(ptr_386, IntegerType::get(mod->getContext(), 32), "", label_tableswitch4_i_i_i); -BinaryOperator* int32_388 = BinaryOperator::Create(Instruction::Or, int32_387, int32_385, "", label_tableswitch4_i_i_i); -CastInst* ptr__c2 = new IntToPtrInst(int32_388, PointerTy_0, ".c2", label_tableswitch4_i_i_i); - new StoreInst(ptr__c2, ptr_382, false, label_tableswitch4_i_i_i); -BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_tableswitch4_i_i_i); - -// Block tableswitch5.i.i.i (label_tableswitch5_i_i_i) -std::vector ptr_391_indices; -ptr_391_indices.push_back(const_int32_56); -ptr_391_indices.push_back(const_int32_77); -Instruction* ptr_391 = GetElementPtrInst::Create(ptr_291, ptr_391_indices.begin(), ptr_391_indices.end(), "", label_tableswitch5_i_i_i); -CastInst* ptr_392 = new BitCastInst(ptr_391, PointerTy_25, "", label_tableswitch5_i_i_i); -LoadInst* int32_393 = new LoadInst(ptr_392, "", false, label_tableswitch5_i_i_i); -BinaryOperator* int32_394 = BinaryOperator::Create(Instruction::And, int32_393, const_int32_55, "", label_tableswitch5_i_i_i); -LoadInst* ptr_395 = new LoadInst(const_ptr_92, "", false, label_tableswitch5_i_i_i); -CastInst* int32_396 = new PtrToIntInst(ptr_395, IntegerType::get(mod->getContext(), 32), "", label_tableswitch5_i_i_i); -BinaryOperator* int32_397 = BinaryOperator::Create(Instruction::Or, int32_394, const_int32_58, "", label_tableswitch5_i_i_i); -BinaryOperator* int32_398 = BinaryOperator::Create(Instruction::Or, int32_397, int32_396, "", label_tableswitch5_i_i_i); -CastInst* ptr__c = new IntToPtrInst(int32_398, PointerTy_0, ".c", label_tableswitch5_i_i_i); - new StoreInst(ptr__c, ptr_391, false, label_tableswitch5_i_i_i); -LoadInst* ptr_400 = new LoadInst(const_ptr_93, "", false, label_tableswitch5_i_i_i); -CastInst* int32_401 = new PtrToIntInst(ptr_291, IntegerType::get(mod->getContext(), 32), "", label_tableswitch5_i_i_i); -BinaryOperator* int32_402 = BinaryOperator::Create(Instruction::And, int32_401, const_int32_85, "", label_tableswitch5_i_i_i); -CastInst* ptr_403 = new IntToPtrInst(int32_402, PointerTy_30, "", label_tableswitch5_i_i_i); -std::vector ptr_404_indices; -ptr_404_indices.push_back(const_int32_58); -ptr_404_indices.push_back(const_int32_77); -Instruction* ptr_404 = GetElementPtrInst::Create(ptr_400, ptr_404_indices.begin(), ptr_404_indices.end(), "", label_tableswitch5_i_i_i); -LoadInst* ptr_405 = new LoadInst(ptr_404, "", false, label_tableswitch5_i_i_i); -GetElementPtrInst* ptr_406 = GetElementPtrInst::Create(ptr_405, const_int32_71, "", label_tableswitch5_i_i_i); -CastInst* ptr_407 = new BitCastInst(ptr_406, PointerTy_32, "", label_tableswitch5_i_i_i); -LoadInst* ptr_408 = new LoadInst(ptr_407, "", false, label_tableswitch5_i_i_i); -ICmpInst* int1_409 = new ICmpInst(*label_tableswitch5_i_i_i, ICmpInst::ICMP_EQ, ptr_408, const_ptr_86, ""); -BranchInst::Create(label_true_IF_NULL_i1_i_i3_i_i_i, label_true_IFNULL_i5_i_i6_i_i_i, int1_409, label_tableswitch5_i_i_i); - -// Block true IF*NULL.i1.i.i3.i.i.i (label_true_IF_NULL_i1_i_i3_i_i_i) -std::vector ptr_411_indices; -ptr_411_indices.push_back(const_int32_56); -ptr_411_indices.push_back(const_int32_56); -Instruction* ptr_411 = GetElementPtrInst::Create(ptr_403, ptr_411_indices.begin(), ptr_411_indices.end(), "", label_true_IF_NULL_i1_i_i3_i_i_i); - new StoreInst(const_ptr_78, ptr_411, false, label_true_IF_NULL_i1_i_i3_i_i_i); -GetElementPtrInst* ptr_413 = GetElementPtrInst::Create(ptr_405, const_int32_62, "", label_true_IF_NULL_i1_i_i3_i_i_i); -CastInst* ptr_414 = new BitCastInst(ptr_413, PointerTy_29, "", label_true_IF_NULL_i1_i_i3_i_i_i); -LoadInst* ptr_415 = new LoadInst(ptr_414, "", false, label_true_IF_NULL_i1_i_i3_i_i_i); -LoadInst* ptr_416 = new LoadInst(const_ptr_87, "", false, label_true_IF_NULL_i1_i_i3_i_i_i); -CastInst* int32_417 = new PtrToIntInst(ptr_416, IntegerType::get(mod->getContext(), 32), "", label_true_IF_NULL_i1_i_i3_i_i_i); -BinaryOperator* int32_418 = BinaryOperator::Create(Instruction::Add, int32_417, int32_402, "", label_true_IF_NULL_i1_i_i3_i_i_i); -CastInst* ptr_419 = new IntToPtrInst(int32_418, PointerTy_29, "", label_true_IF_NULL_i1_i_i3_i_i_i); - new StoreInst(ptr_415, ptr_419, false, label_true_IF_NULL_i1_i_i3_i_i_i); -LoadInst* ptr_421 = new LoadInst(ptr_414, "", false, label_true_IF_NULL_i1_i_i3_i_i_i); -ICmpInst* int1_422 = new ICmpInst(*label_true_IF_NULL_i1_i_i3_i_i_i, ICmpInst::ICMP_EQ, ptr_421, const_ptr_88, ""); -BranchInst::Create(label_GOTO_or_IF_1_i3_i_i5_i_i_i, label_false_IFNE_i7_i_i8_i_i_i, int1_422, label_true_IF_NULL_i1_i_i3_i_i_i); - -// Block GOTO or IF*1.i3.i.i5.i.i.i (label_GOTO_or_IF_1_i3_i_i5_i_i_i) -CastInst* ptr_424 = new BitCastInst(ptr_413, PointerTy_35, "", label_GOTO_or_IF_1_i3_i_i5_i_i_i); -CastInst* ptr__c1_i2_i_i4_i_i_i = new IntToPtrInst(int32_402, PointerTy_31, ".c1.i2.i.i4.i.i.i", label_GOTO_or_IF_1_i3_i_i5_i_i_i); - new StoreInst(ptr__c1_i2_i_i4_i_i_i, ptr_424, false, label_GOTO_or_IF_1_i3_i_i5_i_i_i); -LoadInst* ptr_426 = new LoadInst(ptr_407, "", false, label_GOTO_or_IF_1_i3_i_i5_i_i_i); -ICmpInst* int1_427 = new ICmpInst(*label_GOTO_or_IF_1_i3_i_i5_i_i_i, ICmpInst::ICMP_EQ, ptr_426, const_ptr_86, ""); -BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_true_IFNULL3_i8_i_i9_i_i_i, int1_427, label_GOTO_or_IF_1_i3_i_i5_i_i_i); - -// Block true IFNULL.i5.i.i6.i.i.i (label_true_IFNULL_i5_i_i6_i_i_i) -GetElementPtrInst* ptr_429 = GetElementPtrInst::Create(ptr_408, const_int32_62, "", label_true_IFNULL_i5_i_i6_i_i_i); -CastInst* ptr_430 = new BitCastInst(ptr_429, PointerTy_25, "", label_true_IFNULL_i5_i_i6_i_i_i); -BranchInst::Create(label_bb2_i_i_i, label_true_IFNULL_i5_i_i6_i_i_i); - -// Block bb.i.i.i (label_bb_i_i_i) -Argument* fwdref_433 = new Argument(IntegerType::get(mod->getContext(), 1)); -BranchInst::Create(label_true_IF_NULL_i1_i_i3_i_i_i, label_bb1_i_i_i, fwdref_433, label_bb_i_i_i); - -// Block bb1.i.i.i (label_bb1_i_i_i) -Argument* fwdref_435 = new Argument(IntegerType::get(mod->getContext(), 32)); -BinaryOperator* int32_434 = BinaryOperator::Create(Instruction::Add, fwdref_435, const_int32_77, "", label_bb1_i_i_i); -BranchInst::Create(label_bb2_i_i_i, label_bb1_i_i_i); - -// Block bb2.i.i.i (label_bb2_i_i_i) -PHINode* int32_437 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_bb2_i_i_i); -int32_437->reserveOperandSpace(2); -int32_437->addIncoming(const_int32_56, label_true_IFNULL_i5_i_i6_i_i_i); -int32_437->addIncoming(int32_434, label_bb1_i_i_i); - -ICmpInst* int1_438 = new ICmpInst(*label_bb2_i_i_i, ICmpInst::ICMP_ULT, int32_437, const_int32_89, ""); -std::vector void_439_params; -void_439_params.push_back(const_int1_90); -void_439_params.push_back(const_int1_90); -void_439_params.push_back(const_int1_90); -void_439_params.push_back(const_int1_90); -void_439_params.push_back(const_int1_90); -CallInst* void_439 = CallInst::Create(func_llvm_memory_barrier, void_439_params.begin(), void_439_params.end(), "", label_bb2_i_i_i); -void_439->setCallingConv(CallingConv::C); -void_439->setTailCall(true); -AttrListPtr void_439_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_439_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_439->setAttributes(void_439_PAL); - -std::vector int32_440_params; -int32_440_params.push_back(ptr_430); -int32_440_params.push_back(const_int32_56); -int32_440_params.push_back(const_int32_77); -CallInst* int32_440 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_440_params.begin(), int32_440_params.end(), "", label_bb2_i_i_i); -int32_440->setCallingConv(CallingConv::C); -int32_440->setTailCall(true); -AttrListPtr int32_440_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - int32_440_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -int32_440->setAttributes(int32_440_PAL); - -std::vector void_441_params; -void_441_params.push_back(const_int1_90); -void_441_params.push_back(const_int1_90); -void_441_params.push_back(const_int1_90); -void_441_params.push_back(const_int1_90); -void_441_params.push_back(const_int1_90); -CallInst* void_441 = CallInst::Create(func_llvm_memory_barrier, void_441_params.begin(), void_441_params.end(), "", label_bb2_i_i_i); -void_441->setCallingConv(CallingConv::C); -void_441->setTailCall(true); -AttrListPtr void_441_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_441_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_441->setAttributes(void_441_PAL); - -ICmpInst* int1_442 = new ICmpInst(*label_bb2_i_i_i, ICmpInst::ICMP_EQ, int32_440, const_int32_56, ""); -BranchInst::Create(label_bb_i_i_i, label_bb4_preheader_i_i_i, int1_438, label_bb2_i_i_i); - -// Block bb4.preheader.i.i.i (label_bb4_preheader_i_i_i) -BranchInst::Create(label_true_IF_NULL_i1_i_i3_i_i_i, label_bb3_i_i_i, int1_442, label_bb4_preheader_i_i_i); - -// Block bb3.i.i.i (label_bb3_i_i_i) -CallInst* void_445 = CallInst::Create(func__ZN3mvm6Thread5yieldEv, "", label_bb3_i_i_i); -void_445->setCallingConv(CallingConv::C); -void_445->setTailCall(true); -AttrListPtr void_445_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_445_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_445->setAttributes(void_445_PAL); - -std::vector void_446_params; -void_446_params.push_back(const_int1_90); -void_446_params.push_back(const_int1_90); -void_446_params.push_back(const_int1_90); -void_446_params.push_back(const_int1_90); -void_446_params.push_back(const_int1_90); -CallInst* void_446 = CallInst::Create(func_llvm_memory_barrier, void_446_params.begin(), void_446_params.end(), "", label_bb3_i_i_i); -void_446->setCallingConv(CallingConv::C); -void_446->setTailCall(true); -AttrListPtr void_446_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_446_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_446->setAttributes(void_446_PAL); - -std::vector int32_447_params; -int32_447_params.push_back(ptr_430); -int32_447_params.push_back(const_int32_56); -int32_447_params.push_back(const_int32_77); -CallInst* int32_447 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_447_params.begin(), int32_447_params.end(), "", label_bb3_i_i_i); -int32_447->setCallingConv(CallingConv::C); -int32_447->setTailCall(true); -AttrListPtr int32_447_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - int32_447_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -int32_447->setAttributes(int32_447_PAL); - -std::vector void_448_params; -void_448_params.push_back(const_int1_90); -void_448_params.push_back(const_int1_90); -void_448_params.push_back(const_int1_90); -void_448_params.push_back(const_int1_90); -void_448_params.push_back(const_int1_90); -CallInst* void_448 = CallInst::Create(func_llvm_memory_barrier, void_448_params.begin(), void_448_params.end(), "", label_bb3_i_i_i); -void_448->setCallingConv(CallingConv::C); -void_448->setTailCall(true); -AttrListPtr void_448_PAL; -{ - SmallVector Attrs; - AttributeWithIndex PAWI; - PAWI.Index = 4294967295U; PAWI.Attrs = 0 | Attribute::NoUnwind; - Attrs.push_back(PAWI); - void_448_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); - -} -void_448->setAttributes(void_448_PAL); - -ICmpInst* int1_449 = new ICmpInst(*label_bb3_i_i_i, ICmpInst::ICMP_EQ, int32_447, const_int32_56, ""); -BranchInst::Create(label_true_IF_NULL_i1_i_i3_i_i_i, label_bb3_i_i_i, int1_449, label_bb3_i_i_i); - -// Block false IFNE.i7.i.i8.i.i.i (label_false_IFNE_i7_i_i8_i_i_i) -std::vector ptr_451_indices; -ptr_451_indices.push_back(const_int32_56); -ptr_451_indices.push_back(const_int32_56); -Instruction* ptr_451 = GetElementPtrInst::Create(ptr_421, ptr_451_indices.begin(), ptr_451_indices.end(), "", label_false_IFNE_i7_i_i8_i_i_i); -CastInst* ptr__c_i6_i_i7_i_i_i = new IntToPtrInst(int32_402, PointerTy_31, ".c.i6.i.i7.i.i.i", label_false_IFNE_i7_i_i8_i_i_i); - new StoreInst(ptr__c_i6_i_i7_i_i_i, ptr_451, false, label_false_IFNE_i7_i_i8_i_i_i); -BranchInst::Create(label_GOTO_or_IF_1_i3_i_i5_i_i_i, label_false_IFNE_i7_i_i8_i_i_i); - -// Block true IFNULL3.i8.i.i9.i.i.i (label_true_IFNULL3_i8_i_i9_i_i_i) -GetElementPtrInst* ptr_454 = GetElementPtrInst::Create(ptr_426, const_int32_62, "", label_true_IFNULL3_i8_i_i9_i_i_i); -CastInst* ptr_455 = new BitCastInst(ptr_454, PointerTy_25, "", label_true_IFNULL3_i8_i_i9_i_i_i); - new StoreInst(const_int32_56, ptr_455, false, label_true_IFNULL3_i8_i_i9_i_i_i); -BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_true_IFNULL3_i8_i_i9_i_i_i); - -// Block false IFNE.i.i (label_false_IFNE_i_i) -std::vector ptr_458_indices; -ptr_458_indices.push_back(const_int32_56); -ptr_458_indices.push_back(const_int32_77); -Instruction* ptr_458 = GetElementPtrInst::Create(ptr_291, ptr_458_indices.begin(), ptr_458_indices.end(), "", label_false_IFNE_i_i); -CastInst* ptr_459 = new BitCastInst(ptr_458, PointerTy_25, "", label_false_IFNE_i_i); -LoadInst* int32_460 = new LoadInst(ptr_459, "", false, label_false_IFNE_i_i); -BinaryOperator* int32_461 = BinaryOperator::Create(Instruction::And, int32_460, const_int32_79, "", label_false_IFNE_i_i); -LoadInst* ptr_462 = new LoadInst(const_ptr_94, "", false, label_false_IFNE_i_i); -CastInst* int32_463 = new PtrToIntInst(ptr_462, IntegerType::get(mod->getContext(), 32), "", label_false_IFNE_i_i); -BinaryOperator* int32_464 = BinaryOperator::Create(Instruction::Or, int32_463, int32_461, "", label_false_IFNE_i_i); -CastInst* ptr__c6 = new IntToPtrInst(int32_464, PointerTy_0, ".c6", label_false_IFNE_i_i); - new StoreInst(ptr__c6, ptr_458, false, label_false_IFNE_i_i); -BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_false_IFNE_i_i); - -// Block JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2.exit (label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit) -CastInst* ptr_tmp1 = new BitCastInst(ptr_291, PointerTy_0, "tmp1", label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit); -ReturnInst::Create(mod->getContext(), ptr_tmp1, label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit); +ptr_12->setAttributes(ptr_12_PAL); -// Resolve Forward References -fwdref_359->replaceAllUsesWith(int32_361); delete fwdref_359; -fwdref_357->replaceAllUsesWith(int1_366); delete fwdref_357; -fwdref_435->replaceAllUsesWith(int32_437); delete fwdref_435; -fwdref_433->replaceAllUsesWith(int1_442); delete fwdref_433; +CastInst* ptr_tmp1 = new BitCastInst(ptr_12, PointerTy_0, "tmp1", label_entry); +ReturnInst::Create(mod->getContext(), ptr_tmp1, label_entry); return func_gcmalloc; } Modified: vmkit/trunk/mmtk/java/src/org/j3/mmtk/Barriers.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/j3/mmtk/Barriers.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/j3/mmtk/Barriers.java (original) +++ vmkit/trunk/mmtk/java/src/org/j3/mmtk/Barriers.java Sat Aug 14 07:25:41 2010 @@ -1,202 +1,592 @@ -//===--------------- Barriers.java - Barriers for J3 ----------------------===// -// -// The VMKit project -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ package org.j3.mmtk; +import org.jikesrvm.SizeConstants; import org.jikesrvm.Magic; +import org.mmtk.vm.VM; + import org.vmmagic.unboxed.*; import org.vmmagic.pragma.*; -public final class Barriers extends org.mmtk.vm.Barriers { + at Uninterruptible +public class Barriers extends org.mmtk.vm.Barriers implements SizeConstants { /** - * Perform the actual write of the write barrier. + * Perform the actual write of a boolean write barrier. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param target The value that the slot will be updated to - * @param metaDataA The offset from the ref - * @param metaDataB The index of the FieldReference - * @param mode The context in which the write is occuring + * @param objref The object that has the boolean field + * @param value The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The FieldReference index to assist the store + * @param mode The context in which the write is occurring */ @Inline - public final void performWriteInBarrier(ObjectReference ref, Address slot, - ObjectReference target, Word metaDataA, - Word metaDataB, int mode) { - Object obj = ref.toObject(); - Offset offset = metaDataA.toOffset(); - int location = metaDataB.toInt(); - Magic.setObjectAtOffset(obj, offset, target.toObject(), location); + @Override + public final void booleanWrite(ObjectReference objref, boolean value, Word offset, Word location, int mode) { + Magic.setBooleanAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); } /** - * Perform the actual write of the write barrier, writing the value as a raw word. + * Perform the actual read of a boolean read barrier. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param rawTarget The value that the slot will be updated to - * @param metaDataA The offset from the ref - * @param metaDataB The index of the FieldReference - * @param mode The context in which the write is occuring + * @param objref The object that has the boolean field + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring + * @return the read value */ @Inline - public final void performRawWriteInBarrier(ObjectReference ref, Address slot, - Word rawTarget, Word metaDataA, - Word metaDataB, int mode) { - Object obj = ref.toObject(); - Offset offset = metaDataA.toOffset(); - int location = metaDataB.toInt(); - Magic.setWordAtOffset(obj, offset, rawTarget, location); + @Override + public final boolean booleanRead(ObjectReference objref, Word offset, Word location, int mode) { + return Magic.getByteAtOffset(objref.toObject(), offset.toOffset()) == 0; } /** - * Perform the actual read of the read barrier. + * Perform the actual write of a byte write barrier. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param metaDataA The offset from the ref - * @param metaDataB The index of the FieldReference - * @param mode The context in which the write is occuring + * @param objref The object that has the byte field + * @param value The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The FieldReference index to assist the store + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void byteWrite(ObjectReference objref, byte value, Word offset, Word location, int mode) { + Magic.setByteAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); + } + + /** + * Perform the actual read of a byte read barrier. + * + * @param objref The object that has the byte field + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring * @return the read value */ @Inline - public final ObjectReference performReadInBarrier(ObjectReference ref, Address slot, - Word metaDataA, Word metaDataB, int mode) { - Object obj = ref.toObject(); - Offset offset = metaDataA.toOffset(); - int location = metaDataB.toInt(); - return ObjectReference.fromObject(Magic.getObjectAtOffset(obj, offset, location)); + @Override + public final byte byteRead(ObjectReference objref, Word offset, Word location, int mode) { + return Magic.getByteAtOffset(objref.toObject(), offset.toOffset()); } /** - * Perform the actual read of the read barrier, returning the value as a raw word. + * Perform the actual write of a char write barrier. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param metaDataA The offset from the ref - * @param metaDataB The index of the FieldReference - * @param mode The context in which the write is occuring + * @param objref The object that has the char field + * @param value The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The FieldReference index to assist the store + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void charWrite(ObjectReference objref, char value, Word offset, Word location, int mode) { + Magic.setCharAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); + } + + /** + * Perform the actual read of a char read barrier. + * + * @param objref The object that has the char field + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring + * @return the read value + */ + @Inline + @Override + public final char charRead(ObjectReference objref, Word offset, Word location, int mode) { + return Magic.getCharAtOffset(objref.toObject(), offset.toOffset()); + } + + /** + * Perform the actual write of a short write barrier. + * + * @param objref The object that has the short field + * @param value The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The FieldReference index to assist the store + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void shortWrite(ObjectReference objref, short value, Word offset, Word location, int mode) { + Magic.setShortAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); + } + + /** + * Perform the actual read of a short read barrier. + * + * @param objref The object that has the short field + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring + * @return the read value + */ + @Inline + @Override + public final short shortRead(ObjectReference objref, Word offset, Word location, int mode) { + return Magic.getShortAtOffset(objref.toObject(), offset.toOffset()); + } + + /** + * Perform the actual write of a int write barrier. + * + * @param objref The object that has the int field + * @param value The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The FieldReference index to assist the store + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void intWrite(ObjectReference objref, int value, Word offset, Word location, int mode) { + Magic.setIntAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); + } + + /** + * Perform the actual read of a int read barrier. + * + * @param objref The object that has the int field + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring + * @return the read value + */ + @Inline + @Override + public final int intRead(ObjectReference objref, Word offset, Word location, int mode) { + return Magic.getIntAtOffset(objref.toObject(), offset.toOffset()); + } + + /** + * Attempt an atomic compare and exchange in a write barrier sequence. + * + * @param objref The object that has the int field + * @param expected The old int to be swapped out + * @param newValue the new int + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring + * @return True if the compare and swap was successful + */ + @Override + public boolean intTryCompareAndSwap(ObjectReference objref, int expected, int newValue, Word offset, Word unused, int mode) { + int oldValue; + do { + oldValue = Magic.prepareInt(objref, offset.toOffset()); + if (oldValue != expected) return false; + } while (!Magic.attemptInt(objref, offset.toOffset(), oldValue, newValue)); + return true; + } + + /** + * Perform the actual write of a long write barrier. + * + * @param objref The object that has the long field + * @param value The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The FieldReference index to assist the store + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void longWrite(ObjectReference objref, long value, Word offset, Word location, int mode) { + Magic.setLongAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); + } + + /** + * Perform the actual read of a long read barrier. + * + * @param objref The object that has the long field + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring + * @return the read value + */ + @Inline + @Override + public final long longRead(ObjectReference objref, Word offset, Word location, int mode) { + return Magic.getLongAtOffset(objref.toObject(), offset.toOffset()); + } + + /** + * Attempt an atomic compare and exchange in a write barrier sequence. + * + * @param objref The object that has the long field + * @param expected The old long to be swapped out + * @param newValue the new long + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring + * @return True if the compare and swap was successful + */ + @Override + public boolean longTryCompareAndSwap(ObjectReference objref, long expected, long newValue, Word offset, Word unused, int mode) { + long oldValue; + do { + oldValue = Magic.prepareLong(objref, offset.toOffset()); + if (oldValue != expected) return false; + } while (!Magic.attemptLong(objref, offset.toOffset(), oldValue, newValue)); + return true; + } + + /** + * Perform the actual write of a float write barrier. + * + * @param objref The object that has the float field + * @param value The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The FieldReference index to assist the store + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void floatWrite(ObjectReference objref, float value, Word offset, Word location, int mode) { + Magic.setFloatAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); + } + + /** + * Perform the actual read of a float read barrier. + * + * @param objref The object that has the float field + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring + * @return the read value + */ + @Inline + @Override + public final float floatRead(ObjectReference objref, Word offset, Word location, int mode) { + return Magic.getFloatAtOffset(objref.toObject(), offset.toOffset()); + } + + /** + * Perform the actual write of a double write barrier. + * + * @param objref The object that has the double field + * @param value The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The FieldReference index to assist the store + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void doubleWrite(ObjectReference objref, double value, Word offset, Word location, int mode) { + Magic.setDoubleAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); + } + + /** + * Perform the actual read of a double read barrier. + * + * @param objref The object that has the double field + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring * @return the read value */ @Inline - public final Word performRawReadInBarrier(ObjectReference ref, Address slot, - Word metaDataA, Word metaDataB, int mode) { - Object obj = ref.toObject(); - Offset offset = metaDataA.toOffset(); - int location = metaDataB.toInt(); - return Magic.getWordAtOffset(obj, offset, location); + @Override + public final double doubleRead(ObjectReference objref, Word offset, Word location, int mode) { + return Magic.getDoubleAtOffset(objref.toObject(), offset.toOffset()); + } + + /** + * Perform the actual write of an object reference write barrier. + * + * @param objref The object that has the reference field + * @param value The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The index of the FieldReference + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void objectReferenceWrite(ObjectReference objref, ObjectReference value, Word offset, Word location, int mode) { + Magic.setObjectAtOffset(objref.toObject(), offset.toOffset(), value.toObject(), location.toInt()); + } + + /** + * Perform the actual read of an object reference read barrier. + * + * @param objref The object that has the reference field + * @param offset The offset from the ref + * @param location The index of the FieldReference + * @param mode The context in which the write is occurring + * @return the object reference read value + */ + @Inline + @Override + public final ObjectReference objectReferenceRead(ObjectReference objref, Word offset, Word location, int mode) { + return ObjectReference.fromObject(Magic.getObjectAtOffset(objref.toObject(), offset.toOffset(), location.toInt())); + } + + /** + * Perform the actual write of the non-heap write barrier. This is + * used when the store is not to an object, but to a non-heap location + * such as statics or the stack. + * @param target The value that the slot will be updated to + * @param unusedA The offset from the ref + * @param unusedB Unused + * @param ref The object that has the reference field + */ + @Inline + @Override + public final void objectReferenceNonHeapWrite(Address slot, ObjectReference target, Word unusedA, Word unusedB) { + slot.store(target); } /** * Atomically write a reference field of an object or array and return * the old value of the reference field. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference + * @param objref The object that has the reference field * @param target The value that the slot will be updated to - * @param metaDataA The offset from the ref - * @param metaDataB Unused - * @param mode The context in which the write is occuring + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring * @return The value that was replaced by the write. */ @Inline - public final ObjectReference performWriteInBarrierAtomic( - ObjectReference ref, Address slot, - ObjectReference target, Word metaDataA, - Word metaDataB, int mode) { - Object obj = ref.toObject(); + @Override + public final ObjectReference objectReferenceAtomicWrite(ObjectReference objref, ObjectReference target, Word offset, Word unused, int mode) { + Object obj = objref.toObject(); Object newObject = target.toObject(); - Offset offset = metaDataA.toOffset(); Object oldObject; do { - oldObject = Magic.prepareObject(obj, offset); - } while (!Magic.attemptObject(obj, offset, oldObject, newObject)); + oldObject = Magic.prepareObject(obj, offset.toOffset()); + } while (!Magic.attemptObject(obj, offset.toOffset(), oldObject, newObject)); return ObjectReference.fromObject(oldObject); } + /** + * Attempt an atomic compare and exchange in a write barrier sequence. + * + * @param objref The object that has the reference field + * @param old The old reference to be swapped out + * @param target The value that the slot will be updated to + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring + * @return True if the compare and swap was successful + */ + @Inline + @Override + public final boolean objectReferenceTryCompareAndSwap(ObjectReference objref, ObjectReference old, ObjectReference target, Word offset, Word unused, int mode) { + Object oldValue; + do { + oldValue = Magic.prepareObject(objref, offset.toOffset()); + if (oldValue != old) return false; + } while (!Magic.attemptObject(objref, offset.toOffset(), oldValue, target)); + return true; + } + + /** + * Perform the actual write of the write barrier, writing the value as a raw Word. + * + * @param ref The object that has the Word field + * @param target The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The index of the FieldReference + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void wordWrite(ObjectReference ref, Word target, + Word offset, Word location, int mode) { + Magic.setWordAtOffset(ref.toObject(), offset.toOffset(), target, location.toInt()); + } /** * Atomically write a raw reference field of an object or array and return * the old value of the reference field. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param rawTarget The value that the slot will be updated to - * @param metaDataA The offset from the ref - * @param metaDataB Unused - * @param mode The context in which the write is occuring + * @param ref The object that has the Word field + * @param target The value that the slot will be updated to + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring * @return The value that was replaced by the write. */ @Inline - public final Word performRawWriteInBarrierAtomic( - ObjectReference ref, Address slot, - Word rawTarget, Word metaDataA, - Word metaDataB, int mode) { - Object obj = ref.toObject(); - Offset offset = metaDataA.toOffset(); + @Override + public final Word wordAtomicWrite(ObjectReference ref, Word target, + Word offset, Word unused, int mode) { Word oldValue; do { - oldValue = Magic.prepareWord(obj, offset); - } while (!Magic.attemptWord(obj, offset, oldValue, rawTarget)); + oldValue = Magic.prepareWord(ref.toObject(), offset.toOffset()); + } while (!Magic.attemptWord(ref.toObject(), offset.toOffset(), oldValue, target)); return oldValue; } /** * Attempt an atomic compare and exchange in a write barrier sequence. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param old The old reference to be swapped out + * @param ref The object that has the Word field + * @param old The old Word to be swapped out * @param target The value that the slot will be updated to - * @param metaDataA The offset from the ref - * @param metaDataB Unused - * @param mode The context in which the write is occuring + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring * @return True if the compare and swap was successful */ @Inline - public final boolean tryCompareAndSwapWriteInBarrier(ObjectReference ref, Address slot, - ObjectReference old, ObjectReference target, - Word metaDataA, Word metaDataB, int mode) { - Object oldValue; - Offset offset = metaDataA.toOffset(); + @Override + public final boolean wordTryCompareAndSwap(ObjectReference ref, Word old, Word target, + Word offset, Word unused, int mode) { do { - oldValue = Magic.prepareObject(ref, offset); - if (oldValue != old) return false; - } while (!Magic.attemptObject(ref, offset, oldValue, target)); + Word currentValue = Magic.prepareWord(ref, offset.toOffset()); + if (currentValue != old) return false; + } while (!Magic.attemptWord(ref, offset.toOffset(), old, target)); return true; } + /** + * Perform the actual read of the read barrier, returning the value as a raw Word. + * + * @param ref The object that has the Word field + * @param offset The offset from the ref + * @param location The index of the FieldReference + * @param mode The context in which the write is occurring + * @return the read value + */ + @Inline + @Override + public final Word wordRead(ObjectReference ref, + Word offset, Word location, int mode) { + return Magic.getWordAtOffset(ref.toObject(), offset.toOffset(), location.toInt()); + } + + /** + * Perform the actual write of the write barrier, writing the value as a raw Address. + * + * @param ref The object that has the Address field + * @param target The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The index of the FieldReference + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void addressWrite(ObjectReference ref, Address target, + Word offset, Word location, int mode) { + Magic.setAddressAtOffset(ref.toObject(), offset.toOffset(), target, location.toInt()); + } + + /** + * Perform the actual read of the read barrier, returning the value as a raw Address. + * + * @param ref The object that has the Address field + * @param offset The offset from the ref + * @param location The index of the FieldReference + * @param mode The context in which the write is occurring + * @return the read value + */ + @Inline + @Override + public final Address addressRead(ObjectReference ref, + Word offset, Word location, int mode) { + return Magic.getAddressAtOffset(ref.toObject(), offset.toOffset(), location.toInt()); + } /** * Attempt an atomic compare and exchange in a write barrier sequence. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param rawOld The old reference to be swapped out - * @param rawTarget The value that the slot will be updated to - * @param metaDataA The offset from the ref - * @param metaDataB Unused - * @param mode The context in which the write is occuring + * @param objref The object that has the Address field + * @param expected The old Address to be swapped out + * @param newValue the new Address + * @param offset The offset from the ref + * @param unused Unused + * @param mode The context in which the write is occurring * @return True if the compare and swap was successful */ - @Inline - public final boolean tryRawCompareAndSwapWriteInBarrier(ObjectReference ref, Address slot, - Word rawOld, Word rawTarget, Word metaDataA, - Word metaDataB, int mode) { - Offset offset = metaDataA.toOffset(); - do { - Word currentValue = Magic.prepareWord(ref, offset); - if (currentValue != rawOld) return false; - } while (!Magic.attemptObject(ref, offset, rawOld, rawTarget)); + @Override + public boolean addressTryCompareAndSwap(ObjectReference objref, Address expected, Address newValue, Word offset, Word unused, int mode) { + Address oldValue; + do { + oldValue = Magic.prepareAddress(objref, offset.toOffset()); + if (oldValue != expected) return false; + } while (!Magic.attemptAddress(objref, offset.toOffset(), oldValue, newValue)); return true; } /** + * Perform the actual write of the write barrier, writing the value as a raw Offset. + * + * @param ref The object that has the Offset field + * @param target The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The index of the FieldReference + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void offsetWrite(ObjectReference ref, Offset target, + Word offset, Word location, int mode) { + Magic.setOffsetAtOffset(ref.toObject(), offset.toOffset(), target, location.toInt()); + } + + /** + * Perform the actual read of the read barrier, returning the value as a raw Offset. + * + * @param ref The object that has the Offset field + * @param offset The offset from the ref + * @param location The index of the FieldReference + * @param mode The context in which the write is occurring + * @return the read value + */ + @Inline + @Override + public final Offset offsetRead(ObjectReference ref, + Word offset, Word location, int mode) { + return Magic.getOffsetAtOffset(ref.toObject(), offset.toOffset(), location.toInt()); + } + + /** + * Perform the actual write of the write barrier, writing the value as a raw Extent. + * + * @param ref The object that has the Extent field + * @param target The value that the slot will be updated to + * @param offset The offset from the ref + * @param location The index of the FieldReference + * @param mode The context in which the write is occurring + */ + @Inline + @Override + public final void extentWrite(ObjectReference ref, Extent target, + Word offset, Word location, int mode) { + Magic.setExtentAtOffset(ref.toObject(), offset.toOffset(), target, location.toInt()); + } + + /** + * Perform the actual read of the read barrier, returning the value as a raw Extent. + * + * @param ref The object that has the Extent field + * @param offset The offset from the ref + * @param location The index of the FieldReference + * @param mode The context in which the write is occurring + * @return the read value + */ + @Inline + @Override + public final Extent extentRead(ObjectReference ref, + Word offset, Word location, int mode) { + return Magic.getExtentAtOffset(ref.toObject(), offset.toOffset(), location.toInt()); + } + + /** * Sets an element of an object array without invoking any write * barrier. This method is called by the Map class to ensure * potentially-allocation-triggering write barriers do not occur in @@ -206,7 +596,11 @@ * @param index the index of the element to set * @param value the new value for the element */ - public final void setArrayNoBarrier(Object [] dst, int index, Object value) { - dst[index] = value; + @UninterruptibleNoWarn + @Override + public final void objectArrayStoreNoGCBarrier(Object[] dst, int index, Object value) { + Address base = ObjectReference.fromObject(dst).toAddress(); + Address slot = base.plus(Offset.fromIntZeroExtend(index << LOG_BYTES_IN_ADDRESS)); + VM.activePlan.global().storeObjectReference(slot, ObjectReference.fromObject(value)); } } Modified: vmkit/trunk/mmtk/java/src/org/j3/mmtk/Statistics.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/j3/mmtk/Statistics.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/j3/mmtk/Statistics.java (original) +++ vmkit/trunk/mmtk/java/src/org/j3/mmtk/Statistics.java Sat Aug 14 07:25:41 2010 @@ -63,27 +63,14 @@ } /** - * Initialize performance counters - * - * @param metric An integer identifying the metric being read + * Initialize performance events */ - public native void perfCtrInit(int metric); + @Interruptible + public native void perfEventInit(String events); /** - * Read the current cycle count from the perfctr libraries - * - * @return the current cycle count from the perfctr libraries + * Read a performance event */ - public native long perfCtrReadCycles(); - - /** - * Read the current event count for the metric being measured by the - * perfctr libraries - * - * @return the current event count for the metric being measured by the - * perfctr libraries - */ - public native long perfCtrReadMetric(); - + public native void perfEventRead(int id, long[] values); } Modified: vmkit/trunk/mmtk/java/src/org/jikesrvm/Magic.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/jikesrvm/Magic.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/jikesrvm/Magic.java (original) +++ vmkit/trunk/mmtk/java/src/org/jikesrvm/Magic.java Sat Aug 14 07:25:41 2010 @@ -12,16 +12,17 @@ */ package org.jikesrvm; +import org.j3.runtime.VM; + import org.vmmagic.Intrinsic; import org.vmmagic.pragma.Entrypoint; import org.vmmagic.pragma.Uninterruptible; import org.vmmagic.unboxed.Address; +import org.vmmagic.unboxed.Extent; import org.vmmagic.unboxed.Offset; import org.vmmagic.unboxed.Word; import org.vmmagic.unboxed.WordArray; -import org.j3.runtime.VM; - /** * Magic methods for accessing raw machine memory, registers, and * operating system calls. @@ -35,17 +36,6 @@ @Intrinsic public final class Magic { - /** - * Read contents of hardware time base registers. - * Note: we think that 1 "tick" == 4 "machine cycles", but this seems to be - * undocumented and may vary across processor implementations. - * @return number of ticks (epoch undefined) - */ - public static long getTimeBase() { - if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler - return -1; - } - //---------------------------------------// // Memory Access. // //---------------------------------------// @@ -70,6 +60,15 @@ } /** + * Get char at arbitrary (byte) offset from object. The most + * significant 16bits will be 0. + */ + public static char getCharAtOffset(Object object, Offset offset) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + return (char) -1; + } + + /** * Get short at arbitrary (byte) offset from object. The most * significant 16bits will be the same as the most significant bit * in the short. @@ -80,30 +79,38 @@ } /** - * Get char at arbitrary (byte) offset from object. The most - * significant 16bits will be 0. + * Get int at arbitrary (byte) offset from object. + * Use getIntAtOffset(obj, ofs) instead of getMemoryInt(objectAsAddress(obj)+ofs) */ - public static char getCharAtOffset(Object object, Offset offset) { + public static int getIntAtOffset(Object object, Offset offset) { if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler - return (char) -1; + return -1; } /** - * Get int at arbitrary (byte) offset from object. - * Use getIntAtOffset(obj, ofs) instead of getMemoryInt(objectAsAddress(obj)+ofs) + * Get long at arbitrary (byte) offset from object. + * Use getlongAtOffset(obj, ofs) instead of two getIntAtOffset */ - public static int getIntAtOffset(Object object, Offset offset) { + public static long getLongAtOffset(Object object, Offset offset) { if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler return -1; } /** - * Get Word at arbitrary (byte) offset from object. - * Use getWordAtOffset(obj, ofs) instead of getMemoryWord(objectAsAddress(obj)+ofs) + * Get float at arbitrary (byte) offset from object. */ - public static Word getWordAtOffset(Object object, Offset offset) { + public static float getFloatAtOffset(Object object, Offset offset) { if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler - return Word.max(); + return -1; + } + + /** + * Get double at arbitrary (byte) offset from object. + * Use getDoubleAtOffset(obj, ofs) instead of two getIntAtOffset + */ + public static double getDoubleAtOffset(Object object, Offset offset) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + return -1; } /** @@ -128,6 +135,15 @@ /** * Get Word at arbitrary (byte) offset from object. + * Use getWordAtOffset(obj, ofs) instead of getMemoryWord(objectAsAddress(obj)+ofs) + */ + public static Word getWordAtOffset(Object object, Offset offset) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + return Word.max(); + } + + /** + * Get Word at arbitrary (byte) offset from object. */ public static Word getWordAtOffset(Object object, Offset offset, int locationMetadata) { if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler @@ -135,21 +151,70 @@ } /** - * Get long at arbitrary (byte) offset from object. - * Use getlongAtOffset(obj, ofs) instead of two getIntAtOffset + * Get Address at arbitrary (byte) offset from object. + * Use getAddressAtOffset(obj, ofs) instead of getMemoryWord(objectAsAddress(obj)+ofs) */ - public static long getLongAtOffset(Object object, Offset offset) { + public static Address getAddressAtOffset(Object object, Offset offset) { if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler - return -1; + return null; } /** - * Get double at arbitrary (byte) offset from object. - * Use getDoubleAtOffset(obj, ofs) instead of two getIntAtOffset + * Get Address at arbitrary (byte) offset from object. */ - public static double getDoubleAtOffset(Object object, Offset offset) { + public static Address getAddressAtOffset(Object object, Offset offset, int locationMetadata) { if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler - return -1; + return null; + } + + /** + * Get Extent at arbitrary (byte) offset from object. + * Use getExtentAtOffset(obj, ofs) instead of getMemoryWord(objectAsAddress(obj)+ofs) + */ + public static Extent getExtentAtOffset(Object object, Offset offset) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + return null; + } + + /** + * Get Extent at arbitrary (byte) offset from object. + */ + public static Extent getExtentAtOffset(Object object, Offset offset, int locationMetadata) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + return null; + } + + /** + * Get Offset at arbitrary (byte) offset from object. + * Use getOffsetAtOffset(obj, ofs) instead of getMemoryWord(objectAsAddress(obj)+ofs) + */ + public static Offset getOffsetAtOffset(Object object, Offset offset) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + return null; + } + + /** + * Get Offset at arbitrary (byte) offset from object. + */ + public static Offset getOffsetAtOffset(Object object, Offset offset, int locationMetadata) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + return null; + } + + /** + * Set boolean at arbitrary (byte) offset from object. + */ + public static void setBooleanAtOffset(Object object, Offset offset, boolean newvalue) { + if (VM.VerifyAssertions) + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set boolean at arbitrary (byte) offset from object. + */ + public static void setBooleanAtOffset(Object object, Offset offset, boolean newvalue, int locationMetadata) { + if (VM.VerifyAssertions) + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler } /** @@ -160,6 +225,14 @@ } /** + * Set byte at arbitrary (byte) offset from object. + */ + public static void setByteAtOffset(Object object, Offset offset, byte newvalue, int locationMetadata) { + if (VM.VerifyAssertions) + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** * Set char at arbitrary (byte) offset from object. */ public static void setCharAtOffset(Object object, Offset offset, char newvalue) { @@ -167,6 +240,29 @@ } /** + * Set char at arbitrary (byte) offset from object. + */ + public static void setCharAtOffset(Object object, Offset offset, char newvalue, int locationMetadata) { + if (VM.VerifyAssertions) + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set short at arbitrary (byte) offset from object. + */ + public static void setShortAtOffset(Object object, Offset offset, short newvalue) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set short at arbitrary (byte) offset from object. + */ + public static void setShortAtOffset(Object object, Offset offset, short newvalue, int locationMetadata) { + if (VM.VerifyAssertions) + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** * Set int at arbitrary (byte) offset from object. * Use setIntAtOffset(obj, ofs, new) instead of setMemoryWord(objectAsAddress(obj)+ofs, new) */ @@ -175,7 +271,64 @@ } /** - * Set word at arbitrary (byte) offset from object. + * Set int at arbitrary (byte) offset from object. + */ + public static void setIntAtOffset(Object object, Offset offset, int newvalue, int locationMetadata) { + if (VM.VerifyAssertions) + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set long at arbitrary (byte) offset from object. + * Use setlongAtOffset(obj, ofs) instead of two setIntAtOffset + */ + public static void setLongAtOffset(Object object, Offset offset, long newvalue) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set long at arbitrary (byte) offset from object. Use setlongAtOffset(obj, + * ofs) instead of two setIntAtOffset + */ + public static void setLongAtOffset(Object object, Offset offset, long newvalue, int locationMetadata) { + if (VM.VerifyAssertions) + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set float at arbitrary (byte) offset from object. + */ + public static void setFloatAtOffset(Object object, Offset offset, float newvalue) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set float at arbitrary (byte) offset from object. + */ + public static void setFloatAtOffset(Object object, Offset offset, float newvalue, int locationMetadata) { + if (VM.VerifyAssertions) + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set double at arbitrary (byte) offset from object. + * Use setDoubleAtOffset(obj, ofs) instead of two setIntAtOffset + */ + public static void setDoubleAtOffset(Object object, Offset offset, double newvalue) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set double at arbitrary (byte) offset from object. Use + * setDoubleAtOffset(obj, ofs) instead of two setIntAtOffset + */ + public static void setDoubleAtOffset(Object object, Offset offset, double newvalue, int locationMetadata) { + if (VM.VerifyAssertions) + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set Word at arbitrary (byte) offset from object. * Use setWordAtOffset(obj, ofs, new) instead of setMemoryWord(objectAsAddress(obj)+ofs, new) */ public static void setWordAtOffset(Object object, Offset offset, Word newvalue) { @@ -183,7 +336,7 @@ } /** - * Set word at arbitrary (byte) offset from object. + * Set Word at arbitrary (byte) offset from object. * Use setWordAtOffset(obj, ofs, new) instead of setMemoryWord(objectAsAddress(obj)+ofs, new) */ public static void setWordAtOffset(Object object, Offset offset, Word newvalue, int locationMetadata) { @@ -191,36 +344,69 @@ } /** - * Set Object at arbitrary (byte) offset from object. - * Use setObjectAtOffset(obj, ofs, new) instead of setMemoryWord(objectAsAddress(obj)+ofs, objectAsAddress(new)) + * Set Address at arbitrary (byte) offset from object. + * Use setAddressAtOffset(obj, ofs, new) instead of setMemoryWord(objectAsAddress(obj)+ofs, new) */ - public static void setObjectAtOffset(Object object, Offset offset, Object newvalue) { + public static void setAddressAtOffset(Object object, Offset offset, Address newvalue) { if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler } /** - * Set Object at arbitrary (byte) offset from object. + * Set Address at arbitrary (byte) offset from object. + * Use setAddressAtOffset(obj, ofs, new) instead of setMemoryWord(objectAsAddress(obj)+ofs, new) */ - public static void setObjectAtOffset(Object object, Offset offset, Object newvalue, int locationMetadata) { + public static void setAddressAtOffset(Object object, Offset offset, Address newvalue, int locationMetadata) { if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler } /** - * Set long at arbitrary (byte) offset from object. - * Use setlongAtOffset(obj, ofs) instead of two setIntAtOffset + * Set Extent at arbitrary (byte) offset from object. + * Use setExtentAtOffset(obj, ofs, new) instead of setMemoryWord(objectAsAddress(obj)+ofs, new) */ - public static void setLongAtOffset(Object object, Offset offset, long newvalue) { + public static void setExtentAtOffset(Object object, Offset offset, Extent newvalue) { if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler } /** - * Set double at arbitrary (byte) offset from object. - * Use setDoubleAtOffset(obj, ofs) instead of two setIntAtOffset + * Set Extent at arbitrary (byte) offset from object. + * Use setExtenttOffset(obj, ofs, new) instead of setMemoryWord(objectAsAddress(obj)+ofs, new) */ - public static void setDoubleAtOffset(Object object, Offset offset, double newvalue) { + public static void setExtentAtOffset(Object object, Offset offset, Extent newvalue, int locationMetadata) { if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler } + /** + * Set Offset at arbitrary (byte) offset from object. + * Use setOffsetAtOffset(obj, ofs, new) instead of setMemoryWord(objectAsAddress(obj)+ofs, new) + */ + public static void setOffsetAtOffset(Object object, Offset offset, Offset newvalue) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set Offset at arbitrary (byte) offset from object. + * Use setOffsetAtOffset(obj, ofs, new) instead of setMemoryWord(objectAsAddress(obj)+ofs, new) + */ + public static void setOffsetAtOffset(Object object, Offset offset, Offset newvalue, int locationMetadata) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set Object at arbitrary (byte) offset from object. + * Use setObjectAtOffset(obj, ofs, new) instead of setMemoryWord(objectAsAddress(obj)+ofs, objectAsAddress(new)) + */ + public static void setObjectAtOffset(Object object, Offset offset, Object newvalue) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + /** + * Set Object at arbitrary (byte) offset from object. + */ + public static void setObjectAtOffset(Object object, Offset offset, Object newvalue, int locationMetadata) { + if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + + //---------------------------------------// // Atomic Memory Access Primitives. // //---------------------------------------// @@ -348,5 +534,59 @@ } } -} + /**************************************************************** + * + * Misc + * + */ + + /** + * On IA32, emit a PAUSE instruction, to optimize spin-wait loops. + */ + public static void pause() { + if (VM.runningVM && VM.VerifyAssertions) { + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + } + /** + * A hardware SQRT instruction + */ + public static float sqrt(float value) { + if (VM.runningVM && VM.VerifyAssertions) { + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + return -1.0f; // which should upset them even if assertions aren't enabled ... + } + + /** + * A hardware SQRT instruction + */ + public static double sqrt(double value) { + if (VM.runningVM && VM.VerifyAssertions) { + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + return -1.0d; // which should upset them even if assertions aren't enabled ... + } + + /** + * How deeply inlined is this method (0 means no inlining). + */ + public static int getInlineDepth() { + if (VM.runningVM && VM.VerifyAssertions) { + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + return 0; + } + + /** + * Is the specified parameter constant (due to either inlining or specialization). + * Count starts at zero and includes the 'this' parameter for instance methods. + */ + public static boolean isConstantParameter(int index) { + if (VM.runningVM && VM.VerifyAssertions) { + VM._assert(VM.NOT_REACHED); // call site should have been hijacked by magic in compiler + } + return false; + } +} Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/MutatorContext.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/MutatorContext.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/MutatorContext.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/MutatorContext.java Sat Aug 14 07:25:41 2010 @@ -118,13 +118,13 @@ protected final LargeObjectLocal los = new LargeObjectLocal(Plan.loSpace); /** Per-mutator allocator into the small code space */ - private final MarkSweepLocal smcode = Plan.USE_CODE_SPACE ? new MarkSweepLocal(Plan.smallCodeSpace) : null; + protected final MarkSweepLocal smcode = Plan.USE_CODE_SPACE ? new MarkSweepLocal(Plan.smallCodeSpace) : null; /** Per-mutator allocator into the large code space */ - private final LargeObjectLocal lgcode = Plan.USE_CODE_SPACE ? new LargeObjectLocal(Plan.largeCodeSpace) : null; + protected final LargeObjectLocal lgcode = Plan.USE_CODE_SPACE ? new LargeObjectLocal(Plan.largeCodeSpace) : null; /** Per-mutator allocator into the non moving space */ - private final MarkSweepLocal nonmove = new MarkSweepLocal(Plan.nonMovingSpace); + protected final MarkSweepLocal nonmove = new MarkSweepLocal(Plan.nonMovingSpace); /**************************************************************************** @@ -267,47 +267,624 @@ */ /** - * A new reference is about to be created. Take appropriate write - * barrier actions.

+ * Read a reference type. In a concurrent collector this may + * involve adding the referent to the marking queue. + * + * @param referent The referent being read. + * @return The new referent. + */ + @Inline + public ObjectReference javaLangReferenceReadBarrier(ObjectReference referent) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return ObjectReference.nullReference(); + } + + /** + * Write a boolean. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new boolean + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void booleanWrite(ObjectReference src, Address slot, boolean value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read a boolean. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The boolean that was read. + */ + @Inline + public boolean booleanRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * A number of booleans are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean booleanBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Write a byte. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new byte + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void byteWrite(ObjectReference src, Address slot, byte value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read a byte. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The byte that was read. + */ + @Inline + public byte byteRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return 0; + } + + /** + * A number of bytes are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean byteBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Write a char. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new char + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void charWrite(ObjectReference src, Address slot, char value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read a char. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The char that was read. + */ + @Inline + public char charRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return 0; + } + + /** + * A number of chars are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean charBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Write a short. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new short + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void shortWrite(ObjectReference src, Address slot, short value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read a short. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The short that was read. + */ + @Inline + public short shortRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return 0; + } + + /** + * A number of shorts are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean shortBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + + /** + * Write a int. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new int + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void intWrite(ObjectReference src, Address slot, int value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read a int. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The int that was read. + */ + @Inline + public int intRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return 0; + } + + /** + * A number of ints are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean intBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Attempt to atomically exchange the value in the given slot + * with the passed replacement value. + * + * By default do nothing, override if appropriate. + * + * @param src The object into which the value will be stored + * @param slot The address into which the value will be + * stored. + * @param old The old int to be swapped out + * @param value The new int + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + * @return True if the swap was successful. + */ + public boolean intTryCompareAndSwap(ObjectReference src, Address slot, int old, int value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Write a long. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new long + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void longWrite(ObjectReference src, Address slot, long value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read a long. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The long that was read. + */ + @Inline + public long longRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return 0; + } + + /** + * A number of longs are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean longBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Attempt to atomically exchange the value in the given slot + * with the passed replacement value. + * + * By default do nothing, override if appropriate. + * + * @param src The object into which the value will be stored + * @param slot The address into which the value will be + * stored. + * @param old The old long to be swapped out + * @param value The new long + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + * @return True if the swap was successful. + */ + public boolean longTryCompareAndSwap(ObjectReference src, Address slot, long old, long value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Write a float. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new float + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void floatWrite(ObjectReference src, Address slot, float value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read a float. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The float that was read. + */ + @Inline + public float floatRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return 0; + } + + /** + * A number of floats are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean floatBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Write a double. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new double + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void doubleWrite(ObjectReference src, Address slot, double value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read a double. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The double that was read. + */ + @Inline + public double doubleRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return 0; + } + + /** + * A number of doubles are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean doubleBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Write a Word. Take appropriate write barrier actions.

* * By default do nothing, override if appropriate. * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. - * @param tgt The target of the new reference + * @param value The value of the new Word * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ - public void writeBarrier(ObjectReference src, Address slot, - ObjectReference tgt, Word metaDataA, - Word metaDataB, int mode) { + public void wordWrite(ObjectReference src, Address slot, Word value, Word metaDataA, Word metaDataB, int mode) { // Either: write barriers are used and this is overridden, or // write barriers are not used and this is never called if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); } /** + * Read a Word. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The Word that was read. + */ + @Inline + public Word wordRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return Word.zero(); + } + + /** + * A number of Words are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean wordBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** * Attempt to atomically exchange the value in the given slot - * with the passed replacement value. If a new reference is - * created, we must then take appropriate write barrier actions.

+ * with the passed replacement value. * * By default do nothing, override if appropriate. * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. - * @param old The old reference to be swapped out - * @param tgt The target of the new reference + * @param old The old Word to be swapped out + * @param value The new Word * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred * @return True if the swap was successful. */ - public boolean tryCompareAndSwapWriteBarrier(ObjectReference src, Address slot, - ObjectReference old, ObjectReference tgt, Word metaDataA, - Word metaDataB, int mode) { + public boolean wordTryCompareAndSwap(ObjectReference src, Address slot, Word old, Word value, Word metaDataA, Word metaDataB, int mode) { // Either: write barriers are used and this is overridden, or // write barriers are not used and this is never called if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); @@ -315,26 +892,82 @@ } /** - * A number of references are about to be copied from object + * Write an Address. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the Word will be stored + * @param slot The address into which the Word will be + * stored. + * @param value The value of the new Address + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void addressWrite(ObjectReference src, Address slot, Address value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read an Address. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The Address that was read. + */ + @Inline + public Address addressRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return Address.zero(); + } + + /** + * A number of Addresse's are about to be copied from object * src to object dst (as in an array * copy). Thus, dst is the mutated object. Take * appropriate write barrier actions.

* - * @param src The source of the values to be copied - * @param srcOffset The offset of the first source address, in - * bytes, relative to src (in principle, this could be - * negative). - * @param dst The mutated object, i.e. the destination of the copy. - * @param dstOffset The offset of the first destination address, in - * bytes relative to tgt (in principle, this could be - * negative). - * @param bytes The size of the region being copied, in bytes. + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied * @return True if the update was performed by the barrier, false if * left to the caller (always false in this case). */ - public boolean writeBarrier(ObjectReference src, Offset srcOffset, - ObjectReference dst, Offset dstOffset, - int bytes) { + public boolean addressBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Attempt to atomically exchange the value in the given slot + * with the passed replacement value. + * + * By default do nothing, override if appropriate. + * + * @param src The object into which the Address will be stored + * @param slot The address into which the Address will be + * stored. + * @param old The old Address to be swapped out + * @param value The new Address + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + * @return True if the swap was successful. + */ + public boolean addressTryCompareAndSwap(ObjectReference src, Address slot, Address old, Address value, Word metaDataA, Word metaDataB, int mode) { // Either: write barriers are used and this is overridden, or // write barriers are not used and this is never called if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); @@ -342,22 +975,146 @@ } /** - * Read a reference type. In a concurrent collector this may - * involve adding the referent to the marking queue. + * Write an Extent. Take appropriate write barrier actions.

* - * @param referent The referent being read. - * @return The new referent. + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new Extent + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void extentWrite(ObjectReference src, Address slot, Extent value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read an Extent. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The Extent that was read. */ @Inline - public ObjectReference referenceTypeReadBarrier(ObjectReference referent) { + public Extent extentRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { // Either: read barriers are used and this is overridden, or // read barriers are not used and this is never called if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); - return ObjectReference.nullReference(); + return Extent.zero(); + } + + /** + * A number of Extents are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean extentBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Write an Offset. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new Offset + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void offsetWrite(ObjectReference src, Address slot, Offset value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read an Offset. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param src The object reference holding the field being read. + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @param mode The context in which the load occurred + * @return The Offset that was read. + */ + @Inline + public Offset offsetRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return Offset.zero(); + } + + /** + * A number of Offsets are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean offsetBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** + * Write an object reference. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new reference + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void objectReferenceWrite(ObjectReference src, Address slot, ObjectReference value, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); } /** - * Read a reference. Take appropriate read barrier action, and + * Read an object reference. Take appropriate read barrier action, and * return the value that was read.

This is a substituting * barrier. The call to this barrier takes the place of a load.

* @@ -369,7 +1126,65 @@ * @return The reference that was read. */ @Inline - public ObjectReference readBarrier(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + public ObjectReference objectReferenceRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + // Either: read barriers are used and this is overridden, or + // read barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return ObjectReference.nullReference(); + } + + /** + * A number of references are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller (always false in this case). + */ + public boolean objectReferenceBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + // Either: bulk copy is supported and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + + /** + * A new reference is about to be created in a location that is not + * a regular heap object. Take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param slot The address into which the new reference will be + * stored. + * @param tgt The target of the new reference + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + */ + public void objectReferenceNonHeapWrite(Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + } + + /** + * Read an object reference. Take appropriate read barrier action, and + * return the value that was read.

This is a substituting + * barrier. The call to this barrier takes the place of a load.

+ * + * @param slot The address of the slot being read. + * @param metaDataA A value that assists the host VM in creating a load + * @param metaDataB A value that assists the host VM in creating a load + * @return The reference that was read. + */ + @Inline + public ObjectReference objectReferenceNonHeapRead(Address slot, Word metaDataA, Word metaDataB) { // Either: read barriers are used and this is overridden, or // read barriers are not used and this is never called if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); @@ -377,6 +1192,30 @@ } /** + * Attempt to atomically exchange the value in the given slot + * with the passed replacement value. If a new reference is + * created, we must then take appropriate write barrier actions.

+ * + * By default do nothing, override if appropriate. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param old The old reference to be swapped out + * @param tgt The target of the new reference + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + * @return True if the swap was successful. + */ + public boolean objectReferenceTryCompareAndSwap(ObjectReference src, Address slot, ObjectReference old, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) { + // Either: write barriers are used and this is overridden, or + // write barriers are not used and this is never called + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); + return false; + } + + /** * Flush mutator context, in response to a requestMutatorFlush. * Also called by the default implementation of deinitMutator. */ Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/Plan.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/Plan.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/Plan.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/Plan.java Sat Aug 14 07:25:41 2010 @@ -26,7 +26,6 @@ import org.mmtk.utility.Log; import org.mmtk.utility.options.*; import org.mmtk.utility.sanitychecker.SanityChecker; -import org.mmtk.utility.statistics.PerfCounter; import org.mmtk.utility.statistics.Timer; import org.mmtk.utility.statistics.Stats; @@ -110,9 +109,6 @@ /* Do we support a log bit in the object header? Some write barriers may use it */ public static final boolean NEEDS_LOG_BIT_IN_HEADER = VM.activePlan.constraints().needsLogBitInHeader(); - public static final Word LOG_SET_MASK = VM.activePlan.constraints().unloggedBit(); - private static final Word LOG_CLEAR_MASK = LOG_SET_MASK.not(); - public static final Word UNLOGGED_BIT = VM.activePlan.constraints().unloggedBit(); /**************************************************************************** * Class variables @@ -152,9 +148,6 @@ /** Timer that counts total time */ public static final Timer totalTime = new Timer("time"); - /** Performance counters */ - public static final PerfCounter totalPerfCnt = new PerfCounter("perf"); - /** Support for time-limited GCs */ protected static long timeCap; @@ -183,7 +176,7 @@ Options.eagerMmapSpaces = new EagerMmapSpaces(); Options.sanityCheck = new SanityCheck(); Options.debugAddress = new DebugAddress(); - Options.perfMetric = new PerfMetric(); + Options.perfEvents = new PerfEvents(); Map.finalizeStaticSpaceMap(); registerSpecializedMethods(); } @@ -211,7 +204,7 @@ */ @Interruptible public void postBoot() { - VM.statistics.perfCtrInit(Options.perfMetric.getValue()); + VM.statistics.perfEventInit(Options.perfEvents.getValue()); if (Options.verbose.getValue() > 2) Space.printVMMap(); if (Options.verbose.getValue() > 3) VM.config.printConfig(); if (Options.verbose.getValue() > 0) Stats.startAll(); @@ -257,26 +250,6 @@ protected void printDetailedTiming(boolean totals) {} /** - * Perform any required initialization of the GC portion of the header. - * Called for objects created at boot time. - * - * @param ref the object ref to the storage to be initialized - * @param typeRef the type reference for the instance being created - * @param size the number of bytes allocated by the GC system for - * this object. - * @param status the initial value of the status word - * @return The new value of the status word - */ - @Inline - public Word setBootTimeGCBits(Address ref, ObjectReference typeRef, - int size, Word status) { - if (NEEDS_LOG_BIT_IN_HEADER) - return status.or(UNLOGGED_BIT); - else - return status; // nothing to do (no bytes of GC header) - } - - /** * Perform any required write barrier action when installing an object reference * a boot time. * @@ -992,46 +965,6 @@ } /**************************************************************************** - * Support for logging bits (this is cross-cutting). - */ - - /** - * Return true if the specified object needs to be logged. - * - * @param src The object in question - * @return True if the object in question needs to be logged (remembered). - */ - public static final boolean logRequired(ObjectReference src) { - int value = VM.objectModel.readAvailableByte(src); - return !((value & LOG_SET_MASK.toInt()) == 0); - } - - /** - * Mark an object as logged. Since duplicate logging does - * not raise any correctness issues, we do not worry - * about synchronization and allow threads to race to log the - * object, potentially including it twice (unlike reference - * counting where duplicates would lead to incorrect reference - * counts). - * - * @param object The object to be marked as logged - */ - public static final void markAsLogged(ObjectReference object) { - int value = VM.objectModel.readAvailableByte(object); - VM.objectModel.writeAvailableByte(object, (byte) (value & LOG_CLEAR_MASK.toInt())); - } - - /** - * Mark an object as unlogged. - * - * @param object The object to be marked as unlogged - */ - public static final void markAsUnlogged(ObjectReference object) { - int value = VM.objectModel.readAvailableByte(object); - VM.objectModel.writeAvailableByte(object, (byte) (value | UNLOGGED_BIT.toInt())); - } - - /**************************************************************************** * Specialized Methods */ Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/PlanConstraints.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/PlanConstraints.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/PlanConstraints.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/PlanConstraints.java Sat Aug 14 07:25:41 2010 @@ -14,7 +14,6 @@ import org.mmtk.policy.SegregatedFreeListSpace; import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.Word; /** * This class and its subclasses communicate to the host VM/Runtime @@ -23,20 +22,131 @@ * issues with ordering of static initialization. */ @Uninterruptible public abstract class PlanConstraints { - /** @return True if this Plan requires write barriers. */ - public boolean needsWriteBarrier() { return false; } + /** @return True if this Plan requires read barriers on java.lang.reference types. */ + public boolean needsJavaLangReferenceReadBarrier() { return false; } - /** @return True of this Plan requires read barriers on reference types. */ - public boolean needsReferenceTypeReadBarrier() { return false; } + /** @return True if this Plan requires write barriers on booleans. */ + public boolean needsBooleanWriteBarrier() { return false; } - /** @return True of this Plan requires read barriers. */ - public boolean needsReadBarrier() { return false; } + /** @return True if this Plan requires read barriers on booleans. */ + public boolean needsBooleanReadBarrier() { return false; } - /** @return True if this Plan requires static write barriers. */ - public boolean needsStaticWriteBarrier() { return false;} + /** @return True if this Plan can perform bulk boolean arraycopy barriers. */ + public boolean booleanBulkCopySupported() { return false; } - /** @return True if this Plan requires static read barriers. */ - public boolean needsStaticReadBarrier() { return false; } + /** @return True if this Plan requires write barriers on bytes. */ + public boolean needsByteWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on bytes. */ + public boolean needsByteReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk byte arraycopy barriers. */ + public boolean byteBulkCopySupported() { return false; } + + /** @return True if this Plan requires write barriers on chars. */ + public boolean needsCharWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on chars. */ + public boolean needsCharReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk char arraycopy barriers. */ + public boolean charBulkCopySupported() { return false; } + + /** @return True if this Plan requires write barriers on shorts. */ + public boolean needsShortWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on shorts. */ + public boolean needsShortReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk short arraycopy barriers. */ + public boolean shortBulkCopySupported() { return false; } + + /** @return True if this Plan requires write barriers on ints. */ + public boolean needsIntWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on ints. */ + public boolean needsIntReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk int arraycopy barriers. */ + public boolean intBulkCopySupported() { return false; } + + /** @return True if this Plan requires write barriers on longs. */ + public boolean needsLongWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on longs. */ + public boolean needsLongReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk long arraycopy barriers. */ + public boolean longBulkCopySupported() { return false; } + + /** @return True if this Plan requires write barriers on floats. */ + public boolean needsFloatWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on floats. */ + public boolean needsFloatReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk float arraycopy barriers. */ + public boolean floatBulkCopySupported() { return false; } + + /** @return True if this Plan requires write barriers on doubles. */ + public boolean needsDoubleWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on doubles. */ + public boolean needsDoubleReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk double arraycopy barriers. */ + public boolean doubleBulkCopySupported() { return false; } + + /** @return True if this Plan requires write barriers on Words. */ + public boolean needsWordWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on Words. */ + public boolean needsWordReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk Word arraycopy barriers. */ + public boolean wordBulkCopySupported() { return false; } + + /** @return True if this Plan requires write barriers on Address's. */ + public boolean needsAddressWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on Address's. */ + public boolean needsAddressReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk Address arraycopy barriers. */ + public boolean addressBulkCopySupported() { return false; } + + /** @return True if this Plan requires write barriers on Extents. */ + public boolean needsExtentWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on Extents. */ + public boolean needsExtentReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk Extent arraycopy barriers. */ + public boolean extentBulkCopySupported() { return false; } + + /** @return True if this Plan requires write barriers on Offsets. */ + public boolean needsOffsetWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on Offsets. */ + public boolean needsOffsetReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk Offset arraycopy barriers. */ + public boolean offsetBulkCopySupported() { return false; } + + /** @return True if this Plan requires write barriers on object references. */ + public boolean needsObjectReferenceWriteBarrier() { return false; } + + /** @return True if this Plan requires read barriers on object references. */ + public boolean needsObjectReferenceReadBarrier() { return false; } + + /** @return True if this Plan requires non-heap write barriers on object references. */ + public boolean needsObjectReferenceNonHeapWriteBarrier() { return false;} + + /** @return True if this Plan requires non-heap read barriers on object references. */ + public boolean needsObjectReferenceNonHeapReadBarrier() { return false; } + + /** @return True if this Plan can perform bulk object arraycopy barriers. */ + public boolean objectReferenceBulkCopySupported() { return false; } /** @return True if this Plan requires linear scanning. */ public boolean needsLinearScan() { return org.mmtk.utility.Constants.SUPPORT_CARD_SCANNING;} @@ -83,10 +193,4 @@ /** @return True if this Plan requires a header bit for object logging */ public boolean needsLogBitInHeader() { return false; } - - /** @return A bit which represents that a header is unlogged */ - public Word unloggedBit() {return Word.zero(); } - - /** @return A bit which represents that a header is unlogged */ - public Word logSetBitMask() {return Word.zero(); } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/SimpleMutator.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/SimpleMutator.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/SimpleMutator.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/SimpleMutator.java Sat Aug 14 07:25:41 2010 @@ -56,12 +56,18 @@ if (phaseId == Simple.PREPARE) { los.prepare(true); + lgcode.prepare(true); + smcode.prepare(); + nonmove.prepare(); VM.memory.collectorPrepareVMSpace(); return; } if (phaseId == Simple.RELEASE) { los.release(true); + lgcode.release(true); + smcode.release(); + nonmove.release(); VM.memory.collectorReleaseVMSpace(); return; } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/Gen.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/Gen.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/Gen.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/Gen.java Sat Aug 14 07:25:41 2010 @@ -56,11 +56,16 @@ protected static final float MATURE_FRACTION = 0.5f; // est yield private static final float WORST_CASE_COPY_EXPANSION = 1.5f; // worst case for addition of one word overhead due to address based hashing public static final boolean IGNORE_REMSETS = false; - public static final boolean USE_STATIC_WRITE_BARRIER = false; + public static final boolean USE_NON_HEAP_OBJECT_REFERENCE_WRITE_BARRIER = false; public static final boolean USE_OBJECT_BARRIER_FOR_AASTORE = false; // choose between slot and object barriers public static final boolean USE_OBJECT_BARRIER_FOR_PUTFIELD = false; // choose between slot and object barriers public static final boolean USE_OBJECT_BARRIER = USE_OBJECT_BARRIER_FOR_AASTORE || USE_OBJECT_BARRIER_FOR_PUTFIELD; - private static final boolean USE_DISCONTIGUOUS_NURSERY = false; + + /** Fraction of available virtual memory to give to the nursery (if contiguous) */ + protected static final float NURSERY_VM_FRACTION = 0.15f; + + /** Switch between a contiguous and discontiguous nursery (experimental) */ + static final boolean USE_DISCONTIGUOUS_NURSERY = false; // Allocators public static final int ALLOC_NURSERY = ALLOC_DEFAULT; @@ -85,12 +90,11 @@ public static final SizeCounter nurseryCons; /** The nursery space is where all new objects are allocated by default */ - private static final VMRequest vmRequest = USE_DISCONTIGUOUS_NURSERY ? VMRequest.create() : VMRequest.create(0.15f, true); + private static final VMRequest vmRequest = USE_DISCONTIGUOUS_NURSERY ? VMRequest.create() : VMRequest.create(NURSERY_VM_FRACTION, true); public static final CopySpace nurserySpace = new CopySpace("nursery", DEFAULT_POLL_FREQUENCY, false, vmRequest); public static final int NURSERY = nurserySpace.getDescriptor(); private static final Address NURSERY_START = nurserySpace.getStart(); - protected static final int MAX_NURSERY_ALLOC_BYTES = USE_DISCONTIGUOUS_NURSERY ? org.mmtk.utility.Constants.MAX_INT : nurserySpace.getExtent().toInt(); /***************************************************************************** * Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenCollector.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenCollector.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenCollector.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenCollector.java Sat Aug 14 07:25:41 2010 @@ -95,7 +95,7 @@ if (phaseId == StopTheWorld.ROOTS) { VM.scanning.computeGlobalRoots(getCurrentTrace()); - if (!Gen.USE_STATIC_WRITE_BARRIER || global().traceFullHeap()) { + if (!Gen.USE_NON_HEAP_OBJECT_REFERENCE_WRITE_BARRIER || global().traceFullHeap()) { VM.scanning.computeStaticRoots(getCurrentTrace()); } if (Plan.SCAN_BOOT_IMAGE && global().traceFullHeap()) { Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenConstraints.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenConstraints.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenConstraints.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenConstraints.java Sat Aug 14 07:25:41 2010 @@ -15,10 +15,9 @@ import org.mmtk.plan.StopTheWorldConstraints; import org.mmtk.policy.CopySpace; -import org.mmtk.policy.MarkSweepSpace; +import org.mmtk.policy.Space; import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.Word; /** * This class and its subclasses communicate to the host VM/Runtime @@ -47,11 +46,15 @@ /** @return True if this plan requires a write barrier */ @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsObjectReferenceWriteBarrier() { return true; } /** @return True if this plan requires a static barrier */ @Override - public boolean needsStaticWriteBarrier() { return Gen.USE_STATIC_WRITE_BARRIER; } + public boolean needsObjectReferenceNonHeapWriteBarrier() { return Gen.USE_NON_HEAP_OBJECT_REFERENCE_WRITE_BARRIER; } + + /** @return True if this Plan can perform bulk object arraycopy barriers. */ + @Override + public boolean objectReferenceBulkCopySupported() { return true; } /** @return The specialized scan methods required */ @Override @@ -61,12 +64,19 @@ @Override public boolean needsLogBitInHeader() { return Gen.USE_OBJECT_BARRIER; } - /** @return A bit which represents that a header is unlogged */ - @Override - public Word unloggedBit() {return MarkSweepSpace.UNLOGGED_BIT; } - - /** @return The maximum size of an object that may be allocated directly into the nursery */ - @Override - public int maxNonLOSDefaultAllocBytes() { return Gen.MAX_NURSERY_ALLOC_BYTES; } + /** + * @return The maximum size of an object that may be allocated directly into the nursery + */ + @Override + public int maxNonLOSDefaultAllocBytes() { + /* + * If the nursery is discontiguous, the maximum object is essentially unbounded. In + * a contiguous nursery, we can't attempt to nursery-allocate objects larger than the + * available nursery virtual memory. + */ + return Gen.USE_DISCONTIGUOUS_NURSERY ? + org.mmtk.utility.Constants.MAX_INT : + Space.getFracAvailable(Gen.NURSERY_VM_FRACTION).toInt(); + } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenMatureTraceLocal.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenMatureTraceLocal.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenMatureTraceLocal.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenMatureTraceLocal.java Sat Aug 14 07:25:41 2010 @@ -12,9 +12,9 @@ */ package org.mmtk.plan.generational; -import org.mmtk.plan.Plan; import org.mmtk.plan.TraceLocal; import org.mmtk.plan.Trace; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.deque.*; import org.mmtk.vm.VM; @@ -124,7 +124,7 @@ logMessage(5, "clearing modbuf"); ObjectReference obj; while (!(obj = modbuf.pop()).isNull()) { - Plan.markAsUnlogged(obj); + HeaderByte.markAsUnlogged(obj); } logMessage(5, "clearing remset"); while (!remset.isEmpty()) { Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenMutator.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenMutator.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenMutator.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenMutator.java Sat Aug 14 07:25:41 2010 @@ -15,6 +15,7 @@ import org.mmtk.plan.*; import org.mmtk.policy.CopyLocal; import org.mmtk.policy.Space; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.deque.*; import org.mmtk.utility.alloc.Allocator; import org.mmtk.utility.statistics.Stats; @@ -142,11 +143,11 @@ @Inline private void fastPath(ObjectReference src, Address slot, ObjectReference tgt, int mode) { if (Gen.GATHER_WRITE_BARRIER_STATS) Gen.wbFast.inc(); - if ((mode == AASTORE_WRITE_BARRIER && USE_OBJECT_BARRIER_FOR_AASTORE) || - (mode == PUTFIELD_WRITE_BARRIER && USE_OBJECT_BARRIER_FOR_PUTFIELD)) { - if (Plan.logRequired(src)) { + if ((mode == ARRAY_ELEMENT && USE_OBJECT_BARRIER_FOR_AASTORE) || + (mode == INSTANCE_FIELD && USE_OBJECT_BARRIER_FOR_PUTFIELD)) { + if (HeaderByte.isUnlogged(src)) { if (Gen.GATHER_WRITE_BARRIER_STATS) Gen.wbSlow.inc(); - Plan.markAsLogged(src); + HeaderByte.markAsLogged(src); modbuf.insert(src); } } else { @@ -174,11 +175,51 @@ * @param mode The mode of the store (eg putfield, putstatic etc) */ @Inline - public final void writeBarrier(ObjectReference src, Address slot, + public final void objectReferenceWrite(ObjectReference src, Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) { fastPath(src, slot, tgt, mode); - VM.barriers.performWriteInBarrier(src, slot, tgt, metaDataA, metaDataB, mode); + VM.barriers.objectReferenceWrite(src, tgt, metaDataA, metaDataB, mode); + } + + + /** + * Perform the root write barrier fast path, which may involve remembering + * a reference if necessary. + * + * @param slot The address into which the new reference will be + * stored. + * @param tgt The target of the new reference + * @param mode The mode of the store (eg putfield, putstatic etc) + */ + @Inline + private void fastPath(Address slot, ObjectReference tgt) { + if (Gen.GATHER_WRITE_BARRIER_STATS) Gen.wbFast.inc(); + if (Gen.inNursery(tgt)) { + if (Gen.GATHER_WRITE_BARRIER_STATS) Gen.wbSlow.inc(); + remset.insert(slot); + } + } + + /** + * A new reference is about to be created in a location that is not + * a regular heap object. Take appropriate write barrier actions.

+ * + * In this case, we remember the address of the source of the + * pointer if the new reference points into the nursery from + * non-nursery space. + * + * @param slot The address into which the new reference will be + * stored. + * @param tgt The target of the new reference + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + */ + @Inline + public final void objectReferenceNonHeapWrite(Address slot, ObjectReference tgt, + Word metaDataA, Word metaDataB) { + fastPath(slot, tgt); + VM.barriers.objectReferenceNonHeapWrite(slot, tgt, metaDataA, metaDataB); } /** @@ -201,10 +242,9 @@ * @return True if the swap was successful. */ @Inline - public boolean tryCompareAndSwapWriteBarrier(ObjectReference src, Address slot, - ObjectReference old, ObjectReference tgt, Word metaDataA, - Word metaDataB, int mode) { - boolean result = VM.barriers.tryCompareAndSwapWriteInBarrier(src, slot, old, tgt, metaDataA, metaDataB, mode); + public boolean objectReferenceTryCompareAndSwap(ObjectReference src, Address slot, ObjectReference old, ObjectReference tgt, + Word metaDataA, Word metaDataB, int mode) { + boolean result = VM.barriers.objectReferenceTryCompareAndSwap(src, old, tgt, metaDataA, metaDataB, mode); if (result) fastPath(src, slot, tgt, mode); return result; @@ -219,26 +259,21 @@ * In this case, we remember the mutated source address range and * will scan that address range at GC time. * - * @param src The source of the values to copied - * @param srcOffset The offset of the first source address, in - * bytes, relative to src (in principle, this could be - * negative). + * @param src The source of the values to be copied + * @param srcIdx The starting source index * @param dst The mutated object, i.e. the destination of the copy. - * @param dstOffset The offset of the first destination address, in - * bytes relative to tgt (in principle, this could be - * negative). - * @param bytes The size of the region being copied, in bytes. + * @param srcIdx The starting source index + * @param len The number of array elements to be copied * @return True if the update was performed by the barrier, false if * left to the caller (always false in this case). */ @Inline - public final boolean writeBarrier(ObjectReference src, Offset srcOffset, - ObjectReference dst, Offset dstOffset, - int bytes) { - // We can ignore when src is in old space, right? - if (!Gen.inNursery(dst)) - arrayRemset.insert(dst.toAddress().plus(dstOffset), - dst.toAddress().plus(dstOffset.plus(bytes))); + @Override + public final boolean objectReferenceBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + if (!Gen.inNursery(dst)) { + Address start = dst.toAddress().plus(dstOffset); + arrayRemset.insert(start, start.plus(bytes)); + } return false; } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenNurseryTraceLocal.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenNurseryTraceLocal.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenNurseryTraceLocal.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/GenNurseryTraceLocal.java Sat Aug 14 07:25:41 2010 @@ -12,9 +12,9 @@ */ package org.mmtk.plan.generational; -import org.mmtk.plan.Plan; import org.mmtk.plan.TraceLocal; import org.mmtk.plan.Trace; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.deque.*; import org.mmtk.vm.VM; @@ -95,7 +95,7 @@ ObjectReference obj; while (!(obj = modbuf.pop()).isNull()) { if (VM.DEBUG) VM.debugging.modbufEntry(obj); - Plan.markAsUnlogged(obj); + HeaderByte.markAsUnlogged(obj); scanObject(obj); } logMessage(5, "processing remset"); Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/copying/GenCopyCollector.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/copying/GenCopyCollector.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/copying/GenCopyCollector.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/copying/GenCopyCollector.java Sat Aug 14 07:25:41 2010 @@ -17,7 +17,8 @@ import org.mmtk.plan.Plan; import org.mmtk.plan.TraceLocal; import org.mmtk.policy.CopyLocal; -import org.mmtk.policy.CopySpace; +import org.mmtk.utility.ForwardingWord; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.alloc.Allocator; import org.mmtk.vm.VM; @@ -111,13 +112,13 @@ @Inline public final void postCopy(ObjectReference object, ObjectReference typeRef, int bytes, int allocator) { - CopySpace.clearGCBits(object); + ForwardingWord.clearForwardingBits(object); if (allocator == Plan.ALLOC_LOS) Plan.loSpace.initializeHeader(object, false); else if (GenCopy.IGNORE_REMSETS) - CopySpace.markObject(getCurrentTrace(),object, GenCopy.immortalSpace.getMarkState()); + GenCopy.immortalSpace.traceObject(getCurrentTrace(), object); // FIXME this does not look right if (Gen.USE_OBJECT_BARRIER) - Plan.markAsUnlogged(object); + HeaderByte.markAsUnlogged(object); } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/copying/GenCopyMutator.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/copying/GenCopyMutator.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/copying/GenCopyMutator.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/copying/GenCopyMutator.java Sat Aug 14 07:25:41 2010 @@ -142,7 +142,7 @@ */ public void collectionPhase(short phaseId, boolean primary) { if (global().traceFullHeap()) { - if (phaseId == GenCopy.PREPARE) { + if (phaseId == GenCopy.RELEASE) { super.collectionPhase(phaseId, primary); if (global().gcFullHeap) mature.rebind(GenCopy.toSpace()); return; Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/immix/GenImmixCollector.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/immix/GenImmixCollector.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/immix/GenImmixCollector.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/immix/GenImmixCollector.java Sat Aug 14 07:25:41 2010 @@ -16,6 +16,7 @@ import org.mmtk.plan.TraceLocal; import org.mmtk.plan.generational.*; import org.mmtk.policy.Space; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.alloc.Allocator; import org.mmtk.utility.alloc.ImmixAllocator; import org.mmtk.utility.statistics.Stats; @@ -119,7 +120,7 @@ GenImmix.immixSpace.postCopy(object, bytes, allocator == GenImmix.ALLOC_MATURE_MAJORGC); } if (Gen.USE_OBJECT_BARRIER) - Plan.markAsUnlogged(object); + HeaderByte.markAsUnlogged(object); } /***************************************************************************** Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/marksweep/GenMSCollector.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/marksweep/GenMSCollector.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/marksweep/GenMSCollector.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/marksweep/GenMSCollector.java Sat Aug 14 07:25:41 2010 @@ -17,6 +17,7 @@ import org.mmtk.plan.generational.*; import org.mmtk.policy.MarkSweepLocal; import org.mmtk.policy.Space; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.alloc.Allocator; import org.mmtk.utility.statistics.Stats; @@ -115,7 +116,7 @@ else GenMS.msSpace.postCopy(object, allocator == GenMS.ALLOC_MATURE_MAJORGC); if (Gen.USE_OBJECT_BARRIER) - Plan.markAsUnlogged(object); + HeaderByte.markAsUnlogged(object); } /***************************************************************************** Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/immix/ImmixDefragTraceLocal.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/immix/ImmixDefragTraceLocal.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/immix/ImmixDefragTraceLocal.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/immix/ImmixDefragTraceLocal.java Sat Aug 14 07:25:41 2010 @@ -18,6 +18,7 @@ import org.mmtk.plan.TraceLocal; import org.mmtk.plan.Trace; import org.mmtk.policy.Space; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.deque.ObjectReferenceDeque; import org.mmtk.vm.VM; @@ -145,7 +146,7 @@ logMessage(5, "clearing modBuffer"); while (!modBuffer.isEmpty()) { ObjectReference src = modBuffer.pop(); - Plan.markAsUnlogged(src); + HeaderByte.markAsUnlogged(src); } } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/immix/ImmixTraceLocal.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/immix/ImmixTraceLocal.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/immix/ImmixTraceLocal.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/immix/ImmixTraceLocal.java Sat Aug 14 07:25:41 2010 @@ -14,10 +14,10 @@ import static org.mmtk.policy.immix.ImmixConstants.MARK_LINE_AT_SCAN_TIME; -import org.mmtk.plan.Plan; import org.mmtk.plan.TraceLocal; import org.mmtk.plan.Trace; import org.mmtk.policy.Space; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.deque.ObjectReferenceDeque; import org.mmtk.vm.VM; @@ -133,7 +133,7 @@ logMessage(5, "clearing modBuffer"); while (!modBuffer.isEmpty()) { ObjectReference src = modBuffer.pop(); - Plan.markAsUnlogged(src); + HeaderByte.markAsUnlogged(src); } } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MC.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MC.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MC.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MC.java Sat Aug 14 07:25:41 2010 @@ -48,10 +48,16 @@ * Class variables */ + /** The mark compact space itself */ public static final MarkCompactSpace mcSpace = new MarkCompactSpace("mc", DEFAULT_POLL_FREQUENCY, VMRequest.create(0.6f)); + + /** The space descriptor */ public static final int MARK_COMPACT = mcSpace.getDescriptor(); + /** Specialized method identifier for the MARK phase */ public static final int SCAN_MARK = 0; + + /** Specialized method identifier for the FORWARD phase */ public static final int SCAN_FORWARD = 1; /* Phases */ @@ -59,8 +65,10 @@ public static final short FORWARD_CLOSURE = Phase.createSimple("fw-closure"); public static final short RELEASE_FORWARD = Phase.createSimple("fw-release"); - /* FIXME these two phases need to be made per-collector phases */ + /** Calculate forwarding pointers via a linear scan over the heap */ public static final short CALCULATE_FP = Phase.createSimple("calc-fp"); + + /** Perform compaction via a linear scan over the heap */ public static final short COMPACT = Phase.createSimple("compact"); // CHECKSTYLE:OFF @@ -75,7 +83,7 @@ Phase.scheduleComplex (rootClosurePhase), Phase.scheduleComplex (refTypeClosurePhase), Phase.scheduleComplex (completeClosurePhase), - Phase.scheduleMutator (CALCULATE_FP), + Phase.scheduleCollector(CALCULATE_FP), Phase.scheduleGlobal (PREPARE_FORWARD), Phase.scheduleCollector(PREPARE_FORWARD), Phase.scheduleMutator (PREPARE), @@ -87,7 +95,7 @@ Phase.scheduleMutator (RELEASE), Phase.scheduleCollector(RELEASE_FORWARD), Phase.scheduleGlobal (RELEASE_FORWARD), - Phase.scheduleMutator (COMPACT), + Phase.scheduleCollector(COMPACT), Phase.scheduleComplex (finishPhase)); // CHECKSTYLE:ON @@ -96,7 +104,10 @@ * Instance variables */ + /** This trace sets the mark bit in live objects */ public final Trace markTrace; + + /** This trace updates pointers with the forwarded references */ public final Trace forwardTrace; /** @@ -119,6 +130,7 @@ * * @param phaseId Collection phase to execute. */ + @Override @Inline public final void collectionPhase(short phaseId) { if (phaseId == PREPARE) { @@ -167,6 +179,7 @@ * @return The number of pages reserved given the pending * allocation, excluding space reserved for copying. */ + @Override public int getPagesUsed() { return (mcSpace.reservedPages() + super.getPagesUsed()); } @@ -178,6 +191,7 @@ * @return the number of pages a collection is required to free to satisfy * outstanding allocation requests. */ + @Override public int getPagesRequired() { return super.getPagesRequired() + mcSpace.requiredPages(); } @@ -203,6 +217,7 @@ * * @return The expected (root excluded) reference count. */ + @Override public int sanityExpectedRC(ObjectReference object, int sanityRootRC) { Space space = Space.getSpaceForObject(object); @@ -212,14 +227,14 @@ // This is not very satisfying but allows us to use the sanity checker to // detect dangling pointers. return SanityChecker.UNSURE; - } else { - return super.sanityExpectedRC(object, sanityRootRC); } + return super.sanityExpectedRC(object, sanityRootRC); } /** * Register specialized methods. */ + @Override @Interruptible protected void registerSpecializedMethods() { TransitiveClosure.registerSpecializedScan(SCAN_MARK, MCMarkTraceLocal.class); Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCCollector.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCCollector.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCCollector.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCCollector.java Sat Aug 14 07:25:41 2010 @@ -13,6 +13,7 @@ package org.mmtk.plan.markcompact; import org.mmtk.plan.*; +import org.mmtk.policy.MarkCompactCollector; import org.mmtk.vm.VM; @@ -29,12 +30,6 @@ * method), and collection-time allocation.

* * @see MC for an overview of the mark-compact algorithm.

- * - * FIXME Currently MC does not properly separate mutator and collector - * behaviors, so some of the collection logic in MCMutator should - * really be per-collector thread, not per-mutator thread. - * - * @see MC * @see MCMutator * @see StopTheWorldCollector * @see CollectorContext @@ -50,6 +45,7 @@ private final MCMarkTraceLocal markTrace; private final MCForwardTraceLocal forwardTrace; + private final MarkCompactCollector mc; private boolean currentTrace; /**************************************************************************** @@ -63,6 +59,7 @@ public MCCollector() { markTrace = new MCMarkTraceLocal(global().markTrace); forwardTrace = new MCForwardTraceLocal(global().forwardTrace); + mc = new MarkCompactCollector(MC.mcSpace); } @@ -81,6 +78,7 @@ * @param offset The alignment offset. * @return The address of the first byte of the allocated region */ + @Override @Inline public Address allocCopy(ObjectReference original, int bytes, int align, int offset, int allocator) { @@ -96,6 +94,7 @@ * @param typeRef the type reference for the instance being created * @param bytes The size of the space to be allocated (in bytes) */ + @Override @Inline public void postCopy(ObjectReference object, ObjectReference typeRef, int bytes, int allocator) { @@ -113,6 +112,7 @@ * @param phaseId The collection phase to perform * @param primary Perform any single-threaded activities using this thread. */ + @Override @Inline public final void collectionPhase(short phaseId, boolean primary) { if (phaseId == MC.PREPARE) { @@ -127,6 +127,16 @@ return; } + if (phaseId == MC.CALCULATE_FP) { + mc.calculateForwardingPointers(); + return; + } + + if (phaseId == MC.COMPACT) { + mc.compact(); + return; + } + if (phaseId == MC.RELEASE) { markTrace.release(); super.collectionPhase(phaseId, primary); @@ -160,12 +170,12 @@ */ /** @return The current trace instance. */ + @Override public final TraceLocal getCurrentTrace() { if (currentTrace == TRACE_MARK) { return markTrace; - } else { - return forwardTrace; } + return forwardTrace; } /** @return The active global plan as an MC instance. */ Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCConstraints.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCConstraints.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCConstraints.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCConstraints.java Sat Aug 14 07:25:41 2010 @@ -15,6 +15,7 @@ import org.mmtk.plan.StopTheWorldConstraints; import org.mmtk.policy.MarkCompactSpace; +import org.mmtk.policy.MarkCompactLocal; import org.vmmagic.pragma.*; @@ -33,6 +34,8 @@ @Override public boolean needsLinearScan() { return true; } @Override + public int maxNonLOSDefaultAllocBytes() { return MarkCompactLocal.MINIMUM_DATA_SIZE; } + @Override public int gcHeaderBits() { return MarkCompactSpace.LOCAL_GC_BITS_REQUIRED; } @Override public int gcHeaderWords() { return MarkCompactSpace.GC_HEADER_WORDS_REQUIRED; } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCMutator.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCMutator.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCMutator.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/markcompact/MCMutator.java Sat Aug 14 07:25:41 2010 @@ -32,10 +32,6 @@ * * See {@link MC} for an overview of the mark-compact algorithm.

* - * FIXME Currently MC does not properly separate mutator and collector - * behaviors, so some of the collection logic here should really be - * per-collector thread, not per-mutator thread. - * * @see MC * @see MCCollector * @see org.mmtk.plan.StopTheWorldMutator @@ -46,7 +42,7 @@ /**************************************************************************** * Instance fields */ - private MarkCompactLocal mc; + private final MarkCompactLocal mc; /**************************************************************************** * @@ -77,6 +73,7 @@ * @param site Allocation site * @return The low address of the allocated memory. */ + @Override @Inline public Address alloc(int bytes, int align, int offset, int allocator, int site) { if (allocator == MC.ALLOC_DEFAULT) { @@ -95,6 +92,7 @@ * @param bytes The size of the space to be allocated (in bytes) * @param allocator The allocator number to be used for this allocation */ + @Override @Inline public void postAlloc(ObjectReference ref, ObjectReference typeRef, int bytes, int allocator) { @@ -113,6 +111,7 @@ * which is allocating into space, or null * if no appropriate allocator can be established. */ + @Override public Allocator getAllocatorFromSpace(Space space) { if (space == MC.mcSpace) return mc; return super.getAllocatorFromSpace(space); @@ -130,25 +129,15 @@ * @param phaseId The collection phase to perform * @param primary Perform any single-threaded activities using this thread. */ + @Override @Inline public final void collectionPhase(short phaseId, boolean primary) { if (phaseId == MC.PREPARE) { + mc.prepare(); super.collectionPhase(phaseId, primary); return; } - /* FIXME this needs to be made a per-collector phase */ - if (phaseId == MC.CALCULATE_FP) { - mc.calculateForwardingPointers(); - return; - } - - /* FIXME this needs to be made a per-collector phase */ - if (phaseId == MC.COMPACT) { - mc.compact(); - return; - } - if (phaseId == MC.RELEASE) { super.collectionPhase(phaseId, primary); return; @@ -156,4 +145,18 @@ super.collectionPhase(phaseId, primary); } + /** + * Flush the pages this mutator has allocated back to the global + * dirty page list, where the collectors can find them. + * + * @see org.mmtk.plan.MutatorContext#flush() + */ + @Override + public void flush() { + super.flush(); + mc.flush(); + } + + + } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/marksweep/MSTraceLocal.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/marksweep/MSTraceLocal.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/marksweep/MSTraceLocal.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/marksweep/MSTraceLocal.java Sat Aug 14 07:25:41 2010 @@ -12,10 +12,10 @@ */ package org.mmtk.plan.marksweep; -import org.mmtk.plan.Plan; import org.mmtk.plan.TraceLocal; import org.mmtk.plan.Trace; import org.mmtk.policy.Space; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.deque.ObjectReferenceDeque; import org.vmmagic.pragma.*; @@ -93,7 +93,7 @@ logMessage(5, "clearing modBuffer"); while (!modBuffer.isEmpty()) { ObjectReference src = modBuffer.pop(); - Plan.markAsUnlogged(src); + HeaderByte.markAsUnlogged(src); } } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/poisoned/PoisonedConstraints.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/poisoned/PoisonedConstraints.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/poisoned/PoisonedConstraints.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/poisoned/PoisonedConstraints.java Sat Aug 14 07:25:41 2010 @@ -24,11 +24,11 @@ @Uninterruptible public class PoisonedConstraints extends MSConstraints { @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsObjectReferenceWriteBarrier() { return true; } @Override - public boolean needsReadBarrier() { return true; } + public boolean needsObjectReferenceReadBarrier() { return true; } @Override - public boolean needsStaticWriteBarrier() { return false; } + public boolean needsObjectReferenceNonHeapWriteBarrier() { return false; } @Override - public boolean needsStaticReadBarrier() { return false; } + public boolean needsObjectReferenceNonHeapReadBarrier() { return false; } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/poisoned/PoisonedMutator.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/poisoned/PoisonedMutator.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/poisoned/PoisonedMutator.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/poisoned/PoisonedMutator.java Sat Aug 14 07:25:41 2010 @@ -18,7 +18,6 @@ import org.vmmagic.pragma.*; import org.vmmagic.unboxed.Address; import org.vmmagic.unboxed.ObjectReference; -import org.vmmagic.unboxed.Offset; import org.vmmagic.unboxed.Word; /** @@ -50,8 +49,8 @@ */ @Inline @Override - public void writeBarrier(ObjectReference src, Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) { - VM.barriers.performRawWriteInBarrier(src, slot, Poisoned.poison(tgt), metaDataA, metaDataB, mode); + public void objectReferenceWrite(ObjectReference src, Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.wordWrite(src, Poisoned.poison(tgt), metaDataA, metaDataB, mode); } /** @@ -72,35 +71,9 @@ * @return True if the swap was successful. */ @Override - public boolean tryCompareAndSwapWriteBarrier(ObjectReference src, Address slot, ObjectReference old, ObjectReference tgt, + public boolean objectReferenceTryCompareAndSwap(ObjectReference src, Address slot, ObjectReference old, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) { - return VM.barriers.tryRawCompareAndSwapWriteInBarrier(src, slot, Poisoned.poison(old), Poisoned.poison(tgt), metaDataA, metaDataB, mode); - } - - /** - * A number of references are about to be copied from object - * src to object dst (as in an array - * copy). Thus, dst is the mutated object. Take - * appropriate write barrier actions.

- * - * @param src The source of the values to be copied - * @param srcOffset The offset of the first source address, in - * bytes, relative to src (in principle, this could be - * negative). - * @param dst The mutated object, i.e. the destination of the copy. - * @param dstOffset The offset of the first destination address, in - * bytes relative to tgt (in principle, this could be - * negative). - * @param bytes The size of the region being copied, in bytes. - * @return True if the update was performed by the barrier, false if - * left to the caller (always false in this case). - */ - @Override - public boolean writeBarrier(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { - // TODO: Currently, read barriers implies that this is never used, perhaps - // we might want to use it sometime anyway? - if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false); - return false; + return VM.barriers.wordTryCompareAndSwap(src, Poisoned.poison(old), Poisoned.poison(tgt), metaDataA, metaDataB, mode); } /** @@ -117,7 +90,7 @@ */ @Inline @Override - public ObjectReference readBarrier(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { - return Poisoned.depoison(VM.barriers.performRawReadInBarrier(src, slot, metaDataA, metaDataB, mode)); + public ObjectReference objectReferenceRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) { + return Poisoned.depoison(VM.barriers.wordRead(src, metaDataA, metaDataB, mode)); } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/RCBaseConstraints.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/RCBaseConstraints.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/RCBaseConstraints.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/RCBaseConstraints.java Sat Aug 14 07:25:41 2010 @@ -30,7 +30,7 @@ @Override public int gcHeaderWords() { return RCHeader.GC_HEADER_WORDS_REQUIRED; } @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsObjectReferenceWriteBarrier() { return true; } @Override public int maxNonLOSDefaultAllocBytes() { return MAX_FREELIST_OBJECT_BYTES; } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/RCBaseMutator.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/RCBaseMutator.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/RCBaseMutator.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/RCBaseMutator.java Sat Aug 14 07:25:41 2010 @@ -238,13 +238,13 @@ * @param mode The context in which the store occurred */ @Inline - public void writeBarrier(ObjectReference src, Address slot, + public void objectReferenceWrite(ObjectReference src, Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) { if (RCHeader.logRequired(src)) { coalescingWriteBarrierSlow(src); } - VM.barriers.performWriteInBarrier(src,slot,tgt, metaDataA, metaDataB, mode); + VM.barriers.objectReferenceWrite(src,tgt,metaDataA, metaDataB, mode); } /** @@ -265,13 +265,13 @@ * @return True if the swap was successful. */ @Inline - public boolean tryCompareAndSwapWriteBarrier(ObjectReference src, Address slot, + public boolean objectReferenceTryCompareAndSwap(ObjectReference src, Address slot, ObjectReference old, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) { if (RCHeader.logRequired(src)) { coalescingWriteBarrierSlow(src); } - return VM.barriers.tryCompareAndSwapWriteInBarrier(src,slot,old,tgt,metaDataA,metaDataB,mode); + return VM.barriers.objectReferenceTryCompareAndSwap(src,old,tgt,metaDataA,metaDataB,mode); } /** @@ -293,7 +293,7 @@ * left to the caller (always false in this case). */ @Inline - public boolean writeBarrier(ObjectReference src, Offset srcOffset, + public boolean objectReferenceBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { if (RCHeader.logRequired(dst)) { coalescingWriteBarrierSlow(dst); Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/generational/GenRCCollector.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/generational/GenRCCollector.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/generational/GenRCCollector.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/refcount/generational/GenRCCollector.java Sat Aug 14 07:25:41 2010 @@ -17,9 +17,9 @@ import org.mmtk.plan.refcount.RCBase; import org.mmtk.plan.refcount.RCBaseCollector; import org.mmtk.plan.refcount.RCHeader; -import org.mmtk.policy.CopySpace; import org.mmtk.policy.ExplicitFreeListLocal; import org.mmtk.policy.ExplicitFreeListSpace; +import org.mmtk.utility.ForwardingWord; import org.mmtk.vm.VM; import org.vmmagic.pragma.*; import org.vmmagic.unboxed.Address; @@ -102,7 +102,7 @@ @Inline public final void postCopy(ObjectReference object, ObjectReference typeRef, int bytes, int allocator) { - CopySpace.clearGCBits(object); + ForwardingWord.clearForwardingBits(object); RCHeader.initializeHeader(object, false); RCHeader.makeUnlogged(object); ExplicitFreeListSpace.unsyncSetLiveBit(object); Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/SSCollector.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/SSCollector.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/SSCollector.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/SSCollector.java Sat Aug 14 07:25:41 2010 @@ -13,10 +13,10 @@ package org.mmtk.plan.semispace; import org.mmtk.plan.*; -import org.mmtk.policy.CopySpace; import org.mmtk.policy.CopyLocal; import org.mmtk.policy.LargeObjectLocal; import org.mmtk.policy.Space; +import org.mmtk.utility.ForwardingWord; import org.mmtk.vm.VM; import org.vmmagic.unboxed.*; @@ -111,7 +111,7 @@ @Inline public void postCopy(ObjectReference object, ObjectReference typeRef, int bytes, int allocator) { - CopySpace.clearGCBits(object); + ForwardingWord.clearForwardingBits(object); if (allocator == Plan.ALLOC_LOS) Plan.loSpace.initializeHeader(object, false); } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/gctrace/GCTraceConstraints.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/gctrace/GCTraceConstraints.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/gctrace/GCTraceConstraints.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/gctrace/GCTraceConstraints.java Sat Aug 14 07:25:41 2010 @@ -22,7 +22,7 @@ @Uninterruptible public class GCTraceConstraints extends SSConstraints { @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsObjectReferenceWriteBarrier() { return true; } @Override public boolean generateGCTrace() { return true; } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/gctrace/GCTraceMutator.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/gctrace/GCTraceMutator.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/gctrace/GCTraceMutator.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/gctrace/GCTraceMutator.java Sat Aug 14 07:25:41 2010 @@ -89,12 +89,12 @@ * @param mode The mode of the store (eg putfield, putstatic etc) */ @Inline - public final void writeBarrier(ObjectReference src, Address slot, + public final void objectReferenceWrite(ObjectReference src, Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) { - TraceGenerator.processPointerUpdate(mode == PUTFIELD_WRITE_BARRIER, + TraceGenerator.processPointerUpdate(mode == INSTANCE_FIELD, src, slot, tgt); - VM.barriers.performWriteInBarrier(src, slot, tgt, metaDataA, metaDataB, mode); + VM.barriers.objectReferenceWrite(src, tgt, metaDataA, metaDataB, mode); } /** @@ -115,12 +115,12 @@ * @return True if the swap was successful. */ @Inline - public boolean tryCompareAndSwapWriteBarrier(ObjectReference src, Address slot, + public boolean objectReferenceTryCompareAndSwap(ObjectReference src, Address slot, ObjectReference old, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) { - boolean result = VM.barriers.tryCompareAndSwapWriteInBarrier(src, slot, old, tgt, metaDataA, metaDataB, mode); + boolean result = VM.barriers.objectReferenceTryCompareAndSwap(src, old, tgt, metaDataA, metaDataB, mode); if (result) { - TraceGenerator.processPointerUpdate(mode == PUTFIELD_WRITE_BARRIER, src, slot, tgt); + TraceGenerator.processPointerUpdate(mode == INSTANCE_FIELD, src, slot, tgt); } return result; } @@ -143,7 +143,7 @@ * @return True if the update was performed by the barrier, false if * left to the caller (always false in this case). */ - public boolean writeBarrier(ObjectReference src, Offset srcOffset, + public boolean objectReferenceBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { /* These names seem backwards, but are defined to be compatable with the * previous writeBarrier method. */ Added: vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriers.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriers.java?rev=111072&view=auto ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriers.java (added) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriers.java Sat Aug 14 07:25:41 2010 @@ -0,0 +1,26 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.plan.semispace.usePrimitiveWriteBarriers; + +import org.mmtk.plan.semispace.SS; + +import org.vmmagic.pragma.*; + +/** + * This class exercises primitive write barriers The write barriers contain no + * payloads but merely perform a write to the heap + */ + at Uninterruptible +public class UsePrimitiveWriteBarriers extends SS { + +} Added: vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersCollector.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersCollector.java?rev=111072&view=auto ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersCollector.java (added) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersCollector.java Sat Aug 14 07:25:41 2010 @@ -0,0 +1,25 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.plan.semispace.usePrimitiveWriteBarriers; + +import org.mmtk.plan.semispace.SSCollector; +import org.vmmagic.pragma.*; + +/** + * This class extends the {@link SSCollector} class as part of the + * {@link UsePrimitiveWriteBarriers} collector. All implementation details + * concerning GC are handled by {@link SSCollector} + */ + at Uninterruptible +public class UsePrimitiveWriteBarriersCollector extends SSCollector { +} Added: vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersConstraints.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersConstraints.java?rev=111072&view=auto ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersConstraints.java (added) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersConstraints.java Sat Aug 14 07:25:41 2010 @@ -0,0 +1,84 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.plan.semispace.usePrimitiveWriteBarriers; + +import org.mmtk.plan.semispace.SSConstraints; +import org.vmmagic.pragma.*; + +/** + * UsePrimitiveWriteBarriers common constants. + */ + at Uninterruptible +public class UsePrimitiveWriteBarriersConstraints extends SSConstraints { + + /** @return True if this Plan requires write barriers on booleans. */ + public boolean needsBooleanWriteBarrier() { return true; } + + /** @return True if this Plan can perform bulk boolean arraycopy barriers. */ + public boolean booleanBulkCopySupported() { return true; } + + /** @return True if this Plan requires write barriers on bytes. */ + public boolean needsByteWriteBarrier() { return true; } + + /** @return True if this Plan can perform bulk byte arraycopy barriers. */ + public boolean byteBulkCopySupported() { return true; } + + /** @return True if this Plan requires write barriers on chars. */ + public boolean needsCharWriteBarrier() { return true; } + + /** @return True if this Plan can perform bulk char arraycopy barriers. */ + public boolean charBulkCopySupported() { return true; } + + /** @return True if this Plan requires write barriers on shorts. */ + public boolean needsShortWriteBarrier() { return true; } + + /** @return True if this Plan can perform bulk short arraycopy barriers. */ + public boolean shortBulkCopySupported() { return true; } + + /** @return True if this Plan requires write barriers on ints. */ + public boolean needsIntWriteBarrier() { return true; } + + /** @return True if this Plan can perform bulk int arraycopy barriers. */ + public boolean intBulkCopySupported() { return true; } + + /** @return True if this Plan requires write barriers on longs. */ + public boolean needsLongWriteBarrier() { return true; } + + /** @return True if this Plan can perform bulk long arraycopy barriers. */ + public boolean longBulkCopySupported() { return true; } + + /** @return True if this Plan requires write barriers on floats. */ + public boolean needsFloatWriteBarrier() { return true; } + + /** @return True if this Plan can perform bulk float arraycopy barriers. */ + public boolean floatBulkCopySupported() { return true; } + + /** @return True if this Plan requires write barriers on doubles. */ + public boolean needsDoubleWriteBarrier() { return true; } + + /** @return True if this Plan can perform bulk double arraycopy barriers. */ + public boolean doubleBulkCopySupported() { return true; } + + /** @return True if this Plan requires write barriers on Words. */ + public boolean needsWordWriteBarrier() { return true; } + + /** @return True if this Plan requires write barriers on Address's. */ + public boolean needsAddressWriteBarrier() { return true; } + + /** @return True if this Plan requires write barriers on Extents. */ + public boolean needsExtentWriteBarrier() { return true; } + + /** @return True if this Plan requires write barriers on Offsets. */ + public boolean needsOffsetWriteBarrier() { return true; } + +} Added: vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersMutator.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersMutator.java?rev=111072&view=auto ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersMutator.java (added) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/semispace/usePrimitiveWriteBarriers/UsePrimitiveWriteBarriersMutator.java Sat Aug 14 07:25:41 2010 @@ -0,0 +1,424 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.plan.semispace.usePrimitiveWriteBarriers; + +import org.mmtk.plan.semispace.SSMutator; +import org.mmtk.vm.VM; + +import org.vmmagic.unboxed.*; +import org.vmmagic.pragma.*; + +/** + * This class extends the {@link SSMutator} class as part of the + * {@link UsePrimitiveWriteBarriers} collector. It overrides various methods in + * {@link Mutator} to implement primitive write barriers. + */ + at Uninterruptible +public class UsePrimitiveWriteBarriersMutator extends SSMutator { + + /** + * Write an Address. Take appropriate write barrier actions.

+ * + * @param src The object into which the Word will be stored + * @param slot The address into which the Word will be + * stored. + * @param value The value of the new Address + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void addressWrite(ObjectReference src, Address slot, Address value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.addressWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * Attempt to atomically exchange the value in the given slot + * with the passed replacement value. + * + * @param src The object into which the Address will be stored + * @param slot The address into which the Address will be + * stored. + * @param old The old Address to be swapped out + * @param value The new Address + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + * @return True if the swap was successful. + */ + public boolean addressTryCompareAndSwap(ObjectReference src, Address slot, Address old, Address value, Word metaDataA, Word metaDataB, int mode) { + return VM.barriers.addressTryCompareAndSwap(src, old, value, metaDataA, metaDataB, mode); + } + + /** + * Write a boolean. Take appropriate write barrier actions.

+ * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new boolean + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void booleanWrite(ObjectReference src, Address slot, boolean value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.booleanWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * A number of booleans are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller + */ + public boolean booleanBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + return false; + } + + /** + * Write a byte. Take appropriate write barrier actions.

+ * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new byte + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void byteWrite(ObjectReference src, Address slot, byte value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.byteWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * A number of bytes are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller + */ + public boolean byteBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + return false; + } + + /** + * Write a char. Take appropriate write barrier actions.

+ * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new char + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void charWrite(ObjectReference src, Address slot, char value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.charWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * A number of chars are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller + */ + public boolean charBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + return false; + } + + /** + * Write a double. Take appropriate write barrier actions.

+ * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new double + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void doubleWrite(ObjectReference src, Address slot, double value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.doubleWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * A number of doubles are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller + */ + public boolean doubleBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + return false; + } + + /** + * Write an Extent. Take appropriate write barrier actions.

+ * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new Extent + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void extentWrite(ObjectReference src, Address slot, Extent value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.extentWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * Write a float. Take appropriate write barrier actions.

+ * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new float + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void floatWrite(ObjectReference src, Address slot, float value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.floatWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * A number of floats are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller + */ + public boolean floatBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + return false; + } + + /** + * Write a int. Take appropriate write barrier actions.

+ * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new int + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void intWrite(ObjectReference src, Address slot, int value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.intWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * A number of ints are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller + */ + public boolean intBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + return false; + } + + /** + * Attempt to atomically exchange the value in the given slot + * with the passed replacement value. + * + * @param src The object into which the value will be stored + * @param slot The address into which the value will be + * stored. + * @param old The old int to be swapped out + * @param value The new int + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + * @return True if the swap was successful. + */ + public boolean intTryCompareAndSwap(ObjectReference src, Address slot, int old, int value, Word metaDataA, Word metaDataB, int mode) { + return VM.barriers.intTryCompareAndSwap(src, old, value, metaDataA, metaDataB, mode); + } + + /** + * Write a long. Take appropriate write barrier actions.

+ * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new long + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void longWrite(ObjectReference src, Address slot, long value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.longWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * A number of longs are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller + */ + public boolean longBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + return false; + } + + /** + * Attempt to atomically exchange the value in the given slot + * with the passed replacement value. + * + * @param src The object into which the value will be stored + * @param slot The address into which the value will be + * stored. + * @param old The old long to be swapped out + * @param value The new long + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + * @return True if the swap was successful. + */ + public boolean longTryCompareAndSwap(ObjectReference src, Address slot, long old, long value, Word metaDataA, Word metaDataB, int mode) { + return VM.barriers.longTryCompareAndSwap(src, old, value, metaDataA, metaDataB, mode); + } + + /** + * Write an Offset. Take appropriate write barrier actions.

+ * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new Offset + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void offsetWrite(ObjectReference src, Address slot, Offset value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.offsetWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * Write a short. Take appropriate write barrier actions.

+ * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new short + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void shortWrite(ObjectReference src, Address slot, short value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.shortWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * A number of shorts are about to be copied from object + * src to object dst (as in an array + * copy). Thus, dst is the mutated object. Take + * appropriate write barrier actions.

+ * + * @param src The source array + * @param srcOffset The starting source offset + * @param dst The destination array + * @param dstOffset The starting destination offset + * @param bytes The number of bytes to be copied + * @return True if the update was performed by the barrier, false if + * left to the caller + */ + public boolean shortBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { + return false; + } + + /** + * Write a Word. Take appropriate write barrier actions.

+ * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param value The value of the new Word + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + */ + public void wordWrite(ObjectReference src, Address slot, Word value, Word metaDataA, Word metaDataB, int mode) { + VM.barriers.wordWrite(src, value, metaDataA, metaDataB, mode); + } + + /** + * Attempt to atomically exchange the value in the given slot + * with the passed replacement value. + * + * @param src The object into which the new reference will be stored + * @param slot The address into which the new reference will be + * stored. + * @param old The old Word to be swapped out + * @param value The new Word + * @param metaDataA A value that assists the host VM in creating a store + * @param metaDataB A value that assists the host VM in creating a store + * @param mode The context in which the store occurred + * @return True if the swap was successful. + */ + public boolean wordTryCompareAndSwap(ObjectReference src, Address slot, Word old, Word value, Word metaDataA, Word metaDataB, int mode) { + return VM.barriers.wordTryCompareAndSwap(src, old, value, metaDataA, metaDataB, mode); + } +} Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixConstraints.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixConstraints.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixConstraints.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixConstraints.java Sat Aug 14 07:25:41 2010 @@ -16,10 +16,7 @@ import org.mmtk.plan.immix.ImmixConstraints; -import org.mmtk.policy.MarkSweepSpace; - import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.Word; /** * This class and its subclasses communicate to the host VM/Runtime @@ -35,16 +32,12 @@ /** @return True if this plan requires a write barrier */ @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsObjectReferenceWriteBarrier() { return true; } /** @return True if this Plan requires a header bit for object logging */ @Override public boolean needsLogBitInHeader() { return true; } - /** @return A bit which represents that a header is unlogged */ - @Override - public Word unloggedBit() {return MarkSweepSpace.UNLOGGED_BIT; } - /** @return Size (in bytes) beyond which new regular objects must be allocated to the LOS */ @Override public int maxNonLOSDefaultAllocBytes() { return MAX_IMMIX_OBJECT_BYTES; } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixMutator.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixMutator.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixMutator.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixMutator.java Sat Aug 14 07:25:41 2010 @@ -15,6 +15,7 @@ import org.mmtk.plan.*; import org.mmtk.plan.immix.ImmixMutator; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.deque.ObjectReferenceDeque; import org.mmtk.vm.VM; @@ -79,11 +80,11 @@ * @param mode The mode of the store (eg putfield, putstatic etc) */ @Inline - public final void writeBarrier(ObjectReference src, Address slot, + public final void objectReferenceWrite(ObjectReference src, Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) { - if (Plan.logRequired(src)) + if (HeaderByte.isUnlogged(src)) logSource(src); - VM.barriers.performWriteInBarrier(src, slot, tgt, metaDataA, metaDataB, mode); + VM.barriers.objectReferenceWrite(src, tgt, metaDataA, metaDataB, mode); } /** @@ -108,9 +109,9 @@ * left to the caller (always false in this case). */ @Inline - public final boolean writeBarrier(ObjectReference src, Offset srcOffset, + public final boolean objectReferenceBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { - if (Plan.logRequired(src)) + if (HeaderByte.isUnlogged(src)) logSource(src); return false; } @@ -127,8 +128,8 @@ * @param src The object to be logged */ private void logSource(ObjectReference src) { - Plan.markAsLogged(src); - modBuffer.push(src); + HeaderByte.markAsLogged(src); + modBuffer.push(src); } /** Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixNurseryTraceLocal.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixNurseryTraceLocal.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixNurseryTraceLocal.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyimmix/StickyImmixNurseryTraceLocal.java Sat Aug 14 07:25:41 2010 @@ -15,10 +15,10 @@ import static org.mmtk.policy.immix.ImmixConstants.MARK_LINE_AT_SCAN_TIME; import static org.mmtk.policy.immix.ImmixConstants.TMP_PREFER_COPY_ON_NURSERY_GC; -import org.mmtk.plan.Plan; import org.mmtk.plan.TraceLocal; import org.mmtk.plan.Trace; import org.mmtk.policy.Space; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.deque.ObjectReferenceDeque; import org.mmtk.vm.VM; @@ -136,7 +136,7 @@ logMessage(2, "processing modBuffer"); while (!modBuffer.isEmpty()) { ObjectReference src = modBuffer.pop(); - Plan.markAsUnlogged(src); + HeaderByte.markAsUnlogged(src); processNode(src); } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMS.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMS.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMS.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMS.java Sat Aug 14 07:25:41 2010 @@ -83,7 +83,7 @@ * Static initialization */ { - msSpace.isAgeSegregatedSpace(); /* this space is to be collected generationally */ + msSpace.makeAgeSegregatedSpace(); /* this space is to be collected generationally */ } /***************************************************************************** Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSConstraints.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSConstraints.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSConstraints.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSConstraints.java Sat Aug 14 07:25:41 2010 @@ -14,11 +14,9 @@ import org.mmtk.plan.marksweep.MSConstraints; -import org.mmtk.policy.MarkSweepSpace; import org.mmtk.policy.SegregatedFreeListSpace; import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.Word; /** * This class and its subclasses communicate to the host VM/Runtime @@ -34,15 +32,12 @@ /** @return True if this plan requires a write barrier */ @Override - public boolean needsWriteBarrier() { return true; } + public boolean needsObjectReferenceWriteBarrier() { return true; } /** @return True if this Plan requires a header bit for object logging */ @Override public boolean needsLogBitInHeader() { return true; } - /** @return A bit which represents that a header is unlogged */ - @Override - public Word unloggedBit() {return MarkSweepSpace.UNLOGGED_BIT; } @Override public int maxNonLOSDefaultAllocBytes() { return SegregatedFreeListSpace.MAX_FREELIST_OBJECT_BYTES; } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSMutator.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSMutator.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSMutator.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSMutator.java Sat Aug 14 07:25:41 2010 @@ -16,6 +16,7 @@ import org.mmtk.plan.marksweep.MSMutator; import org.mmtk.policy.MarkSweepLocal; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.deque.ObjectReferenceDeque; import org.mmtk.vm.VM; @@ -80,11 +81,11 @@ * @param mode The mode of the store (eg putfield, putstatic etc) */ @Inline - public final void writeBarrier(ObjectReference src, Address slot, + public final void objectReferenceWrite(ObjectReference src, Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) { - if (Plan.logRequired(src)) + if (HeaderByte.isUnlogged(src)) logSource(src); - VM.barriers.performWriteInBarrier(src, slot, tgt, metaDataA, metaDataB, mode); + VM.barriers.objectReferenceWrite(src, tgt, metaDataA, metaDataB, mode); } /** @@ -109,9 +110,9 @@ * left to the caller (always false in this case). */ @Inline - public final boolean writeBarrier(ObjectReference src, Offset srcOffset, + public final boolean objectReferenceBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { - if (Plan.logRequired(src)) + if (HeaderByte.isUnlogged(src)) logSource(src); return false; } @@ -128,8 +129,8 @@ * @param src The object to be logged */ private void logSource(ObjectReference src) { - Plan.markAsLogged(src); - modBuffer.push(src); + HeaderByte.markAsLogged(src); + modBuffer.push(src); } /** Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSNurseryTraceLocal.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSNurseryTraceLocal.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSNurseryTraceLocal.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/stickyms/StickyMSNurseryTraceLocal.java Sat Aug 14 07:25:41 2010 @@ -12,10 +12,10 @@ */ package org.mmtk.plan.stickyms; -import org.mmtk.plan.Plan; import org.mmtk.plan.TraceLocal; import org.mmtk.plan.Trace; import org.mmtk.policy.Space; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.deque.ObjectReferenceDeque; import org.mmtk.vm.VM; @@ -94,7 +94,7 @@ logMessage(2, "processing modBuffer"); while (!modBuffer.isEmpty()) { ObjectReference src = modBuffer.pop(); - Plan.markAsUnlogged(src); + HeaderByte.markAsUnlogged(src); processNode(src); } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/policy/CopySpace.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/policy/CopySpace.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/policy/CopySpace.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/policy/CopySpace.java Sat Aug 14 07:25:41 2010 @@ -12,11 +12,11 @@ */ package org.mmtk.policy; -import org.mmtk.plan.TraceLocal; import org.mmtk.plan.TransitiveClosure; import org.mmtk.utility.heap.*; import org.mmtk.utility.options.Options; import org.mmtk.utility.Constants; +import org.mmtk.utility.ForwardingWord; import org.mmtk.utility.Log; import org.mmtk.vm.VM; @@ -42,21 +42,6 @@ private static final int META_DATA_PAGES_PER_REGION = CARD_META_PAGES_PER_REGION; - /* - * The forwarding process uses three states to deal with a GC race: - * 1. !GC_FORWARDED: Unforwarded - * 2. GC_BEING_FORWARDED: Being forwarded (forwarding is underway) - * 3. GC_FORWARDED: Forwarded - */ - /** If this bit is set, then forwarding of this object has commenced */ - private static final Word GC_FORWARDED = Word.one().lsh(1); // ...10 - /** If this bit is set, then forwarding of this object is incomplete */ - private static final Word GC_BEING_FORWARDED = Word.one().lsh(2).minus(Word.one()); // ...11 - /** This mask is used to reveal which state this object is in with respect to forwarding */ - private static final Word GC_FORWARDING_MASK = GC_FORWARDED.or(GC_BEING_FORWARDED); - - /** A single bit is used to indicate a mark when tracing (but not copying) the space */ - private static final Word GC_MARK_BIT_MASK = Word.one(); /**************************************************************************** * @@ -68,6 +53,12 @@ return fromSpace; } + /** fromSpace CopySpace can always move, toSpace will not move during current GC */ + @Override + public boolean isMovable() { + return fromSpace; + } + /**************************************************************************** * * Initialization @@ -115,7 +106,7 @@ */ public void release() { ((MonotonePageResource) pr).reset(); - lastDiscontiguousRegion = Address.zero(); + headDiscontiguousRegion = Address.zero(); fromSpace = false; } @@ -177,21 +168,21 @@ if (!fromSpace) return object; /* Try to forward the object */ - Word forwardingPtr = attemptToForward(object); + Word forwardingWord = ForwardingWord.attemptToForward(object); - if (stateIsForwardedOrBeingForwarded(forwardingPtr)) { + if (ForwardingWord.stateIsForwardedOrBeingForwarded(forwardingWord)) { /* Somebody else got to it first. */ /* We must wait (spin) if the object is not yet fully forwarded */ - while (stateIsBeingForwarded(forwardingPtr)) - forwardingPtr = getForwardingWord(object); + while (ForwardingWord.stateIsBeingForwarded(forwardingWord)) + forwardingWord = VM.objectModel.readAvailableBitsWord(object); /* Now extract the object reference from the forwarding word and return it */ - return forwardingPtr.and(GC_FORWARDING_MASK.not()).toAddress().toObjectReference(); + return ForwardingWord.extractForwardingPointer(forwardingWord); } else { /* We are the designated copier, so forward it and enqueue it */ ObjectReference newObject = VM.objectModel.copy(object, allocator); - setForwardingPointer(object, newObject); + ForwardingWord.setForwardingPointer(object, newObject); trace.processNode(newObject); // Scan it later if (VM.VERIFY_ASSERTIONS && Options.verbose.getValue() >= 9) { @@ -212,7 +203,7 @@ * @return True if this object is live in this GC (has it been forwarded?) */ public boolean isLive(ObjectReference object) { - return isForwarded(object); + return ForwardingWord.isForwarded(object); } /** @@ -223,26 +214,7 @@ * @return True if the object is reachable. */ public boolean isReachable(ObjectReference object) { - return !fromSpace || isForwarded(object); - } - - /**************************************************************************** - * - * Non-copying tracing (just mark, don't forward) - */ - - /** - * Mark an object as having been traversed, *WITHOUT* forwarding the object. - * This is only used when - * - * @param object The object to be marked - * @param markState The sense of the mark bit (flips from 0 to 1) - */ - @Inline - public static void markObject(TraceLocal trace, ObjectReference object, - Word markState) { - if (testAndMark(object, markState)) - trace.processNode(object); + return !fromSpace || ForwardingWord.isForwarded(object); } /**************************************************************************** @@ -260,148 +232,4 @@ @Inline public void postAlloc(ObjectReference object) {} - /** - * Clear the GC portion of the header for an object. - * - * @param object the object ref to the storage to be initialized - */ - @Inline - public static void clearGCBits(ObjectReference object) { - Word header = VM.objectModel.readAvailableBitsWord(object); - VM.objectModel.writeAvailableBitsWord(object, header.and(GC_FORWARDING_MASK.not())); - } - - /** - * Has an object been forwarded? - * - * @param object The object to be checked - * @return True if the object has been forwarded - */ - @Inline - public static boolean isForwarded(ObjectReference object) { - return stateIsForwarded(getForwardingWord(object)); - } - - /** - * Has an object been forwarded or being forwarded? - * - * @param object The object to be checked - * @return True if the object has been forwarded or is being forwarded - */ - @Inline - public static boolean isForwardedOrBeingForwarded(ObjectReference object) { - return stateIsForwardedOrBeingForwarded(getForwardingWord(object)); - } - - /** - * Non-atomic read of forwarding pointer word - * - * @param object The object whose forwarding word is to be read - * @return The forwarding word stored in object's - * header. - */ - @Inline - private static Word getForwardingWord(ObjectReference object) { - return VM.objectModel.readAvailableBitsWord(object); - } - - /** - * Non-atomic read of forwarding pointer - * - * @param object The object whose forwarding pointer is to be read - * @return The forwarding pointer stored in object's - * header. - */ - @Inline - public static ObjectReference getForwardingPointer(ObjectReference object) { - return getForwardingWord(object).and(GC_FORWARDING_MASK.not()).toAddress().toObjectReference(); - } - - /** - * Used to mark boot image objects during a parallel scan of objects - * during GC Returns true if marking was done. - * - * @param object The object to be marked - * @param value The value to store in the mark bit - */ - @Inline - private static boolean testAndMark(ObjectReference object, Word value) { - Word oldValue; - do { - oldValue = VM.objectModel.prepareAvailableBits(object); - Word markBit = oldValue.and(GC_MARK_BIT_MASK); - if (markBit.EQ(value)) return false; - } while (!VM.objectModel.attemptAvailableBits(object, oldValue, - oldValue.xor(GC_MARK_BIT_MASK))); - return true; - } - - /** - * Either return the forwarding pointer if the object is already - * forwarded (or being forwarded) or write the bit pattern that - * indicates that the object is being forwarded - * - * @param object The object to be forwarded - * @return The forwarding pointer for the object if it has already - * been forwarded. - */ - @Inline - private static Word attemptToForward(ObjectReference object) { - Word oldValue; - do { - oldValue = VM.objectModel.prepareAvailableBits(object); - if (oldValue.and(GC_FORWARDING_MASK).EQ(GC_FORWARDED)) return oldValue; - } while (!VM.objectModel.attemptAvailableBits(object, oldValue, - oldValue.or(GC_BEING_FORWARDED))); - return oldValue; - } - - /** - * Is the state of the forwarding word being forwarded? - * - * @param fword A forwarding word. - * @return True if the forwarding word's state is being forwarded. - */ - @Inline - private static boolean stateIsBeingForwarded(Word fword) { - return fword.and(GC_FORWARDING_MASK).EQ(GC_BEING_FORWARDED); - } - - /** - * Is the state of the forwarding word forwarded? - * - * @param fword A forwarding word. - * @return True if the forwarding word's state is forwarded. - */ - @Inline - private static boolean stateIsForwarded(Word fword) { - return fword.and(GC_FORWARDING_MASK).EQ(GC_FORWARDED); - } - - /** - * Is the state of the forwarding word forwarded or being forwarded? - * - * @param fword A forwarding word. - * @return True if the forwarding word's state is forwarded or being - * forwarded. - */ - @Inline - public static boolean stateIsForwardedOrBeingForwarded(Word fword) { - return !(fword.and(GC_FORWARDED).isZero()); - } - - /** - * Non-atomic write of forwarding pointer word (assumption, thread - * doing the set has done attempt to forward and owns the right to - * copy the object) - * - * @param object The object whose forwarding pointer is to be set - * @param ptr The forwarding pointer to be stored in the object's - * forwarding word - */ - @Inline - private static void setForwardingPointer(ObjectReference object, - ObjectReference ptr) { - VM.objectModel.writeAvailableBitsWord(object, ptr.toAddress().toWord().or(GC_FORWARDED)); - } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/policy/ImmortalSpace.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/policy/ImmortalSpace.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/policy/ImmortalSpace.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/policy/ImmortalSpace.java Sat Aug 14 07:25:41 2010 @@ -17,6 +17,7 @@ import org.mmtk.utility.heap.MonotonePageResource; import org.mmtk.utility.heap.VMRequest; import org.mmtk.utility.Constants; +import org.mmtk.utility.HeaderByte; import org.mmtk.vm.VM; @@ -37,14 +38,14 @@ * * Class variables */ - static final Word GC_MARK_BIT_MASK = Word.one(); + static final byte GC_MARK_BIT_MASK = 1; private static final int META_DATA_PAGES_PER_REGION = CARD_META_PAGES_PER_REGION; /**************************************************************************** * * Instance variables */ - private Word markState = Word.zero(); // when GC off, the initialization value + private byte markState = 0; // when GC off, the initialization value /**************************************************************************** * @@ -71,7 +72,7 @@ /** @return the current mark state */ @Inline - public Word getMarkState() { return markState; } + public Word getMarkState() { return Word.fromIntZeroExtend(markState); } /**************************************************************************** * @@ -85,10 +86,10 @@ * @param object The newly allocated object instance whose header we are initializing */ public void initializeHeader(ObjectReference object) { - Word oldValue = VM.objectModel.readAvailableBitsWord(object); - Word newValue = oldValue.and(GC_MARK_BIT_MASK.not()).or(markState); - if (Plan.NEEDS_LOG_BIT_IN_HEADER) newValue = newValue.or(Plan.UNLOGGED_BIT); - VM.objectModel.writeAvailableBitsWord(object, newValue); + byte oldValue = VM.objectModel.readAvailableByte(object); + byte newValue = (byte) ((oldValue & GC_MARK_BIT_MASK) | markState); + if (HeaderByte.NEEDS_UNLOGGED_BIT) newValue |= HeaderByte.UNLOGGED_BIT; + VM.objectModel.writeAvailableByte(object, newValue); } /** @@ -96,14 +97,14 @@ * Returns true if marking was done. */ @Inline - private static boolean testAndMark(ObjectReference object, Word value) { + private static boolean testAndMark(ObjectReference object, byte value) { Word oldValue; do { oldValue = VM.objectModel.prepareAvailableBits(object); - Word markBit = oldValue.and(GC_MARK_BIT_MASK); - if (markBit.EQ(value)) return false; + byte markBit = (byte) (oldValue.toInt() & GC_MARK_BIT_MASK); + if (markBit == value) return false; } while (!VM.objectModel.attemptAvailableBits(object, oldValue, - oldValue.xor(GC_MARK_BIT_MASK))); + oldValue.xor(Word.fromIntZeroExtend(GC_MARK_BIT_MASK)))); return true; } @@ -129,7 +130,7 @@ * collections. */ public void prepare() { - markState = GC_MARK_BIT_MASK.minus(markState); + markState = (byte) (GC_MARK_BIT_MASK - markState); } public void release() {} @@ -166,6 +167,6 @@ if (Plan.SCAN_BOOT_IMAGE && this == Plan.vmSpace) return true; // ignore boot image "reachabilty" if we're not tracing it else - return (VM.objectModel.readAvailableBitsWord(object).and(GC_MARK_BIT_MASK).EQ(markState)); + return (VM.objectModel.readAvailableByte(object) & GC_MARK_BIT_MASK) == markState; } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/policy/LargeObjectSpace.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/policy/LargeObjectSpace.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/policy/LargeObjectSpace.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/policy/LargeObjectSpace.java Sat Aug 14 07:25:41 2010 @@ -12,10 +12,10 @@ */ package org.mmtk.policy; -import org.mmtk.plan.Plan; import org.mmtk.plan.TransitiveClosure; import org.mmtk.utility.heap.FreeListPageResource; import org.mmtk.utility.heap.VMRequest; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.Treadmill; import org.mmtk.vm.VM; @@ -36,15 +36,15 @@ */ public static final int LOCAL_GC_BITS_REQUIRED = 2; public static final int GLOBAL_GC_BITS_REQUIRED = 0; - private static final Word MARK_BIT = Word.one(); // ...01 - private static final Word NURSERY_BIT = Word.fromIntZeroExtend(2); // ...10 - private static final Word LOS_BIT_MASK = Word.fromIntZeroExtend(3); // ...11 + private static final byte MARK_BIT = 1; // ...01 + private static final byte NURSERY_BIT = 2; // ...10 + private static final byte LOS_BIT_MASK = 3; // ...11 /**************************************************************************** * * Instance variables */ - private Word markState; + private byte markState; private boolean inNurseryGC; private final Treadmill treadmill; @@ -66,7 +66,7 @@ public LargeObjectSpace(String name, int pageBudget, VMRequest vmRequest) { super(name, pageBudget, vmRequest); treadmill = new Treadmill(LOG_BYTES_IN_PAGE, true); - markState = Word.zero(); + markState = 0; } /**************************************************************************** @@ -84,7 +84,7 @@ if (VM.VERIFY_ASSERTIONS) { VM.assertions._assert(treadmill.fromSpaceEmpty()); } - markState = MARK_BIT.minus(markState); + markState = (byte) (MARK_BIT - markState); } treadmill.flip(fullHeap); inNurseryGC = !fullHeap; @@ -194,11 +194,11 @@ */ @Inline public void initializeHeader(ObjectReference object, boolean alloc) { - Word oldValue = VM.objectModel.readAvailableBitsWord(object); - Word newValue = oldValue.and(LOS_BIT_MASK.not()).or(markState); - if (alloc) newValue = newValue.or(NURSERY_BIT); - if (Plan.NEEDS_LOG_BIT_IN_HEADER) newValue = newValue.or(Plan.UNLOGGED_BIT); - VM.objectModel.writeAvailableBitsWord(object, newValue); + byte oldValue = VM.objectModel.readAvailableByte(object); + byte newValue = (byte) ((oldValue & ~LOS_BIT_MASK) | markState); + if (alloc) newValue |= NURSERY_BIT; + if (HeaderByte.NEEDS_UNLOGGED_BIT) newValue |= HeaderByte.UNLOGGED_BIT; + VM.objectModel.writeAvailableByte(object, newValue); Address cell = VM.objectModel.objectStartRef(object); treadmill.addToTreadmill(Treadmill.midPayloadToNode(cell), alloc); } @@ -211,14 +211,14 @@ * @param value The value to which the mark bit will be set */ @Inline - private boolean testAndMark(ObjectReference object, Word value) { - Word oldValue, markBit; + private boolean testAndMark(ObjectReference object, byte value) { + Word oldValue; do { oldValue = VM.objectModel.prepareAvailableBits(object); - markBit = oldValue.and(inNurseryGC ? LOS_BIT_MASK : MARK_BIT); - if (markBit.EQ(value)) return false; + byte markBit = (byte) (oldValue.toInt() & (inNurseryGC ? LOS_BIT_MASK : MARK_BIT)); + if (markBit == value) return false; } while (!VM.objectModel.attemptAvailableBits(object, oldValue, - oldValue.and(LOS_BIT_MASK.not()).or(value))); + oldValue.and(Word.fromIntZeroExtend(LOS_BIT_MASK).not()).or(Word.fromIntZeroExtend(value)))); return true; } @@ -230,8 +230,8 @@ * @return True if the mark bit for the object has the given value. */ @Inline - private boolean testMarkBit(ObjectReference object, Word value) { - return VM.objectModel.readAvailableBitsWord(object).and(MARK_BIT).EQ(value); + private boolean testMarkBit(ObjectReference object, byte value) { + return (byte) (VM.objectModel.readAvailableByte(object) & MARK_BIT) == value; } /** @@ -242,7 +242,7 @@ */ @Inline private boolean isInNursery(ObjectReference object) { - return VM.objectModel.readAvailableBitsWord(object).and(NURSERY_BIT).EQ(NURSERY_BIT); + return (byte)(VM.objectModel.readAvailableByte(object) & NURSERY_BIT) == NURSERY_BIT; } /** Added: vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactCollector.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactCollector.java?rev=111072&view=auto ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactCollector.java (added) +++ vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactCollector.java Sat Aug 14 07:25:41 2010 @@ -0,0 +1,544 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.policy; + +import org.mmtk.plan.markcompact.MC; +import org.mmtk.utility.Log; +import org.mmtk.utility.alloc.Allocator; +import org.mmtk.utility.alloc.BumpPointer; +import org.mmtk.vm.VM; +import org.vmmagic.pragma.Inline; +import org.vmmagic.pragma.Uninterruptible; +import org.vmmagic.unboxed.Address; +import org.vmmagic.unboxed.Extent; +import org.vmmagic.unboxed.ObjectReference; + +/** + * This class implements unsynchronized (local) per-collector-thread elements of a + * sliding mark-compact collector. + * + * Specifically, this class provides the methods that + * - Calculate the forwarding pointers for heap objects, in a linear pass over + * (part of) the heap + * - Performs the compaction pass over the heap. + * + * Each collector thread maintains a private list of the pages that it compacts. + * If it runs out of work during the calculateForwardingPointers pass, it requests + * a new region from the global MarkCompactSpace. Regions compacted by a collector + * remain local to the collector. + * + * @see MarkCompactSpace + * @see MarkCompactLocal + */ + at Uninterruptible +public final class MarkCompactCollector { + + static final boolean VERBOSE = false; + + static final boolean VERY_VERBOSE = VERBOSE && false; + + private final MarkCompactSpace space; + + /** + * This collector's work list + */ + private Address regions = Address.zero(); + + private final FromCursor fromCursor = new FromCursor(); + private final ToCursor toCursor = new ToCursor(); + + /** + * Constructor + * + * @param space The space to bump point into. + */ + public MarkCompactCollector(MarkCompactSpace space) { + this.space = space; + } + + /* ******************************************************************************** + * + * Cursor classes + * + */ + + /** + * Both the 'compact' and 'calculate' phases can be thought of as sweeping + * a pair of cursors across a linked list of regions. Each cursor requires + * maintaining pointers to the current region, the current address and the end of + * the region. The regionCursor class maintains these 3 pointers, while the + * subclasses ToCursor and FromCursor provide methods specific to the + * read and write pointers. + */ + @Uninterruptible + private abstract static class RegionCursor { + + /** Name of the cursor - for debugging messages */ + private final String name; + + /** + * The current region, or zero if the cursor is invalid (eg after advancing + * past the end of the current work list + */ + protected Address region; + + /** + * The limit of the current region. When reading a populated region, this is the + * address of the last used byte. When writing to a fresh region, this is the last + * byte in the region. + */ + protected Address limit; + + /** The current address */ + protected Address cursor; + + /** + * @param name The name of the region - for debugging messages. + */ + public RegionCursor(String name) { + this.name = name; + } + + /** + * Hook to allow subclasses to initialize the cursor in different ways. + * + * @param region The region to be processed. + */ + abstract void init(Address region); + + /** + * Assert that the cursor is within the bounds of the region. Calls to this + * must be guarded by {@code if (VM.VERIFY_ASSERTIONS)} + */ + protected void assertCursorInBounds() { + VM.assertions._assert(!region.isZero()); + VM.assertions._assert(cursor.GE(BumpPointer.getDataStart(region)), + "Cursor is below start of region"); + VM.assertions._assert(cursor.LE(limit),"Cursor beyond end of region"); + } + + /** + * Increment the cursor. + * @param size Bytes to increment by + */ + void inc(int size) { + this.cursor = cursor.plus(size); + if (VM.VERIFY_ASSERTIONS) assertCursorInBounds(); + } + + /** + * Increment the cursor to a specific address + * @param cursor Destination address + */ + public void incTo(Address cursor) { + if (VM.VERIFY_ASSERTIONS) assertCursorInBounds(); + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(cursor.GE(this.cursor)); + this.cursor = cursor; + } + + /** + * @param other Other region + * @return {@code true} if this cursor points to the same region as {@code other} + */ + boolean sameRegion(RegionCursor other) { + return region.EQ(other.getRegion()); + } + + /** + * @param size Size in bytes + * @return {@code true} if {@code size} bytes are available in the current region + */ + boolean isAvailable(int size) { + return cursor.plus(size).LE(limit); + } + + /** + * @return The current cursor + */ + public Address get() { + return cursor; + } + + /** + * @return The current region pointer + */ + public Address getRegion() { + return region; + } + + /** + * @return The current region limit + */ + public Address getLimit() { + return limit; + } + + /** + * Follow the linked-list of regions to the next region. + */ + void advanceToNextRegion() { + Address nextRegion = MarkCompactLocal.getNextRegion(region); + if (nextRegion.isZero()) { + region = Address.zero(); + } else { + init(nextRegion); + if (VM.VERIFY_ASSERTIONS) assertCursorInBounds(); + } + } + + /** + * @return {@code true} if we haven't advanced beyond the end of the region list + */ + boolean isValid() { + return !region.isZero(); + } + + /** + * @param ref The object in question + * @return {@code true} if the object's start address is in this region + */ + @Inline + boolean isInRegion(ObjectReference ref) { + Address addr = VM.objectModel.refToAddress(ref); + return addr.GE(BumpPointer.getDataStart(region)) && addr.LE(limit); + } + + /** + * Print the cursor - for debugging + */ + void print() { + Log.write(name); Log.write(" cursor:"); + Log.write(" region="); Log.write(region); + Log.write(" limit="); Log.write(limit); + Log.write(" cursor="); Log.write(cursor); + Log.writeln(); + + } + } + + /** + * Subclass for the read-only cursor that leads the scan of regions. + */ + @Uninterruptible + private static final class FromCursor extends RegionCursor { + public FromCursor() { + super("from"); + } + + /** + * Initialize the cursor - the limit is the end of the allocated data + */ + @Override + void init(Address region) { + if (VM.VERIFY_ASSERTIONS) BumpPointer.checkRegionMetadata(region); + this.region = region; + this.cursor = MarkCompactLocal.getDataStart(region); + this.limit = MarkCompactLocal.getDataEnd(region); + } + + /** + * Advance from the cursor to the start of the next object. + * @return The object reference of the next object. + */ + @Inline + ObjectReference advanceToObject() { + ObjectReference current = VM.objectModel.getObjectFromStartAddress(cursor); + cursor = VM.objectModel.objectStartRef(current); + if (VM.VERIFY_ASSERTIONS) { + Address lowBound = BumpPointer.getDataStart(region); + VM.assertions._assert(cursor.GE(lowBound) && cursor.LE(limit),"Cursor outside region"); + } + return current; + } + + /** + * Advance the cursor to the end of the given object. + * @return The object reference of the next object. + */ + @Inline + void advanceToObjectEnd(ObjectReference current) { + cursor = VM.objectModel.getObjectEndAddress(current); + if (VM.VERIFY_ASSERTIONS) assertCursorInBounds(); + } + + /** + * Advance the cursor either to the next region in the list, + * or to a new region allocated from the global list. + * @param m + */ + void advanceToNextForwardableRegion(MarkCompactSpace space) { + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(get().EQ(getLimit())); + Address nextRegion = BumpPointer.getNextRegion(region); + if (nextRegion.isZero()) { + nextRegion = space.getNextRegion(); + if (nextRegion.isZero()) { + region = Address.zero(); + return; + } + MarkCompactLocal.setNextRegion(region,nextRegion); + MarkCompactLocal.clearNextRegion(nextRegion); + } + init(nextRegion); + if (VM.VERIFY_ASSERTIONS) assertCursorInBounds(); + } + + /** + * Override the superclass with an additional assertion - we only advance + * when we have read to the end, and the cursor must point *precisely* + * to the last allocated byte in the region. + */ + @Override + void advanceToNextRegion() { + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(get().EQ(getLimit())); + super.advanceToNextRegion(); + } + + /** + * @return {@code true} if there are more objects in this region + */ + boolean hasMoreObjects() { + return cursor.LT(limit); + } + } + + /** + * Subclass for the read-only cursor that follows the 'from' cursor, + * writing or calculating the position of copied objects + */ + @Uninterruptible + private static final class ToCursor extends RegionCursor { + public ToCursor() { + super("to"); + } + + /** + * Initialize the cursor to a given region. The limit is the limit of + * available space in the region. + */ + @Override + void init(Address region) { + if (VM.VERIFY_ASSERTIONS) BumpPointer.checkRegionMetadata(region); + this.region = region; + this.cursor = MarkCompactLocal.getDataStart(region); + this.limit = MarkCompactLocal.getRegionLimit(region); + if (VM.VERIFY_ASSERTIONS) assertCursorInBounds(); + } + + /** + * Update the metadata of the current region with the current value + * of the cursor. Zero the region from here to the end. + */ + void finish() { + if (VM.VERIFY_ASSERTIONS) assertCursorInBounds(); + Extent zeroBytes = limit.diff(cursor).toWord().toExtent(); + VM.memory.zero(cursor, zeroBytes); + MarkCompactLocal.setDataEnd(region, cursor); + MarkCompactLocal.checkRegionMetadata(region); + } + + /** + * Terminate the list of regions here. + * @return The address of the (old) next region in the list. + */ + Address snip() { + Address nextRegion = BumpPointer.getNextRegion(region); + BumpPointer.clearNextRegion(region); + finish(); + return nextRegion; + } + + /** + * Copy an object to an address within this cursor's region. + * @param from The source object + * @param to The target object + */ + @Inline + void copy(ObjectReference from, ObjectReference to) { + if (VM.VERIFY_ASSERTIONS) { + VM.assertions._assert(MarkCompactSpace.getForwardingPointer(from).toAddress().EQ(to.toAddress())); + VM.assertions._assert(cursor.GT(region) && cursor.LE(limit)); + } + Address savedCursor = Address.zero(); + if (VM.VERIFY_ASSERTIONS) savedCursor = cursor; + cursor = VM.objectModel.copyTo(from, to, cursor); + if (VM.VERIFY_ASSERTIONS) { + if (cursor.LT(BumpPointer.getDataStart(region)) || cursor.GT(limit)) { + Log.write("Copy of "); Log.write(from); + Log.write(" to "); Log.write(to); + Log.write(" puts cursor at "); Log.write(cursor); + Log.write(" (was: "); Log.write(savedCursor); + Log.writeln(")"); + } + VM.assertions._assert(cursor.GT(region) && cursor.LE(limit)); + } + MarkCompactSpace.setForwardingPointer(to, ObjectReference.nullReference()); + if (VM.VERIFY_ASSERTIONS) + VM.assertions._assert(VM.objectModel.getObjectEndAddress(to).LE(limit)); + } + + /** + * Move to the next region, updating the metadata with the current 'write' state. + */ + void finishAndAdvanceToNextRegion() { + finish(); + advanceToNextRegion(); + } + + /** + * Move to the next region, in read-only mode. Add the assertion of validity, + * since we shouldn't be able to fall off the end of the list while writing. + */ + @Override + void advanceToNextRegion() { + super.advanceToNextRegion(); + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(isValid()); + } + } + + /* ***************************************************************************************** */ + + /** + * Perform a linear scan through the objects allocated by this bump pointer, + * calculating where each live object will be post collection. + * + * We maintain two cursors, {@code fromCursor} and {@code toCursor}, and simulate + * copying live objects from the former to the latter. Initially, the cursors + * point to the first region in this collector's local list, and increment in + * lockstep until the first dead object is encountered. After that, the to cursor + * trails the from cursor. + * + * The outer loop advances the 'from' pointer + */ + public void calculateForwardingPointers() { + if (regions.isZero()) { + regions = space.getNextRegion(); + } + + if (regions.isZero()) + return; + + fromCursor.init(regions); + toCursor.init(regions); + + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(true); + + /* Loop through active regions or until the last region */ + while (fromCursor.isValid()) { + if (VERBOSE) { + fromCursor.print(); + toCursor.print(); + } + + /* Loop through the objects in the current 'from' region */ + while (fromCursor.hasMoreObjects()) { + ObjectReference current = fromCursor.advanceToObject(); + fromCursor.advanceToObjectEnd(current); + + if (MarkCompactSpace.toBeCompacted(current)) { + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(MarkCompactSpace.getForwardingPointer(current).isNull()); + + // Fake - allocate it. + int size = VM.objectModel.getSizeWhenCopied(current); + int align = VM.objectModel.getAlignWhenCopied(current); + int offset = VM.objectModel.getAlignOffsetWhenCopied(current); + // Move to the (aligned) start of the next object + toCursor.incTo(Allocator.alignAllocationNoFill(toCursor.get(), align, offset)); + + /* + * If we're allocating into separate regions, and we've allocated beyond the end of the + * current region, advance to the next one. We always allocate into regions we have + * scanned in this collector. + */ + if (!toCursor.sameRegion(fromCursor) && !toCursor.isAvailable(size)) { + // The 'to' pointer always trails the 'from' pointer, guaranteeing that + // there's a next region to advance to. + toCursor.advanceToNextRegion(); + toCursor.incTo(Allocator.alignAllocationNoFill(toCursor.get(), align, offset)); + } + + ObjectReference target = VM.objectModel.getReferenceWhenCopiedTo(current, toCursor.get()); + if (toCursor.sameRegion(fromCursor) && target.toAddress().GE(current.toAddress())) { + // Don't move the object. + MarkCompactSpace.setForwardingPointer(current, current); + toCursor.incTo(VM.objectModel.getObjectEndAddress(current)); + } else { + MarkCompactSpace.setForwardingPointer(current, target); + toCursor.inc(size); + } + } + } + fromCursor.advanceToNextForwardableRegion(space); + } + } + + + /** + * Perform the compacting phase of the collection. + */ + public void compact() { + if (regions.isZero()) return; + + toCursor.init(regions); + fromCursor.init(regions); + + /* Loop through active regions or until the last region */ + while (fromCursor.isValid()) { + if (VERBOSE) { + Log.write("Compacting from region "); Log.write(fromCursor.getRegion()); + Log.write(" to region "); Log.writeln(toCursor.getRegion()); + } + + /* Loop through the objects in the region */ + while (fromCursor.hasMoreObjects()) { + ObjectReference current = fromCursor.advanceToObject(); + fromCursor.advanceToObjectEnd(current); + + ObjectReference copyTo = MarkCompactSpace.getForwardingPointer(current); + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!copyTo.toAddress().EQ(Address.fromIntZeroExtend(VM.ALIGNMENT_VALUE))); + + if (!copyTo.isNull() && Space.isInSpace(MC.MARK_COMPACT, copyTo)) { + if (VM.VERIFY_ASSERTIONS) { + if (MarkCompactSpace.isMarked(current)) { + Log.write("Object "); Log.write(current); + Log.writeln(" is marked during the compact phase"); + } + VM.assertions._assert(!MarkCompactSpace.isMarked(current)); + } + if (!toCursor.isInRegion(copyTo)) { + // Update metadata and move on + toCursor.finishAndAdvanceToNextRegion(); + } + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(toCursor.isInRegion(copyTo)); + toCursor.copy(current, copyTo); + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(toCursor.isInRegion(copyTo)); + MarkCompactSpace.setForwardingPointer(copyTo, ObjectReference.nullReference()); + } + } + fromCursor.advanceToNextRegion(); + } + + /* Fix up the last object pointer etc */ + toCursor.finish(); + + + /* + * Return unused pages to the global page resource + */ + Address region = toCursor.snip(); + while (!region.isZero()) { + Address nextRegion = MarkCompactLocal.getNextRegion(region); + space.release(region); + region = nextRegion; + } + } +} Modified: vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactLocal.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactLocal.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactLocal.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactLocal.java Sat Aug 14 07:25:41 2010 @@ -12,16 +12,9 @@ */ package org.mmtk.policy; -import org.mmtk.plan.markcompact.MC; -import org.mmtk.utility.Conversions; -import org.mmtk.utility.alloc.Allocator; import org.mmtk.utility.alloc.BumpPointer; -import org.mmtk.vm.VM; - -import org.vmmagic.pragma.*; -import org.vmmagic.unboxed.Address; +import org.vmmagic.pragma.Uninterruptible; import org.vmmagic.unboxed.Extent; -import org.vmmagic.unboxed.ObjectReference; /** * This class implements unsynchronized (local) elements of a @@ -31,7 +24,8 @@ * @see BumpPointer * @see MarkCompactSpace */ - at Uninterruptible public final class MarkCompactLocal extends BumpPointer { + at Uninterruptible +public final class MarkCompactLocal extends BumpPointer { /** * Constructor @@ -42,163 +36,28 @@ super(space, true); } - /** - * Perform the compacting phase of the collection. - */ - public void compact() { - /* Has this allocator ever allocated anything? */ - if (initialRegion.isZero()) return; - - /* Loop through active regions or until the last region */ - Address start = initialRegion; - Address allocStart = initialRegion; - Address allocEnd = initialRegion.plus(REGION_LIMIT_OFFSET).loadAddress(); - Address allocCursor = allocStart.plus(DATA_START_OFFSET); - - /* Keep track of which regions are being used */ - int oldPages = 0; - int newPages = Conversions.bytesToPages(allocEnd.diff(allocStart).plus(BYTES_IN_ADDRESS)); - - while (!start.isZero()) { - /* Get the end of this region */ - Address end = start.plus(REGION_LIMIT_OFFSET).loadAddress(); - Address dataEnd = start.plus(DATA_END_OFFSET).loadAddress(); - Address nextRegion = start.plus(NEXT_REGION_OFFSET).loadAddress(); - oldPages += Conversions.bytesToPages(end.diff(start).plus(BYTES_IN_ADDRESS)); - - /* dataEnd = zero represents the current region. */ - Address currentLimit = (dataEnd.isZero() ? cursor : dataEnd); - ObjectReference current = - VM.objectModel.getObjectFromStartAddress(start.plus(DATA_START_OFFSET)); - - while (VM.objectModel.refToAddress(current).LT(currentLimit) && !current.isNull()) { - ObjectReference next = VM.objectModel.getNextObject(current); - - ObjectReference copyTo = MarkCompactSpace.getForwardingPointer(current); - - if (!copyTo.isNull() && Space.isInSpace(MC.MARK_COMPACT, copyTo)) { - if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!MarkCompactSpace.isMarked(current)); - // To be copied. - if (copyTo.toAddress().GT(allocEnd) || copyTo.toAddress().LT(allocStart)) { - // changed regions. - - VM.memory.zero(allocCursor, allocEnd.diff(allocCursor).toWord().toExtent().plus(BYTES_IN_ADDRESS)); - - allocStart.store(allocCursor, DATA_END_OFFSET); - allocStart = allocStart.plus(NEXT_REGION_OFFSET).loadAddress(); - allocEnd = allocStart.plus(REGION_LIMIT_OFFSET).loadAddress(); - allocCursor = allocStart.plus(DATA_START_OFFSET); - - newPages += Conversions.bytesToPages(allocEnd.diff(allocStart).plus(BYTES_IN_ADDRESS)); - - if (VM.VERIFY_ASSERTIONS) { - VM.assertions._assert(allocCursor.LT(allocEnd) && allocCursor.GE(allocStart)); - } - } - allocCursor = VM.objectModel.copyTo(current, copyTo, allocCursor); - MarkCompactSpace.setForwardingPointer(copyTo, ObjectReference.nullReference()); - } - current = next; - } - if (dataEnd.isZero()) { - break; - } - start = nextRegion; - } - Extent zeroBytes = allocEnd.diff(allocCursor).toWord().toExtent().plus(BYTES_IN_ADDRESS); - VM.memory.zero(allocCursor, zeroBytes); - - allocStart.store(Address.zero(), DATA_END_OFFSET); - region = allocStart; - cursor = allocCursor; - updateLimit(allocEnd, region, 0); - if (oldPages > newPages) { - ((MarkCompactSpace) space).unusePages((oldPages - newPages)); - } - - // Zero during GC to help debugging. - allocStart = allocStart.loadAddress(NEXT_REGION_OFFSET); - while (!allocStart.isZero()) { - allocStart.store(Address.zero(), DATA_END_OFFSET); - if (VM.VERIFY_ASSERTIONS) { - Address low = allocStart.plus(DATA_START_OFFSET); - Extent size = allocStart.loadAddress(REGION_LIMIT_OFFSET).diff(allocStart).toWord().toExtent().minus(2 * BYTES_IN_ADDRESS); - VM.memory.zero(low, size); - } - allocStart = allocStart.loadAddress(NEXT_REGION_OFFSET); - } + private MarkCompactSpace mcSpace() { + return (MarkCompactSpace)space; } /** - * Perform a linear scan through the objects allocated by this bump pointer, - * calculating where each live object will be post collection. + * Prepare for collection: update the metadata for the current region, and flush + * this bump-pointer's allocations to the global page list. */ - public void calculateForwardingPointers() { - /* Has this allocator ever allocated anything? */ - if (initialRegion.isZero()) return; - - /* Loop through active regions or until the last region */ - Address start = initialRegion; - Address allocStart = initialRegion; - Address allocDataEnd = initialRegion.plus(DATA_END_OFFSET).loadAddress(); - Address allocLimit = (allocDataEnd.isZero() ? cursor : allocDataEnd); - Address allocCursor = start.plus(DATA_START_OFFSET); - - while (!start.isZero()) { - /* Get the end of this region */ - Address dataEnd = start.plus(DATA_END_OFFSET).loadAddress(); - - /* dataEnd = zero represents the current region. */ - Address currentLimit = (dataEnd.isZero() ? cursor : dataEnd); - ObjectReference current = - VM.objectModel.getObjectFromStartAddress(start.plus(DATA_START_OFFSET)); - - while (VM.objectModel.refToAddress(current).LT(currentLimit) && !current.isNull()) { - ObjectReference next = VM.objectModel.getNextObject(current); - - if (MarkCompactSpace.toBeCompacted(current)) { - if (VM.VERIFY_ASSERTIONS) - VM.assertions._assert(MarkCompactSpace.getForwardingPointer(current).isNull()); - - // Fake - allocate it. - int size = VM.objectModel.getSizeWhenCopied(current); - int align = VM.objectModel.getAlignWhenCopied(current); - int offset = VM.objectModel.getAlignOffsetWhenCopied(current); - allocCursor = Allocator.alignAllocationNoFill(allocCursor, align, offset); - - boolean sameRegion = allocStart.EQ(start); - - if (!sameRegion && allocCursor.plus(size).GT(allocLimit)) { - allocStart = allocStart.plus(NEXT_REGION_OFFSET).loadAddress(); - allocDataEnd = allocStart.plus(DATA_END_OFFSET).loadAddress(); - allocLimit = (allocDataEnd.isZero() ? cursor : allocDataEnd); - allocCursor = Allocator.alignAllocationNoFill(allocStart.plus(DATA_START_OFFSET), align, offset); - } - - ObjectReference target = VM.objectModel.getReferenceWhenCopiedTo(current, allocCursor); - if (sameRegion && target.toAddress().GE(current.toAddress())) { - MarkCompactSpace.setForwardingPointer(current, current); - allocCursor = VM.objectModel.getObjectEndAddress(current); - } else { - MarkCompactSpace.setForwardingPointer(current, target); - allocCursor = allocCursor.plus(size); - } - } - current = next; - } - if (dataEnd.isZero()) { - break; - } - start = start.plus(NEXT_REGION_OFFSET).loadAddress(); // Move on to next + public void prepare() { + if (!initialRegion.isZero()) { + setDataEnd(region,cursor); + mcSpace().append(initialRegion); } + reset(); } /** - * Some pages are about to be re-used to satisfy a slow path request. - * @param pages The number of pages. + * Flush this thread-local component in preparation for the mutator thread + * to die. */ - protected void reusePages(int pages) { - ((MarkCompactSpace)space).reusePages(pages); + public void flush() { + prepare(); } /** @@ -206,5 +65,7 @@ * load balancing or increments based on region size. * @return the maximum region size */ + @Override protected Extent maximumRegionSize() { return Extent.fromIntZeroExtend(4 << LOG_BLOCK_SIZE) ; } + } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactSpace.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactSpace.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactSpace.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkCompactSpace.java Sat Aug 14 07:25:41 2010 @@ -14,9 +14,12 @@ import org.mmtk.plan.TraceLocal; import org.mmtk.plan.TransitiveClosure; +import org.mmtk.utility.alloc.BumpPointer; import org.mmtk.utility.heap.*; import org.mmtk.utility.Constants; +import org.mmtk.utility.Log; +import org.mmtk.vm.Lock; import org.mmtk.vm.VM; import org.vmmagic.unboxed.*; @@ -40,6 +43,14 @@ private static final Word GC_MARK_BIT_MASK = Word.one(); private static final Offset FORWARDING_POINTER_OFFSET = VM.objectModel.GC_HEADER_OFFSET(); + private static final Lock lock = VM.newLock("mcSpace"); + + /** The list of occupied regions */ + private Address regionList = Address.zero(); + + // TODO - maintain a separate list of partially allocated regions + // for threads to allocate into immediately after a collection. + /**************************************************************************** * * Instance variables @@ -63,9 +74,9 @@ public MarkCompactSpace(String name, int pageBudget, VMRequest vmRequest) { super(name, true, false, vmRequest); if (vmRequest.isDiscontiguous()) { - pr = new MonotonePageResource(pageBudget, this, 0); + pr = new FreeListPageResource(pageBudget, this, 0); } else { - pr = new MonotonePageResource(pageBudget, this, start, extent, 0); + pr = new FreeListPageResource(pageBudget, this, start, extent, 0); } } @@ -73,7 +84,6 @@ * Prepare for a collection */ public void prepare() { - // nothing to do } /** @@ -85,33 +95,15 @@ /** - * Notify that several pages are no longer in use. - * - * @param pages The number of pages - */ - public void unusePages(int pages) { - ((MonotonePageResource) pr).unusePages(pages); - } - - /** - * Notify that several pages are no longer in use. - * - * @param pages The number of pages - */ - public void reusePages(int pages) { - ((MonotonePageResource) pr).reusePages(pages); - } - - /** * Release an allocated page or pages. In this case we do nothing * because we only release pages enmasse. * * @param start The address of the start of the page or pages */ + @Override @Inline public void release(Address start) { - if (VM.VERIFY_ASSERTIONS) - VM.assertions._assert(false); // this policy only releases pages enmasse + ((FreeListPageResource)pr).releasePages(start); } /** @@ -124,6 +116,7 @@ * @param object The object to be forwarded. * @return The forwarded object. */ + @Override @Inline public ObjectReference traceObject(TransitiveClosure trace, ObjectReference object) { if (VM.VERIFY_ASSERTIONS) @@ -143,11 +136,20 @@ */ @Inline public ObjectReference traceMarkObject(TraceLocal trace, ObjectReference object) { + if (MarkCompactCollector.VERY_VERBOSE) { + Log.write("marking "); Log.write(object); + } if (testAndMark(object)) { trace.processNode(object); } else if (!getForwardingPointer(object).isNull()) { + if (MarkCompactCollector.VERY_VERBOSE) { + Log.write(" -> "); Log.writeln(getForwardingPointer(object)); + } return getForwardingPointer(object); } + if (MarkCompactCollector.VERY_VERBOSE) { + Log.writeln(); + } return object; } @@ -167,6 +169,10 @@ trace.processNode(object); } ObjectReference newObject = getForwardingPointer(object); + if (MarkCompactCollector.VERY_VERBOSE) { + Log.write("forwarding "); Log.write(object); + Log.write(" -> "); Log.writeln(newObject); + } if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!newObject.isNull()); return getForwardingPointer(object); } @@ -177,6 +183,7 @@ * @param object The object * @return True if the object is live */ + @Override public boolean isLive(ObjectReference object) { return isMarked(object); } @@ -188,6 +195,7 @@ * @param object The object reference. * @return True if the object is reachable. */ + @Override public boolean isReachable(ObjectReference object) { return isMarked(object); } @@ -332,4 +340,49 @@ public static void clearForwardingPointer(ObjectReference object) { object.toAddress().store(Address.zero(), FORWARDING_POINTER_OFFSET); } + + /** + * @return A region of this space that has net yet been compacted during + * the current collection + */ + public Address getNextRegion() { + lock.acquire(); + if (regionList.isZero()) { + lock.release(); + return Address.zero(); + } + Address result = regionList; + regionList = BumpPointer.getNextRegion(regionList); + BumpPointer.clearNextRegion(result); + lock.release(); + return result; + } + + /** + * Append a region or list of regions to the global list + * @param region + */ + public void append(Address region) { + lock.acquire(); + if (MarkCompactCollector.VERBOSE) { + Log.write("Appending region "); Log.write(region); + Log.writeln(" to global list"); + } + if (regionList.isZero()) { + regionList = region; + } else { + appendRegion(regionList,region); + } + lock.release(); + } + + public static void appendRegion(Address listHead, Address region) { + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!listHead.isZero()); + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!region.isZero()); + Address cursor = listHead; + while (!BumpPointer.getNextRegion(cursor).isZero()) { + cursor = BumpPointer.getNextRegion(cursor); + } + BumpPointer.setNextRegion(cursor,region); + } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkSweepSpace.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkSweepSpace.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkSweepSpace.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/policy/MarkSweepSpace.java Sat Aug 14 07:25:41 2010 @@ -12,13 +12,13 @@ */ package org.mmtk.policy; -import org.mmtk.plan.Plan; import org.mmtk.plan.TransitiveClosure; import org.mmtk.utility.heap.*; import org.mmtk.utility.options.Options; import org.mmtk.utility.options.MarkSweepMarkBits; import org.mmtk.utility.options.EagerCompleteSweep; import org.mmtk.utility.Constants; +import org.mmtk.utility.HeaderByte; import org.mmtk.vm.VM; @@ -48,21 +48,20 @@ */ public static final boolean HEADER_MARK_BITS = VM.config.HEADER_MARK_BITS; /** highest bit bits we may use */ - private static final int MAX_BITS = 4; + private static final int AVAILABLE_LOCAL_BITS = 8 - HeaderByte.USED_GLOBAL_BITS; /* mark bits */ private static final int COUNT_BASE = 0; - public static final int DEFAULT_MARKCOUNT_BITS = 2; - public static final int MAX_MARKCOUNT_BITS = Plan.NEEDS_LOG_BIT_IN_HEADER ? MAX_BITS - 1 : MAX_BITS; - public static final Word UNLOGGED_BIT = Word.one().lsh(MAX_BITS - 1).lsh(COUNT_BASE); - private static final Word MARK_COUNT_INCREMENT = Word.one().lsh(COUNT_BASE); - private static final Word MARK_COUNT_MASK = Word.one().lsh(MAX_MARKCOUNT_BITS).minus(Word.one()).lsh(COUNT_BASE); - private static final Word MARK_BITS_MASK = Word.one().lsh(MAX_BITS).minus(Word.one()); - private static final boolean EAGER_MARK_CLEAR = Plan.NEEDS_LOG_BIT_IN_HEADER; + public static final int DEFAULT_MARKCOUNT_BITS = 4; + public static final int MAX_MARKCOUNT_BITS = AVAILABLE_LOCAL_BITS - COUNT_BASE; + private static final byte MARK_COUNT_INCREMENT = (byte) (1<>LOG_LIVE_COVERAGE); - while (start.LT(end)) { - Address metadata = EmbeddedMetaData.getMetaDataBase(start).plus(META_DATA_OFFSET); - VM.memory.zero(metadata, bytes); - start = start.plus(EmbeddedMetaData.BYTES_IN_REGION); + if (contiguous) { + Address end = ((FreeListPageResource)pr).getHighWater(); + Address cursor = start; + while (cursor.LT(end)) { + Address metadata = EmbeddedMetaData.getMetaDataBase(cursor).plus(META_DATA_OFFSET); + VM.memory.zero(metadata, bytes); + cursor = cursor.plus(EmbeddedMetaData.BYTES_IN_REGION); + } + } else { + for(Address cursor = headDiscontiguousRegion; !cursor.isZero(); cursor = Map.getNextContiguousRegion(cursor)) { + Address metadata = EmbeddedMetaData.getMetaDataBase(cursor).plus(META_DATA_OFFSET); + VM.memory.zero(metadata, bytes); + } } } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/policy/Space.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/policy/Space.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/policy/Space.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/policy/Space.java Sat Aug 14 07:25:41 2010 @@ -98,7 +98,7 @@ protected PageResource pr; protected final Address start; protected final Extent extent; - protected Address lastDiscontiguousRegion; + protected Address headDiscontiguousRegion; private boolean allocationFailed; @@ -133,7 +133,7 @@ this.descriptor = SpaceDescriptor.createDescriptor(); this.start = Address.zero(); this.extent = Extent.zero(); - this.lastDiscontiguousRegion = Address.zero(); + this.headDiscontiguousRegion = Address.zero(); VM.memory.setHeapRange(index, HEAP_START, HEAP_END); // this should really be refined! Once we have a code space, we can be a lot more specific about what is a valid code heap area return; } @@ -219,7 +219,7 @@ public final boolean isImmortal() { return immortal; } /** Movable getter @return True if objects in this space may move */ - public final boolean isMovable() { return movable; } + public boolean isMovable() { return movable; } /** Allocationfailed getter @return true if an allocation has failed since GC */ public final boolean allocationFailed() { return allocationFailed; } @@ -354,6 +354,18 @@ return Map.getSpaceForAddress(VM.objectModel.refToAddress(object)); } + /** + * Return the space for a given address, not necessarily the + * start address of an object. + * + * @param addr The address in question + * @return The space containing the address + */ + public static Space getSpaceForAddress(Address addr) { + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!addr.isZero()); + return Map.getSpaceForAddress(addr); + } + /**************************************************************************** * * Page management @@ -420,8 +432,7 @@ * @return The address of the new discontiguous space. */ public Address growDiscontiguousSpace(int chunks) { - this.lastDiscontiguousRegion = Map.allocateContiguousChunks(descriptor, this, chunks, lastDiscontiguousRegion); - return lastDiscontiguousRegion; + return headDiscontiguousRegion = Map.allocateContiguousChunks(descriptor, this, chunks, headDiscontiguousRegion); } /** @@ -455,8 +466,8 @@ */ public int releaseDiscontiguousChunks(Address chunk) { if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(chunk.EQ(chunkAlign(chunk, true))); - if (chunk.EQ(lastDiscontiguousRegion)) { - lastDiscontiguousRegion = Map.getNextContiguousRegion(chunk); + if (chunk.EQ(headDiscontiguousRegion)) { + headDiscontiguousRegion = Map.getNextContiguousRegion(chunk); } return Map.freeContiguousChunks(chunk); } @@ -534,7 +545,7 @@ Log.writeln(); } else { Log.write("D ["); - for(Address a = space.lastDiscontiguousRegion; !a.isZero(); a = Map.getNextContiguousRegion(a)) { + for(Address a = space.headDiscontiguousRegion; !a.isZero(); a = Map.getNextContiguousRegion(a)) { Log.write(a); Log.write("->"); Log.write(a.plus(Map.getContiguousRegionSize(a).minus(1))); if (Map.getNextContiguousRegion(a) != Address.zero()) @@ -573,6 +584,17 @@ */ @Interruptible public static void eagerlyMmapMMTkSpaces() { + eagerlyMmapMMTkContiguousSpaces(); + eagerlyMmapMMTkDiscontiguousSpaces(); + } + + + /** + * Ensure that all contiguous MMTk spaces are mapped. Demand zero map + * all of them if they are not already mapped. + */ + @Interruptible + public static void eagerlyMmapMMTkContiguousSpaces() { for (int i = 0; i < spaceCount; i++) { Space space = spaces[i]; if (space != VM.memory.getVMSpace()) { @@ -590,6 +612,22 @@ } /** + * Ensure that all discontiguous MMTk spaces are mapped. Demand zero map + * all of them if they are not already mapped. + */ + @Interruptible + public static void eagerlyMmapMMTkDiscontiguousSpaces() { + Address regionStart = Space.getDiscontigStart(); + Address regionEnd = Space.getDiscontigEnd(); + int pages = regionEnd.diff(regionStart).toInt()>>LOG_BYTES_IN_PAGE; + Log.write("Mapping discontiguous spaces "); + Log.write(regionStart); + Log.write("->"); + Log.writeln(regionEnd.minus(1)); + Mmapper.ensureMapped(getDiscontigStart(), pages); + } + + /** * Print out the memory used by all spaces in either megabytes or * pages. * @@ -670,6 +708,7 @@ * @param addr The address to be aligned * @param down If true the address will be rounded down, otherwise * it will rounded up. + * @return The chunk-aligned address */ public static Address chunkAlign(Address addr, boolean down) { if (!down) addr = addr.plus(BYTES_IN_CHUNK - 1); @@ -680,8 +719,9 @@ * Align an extent to a space chunk * * @param bytes The extent to be aligned - * @param down If true the address will be rounded down, otherwise + * @param down If true the extent will be rounded down, otherwise * it will rounded up. + * @return The chunk-aligned extent */ public static Extent chunkAlign(Extent bytes, boolean down) { if (!down) bytes = bytes.plus(BYTES_IN_CHUNK - 1); @@ -692,10 +732,10 @@ * Convert a fraction into a number of bytes according to the * fraction of available bytes. * - * @param frac The fraction of avialable virtual memory desired + * @param frac The fraction of available virtual memory desired * @return The corresponding number of bytes, chunk-aligned. */ - private static Extent getFracAvailable(float frac) { + public static Extent getFracAvailable(float frac) { long bytes = (long) (frac * AVAILABLE_BYTES.toLong()); Word mb = Word.fromIntSignExtend((int) (bytes >> LOG_BYTES_IN_MBYTE)); Extent rtn = mb.lsh(LOG_BYTES_IN_MBYTE).toExtent(); Modified: vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/ImmixSpace.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/ImmixSpace.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/ImmixSpace.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/ImmixSpace.java Sat Aug 14 07:25:41 2010 @@ -21,6 +21,8 @@ import org.mmtk.utility.options.LineReuseRatio; import org.mmtk.utility.options.Options; import org.mmtk.utility.Constants; +import org.mmtk.utility.ForwardingWord; +import org.mmtk.utility.HeaderByte; import org.mmtk.utility.Log; import org.mmtk.vm.Lock; @@ -52,7 +54,7 @@ * * Instance variables */ - private Word markState = ObjectHeader.MARK_BASE_VALUE; + private byte markState = ObjectHeader.MARK_BASE_VALUE; byte lineMarkState = RESET_LINE_MARK_STATE; private byte lineUnavailState = RESET_LINE_MARK_STATE; private boolean inCollection; @@ -136,7 +138,7 @@ if (allocBlockCursor.isZero()) allocBlockCursor = chunkMap.getHeadChunk(); allocBlockSentinel = allocBlockCursor; if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(isRecycleAllocChunkAligned(allocBlockSentinel)); - exhaustedReusableSpace = false; + exhaustedReusableSpace = allocBlockCursor.isZero(); if (VM.VERIFY_ASSERTIONS && Options.verbose.getValue() >= 9) { Log.write("gr[allocBlockCursor: "); Log.write(allocBlockCursor); Log.write(" allocBlockSentinel: "); Log.write(allocBlockSentinel); Log.writeln("]"); } @@ -341,7 +343,7 @@ if (bytes > BYTES_IN_LINE) ObjectHeader.markAsStraddling(object); if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(ObjectHeader.isNewObject(object)); - if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!ObjectHeader.isForwardedOrBeingForwarded(object)); + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!ForwardingWord.isForwardedOrBeingForwarded(object)); } /** @@ -356,8 +358,8 @@ public void postCopy(ObjectReference object, int bytes, boolean majorGC) { ObjectHeader.writeMarkState(object, markState, bytes > BYTES_IN_LINE); if (!MARK_LINE_AT_SCAN_TIME && majorGC) markLines(object); - if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!ObjectHeader.isForwardedOrBeingForwarded(object)); - if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER) VM.assertions._assert(ObjectHeader.isUnloggedObject(object)); + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!ForwardingWord.isForwardedOrBeingForwarded(object)); + if (VM.VERIFY_ASSERTIONS && HeaderByte.NEEDS_UNLOGGED_BIT) VM.assertions._assert(HeaderByte.isUnlogged(object)); } /**************************************************************************** @@ -452,16 +454,16 @@ */ @Inline private void traceObjectWithoutMoving(TransitiveClosure trace, ObjectReference object) { - Word markValue = Plan.NEEDS_LOG_BIT_IN_HEADER ? markState.or(ObjectHeader.UNLOGGED_BIT) : markState; - Word oldMarkState = ObjectHeader.testAndMark(object, markValue); + byte markValue = markState; + byte oldMarkState = ObjectHeader.testAndMark(object, markValue); if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!defrag.inDefrag() || defrag.spaceExhausted() || !isDefragSource(object)); if (oldMarkState != markValue) { if (!MARK_LINE_AT_SCAN_TIME) markLines(object); trace.processNode(object); } - if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!ObjectHeader.isForwardedOrBeingForwarded(object)); - if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER) VM.assertions._assert(ObjectHeader.isUnloggedObject(object)); + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!ForwardingWord.isForwardedOrBeingForwarded(object)); + if (VM.VERIFY_ASSERTIONS && HeaderByte.NEEDS_UNLOGGED_BIT) VM.assertions._assert(HeaderByte.isUnlogged(object)); } /** @@ -479,36 +481,38 @@ if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(nurseryCollection || (defrag.determined(true) && isDefragSource(object))); /* now race to be the (potential) forwarder */ - Word priorForwardingWord = ObjectHeader.attemptToBeForwarder(object); - if (ObjectHeader.isForwardedOrBeingForwarded(priorForwardingWord)) { + Word priorStatusWord = ForwardingWord.attemptToForward(object); + if (ForwardingWord.stateIsForwardedOrBeingForwarded(priorStatusWord)) { /* We lost the race; the object is either forwarded or being forwarded by another thread. */ /* Note that the concurrent attempt to forward the object may fail, so the object may remain in-place */ - ObjectReference rtn = ObjectHeader.spinAndGetForwardedObject(object, priorForwardingWord); + ObjectReference rtn = ForwardingWord.spinAndGetForwardedObject(object, priorStatusWord); if (VM.VERIFY_ASSERTIONS && rtn == object) VM.assertions._assert((nurseryCollection && ObjectHeader.testMarkState(object, markState)) || defrag.spaceExhausted() || ObjectHeader.isPinnedObject(object)); if (VM.VERIFY_ASSERTIONS && rtn != object) VM.assertions._assert(nurseryCollection || !isDefragSource(rtn)); - if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER) VM.assertions._assert(ObjectHeader.isUnloggedObject(rtn)); + if (VM.VERIFY_ASSERTIONS && HeaderByte.NEEDS_UNLOGGED_BIT) VM.assertions._assert(HeaderByte.isUnlogged(rtn)); return rtn; } else { + byte priorState = (byte) (priorStatusWord.toInt() & 0xFF); /* the object is unforwarded, either because this is the first thread to reach it, or because the object can't be forwarded */ - if (ObjectHeader.testMarkState(priorForwardingWord, markState)) { + if (ObjectHeader.testMarkState(priorState, markState)) { /* the object has not been forwarded, but has the correct mark state; unlock and return unmoved object */ /* Note that in a sticky mark bits collector, the mark state does not change at each GC, so correct mark state does not imply another thread got there first */ if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(nurseryCollection || defrag.spaceExhausted() || ObjectHeader.isPinnedObject(object)); - ObjectHeader.setForwardingWordAndEnsureUnlogged(object, priorForwardingWord); // return to uncontested state - if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER) VM.assertions._assert(ObjectHeader.isUnloggedObject(object)); + ObjectHeader.returnToPriorStateAndEnsureUnlogged(object, priorState); // return to uncontested state + if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER) VM.assertions._assert(HeaderByte.isUnlogged(object)); return object; } else { /* we are the first to reach the object; either mark in place or forward it */ ObjectReference newObject; if (ObjectHeader.isPinnedObject(object) || defrag.spaceExhausted()) { /* mark in place */ - ObjectHeader.setMarkStateUnlogAndUnlock(object, priorForwardingWord, markState); + ObjectHeader.setMarkStateUnlogAndUnlock(object, priorState, markState); newObject = object; - if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER) VM.assertions._assert(ObjectHeader.isUnloggedObject(newObject)); + if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER) VM.assertions._assert(HeaderByte.isUnlogged(newObject)); } else { /* forward */ - newObject = ObjectHeader.forwardObject(object, allocator); - if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER) VM.assertions._assert(ObjectHeader.isUnloggedObject(newObject)); + if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(!ObjectHeader.isPinnedObject(object)); + newObject = ForwardingWord.forwardObject(object, allocator); + if (VM.VERIFY_ASSERTIONS && Plan.NEEDS_LOG_BIT_IN_HEADER) VM.assertions._assert(HeaderByte.isUnlogged(newObject)); } if (VM.VERIFY_ASSERTIONS && Options.verbose.getValue() >= 9) { Log.write("C["); Log.write(object); Log.write("/"); @@ -657,7 +661,7 @@ @Inline public boolean isLive(ObjectReference object) { if (defrag.inDefrag() && isDefragSource(object)) - return ObjectHeader.isForwardedOrBeingForwarded(object) || ObjectHeader.testMarkState(object, markState); + return ForwardingWord.isForwardedOrBeingForwarded(object) || ObjectHeader.testMarkState(object, markState); else return ObjectHeader.testMarkState(object, markState); } @@ -670,7 +674,7 @@ */ @Inline public boolean copyNurseryIsLive(ObjectReference object) { - return ObjectHeader.isForwardedOrBeingForwarded(object) || ObjectHeader.testMarkState(object, markState); + return ForwardingWord.isForwardedOrBeingForwarded(object) || ObjectHeader.testMarkState(object, markState); } /** Modified: vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/Line.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/Line.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/Line.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/Line.java Sat Aug 14 07:25:41 2010 @@ -52,7 +52,7 @@ Address line = Line.align(start.plus(BYTES_IN_LINE)); while (line.LT(endLine)) { if (VM.VERIFY_ASSERTIONS) - VM.assertions._assert(Block.align(start) == Block.align(line)); + VM.assertions._assert(Block.align(start).EQ(Block.align(line))); mark(line, markValue); line = line.plus(BYTES_IN_LINE); } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/ObjectHeader.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/ObjectHeader.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/ObjectHeader.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/policy/immix/ObjectHeader.java Sat Aug 14 07:25:41 2010 @@ -12,54 +12,39 @@ */ package org.mmtk.policy.immix; -import org.mmtk.plan.Plan; +import org.mmtk.utility.ForwardingWord; +import org.mmtk.utility.HeaderByte; import org.mmtk.vm.VM; import org.vmmagic.pragma.Inline; import org.vmmagic.pragma.Uninterruptible; import org.vmmagic.unboxed.ObjectReference; -import org.vmmagic.unboxed.Word; @Uninterruptible public class ObjectHeader { /** number of header bits we may use */ - static final int MAX_BITS = 8; + static final int AVAILABLE_LOCAL_BITS = 8 - HeaderByte.USED_GLOBAL_BITS; /* header requirements */ - public static final int LOCAL_GC_BITS_REQUIRED = MAX_BITS; + public static final int LOCAL_GC_BITS_REQUIRED = AVAILABLE_LOCAL_BITS; public static final int GLOBAL_GC_BITS_REQUIRED = 0; public static final int GC_HEADER_WORDS_REQUIRED = 0; - /* stolen bits */ - static final Word NEW_OBJECT_MARK = Word.fromIntZeroExtend(0); // using zero means no need for explicit initialization on allocation - private static final Word BEING_FORWARDED = Word.fromIntZeroExtend(2); // second bit indicates an object is in the process of being forwarded - private static final Word FORWARDED = Word.fromIntZeroExtend(3); // second bit indicates an object is in the process of being forwarded - private static final Word FORWARDING_MASK = Word.fromIntZeroExtend(3); - - private static final int UNLOGGED_BIT_NUMBER = 3; - public static final Word UNLOGGED_BIT = Word.one().lsh(UNLOGGED_BIT_NUMBER); - public static final Word LOG_SET_MASK = UNLOGGED_BIT; + /* local status bits */ + static final byte NEW_OBJECT_MARK = 0; // using zero means no need for explicit initialization on allocation - private static final int STOLEN_LO_BITS = UNLOGGED_BIT_NUMBER + 1; // both used for forwarding, also the all zero state is used to represent new objects - private static final int STOLEN_HI_BITS = 2; - - static final int MAX_MARKCOUNT_BITS = MAX_BITS-(STOLEN_LO_BITS+STOLEN_HI_BITS); - private static final int FIRST_STOLEN_HI_BIT_NUMBER = STOLEN_LO_BITS + MAX_MARKCOUNT_BITS; - - public static final int PINNED_BIT_NUMBER = FIRST_STOLEN_HI_BIT_NUMBER; - public static final Word PINNED_BIT = Word.one().lsh(PINNED_BIT_NUMBER); + public static final int PINNED_BIT_NUMBER = ForwardingWord.FORWARDING_BITS; + public static final byte PINNED_BIT = 1< + * + * The two lowest order bits are used for object forwarding because forwarding + * generally must steal the unused two low order bits of the forwarding pointer. + */ + at Uninterruptible +public class ForwardingWord { + /* + * The forwarding process uses three states to deal with a GC race: + * 1. !FORWARDED: Unforwarded + * 2. BEING_FORWARDED: Being forwarded (forwarding is underway) + * 3. FORWARDED: Forwarded + */ + /** If this bit is set, then forwarding of this object is incomplete */ + private static final byte BEING_FORWARDED = 2; // ...10 + /** If this bit is set, then forwarding of this object has commenced */ + private static final byte FORWARDED = 3; // ...11 + /** This mask is used to reveal which state this object is in with respect to forwarding */ + public static final byte FORWARDING_MASK = 3; // ...11 + + public static final int FORWARDING_BITS = 2; + + + /** + * Either return the forwarding pointer if the object is already + * forwarded (or being forwarded) or write the bit pattern that + * indicates that the object is being forwarded + * + * @param object The object to be forwarded + * @return The forwarding pointer for the object if it has already + * been forwarded. + */ + @Inline + public static Word attemptToForward(ObjectReference object) { + Word oldValue; + do { + oldValue = VM.objectModel.prepareAvailableBits(object); + if ((byte) (oldValue.toInt() & FORWARDING_MASK) == FORWARDED) + return oldValue; + } while (!VM.objectModel.attemptAvailableBits(object, oldValue, + oldValue.or(Word.fromIntZeroExtend(BEING_FORWARDED)))); + return oldValue; + } + + public static ObjectReference spinAndGetForwardedObject(ObjectReference object, Word statusWord) { + /* We must wait (spin) if the object is not yet fully forwarded */ + while ((statusWord.toInt() & FORWARDING_MASK) == BEING_FORWARDED) + statusWord = VM.objectModel.readAvailableBitsWord(object); + + /* Now extract the object reference from the forwarding word and return it */ + if ((statusWord.toInt() & FORWARDING_MASK) == FORWARDED) + return statusWord.and(Word.fromIntZeroExtend(FORWARDING_MASK).not()).toAddress().toObjectReference(); + else + return object; + } + + public static ObjectReference forwardObject(ObjectReference object, int allocator) { + ObjectReference newObject = VM.objectModel.copy(object, allocator); + VM.objectModel.writeAvailableBitsWord(object, newObject.toAddress().toWord().or(Word.fromIntZeroExtend(FORWARDED))); + return newObject; + } + + /** + * Non-atomic write of forwarding pointer word (assumption, thread + * doing the set has done attempt to forward and owns the right to + * copy the object) + * + * @param object The object whose forwarding pointer is to be set + * @param ptr The forwarding pointer to be stored in the object's + * forwarding word + */ + @Inline + public static void setForwardingPointer(ObjectReference object, + ObjectReference ptr) { + VM.objectModel.writeAvailableBitsWord(object, ptr.toAddress().toWord().or(Word.fromIntZeroExtend(FORWARDED))); + } + + /** + * Has an object been forwarded? + * + * @param object The object to be checked + * @return True if the object has been forwarded + */ + @Inline + public static boolean isForwarded(ObjectReference object) { + return (VM.objectModel.readAvailableByte(object) & FORWARDING_MASK) == FORWARDED; + } + + /** + * Has an object been forwarded or is it being forwarded? + * + * @param object The object to be checked + * @return True if the object has been forwarded + */ + @Inline + public static boolean isForwardedOrBeingForwarded(ObjectReference object) { + return (VM.objectModel.readAvailableByte(object) & FORWARDING_MASK) != 0; + } + + /** + * Has an object been forwarded or being forwarded? + * + * @param object The object to be checked + * @return True if the object has been forwarded + */ + @Inline + public static boolean stateIsForwardedOrBeingForwarded(Word header) { + return (header.toInt() & FORWARDING_MASK) != 0; + } + + /** + * Has an object been forwarded or being forwarded? + * + * @param object The object to be checked + * @return True if the object has been forwarded + */ + @Inline + public static boolean stateIsBeingForwarded(Word header) { + return (header.toInt() & FORWARDING_MASK) == BEING_FORWARDED; + } + + /** + * Clear the GC forwarding portion of the header for an object. + * + * @param object the object ref to the storage to be initialized + */ + @Inline + public static void clearForwardingBits(ObjectReference object) { + VM.objectModel.writeAvailableByte(object, (byte) (VM.objectModel.readAvailableByte(object) & ~FORWARDING_MASK)); + } + + @Inline + public static ObjectReference extractForwardingPointer(Word forwardingWord) { + return forwardingWord.and(Word.fromIntZeroExtend(FORWARDING_MASK).not()).toAddress().toObjectReference(); + } +} Added: vmkit/trunk/mmtk/java/src/org/mmtk/utility/HeaderByte.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/utility/HeaderByte.java?rev=111072&view=auto ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/utility/HeaderByte.java (added) +++ vmkit/trunk/mmtk/java/src/org/mmtk/utility/HeaderByte.java Sat Aug 14 07:25:41 2010 @@ -0,0 +1,89 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.utility; + +import org.mmtk.vm.VM; +import org.vmmagic.pragma.Uninterruptible; +import org.vmmagic.unboxed.Address; +import org.vmmagic.unboxed.ObjectReference; + +/** + * This class provides generic support for operations over the GC byte + * within each object's header word. Specifically this class manages + * global status bits which cut across policies (for example the logging bit).

+ * + * The general pattern for use of the GC byte is that the high order bits + * successively reserved for global use, as necessary. Any GC policy may use + * those bits that are not reserved for global use.

+ */ + at Uninterruptible +public class HeaderByte { + private static final int TOTAL_BITS = 8; + + public static final boolean NEEDS_UNLOGGED_BIT = VM.activePlan.constraints().needsLogBitInHeader(); + private static final int UNLOGGED_BIT_NUMBER = TOTAL_BITS - (NEEDS_UNLOGGED_BIT ? 1 : 0); + public static final byte UNLOGGED_BIT = (byte) (1<not worry + * about synchronization and allow threads to race to log the + * object, potentially including it twice (unlike reference + * counting where duplicates would lead to incorrect reference + * counts). + * + * @param object The object to be marked as logged + */ + public static void markAsLogged(ObjectReference object) { + byte value = VM.objectModel.readAvailableByte(object); + VM.objectModel.writeAvailableByte(object, (byte) (value & ~UNLOGGED_BIT)); + } + + /** + * Return true if the specified object needs to be logged. + * + * @param object The object in question + * @return True if the object in question needs to be logged (remembered). + */ + public static boolean isUnlogged(ObjectReference object) { + byte value = VM.objectModel.readAvailableByte(object); + return (value & UNLOGGED_BIT) == UNLOGGED_BIT; + } +} Modified: vmkit/trunk/mmtk/java/src/org/mmtk/utility/alloc/BumpPointer.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/utility/alloc/BumpPointer.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/utility/alloc/BumpPointer.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/utility/alloc/BumpPointer.java Sat Aug 14 07:25:41 2010 @@ -13,12 +13,19 @@ package org.mmtk.utility.alloc; import org.mmtk.policy.Space; -import org.mmtk.utility.*; +import org.mmtk.utility.Constants; +import org.mmtk.utility.Conversions; +import org.mmtk.utility.Log; import org.mmtk.utility.gcspy.drivers.LinearSpaceDriver; import org.mmtk.vm.VM; - -import org.vmmagic.unboxed.*; -import org.vmmagic.pragma.*; +import org.vmmagic.pragma.Inline; +import org.vmmagic.pragma.NoInline; +import org.vmmagic.pragma.Uninterruptible; +import org.vmmagic.unboxed.Address; +import org.vmmagic.unboxed.Extent; +import org.vmmagic.unboxed.ObjectReference; +import org.vmmagic.unboxed.Offset; +import org.vmmagic.unboxed.Word; /** * This class implements a bump pointer allocator that allows linearly @@ -65,6 +72,8 @@ private static final int STEP_SIZE = 1<<(SUPPORT_CARD_SCANNING ? LOG_CARD_BYTES : LOG_DEFAULT_STEP_SIZE); protected static final int LOG_BLOCK_SIZE = LOG_BYTES_IN_PAGE + 3; protected static final Word BLOCK_MASK = Word.one().lsh(LOG_BLOCK_SIZE).minus(Word.one()); + private static final int BLOCK_SIZE = (1<startAll() is called. * @return True if this counter is implicitly started when Removed: vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/PerfCounter.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/PerfCounter.java?rev=111071&view=auto ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/PerfCounter.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/PerfCounter.java (removed) @@ -1,78 +0,0 @@ -/* - * This file is part of the Jikes RVM project (http://jikesrvm.org). - * - * This file is licensed to You under the Eclipse Public License (EPL); - * You may not use this file except in compliance with the License. You - * may obtain a copy of the License at - * - * http://www.opensource.org/licenses/eclipse-1.0.php - * - * See the COPYRIGHT.txt file distributed with this work for information - * regarding copyright ownership. - */ -package org.mmtk.utility.statistics; - -import org.mmtk.vm.VM; - -import org.vmmagic.pragma.*; - -/** - * This class implements a simple performance counter, used to gather - * data from hardware performance counters. - */ - at Uninterruptible -public class PerfCounter extends LongCounter { - - /**************************************************************************** - * - * Initialization - */ - - /** - * Constructor - * - * @param name The name to be associated with this counter - */ - public PerfCounter(String name) { - this(name, true, false); - } - - /** - * Constructor - * - * @param name The name to be associated with this counter - * @param start True if this counter is to be implicitly started at - * boot time (otherwise the counter must be explicitly started). - */ - public PerfCounter(String name, boolean start) { - this(name, start, false); - } - - /** - * Constructor - * - * @param name The name to be associated with this counter - * @param start True if this counter is to be implicitly started at - * boot time (otherwise the counter must be explicitly started). - * @param gconly True if this counter only pertains to (and - * therefore functions during) GC phases. - */ - public PerfCounter(String name, boolean start, boolean gconly) { - super(name, start, gconly); - } - - /**************************************************************************** - * - * Counter-specific methods - */ - - /** - * Get the current value for this counter - * - * @return The current value for this counter - */ - @Inline - protected final long getCurrentValue() { - return VM.statistics.perfCtrReadMetric(); - } -} Added: vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/PerfEvent.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/PerfEvent.java?rev=111072&view=auto ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/PerfEvent.java (added) +++ vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/PerfEvent.java Sat Aug 14 07:25:41 2010 @@ -0,0 +1,116 @@ +/* + * This file is part of the Jikes RVM project (http://jikesrvm.org). + * + * This file is licensed to You under the Eclipse Public License (EPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. + */ +package org.mmtk.utility.statistics; + +import org.mmtk.utility.Log; +import org.mmtk.vm.VM; +import org.vmmagic.pragma.Uninterruptible; + +/** + * This class represents a perf event, such as cache misses, etc. + */ + at Uninterruptible +public final class PerfEvent extends LongCounter { + /** True if the counter did not run due to contention for a physical counter */ + private boolean contended; + + /** True if the counter did not run all of the time and has been scaled appropriately */ + private boolean scaled; + + /** True if the counter overflowed */ + private boolean overflowed; + + /** The index of the counter in the native array */ + private int index; + + /** The previously read value of the counter (used to detect overflow) */ + private long previousValue; + + /** A buffer passed to the native code when reading values, returns the tuple RAW_COUNT, TIME_ENABLED, TIME_RUNNING */ + private final long[] readBuffer = new long[3]; + private static final int RAW_COUNT = 0; + private static final int TIME_ENABLED = 1; + private static final int TIME_RUNNING = 2; + + /** Three 64 bit values is 24 bytes */ + private static final int BYTES_TO_READ = 24; + + /** True if any data was scaled */ + public static boolean dataWasScaled = false; + + public PerfEvent(int index, String name) { + super(name, true, false); + this.index = index; + } + + /** + * Counters are 64 bit unsigned in the kernel but only 63 bits are available in Java + */ + @Override + protected long getCurrentValue() { + VM.statistics.perfEventRead(index, readBuffer); + if (readBuffer[RAW_COUNT] < 0 || readBuffer[TIME_ENABLED] < 0 || readBuffer[TIME_RUNNING] < 0) { + // Negative implies they have exceeded 63 bits. + overflowed = true; + } + if (readBuffer[TIME_ENABLED] == 0) { + // Counter never run (assume contention) + contended = true; + } + // Was the counter scaled? + if (readBuffer[TIME_ENABLED] != readBuffer[TIME_RUNNING]) { + scaled = true; + dataWasScaled = true; + double scaleFactor; + if (readBuffer[TIME_RUNNING] == 0) { + scaleFactor = 0; + } else { + scaleFactor = readBuffer[TIME_ENABLED] / readBuffer[TIME_RUNNING]; + } + readBuffer[RAW_COUNT] = (long) (readBuffer[RAW_COUNT] * scaleFactor); + } + if (readBuffer[RAW_COUNT] < previousValue) { + // value should monotonically increase + overflowed = true; + } + previousValue = readBuffer[RAW_COUNT]; + return readBuffer[RAW_COUNT]; + } + + /** + * Print the given value + * @param value The value to be printed + */ + @Override + void printValue(long value) { + if (overflowed) { + Log.write("OVERFLOWED"); + } else if (contended) { + Log.write("CONTENDED"); + } else { + Log.write(value); + if (scaled) { + Log.write(" (SCALED)"); + } + } + } + + public String getColumnSuffix() { + return + overflowed ? "overflowed" : + contended ? "contended" : + scaled ? ".scaled" : + ""; + } +} + Modified: vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/Stats.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/Stats.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/Stats.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/utility/statistics/Stats.java Sat Aug 14 07:25:41 2010 @@ -127,6 +127,7 @@ if (counter[c].getStart()) counter[c].start(); } + if (Options.xmlStats.getValue()) { Xml.begin(); Xml.openTag("mmtk-stats"); @@ -232,11 +233,14 @@ for (int c = 0; c < counters; c++) { if (counter[c].mergePhases()) { Log.write(counter[c].getName()); + Log.write(counter[c].getColumnSuffix()); Log.write("\t"); } else { Log.write(counter[c].getName()); + Log.write(counter[c].getColumnSuffix()); Log.write(".mu\t"); Log.write(counter[c].getName()); + Log.write(counter[c].getColumnSuffix()); Log.write(".gc\t"); } } @@ -310,6 +314,7 @@ @Interruptible private static void printTotalXml(Counter c, Phase phase) { openStatXml(c.getName()); + Xml.attribute("suffix", c.getColumnSuffix()); Xml.openAttribute("value"); if (phase == Phase.COMBINED) { c.printTotal(); @@ -333,6 +338,7 @@ @Interruptible private static void printPhaseStatXml(Counter c, int p, Phase phase) { openStatXml(c.getName()); + Xml.attribute("suffix", c.getColumnSuffix()); Xml.openAttribute("value"); if (phase == Phase.COMBINED) { c.printCount(p); Modified: vmkit/trunk/mmtk/java/src/org/mmtk/vm/Barriers.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/vm/Barriers.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/vm/Barriers.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/vm/Barriers.java Sat Aug 14 07:25:41 2010 @@ -18,132 +18,404 @@ @Uninterruptible public abstract class Barriers { /** - * Sets an element of an object array without invoking any write - * barrier. This method is called by the Map class to ensure - * potentially-allocation-triggering write barriers do not occur in - * allocation slow path code. + * Perform the actual write of a boolean write barrier. * - * @param dst the destination array - * @param index the index of the element to set - * @param value the new value for the element + * @param ref The object that has the boolean field + * @param value The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring */ - public abstract void setArrayNoBarrier(Object [] dst, int index, Object value); + public abstract void booleanWrite(ObjectReference ref, boolean value, Word metaDataA, Word metaDataB, int mode); /** - * Perform the actual write of the write barrier. + * Perform the actual read of a boolean read barrier. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param target The value that the slot will be updated to - * @param metaDataA VM specific meta data - * @param metaDataB VM specific meta data - * @param mode The context in which the write is occuring - */ - public abstract void performWriteInBarrier(ObjectReference ref, Address slot, - ObjectReference target, Word metaDataA, - Word metaDataB, int mode); + * @param ref The object that has the boolean field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return the read value + */ + public abstract boolean booleanRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); /** - * Perform the actual write of the write barrier, writing the value as a raw Word. + * Perform the actual write of a byte write barrier. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param rawTarget The value that the slot will be updated to - * @param metaDataA VM specific meta data - * @param metaDataB VM specific meta data - * @param mode The context in which the write is occuring - */ - public abstract void performRawWriteInBarrier(ObjectReference ref, Address slot, - Word rawTarget, Word metaDataA, - Word metaDataB, int mode); + * @param ref The object that has the byte field + * @param value The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void byteWrite(ObjectReference ref, byte value, Word metaDataA, Word metaDataB, int mode); /** - * Perform the actual read of the read barrier. + * Perform the actual read of a byte read barrier. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param metaDataA VM specific meta data - * @param metaDataB VM specific meta data - * @param mode The context in which the write is occuring + * @param ref The object that has the byte field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring * @return the read value */ - public abstract ObjectReference performReadInBarrier(ObjectReference ref, Address slot, - Word metaDataA, Word metaDataB, int mode); + public abstract byte byteRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); /** - * Perform the actual read of the read barrier, returning the value as a raw Word. + * Perform the actual write of a char write barrier. + * + * @param ref The object that has the char field + * @param value The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void charWrite(ObjectReference ref, char value, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual read of a char read barrier. + * + * @param ref The object that has the char field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return the read value + */ + public abstract char charRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual write of a short write barrier. + * + * @param ref The object that has the short field + * @param value The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void shortWrite(ObjectReference ref, short value, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual read of a short read barrier. + * + * @param ref The object that has the short field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return the read value + */ + public abstract short shortRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual write of a int write barrier. + * + * @param ref The object that has the int field + * @param value The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void intWrite(ObjectReference ref, int value, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual read of a int read barrier. + * + * @param ref The object that has the int field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return the read value + */ + public abstract int intRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); + + /** + * Attempt an atomic compare and exchange in a write barrier sequence. + * + * @param objref The object that has the int field + * @param old The old int to be swapped out + * @param value the new int + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return True if the compare and swap was successful + */ + public abstract boolean intTryCompareAndSwap(ObjectReference objref, int old, int value, Word metaDataA, Word metaDataB, int mode); + + + /** + * Perform the actual write of a long write barrier. + * + * @param ref The object that has the long field + * @param value The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void longWrite(ObjectReference ref, long value, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual read of a long read barrier. + * + * @param ref The object that has the long field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return the read value + */ + public abstract long longRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); + + /** + * Attempt an atomic compare and exchange in a write barrier sequence. + * + * @param objref The object that has the long field + * @param old The old long to be swapped out + * @param value the new long + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return True if the compare and swap was successful + */ + public abstract boolean longTryCompareAndSwap(ObjectReference objref, long old, long value, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual write of a float write barrier. + * + * @param ref The object that has the float field + * @param value The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void floatWrite(ObjectReference ref, float value, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual read of a float read barrier. + * + * @param ref The object that has the float field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return the read value + */ + public abstract float floatRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual write of a double write barrier. + * + * @param ref The object that has the double field + * @param value The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void doubleWrite(ObjectReference ref, double value, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual read of a double read barrier. + * + * @param ref The object that has the double field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return the read value + */ + public abstract double doubleRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual write of an object reference write barrier. + * + * @param ref The object that has the reference field + * @param value The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void objectReferenceWrite(ObjectReference ref, ObjectReference value, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual read of a read barrier. * * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param metaDataA VM specific meta data - * @param metaDataB VM specific meta data - * @param mode The context in which the write is occuring + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring * @return the read value */ - public abstract Word performRawReadInBarrier(ObjectReference ref, Address slot, - Word metaDataA, Word metaDataB, int mode); + public abstract ObjectReference objectReferenceRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual write of the non-heap write barrier. This is + * used when the store is not to an object, but to a non-heap location + * such as statics or the stack. + * + * @param slot The address that contains the reference field + * @param target The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + */ + public abstract void objectReferenceNonHeapWrite(Address slot, ObjectReference target, Word metaDataA, Word metaDataB); /** * Atomically write a reference field of an object or array and return * the old value of the reference field. * * @param ref The object that has the reference field - * @param slot The slot that holds the reference * @param target The value that the slot will be updated to - * @param metaDataA VM specific meta data - * @param metaDataB VM specific meta data - * @param mode The context in which the write is occuring + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring * @return The value that was replaced by the write. */ - public abstract ObjectReference performWriteInBarrierAtomic(ObjectReference ref, Address slot, - ObjectReference target, Word metaDataA, - Word metaDataB, int mode); + public abstract ObjectReference objectReferenceAtomicWrite(ObjectReference ref, ObjectReference target, Word metaDataA, Word metaDataB, int mode); /** - * Atomically write a reference field of an object or array and return - * the old value of the reference field. + * Attempt an atomic compare and exchange in a write barrier sequence. * * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param rawTarget The raw value that the slot will be updated to - * @param metaDataA VM specific meta data - * @param metaDataB VM specific meta data - * @param mode The context in which the write is occuring + * @param old The old reference to be swapped out + * @param target The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return True if the compare and swap was successful + */ + public abstract boolean objectReferenceTryCompareAndSwap(ObjectReference ref, ObjectReference old, ObjectReference target, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual write of the write barrier, writing the value as a raw Word. + * + * @param ref The object that has the Word field + * @param target The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void wordWrite(ObjectReference ref, Word target, Word metaDataA, Word metaDataB, int mode); + + /** + * Atomically write a Word field of an object or array and return + * the old value of the Word field. + * + * @param ref The object that has the Word field + * @param target The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring * @return The raw value that was replaced by the write. */ - public abstract Word performRawWriteInBarrierAtomic(ObjectReference ref, Address slot, - Word rawTarget, Word metaDataA, - Word metaDataB, int mode); + public abstract Word wordAtomicWrite(ObjectReference ref, Word rawTarget, Word metaDataA, Word metaDataB, int mode); /** * Attempt an atomic compare and exchange in a write barrier sequence. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param old The old reference to be swapped out + * @param ref The object that has the Word field + * @param old The old Word to be swapped out * @param target The value that the slot will be updated to - * @param metaDataA VM specific meta data - * @param metaDataB VM specific meta data - * @param mode The context in which the write is occuring + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring * @return True if the compare and swap was successful */ - public abstract boolean tryCompareAndSwapWriteInBarrier(ObjectReference ref, Address slot, - ObjectReference old, ObjectReference target, - Word metaDataA, Word metaDataB, int mode); + public abstract boolean wordTryCompareAndSwap(ObjectReference ref, Word old, Word target, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual read of the read barrier, returning the value as a raw Word. + * + * @param ref The object that has the Word field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return the read value + */ + public abstract Word wordRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual write of the write barrier, writing the value as a raw Address. + * + * @param ref The object that has the Address field + * @param target The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void addressWrite(ObjectReference ref, Address target, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual read of the read barrier, returning the value as a raw Address. + * + * @param ref The object that has the Address field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return the read value + */ + public abstract Address addressRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); /** * Attempt an atomic compare and exchange in a write barrier sequence. * - * @param ref The object that has the reference field - * @param slot The slot that holds the reference - * @param rawOld The old reference to be swapped out - * @param rawTarget The value that the slot will be updated to - * @param metaDataA VM specific meta data - * @param metaDataB VM specific meta data - * @param mode The context in which the write is occuring + * @param ref The object that has the Address field + * @param old The old address to be swapped out + * @param target The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring * @return True if the compare and swap was successful */ - public abstract boolean tryRawCompareAndSwapWriteInBarrier(ObjectReference ref, Address slot, - Word rawOld, Word rawTarget, - Word metaDataA, Word metaDataB, int mode); + public abstract boolean addressTryCompareAndSwap(ObjectReference ref, Address old, Address target, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual write of the write barrier, writing the value as a raw Offset. + * + * @param ref The object that has the Offset field + * @param target The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void offsetWrite(ObjectReference ref, Offset target, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual read of the read barrier, returning the value as a raw Offset. + * + * @param ref The object that has the Offset field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return the read value + */ + public abstract Offset offsetRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual write of the write barrier, writing the value as a raw Extent. + * + * @param ref The object that has the Extent field + * @param target The value that the slot will be updated to + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + */ + public abstract void extentWrite(ObjectReference ref, Extent target, Word metaDataA, Word metaDataB, int mode); + + /** + * Perform the actual read of the read barrier, returning the value as a raw Extent. + * + * @param ref The object that has the Extent field + * @param metaDataA Opaque, VM-specific, meta-data identifying the slot + * @param metaDataB Opaque, VM-specific, meta-data identifying the slot + * @param mode The context in which the write is occurring + * @return the read value + */ + public abstract Extent extentRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode); + + /** + * Sets an element of an object array without invoking any write + * barrier. This method is called by the Map class to ensure + * potentially-allocation-triggering write barriers do not occur in + * allocation slow path code. + * + * @param dst the destination array + * @param index the index of the element to set + * @param value the new value for the element + */ + public abstract void objectArrayStoreNoGCBarrier(Object [] dst, int index, Object value); } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/vm/Debug.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/vm/Debug.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/vm/Debug.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/vm/Debug.java Sat Aug 14 07:25:41 2010 @@ -12,6 +12,7 @@ */ package org.mmtk.vm; +import org.mmtk.plan.TraceLocal; import org.vmmagic.pragma.Uninterruptible; import org.vmmagic.unboxed.Address; import org.vmmagic.unboxed.ObjectReference; @@ -31,14 +32,14 @@ /** * A modbuf (object remembering barrier) entry has been * traced during collection. - * @param object + * @param object The modbuf entry */ public void modbufEntry(ObjectReference object) { } /** * A remset (slot remembering barrier) entry has been * traced during collection. - * @param slot + * @param slot The remset entry */ public void remsetEntry(Address slot) { } @@ -46,8 +47,8 @@ * An array remset entry has been traced during collection. Implicitly * the slots from start (inclusive) through to guard (non-inclusive) * are traced as remset entries - * @param start - * @param guard + * @param start The entry start address + * @param guard The guard */ public void arrayRemsetEntry(Address start, Address guard) { } @@ -74,6 +75,58 @@ */ public void mutatorPhase(short phaseId, int ordinal, boolean before) { } + /** + * Trace an object during GC + * + * *** Non-standard, requires plumbing into a collector during debugging *** + * + * @param trace The trace being performed + * @param object The object + */ + public void traceObject(TraceLocal trace, ObjectReference object) { } + + /** + * An entry has been inserted at the head of a queue + * + * *** Non-standard, requires plumbing into a collector during debugging *** + * + * @param queueName The name of the queue + * @param value The value + */ + public void queueHeadInsert(String queueName, Address value) { + } + + /** + * An entry has been inserted at the head of a queue + * + * *** Non-standard, requires plumbing into a collector during debugging *** + * + * @param queueName The name of the queue + * @param value The value + */ + public void queueTailInsert(String queueName, Address value) { + } + + /** + * An entry has been inserted at the head of a queue + * + * *** Non-standard, requires plumbing into a collector during debugging *** + * + * @param queueName The name of the queue + * @param value The value + */ + public void queueHeadRemove(String queueName, Address value) { } + + /** + * An entry has been inserted at the head of a queue + * + * *** Non-standard, requires plumbing into a collector during debugging *** + * + * @param queueName The name of the queue + * @param value The value + */ + public void queueTailRemove(String queueName, Address value) { } + /* * NOTE: These methods should not be called by anything other than the * reflective mechanisms in org.mmtk.vm.VM, and are not implemented by Modified: vmkit/trunk/mmtk/java/src/org/mmtk/vm/Statistics.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/vm/Statistics.java?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/vm/Statistics.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/vm/Statistics.java Sat Aug 14 07:25:41 2010 @@ -12,10 +12,12 @@ */ package org.mmtk.vm; +import org.vmmagic.pragma.Interruptible; import org.vmmagic.pragma.Uninterruptible; - at Uninterruptible public abstract class Statistics { + at Uninterruptible +public abstract class Statistics { /** * Returns the number of collections that have occurred. * @@ -54,26 +56,13 @@ public abstract long cycles(); /** - * Initialize performance counters - * - * @param metric An integer identifying the metric being read + * Initialize performance events */ - public abstract void perfCtrInit(int metric); + @Interruptible + public abstract void perfEventInit(String events); /** - * Read the current cycle count from the perfctr libraries - * - * @return the current cycle count from the perfctr libraries + * Read a performance event value */ - public abstract long perfCtrReadCycles(); - - /** - * Read the current event count for the metric being measured by the - * perfctr libraries - * - * @return the current event count for the metric being measured by the - * perfctr libraries - */ - public abstract long perfCtrReadMetric(); - + public abstract void perfEventRead(int counter, long[] values); } Modified: vmkit/trunk/mmtk/mmtk-j3/Statistics.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Statistics.cpp?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-j3/Statistics.cpp (original) +++ vmkit/trunk/mmtk/mmtk-j3/Statistics.cpp Sat Aug 14 07:25:41 2010 @@ -15,10 +15,6 @@ using namespace j3; -extern "C" void Java_org_j3_mmtk_Statistics_perfCtrInit__I (JavaObject* S, sint32 val) { - // Implement me -} - extern "C" int64_t Java_org_j3_mmtk_Statistics_cycles__ (JavaObject* S) { return 0; } @@ -43,10 +39,8 @@ return 0; } -extern "C" int64_t Java_org_j3_mmtk_Statistics_perfCtrReadCycles__ (JavaObject* S) { - return 0; +extern "C" void Java_org_j3_mmtk_Statistics_perfEventInit__Ljava_lang_String_2(JavaObject* S, JavaObject* Str) { } -extern "C" int64_t Java_org_j3_mmtk_Statistics_perfCtrReadMetric__ (JavaObject* S) { - return 0; +extern "C" void Java_org_j3_mmtk_Statistics_perfEventRead__I_3J(JavaObject* S, int id, int64_t* values) { } Modified: vmkit/trunk/mmtk/mmtk-j3/VM.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/VM.cpp?rev=111072&r1=111071&r2=111072&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-j3/VM.cpp (original) +++ vmkit/trunk/mmtk/mmtk-j3/VM.cpp Sat Aug 14 07:25:41 2010 @@ -58,9 +58,5 @@ } extern "C" bool Java_org_j3_runtime_VM_verifyAssertions__ () { -#ifdef DEBUG return true; -#else - return false; -#endif } From nicolas.geoffray at lip6.fr Sun Aug 15 02:27:07 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 15 Aug 2010 09:27:07 -0000 Subject: [vmkit-commits] [vmkit] r111098 - /vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp Message-ID: <20100815092707.AE6692A6C12C@llvm.org> Author: geoffray Date: Sun Aug 15 04:27:07 2010 New Revision: 111098 URL: http://llvm.org/viewvc/llvm-project?rev=111098&view=rev Log: Provide more debugging output. Modified: vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp Modified: vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp?rev=111098&r1=111097&r2=111098&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp Sun Aug 15 04:27:07 2010 @@ -60,10 +60,11 @@ void JavaJITMethodInfo::print(void* ip, void* addr) { void* new_ip = NULL; if (ip) new_ip = isStub(ip, addr); - uint16 line = meth->lookupLineNumber((uintptr_t)ip); - fprintf(stderr, "; %p in %s.%s (line %d)", new_ip, + CodeLineInfo* info = meth->lookupCodeLineInfo((uintptr_t)ip); + fprintf(stderr, "; %p in %s.%s (line %d, bytecode %d, code start %p)", new_ip, UTF8Buffer(meth->classDef->name).cString(), - UTF8Buffer(meth->name).cString(), line); + UTF8Buffer(meth->name).cString(), info->lineNumber, + info->bytecodeIndex, meth->code); if (ip != new_ip) fprintf(stderr, " (from stub)"); fprintf(stderr, "\n"); } From nicolas.geoffray at lip6.fr Sun Aug 15 11:28:33 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 15 Aug 2010 18:28:33 -0000 Subject: [vmkit-commits] [vmkit] r111107 - in /vmkit/trunk/lib/J3/VMCore: JavaLocks.cpp JavaLocks.h Message-ID: <20100815182833.73BA62A6C12C@llvm.org> Author: geoffray Date: Sun Aug 15 13:28:33 2010 New Revision: 111107 URL: http://llvm.org/viewvc/llvm-project?rev=111107&view=rev Log: Code cleanup. No functionality change. Modified: vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp vmkit/trunk/lib/J3/VMCore/JavaLocks.h Modified: vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp?rev=111107&r1=111106&r2=111107&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp Sun Aug 15 13:28:33 2010 @@ -32,10 +32,11 @@ threadLock.lock(); // Try the freeLock list. - if (freeLock) { + if (freeLock != NULL) { res = freeLock; freeLock = res->nextFreeLock; res->nextFreeLock = 0; + assert(res->associatedObject == NULL); threadLock.unlock(); res->associatedObject = obj; } else { @@ -61,10 +62,18 @@ uint32_t internalIndex = index & BitMask; tab[internalIndex] = res; } - + // Return the lock. return res; } + +void LockSystem::deallocate(JavaLock* lock) { + lock->associatedObject = NULL; + threadLock.lock(); + lock->nextFreeLock = freeLock; + freeLock = lock; + threadLock.unlock(); +} LockSystem::LockSystem(Jnjvm* vm) { associatedVM = vm; @@ -73,6 +82,7 @@ LockTable[0] = (JavaLock**) vm->allocator.Allocate(IndexSize * sizeof(JavaLock*), "Index LockTable"); currentIndex = 0; + freeLock = NULL; } uintptr_t JavaLock::getID() { @@ -92,12 +102,34 @@ void JavaLock::release(JavaObject* obj) { llvm_gcroot(obj, 0); + assert(associatedObject && "No associated object when releasing"); assert(associatedObject == obj && "Mismatch object in lock"); if (!waitingThreads && !lockingThreads && internalLock.recursionCount() == 1) { - assert(associatedObject && "No associated object when releasing"); associatedObject->lock.initialise(); deallocate(); } internalLock.unlock(); } + +/// acquire - Acquires the internalLock. +/// +bool JavaLock::acquire(JavaObject* obj) { + llvm_gcroot(obj, 0); + + spinLock.lock(); + lockingThreads++; + spinLock.unlock(); + + internalLock.lock(); + + spinLock.lock(); + lockingThreads--; + spinLock.unlock(); + + if (associatedObject != obj) { + internalLock.unlock(); + return false; + } + return true; + } Modified: vmkit/trunk/lib/J3/VMCore/JavaLocks.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaLocks.h?rev=111107&r1=111106&r2=111107&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaLocks.h (original) +++ vmkit/trunk/lib/J3/VMCore/JavaLocks.h Sun Aug 15 13:28:33 2010 @@ -50,25 +50,7 @@ /// acquire - Acquires the internalLock. /// - bool acquire(JavaObject* obj) { - llvm_gcroot(obj, 0); - - spinLock.lock(); - lockingThreads++; - spinLock.unlock(); - - internalLock.lock(); - - spinLock.lock(); - lockingThreads--; - spinLock.unlock(); - - if (associatedObject != obj) { - internalLock.unlock(); - return false; - } - return true; - } + bool acquire(JavaObject* obj); /// tryAcquire - Tries to acquire the lock. /// @@ -106,6 +88,7 @@ associatedObject = a; waitingThreads = 0; lockingThreads = 0; + nextFreeLock = NULL; } static JavaLock* allocate(JavaObject*); @@ -159,13 +142,7 @@ /// deallocate - Put a lock in the free list lock. /// - void deallocate(JavaLock* lock) { - lock->associatedObject = NULL; - threadLock.lock(); - lock->nextFreeLock = freeLock; - freeLock = lock; - threadLock.unlock(); - } + void deallocate(JavaLock* lock); /// LockSystem - Default constructor. Initialize the table. /// From nicolas.geoffray at lip6.fr Wed Aug 18 13:25:16 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 18 Aug 2010 20:25:16 -0000 Subject: [vmkit-commits] [vmkit] r111399 - in /vmkit/trunk: include/j3/J3Intrinsics.h lib/J3/Compiler/J3Intrinsics.cpp lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/LLVMRuntime/runtime-isolate.ll lib/J3/LLVMRuntime/runtime-single.ll lib/J3/VMCore/JavaClass.h Message-ID: <20100818202516.EA61F2A6C12C@llvm.org> Author: geoffray Date: Wed Aug 18 15:25:16 2010 New Revision: 111399 URL: http://llvm.org/viewvc/llvm-project?rev=111399&view=rev Log: Don't use a thin lock for class locks: it is not worth it to complicate the code of the ThinLock implementation. Modified: vmkit/trunk/include/j3/J3Intrinsics.h vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/trunk/lib/J3/LLVMRuntime/runtime-isolate.ll vmkit/trunk/lib/J3/LLVMRuntime/runtime-single.ll vmkit/trunk/lib/J3/VMCore/JavaClass.h Modified: vmkit/trunk/include/j3/J3Intrinsics.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/J3Intrinsics.h?rev=111399&r1=111398&r2=111399&view=diff ============================================================================== --- vmkit/trunk/include/j3/J3Intrinsics.h (original) +++ vmkit/trunk/include/j3/J3Intrinsics.h Wed Aug 18 15:25:16 2010 @@ -128,7 +128,6 @@ llvm::Constant* OffsetObjectSizeInClassConstant; llvm::Constant* OffsetVTInClassConstant; llvm::Constant* OffsetTaskClassMirrorInClassConstant; - llvm::Constant* OffsetVirtualMethodsInClassConstant; llvm::Constant* OffsetStaticInstanceInTaskClassMirrorConstant; llvm::Constant* OffsetInitializedInTaskClassMirrorConstant; llvm::Constant* OffsetStatusInTaskClassMirrorConstant; Modified: vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp?rev=111399&r1=111398&r2=111399&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp Wed Aug 18 15:25:16 2010 @@ -138,8 +138,6 @@ OffsetObjectSizeInClassConstant = constantOne; OffsetVTInClassConstant = ConstantInt::get(Type::getInt32Ty(Context), 7); OffsetTaskClassMirrorInClassConstant = constantThree; - OffsetVirtualMethodsInClassConstant = - ConstantInt::get(Type::getInt32Ty(Context), 9); OffsetStaticInstanceInTaskClassMirrorConstant = constantThree; OffsetStatusInTaskClassMirrorConstant = constantZero; OffsetInitializedInTaskClassMirrorConstant = constantOne; Modified: vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=111399&r1=111398&r2=111399&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Aug 18 15:25:16 2010 @@ -1043,9 +1043,6 @@ TempElts.clear(); ClassElts.push_back(ConstantArray::get(ATy, CStr, 1)); - // thinlock - ClassElts.push_back(Constant::getNullValue(JavaIntrinsics.ptrType)); - if (cl->nbVirtualFields + cl->nbStaticFields) { ATy = ArrayType::get(JavaIntrinsics.JavaFieldType->getContainedType(0), cl->nbVirtualFields + cl->nbStaticFields); Modified: vmkit/trunk/lib/J3/LLVMRuntime/runtime-isolate.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/LLVMRuntime/runtime-isolate.ll?rev=111399&r1=111398&r2=111399&view=diff ============================================================================== --- vmkit/trunk/lib/J3/LLVMRuntime/runtime-isolate.ll (original) +++ vmkit/trunk/lib/J3/LLVMRuntime/runtime-isolate.ll Wed Aug 18 15:25:16 2010 @@ -9,7 +9,7 @@ %VT* } -%JavaClass = type { %JavaCommonClass, i32, i32, [32 x %TaskClassMirror], i8*, +%JavaClass = type { %JavaCommonClass, i32, i32, [32 x %TaskClassMirror], %JavaField*, i16, %JavaField*, i16, %JavaMethod*, i16, %JavaMethod*, i16, i8*, %ArrayUInt8*, i8*, %Attribut*, i16, %JavaClass**, i16, %JavaClass*, i16, i8, i8, i32, i32 } Modified: vmkit/trunk/lib/J3/LLVMRuntime/runtime-single.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/LLVMRuntime/runtime-single.ll?rev=111399&r1=111398&r2=111399&view=diff ============================================================================== --- vmkit/trunk/lib/J3/LLVMRuntime/runtime-single.ll (original) +++ vmkit/trunk/lib/J3/LLVMRuntime/runtime-single.ll Wed Aug 18 15:25:16 2010 @@ -6,7 +6,7 @@ %JavaClass**, i16, %UTF8*, %JavaClass*, i8*, %VT* } -%JavaClass = type { %JavaCommonClass, i32, i32, [1 x %TaskClassMirror], i8*, +%JavaClass = type { %JavaCommonClass, i32, i32, [1 x %TaskClassMirror], %JavaField*, i16, %JavaField*, i16, %JavaMethod*, i16, %JavaMethod*, i16, i8*, %ArrayUInt8*, i8*, %Attribut*, i16, %JavaClass**, i16, %JavaClass*, i16, i8, i8, i32, i32 } Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.h?rev=111399&r1=111398&r2=111399&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaClass.h (original) +++ vmkit/trunk/lib/J3/VMCore/JavaClass.h Wed Aug 18 15:25:16 2010 @@ -404,67 +404,6 @@ /// class Class : public CommonClass { -private: - - /// FatLock - This class is the inflated lock of Class instances. It should - /// be very rare that such locks are allocated. - class FatLock : public mvm::PermanentObject { - public: - /// lockVar - When multiple threads want to load/resolve/initialize a class, - /// they must be synchronized so that these steps are only performed once - /// for a given class. - mvm::LockRecursive lockVar; - - /// condVar - Used to wake threads waiting on the load/resolve/initialize - /// process of this class, done by another thread. - mvm::Cond condVar; - - bool owner() { - return lockVar.selfOwner(); - } - - mvm::Thread* getOwner() { - return lockVar.getOwner(); - } - - static FatLock* allocate(UserCommonClass* cl) { - return new(cl->classLoader->allocator, "Class fat lock") FatLock(); - } - - uintptr_t getID() { - return (((uintptr_t)this) >> 1) | mvm::FatMask; - } - - static FatLock* getFromID(uintptr_t id) { - return (FatLock*)(id << 1); - } - - void deallocate() { - // Too bad, I can't deallocate it because it is in permanent memory. - } - - bool acquire(CommonClass* cl) { - lockVar.lock(); - return true; - } - - void acquireAll(uint32 nb) { - lockVar.lockAll(nb); - } - - void release(CommonClass* cl) { - lockVar.unlock(); - } - - void broadcast() { - condVar.broadcast(); - } - - void wait() { - condVar.wait(&lockVar); - } - }; - public: /// virtualSize - The size of instances of this class. @@ -480,11 +419,6 @@ /// TaskClassMirror IsolateInfo[NR_ISOLATES]; - /// lock - The lock of this class. It should be very rare that this lock - /// inflates. - /// - mvm::ThinLock lock; - /// virtualFields - List of all the virtual fields defined in this class. /// This does not contain non-redefined super fields. JavaField* virtualFields; @@ -568,6 +502,10 @@ /// staticSize - The size of the static instance of this class. /// uint32 staticSize; + + /// lock - The lock of this class. + mvm::LockRecursive lock; + mvm::Cond condition; /// getVirtualSize - Get the virtual size of instances of this class. /// @@ -751,27 +689,26 @@ /// acquire - Acquire this class lock. /// void acquire() { - lock.acquire(this); + lock.lock(); } /// release - Release this class lock. /// void release() { - lock.release(this); + lock.unlock(); } /// waitClass - Wait for the class to be loaded/initialized/resolved. /// void waitClass() { - FatLock* FL = lock.changeToFatlock(this); - FL->wait(); + condition.wait(&lock); } /// broadcastClass - Unblock threads that were waiting on the class being /// loaded/initialized/resolved. /// void broadcastClass() { - lock.broadcast(); + condition.broadcast(); } #ifndef ISOLATE From nicolas.geoffray at lip6.fr Sun Aug 22 03:03:36 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 22 Aug 2010 10:03:36 -0000 Subject: [vmkit-commits] [vmkit] r111775 - in /vmkit/trunk: include/mvm/GC/GC.h include/mvm/Threads/Locks.h include/mvm/VirtualMachine.h lib/J3/VMCore/JavaLocks.cpp lib/J3/VMCore/JavaLocks.h lib/J3/VMCore/JavaObject.cpp lib/J3/VMCore/JavaObject.h lib/J3/VMCore/Jnjvm.h lib/Mvm/CommonThread/ctlock.cpp mmtk/mmtk-j3/Memory.cpp mmtk/mmtk-j3/ObjectModel.cpp mmtk/mmtk-j3/VM.cpp Message-ID: <20100822100336.AC0EA2A6C12C@llvm.org> Author: geoffray Date: Sun Aug 22 05:03:36 2010 New Revision: 111775 URL: http://llvm.org/viewvc/llvm-project?rev=111775&view=rev Log: Put the thin lock implementation in a cpp file instead of a .h. Also remove the templated version. Now a thin lock can only be associated with a gc object. Modified: vmkit/trunk/include/mvm/GC/GC.h vmkit/trunk/include/mvm/Threads/Locks.h vmkit/trunk/include/mvm/VirtualMachine.h vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp vmkit/trunk/lib/J3/VMCore/JavaLocks.h vmkit/trunk/lib/J3/VMCore/JavaObject.cpp vmkit/trunk/lib/J3/VMCore/JavaObject.h vmkit/trunk/lib/J3/VMCore/Jnjvm.h vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp vmkit/trunk/mmtk/mmtk-j3/Memory.cpp vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp vmkit/trunk/mmtk/mmtk-j3/VM.cpp Modified: vmkit/trunk/include/mvm/GC/GC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/GC/GC.h?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/include/mvm/GC/GC.h (original) +++ vmkit/trunk/include/mvm/GC/GC.h Sun Aug 22 05:03:36 2010 @@ -19,6 +19,7 @@ public: virtual ~gcRoot() {} virtual void tracer(uintptr_t closure) {} + uintptr_t header; /// getVirtualTable - Returns the virtual table of this object. /// Modified: vmkit/trunk/include/mvm/Threads/Locks.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Locks.h?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/include/mvm/Threads/Locks.h (original) +++ vmkit/trunk/include/mvm/Threads/Locks.h Sun Aug 22 05:03:36 2010 @@ -24,6 +24,8 @@ #define llvm_gcroot(a, b) #endif +class gc; + namespace mvm { extern "C" uint8 llvm_atomic_cmp_swap_i8(uint8* ptr, uint8 cmp, @@ -71,6 +73,7 @@ #endif class Cond; +class FatLock; class LockNormal; class LockRecursive; class Thread; @@ -185,195 +188,35 @@ void lockAll(int count); }; -class FatLockNoGC { -public: - static void gcroot(void* val, void* unused) - __attribute__ ((always_inline)) {} - - static uintptr_t mask() { - return 0; - } -}; - -class FatLockWithGC { -public: - static void gcroot(void* val, void* unused) - __attribute__ ((always_inline)) { - llvm_gcroot(val, unused); - } - - static uintptr_t mask() { - return NonLockBitsMask; - } -}; - -/// ThinLock - This class is an implementation of thin locks. The template class -/// TFatLock is a virtual machine specific fat lock. -/// -template class ThinLock { public: - uintptr_t lock; - /// overflowThinlock - Change the lock of this object to a fat lock because - /// we have reached 0xFF locks. - void overflowThinLock(Owner* O) { - IsGC::gcroot(O, 0); - TFatLock* obj = TFatLock::allocate(O); - obj->acquireAll((ThinCountMask >> ThinCountShift) + 1); - uintptr_t oldLock = lock; - lock = obj->getID() | (oldLock & IsGC::mask()); - } - /// initialise - Initialise the value of the lock. /// - void initialise() { - lock = lock & IsGC::mask(); - } - - /// ThinLock - Calls initialize. - ThinLock() { - initialise(); - } + static void initialise(gc* object); + + /// overflowThinlock - Change the lock of this object to a fat lock because + /// we have reached 0xFF locks. + static void overflowThinLock(gc* object); /// changeToFatlock - Change the lock of this object to a fat lock. The lock /// may be in a thin lock or fat lock state. - TFatLock* changeToFatlock(Owner* O) { - IsGC::gcroot(O, 0); - if (!(lock & FatMask)) { - TFatLock* obj = TFatLock::allocate(O); - uint32 count = (lock & ThinCountMask) >> ThinCountShift; - obj->acquireAll(count + 1); - uintptr_t oldLock = lock; - lock = obj->getID() | (oldLock & IsGC::mask()); - return obj; - } else { - TFatLock* res = TFatLock::getFromID(lock); - assert(res && "Lock deallocated while held."); - return res; - } - } + static FatLock* changeToFatlock(gc* object); /// acquire - Acquire the lock. - void acquire(Owner* O) { - IsGC::gcroot(O, 0); -start: - uint64_t id = mvm::Thread::get()->getThreadID(); - uintptr_t oldValue = lock; - uintptr_t newValue = id | (lock & IsGC::mask()); - uintptr_t val = __sync_val_compare_and_swap(&lock, oldValue & IsGC::mask(), - newValue); - - if (val != (oldValue & IsGC::mask())) { - //fat! - if (!(val & FatMask)) { - if ((val & Thread::IDMask) == id) { - if ((val & ThinCountMask) != ThinCountMask) { - lock += ThinCountAdd; - } else { - overflowThinLock(O); - } - } else { - TFatLock* obj = TFatLock::allocate(O); - uintptr_t val = obj->getID(); -loop: - while (lock & ~IsGC::mask()) { - if (lock & FatMask) { - obj->deallocate(); - goto end; - } - else mvm::Thread::yield(); - } - - oldValue = lock; - newValue = val | (lock & IsGC::mask()); - uintptr_t test = __sync_val_compare_and_swap(&lock, - oldValue & IsGC::mask(), - newValue); - if (test != (oldValue & IsGC::mask())) goto loop; - if (!obj->acquire(O)) goto start; - } - } else { - -end: - TFatLock* obj = TFatLock::getFromID(lock); - if (obj) { - if (!obj->acquire(O)) goto start; - } else { - goto start; - } - } - } - - assert(owner() && "Not owner after quitting acquire!"); - } + static void acquire(gc* object); /// release - Release the lock. - void release(Owner* O) { - IsGC::gcroot(O, 0); - assert(owner() && "Not owner when entering release!"); - uint64 id = mvm::Thread::get()->getThreadID(); - if ((lock & ~IsGC::mask()) == id) { - lock = lock & IsGC::mask(); - } else if (lock & FatMask) { - TFatLock* obj = TFatLock::getFromID(lock); - assert(obj && "Lock deallocated while held."); - obj->release(O); - } else { - lock -= ThinCountAdd; - } - } + static void release(gc* object); - /// broadcast - Wakes up all threads waiting for this lock. - /// - void broadcast() { - if (lock & FatMask) { - TFatLock* obj = TFatLock::getFromID(lock); - assert(obj && "Lock deallocated while held."); - obj->broadcast(); - } - } - - /// signal - Wakes up one thread waiting for this lock. - void signal() { - if (lock & FatMask) { - TFatLock* obj = TFatLock::getFromID(lock); - assert(obj && "Lock deallocated while held."); - obj->signal(); - } - } - /// owner - Returns true if the curren thread is the owner of this object's /// lock. - bool owner() { - if (lock & FatMask) { - TFatLock* obj = TFatLock::getFromID(lock); - if (obj) return obj->owner(); - } else { - uint64 id = mvm::Thread::get()->getThreadID(); - if ((lock & Thread::IDMask) == id) return true; - } - return false; - } + static bool owner(gc* object); - mvm::Thread* getOwner() { - if (lock & FatMask) { - TFatLock* obj = TFatLock::getFromID(lock); - if (obj) return obj->getOwner(); - return 0; - } else { - return (mvm::Thread*)(lock & mvm::Thread::IDMask); - } - } + static mvm::Thread* getOwner(gc* object); /// getFatLock - Get the fat lock is the lock is a fat lock, 0 otherwise. - TFatLock* getFatLock() { - if (lock & FatMask) { - return TFatLock::getFromID(lock); - } else { - return 0; - } - } + static FatLock* getFatLock(gc* object); }; Modified: vmkit/trunk/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/VirtualMachine.h?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/include/mvm/VirtualMachine.h (original) +++ vmkit/trunk/include/mvm/VirtualMachine.h Sun Aug 22 05:03:36 2010 @@ -185,6 +185,16 @@ void scan(VirtualMachine* vm, uintptr_t closure); }; +class FatLock : public mvm::PermanentObject { +public: + virtual void deallocate() = 0; + virtual uintptr_t getID() = 0; + virtual bool acquire(gc* object) = 0; + virtual void acquireAll(gc* object, uint32_t count) = 0; + virtual void release(gc* object) = 0; + virtual mvm::Thread* getOwner() = 0; + virtual bool owner() = 0; +}; /// VirtualMachine - This class is the root of virtual machine classes. It /// defines what a VM should be. @@ -291,6 +301,9 @@ /// waitForExit - Wait until the virtual machine stops its execution. virtual void waitForExit() = 0; + virtual FatLock* allocateFatLock(gc* object) = 0; + virtual FatLock* getFatLockFromID(uintptr_t header) = 0; + static j3::JnjvmClassLoader* initialiseJVM(j3::JavaCompiler* C, bool dlLoad = true); static VirtualMachine* createJVM(j3::JnjvmClassLoader* C = 0); Modified: vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp Sun Aug 22 05:03:36 2010 @@ -13,10 +13,9 @@ using namespace j3; -JavaLock* JavaLock::allocate(JavaObject* obj) { +JavaLock* Jnjvm::allocateFatLock(gc* obj) { llvm_gcroot(obj, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); - JavaLock* res = vm->lockSystem.allocate(obj); + JavaLock* res = lockSystem.allocate((JavaObject*)obj); return res; } @@ -89,24 +88,23 @@ return (index << mvm::NonLockBits) | mvm::FatMask; } -JavaLock* JavaLock::getFromID(uintptr_t ID) { - Jnjvm* vm = JavaThread::get()->getJVM(); +JavaLock* Jnjvm::getFatLockFromID(uintptr_t ID) { if (ID & mvm::FatMask) { uint32_t index = (ID & ~mvm::FatMask) >> mvm::NonLockBits; - JavaLock* res = vm->lockSystem.getLock(index); + JavaLock* res = lockSystem.getLock(index); return res; } else { - return 0; + return NULL; } } -void JavaLock::release(JavaObject* obj) { +void JavaLock::release(gc* obj) { llvm_gcroot(obj, 0); assert(associatedObject && "No associated object when releasing"); assert(associatedObject == obj && "Mismatch object in lock"); if (!waitingThreads && !lockingThreads && internalLock.recursionCount() == 1) { - associatedObject->lock.initialise(); + mvm::ThinLock::initialise(associatedObject); deallocate(); } internalLock.unlock(); @@ -114,7 +112,7 @@ /// acquire - Acquires the internalLock. /// -bool JavaLock::acquire(JavaObject* obj) { +bool JavaLock::acquire(gc* obj) { llvm_gcroot(obj, 0); spinLock.lock(); @@ -131,5 +129,5 @@ internalLock.unlock(); return false; } - return true; - } + return true; +} Modified: vmkit/trunk/lib/J3/VMCore/JavaLocks.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaLocks.h?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaLocks.h (original) +++ vmkit/trunk/lib/J3/VMCore/JavaLocks.h Sun Aug 22 05:03:36 2010 @@ -12,6 +12,7 @@ #include "mvm/Allocator.h" #include "mvm/Threads/Locks.h" +#include "mvm/VirtualMachine.h" namespace mvm { class Thread; @@ -23,7 +24,7 @@ class JavaThread; class Jnjvm; -class JavaLock : public mvm::PermanentObject { +class JavaLock : public mvm::FatLock { friend class JavaObject; friend class LockSystem; @@ -50,7 +51,7 @@ /// acquire - Acquires the internalLock. /// - bool acquire(JavaObject* obj); + bool acquire(gc* obj); /// tryAcquire - Tries to acquire the lock. /// @@ -60,13 +61,13 @@ /// acquireAll - Acquires the lock nb times. - void acquireAll(uint32 nb) { + void acquireAll(gc* obj, uint32 nb) { internalLock.lockAll(nb); } /// release - Releases the internalLock. /// - void release(JavaObject* obj); + void release(gc* obj); /// owner - Returns if the current thread owns this internalLock. /// @@ -91,11 +92,9 @@ nextFreeLock = NULL; } - static JavaLock* allocate(JavaObject*); void deallocate(); uintptr_t getID(); - static JavaLock* getFromID(uintptr_t val); }; /// LockSystem - This class manages all Java locks used by the applications. Modified: vmkit/trunk/lib/J3/VMCore/JavaObject.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaObject.cpp?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaObject.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaObject.cpp Sun Aug 22 05:03:36 2010 @@ -28,7 +28,7 @@ llvm_gcroot(self, 0); if (!mvm::MovesObject) return (uint32_t)(long)self; - uintptr_t header = self->lock.lock; + uintptr_t header = self->header; uintptr_t GCBits = header & mvm::GCBitMask; uintptr_t val = header & mvm::HashMask; if (val != 0) { @@ -48,16 +48,16 @@ assert(val != hashCodeGenerator); do { - header = self->lock.lock; + header = self->header; if ((header & mvm::HashMask) != 0) break; uintptr_t newHeader = header | val; assert((newHeader & ~mvm::HashMask) == header); - __sync_val_compare_and_swap(&(self->lock.lock), header, newHeader); + __sync_val_compare_and_swap(&(self->header), header, newHeader); } while (true); - assert((self->lock.lock & mvm::HashMask) != 0); - assert(GCBits == (self->lock.lock & mvm::GCBitMask)); - return (self->lock.lock & mvm::HashMask) ^ (uintptr_t)getClass(self); + assert((self->header & mvm::HashMask) != 0); + assert(GCBits == (self->header & mvm::GCBitMask)); + return (self->header & mvm::HashMask) ^ (uintptr_t)getClass(self); } @@ -67,7 +67,7 @@ JavaLock* l = 0; if (owner(self)) { - l = self->lock.changeToFatlock(self); + l = (JavaLock*)mvm::ThinLock::changeToFatlock(self); JavaThread* thread = JavaThread::get(); thread->waitsOn = l; mvm::Cond& varcondThread = thread->varcond; @@ -178,7 +178,7 @@ JavaLock* l = 0; if (owner(self)) { - l = self->lock.getFatLock(); + l = (JavaLock*)mvm::ThinLock::getFatLock(self); if (l) { JavaThread* cur = l->firstThread; if (cur) { @@ -222,7 +222,7 @@ JavaLock* l = 0; if (owner(self)) { - l = self->lock.getFatLock(); + l = (JavaLock*)mvm::ThinLock::getFatLock(self); if (l) { JavaThread* cur = l->firstThread; if (cur) { Modified: vmkit/trunk/lib/J3/VMCore/JavaObject.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaObject.h?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaObject.h (original) +++ vmkit/trunk/lib/J3/VMCore/JavaObject.h Sun Aug 22 05:03:36 2010 @@ -245,10 +245,6 @@ return ((JavaVirtualTable*)self->getVirtualTable())->cl; } - /// lock - The monitor of this object. Most of the time null. - /// - mvm::ThinLock lock; - /// wait - Java wait. Makes the current thread waiting on a monitor. /// static void wait(JavaObject* self); @@ -268,11 +264,11 @@ /// static void notifyAll(JavaObject* self); - /// overflowThinLock - Notify that the thin lock has overflowed. + /// overflowmvm::ThinLock - Notify that the thin lock has overflowed. /// static void overflowThinLock(JavaObject* self) { llvm_gcroot(self, 0); - self->lock.overflowThinLock(self); + mvm::ThinLock::overflowThinLock(self); } /// instanceOf - Is this object's class of type the given class? @@ -282,20 +278,20 @@ /// acquire - Acquire the lock on this object. static void acquire(JavaObject* self) { llvm_gcroot(self, 0); - self->lock.acquire(self); + mvm::ThinLock::acquire(self); } /// release - Release the lock on this object static void release(JavaObject* self) { llvm_gcroot(self, 0); - self->lock.release(self); + mvm::ThinLock::release(self); } /// owner - Returns true if the current thread is the owner of this object's /// lock. static bool owner(JavaObject* self) { llvm_gcroot(self, 0); - return self->lock.owner(); + return mvm::ThinLock::owner(self); } #ifdef SIGSEGV_THROW_NULL @@ -308,7 +304,7 @@ /// lockObj - Get the LockObj if the lock is a fat lock. static JavaLock* lockObj(JavaObject* self) { llvm_gcroot(self, 0); - return self->lock.getFatLock(); + return (JavaLock*)mvm::ThinLock::getFatLock(self); } /// decapsulePrimitive - Based on the signature argument, decapsule Modified: vmkit/trunk/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Jnjvm.h?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/trunk/lib/J3/VMCore/Jnjvm.h Sun Aug 22 05:03:36 2010 @@ -341,6 +341,9 @@ /// virtual void waitForExit(); + virtual JavaLock* allocateFatLock(gc*); + virtual JavaLock* getFatLockFromID(uintptr_t val); + private: /// internalRemoveMethodsInFunctionMap - Removes all methods compiled by this /// class loader from the function map. Modified: vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp (original) +++ vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp Sun Aug 22 05:03:36 2010 @@ -12,6 +12,8 @@ #include "mvm/Threads/Cond.h" #include "mvm/Threads/Locks.h" #include "mvm/Threads/Thread.h" +#include "mvm/VirtualMachine.h" +#include "MvmGC.h" #include "cterror.h" #include #include @@ -186,3 +188,145 @@ return res; } + + +void ThinLock::overflowThinLock(gc* object) { + llvm_gcroot(object, 0); + FatLock* obj = Thread::get()->MyVM->allocateFatLock(object); + obj->acquireAll(object, (ThinCountMask >> ThinCountShift) + 1); + uintptr_t oldLock = object->header; + object->header = obj->getID() | (oldLock & NonLockBitsMask); +} + +/// initialise - Initialise the value of the lock. +/// +void ThinLock::initialise(gc* object) { + llvm_gcroot(object, 0); + uintptr_t oldValue = 0; + uintptr_t newValue = 0; + uintptr_t yieldedValue = 0; + do { + oldValue = object->header; + newValue = oldValue & NonLockBitsMask; + yieldedValue = __sync_val_compare_and_swap(&object->header, oldValue, newValue); + } while (yieldedValue != oldValue); +} + +FatLock* ThinLock::changeToFatlock(gc* object) { + llvm_gcroot(object, 0); + if (!(object->header & FatMask)) { + FatLock* obj = Thread::get()->MyVM->allocateFatLock(object); + uint32 count = (object->header & ThinCountMask) >> ThinCountShift; + obj->acquireAll(object, count + 1); + uintptr_t oldLock = object->header; + object->header = obj->getID() | (oldLock & NonLockBitsMask); + return obj; + } else { + FatLock* res = Thread::get()->MyVM->getFatLockFromID(object->header); + assert(res && "Lock deallocated while held."); + return res; + } +} + +void ThinLock::acquire(gc* object) { + llvm_gcroot(object, 0); +start: + uint64_t id = mvm::Thread::get()->getThreadID(); + uintptr_t oldValue = object->header; + uintptr_t newValue = id | (oldValue & NonLockBitsMask); + uintptr_t val = __sync_val_compare_and_swap(&object->header, oldValue & NonLockBitsMask, + newValue); + + if (val != (oldValue & NonLockBitsMask)) { + //fat! + if (!(val & FatMask)) { + if ((val & Thread::IDMask) == id) { + if ((val & ThinCountMask) != ThinCountMask) { + object->header += ThinCountAdd; + } else { + overflowThinLock(object); + } + } else { + FatLock* obj = Thread::get()->MyVM->allocateFatLock(object); + uintptr_t val = obj->getID(); +loop: + while (object->header & ~NonLockBitsMask) { + if (object->header & FatMask) { + obj->deallocate(); + goto end; + } + else mvm::Thread::yield(); + } + + oldValue = object->header; + newValue = val | (oldValue & NonLockBitsMask); + uintptr_t test = __sync_val_compare_and_swap(&object->header, + oldValue & NonLockBitsMask, + newValue); + if (test != (oldValue & NonLockBitsMask)) goto loop; + if (!obj->acquire(object)) goto start; + } + } else { +end: + FatLock* obj = Thread::get()->MyVM->getFatLockFromID(object->header); + if (obj) { + if (!obj->acquire(object)) goto start; + } else { + goto start; + } + } + } + + assert(owner(object) && "Not owner after quitting acquire!"); +} + +/// release - Release the lock. +void ThinLock::release(gc* object) { + llvm_gcroot(object, 0); + assert(owner(object) && "Not owner when entering release!"); + uint64 id = mvm::Thread::get()->getThreadID(); + if ((object->header & ~NonLockBitsMask) == id) { + object->header = object->header & NonLockBitsMask; + } else if (object->header & FatMask) { + FatLock* obj = Thread::get()->MyVM->getFatLockFromID(object->header); + assert(obj && "Lock deallocated while held."); + obj->release(object); + } else { + object->header -= ThinCountAdd; + } +} + +/// owner - Returns true if the curren thread is the owner of this object's +/// lock. +bool ThinLock::owner(gc* object) { + llvm_gcroot(object, 0); + if (object->header & FatMask) { + FatLock* obj = Thread::get()->MyVM->getFatLockFromID(object->header); + if (obj) return obj->owner(); + } else { + uint64 id = mvm::Thread::get()->getThreadID(); + if ((object->header & Thread::IDMask) == id) return true; + } + return false; +} + +mvm::Thread* ThinLock::getOwner(gc* object) { + llvm_gcroot(object, 0); + if (object->header & FatMask) { + FatLock* obj = Thread::get()->MyVM->getFatLockFromID(object->header); + if (obj) return obj->getOwner(); + return 0; + } else { + return (mvm::Thread*)(object->header & mvm::Thread::IDMask); + } +} + +/// getFatLock - Get the fat lock is the lock is a fat lock, 0 otherwise. +FatLock* ThinLock::getFatLock(gc* object) { + llvm_gcroot(object, 0); + if (object->header & FatMask) { + return Thread::get()->MyVM->getFatLockFromID(object->header); + } else { + return NULL; + } +} Modified: vmkit/trunk/mmtk/mmtk-j3/Memory.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Memory.cpp?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-j3/Memory.cpp (original) +++ vmkit/trunk/mmtk/mmtk-j3/Memory.cpp Sun Aug 22 05:03:36 2010 @@ -43,12 +43,12 @@ extern "C" void Java_org_j3_mmtk_Memory_mprotect__Lorg_vmmagic_unboxed_Address_2I (JavaObject* M, uintptr_t address, sint32 size) { - UNIMPLEMENTED(); + mprotect((void*)address, size, PROT_NONE); } extern "C" void Java_org_j3_mmtk_Memory_munprotect__Lorg_vmmagic_unboxed_Address_2I (JavaObject* M, uintptr_t address, sint32 size) { - UNIMPLEMENTED(); + mprotect((void*)address, size, PROT_READ | PROT_WRITE); } extern "C" void Modified: vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp (original) +++ vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp Sun Aug 22 05:03:36 2010 @@ -25,12 +25,12 @@ } extern "C" uintptr_t Java_org_j3_mmtk_ObjectModel_readAvailableBitsWord__Lorg_vmmagic_unboxed_ObjectReference_2 (JavaObject* OM, JavaObject* obj) { - return obj->lock.lock; + return obj->header; } extern "C" void Java_org_j3_mmtk_ObjectModel_writeAvailableBitsWord__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Word_2 ( JavaObject* OM, JavaObject* obj, uintptr_t val) { - obj->lock.lock = val; + obj->header = val; } extern "C" JavaObject* Java_org_j3_mmtk_ObjectModel_objectStartRef__Lorg_vmmagic_unboxed_ObjectReference_2 (JavaObject* OM, JavaObject* obj) { @@ -62,13 +62,14 @@ } extern "C" uintptr_t Java_org_j3_mmtk_ObjectModel_prepareAvailableBits__Lorg_vmmagic_unboxed_ObjectReference_2 (JavaObject* OM, JavaObject* obj) { - return obj->lock.lock; + return obj->header; } extern "C" uint8_t Java_org_j3_mmtk_ObjectModel_attemptAvailableBits__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Word_2Lorg_vmmagic_unboxed_Word_2( JavaObject* OM, JavaObject* obj, intptr_t oldValue, intptr_t newValue) { - return __sync_bool_compare_and_swap(&(obj->lock.lock), oldValue, newValue); + intptr_t val = __sync_val_compare_and_swap(&(obj->header), oldValue, newValue); + return (val == oldValue); } extern "C" void Java_org_j3_bindings_Bindings_memcpy__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2I( Modified: vmkit/trunk/mmtk/mmtk-j3/VM.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/VM.cpp?rev=111775&r1=111774&r2=111775&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-j3/VM.cpp (original) +++ vmkit/trunk/mmtk/mmtk-j3/VM.cpp Sun Aug 22 05:03:36 2010 @@ -58,5 +58,9 @@ } extern "C" bool Java_org_j3_runtime_VM_verifyAssertions__ () { +#ifdef DEBUG return true; +#else + return false; +#endif } From nicolas.geoffray at lip6.fr Sun Aug 22 10:46:47 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 22 Aug 2010 17:46:47 -0000 Subject: [vmkit-commits] [vmkit] r111781 - in /vmkit/trunk: include/mvm/Threads/Locks.h lib/Mvm/CommonThread/ctlock.cpp Message-ID: <20100822174647.419582A6C12C@llvm.org> Author: geoffray Date: Sun Aug 22 12:46:47 2010 New Revision: 111781 URL: http://llvm.org/viewvc/llvm-project?rev=111781&view=rev Log: Re-organize the thin lock code for better readability and race fixes. Modified: vmkit/trunk/include/mvm/Threads/Locks.h vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp Modified: vmkit/trunk/include/mvm/Threads/Locks.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Locks.h?rev=111781&r1=111780&r2=111781&view=diff ============================================================================== --- vmkit/trunk/include/mvm/Threads/Locks.h (original) +++ vmkit/trunk/include/mvm/Threads/Locks.h Sun Aug 22 12:46:47 2010 @@ -213,8 +213,6 @@ /// lock. static bool owner(gc* object); - static mvm::Thread* getOwner(gc* object); - /// getFatLock - Get the fat lock is the lock is a fat lock, 0 otherwise. static FatLock* getFatLock(gc* object); }; Modified: vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp?rev=111781&r1=111780&r2=111781&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp (original) +++ vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp Sun Aug 22 12:46:47 2010 @@ -189,13 +189,18 @@ return res; } - void ThinLock::overflowThinLock(gc* object) { llvm_gcroot(object, 0); FatLock* obj = Thread::get()->MyVM->allocateFatLock(object); obj->acquireAll(object, (ThinCountMask >> ThinCountShift) + 1); - uintptr_t oldLock = object->header; - object->header = obj->getID() | (oldLock & NonLockBitsMask); + uintptr_t oldValue = 0; + uintptr_t newValue = 0; + uintptr_t yieldedValue = 0; + do { + oldValue = object->header; + newValue = obj->getID() | (oldValue & NonLockBitsMask); + yieldedValue = __sync_val_compare_and_swap(&(object->header), oldValue, newValue); + } while (yieldedValue != oldValue); } /// initialise - Initialise the value of the lock. @@ -218,8 +223,14 @@ FatLock* obj = Thread::get()->MyVM->allocateFatLock(object); uint32 count = (object->header & ThinCountMask) >> ThinCountShift; obj->acquireAll(object, count + 1); - uintptr_t oldLock = object->header; - object->header = obj->getID() | (oldLock & NonLockBitsMask); + uintptr_t oldValue = 0; + uintptr_t newValue = 0; + uintptr_t yieldedValue = 0; + do { + oldValue = object->header; + newValue = obj->getID() | (oldValue & NonLockBitsMask); + yieldedValue = __sync_val_compare_and_swap(&(object->header), oldValue, newValue); + } while (yieldedValue != oldValue); return obj; } else { FatLock* res = Thread::get()->MyVM->getFatLockFromID(object->header); @@ -230,51 +241,70 @@ void ThinLock::acquire(gc* object) { llvm_gcroot(object, 0); -start: uint64_t id = mvm::Thread::get()->getThreadID(); - uintptr_t oldValue = object->header; - uintptr_t newValue = id | (oldValue & NonLockBitsMask); - uintptr_t val = __sync_val_compare_and_swap(&object->header, oldValue & NonLockBitsMask, - newValue); - - if (val != (oldValue & NonLockBitsMask)) { - //fat! - if (!(val & FatMask)) { - if ((val & Thread::IDMask) == id) { - if ((val & ThinCountMask) != ThinCountMask) { - object->header += ThinCountAdd; - } else { - overflowThinLock(object); - } - } else { - FatLock* obj = Thread::get()->MyVM->allocateFatLock(object); - uintptr_t val = obj->getID(); -loop: - while (object->header & ~NonLockBitsMask) { - if (object->header & FatMask) { - obj->deallocate(); - goto end; - } - else mvm::Thread::yield(); - } - + uintptr_t oldValue = 0; + uintptr_t newValue = 0; + uintptr_t yieldedValue = 0; + do { + oldValue = object->header & NonLockBitsMask; + newValue = oldValue | id; + yieldedValue = __sync_val_compare_and_swap(&(object->header), oldValue, newValue); + } while ((object->header & ~NonLockBitsMask) == 0); + + if (yieldedValue == oldValue) { + assert(owner(object) && "Not owner after quitting acquire!"); + return; + } + + if ((yieldedValue & Thread::IDMask) == id) { + assert(owner(object) && "Inconsistent lock"); + if ((yieldedValue & ThinCountMask) != ThinCountMask) { + do { oldValue = object->header; - newValue = val | (oldValue & NonLockBitsMask); - uintptr_t test = __sync_val_compare_and_swap(&object->header, - oldValue & NonLockBitsMask, - newValue); - if (test != (oldValue & NonLockBitsMask)) goto loop; - if (!obj->acquire(object)) goto start; - } + newValue = oldValue + ThinCountAdd; + yieldedValue = __sync_val_compare_and_swap(&(object->header), oldValue, newValue); + } while (oldValue != yieldedValue); } else { -end: + overflowThinLock(object); + } + assert(owner(object) && "Not owner after quitting acquire!"); + return; + } + + while (true) { + if (object->header & FatMask) { FatLock* obj = Thread::get()->MyVM->getFatLockFromID(object->header); - if (obj) { - if (!obj->acquire(object)) goto start; + if (obj != NULL) { + if (obj->acquire(object)) { + break; + } + } + } + + while (object->header & ~NonLockBitsMask) { + if (object->header & FatMask) { + break; } else { - goto start; + mvm::Thread::yield(); } } + + if ((object->header & ~NonLockBitsMask) == 0) { + FatLock* obj = Thread::get()->MyVM->allocateFatLock(object); + do { + oldValue = object->header & NonLockBitsMask; + newValue = oldValue | obj->getID(); + yieldedValue = __sync_val_compare_and_swap(&object->header, oldValue, newValue); + } while ((object->header & ~NonLockBitsMask) == 0); + + if (oldValue != yieldedValue) { + assert((getFatLock(object) != obj) && "Inconsistent lock"); + obj->deallocate(); + } else { + assert((getFatLock(object) == obj) && "Inconsistent lock"); + } + assert(!owner(object) && "Inconsistent lock"); + } } assert(owner(object) && "Not owner after quitting acquire!"); @@ -285,14 +315,26 @@ llvm_gcroot(object, 0); assert(owner(object) && "Not owner when entering release!"); uint64 id = mvm::Thread::get()->getThreadID(); + uintptr_t oldValue = 0; + uintptr_t newValue = 0; + uintptr_t yieldedValue = 0; if ((object->header & ~NonLockBitsMask) == id) { - object->header = object->header & NonLockBitsMask; + do { + oldValue = object->header; + newValue = oldValue & NonLockBitsMask; + yieldedValue = __sync_val_compare_and_swap(&object->header, oldValue, newValue); + } while (yieldedValue != oldValue); } else if (object->header & FatMask) { FatLock* obj = Thread::get()->MyVM->getFatLockFromID(object->header); assert(obj && "Lock deallocated while held."); obj->release(object); } else { - object->header -= ThinCountAdd; + assert(((object->header & ThinCountMask) > 0) && "Inconsistent state"); + do { + oldValue = object->header; + newValue = oldValue - ThinCountAdd; + yieldedValue = __sync_val_compare_and_swap(&(object->header), oldValue, newValue); + } while (yieldedValue != oldValue); } } @@ -302,7 +344,7 @@ llvm_gcroot(object, 0); if (object->header & FatMask) { FatLock* obj = Thread::get()->MyVM->getFatLockFromID(object->header); - if (obj) return obj->owner(); + if (obj != NULL) return obj->owner(); } else { uint64 id = mvm::Thread::get()->getThreadID(); if ((object->header & Thread::IDMask) == id) return true; @@ -310,17 +352,6 @@ return false; } -mvm::Thread* ThinLock::getOwner(gc* object) { - llvm_gcroot(object, 0); - if (object->header & FatMask) { - FatLock* obj = Thread::get()->MyVM->getFatLockFromID(object->header); - if (obj) return obj->getOwner(); - return 0; - } else { - return (mvm::Thread*)(object->header & mvm::Thread::IDMask); - } -} - /// getFatLock - Get the fat lock is the lock is a fat lock, 0 otherwise. FatLock* ThinLock::getFatLock(gc* object) { llvm_gcroot(object, 0); From nicolas.geoffray at lip6.fr Sun Aug 22 13:25:23 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sun, 22 Aug 2010 20:25:23 -0000 Subject: [vmkit-commits] [vmkit] r111784 - in /vmkit/trunk: include/j3/J3Intrinsics.h lib/J3/Compiler/J3Intrinsics.cpp lib/J3/Compiler/JavaJIT.cpp lib/J3/LLVMRuntime/runtime-default.ll lib/J3/VMCore/JavaRuntimeJIT.cpp Message-ID: <20100822202523.DA4492A6C12C@llvm.org> Author: geoffray Date: Sun Aug 22 15:25:23 2010 New Revision: 111784 URL: http://llvm.org/viewvc/llvm-project?rev=111784&view=rev Log: Only do a cas in the JIT-compiled code. Bail out to runtime if it fails. Also remove the runtime intrinsic overflowThinLock. Modified: vmkit/trunk/include/j3/J3Intrinsics.h vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp Modified: vmkit/trunk/include/j3/J3Intrinsics.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/J3Intrinsics.h?rev=111784&r1=111783&r2=111784&view=diff ============================================================================== --- vmkit/trunk/include/j3/J3Intrinsics.h (original) +++ vmkit/trunk/include/j3/J3Intrinsics.h Sun Aug 22 15:25:23 2010 @@ -108,7 +108,6 @@ llvm::Function* GetBaseClassVTFromVTFunction; llvm::Function* GetLockFunction; - llvm::Function* OverflowThinLockFunction; llvm::Function* GetFinalInt8FieldFunction; llvm::Function* GetFinalInt16FieldFunction; Modified: vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp?rev=111784&r1=111783&r2=111784&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp Sun Aug 22 15:25:23 2010 @@ -185,7 +185,6 @@ GetVTInDisplayFunction = module->getFunction("getVTInDisplay"); AquireObjectFunction = module->getFunction("j3JavaObjectAquire"); ReleaseObjectFunction = module->getFunction("j3JavaObjectRelease"); - OverflowThinLockFunction = module->getFunction("j3OverflowThinLock"); VirtualFieldLookupFunction = module->getFunction("j3VirtualFieldLookup"); StaticFieldLookupFunction = module->getFunction("j3StaticFieldLookup"); Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=111784&r1=111783&r2=111784&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Sun Aug 22 15:25:23 2010 @@ -577,62 +577,14 @@ BasicBlock* OK = createBasicBlock("synchronize passed"); BasicBlock* NotOK = createBasicBlock("synchronize did not pass"); - BasicBlock* FatLockBB = createBasicBlock("fat lock"); - BasicBlock* ThinLockBB = createBasicBlock("thin lock"); BranchInst::Create(OK, NotOK, cmp, currentBlock); + // The atomic cas did not work. currentBlock = NotOK; - - // The compare and swap did not pass, look if it's a thin lock - Value* isThin = BinaryOperator::CreateAnd(atomic, intrinsics->constantFatMask, "", - currentBlock); - cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, isThin, - intrinsics->constantPtrZero, ""); - - BranchInst::Create(ThinLockBB, FatLockBB, cmp, currentBlock); - - // It's a thin lock. Look if we're the owner of this lock. - currentBlock = ThinLockBB; - Value* idMask = ConstantInt::get(intrinsics->pointerSizeType, mvm::Thread::IDMask); - Value* cptMask = ConstantInt::get(intrinsics->pointerSizeType, mvm::ThinCountMask); - Value* IdInLock = BinaryOperator::CreateAnd(atomic, idMask, "", currentBlock); - Value* owner = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, threadId, - IdInLock, ""); - - BasicBlock* OwnerBB = createBasicBlock("owner thread"); - - BranchInst::Create(OwnerBB, FatLockBB, owner, currentBlock); - currentBlock = OwnerBB; - - // OK, we are the owner, now check if the counter will overflow. - Value* count = BinaryOperator::CreateAnd(atomic, cptMask, "", currentBlock); - cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_ULT, count, cptMask, ""); - - BasicBlock* IncCounterBB = createBasicBlock("Increment counter"); - BasicBlock* OverflowCounterBB = createBasicBlock("Overflow counter"); - - BranchInst::Create(IncCounterBB, OverflowCounterBB, cmp, currentBlock); - currentBlock = IncCounterBB; - - // The counter will not overflow, increment it. - Value* One = ConstantInt::get(intrinsics->pointerSizeType, mvm::ThinCountAdd); - Value* Add = BinaryOperator::CreateAdd(One, atomic, "", currentBlock); - new StoreInst(Add, lockPtr, false, currentBlock); - BranchInst::Create(OK, currentBlock); - - currentBlock = OverflowCounterBB; - - // The counter will overflow, call this function to create a new lock, - // lock it 0x101 times, and pass. - CallInst::Create(intrinsics->OverflowThinLockFunction, obj, "", - currentBlock); - BranchInst::Create(OK, currentBlock); - - currentBlock = FatLockBB; - // Either it's a fat lock or there is contention. CallInst::Create(intrinsics->AquireObjectFunction, obj, "", currentBlock); BranchInst::Create(OK, currentBlock); + currentBlock = OK; } @@ -647,7 +599,7 @@ "", currentBlock); Value* lock = new LoadInst(lockPtr, "", currentBlock); Value* NonLockBitsMask = ConstantInt::get( - intrinsics->pointerSizeType, ~mvm::NonLockBitsMask); + intrinsics->pointerSizeType, mvm::NonLockBitsMask); Value* lockedMask = BinaryOperator::CreateAnd( lock, NonLockBitsMask, "", currentBlock); @@ -656,54 +608,34 @@ threadId = new PtrToIntInst(threadId, intrinsics->pointerSizeType, "", currentBlock); - Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, lockedMask, - threadId, ""); - - - BasicBlock* EndUnlock = createBasicBlock("end unlock"); - BasicBlock* LockedOnceBB = createBasicBlock("desynchronize thin lock"); - BasicBlock* NotLockedOnceBB = - createBasicBlock("simple desynchronize did not pass"); - BasicBlock* FatLockBB = createBasicBlock("fat lock"); - BasicBlock* ThinLockBB = createBasicBlock("thin lock"); - - BranchInst::Create(LockedOnceBB, NotLockedOnceBB, cmp, currentBlock); - - // Locked once, set zero - currentBlock = LockedOnceBB; - NonLockBitsMask = ConstantInt::get( - intrinsics->pointerSizeType, mvm::NonLockBitsMask); - lockedMask = BinaryOperator::CreateAnd( - lock, NonLockBitsMask, "", currentBlock); - new StoreInst(lockedMask, lockPtr, false, currentBlock); - BranchInst::Create(EndUnlock, currentBlock); + Value* oldValMask = BinaryOperator::CreateOr(threadId, lockedMask, "", + currentBlock); - currentBlock = NotLockedOnceBB; - // Look if the lock is thin. - Value* isThin = BinaryOperator::CreateAnd(lock, intrinsics->constantFatMask, "", - currentBlock); - cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, isThin, - intrinsics->constantPtrZero, ""); + std::vector atomicArgs; + atomicArgs.push_back(lockPtr); + atomicArgs.push_back(oldValMask); + atomicArgs.push_back(lockedMask); + + // Do the atomic compare and swap. + Value* atomic = CallInst::Create(intrinsics->llvm_atomic_lcs_ptr, + atomicArgs.begin(), atomicArgs.end(), "", + currentBlock); - BranchInst::Create(ThinLockBB, FatLockBB, cmp, currentBlock); + Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, atomic, + oldValMask, ""); - currentBlock = ThinLockBB; + BasicBlock* OK = createBasicBlock("unsynchronize passed"); + BasicBlock* NotOK = createBasicBlock("unsynchronize did not pass"); - // Decrement the counter. - Value* One = ConstantInt::get(intrinsics->pointerSizeType, mvm::ThinCountAdd); - Value* Sub = BinaryOperator::CreateSub(lock, One, "", currentBlock); - new StoreInst(Sub, lockPtr, false, currentBlock); - BranchInst::Create(EndUnlock, currentBlock); - - currentBlock = FatLockBB; + BranchInst::Create(OK, NotOK, cmp, currentBlock); - // Either it's a fat lock or there is contention. + // The atomic cas did not work. + currentBlock = NotOK; CallInst::Create(intrinsics->ReleaseObjectFunction, obj, "", currentBlock); - BranchInst::Create(EndUnlock, currentBlock); - currentBlock = EndUnlock; -} - + BranchInst::Create(OK, currentBlock); + currentBlock = OK; +} #ifdef ISOLATE_SHARING Value* JavaJIT::getStaticInstanceCtp() { Modified: vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll?rev=111784&r1=111783&r2=111784&view=diff ============================================================================== --- vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll (original) +++ vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll Sun Aug 22 15:25:23 2010 @@ -161,10 +161,6 @@ ;;; block or method. declare void @j3JavaObjectRelease(%JavaObject*) -;;; j3OverflowThinLock - Change a thin lock to a fat lock when the thin lock -;;; overflows -declare void @j3OverflowThinLock(%JavaObject*) - ;;; isAssignableFrom - Returns if a type is a subtype of another type. declare i1 @isAssignableFrom(%VT*, %VT*) readnone Modified: vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=111784&r1=111783&r2=111784&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp Sun Aug 22 15:25:23 2010 @@ -385,12 +385,6 @@ return JavaThread::get()->throwException(obj); } -// Never throws. -extern "C" void j3OverflowThinLock(JavaObject* obj) { - llvm_gcroot(obj, 0); - JavaObject::overflowThinLock(obj); -} - // Creates a Java object and then throws it. extern "C" JavaObject* j3NullPointerException() { JavaObject *exc = 0; From nicolas.geoffray at lip6.fr Sat Aug 28 04:53:31 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sat, 28 Aug 2010 11:53:31 -0000 Subject: [vmkit-commits] [vmkit] r112368 - /vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Message-ID: <20100828115331.4095F2A6C12C@llvm.org> Author: geoffray Date: Sat Aug 28 06:53:31 2010 New Revision: 112368 URL: http://llvm.org/viewvc/llvm-project?rev=112368&view=rev Log: Remove SA_ONSTACK flag. Modified: vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Modified: vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp?rev=112368&r1=112367&r2=112368&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Sat Aug 28 06:53:31 2010 @@ -288,7 +288,7 @@ struct sigaction sa; sigset_t mask; sigfillset(&mask); - sa.sa_flags = SA_ONSTACK | SA_SIGINFO; + sa.sa_flags = SA_SIGINFO; sa.sa_mask = mask; sa.sa_sigaction = sigsegvHandler; sigaction(SIGSEGV, &sa, NULL); From nicolas.geoffray at lip6.fr Sat Aug 28 08:06:13 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sat, 28 Aug 2010 15:06:13 -0000 Subject: [vmkit-commits] [vmkit] r112371 - in /vmkit/trunk: include/mvm/JIT.h include/mvm/MethodInfo.h lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/VMCore/JavaClass.cpp lib/J3/VMCore/JavaClass.h lib/Mvm/Compiler/JIT.cpp Message-ID: <20100828150614.03AC72A6C12C@llvm.org> Author: geoffray Date: Sat Aug 28 10:06:13 2010 New Revision: 112371 URL: http://llvm.org/viewvc/llvm-project?rev=112371&view=rev Log: Add a MetaInfo on MethodInfo instead of having special fields for each kind of MethodInfo. Modified: vmkit/trunk/include/mvm/JIT.h vmkit/trunk/include/mvm/MethodInfo.h vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/trunk/lib/J3/VMCore/JavaClass.cpp vmkit/trunk/lib/J3/VMCore/JavaClass.h vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Modified: vmkit/trunk/include/mvm/JIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/JIT.h?rev=112371&r1=112370&r2=112371&view=diff ============================================================================== --- vmkit/trunk/include/mvm/JIT.h (original) +++ vmkit/trunk/include/mvm/JIT.h Sat Aug 28 10:06:13 2010 @@ -212,12 +212,11 @@ }; class MvmJITMethodInfo : public JITMethodInfo { - const llvm::Function* Func; public: virtual void print(void* ip, void* addr); MvmJITMethodInfo(llvm::GCFunctionInfo* GFI, const llvm::Function* F) : JITMethodInfo(GFI) { - Func = F; + MetaInfo = const_cast(F); MethodType = 0; } }; Modified: vmkit/trunk/include/mvm/MethodInfo.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/MethodInfo.h?rev=112371&r1=112370&r2=112371&view=diff ============================================================================== --- vmkit/trunk/include/mvm/MethodInfo.h (original) +++ vmkit/trunk/include/mvm/MethodInfo.h Sat Aug 28 10:06:13 2010 @@ -25,14 +25,12 @@ if (isStub) ip = ((void**)addr)[2]; return ip; } - - virtual void* getMetaInfo() { - abort(); - return NULL; - } + void* getMetaInfo() const { return MetaInfo; } + unsigned MethodType; void* InstructionPointer; + void* MetaInfo; }; class CamlFrame { Modified: vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp?rev=112371&r1=112370&r2=112371&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp Sat Aug 28 10:06:13 2010 @@ -40,26 +40,20 @@ class JavaJITMethodInfo : public mvm::JITMethodInfo { -protected: - JavaMethod* meth; public: virtual void print(void* ip, void* addr); JavaJITMethodInfo(llvm::GCFunctionInfo* GFI, JavaMethod* m) : mvm::JITMethodInfo(GFI) { - meth = m; + MetaInfo = m; MethodType = 1; } - - virtual void* getMetaInfo() { - return meth; - } - }; void JavaJITMethodInfo::print(void* ip, void* addr) { void* new_ip = NULL; if (ip) new_ip = isStub(ip, addr); + JavaMethod* meth = (JavaMethod*)MetaInfo; CodeLineInfo* info = meth->lookupCodeLineInfo((uintptr_t)ip); fprintf(stderr, "; %p in %s.%s (line %d, bytecode %d, code start %p)", new_ip, UTF8Buffer(meth->classDef->name).cString(), Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.cpp?rev=112371&r1=112370&r2=112371&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaClass.cpp Sat Aug 28 10:06:13 2010 @@ -290,6 +290,7 @@ void JavaStaticMethodInfo::print(void* ip, void* addr) { void* new_ip = NULL; if (ip) new_ip = mvm::MethodInfo::isStub(ip, addr); + JavaMethod* meth = (JavaMethod*)MetaInfo; fprintf(stderr, "; %p in %s.%s", new_ip, UTF8Buffer(meth->classDef->name).cString(), UTF8Buffer(meth->name).cString()); Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.h?rev=112371&r1=112370&r2=112371&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaClass.h (original) +++ vmkit/trunk/lib/J3/VMCore/JavaClass.h Sat Aug 28 10:06:13 2010 @@ -898,21 +898,15 @@ }; class JavaStaticMethodInfo : public mvm::CamlMethodInfo { -protected: - JavaMethod* meth; - public: virtual void print(void* ip, void* addr); JavaStaticMethodInfo(mvm::CamlMethodInfo* super, void* ip, JavaMethod* M) : mvm::CamlMethodInfo(super != NULL ? super->CF : NULL, ip) { - meth = M; + MetaInfo = M; MethodType = 1; } - virtual void* getMetaInfo() { - return meth; - } }; class CodeLineInfo : public mvm::PermanentObject { Modified: vmkit/trunk/lib/Mvm/Compiler/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/JIT.cpp?rev=112371&r1=112370&r2=112371&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original) +++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Sat Aug 28 10:06:13 2010 @@ -83,7 +83,8 @@ } void MvmJITMethodInfo::print(void* ip, void* addr) { - fprintf(stderr, "; %p in %s LLVM method\n", ip, Func->getName().data()); + fprintf(stderr, "; %p in %s LLVM method\n", ip, + ((llvm::Function*)MetaInfo)->getName().data()); } class MvmJITListener : public llvm::JITEventListener { From nicolas.geoffray at lip6.fr Mon Aug 30 13:08:26 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Mon, 30 Aug 2010 20:08:26 -0000 Subject: [vmkit-commits] [vmkit] r112508 - /vmkit/branches/precise/ Message-ID: <20100830200826.9C24E2A6C12C@llvm.org> Author: geoffray Date: Mon Aug 30 15:08:26 2010 New Revision: 112508 URL: http://llvm.org/viewvc/llvm-project?rev=112508&view=rev Log: Create a precise branch to get precise information on ip instead of doing an approximate search. Added: vmkit/branches/precise/ - copied from r112507, vmkit/trunk/