[vmkit-commits] [vmkit] r86491 - in /vmkit/trunk: Makefile.rules mmtk/Makefile mmtk/mmtk-fake/ mmtk/mmtk-fake/Makefile mmtk/mmtk-fake/Selected.cpp mmtk/mmtk-j3/Selected.cpp mmtk/mmtk-j3/VM.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sun Nov 8 15:49:22 PST 2009
Author: geoffray
Date: Sun Nov 8 17:49:21 2009
New Revision: 86491
URL: http://llvm.org/viewvc/llvm-project?rev=86491&view=rev
Log:
Call MMTk functions directly on allocations.
Added:
vmkit/trunk/mmtk/mmtk-fake/
vmkit/trunk/mmtk/mmtk-fake/Makefile
vmkit/trunk/mmtk/mmtk-fake/Selected.cpp
Modified:
vmkit/trunk/Makefile.rules
vmkit/trunk/mmtk/Makefile
vmkit/trunk/mmtk/mmtk-j3/Selected.cpp
vmkit/trunk/mmtk/mmtk-j3/VM.cpp
Modified: vmkit/trunk/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.rules?rev=86491&r1=86490&r2=86491&view=diff
==============================================================================
--- vmkit/trunk/Makefile.rules (original)
+++ vmkit/trunk/Makefile.rules Sun Nov 8 17:49:21 2009
@@ -127,7 +127,7 @@
ifdef RUN_ANT
ifdef ANT
-ADDITIONAL_ARGS := -load-bc=$(LibDir)/MMTKRuntime.bc
+ADDITIONAL_ARGS := -load-bc=$(LibDir)/MMTKRuntime.bc -load-bc=$(LibDir)/MMTKFake.bc
all::
$(Verb) $(ANT)
@@ -135,6 +135,8 @@
$(Verb) $(LOPT) -load=$(LibDir)/JITGCPass$(SHLIBEXT) -std-compile-opts -JITGCPass -f $(LibDir)/MMTKRuntime.bc -o $(LibDir)/MMTKRuntime.bc
$(Verb) $(VMJC) -std-compile-opts $(ADDITIONAL_ARGS) -load=$(LibDir)/MMTKMagic$(SHLIBEXT) -LowerMagic -verify $(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=vmkit.properties -disable-stubs -assume-compiled
$(Verb) $(LOPT) -load=$(LibDir)/MMTKMagic$(SHLIBEXT) -std-compile-opts -LowerJavaRT -f $(JARNAME).bc -o $(JARNAME)-optimized.bc
+ $(Verb) $(LLVMLD) -r -o $(LibDir)/FinalMMTk.bc $(JARNAME)-optimized.bc $(LibDir)/MMTKRuntime.bc
+ $(Verb) $(LOPT) -std-compile-opts $(LibDir)/FinalMMTk.bc -o $(LibDir)/FinalMMTk.bc
endif
Modified: vmkit/trunk/mmtk/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/Makefile?rev=86491&r1=86490&r2=86491&view=diff
==============================================================================
--- vmkit/trunk/mmtk/Makefile (original)
+++ vmkit/trunk/mmtk/Makefile Sun Nov 8 17:49:21 2009
@@ -8,7 +8,7 @@
##===----------------------------------------------------------------------===##
LEVEL = ..
-DIRS = magic mmtk-j3 java
+DIRS = magic mmtk-j3 mmtk-fake java
include $(LEVEL)/Makefile.config
Added: vmkit/trunk/mmtk/mmtk-fake/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-fake/Makefile?rev=86491&view=auto
==============================================================================
--- vmkit/trunk/mmtk/mmtk-fake/Makefile (added)
+++ vmkit/trunk/mmtk/mmtk-fake/Makefile Sun Nov 8 17:49:21 2009
@@ -0,0 +1,26 @@
+##===- mmtk/mmtk-j3/Makefile -------------------------------*- Makefile -*-===##
+#
+# The vmkit project
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../..
+
+include $(LEVEL)/Makefile.config
+
+ifeq ($(WITH_LLVM_GCC), 1)
+ MODULE_NAME = MMTKFake
+else
+ LIBRARYNAME = MMTKFake
+endif
+
+LOADABLE_MODULE = 1
+USEDLIBS =
+
+CXX.Flags += -I$(PROJ_OBJ_DIR)/../../lib/JnJVM/VMCore
+
+include $(LEVEL)/Makefile.common
+
Added: vmkit/trunk/mmtk/mmtk-fake/Selected.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-fake/Selected.cpp?rev=86491&view=auto
==============================================================================
--- vmkit/trunk/mmtk/mmtk-fake/Selected.cpp (added)
+++ vmkit/trunk/mmtk/mmtk-fake/Selected.cpp Sun Nov 8 17:49:21 2009
@@ -0,0 +1,30 @@
+//===-------- Selected.cpp - Implementation of the Selected class --------===//
+//
+// The VMKit project
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "JavaArray.h"
+#include "JavaClass.h"
+#include "JavaObject.h"
+#include "JavaThread.h"
+#include "MutatorThread.h"
+
+using namespace jnjvm;
+
+extern "C" gc* internalMalloc(uintptr_t Mutator, int32_t sz, int32_t align,
+ int32_t offset, int32_t allocator,
+ int32_t site);
+
+
+extern "C" void* JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII(uintptr_t Mutator, int32_t sz, int32_t align, int32_t offset, int32_t allocator, int32_t site) {
+ return internalMalloc(Mutator, sz, align, offset, allocator, site);
+}
+extern "C" int32_t JnJVM_org_mmtk_plan_MutatorContext_checkAllocator__III(uintptr_t Mutator, int32_t bytes, int32_t align, int32_t allocator) {
+ return allocator;
+}
+extern "C" void JnJVM_org_mmtk_plan_marksweep_MSMutator_postAlloc__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2II(uintptr_t Mutator, uintptr_t ref, uintptr_t typeref,
+ int32_t bytes, int32_t allocator) {}
Modified: vmkit/trunk/mmtk/mmtk-j3/Selected.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Selected.cpp?rev=86491&r1=86490&r2=86491&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/Selected.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/Selected.cpp Sun Nov 8 17:49:21 2009
@@ -18,3 +18,27 @@
extern "C" JavaObject* Java_org_j3_config_Selected_00024Mutator_get__() {
return (JavaObject*)mvm::MutatorThread::get()->MutatorContext;
}
+
+
+
+extern "C" void* JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII(uintptr_t Mutator, int32_t sz, int32_t align, int32_t offset, int32_t allocator, int32_t site) __attribute__((always_inline));
+extern "C" int32_t JnJVM_org_mmtk_plan_MutatorContext_checkAllocator__III(uintptr_t Mutator, int32_t bytes, int32_t align, int32_t allocator) __attribute__((always_inline));
+extern "C" void JnJVM_org_mmtk_plan_marksweep_MSMutator_postAlloc__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2II(uintptr_t Mutator, uintptr_t ref, uintptr_t typeref,
+ int32_t bytes, int32_t allocator) __attribute__((always_inline));
+
+extern "C" void* gcmalloc(size_t sz, void* _VT) {
+ gc* res = 0;
+ llvm_gcroot(res, 0);
+ VirtualTable* VT = (VirtualTable*)_VT;
+ sz = llvm::RoundUpToAlignment(sz, sizeof(void*));
+ uintptr_t Mutator = mvm::MutatorThread::get()->MutatorContext;
+ int allocator = JnJVM_org_mmtk_plan_MutatorContext_checkAllocator__III(Mutator, sz, 0, 0);
+ res = (gc*)JnJVM_org_mmtk_plan_marksweep_MSMutator_alloc__IIIII(Mutator, sz, 0, 0, allocator, 0);
+ res->setVirtualTable(VT);
+ JnJVM_org_mmtk_plan_marksweep_MSMutator_postAlloc__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2II(Mutator, (uintptr_t)res, (uintptr_t)VT, sz, allocator);
+
+ if (VT->destructor) {
+ mvm::Thread::get()->MyVM->addFinalizationCandidate(res);
+ }
+ return res;
+}
Modified: vmkit/trunk/mmtk/mmtk-j3/VM.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/VM.cpp?rev=86491&r1=86490&r2=86491&view=diff
==============================================================================
--- vmkit/trunk/mmtk/mmtk-j3/VM.cpp (original)
+++ vmkit/trunk/mmtk/mmtk-j3/VM.cpp Sun Nov 8 17:49:21 2009
@@ -39,20 +39,3 @@
extern "C" bool Java_org_j3_runtime_VM_verifyAssertions__ () {
return true;
}
-
-extern "C" void* gcmalloc(size_t sz, void* _VT) {
- gc* res = 0;
- llvm_gcroot(res, 0);
- VirtualTable* VT = (VirtualTable*)_VT;
- sz = llvm::RoundUpToAlignment(sz, sizeof(void*));
- uintptr_t Mutator = mvm::MutatorThread::get()->MutatorContext;
- int allocator = gc::MMTkCheckAllocator(Mutator, sz, 0, 0);
- res = (gc*)gc::MMTkGCAllocator(Mutator, sz, 0, 0, allocator, 0);
- res->setVirtualTable(VT);
- gc::MMTkGCPostAllocator(Mutator, (uintptr_t)res, (uintptr_t)VT, sz, allocator);
-
- if (VT->destructor) {
- mvm::Thread::get()->MyVM->addFinalizationCandidate(res);
- }
- return res;
-}
More information about the vmkit-commits
mailing list