[vmkit-commits] [vmkit] r120206 - in /vmkit/trunk: ./ include/j3/ include/mvm/ include/mvm/GC/ include/mvm/Threads/ lib/J3/Classpath/ lib/J3/Compiler/ lib/J3/LLVMRuntime/ lib/J3/VMCore/ lib/Mvm/CommonThread/ lib/Mvm/Compiler/ lib/Mvm/GCMmap2/ lib/Mvm/MMTk/ lib/Mvm/Runtime/ mmtk/config/copyms/ mmtk/config/marksweep/ mmtk/java/src/org/j3/mmtk/ mmtk/mmtk-alloc/ mmtk/mmtk-j3/ tools/vmjc/ tools/vmkit/ www/

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sat Nov 27 02:07:19 PST 2010


Author: geoffray
Date: Sat Nov 27 04:07:18 2010
New Revision: 120206

URL: http://llvm.org/viewvc/llvm-project?rev=120206&view=rev
Log:
Merge with the precise branch. Collectors CopyMS and MarkSweep are now fully supported.


Added:
    vmkit/trunk/include/mvm/Threads/ObjectLocks.h
      - copied unchanged from r120199, vmkit/branches/precise/include/mvm/Threads/ObjectLocks.h
    vmkit/trunk/lib/J3/VMCore/ReferenceQueue.cpp
      - copied unchanged from r120199, vmkit/branches/precise/lib/J3/VMCore/ReferenceQueue.cpp
    vmkit/trunk/lib/J3/VMCore/ReferenceQueue.h
      - copied unchanged from r120199, vmkit/branches/precise/lib/J3/VMCore/ReferenceQueue.h
    vmkit/trunk/lib/Mvm/CommonThread/ObjectLocks.cpp
      - copied unchanged from r120199, vmkit/branches/precise/lib/Mvm/CommonThread/ObjectLocks.cpp
Removed:
    vmkit/trunk/include/mvm/CompilationUnit.h
    vmkit/trunk/lib/J3/VMCore/JavaInitialise.cpp
    vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp
    vmkit/trunk/lib/J3/VMCore/JavaLocks.h
Modified:
    vmkit/trunk/   (props changed)
    vmkit/trunk/Makefile.rules
    vmkit/trunk/include/j3/J3Intrinsics.h
    vmkit/trunk/include/j3/JavaAOTCompiler.h
    vmkit/trunk/include/j3/JavaCompiler.h
    vmkit/trunk/include/j3/JavaJITCompiler.h
    vmkit/trunk/include/j3/JavaLLVMCompiler.h
    vmkit/trunk/include/j3/LLVMMaterializer.h
    vmkit/trunk/include/mvm/GC/GC.h
    vmkit/trunk/include/mvm/JIT.h
    vmkit/trunk/include/mvm/MethodInfo.h
    vmkit/trunk/include/mvm/Threads/CollectionRV.h
    vmkit/trunk/include/mvm/Threads/Locks.h
    vmkit/trunk/include/mvm/Threads/Thread.h
    vmkit/trunk/include/mvm/VirtualMachine.h
    vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h
    vmkit/trunk/lib/J3/Classpath/ClasspathVMClassLoader.inc
    vmkit/trunk/lib/J3/Classpath/ClasspathVMRuntime.inc
    vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc
    vmkit/trunk/lib/J3/Classpath/ClasspathVMSystemProperties.inc
    vmkit/trunk/lib/J3/Classpath/ClasspathVMThread.inc
    vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc
    vmkit/trunk/lib/J3/Classpath/JavaUpcalls.cpp
    vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc
    vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp
    vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
    vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
    vmkit/trunk/lib/J3/Compiler/JavaJIT.h
    vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
    vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
    vmkit/trunk/lib/J3/Compiler/JavaLLVMCompiler.cpp
    vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp
    vmkit/trunk/lib/J3/Compiler/LLVMMaterializer.cpp
    vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp
    vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll
    vmkit/trunk/lib/J3/LLVMRuntime/runtime-mmtk-thread.ll
    vmkit/trunk/lib/J3/VMCore/JavaArray.h
    vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
    vmkit/trunk/lib/J3/VMCore/JavaClass.h
    vmkit/trunk/lib/J3/VMCore/JavaConstantPool.cpp
    vmkit/trunk/lib/J3/VMCore/JavaConstantPool.h
    vmkit/trunk/lib/J3/VMCore/JavaMetaJIT.cpp
    vmkit/trunk/lib/J3/VMCore/JavaObject.cpp
    vmkit/trunk/lib/J3/VMCore/JavaObject.h
    vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp
    vmkit/trunk/lib/J3/VMCore/JavaString.h
    vmkit/trunk/lib/J3/VMCore/JavaThread.cpp
    vmkit/trunk/lib/J3/VMCore/JavaThread.h
    vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp
    vmkit/trunk/lib/J3/VMCore/Jnjvm.h
    vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp
    vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h
    vmkit/trunk/lib/J3/VMCore/LockedMap.h
    vmkit/trunk/lib/J3/VMCore/Reader.cpp
    vmkit/trunk/lib/J3/VMCore/Reader.h
    vmkit/trunk/lib/J3/VMCore/VirtualTables.cpp
    vmkit/trunk/lib/J3/VMCore/Zip.cpp
    vmkit/trunk/lib/J3/VMCore/Zip.h
    vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp
    vmkit/trunk/lib/Mvm/CommonThread/Sigsegv.cpp
    vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp
    vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp
    vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
    vmkit/trunk/lib/Mvm/Compiler/VmkitGC.cpp
    vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
    vmkit/trunk/lib/Mvm/MMTk/MutatorThread.h
    vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp
    vmkit/trunk/lib/Mvm/Runtime/Object.cpp
    vmkit/trunk/mmtk/config/copyms/MMTkInline.inc
    vmkit/trunk/mmtk/config/copyms/ObjectHeader.h
    vmkit/trunk/mmtk/config/marksweep/MMTkInline.inc
    vmkit/trunk/mmtk/config/marksweep/ObjectHeader.h
    vmkit/trunk/mmtk/java/src/org/j3/mmtk/Barriers.java
    vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp
    vmkit/trunk/mmtk/mmtk-j3/Assert.cpp
    vmkit/trunk/mmtk/mmtk-j3/Collection.cpp
    vmkit/trunk/mmtk/mmtk-j3/Lock.cpp
    vmkit/trunk/mmtk/mmtk-j3/MMTk_Events.cpp
    vmkit/trunk/mmtk/mmtk-j3/Memory.cpp
    vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp
    vmkit/trunk/mmtk/mmtk-j3/RuntimeHelpers.cpp
    vmkit/trunk/mmtk/mmtk-j3/Scanning.cpp
    vmkit/trunk/mmtk/mmtk-j3/Strings.cpp
    vmkit/trunk/mmtk/mmtk-j3/SynchronizedCounter.cpp
    vmkit/trunk/mmtk/mmtk-j3/VM.cpp
    vmkit/trunk/tools/vmjc/vmjc.cpp
    vmkit/trunk/tools/vmkit/Launcher.cpp
    vmkit/trunk/www/get_started.html
    vmkit/trunk/www/index.html
    vmkit/trunk/www/use_aot.html

Propchange: vmkit/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 27 04:07:18 2010
@@ -1 +1,2 @@
+/vmkit/branches/precise:112509-120199
 /vmkit/branches/release_028:115466-116298

Modified: vmkit/trunk/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.rules?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/Makefile.rules (original)
+++ vmkit/trunk/Makefile.rules Sat Nov 27 04:07:18 2010
@@ -134,7 +134,7 @@
 	$(Verb) $(ANT) -buildfile $(PROJ_OBJ_ROOT)/mmtk/java/build.xml
 	$(Echo) Building $(BuildMode) $(JARNAME).jar $(notdir $@)
 	$(Verb) $(LOPT) -load=$(LibDir)/JITGCPass$(SHLIBEXT) -std-compile-opts -JITGCPass -f $(LibDir)/MMTKAlloc.bc -o $(LibDir)/MMTKAlloc.bc
-	$(Verb) $(VMJC) -std-compile-opts $(ADDITIONAL_ARGS) -load=$(LibDir)/MMTKMagic$(SHLIBEXT) -LowerMagic -verify $(PROJ_OBJ_ROOT)/mmtk/java/$(JARNAME).jar -disable-exceptions -disable-cooperativegc -with-clinit=org/mmtk/vm/VM,org/mmtk/utility/*,org/mmtk/policy/*,org/j3/config/* -Dmmtk.hostjvm=org.j3.mmtk.Factory -o $(JARNAME).bc -Dmmtk.properties=$(PROJ_SRC_ROOT)/mmtk/java/vmkit.properties -disable-stubs -assume-compiled -llvm-lazy
+	$(Verb) $(VMJC) -std-compile-opts $(ADDITIONAL_ARGS) -load=$(LibDir)/MMTKMagic$(SHLIBEXT) -LowerMagic $(PROJ_OBJ_ROOT)/mmtk/java/$(JARNAME).jar -disable-exceptions -disable-cooperativegc -with-clinit=org/mmtk/vm/VM,org/mmtk/utility/*,org/mmtk/policy/*,org/j3/config/* -Dmmtk.hostjvm=org.j3.mmtk.Factory -o $(JARNAME).bc -Dmmtk.properties=$(PROJ_SRC_ROOT)/mmtk/java/vmkit.properties -disable-stubs -assume-compiled -llvm-lazy
 	$(Verb) $(LOPT) -load=$(LibDir)/MMTKMagic$(SHLIBEXT) -std-compile-opts -LowerJavaRT -f $(JARNAME).bc -o $(JARNAME)-optimized.bc
 	$(Verb) $(LLVMLD) -r -o $(LibDir)/FinalMMTk.bc $(LibDir)/MMTKAlloc.bc $(JARNAME)-optimized.bc $(LibDir)/MMTKRuntime.bc
 	$(Verb) $(LOPT) -std-compile-opts $(LibDir)/FinalMMTk.bc -o $(LibDir)/FinalMMTk.bc

Modified: vmkit/trunk/include/j3/J3Intrinsics.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/J3Intrinsics.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/j3/J3Intrinsics.h (original)
+++ vmkit/trunk/include/j3/J3Intrinsics.h Sat Nov 27 04:07:18 2010
@@ -66,6 +66,7 @@
   llvm::Function* ResolveVirtualStubFunction;
   llvm::Function* ResolveSpecialStubFunction;
   llvm::Function* ResolveStaticStubFunction;
+  llvm::Function* ResolveInterfaceFunction;
 
 #ifndef WITHOUT_VTABLE
   llvm::Function* VirtualLookupFunction;

Modified: vmkit/trunk/include/j3/JavaAOTCompiler.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/JavaAOTCompiler.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/j3/JavaAOTCompiler.h (original)
+++ vmkit/trunk/include/j3/JavaAOTCompiler.h Sat Nov 27 04:07:18 2010
@@ -67,7 +67,7 @@
   virtual llvm::Constant* getConstantPool(JavaConstantPool* ctp);
   virtual llvm::Constant* getNativeFunction(JavaMethod* meth, void* natPtr);
   
-  virtual void setMethod(JavaMethod* meth, void* ptr, const char* name);
+  virtual void setMethod(llvm::Function* func, void* ptr, const char* name);
   
 
 #ifdef SERVICE

Modified: vmkit/trunk/include/j3/JavaCompiler.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/JavaCompiler.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/j3/JavaCompiler.h (original)
+++ vmkit/trunk/include/j3/JavaCompiler.h Sat Nov 27 04:07:18 2010
@@ -46,9 +46,6 @@
     return 0;
   }
 
-  virtual void setMethod(JavaMethod* meth, void* ptr, const char* name) {
-  }
-  
   virtual bool isStaticCompiling() {
     return false;
   }
@@ -105,10 +102,6 @@
 
   virtual ~JavaCompiler() {}
 
-  virtual mvm::StackScanner* createStackScanner() {
-    return new mvm::UnpreciseStackScanner();
-  }
-
   virtual void* loadMethod(void* handle, const char* symbol) {
     return dlsym(handle, symbol);
   }

Modified: vmkit/trunk/include/j3/JavaJITCompiler.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/JavaJITCompiler.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/j3/JavaJITCompiler.h (original)
+++ vmkit/trunk/include/j3/JavaJITCompiler.h Sat Nov 27 04:07:18 2010
@@ -10,6 +10,7 @@
 #ifndef J3_JIT_COMPILER_H
 #define J3_JIT_COMPILER_H
 
+#include "llvm/CodeGen/GCMetadata.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include "llvm/ExecutionEngine/JITEventListener.h"
 #include "j3/JavaLLVMCompiler.h"
@@ -38,9 +39,9 @@
   bool EmitFunctionName;
   JavaJITListener listener;
   llvm::ExecutionEngine* executionEngine;
-  llvm::GCStrategy* TheGCStrategy;
+  llvm::GCModuleInfo* GCInfo;
 
-  JavaJITCompiler(const std::string &ModuleID, bool trusted = false);
+  JavaJITCompiler(const std::string &ModuleID);
   ~JavaJITCompiler();
   
   virtual bool isStaticCompiling() {
@@ -72,28 +73,13 @@
   virtual llvm::Constant* getConstantPool(JavaConstantPool* ctp);
   virtual llvm::Constant* getNativeFunction(JavaMethod* meth, void* natPtr);
   
-  virtual void setMethod(JavaMethod* meth, void* ptr, const char* name);
+  virtual void setMethod(llvm::Function* func, void* ptr, const char* name);
   
-
-#ifdef SERVICE
-  virtual llvm::Value* getIsolate(Jnjvm* vm, llvm::Value* Where);
-#endif
- 
   virtual llvm::Value* addCallback(Class* cl, uint16 index, Signdef* sign,
                                    bool stat, llvm::BasicBlock* insert) = 0;
   virtual uintptr_t getPointerOrStub(JavaMethod& meth, int type) = 0;
 
-#ifdef WITH_LLVM_GCC
-  virtual mvm::StackScanner* createStackScanner() {
-    if (useCooperativeGC())
-      return new mvm::PreciseStackScanner();
-    
-    return new mvm::UnpreciseStackScanner();
-  }
-#endif
-  
   static JavaJITCompiler* CreateCompiler(const std::string& ModuleID);
-
 };
 
 class JavaJ3LazyJITCompiler : public JavaJITCompiler {
@@ -104,10 +90,10 @@
   virtual uintptr_t getPointerOrStub(JavaMethod& meth, int side);
   
   virtual JavaCompiler* Create(const std::string& ModuleID) {
-    return new JavaJ3LazyJITCompiler(ModuleID, false);
+    return new JavaJ3LazyJITCompiler(ModuleID);
   }
 
-  JavaJ3LazyJITCompiler(const std::string& ModuleID, bool trusted);
+  JavaJ3LazyJITCompiler(const std::string& ModuleID);
 };
 
 } // end namespace j3

Modified: vmkit/trunk/include/j3/JavaLLVMCompiler.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/JavaLLVMCompiler.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/j3/JavaLLVMCompiler.h (original)
+++ vmkit/trunk/include/j3/JavaLLVMCompiler.h Sat Nov 27 04:07:18 2010
@@ -80,7 +80,7 @@
   virtual bool isStaticCompiling() = 0;
   virtual bool emitFunctionName() = 0;
   virtual void* GenerateStub(llvm::Function* F) = 0;
-  void addJavaPasses(bool trusted);
+  void addJavaPasses();
   
   llvm::DIFactory* getDebugFactory() {
     return DebugFactory;
@@ -195,7 +195,7 @@
   virtual llvm::Constant* getConstantPool(JavaConstantPool* ctp) = 0;
   virtual llvm::Constant* getNativeFunction(JavaMethod* meth, void* natPtr) = 0;
   
-  virtual void setMethod(JavaMethod* meth, void* ptr, const char* name) = 0;
+  virtual void setMethod(llvm::Function* func, void* ptr, const char* name) = 0;
   
 #ifdef SERVICE
   virtual llvm::Value* getIsolate(Jnjvm* vm, llvm::Value* Where) = 0;

Modified: vmkit/trunk/include/j3/LLVMMaterializer.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/j3/LLVMMaterializer.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/j3/LLVMMaterializer.h (original)
+++ vmkit/trunk/include/j3/LLVMMaterializer.h Sat Nov 27 04:07:18 2010
@@ -41,10 +41,10 @@
   virtual uintptr_t getPointerOrStub(JavaMethod& meth, int side);
   
   virtual JavaCompiler* Create(const std::string& ModuleID) {
-    return new JavaLLVMLazyJITCompiler(ModuleID, false);
+    return new JavaLLVMLazyJITCompiler(ModuleID);
   }
 
-  JavaLLVMLazyJITCompiler(const std::string& ModuleID, bool trusted);
+  JavaLLVMLazyJITCompiler(const std::string& ModuleID);
   
   virtual ~JavaLLVMLazyJITCompiler();
   

Removed: vmkit/trunk/include/mvm/CompilationUnit.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/CompilationUnit.h?rev=120205&view=auto
==============================================================================
--- vmkit/trunk/include/mvm/CompilationUnit.h (original)
+++ vmkit/trunk/include/mvm/CompilationUnit.h (removed)
@@ -1,33 +0,0 @@
-//===---- CompilingUnit.h - A compilation unit to compile source files ----===//
-//
-//                            The VMKit project
-//
-// This file is distributed under the University of Pierre et Marie Curie 
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// A compilation unit contains a module and a module provider to compile source
-// files of a virtual machine, e.g .java files in Java.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MVM_COMPILATION_UNIT_H
-#define MVM_COMPILATION_UNIT_H
-
-#include "mvm/Object.h"
-
-namespace mvm {
-
-class MvmModule;
-
-class CompilationUnit : public mvm::Object {
-public:
-  MvmModule* TheModule;
-
-  void AddStandardCompilePasses();
-};
-}
-
-
-#endif

Modified: vmkit/trunk/include/mvm/GC/GC.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/GC/GC.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/GC/GC.h (original)
+++ vmkit/trunk/include/mvm/GC/GC.h Sat Nov 27 04:07:18 2010
@@ -34,26 +34,4 @@
   }
 };
 
-namespace mvm {
-
-class Thread;
-
-class StackScanner {
-public:
-  virtual void scanStack(mvm::Thread* th, uintptr_t closure) = 0;
-  virtual ~StackScanner() {}
-};
-
-class UnpreciseStackScanner : public StackScanner {
-public:
-  virtual void scanStack(mvm::Thread* th, uintptr_t closure);
-};
-
-class PreciseStackScanner : public StackScanner {
-public:
-  virtual void scanStack(mvm::Thread* th, uintptr_t closure);
-};
-
-}
-
 #endif

Modified: vmkit/trunk/include/mvm/JIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/JIT.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/JIT.h (original)
+++ vmkit/trunk/include/mvm/JIT.h Sat Nov 27 04:07:18 2010
@@ -30,6 +30,7 @@
   class FunctionPassManager;
   class GCFunctionInfo;
   class GCStrategy;
+  class JIT;
   class Module;
   class PointerType;
   class TargetData;
@@ -176,15 +177,13 @@
 
 
 class MvmModule {
-private:
-   static llvm::ExecutionEngine* executionEngine;
-
 public:
    static llvm::GCStrategy* TheGCStrategy;
    static mvm::LockRecursive protectEngine;
    static llvm::Module *globalModule;
    static const llvm::TargetData* TheTargetData;
    static mvm::BumpPtrAllocator* Allocator;
+   static llvm::ExecutionEngine* executionEngine;
    //static unsigned MetadataTypeKind;
 
    static uint64 getTypeSize(const llvm::Type* type);
@@ -209,15 +208,18 @@
 public:
   virtual void scan(uintptr_t closure, void* ip, void* addr);
   JITMethodInfo(llvm::GCFunctionInfo* GFI) : GCInfo(GFI) {}
+  void addToVM(VirtualMachine* vm, llvm::JIT* jit);
 };
 
 class MvmJITMethodInfo : public JITMethodInfo {
 public:
   virtual void print(void* ip, void* addr);
-  MvmJITMethodInfo(llvm::GCFunctionInfo* GFI, const llvm::Function* F) :
+  MvmJITMethodInfo(llvm::GCFunctionInfo* GFI,
+                   const llvm::Function* F,
+                   void* owner) :
     JITMethodInfo(GFI) {
       MetaInfo = const_cast<llvm::Function*>(F);
-      MethodType = 0;
+      Owner = owner;
   }
 };
 

Modified: vmkit/trunk/include/mvm/MethodInfo.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/MethodInfo.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/MethodInfo.h (original)
+++ vmkit/trunk/include/mvm/MethodInfo.h Sat Nov 27 04:07:18 2010
@@ -19,6 +19,9 @@
 public:
   virtual void print(void* ip, void* addr) = 0;
   virtual void scan(uintptr_t closure, void* ip, void* addr) = 0;
+  virtual bool isHighLevelMethod() {
+    return false;
+  }
 
   static void* isStub(void* ip, void* addr) {
     bool isStub = ((unsigned char*)ip)[0] == 0xCE;
@@ -26,11 +29,8 @@
     return ip;
   }
 
-  void* getMetaInfo() const { return MetaInfo; }
-  
-  unsigned MethodType;
-  void* InstructionPointer;
   void* MetaInfo;
+  void* Owner;
 };
 
 class CamlFrame {
@@ -45,17 +45,21 @@
 public:
   CamlFrame* CF;
   virtual void scan(uintptr_t closure, void* ip, void* addr);
-  CamlMethodInfo(CamlFrame* C, void* ip);
+  CamlMethodInfo(CamlFrame* C) : CF(C) {
+    Owner = NULL;
+    MetaInfo = NULL;
+  }
 };
 
 class StaticCamlMethodInfo : public CamlMethodInfo {
   const char* name;
 public:
   virtual void print(void* ip, void* addr);
-  StaticCamlMethodInfo(CamlFrame* CF, void* ip, const char* n) :
-    CamlMethodInfo(CF, ip) {
+  StaticCamlMethodInfo(CamlFrame* CF, const char* n) :
+    CamlMethodInfo(CF) {
+    Owner = NULL;
+    MetaInfo = NULL;
     name = n;
-    MethodType = 0;
   }
 };
 
@@ -66,7 +70,8 @@
   static DefaultMethodInfo DM;
     
   DefaultMethodInfo() {
-    MethodType = -1;
+    Owner = NULL;
+    MetaInfo = NULL;
   }
 };
 

Modified: vmkit/trunk/include/mvm/Threads/CollectionRV.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/CollectionRV.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Threads/CollectionRV.h (original)
+++ vmkit/trunk/include/mvm/Threads/CollectionRV.h Sat Nov 27 04:07:18 2010
@@ -34,7 +34,7 @@
   CollectionRV() {
     nbJoined = 0;
   }
- 
+
   void lockRV() { _lockRV.lock(); }
   void unlockRV() { _lockRV.unlock(); }
 
@@ -57,8 +57,10 @@
   virtual void synchronize() = 0;
 
   virtual void join() = 0;
-  virtual void joinAfterUncooperative() = 0;
+  virtual void joinAfterUncooperative(void* SP) = 0;
   virtual void joinBeforeUncooperative() = 0;
+
+  virtual void addThread(Thread* th) = 0;
 };
 
 class CooperativeCollectionRV : public CollectionRV {
@@ -67,8 +69,9 @@
   void synchronize();
 
   void join();
-  void joinAfterUncooperative();
+  void joinAfterUncooperative(void* SP);
   void joinBeforeUncooperative();
+  void addThread(Thread* th);
 };
 
 class UncooperativeCollectionRV : public CollectionRV {
@@ -77,8 +80,9 @@
   void synchronize();
 
   void join();
-  void joinAfterUncooperative();
+  void joinAfterUncooperative(void* SP);
   void joinBeforeUncooperative();
+  void addThread(Thread* th);
 };
 
 

Modified: vmkit/trunk/include/mvm/Threads/Locks.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Locks.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Threads/Locks.h (original)
+++ vmkit/trunk/include/mvm/Threads/Locks.h Sat Nov 27 04:07:18 2010
@@ -110,7 +110,7 @@
   
   /// lock - Acquire the lock.
   ///
-  virtual void lock() = 0;
+  virtual void lock() __attribute__ ((noinline)) = 0;
 
   /// unlock - Release the lock.
   ///
@@ -141,7 +141,7 @@
 public:
   LockNormal() : Lock() {}
 
-  virtual void lock();
+  virtual void lock() __attribute__ ((noinline));
   virtual void unlock();
 
 };
@@ -170,7 +170,7 @@
 public:
   LockRecursive() : Lock() { n = 0; }
   
-  virtual void lock();
+  virtual void lock() __attribute__ ((noinline));
   virtual void unlock();
   virtual int tryLock();
 
@@ -185,39 +185,9 @@
 
   /// lockAll - Acquire the lock count times.
   ///
-  void lockAll(int count);
+  void lockAll(int count) __attribute__ ((noinline));
 };
 
-class ThinLock {
-public:
-
-  /// initialise - Initialise the value of the lock.
-  ///
-  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.
-  static FatLock* changeToFatlock(gc* object);
-
-  /// acquire - Acquire the lock.
-  static void acquire(gc* object);
-
-  /// release - Release the lock.
-  static void release(gc* object);
-
-  /// owner - Returns true if the curren thread is the owner of this object's
-  /// lock.
-  static bool owner(gc* object);
-
-  /// getFatLock - Get the fat lock is the lock is a fat lock, 0 otherwise.
-  static FatLock* getFatLock(gc* object);
-};
-
-
 /// SpinLock - This class implements a spin lock. A spin lock is OK to use
 /// when it is held during short period of times. It is CPU expensive
 /// otherwise.

Modified: vmkit/trunk/include/mvm/Threads/Thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Thread.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Threads/Thread.h (original)
+++ vmkit/trunk/include/mvm/Threads/Thread.h Sat Nov 27 04:07:18 2010
@@ -14,6 +14,7 @@
 #include <cstdio>
 #include <stdlib.h>
 
+#include "debug.h"
 #include "types.h"
 
 #ifdef RUNTIME_DWARF_EXCEPTIONS
@@ -131,8 +132,9 @@
 
 class KnownFrame {
 public:
-  KnownFrame* previousFrame;
   void* currentFP;
+  void* currentIP;
+  KnownFrame* previousFrame;
 };
 
 
@@ -164,10 +166,6 @@
   ///
   int kill(int signo);
   
-  /// killForRendezvous - Kill the given thread for a rendezvous.
-  ///
-  void killForRendezvous();
-
   /// exit - Exit the current thread.
   ///
   static void exit(int value);
@@ -241,70 +239,18 @@
   /// a tracer.
   ///
   virtual void tracer(uintptr_t closure) {}
+  void scanStack(uintptr_t closure);
   
   void* getLastSP() { return lastSP; }
   void  setLastSP(void* V) { lastSP = V; }
   
   void joinRVBeforeEnter();
-  void joinRVAfterLeave();
+  void joinRVAfterLeave(void* savedSP);
 
-  void enterUncooperativeCode(unsigned level = 0) __attribute__ ((noinline)) {
-    if (isMvmThread()) {
-      if (!inRV) {
-        assert(!lastSP && "SP already set when entering uncooperative code");
-        ++level;
-        void* temp = __builtin_frame_address(0);
-        while (level--) temp = ((void**)temp)[0];
-        // 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");
-      }
-    }
-  }
-  
-  void enterUncooperativeCode(void* SP) {
-    if (isMvmThread()) {
-      if (!inRV) {
-        assert(!lastSP && "SP already set when entering uncooperative code");
-        // 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");
-      }
-    }
-  }
-
-  void leaveUncooperativeCode() {
-    if (isMvmThread()) {
-      if (!inRV) {
-        assert(lastSP && "No last SP when leaving uncooperative code");
-        // 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");
-      }
-    }
-  }
-
-  void* waitOnSP() {
-    // First see if we can get lastSP directly.
-    void* sp = lastSP;
-    if (sp) return sp;
-    
-    // Then loop a fixed number of iterations to get lastSP.
-    for (uint32 count = 0; count < 1000; ++count) {
-      sp = lastSP;
-      if (sp) return sp;
-    }
-    
-    // Finally, yield until lastSP is not set.
-    while ((sp = lastSP) == NULL) mvm::Thread::yield();
-
-    assert(sp != NULL && "Still no sp");
-    return sp;
-  }
+  void enterUncooperativeCode(unsigned level = 0) __attribute__ ((noinline));
+  void enterUncooperativeCode(void* SP);
+  void leaveUncooperativeCode();
+  void* waitOnSP();
 
 
   /// clearException - Clear any pending exception of the current thread.
@@ -351,11 +297,11 @@
   /// Thread. The thread object is inlined in the stack.
   ///
   void* operator new(size_t sz);
-  void operator delete(void* th) {}
+  void operator delete(void* th) { UNREACHABLE(); }
   
   /// releaseThread - Free the stack so that another thread can use it.
   ///
-  static void releaseThread(void* th);
+  static void releaseThread(mvm::Thread* th);
 
   /// routine - The function to invoke when the thread starts.
   ///
@@ -395,6 +341,8 @@
 
   void startKnownFrame(KnownFrame& F) __attribute__ ((noinline));
   void endKnownFrame();
+  void startUnknownFrame(KnownFrame& F) __attribute__ ((noinline));
+  void endUnknownFrame();
 };
 
 #ifndef RUNTIME_DWARF_EXCEPTIONS
@@ -426,17 +374,9 @@
   KnownFrame* frame;
   mvm::Thread* thread;
 
-  StackWalker(mvm::Thread* th) {
-    thread = th;
-    addr = mvm::Thread::get() == th ? (void**)FRAME_PTR() :
-                                      (void**)th->waitOnSP();
-    frame = th->lastKnownFrame;
-    assert(addr && "No address to start with");
-  }
-
+  StackWalker(mvm::Thread* th) __attribute__ ((noinline));
   void operator++();
   void* operator*();
-
   MethodInfo* get();
 
 };

Modified: vmkit/trunk/include/mvm/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/VirtualMachine.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/VirtualMachine.h (original)
+++ vmkit/trunk/include/mvm/VirtualMachine.h Sat Nov 27 04:07:18 2010
@@ -6,34 +6,22 @@
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-//
-// Ultimately, this would be like a generic way of defining a VM. But we're not
-// quite there yet.
-//
-//===----------------------------------------------------------------------===//
 
 #ifndef MVM_VIRTUALMACHINE_H
 #define MVM_VIRTUALMACHINE_H
 
 #include "mvm/Allocator.h"
-#include "mvm/MethodInfo.h"
 #include "mvm/Threads/CollectionRV.h"
-#include "mvm/Threads/Cond.h"
 #include "mvm/Threads/Locks.h"
 #include "mvm/GC/GC.h"
 
 #include <cassert>
 #include <map>
 
-namespace j3 {
-  class JavaCompiler;
-  class JnjvmClassLoader;
-}
-
-class gc;
-
 namespace mvm {
 
+class MethodInfo;
+
 class FunctionMap {
 public:
   /// Functions - Map of applicative methods to function pointers. This map is
@@ -48,192 +36,32 @@
 
   /// IPToMethodInfo - Map a code start instruction instruction to the MethodInfo.
   ///
-  MethodInfo* CodeStartToMethodInfo(void* ip) {
-    FunctionMapLock.acquire();
-    std::map<void*, MethodInfo*>::iterator I = Functions.find(ip);
-    MethodInfo* res = NULL;
-    if (I != Functions.end()) {
-      res = I->second;
-    }
-    FunctionMapLock.release();
-    return res;
-  }
-};
-
-/// StartEndFunctionMap - This map is for functions for which we have
-/// a start and end address.
-///
-class StartEndFunctionMap : public FunctionMap {
-public:
-  /// addMethodInFunctionMap - A new method pointer in the function map.
-  ///
-  void addMethodInfo(MethodInfo* meth, void* start, void* end) {
-    FunctionMapLock.acquire();
-    Functions.insert(std::make_pair(start, meth));
-    Functions.insert(std::make_pair(end, meth));
-    FunctionMapLock.release();
-  }
-  
-  /// IPToMethodInfo - Map an instruction pointer to the MethodInfo.
-  ///
-  MethodInfo* IPToMethodInfo(void* ip) {
-    FunctionMapLock.acquire();
-    std::map<void*, MethodInfo*>::iterator I = Functions.upper_bound(ip);
-    MethodInfo* res = 0;
-    if (I != Functions.end() && I != Functions.begin()) {
-      res = I->second;
-      if ((--I)->second != res) res = 0;
-    }
-    FunctionMapLock.release();
-    return res;
-  }
-};
-
-/// StartFunctionMap - This map is for static functions where getting an end
-/// address is cumbersome.
-///
-class StartFunctionMap : public FunctionMap {
-public: 
-  /// addMethodInFunctionMap - A new method pointer in the function map.
-  ///
-  void addMethodInfo(MethodInfo* meth, void* addr) {
-    FunctionMapLock.acquire();
-    Functions.insert(std::make_pair((void*)addr, meth));
-    FunctionMapLock.release();
-  }
-  
-  /// IPToMethodInfo - Map an instruction pointer to the MethodInfo.
-  ///
   MethodInfo* IPToMethodInfo(void* ip);
- 
-};
-
-class SharedStartFunctionMap : public StartFunctionMap {
-public: 
-  BumpPtrAllocator* StaticAllocator;
-  bool initialized;
-  SharedStartFunctionMap() {
-    initialized = false;
-  }
-
-  void initialize();
-};
-
-
-
-// Same values than JikesRVM
-#define INITIAL_QUEUE_SIZE 256
-#define GROW_FACTOR 2
-
-class CompilationUnit;
-class VirtualMachine;
-
-class ReferenceQueue {
-private:
-  gc** References;
-  uint32 QueueLength;
-  uint32 CurrentIndex;
-  mvm::SpinLock QueueLock;
-  uint8_t semantics;
-
-  gc* processReference(gc*, VirtualMachine*, uintptr_t closure);
-public:
-
-  static const uint8_t WEAK = 1;
-  static const uint8_t SOFT = 2;
-  static const uint8_t PHANTOM = 3;
-
-
-
-  ReferenceQueue(uint8_t s) {
-    References = new gc*[INITIAL_QUEUE_SIZE];
-    QueueLength = INITIAL_QUEUE_SIZE;
-    CurrentIndex = 0;
-    semantics = s;
-  }
 
-  ~ReferenceQueue() {
-    delete[] References;
-  }
- 
-  void addReference(gc* ref) {
-    QueueLock.acquire();
-    if (CurrentIndex >= QueueLength) {
-      uint32 newLength = QueueLength * GROW_FACTOR;
-      gc** newQueue = new gc*[newLength];
-      if (!newQueue) {
-        fprintf(stderr, "I don't know how to handle reference overflow yet!\n");
-        abort();
-      }
-      for (uint32 i = 0; i < QueueLength; ++i) newQueue[i] = References[i];
-      delete[] References;
-      References = newQueue;
-      QueueLength = newLength;
-    }
-    References[CurrentIndex++] = ref;
-    QueueLock.release();
-  }
-  
-  void acquire() {
-    QueueLock.acquire();
-  }
-
-  void release() {
-    QueueLock.release();
-  }
+  /// addMethodInfo - A new instruction pointer in the function map.
+  ///
+  void addMethodInfo(MethodInfo* meth, void* ip);
 
-  void scan(VirtualMachine* vm, uintptr_t closure);
-};
+  /// removeMethodInfos - Remove all MethodInfo owned by the given owner.
+  void removeMethodInfos(void* owner);
 
-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;
+  FunctionMap();
 };
 
 /// VirtualMachine - This class is the root of virtual machine classes. It
 /// defines what a VM should be.
 ///
 class VirtualMachine : public mvm::PermanentObject {
-  friend class ReferenceQueue;
-
 protected:
-
   VirtualMachine(mvm::BumpPtrAllocator &Alloc) :
-		allocator(Alloc),
-    WeakReferencesQueue(ReferenceQueue::WEAK),
-    SoftReferencesQueue(ReferenceQueue::SOFT), 
-    PhantomReferencesQueue(ReferenceQueue::PHANTOM) {
-#ifdef SERVICE
-    memoryLimit = ~0;
-    executionLimit = ~0;
-    GCLimit = ~0;
-    threadLimit = ~0;
-    parent = this;
-    status = 1;
-    _since_last_collection = 4*1024*1024;
-#endif
-    FinalizationQueue = new gc*[INITIAL_QUEUE_SIZE];
-    QueueLength = INITIAL_QUEUE_SIZE;
-    CurrentIndex = 0;
-
-    ToBeFinalized = new gc*[INITIAL_QUEUE_SIZE];
-    ToBeFinalizedLength = INITIAL_QUEUE_SIZE;
-    CurrentFinalizedIndex = 0;
-    
-    ToEnqueue = new gc*[INITIAL_QUEUE_SIZE];
-    ToEnqueueLength = INITIAL_QUEUE_SIZE;
-    ToEnqueueIndex = 0;
-    
+		  allocator(Alloc) {
     mainThread = 0;
     NumberOfThreads = 0;
-    if (!SharedStaticFunctions.initialized) SharedStaticFunctions.initialize();
   }
+
+  virtual ~VirtualMachine() {
+  }
+
 public:
 
   /// allocator - Bump pointer allocator to allocate permanent memory
@@ -241,6 +69,10 @@
   ///
   mvm::BumpPtrAllocator& allocator;
 
+//===----------------------------------------------------------------------===//
+// (1) Thread-related methods.
+//===----------------------------------------------------------------------===//
+
   /// mainThread - The main thread of this VM.
   ///
   mvm::Thread* mainThread;
@@ -284,239 +116,46 @@
     ThreadLock.unlock();
   }
 
+//===----------------------------------------------------------------------===//
+// (2) GC-related methods.
+//===----------------------------------------------------------------------===//
 
-  virtual void tracer(uintptr_t closure);
-
-  virtual ~VirtualMachine() {
-    if (scanner) delete scanner;
-    delete[] FinalizationQueue;
-    delete[] ToBeFinalized;
-    delete[] ToEnqueue;
-  }
-
-  /// runApplication - Run an application. The application name is in
-  /// the arguments, hence it is the virtual machine's job to parse them.
-  virtual void runApplication(int argc, char** argv) = 0;
-  
-  /// 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);
-  
-  static CompilationUnit* initialiseCLIVM();
-  static VirtualMachine* createCLIVM(CompilationUnit* C = 0);
-
-private:
-  /// WeakReferencesQueue - The queue of weak references.
-  ///
-  ReferenceQueue WeakReferencesQueue;
-
-  /// SoftReferencesQueue - The queue of soft references.
-  ///
-  ReferenceQueue SoftReferencesQueue;
-
-  /// PhantomReferencesQueue - The queue of phantom references.
-  ///
-  ReferenceQueue PhantomReferencesQueue;
-
-  
-  /// FinalizationQueueLock - A lock to protect access to the queue.
-  ///
-  mvm::SpinLock FinalizationQueueLock;
-
-  /// finalizationQueue - A list of allocated objets that contain a finalize
-  /// method.
-  ///
-  gc** FinalizationQueue;
-
-  /// CurrentIndex - Current index in the queue of finalizable objects.
-  ///
-  uint32 CurrentIndex;
-
-  /// QueueLength - Current length of the queue of finalizable objects.
-  ///
-  uint32 QueueLength;
-
-  /// growFinalizationQueue - Grow the queue of finalizable objects.
-  ///
-  void growFinalizationQueue();
-  
-  /// ToBeFinalized - List of objects that are scheduled to be finalized.
-  ///
-  gc** ToBeFinalized;
-  
-  /// ToBeFinalizedLength - Current length of the queue of objects scheduled
-  /// for finalization.
-  ///
-  uint32 ToBeFinalizedLength;
-
-  /// CurrentFinalizedIndex - The current index in the ToBeFinalized queue
-  /// that will be sceduled for finalization.
-  ///
-  uint32 CurrentFinalizedIndex;
-  
-  /// growToBeFinalizedQueue - Grow the queue of the to-be finalized objects.
-  ///
-  void growToBeFinalizedQueue();
-  
-  /// finalizationCond - Condition variable to wake up finalization threads.
-  ///
-  mvm::Cond FinalizationCond;
-
-  /// finalizationLock - Lock for the condition variable.
-  ///
-  mvm::LockNormal FinalizationLock;
-  
-  gc** ToEnqueue;
-  uint32 ToEnqueueLength;
-  uint32 ToEnqueueIndex;
-  
-  /// ToEnqueueLock - A lock to protect access to the queue.
-  ///
-  mvm::LockNormal EnqueueLock;
-  mvm::Cond EnqueueCond;
-  mvm::SpinLock ToEnqueueLock;
-  
-  void addToEnqueue(gc* obj) {
-    if (ToEnqueueIndex >= ToEnqueueLength) {
-      uint32 newLength = ToEnqueueLength * GROW_FACTOR;
-      gc** newQueue = new gc*[newLength];
-      if (!newQueue) {
-        fprintf(stderr, "I don't know how to handle reference overflow yet!\n");
-        abort();
-      }
-      for (uint32 i = 0; i < ToEnqueueLength; ++i) {
-        newQueue[i] = ToEnqueue[i];
-      }
-      delete[] ToEnqueue;
-      ToEnqueue = newQueue;
-      ToEnqueueLength = newLength;
-    }
-    ToEnqueue[ToEnqueueIndex++] = obj;
-  }
-
-public:
-  /// invokeFinalizer - Invoke the finalizer of the object. This may involve
-  /// changing the environment, e.g. going to native to Java.
-  ///
-  virtual void invokeFinalizer(gc*) {}
-  
-  /// enqueueReference - Calls the enqueue method. Should be overriden
-  /// by the VM.
-  ///
-  virtual bool enqueueReference(gc*) { return false; }
-  
-  /// finalizerStart - The start function of a finalizer. Will poll the
-  /// finalizationQueue.
-  ///
-  static void finalizerStart(mvm::Thread*);
-  
-  /// enqueueStart - The start function of a thread for references. Will poll
-  /// ToEnqueue.
-  ///
-  static void enqueueStart(mvm::Thread*);
-
-  /// addFinalizationCandidate - Add an object to the queue of objects with
-  /// a finalization method.
-  ///
-  void addFinalizationCandidate(gc*);
-  
-  /// scanFinalizationQueue - Scan objets with a finalized method and schedule
-  /// them for finalization if they are not live.
-  ///
-  void scanFinalizationQueue(uintptr_t closure);
-
-  /// wakeUpFinalizers - Wake the finalizers.
+  /// startCollection - Preliminary code before starting a GC.
   ///
-  void wakeUpFinalizers() { FinalizationCond.broadcast(); }
+  virtual void startCollection() {}
   
-  /// wakeUpEnqueue - Wake the threads for enqueueing.
+  /// endCollection - Code after running a GC.
   ///
-  void wakeUpEnqueue() { EnqueueCond.broadcast(); }
-
-  virtual void startCollection() {
-    FinalizationQueueLock.acquire();
-    ToEnqueueLock.acquire();
-    SoftReferencesQueue.acquire();
-    WeakReferencesQueue.acquire();
-    PhantomReferencesQueue.acquire();
-  }
-  
-  virtual void endCollection() {
-    FinalizationQueueLock.release();
-    ToEnqueueLock.release();
-    SoftReferencesQueue.release();
-    WeakReferencesQueue.release();
-    PhantomReferencesQueue.release();
-  }
+  virtual void endCollection() {}
   
   /// scanWeakReferencesQueue - Scan all weak references. Called by the GC
   /// before scanning the finalization queue.
   /// 
-  void scanWeakReferencesQueue(uintptr_t closure) {
-    WeakReferencesQueue.scan(this, closure);
-  }
+  virtual void scanWeakReferencesQueue(uintptr_t closure) {}
   
   /// scanSoftReferencesQueue - Scan all soft references. Called by the GC
   /// before scanning the finalization queue.
   ///
-  void scanSoftReferencesQueue(uintptr_t closure) {
-    SoftReferencesQueue.scan(this, closure);
-  }
+  virtual void scanSoftReferencesQueue(uintptr_t closure) {}
   
   /// scanPhantomReferencesQueue - Scan all phantom references. Called by the GC
   /// after the finalization queue.
   ///
-  void scanPhantomReferencesQueue(uintptr_t closure) {
-    PhantomReferencesQueue.scan(this, closure);
-  }
-  
-  /// addWeakReference - Add a weak reference to the queue.
-  ///
-  void addWeakReference(gc* ref) {
-    WeakReferencesQueue.addReference(ref);
-  }
-  
-  /// addSoftReference - Add a weak reference to the queue.
-  ///
-  void addSoftReference(gc* ref) {
-    SoftReferencesQueue.addReference(ref);
-  }
-  
-  /// addPhantomReference - Add a weak reference to the queue.
-  ///
-  void addPhantomReference(gc* ref) {
-    PhantomReferencesQueue.addReference(ref);
-  }
-
-  /// clearReferent - Clear the referent in a reference. Should be overriden
-  /// by the VM.
-  ///
-  virtual void clearReferent(gc*) {}
-
-  /// getReferent - Get the referent of the reference. Should be overriden
-  /// by the VM.
-  //
-  virtual gc** getReferentPtr(gc*) { return 0; }
-  
-  /// setReferent - Set the referent of the reference. Should be overriden
-  /// by the VM.
-  virtual void setReferent(gc* reference, gc* referent) { }
+  virtual void scanPhantomReferencesQueue(uintptr_t closure) {}
 
-public:
+  /// scanFinalizationQueue - Scan objets with a finalized method and schedule
+  /// them for finalization if they are not live.
+  /// 
+  virtual void scanFinalizationQueue(uintptr_t closure) {}
 
-  /// scanner - Scanner of threads' stacks.
+  /// addFinalizationCandidate - Add an object to the queue of objects with
+  /// a finalization method.
   ///
-  mvm::StackScanner* scanner;
+  virtual void addFinalizationCandidate(gc* object) {}
 
-  mvm::StackScanner* getScanner() {
-    return scanner;
-  }
+  /// tracer - Trace this virtual machine's GC-objects.
+  ///
+  virtual void tracer(uintptr_t closure) {}
 
   /// rendezvous - The rendezvous implementation for garbage collection.
   ///
@@ -526,38 +165,29 @@
   UncooperativeCollectionRV rendezvous;
 #endif
 
+//===----------------------------------------------------------------------===//
+// (3) Backtrace-related methods.
+//===----------------------------------------------------------------------===//
 
-  StartEndFunctionMap RuntimeFunctions;
-  static StartEndFunctionMap SharedRuntimeFunctions;
-  StartFunctionMap StaticFunctions;
-  static SharedStartFunctionMap SharedStaticFunctions;
-
-  MethodInfo* IPToMethodInfo(void* ip);
-
-#ifdef ISOLATE
-  size_t IsolateID;
-#endif
-
-#ifdef SERVICE
-  uint64_t memoryUsed;
-  uint64_t gcTriggered;
-  uint64_t executionTime;
-  uint64_t numThreads;
-  CompilationUnit* CU;
-  virtual void stopService() {}
-
-  uint64_t memoryLimit;
-  uint64_t executionLimit;
-  uint64_t threadLimit;
-  uint64_t GCLimit;
-
-  int _since_last_collection;
-  VirtualMachine* parent;
-  uint32 status; 
-#endif
+  FunctionMap FunctionsCache;
+  MethodInfo* IPToMethodInfo(void* ip) {
+    return FunctionsCache.IPToMethodInfo(ip);
+  }
+  void removeMethodInfos(void* owner) {
+    FunctionsCache.removeMethodInfos(owner);
+  }
+  
+//===----------------------------------------------------------------------===//
+// (4) Launch-related methods.
+//===----------------------------------------------------------------------===//
 
+  /// runApplication - Run an application. The application name is in
+  /// the arguments, hence it is the virtual machine's job to parse them.
+  virtual void runApplication(int argc, char** argv) = 0;
+  
+  /// waitForExit - Wait until the virtual machine stops its execution.
+  virtual void waitForExit() = 0;
 };
 
-
 } // end namespace mvm
 #endif // MVM_VIRTUALMACHINE_H

Modified: vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h Sat Nov 27 04:07:18 2010
@@ -14,6 +14,7 @@
 
 #include "JavaClass.h"
 #include "JavaObject.h"
+#include <JavaThread.h>
 
 extern "C" j3::JavaObject* internalFillInStackTrace(j3::JavaObject*);
 

Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMClassLoader.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMClassLoader.inc?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathVMClassLoader.inc (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathVMClassLoader.inc Sat Nov 27 04:07:18 2010
@@ -131,22 +131,27 @@
   BEGIN_NATIVE_EXCEPTION(0)
 
   Jnjvm* vm = JavaThread::get()->getJVM();
+
+  JnjvmClassLoader* JCL = 
+    JnjvmClassLoader::getJnjvmLoaderFromJavaObject(loader, vm);
  
+  int32_t size = JavaArray::getSize(bytes);
+  ClassBytes* classBytes = new (JCL->allocator, size) ClassBytes(size);
+  memcpy(classBytes->elements, JavaArray::getElements(bytes), size);
+   
   // Before creating a class, do a check on the bytes.  
-  Reader reader(&bytes);
+  Reader reader(classBytes);
   uint32 magic = reader.readU4();
   if (magic != Jnjvm::Magic) {
     JavaThread::get()->getJVM()->classFormatError("bad magic number");
   }
 
-  JnjvmClassLoader* JCL = 
-    JnjvmClassLoader::getJnjvmLoaderFromJavaObject(loader, vm);
   
   const UTF8* name = JavaString::javaToInternal(str, JCL->hashUTF8);
   UserCommonClass* cl = JCL->lookupClass(name);
   
   if (!cl) {
-    UserClass* cl = JCL->constructClass(name, bytes);
+    UserClass* cl = JCL->constructClass(name, classBytes);
     cl->resolveClass();
 
     res = cl->getClassDelegatee(vm, pd);
@@ -351,7 +356,7 @@
 				"org.xml.sax.helpers"
 };
 
-extern "C" ArrayObject* nativeGetBootPackages() {
+extern "C" ArrayObject* Java_java_lang_VMClassLoader_getBootPackages__() {
   ArrayObject* obj = 0;
   llvm_gcroot(obj, 0);
   

Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMRuntime.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMRuntime.inc?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathVMRuntime.inc (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathVMRuntime.inc Sat Nov 27 04:07:18 2010
@@ -150,8 +150,7 @@
 jclass clazz,
 #endif
 ) {
-  Jnjvm* vm = JavaThread::get()->getJVM();
-  vm->wakeUpFinalizers();
+  mvm::Collector::collect();
   // Sleep a bit.
   sleep(1);
   return;

Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc Sat Nov 27 04:07:18 2010
@@ -35,6 +35,8 @@
   llvm_gcroot(src, 0);
   llvm_gcroot(dst, 0);
   llvm_gcroot(cur, 0);
+  assert(src->getVirtualTable());
+  assert(dst->getVirtualTable());
 
   JavaThread* th = JavaThread::get();
   Jnjvm *vm = th->getJVM();

Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMSystemProperties.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMSystemProperties.inc?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathVMSystemProperties.inc (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathVMSystemProperties.inc Sat Nov 27 04:07:18 2010
@@ -136,7 +136,7 @@
   END_NATIVE_EXCEPTION
 }
 
-extern "C" void nativePropertiesPostInit(JavaObject* prop) {
+extern "C" void Java_gnu_classpath_VMSystemProperties_postInit__Ljava_util_Properties_2(JavaObject* prop) {
 
   llvm_gcroot(prop, 0);
 

Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMThread.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMThread.inc?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathVMThread.inc (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathVMThread.inc Sat Nov 27 04:07:18 2010
@@ -40,11 +40,16 @@
   llvm_gcroot(javaThread, 0);
 
   Jnjvm* vm = thread->getJVM();
+  // Wait some time to let the creator initialise these fields.
+  while ((thread->javaThread == NULL) || (thread->vmThread == NULL)) {
+    mvm::Thread::yield();
+  }
 
   // Ok, now that the thread is created we can set the the value of vmdata,
   // which is the JavaThread object.
   vmThread = (JavaObjectVMThread*)thread->vmThread;
   assert(vmThread && "Didn't fix the vmThread of a j3 thread");
+  assert(vmThread->getVirtualTable());
   JavaObjectVMThread::setVmdata(vmThread, thread);
   
   UserClass* vmthClass = (UserClass*)JavaObject::getClass(vmThread); 
@@ -58,7 +63,9 @@
   if (!isDaemon) {
     vm->threadSystem.enter();
   }
-  
+ 
+  assert(vmThread->getVirtualTable());
+  assert(javaThread->getVirtualTable());
   // Run the VMThread::run function
   vm->upcalls->runVMThread->invokeIntSpecial(vm, vmthClass, vmThread);
  
@@ -86,9 +93,11 @@
   javaThread = vm->upcalls->assocThread->getInstanceObjectField(vmThread);
   assert(javaThread && "VMThread with no Java equivalent");
  
-  JavaThread* th = new JavaThread(javaThread, vmThread, vm);
+  JavaThread* th = new JavaThread(vm);
   if (!th) vm->outOfMemoryError();
   th->start((void (*)(mvm::Thread*))start);
+  // Now that the thread has been created, initialise its object fields.
+  th->initialise(javaThread, vmThread);
 
   END_NATIVE_EXCEPTION
 }
@@ -112,13 +121,13 @@
     mvm::Thread::yield();
   
   JavaThread* th = (JavaThread*)field->getInstanceObjectField(vmthread);
-  th->interruptFlag = 1;
-  JavaLock* lock = th->waitsOn;
+  th->lockingThread.interruptFlag = 1;
+  mvm::FatLock* lock = th->lockingThread.waitsOn;
 
   // If the thread is blocked on a wait. We also verify nextWaiting in case
   // the thread has been notified.
-  if (lock && th->nextWaiting) {
-    th->state = JavaThread::StateInterrupted;
+  if (lock && th->lockingThread.nextWaiting) {
+    th->lockingThread.state = mvm::LockingThread::StateInterrupted;
   
     // Make sure the thread is waiting.
     uint32 locked = 0;
@@ -130,10 +139,10 @@
     }
     
     // Interrupt the thread.
-    th->varcond.signal();
+    th->lockingThread.varcond.signal();
 
     // Release the lock if we acquired it.
-    if (locked) lock->release(lock->getAssociatedObject());
+    if (locked) lock->release(lock->getAssociatedObject(), vm->lockSystem);
   }
 
   // Here we could also raise a signal for interrupting I/O
@@ -150,8 +159,8 @@
 #endif
 ) {
   JavaThread* th = JavaThread::get();
-  uint32 interrupt = th->interruptFlag;
-  th->interruptFlag = 0;
+  uint32 interrupt = th->lockingThread.interruptFlag;
+  th->lockingThread.interruptFlag = 0;
   return (jboolean)interrupt;
 }
 
@@ -168,7 +177,7 @@
   Jnjvm* vm = JavaThread::get()->getJVM();
   JavaField* field = vm->upcalls->vmdataVMThread;
   JavaThread* th = (JavaThread*)field->getInstanceObjectField(vmthread);
-  return (jboolean)th->interruptFlag;
+  return (jboolean)th->lockingThread.interruptFlag;
 }
 
 // Never throws.

Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc Sat Nov 27 04:07:18 2010
@@ -103,7 +103,7 @@
   
   // We don't have the bytes if the class was vmjc'ed.
   if (sourceAtt && cl->getBytes()) {
-    Reader reader(sourceAtt, cl->getBytesPtr());
+    Reader reader(sourceAtt, cl->bytes);
     uint16 index = reader.readU2();
     sourceName = vm->internalUTF8ToStr(cl->getConstantPool()->UTF8At(index));
   }
@@ -144,9 +144,9 @@
   sint32 index = 2;;
   while (index != JavaArray::getSize(stack)) {
     mvm::MethodInfo* MI = vm->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, index));
-    if (MI->MethodType != 1) ++index;
+    if (!MI->isHighLevelMethod()) ++index;
     else {
-      JavaMethod* meth = (JavaMethod*)MI->getMetaInfo();
+      JavaMethod* meth = (JavaMethod*)MI->MetaInfo;
       assert(meth && "Wrong stack trace");
       if (meth->classDef->isAssignableFrom(vm->upcalls->newThrowable)) {
         ++index;
@@ -159,7 +159,7 @@
   while (cur < JavaArray::getSize(stack)) {
     mvm::MethodInfo* MI = vm->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, cur));
     ++cur;
-    if (MI->MethodType == 1) ++size;
+    if (MI->isHighLevelMethod()) ++size;
   }
 
   result = (ArrayObject*)
@@ -168,8 +168,8 @@
   cur = 0;
   for (sint32 i = index; i < JavaArray::getSize(stack); ++i) {
     mvm::MethodInfo* MI = vm->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, i));
-    if (MI->MethodType == 1) {
-      JavaMethod* meth = (JavaMethod*)MI->getMetaInfo();
+    if (MI->isHighLevelMethod()) {
+      JavaMethod* meth = (JavaMethod*)MI->MetaInfo;
       ArrayObject::setElement(result, consStackElement(meth, ArrayPtr::getElement((ArrayPtr*)stack, i)), cur);
       cur++;
     }

Modified: vmkit/trunk/lib/J3/Classpath/JavaUpcalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/JavaUpcalls.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/JavaUpcalls.cpp (original)
+++ vmkit/trunk/lib/J3/Classpath/JavaUpcalls.cpp Sat Nov 27 04:07:18 2010
@@ -15,6 +15,7 @@
 #include "JavaThread.h"
 #include "JavaUpcalls.h"
 #include "Jnjvm.h"
+#include "ReferenceQueue.h"
 
 #define COMPILE_METHODS(cl) \
   for (CommonClass::method_iterator i = cl->virtualMethods.begin(), \
@@ -292,28 +293,28 @@
   CreateJavaThread(vm, vm->getFinalizerThread(), "Finalizer", SystemGroup);
   
   // Create the enqueue thread.
-  assert(vm->getEnqueueThread() && "VM did not set its enqueue thread");
-  CreateJavaThread(vm, vm->getEnqueueThread(), "Reference", SystemGroup);
+  assert(vm->getReferenceThread() && "VM did not set its enqueue thread");
+  CreateJavaThread(vm, vm->getReferenceThread(), "Reference", SystemGroup);
 }
 
-extern "C" void nativeInitWeakReference(JavaObjectReference* reference,
-                                        JavaObject* referent) {
-  
+extern "C" void Java_java_lang_ref_WeakReference__0003Cinit_0003E__Ljava_lang_Object_2(
+    JavaObjectReference* reference, JavaObject* referent) {
   llvm_gcroot(reference, 0);
   llvm_gcroot(referent, 0);
 
   BEGIN_NATIVE_EXCEPTION(0)
   
   JavaObjectReference::init(reference, referent, 0);
-  JavaThread::get()->getJVM()->addWeakReference(reference);
+  JavaThread::get()->getJVM()->getReferenceThread()->addWeakReference(reference);
 
   END_NATIVE_EXCEPTION
 
 }
 
-extern "C" void nativeInitWeakReferenceQ(JavaObjectReference* reference,
-                                         JavaObject* referent,
-                                         JavaObject* queue) {
+extern "C" void Java_java_lang_ref_WeakReference__0003Cinit_0003E__Ljava_lang_Object_2Ljava_lang_ref_ReferenceQueue_2(
+    JavaObjectReference* reference,
+    JavaObject* referent,
+    JavaObject* queue) {
   llvm_gcroot(reference, 0);
   llvm_gcroot(referent, 0);
   llvm_gcroot(queue, 0);
@@ -321,29 +322,30 @@
   BEGIN_NATIVE_EXCEPTION(0)
   
   JavaObjectReference::init(reference, referent, queue);
-  JavaThread::get()->getJVM()->addWeakReference(reference);
+  JavaThread::get()->getJVM()->getReferenceThread()->addWeakReference(reference);
   
   END_NATIVE_EXCEPTION
 
 }
 
-extern "C" void nativeInitSoftReference(JavaObjectReference* reference,
-                                        JavaObject* referent) {
+extern "C" void Java_java_lang_ref_SoftReference__0003Cinit_0003E__Ljava_lang_Object_2(
+    JavaObjectReference* reference, JavaObject* referent) {
   llvm_gcroot(reference, 0);
   llvm_gcroot(referent, 0);
   
   BEGIN_NATIVE_EXCEPTION(0)
   
   JavaObjectReference::init(reference, referent, 0);
-  JavaThread::get()->getJVM()->addSoftReference(reference);
+  JavaThread::get()->getJVM()->getReferenceThread()->addSoftReference(reference);
   
   END_NATIVE_EXCEPTION
 
 }
 
-extern "C" void nativeInitSoftReferenceQ(JavaObjectReference* reference,
-                                         JavaObject* referent,
-                                         JavaObject* queue) {
+extern "C" void Java_java_lang_ref_SoftReference__0003Cinit_0003E__Ljava_lang_Object_2Ljava_lang_ref_ReferenceQueue_2(
+    JavaObjectReference* reference,
+    JavaObject* referent,
+    JavaObject* queue) {
   llvm_gcroot(reference, 0);
   llvm_gcroot(referent, 0);
   llvm_gcroot(queue, 0);
@@ -351,15 +353,16 @@
   BEGIN_NATIVE_EXCEPTION(0)
 
   JavaObjectReference::init(reference, referent, queue);
-  JavaThread::get()->getJVM()->addSoftReference(reference);
+  JavaThread::get()->getJVM()->getReferenceThread()->addSoftReference(reference);
   
   END_NATIVE_EXCEPTION
 
 }
 
-extern "C" void nativeInitPhantomReferenceQ(JavaObjectReference* reference,
-                                            JavaObject* referent,
-                                            JavaObject* queue) {
+extern "C" void Java_java_lang_ref_PhantomReference__0003Cinit_0003E__Ljava_lang_Object_2Ljava_lang_ref_ReferenceQueue_2(
+    JavaObjectReference* reference,
+    JavaObject* referent,
+    JavaObject* queue) {
   llvm_gcroot(reference, 0);
   llvm_gcroot(referent, 0);
   llvm_gcroot(queue, 0);
@@ -367,12 +370,13 @@
   BEGIN_NATIVE_EXCEPTION(0)
   
   JavaObjectReference::init(reference, referent, queue);
-  JavaThread::get()->getJVM()->addPhantomReference(reference);
+  JavaThread::get()->getJVM()->getReferenceThread()->addPhantomReference(reference);
 
   END_NATIVE_EXCEPTION
 }
 
-extern "C" JavaString* nativeInternString(JavaString* obj) {
+extern "C" JavaString* Java_java_lang_VMString_intern__Ljava_lang_String_2(
+    JavaString* obj) {
   const ArrayUInt16* array = 0;
   JavaString* res = 0;
   llvm_gcroot(obj, 0);
@@ -392,7 +396,7 @@
   return res;
 }
 
-extern "C" uint8 nativeIsArray(JavaObjectClass* klass) {
+extern "C" uint8 Java_java_lang_Class_isArray__(JavaObjectClass* klass) {
   llvm_gcroot(klass, 0);
   UserCommonClass* cl = 0;
 
@@ -405,7 +409,7 @@
   return (uint8)cl->isArray();
 }
 
-extern "C" JavaObject* nativeGetCallingClass() {
+extern "C" JavaObject* Java_gnu_classpath_VMStackWalker_getCallingClass__() {
   
   JavaObject* res = 0;
   llvm_gcroot(res, 0);
@@ -421,7 +425,7 @@
   return res;
 }
 
-extern "C" JavaObject* nativeGetCallingClassLoader() {
+extern "C" JavaObject* Java_gnu_classpath_VMStackWalker_getCallingClassLoader__() {
   
   JavaObject* res = 0;
   llvm_gcroot(res, 0);
@@ -437,7 +441,7 @@
   return res;
 }
 
-extern "C" JavaObject* nativeFirstNonNullClassLoader() {
+extern "C" JavaObject* Java_gnu_classpath_VMStackWalker_firstNonNullClassLoader__() {
   JavaObject* res = 0;
   llvm_gcroot(res, 0);
   
@@ -451,7 +455,7 @@
   return res;
 }
 
-extern "C" JavaObject* nativeGetCallerClass(uint32 index) {
+extern "C" JavaObject* Java_sun_reflect_Reflection_getCallerClass__I(uint32 index) {
   
   JavaObject* res = 0;
   llvm_gcroot(res, 0);
@@ -468,12 +472,13 @@
   return res;
 }
 
-extern "C" JavaObject* nativeGetAnnotation(JavaObject* obj) {
+extern "C" JavaObject* Java_java_lang_reflect_AccessibleObject_getAnnotation__Ljava_lang_Class_2(
+    JavaObject* obj) {
   llvm_gcroot(obj, 0);
   return 0;
 }
 
-extern "C" JavaObject* nativeGetDeclaredAnnotations() {
+extern "C" JavaObject* Java_java_lang_reflect_AccessibleObject_getDeclaredAnnotations__() {
   JavaObject* res = 0;
   llvm_gcroot(res, 0);
   
@@ -488,8 +493,6 @@
   return res;
 }
 
-extern "C" void nativePropertiesPostInit(JavaObject* prop);
-
 extern "C" void nativeJavaObjectClassTracer(
     JavaObjectClass* obj, uintptr_t closure) {
   JavaObjectClass::staticTracer(obj, closure);
@@ -520,10 +523,7 @@
   JavaObjectVMThread::staticDestructor(obj);
 }
 
-// Defined in Classpath/ClasspathVMClassLoader.cpp
-extern "C" ArrayObject* nativeGetBootPackages();
-
-extern "C" JavaString* nativeGetenv(JavaString* str) {
+extern "C" JavaString* Java_java_lang_VMSystem_getenv__Ljava_lang_String_2(JavaString* str) {
   JavaString* ret = 0;
   llvm_gcroot(str, 0);
   llvm_gcroot(ret, 0);
@@ -748,12 +748,11 @@
   JavaMethod* internString =
     UPCALL_METHOD(loader, "java/lang/VMString", "intern",
                   "(Ljava/lang/String;)Ljava/lang/String;", ACC_STATIC); 
-  internString->setCompiledPtr((void*)(intptr_t)nativeInternString,
-                               "nativeInternString");
+  internString->setNative();
   
   JavaMethod* isArray =
     UPCALL_METHOD(loader, "java/lang/Class", "isArray", "()Z", ACC_VIRTUAL);
-  isArray->setCompiledPtr((void*)(intptr_t)nativeIsArray, "nativeIsArray");
+  isArray->setNative();
 
 
   UPCALL_REFLECT_CLASS_EXCEPTION(loader, InvocationTargetException);
@@ -944,61 +943,51 @@
   JavaMethod* getEnv =
     UPCALL_METHOD(loader, "java/lang/VMSystem", "getenv",
                   "(Ljava/lang/String;)Ljava/lang/String;", ACC_STATIC);
-  getEnv->setCompiledPtr((void*)(intptr_t)nativeGetenv, "nativeGetenv");
+  getEnv->setNative();
 
   JavaMethod* getCallingClass =
     UPCALL_METHOD(loader, "gnu/classpath/VMStackWalker", "getCallingClass",
                   "()Ljava/lang/Class;", ACC_STATIC);
-  getCallingClass->setCompiledPtr((void*)(intptr_t)nativeGetCallingClass,
-                                  "nativeGetCallingClass");
+  getCallingClass->setNative();
   
   JavaMethod* getCallingClassLoader =
     UPCALL_METHOD(loader, "gnu/classpath/VMStackWalker", "getCallingClassLoader",
                   "()Ljava/lang/ClassLoader;", ACC_STATIC);
-  getCallingClassLoader->setCompiledPtr((void*)(intptr_t)
-                                        nativeGetCallingClassLoader,
-                                        "nativeGetCallingClassLoader");
+  getCallingClassLoader->setNative();
   
   JavaMethod* firstNonNullClassLoader =
     UPCALL_METHOD(loader, "gnu/classpath/VMStackWalker", "firstNonNullClassLoader",
                   "()Ljava/lang/ClassLoader;", ACC_STATIC);
-  firstNonNullClassLoader->setCompiledPtr((void*)(intptr_t)
-                                          nativeFirstNonNullClassLoader,
-                                          "nativeFirstNonNullClassLoader");
+  firstNonNullClassLoader->setNative();
   
   JavaMethod* getCallerClass =
     UPCALL_METHOD(loader, "sun/reflect/Reflection", "getCallerClass",
                   "(I)Ljava/lang/Class;", ACC_STATIC);
-  getCallerClass->setCompiledPtr((void*)(intptr_t)nativeGetCallerClass,
-                                 "nativeGetCallerClass");
+  getCallerClass->setNative();
   
   JavaMethod* postProperties =
     UPCALL_METHOD(loader, "gnu/classpath/VMSystemProperties", "postInit",
                   "(Ljava/util/Properties;)V", ACC_STATIC);
-  postProperties->setCompiledPtr((void*)(intptr_t)nativePropertiesPostInit,
-                                 "nativePropertiesPostInit");
+  postProperties->setNative();
 
   // Also implement these twos, implementation in GNU Classpath 0.97.2 is buggy.
   JavaMethod* getAnnotation =
     UPCALL_METHOD(loader, "java/lang/reflect/AccessibleObject", "getAnnotation",
                   "(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;",
                   ACC_VIRTUAL);
-  getAnnotation->setCompiledPtr((void*)(intptr_t)nativeGetAnnotation,
-                                "nativeGetAnnotation");
+  getAnnotation->setNative();
   
   JavaMethod* getAnnotations =
     UPCALL_METHOD(loader, "java/lang/reflect/AccessibleObject",
                   "getDeclaredAnnotations",
                   "()[Ljava/lang/annotation/Annotation;",
                   ACC_VIRTUAL);
-  getAnnotations->setCompiledPtr((void*)(intptr_t)nativeGetDeclaredAnnotations,
-                                 "nativeGetDeclaredAnnotations");
+  getAnnotations->setNative();
   
   JavaMethod* getBootPackages =
     UPCALL_METHOD(loader, "java/lang/VMClassLoader", "getBootPackages",
                   "()[Ljava/lang/String;", ACC_STATIC);
-  getBootPackages->setCompiledPtr((void*)(intptr_t)nativeGetBootPackages,
-                                  "nativeGetBootPackages");
+  getBootPackages->setNative();
   
   //===----------------------------------------------------------------------===//
   //
@@ -1044,58 +1033,31 @@
     UPCALL_METHOD(loader, "java/lang/ref/WeakReference", "<init>",
                   "(Ljava/lang/Object;)V",
                   ACC_VIRTUAL);
-  initWeakReference->setCompiledPtr((void*)(intptr_t)nativeInitWeakReference,
-                                    "nativeInitWeakReference");
+  initWeakReference->setNative();
   
   initWeakReference =
     UPCALL_METHOD(loader, "java/lang/ref/WeakReference", "<init>",
                   "(Ljava/lang/Object;Ljava/lang/ref/ReferenceQueue;)V",
                   ACC_VIRTUAL);
-  initWeakReference->setCompiledPtr((void*)(intptr_t)nativeInitWeakReferenceQ,
-                                    "nativeInitWeakReferenceQ");
+  initWeakReference->setNative();
   
   JavaMethod* initSoftReference =
     UPCALL_METHOD(loader, "java/lang/ref/SoftReference", "<init>",
                   "(Ljava/lang/Object;)V",
                   ACC_VIRTUAL);
-  initSoftReference->setCompiledPtr((void*)(intptr_t)nativeInitSoftReference,
-                                    "nativeInitSoftReference");
+  initSoftReference->setNative();
   
   initSoftReference =
-    UPCALL_METHOD(loader, "java/lang/ref/WeakReference", "<init>",
+    UPCALL_METHOD(loader, "java/lang/ref/SoftReference", "<init>",
                   "(Ljava/lang/Object;Ljava/lang/ref/ReferenceQueue;)V",
                   ACC_VIRTUAL);
-  initSoftReference->setCompiledPtr((void*)(intptr_t)nativeInitSoftReferenceQ,
-                                    "nativeInitSoftReferenceQ");
+  initSoftReference->setNative();
   
   JavaMethod* initPhantomReference =
     UPCALL_METHOD(loader, "java/lang/ref/PhantomReference", "<init>",
                   "(Ljava/lang/Object;Ljava/lang/ref/ReferenceQueue;)V",
                   ACC_VIRTUAL);
-  initPhantomReference->setCompiledPtr(
-      (void*)(intptr_t)nativeInitPhantomReferenceQ,
-      "nativeInitPhantomReferenceQ");
-  
-
-}
-
-gc** Jnjvm::getReferentPtr(gc* _obj) {
-  JavaObjectReference* obj = (JavaObjectReference*)_obj;
-  llvm_gcroot(obj, 0);
-  return (gc**)JavaObjectReference::getReferentPtr(obj);
-}
-
-void Jnjvm::setReferent(gc* _obj, gc* val) {
-  JavaObjectReference* obj = (JavaObjectReference*)_obj;
-  llvm_gcroot(obj, 0);
-  llvm_gcroot(val, 0);
-  JavaObjectReference::setReferent(obj, (JavaObject*)val);
-}
- 
-void Jnjvm::clearReferent(gc* _obj) {
-  JavaObjectReference* obj = (JavaObjectReference*)_obj;
-  llvm_gcroot(obj, 0);
-  JavaObjectReference::setReferent(obj, NULL);
+  initPhantomReference->setNative();
 }
 
 #include "ClasspathConstructor.inc"

Modified: vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc (original)
+++ vmkit/trunk/lib/J3/Compiler/ExceptionsCheck.inc Sat Nov 27 04:07:18 2010
@@ -501,7 +501,6 @@
   // Restore currentBlock.
   currentBlock = temp;
   return nbe;
-
 }
 
 void JavaJIT::finishExceptions() {

Modified: vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/J3Intrinsics.cpp Sat Nov 27 04:07:18 2010
@@ -193,6 +193,7 @@
   ResolveVirtualStubFunction = module->getFunction("j3ResolveVirtualStub");
   ResolveStaticStubFunction = module->getFunction("j3ResolveStaticStub");
   ResolveSpecialStubFunction = module->getFunction("j3ResolveSpecialStub");
+  ResolveInterfaceFunction = module->getFunction("j3ResolveInterface");
   
   NullPointerExceptionFunction =
     module->getFunction("j3NullPointerException");

Modified: vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Sat Nov 27 04:07:18 2010
@@ -167,6 +167,7 @@
 }
 
 Constant* JavaAOTCompiler::getString(JavaString* str) {
+  assert(!useCooperativeGC());
   string_iterator SI = strings.find(str);
   if (SI != strings.end()) {
     return SI->second;
@@ -306,6 +307,7 @@
 
 
 Constant* JavaAOTCompiler::getFinalObject(JavaObject* obj, CommonClass* objCl) {
+  assert(!useCooperativeGC());
   llvm::GlobalVariable* varGV = 0;
   final_object_iterator End = finalObjects.end();
   final_object_iterator I = finalObjects.find(obj);
@@ -444,7 +446,7 @@
         Elts.push_back(Constant::getNullValue(Ty));
       }
     } else {
-      Reader reader(attribut, &(cl->bytes));
+      Reader reader(attribut, cl->bytes);
       JavaConstantPool * ctpInfo = cl->ctpInfo;
       uint16 idx = reader.readU2();
       if (type->isPrimitive()) {
@@ -1482,6 +1484,7 @@
   if (!VT->IMT) {
     Elemts.push_back(Constant::getNullValue(PTy));
   } else {
+    // TODO: add a null element at the end to diagnose errors.
     Class* cl = classDef->asClass();
     assert(cl && "Not a class");
     std::set<JavaMethod*> contents[InterfaceMethodTable::NumIndexes];
@@ -1851,8 +1854,7 @@
 void JavaAOTCompiler::makeIMT(Class* cl) {
 }
 
-void JavaAOTCompiler::setMethod(JavaMethod* meth, void* ptr, const char* name) {
-  Function* func = getMethodInfo(meth)->getMethod();
+void JavaAOTCompiler::setMethod(Function* func, void* ptr, const char* name) {
   func->setName(name);
   func->setLinkage(GlobalValue::ExternalLinkage);
 }
@@ -1903,14 +1905,14 @@
 
 
 
-void extractFiles(ArrayUInt8* bytes,
+void extractFiles(ClassBytes* bytes,
                   JavaAOTCompiler* M,
                   JnjvmBootstrapLoader* bootstrapLoader,
                   std::vector<Class*>& classes) {
   ZipArchive archive(bytes, bootstrapLoader->allocator);
    
-  mvm::ThreadAllocator allocator; 
-  char* realName = (char*)allocator.Allocate(4096);
+  mvm::BumpPtrAllocator allocator; 
+  char* realName = (char*)allocator.Allocate(4096, "temp");
   for (ZipArchive::table_iterator i = archive.filetable.begin(), 
        e = archive.filetable.end(); i != e; ++i) {
     ZipFile* file = i->second;
@@ -1927,9 +1929,7 @@
       classes.push_back(cl);  
     } else if (size > 4 && (!strcmp(&name[size - 4], ".jar") || 
                             !strcmp(&name[size - 4], ".zip"))) {
-      UserClassArray* array = bootstrapLoader->upcalls->ArrayOfByte;
-      ArrayUInt8* res = 
-        (ArrayUInt8*)array->doNew(file->ucsize, JavaThread::get()->getJVM());
+      ClassBytes* res = new (allocator, file->ucsize) ClassBytes(file->ucsize);
       int ok = archive.readFile(res, file);
       if (!ok) return;
       
@@ -1958,6 +1958,9 @@
   if (!M->clinits->empty()) {
     Comp = JavaJITCompiler::CreateCompiler("JIT");
     Comp->EmitFunctionName = true;
+    if (!M->useCooperativeGC()) {
+      Comp->disableCooperativeGC();
+    }
     bootstrapLoader->setCompiler(Comp);
     bootstrapLoader->analyseClasspathEnv(vm->classpath);
   } else {
@@ -1970,7 +1973,7 @@
       (!strcmp(&name[size - 4], ".jar") || !strcmp(&name[size - 4], ".zip"))) {
   
     std::vector<Class*> classes;
-    ArrayUInt8* bytes = Reader::openFile(bootstrapLoader, name);
+    ClassBytes* bytes = Reader::openFile(bootstrapLoader, name);
       
     if (!bytes) {
       fprintf(stderr, "Can't find zip file.\n");
@@ -1979,7 +1982,7 @@
 
     extractFiles(bytes, M, bootstrapLoader, classes);
     // Now that we know if we can trust this compiler, add the Java passes.
-    M->addJavaPasses(M->compileRT);
+    M->addJavaPasses();
 
 
       // First resolve everyone so that there can not be unknown references in
@@ -2057,7 +2060,7 @@
       }
 
     } else {
-      M->addJavaPasses(false);
+      M->addJavaPasses();
       char* realName = (char*)allocator.Allocate(size + 1);
       if (size > 6 && !strcmp(&name[size - 6], ".class")) {
         memcpy(realName, name, size - 6);
@@ -2130,7 +2133,7 @@
 
 void JavaAOTCompiler::compileFile(Jnjvm* vm, const char* n) {
   name = n;
-  JavaThread* th = new JavaThread(0, 0, vm);
+  JavaThread* th = new JavaThread(vm);
   vm->setMainThread(th);
   th->start((void (*)(mvm::Thread*))mainCompilerStart);
   vm->waitForExit();

Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Sat Nov 27 04:07:18 2010
@@ -202,8 +202,7 @@
       Args.push_back(TheCompiler->getNativeClass(compilingClass));
       Args.push_back(ConstantInt::get(Type::getInt32Ty(*llvmContext), index));
       Args.push_back(GV);
-      Value* targetObject = getTarget(virtualType->param_end(),
-                                      signature->nbArguments + 1);
+      Value* targetObject = getTarget(signature);
       Args.push_back(new LoadInst(
           targetObject, "", TheCompiler->useCooperativeGC(), currentBlock));
       load = invoke(intrinsics->VirtualLookupFunction, Args, "", currentBlock);
@@ -347,20 +346,23 @@
   sint32 mnlen = jniConsName->size;
   sint32 mtlen = jniConsType->size;
 
-  char* functionName = (char*)alloca(3 + JNI_NAME_PRE_LEN + 
-                            ((mnlen + clen + mtlen) << 3));
+  mvm::ThreadAllocator allocator;
+  char* functionName = (char*)allocator.Allocate(
+      3 + JNI_NAME_PRE_LEN + ((mnlen + clen + mtlen) << 3));
   
-  if (!natPtr)
+  if (!natPtr) {
     natPtr = compilingClass->classLoader->nativeLookup(compilingMethod, j3,
                                                        functionName);
+  }
   
   if (!natPtr && !TheCompiler->isStaticCompiling()) {
     currentBlock = createBasicBlock("start");
     CallInst::Create(intrinsics->ThrowExceptionFromJITFunction, "", currentBlock);
-    if (returnType != Type::getVoidTy(*llvmContext))
+    if (returnType != Type::getVoidTy(*llvmContext)) {
       ReturnInst::Create(*llvmContext, Constant::getNullValue(returnType), currentBlock);
-    else
+    } else {
       ReturnInst::Create(*llvmContext, currentBlock);
+    }
   
     PRINT_DEBUG(JNJVM_COMPILE, 1, COLOR_NORMAL, "end native compile %s.%s\n",
                 UTF8Buffer(compilingClass->name).cString(),
@@ -372,8 +374,25 @@
   
   Function* func = llvmFunction;
   if (j3) {
-    compilingMethod->setCompiledPtr((void*)natPtr, functionName);
-    llvmFunction->clearGC();
+    Function* callee = Function::Create(llvmFunction->getFunctionType(),
+                                        GlobalValue::ExternalLinkage,
+                                        functionName,
+                                        llvmFunction->getParent());
+    TheCompiler->setMethod(callee, (void*)natPtr, functionName);
+    currentBlock = createBasicBlock("start");
+    std::vector<Value*> args;
+    for (Function::arg_iterator i = func->arg_begin(), e = func->arg_end();
+         i != e;
+         i++) {
+      args.push_back(i);
+    }
+    Value* res = CallInst::Create(
+        callee, args.begin(), args.end(), "", currentBlock);
+    if (returnType != Type::getVoidTy(*llvmContext)) {
+      ReturnInst::Create(*llvmContext, res, currentBlock);
+    } else {
+      ReturnInst::Create(*llvmContext, currentBlock);
+    }
     return llvmFunction;
   }
 
@@ -395,7 +414,7 @@
   Value* oldCLIN = new AllocaInst(PointerType::getUnqual(Type::getInt32Ty(*llvmContext)), "",
                                   currentBlock);
   
-  Constant* sizeF = ConstantInt::get(Type::getInt32Ty(*llvmContext), 2 * sizeof(void*));
+  Constant* sizeF = ConstantInt::get(Type::getInt32Ty(*llvmContext), sizeof(mvm::KnownFrame));
   Value* Frame = new AllocaInst(Type::getInt8Ty(*llvmContext), sizeF, "", currentBlock);
   
   uint32 nargs = func->arg_size() + 1 + (stat ? 1 : 0); 
@@ -571,18 +590,6 @@
               UTF8Buffer(compilingClass->name).cString(),
               UTF8Buffer(compilingMethod->name).cString());
   
-  if (codeInfo.size()) { 
-    compilingMethod->codeInfo = new CodeLineInfo[codeInfo.size()];
-    for (uint32 i = 0; i < codeInfo.size(); i++) {
-      compilingMethod->codeInfo[i].lineNumber = codeInfo[i].lineNumber;
-      compilingMethod->codeInfo[i].ctpIndex = codeInfo[i].ctpIndex;
-      compilingMethod->codeInfo[i].bytecodeIndex = codeInfo[i].bytecodeIndex;
-      compilingMethod->codeInfo[i].bytecode = codeInfo[i].bytecode;
-    }
-  } else {
-    compilingMethod->codeInfo = NULL;
-  }
- 
   return llvmFunction;
 }
 
@@ -789,7 +796,7 @@
     abort();
   }
 
-  Reader reader(codeAtt, &(compilingClass->bytes));
+  Reader reader(codeAtt, compilingClass->bytes);
   uint16 maxStack = reader.readU2();
   uint16 maxLocals = reader.readU2();
   uint32 codeLen = reader.readU4();
@@ -926,23 +933,6 @@
   
   readExceptionTable(reader, codeLen);
   
-  // Lookup line number table attribute.
-  uint16 nba = reader.readU2();
-  for (uint16 i = 0; i < nba; ++i) {
-    const UTF8* attName = compilingClass->ctpInfo->UTF8At(reader.readU2());
-    uint32 attLen = reader.readU4();
-    if (attName->equals(Attribut::lineNumberTableAttribut)) {
-      uint16 lineLength = reader.readU2();
-      for (uint16 i = 0; i < lineLength; ++i) {
-        uint16 pc = reader.readU2();
-        uint16 ln = reader.readU2();
-        opcodeInfos[pc].lineNumber = ln;
-      }
-    } else {
-      reader.seek(attLen, Reader::SeekCur);      
-    }
-  }
-   
   reader.cursor = start;
   exploreOpcodes(reader, codeLen);
 
@@ -996,7 +986,7 @@
     abort();
   } 
 
-  Reader reader(codeAtt, &(compilingClass->bytes));
+  Reader reader(codeAtt, compilingClass->bytes);
   uint16 maxStack = reader.readU2();
   uint16 maxLocals = reader.readU2();
   uint32 codeLen = reader.readU4();
@@ -1174,23 +1164,6 @@
 
   readExceptionTable(reader, codeLen);
   
-  // Lookup line number table attribute.
-  uint16 nba = reader.readU2();
-  for (uint16 i = 0; i < nba; ++i) {
-    const UTF8* attName = compilingClass->ctpInfo->UTF8At(reader.readU2());
-    uint32 attLen = reader.readU4();
-    if (attName->equals(Attribut::lineNumberTableAttribut)) {
-      uint16 lineLength = reader.readU2();
-      for (uint16 i = 0; i < lineLength; ++i) {
-        uint16 pc = reader.readU2();
-        uint16 ln = reader.readU2();
-        opcodeInfos[pc].lineNumber = ln;
-      }
-    } else {
-      reader.seek(attLen, Reader::SeekCur);      
-    }
-  }
-  
   reader.cursor = start;
   exploreOpcodes(reader, codeLen);
  
@@ -1355,7 +1328,7 @@
     compilingMethod->lookupAttribut(Attribut::annotationsAttribut);
   
   if (annotationsAtt) {
-    Reader reader(annotationsAtt, &(compilingClass->bytes));
+    Reader reader(annotationsAtt, compilingClass->bytes);
     AnnotationReader AR(reader, compilingClass);
     uint16 numAnnotations = reader.readU2();
     for (uint16 i = 0; i < numAnnotations; ++i) {
@@ -1370,18 +1343,6 @@
     }
   }
  
-  if (codeInfo.size()) { 
-    compilingMethod->codeInfo = new CodeLineInfo[codeInfo.size()];
-    for (uint32 i = 0; i < codeInfo.size(); i++) {
-      compilingMethod->codeInfo[i].lineNumber = codeInfo[i].lineNumber;
-      compilingMethod->codeInfo[i].ctpIndex = codeInfo[i].ctpIndex;
-      compilingMethod->codeInfo[i].bytecodeIndex = codeInfo[i].bytecodeIndex;
-      compilingMethod->codeInfo[i].bytecode = codeInfo[i].bytecode;
-    }
-  } else {
-    compilingMethod->codeInfo = NULL;
-  }
-
   return llvmFunction;
 }
 
@@ -1548,26 +1509,16 @@
   }
 }
 
-Value* JavaJIT::getTarget(FunctionType::param_iterator it, uint32 nb) {
-#if defined(ISOLATE_SHARING)
-  nb += 1;
-#endif
-#if defined(ISOLATE_SHARING)
-  sint32 start = nb - 2;
-  it--;
-  it--;
-#else
-  sint32 start = nb - 1;
-#endif
-  uint32 nbObjects = 0;
-  for (sint32 i = start; i >= 0; --i) {
-    it--;
-    if (it->get() == intrinsics->JavaObjectType) {
-      nbObjects++;
+Value* JavaJIT::getTarget(Signdef* signature) {
+  int offset = 0;
+  Typedef* const* arguments = signature->getArgumentsType();
+  for (uint32 i = 0; i < signature->nbArguments; i++) {
+    if (arguments[i]->isDouble() || arguments[i]->isLong()) {
+      offset++;
     }
+    offset++;
   }
-  assert(nbObjects > 0 && "No this");
-  return objectStack[currentStackIndex - nbObjects];
+  return objectStack[currentStackIndex - 1 - offset];
 }
 
 Instruction* JavaJIT::lowerMathOps(const UTF8* name, 
@@ -1992,14 +1943,15 @@
                            intrinsics->AllocateUnresolvedFunction,
                            Size, VT, "", currentBlock);
 
+  addHighLevelType(val, cl ? cl : upcalls->OfObject);
+  Instruction* res = new BitCastInst(val, intrinsics->JavaObjectType, "", currentBlock);
+  push(res, false, cl ? cl : upcalls->OfObject);
+
+  // Make sure to add the object to the finalization list after it has been
+  // pushed.
   if (cl && cl->virtualVT->destructor) {
     CallInst::Create(intrinsics->AddFinalizationCandidate, val, "", currentBlock);
   }
-
-
-  addHighLevelType(val, cl ? cl : upcalls->OfObject);
-  val = new BitCastInst(val, intrinsics->JavaObjectType, "", currentBlock);
-  push(val, false, cl ? cl : upcalls->OfObject);
 }
 
 Value* JavaJIT::ldResolved(uint16 index, bool stat, Value* object, 
@@ -2163,7 +2115,7 @@
           abort();
         }
       } else {
-        if (TheCompiler->isStaticCompiling()) {
+        if (TheCompiler->isStaticCompiling() && !TheCompiler->useCooperativeGC()) {
           JavaObject* val = field->getStaticObjectField();
           JnjvmClassLoader* JCL = field->classDef->classLoader;
           Value* V = TheCompiler->getFinalObject(val, sign->assocClass(JCL));
@@ -2275,7 +2227,7 @@
 }
 
 
-void JavaJIT::invokeInterface(uint16 index, bool buggyVirtual) {
+void JavaJIT::invokeInterface(uint16 index) {
   
   // Do the usual
   JavaConstantPool* ctpInfo = compilingClass->ctpInfo;
@@ -2287,13 +2239,7 @@
   const llvm::PointerType* virtualPtrType = LSI->getVirtualPtrType();
  
   const llvm::Type* retType = virtualType->getReturnType();
-  BasicBlock* endBlock = createBasicBlock("end interface invoke");
-  PHINode * node = 0;
-  if (retType != Type::getVoidTy(*llvmContext)) {
-    node = PHINode::Create(retType, "", endBlock);
-  }
-  
- 
+   
   CommonClass* cl = 0;
   JavaMethod* meth = 0;
   ctpInfo->infoOfMethod(index, ACC_VIRTUAL, cl, meth);
@@ -2306,13 +2252,17 @@
                              intrinsics->JavaMethodType, 0, true);
   }
 
-  // Compute the arguments after calling getConstantPoolAt because the
-  // arguments will be loaded and the runtime may trigger GC.
-  std::vector<Value*> args; // size = [signature->nbIn + 3];
-
-  FunctionType::param_iterator it  = virtualType->param_end();
-  makeArgs(it, index, args, signature->nbArguments + 1);
-  JITVerifyNull(args[0]);
+  uint32_t tableIndex = InterfaceMethodTable::getIndex(name, signature->keyName);
+  Constant* Index = ConstantInt::get(Type::getInt32Ty(*llvmContext),
+                                     tableIndex);
+  Value* targetObject = getTarget(signature);
+  targetObject = new LoadInst(
+          targetObject, "", TheCompiler->useCooperativeGC(), currentBlock);
+  JITVerifyNull(targetObject);
+  // TODO: The following code needs more testing.
+#if 0
+  BasicBlock* endBlock = createBasicBlock("end interface invoke");
+  PHINode * node = PHINode::Create(virtualPtrType, "", endBlock);
 
   BasicBlock* label_bb = createBasicBlock("bb");
   BasicBlock* label_bb4 = createBasicBlock("bb4");
@@ -2320,14 +2270,11 @@
   BasicBlock* label_bb7 = createBasicBlock("bb7");
     
   // Block entry (label_entry)
-  Value* VT = CallInst::Create(intrinsics->GetVTFunction, args[0], "",
+  Value* VT = CallInst::Create(intrinsics->GetVTFunction, targetObject, "",
                                currentBlock);
   Value* IMT = CallInst::Create(intrinsics->GetIMTFunction, VT, "",
                                 currentBlock);
 
-  uint32_t tableIndex = InterfaceMethodTable::getIndex(name, signature->keyName);
-  Constant* Index = ConstantInt::get(Type::getInt32Ty(*llvmContext),
-                                     tableIndex);
 
   Value* indices[2] = { intrinsics->constantZero, Index };
   Instruction* ptr_18 = GetElementPtrInst::Create(IMT, indices, indices + 2, "",
@@ -2346,8 +2293,8 @@
   // Block bb (label_bb)
   currentBlock = label_bb;
   CastInst* ptr_22 = new IntToPtrInst(int32_19, virtualPtrType, "", currentBlock);
-  Value* ret = invoke(ptr_22, args, "", currentBlock);
-  if (node) node->addIncoming(ret, currentBlock);
+  
+  node->addIncoming(ptr_22, currentBlock);
   BranchInst::Create(endBlock, currentBlock);
     
   // Block bb4 (label_bb4)
@@ -2376,8 +2323,8 @@
   LoadInst* int32_32 = new LoadInst(ptr_31, "", false, currentBlock);
   CastInst* ptr_33 = new BitCastInst(int32_32, virtualPtrType, "",
                                      currentBlock);
-  ret = invoke(ptr_33, args, "", currentBlock);
-  if (node) node->addIncoming(ret, currentBlock);
+  node->addIncoming(ptr_33, currentBlock);
+
   BranchInst::Create(endBlock, currentBlock);
     
   // Block bb7 (label_bb7)
@@ -2408,12 +2355,27 @@
   ptr_table_0_lcssa->addIncoming(ptr_37, currentBlock);
       
   currentBlock = endBlock;
-  if (node) {
-    if (node->getType() == intrinsics->JavaObjectType) {
+#else
+  std::vector<Value*> Args;
+  Args.push_back(targetObject);
+  Args.push_back(Meth);
+  Args.push_back(Index);
+  Value* node =
+      invoke(intrinsics->ResolveInterfaceFunction, Args, "", currentBlock);
+  node = new BitCastInst(node, virtualPtrType, "", currentBlock);
+#endif
+
+  std::vector<Value*> args; // size = [signature->nbIn + 3];
+  FunctionType::param_iterator it  = virtualType->param_end();
+  makeArgs(it, index, args, signature->nbArguments + 1);
+  JITVerifyNull(args[0]);
+  Value* ret = invoke(node, args, "", currentBlock);
+  if (retType != Type::getVoidTy(*llvmContext)) {
+    if (ret->getType() == intrinsics->JavaObjectType) {
       JnjvmClassLoader* JCL = compilingClass->classLoader;
-      push(node, false, signature->getReturnType()->findAssocClass(JCL));
+      push(ret, false, signature->getReturnType()->findAssocClass(JCL));
     } else {
-      push(node, signature->getReturnType()->isUnsigned());
+      push(ret, signature->getReturnType()->isUnsigned());
       if (retType == Type::getDoubleTy(*llvmContext) ||
           retType == Type::getInt64Ty(*llvmContext)) {
         push(intrinsics->constantZero, false);
@@ -2656,10 +2618,7 @@
 }
 
 DebugLoc JavaJIT::CreateLocation() {
-  LineInfo LI = { currentLineNumber, currentCtpIndex, currentBytecodeIndex,
-                  currentBytecode };
-  codeInfo.push_back(LI);
-  DebugLoc DL = DebugLoc::get(callNumber++, 0, DbgSubprogram);
+  DebugLoc DL = DebugLoc::get(currentBytecodeIndex, 0, DbgSubprogram);
   return DL;
 }
 

Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.h (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.h Sat Nov 27 04:07:18 2010
@@ -58,19 +58,9 @@
   /// stack - The stack at this location if there is a new block
   ///
   std::vector<CommonClass*> stack;
-
-  /// lineNumber - The line number of this bytecode.
-  uint16 lineNumber;
 };
 
 
-struct LineInfo {
-  uint16 lineNumber;
-  uint16 ctpIndex;
-  uint16 bytecodeIndex;
-  uint16 bytecode;
-};
-
 /// JavaJIT - The compilation engine of J3. Parses the bycode and returns
 /// its LLVM representation.
 ///
@@ -90,11 +80,7 @@
     callsStackWalker = false;
     endNode = 0;
     currentStackIndex = 0;
-    currentLineNumber = 0;
     currentBytecodeIndex = 0;
-    currentCtpIndex = -1;
-    currentBytecode = -1;
-    callNumber = 0;
     thisObject = NULL;
   }
 
@@ -180,27 +166,12 @@
   
   llvm::MDNode* DbgSubprogram;
   
-  /// currentLineIndex - The current line being processed.
-  uint16 currentLineNumber;
-
   /// currentBytecodeIndex - The current bytecode being processed.
   uint16 currentBytecodeIndex;
   
-  /// currentCtpIndex - The constant pool index being processed.
-  uint16 currentCtpIndex;
-  
-  /// currentBytecode - The bytecode being processed.
-  uint16 currentBytecode;
-  
-  /// callNumber - The number of a call for a single opcode. 
-  uint16 callNumber;
-
   /// CreateLocation - Create debug information for a call.
   llvm::DebugLoc CreateLocation();
 
-  // codeInfo - List of LineInfo for this method.
-  std::vector<LineInfo> codeInfo;
-
 //===--------------------------- Inline support ---------------------------===//
 
   /// inlineCompile - Parse the method and start its LLVM representation
@@ -494,15 +465,13 @@
                 uint32 index, std::vector<llvm::Value*>& result, uint32 nb);
 
   /// getTarget - Get the target object for invocation.
-  llvm::Value* getTarget(llvm::FunctionType::param_iterator it, uint32 nb);
+  llvm::Value* getTarget(Signdef* signature);
 
   /// invokeVirtual - Invoke a Java virtual method.
   void invokeVirtual(uint16 index);
 
-  /// invokeInterface - Invoke a Java interface method. The buggyVirtual
-  /// argument is for buggy java to bytecode compilers which emit a virtual
-  /// call instead of an interface call in some occasions.
-  void invokeInterface(uint16 index, bool buggyVirtual = false);
+  /// invokeInterface - Invoke a Java interface method.
+  void invokeInterface(uint16 index);
 
   /// invokeSpecial - Invoke an instance Java method directly.
   void invokeSpecial(uint16 index);

Modified: vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp Sat Nov 27 04:07:18 2010
@@ -15,12 +15,14 @@
 #include "llvm/Module.h"
 #include "llvm/Analysis/DebugInfo.h"
 #include "llvm/CodeGen/GCStrategy.h"
+#include <llvm/CodeGen/JITCodeEmitter.h>
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+#include <../lib/ExecutionEngine/JIT/JIT.h>
 
 #include "MvmGC.h"
 #include "mvm/VirtualMachine.h"
@@ -38,15 +40,18 @@
 using namespace j3;
 using namespace llvm;
 
-
 class JavaJITMethodInfo : public mvm::JITMethodInfo {
 public:
   virtual void print(void* ip, void* addr);
+  virtual bool isHighLevelMethod() {
+    return true;
+  }
   
-  JavaJITMethodInfo(llvm::GCFunctionInfo* GFI, JavaMethod* m) : 
-    mvm::JITMethodInfo(GFI) {
+  JavaJITMethodInfo(llvm::GCFunctionInfo* GFI,
+                    JavaMethod* m) :
+      mvm::JITMethodInfo(GFI) {
     MetaInfo = m;
-    MethodType = 1;
+    Owner = m->classDef->classLoader->getCompiler();
   }
 };
 
@@ -55,10 +60,17 @@
   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(),
-          UTF8Buffer(meth->name).cString(), info->lineNumber,
-          info->bytecodeIndex, meth->code);
+  if (info != NULL) {
+    fprintf(stderr, "; %p (%p) in %s.%s (line %d, bytecode %d, code start %p)", new_ip, addr,
+            UTF8Buffer(meth->classDef->name).cString(),
+            UTF8Buffer(meth->name).cString(),
+            meth->lookupLineNumber((uintptr_t)ip),
+            info->bytecodeIndex, meth->code);
+  } else {
+    fprintf(stderr, "; %p (%p) in %s.%s (native method, code start %p)", new_ip, addr,
+            UTF8Buffer(meth->classDef->name).cString(),
+            UTF8Buffer(meth->name).cString(), meth->code);
+  }
   if (ip != new_ip) fprintf(stderr, " (from stub)");
   fprintf(stderr, "\n");
 }
@@ -68,72 +80,17 @@
                                      void *Code, size_t Size,
                                      const EmittedFunctionDetails &Details) {
 
-  // The following could be changed to an assert when -load-bc supports
-  // the verifier.
+  // The following is necessary for -load-bc.
   if (F.getParent() != TheCompiler->getLLVMModule()) return;
-
-  Jnjvm* vm = JavaThread::get()->getJVM();
-  mvm::BumpPtrAllocator& Alloc = TheCompiler->allocator;
-  llvm::GCFunctionInfo* GFI = 0;
-
-  if (F.hasGC()) {
-    if (TheCompiler->TheGCStrategy == NULL) {
-      assert(mvm::MvmModule::TheGCStrategy != NULL && "No GC strategy");
-      TheCompiler->TheGCStrategy = mvm::MvmModule::TheGCStrategy;
-      mvm::MvmModule::TheGCStrategy = NULL;
-    }
-    GCStrategy::iterator I = TheCompiler->TheGCStrategy->end();
-    I--;
-    while (&(*I)->getFunction() != &F) {
-      // This happens when the compilation of a function was post-poned.
-      assert(I != TheCompiler->TheGCStrategy->begin() && "No GC info");
-      I--;
-    }
-    assert(&(*I)->getFunction() == &F &&
-        "GC Info and method do not correspond");
-    GFI = *I;
-  }
-
-  JavaMethod* meth = TheCompiler->getJavaMethod(F);
-  if (meth == NULL) {
-    // This is a stub.
-    mvm::MvmJITMethodInfo* MI = new(Alloc, "JITMethodInfo")
-      mvm::MvmJITMethodInfo(GFI, &F);
-    vm->RuntimeFunctions.addMethodInfo(MI, Code,
-                                       (void*)((uintptr_t)Code + Size));
-  } else {
-    JavaJITMethodInfo* MI = new(Alloc, "JavaJITMethodInfo")
-      JavaJITMethodInfo(GFI, meth);
-    vm->RuntimeFunctions.addMethodInfo(MI, Code,
-                                       (void*)((uintptr_t)Code + Size));
-    uint32 infoLength = Details.LineStarts.size();
-    meth->codeInfoLength = infoLength;
-    if (infoLength > 0) {
-      mvm::BumpPtrAllocator& JavaAlloc = meth->classDef->classLoader->allocator;
-      CodeLineInfo* infoTable =
-        new(JavaAlloc, "CodeLineInfo") CodeLineInfo[infoLength];
-      for (uint32 i = 0; i < infoLength; ++i) {
-        DebugLoc DL = Details.LineStarts[i].Loc;
-        uint32_t first = DL.getLine();
-        uint32_t second = DL.getCol();
-        assert(second == 0 && "Wrong column number");
-        infoTable[i].address = Details.LineStarts[i].Address;
-        infoTable[i].lineNumber = meth->codeInfo[first].lineNumber;
-        infoTable[i].bytecodeIndex = meth->codeInfo[first].bytecodeIndex;
-        infoTable[i].ctpIndex = meth->codeInfo[first].ctpIndex;
-        infoTable[i].bytecode = meth->codeInfo[first].bytecode;
-      }
-      delete[] meth->codeInfo;
-      meth->codeInfo = infoTable;
-    } else {
-      if (meth->codeInfo != NULL) {
-        delete[] meth->codeInfo;
-        meth->codeInfo = NULL;
-      }
-    }
+  assert(F.hasGC());
+  if (TheCompiler->GCInfo != NULL) {
+    assert(TheCompiler->GCInfo == Details.MF->getGMI());
+    return;
   }
+  TheCompiler->GCInfo = Details.MF->getGMI();
 }
 
+
 Constant* JavaJITCompiler::getNativeClass(CommonClass* classDef) {
   const llvm::Type* Ty = classDef->isClass() ? JavaIntrinsics.JavaClassType :
                                                JavaIntrinsics.JavaCommonClassType;
@@ -238,22 +195,17 @@
   return ConstantExpr::getIntToPtr(CI, valPtrType);
 }
 
-JavaJITCompiler::JavaJITCompiler(const std::string &ModuleID, bool trusted) :
+JavaJITCompiler::JavaJITCompiler(const std::string &ModuleID) :
   JavaLLVMCompiler(ModuleID), listener(this) {
 
   EmitFunctionName = false;
+  GCInfo = NULL;
 
-  // Protect IR for the GC.
-  mvm::MvmModule::protectIR();
   executionEngine = ExecutionEngine::createJIT(TheModule, 0,
                                                0, llvm::CodeGenOpt::Default, false);
-  TheGCStrategy = mvm::MvmModule::TheGCStrategy;
-  mvm::MvmModule::TheGCStrategy = NULL;
-  mvm::MvmModule::unprotectIR();
- 
   executionEngine->RegisterJITEventListener(&listener);
 
-  addJavaPasses(trusted);
+  addJavaPasses();
 }
 
 JavaJITCompiler::~JavaJITCompiler() {
@@ -320,6 +272,7 @@
  
   std::set<JavaMethod*> contents[InterfaceMethodTable::NumIndexes];
   cl->fillIMT(contents);
+
   
   for (uint32_t i = 0; i < InterfaceMethodTable::NumIndexes; ++i) {
     std::set<JavaMethod*>& atIndex = contents[i];
@@ -348,7 +301,7 @@
         if (OldMethod && OldMethod != Cmeth) SameMethod = false;
         else OldMethod = Cmeth;
        
-        if (Cmeth) methods.push_back(Cmeth);
+        methods.push_back(Cmeth);
       }
 
       if (SameMethod) {
@@ -360,45 +313,81 @@
         }
       } else {
 
-        uint32_t length = 2 * size * sizeof(uintptr_t);
+        // Add one to have a NULL-terminated table.
+        uint32_t length = (2 * size + 1) * sizeof(uintptr_t);
       
         uintptr_t* table = (uintptr_t*)
           cl->classLoader->allocator.Allocate(length, "IMT");
       
         IMT->contents[i] = (uintptr_t)table | 1;
 
-        int j = 0;
+        uint32_t j = 0;
         std::set<JavaMethod*>::iterator Interf = atIndex.begin();
         for (std::vector<JavaMethod*>::iterator it = methods.begin(),
              et = methods.end(); it != et; ++it, j += 2, ++Interf) {
           JavaMethod* Imeth = *Interf;
           JavaMethod* Cmeth = *it;
-         
+          assert(Imeth != NULL);
+          assert(j < 2 * size - 1);
           table[j] = (uintptr_t)Imeth;
           if (Cmeth) {
-             table[j + 1] = getPointerOrStub(*Cmeth, JavaMethod::Interface);
+            table[j + 1] = getPointerOrStub(*Cmeth, JavaMethod::Interface);
           } else {
             table[j + 1] = (uintptr_t)ThrowUnfoundInterface;
           }
         }
+        assert(Interf == atIndex.end());
       }
     }
   }
 }
 
-void JavaJITCompiler::setMethod(JavaMethod* meth, void* ptr, const char* name) {
-  Function* func = getMethodInfo(meth)->getMethod();
+void JavaJITCompiler::setMethod(Function* func, void* ptr, const char* name) {
+  func->setLinkage(GlobalValue::ExternalLinkage);
   func->setName(name);
   assert(ptr && "No value given");
   executionEngine->updateGlobalMapping(func, ptr);
-  func->setLinkage(GlobalValue::ExternalLinkage);
 }
 
 void* JavaJITCompiler::materializeFunction(JavaMethod* meth) {
   mvm::MvmModule::protectIR();
   Function* func = parseFunction(meth);
   void* res = executionEngine->getPointerToGlobal(func);
-  // Now that it's compiled, we don't need the IR anymore
+ 
+  if (!func->isDeclaration()) {
+    llvm::GCFunctionInfo* GFI = &(GCInfo->getFunctionInfo(*func));
+    assert((GFI != NULL) && "No GC information");
+  
+    Jnjvm* vm = JavaThread::get()->getJVM();
+    mvm::JITMethodInfo* MI = 
+      new(allocator, "JavaJITMethodInfo") JavaJITMethodInfo(GFI, meth);
+    MI->addToVM(vm, (JIT*)executionEngine);
+
+    uint32_t infoLength = GFI->size();
+    meth->codeInfoLength = infoLength;
+    if (infoLength == 0) {
+      meth->codeInfo = NULL;
+    } else {
+      mvm::BumpPtrAllocator& JavaAlloc = meth->classDef->classLoader->allocator;
+      CodeLineInfo* infoTable =
+        new(JavaAlloc, "CodeLineInfo") CodeLineInfo[infoLength];
+      uint32_t index = 0;
+      for (GCFunctionInfo::iterator I = GFI->begin(), E = GFI->end();
+           I != E;
+           I++, index++) {
+        DebugLoc DL = I->Loc;
+        uint32_t bytecodeIndex = DL.getLine();
+        uint32_t second = DL.getCol();
+        assert(second == 0 && "Wrong column number");
+        uintptr_t address =
+            ((JIT*)executionEngine)->getCodeEmitter()->getLabelAddress(I->Label);
+        infoTable[index].address = address;
+        infoTable[index].bytecodeIndex = bytecodeIndex;
+      }
+      meth->codeInfo = infoTable;
+    }
+  }
+    // Now that it's compiled, we don't need the IR anymore
   func->deleteBody();
   mvm::MvmModule::unprotectIR();
   return res;
@@ -407,6 +396,15 @@
 void* JavaJITCompiler::GenerateStub(llvm::Function* F) {
   mvm::MvmModule::protectIR();
   void* res = executionEngine->getPointerToGlobal(F);
+  
+  llvm::GCFunctionInfo* GFI = &(GCInfo->getFunctionInfo(*F));
+  assert((GFI != NULL) && "No GC information");
+  
+  Jnjvm* vm = JavaThread::get()->getJVM();
+  mvm::JITMethodInfo* MI = 
+    new(allocator, "JITMethodInfo") mvm::MvmJITMethodInfo(GFI, F, this);
+  MI->addToVM(vm, (JIT*)executionEngine);
+  
   // Now that it's compiled, we don't need the IR anymore
   F->deleteBody();
   mvm::MvmModule::unprotectIR();
@@ -426,9 +424,11 @@
   newArgv[0] = newArgv[1];
   newArgv[1] = mainClass;
 
+  mvm::BumpPtrAllocator Allocator;
   JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule");
-  JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp);
-  mvm::VirtualMachine* vm = mvm::VirtualMachine::createJVM(JCL);
+  JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader")
+    JnjvmBootstrapLoader(Allocator, Comp, true);
+  Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader);
   vm->runApplication(argc + 1, newArgv);
   vm->waitForExit();
   
@@ -478,9 +478,8 @@
   return (meth == NULL || meth->code == NULL);
 }
 
-JavaJ3LazyJITCompiler::JavaJ3LazyJITCompiler(const std::string& ModuleID,
-                                             bool trusted)
-    : JavaJITCompiler(ModuleID, trusted) {}
+JavaJ3LazyJITCompiler::JavaJ3LazyJITCompiler(const std::string& ModuleID)
+    : JavaJITCompiler(ModuleID) {}
 
 
 static llvm::cl::opt<bool> LLVMLazy("llvm-lazy", 
@@ -490,7 +489,7 @@
 JavaJITCompiler* JavaJITCompiler::CreateCompiler(const std::string& ModuleID) {
   // This is called for the first compiler.
   if (LLVMLazy) {
-    return new JavaLLVMLazyJITCompiler(ModuleID, true);
+    return new JavaLLVMLazyJITCompiler(ModuleID);
   }
-  return new JavaJ3LazyJITCompiler(ModuleID, true);
+  return new JavaJ3LazyJITCompiler(ModuleID);
 }

Modified: vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Sat Nov 27 04:07:18 2010
@@ -148,13 +148,7 @@
 
     currentExceptionBlock = opinfo->exceptionBlock;
     
-    // Update the line number information.
-    if (opinfo->lineNumber)
-      currentLineNumber = opinfo->lineNumber;
-   
-    currentCtpIndex = -1;
     currentBytecodeIndex = i;
-    currentBytecode = bytecode;
 
     // To prevent a gcj bug with useless goto
     if (currentBlock->getTerminator() != 0) { 
@@ -2016,7 +2010,6 @@
       case INVOKEVIRTUAL : {
         uint16 index = reader.readU2();
         i += 2;
-        currentCtpIndex = index;
         invokeVirtual(index);
         break;
       }
@@ -2024,7 +2017,6 @@
       case INVOKESPECIAL : {
         uint16 index = reader.readU2();
         i += 2;
-        currentCtpIndex = index;
         invokeSpecial(index);
         break;
       }
@@ -2032,7 +2024,6 @@
       case INVOKESTATIC : {
         uint16 index = reader.readU2();
         i += 2;
-        currentCtpIndex = index;
         invokeStatic(index);
         break;
       }
@@ -2040,7 +2031,6 @@
       case INVOKEINTERFACE : {
         uint16 index = reader.readU2();
         i += 2;
-        currentCtpIndex = index;
         invokeInterface(index);
         i += 2;
         break;

Modified: vmkit/trunk/lib/J3/Compiler/JavaLLVMCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaLLVMCompiler.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaLLVMCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaLLVMCompiler.cpp Sat Nov 27 04:07:18 2010
@@ -116,7 +116,7 @@
   llvm::FunctionPass* createLowerConstantCallsPass(JavaLLVMCompiler* I);
 }
 
-void JavaLLVMCompiler::addJavaPasses(bool trusted) {
+void JavaLLVMCompiler::addJavaPasses() {
   JavaNativeFunctionPasses = new FunctionPassManager(TheModule);
   JavaNativeFunctionPasses->add(new TargetData(TheModule));
   // Lower constant calls to lower things like getClass used
@@ -124,9 +124,7 @@
   JavaNativeFunctionPasses->add(createLowerConstantCallsPass(this));
   
   JavaFunctionPasses = new FunctionPassManager(TheModule);
-  // Add safe points in loops if we don't trust the code (trusted code doesn't
-  // do infinite loops).
-  if (cooperativeGC && !trusted)
+  if (cooperativeGC)
     JavaFunctionPasses->add(mvm::createLoopSafePointsPass());
   // Add other passes after the loop pass, because safepoints may move objects.
   // Moving objects disable many optimizations.

Modified: vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/LLVMInfo.cpp Sat Nov 27 04:07:18 2010
@@ -157,10 +157,8 @@
         JCL->nativeLookup(methodDef, j3, buf);
       }
 
-      if (!j3) {
-        methodDef->jniConsFromMethOverloaded(buf + 1);
-        memcpy(buf, "JnJVM", 5);
-      }
+      methodDef->jniConsFromMethOverloaded(buf + 1);
+      memcpy(buf, "JnJVM", 5);
 
       methodFunction = Function::Create(getFunctionType(), 
                                         GlobalValue::ExternalWeakLinkage, buf,
@@ -171,13 +169,11 @@
                                         "", Compiler->getLLVMModule());
     }
     
-    if (Compiler->useCooperativeGC()) {
-      methodFunction->setGC("vmkit");
-    }
+    methodFunction->setGC("vmkit");
     
     Compiler->functions.insert(std::make_pair(methodFunction, methodDef));
     if (Compiler != JCL->getCompiler() && methodDef->code) {
-      Compiler->setMethod(methodDef, methodDef->code, methodFunction->getName().data());
+      Compiler->setMethod(methodFunction, methodDef->code, methodFunction->getName().data());
     }
   }
   return methodFunction;
@@ -406,10 +402,13 @@
 
   Value* val = CallInst::Create(func, Args.begin(), Args.end(), "",
                                 currentBlock);
-  if (!signature->getReturnType()->isVoid())
+  if (!signature->getReturnType()->isVoid()) {
     ReturnInst::Create(context, val, currentBlock);
-  else
+  } else {
     ReturnInst::Create(context, currentBlock);
+  }
+  
+  res->setGC("vmkit");
 
   return res;
 }
@@ -483,15 +482,14 @@
 
   Value* val = CallInst::Create(func, Args.begin(), Args.end(), "",
                                 currentBlock);
-  if (!signature->getReturnType()->isVoid())
+  if (!signature->getReturnType()->isVoid()) {
     ReturnInst::Create(context, val, currentBlock);
-  else
+  } else {
     ReturnInst::Create(context, currentBlock);
-  
-  if (Compiler->useCooperativeGC()) {
-    res->setGC("vmkit");
   }
   
+  res->setGC("vmkit");
+  
   return res;
 }
 
@@ -547,7 +545,7 @@
   if (virt) {
     if (Compiler->useCooperativeGC()) {
       Args.push_back(new LoadInst(TempArgs[0], "", false, currentBlock));
-    }else {
+    } else {
       Args.push_back(TempArgs[0]);
     }
   }
@@ -589,9 +587,7 @@
     ReturnInst::Create(context, currentBlock);
   }
   
-  if (Compiler->useCooperativeGC()) {
-    stub->setGC("vmkit");
-  }
+  stub->setGC("vmkit");
   
   return stub;
 }

Modified: vmkit/trunk/lib/J3/Compiler/LLVMMaterializer.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LLVMMaterializer.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/LLVMMaterializer.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/LLVMMaterializer.cpp Sat Nov 27 04:07:18 2010
@@ -27,9 +27,8 @@
 using namespace j3;
 
 
-JavaLLVMLazyJITCompiler::JavaLLVMLazyJITCompiler(const std::string& ModuleID,
-                                                 bool trusted)
-    : JavaJITCompiler(ModuleID, trusted) {
+JavaLLVMLazyJITCompiler::JavaLLVMLazyJITCompiler(const std::string& ModuleID)
+    : JavaJITCompiler(ModuleID) {
   TheMaterializer = new LLVMMaterializer(TheModule, this);
   executionEngine->DisableLazyCompilation(false);   
 }

Modified: vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/LowerConstantCalls.cpp Sat Nov 27 04:07:18 2010
@@ -388,8 +388,9 @@
           PHINode* phi = PHINode::Create(intrinsics->JavaObjectType, "", DelegateeOK);
           phi->addIncoming(Del, CI->getParent());
           
-          Value* Res = CallInst::Create(intrinsics->RuntimeDelegateeFunction,
-                                        Call.getArgument(0), "", NoDelegatee);
+          Instruction* Res = CallInst::Create(intrinsics->RuntimeDelegateeFunction,
+                                              Call.getArgument(0), "", NoDelegatee);
+          Res->setDebugLoc(CI->getDebugLoc());
           BranchInst::Create(DelegateeOK, NoDelegatee);
           phi->addIncoming(Res, NoDelegatee);
 
@@ -428,7 +429,7 @@
           BranchInst::Create(trueCl, falseCl, test, CI);
   
           
-          Value* res = 0;
+          Instruction* res = 0;
           if (InvokeInst* Invoke = dyn_cast<InvokeInst>(CI)) {
             Value* Args[1] = { Cl };
             BasicBlock* UI = Invoke->getUnwindDest();
@@ -462,6 +463,7 @@
                                    Cl, "", falseCl);
             BranchInst::Create(trueCl, falseCl);
           }
+          res->setDebugLoc(CI->getDebugLoc());
           
           node->addIncoming(res, falseCl);
 
@@ -512,7 +514,7 @@
             Args.push_back(Call.getArgument(i));
           }
           
-          Value* res = 0;
+          Instruction* res = 0;
           if (InvokeInst* Invoke = dyn_cast<InvokeInst>(CI)) {
             BasicBlock* UI = Invoke->getUnwindDest();
             res = InvokeInst::Create(resolver, trueCl, UI, Args.begin(),
@@ -544,9 +546,9 @@
             BranchInst::Create(trueCl, falseCl);
           }
           
+          res->setDebugLoc(CI->getDebugLoc());
           node->addIncoming(res, falseCl);
 
-
           CI->replaceAllUsesWith(node);
           CI->eraseFromParent();
           BranchInst::Create(NBB, trueCl);
@@ -578,8 +580,9 @@
             BranchInst::Create(NotOKBlock, OKBlock, cmp, CI);
 
             Value* args[3] = { Call.getArgument(0), Call.getArgument(1), GV };
-            Value* res = CallInst::Create(intrinsics->GetArrayClassFunction, args,
-                                          args + 3, "", NotOKBlock);
+            Instruction* res = CallInst::Create(intrinsics->GetArrayClassFunction, args,
+                                                args + 3, "", NotOKBlock);
+            res->setDebugLoc(CI->getDebugLoc());
             BranchInst::Create(OKBlock, NotOKBlock);
             node->addIncoming(res, NotOKBlock);
             
@@ -629,7 +632,8 @@
           CurVT = new LoadInst(CurVT, "", false, CI);
           CurVT = new BitCastInst(CurVT, intrinsics->VTType, "", CI);
              
-          Value* res = new ICmpInst(CI, ICmpInst::ICMP_EQ, CurVT, VT2, "");
+          Instruction* res =
+            new ICmpInst(CI, ICmpInst::ICMP_EQ, CurVT, VT2, "");
 
           node->addIncoming(ConstantInt::getTrue(*Context), CI->getParent());
           BranchInst::Create(CurEndBlock, FailedBlock, res, CI);
@@ -637,6 +641,7 @@
           Value* Args[2] = { VT1, VT2 };
           res = CallInst::Create(intrinsics->IsSecondaryClassFunction, Args,
                                  Args + 2, "", FailedBlock);
+          res->setDebugLoc(CI->getDebugLoc());
          
           node->addIncoming(res, FailedBlock);
           BranchInst::Create(CurEndBlock, FailedBlock);

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=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll (original)
+++ vmkit/trunk/lib/J3/LLVMRuntime/runtime-default.ll Sat Nov 27 04:07:18 2010
@@ -34,18 +34,18 @@
 ;;; Field 2:  void*  MyVM
 ;;; Field 3:  void*  baseSP
 ;;; Field 4:  char   doYield
-;;; field 5:  void*  vmData
-;;; Field 6:  char   inRV
-;;; Field 7:  char   joinedRV
-;;; Field 8:  void*  lastSP
-;;; Field 9:  void*  internalThreadID
-;;; field 10: void*  routine
-;;; field 11: void*  lastKnownFrame
-;;; field 12: void*  lastExceptionBuffer
-%Thread = type { %CircularBase, i32, i8*, i8*, i8, i8, i8, i8*, i8*, i8*, i8*, i8* }
+;;; Field 5:  char   inRV
+;;; Field 6:  char   joinedRV
+;;; Field 7:  void*  lastSP
+;;; Field 8:  void*  internalThreadID
+;;; field 9:  void*  routine
+;;; field 10: void*  lastKnownFrame
+;;; field 11: void*  lastExceptionBuffer
+%Thread = type { %CircularBase, i8*, i8*, i8*, i8, i8, i8, i8*, i8*, i8*, i8*, i8* }
 
 %JavaThread = type { %MutatorThread, i8*, %JavaObject* }
 
+%JavaConstantPool = type { %JavaClass*, i32, i8*, i32*, i8** }
 
 %Attribut = type { %UTF8*, i32, i32 }
 
@@ -55,7 +55,7 @@
 %JavaField = type { i8*, i16, %UTF8*, %UTF8*, %Attribut*, i16, %JavaClass*, i32,
                     i16 }
 
-%CodeLineInfo = type { i8*, i16, i16, %JavaMethod*, %CodeLineInfo* }
+%CodeLineInfo = type { i8*, %JavaMethod*, %CodeLineInfo* }
 
 %JavaMethod = type { i8*, i16, %Attribut*, i16, %JavaClass*,
                      %UTF8*, %UTF8*, i8, i8*, %CodeLineInfo*, i16, i32 }
@@ -208,6 +208,7 @@
 declare i8* @j3ResolveVirtualStub(%JavaObject*)
 declare i8* @j3ResolveSpecialStub()
 declare i8* @j3ResolveStaticStub()
+declare i8* @j3ResolveInterface(%JavaObject*, %JavaMethod*, i32)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Exception methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Modified: vmkit/trunk/lib/J3/LLVMRuntime/runtime-mmtk-thread.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/LLVMRuntime/runtime-mmtk-thread.ll?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/LLVMRuntime/runtime-mmtk-thread.ll (original)
+++ vmkit/trunk/lib/J3/LLVMRuntime/runtime-mmtk-thread.ll Sat Nov 27 04:07:18 2010
@@ -1,7 +1,7 @@
-%BumpPtrAllocator = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8* }
+%ThreadAllocator = type { i8*, i8*, i8*, i8*, i8*, i8*, i8* }
 
 ;;; Field 0: the thread
 ;;; field 1: allocator
 ;;; field 2: MutatorContext
 ;;; field 3: realRoutine
-%MutatorThread = type { %Thread, %BumpPtrAllocator, i8*, i8* }
+%MutatorThread = type { %Thread, %ThreadAllocator, i8*, i8* }

Modified: vmkit/trunk/lib/J3/VMCore/JavaArray.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaArray.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaArray.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaArray.h Sat Nov 27 04:07:18 2010
@@ -36,7 +36,7 @@
 ///  {JavaObject, size, [0 * T]}.
 template <class T>
 class TJavaArray : public JavaObject {
-private:
+public:
   /// size - The (constant) size of the array.
   ssize_t size;
 
@@ -75,7 +75,7 @@
 };
 
 class ArrayObject : public JavaObject {
-private:
+public:
   /// size - The (constant) size of the array.
   ssize_t size;
 
@@ -98,6 +98,7 @@
   static void setElement(ArrayObject* self, JavaObject* value, uint32_t i) {
     llvm_gcroot(self, 0);
     llvm_gcroot(value, 0);
+    if (value != NULL) assert(value->getVirtualTable());
     self->elements[i] = value;
   }
 

Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.cpp Sat Nov 27 04:07:18 2010
@@ -216,9 +216,8 @@
   logSize = nb;
 }
 
-Class::Class(JnjvmClassLoader* loader, const UTF8* n, ArrayUInt8* B) : 
+Class::Class(JnjvmClassLoader* loader, const UTF8* n, ClassBytes* B) : 
     CommonClass(loader, n) {
-  llvm_gcroot(B, 0);
   virtualVT = 0;
   bytes = B;
   super = 0;
@@ -287,31 +286,8 @@
   return code;
 }
 
-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());
-  if (ip != new_ip) fprintf(stderr, " (from stub)");
-  fprintf(stderr, "\n");
-}
-
-void JavaMethod::setCompiledPtr(void* ptr, const char* name) {
-  classDef->acquire();
-  if (code == 0) {
-    code = ptr;
-    Jnjvm* vm = JavaThread::get()->getJVM();
-    mvm::MethodInfo* MI = vm->SharedStaticFunctions.CodeStartToMethodInfo(ptr);
-    JavaStaticMethodInfo* JMI =
-      new (classDef->classLoader->allocator, "JavaStaticMethodInfo")
-        JavaStaticMethodInfo((mvm::CamlMethodInfo*)MI, code, this);
-    vm->StaticFunctions.addMethodInfo(JMI, code);
-    classDef->classLoader->getCompiler()->setMethod(this, ptr, name);
-  }
+void JavaMethod::setNative() {
   access |= ACC_NATIVE;
-  classDef->release();
 }
 
 void JavaVirtualTable::setNativeTracer(uintptr_t ptr, const char* name) {
@@ -624,7 +600,7 @@
   if (!attribut) {
     InitNullStaticField();
   } else {
-    Reader reader(attribut, &(classDef->bytes));
+    Reader reader(attribut, classDef->bytes);
     JavaConstantPool * ctpInfo = classDef->ctpInfo;
     uint16 idx = reader.readU2();
     if (type->isPrimitive()) {
@@ -710,7 +686,7 @@
   Attribut* codeAtt = meth.lookupAttribut(Attribut::codeAttribut);
    
   if (codeAtt) {
-    Reader reader(codeAtt, &(meth.classDef->bytes));
+    Reader reader(codeAtt, meth.classDef->bytes);
     //uint16 maxStack =
     reader.readU2();
     //uint16 maxLocals = 
@@ -789,14 +765,16 @@
     interfaces[i]->fillIMT(meths);
   }
 
-  if (super) super->fillIMT(meths);
+  if (super != NULL) {
+    super->fillIMT(meths);
+  }
 
-  if (isInterface()) {
+  // Specification says that an invokeinterface also looks at j.l.Object.
+  if (isInterface() || (super == NULL)) {
     for (uint32 i = 0; i < nbVirtualMethods; ++i) {
       JavaMethod& meth = virtualMethods[i];
       uint32_t index = InterfaceMethodTable::getIndex(meth.name, meth.type);
-      if (meths[index].find(&meth) == meths[index].end())
-        meths[index].insert(&meth);
+      meths[index].insert(&meth);
     }
   }
 }
@@ -911,7 +889,7 @@
   PRINT_DEBUG(JNJVM_LOAD, 0, LIGHT_GREEN, "reading ", 0);
   PRINT_DEBUG(JNJVM_LOAD, 0, COLOR_NORMAL, "%s\n", mvm::PrintBuffer(this).cString());
 
-  Reader reader(&bytes);
+  Reader reader(bytes);
   uint32 magic = reader.readU4();
   assert(magic == Jnjvm::Magic && "I've created a class but magic is no good!");
 
@@ -946,14 +924,22 @@
     interfaces[i]->resolveClass(); 
 }
 
-
 #ifndef ISOLATE_SHARING
+#ifdef ISOLATE
+void Class::resolveClass() {
+  UNIMPLEMENTED();
+}
+#else
 void Class::resolveClass() {
   if (isResolved() || isErroneous()) return;
   resolveParents();
   loadExceptions();
-  setResolved();
+  // Do a compare and swap in case another thread initialized the class.
+  __sync_val_compare_and_swap(
+      &(getCurrentTaskClassMirror().status), loaded, resolved);
+  assert(isResolved() || isErroneous());
 }
+#endif
 #else
 void Class::resolveClass() {
   assert(status >= resolved && 
@@ -965,7 +951,7 @@
   if (!innerOuterResolved) {
     Attribut* attribut = lookupAttribut(Attribut::innerClassesAttribut);
     if (attribut != 0) {
-      Reader reader(attribut, getBytesPtr());
+      Reader reader(attribut, bytes);
       uint16 nbi = reader.readU2();
       for (uint16 i = 0; i < nbi; ++i) {
         uint16 inner = reader.readU2();
@@ -1042,7 +1028,7 @@
     return (ArrayObject*)vm->upcalls->classArrayClass->doNew(0, vm);
   } else {
     UserConstantPool* ctp = classDef->getConstantPool();
-    Reader reader(exceptionAtt, classDef->getBytesPtr());
+    Reader reader(exceptionAtt, classDef->bytes);
     uint16 nbe = reader.readU2();
     res = (ArrayObject*)vm->upcalls->classArrayClass->doNew(nbe, vm);
 
@@ -1144,19 +1130,35 @@
   
   for (sint32 i =0; i < mnlen; ++i) {
     cur = jniConsName->elements[i];
-    if (cur == '/') ptr[0] = '_';
-    else if (cur == '_') {
+    if (cur == '/') {
+      ptr[0] = '_';
+      ++ptr;
+    } else if (cur == '_') {
       ptr[0] = '_';
       ptr[1] = '1';
+      ptr += 2;
+    } else if (cur == '<') {
+      ptr[0] = '_';
+      ptr[1] = '0';
+      ptr[2] = '0';
+      ptr[3] = '0';
+      ptr[4] = '3';
+      ptr[5] = 'C';
+      ptr += 6;
+    } else if (cur == '>') {
+      ptr[0] = '_';
+      ptr[1] = '0';
+      ptr[2] = '0';
+      ptr[3] = '0';
+      ptr[4] = '3';
+      ptr[5] = 'E';
+      ptr += 6;
+    } else {
+      ptr[0] = (uint8)cur;
       ++ptr;
     }
-    else ptr[0] = (uint8)cur;
-    ++ptr;
-  }
-  
+  } 
   ptr[0] = 0;
-
-
 }
 
 void JavaMethod::jniConsFromMethOverloaded(char* buf, const UTF8* jniConsClName,
@@ -1752,32 +1754,56 @@
 
 CodeLineInfo* JavaMethod::lookupCodeLineInfo(uintptr_t ip) {
   for(uint16 i = 0; i < codeInfoLength; ++i) {
-    if (codeInfo[i].address > ip) {
-      assert(i > 0 && "Wrong ip address for method");
-      return &(codeInfo[i - 1]);
+    if (codeInfo[i].address == ip) {
+      return &(codeInfo[i]);
     }
   }
-  if (codeInfoLength) return &(codeInfo[codeInfoLength - 1]);
   return NULL;
 }
 
 uint16 JavaMethod::lookupLineNumber(uintptr_t ip) {
-  for(uint16 i = 1; i < codeInfoLength; ++i) {
-    if (codeInfo[i].address > ip) {
-      return codeInfo[i - 1].lineNumber;
+  for(uint16 i = 0; i < codeInfoLength; ++i) {
+    if (codeInfo[i].address == ip) {
+      Attribut* codeAtt = lookupAttribut(Attribut::codeAttribut);      
+      if (codeAtt == NULL) return 0;
+      Reader reader(codeAtt, classDef->bytes);
+      reader.readU2(); // max_stack
+      reader.readU2(); // max_locals;
+      uint32_t codeLength = reader.readU4();
+      reader.seek(codeLength, Reader::SeekCur);
+      uint16_t exceptionTableLength = reader.readU2();
+      reader.seek(8 * exceptionTableLength, Reader::SeekCur);
+      uint16_t nba = reader.readU2();
+      for (uint16 att = 0; att < nba; ++att) {
+        const UTF8* attName = classDef->ctpInfo->UTF8At(reader.readU2());
+        uint32 attLen = reader.readU4();
+        if (attName->equals(Attribut::lineNumberTableAttribut)) {
+          uint16_t lineLength = reader.readU2();
+          uint16_t currentLine = 0;
+          for (uint16 j = 0; j < lineLength; ++j) {
+            uint16 pc = reader.readU2();
+            if (pc > codeInfo[i].bytecodeIndex + 1) return currentLine;
+            currentLine = reader.readU2();
+          }
+          return currentLine;
+        } else {
+          reader.seek(attLen, Reader::SeekCur);      
+        }
+      }
     }
   }
-  if (codeInfoLength) return codeInfo[codeInfoLength - 1].lineNumber;
   return 0;
 }
 
 uint16 JavaMethod::lookupCtpIndex(uintptr_t ip) {
-  for(uint16 i = 1; i < codeInfoLength; ++i) {
-    if (codeInfo[i].address > ip) {
-      return codeInfo[i - 1].ctpIndex;
+  for(uint16 i = 0; i < codeInfoLength; ++i) {
+    if (codeInfo[i].address == ip) {
+      Attribut* codeAtt = lookupAttribut(Attribut::codeAttribut);
+      Reader reader(codeAtt, classDef->bytes);
+      reader.cursor = reader.cursor + 2 + 2 + 4 + codeInfo[i].bytecodeIndex + 1;
+      return reader.readU2();
     }
   }
-  if (codeInfoLength) return codeInfo[codeInfoLength - 1].ctpIndex;
   return 0;
 }
 

Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.h Sat Nov 27 04:07:18 2010
@@ -34,6 +34,7 @@
 class ArrayUInt16;
 class Class;
 class ClassArray;
+class ClassBytes;
 class JavaArray;
 class JavaConstantPool;
 class JavaField;
@@ -457,7 +458,7 @@
   
   /// bytes - The .class file of this class.
   ///
-  ArrayUInt8* bytes;
+  ClassBytes* bytes;
 
   /// ctpInfo - The constant pool info of this class.
   ///
@@ -621,7 +622,7 @@
   
   /// Class - Create a class in the given virtual machine and with the given
   /// name.
-  Class(JnjvmClassLoader* loader, const UTF8* name, ArrayUInt8* bytes);
+  Class(JnjvmClassLoader* loader, const UTF8* name, ClassBytes* bytes);
   
   /// readParents - Reads the parents, i.e. super and interfaces, of the class.
   ///
@@ -656,14 +657,10 @@
 
   /// getBytes - Get the bytes of the class file.
   ///
-  ArrayUInt8* getBytes() const {
+  ClassBytes* getBytes() const {
     return bytes;
   }
   
-  ArrayUInt8** getBytesPtr() {
-    return &bytes;
-  }
-  
   /// resolveInnerOuterClasses - Resolve the inner/outer information.
   ///
   void resolveInnerOuterClasses();
@@ -873,25 +870,10 @@
   
 };
 
-class JavaStaticMethodInfo : public mvm::CamlMethodInfo {
-public:
-  virtual void print(void* ip, void* addr);
-  
-  JavaStaticMethodInfo(mvm::CamlMethodInfo* super, void* ip, JavaMethod* M) :
-    mvm::CamlMethodInfo(super != NULL ? super->CF : NULL, ip) {
-    MetaInfo = M;
-    MethodType = 1;
-  }
-
-};
-
 class CodeLineInfo : public mvm::PermanentObject {
 public:
   uintptr_t address;
-  uint16 lineNumber;
-  uint16 ctpIndex;
   uint16 bytecodeIndex;
-  uint16 bytecode;
   // TODO: Use these fields when inlining.
   JavaMethod* executingMethod;
   // The code where the inlined method starts.
@@ -925,9 +907,9 @@
   ///
   void* compiledPtr();
 
-  /// setCompiledPtr - Set the pointer function to the method.
+  /// setNative - Set the method as native.
   ///
-  void setCompiledPtr(void*, const char*);
+  void setNative();
   
   /// JavaMethod - Delete the method as well as the cache enveloppes and
   /// attributes of the method.
@@ -1315,6 +1297,7 @@
 
   void setStaticObjectField(JavaObject* val) {
     llvm_gcroot(val, 0);
+    if (val != NULL) assert(val->getVirtualTable());
     assert(classDef->isResolved());
     void* ptr = (void*)((uint64)classDef->getStaticInstance() + ptrOffset);
     ((JavaObject**)ptr)[0] = val;
@@ -1330,6 +1313,7 @@
   void setInstanceObjectField(JavaObject* obj, JavaObject* val) {
     llvm_gcroot(obj, 0);
     llvm_gcroot(val, 0);
+    if (val != NULL) assert(val->getVirtualTable());
     assert(classDef->isResolved());
     void* ptr = (void*)((uint64)obj + ptrOffset);
     ((JavaObject**)ptr)[0] = val;

Modified: vmkit/trunk/lib/J3/VMCore/JavaConstantPool.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaConstantPool.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaConstantPool.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaConstantPool.cpp Sat Nov 27 04:07:18 2010
@@ -190,7 +190,7 @@
   
   if (!ctpRes[entry]) {
     mvm::ThreadAllocator allocator;
-    Reader reader(&(classDef->bytes), ctpDef[entry]);
+    Reader reader(classDef->bytes, ctpDef[entry]);
     uint32 len = reader.readU2();
     uint16* buf = (uint16*)allocator.Allocate(len * sizeof(uint16));
     uint32 n = 0;

Modified: vmkit/trunk/lib/J3/VMCore/JavaConstantPool.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaConstantPool.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaConstantPool.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaConstantPool.h Sat Nov 27 04:07:18 2010
@@ -52,7 +52,7 @@
   /// ctpRes - Objects resolved dynamically, e.g. UTF8s, classes, methods,
   /// fields, string pointers.
   ///
-  void**  ctpRes; 
+  void**  ctpRes;
   
   /// operator new - Redefine the operator to allocate the arrays of a
   /// constant pool inline.

Removed: vmkit/trunk/lib/J3/VMCore/JavaInitialise.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaInitialise.cpp?rev=120205&view=auto
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaInitialise.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaInitialise.cpp (removed)
@@ -1,56 +0,0 @@
-//===-------- JavaInitialise.cpp - Initialization of JnJVM ----------------===//
-//
-//                            The VMKit project
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "mvm/VirtualMachine.h"
-#include "j3/JavaCompiler.h"
-
-#include "JavaArray.h"
-#include "JavaClass.h"
-#include "JavaObject.h"
-#include "Jnjvm.h"
-#include "JnjvmClassLoader.h"
-
-#ifdef ISOLATE_SHARING
-#include "SharedMaps.h"
-#include "IsolateSharedLoader.h"
-#endif
-
-using namespace j3;
-
-
-#ifdef ISOLATE_SHARING
-JnjvmClassLoader* mvm::VirtualMachine::initialiseJVM(JavaCompiler* Comp) {
-  JnjvmSharedLoader::sharedLoader = JnjvmSharedLoader::createSharedLoader(Comp);
-  return JnjvmSharedLoader::sharedLoader;
-}
-
-mvm::VirtualMachine* mvm::VirtualMachine::createJVM(JnjvClassLoader* JCL) {
-  mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator();
-  mvm::BumpPtrAllocator* C = new mvm::BumpPtrAllocator();
-  JnjvmBootstraLoader* bootstrapLoader = 
-    new(*C) JnjvmBootstrapLoader(*C, JCL->getCompiler());
-  Jnjvm* vm = new(*A, "VM") Jnjvm(*A, bootstrapLoader);
-  vm->scanner = JCL->getCompiler()->createStackScanner();
-  return vm;
-}
-#else
-  
-JnjvmClassLoader*
-mvm::VirtualMachine::initialiseJVM(JavaCompiler* Comp, bool dlLoad) {
-  mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator();
-  return new(*A, "Bootstrap loader") JnjvmBootstrapLoader(*A, Comp, dlLoad);
-}
-
-mvm::VirtualMachine* mvm::VirtualMachine::createJVM(JnjvmClassLoader* C) {
-  mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator();
-  Jnjvm* vm = new(*A, "VM") Jnjvm(*A, (JnjvmBootstrapLoader*)C);
-  return vm;
-}
-
-#endif

Removed: vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp?rev=120205&view=auto
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaLocks.cpp (removed)
@@ -1,133 +0,0 @@
-//===------------- JavaLocks.cpp - Fat lock management --------------------===//
-//
-//                            The VMKit project
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "JavaLocks.h"
-#include "JavaThread.h"
-#include "Jnjvm.h"
-
-using namespace j3;
-
-JavaLock* Jnjvm::allocateFatLock(gc* obj) {
-  llvm_gcroot(obj, 0);
-  JavaLock* res = lockSystem.allocate((JavaObject*)obj);  
-  return res;
-}
-
-void JavaLock::deallocate() {
-  Jnjvm* vm = JavaThread::get()->getJVM();
-  vm->lockSystem.deallocate(this);
-}
-
-JavaLock* LockSystem::allocate(JavaObject* obj) { 
- 
-  llvm_gcroot(obj, 0); 
-  JavaLock* res = 0;
-  threadLock.lock();
-
-  // Try the freeLock list.
-  if (freeLock != NULL) {
-    res = freeLock;
-    freeLock = res->nextFreeLock;
-    res->nextFreeLock = 0;
-    assert(res->associatedObject == NULL);
-    threadLock.unlock();
-    res->associatedObject = obj;
-  } else { 
-    // Get an index.
-    uint32_t index = currentIndex++;
-    if (index == MaxLocks) {
-      fprintf(stderr, "Ran out of space for allocating locks");
-      abort();
-    }
-  
-    JavaLock** tab = LockTable[index >> BitIndex];
-  
-    if (tab == NULL) {
-      tab = (JavaLock**)associatedVM->allocator.Allocate(
-          IndexSize * sizeof(JavaLock*), "Index LockTable");
-    }
-    threadLock.unlock();
-   
-    // Allocate the lock.
-    res = new(associatedVM->allocator, "Lock") JavaLock(index, obj);
-    
-    // Add the lock to the table.
-    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;
-  LockTable = (JavaLock* **)
-    vm->allocator.Allocate(GlobalSize * sizeof(JavaLock**), "Global LockTable");
-  LockTable[0] = (JavaLock**)
-    vm->allocator.Allocate(IndexSize * sizeof(JavaLock*), "Index LockTable");
-  currentIndex = 0;
-  freeLock = NULL;
-}
-
-uintptr_t JavaLock::getID() {
-  return (index << mvm::NonLockBits) | mvm::FatMask;
-}
-
-JavaLock* Jnjvm::getFatLockFromID(uintptr_t ID) {
-  if (ID & mvm::FatMask) {
-    uint32_t index = (ID & ~mvm::FatMask) >> mvm::NonLockBits;
-    JavaLock* res = lockSystem.getLock(index);
-    return res;
-  } else {
-    return NULL;
-  }
-}
-
-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) {
-    mvm::ThinLock::initialise(associatedObject);
-    deallocate();
-  }
-  internalLock.unlock();
-}
-
-/// acquire - Acquires the internalLock.
-///
-bool JavaLock::acquire(gc* 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;
-}

Removed: vmkit/trunk/lib/J3/VMCore/JavaLocks.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaLocks.h?rev=120205&view=auto
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaLocks.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaLocks.h (removed)
@@ -1,159 +0,0 @@
-//===--------------- JavaLocks.h - Fat lock management --------------------===//
-//
-//                            The VMKit project
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef JAVA_LOCKS_H
-#define JAVA_LOCKS_H
-
-#include "mvm/Allocator.h"
-#include "mvm/Threads/Locks.h"
-#include "mvm/VirtualMachine.h"
-
-namespace mvm {
-  class Thread;
-}
-
-namespace j3 {
-
-class JavaObject;
-class JavaThread;
-class Jnjvm;
-
-class JavaLock : public mvm::FatLock {
-
-friend class JavaObject;
-friend class LockSystem;
-
-private:
-  mvm::LockRecursive internalLock;
-  mvm::SpinLock spinLock;
-  uint32_t waitingThreads;
-  uint32_t lockingThreads;
-  JavaThread* firstThread;
-  JavaObject* associatedObject;
-  uint32_t index;
-  JavaLock* nextFreeLock;
-
-public:
-
-  JavaObject* getAssociatedObject() {
-    return associatedObject;
-  }
-
-  JavaObject** getAssociatedObjectPtr() {
-    return &associatedObject;
-  }
-
-  /// acquire - Acquires the internalLock.
-  ///
-  bool acquire(gc* obj);
- 
-  /// tryAcquire - Tries to acquire the lock.
-  ///
-  int tryAcquire() {
-    return internalLock.tryLock();
-  }
-
- 
-  /// acquireAll - Acquires the lock nb times.
-  void acquireAll(gc* obj, uint32 nb) {
-    internalLock.lockAll(nb);
-  }
-
-  /// release - Releases the internalLock.
-  ///
-  void release(gc* obj);
-  
-  /// owner - Returns if the current thread owns this internalLock.
-  ///
-  bool owner() {
-    return internalLock.selfOwner();
-  }
- 
-  /// getOwner - Get the owner of this internalLock.
-  ///
-  mvm::Thread* getOwner() {
-    return internalLock.getOwner();
-  }
-  
-  /// JavaLock - Default constructor.
-  JavaLock(uint32_t i, JavaObject* a) {
-    llvm_gcroot(a, 0);
-    firstThread = 0;
-    index = i;
-    associatedObject = a;
-    waitingThreads = 0;
-    lockingThreads = 0;
-    nextFreeLock = NULL;
-  }
-
-  void deallocate();
-  
-  uintptr_t getID();
-};
-
-/// LockSystem - This class manages all Java locks used by the applications.
-/// Each JVM must own an instance of this class and allocate Java locks
-/// with it.
-///
-class LockSystem {
-  friend class JavaLock;
-public:
-  
-  // Fixed values. With these values, an index is on 18 bits.
-  static const uint32_t GlobalSize = 128;
-  static const uint32_t BitIndex = 11;
-  static const uint32_t IndexSize = 1 << BitIndex;
-  static const uint32_t BitMask = IndexSize - 1;
-  static const uint32_t MaxLocks = GlobalSize * IndexSize;
-
-  /// LockTable - The global table that will hold the locks. The table is
-  /// a two-dimensional array, and only one entry is created, so that
-  /// the lock system does not eat up all memory on startup.
-  ///  
-  JavaLock* ** LockTable;
-  
-  /// currentIndex - The current index in the tables. Always incremented,
-  /// never decremented.
-  ///
-  uint32_t currentIndex;
- 
-  /// freeLock - The list of locks that are allocated and available.
-  ///
-  JavaLock* freeLock;
- 
-  /// threadLock - Spin lock to protect the currentIndex field.
-  ///
-  mvm::SpinLock threadLock;
-  
-  /// associatedVM - The JVM associated with this lock system.
-  ///
-  Jnjvm* associatedVM;  
-
-  /// allocate - Allocate a JavaLock.
-  ///
-  JavaLock* allocate(JavaObject* obj); 
- 
-  /// deallocate - Put a lock in the free list lock.
-  ///
-  void deallocate(JavaLock* lock);
-
-  /// LockSystem - Default constructor. Initialize the table.
-  ///
-  LockSystem(Jnjvm* vm);
-
-  /// getLock - Get a lock from an index in the table.
-  ///
-  JavaLock* getLock(uint32_t index) {
-    return LockTable[index >> BitIndex][index & BitMask];
-  }
-};
-
-}
-
-#endif

Modified: vmkit/trunk/lib/J3/VMCore/JavaMetaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaMetaJIT.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaMetaJIT.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaMetaJIT.cpp Sat Nov 27 04:07:18 2010
@@ -289,19 +289,3 @@
 INVOKE(float,  Float, float_virtual_ap,  float_static_ap,  float_virtual_buf,  float_static_buf)
 INVOKE(double, Double, double_virtual_ap, double_static_ap, double_virtual_buf, double_static_buf)
 INVOKE(JavaObject*, JavaObject, object_virtual_ap, object_static_ap, object_virtual_buf, object_static_buf)
-
-void Jnjvm::invokeFinalizer(gc* _obj) {
-  JavaObject* obj = (JavaObject*)_obj;
-  llvm_gcroot(obj, 0);
-  JavaMethod* meth = upcalls->FinalizeObject;
-  UserClass* cl = JavaObject::getClass(obj)->asClass();
-  meth->invokeIntVirtualBuf(this, cl, obj, 0);
-}
-
-bool Jnjvm::enqueueReference(gc* _obj) {
-  JavaObject* obj = (JavaObject*)_obj;
-  llvm_gcroot(obj, 0);
-  JavaMethod* meth = upcalls->EnqueueReference;
-  UserClass* cl = JavaObject::getClass(obj)->asClass();
-  return (bool)meth->invokeIntSpecialBuf(this, cl, obj, 0);
-}

Modified: vmkit/trunk/lib/J3/VMCore/JavaObject.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaObject.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaObject.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaObject.cpp Sat Nov 27 04:07:18 2010
@@ -17,6 +17,7 @@
 #include "Jnjvm.h"
 
 #include <jni.h>
+#include "debug.h"
 
 using namespace j3;
 
@@ -45,7 +46,6 @@
   }
   assert(val > mvm::GCBitMask);
   assert(val <= mvm::HashMask);
-  assert(val != hashCodeGenerator);
 
   do {
     header = self->header;
@@ -64,103 +64,20 @@
 void JavaObject::waitIntern(
     JavaObject* self, struct timeval* info, bool timed) {
   llvm_gcroot(self, 0);
-  JavaLock* l = 0;
+  JavaThread* thread = JavaThread::get();
+  mvm::LockSystem& table = thread->getJVM()->lockSystem;
 
-  if (owner(self)) {
-    l = (JavaLock*)mvm::ThinLock::changeToFatlock(self);
-    JavaThread* thread = JavaThread::get();
-    thread->waitsOn = l;
-    mvm::Cond& varcondThread = thread->varcond;
-
-    if (thread->interruptFlag != 0) {
-      thread->interruptFlag = 0;
-      thread->waitsOn = 0;
-      thread->getJVM()->interruptedException(self);
-    } else { 
-      thread->state = JavaThread::StateWaiting;
-      if (l->firstThread) {
-        assert(l->firstThread->prevWaiting && l->firstThread->nextWaiting &&
-               "Inconsistent list");
-        if (l->firstThread->nextWaiting == l->firstThread) {
-          l->firstThread->nextWaiting = thread;
-        } else {
-          l->firstThread->prevWaiting->nextWaiting = thread;
-        } 
-        thread->prevWaiting = l->firstThread->prevWaiting;
-        thread->nextWaiting = l->firstThread;
-        l->firstThread->prevWaiting = thread;
-      } else {
-        l->firstThread = thread;
-        thread->nextWaiting = thread;
-        thread->prevWaiting = thread;
-      }
-      assert(thread->prevWaiting && thread->nextWaiting && "Inconsistent list");
-      assert(l->firstThread->prevWaiting && l->firstThread->nextWaiting &&
-             "Inconsistent list");
-      
-      bool timeout = false;
-
-      l->waitingThreads++;
-
-      while (!thread->interruptFlag && thread->nextWaiting) {
-        if (timed) {
-          timeout = varcondThread.timedWait(&l->internalLock, info);
-          if (timeout) break;
-        } else {
-          varcondThread.wait(&l->internalLock);
-        }
-      }
-      
-      l->waitingThreads--;
-     
-      assert((!l->firstThread || (l->firstThread->prevWaiting && 
-             l->firstThread->nextWaiting)) && "Inconsistent list");
- 
-      bool interrupted = (thread->interruptFlag != 0);
-
-      if (interrupted || timeout) {
-        
-        if (thread->nextWaiting) {
-          assert(thread->prevWaiting && "Inconsistent list");
-          if (l->firstThread != thread) {
-            thread->nextWaiting->prevWaiting = thread->prevWaiting;
-            thread->prevWaiting->nextWaiting = thread->nextWaiting;
-            assert(l->firstThread->prevWaiting && 
-                   l->firstThread->nextWaiting && "Inconsistent list");
-          } else if (thread->nextWaiting == thread) {
-            l->firstThread = 0;
-          } else {
-            l->firstThread = thread->nextWaiting;
-            l->firstThread->prevWaiting = thread->prevWaiting;
-            thread->prevWaiting->nextWaiting = l->firstThread;
-            assert(l->firstThread->prevWaiting && 
-                   l->firstThread->nextWaiting && "Inconsistent list");
-          }
-          thread->nextWaiting = 0;
-          thread->prevWaiting = 0;
-        } else {
-          assert(!thread->prevWaiting && "Inconstitent state");
-          // Notify lost, notify someone else.
-          notify(self);
-        }
-      } else {
-        assert(!thread->prevWaiting && !thread->nextWaiting &&
-               "Inconsistent state");
-      }
-      
-      thread->state = JavaThread::StateRunning;
-      thread->waitsOn = 0;
-
-      if (interrupted) {
-        thread->interruptFlag = 0;
-        thread->getJVM()->interruptedException(self);
-      }
-    }
-  } else {
-    JavaThread::get()->getJVM()->illegalMonitorStateException(self);
+  if (!owner(self)) {
+    thread->getJVM()->illegalMonitorStateException(self);
+    UNREACHABLE();
+  }
+
+  bool interrupted = thread->lockingThread.wait(self, table, info, timed);
+
+  if (interrupted) {
+    thread->getJVM()->interruptedException(self);
+    UNREACHABLE();
   }
-  
-  assert(owner(self) && "Not owner after wait");
 }
 
 void JavaObject::wait(JavaObject* self) {
@@ -175,72 +92,46 @@
 
 void JavaObject::notify(JavaObject* self) {
   llvm_gcroot(self, 0);
-  JavaLock* l = 0;
+  JavaThread* thread = JavaThread::get();
+  mvm::LockSystem& table = thread->getJVM()->lockSystem;
 
-  if (owner(self)) {
-    l = (JavaLock*)mvm::ThinLock::getFatLock(self);
-    if (l) {
-      JavaThread* cur = l->firstThread;
-      if (cur) {
-        do {
-          if (cur->interruptFlag != 0) {
-            cur = cur->nextWaiting;
-          } else {
-            assert(cur->javaThread && "No java thread");
-            assert(cur->prevWaiting && cur->nextWaiting &&
-                   "Inconsistent list");
-            if (cur != l->firstThread) {
-              cur->prevWaiting->nextWaiting = cur->nextWaiting;
-              cur->nextWaiting->prevWaiting = cur->prevWaiting;
-              assert(l->firstThread->prevWaiting &&
-                     l->firstThread->nextWaiting && "Inconsistent list");
-            } else if (cur->nextWaiting == cur) {
-              l->firstThread = 0;
-            } else {
-              l->firstThread = cur->nextWaiting;
-              l->firstThread->prevWaiting = cur->prevWaiting;
-              cur->prevWaiting->nextWaiting = l->firstThread;
-              assert(l->firstThread->prevWaiting && 
-                     l->firstThread->nextWaiting && "Inconsistent list");
-            }
-            cur->prevWaiting = 0;
-            cur->nextWaiting = 0;
-            cur->varcond.signal();
-            break;
-          }
-        } while (cur != l->firstThread);
-      }
-    }
-  } else {
-    JavaThread::get()->getJVM()->illegalMonitorStateException(self);
+  if (!owner(self)) {
+    thread->getJVM()->illegalMonitorStateException(self);
+    UNREACHABLE();
   }
-  assert(owner(self) && "Not owner after notify");
+  thread->lockingThread.notify(self, table);
 }
 
 void JavaObject::notifyAll(JavaObject* self) {
   llvm_gcroot(self, 0);
-  JavaLock* l = 0;
-  
-  if (owner(self)) {
-    l = (JavaLock*)mvm::ThinLock::getFatLock(self);
-    if (l) {
-      JavaThread* cur = l->firstThread;
-      if (cur) {
-        do {
-          JavaThread* temp = cur->nextWaiting;
-          cur->prevWaiting = 0;
-          cur->nextWaiting = 0;
-          cur->varcond.signal();
-          cur = temp;
-        } while (cur != l->firstThread);
-        l->firstThread = 0;
-      }
-    }
-  } else {
-    JavaThread::get()->getJVM()->illegalMonitorStateException(self);
+  JavaThread* thread = JavaThread::get();
+  mvm::LockSystem& table = thread->getJVM()->lockSystem;
+
+  if (!owner(self)) {
+    thread->getJVM()->illegalMonitorStateException(self);
+    UNREACHABLE();
   }
+  thread->lockingThread.notifyAll(self, table);
+}
+
+void JavaObject::overflowThinLock(JavaObject* self) {
+  llvm_gcroot(self, 0);
+  mvm::ThinLock::overflowThinLock(self, JavaThread::get()->getJVM()->lockSystem);
+}
 
-  assert(owner(self) && "Not owner after notifyAll");
+void JavaObject::acquire(JavaObject* self) {
+  llvm_gcroot(self, 0);
+  mvm::ThinLock::acquire(self, JavaThread::get()->getJVM()->lockSystem);
+}
+
+void JavaObject::release(JavaObject* self) {
+  llvm_gcroot(self, 0);
+  mvm::ThinLock::release(self, JavaThread::get()->getJVM()->lockSystem);
+}
+
+bool JavaObject::owner(JavaObject* self) {
+  llvm_gcroot(self, 0);
+  return mvm::ThinLock::owner(self, JavaThread::get()->getJVM()->lockSystem);
 }
 
 void JavaObject::decapsulePrimitive(JavaObject* obj, Jnjvm *vm, jvalue* buf,

Modified: vmkit/trunk/lib/J3/VMCore/JavaObject.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaObject.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaObject.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaObject.h Sat Nov 27 04:07:18 2010
@@ -18,7 +18,6 @@
 
 #include "types.h"
 
-#include "JavaLocks.h"
 #include "JnjvmConfig.h"
 
 union jvalue;
@@ -244,6 +243,10 @@
     llvm_gcroot(self, 0);
     return ((JavaVirtualTable*)self->getVirtualTable())->cl;
   }
+  
+  /// instanceOf - Is this object's class of type the given class?
+  ///
+  static bool instanceOf(JavaObject* self, UserCommonClass* cl);
 
   /// wait - Java wait. Makes the current thread waiting on a monitor.
   ///
@@ -264,35 +267,19 @@
   ///
   static void notifyAll(JavaObject* self);
  
-  /// overflowmvm::ThinLock - Notify that the thin lock has overflowed.
-  ///
-  static void overflowThinLock(JavaObject* self) {
-    llvm_gcroot(self, 0);
-    mvm::ThinLock::overflowThinLock(self);
-  }
-
-  /// instanceOf - Is this object's class of type the given class?
+  /// overflowThinLock - Notify that the thin lock has overflowed.
   ///
-  static bool instanceOf(JavaObject* self, UserCommonClass* cl);
+  static void overflowThinLock(JavaObject* self);
 
   /// acquire - Acquire the lock on this object.
-  static void acquire(JavaObject* self) {
-    llvm_gcroot(self, 0);
-    mvm::ThinLock::acquire(self);
-  }
+  static void acquire(JavaObject* self);
 
   /// release - Release the lock on this object
-  static void release(JavaObject* self) {
-    llvm_gcroot(self, 0);
-    mvm::ThinLock::release(self);
-  }
+  static void release(JavaObject* 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 mvm::ThinLock::owner(self);
-  }
+  static bool owner(JavaObject* self);
 
 #ifdef SIGSEGV_THROW_NULL
   #define verifyNull(obj) {}
@@ -301,12 +288,6 @@
     if (obj == NULL) JavaThread::get()->getJVM()->nullPointerException();
 #endif
   
-  /// lockObj - Get the LockObj if the lock is a fat lock.
-  static JavaLock* lockObj(JavaObject* self) {
-    llvm_gcroot(self, 0);
-    return (JavaLock*)mvm::ThinLock::getFatLock(self);
-  }
-
   /// decapsulePrimitive - Based on the signature argument, decapsule
   /// obj as a primitive and put it in the buffer.
   ///

Modified: vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp Sat Nov 27 04:07:18 2010
@@ -16,6 +16,7 @@
 #include "JavaString.h"
 #include "JavaThread.h"
 #include "JavaTypes.h"
+#include "JavaUpcalls.h"
 #include "Jnjvm.h"
 
 #include "j3/OpcodeNames.def"
@@ -360,9 +361,10 @@
  
   *oldLocalReferencesNumber = th->currentAddedReferences;
   th->currentAddedReferences = localReferencesNumber;
-  th->startKnownFrame(*Frame);
-
-  th->startJNI(1);
+  th->startJNI();
+  th->startUnknownFrame(*Frame);
+  th->enterUncooperativeCode();
+  assert(th->getLastSP() == th->lastKnownFrame->currentFP);
 
   return Frame->currentFP;
 }
@@ -608,15 +610,14 @@
 
   // Lookup the caller of this class.
   mvm::StackWalker Walker(th);
-  while (Walker.get()->MethodType != 1) ++Walker;
+  ++Walker; // Remove the stub.
   mvm::MethodInfo* MI = Walker.get();
-  JavaMethod* meth = (JavaMethod*)MI->getMetaInfo();
+  assert(MI->isHighLevelMethod() && "Wrong stack trace");
+  JavaMethod* meth = (JavaMethod*)MI->MetaInfo;
   void* ip = *Walker;
 
   // Lookup the method info in the constant pool of the caller.
-  CodeLineInfo* CLInfo =
-    meth->lookupCodeLineInfo(reinterpret_cast<uintptr_t>(ip));
-  uint16 ctpIndex = CLInfo->ctpIndex;
+  uint16 ctpIndex = meth->lookupCtpIndex(reinterpret_cast<uintptr_t>(ip));
   assert(ctpIndex && "No constant pool index");
   JavaConstantPool* ctpInfo = meth->classDef->getConstantPool();
   CommonClass* ctpCl = 0;
@@ -648,8 +649,7 @@
     uint32_t index = InterfaceMethodTable::getIndex(Virt->name, Virt->type);
     if ((IMT->contents[index] & 1) == 0) {
       IMT->contents[index] = (uintptr_t)result;
-    } else {
-      
+    } else { 
       JavaMethod* Imeth = 
         ctpCl->asClass()->lookupInterfaceMethodDontThrow(utf8, sign->keyName);
       assert(Imeth && "Method not in hierarchy?");
@@ -673,10 +673,10 @@
 
   // Lookup the caller of this class.
   mvm::StackWalker Walker(th);
-  while (Walker.get()->MethodType != 1) ++Walker;
+  ++Walker; // Remove the stub.
   mvm::MethodInfo* MI = Walker.get();
-  assert(MI->MethodType == 1 && "Wrong call to stub");
-  JavaMethod* caller = (JavaMethod*)MI->getMetaInfo();
+  assert(MI->isHighLevelMethod() && "Wrong stack trace");
+  JavaMethod* caller = (JavaMethod*)MI->MetaInfo;
   void* ip = *Walker;
 
   // Lookup the method info in the constant pool of the caller.
@@ -711,10 +711,10 @@
 
   // Lookup the caller of this class.
   mvm::StackWalker Walker(th);
-  while (Walker.get()->MethodType != 1) ++Walker;
+  ++Walker; // Remove the stub.
   mvm::MethodInfo* MI = Walker.get();
-  assert(MI->MethodType == 1 && "Wrong call to stub");
-  JavaMethod* caller = (JavaMethod*)MI->getMetaInfo();
+  assert(MI->isHighLevelMethod() && "Wrong stack trace");
+  JavaMethod* caller = (JavaMethod*)MI->MetaInfo;
   void* ip = *Walker;
 
   // Lookup the method info in the constant pool of the caller.
@@ -746,6 +746,27 @@
   return result;
 }
 
+// Does not throw an exception.
+extern "C" void* j3ResolveInterface(JavaObject* obj, JavaMethod* meth, uint32_t index) {
+  uintptr_t result = NULL;
+  InterfaceMethodTable* IMT = JavaObject::getClass(obj)->virtualVT->IMT;
+  assert(JavaObject::instanceOf(obj, meth->classDef));
+  assert(meth->classDef->isInterface() ||
+      (meth->classDef == meth->classDef->classLoader->bootstrapLoader->upcalls->OfObject));
+  assert(index == InterfaceMethodTable::getIndex(meth->name, meth->type));
+  if ((IMT->contents[index] & 1) == 0) {
+    result = IMT->contents[index];
+  } else {
+    uintptr_t* table = (uintptr_t*)(IMT->contents[index] & ~1);
+    uint32 i = 0;
+    while (table[i] != (uintptr_t)meth && table[i] != 0) { i += 2; }
+    assert(table[i] != 0);
+    result = table[i + 1];
+  }
+  assert((result != 0) && "Bad IMT");
+  return (void*)result;
+}
+
 extern "C" void j3PrintMethodStart(JavaMethod* meth) {
   fprintf(stderr, "[%p] executing %s.%s\n", (void*)mvm::Thread::get(),
           UTF8Buffer(meth->classDef->name).cString(),

Modified: vmkit/trunk/lib/J3/VMCore/JavaString.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaString.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaString.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaString.h Sat Nov 27 04:07:18 2010
@@ -21,10 +21,9 @@
 class Jnjvm;
 
 class JavaString : public JavaObject {
-private:
+public:
   // CLASSPATH FIELDS!!
   const ArrayUInt16* value;
-public:
   sint32 count;
   sint32 cachedHashCode;
   sint32 offset;

Modified: vmkit/trunk/lib/J3/VMCore/JavaThread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaThread.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaThread.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaThread.cpp Sat Nov 27 04:07:18 2010
@@ -19,24 +19,14 @@
 
 using namespace j3;
 
-const unsigned int JavaThread::StateRunning = 0;
-const unsigned int JavaThread::StateWaiting = 1;
-const unsigned int JavaThread::StateInterrupted = 2;
-
-JavaThread::JavaThread(JavaObject* thread, JavaObject* vmth, Jnjvm* isolate)
-    : MutatorThread() {
-  llvm_gcroot(thread, 0);
-  llvm_gcroot(vmth, 0);
-  
-  javaThread = thread;
-  vmThread = vmth;
+JavaThread::JavaThread(Jnjvm* isolate) : MutatorThread() { 
   MyVM = isolate;
-  interruptFlag = 0;
-  state = StateRunning;
-  pendingException = 0;
+  pendingException = NULL;
   jniEnv = isolate->jniEnv;
   localJNIRefs = new JNILocalReferences();
-  currentAddedReferences = 0;
+  currentAddedReferences = NULL;
+  javaThread = NULL;
+  vmThread = NULL;
 
 #ifdef SERVICE
   eipIndex = 0;
@@ -47,6 +37,13 @@
 #endif
 }
 
+void JavaThread::initialise(JavaObject* thread, JavaObject* vmth) {
+  llvm_gcroot(thread, 0);
+  llvm_gcroot(vmth, 0);
+  javaThread = thread;
+  vmThread = vmth;
+}
+
 JavaThread::~JavaThread() {
   delete localJNIRefs;
 #ifdef SERVICE
@@ -68,9 +65,16 @@
   th->internalThrowException();
 }
 
-void JavaThread::startJNI(int level) {
-  // Start uncooperative mode.
-  enterUncooperativeCode(level);
+void JavaThread::startJNI() {
+  // Interesting, but no need to do anything.
+}
+
+void JavaThread::endJNI() {
+  localJNIRefs->removeJNIReferences(this, *currentAddedReferences);
+  endUnknownFrame();
+   
+  // Go back to cooperative mode.
+  leaveUncooperativeCode();
 }
 
 uint32 JavaThread::getJavaFrameContext(void** buffer) {
@@ -78,8 +82,8 @@
   uint32 i = 0;
 
   while (mvm::MethodInfo* MI = Walker.get()) {
-    if (MI->MethodType == 1) {
-      JavaMethod* M = (JavaMethod*)MI->getMetaInfo();
+    if (MI->isHighLevelMethod()) {
+      JavaMethod* M = (JavaMethod*)MI->MetaInfo;
       buffer[i++] = M;
     }
     ++Walker;
@@ -92,9 +96,9 @@
   uint32 index = 0;
 
   while (mvm::MethodInfo* MI = Walker.get()) {
-    if (MI->MethodType == 1) {
+    if (MI->isHighLevelMethod()) {
       if (index == level) {
-        return (JavaMethod*)MI->getMetaInfo();
+        return (JavaMethod*)MI->MetaInfo;
       }
       ++index;
     }
@@ -117,8 +121,8 @@
   mvm::StackWalker Walker(this);
 
   while (mvm::MethodInfo* MI = Walker.get()) {
-    if (MI->MethodType == 1) {
-      JavaMethod* meth = (JavaMethod*)MI->getMetaInfo();
+    if (MI->isHighLevelMethod() == 1) {
+      JavaMethod* meth = (JavaMethod*)MI->MetaInfo;
       JnjvmClassLoader* loader = meth->classDef->classLoader;
       obj = loader->getJavaClassLoader();
       if (obj) return obj;
@@ -133,7 +137,7 @@
   mvm::StackWalker Walker(this);
 
   while (mvm::MethodInfo* MI = Walker.get()) {
-    if (MI->MethodType == 1)
+    if (MI->isHighLevelMethod())
       MI->print(Walker.ip, Walker.addr);
     ++Walker;
   }

Modified: vmkit/trunk/lib/J3/VMCore/JavaThread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaThread.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaThread.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaThread.h Sat Nov 27 04:07:18 2010
@@ -13,6 +13,7 @@
 #include "mvm/Object.h"
 #include "mvm/Threads/Cond.h"
 #include "mvm/Threads/Locks.h"
+#include "mvm/Threads/ObjectLocks.h"
 #include "mvm/Threads/Thread.h"
 
 #include "MutatorThread.h"
@@ -84,33 +85,7 @@
   ///
   JavaObject* vmThread;
 
-  /// varcond - Condition variable when the thread needs to be awaken from
-  /// a wait.
-  ///
-  mvm::Cond varcond;
-
-  /// interruptFlag - Has this thread been interrupted?
-  ///
-  uint32 interruptFlag;
-
-  /// nextWaiting - Next thread waiting on the same monitor.
-  ///
-  JavaThread* nextWaiting;
-  
-  /// prevWaiting - Previous thread waiting on the same monitor.
-  ///
-  JavaThread* prevWaiting;
-
-  /// waitsOn - The monitor on which the thread is waiting on.
-  ///
-  JavaLock* waitsOn;
-
-  static const unsigned int StateRunning;
-  static const unsigned int StateWaiting;
-  static const unsigned int StateInterrupted;
-
-  /// state - The current state of this thread: Running, Waiting or Interrupted.
-  uint32 state;
+  mvm::LockingThread lockingThread;
   
   /// currentAddedReferences - Current number of added local references.
   ///
@@ -148,15 +123,17 @@
   
   /// JavaThread - Creates a Java thread.
   ///
-  JavaThread(JavaObject* thread, JavaObject* vmThread, Jnjvm* isolate);
+  JavaThread(Jnjvm* isolate);
 
-  /// get - Get the current thread as a JnJVM object.
+  void initialise(JavaObject* thread, JavaObject* vmth);
+  
+  /// get - Get the current thread as a J3 object.
   ///
   static JavaThread* get() {
     return (JavaThread*)mvm::Thread::get();
   }
 
-  /// getJVM - Get the JnJVM in which this thread executes.
+  /// getJVM - Get the Java VM in which this thread executes.
   ///
   Jnjvm* getJVM() {
     return (Jnjvm*)MyVM;
@@ -211,16 +188,9 @@
 
   /// startJNI - Record that we are entering native code.
   ///
-  void startJNI(int level) __attribute__ ((noinline));
+  void startJNI();
 
-  void endJNI() {
-    localJNIRefs->removeJNIReferences(this, *currentAddedReferences);
-   
-    // Go back to cooperative mode.
-    leaveUncooperativeCode();
-   
-    endKnownFrame();
-  }
+  void endJNI();
 
   /// getCallingMethod - Get the Java method in the stack at the specified
   /// level.

Modified: vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp Sat Nov 27 04:07:18 2010
@@ -34,6 +34,7 @@
 #include "LinkJavaRuntime.h"
 #include "LockedMap.h"
 #include "Reader.h"
+#include "ReferenceQueue.h"
 #include "Zip.h"
 
 using namespace j3;
@@ -42,12 +43,6 @@
 const char* Jnjvm::envSeparator = ":";
 const unsigned int Jnjvm::Magic = 0xcafebabe;
 
-#ifdef ISOLATE
-Jnjvm* Jnjvm::RunningIsolates[NR_ISOLATES];
-mvm::LockNormal Jnjvm::IsolateLock;
-#endif
-
-
 /// initialiseClass - Java class initialisation. Java specification §2.17.5.
 
 void UserClass::initialiseClass(Jnjvm* vm) {
@@ -123,16 +118,12 @@
     bool vmjced = (getInitializationState() == vmjc);
     setInitializationState(inClinit);
     UserClass* cl = (UserClass*)this;
-#if defined(ISOLATE) || defined(ISOLATE_SHARING)
-    // Isolate environments allocate the static instance on their own, not when
-    // the class is being resolved.
-    cl->allocateStaticInstance(vm);
-#else
+    
     // Single environment allocates the static instance during resolution, so
     // that compiled code can access it directly (with an initialization
     // check just before the access)
     if (!cl->getStaticInstance()) cl->allocateStaticInstance(vm);
-#endif
+
     release();
   
 
@@ -161,11 +152,6 @@
       }
     }
  
-#ifdef SERVICE
-    if (classLoader == classLoader->bootstrapLoader || 
-        classLoader->getIsolate() == vm) {
-#endif
-
     // 8. Next, execute either the class variable initializers and static
     //    initializers of the class or the field initializers of the interface,
     //    in textual order, as though they were a single block, except that
@@ -200,9 +186,6 @@
         self->clearException();
       } END_CATCH;
     }
-#ifdef SERVICE
-    }
-#endif
 
     // 9. If the execution of the initializers completes normally, then lock
     //    this Class object, label it fully initialized, notify all waiting 
@@ -828,19 +811,18 @@
 }
 
 
-char* findInformation(Jnjvm* vm, ArrayUInt8* manifest, const char* entry,
-                      uint32 len) {
-  llvm_gcroot(manifest, 0);
-  sint32 index = sys_strnstr((char*)ArrayUInt8::getElements(manifest), entry);
+static char* findInformation(Jnjvm* vm, ClassBytes* manifest, const char* entry,
+                             uint32 len) {
+  sint32 index = sys_strnstr((char*)manifest->elements, entry);
   if (index != -1) {
     index += len;
-    sint32 end = sys_strnstr((char*)ArrayUInt8::getElements(manifest) + index, "\n");
-    if (end == -1) end = ArrayUInt8::getSize(manifest);
+    sint32 end = sys_strnstr((char*)manifest->elements + index, "\n");
+    if (end == -1) end = manifest->size;
     else end += index;
 
     sint32 length = end - index - 1;
     char* name = (char*)vm->allocator.Allocate(length + 1, "class name");
-    memcpy(name, ArrayUInt8::getElements(manifest) + index, length);
+    memcpy(name, manifest->elements + index, length);
     name[length] = 0;
     return name;
   } else {
@@ -850,10 +832,8 @@
 
 void ClArgumentsInfo::extractClassFromJar(Jnjvm* vm, int argc, char** argv, 
                                           int i) {
-  ArrayUInt8* bytes = NULL;
-  ArrayUInt8* res = NULL;
-  llvm_gcroot(bytes, 0);
-  llvm_gcroot(res, 0);
+  ClassBytes* bytes = NULL;
+  ClassBytes* res = NULL;
   jarFile = argv[i];
 
   vm->setClasspath(jarFile);
@@ -868,13 +848,10 @@
   mvm::BumpPtrAllocator allocator;
   ZipArchive* archive = new(allocator, "TempZipArchive")
       ZipArchive(bytes, allocator);
-  // Make sure it gets GC'd.
-  vm->bootstrapLoader->bootArchives.push_back(archive);
   if (archive->getOfscd() != -1) {
     ZipFile* file = archive->getFile(PATH_MANIFEST);
     if (file != NULL) {
-      UserClassArray* array = vm->bootstrapLoader->upcalls->ArrayOfByte;
-      res = (ArrayUInt8*)array->doNew(file->ucsize, vm);
+      res = new (allocator, file->ucsize) ClassBytes(file->ucsize);
       int ok = archive->readFile(res, file);
       if (ok) {
         char* mainClass = findInformation(vm, res, MAIN_CLASS,
@@ -897,8 +874,6 @@
   } else {
     printf("Can't find archive %s\n", jarFile);
   }
-  // We don't need this archive anymore.
-  vm->bootstrapLoader->bootArchives.pop_back();
 }
 
 void ClArgumentsInfo::nyi() {
@@ -1088,11 +1063,13 @@
   JnjvmClassLoader* loader = bootstrapLoader;
   
   // First create system threads.
-  finalizerThread = new JavaThread(0, 0, this);
-  finalizerThread->start((void (*)(mvm::Thread*))finalizerStart);
+  finalizerThread = new FinalizerThread(this);
+  finalizerThread->start(
+      (void (*)(mvm::Thread*))FinalizerThread::finalizerStart);
     
-  enqueueThread = new JavaThread(0, 0, this);
-  enqueueThread->start((void (*)(mvm::Thread*))enqueueStart);
+  referenceThread = new ReferenceThread(this);
+  referenceThread->start(
+      (void (*)(mvm::Thread*))ReferenceThread::enqueueStart);
   
   // Initialise the bootstrap class loader if it's not
   // done already.
@@ -1127,9 +1104,6 @@
   }
   upcalls->newString->initialiseClass(this);
 
-#ifdef SERVICE
-  if (!IsolateID)
-#endif
   // The initialization code of the classes initialized below may require
   // to get the Java thread, so we create the Java thread object first.
   upcalls->InitializeThreading(this);
@@ -1188,9 +1162,6 @@
   obj = JavaThread::get()->currentThread();
   javaLoader = appClassLoader->getJavaClassLoader();
 
-#ifdef SERVICE
-  if (!IsolateID)
-#endif
   upcalls->setContextClassLoader->invokeIntSpecial(this, upcalls->newThread,
                                                    obj, &javaLoader);
   // load and initialise math since it is responsible for dlopen'ing 
@@ -1318,10 +1289,6 @@
     fprintf(stderr, "Exception %s while bootstrapping VM.",
         UTF8Buffer(JavaObject::getClass(exc)->name).cString());
   } else {
-#ifdef SERVICE
-    thread->ServiceException = vm->upcalls->newThrowable->doNew(vm);
-#endif
-
     ClArgumentsInfo& info = vm->argumentsInfo;
   
     if (info.agents.size()) {
@@ -1358,51 +1325,15 @@
   nonDaemonLock.unlock();  
 }
 
-#ifdef SERVICE
-
-#include <signal.h>
-
-extern void terminationHandler(int);
-
-static void serviceCPUMonitor(mvm::Thread* th) {
-  while (true) {
-    sleep(1);
-    for(JavaThread* cur = (Java*)th->next(); cur != th;
-        cur = (JavaThread*)cur->next()) {
-        JavaThread* th = (JavaThread*)cur;
-        if (!(th->StateWaiting)) {
-          mvm::VirtualMachine* executingVM = cur->MyVM;
-          assert(executingVM && "Thread with no VM!");
-          ++executingVM->executionTime;
-      }
-    }
-  }
-}
-#endif
-
 void Jnjvm::runApplication(int argc, char** argv) {
   argumentsInfo.argc = argc;
   argumentsInfo.argv = argv;
-#ifdef SERVICE
-  struct sigaction sa;
-  sigset_t mask;
-  sigfillset(&mask);
-  sigaction(SIGUSR1, 0, &sa);
-  sa.sa_mask = mask;
-  sa.sa_handler = terminationHandler;
-  sa.sa_flags |= SA_RESTART;
-  sigaction(SIGUSR1, &sa, NULL);
-
-  mvm::Thread* th = new JavaThread(0, 0, this);
-  th->start(serviceCPUMonitor);
-#endif
-   
-  mainThread = new JavaThread(0, 0, this);
+  mainThread = new JavaThread(this);
   mainThread->start((void (*)(mvm::Thread*))mainJavaStart);
 }
 
 Jnjvm::Jnjvm(mvm::BumpPtrAllocator& Alloc, JnjvmBootstrapLoader* loader) : 
-  VirtualMachine(Alloc), lockSystem(this) {
+  VirtualMachine(Alloc), lockSystem(Alloc) {
 
   classpath = getenv("CLASSPATH");
   if (!classpath) classpath = ".";
@@ -1411,7 +1342,6 @@
   jniEnv = &JNI_JNIEnvTable;
   javavmEnv = &JNI_JavaVMTable;
   
-
   bootstrapLoader = loader;
   upcalls = bootstrapLoader->upcalls;
 
@@ -1427,26 +1357,9 @@
   }
 
   bootstrapLoader->insertAllMethodsInVM(this);  
-
-#ifdef ISOLATE
-  IsolateLock.lock();
-  for (uint32 i = 0; i < NR_ISOLATES; ++i) {
-    if (RunningIsolates[i] == 0) {
-      RunningIsolates[i] = this;
-      IsolateID = i;
-      break;
-    }
-  }
-  IsolateLock.unlock();
-#endif
-
-  scanner = loader->getCompiler()->createStackScanner();
 }
 
 Jnjvm::~Jnjvm() {
-#ifdef ISOLATE
-  RunningIsolates[IsolateID] = 0;
-#endif
 }
 
 ArrayUInt16* Jnjvm::asciizToArray(const char* asciiz) {
@@ -1462,49 +1375,46 @@
   return tmp;
 }
 
-void Jnjvm::internalRemoveMethods(JnjvmClassLoader* loader, mvm::FunctionMap& Map) {
-  // Loop over all methods in the map to find which ones belong
-  // to this class loader.
-  Map.FunctionMapLock.acquire();
-  std::map<void*, mvm::MethodInfo*>::iterator temp;
-  for (std::map<void*, mvm::MethodInfo*>::iterator i = Map.Functions.begin(), 
-       e = Map.Functions.end(); i != e;) {
-    mvm::MethodInfo* MI = i->second;
-    if (MI->MethodType == 1) {
-      JavaMethod* meth = (JavaMethod*)i->second->getMetaInfo();
-      if (meth->classDef->classLoader == loader) {
-        temp = i;
-        ++i;
-        Map.Functions.erase(temp);
-      } else {
-        ++i;
-      }
-    } else {
-      ++i;
-    }
-  }
-  Map.FunctionMapLock.release();
+void Jnjvm::startCollection() {
+  finalizerThread->FinalizationQueueLock.acquire();
+  referenceThread->ToEnqueueLock.acquire();
+  referenceThread->SoftReferencesQueue.acquire();
+  referenceThread->WeakReferencesQueue.acquire();
+  referenceThread->PhantomReferencesQueue.acquire();
 }
-
-void Jnjvm::removeMethodsInFunctionMaps(JnjvmClassLoader* loader) {
-  internalRemoveMethods(loader, RuntimeFunctions);
-  internalRemoveMethods(loader, StaticFunctions);
+  
+void Jnjvm::endCollection() {
+  finalizerThread->FinalizationQueueLock.release();
+  referenceThread->ToEnqueueLock.release();
+  referenceThread->SoftReferencesQueue.release();
+  referenceThread->WeakReferencesQueue.release();
+  referenceThread->PhantomReferencesQueue.release();
+  finalizerThread->FinalizationCond.broadcast();
+  referenceThread->EnqueueCond.broadcast();
+}
+  
+void Jnjvm::scanWeakReferencesQueue(uintptr_t closure) {
+  referenceThread->WeakReferencesQueue.scan(referenceThread, closure);
+}
+  
+void Jnjvm::scanSoftReferencesQueue(uintptr_t closure) {
+  referenceThread->SoftReferencesQueue.scan(referenceThread, closure);
+}
+  
+void Jnjvm::scanPhantomReferencesQueue(uintptr_t closure) {
+  referenceThread->PhantomReferencesQueue.scan(referenceThread, closure);
 }
 
+void Jnjvm::scanFinalizationQueue(uintptr_t closure) {
+  finalizerThread->scanFinalizationQueue(closure);
+}
 
-/// JavaStaticCompiler - Compiler for AOT-compiled programs that
-/// do not use the JIT.
-class JavaStaticCompiler : public JavaCompiler {
-public:
-#ifdef WITH_LLVM_GCC
-  virtual mvm::StackScanner* createStackScanner() {
-    return new mvm::PreciseStackScanner();
-  }
-#endif
-};
-
+void Jnjvm::addFinalizationCandidate(gc* object) {
+  llvm_gcroot(object, 0);
+  finalizerThread->addFinalizationCandidate(object);
+}
 
-// Helper function to run Jnjvm without JIT.
+// Helper function to run J3 without JIT.
 extern "C" int StartJnjvmWithoutJIT(int argc, char** argv, char* mainClass) {
   mvm::Collector::initialise();
  
@@ -1514,9 +1424,12 @@
   newArgv[0] = newArgv[1];
   newArgv[1] = mainClass;
  
-  JavaCompiler* Comp = new JavaStaticCompiler();
-  JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp);
-  mvm::VirtualMachine* vm = mvm::VirtualMachine::createJVM(JCL);
+  mvm::BumpPtrAllocator Allocator;
+  JavaCompiler* Comp = new JavaCompiler();
+  JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader")
+    JnjvmBootstrapLoader(Allocator, Comp, true);
+  Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader);
+
   vm->runApplication(argc + 1, newArgv);
   vm->waitForExit();
   

Modified: vmkit/trunk/lib/J3/VMCore/Jnjvm.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Jnjvm.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/Jnjvm.h (original)
+++ vmkit/trunk/lib/J3/VMCore/Jnjvm.h Sat Nov 27 04:07:18 2010
@@ -19,8 +19,8 @@
 #include "mvm/VirtualMachine.h"
 #include "mvm/Threads/Cond.h"
 #include "mvm/Threads/Locks.h"
+#include "mvm/Threads/ObjectLocks.h"
 
-#include "JavaLocks.h"
 #include "JnjvmConfig.h"
 #include "JNIReferences.h"
 #include "LockedMap.h"
@@ -30,6 +30,7 @@
 class ArrayObject;
 class Classpath;
 class CommonClass;
+class FinalizerThread;
 class JavaField;
 class JavaMethod;
 class JavaObject;
@@ -38,6 +39,7 @@
 class JavaVirtualTable;
 class JnjvmBootstrapLoader;
 class JnjvmClassLoader;
+class ReferenceThread;
 class UserClass;
 class UserClassArray;
 class UserClassPrimitive;
@@ -120,11 +122,19 @@
   
   /// finalizerThread - The thread that finalizes Java objects.
   ///
-  JavaThread* finalizerThread;
+  FinalizerThread* finalizerThread;
  
   /// enqueueThread - The thread that enqueue Java references.
   ///
-  JavaThread* enqueueThread;
+  ReferenceThread* referenceThread;
+
+  virtual void startCollection();
+  virtual void endCollection();
+  virtual void scanWeakReferencesQueue(uintptr_t closure);
+  virtual void scanSoftReferencesQueue(uintptr_t closure);
+  virtual void scanPhantomReferencesQueue(uintptr_t closure);
+  virtual void scanFinalizationQueue(uintptr_t closure);
+  virtual void addFinalizationCandidate(gc* obj);
 
   /// CreateError - Creates a Java object of the specified exception class
   /// and calling its <init> function.
@@ -202,7 +212,7 @@
   
   /// lockSystem - The lock system to allocate and manage Java locks.
   ///
-  LockSystem lockSystem;
+  mvm::LockSystem lockSystem;
   
   /// argumentsInfo - The command line arguments given to the vm
   ///
@@ -300,19 +310,19 @@
   
   /// setFinalizerThread - Set the finalizer thread of this VM.
   ///
-  void setFinalizerThread(JavaThread* th) { finalizerThread = th; }
+  void setFinalizerThread(FinalizerThread* th) { finalizerThread = th; }
   
   /// getFinalizerThread - Get the finalizer thread of this VM.
   ///
-  JavaThread* getFinalizerThread() const { return finalizerThread; }
+  FinalizerThread* getFinalizerThread() const { return finalizerThread; }
   
-  /// setEnqueueThread - Set the enqueue thread of this VM.
+  /// setReferenceThread - Set the enqueue thread of this VM.
   ///
-  void setEnqueueThread(JavaThread* th) { enqueueThread = th; }
+  void setReferenceThread(ReferenceThread* th) { referenceThread = th; }
   
-  /// getEnqueueThread - Get the enqueue thread of this VM.
+  /// getReferenceThread - Get the enqueue thread of this VM.
   ///
-  JavaThread* getEnqueueThread() const { return enqueueThread; }
+  ReferenceThread* getReferenceThread() const { return referenceThread; }
 
   /// ~Jnjvm - Destroy the JVM.
   ///
@@ -341,44 +351,11 @@
   ///
   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.
-  ///
-  void internalRemoveMethods(JnjvmClassLoader* loader, mvm::FunctionMap& Map);
-
-public:
-  /// removeMethodsInFunctionMaps - Removes all methods compiled by this
-  /// class loader from the function maps.
-  ///
-  void removeMethodsInFunctionMaps(JnjvmClassLoader* loader);
-  
   /// loadBootstrap - Bootstraps the JVM, getting the class loader, initializing
-  /// bootstrap classes (e.g. java/lang/Class, java/lang/*Exception) and
+  /// bootstrap classes (e.g. java/lang/Class, java/lang/Exception) and
   /// mapping the initial thread.
   ///
   void loadBootstrap();
-
-#ifdef ISOLATE
-  static Jnjvm* RunningIsolates[NR_ISOLATES];
-  static mvm::LockNormal IsolateLock;
-#endif
-
-#ifdef SERVICE
-  virtual void stopService();
-#endif
-
-  virtual void clearReferent(gc*);
-  virtual gc** getReferentPtr(gc*);
-  virtual void setReferent(gc*, gc*);
-  virtual bool enqueueReference(gc*);
-
-protected:
-  virtual void invokeFinalizer(gc*);
-
 };
 
 } // end namespace j3

Modified: vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp Sat Nov 27 04:07:18 2010
@@ -308,9 +308,8 @@
   TheCompiler = Comp;
 }
 
-ArrayUInt8* JnjvmBootstrapLoader::openName(const UTF8* utf8) {
-  ArrayUInt8* res = 0;
-  llvm_gcroot(res, 0);
+ClassBytes* JnjvmBootstrapLoader::openName(const UTF8* utf8) {
+  ClassBytes* res = 0;
   mvm::ThreadAllocator threadAllocator;
 
   char* asciiz = (char*)threadAllocator.Allocate(utf8->size + 1);
@@ -348,8 +347,7 @@
 UserClass* JnjvmBootstrapLoader::internalLoad(const UTF8* name,
                                               bool doResolve,
                                               JavaString* strName) {
-  ArrayUInt8* bytes = NULL;
-  llvm_gcroot(bytes, 0);
+  ClassBytes* bytes = NULL;
   llvm_gcroot(strName, 0);
 
   UserCommonClass* cl = lookupClass(name);
@@ -667,9 +665,8 @@
 }
 
 UserClass* JnjvmClassLoader::constructClass(const UTF8* name,
-                                            ArrayUInt8* bytes) {
+                                            ClassBytes* bytes) {
   JavaObject* excp = NULL;
-  llvm_gcroot(bytes, 0);
   llvm_gcroot(excp, 0);
   UserClass* res = NULL;
   lock.lock();
@@ -688,6 +685,8 @@
       getCompiler()->resolveVirtualClass(res);
       getCompiler()->resolveStaticClass(res);
       classes->lock.lock();
+      assert(res->getDelegatee() == NULL);
+      assert(res->getStaticInstance() == NULL);
       bool success = classes->map.insert(std::make_pair(internalName, res)).second;
       classes->lock.unlock();
       assert(success && "Could not add class in map");
@@ -912,8 +911,9 @@
 
 JnjvmClassLoader::~JnjvmClassLoader() {
 
-  if (isolate)
-    isolate->removeMethodsInFunctionMaps(this);
+  if (isolate) {
+    isolate->removeMethodInfos(TheCompiler);
+  }
 
   if (classes) {
     classes->~ClassMap();
@@ -966,8 +966,7 @@
 }
 
 void JnjvmBootstrapLoader::analyseClasspathEnv(const char* str) {
-  ArrayUInt8* bytes = NULL;
-  llvm_gcroot(bytes, 0);
+  ClassBytes* bytes = NULL;
   mvm::ThreadAllocator threadAllocator;
   if (str != 0) {
     unsigned int len = strlen(str);
@@ -1087,8 +1086,32 @@
   return res;
 }
 
+class JavaStaticMethodInfo : public mvm::CamlMethodInfo {
+public:
+  virtual void print(void* ip, void* addr);
+  virtual bool isHighLevelMethod() {
+    return true;
+  }
+  
+  JavaStaticMethodInfo(mvm::CamlMethodInfo* super, void* ip, JavaMethod* M) :
+    mvm::CamlMethodInfo(super->CF) {
+    MetaInfo = M;
+    Owner = M->classDef->classLoader->getCompiler();
+  }
+};
+
+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());
+  if (ip != new_ip) fprintf(stderr, " (from stub)");
+  fprintf(stderr, "\n");
+}
+
 void JnjvmClassLoader::insertAllMethodsInVM(Jnjvm* vm) {
-  JavaCompiler* M = getCompiler();
   for (ClassMap::iterator i = classes->map.begin(), e = classes->map.end();
        i != e; ++i) {
     CommonClass* cl = i->second;
@@ -1100,8 +1123,7 @@
         if (!isAbstract(meth.access) && meth.code) {
           JavaStaticMethodInfo* MI = new (allocator, "JavaStaticMethodInfo")
             JavaStaticMethodInfo(0, meth.code, &meth);
-          vm->StaticFunctions.addMethodInfo(MI, meth.code);
-          M->setMethod(&meth, meth.code, "");
+          vm->FunctionsCache.addMethodInfo(MI, meth.code);
         }
       }
       
@@ -1110,8 +1132,7 @@
         if (!isAbstract(meth.access) && meth.code) {
           JavaStaticMethodInfo* MI = new (allocator, "JavaStaticMethodInfo")
             JavaStaticMethodInfo(0, meth.code, &meth);
-          vm->StaticFunctions.addMethodInfo(MI, meth.code);
-          M->setMethod(&meth, meth.code, "");
+          vm->FunctionsCache.addMethodInfo(MI, meth.code);
         }
       }
     }

Modified: vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h Sat Nov 27 04:07:18 2010
@@ -26,9 +26,9 @@
 
 namespace j3 {
 
-class ArrayUInt8;
 class UserClass;
 class UserClassArray;
+class ClassBytes;
 class ClassMap;
 class Classpath;
 class UserCommonClass;
@@ -209,7 +209,7 @@
   /// constructClass - Hashes a runtime representation of a class with
   /// the given name.
   ///
-  UserClass* constructClass(const UTF8* name, ArrayUInt8* bytes);
+  UserClass* constructClass(const UTF8* name, ClassBytes* bytes);
   
   /// constructType - Hashes a Typedef, an internal representation of a class
   /// still not loaded.
@@ -326,7 +326,7 @@
   /// openName - Opens a file of the given name and returns it as an array
   /// of byte.
   ///
-  ArrayUInt8* openName(const UTF8* utf8);
+  ClassBytes* openName(const UTF8* utf8);
   
 public:
   

Modified: vmkit/trunk/lib/J3/VMCore/LockedMap.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/LockedMap.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/LockedMap.h (original)
+++ vmkit/trunk/lib/J3/VMCore/LockedMap.h Sat Nov 27 04:07:18 2010
@@ -31,6 +31,7 @@
 namespace j3 {
 
 class JavaString;
+class JnjvmClassLoader;
 class Signdef;
 class Typedef;
 class UserCommonClass;

Modified: vmkit/trunk/lib/J3/VMCore/Reader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Reader.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/Reader.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/Reader.cpp Sat Nov 27 04:07:18 2010
@@ -12,10 +12,7 @@
 
 #include "types.h"
 
-#include "Jnjvm.h"
-#include "JavaArray.h"
-#include "JavaThread.h"
-#include "JavaUpcalls.h"
+#include "JnjvmClassLoader.h"
 #include "Reader.h"
 #include "Zip.h"
 
@@ -25,17 +22,15 @@
 const int Reader::SeekCur = SEEK_CUR;
 const int Reader::SeekEnd = SEEK_END;
 
-ArrayUInt8* Reader::openFile(JnjvmBootstrapLoader* loader, const char* path) {
-  ArrayUInt8* res = NULL;
-  llvm_gcroot(res, 0);
+ClassBytes* Reader::openFile(JnjvmClassLoader* loader, const char* path) {
+  ClassBytes* res = NULL;
   FILE* fp = fopen(path, "r");
   if (fp != 0) {
     fseek(fp, 0, SeekEnd);
     long nbb = ftell(fp);
     fseek(fp, 0, SeekSet);
-    UserClassArray* array = loader->upcalls->ArrayOfByte;
-    res = (ArrayUInt8*)array->doNew((sint32)nbb, JavaThread::get()->getJVM());
-    if (fread(ArrayUInt8::getElements(res), nbb, 1, fp) == 0) {
+    res = new (loader->allocator, nbb) ClassBytes(nbb);
+    if (fread(res->elements, nbb, 1, fp) == 0) {
       fprintf(stderr, "fread error\n");
       abort();  
     }
@@ -44,14 +39,12 @@
   return res;
 }
 
-ArrayUInt8* Reader::openZip(JnjvmBootstrapLoader* loader, ZipArchive* archive,
+ClassBytes* Reader::openZip(JnjvmClassLoader* loader, ZipArchive* archive,
                             const char* filename) {
-  ArrayUInt8* res = 0;
-  llvm_gcroot(res, 0);
+  ClassBytes* res = 0;
   ZipFile* file = archive->getFile(filename);
   if (file != 0) {
-    UserClassArray* array = loader->upcalls->ArrayOfByte;
-    res = (ArrayUInt8*)array->doNew((sint32)file->ucsize, JavaThread::get()->getJVM());
+    res = new (loader->allocator, file->ucsize) ClassBytes(file->ucsize);
     if (archive->readFile(res, file) != 0) {
       return res;
     }

Modified: vmkit/trunk/lib/J3/VMCore/Reader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Reader.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/Reader.h (original)
+++ vmkit/trunk/lib/J3/VMCore/Reader.h Sat Nov 27 04:07:18 2010
@@ -20,18 +20,35 @@
 namespace j3 {
 
 class JnjvmBootstrapLoader;
+class JnjvmClassLoader;
 class ZipArchive;
 
+
+class ClassBytes {
+ public:
+  ClassBytes(int l) {
+    size = l;
+  }
+
+  void* operator new(size_t sz, mvm::BumpPtrAllocator& allocator, int n) {
+    return allocator.Allocate(sizeof(uint32_t) + n * sizeof(uint8_t),
+                              "Class bytes");
+  }
+
+  uint32_t size;
+  uint8_t elements[1];
+};
+
 class Reader {
 public:
   // bytes - Pointer to a reference array. The array is not manipulated directly
   // in order to support copying GC.
-  ArrayUInt8** bytes;
+  ClassBytes* bytes;
   uint32 min;
   uint32 cursor;
   uint32 max;
 
-  Reader(Attribut* attr, ArrayUInt8** bytes) {
+  Reader(Attribut* attr, ClassBytes* bytes) {
     this->bytes = bytes;
     this->cursor = attr->start;
     this->min = attr->start;
@@ -78,18 +95,18 @@
   static const int SeekCur;
   static const int SeekEnd;
 
-  static ArrayUInt8* openFile(JnjvmBootstrapLoader* loader, const char* path);
-  static ArrayUInt8* openZip(JnjvmBootstrapLoader* loader, ZipArchive* archive,
+  static ClassBytes* openFile(JnjvmClassLoader* loader, const char* path);
+  static ClassBytes* openZip(JnjvmClassLoader* loader, ZipArchive* archive,
                              const char* filename);
   
   uint8 readU1() {
     ++cursor;
-    return ArrayUInt8::getElement(*bytes, cursor - 1);
+    return bytes->elements[cursor - 1];
   }
   
   sint8 readS1() {
     ++cursor;
-    return ArrayUInt8::getElement(*bytes, cursor - 1);
+    return bytes->elements[cursor - 1];
   }
   
   uint16 readU2() {
@@ -122,8 +139,8 @@
     return tmp | ((sint64)(readU4()));
   }
 
-  Reader(ArrayUInt8** array, uint32 start = 0, uint32 end = 0) {
-    if (!end) end = ArrayUInt8::getSize(*array);
+  Reader(ClassBytes* array, uint32 start = 0, uint32 end = 0) {
+    if (!end) end = array->size;
     this->bytes = array;
     this->cursor = start;
     this->min = start;

Modified: vmkit/trunk/lib/J3/VMCore/VirtualTables.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/VirtualTables.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/VirtualTables.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/VirtualTables.cpp Sat Nov 27 04:07:18 2010
@@ -30,6 +30,7 @@
 #include "Jnjvm.h"
 #include "JnjvmClassLoader.h"
 #include "LockedMap.h"
+#include "ReferenceQueue.h"
 #include "Zip.h"
 
 using namespace j3;
@@ -141,8 +142,7 @@
 // (2) The delegatee object (java.lang.Class) if it exists.
 //
 // Additionaly, non-primitive and non-array classes must trace:
-// (3) The bytes that represent the class file.
-// (4) The static instance.
+// (3) The static instance.
 //===----------------------------------------------------------------------===//
 
 void CommonClass::tracer(uintptr_t closure) {
@@ -173,7 +173,6 @@
 
 void Class::tracer(uintptr_t closure) {
   CommonClass::tracer(closure);
-  mvm::Collector::markAndTraceRoot(&bytes, closure);
   
   for (uint32 i = 0; i < NR_ISOLATES; ++i) {
     TaskClassMirror &M = IsolateInfo[i];
@@ -242,11 +241,6 @@
   TRACE_DELEGATEE(upcalls->OfLong);
   TRACE_DELEGATEE(upcalls->OfDouble);
 #undef TRACE_DELEGATEE
-  
-  for (std::vector<ZipArchive*>::iterator i = bootArchives.begin(),
-       e = bootArchives.end(); i != e; i++) {
-    mvm::Collector::markAndTraceRoot(&((*i)->bytes), closure);
-  }
 }
 
 //===----------------------------------------------------------------------===//
@@ -264,15 +258,16 @@
 
 
 void Jnjvm::tracer(uintptr_t closure) {
-  
-  VirtualMachine::tracer(closure);
+  // (1) Trace the bootrap loader.
   bootstrapLoader->tracer(closure);
   
+  // (2) Trace the application class loader.
   if (appClassLoader != NULL) {
     mvm::Collector::markAndTraceRoot(
         appClassLoader->getJavaClassLoaderPtr(), closure);
   }
   
+  // (3) Trace JNI global references.
   JNIGlobalReferences* start = &globalRefs;
   while (start != NULL) {
     for (uint32 i = 0; i < start->length; ++i) {
@@ -282,6 +277,7 @@
     start = start->next;
   }
   
+  // (4) Trace the interned strings.
   for (StringMap::iterator i = hashStr.map.begin(), e = hashStr.map.end();
        i!= e; ++i) {
     JavaString** str = &(i->second);
@@ -289,24 +285,37 @@
     ArrayUInt16** key = const_cast<ArrayUInt16**>(&(i->first));
     mvm::Collector::markAndTraceRoot(key, closure);
   }
+
+  // (5) Trace the finalization queue.
+  for (uint32 i = 0; i < finalizerThread->CurrentFinalizedIndex; ++i) {
+    mvm::Collector::markAndTraceRoot(finalizerThread->ToBeFinalized + i, closure);
+  }
+  
+  // (6) Trace the reference queue
+  for (uint32 i = 0; i < referenceThread->ToEnqueueIndex; ++i) {
+    mvm::Collector::markAndTraceRoot(referenceThread->ToEnqueue + i, closure);
+  }
  
+  // (7) Trace the locks and their associated object.
   uint32 i = 0;
-  for (; i < LockSystem::GlobalSize; i++) {
-    JavaLock** array = lockSystem.LockTable[i];
+  for (; i < mvm::LockSystem::GlobalSize; i++) {
+    mvm::FatLock** array = lockSystem.LockTable[i];
     if (array == NULL) break;
     uint32 j = 0;
-    for (; j < LockSystem::IndexSize; j++) {
+    for (; j < mvm::LockSystem::IndexSize; j++) {
       if (array[j] == NULL) break;
-      JavaLock* lock = array[j];
+      mvm::FatLock* lock = array[j];
       mvm::Collector::markAndTraceRoot(lock->getAssociatedObjectPtr(), closure);
     }
-    for (j = j + 1; j < LockSystem::IndexSize; j++) {
+    for (j = j + 1; j < mvm::LockSystem::IndexSize; j++) {
       assert(array[j] == NULL);
     }
   }
-  for (i = i + 1; i < LockSystem::GlobalSize; i++) {
+  for (i = i + 1; i < mvm::LockSystem::GlobalSize; i++) {
     assert(lockSystem.LockTable[i] == NULL);
   }
+
+
 #if defined(ISOLATE_SHARING)
   mvm::Collector::markAndTraceRoot(&JnjvmSharedLoader::sharedLoader, closure);
 #endif
@@ -317,10 +326,9 @@
 }
 
 void JavaThread::tracer(uintptr_t closure) {
-  if (pendingException != NULL) {
-    mvm::Collector::markAndTraceRoot(&pendingException, closure);
-  }
+  mvm::Collector::markAndTraceRoot(&pendingException, closure);
   mvm::Collector::markAndTraceRoot(&javaThread, closure);
+  mvm::Collector::markAndTraceRoot(&vmThread, closure);
 #ifdef SERVICE
   mvm::Collector::markAndTraceRoot(&ServiceException, closure);
 #endif

Modified: vmkit/trunk/lib/J3/VMCore/Zip.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Zip.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/Zip.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/Zip.cpp Sat Nov 27 04:07:18 2010
@@ -17,8 +17,7 @@
 
 using namespace j3;
 
-ZipArchive::ZipArchive(ArrayUInt8* bytes, mvm::BumpPtrAllocator& A) : allocator(A) {
-  llvm_gcroot(bytes, 0);
+ZipArchive::ZipArchive(ClassBytes* bytes, mvm::BumpPtrAllocator& A) : allocator(A) {
   this->bytes = bytes;
   findOfscd();
   if (ofscd > -1) addFiles();
@@ -74,7 +73,7 @@
   sint32 minOffs = 0;
   sint32 st = END_CENTRAL_DIRECTORY_FILE_HEADER_SIZE + 4;
   
-  Reader reader(&bytes);
+  Reader reader(bytes);
   curOffs = reader.max;
   if (curOffs >= (65535 + END_CENTRAL_DIRECTORY_FILE_HEADER_SIZE + 4)) {
     minOffs = curOffs - (65535 + END_CENTRAL_DIRECTORY_FILE_HEADER_SIZE + 4);
@@ -104,8 +103,8 @@
     if (searchPos >= st) {
       sint32 searchPtr = temp + (searchPos - st);
       while (searchPtr > temp) {
-        if (ArrayUInt8::getElement(bytes, searchPtr) == 'P' && 
-          !(memcmp(ArrayUInt8::getElements(bytes) + searchPtr, HDR_ENDCENTRAL, 4))) {
+        if (bytes->elements[searchPtr] == 'P' && 
+          !(memcmp(bytes->elements + searchPtr, HDR_ENDCENTRAL, 4))) {
           sint32 offset = searchPtr + 4 + E_OFFSET_START_CENTRAL_DIRECTORY;
           reader.cursor = offset;
           this->ofscd = readEndianDep4(reader);
@@ -120,11 +119,11 @@
 void ZipArchive::addFiles() {
   sint32 temp = ofscd;
   
-  Reader reader(&bytes);
+  Reader reader(bytes);
   reader.cursor = temp;
 
   while (true) {
-    if (memcmp(ArrayUInt8::getElements(bytes) + temp, HDR_CENTRAL, 4)) return;
+    if (memcmp(bytes->elements + temp, HDR_CENTRAL, 4)) return;
     ZipFile* ptr = new(allocator, "ZipFile") ZipFile();
     reader.cursor = temp + 4 + C_COMPRESSION_METHOD;
     ptr->compressionMethod = readEndianDep2(reader);
@@ -148,7 +147,7 @@
 
     ptr->filename = (char*)allocator.Allocate(ptr->filenameLength + 1,
                                               "Zip file name");
-    memcpy(ptr->filename, ArrayUInt8::getElements(bytes) + temp,
+    memcpy(ptr->filename, bytes->elements + temp,
            ptr->filenameLength);
     ptr->filename[ptr->filenameLength] = 0;
 
@@ -161,17 +160,16 @@
   }
 }
 
-sint32 ZipArchive::readFile(ArrayUInt8* array, const ZipFile* file) {
-  llvm_gcroot(array, 0);
+sint32 ZipArchive::readFile(ClassBytes* array, const ZipFile* file) {
   uint32 bytesLeft = 0;
   uint32 filenameLength = 0;
   uint32 extraFieldLength = 0;
   uint32 temp = 0;
 
-  Reader reader(&bytes);
+  Reader reader(bytes);
   reader.cursor = file->rolh;
   
-  if (!(memcmp(ArrayUInt8::getElements(bytes) + file->rolh, HDR_LOCAL, 4))) {
+  if (!(memcmp(bytes->elements + file->rolh, HDR_LOCAL, 4))) {
     reader.cursor += 4;
     temp = reader.cursor;
     reader.cursor += L_FILENAME_LENGTH;
@@ -182,14 +180,14 @@
       temp + extraFieldLength + filenameLength + LOCAL_FILE_HEADER_SIZE;
 
     if (file->compressionMethod == ZIP_STORE) {
-      memcpy(ArrayUInt8::getElements(array), ArrayUInt8::getElements(bytes) + reader.cursor, file->ucsize);
+      memcpy(array->elements, bytes->elements + reader.cursor, file->ucsize);
       return 1;
     } else if (file->compressionMethod == ZIP_DEFLATE) {
       z_stream stre;
       sint32 err = 0;
       
       bytesLeft = file->csize;
-      stre.next_out = (Bytef*)ArrayUInt8::getElements(array);
+      stre.next_out = (Bytef*)array->elements;
       stre.avail_out = file->ucsize;
       stre.zalloc = 0;
       stre.zfree = 0;
@@ -202,7 +200,7 @@
 
       while (bytesLeft) {
         uint32 size = 0;
-        stre.next_in = ArrayUInt8::getElements(bytes) + reader.cursor;
+        stre.next_in = bytes->elements + reader.cursor;
         if (bytesLeft > 1024) size = 1024;
         else size = bytesLeft;
 

Modified: vmkit/trunk/lib/J3/VMCore/Zip.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Zip.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/Zip.h (original)
+++ vmkit/trunk/lib/J3/VMCore/Zip.h Sat Nov 27 04:07:18 2010
@@ -16,7 +16,7 @@
 
 namespace j3 {
 
-class ArrayUInt8;
+class classBytes;
 class JnjvmBootstrapLoader;
 
 struct ZipFile : public mvm::PermanentObject {
@@ -49,7 +49,7 @@
 public:
   std::map<const char*, ZipFile*, ltstr> filetable;
   typedef std::map<const char*, ZipFile*, ltstr>::iterator table_iterator;
-  ArrayUInt8* bytes;
+  ClassBytes* bytes;
 
 private:
   
@@ -70,9 +70,9 @@
   }
 
   int getOfscd() { return ofscd; }
-  ZipArchive(ArrayUInt8* bytes, mvm::BumpPtrAllocator& allocator);
+  ZipArchive(ClassBytes* bytes, mvm::BumpPtrAllocator& allocator);
   ZipFile* getFile(const char* filename);
-  int readFile(ArrayUInt8* array, const ZipFile* file);
+  int readFile(ClassBytes* array, const ZipFile* file);
 
 };
 

Modified: vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp Sat Nov 27 04:07:18 2010
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include <cassert>
+#include <signal.h>
 #include "MvmGC.h"
 #include "mvm/VirtualMachine.h"
 #include "mvm/Threads/CollectionRV.h"
@@ -80,6 +81,13 @@
   unlockRV();
 }
 
+
+#if defined(__MACH__)
+# define SIGGC  SIGXCPU
+#else
+# define SIGGC  SIGPWR
+#endif
+
 void UncooperativeCollectionRV::synchronize() { 
   assert(nbJoined == 0);
   mvm::Thread* self = mvm::Thread::get();
@@ -89,7 +97,8 @@
   
   for (mvm::Thread* cur = (mvm::Thread*)self->next(); cur != self; 
        cur = (mvm::Thread*)cur->next()) {
-    cur->killForRendezvous();
+    int res = cur->kill(SIGGC);
+    assert(!res && "Error on kill");
   }
   
   // And wait for other threads to finish.
@@ -154,7 +163,7 @@
   th->inRV = false;
 }
 
-void CooperativeCollectionRV::joinAfterUncooperative() {
+void CooperativeCollectionRV::joinAfterUncooperative(void* SP) {
   mvm::Thread* th = mvm::Thread::get();
   assert((th->getLastSP() == NULL) &&
          "SP set after entering uncooperative code");
@@ -163,7 +172,7 @@
 
   lockRV();
   if (th->doYield) {
-    th->setLastSP(FRAME_PTR());
+    th->setLastSP(SP);
     if (!th->joinedRV) {
       th->joinedRV = true;
       another_mark();
@@ -213,10 +222,36 @@
   initiator->inRV = false;
 }
 
-void UncooperativeCollectionRV::joinAfterUncooperative() {
+void UncooperativeCollectionRV::joinAfterUncooperative(void* SP) {
   UNREACHABLE();
 }
 
 void UncooperativeCollectionRV::joinBeforeUncooperative() {
   UNREACHABLE();
 }
+
+void CooperativeCollectionRV::addThread(Thread* th) {
+  // Nothing to do.
+}
+
+static void siggcHandler(int) {
+  mvm::Thread* th = mvm::Thread::get();
+  th->MyVM->rendezvous.join();
+}
+
+void UncooperativeCollectionRV::addThread(Thread* th) {
+  // Set the SIGGC handler for uncooperative rendezvous.
+  struct sigaction sa;
+  sigset_t mask;
+  sigaction(SIGGC, 0, &sa);
+  sigfillset(&mask);
+  sa.sa_mask = mask;
+  sa.sa_handler = siggcHandler;
+  sa.sa_flags |= SA_RESTART;
+  sigaction(SIGGC, &sa, NULL);
+  
+  if (nbJoined != 0) {
+    // In uncooperative mode, we may have missed a signal.
+    join();
+  }
+}

Modified: vmkit/trunk/lib/Mvm/CommonThread/Sigsegv.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/Sigsegv.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/CommonThread/Sigsegv.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommonThread/Sigsegv.cpp Sat Nov 27 04:07:18 2010
@@ -54,8 +54,8 @@
                     "the bottom of the stack is always available when entering"
                     "\nthe VM.\n");
   } else {
-    fprintf(stderr, "I received a SIGSEGV: either the VM code or an external\n"
-                    "native method is bogus. Aborting...\n");
+    fprintf(stderr, "Thread %p received a SIGSEGV: either the VM code or an external\n"
+                    "native method is bogus. Aborting...\n", (void*)th);
   }
   th->printBacktrace();
   abort();

Modified: vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp Sat Nov 27 04:07:18 2010
@@ -188,176 +188,3 @@
 
   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 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.
-///
-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 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);
-    assert(res && "Lock deallocated while held.");
-    return res;
-  }
-}
-
-void ThinLock::acquire(gc* object) {
-  llvm_gcroot(object, 0);
-  uint64_t id = mvm::Thread::get()->getThreadID();
-  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 = oldValue + ThinCountAdd;
-        yieldedValue = __sync_val_compare_and_swap(&(object->header), oldValue, newValue);
-      } while (oldValue != yieldedValue);
-    } else {
-      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 != NULL) {
-        if (obj->acquire(object)) {
-          break;
-        }
-      }
-    }
-    
-    while (object->header & ~NonLockBitsMask) {
-      if (object->header & FatMask) {
-        break;
-      } else {
-        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!");
-}
-
-/// 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();
-  uintptr_t oldValue = 0;
-  uintptr_t newValue = 0;
-  uintptr_t yieldedValue = 0;
-  if ((object->header & ~NonLockBitsMask) == id) {
-    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 {
-    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);
-  }
-}
-
-/// 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 != NULL) return obj->owner();
-  } else {
-    uint64 id = mvm::Thread::get()->getThreadID();
-    if ((object->header & Thread::IDMask) == id) return true;
-  }
-  return false;
-}
-
-/// 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/lib/Mvm/CommonThread/ctthread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Sat Nov 27 04:07:18 2010
@@ -10,13 +10,14 @@
 #include "debug.h"
 
 #include "MvmGC.h"
+#include "mvm/MethodInfo.h"
 #include "mvm/VirtualMachine.h"
 #include "mvm/Threads/Cond.h"
 #include "mvm/Threads/Locks.h"
 #include "mvm/Threads/Thread.h"
 
 #include <cassert>
-#include <signal.h>
+#include <csetjmp>
 #include <cstdio>
 #include <ctime>
 #include <dlfcn.h>
@@ -24,6 +25,7 @@
 #include <pthread.h>
 #include <sys/mman.h>
 #include <sched.h>
+#include <signal.h>
 #include <unistd.h>
 
 using namespace mvm;
@@ -54,8 +56,8 @@
   MyVM->rendezvous.joinBeforeUncooperative(); 
 }
 
-void Thread::joinRVAfterLeave() {
-  MyVM->rendezvous.joinAfterUncooperative(); 
+void Thread::joinRVAfterLeave(void* savedSP) {
+  MyVM->rendezvous.joinAfterUncooperative(savedSP); 
 }
 
 void Thread::startKnownFrame(KnownFrame& F) {
@@ -65,10 +67,29 @@
   cur = (void**)cur[0];
   F.previousFrame = lastKnownFrame;
   F.currentFP = cur;
+  // This is used as a marker.
+  F.currentIP = NULL;
   lastKnownFrame = &F;
 }
 
 void Thread::endKnownFrame() {
+  assert(lastKnownFrame->currentIP == NULL);
+  lastKnownFrame = lastKnownFrame->previousFrame;
+}
+
+void Thread::startUnknownFrame(KnownFrame& F) {
+  // Get the caller of this function
+  void** cur = (void**)FRAME_PTR();
+  // Get the caller of the caller.
+  cur = (void**)cur[0];
+  F.previousFrame = lastKnownFrame;
+  F.currentFP = cur;
+  F.currentIP = FRAME_IP(cur);
+  lastKnownFrame = &F;
+}
+
+void Thread::endUnknownFrame() {
+  assert(lastKnownFrame->currentIP != NULL);
   lastKnownFrame = lastKnownFrame->previousFrame;
 }
 
@@ -153,22 +174,127 @@
 }
 
 void StackWalker::operator++() {
-  if (addr < thread->baseSP && addr < addr[0]) {
-    if (frame && addr == frame->currentFP) {
+  if (addr != thread->baseSP) {
+    assert((addr < thread->baseSP) && "Corrupted stack");
+    assert((addr < addr[0]) && "Corrupted stack");
+    if ((frame != NULL) && (addr == frame->currentFP)) {
+      assert(frame->currentIP == NULL);
+      frame = frame->previousFrame;
+      assert(frame != NULL);
+      assert(frame->currentIP != NULL);
+      addr = (void**)frame->currentFP;
       frame = frame->previousFrame;
-      if  (frame) {
-        addr = (void**)frame->currentFP;
-        frame = frame->previousFrame;
-      } else {
-        addr = (void**)addr[0];
-      }
     } else {
       addr = (void**)addr[0];
     }
+  }
+}
+
+StackWalker::StackWalker(mvm::Thread* th) {
+  thread = th;
+  frame = th->lastKnownFrame;
+  if (mvm::Thread::get() == th) {
+    addr = (void**)FRAME_PTR();
+    addr = (void**)addr[0];
+  } else {
+    addr = (void**)th->waitOnSP();
+    if (frame) {
+      assert(frame->currentFP >= addr);
+    }
+    if (frame && (addr == frame->currentFP)) {
+      frame = frame->previousFrame;
+      assert((frame == NULL) || (frame->currentIP == NULL));
+    }
+  }
+  assert(addr && "No address to start with");
+}
+
+
+#ifdef WITH_LLVM_GCC
+void Thread::scanStack(uintptr_t closure) {
+  StackWalker Walker(this);
+  while (MethodInfo* MI = Walker.get()) {
+    MI->scan(closure, Walker.ip, Walker.addr);
+    ++Walker;
+  }
+}
+
+#else
+
+void Thread::scanStack(uintptr_t closure) {
+  register unsigned int  **max = (unsigned int**)(void*)this->baseSP;
+  if (mvm::Thread::get() != this) {
+    register unsigned int  **cur = (unsigned int**)this->waitOnSP();
+    for(; cur<max; cur++) Collector::scanObject((void**)cur, closure);
   } else {
-    addr = (void**)thread->baseSP;
+    jmp_buf buf;
+    setjmp(buf);
+    register unsigned int  **cur = (unsigned int**)&buf;
+    for(; cur<max; cur++) Collector::scanObject((void**)cur, closure);
   }
 }
+#endif
+
+void Thread::enterUncooperativeCode(unsigned level) {
+  if (isMvmThread()) {
+    if (!inRV) {
+      assert(!lastSP && "SP already set when entering uncooperative code");
+      // Get the caller.
+      void* temp = FRAME_PTR();
+      // Make sure to at least get the caller of the caller.
+      ++level;
+      while (level--) temp = ((void**)temp)[0];
+      // 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");
+    }
+  }
+}
+
+void Thread::enterUncooperativeCode(void* SP) {
+  if (isMvmThread()) {
+    if (!inRV) {
+      assert(!lastSP && "SP already set when entering uncooperative code");
+      // 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");
+    }
+  }
+}
+
+void Thread::leaveUncooperativeCode() {
+  if (isMvmThread()) {
+    if (!inRV) {
+      assert(lastSP && "No last SP when leaving uncooperative code");
+      void* savedSP = lastSP;
+      // 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(savedSP);
+      assert(!lastSP && "SP has a value after leaving uncooperative code");
+    }
+  }
+}
+
+void* Thread::waitOnSP() {
+  // First see if we can get lastSP directly.
+  void* sp = lastSP;
+  if (sp) return sp;
+  
+  // Then loop a fixed number of iterations to get lastSP.
+  for (uint32 count = 0; count < 1000; ++count) {
+    sp = lastSP;
+    if (sp) return sp;
+  }
+  
+  // Finally, yield until lastSP is not set.
+  while ((sp = lastSP) == NULL) mvm::Thread::yield();
+
+  assert(sp != NULL && "Still no sp");
+  return sp;
+}
 
 
 uintptr_t Thread::baseAddr = 0;
@@ -267,24 +393,12 @@
 
 extern void sigsegvHandler(int, siginfo_t*, void*);
 
-
-#if defined(__MACH__)
-# define SIGGC  SIGXCPU
-#else
-# define SIGGC  SIGPWR
-#endif
-
-static void siggcHandler(int) {
-  mvm::Thread* th = mvm::Thread::get();
-  th->MyVM->rendezvous.join();
-}
-
 /// internalThreadStart - The initial function called by a thread. Sets some
 /// thread specific data, registers the thread to the GC and calls the
 /// given routine of th.
 ///
 void Thread::internalThreadStart(mvm::Thread* th) {
-  th->baseSP  = (void*)&th;
+  th->baseSP  = FRAME_PTR();
 
   // Set the SIGSEGV handler to diagnose errors.
   struct sigaction sa;
@@ -295,22 +409,14 @@
   sa.sa_sigaction = sigsegvHandler;
   sigaction(SIGSEGV, &sa, NULL);
 
-  // Set the SIGGC handler for uncooperative rendezvous.
-  sigaction(SIGGC, 0, &sa);
-  sigfillset(&mask);
-  sa.sa_mask = mask;
-  sa.sa_handler = siggcHandler;
-  sa.sa_flags |= SA_RESTART;
-  sigaction(SIGGC, &sa, NULL);
 
   assert(th->MyVM && "VM not set in a thread");
 #ifdef ISOLATE
   th->IsolateID = th->MyVM->IsolateID;
 #endif
-  th->MyVM->addThread(th); 
+  th->MyVM->rendezvous.addThread(th);
   th->routine(th);
   th->MyVM->removeThread(th);
-  delete th;
 }
 
 
@@ -323,6 +429,9 @@
   pthread_attr_init(&attributs);
   pthread_attr_setstack(&attributs, this, STACK_SIZE);
   routine = fct;
+  // Make sure to add it in the list of threads before leaving this function:
+  // the garbage collector wants to trace this thread.
+  MyVM->addThread(this);
   int res = pthread_create((pthread_t*)(void*)(&internalThreadID), &attributs,
                            (void* (*)(void *))internalThreadStart, this);
   pthread_detach((pthread_t)internalThreadID);
@@ -346,18 +455,23 @@
       res = (void*)TheStackManager.allocate();
     }
   }
+  // Make sure the thread information is cleared.
+  memset(res, 0, sz);
   return res;
 }
 
 /// releaseThread - Remove the stack of the thread from the list of stacks
 /// in use.
-void Thread::releaseThread(void* th) {
+void Thread::releaseThread(mvm::Thread* th) {
+  // It seems like the pthread implementation in Linux is clearing with NULL
+  // the stack of the thread. So we have to get the thread id before
+  // calling pthread_join.
+  void* thread_id = th->internalThreadID;
+  if (thread_id != NULL) {
+    // Wait for the thread to die.
+    pthread_join((pthread_t)thread_id, NULL);
+  }
   uintptr_t index = ((uintptr_t)th & Thread::IDMask);
   index = (index & ~TheStackManager.baseAddr) >> 20;
   TheStackManager.used[index] = 0;
 }
-
-void Thread::killForRendezvous() {
-  int res = kill(SIGGC);
-  assert(!res && "Error on kill");
-}

Modified: vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/JIT.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Sat Nov 27 04:07:18 2010
@@ -22,6 +22,7 @@
 #include <llvm/Analysis/Verifier.h>
 #include <llvm/Assembly/Parser.h>
 #include <llvm/CodeGen/GCStrategy.h>
+#include <llvm/CodeGen/JITCodeEmitter.h>
 #include <llvm/Config/config.h>
 #include <llvm/ExecutionEngine/ExecutionEngine.h>
 #include "llvm/ExecutionEngine/JITEventListener.h"
@@ -35,6 +36,7 @@
 #include <llvm/Target/TargetMachine.h>
 #include <llvm/Target/TargetOptions.h>
 #include <llvm/Target/TargetSelect.h>
+#include <../lib/ExecutionEngine/JIT/JIT.h>
 
 #include "mvm/JIT.h"
 #include "mvm/Threads/Locks.h"
@@ -83,7 +85,7 @@
 }
 
 void MvmJITMethodInfo::print(void* ip, void* addr) {
-  fprintf(stderr, "; %p in %s LLVM method\n", ip,
+  fprintf(stderr, "; %p (%p) in %s LLVM method\n", ip, addr,
       ((llvm::Function*)MetaInfo)->getName().data());
 }
 
@@ -93,24 +95,33 @@
                                      void *Code, size_t Size,
                                      const EmittedFunctionDetails &Details) {
     assert(F.getParent() == MvmModule::globalModule);
-    llvm::GCFunctionInfo* GFI = 0;
+    assert(F.hasGC());
     // We know the last GC info is for this method.
-    if (F.hasGC()) {
-      GCStrategy::iterator I = mvm::MvmModule::TheGCStrategy->end();
-      I--;
-      DEBUG(errs() << (*I)->getFunction().getName() << '\n');
-      DEBUG(errs() << F.getName() << '\n');
-      assert(&(*I)->getFunction() == &F &&
+    GCStrategy::iterator I = mvm::MvmModule::TheGCStrategy->end();
+    I--;
+    DEBUG(errs() << (*I)->getFunction().getName() << '\n');
+    DEBUG(errs() << F.getName() << '\n');
+    assert(&(*I)->getFunction() == &F &&
         "GC Info and method do not correspond");
-      GFI = *I;
-    }
-    MethodInfo* MI =
-      new(*MvmModule::Allocator, "MvmJITMethodInfo") MvmJITMethodInfo(GFI, &F);
-    VirtualMachine::SharedRuntimeFunctions.addMethodInfo(MI, Code,
-                                            (void*)((uintptr_t)Code + Size));
+    llvm::GCFunctionInfo* GFI = *I;
+    JITMethodInfo* MI = new(*MvmModule::Allocator, "MvmJITMethodInfo")
+        MvmJITMethodInfo(GFI, &F, MvmModule::executionEngine);
+    MI->addToVM(mvm::Thread::get()->MyVM, (JIT*)MvmModule::executionEngine);
   }
 };
 
+void JITMethodInfo::addToVM(VirtualMachine* VM, JIT* jit) {
+  JITCodeEmitter* JCE = jit->getCodeEmitter();
+  assert(GCInfo != NULL);
+  for (GCFunctionInfo::iterator I = GCInfo->begin(), E = GCInfo->end();
+       I != E;
+       I++) {
+    uintptr_t address = JCE->getLabelAddress(I->Label);
+    assert(address != 0);
+    VM->FunctionsCache.addMethodInfo(this, (void*)address);
+  }
+}
+
 static MvmJITListener JITListener;
 
 void MvmModule::loadBytecodeFile(const std::string& str) {
@@ -317,6 +328,7 @@
   unconditionalSafePoint = module->getFunction("unconditionalSafePoint");
   conditionalSafePoint = module->getFunction("conditionalSafePoint");
   AllocateFunction = module->getFunction("gcmalloc");
+  AllocateFunction->setGC("vmkit");
   assert(AllocateFunction && "No allocate function");
   AllocateUnresolvedFunction = module->getFunction("gcmallocUnresolved");
   assert(AllocateUnresolvedFunction && "No allocateUnresolved function");

Modified: vmkit/trunk/lib/Mvm/Compiler/VmkitGC.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/VmkitGC.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/VmkitGC.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/VmkitGC.cpp Sat Nov 27 04:07:18 2010
@@ -32,5 +32,4 @@
 
 VmkitGC::VmkitGC() {
   NeededSafePoints = 1 << GC::PostCall;
-  mvm::MvmModule::TheGCStrategy = this;
 }

Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp Sat Nov 27 04:07:18 2010
@@ -33,18 +33,13 @@
 
 void Collector::do_collect() {
   GCChunkNode  *cur;
-#ifdef SERVICE
-  mvm::Thread::get()->MyVM->_since_last_collection = _collect_freq_auto;
-#else
   _since_last_collection = _collect_freq_auto;
-#endif
 
   current_mark++;
 
   unused_nodes->attrape(used_nodes);
 
   mvm::Thread* th = mvm::Thread::get();
-  mvm::StackScanner* sc = th->MyVM->getScanner();
   th->MyVM->rendezvous.startRV();
   th->MyVM->startCollection();
 
@@ -57,7 +52,7 @@
 
   // (2) Trace the threads.
   do {
-    sc->scanStack(tcur, 0);
+    tcur->scanStack(0);
     tcur->tracer(0);
     tcur = (mvm::Thread*)tcur->next();
   } while (tcur != th);
@@ -94,10 +89,8 @@
   status = stat_alloc;
   
   // Wake up all threads.
-  th->MyVM->endCollection();
   th->MyVM->rendezvous.finishRV();
-  th->MyVM->wakeUpFinalizers();
-  th->MyVM->wakeUpEnqueue();
+  th->MyVM->endCollection();
   
   // Kill unreachable objects.
   GCChunkNode *next = 0;

Modified: vmkit/trunk/lib/Mvm/MMTk/MutatorThread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MutatorThread.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/MMTk/MutatorThread.h (original)
+++ vmkit/trunk/lib/Mvm/MMTk/MutatorThread.h Sat Nov 27 04:07:18 2010
@@ -21,7 +21,7 @@
   MutatorThread() : mvm::Thread() {
     MutatorContext = 0;
   }
-  mvm::BumpPtrAllocator Allocator;
+  mvm::ThreadAllocator Allocator;
   uintptr_t MutatorContext;
   
   /// realRoutine - The function to invoke when the thread starts.

Modified: vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Sat Nov 27 04:07:18 2010
@@ -24,19 +24,11 @@
 using namespace mvm;
 
 void CamlMethodInfo::scan(uintptr_t closure, void* ip, void* addr) {
-  if (!CF && InstructionPointer) {
-    MethodInfo* MI = VirtualMachine::SharedStaticFunctions.IPToMethodInfo(ip);
-    if (MI != &DefaultMethodInfo::DM) {
-      CF = ((CamlMethodInfo*)MI)->CF;
-    }
-  }
-
-  if (CF) {
-    //uintptr_t spaddr = (uintptr_t)addr + CF->FrameSize + sizeof(void*);
-    uintptr_t spaddr = ((uintptr_t*)addr)[0];
-    for (uint16 i = 0; i < CF->NumLiveOffsets; ++i) {
-      Collector::scanObject((void**)(spaddr + CF->LiveOffsets[i]), closure);
-    }
+  assert(CF != NULL);
+  //uintptr_t spaddr = (uintptr_t)addr + CF->FrameSize + sizeof(void*);
+  uintptr_t spaddr = ((uintptr_t*)addr)[0];
+  for (uint16 i = 0; i < CF->NumLiveOffsets; ++i) {
+    Collector::scanObject((void**)(spaddr + CF->LiveOffsets[i]), closure);
   }
 }
 
@@ -59,52 +51,6 @@
 void DefaultMethodInfo::scan(uintptr_t closure, void* ip, void* addr) {
 }
 
-
-MethodInfo* StartFunctionMap::IPToMethodInfo(void* ip) {
-  FunctionMapLock.acquire();
-  std::map<void*, MethodInfo*>::iterator E = Functions.end();
-  std::map<void*, MethodInfo*>::iterator I = Functions.find(ip);
-  MethodInfo* MI = 0;
-  if (I == E) {
-    Dl_info info;
-    int res = dladdr(ip, &info);
-    if (res != 0) {
-      I = Functions.find(info.dli_saddr);
-      if (I == E) {
-        // The method is static, and we have no information for it.
-        // Just return the Default MethodInfo object.
-        MI = &DefaultMethodInfo::DM;
-      } else {
-        MI = I->second;
-      }
-    } else {
-      // The method is jitted, and no-one has intercepted its compilation.
-      // Just return the Default MethodInfo object.
-      MI = &DefaultMethodInfo::DM;
-    }
-    // Add it to the map, so that we don't need to call dladdr again.
-    Functions.insert(std::make_pair(ip, MI));
-  } else {
-    MI = I->second;
-  }
-  FunctionMapLock.release();
-  return MI;
-}
-
-MethodInfo* VirtualMachine::IPToMethodInfo(void* ip) {
-  MethodInfo* MI = RuntimeFunctions.IPToMethodInfo(ip);
-  if (MI) return MI;
-  
-  MI = SharedRuntimeFunctions.IPToMethodInfo(ip);
-  if (MI) return MI;
-
-  MI = StaticFunctions.IPToMethodInfo(ip);
-  if (MI != &DefaultMethodInfo::DM) return MI;
-
-  MI = SharedStaticFunctions.IPToMethodInfo(ip);
-  return MI;
-}
-
 struct CamlFrames {
   uint16_t NumDescriptors;
   CamlFrame frames[1];
@@ -114,14 +60,11 @@
   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() {
@@ -135,55 +78,67 @@
       (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) {
+  CamlFrame* next() {
     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();
-    }
+    advance();
     return result;
   }
 };
 
-void SharedStartFunctionMap::initialize() {
+static BumpPtrAllocator* StaticAllocator = NULL;
+
+FunctionMap::FunctionMap() {
   CamlFrames* frames =
     (CamlFrames*)dlsym(SELF_HANDLE, "camlVmkitoptimized__frametable");
+  if (frames == NULL) return;
+  
   StaticAllocator = new BumpPtrAllocator();
-  const char* name = NULL;
-  void* address = NULL;
+  CamlFrameDecoder decoder(frames);
+  Dl_info info;
+  while (decoder.hasNext()) {
+    CamlFrame* frame = decoder.next();
+    int res = dladdr(frame->ReturnAddress, &info);
+    assert(res != 0 && "No frame");
+    StaticCamlMethodInfo* MI = new(*StaticAllocator, "StaticCamlMethodInfo")
+        StaticCamlMethodInfo(frame, info.dli_sname);
+    addMethodInfo(MI, frame->ReturnAddress);
+  }
+}
 
-  if (frames != NULL) {
-    CamlFrameDecoder decoder(frames);
-    while (decoder.hasNext()) {
-      CamlFrame* frame = decoder.next(&address, &name);
-      StaticCamlMethodInfo* MI = new(*StaticAllocator, "StaticCamlMethodInfo")
-          StaticCamlMethodInfo(frame, address, name);
-      addMethodInfo(MI, address);
-    }
+MethodInfo* FunctionMap::IPToMethodInfo(void* ip) {
+  FunctionMapLock.acquire();
+  std::map<void*, MethodInfo*>::iterator I = Functions.find(ip);
+  MethodInfo* res = NULL;
+  if (I != Functions.end()) {
+    res = I->second;
+  } else {
+    res = &DefaultMethodInfo::DM;
   }
+  FunctionMapLock.release();
+  return res;
 }
 
-CamlMethodInfo::CamlMethodInfo(CamlFrame* C, void* ip) {
-  InstructionPointer = ip;
-  CF = C;
+void FunctionMap::addMethodInfo(MethodInfo* meth, void* ip) {
+  FunctionMapLock.acquire();
+  Functions.insert(std::make_pair(ip, meth));
+  FunctionMapLock.release();
 }
 
-StartEndFunctionMap VirtualMachine::SharedRuntimeFunctions;
-SharedStartFunctionMap VirtualMachine::SharedStaticFunctions;
+
+void FunctionMap::removeMethodInfos(void* owner) {
+  FunctionMapLock.acquire();
+  std::map<void*, mvm::MethodInfo*>::iterator temp;
+  for (std::map<void*, mvm::MethodInfo*>::iterator i = Functions.begin(),
+       e = Functions.end(); i != e;) {
+    mvm::MethodInfo* MI = i->second;
+    temp = i;
+    i++;
+    if (MI->Owner == owner) {
+      Functions.erase(temp);
+    }
+  }
+  FunctionMapLock.release();
+}

Modified: vmkit/trunk/lib/Mvm/Runtime/Object.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/Object.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/Object.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/Object.cpp Sat Nov 27 04:07:18 2010
@@ -9,14 +9,10 @@
 
 #include <cstdio>
 #include <cstdlib>
-#include <csetjmp>
 
 #include "MvmGC.h"
-#include "mvm/Allocator.h"
 #include "mvm/Object.h"
 #include "mvm/PrintBuffer.h"
-#include "mvm/VirtualMachine.h"
-#include "mvm/Threads/Thread.h"
 
 using namespace mvm;
 
@@ -58,222 +54,3 @@
   buf->writePtr((void*)o);
   buf->write(">");
 }
-
-typedef void (*destructor_t)(void*);
-
-void invokeFinalize(mvm::Thread* th, gc* res) {
-  llvm_gcroot(res, 0);
-  TRY {
-    th->MyVM->invokeFinalizer(res);
-  } IGNORE;
-  th->clearException();
-}
-
-void invokeEnqueue(mvm::Thread* th, gc* res) {
-  llvm_gcroot(res, 0);
-  TRY {
-    th->MyVM->enqueueReference(res);
-  } IGNORE;
-  th->clearException();
-}
-
-void VirtualMachine::finalizerStart(mvm::Thread* th) {
-  VirtualMachine* vm = th->MyVM;
-  gc* res = 0;
-  llvm_gcroot(res, 0);
-
-  while (true) {
-    vm->FinalizationLock.lock();
-    while (vm->CurrentFinalizedIndex == 0) {
-      vm->FinalizationCond.wait(&vm->FinalizationLock);
-    }
-    vm->FinalizationLock.unlock();
-
-    while (true) {
-      vm->FinalizationQueueLock.acquire();
-      if (vm->CurrentFinalizedIndex != 0) {
-        res = vm->ToBeFinalized[vm->CurrentFinalizedIndex - 1];
-        --vm->CurrentFinalizedIndex;
-      }
-      vm->FinalizationQueueLock.release();
-      if (!res) break;
-
-      VirtualTable* VT = res->getVirtualTable();
-      if (VT->operatorDelete) {
-        destructor_t dest = (destructor_t)VT->destructor;
-        dest(res);
-      } else {
-        invokeFinalize(th, res);
-      }
-      res = 0;
-    }
-  }
-}
-
-void VirtualMachine::enqueueStart(mvm::Thread* th) {
-  VirtualMachine* vm = th->MyVM;
-  gc* res = 0;
-  llvm_gcroot(res, 0);
-
-  while (true) {
-    vm->EnqueueLock.lock();
-    while (vm->ToEnqueueIndex == 0) {
-      vm->EnqueueCond.wait(&vm->EnqueueLock);
-    }
-    vm->EnqueueLock.unlock();
-
-    while (true) {
-      vm->ToEnqueueLock.acquire();
-      if (vm->ToEnqueueIndex != 0) {
-        res = vm->ToEnqueue[vm->ToEnqueueIndex - 1];
-        --vm->ToEnqueueIndex;
-      }
-      vm->ToEnqueueLock.release();
-      if (!res) break;
-
-      invokeEnqueue(th, res);
-      res = 0;
-    }
-  }
-}
-
-void VirtualMachine::growFinalizationQueue() {
-  if (CurrentIndex >= QueueLength) {
-    uint32 newLength = QueueLength * GROW_FACTOR;
-    gc** newQueue = new gc*[newLength];
-    if (!newQueue) {
-      fprintf(stderr, "I don't know how to handle finalizer overflows yet!\n");
-      abort();
-    }
-    for (uint32 i = 0; i < QueueLength; ++i) newQueue[i] = FinalizationQueue[i];
-    delete[] FinalizationQueue;
-    FinalizationQueue = newQueue;
-    QueueLength = newLength;
-  }
-}
-
-void VirtualMachine::growToBeFinalizedQueue() {
-  if (CurrentFinalizedIndex >= ToBeFinalizedLength) {
-    uint32 newLength = ToBeFinalizedLength * GROW_FACTOR;
-    gc** newQueue = new gc*[newLength];
-    if (!newQueue) {
-      fprintf(stderr, "I don't know how to handle finalizer overflows yet!\n");
-      abort();
-    }
-    for (uint32 i = 0; i < ToBeFinalizedLength; ++i) newQueue[i] = ToBeFinalized[i];
-    delete[] ToBeFinalized;
-    ToBeFinalized = newQueue;
-    ToBeFinalizedLength = newLength;
-  }
-}
-
-
-void VirtualMachine::addFinalizationCandidate(gc* obj) {
-  FinalizationQueueLock.acquire();
- 
-  if (CurrentIndex >= QueueLength) {
-    growFinalizationQueue();
-  }
-  
-  FinalizationQueue[CurrentIndex++] = obj;
-  FinalizationQueueLock.release();
-}
-  
-
-void VirtualMachine::scanFinalizationQueue(uintptr_t closure) {
-  uint32 NewIndex = 0;
-  for (uint32 i = 0; i < CurrentIndex; ++i) {
-    gc* obj = FinalizationQueue[i];
-
-    if (!Collector::isLive(obj, closure)) {
-      obj = Collector::retainForFinalize(FinalizationQueue[i], closure);
-      
-      if (CurrentFinalizedIndex >= ToBeFinalizedLength)
-        growToBeFinalizedQueue();
-      
-      /* Add to object table */
-      ToBeFinalized[CurrentFinalizedIndex++] = obj;
-    } else {
-      FinalizationQueue[NewIndex++] =
-        Collector::getForwardedFinalizable(obj, closure);
-    }
-  }
-  CurrentIndex = NewIndex;
-}
-
-void VirtualMachine::tracer(uintptr_t closure) {
-  for (uint32 i = 0; i < CurrentFinalizedIndex; ++i) {
-    Collector::markAndTraceRoot(ToBeFinalized + i, closure);
-  }
-}
-
-gc* ReferenceQueue::processReference(
-    gc* reference, VirtualMachine* vm, uintptr_t closure) {
-  if (!Collector::isLive(reference, closure)) {
-    vm->clearReferent(reference);
-    return NULL;
-  }
-
-  gc* referent = *(vm->getReferentPtr(reference));
-
-  if (!referent) {
-    return NULL;
-  }
-
-  if (semantics == SOFT) {
-    // TODO: are we are out of memory? Consider that we always are for now.
-    if (false) {
-      Collector::retainReferent(referent, closure);
-    }
-  } else if (semantics == PHANTOM) {
-    // Nothing to do.
-  }
-
-  gc* newReference =
-      mvm::Collector::getForwardedReference(reference, closure);
-  if (Collector::isLive(referent, closure)) {
-    gc* newReferent = mvm::Collector::getForwardedReferent(referent, closure);
-    vm->setReferent(newReference, newReferent);
-    return newReference;
-  } else {
-    vm->clearReferent(newReference);
-    vm->addToEnqueue(newReference);
-    return NULL;
-  }
-}
-
-
-void ReferenceQueue::scan(VirtualMachine* vm, uintptr_t closure) {
-  uint32 NewIndex = 0;
-
-  for (uint32 i = 0; i < CurrentIndex; ++i) {
-    gc* obj = References[i];
-    gc* res = processReference(obj, vm, closure);
-    if (res) References[NewIndex++] = res;
-  }
-
-  CurrentIndex = NewIndex;
-}
-
-void PreciseStackScanner::scanStack(mvm::Thread* th, uintptr_t closure) {
-  StackWalker Walker(th);
-
-  while (MethodInfo* MI = Walker.get()) {
-    MI->scan(closure, Walker.ip, Walker.addr);
-    ++Walker;
-  }
-}
-
-
-void UnpreciseStackScanner::scanStack(mvm::Thread* th, uintptr_t closure) {
-  register unsigned int  **max = (unsigned int**)(void*)th->baseSP;
-  if (mvm::Thread::get() != th) {
-    register unsigned int  **cur = (unsigned int**)th->waitOnSP();
-    for(; cur<max; cur++) Collector::scanObject((void**)cur, closure);
-  } else {
-    jmp_buf buf;
-    setjmp(buf);
-    register unsigned int  **cur = (unsigned int**)&buf;
-    for(; cur<max; cur++) Collector::scanObject((void**)cur, closure);
-  }
-}

Modified: vmkit/trunk/mmtk/config/copyms/MMTkInline.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/config/copyms/MMTkInline.inc?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/config/copyms/MMTkInline.inc (original)
+++ vmkit/trunk/mmtk/config/copyms/MMTkInline.inc Sat Nov 27 04:07:18 2010
@@ -62,12 +62,12 @@
 std::vector<const Type*>StructTy_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::vector<const Type*>StructTy_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);
+std::vector<const Type*>StructTy_struct_llvm__SlabAllocator_fields;
+StructTy_struct_llvm__SlabAllocator_fields.push_back(PointerTy_5);
+StructType* StructTy_struct_llvm__SlabAllocator = StructType::get(mod->getContext(), StructTy_struct_llvm__SlabAllocator_fields, /*isPacked=*/false);
+mod->addTypeName("struct.llvm::SlabAllocator", StructTy_struct_llvm__SlabAllocator);
 
-PointerType* PointerTy_11 = PointerType::get(StructTy_struct_gcRoot, 0);
+PointerType* PointerTy_11 = PointerType::get(StructTy_struct_llvm__SlabAllocator, 0);
 
 StructTy_struct_llvm__BumpPtrAllocator_fields.push_back(PointerTy_11);
 std::vector<const Type*>StructTy_struct_llvm__MemSlab_fields;
@@ -102,60 +102,9 @@
 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::vector<const Type*>StructTy_struct_mvm__ReferenceQueue_fields;
-std::vector<const Type*>StructTy_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::vector<const Type*>StructTy_struct_mvm__Cond_fields;
-std::vector<const Type*>StructTy_union_pthread_cond_t_fields;
-std::vector<const Type*>StructTy_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::vector<const Type*>StructTy_struct_mvm__CooperativeCollectionRV_fields;
+std::vector<const Type*>StructTy_struct_mvm__CollectionRV_fields;
+StructTy_struct_mvm__CollectionRV_fields.push_back(PointerTy_5);
 std::vector<const Type*>StructTy_struct_mvm__LockNormal_fields;
 std::vector<const Type*>StructTy_struct_mvm__Lock_fields;
 StructTy_struct_mvm__Lock_fields.push_back(PointerTy_5);
@@ -183,26 +132,43 @@
 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::vector<const Type*>StructTy_struct_mvm__CollectionRV_fields;
 StructTy_struct_mvm__CollectionRV_fields.push_back(StructTy_struct_mvm__LockNormal);
+std::vector<const Type*>StructTy_struct_mvm__Cond_fields;
+std::vector<const Type*>StructTy_union_pthread_cond_t_fields;
+std::vector<const Type*>StructTy_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_14 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 1);
+
+StructTy_union_pthread_cond_t_fields.push_back(ArrayTy_14);
+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__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::vector<const Type*>StructTy_struct_mvm__StartEndFunctionMap_fields;
+StructTy_struct_mvm__CooperativeCollectionRV_fields.push_back(StructTy_struct_mvm__CollectionRV);
+StructType* StructTy_struct_mvm__CooperativeCollectionRV = StructType::get(mod->getContext(), StructTy_struct_mvm__CooperativeCollectionRV_fields, /*isPacked=*/false);
+mod->addTypeName("struct.mvm::CooperativeCollectionRV", StructTy_struct_mvm__CooperativeCollectionRV);
+
+StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__CooperativeCollectionRV);
 std::vector<const Type*>StructTy_struct_mvm__FunctionMap_fields;
 std::vector<const Type*>StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields;
 std::vector<const Type*>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;
@@ -216,11 +182,11 @@
 std::vector<const Type*>StructTy_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);
+PointerType* PointerTy_15 = 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);
+StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_15);
+StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_15);
+StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_15);
 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<OpaqueType>(StructTy_struct_std___Rb_tree_node_base_fwd.get())->refineAbstractTypeTo(StructTy_struct_std___Rb_tree_node_base);
@@ -245,12 +211,7 @@
 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);
+StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__FunctionMap);
 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);
 
@@ -263,41 +224,42 @@
 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::vector<const Type*>FuncTy_19_args;
-FuncTy_19_args.push_back(PointerTy_13);
-FunctionType* FuncTy_19 = FunctionType::get(
+std::vector<const Type*>FuncTy_17_args;
+FuncTy_17_args.push_back(PointerTy_13);
+FunctionType* FuncTy_17 = FunctionType::get(
  /*Result=*/Type::getVoidTy(mod->getContext()),
- /*Params=*/FuncTy_19_args,
+ /*Params=*/FuncTy_17_args,
  /*isVarArg=*/false);
 
-PointerType* PointerTy_18 = PointerType::get(FuncTy_19, 0);
+PointerType* PointerTy_16 = PointerType::get(FuncTy_17, 0);
 
-StructTy_struct_mvm__Thread_fields.push_back(PointerTy_18);
+StructTy_struct_mvm__Thread_fields.push_back(PointerTy_16);
 std::vector<const Type*>StructTy_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);
+StructTy_struct_mvm__KnownFrame_fields.push_back(PointerTy_0);
+PATypeHolder PointerTy_18_fwd = OpaqueType::get(mod->getContext());
+StructTy_struct_mvm__KnownFrame_fields.push_back(PointerTy_18_fwd);
 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<OpaqueType>(PointerTy_20_fwd.get())->refineAbstractTypeTo(PointerTy_20);
-PointerTy_20 = cast<PointerType>(PointerTy_20_fwd.get());
+PointerType* PointerTy_18 = PointerType::get(StructTy_struct_mvm__KnownFrame, 0);
+cast<OpaqueType>(PointerTy_18_fwd.get())->refineAbstractTypeTo(PointerTy_18);
+PointerTy_18 = cast<PointerType>(PointerTy_18_fwd.get());
 
 
-StructTy_struct_mvm__Thread_fields.push_back(PointerTy_20);
+StructTy_struct_mvm__Thread_fields.push_back(PointerTy_18);
 std::vector<const Type*>StructTy_struct_mvm__ExceptionBuffer_fields;
-PATypeHolder PointerTy_21_fwd = OpaqueType::get(mod->getContext());
-StructTy_struct_mvm__ExceptionBuffer_fields.push_back(PointerTy_21_fwd);
+PATypeHolder PointerTy_19_fwd = OpaqueType::get(mod->getContext());
+StructTy_struct_mvm__ExceptionBuffer_fields.push_back(PointerTy_19_fwd);
 std::vector<const Type*>StructTy_struct___jmp_buf_tag_fields;
-ArrayType* ArrayTy_23 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 6);
+ArrayType* ArrayTy_21 = 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(ArrayTy_21);
 StructTy_struct___jmp_buf_tag_fields.push_back(IntegerType::get(mod->getContext(), 32));
 std::vector<const Type*>StructTy_struct___sigset_t_fields;
-ArrayType* ArrayTy_24 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 32);
+ArrayType* ArrayTy_22 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 32);
 
-StructTy_struct___sigset_t_fields.push_back(ArrayTy_24);
+StructTy_struct___sigset_t_fields.push_back(ArrayTy_22);
 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);
 
@@ -305,18 +267,18 @@
 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);
+ArrayType* ArrayTy_20 = ArrayType::get(StructTy_struct___jmp_buf_tag, 1);
 
-StructTy_struct_mvm__ExceptionBuffer_fields.push_back(ArrayTy_22);
+StructTy_struct_mvm__ExceptionBuffer_fields.push_back(ArrayTy_20);
 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<OpaqueType>(PointerTy_21_fwd.get())->refineAbstractTypeTo(PointerTy_21);
-PointerTy_21 = cast<PointerType>(PointerTy_21_fwd.get());
+PointerType* PointerTy_19 = PointerType::get(StructTy_struct_mvm__ExceptionBuffer, 0);
+cast<OpaqueType>(PointerTy_19_fwd.get())->refineAbstractTypeTo(PointerTy_19);
+PointerTy_19 = cast<PointerType>(PointerTy_19_fwd.get());
 
 
-StructTy_struct_mvm__Thread_fields.push_back(PointerTy_21);
+StructTy_struct_mvm__Thread_fields.push_back(PointerTy_19);
 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<OpaqueType>(StructTy_struct_mvm__Thread_fwd.get())->refineAbstractTypeTo(StructTy_struct_mvm__Thread);
@@ -324,55 +286,70 @@
 
 
 StructTy_struct_mvm__MutatorThread_fields.push_back(StructTy_struct_mvm__Thread);
-StructTy_struct_mvm__MutatorThread_fields.push_back(StructTy_struct_mvm__BumpPtrAllocator);
+std::vector<const Type*>StructTy_struct_mvm__ThreadAllocator_fields;
+StructTy_struct_mvm__ThreadAllocator_fields.push_back(StructTy_struct_llvm__BumpPtrAllocator);
+StructType* StructTy_struct_mvm__ThreadAllocator = StructType::get(mod->getContext(), StructTy_struct_mvm__ThreadAllocator_fields, /*isPacked=*/false);
+mod->addTypeName("struct.mvm::ThreadAllocator", StructTy_struct_mvm__ThreadAllocator);
+
+StructTy_struct_mvm__MutatorThread_fields.push_back(StructTy_struct_mvm__ThreadAllocator);
 StructTy_struct_mvm__MutatorThread_fields.push_back(IntegerType::get(mod->getContext(), 32));
-StructTy_struct_mvm__MutatorThread_fields.push_back(PointerTy_18);
+StructTy_struct_mvm__MutatorThread_fields.push_back(PointerTy_16);
 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);
+PointerType* PointerTy_23 = PointerType::get(IntegerType::get(mod->getContext(), 32), 0);
 
 std::vector<const Type*>StructTy_struct_j3__JavaObject_fields;
+std::vector<const Type*>StructTy_struct_gc_fields;
+std::vector<const Type*>StructTy_struct_gcRoot_fields;
+StructTy_struct_gcRoot_fields.push_back(PointerTy_5);
+StructTy_struct_gcRoot_fields.push_back(IntegerType::get(mod->getContext(), 32));
+StructType* StructTy_struct_gcRoot = StructType::get(mod->getContext(), StructTy_struct_gcRoot_fields, /*isPacked=*/false);
+mod->addTypeName("struct.gcRoot", StructTy_struct_gcRoot);
+
+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);
+
 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);
+PointerType* PointerTy_24 = PointerType::get(StructTy_struct_j3__JavaObject, 0);
 
 std::vector<const Type*>StructTy_JavaObject_fields;
 ArrayType* ArrayTy_VT = ArrayType::get(PointerTy_6, 0);
 mod->addTypeName("VT", ArrayTy_VT);
 
-PointerType* PointerTy_29 = PointerType::get(ArrayTy_VT, 0);
+PointerType* PointerTy_27 = PointerType::get(ArrayTy_VT, 0);
 
-StructTy_JavaObject_fields.push_back(PointerTy_29);
+StructTy_JavaObject_fields.push_back(PointerTy_27);
 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_26 = PointerType::get(StructTy_JavaObject, 0);
 
-PointerType* PointerTy_27 = PointerType::get(PointerTy_28, 0);
+PointerType* PointerTy_25 = PointerType::get(PointerTy_26, 0);
 
-PointerType* PointerTy_30 = PointerType::get(PointerTy_0, 0);
+PointerType* PointerTy_28 = PointerType::get(PointerTy_0, 0);
 
-PointerType* PointerTy_31 = PointerType::get(PointerTy_29, 0);
+PointerType* PointerTy_29 = PointerType::get(PointerTy_27, 0);
 
-std::vector<const Type*>FuncTy_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,
+std::vector<const Type*>FuncTy_31_args;
+FuncTy_31_args.push_back(PointerTy_26);
+FuncTy_31_args.push_back(PointerTy_26);
+FuncTy_31_args.push_back(PointerTy_26);
+FuncTy_31_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_31_args.push_back(IntegerType::get(mod->getContext(), 32));
+FunctionType* FuncTy_31 = FunctionType::get(
+ /*Result=*/PointerTy_26,
+ /*Params=*/FuncTy_31_args,
  /*isVarArg=*/false);
 
-PointerType* PointerTy_32 = PointerType::get(FuncTy_33, 0);
+PointerType* PointerTy_30 = PointerType::get(FuncTy_31, 0);
 
 
 // Function Declarations
@@ -394,10 +371,11 @@
 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,
+ /*Type=*/FuncTy_31,
  /*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);
+func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II->setGC("vmkit");
 AttrListPtr func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
@@ -412,13 +390,13 @@
 // 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));
+ConstantInt* const_int32_32 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("3"), 10));
+ConstantInt* const_int32_33 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-4"), 10));
+ConstantInt* const_int32_34 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("0"), 10));
+ConstantInt* const_int32_35 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2146435072"), 10));
+ConstantInt* const_int32_36 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2"), 10));
+ConstantInt* const_int32_37 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("5"), 10));
+ConstantInt* const_int32_38 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1"), 10));
 
 // Global Variable Definitions
 
@@ -427,6 +405,7 @@
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"gcmalloc", mod); 
 func_gcmalloc->setCallingConv(CallingConv::C);
+func_gcmalloc->setGC("vmkit");
 AttrListPtr func_gcmalloc_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
@@ -449,94 +428,94 @@
 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;
+BinaryOperator* int32_39 = BinaryOperator::Create(Instruction::Add, int32_sz, const_int32_32, "", label_entry);
+BinaryOperator* int32_40 = BinaryOperator::Create(Instruction::And, int32_39, const_int32_33, "", label_entry);
+CallInst* ptr_41 = CallInst::Create(func_llvm_frameaddress, const_int32_34, "", label_entry);
+ptr_41->setCallingConv(CallingConv::C);
+ptr_41->setTailCall(true);
+AttrListPtr ptr_41_PAL;
 {
  SmallVector<AttributeWithIndex, 4> 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_41_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-ptr_43->setAttributes(ptr_43_PAL);
+ptr_41->setAttributes(ptr_41_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<Value*> 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<Value*> 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);
+CastInst* int32_42 = new PtrToIntInst(ptr_41, IntegerType::get(mod->getContext(), 32), "", label_entry);
+BinaryOperator* int32_43 = BinaryOperator::Create(Instruction::And, int32_42, const_int32_35, "", label_entry);
+CastInst* ptr_44 = new IntToPtrInst(int32_43, PointerTy_4, "", label_entry);
+std::vector<Value*> ptr_45_indices;
+ptr_45_indices.push_back(const_int32_34);
+ptr_45_indices.push_back(const_int32_36);
+Instruction* ptr_45 = GetElementPtrInst::Create(ptr_44, ptr_45_indices.begin(), ptr_45_indices.end(), "", label_entry);
+LoadInst* int32_46 = new LoadInst(ptr_45, "", false, label_entry);
+CastInst* ptr_47 = new IntToPtrInst(int32_46, PointerTy_24, "", label_entry);
+GetElementPtrInst* ptr_48 = GetElementPtrInst::Create(ptr_47, const_int32_37, "", label_entry);
+CastInst* ptr_49 = new BitCastInst(ptr_48, PointerTy_25, "", label_entry);
+LoadInst* ptr_50 = new LoadInst(ptr_49, "", false, label_entry);
+GetElementPtrInst* ptr_51 = GetElementPtrInst::Create(ptr_50, const_int32_38, "", label_entry);
+CastInst* ptr_52 = new BitCastInst(ptr_51, PointerTy_25, "", label_entry);
+LoadInst* ptr_53 = new LoadInst(ptr_52, "", false, label_entry);
+CastInst* int32_54 = new PtrToIntInst(ptr_53, IntegerType::get(mod->getContext(), 32), "", label_entry);
+BinaryOperator* int32_55 = BinaryOperator::Create(Instruction::Add, int32_54, int32_40, "", label_entry);
+CastInst* ptr_56 = new IntToPtrInst(int32_55, PointerTy_26, "", label_entry);
+std::vector<Value*> ptr_57_indices;
+ptr_57_indices.push_back(const_int32_38);
+ptr_57_indices.push_back(const_int32_38);
+Instruction* ptr_57 = GetElementPtrInst::Create(ptr_50, ptr_57_indices.begin(), ptr_57_indices.end(), "", label_entry);
+LoadInst* ptr_58 = new LoadInst(ptr_57, "", false, label_entry);
+CastInst* ptr_59 = new BitCastInst(ptr_58, PointerTy_26, "", label_entry);
+ICmpInst* int1_60 = new ICmpInst(*label_entry, ICmpInst::ICMP_UGT, ptr_56, ptr_59, "");
+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_60, 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<Value*> 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);
+std::vector<Value*> ptr_62_indices;
+ptr_62_indices.push_back(const_int32_38);
+ptr_62_indices.push_back(const_int32_34);
+Instruction* ptr_62 = GetElementPtrInst::Create(ptr_50, ptr_62_indices.begin(), ptr_62_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_55, PointerTy_27, ".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_62, 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<Value*> 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;
+std::vector<Value*> ptr_65_params;
+ptr_65_params.push_back(ptr_50);
+ptr_65_params.push_back(ptr_53);
+ptr_65_params.push_back(ptr_56);
+ptr_65_params.push_back(const_int32_34);
+ptr_65_params.push_back(const_int32_34);
+CallInst* ptr_65 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II, ptr_65_params.begin(), ptr_65_params.end(), "", label_false_IFEQ_i_i_i);
+ptr_65->setCallingConv(CallingConv::C);
+ptr_65->setTailCall(true);
+AttrListPtr ptr_65_PAL;
 {
  SmallVector<AttributeWithIndex, 4> 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_65_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-ptr_67->setAttributes(ptr_67_PAL);
+ptr_65->setAttributes(ptr_65_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<Value*> 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);
+PHINode* ptr_67 = PHINode::Create(PointerTy_26, "", label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit);
+ptr_67->reserveOperandSpace(2);
+ptr_67->addIncoming(ptr_53, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i);
+ptr_67->addIncoming(ptr_65, label_false_IFEQ_i_i_i);
+
+std::vector<Value*> ptr_68_indices;
+ptr_68_indices.push_back(const_int32_34);
+ptr_68_indices.push_back(const_int32_34);
+Instruction* ptr_68 = GetElementPtrInst::Create(ptr_67, ptr_68_indices.begin(), ptr_68_indices.end(), "", label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit);
+CastInst* ptr__c_i = new BitCastInst(ptr_VT, PointerTy_27, ".c.i", label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit);
+ new StoreInst(ptr__c_i, ptr_68, false, label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit);
+CastInst* ptr_tmp1 = new BitCastInst(ptr_67, 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;
 }

Modified: vmkit/trunk/mmtk/config/copyms/ObjectHeader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/config/copyms/ObjectHeader.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/config/copyms/ObjectHeader.h (original)
+++ vmkit/trunk/mmtk/config/copyms/ObjectHeader.h Sat Nov 27 04:07:18 2010
@@ -24,12 +24,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 uint64_t HashMask = 0xF00;
+  static const uint64_t GCBitMask = 0xFF;
 
   static const uint32_t NonLockBits = 12;
-  static const uint32_t HashBits = 8;
-  static const uint32_t GCBits = 4;
+  static const uint32_t HashBits = 4;
+  static const uint32_t GCBits = 8;
 
   static const bool MovesObject = true;
 }

Modified: vmkit/trunk/mmtk/config/marksweep/MMTkInline.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/config/marksweep/MMTkInline.inc?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/config/marksweep/MMTkInline.inc (original)
+++ vmkit/trunk/mmtk/config/marksweep/MMTkInline.inc Sat Nov 27 04:07:18 2010
@@ -102,66 +102,9 @@
 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::vector<const Type*>StructTy_struct_mvm__ReferenceQueue_fields;
-std::vector<const Type*>StructTy_struct_gc_fields;
-std::vector<const Type*>StructTy_struct_gcRoot_fields;
-StructTy_struct_gcRoot_fields.push_back(PointerTy_5);
-StructTy_struct_gcRoot_fields.push_back(IntegerType::get(mod->getContext(), 32));
-StructType* StructTy_struct_gcRoot = StructType::get(mod->getContext(), StructTy_struct_gcRoot_fields, /*isPacked=*/false);
-mod->addTypeName("struct.gcRoot", StructTy_struct_gcRoot);
-
-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::vector<const Type*>StructTy_struct_mvm__Cond_fields;
-std::vector<const Type*>StructTy_union_pthread_cond_t_fields;
-std::vector<const Type*>StructTy_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::vector<const Type*>StructTy_struct_mvm__CooperativeCollectionRV_fields;
+std::vector<const Type*>StructTy_struct_mvm__CollectionRV_fields;
+StructTy_struct_mvm__CollectionRV_fields.push_back(PointerTy_5);
 std::vector<const Type*>StructTy_struct_mvm__LockNormal_fields;
 std::vector<const Type*>StructTy_struct_mvm__Lock_fields;
 StructTy_struct_mvm__Lock_fields.push_back(PointerTy_5);
@@ -189,18 +132,32 @@
 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::vector<const Type*>StructTy_struct_mvm__CooperativeCollectionRV_fields;
-std::vector<const Type*>StructTy_struct_mvm__CollectionRV_fields;
-StructTy_struct_mvm__CollectionRV_fields.push_back(PointerTy_5);
 StructTy_struct_mvm__CollectionRV_fields.push_back(StructTy_struct_mvm__LockNormal);
+std::vector<const Type*>StructTy_struct_mvm__Cond_fields;
+std::vector<const Type*>StructTy_union_pthread_cond_t_fields;
+std::vector<const Type*>StructTy_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_14 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 1);
+
+StructTy_union_pthread_cond_t_fields.push_back(ArrayTy_14);
+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__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));
@@ -212,7 +169,6 @@
 mod->addTypeName("struct.mvm::CooperativeCollectionRV", StructTy_struct_mvm__CooperativeCollectionRV);
 
 StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__CooperativeCollectionRV);
-std::vector<const Type*>StructTy_struct_mvm__StartEndFunctionMap_fields;
 std::vector<const Type*>StructTy_struct_mvm__FunctionMap_fields;
 std::vector<const Type*>StructTy_struct_std__map_const_char_j3__ClassPrimitive__std__less_const_char__std__allocator_std__pair_const_char__j3__ClassPrimitive_______fields;
 std::vector<const Type*>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;
@@ -226,11 +182,11 @@
 std::vector<const Type*>StructTy_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);
+PointerType* PointerTy_15 = 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);
+StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_15);
+StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_15);
+StructTy_struct_std___Rb_tree_node_base_fields.push_back(PointerTy_15);
 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<OpaqueType>(StructTy_struct_std___Rb_tree_node_base_fwd.get())->refineAbstractTypeTo(StructTy_struct_std___Rb_tree_node_base);
@@ -255,12 +211,7 @@
 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);
+StructTy_struct_mvm__VirtualMachine_fields.push_back(StructTy_struct_mvm__FunctionMap);
 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);
 
@@ -273,41 +224,42 @@
 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::vector<const Type*>FuncTy_19_args;
-FuncTy_19_args.push_back(PointerTy_13);
-FunctionType* FuncTy_19 = FunctionType::get(
+std::vector<const Type*>FuncTy_17_args;
+FuncTy_17_args.push_back(PointerTy_13);
+FunctionType* FuncTy_17 = FunctionType::get(
  /*Result=*/Type::getVoidTy(mod->getContext()),
- /*Params=*/FuncTy_19_args,
+ /*Params=*/FuncTy_17_args,
  /*isVarArg=*/false);
 
-PointerType* PointerTy_18 = PointerType::get(FuncTy_19, 0);
+PointerType* PointerTy_16 = PointerType::get(FuncTy_17, 0);
 
-StructTy_struct_mvm__Thread_fields.push_back(PointerTy_18);
+StructTy_struct_mvm__Thread_fields.push_back(PointerTy_16);
 std::vector<const Type*>StructTy_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);
+StructTy_struct_mvm__KnownFrame_fields.push_back(PointerTy_0);
+PATypeHolder PointerTy_18_fwd = OpaqueType::get(mod->getContext());
+StructTy_struct_mvm__KnownFrame_fields.push_back(PointerTy_18_fwd);
 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<OpaqueType>(PointerTy_20_fwd.get())->refineAbstractTypeTo(PointerTy_20);
-PointerTy_20 = cast<PointerType>(PointerTy_20_fwd.get());
+PointerType* PointerTy_18 = PointerType::get(StructTy_struct_mvm__KnownFrame, 0);
+cast<OpaqueType>(PointerTy_18_fwd.get())->refineAbstractTypeTo(PointerTy_18);
+PointerTy_18 = cast<PointerType>(PointerTy_18_fwd.get());
 
 
-StructTy_struct_mvm__Thread_fields.push_back(PointerTy_20);
+StructTy_struct_mvm__Thread_fields.push_back(PointerTy_18);
 std::vector<const Type*>StructTy_struct_mvm__ExceptionBuffer_fields;
-PATypeHolder PointerTy_21_fwd = OpaqueType::get(mod->getContext());
-StructTy_struct_mvm__ExceptionBuffer_fields.push_back(PointerTy_21_fwd);
+PATypeHolder PointerTy_19_fwd = OpaqueType::get(mod->getContext());
+StructTy_struct_mvm__ExceptionBuffer_fields.push_back(PointerTy_19_fwd);
 std::vector<const Type*>StructTy_struct___jmp_buf_tag_fields;
-ArrayType* ArrayTy_23 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 6);
+ArrayType* ArrayTy_21 = 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(ArrayTy_21);
 StructTy_struct___jmp_buf_tag_fields.push_back(IntegerType::get(mod->getContext(), 32));
 std::vector<const Type*>StructTy_struct___sigset_t_fields;
-ArrayType* ArrayTy_24 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 32);
+ArrayType* ArrayTy_22 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 32);
 
-StructTy_struct___sigset_t_fields.push_back(ArrayTy_24);
+StructTy_struct___sigset_t_fields.push_back(ArrayTy_22);
 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);
 
@@ -315,18 +267,18 @@
 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);
+ArrayType* ArrayTy_20 = ArrayType::get(StructTy_struct___jmp_buf_tag, 1);
 
-StructTy_struct_mvm__ExceptionBuffer_fields.push_back(ArrayTy_22);
+StructTy_struct_mvm__ExceptionBuffer_fields.push_back(ArrayTy_20);
 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<OpaqueType>(PointerTy_21_fwd.get())->refineAbstractTypeTo(PointerTy_21);
-PointerTy_21 = cast<PointerType>(PointerTy_21_fwd.get());
+PointerType* PointerTy_19 = PointerType::get(StructTy_struct_mvm__ExceptionBuffer, 0);
+cast<OpaqueType>(PointerTy_19_fwd.get())->refineAbstractTypeTo(PointerTy_19);
+PointerTy_19 = cast<PointerType>(PointerTy_19_fwd.get());
 
 
-StructTy_struct_mvm__Thread_fields.push_back(PointerTy_21);
+StructTy_struct_mvm__Thread_fields.push_back(PointerTy_19);
 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<OpaqueType>(StructTy_struct_mvm__Thread_fwd.get())->refineAbstractTypeTo(StructTy_struct_mvm__Thread);
@@ -334,166 +286,182 @@
 
 
 StructTy_struct_mvm__MutatorThread_fields.push_back(StructTy_struct_mvm__Thread);
-StructTy_struct_mvm__MutatorThread_fields.push_back(StructTy_struct_mvm__BumpPtrAllocator);
+std::vector<const Type*>StructTy_struct_mvm__ThreadAllocator_fields;
+StructTy_struct_mvm__ThreadAllocator_fields.push_back(StructTy_struct_llvm__BumpPtrAllocator);
+StructType* StructTy_struct_mvm__ThreadAllocator = StructType::get(mod->getContext(), StructTy_struct_mvm__ThreadAllocator_fields, /*isPacked=*/false);
+mod->addTypeName("struct.mvm::ThreadAllocator", StructTy_struct_mvm__ThreadAllocator);
+
+StructTy_struct_mvm__MutatorThread_fields.push_back(StructTy_struct_mvm__ThreadAllocator);
 StructTy_struct_mvm__MutatorThread_fields.push_back(IntegerType::get(mod->getContext(), 32));
-StructTy_struct_mvm__MutatorThread_fields.push_back(PointerTy_18);
+StructTy_struct_mvm__MutatorThread_fields.push_back(PointerTy_16);
 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);
+PointerType* PointerTy_23 = PointerType::get(IntegerType::get(mod->getContext(), 32), 0);
 
 std::vector<const Type*>StructTy_struct_j3__JavaObject_fields;
+std::vector<const Type*>StructTy_struct_gc_fields;
+std::vector<const Type*>StructTy_struct_gcRoot_fields;
+StructTy_struct_gcRoot_fields.push_back(PointerTy_5);
+StructTy_struct_gcRoot_fields.push_back(IntegerType::get(mod->getContext(), 32));
+StructType* StructTy_struct_gcRoot = StructType::get(mod->getContext(), StructTy_struct_gcRoot_fields, /*isPacked=*/false);
+mod->addTypeName("struct.gcRoot", StructTy_struct_gcRoot);
+
+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);
+
 StructTy_struct_j3__JavaObject_fields.push_back(StructTy_struct_gc);
 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);
+PointerType* PointerTy_24 = PointerType::get(StructTy_struct_j3__JavaObject, 0);
 
 std::vector<const Type*>StructTy_JavaObject_fields;
 ArrayType* ArrayTy_VT = ArrayType::get(PointerTy_6, 0);
 mod->addTypeName("VT", ArrayTy_VT);
 
-PointerType* PointerTy_29 = PointerType::get(ArrayTy_VT, 0);
+PointerType* PointerTy_27 = PointerType::get(ArrayTy_VT, 0);
 
-StructTy_JavaObject_fields.push_back(PointerTy_29);
+StructTy_JavaObject_fields.push_back(PointerTy_27);
 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_26 = PointerType::get(StructTy_JavaObject, 0);
 
-PointerType* PointerTy_27 = PointerType::get(PointerTy_28, 0);
+PointerType* PointerTy_25 = PointerType::get(PointerTy_26, 0);
 
-PointerType* PointerTy_30 = PointerType::get(PointerTy_0, 0);
+PointerType* PointerTy_28 = PointerType::get(PointerTy_0, 0);
 
-std::vector<const Type*>FuncTy_32_args;
-FuncTy_32_args.push_back(PointerTy_28);
-FuncTy_32_args.push_back(IntegerType::get(mod->getContext(), 32));
-FuncTy_32_args.push_back(IntegerType::get(mod->getContext(), 32));
-FuncTy_32_args.push_back(IntegerType::get(mod->getContext(), 32));
-FunctionType* FuncTy_32 = FunctionType::get(
- /*Result=*/PointerTy_28,
- /*Params=*/FuncTy_32_args,
+std::vector<const Type*>FuncTy_30_args;
+FuncTy_30_args.push_back(PointerTy_26);
+FuncTy_30_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_30_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_30_args.push_back(IntegerType::get(mod->getContext(), 32));
+FunctionType* FuncTy_30 = FunctionType::get(
+ /*Result=*/PointerTy_26,
+ /*Params=*/FuncTy_30_args,
  /*isVarArg=*/false);
 
-PointerType* PointerTy_31 = PointerType::get(FuncTy_32, 0);
+PointerType* PointerTy_29 = PointerType::get(FuncTy_30, 0);
 
-PointerType* PointerTy_33 = PointerType::get(PointerTy_29, 0);
+PointerType* PointerTy_31 = PointerType::get(PointerTy_27, 0);
 
-std::vector<const Type*>FuncTy_35_args;
-FuncTy_35_args.push_back(PointerTy_28);
-FuncTy_35_args.push_back(PointerTy_28);
-FuncTy_35_args.push_back(PointerTy_28);
-FuncTy_35_args.push_back(IntegerType::get(mod->getContext(), 32));
-FuncTy_35_args.push_back(IntegerType::get(mod->getContext(), 32));
-FunctionType* FuncTy_35 = FunctionType::get(
- /*Result=*/PointerTy_28,
- /*Params=*/FuncTy_35_args,
+std::vector<const Type*>FuncTy_33_args;
+FuncTy_33_args.push_back(PointerTy_26);
+FuncTy_33_args.push_back(PointerTy_26);
+FuncTy_33_args.push_back(PointerTy_26);
+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_26,
+ /*Params=*/FuncTy_33_args,
  /*isVarArg=*/false);
 
-PointerType* PointerTy_34 = PointerType::get(FuncTy_35, 0);
+PointerType* PointerTy_32 = PointerType::get(FuncTy_33, 0);
 
+std::vector<const Type*>StructTy_35_fields;
+std::vector<const Type*>StructTy_36_fields;
 std::vector<const Type*>StructTy_37_fields;
-std::vector<const Type*>StructTy_38_fields;
+StructTy_37_fields.push_back(StructTy_JavaObject);
+StructTy_37_fields.push_back(PointerTy_26);
+StructTy_37_fields.push_back(IntegerType::get(mod->getContext(), 32));
+StructTy_37_fields.push_back(IntegerType::get(mod->getContext(), 32));
+StructTy_37_fields.push_back(IntegerType::get(mod->getContext(), 32));
+StructTy_37_fields.push_back(PointerTy_26);
+StructTy_37_fields.push_back(IntegerType::get(mod->getContext(), 8));
+StructTy_37_fields.push_back(IntegerType::get(mod->getContext(), 8));
+StructTy_37_fields.push_back(IntegerType::get(mod->getContext(), 8));
+StructTy_37_fields.push_back(PointerTy_26);
+StructTy_37_fields.push_back(PointerTy_26);
+StructTy_37_fields.push_back(PointerTy_26);
+StructTy_37_fields.push_back(PointerTy_26);
+StructTy_37_fields.push_back(IntegerType::get(mod->getContext(), 8));
+StructType* StructTy_37 = StructType::get(mod->getContext(), StructTy_37_fields, /*isPacked=*/false);
+
+StructTy_36_fields.push_back(StructTy_37);
+StructType* StructTy_36 = StructType::get(mod->getContext(), StructTy_36_fields, /*isPacked=*/false);
+
+StructTy_35_fields.push_back(StructTy_36);
+StructTy_35_fields.push_back(IntegerType::get(mod->getContext(), 8));
+StructTy_35_fields.push_back(IntegerType::get(mod->getContext(), 8));
+StructTy_35_fields.push_back(PointerTy_26);
+StructType* StructTy_35 = StructType::get(mod->getContext(), StructTy_35_fields, /*isPacked=*/false);
+
+PointerType* PointerTy_34 = PointerType::get(StructTy_35, 0);
+
 std::vector<const Type*>StructTy_39_fields;
-StructTy_39_fields.push_back(StructTy_JavaObject);
-StructTy_39_fields.push_back(PointerTy_28);
-StructTy_39_fields.push_back(IntegerType::get(mod->getContext(), 32));
-StructTy_39_fields.push_back(IntegerType::get(mod->getContext(), 32));
-StructTy_39_fields.push_back(IntegerType::get(mod->getContext(), 32));
-StructTy_39_fields.push_back(PointerTy_28);
+std::vector<const Type*>StructTy_40_fields;
+StructTy_40_fields.push_back(StructTy_37);
+StructTy_40_fields.push_back(PointerTy_26);
+StructTy_40_fields.push_back(PointerTy_26);
+StructTy_40_fields.push_back(PointerTy_26);
+StructTy_40_fields.push_back(PointerTy_26);
+StructTy_40_fields.push_back(PointerTy_26);
+StructTy_40_fields.push_back(PointerTy_26);
+StructTy_40_fields.push_back(PointerTy_26);
+StructType* StructTy_40 = StructType::get(mod->getContext(), StructTy_40_fields, /*isPacked=*/false);
+
+StructTy_39_fields.push_back(StructTy_40);
 StructTy_39_fields.push_back(IntegerType::get(mod->getContext(), 8));
 StructTy_39_fields.push_back(IntegerType::get(mod->getContext(), 8));
 StructTy_39_fields.push_back(IntegerType::get(mod->getContext(), 8));
-StructTy_39_fields.push_back(PointerTy_28);
-StructTy_39_fields.push_back(PointerTy_28);
-StructTy_39_fields.push_back(PointerTy_28);
-StructTy_39_fields.push_back(PointerTy_28);
 StructTy_39_fields.push_back(IntegerType::get(mod->getContext(), 8));
 StructType* StructTy_39 = StructType::get(mod->getContext(), StructTy_39_fields, /*isPacked=*/false);
 
-StructTy_38_fields.push_back(StructTy_39);
-StructType* StructTy_38 = StructType::get(mod->getContext(), StructTy_38_fields, /*isPacked=*/false);
+PointerType* PointerTy_38 = PointerType::get(StructTy_39, 0);
 
-StructTy_37_fields.push_back(StructTy_38);
-StructTy_37_fields.push_back(IntegerType::get(mod->getContext(), 8));
-StructTy_37_fields.push_back(IntegerType::get(mod->getContext(), 8));
-StructTy_37_fields.push_back(PointerTy_28);
-StructType* StructTy_37 = StructType::get(mod->getContext(), StructTy_37_fields, /*isPacked=*/false);
-
-PointerType* PointerTy_36 = PointerType::get(StructTy_37, 0);
-
-std::vector<const Type*>StructTy_41_fields;
 std::vector<const Type*>StructTy_42_fields;
-StructTy_42_fields.push_back(StructTy_39);
-StructTy_42_fields.push_back(PointerTy_28);
-StructTy_42_fields.push_back(PointerTy_28);
-StructTy_42_fields.push_back(PointerTy_28);
-StructTy_42_fields.push_back(PointerTy_28);
-StructTy_42_fields.push_back(PointerTy_28);
-StructTy_42_fields.push_back(PointerTy_28);
-StructTy_42_fields.push_back(PointerTy_28);
+StructTy_42_fields.push_back(StructTy_37);
+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(IntegerType::get(mod->getContext(), 8));
-StructTy_41_fields.push_back(IntegerType::get(mod->getContext(), 8));
-StructTy_41_fields.push_back(IntegerType::get(mod->getContext(), 8));
-StructTy_41_fields.push_back(IntegerType::get(mod->getContext(), 8));
-StructType* StructTy_41 = StructType::get(mod->getContext(), StructTy_41_fields, /*isPacked=*/false);
-
-PointerType* PointerTy_40 = PointerType::get(StructTy_41, 0);
-
-std::vector<const Type*>StructTy_44_fields;
-StructTy_44_fields.push_back(StructTy_39);
-StructTy_44_fields.push_back(IntegerType::get(mod->getContext(), 8));
-StructType* StructTy_44 = StructType::get(mod->getContext(), StructTy_44_fields, /*isPacked=*/false);
+PointerType* PointerTy_41 = PointerType::get(StructTy_42, 0);
 
-PointerType* PointerTy_43 = PointerType::get(StructTy_44, 0);
-
-std::vector<const Type*>FuncTy_46_args;
-FunctionType* FuncTy_46 = FunctionType::get(
+std::vector<const Type*>FuncTy_44_args;
+FunctionType* FuncTy_44 = FunctionType::get(
  /*Result=*/Type::getVoidTy(mod->getContext()),
- /*Params=*/FuncTy_46_args,
+ /*Params=*/FuncTy_44_args,
  /*isVarArg=*/false);
 
-PointerType* PointerTy_45 = PointerType::get(FuncTy_46, 0);
+PointerType* PointerTy_43 = PointerType::get(FuncTy_44, 0);
 
-std::vector<const Type*>StructTy_48_fields;
-StructTy_48_fields.push_back(PointerTy_28);
-StructTy_48_fields.push_back(PointerTy_28);
-StructTy_48_fields.push_back(PointerTy_28);
-StructTy_48_fields.push_back(PointerTy_28);
-StructType* StructTy_48 = StructType::get(mod->getContext(), StructTy_48_fields, /*isPacked=*/false);
+std::vector<const Type*>StructTy_46_fields;
+StructTy_46_fields.push_back(PointerTy_26);
+StructTy_46_fields.push_back(PointerTy_26);
+StructTy_46_fields.push_back(PointerTy_26);
+StructTy_46_fields.push_back(PointerTy_26);
+StructType* StructTy_46 = StructType::get(mod->getContext(), StructTy_46_fields, /*isPacked=*/false);
+
+PointerType* PointerTy_45 = PointerType::get(StructTy_46, 0);
+
+std::vector<const Type*>FuncTy_48_args;
+FuncTy_48_args.push_back(IntegerType::get(mod->getContext(), 1));
+FuncTy_48_args.push_back(IntegerType::get(mod->getContext(), 1));
+FuncTy_48_args.push_back(IntegerType::get(mod->getContext(), 1));
+FuncTy_48_args.push_back(IntegerType::get(mod->getContext(), 1));
+FuncTy_48_args.push_back(IntegerType::get(mod->getContext(), 1));
+FunctionType* FuncTy_48 = FunctionType::get(
+ /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Params=*/FuncTy_48_args,
+ /*isVarArg=*/false);
 
-PointerType* PointerTy_47 = PointerType::get(StructTy_48, 0);
+PointerType* PointerTy_47 = PointerType::get(FuncTy_48, 0);
 
 std::vector<const Type*>FuncTy_50_args;
-FuncTy_50_args.push_back(IntegerType::get(mod->getContext(), 1));
-FuncTy_50_args.push_back(IntegerType::get(mod->getContext(), 1));
-FuncTy_50_args.push_back(IntegerType::get(mod->getContext(), 1));
-FuncTy_50_args.push_back(IntegerType::get(mod->getContext(), 1));
-FuncTy_50_args.push_back(IntegerType::get(mod->getContext(), 1));
+FuncTy_50_args.push_back(PointerTy_23);
+FuncTy_50_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_50_args.push_back(IntegerType::get(mod->getContext(), 32));
 FunctionType* FuncTy_50 = FunctionType::get(
- /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
  /*Params=*/FuncTy_50_args,
  /*isVarArg=*/false);
 
 PointerType* PointerTy_49 = PointerType::get(FuncTy_50, 0);
 
-std::vector<const Type*>FuncTy_52_args;
-FuncTy_52_args.push_back(PointerTy_25);
-FuncTy_52_args.push_back(IntegerType::get(mod->getContext(), 32));
-FuncTy_52_args.push_back(IntegerType::get(mod->getContext(), 32));
-FunctionType* FuncTy_52 = FunctionType::get(
- /*Result=*/IntegerType::get(mod->getContext(), 32),
- /*Params=*/FuncTy_52_args,
- /*isVarArg=*/false);
-
-PointerType* PointerTy_51 = PointerType::get(FuncTy_52, 0);
-
 
 // Function Declarations
 
@@ -514,10 +482,11 @@
 func_llvm_frameaddress->setAttributes(func_llvm_frameaddress_PAL);
 
 Function* func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III = Function::Create(
- /*Type=*/FuncTy_32,
+ /*Type=*/FuncTy_30,
  /*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);
+func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III->setGC("vmkit");
 AttrListPtr func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
@@ -530,10 +499,11 @@
 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_35,
+ /*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);
+func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II->setGC("vmkit");
 AttrListPtr func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
@@ -546,10 +516,11 @@
 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_32,
+ /*Type=*/FuncTy_30,
  /*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);
+func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III->setGC("vmkit");
 AttrListPtr func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
@@ -561,24 +532,24 @@
 }
 func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III->setAttributes(func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III_PAL);
 
-Function* func_llvm_trap = Function::Create(
- /*Type=*/FuncTy_46,
+Function* func_abort = Function::Create(
+ /*Type=*/FuncTy_44,
  /*Linkage=*/GlobalValue::ExternalLinkage,
- /*Name=*/"llvm.trap", mod); // (external, no body)
-func_llvm_trap->setCallingConv(CallingConv::C);
-AttrListPtr func_llvm_trap_PAL;
+ /*Name=*/"abort", mod); // (external, no body)
+func_abort->setCallingConv(CallingConv::C);
+AttrListPtr func_abort_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
- PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
+ PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoReturn | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- func_llvm_trap_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ func_abort_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-func_llvm_trap->setAttributes(func_llvm_trap_PAL);
+func_abort->setAttributes(func_abort_PAL);
 
 Function* func_llvm_memory_barrier = Function::Create(
- /*Type=*/FuncTy_50,
+ /*Type=*/FuncTy_48,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"llvm.memory.barrier", mod); // (external, no body)
 func_llvm_memory_barrier->setCallingConv(CallingConv::C);
@@ -594,7 +565,7 @@
 func_llvm_memory_barrier->setAttributes(func_llvm_memory_barrier_PAL);
 
 Function* func_llvm_atomic_cmp_swap_i32_p0i32 = Function::Create(
- /*Type=*/FuncTy_52,
+ /*Type=*/FuncTy_50,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"llvm.atomic.cmp.swap.i32.p0i32", mod); // (external, no body)
 func_llvm_atomic_cmp_swap_i32_p0i32->setCallingConv(CallingConv::C);
@@ -612,7 +583,7 @@
 func_llvm_atomic_cmp_swap_i32_p0i32->setAttributes(func_llvm_atomic_cmp_swap_i32_p0i32_PAL);
 
 Function* func__ZN3mvm6Thread5yieldEv = Function::Create(
- /*Type=*/FuncTy_46,
+ /*Type=*/FuncTy_44,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"_ZN3mvm6Thread5yieldEv", mod); // (external, no body)
 func__ZN3mvm6Thread5yieldEv->setCallingConv(CallingConv::C);
@@ -622,124 +593,125 @@
 // Global Variable Declarations
 
 GlobalVariable* gvar_struct_finalObject32 = new GlobalVariable(/*Module=*/*mod, 
-/*Type=*/StructTy_37,
+/*Type=*/StructTy_35,
 /*isConstant=*/false,
 /*Linkage=*/GlobalValue::ExternalLinkage,
 /*Initializer=*/0, // has initializer, specified below
 /*Name=*/"finalObject32");
 
 GlobalVariable* gvar_struct_finalObject101 = new GlobalVariable(/*Module=*/*mod, 
-/*Type=*/StructTy_37,
+/*Type=*/StructTy_35,
 /*isConstant=*/false,
 /*Linkage=*/GlobalValue::ExternalLinkage,
 /*Initializer=*/0, // has initializer, specified below
 /*Name=*/"finalObject101");
 
 GlobalVariable* gvar_struct_finalObject122 = new GlobalVariable(/*Module=*/*mod, 
-/*Type=*/StructTy_41,
+/*Type=*/StructTy_39,
 /*isConstant=*/false,
 /*Linkage=*/GlobalValue::ExternalLinkage,
 /*Initializer=*/0, // has initializer, specified below
 /*Name=*/"finalObject122");
 
 GlobalVariable* gvar_struct_finalObject67 = new GlobalVariable(/*Module=*/*mod, 
-/*Type=*/StructTy_41,
+/*Type=*/StructTy_39,
 /*isConstant=*/false,
 /*Linkage=*/GlobalValue::ExternalLinkage,
 /*Initializer=*/0, // has initializer, specified below
 /*Name=*/"finalObject67");
 
 GlobalVariable* gvar_struct_finalObject2 = new GlobalVariable(/*Module=*/*mod, 
-/*Type=*/StructTy_44,
+/*Type=*/StructTy_42,
 /*isConstant=*/false,
 /*Linkage=*/GlobalValue::ExternalLinkage,
 /*Initializer=*/0, // has initializer, specified below
 /*Name=*/"finalObject2");
 
 GlobalVariable* gvar_struct_finalObject85 = new GlobalVariable(/*Module=*/*mod, 
-/*Type=*/StructTy_41,
+/*Type=*/StructTy_39,
 /*isConstant=*/false,
 /*Linkage=*/GlobalValue::ExternalLinkage,
 /*Initializer=*/0, // has initializer, specified below
 /*Name=*/"finalObject85");
 
 GlobalVariable* gvar_struct_org_mmtk_utility_DoublyLinkedList_static = new GlobalVariable(/*Module=*/*mod, 
-/*Type=*/StructTy_48,
+/*Type=*/StructTy_46,
 /*isConstant=*/false,
 /*Linkage=*/GlobalValue::ExternalLinkage,
 /*Initializer=*/0, // has initializer, specified below
 /*Name=*/"org_mmtk_utility_DoublyLinkedList_static");
 
 // Constant Definitions
-ConstantInt* const_int32_53 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("3"), 10));
-ConstantInt* const_int32_54 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-4"), 10));
-ConstantInt* const_int32_55 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("0"), 10));
-ConstantInt* const_int32_56 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2146435072"), 10));
-ConstantInt* const_int32_57 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2"), 10));
-ConstantInt* const_int32_58 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("8193"), 10));
-ConstantInt* const_int32_59 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("4"), 10));
-ConstantInt* const_int32_60 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("7"), 10));
-ConstantInt* const_int32_61 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("8"), 10));
-ConstantInt* const_int32_62 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-1"), 10));
-ConstantInt* const_int32_63 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("63"), 10));
-ConstantInt* const_int32_64 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("127"), 10));
-ConstantInt* const_int32_65 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("255"), 10));
-ConstantInt* const_int32_66 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("511"), 10));
-ConstantInt* const_int32_67 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2047"), 10));
-ConstantInt* const_int32_68 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("10"), 10));
-ConstantInt* const_int32_69 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("32"), 10));
-ConstantInt* const_int32_70 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("12"), 10));
-ConstantInt* const_int32_71 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("5"), 10));
-ConstantInt* const_int32_72 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("16"), 10));
-ConstantInt* const_int32_73 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("6"), 10));
-ConstantInt* const_int32_74 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("20"), 10));
-ConstantInt* const_int32_75 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("26"), 10));
-ConstantInt* const_int32_76 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1"), 10));
-ConstantPointerNull* const_ptr_77 = ConstantPointerNull::get(PointerTy_29);
-ConstantInt* const_int8_78 = ConstantInt::get(mod->getContext(), APInt(8, StringRef("-4"), 10));
+ConstantInt* const_int32_51 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("3"), 10));
+ConstantInt* const_int32_52 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-4"), 10));
+ConstantInt* const_int32_53 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("0"), 10));
+ConstantInt* const_int32_54 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2146435072"), 10));
+ConstantInt* const_int32_55 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2"), 10));
+ConstantInt* const_int32_56 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("8193"), 10));
+ConstantInt* const_int32_57 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("4"), 10));
+ConstantInt* const_int32_58 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("7"), 10));
+ConstantInt* const_int32_59 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("8"), 10));
+ConstantInt* const_int32_60 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-1"), 10));
+ConstantInt* const_int32_61 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("63"), 10));
+ConstantInt* const_int32_62 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("127"), 10));
+ConstantInt* const_int32_63 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("255"), 10));
+ConstantInt* const_int32_64 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("511"), 10));
+ConstantInt* const_int32_65 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("2047"), 10));
+ConstantInt* const_int32_66 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("10"), 10));
+ConstantInt* const_int32_67 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("32"), 10));
+ConstantInt* const_int32_68 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("12"), 10));
+ConstantInt* const_int32_69 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("5"), 10));
+ConstantInt* const_int32_70 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("16"), 10));
+ConstantInt* const_int32_71 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("6"), 10));
+ConstantInt* const_int32_72 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("20"), 10));
+ConstantInt* const_int32_73 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("26"), 10));
+ConstantInt* const_int32_74 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1"), 10));
+ConstantPointerNull* const_ptr_75 = ConstantPointerNull::get(PointerTy_27);
+ConstantInt* const_int8_76 = ConstantInt::get(mod->getContext(), APInt(8, StringRef("-4"), 10));
+std::vector<Constant*> const_ptr_77_indices;
+const_ptr_77_indices.push_back(const_int32_53);
+const_ptr_77_indices.push_back(const_int32_74);
+Constant* const_ptr_77 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject32, &const_ptr_77_indices[0], const_ptr_77_indices.size());
+ConstantInt* const_int8_78 = ConstantInt::get(mod->getContext(), APInt(8, StringRef("2"), 10));
 std::vector<Constant*> const_ptr_79_indices;
-const_ptr_79_indices.push_back(const_int32_55);
-const_ptr_79_indices.push_back(const_int32_76);
+const_ptr_79_indices.push_back(const_int32_53);
+const_ptr_79_indices.push_back(const_int32_51);
 Constant* const_ptr_79 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject32, &const_ptr_79_indices[0], const_ptr_79_indices.size());
-ConstantInt* const_int8_80 = ConstantInt::get(mod->getContext(), APInt(8, StringRef("2"), 10));
-std::vector<Constant*> const_ptr_81_indices;
-const_ptr_81_indices.push_back(const_int32_55);
-const_ptr_81_indices.push_back(const_int32_53);
-Constant* const_ptr_81 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject32, &const_ptr_81_indices[0], const_ptr_81_indices.size());
-ConstantInt* const_int32_82 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-32"), 10));
-ConstantPointerNull* const_ptr_83 = ConstantPointerNull::get(PointerTy_0);
+ConstantInt* const_int32_80 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("-32"), 10));
+ConstantPointerNull* const_ptr_81 = ConstantPointerNull::get(PointerTy_0);
+std::vector<Constant*> const_ptr_82_indices;
+const_ptr_82_indices.push_back(const_int32_53);
+const_ptr_82_indices.push_back(const_int32_74);
+Constant* const_ptr_82 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject101, &const_ptr_82_indices[0], const_ptr_82_indices.size());
+std::vector<Constant*> const_ptr_83_indices;
+const_ptr_83_indices.push_back(const_int32_53);
+const_ptr_83_indices.push_back(const_int32_51);
+Constant* const_ptr_83 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject101, &const_ptr_83_indices[0], const_ptr_83_indices.size());
 std::vector<Constant*> const_ptr_84_indices;
+const_ptr_84_indices.push_back(const_int32_53);
 const_ptr_84_indices.push_back(const_int32_55);
-const_ptr_84_indices.push_back(const_int32_76);
-Constant* const_ptr_84 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject101, &const_ptr_84_indices[0], const_ptr_84_indices.size());
+Constant* const_ptr_84 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject122, &const_ptr_84_indices[0], const_ptr_84_indices.size());
 std::vector<Constant*> const_ptr_85_indices;
-const_ptr_85_indices.push_back(const_int32_55);
 const_ptr_85_indices.push_back(const_int32_53);
-Constant* const_ptr_85 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject101, &const_ptr_85_indices[0], const_ptr_85_indices.size());
-std::vector<Constant*> const_ptr_86_indices;
-const_ptr_86_indices.push_back(const_int32_55);
-const_ptr_86_indices.push_back(const_int32_57);
-Constant* const_ptr_86 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject122, &const_ptr_86_indices[0], const_ptr_86_indices.size());
+const_ptr_85_indices.push_back(const_int32_55);
+Constant* const_ptr_85 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject67, &const_ptr_85_indices[0], const_ptr_85_indices.size());
+ConstantInt* const_int8_86 = ConstantInt::get(mod->getContext(), APInt(8, StringRef("1"), 10));
 std::vector<Constant*> const_ptr_87_indices;
-const_ptr_87_indices.push_back(const_int32_55);
-const_ptr_87_indices.push_back(const_int32_57);
-Constant* const_ptr_87 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject67, &const_ptr_87_indices[0], const_ptr_87_indices.size());
-ConstantInt* const_int8_88 = ConstantInt::get(mod->getContext(), APInt(8, StringRef("1"), 10));
+const_ptr_87_indices.push_back(const_int32_53);
+const_ptr_87_indices.push_back(const_int32_74);
+Constant* const_ptr_87 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject2, &const_ptr_87_indices[0], const_ptr_87_indices.size());
+std::vector<Constant*> const_ptr_88_indices;
+const_ptr_88_indices.push_back(const_int32_53);
+const_ptr_88_indices.push_back(const_int32_55);
+Constant* const_ptr_88 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject85, &const_ptr_88_indices[0], const_ptr_88_indices.size());
 std::vector<Constant*> const_ptr_89_indices;
+const_ptr_89_indices.push_back(const_int32_53);
 const_ptr_89_indices.push_back(const_int32_55);
-const_ptr_89_indices.push_back(const_int32_76);
-Constant* const_ptr_89 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject2, &const_ptr_89_indices[0], const_ptr_89_indices.size());
-std::vector<Constant*> const_ptr_90_indices;
-const_ptr_90_indices.push_back(const_int32_55);
-const_ptr_90_indices.push_back(const_int32_57);
-Constant* const_ptr_90 = ConstantExpr::getGetElementPtr(gvar_struct_finalObject85, &const_ptr_90_indices[0], const_ptr_90_indices.size());
-std::vector<Constant*> const_ptr_91_indices;
-const_ptr_91_indices.push_back(const_int32_55);
-const_ptr_91_indices.push_back(const_int32_57);
-Constant* const_ptr_91 = ConstantExpr::getGetElementPtr(gvar_struct_org_mmtk_utility_DoublyLinkedList_static, &const_ptr_91_indices[0], const_ptr_91_indices.size());
-ConstantPointerNull* const_ptr_92 = ConstantPointerNull::get(PointerTy_28);
-ConstantInt* const_int32_93 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1000"), 10));
-ConstantInt* const_int1_94 = ConstantInt::get(mod->getContext(), APInt(1, StringRef("-1"), 10));
+Constant* const_ptr_89 = ConstantExpr::getGetElementPtr(gvar_struct_org_mmtk_utility_DoublyLinkedList_static, &const_ptr_89_indices[0], const_ptr_89_indices.size());
+ConstantPointerNull* const_ptr_90 = ConstantPointerNull::get(PointerTy_26);
+ConstantInt* const_int8_91 = ConstantInt::get(mod->getContext(), APInt(8, StringRef("0"), 10));
+ConstantInt* const_int32_92 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1000"), 10));
+ConstantInt* const_int1_93 = ConstantInt::get(mod->getContext(), APInt(1, StringRef("-1"), 10));
 
 // Global Variable Definitions
 
@@ -748,6 +720,7 @@
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"gcmalloc", mod); 
 func_gcmalloc->setCallingConv(CallingConv::C);
+func_gcmalloc->setGC("vmkit");
 AttrListPtr func_gcmalloc_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
@@ -818,1098 +791,1168 @@
 BasicBlock* label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i = BasicBlock::Create(mod->getContext(), "JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII.exit.thread17.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_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_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "true IF*NULL.GOTO or IF*1_crit_edge.i3.i.i.i.i.i",func_gcmalloc,0);
+BasicBlock* label_GOTO_or_IF_1_i5_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*1.i5.i.i.i.i.i",func_gcmalloc,0);
+BasicBlock* label_true_IFNULL_i7_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "true IFNULL.i7.i.i.i.i.i",func_gcmalloc,0);
 BasicBlock* label_bb_i_i20_i = BasicBlock::Create(mod->getContext(), "bb.i.i20.i",func_gcmalloc,0);
 BasicBlock* label_bb1_i_i21_i = BasicBlock::Create(mod->getContext(), "bb1.i.i21.i",func_gcmalloc,0);
 BasicBlock* label_bb2_i_i22_i = BasicBlock::Create(mod->getContext(), "bb2.i.i22.i",func_gcmalloc,0);
 BasicBlock* label_bb4_preheader_i_i23_i = BasicBlock::Create(mod->getContext(), "bb4.preheader.i.i23.i",func_gcmalloc,0);
 BasicBlock* label_bb3_i_i24_i = BasicBlock::Create(mod->getContext(), "bb3.i.i24.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_Java_org_j3_mmtk_Lock_acquire___exit25_i = BasicBlock::Create(mod->getContext(), "Java_org_j3_mmtk_Lock_acquire__.exit25.i",func_gcmalloc,0);
+BasicBlock* label_false_IFNE_i9_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "false IFNE.i9.i.i.i.i.i",func_gcmalloc,0);
+BasicBlock* label_true_IFNULL3_i10_i_i_i_i_i = BasicBlock::Create(mod->getContext(), "true IFNULL3.i10.i.i.i.i.i",func_gcmalloc,0);
 BasicBlock* label_true_IF_NULL_i1_i_i6_i_i_i = BasicBlock::Create(mod->getContext(), "true IF*NULL.i1.i.i6.i.i.i",func_gcmalloc,0);
-BasicBlock* label_GOTO_or_IF_1_i3_i_i8_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*1.i3.i.i8.i.i.i",func_gcmalloc,0);
-BasicBlock* label_true_IFNULL_i5_i_i9_i_i_i = BasicBlock::Create(mod->getContext(), "true IFNULL.i5.i.i9.i.i.i",func_gcmalloc,0);
+BasicBlock* label_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i8_i_i_i = BasicBlock::Create(mod->getContext(), "true IF*NULL.GOTO or IF*1_crit_edge.i3.i.i8.i.i.i",func_gcmalloc,0);
+BasicBlock* label_GOTO_or_IF_1_i5_i_i10_i_i_i = BasicBlock::Create(mod->getContext(), "GOTO or IF*1.i5.i.i10.i.i.i",func_gcmalloc,0);
+BasicBlock* label_true_IFNULL_i7_i_i11_i_i_i = BasicBlock::Create(mod->getContext(), "true IFNULL.i7.i.i11.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_i11_i_i_i = BasicBlock::Create(mod->getContext(), "false IFNE.i7.i.i11.i.i.i",func_gcmalloc,0);
-BasicBlock* label_true_IFNULL3_i8_i_i12_i_i_i = BasicBlock::Create(mod->getContext(), "true IFNULL3.i8.i.i12.i.i.i",func_gcmalloc,0);
+BasicBlock* label_Java_org_j3_mmtk_Lock_acquire___exit_i = BasicBlock::Create(mod->getContext(), "Java_org_j3_mmtk_Lock_acquire__.exit.i",func_gcmalloc,0);
+BasicBlock* label_false_IFNE_i9_i_i13_i_i_i = BasicBlock::Create(mod->getContext(), "false IFNE.i9.i.i13.i.i.i",func_gcmalloc,0);
+BasicBlock* label_true_IFNULL3_i10_i_i14_i_i_i = BasicBlock::Create(mod->getContext(), "true IFNULL3.i10.i.i14.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_95 = BinaryOperator::Create(Instruction::Add, int32_sz, const_int32_53, "", label_entry);
-BinaryOperator* int32_96 = BinaryOperator::Create(Instruction::And, int32_95, const_int32_54, "", label_entry);
-CallInst* ptr_97 = CallInst::Create(func_llvm_frameaddress, const_int32_55, "", label_entry);
-ptr_97->setCallingConv(CallingConv::C);
-ptr_97->setTailCall(true);
-AttrListPtr ptr_97_PAL;
+BinaryOperator* int32_94 = BinaryOperator::Create(Instruction::Add, int32_sz, const_int32_51, "", label_entry);
+BinaryOperator* int32_95 = BinaryOperator::Create(Instruction::And, int32_94, const_int32_52, "", label_entry);
+CallInst* ptr_96 = CallInst::Create(func_llvm_frameaddress, const_int32_53, "", label_entry);
+ptr_96->setCallingConv(CallingConv::C);
+ptr_96->setTailCall(true);
+AttrListPtr ptr_96_PAL;
 {
  SmallVector<AttributeWithIndex, 4> 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_56, "", label_entry);
-CastInst* ptr_100 = new IntToPtrInst(int32_99, PointerTy_4, "", label_entry);
-std::vector<Value*> ptr_101_indices;
-ptr_101_indices.push_back(const_int32_55);
-ptr_101_indices.push_back(const_int32_57);
-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_58, "");
-SelectInst* int32_storemerge_i_i = SelectInst::Create(int1_104, const_int32_55, const_int32_59, "storemerge.i.i", label_entry);
-SwitchInst* void_105 = SwitchInst::Create(int32_storemerge_i_i, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, 7, label_entry);
-void_105->addCase(const_int32_55, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
-void_105->addCase(const_int32_57, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i);
-void_105->addCase(const_int32_53, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-void_105->addCase(const_int32_59, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-void_105->addCase(const_int32_60, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i);
-void_105->addCase(const_int32_61, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+ ptr_96_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ 
+}
+ptr_96->setAttributes(ptr_96_PAL);
+
+CastInst* int32_97 = new PtrToIntInst(ptr_96, IntegerType::get(mod->getContext(), 32), "", label_entry);
+BinaryOperator* int32_98 = BinaryOperator::Create(Instruction::And, int32_97, const_int32_54, "", label_entry);
+CastInst* ptr_99 = new IntToPtrInst(int32_98, PointerTy_4, "", label_entry);
+std::vector<Value*> ptr_100_indices;
+ptr_100_indices.push_back(const_int32_53);
+ptr_100_indices.push_back(const_int32_55);
+Instruction* ptr_100 = GetElementPtrInst::Create(ptr_99, ptr_100_indices.begin(), ptr_100_indices.end(), "", label_entry);
+LoadInst* int32_101 = new LoadInst(ptr_100, "", false, label_entry);
+CastInst* ptr_102 = new IntToPtrInst(int32_101, PointerTy_24, "", label_entry);
+ICmpInst* int1_103 = new ICmpInst(*label_entry, ICmpInst::ICMP_SLT, int32_95, const_int32_56, "");
+SelectInst* int32_storemerge_i_i = SelectInst::Create(int1_103, const_int32_53, const_int32_57, "storemerge.i.i", label_entry);
+SwitchInst* void_104 = SwitchInst::Create(int32_storemerge_i_i, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i, 7, label_entry);
+void_104->addCase(const_int32_53, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
+void_104->addCase(const_int32_55, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i);
+void_104->addCase(const_int32_51, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
+void_104->addCase(const_int32_57, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+void_104->addCase(const_int32_58, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i);
+void_104->addCase(const_int32_59, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_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_106 = GetElementPtrInst::Create(ptr_103, const_int32_59, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i);
-CastInst* ptr_107 = new BitCastInst(ptr_106, PointerTy_27, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i);
-LoadInst* ptr_108 = new LoadInst(ptr_107, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i);
-BinaryOperator* int32_109 = BinaryOperator::Create(Instruction::Add, int32_96, const_int32_62, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i);
-ICmpInst* int1_110 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i, ICmpInst::ICMP_SGT, int32_109, const_int32_63, "");
-BranchInst::Create(label_GOTO_or_IF_4_i_i_i_i_i_i, label_false_IF_ICMPGT16_i_i_i_i_i_i, int1_110, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i);
+GetElementPtrInst* ptr_105 = GetElementPtrInst::Create(ptr_102, const_int32_57, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i);
+CastInst* ptr_106 = new BitCastInst(ptr_105, PointerTy_25, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i);
+LoadInst* ptr_107 = new LoadInst(ptr_106, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i);
+BinaryOperator* int32_108 = BinaryOperator::Create(Instruction::Add, int32_95, const_int32_60, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i);
+ICmpInst* int1_109 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i_i, ICmpInst::ICMP_SGT, int32_108, const_int32_61, "");
+BranchInst::Create(label_GOTO_or_IF_4_i_i_i_i_i_i, label_false_IF_ICMPGT16_i_i_i_i_i_i, int1_109, 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_112 = new ICmpInst(*label_GOTO_or_IF_4_i_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_109, const_int32_64, "");
-BranchInst::Create(label_GOTO_or_IF_6_i_i_i_i_i_i, label_false_IF_ICMPGT17_i_i_i_i_i_i, int1_112, label_GOTO_or_IF_4_i_i_i_i_i_i);
+ICmpInst* int1_111 = new ICmpInst(*label_GOTO_or_IF_4_i_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_108, const_int32_62, "");
+BranchInst::Create(label_GOTO_or_IF_6_i_i_i_i_i_i, label_false_IF_ICMPGT17_i_i_i_i_i_i, int1_111, 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_114 = new ICmpInst(*label_GOTO_or_IF_6_i_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_109, const_int32_65, "");
-BranchInst::Create(label_GOTO_or_IF_7_i_i1_i_i_i_i, label_false_IF_ICMPGT18_i_i_i_i_i_i, int1_114, label_GOTO_or_IF_6_i_i_i_i_i_i);
+ICmpInst* int1_113 = new ICmpInst(*label_GOTO_or_IF_6_i_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_108, const_int32_63, "");
+BranchInst::Create(label_GOTO_or_IF_7_i_i1_i_i_i_i, label_false_IF_ICMPGT18_i_i_i_i_i_i, int1_113, 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_116 = new ICmpInst(*label_GOTO_or_IF_7_i_i1_i_i_i_i, ICmpInst::ICMP_SGT, int32_109, const_int32_66, "");
-BranchInst::Create(label_GOTO_or_IF_8_i_i_i_i_i_i, label_false_IF_ICMPGT19_i_i_i_i_i_i, int1_116, label_GOTO_or_IF_7_i_i1_i_i_i_i);
+ICmpInst* int1_115 = new ICmpInst(*label_GOTO_or_IF_7_i_i1_i_i_i_i, ICmpInst::ICMP_SGT, int32_108, const_int32_64, "");
+BranchInst::Create(label_GOTO_or_IF_8_i_i_i_i_i_i, label_false_IF_ICMPGT19_i_i_i_i_i_i, int1_115, 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_118 = new ICmpInst(*label_GOTO_or_IF_8_i_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_109, const_int32_67, "");
-BranchInst::Create(label_GOTO_or_IF_9_i_i_i_i_i_i, label_false_IF_ICMPGT20_i_i_i_i_i_i, int1_118, label_GOTO_or_IF_8_i_i_i_i_i_i);
+ICmpInst* int1_117 = new ICmpInst(*label_GOTO_or_IF_8_i_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_108, const_int32_65, "");
+BranchInst::Create(label_GOTO_or_IF_9_i_i_i_i_i_i, label_false_IF_ICMPGT20_i_i_i_i_i_i, int1_117, 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_120 = BinaryOperator::Create(Instruction::AShr, int32_109, const_int32_68, "", label_GOTO_or_IF_9_i_i_i_i_i_i);
-BinaryOperator* int32_121 = BinaryOperator::Create(Instruction::Add, int32_120, const_int32_69, "", label_GOTO_or_IF_9_i_i_i_i_i_i);
+BinaryOperator* int32_119 = BinaryOperator::Create(Instruction::AShr, int32_108, const_int32_66, "", label_GOTO_or_IF_9_i_i_i_i_i_i);
+BinaryOperator* int32_120 = BinaryOperator::Create(Instruction::Add, int32_119, const_int32_67, "", 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_123 = BinaryOperator::Create(Instruction::AShr, int32_109, const_int32_57, "", label_false_IF_ICMPGT16_i_i_i_i_i_i);
+BinaryOperator* int32_122 = BinaryOperator::Create(Instruction::AShr, int32_108, const_int32_55, "", 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_125 = BinaryOperator::Create(Instruction::AShr, int32_109, const_int32_59, "", label_false_IF_ICMPGT17_i_i_i_i_i_i);
-BinaryOperator* int32_126 = BinaryOperator::Create(Instruction::Add, int32_125, const_int32_70, "", label_false_IF_ICMPGT17_i_i_i_i_i_i);
+BinaryOperator* int32_124 = BinaryOperator::Create(Instruction::AShr, int32_108, const_int32_57, "", label_false_IF_ICMPGT17_i_i_i_i_i_i);
+BinaryOperator* int32_125 = BinaryOperator::Create(Instruction::Add, int32_124, const_int32_68, "", 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_128 = BinaryOperator::Create(Instruction::AShr, int32_109, const_int32_71, "", label_false_IF_ICMPGT18_i_i_i_i_i_i);
-BinaryOperator* int32_129 = BinaryOperator::Create(Instruction::Add, int32_128, const_int32_72, "", label_false_IF_ICMPGT18_i_i_i_i_i_i);
+BinaryOperator* int32_127 = BinaryOperator::Create(Instruction::AShr, int32_108, const_int32_69, "", label_false_IF_ICMPGT18_i_i_i_i_i_i);
+BinaryOperator* int32_128 = BinaryOperator::Create(Instruction::Add, int32_127, const_int32_70, "", 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_131 = BinaryOperator::Create(Instruction::AShr, int32_109, const_int32_73, "", label_false_IF_ICMPGT19_i_i_i_i_i_i);
-BinaryOperator* int32_132 = BinaryOperator::Create(Instruction::Add, int32_131, const_int32_74, "", label_false_IF_ICMPGT19_i_i_i_i_i_i);
+BinaryOperator* int32_130 = BinaryOperator::Create(Instruction::AShr, int32_108, const_int32_71, "", label_false_IF_ICMPGT19_i_i_i_i_i_i);
+BinaryOperator* int32_131 = BinaryOperator::Create(Instruction::Add, int32_130, const_int32_72, "", 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_134 = BinaryOperator::Create(Instruction::AShr, int32_109, const_int32_61, "", label_false_IF_ICMPGT20_i_i_i_i_i_i);
-BinaryOperator* int32_135 = BinaryOperator::Create(Instruction::Add, int32_134, const_int32_75, "", label_false_IF_ICMPGT20_i_i_i_i_i_i);
+BinaryOperator* int32_133 = BinaryOperator::Create(Instruction::AShr, int32_108, const_int32_59, "", label_false_IF_ICMPGT20_i_i_i_i_i_i);
+BinaryOperator* int32_134 = BinaryOperator::Create(Instruction::Add, int32_133, const_int32_73, "", 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_137 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
-int32_137->reserveOperandSpace(6);
-int32_137->addIncoming(int32_123, label_false_IF_ICMPGT16_i_i_i_i_i_i);
-int32_137->addIncoming(int32_126, label_false_IF_ICMPGT17_i_i_i_i_i_i);
-int32_137->addIncoming(int32_129, label_false_IF_ICMPGT18_i_i_i_i_i_i);
-int32_137->addIncoming(int32_132, label_false_IF_ICMPGT19_i_i_i_i_i_i);
-int32_137->addIncoming(int32_135, label_false_IF_ICMPGT20_i_i_i_i_i_i);
-int32_137->addIncoming(int32_121, label_GOTO_or_IF_9_i_i_i_i_i_i);
-
-std::vector<Value*> ptr_138_indices;
-ptr_138_indices.push_back(const_int32_76);
-ptr_138_indices.push_back(const_int32_76);
-Instruction* ptr_138 = GetElementPtrInst::Create(ptr_108, ptr_138_indices.begin(), ptr_138_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
-LoadInst* ptr_139 = new LoadInst(ptr_138, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
-BinaryOperator* int32_140 = BinaryOperator::Create(Instruction::Add, int32_137, const_int32_76, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
-CastInst* ptr_141 = new BitCastInst(ptr_139, PointerTy_25, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
-GetElementPtrInst* ptr_142 = GetElementPtrInst::Create(ptr_141, int32_140, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
-LoadInst* int32_143 = new LoadInst(ptr_142, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
-CastInst* ptr_144 = new IntToPtrInst(int32_143, PointerTy_28, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
-ICmpInst* int1_145 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i, ICmpInst::ICMP_EQ, int32_143, const_int32_55, "");
-BranchInst::Create(label_GOTO_or_IF__i_i_i_i, label_false_IFNE_i_i_i_i, int1_145, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
+PHINode* int32_136 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
+int32_136->reserveOperandSpace(6);
+int32_136->addIncoming(int32_122, label_false_IF_ICMPGT16_i_i_i_i_i_i);
+int32_136->addIncoming(int32_125, label_false_IF_ICMPGT17_i_i_i_i_i_i);
+int32_136->addIncoming(int32_128, label_false_IF_ICMPGT18_i_i_i_i_i_i);
+int32_136->addIncoming(int32_131, label_false_IF_ICMPGT19_i_i_i_i_i_i);
+int32_136->addIncoming(int32_134, label_false_IF_ICMPGT20_i_i_i_i_i_i);
+int32_136->addIncoming(int32_120, label_GOTO_or_IF_9_i_i_i_i_i_i);
+
+std::vector<Value*> ptr_137_indices;
+ptr_137_indices.push_back(const_int32_74);
+ptr_137_indices.push_back(const_int32_74);
+Instruction* ptr_137 = GetElementPtrInst::Create(ptr_107, ptr_137_indices.begin(), ptr_137_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
+LoadInst* ptr_138 = new LoadInst(ptr_137, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
+BinaryOperator* int32_139 = BinaryOperator::Create(Instruction::Add, int32_136, const_int32_74, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
+CastInst* ptr_140 = new BitCastInst(ptr_138, PointerTy_23, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
+GetElementPtrInst* ptr_141 = GetElementPtrInst::Create(ptr_140, int32_139, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
+LoadInst* int32_142 = new LoadInst(ptr_141, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
+CastInst* ptr_143 = new IntToPtrInst(int32_142, PointerTy_26, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i);
+ICmpInst* int1_144 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i_i, ICmpInst::ICMP_EQ, int32_142, const_int32_53, "");
+BranchInst::Create(label_GOTO_or_IF__i_i_i_i, label_false_IFNE_i_i_i_i, int1_144, 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<Value*> ptr_147_params;
-ptr_147_params.push_back(ptr_108);
-ptr_147_params.push_back(int32_96);
-ptr_147_params.push_back(const_int32_55);
-ptr_147_params.push_back(const_int32_55);
-CallInst* ptr_147 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III, ptr_147_params.begin(), ptr_147_params.end(), "", label_GOTO_or_IF__i_i_i_i);
-ptr_147->setCallingConv(CallingConv::C);
-ptr_147->setTailCall(true);
-AttrListPtr ptr_147_PAL;
+std::vector<Value*> ptr_146_params;
+ptr_146_params.push_back(ptr_107);
+ptr_146_params.push_back(int32_95);
+ptr_146_params.push_back(const_int32_53);
+ptr_146_params.push_back(const_int32_53);
+CallInst* ptr_146 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III, ptr_146_params.begin(), ptr_146_params.end(), "", label_GOTO_or_IF__i_i_i_i);
+ptr_146->setCallingConv(CallingConv::C);
+ptr_146->setTailCall(true);
+AttrListPtr ptr_146_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- ptr_147_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ ptr_146_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-ptr_147->setAttributes(ptr_147_PAL);
+ptr_146->setAttributes(ptr_146_PAL);
 
 BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_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_149 = new IntToPtrInst(int32_143, PointerTy_27, "", label_false_IFNE_i_i_i_i);
-LoadInst* ptr_150 = new LoadInst(ptr_149, "", false, label_false_IFNE_i_i_i_i);
-CastInst* int32_151 = new PtrToIntInst(ptr_150, IntegerType::get(mod->getContext(), 32), "", label_false_IFNE_i_i_i_i);
- new StoreInst(int32_151, ptr_142, false, label_false_IFNE_i_i_i_i);
-std::vector<Value*> ptr_153_indices;
-ptr_153_indices.push_back(const_int32_55);
-ptr_153_indices.push_back(const_int32_55);
-Instruction* ptr_153 = GetElementPtrInst::Create(ptr_144, ptr_153_indices.begin(), ptr_153_indices.end(), "", label_false_IFNE_i_i_i_i);
- new StoreInst(const_ptr_77, ptr_153, false, label_false_IFNE_i_i_i_i);
+CastInst* ptr_148 = new IntToPtrInst(int32_142, PointerTy_25, "", label_false_IFNE_i_i_i_i);
+LoadInst* ptr_149 = new LoadInst(ptr_148, "", false, label_false_IFNE_i_i_i_i);
+CastInst* int32_150 = new PtrToIntInst(ptr_149, IntegerType::get(mod->getContext(), 32), "", label_false_IFNE_i_i_i_i);
+ new StoreInst(int32_150, ptr_141, false, label_false_IFNE_i_i_i_i);
+std::vector<Value*> ptr_152_indices;
+ptr_152_indices.push_back(const_int32_53);
+ptr_152_indices.push_back(const_int32_53);
+Instruction* ptr_152 = GetElementPtrInst::Create(ptr_143, ptr_152_indices.begin(), ptr_152_indices.end(), "", label_false_IFNE_i_i_i_i);
+ new StoreInst(const_ptr_75, ptr_152, false, label_false_IFNE_i_i_i_i);
 BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_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_156 = GetElementPtrInst::Create(ptr_103, const_int32_57, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-CastInst* ptr_157 = new BitCastInst(ptr_156, PointerTy_27, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-LoadInst* ptr_158 = new LoadInst(ptr_157, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-GetElementPtrInst* ptr_159 = GetElementPtrInst::Create(ptr_158, const_int32_76, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-CastInst* ptr_160 = new BitCastInst(ptr_159, PointerTy_27, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-LoadInst* ptr_161 = new LoadInst(ptr_160, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-CastInst* int32_162 = new PtrToIntInst(ptr_161, 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_163 = BinaryOperator::Create(Instruction::Add, int32_162, int32_96, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-CastInst* ptr_164 = new IntToPtrInst(int32_163, PointerTy_28, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-std::vector<Value*> ptr_165_indices;
-ptr_165_indices.push_back(const_int32_76);
-ptr_165_indices.push_back(const_int32_76);
-Instruction* ptr_165 = GetElementPtrInst::Create(ptr_158, ptr_165_indices.begin(), ptr_165_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-LoadInst* ptr_166 = new LoadInst(ptr_165, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-CastInst* ptr_167 = new BitCastInst(ptr_166, PointerTy_28, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
-ICmpInst* int1_168 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i, ICmpInst::ICMP_UGT, ptr_164, ptr_167, "");
-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_168, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
+GetElementPtrInst* ptr_155 = GetElementPtrInst::Create(ptr_102, const_int32_55, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
+CastInst* ptr_156 = new BitCastInst(ptr_155, PointerTy_25, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
+LoadInst* ptr_157 = new LoadInst(ptr_156, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
+GetElementPtrInst* ptr_158 = GetElementPtrInst::Create(ptr_157, const_int32_74, "", 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_25, "", 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);
+CastInst* int32_161 = new PtrToIntInst(ptr_160, 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_162 = BinaryOperator::Create(Instruction::Add, int32_161, int32_95, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
+CastInst* ptr_163 = new IntToPtrInst(int32_162, PointerTy_26, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
+std::vector<Value*> ptr_164_indices;
+ptr_164_indices.push_back(const_int32_74);
+ptr_164_indices.push_back(const_int32_74);
+Instruction* ptr_164 = GetElementPtrInst::Create(ptr_157, ptr_164_indices.begin(), ptr_164_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
+LoadInst* ptr_165 = new LoadInst(ptr_164, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
+CastInst* ptr_166 = new BitCastInst(ptr_165, PointerTy_26, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i);
+ICmpInst* int1_167 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_alignAllocationNoFill__Lorg_vmmagic_unboxed_Address_2II_exit_i_i_i_i, ICmpInst::ICMP_UGT, ptr_163, ptr_166, "");
+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_167, 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<Value*> ptr_170_indices;
-ptr_170_indices.push_back(const_int32_76);
-ptr_170_indices.push_back(const_int32_55);
-Instruction* ptr_170 = GetElementPtrInst::Create(ptr_158, ptr_170_indices.begin(), ptr_170_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_163, PointerTy_29, ".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_170, false, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i_i);
+std::vector<Value*> ptr_169_indices;
+ptr_169_indices.push_back(const_int32_74);
+ptr_169_indices.push_back(const_int32_53);
+Instruction* ptr_169 = GetElementPtrInst::Create(ptr_157, ptr_169_indices.begin(), ptr_169_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_162, PointerTy_27, ".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_169, 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_thread13_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<Value*> ptr_173_params;
-ptr_173_params.push_back(ptr_158);
-ptr_173_params.push_back(ptr_161);
-ptr_173_params.push_back(ptr_164);
-ptr_173_params.push_back(const_int32_55);
-ptr_173_params.push_back(const_int32_55);
-CallInst* ptr_173 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II, ptr_173_params.begin(), ptr_173_params.end(), "", label_false_IFEQ_i_i_i_i);
-ptr_173->setCallingConv(CallingConv::C);
-ptr_173->setTailCall(true);
-AttrListPtr ptr_173_PAL;
+std::vector<Value*> ptr_172_params;
+ptr_172_params.push_back(ptr_157);
+ptr_172_params.push_back(ptr_160);
+ptr_172_params.push_back(ptr_163);
+ptr_172_params.push_back(const_int32_53);
+ptr_172_params.push_back(const_int32_53);
+CallInst* ptr_172 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_BumpPointer_allocSlow__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2II, ptr_172_params.begin(), ptr_172_params.end(), "", label_false_IFEQ_i_i_i_i);
+ptr_172->setCallingConv(CallingConv::C);
+ptr_172->setTailCall(true);
+AttrListPtr ptr_172_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- ptr_173_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ ptr_172_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-ptr_173->setAttributes(ptr_173_PAL);
+ptr_172->setAttributes(ptr_172_PAL);
 
 BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i, label_false_IFEQ_i_i_i_i);
 
 // Block JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII.exit.thread19.i (label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i)
-std::vector<Value*> ptr_175_indices;
-ptr_175_indices.push_back(const_int32_57);
-ptr_175_indices.push_back(const_int32_55);
-ptr_175_indices.push_back(const_int32_55);
-ptr_175_indices.push_back(const_int32_76);
-Instruction* ptr_175 = GetElementPtrInst::Create(ptr_103, ptr_175_indices.begin(), ptr_175_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-CastInst* ptr_176 = new BitCastInst(ptr_175, PointerTy_30, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-LoadInst* ptr_177 = new LoadInst(ptr_176, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-CastInst* ptr_178 = new BitCastInst(ptr_177, PointerTy_28, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-std::vector<Value*> ptr_179_params;
-ptr_179_params.push_back(ptr_178);
-ptr_179_params.push_back(int32_96);
-ptr_179_params.push_back(const_int32_55);
-ptr_179_params.push_back(const_int32_55);
-CallInst* ptr_179 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III, ptr_179_params.begin(), ptr_179_params.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-ptr_179->setCallingConv(CallingConv::C);
-ptr_179->setTailCall(true);
-AttrListPtr ptr_179_PAL;
+std::vector<Value*> ptr_174_indices;
+ptr_174_indices.push_back(const_int32_55);
+ptr_174_indices.push_back(const_int32_53);
+ptr_174_indices.push_back(const_int32_53);
+ptr_174_indices.push_back(const_int32_74);
+Instruction* ptr_174 = GetElementPtrInst::Create(ptr_102, ptr_174_indices.begin(), ptr_174_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+CastInst* ptr_175 = new BitCastInst(ptr_174, PointerTy_28, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+LoadInst* ptr_176 = new LoadInst(ptr_175, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+CastInst* ptr_177 = new BitCastInst(ptr_176, PointerTy_26, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+std::vector<Value*> ptr_178_params;
+ptr_178_params.push_back(ptr_177);
+ptr_178_params.push_back(int32_95);
+ptr_178_params.push_back(const_int32_53);
+ptr_178_params.push_back(const_int32_53);
+CallInst* ptr_178 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III, ptr_178_params.begin(), ptr_178_params.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+ptr_178->setCallingConv(CallingConv::C);
+ptr_178->setTailCall(true);
+AttrListPtr ptr_178_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- ptr_179_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
- 
-}
-ptr_179->setAttributes(ptr_179_PAL);
-
-std::vector<Value*> ptr_180_indices;
-ptr_180_indices.push_back(const_int32_55);
-ptr_180_indices.push_back(const_int32_55);
-Instruction* ptr_180 = GetElementPtrInst::Create(ptr_179, ptr_180_indices.begin(), ptr_180_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-CastInst* ptr__c20_i = new BitCastInst(ptr_VT, PointerTy_29, ".c20.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
- new StoreInst(ptr__c20_i, ptr_180, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-std::vector<Value*> ptr_182_indices;
-ptr_182_indices.push_back(const_int32_55);
-ptr_182_indices.push_back(const_int32_76);
-Instruction* ptr_182 = GetElementPtrInst::Create(ptr_179, ptr_182_indices.begin(), ptr_182_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-CastInst* ptr_183 = new BitCastInst(ptr_182, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-LoadInst* int8_184 = new LoadInst(ptr_183, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-BinaryOperator* int8_185 = BinaryOperator::Create(Instruction::And, int8_184, const_int8_78, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-LoadInst* int8_186 = new LoadInst(const_ptr_79, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-BinaryOperator* int8_187 = BinaryOperator::Create(Instruction::Or, int8_185, int8_186, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-BinaryOperator* int8_188 = BinaryOperator::Create(Instruction::Or, int8_187, const_int8_80, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
- new StoreInst(int8_188, ptr_183, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-LoadInst* ptr_190 = new LoadInst(const_ptr_81, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-CastInst* int32_191 = new PtrToIntInst(ptr_179, IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-BinaryOperator* int32_192 = BinaryOperator::Create(Instruction::And, int32_191, const_int32_82, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-CastInst* ptr_193 = new IntToPtrInst(int32_192, PointerTy_28, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-std::vector<Value*> ptr_194_indices;
-ptr_194_indices.push_back(const_int32_57);
-ptr_194_indices.push_back(const_int32_76);
-Instruction* ptr_194 = GetElementPtrInst::Create(ptr_190, ptr_194_indices.begin(), ptr_194_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-LoadInst* ptr_195 = new LoadInst(ptr_194, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-GetElementPtrInst* ptr_196 = GetElementPtrInst::Create(ptr_195, const_int32_70, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-CastInst* ptr_197 = new BitCastInst(ptr_196, PointerTy_30, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-LoadInst* ptr_198 = new LoadInst(ptr_197, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
-ICmpInst* int1_199 = new ICmpInst(*label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i, ICmpInst::ICMP_EQ, ptr_198, const_ptr_83, "");
-BranchInst::Create(label_true_IF_NULL_i1_i_i_i_i_i, label_true_IFNULL_i5_i_i_i_i_i, int1_199, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+ ptr_178_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ 
+}
+ptr_178->setAttributes(ptr_178_PAL);
+
+std::vector<Value*> ptr_179_indices;
+ptr_179_indices.push_back(const_int32_53);
+ptr_179_indices.push_back(const_int32_53);
+Instruction* ptr_179 = GetElementPtrInst::Create(ptr_178, ptr_179_indices.begin(), ptr_179_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+CastInst* ptr__c20_i = new BitCastInst(ptr_VT, PointerTy_27, ".c20.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+ new StoreInst(ptr__c20_i, ptr_179, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+std::vector<Value*> ptr_181_indices;
+ptr_181_indices.push_back(const_int32_53);
+ptr_181_indices.push_back(const_int32_74);
+Instruction* ptr_181 = GetElementPtrInst::Create(ptr_178, ptr_181_indices.begin(), ptr_181_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+CastInst* ptr_182 = new BitCastInst(ptr_181, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+LoadInst* int8_183 = new LoadInst(ptr_182, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+BinaryOperator* int8_184 = BinaryOperator::Create(Instruction::And, int8_183, const_int8_76, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+LoadInst* int8_185 = new LoadInst(const_ptr_77, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+BinaryOperator* int8_186 = BinaryOperator::Create(Instruction::Or, int8_184, int8_185, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+BinaryOperator* int8_187 = BinaryOperator::Create(Instruction::Or, int8_186, const_int8_78, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+ new StoreInst(int8_187, ptr_182, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+LoadInst* ptr_189 = new LoadInst(const_ptr_79, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+CastInst* int32_190 = new PtrToIntInst(ptr_178, IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+BinaryOperator* int32_191 = BinaryOperator::Create(Instruction::And, int32_190, const_int32_80, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+CastInst* ptr_192 = new IntToPtrInst(int32_191, PointerTy_26, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+std::vector<Value*> ptr_193_indices;
+ptr_193_indices.push_back(const_int32_55);
+ptr_193_indices.push_back(const_int32_74);
+Instruction* ptr_193 = GetElementPtrInst::Create(ptr_189, ptr_193_indices.begin(), ptr_193_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+LoadInst* ptr_194 = new LoadInst(ptr_193, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+GetElementPtrInst* ptr_195 = GetElementPtrInst::Create(ptr_194, const_int32_68, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+CastInst* ptr_196 = new BitCastInst(ptr_195, PointerTy_28, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+LoadInst* ptr_197 = new LoadInst(ptr_196, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i);
+ICmpInst* int1_198 = new ICmpInst(*label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_i, ICmpInst::ICMP_EQ, ptr_197, const_ptr_81, "");
+BranchInst::Create(label_true_IF_NULL_i1_i_i_i_i_i, label_true_IFNULL_i7_i_i_i_i_i, int1_198, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread19_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_201 = GetElementPtrInst::Create(ptr_103, const_int32_53, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i);
-CastInst* ptr_202 = new BitCastInst(ptr_201, PointerTy_27, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i);
-LoadInst* ptr_203 = new LoadInst(ptr_202, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i);
-BinaryOperator* int32_204 = BinaryOperator::Create(Instruction::Add, int32_96, const_int32_62, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i);
-ICmpInst* int1_205 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i, ICmpInst::ICMP_SGT, int32_204, const_int32_63, "");
-BranchInst::Create(label_GOTO_or_IF_4_i_i_i6_i_i_i, label_false_IF_ICMPGT16_i_i_i11_i_i_i, int1_205, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i);
+GetElementPtrInst* ptr_200 = GetElementPtrInst::Create(ptr_102, const_int32_51, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i);
+CastInst* ptr_201 = new BitCastInst(ptr_200, PointerTy_25, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i);
+LoadInst* ptr_202 = new LoadInst(ptr_201, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i);
+BinaryOperator* int32_203 = BinaryOperator::Create(Instruction::Add, int32_95, const_int32_60, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i);
+ICmpInst* int1_204 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i5_i_i_i, ICmpInst::ICMP_SGT, int32_203, const_int32_61, "");
+BranchInst::Create(label_GOTO_or_IF_4_i_i_i6_i_i_i, label_false_IF_ICMPGT16_i_i_i11_i_i_i, int1_204, 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_207 = new ICmpInst(*label_GOTO_or_IF_4_i_i_i6_i_i_i, ICmpInst::ICMP_SGT, int32_204, const_int32_64, "");
-BranchInst::Create(label_GOTO_or_IF_6_i_i_i7_i_i_i, label_false_IF_ICMPGT17_i_i_i12_i_i_i, int1_207, label_GOTO_or_IF_4_i_i_i6_i_i_i);
+ICmpInst* int1_206 = new ICmpInst(*label_GOTO_or_IF_4_i_i_i6_i_i_i, ICmpInst::ICMP_SGT, int32_203, const_int32_62, "");
+BranchInst::Create(label_GOTO_or_IF_6_i_i_i7_i_i_i, label_false_IF_ICMPGT17_i_i_i12_i_i_i, int1_206, 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_209 = new ICmpInst(*label_GOTO_or_IF_6_i_i_i7_i_i_i, ICmpInst::ICMP_SGT, int32_204, const_int32_65, "");
-BranchInst::Create(label_GOTO_or_IF_7_i_i1_i8_i_i_i, label_false_IF_ICMPGT18_i_i_i13_i_i_i, int1_209, label_GOTO_or_IF_6_i_i_i7_i_i_i);
+ICmpInst* int1_208 = new ICmpInst(*label_GOTO_or_IF_6_i_i_i7_i_i_i, ICmpInst::ICMP_SGT, int32_203, const_int32_63, "");
+BranchInst::Create(label_GOTO_or_IF_7_i_i1_i8_i_i_i, label_false_IF_ICMPGT18_i_i_i13_i_i_i, int1_208, 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_211 = new ICmpInst(*label_GOTO_or_IF_7_i_i1_i8_i_i_i, ICmpInst::ICMP_SGT, int32_204, const_int32_66, "");
-BranchInst::Create(label_GOTO_or_IF_8_i_i_i9_i_i_i, label_false_IF_ICMPGT19_i_i_i14_i_i_i, int1_211, label_GOTO_or_IF_7_i_i1_i8_i_i_i);
+ICmpInst* int1_210 = new ICmpInst(*label_GOTO_or_IF_7_i_i1_i8_i_i_i, ICmpInst::ICMP_SGT, int32_203, const_int32_64, "");
+BranchInst::Create(label_GOTO_or_IF_8_i_i_i9_i_i_i, label_false_IF_ICMPGT19_i_i_i14_i_i_i, int1_210, 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_213 = new ICmpInst(*label_GOTO_or_IF_8_i_i_i9_i_i_i, ICmpInst::ICMP_SGT, int32_204, const_int32_67, "");
-BranchInst::Create(label_GOTO_or_IF_9_i_i_i10_i_i_i, label_false_IF_ICMPGT20_i_i_i15_i_i_i, int1_213, label_GOTO_or_IF_8_i_i_i9_i_i_i);
+ICmpInst* int1_212 = new ICmpInst(*label_GOTO_or_IF_8_i_i_i9_i_i_i, ICmpInst::ICMP_SGT, int32_203, const_int32_65, "");
+BranchInst::Create(label_GOTO_or_IF_9_i_i_i10_i_i_i, label_false_IF_ICMPGT20_i_i_i15_i_i_i, int1_212, 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_215 = BinaryOperator::Create(Instruction::AShr, int32_204, const_int32_68, "", label_GOTO_or_IF_9_i_i_i10_i_i_i);
-BinaryOperator* int32_216 = BinaryOperator::Create(Instruction::Add, int32_215, const_int32_69, "", label_GOTO_or_IF_9_i_i_i10_i_i_i);
+BinaryOperator* int32_214 = BinaryOperator::Create(Instruction::AShr, int32_203, const_int32_66, "", label_GOTO_or_IF_9_i_i_i10_i_i_i);
+BinaryOperator* int32_215 = BinaryOperator::Create(Instruction::Add, int32_214, const_int32_67, "", 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_218 = BinaryOperator::Create(Instruction::AShr, int32_204, const_int32_57, "", label_false_IF_ICMPGT16_i_i_i11_i_i_i);
+BinaryOperator* int32_217 = BinaryOperator::Create(Instruction::AShr, int32_203, const_int32_55, "", 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_220 = BinaryOperator::Create(Instruction::AShr, int32_204, const_int32_59, "", label_false_IF_ICMPGT17_i_i_i12_i_i_i);
-BinaryOperator* int32_221 = BinaryOperator::Create(Instruction::Add, int32_220, const_int32_70, "", label_false_IF_ICMPGT17_i_i_i12_i_i_i);
+BinaryOperator* int32_219 = BinaryOperator::Create(Instruction::AShr, int32_203, const_int32_57, "", label_false_IF_ICMPGT17_i_i_i12_i_i_i);
+BinaryOperator* int32_220 = BinaryOperator::Create(Instruction::Add, int32_219, const_int32_68, "", 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_223 = BinaryOperator::Create(Instruction::AShr, int32_204, const_int32_71, "", label_false_IF_ICMPGT18_i_i_i13_i_i_i);
-BinaryOperator* int32_224 = BinaryOperator::Create(Instruction::Add, int32_223, const_int32_72, "", label_false_IF_ICMPGT18_i_i_i13_i_i_i);
+BinaryOperator* int32_222 = BinaryOperator::Create(Instruction::AShr, int32_203, const_int32_69, "", label_false_IF_ICMPGT18_i_i_i13_i_i_i);
+BinaryOperator* int32_223 = BinaryOperator::Create(Instruction::Add, int32_222, const_int32_70, "", 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_226 = BinaryOperator::Create(Instruction::AShr, int32_204, const_int32_73, "", label_false_IF_ICMPGT19_i_i_i14_i_i_i);
-BinaryOperator* int32_227 = BinaryOperator::Create(Instruction::Add, int32_226, const_int32_74, "", label_false_IF_ICMPGT19_i_i_i14_i_i_i);
+BinaryOperator* int32_225 = BinaryOperator::Create(Instruction::AShr, int32_203, const_int32_71, "", label_false_IF_ICMPGT19_i_i_i14_i_i_i);
+BinaryOperator* int32_226 = BinaryOperator::Create(Instruction::Add, int32_225, const_int32_72, "", 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_229 = BinaryOperator::Create(Instruction::AShr, int32_204, const_int32_61, "", label_false_IF_ICMPGT20_i_i_i15_i_i_i);
-BinaryOperator* int32_230 = BinaryOperator::Create(Instruction::Add, int32_229, const_int32_75, "", label_false_IF_ICMPGT20_i_i_i15_i_i_i);
+BinaryOperator* int32_228 = BinaryOperator::Create(Instruction::AShr, int32_203, const_int32_59, "", label_false_IF_ICMPGT20_i_i_i15_i_i_i);
+BinaryOperator* int32_229 = BinaryOperator::Create(Instruction::Add, int32_228, const_int32_73, "", 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_232 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
-int32_232->reserveOperandSpace(6);
-int32_232->addIncoming(int32_218, label_false_IF_ICMPGT16_i_i_i11_i_i_i);
-int32_232->addIncoming(int32_221, label_false_IF_ICMPGT17_i_i_i12_i_i_i);
-int32_232->addIncoming(int32_224, label_false_IF_ICMPGT18_i_i_i13_i_i_i);
-int32_232->addIncoming(int32_227, label_false_IF_ICMPGT19_i_i_i14_i_i_i);
-int32_232->addIncoming(int32_230, label_false_IF_ICMPGT20_i_i_i15_i_i_i);
-int32_232->addIncoming(int32_216, label_GOTO_or_IF_9_i_i_i10_i_i_i);
-
-std::vector<Value*> ptr_233_indices;
-ptr_233_indices.push_back(const_int32_76);
-ptr_233_indices.push_back(const_int32_76);
-Instruction* ptr_233 = GetElementPtrInst::Create(ptr_203, ptr_233_indices.begin(), ptr_233_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
-LoadInst* ptr_234 = new LoadInst(ptr_233, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
-BinaryOperator* int32_235 = BinaryOperator::Create(Instruction::Add, int32_232, const_int32_76, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
-CastInst* ptr_236 = new BitCastInst(ptr_234, PointerTy_25, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
-GetElementPtrInst* ptr_237 = GetElementPtrInst::Create(ptr_236, int32_235, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
-LoadInst* int32_238 = new LoadInst(ptr_237, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
-CastInst* ptr_239 = new IntToPtrInst(int32_238, PointerTy_28, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
-ICmpInst* int1_240 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i, ICmpInst::ICMP_EQ, int32_238, const_int32_55, "");
-BranchInst::Create(label_GOTO_or_IF__i17_i_i_i, label_false_IFNE_i21_i_i_i, int1_240, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
+PHINode* int32_231 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
+int32_231->reserveOperandSpace(6);
+int32_231->addIncoming(int32_217, label_false_IF_ICMPGT16_i_i_i11_i_i_i);
+int32_231->addIncoming(int32_220, label_false_IF_ICMPGT17_i_i_i12_i_i_i);
+int32_231->addIncoming(int32_223, label_false_IF_ICMPGT18_i_i_i13_i_i_i);
+int32_231->addIncoming(int32_226, label_false_IF_ICMPGT19_i_i_i14_i_i_i);
+int32_231->addIncoming(int32_229, label_false_IF_ICMPGT20_i_i_i15_i_i_i);
+int32_231->addIncoming(int32_215, label_GOTO_or_IF_9_i_i_i10_i_i_i);
+
+std::vector<Value*> ptr_232_indices;
+ptr_232_indices.push_back(const_int32_74);
+ptr_232_indices.push_back(const_int32_74);
+Instruction* ptr_232 = GetElementPtrInst::Create(ptr_202, ptr_232_indices.begin(), ptr_232_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
+LoadInst* ptr_233 = new LoadInst(ptr_232, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
+BinaryOperator* int32_234 = BinaryOperator::Create(Instruction::Add, int32_231, const_int32_74, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
+CastInst* ptr_235 = new BitCastInst(ptr_233, PointerTy_23, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
+GetElementPtrInst* ptr_236 = GetElementPtrInst::Create(ptr_235, int32_234, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
+LoadInst* int32_237 = new LoadInst(ptr_236, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
+CastInst* ptr_238 = new IntToPtrInst(int32_237, PointerTy_26, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i);
+ICmpInst* int1_239 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i16_i_i_i, ICmpInst::ICMP_EQ, int32_237, const_int32_53, "");
+BranchInst::Create(label_GOTO_or_IF__i17_i_i_i, label_false_IFNE_i21_i_i_i, int1_239, 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<Value*> ptr_242_params;
-ptr_242_params.push_back(ptr_203);
-ptr_242_params.push_back(int32_96);
-ptr_242_params.push_back(const_int32_55);
-ptr_242_params.push_back(const_int32_55);
-CallInst* ptr_242 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III, ptr_242_params.begin(), ptr_242_params.end(), "", label_GOTO_or_IF__i17_i_i_i);
-ptr_242->setCallingConv(CallingConv::C);
-ptr_242->setTailCall(true);
-AttrListPtr ptr_242_PAL;
+std::vector<Value*> ptr_241_params;
+ptr_241_params.push_back(ptr_202);
+ptr_241_params.push_back(int32_95);
+ptr_241_params.push_back(const_int32_53);
+ptr_241_params.push_back(const_int32_53);
+CallInst* ptr_241 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III, ptr_241_params.begin(), ptr_241_params.end(), "", label_GOTO_or_IF__i17_i_i_i);
+ptr_241->setCallingConv(CallingConv::C);
+ptr_241->setTailCall(true);
+AttrListPtr ptr_241_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- ptr_242_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ ptr_241_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-ptr_242->setAttributes(ptr_242_PAL);
+ptr_241->setAttributes(ptr_241_PAL);
 
 BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_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_244 = new IntToPtrInst(int32_238, PointerTy_27, "", label_false_IFNE_i21_i_i_i);
-LoadInst* ptr_245 = new LoadInst(ptr_244, "", false, label_false_IFNE_i21_i_i_i);
-CastInst* int32_246 = new PtrToIntInst(ptr_245, IntegerType::get(mod->getContext(), 32), "", label_false_IFNE_i21_i_i_i);
- new StoreInst(int32_246, ptr_237, false, label_false_IFNE_i21_i_i_i);
-std::vector<Value*> ptr_248_indices;
-ptr_248_indices.push_back(const_int32_55);
-ptr_248_indices.push_back(const_int32_55);
-Instruction* ptr_248 = GetElementPtrInst::Create(ptr_239, ptr_248_indices.begin(), ptr_248_indices.end(), "", label_false_IFNE_i21_i_i_i);
- new StoreInst(const_ptr_77, ptr_248, false, label_false_IFNE_i21_i_i_i);
+CastInst* ptr_243 = new IntToPtrInst(int32_237, PointerTy_25, "", label_false_IFNE_i21_i_i_i);
+LoadInst* ptr_244 = new LoadInst(ptr_243, "", false, label_false_IFNE_i21_i_i_i);
+CastInst* int32_245 = new PtrToIntInst(ptr_244, IntegerType::get(mod->getContext(), 32), "", label_false_IFNE_i21_i_i_i);
+ new StoreInst(int32_245, ptr_236, false, label_false_IFNE_i21_i_i_i);
+std::vector<Value*> ptr_247_indices;
+ptr_247_indices.push_back(const_int32_53);
+ptr_247_indices.push_back(const_int32_53);
+Instruction* ptr_247 = GetElementPtrInst::Create(ptr_238, ptr_247_indices.begin(), ptr_247_indices.end(), "", label_false_IFNE_i21_i_i_i);
+ new StoreInst(const_ptr_75, ptr_247, false, label_false_IFNE_i21_i_i_i);
 BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i, label_false_IFNE_i21_i_i_i);
 
 // Block JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII.exit.thread21.i (label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i)
-std::vector<Value*> ptr_251_indices;
-ptr_251_indices.push_back(const_int32_53);
-ptr_251_indices.push_back(const_int32_55);
-ptr_251_indices.push_back(const_int32_55);
-ptr_251_indices.push_back(const_int32_76);
-Instruction* ptr_251 = GetElementPtrInst::Create(ptr_103, ptr_251_indices.begin(), ptr_251_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-CastInst* ptr_252 = new BitCastInst(ptr_251, PointerTy_30, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-LoadInst* ptr_253 = new LoadInst(ptr_252, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-CastInst* ptr_254 = new BitCastInst(ptr_253, PointerTy_28, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-std::vector<Value*> ptr_255_params;
-ptr_255_params.push_back(ptr_254);
-ptr_255_params.push_back(int32_96);
-ptr_255_params.push_back(const_int32_55);
-ptr_255_params.push_back(const_int32_55);
-CallInst* ptr_255 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III, ptr_255_params.begin(), ptr_255_params.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-ptr_255->setCallingConv(CallingConv::C);
-ptr_255->setTailCall(true);
-AttrListPtr ptr_255_PAL;
+std::vector<Value*> ptr_250_indices;
+ptr_250_indices.push_back(const_int32_51);
+ptr_250_indices.push_back(const_int32_53);
+ptr_250_indices.push_back(const_int32_53);
+ptr_250_indices.push_back(const_int32_74);
+Instruction* ptr_250 = GetElementPtrInst::Create(ptr_102, ptr_250_indices.begin(), ptr_250_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+CastInst* ptr_251 = new BitCastInst(ptr_250, PointerTy_28, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+LoadInst* ptr_252 = new LoadInst(ptr_251, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+CastInst* ptr_253 = new BitCastInst(ptr_252, PointerTy_26, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+std::vector<Value*> ptr_254_params;
+ptr_254_params.push_back(ptr_253);
+ptr_254_params.push_back(int32_95);
+ptr_254_params.push_back(const_int32_53);
+ptr_254_params.push_back(const_int32_53);
+CallInst* ptr_254 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_LargeObjectAllocator_alloc__III, ptr_254_params.begin(), ptr_254_params.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+ptr_254->setCallingConv(CallingConv::C);
+ptr_254->setTailCall(true);
+AttrListPtr ptr_254_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- ptr_255_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
- 
-}
-ptr_255->setAttributes(ptr_255_PAL);
-
-std::vector<Value*> ptr_256_indices;
-ptr_256_indices.push_back(const_int32_55);
-ptr_256_indices.push_back(const_int32_55);
-Instruction* ptr_256 = GetElementPtrInst::Create(ptr_255, ptr_256_indices.begin(), ptr_256_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-CastInst* ptr__c22_i = new BitCastInst(ptr_VT, PointerTy_29, ".c22.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
- new StoreInst(ptr__c22_i, ptr_256, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-std::vector<Value*> ptr_258_indices;
-ptr_258_indices.push_back(const_int32_55);
-ptr_258_indices.push_back(const_int32_76);
-Instruction* ptr_258 = GetElementPtrInst::Create(ptr_255, ptr_258_indices.begin(), ptr_258_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-CastInst* ptr_259 = new BitCastInst(ptr_258, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-LoadInst* int8_260 = new LoadInst(ptr_259, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-BinaryOperator* int8_261 = BinaryOperator::Create(Instruction::And, int8_260, const_int8_78, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-LoadInst* int8_262 = new LoadInst(const_ptr_84, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-BinaryOperator* int8_263 = BinaryOperator::Create(Instruction::Or, int8_261, int8_262, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-BinaryOperator* int8_264 = BinaryOperator::Create(Instruction::Or, int8_263, const_int8_80, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
- new StoreInst(int8_264, ptr_259, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-LoadInst* ptr_266 = new LoadInst(const_ptr_85, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-CastInst* int32_267 = new PtrToIntInst(ptr_255, IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-BinaryOperator* int32_268 = BinaryOperator::Create(Instruction::And, int32_267, const_int32_82, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-CastInst* ptr_269 = new IntToPtrInst(int32_268, PointerTy_28, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-std::vector<Value*> ptr_270_indices;
-ptr_270_indices.push_back(const_int32_57);
-ptr_270_indices.push_back(const_int32_76);
-Instruction* ptr_270 = GetElementPtrInst::Create(ptr_266, ptr_270_indices.begin(), ptr_270_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-LoadInst* ptr_271 = new LoadInst(ptr_270, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-GetElementPtrInst* ptr_272 = GetElementPtrInst::Create(ptr_271, const_int32_70, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-CastInst* ptr_273 = new BitCastInst(ptr_272, PointerTy_30, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-LoadInst* ptr_274 = new LoadInst(ptr_273, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
-ICmpInst* int1_275 = new ICmpInst(*label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i, ICmpInst::ICMP_EQ, ptr_274, const_ptr_83, "");
-BranchInst::Create(label_true_IF_NULL_i1_i_i6_i_i_i, label_true_IFNULL_i5_i_i9_i_i_i, int1_275, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+ ptr_254_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ 
+}
+ptr_254->setAttributes(ptr_254_PAL);
+
+std::vector<Value*> ptr_255_indices;
+ptr_255_indices.push_back(const_int32_53);
+ptr_255_indices.push_back(const_int32_53);
+Instruction* ptr_255 = GetElementPtrInst::Create(ptr_254, ptr_255_indices.begin(), ptr_255_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+CastInst* ptr__c22_i = new BitCastInst(ptr_VT, PointerTy_27, ".c22.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+ new StoreInst(ptr__c22_i, ptr_255, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+std::vector<Value*> ptr_257_indices;
+ptr_257_indices.push_back(const_int32_53);
+ptr_257_indices.push_back(const_int32_74);
+Instruction* ptr_257 = GetElementPtrInst::Create(ptr_254, ptr_257_indices.begin(), ptr_257_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+CastInst* ptr_258 = new BitCastInst(ptr_257, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+LoadInst* int8_259 = new LoadInst(ptr_258, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+BinaryOperator* int8_260 = BinaryOperator::Create(Instruction::And, int8_259, const_int8_76, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+LoadInst* int8_261 = new LoadInst(const_ptr_82, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+BinaryOperator* int8_262 = BinaryOperator::Create(Instruction::Or, int8_260, int8_261, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+BinaryOperator* int8_263 = BinaryOperator::Create(Instruction::Or, int8_262, const_int8_78, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+ new StoreInst(int8_263, ptr_258, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+LoadInst* ptr_265 = new LoadInst(const_ptr_83, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+CastInst* int32_266 = new PtrToIntInst(ptr_254, IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+BinaryOperator* int32_267 = BinaryOperator::Create(Instruction::And, int32_266, const_int32_80, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+CastInst* ptr_268 = new IntToPtrInst(int32_267, PointerTy_26, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+std::vector<Value*> ptr_269_indices;
+ptr_269_indices.push_back(const_int32_55);
+ptr_269_indices.push_back(const_int32_74);
+Instruction* ptr_269 = GetElementPtrInst::Create(ptr_265, ptr_269_indices.begin(), ptr_269_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+LoadInst* ptr_270 = new LoadInst(ptr_269, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+GetElementPtrInst* ptr_271 = GetElementPtrInst::Create(ptr_270, const_int32_68, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+CastInst* ptr_272 = new BitCastInst(ptr_271, PointerTy_28, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+LoadInst* ptr_273 = new LoadInst(ptr_272, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i);
+ICmpInst* int1_274 = new ICmpInst(*label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_i, ICmpInst::ICMP_EQ, ptr_273, const_ptr_81, "");
+BranchInst::Create(label_true_IF_NULL_i1_i_i6_i_i_i, label_true_IFNULL_i7_i_i11_i_i_i, int1_274, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread21_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<Value*> ptr_277_indices;
-ptr_277_indices.push_back(const_int32_59);
-ptr_277_indices.push_back(const_int32_55);
-ptr_277_indices.push_back(const_int32_55);
-ptr_277_indices.push_back(const_int32_76);
-Instruction* ptr_277 = GetElementPtrInst::Create(ptr_103, ptr_277_indices.begin(), ptr_277_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
-CastInst* ptr_278 = new BitCastInst(ptr_277, PointerTy_30, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
-LoadInst* ptr_279 = new LoadInst(ptr_278, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
-CastInst* ptr_280 = new BitCastInst(ptr_279, PointerTy_28, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
-BinaryOperator* int32_281 = BinaryOperator::Create(Instruction::Add, int32_96, const_int32_62, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
-ICmpInst* int1_282 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i, ICmpInst::ICMP_SGT, int32_281, const_int32_63, "");
-BranchInst::Create(label_GOTO_or_IF_4_i_i_i_i_i, label_false_IF_ICMPGT16_i_i_i_i_i, int1_282, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
+std::vector<Value*> ptr_276_indices;
+ptr_276_indices.push_back(const_int32_57);
+ptr_276_indices.push_back(const_int32_53);
+ptr_276_indices.push_back(const_int32_53);
+ptr_276_indices.push_back(const_int32_74);
+Instruction* ptr_276 = GetElementPtrInst::Create(ptr_102, ptr_276_indices.begin(), ptr_276_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
+CastInst* ptr_277 = new BitCastInst(ptr_276, PointerTy_28, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
+LoadInst* ptr_278 = new LoadInst(ptr_277, "", false, label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
+CastInst* ptr_279 = new BitCastInst(ptr_278, PointerTy_26, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
+BinaryOperator* int32_280 = BinaryOperator::Create(Instruction::Add, int32_95, const_int32_60, "", label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i);
+ICmpInst* int1_281 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_Allocator_getMaximumAlignedSize__II_exit_i_i_i, ICmpInst::ICMP_SGT, int32_280, const_int32_61, "");
+BranchInst::Create(label_GOTO_or_IF_4_i_i_i_i_i, label_false_IF_ICMPGT16_i_i_i_i_i, int1_281, 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_284 = new ICmpInst(*label_GOTO_or_IF_4_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_281, const_int32_64, "");
-BranchInst::Create(label_GOTO_or_IF_6_i_i_i_i_i, label_false_IF_ICMPGT17_i_i_i_i_i, int1_284, label_GOTO_or_IF_4_i_i_i_i_i);
+ICmpInst* int1_283 = new ICmpInst(*label_GOTO_or_IF_4_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_280, const_int32_62, "");
+BranchInst::Create(label_GOTO_or_IF_6_i_i_i_i_i, label_false_IF_ICMPGT17_i_i_i_i_i, int1_283, 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_286 = new ICmpInst(*label_GOTO_or_IF_6_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_281, const_int32_65, "");
-BranchInst::Create(label_GOTO_or_IF_7_i_i1_i_i_i, label_false_IF_ICMPGT18_i_i_i_i_i, int1_286, label_GOTO_or_IF_6_i_i_i_i_i);
+ICmpInst* int1_285 = new ICmpInst(*label_GOTO_or_IF_6_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_280, const_int32_63, "");
+BranchInst::Create(label_GOTO_or_IF_7_i_i1_i_i_i, label_false_IF_ICMPGT18_i_i_i_i_i, int1_285, 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_288 = new ICmpInst(*label_GOTO_or_IF_7_i_i1_i_i_i, ICmpInst::ICMP_SGT, int32_281, const_int32_66, "");
-BranchInst::Create(label_GOTO_or_IF_8_i_i_i_i_i, label_false_IF_ICMPGT19_i_i_i_i_i, int1_288, label_GOTO_or_IF_7_i_i1_i_i_i);
+ICmpInst* int1_287 = new ICmpInst(*label_GOTO_or_IF_7_i_i1_i_i_i, ICmpInst::ICMP_SGT, int32_280, const_int32_64, "");
+BranchInst::Create(label_GOTO_or_IF_8_i_i_i_i_i, label_false_IF_ICMPGT19_i_i_i_i_i, int1_287, 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_290 = new ICmpInst(*label_GOTO_or_IF_8_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_281, const_int32_67, "");
-BranchInst::Create(label_GOTO_or_IF_9_i_i_i_i_i, label_false_IF_ICMPGT20_i_i_i_i_i, int1_290, label_GOTO_or_IF_8_i_i_i_i_i);
+ICmpInst* int1_289 = new ICmpInst(*label_GOTO_or_IF_8_i_i_i_i_i, ICmpInst::ICMP_SGT, int32_280, const_int32_65, "");
+BranchInst::Create(label_GOTO_or_IF_9_i_i_i_i_i, label_false_IF_ICMPGT20_i_i_i_i_i, int1_289, 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_292 = BinaryOperator::Create(Instruction::AShr, int32_281, const_int32_68, "", label_GOTO_or_IF_9_i_i_i_i_i);
-BinaryOperator* int32_293 = BinaryOperator::Create(Instruction::Add, int32_292, const_int32_69, "", label_GOTO_or_IF_9_i_i_i_i_i);
+BinaryOperator* int32_291 = BinaryOperator::Create(Instruction::AShr, int32_280, const_int32_66, "", label_GOTO_or_IF_9_i_i_i_i_i);
+BinaryOperator* int32_292 = BinaryOperator::Create(Instruction::Add, int32_291, const_int32_67, "", 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_295 = BinaryOperator::Create(Instruction::AShr, int32_281, const_int32_57, "", label_false_IF_ICMPGT16_i_i_i_i_i);
+BinaryOperator* int32_294 = BinaryOperator::Create(Instruction::AShr, int32_280, const_int32_55, "", 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_297 = BinaryOperator::Create(Instruction::AShr, int32_281, const_int32_59, "", label_false_IF_ICMPGT17_i_i_i_i_i);
-BinaryOperator* int32_298 = BinaryOperator::Create(Instruction::Add, int32_297, const_int32_70, "", label_false_IF_ICMPGT17_i_i_i_i_i);
+BinaryOperator* int32_296 = BinaryOperator::Create(Instruction::AShr, int32_280, const_int32_57, "", label_false_IF_ICMPGT17_i_i_i_i_i);
+BinaryOperator* int32_297 = BinaryOperator::Create(Instruction::Add, int32_296, const_int32_68, "", 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_300 = BinaryOperator::Create(Instruction::AShr, int32_281, const_int32_71, "", label_false_IF_ICMPGT18_i_i_i_i_i);
-BinaryOperator* int32_301 = BinaryOperator::Create(Instruction::Add, int32_300, const_int32_72, "", label_false_IF_ICMPGT18_i_i_i_i_i);
+BinaryOperator* int32_299 = BinaryOperator::Create(Instruction::AShr, int32_280, const_int32_69, "", label_false_IF_ICMPGT18_i_i_i_i_i);
+BinaryOperator* int32_300 = BinaryOperator::Create(Instruction::Add, int32_299, const_int32_70, "", 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_303 = BinaryOperator::Create(Instruction::AShr, int32_281, const_int32_73, "", label_false_IF_ICMPGT19_i_i_i_i_i);
-BinaryOperator* int32_304 = BinaryOperator::Create(Instruction::Add, int32_303, const_int32_74, "", label_false_IF_ICMPGT19_i_i_i_i_i);
+BinaryOperator* int32_302 = BinaryOperator::Create(Instruction::AShr, int32_280, const_int32_71, "", label_false_IF_ICMPGT19_i_i_i_i_i);
+BinaryOperator* int32_303 = BinaryOperator::Create(Instruction::Add, int32_302, const_int32_72, "", 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_306 = BinaryOperator::Create(Instruction::AShr, int32_281, const_int32_61, "", label_false_IF_ICMPGT20_i_i_i_i_i);
-BinaryOperator* int32_307 = BinaryOperator::Create(Instruction::Add, int32_306, const_int32_75, "", label_false_IF_ICMPGT20_i_i_i_i_i);
+BinaryOperator* int32_305 = BinaryOperator::Create(Instruction::AShr, int32_280, const_int32_59, "", label_false_IF_ICMPGT20_i_i_i_i_i);
+BinaryOperator* int32_306 = BinaryOperator::Create(Instruction::Add, int32_305, const_int32_73, "", 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_309 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
-int32_309->reserveOperandSpace(6);
-int32_309->addIncoming(int32_295, label_false_IF_ICMPGT16_i_i_i_i_i);
-int32_309->addIncoming(int32_298, label_false_IF_ICMPGT17_i_i_i_i_i);
-int32_309->addIncoming(int32_301, label_false_IF_ICMPGT18_i_i_i_i_i);
-int32_309->addIncoming(int32_304, label_false_IF_ICMPGT19_i_i_i_i_i);
-int32_309->addIncoming(int32_307, label_false_IF_ICMPGT20_i_i_i_i_i);
-int32_309->addIncoming(int32_293, label_GOTO_or_IF_9_i_i_i_i_i);
-
-GetElementPtrInst* ptr_310 = GetElementPtrInst::Create(ptr_279, const_int32_70, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
-CastInst* ptr_311 = new BitCastInst(ptr_310, PointerTy_30, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
-LoadInst* ptr_312 = new LoadInst(ptr_311, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
-BinaryOperator* int32_313 = BinaryOperator::Create(Instruction::Add, int32_309, const_int32_76, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
-CastInst* ptr_314 = new BitCastInst(ptr_312, PointerTy_25, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
-GetElementPtrInst* ptr_315 = GetElementPtrInst::Create(ptr_314, int32_313, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
-LoadInst* int32_316 = new LoadInst(ptr_315, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
-CastInst* ptr_317 = new IntToPtrInst(int32_316, PointerTy_28, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
-ICmpInst* int1_318 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i, ICmpInst::ICMP_EQ, int32_316, const_int32_55, "");
-BranchInst::Create(label_GOTO_or_IF__i_i_i, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i, int1_318, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
+PHINode* int32_308 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
+int32_308->reserveOperandSpace(6);
+int32_308->addIncoming(int32_294, label_false_IF_ICMPGT16_i_i_i_i_i);
+int32_308->addIncoming(int32_297, label_false_IF_ICMPGT17_i_i_i_i_i);
+int32_308->addIncoming(int32_300, label_false_IF_ICMPGT18_i_i_i_i_i);
+int32_308->addIncoming(int32_303, label_false_IF_ICMPGT19_i_i_i_i_i);
+int32_308->addIncoming(int32_306, label_false_IF_ICMPGT20_i_i_i_i_i);
+int32_308->addIncoming(int32_292, label_GOTO_or_IF_9_i_i_i_i_i);
+
+GetElementPtrInst* ptr_309 = GetElementPtrInst::Create(ptr_278, const_int32_68, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
+CastInst* ptr_310 = new BitCastInst(ptr_309, PointerTy_28, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
+LoadInst* ptr_311 = new LoadInst(ptr_310, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
+BinaryOperator* int32_312 = BinaryOperator::Create(Instruction::Add, int32_308, const_int32_74, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
+CastInst* ptr_313 = new BitCastInst(ptr_311, PointerTy_23, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
+GetElementPtrInst* ptr_314 = GetElementPtrInst::Create(ptr_313, int32_312, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
+LoadInst* int32_315 = new LoadInst(ptr_314, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
+CastInst* ptr_316 = new IntToPtrInst(int32_315, PointerTy_26, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i);
+ICmpInst* int1_317 = new ICmpInst(*label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_getSizeClass__I_exit_i_i_i, ICmpInst::ICMP_EQ, int32_315, const_int32_53, "");
+BranchInst::Create(label_GOTO_or_IF__i_i_i, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i, int1_317, 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<Value*> ptr_320_params;
-ptr_320_params.push_back(ptr_280);
-ptr_320_params.push_back(int32_96);
-ptr_320_params.push_back(const_int32_55);
-ptr_320_params.push_back(const_int32_55);
-CallInst* ptr_320 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III, ptr_320_params.begin(), ptr_320_params.end(), "", label_GOTO_or_IF__i_i_i);
-ptr_320->setCallingConv(CallingConv::C);
-ptr_320->setTailCall(true);
-AttrListPtr ptr_320_PAL;
+std::vector<Value*> ptr_319_params;
+ptr_319_params.push_back(ptr_279);
+ptr_319_params.push_back(int32_95);
+ptr_319_params.push_back(const_int32_53);
+ptr_319_params.push_back(const_int32_53);
+CallInst* ptr_319 = CallInst::Create(func_JnJVM_org_mmtk_utility_alloc_Allocator_allocSlow__III, ptr_319_params.begin(), ptr_319_params.end(), "", label_GOTO_or_IF__i_i_i);
+ptr_319->setCallingConv(CallingConv::C);
+ptr_319->setTailCall(true);
+AttrListPtr ptr_319_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- ptr_320_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ ptr_319_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-ptr_320->setAttributes(ptr_320_PAL);
+ptr_319->setAttributes(ptr_319_PAL);
 
 BranchInst::Create(label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_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_322 = new IntToPtrInst(int32_316, PointerTy_27, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
-LoadInst* ptr_323 = new LoadInst(ptr_322, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
-CastInst* int32_324 = new PtrToIntInst(ptr_323, IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
- new StoreInst(int32_324, ptr_315, false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
-std::vector<Value*> ptr_326_indices;
-ptr_326_indices.push_back(const_int32_55);
-ptr_326_indices.push_back(const_int32_55);
-Instruction* ptr_326 = GetElementPtrInst::Create(ptr_317, ptr_326_indices.begin(), ptr_326_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
- new StoreInst(const_ptr_77, ptr_326, false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
+CastInst* ptr_321 = new IntToPtrInst(int32_315, PointerTy_25, "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
+LoadInst* ptr_322 = new LoadInst(ptr_321, "", false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
+CastInst* int32_323 = new PtrToIntInst(ptr_322, IntegerType::get(mod->getContext(), 32), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
+ new StoreInst(int32_323, ptr_314, false, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
+std::vector<Value*> ptr_325_indices;
+ptr_325_indices.push_back(const_int32_53);
+ptr_325_indices.push_back(const_int32_53);
+Instruction* ptr_325 = GetElementPtrInst::Create(ptr_316, ptr_325_indices.begin(), ptr_325_indices.end(), "", label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
+ new StoreInst(const_ptr_75, ptr_325, 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_thread_i, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
 
 // Block JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII.exit.thread.i (label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i)
-PHINode* ptr__ph_i = PHINode::Create(PointerTy_28, ".ph.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
+PHINode* ptr__ph_i = PHINode::Create(PointerTy_26, ".ph.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
 ptr__ph_i->reserveOperandSpace(2);
-ptr__ph_i->addIncoming(ptr_320, label_GOTO_or_IF__i_i_i);
-ptr__ph_i->addIncoming(ptr_317, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
+ptr__ph_i->addIncoming(ptr_319, label_GOTO_or_IF__i_i_i);
+ptr__ph_i->addIncoming(ptr_316, label_JnJVM_org_mmtk_utility_alloc_SegregatedFreeList_alloc__III_exit_i_i);
 
-std::vector<Value*> ptr_329_indices;
-ptr_329_indices.push_back(const_int32_55);
-ptr_329_indices.push_back(const_int32_55);
-Instruction* ptr_329 = GetElementPtrInst::Create(ptr__ph_i, ptr_329_indices.begin(), ptr_329_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
-CastInst* ptr__c6_i = new BitCastInst(ptr_VT, PointerTy_29, ".c6.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
- new StoreInst(ptr__c6_i, ptr_329, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
-LoadInst* int8_storemerge_in_i_i1_i_i = new LoadInst(const_ptr_86, "storemerge.in.i.i1.i.i", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
-std::vector<Value*> ptr_331_indices;
-ptr_331_indices.push_back(const_int32_55);
-ptr_331_indices.push_back(const_int32_76);
-Instruction* ptr_331 = GetElementPtrInst::Create(ptr__ph_i, ptr_331_indices.begin(), ptr_331_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
-CastInst* ptr_332 = new BitCastInst(ptr_331, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
- new StoreInst(int8_storemerge_in_i_i1_i_i, ptr_332, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
+std::vector<Value*> ptr_328_indices;
+ptr_328_indices.push_back(const_int32_53);
+ptr_328_indices.push_back(const_int32_53);
+Instruction* ptr_328 = GetElementPtrInst::Create(ptr__ph_i, ptr_328_indices.begin(), ptr_328_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
+CastInst* ptr__c6_i = new BitCastInst(ptr_VT, PointerTy_27, ".c6.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
+ new StoreInst(ptr__c6_i, ptr_328, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
+LoadInst* int8_storemerge_in_i_i1_i_i = new LoadInst(const_ptr_84, "storemerge.in.i.i1.i.i", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
+std::vector<Value*> ptr_330_indices;
+ptr_330_indices.push_back(const_int32_53);
+ptr_330_indices.push_back(const_int32_74);
+Instruction* ptr_330 = GetElementPtrInst::Create(ptr__ph_i, ptr_330_indices.begin(), ptr_330_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
+CastInst* ptr_331 = new BitCastInst(ptr_330, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
+ new StoreInst(int8_storemerge_in_i_i1_i_i, ptr_331, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
 BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
 
 // Block JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII.exit.thread9.i (label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i)
-PHINode* ptr__ph8_i = PHINode::Create(PointerTy_28, ".ph8.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
+PHINode* ptr__ph8_i = PHINode::Create(PointerTy_26, ".ph8.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
 ptr__ph8_i->reserveOperandSpace(2);
-ptr__ph8_i->addIncoming(ptr_144, label_false_IFNE_i_i_i_i);
-ptr__ph8_i->addIncoming(ptr_147, label_GOTO_or_IF__i_i_i_i);
+ptr__ph8_i->addIncoming(ptr_143, label_false_IFNE_i_i_i_i);
+ptr__ph8_i->addIncoming(ptr_146, label_GOTO_or_IF__i_i_i_i);
 
-std::vector<Value*> ptr_335_indices;
-ptr_335_indices.push_back(const_int32_55);
-ptr_335_indices.push_back(const_int32_55);
-Instruction* ptr_335 = GetElementPtrInst::Create(ptr__ph8_i, ptr_335_indices.begin(), ptr_335_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
-CastInst* ptr__c10_i = new BitCastInst(ptr_VT, PointerTy_29, ".c10.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
- new StoreInst(ptr__c10_i, ptr_335, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
-LoadInst* int8_storemerge_in_i_i_i_i = new LoadInst(const_ptr_87, "storemerge.in.i.i.i.i", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
-std::vector<Value*> ptr_337_indices;
-ptr_337_indices.push_back(const_int32_55);
-ptr_337_indices.push_back(const_int32_76);
-Instruction* ptr_337 = GetElementPtrInst::Create(ptr__ph8_i, ptr_337_indices.begin(), ptr_337_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
-CastInst* ptr_338 = new BitCastInst(ptr_337, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
- new StoreInst(int8_storemerge_in_i_i_i_i, ptr_338, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
+std::vector<Value*> ptr_334_indices;
+ptr_334_indices.push_back(const_int32_53);
+ptr_334_indices.push_back(const_int32_53);
+Instruction* ptr_334 = GetElementPtrInst::Create(ptr__ph8_i, ptr_334_indices.begin(), ptr_334_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
+CastInst* ptr__c10_i = new BitCastInst(ptr_VT, PointerTy_27, ".c10.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
+ new StoreInst(ptr__c10_i, ptr_334, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
+LoadInst* int8_storemerge_in_i_i_i_i = new LoadInst(const_ptr_85, "storemerge.in.i.i.i.i", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
+std::vector<Value*> ptr_336_indices;
+ptr_336_indices.push_back(const_int32_53);
+ptr_336_indices.push_back(const_int32_74);
+Instruction* ptr_336 = GetElementPtrInst::Create(ptr__ph8_i, ptr_336_indices.begin(), ptr_336_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
+CastInst* ptr_337 = new BitCastInst(ptr_336, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
+ new StoreInst(int8_storemerge_in_i_i_i_i, ptr_337, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
 BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
 
 // Block JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII.exit.thread13.i (label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i)
-PHINode* ptr__ph12_i = PHINode::Create(PointerTy_28, ".ph12.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+PHINode* ptr__ph12_i = PHINode::Create(PointerTy_26, ".ph12.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
 ptr__ph12_i->reserveOperandSpace(2);
-ptr__ph12_i->addIncoming(ptr_173, label_false_IFEQ_i_i_i_i);
-ptr__ph12_i->addIncoming(ptr_161, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i_i);
+ptr__ph12_i->addIncoming(ptr_172, label_false_IFEQ_i_i_i_i);
+ptr__ph12_i->addIncoming(ptr_160, label_JnJVM_org_mmtk_utility_alloc_Allocator_fillAlignmentGap__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_Address_2_exit_i_i_i_i);
 
-std::vector<Value*> ptr_341_indices;
-ptr_341_indices.push_back(const_int32_55);
-ptr_341_indices.push_back(const_int32_55);
-Instruction* ptr_341 = GetElementPtrInst::Create(ptr__ph12_i, ptr_341_indices.begin(), ptr_341_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
-CastInst* ptr__c14_i = new BitCastInst(ptr_VT, PointerTy_29, ".c14.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
- new StoreInst(ptr__c14_i, ptr_341, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
-std::vector<Value*> ptr_343_indices;
-ptr_343_indices.push_back(const_int32_55);
-ptr_343_indices.push_back(const_int32_76);
-Instruction* ptr_343 = GetElementPtrInst::Create(ptr__ph12_i, ptr_343_indices.begin(), ptr_343_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
-CastInst* ptr_344 = new BitCastInst(ptr_343, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
-LoadInst* int8_345 = new LoadInst(ptr_344, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
-BinaryOperator* int8_346 = BinaryOperator::Create(Instruction::And, int8_345, const_int8_88, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
-LoadInst* int8_347 = new LoadInst(const_ptr_89, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
-BinaryOperator* int8_348 = BinaryOperator::Create(Instruction::Or, int8_346, int8_347, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
- new StoreInst(int8_348, ptr_344, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+std::vector<Value*> ptr_340_indices;
+ptr_340_indices.push_back(const_int32_53);
+ptr_340_indices.push_back(const_int32_53);
+Instruction* ptr_340 = GetElementPtrInst::Create(ptr__ph12_i, ptr_340_indices.begin(), ptr_340_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+CastInst* ptr__c14_i = new BitCastInst(ptr_VT, PointerTy_27, ".c14.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+ new StoreInst(ptr__c14_i, ptr_340, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+std::vector<Value*> ptr_342_indices;
+ptr_342_indices.push_back(const_int32_53);
+ptr_342_indices.push_back(const_int32_74);
+Instruction* ptr_342 = GetElementPtrInst::Create(ptr__ph12_i, ptr_342_indices.begin(), ptr_342_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+CastInst* ptr_343 = new BitCastInst(ptr_342, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+LoadInst* int8_344 = new LoadInst(ptr_343, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+BinaryOperator* int8_345 = BinaryOperator::Create(Instruction::And, int8_344, const_int8_86, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+LoadInst* int8_346 = new LoadInst(const_ptr_87, "", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+BinaryOperator* int8_347 = BinaryOperator::Create(Instruction::Or, int8_345, int8_346, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+ new StoreInst(int8_347, ptr_343, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
 BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
 
 // Block JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII.exit.thread17.i (label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i)
-PHINode* ptr__ph16_i = PHINode::Create(PointerTy_28, ".ph16.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
+PHINode* ptr__ph16_i = PHINode::Create(PointerTy_26, ".ph16.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
 ptr__ph16_i->reserveOperandSpace(2);
-ptr__ph16_i->addIncoming(ptr_239, label_false_IFNE_i21_i_i_i);
-ptr__ph16_i->addIncoming(ptr_242, label_GOTO_or_IF__i17_i_i_i);
+ptr__ph16_i->addIncoming(ptr_238, label_false_IFNE_i21_i_i_i);
+ptr__ph16_i->addIncoming(ptr_241, label_GOTO_or_IF__i17_i_i_i);
 
-std::vector<Value*> ptr_351_indices;
-ptr_351_indices.push_back(const_int32_55);
-ptr_351_indices.push_back(const_int32_55);
-Instruction* ptr_351 = GetElementPtrInst::Create(ptr__ph16_i, ptr_351_indices.begin(), ptr_351_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
-CastInst* ptr__c18_i = new BitCastInst(ptr_VT, PointerTy_29, ".c18.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
- new StoreInst(ptr__c18_i, ptr_351, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
-LoadInst* int8_storemerge_in_i2_i_i_i = new LoadInst(const_ptr_90, "storemerge.in.i2.i.i.i", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
-std::vector<Value*> ptr_353_indices;
-ptr_353_indices.push_back(const_int32_55);
-ptr_353_indices.push_back(const_int32_76);
-Instruction* ptr_353 = GetElementPtrInst::Create(ptr__ph16_i, ptr_353_indices.begin(), ptr_353_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
-CastInst* ptr_354 = new BitCastInst(ptr_353, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
- new StoreInst(int8_storemerge_in_i2_i_i_i, ptr_354, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
+std::vector<Value*> ptr_350_indices;
+ptr_350_indices.push_back(const_int32_53);
+ptr_350_indices.push_back(const_int32_53);
+Instruction* ptr_350 = GetElementPtrInst::Create(ptr__ph16_i, ptr_350_indices.begin(), ptr_350_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
+CastInst* ptr__c18_i = new BitCastInst(ptr_VT, PointerTy_27, ".c18.i", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
+ new StoreInst(ptr__c18_i, ptr_350, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
+LoadInst* int8_storemerge_in_i2_i_i_i = new LoadInst(const_ptr_88, "storemerge.in.i2.i.i.i", false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
+std::vector<Value*> ptr_352_indices;
+ptr_352_indices.push_back(const_int32_53);
+ptr_352_indices.push_back(const_int32_74);
+Instruction* ptr_352 = GetElementPtrInst::Create(ptr__ph16_i, ptr_352_indices.begin(), ptr_352_indices.end(), "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
+CastInst* ptr_353 = new BitCastInst(ptr_352, PointerTy_0, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
+ new StoreInst(int8_storemerge_in_i2_i_i_i, ptr_353, false, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
 BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
 
 // Block JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII.exit.i (label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i)
-CallInst* void_357 = CallInst::Create(func_llvm_trap, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i);
-void_357->setCallingConv(CallingConv::C);
-void_357->setTailCall(true);
-AttrListPtr void_357_PAL;
+CallInst* void_356 = CallInst::Create(func_abort, "", label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i);
+void_356->setCallingConv(CallingConv::C);
+void_356->setTailCall(true);
+AttrListPtr void_356_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
- PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
+ PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoReturn | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- void_357_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ void_356_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-void_357->setAttributes(void_357_PAL);
+void_356->setAttributes(void_356_PAL);
 
 new UnreachableInst(mod->getContext(), label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_i);
 
 // Block true IF*NULL.i1.i.i.i.i.i (label_true_IF_NULL_i1_i_i_i_i_i)
-std::vector<Value*> ptr_359_indices;
-ptr_359_indices.push_back(const_int32_55);
-ptr_359_indices.push_back(const_int32_55);
-Instruction* ptr_359 = GetElementPtrInst::Create(ptr_193, ptr_359_indices.begin(), ptr_359_indices.end(), "", label_true_IF_NULL_i1_i_i_i_i_i);
- new StoreInst(const_ptr_77, ptr_359, false, label_true_IF_NULL_i1_i_i_i_i_i);
-GetElementPtrInst* ptr_361 = GetElementPtrInst::Create(ptr_195, const_int32_61, "", label_true_IF_NULL_i1_i_i_i_i_i);
-CastInst* ptr_362 = new BitCastInst(ptr_361, PointerTy_27, "", label_true_IF_NULL_i1_i_i_i_i_i);
-LoadInst* ptr_363 = new LoadInst(ptr_362, "", false, label_true_IF_NULL_i1_i_i_i_i_i);
-LoadInst* ptr_364 = new LoadInst(const_ptr_91, "", false, label_true_IF_NULL_i1_i_i_i_i_i);
-CastInst* int32_365 = new PtrToIntInst(ptr_364, IntegerType::get(mod->getContext(), 32), "", label_true_IF_NULL_i1_i_i_i_i_i);
-BinaryOperator* int32_366 = BinaryOperator::Create(Instruction::Add, int32_365, int32_192, "", label_true_IF_NULL_i1_i_i_i_i_i);
-CastInst* ptr_367 = new IntToPtrInst(int32_366, PointerTy_27, "", label_true_IF_NULL_i1_i_i_i_i_i);
- new StoreInst(ptr_363, ptr_367, false, label_true_IF_NULL_i1_i_i_i_i_i);
-LoadInst* ptr_369 = new LoadInst(ptr_362, "", false, label_true_IF_NULL_i1_i_i_i_i_i);
-ICmpInst* int1_370 = new ICmpInst(*label_true_IF_NULL_i1_i_i_i_i_i, ICmpInst::ICMP_EQ, ptr_369, const_ptr_92, "");
-BranchInst::Create(label_GOTO_or_IF_1_i3_i_i_i_i_i, label_false_IFNE_i7_i_i_i_i_i, int1_370, 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_372 = new BitCastInst(ptr_361, PointerTy_33, "", label_GOTO_or_IF_1_i3_i_i_i_i_i);
-CastInst* ptr__c1_i2_i_i_i_i_i = new IntToPtrInst(int32_192, PointerTy_29, ".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_372, false, label_GOTO_or_IF_1_i3_i_i_i_i_i);
-LoadInst* ptr_374 = new LoadInst(ptr_197, "", false, label_GOTO_or_IF_1_i3_i_i_i_i_i);
-ICmpInst* int1_375 = new ICmpInst(*label_GOTO_or_IF_1_i3_i_i_i_i_i, ICmpInst::ICMP_EQ, ptr_374, const_ptr_83, "");
-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_375, 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_377 = GetElementPtrInst::Create(ptr_198, const_int32_61, "", label_true_IFNULL_i5_i_i_i_i_i);
-CastInst* ptr_378 = new BitCastInst(ptr_377, PointerTy_25, "", label_true_IFNULL_i5_i_i_i_i_i);
-BranchInst::Create(label_bb2_i_i22_i, label_true_IFNULL_i5_i_i_i_i_i);
+std::vector<Value*> ptr_358_indices;
+ptr_358_indices.push_back(const_int32_53);
+ptr_358_indices.push_back(const_int32_53);
+Instruction* ptr_358 = GetElementPtrInst::Create(ptr_192, ptr_358_indices.begin(), ptr_358_indices.end(), "", label_true_IF_NULL_i1_i_i_i_i_i);
+ new StoreInst(const_ptr_75, ptr_358, false, label_true_IF_NULL_i1_i_i_i_i_i);
+GetElementPtrInst* ptr_360 = GetElementPtrInst::Create(ptr_194, const_int32_59, "", label_true_IF_NULL_i1_i_i_i_i_i);
+CastInst* ptr_361 = new BitCastInst(ptr_360, PointerTy_25, "", label_true_IF_NULL_i1_i_i_i_i_i);
+LoadInst* ptr_362 = new LoadInst(ptr_361, "", false, label_true_IF_NULL_i1_i_i_i_i_i);
+LoadInst* ptr_363 = new LoadInst(const_ptr_89, "", false, label_true_IF_NULL_i1_i_i_i_i_i);
+CastInst* int32_364 = new PtrToIntInst(ptr_363, IntegerType::get(mod->getContext(), 32), "", label_true_IF_NULL_i1_i_i_i_i_i);
+BinaryOperator* int32_365 = BinaryOperator::Create(Instruction::Add, int32_364, int32_191, "", label_true_IF_NULL_i1_i_i_i_i_i);
+CastInst* ptr_366 = new IntToPtrInst(int32_365, PointerTy_25, "", label_true_IF_NULL_i1_i_i_i_i_i);
+ new StoreInst(ptr_362, ptr_366, false, label_true_IF_NULL_i1_i_i_i_i_i);
+LoadInst* ptr_368 = new LoadInst(ptr_361, "", false, label_true_IF_NULL_i1_i_i_i_i_i);
+ICmpInst* int1_369 = new ICmpInst(*label_true_IF_NULL_i1_i_i_i_i_i, ICmpInst::ICMP_EQ, ptr_368, const_ptr_90, "");
+BranchInst::Create(label_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i_i_i_i, label_false_IFNE_i9_i_i_i_i_i, int1_369, label_true_IF_NULL_i1_i_i_i_i_i);
+
+// Block true IF*NULL.GOTO or IF*1_crit_edge.i3.i.i.i.i.i (label_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i_i_i_i)
+CastInst* ptr__c1_pre_i2_i_i_i_i_i = new IntToPtrInst(int32_191, PointerTy_27, ".c1.pre.i2.i.i.i.i.i", label_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i_i_i_i);
+BranchInst::Create(label_GOTO_or_IF_1_i5_i_i_i_i_i, label_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i_i_i_i);
+
+// Block GOTO or IF*1.i5.i.i.i.i.i (label_GOTO_or_IF_1_i5_i_i_i_i_i)
+Argument* fwdref_372 = new Argument(PointerTy_27);
+PHINode* ptr__c1_pre_phi_i4_i_i_i_i_i = PHINode::Create(PointerTy_27, ".c1.pre-phi.i4.i.i.i.i.i", label_GOTO_or_IF_1_i5_i_i_i_i_i);
+ptr__c1_pre_phi_i4_i_i_i_i_i->reserveOperandSpace(2);
+ptr__c1_pre_phi_i4_i_i_i_i_i->addIncoming(ptr__c1_pre_i2_i_i_i_i_i, label_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i_i_i_i);
+ptr__c1_pre_phi_i4_i_i_i_i_i->addIncoming(fwdref_372, label_false_IFNE_i9_i_i_i_i_i);
+
+CastInst* ptr_373 = new BitCastInst(ptr_360, PointerTy_31, "", label_GOTO_or_IF_1_i5_i_i_i_i_i);
+ new StoreInst(ptr__c1_pre_phi_i4_i_i_i_i_i, ptr_373, false, label_GOTO_or_IF_1_i5_i_i_i_i_i);
+LoadInst* ptr_375 = new LoadInst(ptr_196, "", false, label_GOTO_or_IF_1_i5_i_i_i_i_i);
+ICmpInst* int1_376 = new ICmpInst(*label_GOTO_or_IF_1_i5_i_i_i_i_i, ICmpInst::ICMP_EQ, ptr_375, const_ptr_81, "");
+BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_true_IFNULL3_i10_i_i_i_i_i, int1_376, label_GOTO_or_IF_1_i5_i_i_i_i_i);
+
+// Block true IFNULL.i7.i.i.i.i.i (label_true_IFNULL_i7_i_i_i_i_i)
+CastInst* ptr_378 = new IntToPtrInst(int32_98, PointerTy_13, "", label_true_IFNULL_i7_i_i_i_i_i);
+std::vector<Value*> ptr_379_indices;
+ptr_379_indices.push_back(const_int32_53);
+ptr_379_indices.push_back(const_int32_69);
+Instruction* ptr_379 = GetElementPtrInst::Create(ptr_378, ptr_379_indices.begin(), ptr_379_indices.end(), "", label_true_IFNULL_i7_i_i_i_i_i);
+LoadInst* int8_380 = new LoadInst(ptr_379, "", false, label_true_IFNULL_i7_i_i_i_i_i);
+ICmpInst* int1_381 = new ICmpInst(*label_true_IFNULL_i7_i_i_i_i_i, ICmpInst::ICMP_NE, int8_380, const_int8_91, "");
+CastInst* int8_382 = new ZExtInst(int1_381, IntegerType::get(mod->getContext(), 8), "", label_true_IFNULL_i7_i_i_i_i_i);
+ new StoreInst(const_int8_86, ptr_379, false, label_true_IFNULL_i7_i_i_i_i_i);
+GetElementPtrInst* ptr_384 = GetElementPtrInst::Create(ptr_197, const_int32_59, "", label_true_IFNULL_i7_i_i_i_i_i);
+CastInst* ptr_385 = new BitCastInst(ptr_384, PointerTy_23, "", label_true_IFNULL_i7_i_i_i_i_i);
+BranchInst::Create(label_bb2_i_i22_i, label_true_IFNULL_i7_i_i_i_i_i);
 
 // Block bb.i.i20.i (label_bb_i_i20_i)
-Argument* fwdref_381 = new Argument(IntegerType::get(mod->getContext(), 1));
-BranchInst::Create(label_true_IF_NULL_i1_i_i_i_i_i, label_bb1_i_i21_i, fwdref_381, label_bb_i_i20_i);
+Argument* fwdref_388 = new Argument(IntegerType::get(mod->getContext(), 1));
+BranchInst::Create(label_Java_org_j3_mmtk_Lock_acquire___exit25_i, label_bb1_i_i21_i, fwdref_388, label_bb_i_i20_i);
 
 // Block bb1.i.i21.i (label_bb1_i_i21_i)
-Argument* fwdref_383 = new Argument(IntegerType::get(mod->getContext(), 32));
-BinaryOperator* int32_382 = BinaryOperator::Create(Instruction::Add, fwdref_383, const_int32_76, "", label_bb1_i_i21_i);
+Argument* fwdref_390 = new Argument(IntegerType::get(mod->getContext(), 32));
+BinaryOperator* int32_389 = BinaryOperator::Create(Instruction::Add, fwdref_390, const_int32_74, "", label_bb1_i_i21_i);
 BranchInst::Create(label_bb2_i_i22_i, label_bb1_i_i21_i);
 
 // Block bb2.i.i22.i (label_bb2_i_i22_i)
-PHINode* int32_385 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_bb2_i_i22_i);
-int32_385->reserveOperandSpace(2);
-int32_385->addIncoming(const_int32_55, label_true_IFNULL_i5_i_i_i_i_i);
-int32_385->addIncoming(int32_382, label_bb1_i_i21_i);
+PHINode* int32_392 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_bb2_i_i22_i);
+int32_392->reserveOperandSpace(2);
+int32_392->addIncoming(const_int32_53, label_true_IFNULL_i7_i_i_i_i_i);
+int32_392->addIncoming(int32_389, label_bb1_i_i21_i);
 
-ICmpInst* int1_386 = new ICmpInst(*label_bb2_i_i22_i, ICmpInst::ICMP_ULT, int32_385, const_int32_93, "");
-std::vector<Value*> void_387_params;
-void_387_params.push_back(const_int1_94);
-void_387_params.push_back(const_int1_94);
-void_387_params.push_back(const_int1_94);
-void_387_params.push_back(const_int1_94);
-void_387_params.push_back(const_int1_94);
-CallInst* void_387 = CallInst::Create(func_llvm_memory_barrier, void_387_params.begin(), void_387_params.end(), "", label_bb2_i_i22_i);
-void_387->setCallingConv(CallingConv::C);
-void_387->setTailCall(true);
-AttrListPtr void_387_PAL;
+ICmpInst* int1_393 = new ICmpInst(*label_bb2_i_i22_i, ICmpInst::ICMP_ULT, int32_392, const_int32_92, "");
+std::vector<Value*> void_394_params;
+void_394_params.push_back(const_int1_93);
+void_394_params.push_back(const_int1_93);
+void_394_params.push_back(const_int1_93);
+void_394_params.push_back(const_int1_93);
+void_394_params.push_back(const_int1_93);
+CallInst* void_394 = CallInst::Create(func_llvm_memory_barrier, void_394_params.begin(), void_394_params.end(), "", label_bb2_i_i22_i);
+void_394->setCallingConv(CallingConv::C);
+void_394->setTailCall(true);
+AttrListPtr void_394_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- void_387_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ void_394_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-void_387->setAttributes(void_387_PAL);
+void_394->setAttributes(void_394_PAL);
 
-std::vector<Value*> int32_388_params;
-int32_388_params.push_back(ptr_378);
-int32_388_params.push_back(const_int32_55);
-int32_388_params.push_back(const_int32_76);
-CallInst* int32_388 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_388_params.begin(), int32_388_params.end(), "", label_bb2_i_i22_i);
-int32_388->setCallingConv(CallingConv::C);
-int32_388->setTailCall(true);
-AttrListPtr int32_388_PAL;
+std::vector<Value*> int32_395_params;
+int32_395_params.push_back(ptr_385);
+int32_395_params.push_back(const_int32_53);
+int32_395_params.push_back(const_int32_74);
+CallInst* int32_395 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_395_params.begin(), int32_395_params.end(), "", label_bb2_i_i22_i);
+int32_395->setCallingConv(CallingConv::C);
+int32_395->setTailCall(true);
+AttrListPtr int32_395_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- int32_388_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ int32_395_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-int32_388->setAttributes(int32_388_PAL);
+int32_395->setAttributes(int32_395_PAL);
 
-std::vector<Value*> void_389_params;
-void_389_params.push_back(const_int1_94);
-void_389_params.push_back(const_int1_94);
-void_389_params.push_back(const_int1_94);
-void_389_params.push_back(const_int1_94);
-void_389_params.push_back(const_int1_94);
-CallInst* void_389 = CallInst::Create(func_llvm_memory_barrier, void_389_params.begin(), void_389_params.end(), "", label_bb2_i_i22_i);
-void_389->setCallingConv(CallingConv::C);
-void_389->setTailCall(true);
-AttrListPtr void_389_PAL;
+std::vector<Value*> void_396_params;
+void_396_params.push_back(const_int1_93);
+void_396_params.push_back(const_int1_93);
+void_396_params.push_back(const_int1_93);
+void_396_params.push_back(const_int1_93);
+void_396_params.push_back(const_int1_93);
+CallInst* void_396 = CallInst::Create(func_llvm_memory_barrier, void_396_params.begin(), void_396_params.end(), "", label_bb2_i_i22_i);
+void_396->setCallingConv(CallingConv::C);
+void_396->setTailCall(true);
+AttrListPtr void_396_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- void_389_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ void_396_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-void_389->setAttributes(void_389_PAL);
+void_396->setAttributes(void_396_PAL);
 
-ICmpInst* int1_390 = new ICmpInst(*label_bb2_i_i22_i, ICmpInst::ICMP_EQ, int32_388, const_int32_55, "");
-BranchInst::Create(label_bb_i_i20_i, label_bb4_preheader_i_i23_i, int1_386, label_bb2_i_i22_i);
+ICmpInst* int1_397 = new ICmpInst(*label_bb2_i_i22_i, ICmpInst::ICMP_EQ, int32_395, const_int32_53, "");
+BranchInst::Create(label_bb_i_i20_i, label_bb4_preheader_i_i23_i, int1_393, label_bb2_i_i22_i);
 
 // Block bb4.preheader.i.i23.i (label_bb4_preheader_i_i23_i)
-BranchInst::Create(label_true_IF_NULL_i1_i_i_i_i_i, label_bb3_i_i24_i, int1_390, label_bb4_preheader_i_i23_i);
+BranchInst::Create(label_Java_org_j3_mmtk_Lock_acquire___exit25_i, label_bb3_i_i24_i, int1_397, label_bb4_preheader_i_i23_i);
 
 // Block bb3.i.i24.i (label_bb3_i_i24_i)
-CallInst* void_393 = CallInst::Create(func__ZN3mvm6Thread5yieldEv, "", label_bb3_i_i24_i);
-void_393->setCallingConv(CallingConv::C);
-void_393->setTailCall(true);
-AttrListPtr void_393_PAL;
+CallInst* void_400 = CallInst::Create(func__ZN3mvm6Thread5yieldEv, "", label_bb3_i_i24_i);
+void_400->setCallingConv(CallingConv::C);
+void_400->setTailCall(true);
+AttrListPtr void_400_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- void_393_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ void_400_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-void_393->setAttributes(void_393_PAL);
+void_400->setAttributes(void_400_PAL);
 
-std::vector<Value*> void_394_params;
-void_394_params.push_back(const_int1_94);
-void_394_params.push_back(const_int1_94);
-void_394_params.push_back(const_int1_94);
-void_394_params.push_back(const_int1_94);
-void_394_params.push_back(const_int1_94);
-CallInst* void_394 = CallInst::Create(func_llvm_memory_barrier, void_394_params.begin(), void_394_params.end(), "", label_bb3_i_i24_i);
-void_394->setCallingConv(CallingConv::C);
-void_394->setTailCall(true);
-AttrListPtr void_394_PAL;
+std::vector<Value*> void_401_params;
+void_401_params.push_back(const_int1_93);
+void_401_params.push_back(const_int1_93);
+void_401_params.push_back(const_int1_93);
+void_401_params.push_back(const_int1_93);
+void_401_params.push_back(const_int1_93);
+CallInst* void_401 = CallInst::Create(func_llvm_memory_barrier, void_401_params.begin(), void_401_params.end(), "", label_bb3_i_i24_i);
+void_401->setCallingConv(CallingConv::C);
+void_401->setTailCall(true);
+AttrListPtr void_401_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- void_394_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ void_401_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-void_394->setAttributes(void_394_PAL);
+void_401->setAttributes(void_401_PAL);
 
-std::vector<Value*> int32_395_params;
-int32_395_params.push_back(ptr_378);
-int32_395_params.push_back(const_int32_55);
-int32_395_params.push_back(const_int32_76);
-CallInst* int32_395 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_395_params.begin(), int32_395_params.end(), "", label_bb3_i_i24_i);
-int32_395->setCallingConv(CallingConv::C);
-int32_395->setTailCall(true);
-AttrListPtr int32_395_PAL;
+std::vector<Value*> int32_402_params;
+int32_402_params.push_back(ptr_385);
+int32_402_params.push_back(const_int32_53);
+int32_402_params.push_back(const_int32_74);
+CallInst* int32_402 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_402_params.begin(), int32_402_params.end(), "", label_bb3_i_i24_i);
+int32_402->setCallingConv(CallingConv::C);
+int32_402->setTailCall(true);
+AttrListPtr int32_402_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- int32_395_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ int32_402_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-int32_395->setAttributes(int32_395_PAL);
+int32_402->setAttributes(int32_402_PAL);
 
-std::vector<Value*> void_396_params;
-void_396_params.push_back(const_int1_94);
-void_396_params.push_back(const_int1_94);
-void_396_params.push_back(const_int1_94);
-void_396_params.push_back(const_int1_94);
-void_396_params.push_back(const_int1_94);
-CallInst* void_396 = CallInst::Create(func_llvm_memory_barrier, void_396_params.begin(), void_396_params.end(), "", label_bb3_i_i24_i);
-void_396->setCallingConv(CallingConv::C);
-void_396->setTailCall(true);
-AttrListPtr void_396_PAL;
+std::vector<Value*> void_403_params;
+void_403_params.push_back(const_int1_93);
+void_403_params.push_back(const_int1_93);
+void_403_params.push_back(const_int1_93);
+void_403_params.push_back(const_int1_93);
+void_403_params.push_back(const_int1_93);
+CallInst* void_403 = CallInst::Create(func_llvm_memory_barrier, void_403_params.begin(), void_403_params.end(), "", label_bb3_i_i24_i);
+void_403->setCallingConv(CallingConv::C);
+void_403->setTailCall(true);
+AttrListPtr void_403_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- void_396_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ void_403_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-void_396->setAttributes(void_396_PAL);
+void_403->setAttributes(void_403_PAL);
+
+ICmpInst* int1_404 = new ICmpInst(*label_bb3_i_i24_i, ICmpInst::ICMP_EQ, int32_402, const_int32_53, "");
+BranchInst::Create(label_Java_org_j3_mmtk_Lock_acquire___exit25_i, label_bb3_i_i24_i, int1_404, label_bb3_i_i24_i);
 
-ICmpInst* int1_397 = new ICmpInst(*label_bb3_i_i24_i, ICmpInst::ICMP_EQ, int32_395, const_int32_55, "");
-BranchInst::Create(label_true_IF_NULL_i1_i_i_i_i_i, label_bb3_i_i24_i, int1_397, label_bb3_i_i24_i);
+// Block Java_org_j3_mmtk_Lock_acquire__.exit25.i (label_Java_org_j3_mmtk_Lock_acquire___exit25_i)
+ new StoreInst(int8_382, ptr_379, false, label_Java_org_j3_mmtk_Lock_acquire___exit25_i);
+BranchInst::Create(label_true_IF_NULL_i1_i_i_i_i_i, label_Java_org_j3_mmtk_Lock_acquire___exit25_i);
 
-// Block false IFNE.i7.i.i.i.i.i (label_false_IFNE_i7_i_i_i_i_i)
-std::vector<Value*> ptr_399_indices;
-ptr_399_indices.push_back(const_int32_55);
-ptr_399_indices.push_back(const_int32_55);
-Instruction* ptr_399 = GetElementPtrInst::Create(ptr_369, ptr_399_indices.begin(), ptr_399_indices.end(), "", label_false_IFNE_i7_i_i_i_i_i);
-CastInst* ptr__c_i6_i_i_i_i_i = new IntToPtrInst(int32_192, PointerTy_29, ".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_399, 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_402 = GetElementPtrInst::Create(ptr_374, const_int32_61, "", label_true_IFNULL3_i8_i_i_i_i_i);
-CastInst* ptr_403 = new BitCastInst(ptr_402, PointerTy_25, "", label_true_IFNULL3_i8_i_i_i_i_i);
- new StoreInst(const_int32_55, ptr_403, 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 false IFNE.i9.i.i.i.i.i (label_false_IFNE_i9_i_i_i_i_i)
+std::vector<Value*> ptr_408_indices;
+ptr_408_indices.push_back(const_int32_53);
+ptr_408_indices.push_back(const_int32_53);
+Instruction* ptr_408 = GetElementPtrInst::Create(ptr_368, ptr_408_indices.begin(), ptr_408_indices.end(), "", label_false_IFNE_i9_i_i_i_i_i);
+CastInst* ptr__c_i8_i_i_i_i_i = new IntToPtrInst(int32_191, PointerTy_27, ".c.i8.i.i.i.i.i", label_false_IFNE_i9_i_i_i_i_i);
+ new StoreInst(ptr__c_i8_i_i_i_i_i, ptr_408, false, label_false_IFNE_i9_i_i_i_i_i);
+BranchInst::Create(label_GOTO_or_IF_1_i5_i_i_i_i_i, label_false_IFNE_i9_i_i_i_i_i);
+
+// Block true IFNULL3.i10.i.i.i.i.i (label_true_IFNULL3_i10_i_i_i_i_i)
+CastInst* ptr_411 = new IntToPtrInst(int32_98, PointerTy_13, "", label_true_IFNULL3_i10_i_i_i_i_i);
+std::vector<Value*> ptr_412_indices;
+ptr_412_indices.push_back(const_int32_53);
+ptr_412_indices.push_back(const_int32_69);
+Instruction* ptr_412 = GetElementPtrInst::Create(ptr_411, ptr_412_indices.begin(), ptr_412_indices.end(), "", label_true_IFNULL3_i10_i_i_i_i_i);
+LoadInst* int8_413 = new LoadInst(ptr_412, "", false, label_true_IFNULL3_i10_i_i_i_i_i);
+ICmpInst* int1_414 = new ICmpInst(*label_true_IFNULL3_i10_i_i_i_i_i, ICmpInst::ICMP_NE, int8_413, const_int8_91, "");
+CastInst* int8_415 = new ZExtInst(int1_414, IntegerType::get(mod->getContext(), 8), "", label_true_IFNULL3_i10_i_i_i_i_i);
+ new StoreInst(const_int8_86, ptr_412, false, label_true_IFNULL3_i10_i_i_i_i_i);
+GetElementPtrInst* ptr_417 = GetElementPtrInst::Create(ptr_375, const_int32_59, "", label_true_IFNULL3_i10_i_i_i_i_i);
+CastInst* ptr_418 = new BitCastInst(ptr_417, PointerTy_23, "", label_true_IFNULL3_i10_i_i_i_i_i);
+ new StoreInst(const_int32_53, ptr_418, false, label_true_IFNULL3_i10_i_i_i_i_i);
+ new StoreInst(int8_415, ptr_412, false, label_true_IFNULL3_i10_i_i_i_i_i);
+BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_true_IFNULL3_i10_i_i_i_i_i);
 
 // Block true IF*NULL.i1.i.i6.i.i.i (label_true_IF_NULL_i1_i_i6_i_i_i)
-std::vector<Value*> ptr_406_indices;
-ptr_406_indices.push_back(const_int32_55);
-ptr_406_indices.push_back(const_int32_55);
-Instruction* ptr_406 = GetElementPtrInst::Create(ptr_269, ptr_406_indices.begin(), ptr_406_indices.end(), "", label_true_IF_NULL_i1_i_i6_i_i_i);
- new StoreInst(const_ptr_77, ptr_406, false, label_true_IF_NULL_i1_i_i6_i_i_i);
-GetElementPtrInst* ptr_408 = GetElementPtrInst::Create(ptr_271, const_int32_61, "", label_true_IF_NULL_i1_i_i6_i_i_i);
-CastInst* ptr_409 = new BitCastInst(ptr_408, PointerTy_27, "", label_true_IF_NULL_i1_i_i6_i_i_i);
-LoadInst* ptr_410 = new LoadInst(ptr_409, "", false, label_true_IF_NULL_i1_i_i6_i_i_i);
-LoadInst* ptr_411 = new LoadInst(const_ptr_91, "", false, label_true_IF_NULL_i1_i_i6_i_i_i);
-CastInst* int32_412 = new PtrToIntInst(ptr_411, IntegerType::get(mod->getContext(), 32), "", label_true_IF_NULL_i1_i_i6_i_i_i);
-BinaryOperator* int32_413 = BinaryOperator::Create(Instruction::Add, int32_412, int32_268, "", label_true_IF_NULL_i1_i_i6_i_i_i);
-CastInst* ptr_414 = new IntToPtrInst(int32_413, PointerTy_27, "", label_true_IF_NULL_i1_i_i6_i_i_i);
- new StoreInst(ptr_410, ptr_414, false, label_true_IF_NULL_i1_i_i6_i_i_i);
-LoadInst* ptr_416 = new LoadInst(ptr_409, "", false, label_true_IF_NULL_i1_i_i6_i_i_i);
-ICmpInst* int1_417 = new ICmpInst(*label_true_IF_NULL_i1_i_i6_i_i_i, ICmpInst::ICMP_EQ, ptr_416, const_ptr_92, "");
-BranchInst::Create(label_GOTO_or_IF_1_i3_i_i8_i_i_i, label_false_IFNE_i7_i_i11_i_i_i, int1_417, label_true_IF_NULL_i1_i_i6_i_i_i);
-
-// Block GOTO or IF*1.i3.i.i8.i.i.i (label_GOTO_or_IF_1_i3_i_i8_i_i_i)
-CastInst* ptr_419 = new BitCastInst(ptr_408, PointerTy_33, "", label_GOTO_or_IF_1_i3_i_i8_i_i_i);
-CastInst* ptr__c1_i2_i_i7_i_i_i = new IntToPtrInst(int32_268, PointerTy_29, ".c1.i2.i.i7.i.i.i", label_GOTO_or_IF_1_i3_i_i8_i_i_i);
- new StoreInst(ptr__c1_i2_i_i7_i_i_i, ptr_419, false, label_GOTO_or_IF_1_i3_i_i8_i_i_i);
-LoadInst* ptr_421 = new LoadInst(ptr_273, "", false, label_GOTO_or_IF_1_i3_i_i8_i_i_i);
-ICmpInst* int1_422 = new ICmpInst(*label_GOTO_or_IF_1_i3_i_i8_i_i_i, ICmpInst::ICMP_EQ, ptr_421, const_ptr_83, "");
-BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_true_IFNULL3_i8_i_i12_i_i_i, int1_422, label_GOTO_or_IF_1_i3_i_i8_i_i_i);
-
-// Block true IFNULL.i5.i.i9.i.i.i (label_true_IFNULL_i5_i_i9_i_i_i)
-GetElementPtrInst* ptr_424 = GetElementPtrInst::Create(ptr_274, const_int32_61, "", label_true_IFNULL_i5_i_i9_i_i_i);
-CastInst* ptr_425 = new BitCastInst(ptr_424, PointerTy_25, "", label_true_IFNULL_i5_i_i9_i_i_i);
-BranchInst::Create(label_bb2_i_i_i, label_true_IFNULL_i5_i_i9_i_i_i);
+std::vector<Value*> ptr_422_indices;
+ptr_422_indices.push_back(const_int32_53);
+ptr_422_indices.push_back(const_int32_53);
+Instruction* ptr_422 = GetElementPtrInst::Create(ptr_268, ptr_422_indices.begin(), ptr_422_indices.end(), "", label_true_IF_NULL_i1_i_i6_i_i_i);
+ new StoreInst(const_ptr_75, ptr_422, false, label_true_IF_NULL_i1_i_i6_i_i_i);
+GetElementPtrInst* ptr_424 = GetElementPtrInst::Create(ptr_270, const_int32_59, "", label_true_IF_NULL_i1_i_i6_i_i_i);
+CastInst* ptr_425 = new BitCastInst(ptr_424, PointerTy_25, "", label_true_IF_NULL_i1_i_i6_i_i_i);
+LoadInst* ptr_426 = new LoadInst(ptr_425, "", false, label_true_IF_NULL_i1_i_i6_i_i_i);
+LoadInst* ptr_427 = new LoadInst(const_ptr_89, "", false, label_true_IF_NULL_i1_i_i6_i_i_i);
+CastInst* int32_428 = new PtrToIntInst(ptr_427, IntegerType::get(mod->getContext(), 32), "", label_true_IF_NULL_i1_i_i6_i_i_i);
+BinaryOperator* int32_429 = BinaryOperator::Create(Instruction::Add, int32_428, int32_267, "", label_true_IF_NULL_i1_i_i6_i_i_i);
+CastInst* ptr_430 = new IntToPtrInst(int32_429, PointerTy_25, "", label_true_IF_NULL_i1_i_i6_i_i_i);
+ new StoreInst(ptr_426, ptr_430, false, label_true_IF_NULL_i1_i_i6_i_i_i);
+LoadInst* ptr_432 = new LoadInst(ptr_425, "", false, label_true_IF_NULL_i1_i_i6_i_i_i);
+ICmpInst* int1_433 = new ICmpInst(*label_true_IF_NULL_i1_i_i6_i_i_i, ICmpInst::ICMP_EQ, ptr_432, const_ptr_90, "");
+BranchInst::Create(label_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i8_i_i_i, label_false_IFNE_i9_i_i13_i_i_i, int1_433, label_true_IF_NULL_i1_i_i6_i_i_i);
+
+// Block true IF*NULL.GOTO or IF*1_crit_edge.i3.i.i8.i.i.i (label_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i8_i_i_i)
+CastInst* ptr__c1_pre_i2_i_i7_i_i_i = new IntToPtrInst(int32_267, PointerTy_27, ".c1.pre.i2.i.i7.i.i.i", label_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i8_i_i_i);
+BranchInst::Create(label_GOTO_or_IF_1_i5_i_i10_i_i_i, label_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i8_i_i_i);
+
+// Block GOTO or IF*1.i5.i.i10.i.i.i (label_GOTO_or_IF_1_i5_i_i10_i_i_i)
+Argument* fwdref_436 = new Argument(PointerTy_27);
+PHINode* ptr__c1_pre_phi_i4_i_i9_i_i_i = PHINode::Create(PointerTy_27, ".c1.pre-phi.i4.i.i9.i.i.i", label_GOTO_or_IF_1_i5_i_i10_i_i_i);
+ptr__c1_pre_phi_i4_i_i9_i_i_i->reserveOperandSpace(2);
+ptr__c1_pre_phi_i4_i_i9_i_i_i->addIncoming(ptr__c1_pre_i2_i_i7_i_i_i, label_true_IF_NULL_GOTO_or_IF_1_crit_edge_i3_i_i8_i_i_i);
+ptr__c1_pre_phi_i4_i_i9_i_i_i->addIncoming(fwdref_436, label_false_IFNE_i9_i_i13_i_i_i);
+
+CastInst* ptr_437 = new BitCastInst(ptr_424, PointerTy_31, "", label_GOTO_or_IF_1_i5_i_i10_i_i_i);
+ new StoreInst(ptr__c1_pre_phi_i4_i_i9_i_i_i, ptr_437, false, label_GOTO_or_IF_1_i5_i_i10_i_i_i);
+LoadInst* ptr_439 = new LoadInst(ptr_272, "", false, label_GOTO_or_IF_1_i5_i_i10_i_i_i);
+ICmpInst* int1_440 = new ICmpInst(*label_GOTO_or_IF_1_i5_i_i10_i_i_i, ICmpInst::ICMP_EQ, ptr_439, const_ptr_81, "");
+BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_true_IFNULL3_i10_i_i14_i_i_i, int1_440, label_GOTO_or_IF_1_i5_i_i10_i_i_i);
+
+// Block true IFNULL.i7.i.i11.i.i.i (label_true_IFNULL_i7_i_i11_i_i_i)
+CastInst* ptr_442 = new IntToPtrInst(int32_98, PointerTy_13, "", label_true_IFNULL_i7_i_i11_i_i_i);
+std::vector<Value*> ptr_443_indices;
+ptr_443_indices.push_back(const_int32_53);
+ptr_443_indices.push_back(const_int32_69);
+Instruction* ptr_443 = GetElementPtrInst::Create(ptr_442, ptr_443_indices.begin(), ptr_443_indices.end(), "", label_true_IFNULL_i7_i_i11_i_i_i);
+LoadInst* int8_444 = new LoadInst(ptr_443, "", false, label_true_IFNULL_i7_i_i11_i_i_i);
+ICmpInst* int1_445 = new ICmpInst(*label_true_IFNULL_i7_i_i11_i_i_i, ICmpInst::ICMP_NE, int8_444, const_int8_91, "");
+CastInst* int8_446 = new ZExtInst(int1_445, IntegerType::get(mod->getContext(), 8), "", label_true_IFNULL_i7_i_i11_i_i_i);
+ new StoreInst(const_int8_86, ptr_443, false, label_true_IFNULL_i7_i_i11_i_i_i);
+GetElementPtrInst* ptr_448 = GetElementPtrInst::Create(ptr_273, const_int32_59, "", label_true_IFNULL_i7_i_i11_i_i_i);
+CastInst* ptr_449 = new BitCastInst(ptr_448, PointerTy_23, "", label_true_IFNULL_i7_i_i11_i_i_i);
+BranchInst::Create(label_bb2_i_i_i, label_true_IFNULL_i7_i_i11_i_i_i);
 
 // Block bb.i.i.i (label_bb_i_i_i)
-Argument* fwdref_428 = new Argument(IntegerType::get(mod->getContext(), 1));
-BranchInst::Create(label_true_IF_NULL_i1_i_i6_i_i_i, label_bb1_i_i_i, fwdref_428, label_bb_i_i_i);
+Argument* fwdref_452 = new Argument(IntegerType::get(mod->getContext(), 1));
+BranchInst::Create(label_Java_org_j3_mmtk_Lock_acquire___exit_i, label_bb1_i_i_i, fwdref_452, label_bb_i_i_i);
 
 // Block bb1.i.i.i (label_bb1_i_i_i)
-Argument* fwdref_430 = new Argument(IntegerType::get(mod->getContext(), 32));
-BinaryOperator* int32_429 = BinaryOperator::Create(Instruction::Add, fwdref_430, const_int32_76, "", label_bb1_i_i_i);
+Argument* fwdref_454 = new Argument(IntegerType::get(mod->getContext(), 32));
+BinaryOperator* int32_453 = BinaryOperator::Create(Instruction::Add, fwdref_454, const_int32_74, "", 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_432 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_bb2_i_i_i);
-int32_432->reserveOperandSpace(2);
-int32_432->addIncoming(const_int32_55, label_true_IFNULL_i5_i_i9_i_i_i);
-int32_432->addIncoming(int32_429, label_bb1_i_i_i);
+PHINode* int32_456 = PHINode::Create(IntegerType::get(mod->getContext(), 32), "", label_bb2_i_i_i);
+int32_456->reserveOperandSpace(2);
+int32_456->addIncoming(const_int32_53, label_true_IFNULL_i7_i_i11_i_i_i);
+int32_456->addIncoming(int32_453, label_bb1_i_i_i);
 
-ICmpInst* int1_433 = new ICmpInst(*label_bb2_i_i_i, ICmpInst::ICMP_ULT, int32_432, const_int32_93, "");
-std::vector<Value*> void_434_params;
-void_434_params.push_back(const_int1_94);
-void_434_params.push_back(const_int1_94);
-void_434_params.push_back(const_int1_94);
-void_434_params.push_back(const_int1_94);
-void_434_params.push_back(const_int1_94);
-CallInst* void_434 = CallInst::Create(func_llvm_memory_barrier, void_434_params.begin(), void_434_params.end(), "", label_bb2_i_i_i);
-void_434->setCallingConv(CallingConv::C);
-void_434->setTailCall(true);
-AttrListPtr void_434_PAL;
+ICmpInst* int1_457 = new ICmpInst(*label_bb2_i_i_i, ICmpInst::ICMP_ULT, int32_456, const_int32_92, "");
+std::vector<Value*> void_458_params;
+void_458_params.push_back(const_int1_93);
+void_458_params.push_back(const_int1_93);
+void_458_params.push_back(const_int1_93);
+void_458_params.push_back(const_int1_93);
+void_458_params.push_back(const_int1_93);
+CallInst* void_458 = CallInst::Create(func_llvm_memory_barrier, void_458_params.begin(), void_458_params.end(), "", label_bb2_i_i_i);
+void_458->setCallingConv(CallingConv::C);
+void_458->setTailCall(true);
+AttrListPtr void_458_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- void_434_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ void_458_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-void_434->setAttributes(void_434_PAL);
+void_458->setAttributes(void_458_PAL);
 
-std::vector<Value*> int32_435_params;
-int32_435_params.push_back(ptr_425);
-int32_435_params.push_back(const_int32_55);
-int32_435_params.push_back(const_int32_76);
-CallInst* int32_435 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_435_params.begin(), int32_435_params.end(), "", label_bb2_i_i_i);
-int32_435->setCallingConv(CallingConv::C);
-int32_435->setTailCall(true);
-AttrListPtr int32_435_PAL;
+std::vector<Value*> int32_459_params;
+int32_459_params.push_back(ptr_449);
+int32_459_params.push_back(const_int32_53);
+int32_459_params.push_back(const_int32_74);
+CallInst* int32_459 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_459_params.begin(), int32_459_params.end(), "", label_bb2_i_i_i);
+int32_459->setCallingConv(CallingConv::C);
+int32_459->setTailCall(true);
+AttrListPtr int32_459_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- int32_435_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ int32_459_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-int32_435->setAttributes(int32_435_PAL);
+int32_459->setAttributes(int32_459_PAL);
 
-std::vector<Value*> void_436_params;
-void_436_params.push_back(const_int1_94);
-void_436_params.push_back(const_int1_94);
-void_436_params.push_back(const_int1_94);
-void_436_params.push_back(const_int1_94);
-void_436_params.push_back(const_int1_94);
-CallInst* void_436 = CallInst::Create(func_llvm_memory_barrier, void_436_params.begin(), void_436_params.end(), "", label_bb2_i_i_i);
-void_436->setCallingConv(CallingConv::C);
-void_436->setTailCall(true);
-AttrListPtr void_436_PAL;
+std::vector<Value*> void_460_params;
+void_460_params.push_back(const_int1_93);
+void_460_params.push_back(const_int1_93);
+void_460_params.push_back(const_int1_93);
+void_460_params.push_back(const_int1_93);
+void_460_params.push_back(const_int1_93);
+CallInst* void_460 = CallInst::Create(func_llvm_memory_barrier, void_460_params.begin(), void_460_params.end(), "", label_bb2_i_i_i);
+void_460->setCallingConv(CallingConv::C);
+void_460->setTailCall(true);
+AttrListPtr void_460_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- void_436_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ void_460_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-void_436->setAttributes(void_436_PAL);
+void_460->setAttributes(void_460_PAL);
 
-ICmpInst* int1_437 = new ICmpInst(*label_bb2_i_i_i, ICmpInst::ICMP_EQ, int32_435, const_int32_55, "");
-BranchInst::Create(label_bb_i_i_i, label_bb4_preheader_i_i_i, int1_433, label_bb2_i_i_i);
+ICmpInst* int1_461 = new ICmpInst(*label_bb2_i_i_i, ICmpInst::ICMP_EQ, int32_459, const_int32_53, "");
+BranchInst::Create(label_bb_i_i_i, label_bb4_preheader_i_i_i, int1_457, 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_i6_i_i_i, label_bb3_i_i_i, int1_437, label_bb4_preheader_i_i_i);
+BranchInst::Create(label_Java_org_j3_mmtk_Lock_acquire___exit_i, label_bb3_i_i_i, int1_461, label_bb4_preheader_i_i_i);
 
 // Block bb3.i.i.i (label_bb3_i_i_i)
-CallInst* void_440 = CallInst::Create(func__ZN3mvm6Thread5yieldEv, "", label_bb3_i_i_i);
-void_440->setCallingConv(CallingConv::C);
-void_440->setTailCall(true);
-AttrListPtr void_440_PAL;
+CallInst* void_464 = CallInst::Create(func__ZN3mvm6Thread5yieldEv, "", label_bb3_i_i_i);
+void_464->setCallingConv(CallingConv::C);
+void_464->setTailCall(true);
+AttrListPtr void_464_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- void_440_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ void_464_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-void_440->setAttributes(void_440_PAL);
+void_464->setAttributes(void_464_PAL);
 
-std::vector<Value*> void_441_params;
-void_441_params.push_back(const_int1_94);
-void_441_params.push_back(const_int1_94);
-void_441_params.push_back(const_int1_94);
-void_441_params.push_back(const_int1_94);
-void_441_params.push_back(const_int1_94);
-CallInst* void_441 = CallInst::Create(func_llvm_memory_barrier, void_441_params.begin(), void_441_params.end(), "", label_bb3_i_i_i);
-void_441->setCallingConv(CallingConv::C);
-void_441->setTailCall(true);
-AttrListPtr void_441_PAL;
+std::vector<Value*> void_465_params;
+void_465_params.push_back(const_int1_93);
+void_465_params.push_back(const_int1_93);
+void_465_params.push_back(const_int1_93);
+void_465_params.push_back(const_int1_93);
+void_465_params.push_back(const_int1_93);
+CallInst* void_465 = CallInst::Create(func_llvm_memory_barrier, void_465_params.begin(), void_465_params.end(), "", label_bb3_i_i_i);
+void_465->setCallingConv(CallingConv::C);
+void_465->setTailCall(true);
+AttrListPtr void_465_PAL;
 {
  SmallVector<AttributeWithIndex, 4> 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_465_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-void_441->setAttributes(void_441_PAL);
+void_465->setAttributes(void_465_PAL);
 
-std::vector<Value*> int32_442_params;
-int32_442_params.push_back(ptr_425);
-int32_442_params.push_back(const_int32_55);
-int32_442_params.push_back(const_int32_76);
-CallInst* int32_442 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_442_params.begin(), int32_442_params.end(), "", label_bb3_i_i_i);
-int32_442->setCallingConv(CallingConv::C);
-int32_442->setTailCall(true);
-AttrListPtr int32_442_PAL;
+std::vector<Value*> int32_466_params;
+int32_466_params.push_back(ptr_449);
+int32_466_params.push_back(const_int32_53);
+int32_466_params.push_back(const_int32_74);
+CallInst* int32_466 = CallInst::Create(func_llvm_atomic_cmp_swap_i32_p0i32, int32_466_params.begin(), int32_466_params.end(), "", label_bb3_i_i_i);
+int32_466->setCallingConv(CallingConv::C);
+int32_466->setTailCall(true);
+AttrListPtr int32_466_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- int32_442_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ int32_466_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-int32_442->setAttributes(int32_442_PAL);
+int32_466->setAttributes(int32_466_PAL);
 
-std::vector<Value*> void_443_params;
-void_443_params.push_back(const_int1_94);
-void_443_params.push_back(const_int1_94);
-void_443_params.push_back(const_int1_94);
-void_443_params.push_back(const_int1_94);
-void_443_params.push_back(const_int1_94);
-CallInst* void_443 = CallInst::Create(func_llvm_memory_barrier, void_443_params.begin(), void_443_params.end(), "", label_bb3_i_i_i);
-void_443->setCallingConv(CallingConv::C);
-void_443->setTailCall(true);
-AttrListPtr void_443_PAL;
+std::vector<Value*> void_467_params;
+void_467_params.push_back(const_int1_93);
+void_467_params.push_back(const_int1_93);
+void_467_params.push_back(const_int1_93);
+void_467_params.push_back(const_int1_93);
+void_467_params.push_back(const_int1_93);
+CallInst* void_467 = CallInst::Create(func_llvm_memory_barrier, void_467_params.begin(), void_467_params.end(), "", label_bb3_i_i_i);
+void_467->setCallingConv(CallingConv::C);
+void_467->setTailCall(true);
+AttrListPtr void_467_PAL;
 {
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
- void_443_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
+ void_467_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
  
 }
-void_443->setAttributes(void_443_PAL);
+void_467->setAttributes(void_467_PAL);
+
+ICmpInst* int1_468 = new ICmpInst(*label_bb3_i_i_i, ICmpInst::ICMP_EQ, int32_466, const_int32_53, "");
+BranchInst::Create(label_Java_org_j3_mmtk_Lock_acquire___exit_i, label_bb3_i_i_i, int1_468, label_bb3_i_i_i);
 
-ICmpInst* int1_444 = new ICmpInst(*label_bb3_i_i_i, ICmpInst::ICMP_EQ, int32_442, const_int32_55, "");
-BranchInst::Create(label_true_IF_NULL_i1_i_i6_i_i_i, label_bb3_i_i_i, int1_444, label_bb3_i_i_i);
+// Block Java_org_j3_mmtk_Lock_acquire__.exit.i (label_Java_org_j3_mmtk_Lock_acquire___exit_i)
+ new StoreInst(int8_446, ptr_443, false, label_Java_org_j3_mmtk_Lock_acquire___exit_i);
+BranchInst::Create(label_true_IF_NULL_i1_i_i6_i_i_i, label_Java_org_j3_mmtk_Lock_acquire___exit_i);
 
-// Block false IFNE.i7.i.i11.i.i.i (label_false_IFNE_i7_i_i11_i_i_i)
-std::vector<Value*> ptr_446_indices;
-ptr_446_indices.push_back(const_int32_55);
-ptr_446_indices.push_back(const_int32_55);
-Instruction* ptr_446 = GetElementPtrInst::Create(ptr_416, ptr_446_indices.begin(), ptr_446_indices.end(), "", label_false_IFNE_i7_i_i11_i_i_i);
-CastInst* ptr__c_i6_i_i10_i_i_i = new IntToPtrInst(int32_268, PointerTy_29, ".c.i6.i.i10.i.i.i", label_false_IFNE_i7_i_i11_i_i_i);
- new StoreInst(ptr__c_i6_i_i10_i_i_i, ptr_446, false, label_false_IFNE_i7_i_i11_i_i_i);
-BranchInst::Create(label_GOTO_or_IF_1_i3_i_i8_i_i_i, label_false_IFNE_i7_i_i11_i_i_i);
+// Block false IFNE.i9.i.i13.i.i.i (label_false_IFNE_i9_i_i13_i_i_i)
+std::vector<Value*> ptr_472_indices;
+ptr_472_indices.push_back(const_int32_53);
+ptr_472_indices.push_back(const_int32_53);
+Instruction* ptr_472 = GetElementPtrInst::Create(ptr_432, ptr_472_indices.begin(), ptr_472_indices.end(), "", label_false_IFNE_i9_i_i13_i_i_i);
+CastInst* ptr__c_i8_i_i12_i_i_i = new IntToPtrInst(int32_267, PointerTy_27, ".c.i8.i.i12.i.i.i", label_false_IFNE_i9_i_i13_i_i_i);
+ new StoreInst(ptr__c_i8_i_i12_i_i_i, ptr_472, false, label_false_IFNE_i9_i_i13_i_i_i);
+BranchInst::Create(label_GOTO_or_IF_1_i5_i_i10_i_i_i, label_false_IFNE_i9_i_i13_i_i_i);
 
-// Block true IFNULL3.i8.i.i12.i.i.i (label_true_IFNULL3_i8_i_i12_i_i_i)
-GetElementPtrInst* ptr_449 = GetElementPtrInst::Create(ptr_421, const_int32_61, "", label_true_IFNULL3_i8_i_i12_i_i_i);
-CastInst* ptr_450 = new BitCastInst(ptr_449, PointerTy_25, "", label_true_IFNULL3_i8_i_i12_i_i_i);
- new StoreInst(const_int32_55, ptr_450, false, label_true_IFNULL3_i8_i_i12_i_i_i);
-BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_true_IFNULL3_i8_i_i12_i_i_i);
+// Block true IFNULL3.i10.i.i14.i.i.i (label_true_IFNULL3_i10_i_i14_i_i_i)
+CastInst* ptr_475 = new IntToPtrInst(int32_98, PointerTy_13, "", label_true_IFNULL3_i10_i_i14_i_i_i);
+std::vector<Value*> ptr_476_indices;
+ptr_476_indices.push_back(const_int32_53);
+ptr_476_indices.push_back(const_int32_69);
+Instruction* ptr_476 = GetElementPtrInst::Create(ptr_475, ptr_476_indices.begin(), ptr_476_indices.end(), "", label_true_IFNULL3_i10_i_i14_i_i_i);
+LoadInst* int8_477 = new LoadInst(ptr_476, "", false, label_true_IFNULL3_i10_i_i14_i_i_i);
+ICmpInst* int1_478 = new ICmpInst(*label_true_IFNULL3_i10_i_i14_i_i_i, ICmpInst::ICMP_NE, int8_477, const_int8_91, "");
+CastInst* int8_479 = new ZExtInst(int1_478, IntegerType::get(mod->getContext(), 8), "", label_true_IFNULL3_i10_i_i14_i_i_i);
+ new StoreInst(const_int8_86, ptr_476, false, label_true_IFNULL3_i10_i_i14_i_i_i);
+GetElementPtrInst* ptr_481 = GetElementPtrInst::Create(ptr_439, const_int32_59, "", label_true_IFNULL3_i10_i_i14_i_i_i);
+CastInst* ptr_482 = new BitCastInst(ptr_481, PointerTy_23, "", label_true_IFNULL3_i10_i_i14_i_i_i);
+ new StoreInst(const_int32_53, ptr_482, false, label_true_IFNULL3_i10_i_i14_i_i_i);
+ new StoreInst(int8_479, ptr_476, false, label_true_IFNULL3_i10_i_i14_i_i_i);
+BranchInst::Create(label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit, label_true_IFNULL3_i10_i_i14_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_453 = PHINode::Create(PointerTy_28, "", label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit);
-ptr_453->reserveOperandSpace(8);
-ptr_453->addIncoming(ptr_255, label_true_IFNULL3_i8_i_i12_i_i_i);
-ptr_453->addIncoming(ptr__ph16_i, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
-ptr_453->addIncoming(ptr_179, label_true_IFNULL3_i8_i_i_i_i_i);
-ptr_453->addIncoming(ptr__ph12_i, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
-ptr_453->addIncoming(ptr__ph8_i, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
-ptr_453->addIncoming(ptr__ph_i, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
-ptr_453->addIncoming(ptr_255, label_GOTO_or_IF_1_i3_i_i8_i_i_i);
-ptr_453->addIncoming(ptr_179, label_GOTO_or_IF_1_i3_i_i_i_i_i);
+PHINode* ptr_486 = PHINode::Create(PointerTy_26, "", label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit);
+ptr_486->reserveOperandSpace(8);
+ptr_486->addIncoming(ptr_254, label_true_IFNULL3_i10_i_i14_i_i_i);
+ptr_486->addIncoming(ptr__ph16_i, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread17_i);
+ptr_486->addIncoming(ptr_178, label_true_IFNULL3_i10_i_i_i_i_i);
+ptr_486->addIncoming(ptr__ph12_i, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread13_i);
+ptr_486->addIncoming(ptr__ph8_i, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread9_i);
+ptr_486->addIncoming(ptr__ph_i, label_JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII_exit_thread_i);
+ptr_486->addIncoming(ptr_254, label_GOTO_or_IF_1_i5_i_i10_i_i_i);
+ptr_486->addIncoming(ptr_178, label_GOTO_or_IF_1_i5_i_i_i_i_i);
 
-CastInst* ptr_tmp1 = new BitCastInst(ptr_453, PointerTy_0, "tmp1", label_JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2_exit);
+CastInst* ptr_tmp1 = new BitCastInst(ptr_486, 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);
 
 // Resolve Forward References
-fwdref_383->replaceAllUsesWith(int32_385); delete fwdref_383;
-fwdref_381->replaceAllUsesWith(int1_390); delete fwdref_381;
-fwdref_430->replaceAllUsesWith(int32_432); delete fwdref_430;
-fwdref_428->replaceAllUsesWith(int1_437); delete fwdref_428;
+fwdref_390->replaceAllUsesWith(int32_392); delete fwdref_390;
+fwdref_388->replaceAllUsesWith(int1_397); delete fwdref_388;
+fwdref_372->replaceAllUsesWith(ptr__c_i8_i_i_i_i_i); delete fwdref_372;
+fwdref_454->replaceAllUsesWith(int32_456); delete fwdref_454;
+fwdref_452->replaceAllUsesWith(int1_461); delete fwdref_452;
+fwdref_436->replaceAllUsesWith(ptr__c_i8_i_i12_i_i_i); delete fwdref_436;
 return func_gcmalloc;
 }

Modified: vmkit/trunk/mmtk/config/marksweep/ObjectHeader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/config/marksweep/ObjectHeader.h?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/config/marksweep/ObjectHeader.h (original)
+++ vmkit/trunk/mmtk/config/marksweep/ObjectHeader.h Sat Nov 27 04:07:18 2010
@@ -24,12 +24,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 uint64_t HashMask = 0xF00;
+  static const uint64_t GCBitMask = 0xFF;
 
   static const uint32_t NonLockBits = 12;
   static const uint32_t HashBits = 0;
-  static const uint32_t GCBits = 4;
+  static const uint32_t GCBits = 8;
 
   static const bool MovesObject = false;
 }

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=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/java/src/org/j3/mmtk/Barriers.java (original)
+++ vmkit/trunk/mmtk/java/src/org/j3/mmtk/Barriers.java Sat Nov 27 04:07:18 2010
@@ -600,7 +600,8 @@
   @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));
+    // Add 3 for the header, the class, and the length.
+    Address slot = base.plus(Offset.fromIntZeroExtend((index + 3) << LOG_BYTES_IN_ADDRESS));
     VM.activePlan.global().storeObjectReference(slot, ObjectReference.fromObject(value));
   }
 }

Modified: vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp Sat Nov 27 04:07:18 2010
@@ -51,7 +51,7 @@
 
 extern "C" void* gcmalloc(uint32_t sz, void* VT) {
   sz = llvm::RoundUpToAlignment(sz, sizeof(void*));
-  return JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2(sz, VT);
+  return (gc*)JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2(sz, VT);
 }
 
 extern "C" void addFinalizationCandidate(void* obj) __attribute__((always_inline));
@@ -84,14 +84,26 @@
 }
 
 void Collector::scanObject(void** ptr, uintptr_t closure) {
+  if ((*ptr) != NULL) {
+    assert(((gc*)(*ptr))->getVirtualTable());
+  }
   JnJVM_org_j3_bindings_Bindings_reportDelayedRootEdge__Lorg_mmtk_plan_TraceLocal_2Lorg_vmmagic_unboxed_Address_2(closure, ptr);
 }
  
 void Collector::markAndTrace(void* source, void* ptr, uintptr_t closure) {
+  void** ptr_ = (void**)ptr;
+  if ((*ptr_) != NULL) {
+    assert(((gc*)(*ptr_))->getVirtualTable());
+  }
+  if ((*(void**)ptr) != NULL) assert(((gc*)(*(void**)ptr))->getVirtualTable());
   JnJVM_org_j3_bindings_Bindings_processEdge__Lorg_mmtk_plan_TransitiveClosure_2Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Address_2(closure, source, ptr);
 }
   
 void Collector::markAndTraceRoot(void* ptr, uintptr_t closure) {
+  void** ptr_ = (void**)ptr;
+  if ((*ptr_) != NULL) {
+    assert(((gc*)(*ptr_))->getVirtualTable());
+  }
   JnJVM_org_j3_bindings_Bindings_processRootEdge__Lorg_mmtk_plan_TraceLocal_2Lorg_vmmagic_unboxed_Address_2Z(closure, ptr, true);
 }
 
@@ -127,7 +139,7 @@
 #else
   uint32 flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED;
 #endif
-  void* baseAddr = mmap((void*)0x30000000, 0x40000000, PROT_READ | PROT_WRITE,
+  void* baseAddr = mmap((void*)0x30000000, 0x30000000, PROT_READ | PROT_WRITE,
                         flags, -1, 0);
   if (baseAddr == MAP_FAILED) {
     perror("mmap");
@@ -138,7 +150,7 @@
 }
 
 extern "C" void* MMTkMutatorAllocate(uint32_t size, VirtualTable* VT) {
-  void* val = MutatorThread::get()->Allocator.Allocate(size, "MMTk");
+  void* val = MutatorThread::get()->Allocator.Allocate(size);
   ((void**)val)[0] = VT;
   return val;
 }

Modified: vmkit/trunk/mmtk/mmtk-j3/Assert.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Assert.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/Assert.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/Assert.cpp Sat Nov 27 04:07:18 2010
@@ -15,4 +15,4 @@
 
 using namespace j3;
 
-extern "C" void Java_org_j3_mmtk_Assert_dumpStack__ () { UNIMPLEMENTED(); }
+extern "C" void Java_org_j3_mmtk_Assert_dumpStack__ (JavaObject* self) { UNIMPLEMENTED(); }

Modified: vmkit/trunk/mmtk/mmtk-j3/Collection.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Collection.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/Collection.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/Collection.cpp Sat Nov 27 04:07:18 2010
@@ -81,10 +81,6 @@
     }
 
     th->MyVM->rendezvous.finishRV();
-  
-    th->MyVM->wakeUpFinalizers();
-    th->MyVM->wakeUpEnqueue();
-    
     th->MyVM->endCollection();
   }
 

Modified: vmkit/trunk/mmtk/mmtk-j3/Lock.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Lock.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/Lock.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/Lock.cpp Sat Nov 27 04:07:18 2010
@@ -25,10 +25,16 @@
 
 
 extern "C" void Java_org_j3_mmtk_Lock_acquire__(Lock* l) {
+  bool saved = mvm::Thread::get()->inRV;
+  mvm::Thread::get()->inRV = true;
   l->spin.acquire();
+  mvm::Thread::get()->inRV = saved;
 }
-extern "C" void Java_org_j3_mmtk_Lock_check__I () { UNIMPLEMENTED(); }
+extern "C" void Java_org_j3_mmtk_Lock_check__I (Lock* l, int i) { UNIMPLEMENTED(); }
 
 extern "C" void Java_org_j3_mmtk_Lock_release__(Lock* l) {
+  bool saved = mvm::Thread::get()->inRV;
+  mvm::Thread::get()->inRV = true;
   l->spin.release();
+  mvm::Thread::get()->inRV = saved;
 }

Modified: vmkit/trunk/mmtk/mmtk-j3/MMTk_Events.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/MMTk_Events.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/MMTk_Events.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/MMTk_Events.cpp Sat Nov 27 04:07:18 2010
@@ -17,21 +17,21 @@
 
 extern "C" void Java_org_j3_mmtk_MMTk_1Events_tracePageAcquired__Lorg_mmtk_policy_Space_2Lorg_vmmagic_unboxed_Address_2I(
     JavaObject* event, JavaObject* space, uintptr_t address, int numPages) {
-#ifdef DEBUG
+#if 0
   fprintf(stderr, "Pages acquired by thread %p from space %p at %x (%d)\n", (void*)mvm::Thread::get(), (void*)space, address, numPages);
 #endif
 }
 
 extern "C" void Java_org_j3_mmtk_MMTk_1Events_tracePageReleased__Lorg_mmtk_policy_Space_2Lorg_vmmagic_unboxed_Address_2I(
     JavaObject* event, JavaObject* space, uintptr_t address, int numPages) {
-#ifdef DEBUG
+#if 0
   fprintf(stderr, "Pages released by thread %p from space %p at %x (%d)\n", (void*)mvm::Thread::get(), (void*)space, address, numPages);
 #endif
 }
 
 extern "C" void Java_org_j3_mmtk_MMTk_1Events_heapSizeChanged__Lorg_vmmagic_unboxed_Extent_2(
     JavaObject* event, uintptr_t heapSize) {
-#ifdef DEBUG
+#if 0
   fprintf(stderr, "New heap size : %d\n", (int)heapSize);
 #endif
 }

Modified: vmkit/trunk/mmtk/mmtk-j3/Memory.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Memory.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/Memory.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/Memory.cpp Sat Nov 27 04:07:18 2010
@@ -22,7 +22,7 @@
 }
 
 extern "C" uintptr_t Java_org_j3_mmtk_Memory_getHeapEndConstant__ (JavaObject* M) {
-  return (uintptr_t)0x70000000;
+  return (uintptr_t)0x60000000;
 }
 
 extern "C" uintptr_t Java_org_j3_mmtk_Memory_getAvailableStartConstant__ (JavaObject* M) {
@@ -30,7 +30,7 @@
 }
 
 extern "C" uintptr_t Java_org_j3_mmtk_Memory_getAvailableEndConstant__ (JavaObject* M) {
-  return (uintptr_t)0x70000000;
+  return (uintptr_t)0x60000000;
 }
 
 extern "C" sint32
@@ -41,14 +41,16 @@
   return 0;
 }
 
-extern "C" void
+extern "C" uint8_t
 Java_org_j3_mmtk_Memory_mprotect__Lorg_vmmagic_unboxed_Address_2I (JavaObject* M, uintptr_t address, sint32 size) {
-  mprotect((void*)address, size, PROT_NONE);
+  int val = mprotect((void*)address, size, PROT_NONE);
+  return (val == 0);
 }
 
-extern "C" void
+extern "C" uint8_t
 Java_org_j3_mmtk_Memory_munprotect__Lorg_vmmagic_unboxed_Address_2I (JavaObject* M, uintptr_t address, sint32 size) {
-  mprotect((void*)address, size, PROT_READ | PROT_WRITE);
+  int val = mprotect((void*)address, size, PROT_READ | PROT_WRITE);
+  return (val == 0);
 }
 
 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=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/ObjectModel.cpp Sat Nov 27 04:07:18 2010
@@ -10,6 +10,7 @@
 #include "JavaArray.h"
 #include "JavaClass.h"
 #include "JavaObject.h"
+#include "JavaString.h"
 #include "JavaThread.h"
 
 #include "debug.h"
@@ -137,8 +138,42 @@
 extern "C" void Java_org_j3_mmtk_ObjectModel_getNextObject__Lorg_vmmagic_unboxed_ObjectReference_2 (
     JavaObject* OM, uintptr_t object) { UNIMPLEMENTED(); }
 
-extern "C" void Java_org_j3_mmtk_ObjectModel_getTypeDescriptor__Lorg_vmmagic_unboxed_ObjectReference_2 (
-    JavaObject* OM, uintptr_t object) { UNIMPLEMENTED(); }
+
+class FakeByteArray {
+ public:
+  void* operator new(size_t size, int length) {
+    return new char[size + length];
+  }
+
+  FakeByteArray(const char* name) {
+    length = strlen(name);
+    for (uint32 i = 0; i < length; i++) {
+      elements[i] = name[i];
+    }
+  }
+  
+  FakeByteArray(const UTF8* name) {
+    length = name->size;
+    for (uint32 i = 0; i < length; i++) {
+      elements[i] = name->elements[i];
+    }
+  }
+ private:
+  JavaObject header;
+  size_t length;
+  uint8_t elements[1];
+};
+
+extern "C" FakeByteArray* Java_org_j3_mmtk_ObjectModel_getTypeDescriptor__Lorg_vmmagic_unboxed_ObjectReference_2 (
+    JavaObject* OM, JavaObject* src) {
+  if (VMClassLoader::isVMClassLoader(src)) {
+    return new (14) FakeByteArray("VMClassLoader");
+  } else {
+    CommonClass* cl = JavaObject::getClass(src);
+    return new (cl->name->size) FakeByteArray(cl->name);
+  }
+}
+
 
 extern "C" void Java_org_j3_mmtk_ObjectModel_getArrayLength__Lorg_vmmagic_unboxed_ObjectReference_2 (
     JavaObject* OM, uintptr_t object) { UNIMPLEMENTED(); }

Modified: vmkit/trunk/mmtk/mmtk-j3/RuntimeHelpers.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/RuntimeHelpers.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/RuntimeHelpers.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/RuntimeHelpers.cpp Sat Nov 27 04:07:18 2010
@@ -14,11 +14,9 @@
 using namespace j3;
 
 extern "C" uint16_t MMTkCharAt(JavaString* str, uint32_t index) {
-  llvm_gcroot(str, 0);
-  return ArrayUInt16::getElement(JavaString::getValue(str), index);
+  return str->value->elements[index];
 }
 
 extern "C" JavaObject* MMTkGetClass(JavaObject* obj) {
-  llvm_gcroot(obj, 0);
-  return JavaObject::getClass(obj)->delegatee[0];
+  return ((JavaVirtualTable*)obj->getVirtualTable())->cl->delegatee[0];
 }

Modified: vmkit/trunk/mmtk/mmtk-j3/Scanning.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Scanning.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/Scanning.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/Scanning.cpp Sat Nov 27 04:07:18 2010
@@ -20,11 +20,10 @@
   // When entering this function, all threads are waiting on the rendezvous to
   // finish.
   mvm::Thread* th = mvm::Thread::get();
-  mvm::StackScanner* sc = th->MyVM->getScanner();  
   mvm::Thread* tcur = th;
   
   do {
-    sc->scanStack(tcur, reinterpret_cast<uintptr_t>(TL));
+    tcur->scanStack(reinterpret_cast<uintptr_t>(TL));
     tcur = (mvm::Thread*)tcur->next();
   } while (tcur != th);
 }
@@ -39,7 +38,6 @@
     tcur->tracer(reinterpret_cast<uintptr_t>(TL));
     tcur = (mvm::Thread*)tcur->next();
   } while (tcur != th);
-
 }
 
 extern "C" void Java_org_j3_mmtk_Scanning_computeStaticRoots__Lorg_mmtk_plan_TraceLocal_2 (JavaObject* Scanning, JavaObject* TL) {

Modified: vmkit/trunk/mmtk/mmtk-j3/Strings.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Strings.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/Strings.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/Strings.cpp Sat Nov 27 04:07:18 2010
@@ -17,23 +17,18 @@
 extern "C" void Java_org_j3_mmtk_Strings_write___3CI(JavaObject* str,
                                                      ArrayUInt16* msg,
                                                      sint32 len) {
-  llvm_gcroot(str, 0);
-  llvm_gcroot(msg, 0);
   for (sint32 i = 0; i < len; ++i) {
-    fprintf(stderr, "%c", ArrayUInt16::getElement(msg, i));
+    fprintf(stderr, "%c", msg->elements[i]);
   }
 }
 
 extern "C" void Java_org_j3_mmtk_Strings_writeThreadId___3CI(JavaObject* str,
                                                              ArrayUInt16* msg,
                                                              sint32 len) {
-  llvm_gcroot(str, 0);
-  llvm_gcroot(msg, 0);
-  
   fprintf(stderr, "[%p] ", (void*)JavaThread::get());
   
   for (sint32 i = 0; i < len; ++i) {
-    fprintf(stderr, "%c", ArrayUInt16::getElement(msg, i));
+    fprintf(stderr, "%c", msg->elements[i]);
   }
 }
 
@@ -42,16 +37,12 @@
 Java_org_j3_mmtk_Strings_copyStringToChars__Ljava_lang_String_2_3CII(
     JavaObject* obj, JavaString* str, ArrayUInt16* dst, uint32 dstBegin,
     uint32 dstEnd) {
-  llvm_gcroot(str, 0);
-  llvm_gcroot(obj, 0);
-  llvm_gcroot(dst, 0);
 
   sint32 len = str->count;
   sint32 n = (dstBegin + len <= dstEnd) ? len : (dstEnd - dstBegin);
 
   for (sint32 i = 0; i < n; i++) {
-    ArrayUInt16::setElement(dst,
-        ArrayUInt16::getElement(JavaString::getValue(str), str->offset + i), dstBegin + i);
+    dst->elements[dstBegin + i] = str->value->elements[str->offset + i];
   }
   
   return n;

Modified: vmkit/trunk/mmtk/mmtk-j3/SynchronizedCounter.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/SynchronizedCounter.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/SynchronizedCounter.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/SynchronizedCounter.cpp Sat Nov 27 04:07:18 2010
@@ -15,6 +15,6 @@
 
 using namespace j3;
 
-extern "C" void Java_org_j3_mmtk_SynchronizedCounter_reset__ () { UNIMPLEMENTED(); }
-extern "C" void Java_org_j3_mmtk_SynchronizedCounter_increment__ () { UNIMPLEMENTED(); }
+extern "C" void Java_org_j3_mmtk_SynchronizedCounter_reset__ (JavaObject* self) { UNIMPLEMENTED(); }
+extern "C" void Java_org_j3_mmtk_SynchronizedCounter_increment__ (JavaObject* self) { UNIMPLEMENTED(); }
 

Modified: vmkit/trunk/mmtk/mmtk-j3/VM.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/VM.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/VM.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/VM.cpp Sat Nov 27 04:07:18 2010
@@ -58,6 +58,10 @@
 }
 
 extern "C" bool Java_org_j3_runtime_VM_verifyAssertions__ () {
+  // Note that DEBUG is defined in make ENABLE_OPTIMIZED=1.
+  // You must provide DISABLE_ASSERTIONS=1 to not have DEBUG defined.
+  // To generate MMTkInline.inc, you need to have this function return
+  // false.
 #ifdef DEBUG
   return true;
 #else

Modified: vmkit/trunk/tools/vmjc/vmjc.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/vmjc/vmjc.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/tools/vmjc/vmjc.cpp (original)
+++ vmkit/trunk/tools/vmjc/vmjc.cpp Sat Nov 27 04:07:18 2010
@@ -178,15 +178,16 @@
 
   mvm::Collector::initialise();
 
-  JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp, false);
+  mvm::BumpPtrAllocator allocator;
+  JnjvmBootstrapLoader* loader = new(allocator, "Bootstrap loader")
+    JnjvmBootstrapLoader(allocator, Comp, false);
 
   if (DisableExceptions) Comp->disableExceptions();
   if (DisableStubs) Comp->generateStubs = false;
   if (AssumeCompiled) Comp->assumeCompiled = true;
   if (DisableCooperativeGC) Comp->disableCooperativeGC();
     
-  mvm::BumpPtrAllocator A;
-  Jnjvm* vm = new(A, "Bootstrap loader") Jnjvm(A, (JnjvmBootstrapLoader*)JCL);
+  Jnjvm* vm = new(allocator, "Bootstrap loader") Jnjvm(allocator, loader);
   
   for (std::vector<std::string>::iterator i = Properties.begin(),
        e = Properties.end(); i != e; ++i) {

Modified: vmkit/trunk/tools/vmkit/Launcher.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/vmkit/Launcher.cpp?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/tools/vmkit/Launcher.cpp (original)
+++ vmkit/trunk/tools/vmkit/Launcher.cpp Sat Nov 27 04:07:18 2010
@@ -26,6 +26,8 @@
 #include "mvm/Threads/Thread.h"
 
 #include "j3/JavaJITCompiler.h"
+#include "../../lib/J3/VMCore/JnjvmClassLoader.h"
+#include "../../lib/J3/VMCore/Jnjvm.h"
 
 #include "CommandLine.h"
 
@@ -33,14 +35,12 @@
 using namespace llvm;
 
 enum VMType {
-  Interactive, RunJava, RunNet
+  RunJava
 };
 
 static llvm::cl::opt<VMType> VMToRun(llvm::cl::desc("Choose VM to run:"),
   llvm::cl::values(
-    clEnumValN(Interactive , "i", "Run in interactive mode"),
     clEnumValN(RunJava , "java", "Run the JVM"),
-    clEnumValN(RunNet, "net", "Run the CLI VM"),
    clEnumValEnd));
 
 static llvm::cl::opt<bool> Fast("fast", 
@@ -57,55 +57,26 @@
 }
 
 int main(int argc, char** argv) {
-  // Disable the lcean shutdown, as deamon threads may still
-  // continue to execute and use LLVM things.
-  //llvm::llvm_shutdown_obj X;
-  
+  llvm::llvm_shutdown_obj X;
   int pos = found(argv, argc, "-java");
   if (pos) {
     llvm::cl::ParseCommandLineOptions(pos, argv);
   } else {
-    pos = found(argv, argc, "-net");
-    if (pos) {
-      llvm::cl::ParseCommandLineOptions(pos, argv);
-    } else {
-      llvm::cl::ParseCommandLineOptions(argc, argv);
-    }
+    fprintf(stderr, "Only -java is supported\n");
+    return 0;
   }
   
   mvm::MvmModule::initialise(Fast ? CodeGenOpt::None : CodeGenOpt::Aggressive);
   mvm::Collector::initialise();
 
   if (VMToRun == RunJava) {
-#if WITH_J3
+    mvm::BumpPtrAllocator Allocator;
     JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule");
-    JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp);
-    mvm::VirtualMachine* vm = mvm::VirtualMachine::createJVM(JCL);
-    vm->runApplication(argc, argv);
-    vm->waitForExit();
-#endif
-  } else if (VMToRun == RunNet) {
-#if WITH_N3
-    mvm::CompilationUnit* CU = mvm::VirtualMachine::initialiseCLIVM();
-    mvm::VirtualMachine* vm = mvm::VirtualMachine::createCLIVM(CU);
+    JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader")
+        JnjvmBootstrapLoader(Allocator, Comp, true);
+    Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader);
     vm->runApplication(argc, argv);
     vm->waitForExit();
-#endif
-  } else {
-    mvm::CommandLine MyCl;
-#if WITH_J3
-    JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule");
-    JnjvmClassLoader* JCL = mvm::VirtualMachine::initialiseJVM(Comp);
-    MyCl.vmlets["java"] = (create_vm_t)(mvm::VirtualMachine::createJVM);
-    MyCl.compilers["java"] = (mvm::Object*)JCL;
-#endif
-#if WITH_N3
-    mvm::CompilationUnit* CLICompiler = 
-      mvm::VirtualMachine::initialiseCLIVM();
-    MyCl.vmlets["net"] = (create_vm_t)(mvm::VirtualMachine::createCLIVM);
-    MyCl.compilers["net"] = (mvm::Object*)CLICompiler;
-#endif
-    MyCl.start();
   }
 
   return 0;

Modified: vmkit/trunk/www/get_started.html
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/www/get_started.html?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/www/get_started.html (original)
+++ vmkit/trunk/www/get_started.html Sat Nov 27 04:07:18 2010
@@ -24,27 +24,19 @@
 
 <h2>A word of warning</h2>
 
-<p>While this work aims to provide a fully functional JVM and CLI runtime, it
+<p>While this work aims to provide a fully functional JVM, it
 is <em>still early work</em> and is under heavy development. 
-<p>Some of the more notable missing pieces in the CLI runtime are:</p>
-
-<ol>
-  <li>Support for arithmetic overflow.</li>
-  <li>Support for CLI object finalization semantics.</li>
-  <li>Thread support.</li>
-</ol>
-
 <p>Some of the common missing pieces in vmkit/llvm are:</p>
 
 <ol>
-  <li>Hotspot-like virtual machine (e.g mixed interpretation/compilation).</li>
+  <li> Mixed interpretation/compilation.</li>
+  <li> Adaptive optimization.</li>
 </ol>
 
 <h2 id="build">Building vmkit / working with the code</h2>
 
 <p>If you would like to check out and build the project, the current scheme
-is (if you only want the JVM, you can skip the Pnet part. If you only want the CLI
-VM, you can skip the GNU Classpath part):</p>
+is:</p>
 
 <ol>
   <li><a href="http://www.llvm.org/docs/GettingStarted.html#checkout">Checkout
@@ -89,22 +81,6 @@
     </ul>
   </ul>
   
-  <li><a href="http://download.savannah.gnu.org/releases/dotgnu-pnet/pnet-0.8.0.tar.gz">Download
-   PNet 0.8.0</a>:</li>
-   <ul>
-    <li><tt>tar zxvf pnet-0.8.0.tar.gz</tt></li>
-    <li><tt>cd pnet-0.8.0</tt></li>
-    <li><tt>./configure; make</tt></li>
-   </ul>
-  
-  <li><a href="http://download.savannah.gnu.org/releases/dotgnu-pnet/pnetlib-0.8.0.tar.gz">Download
-   PNetlib 0.8.0</a>:</li>
-   <ul>
-    <li><tt>tar zxvf pnetlib-0.8.0.tar.gz</tt></li>
-    <li><tt>cd pnetlib-0.8.0</tt></li>
-    <li><tt>./configure; make</tt></li>
-   </ul>
-
   <li>Checkout vmkit:</li>
   <ul>
      <li><tt>svn co http://llvm.org/svn/llvm-project/vmkit/trunk vmkit</tt></li>
@@ -122,10 +98,6 @@
     <dd>Tell vmkit where GNU Classpath glibj.zip is located.</dd>
     <dt><br/><tt>--with-gnu-classpath-libs=<directory></tt></dt>
     <dd>Tell vmkit where GNU Classpath libs are located.</dd>
-    <dt><br/><tt>--with-pnet-local-prefix=<directory></tt></dt>
-    <dd>Tell vmkit where PNet is located.</dd>
-    <dt><br/><tt>--with-pnetlib=<directory></tt></dt>
-    <dd>Tell vmkit where pnetlib's mscorlib.dll is located.</dd>
   </dl>
 
   </ul>
@@ -140,8 +112,6 @@
   <ul>
     <li><tt>j3 --help</tt></li>
     <li><tt>j3 HelloWorld</tt></li>
-    <li><tt>n3-pnetlib --help</tt></li>
-    <li><tt>n3-pnetlib HelloWorld.exe</tt></li>
   </ul>
 </ol>
 

Modified: vmkit/trunk/www/index.html
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/www/index.html?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/www/index.html (original)
+++ vmkit/trunk/www/index.html Sat Nov 27 04:07:18 2010
@@ -4,7 +4,7 @@
 <html>
 <head>
   <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-  <title>"VMKit" JVM and .Net runtimes for LLVM</title>
+  <title>VMKit: a substrate for virtual machines</title>
   <link type="text/css" rel="stylesheet" href="menu.css" />
   <link type="text/css" rel="stylesheet" href="content.css" />
 </head>
@@ -12,16 +12,15 @@
 <!--#include virtual="menu.html.incl"-->
 <div id="content">
   <!--*********************************************************************-->
-  <h1>VMKit: JVM and .Net runtimes for LLVM</h1>
+  <h1>VMKit: a substrate for virtual machines</h1>
   <!--*********************************************************************-->
   
-  <p>The VMKit project is an implementation of a JVM and CLI virtual machine
-  (.Net is an implementation of the CLI). It translates Java bytecode and
-  MSIL in the LLVM IR and uses the <a href="http://llvm.org">LLVM framework</a>
-  for optimizations and compilation. For garbage collection, it uses
-  <a href="http://jikesrvm.org/MMTk">MMTk</a>.
-  You can <a href="get_started.html">get and build</a> the
-  source today.</p>
+  <p>The VMKit project is a framework for building virtual machines. It uses
+  <a href="http://llvm.org">LLVM</a> for compiling and optimizing high-level
+  languages to machine code, and <a href="http://jikesrvm.org/MMTk">MMTk</a>
+  to manage memory. J3 is an implementation of a JVM with VMKit.
+  You can <a href="get_started.html">get and build</a> the source of J3
+  today.</p>
   
   <!--=====================================================================-->
   <h2 id="goals">Features</h2>
@@ -32,7 +31,6 @@
   <p><b>End-User Features</a></b>:</p>
   
   <ul>
-  <li>Runs any Java and .Net applications on MacOSX and Unix-based systems.</li>
   <li>Precise garbage collection.</li>
   <li>Just-in-Time and Ahead-of-Time compilation.</li>
   <li>Portable on many architectures (x86, x64, ppc32, ppc64, arm).</li>
@@ -85,20 +83,14 @@
   <h2>Current Status</h2>
   <!--=====================================================================-->
   
-  <p>VMKit is still in its early development stages. If you are looking to
-     experiment virtual machine technologies, VMKit is probably a great solution
-     for you.  If you want to use it as a drop in JVM or .Net, it is not yet
-     ready.</p>
-
-  <p>VMKit currently has a decent implementation of the JVM. It executes
+  <p>VMKit currently has a decent implementation of a JVM. It executes
      large projects (e.g. OSGi Felix, Tomcat, Eclipse) and the
      <a href="http://dacapobench.org">DaCapo benchmarks</a>.
-     The CLI implementation is still in its early stages, but can execute
-     simple applications.</p>
+  </p>
      
   <p>The JVM has been tested on Linux/x64, Linux/x86, Linux/ppc32, MacOSX/x64,
      MacOSX/x86, MacOSX/ppc32. The JVM may work on ppc64. Support for
-     Windows has not been investigated
+     Windows has not been investigated.
   </p>
 
   

Modified: vmkit/trunk/www/use_aot.html
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/www/use_aot.html?rev=120206&r1=120205&r2=120206&view=diff
==============================================================================
--- vmkit/trunk/www/use_aot.html (original)
+++ vmkit/trunk/www/use_aot.html Sat Nov 27 04:07:18 2010
@@ -29,8 +29,7 @@
 
   <ul>
     <li><tt>cd tools/vmjc/libvmjc</tt></li>
-    <li><tt>make ENABLE_OPTIMIZED=1 REQUIRES_FRAME_POINTER=1
-      (go get coffee)</tt></li>
+    <li><tt>make ENABLE_OPTIMIZED=1 (go get coffee)</tt></li>
   </ul>
   
   <li>Update PATH to include LLVM and VMKit binaries (replace *_OBJ with your





More information about the vmkit-commits mailing list