From gael.thomas at lip6.fr Wed Dec 1 00:18:50 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 08:18:50 -0000 Subject: [vmkit-commits] [vmkit] r120563 - in /vmkit/branches/multi-vm: include/mvm/Object.h include/mvm/PrintBuffer.h include/mvm/UTF8.h lib/Mvm/Runtime/Object.cpp lib/Mvm/Runtime/PrintBuffer.cpp lib/Mvm/Runtime/UTF8.cpp tools/vmkit/CommandLine.cpp tools/vmkit/Launcher.cpp Message-ID: <20101201081850.B5CEC2A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 02:18:50 2010 New Revision: 120563 URL: http://llvm.org/viewvc/llvm-project?rev=120563&view=rev Log: remove old object definition (put it in PrintBuffer.h). Put all related PrintBuffer functions in PrintBuffer.cpp. UTF8 does not define a tracer anymore. Added: vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp - copied, changed from r120463, vmkit/branches/multi-vm/lib/Mvm/Runtime/Object.cpp Removed: vmkit/branches/multi-vm/lib/Mvm/Runtime/Object.cpp Modified: vmkit/branches/multi-vm/include/mvm/Object.h vmkit/branches/multi-vm/include/mvm/PrintBuffer.h vmkit/branches/multi-vm/include/mvm/UTF8.h vmkit/branches/multi-vm/lib/Mvm/Runtime/UTF8.cpp vmkit/branches/multi-vm/tools/vmkit/CommandLine.cpp vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Modified: vmkit/branches/multi-vm/include/mvm/Object.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Object.h?rev=120563&r1=120562&r2=120563&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Object.h (original) +++ vmkit/branches/multi-vm/include/mvm/Object.h Wed Dec 1 02:18:50 2010 @@ -16,41 +16,6 @@ namespace mvm { -#define VT_DESTRUCTOR_OFFSET 0 -#define VT_OPERATOR_DELETE_OFFSET 1 -#define VT_TRACER_OFFSET 2 -#define VT_PRINT_OFFSET 3 -#define VT_HASHCODE_OFFSET 4 -#define VT_NB_FUNCS 5 -#define VT_SIZE 5 * sizeof(void*) - - -class PrintBuffer; - -/// Object - Root of all objects. Define default implementations of virtual -/// methods and some commodity functions. -/// -class Object : public gc { -public: - static void default_tracer(gc *o, uintptr_t closure) {} - static intptr_t default_hashCode(const gc *o) { return (intptr_t)o; } - static void default_print(const gc *o, PrintBuffer *buf); - - /// tracer - Default implementation of tracer. Does nothing. - /// - virtual void tracer(uintptr_t closure) { default_tracer(this, closure); } - - /// print - Default implementation of print. - /// - virtual void print(PrintBuffer *buf) const { default_print(this, buf); } - - /// hashCode - Default implementation of hashCode. Returns the address - /// of this object. - /// - virtual intptr_t hashCode() const { return default_hashCode(this);} - -}; - } // end namespace mvm #endif // MVM_OBJECT_H Modified: vmkit/branches/multi-vm/include/mvm/PrintBuffer.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/PrintBuffer.h?rev=120563&r1=120562&r2=120563&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/PrintBuffer.h (original) +++ vmkit/branches/multi-vm/include/mvm/PrintBuffer.h Wed Dec 1 02:18:50 2010 @@ -19,6 +19,41 @@ namespace mvm { +// #define VT_DESTRUCTOR_OFFSET 0 +// #define VT_OPERATOR_DELETE_OFFSET 1 +// #define VT_TRACER_OFFSET 2 +// #define VT_PRINT_OFFSET 3 +// #define VT_HASHCODE_OFFSET 4 +// #define VT_NB_FUNCS 5 +// #define VT_SIZE 5 * sizeof(void*) + +class PrintBuffer; + +/// OldObject - Root of all objects. Define default implementations of virtual +/// methods and some commodity functions. +/// ************ Technically this class is not used anywhere, to be removed? ************ +/// +class OldObject : public gc { +public: + static void default_tracer(gc *o, uintptr_t closure) {} + static intptr_t default_hashCode(const gc *o) { return (intptr_t)o; } + static void default_print(const gc *o, PrintBuffer *buf); + + /// tracer - Default implementation of tracer. Does nothing. + /// + virtual void tracer(uintptr_t closure) { default_tracer(this, closure); } + + /// print - Default implementation of print. + /// + virtual void print(PrintBuffer *buf) const { default_print(this, buf); } + + /// hashCode - Default implementation of hashCode. Returns the address + /// of this object. + /// + virtual intptr_t hashCode() const { return default_hashCode(this);} + +}; + /// PrintBuffer - This class is a buffered string. /// class PrintBuffer { @@ -48,16 +83,15 @@ init(); } - template - PrintBuffer(const T *obj) { + PrintBuffer(const OldObject *obj) { + llvm_gcroot(obj, 0); init(); writeObj(obj); } - PrintBuffer(const Object *obj) { - llvm_gcroot(obj, 0); + PrintBuffer(const UTF8 *utf8) { init(); - writeObj(obj); + writeUTF8(utf8); } virtual ~PrintBuffer() { @@ -156,17 +190,9 @@ return this; } - /// writeObj - Writes anything (except an object) to the buffer. - /// - template - inline PrintBuffer *writeObj(const T *obj) { - obj->print(this); - return this; - } - /// writeObj - Writes a gc Object to the buffer. /// - inline PrintBuffer *writeObj(const Object *obj) { + inline PrintBuffer *writeObj(const OldObject *obj) { llvm_gcroot(obj, 0); obj->print(this); return this; Modified: vmkit/branches/multi-vm/include/mvm/UTF8.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/UTF8.h?rev=120563&r1=120562&r2=120563&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/UTF8.h (original) +++ vmkit/branches/multi-vm/include/mvm/UTF8.h Wed Dec 1 02:18:50 2010 @@ -56,8 +56,6 @@ size * sizeof(uint16)) < 0; } - void print(PrintBuffer *pb) const; - static uint32_t readerHasher(const uint16* buf, sint32 size); uint32_t hash() const { @@ -99,48 +97,6 @@ void insert(const UTF8* val); }; -class UTF8Builder { - uint16 *buf; - uint32 cur; - uint32 size; - -public: - UTF8Builder(size_t size) { - size = (size < 4) ? 4 : size; - this->buf = new uint16[size]; - this->size = size; - } - - UTF8Builder *append(const UTF8 *utf8, uint32 start=0, uint32 length=0xffffffff) { - length = length == 0xffffffff ? utf8->size : length; - uint32 req = cur + length; - - if(req > size) { - uint32 newSize = size<<1; - while(req < newSize) - newSize <<= 1; - uint16 *newBuf = new uint16[newSize]; - memcpy(newBuf, buf, cur<<1); - delete []buf; - buf = newBuf; - size = newSize; - } - - memcpy(buf + cur, &utf8->elements + start, length<<1); - cur = req; - - return this; - } - - const UTF8 *toUTF8(UTF8Map *map) { - return map->lookupOrCreateReader(buf, size); - } - - ~UTF8Builder() { - delete [] buf; - } -}; - } // end namespace mvm #endif Removed: vmkit/branches/multi-vm/lib/Mvm/Runtime/Object.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/Object.cpp?rev=120562&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/Object.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/Object.cpp (removed) @@ -1,56 +0,0 @@ -//===--------- Object.cc - Common objects for vmlets ----------------------===// -// -// The Micro Virtual Machine -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include -#include - -#include "MvmGC.h" -#include "mvm/Object.h" -#include "mvm/PrintBuffer.h" - -using namespace mvm; - -extern "C" void printFloat(float f) { - fprintf(stderr, "%f\n", f); -} - -extern "C" void printDouble(double d) { - fprintf(stderr, "%f\n", d); -} - -extern "C" void printLong(sint64 l) { - fprintf(stderr, "%lld\n", (long long int)l); -} - -extern "C" void printInt(sint32 i) { - fprintf(stderr, "%d\n", i); -} - -extern "C" void printObject(void* ptr) { - fprintf(stderr, "%p\n", ptr); -} - -extern "C" void write_ptr(PrintBuffer* buf, void* obj) { - buf->writePtr(obj); -} - -extern "C" void write_int(PrintBuffer* buf, int a) { - buf->writeS4(a); -} - -extern "C" void write_str(PrintBuffer* buf, char* a) { - buf->write(a); -} - -void Object::default_print(const gc *o, PrintBuffer *buf) { - llvm_gcroot(o, 0); - buf->write("writePtr((void*)o); - buf->write(">"); -} Copied: vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp (from r120463, vmkit/branches/multi-vm/lib/Mvm/Runtime/Object.cpp) URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp?p2=vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp&p1=vmkit/branches/multi-vm/lib/Mvm/Runtime/Object.cpp&r1=120463&r2=120563&rev=120563&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/Object.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp Wed Dec 1 02:18:50 2010 @@ -48,9 +48,57 @@ buf->write(a); } -void Object::default_print(const gc *o, PrintBuffer *buf) { +void OldObject::default_print(const gc *o, PrintBuffer *buf) { llvm_gcroot(o, 0); - buf->write("write("writePtr((void*)o); buf->write(">"); } + + +#if 0 +// old stuff + +class UTF8Builder { + uint16 *buf; + uint32 cur; + uint32 size; + +public: + UTF8Builder(size_t size) { + size = (size < 4) ? 4 : size; + this->buf = new uint16[size]; + this->size = size; + } + + UTF8Builder *append(const UTF8 *utf8, uint32 start=0, uint32 length=0xffffffff) { + length = length == 0xffffffff ? utf8->size : length; + uint32 req = cur + length; + + if(req > size) { + uint32 newSize = size<<1; + while(req < newSize) + newSize <<= 1; + uint16 *newBuf = new uint16[newSize]; + memcpy(newBuf, buf, cur<<1); + delete []buf; + buf = newBuf; + size = newSize; + } + + memcpy(buf + cur, &utf8->elements + start, length<<1); + cur = req; + + return this; + } + + const UTF8 *toUTF8(UTF8Map *map) { + return map->lookupOrCreateReader(buf, size); + } + + ~UTF8Builder() { + delete [] buf; + } +}; + +#endif Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/UTF8.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/UTF8.cpp?rev=120563&r1=120562&r2=120563&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/UTF8.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/UTF8.cpp Wed Dec 1 02:18:50 2010 @@ -1,14 +1,8 @@ #include "mvm/Allocator.h" #include "mvm/UTF8.h" -#include "mvm/PrintBuffer.h" using namespace mvm; -void UTF8::print(PrintBuffer *pb) const { - pb->writeUTF8(this); -} - - const UTF8* UTF8::extract(UTF8Map* map, uint32 start, uint32 end) const { uint32 len = end - start; ThreadAllocator allocator; Modified: vmkit/branches/multi-vm/tools/vmkit/CommandLine.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/CommandLine.cpp?rev=120563&r1=120562&r2=120563&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmkit/CommandLine.cpp (original) +++ vmkit/branches/multi-vm/tools/vmkit/CommandLine.cpp Wed Dec 1 02:18:50 2010 @@ -6,7 +6,7 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// - +#if 0 #include #include @@ -172,3 +172,5 @@ } } } + +#endif Modified: vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp?rev=120563&r1=120562&r2=120563&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp (original) +++ vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Wed Dec 1 02:18:50 2010 @@ -11,7 +11,7 @@ #include "llvm/LinkAllVMCore.h" #include "llvm/PassManager.h" #include "llvm/CodeGen/LinkAllCodegenComponents.h" -#include "llvm/Support/CommandLine.h" +//#include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/PassNameParser.h" #include "llvm/Support/PluginLoader.h" @@ -29,7 +29,7 @@ #include "../../lib/J3/VMCore/JnjvmClassLoader.h" #include "../../lib/J3/VMCore/Jnjvm.h" -#include "CommandLine.h" +//#include "CommandLine.h" using namespace j3; using namespace llvm; From nicolas.geoffray at gmail.com Wed Dec 1 00:35:42 2010 From: nicolas.geoffray at gmail.com (nicolas geoffray) Date: Wed, 1 Dec 2010 09:35:42 +0100 Subject: [vmkit-commits] [vmkit] r120563 - in /vmkit/branches/multi-vm: include/mvm/Object.h include/mvm/PrintBuffer.h include/mvm/UTF8.h lib/Mvm/Runtime/Object.cpp lib/Mvm/Runtime/PrintBuffer.cpp lib/Mvm/Runtime/UTF8.cpp tools/vmkit/CommandLine.cpp tools Message-ID: Hi Gael, On Wed, Dec 1, 2010 at 9:18 AM, Gael Thomas wrote: > Author: gthomas > Date: Wed Dec 1 02:18:50 2010 > New Revision: 120563 > - > -extern "C" void printFloat(float f) { > - fprintf(stderr, "%f\n", f); > -} > - > -extern "C" void printDouble(double d) { > - fprintf(stderr, "%f\n", d); > -} > - > -extern "C" void printLong(sint64 l) { > - fprintf(stderr, "%lld\n", (long long int)l); > -} > - > -extern "C" void printInt(sint32 i) { > - fprintf(stderr, "%d\n", i); > -} > - > -extern "C" void printObject(void* ptr) { > - fprintf(stderr, "%p\n", ptr); > -} > These methods can be really useful for debugging. It looks like you removed all of them. Could you put them back? Thanks! Nicolas -------------- next part -------------- An HTML attachment was scrubbed... URL: From gael.thomas at lip6.fr Wed Dec 1 00:56:55 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 08:56:55 -0000 Subject: [vmkit-commits] [vmkit] r120565 - in /vmkit/branches/multi-vm: include/mvm/Object.h include/mvm/PrintBuffer.h lib/J3/Compiler/LLVMInfo.cpp lib/J3/VMCore/JavaClass.h lib/J3/VMCore/JavaObject.h lib/J3/VMCore/JavaThread.h lib/J3/VMCore/Jnjvm.h lib/J3/VMCore/JnjvmClassLoader.h lib/J3/VMCore/Reader.h lib/Mvm/Runtime/PrintBuffer.cpp tools/j3/Main.cpp tools/vmjc/vmjc.cpp tools/vmkit/Launcher.cpp Message-ID: <20101201085655.1A9352A6C12F@llvm.org> Author: gthomas Date: Wed Dec 1 02:56:54 2010 New Revision: 120565 URL: http://llvm.org/viewvc/llvm-project?rev=120565&view=rev Log: remove Object.h, it was a little disturbing Removed: vmkit/branches/multi-vm/include/mvm/Object.h Modified: vmkit/branches/multi-vm/include/mvm/PrintBuffer.h vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h vmkit/branches/multi-vm/lib/J3/VMCore/Reader.h vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp vmkit/branches/multi-vm/tools/j3/Main.cpp vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Removed: vmkit/branches/multi-vm/include/mvm/Object.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Object.h?rev=120564&view=auto ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Object.h (original) +++ vmkit/branches/multi-vm/include/mvm/Object.h (removed) @@ -1,21 +0,0 @@ -//===---------- Object.h - Common layout for all objects ------------------===// -// -// The Micro Virtual Machine -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef MVM_OBJECT_H -#define MVM_OBJECT_H - -#include "types.h" -#include "MvmGC.h" - -namespace mvm { - - -} // end namespace mvm - -#endif // MVM_OBJECT_H Modified: vmkit/branches/multi-vm/include/mvm/PrintBuffer.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/PrintBuffer.h?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/PrintBuffer.h (original) +++ vmkit/branches/multi-vm/include/mvm/PrintBuffer.h Wed Dec 1 02:56:54 2010 @@ -14,7 +14,6 @@ #include // memcpy #include "types.h" -#include "mvm/Object.h" #include "mvm/UTF8.h" namespace mvm { Modified: vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp Wed Dec 1 02:56:54 2010 @@ -16,7 +16,7 @@ #include "llvm/Support/MutexGuard.h" #include "llvm/Target/TargetData.h" - +#include "MvmGC.h" #include "mvm/JIT.h" #include "JavaConstantPool.h" Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h Wed Dec 1 02:56:54 2010 @@ -15,7 +15,6 @@ #include "mvm/Allocator.h" #include "mvm/MethodInfo.h" -#include "mvm/Object.h" #include "mvm/Threads/Cond.h" #include "mvm/Threads/Locks.h" Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h Wed Dec 1 02:56:54 2010 @@ -11,7 +11,7 @@ #define JNJVM_JAVA_OBJECT_H #include "mvm/Allocator.h" -#include "mvm/Object.h" +#include "MvmGC.h" #include "mvm/UTF8.h" #include "mvm/Threads/Locks.h" #include "mvm/Threads/Thread.h" Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h Wed Dec 1 02:56:54 2010 @@ -10,7 +10,6 @@ #ifndef JNJVM_JAVA_THREAD_H #define JNJVM_JAVA_THREAD_H -#include "mvm/Object.h" #include "mvm/Threads/Cond.h" #include "mvm/Threads/Locks.h" #include "mvm/Threads/ObjectLocks.h" Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Wed Dec 1 02:56:54 2010 @@ -15,7 +15,6 @@ #include "types.h" #include "mvm/Allocator.h" -#include "mvm/Object.h" #include "mvm/VirtualMachine.h" #include "mvm/Threads/Cond.h" #include "mvm/Threads/Locks.h" Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h Wed Dec 1 02:56:54 2010 @@ -18,7 +18,6 @@ #include "mvm/Allocator.h" -#include "mvm/Object.h" #include "JavaObject.h" #include "JnjvmConfig.h" Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Reader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Reader.h?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Reader.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Reader.h Wed Dec 1 02:56:54 2010 @@ -10,8 +10,6 @@ #ifndef JNJVM_READER_H #define JNJVM_READER_H -#include "mvm/Object.h" - #include "types.h" #include "JavaArray.h" Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp Wed Dec 1 02:56:54 2010 @@ -11,7 +11,6 @@ #include #include "MvmGC.h" -#include "mvm/Object.h" #include "mvm/PrintBuffer.h" using namespace mvm; Modified: vmkit/branches/multi-vm/tools/j3/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/j3/Main.cpp?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/j3/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/j3/Main.cpp Wed Dec 1 02:56:54 2010 @@ -9,7 +9,6 @@ #include "MvmGC.h" #include "mvm/JIT.h" -#include "mvm/Object.h" #include "mvm/VirtualMachine.h" #include "mvm/Threads/Thread.h" Modified: vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp (original) +++ vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp Wed Dec 1 02:56:54 2010 @@ -38,7 +38,6 @@ #include "MvmGC.h" #include "mvm/JIT.h" -#include "mvm/Object.h" #include "mvm/VirtualMachine.h" #include "mvm/Threads/Thread.h" Modified: vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp?rev=120565&r1=120564&r2=120565&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp (original) +++ vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Wed Dec 1 02:56:54 2010 @@ -21,7 +21,6 @@ #include "MvmGC.h" #include "mvm/Config/config.h" #include "mvm/JIT.h" -#include "mvm/Object.h" #include "mvm/VirtualMachine.h" #include "mvm/Threads/Thread.h" From gael.thomas at lip6.fr Wed Dec 1 01:29:26 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 09:29:26 -0000 Subject: [vmkit-commits] [vmkit] r120566 - in /vmkit/branches/multi-vm: include/mvm/Threads/ lib/J3/Classpath/ lib/J3/VMCore/ lib/Mvm/CommonThread/ Message-ID: <20101201092926.3EADF2A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 03:29:25 2010 New Revision: 120566 URL: http://llvm.org/viewvc/llvm-project?rev=120566&view=rev Log: move function that accesses to the pendingException in mvm::Thread. JNIReference contains now gc* to preserve an exception Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClassLoader.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMSystem.inc vmkit/branches/multi-vm/lib/J3/VMCore/JNIReferences.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaMetaJIT.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Wed Dec 1 03:29:25 2010 @@ -265,11 +265,26 @@ /// clearPendingException - Clear any pending exception of the current thread. void clearPendingException() { + pendingException = 0; #ifdef RUNTIME_DWARF_EXCEPTIONS internalPendingException = 0; #endif } + /// setException - only set the pending exception + /// + Thread* setPendingException(gc *obj); + + /// throwIt - Throw a pending exception. + /// + void throwIt(); + + /// getPendingException - Return the pending exception. + /// + gc* getPendingException() { + return pendingException; + } + bool isMvmThread() { if (!baseAddr) return false; else return (((uintptr_t)this) & MvmThreadMask) == baseAddr; @@ -346,8 +361,6 @@ ExceptionBuffer* lastExceptionBuffer; #endif - void internalThrowException(); - void startKnownFrame(KnownFrame& F) __attribute__ ((noinline)); void endKnownFrame(); void startUnknownFrame(KnownFrame& F) __attribute__ ((noinline)); Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc Wed Dec 1 03:29:25 2010 @@ -78,7 +78,7 @@ ArrayObject* args, JavaObject* Clazz, jint index) { JavaObject* res = 0; - JavaObject* excp = 0; + gc* excp = 0; llvm_gcroot(cons, 0); llvm_gcroot(args, 0); @@ -120,19 +120,21 @@ TRY { meth->invokeIntSpecialBuf(vm, cl, res, buf); } CATCH { - excp = JavaThread::get()->getPendingException(); + excp = mvm::Thread::get()->getPendingException(); } END_CATCH; mvm::Thread* mut = mvm::Thread::get(); - JavaThread* th = JavaThread::j3Thread(mut); if (excp) { - if (JavaObject::getClass(excp)->isAssignableFrom(vm->upcalls->newException)) { + JavaObject* jexcp; + llvm_gcroot(jexcp, 0); + jexcp = Jnjvm::asJavaException(excp); + if (jexcp && JavaObject::getClass(jexcp)->isAssignableFrom(vm->upcalls->newException)) { mut->clearPendingException(); // If it's an exception, we encapsule it in an // invocationTargetException - vm->invocationTargetException(excp); + vm->invocationTargetException(jexcp); } else { // If it's an error, throw it again. - th->throwIt(); + mut->throwIt(); } return NULL; } Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc Wed Dec 1 03:29:25 2010 @@ -98,7 +98,8 @@ ArrayObject* args, JavaObject* Cl, jint index) { JavaObject* res = 0; - JavaObject* exc = 0; + JavaObject* jexc = 0; + gc* exc = 0; llvm_gcroot(res, 0); llvm_gcroot(Meth, 0); @@ -106,6 +107,7 @@ llvm_gcroot(args, 0); llvm_gcroot(Cl, 0); llvm_gcroot(exc, 0); + llvm_gcroot(jexc, 0); Jnjvm* vm = JavaThread::get()->getJVM(); @@ -164,17 +166,18 @@ VAR = meth->invoke##TYPE##StaticBuf(vm, cl, buf); \ } \ } CATCH { \ - exc = JavaThread::get()->getPendingException(); \ + exc = mvm::Thread::get()->getPendingException(); \ } END_CATCH; \ - mvm::Thread* mut = mvm::Thread::get(); \ - JavaThread* th = JavaThread::j3Thread(mut); \ + \ if (exc) { \ - if (JavaObject::getClass(exc)->isAssignableFrom( \ + mvm::Thread* mut = mvm::Thread::get(); \ + jexc = Jnjvm::asJavaException(exc); \ + if (jexc && JavaObject::getClass(jexc)->isAssignableFrom( \ vm->upcalls->newException)) { \ mut->clearPendingException(); \ - th->getJVM()->invocationTargetException(exc); \ + JavaThread::j3Thread(mut)->getJVM()->invocationTargetException(jexc); \ } else { \ - th->throwIt(); \ + mut->throwIt(); \ } \ return NULL; \ } Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc Wed Dec 1 03:29:25 2010 @@ -584,7 +584,7 @@ llvm_gcroot(throwable, 0); assert(throwable && "Using internal VM throw exception without exception"); - JavaThread::get()->setPendingException(throwable); + mvm::Thread::get()->setPendingException(throwable); } JNIEXPORT ArrayObject* Java_java_lang_VMClass_getDeclaredAnnotations( Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClassLoader.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClassLoader.inc?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClassLoader.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClassLoader.inc Wed Dec 1 03:29:25 2010 @@ -157,7 +157,7 @@ res = cl->getClassDelegatee(vm, pd); } else { excp = vm->CreateLinkageError("duplicate class definition"); - JavaThread::get()->throwException(excp); + mvm::Thread::get()->setPendingException(excp)->throwIt(); } END_NATIVE_EXCEPTION Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMSystem.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMSystem.inc?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMSystem.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMSystem.inc Wed Dec 1 03:29:25 2010 @@ -38,17 +38,17 @@ assert(src->getVirtualTable()); assert(dst->getVirtualTable()); - JavaThread* th = JavaThread::get(); - Jnjvm *vm = th->getJVM(); + mvm::Thread* mut = mvm::Thread::get(); + Jnjvm *vm = JavaThread::j3Thread(mut)->getJVM(); if (src == NULL || dst == NULL) { - th->setPendingException(vm->CreateNullPointerException()); + mut->setPendingException(vm->CreateNullPointerException()); return; } if (!(JavaObject::getClass(src)->isArray() && JavaObject::getClass(dst)->isArray())) { - th->setPendingException(vm->CreateArrayStoreException((JavaVirtualTable*)dst->getVirtualTable())); + mut->setPendingException(vm->CreateArrayStoreException((JavaVirtualTable*)dst->getVirtualTable())); return; } @@ -61,24 +61,24 @@ sint32 dstSize = JavaArray::getSize(dst); if (len > srcSize) { - th->setPendingException(vm->CreateIndexOutOfBoundsException(len)); + mut->setPendingException(vm->CreateIndexOutOfBoundsException(len)); } else if (len > dstSize) { - th->setPendingException(vm->CreateIndexOutOfBoundsException(len)); + mut->setPendingException(vm->CreateIndexOutOfBoundsException(len)); } else if (len + sstart > srcSize) { - th->setPendingException(vm->CreateIndexOutOfBoundsException(len + sstart)); + mut->setPendingException(vm->CreateIndexOutOfBoundsException(len + sstart)); } else if (len + dstart > dstSize) { - th->setPendingException(vm->CreateIndexOutOfBoundsException(len + dstart)); + mut->setPendingException(vm->CreateIndexOutOfBoundsException(len + dstart)); } else if (dstart < 0) { - th->setPendingException(vm->CreateIndexOutOfBoundsException(dstart)); + mut->setPendingException(vm->CreateIndexOutOfBoundsException(dstart)); } else if (sstart < 0) { - th->setPendingException(vm->CreateIndexOutOfBoundsException(sstart)); + mut->setPendingException(vm->CreateIndexOutOfBoundsException(sstart)); } else if (len < 0) { - th->setPendingException(vm->CreateIndexOutOfBoundsException(len)); + mut->setPendingException(vm->CreateIndexOutOfBoundsException(len)); } else if ((dstType->isPrimitive() || srcType->isPrimitive()) && srcType != dstType) { - th->setPendingException(vm->CreateArrayStoreException((JavaVirtualTable*)dst->getVirtualTable())); + mut->setPendingException(vm->CreateArrayStoreException((JavaVirtualTable*)dst->getVirtualTable())); } - if (th->getPendingException() != NULL) return; + if (mut->getPendingException() != NULL) return; jint i = sstart; jint length = len; @@ -104,7 +104,7 @@ memmove(ptrDst, ptrSrc, length << logSize); if (doThrow) { - th->setPendingException(vm->CreateArrayStoreException((JavaVirtualTable*)dst->getVirtualTable())); + mut->setPendingException(vm->CreateArrayStoreException((JavaVirtualTable*)dst->getVirtualTable())); } } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JNIReferences.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JNIReferences.h?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JNIReferences.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JNIReferences.h Wed Dec 1 03:29:25 2010 @@ -25,7 +25,7 @@ private: JNILocalReferences* prev; uint32_t length; - JavaObject* localReferences[MAXIMUM_REFERENCES]; + gc* localReferences[MAXIMUM_REFERENCES]; public: @@ -34,7 +34,7 @@ length = 0; } - JavaObject** addJNIReference(JavaThread* th, JavaObject* obj); + gc** addJNIReference(JavaThread* th, gc* obj); void removeJNIReferences(JavaThread* th, uint32_t num); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaMetaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaMetaJIT.cpp?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaMetaJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaMetaJIT.cpp Wed Dec 1 03:29:25 2010 @@ -64,7 +64,7 @@ #else #define DO_TRY -#define DO_CATCH if (th->getPendingException()) { th->throwFromJava(); } +#define DO_CATCH if (th->mut->getPendingException()) { th->throwFromJava(); } #endif Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp Wed Dec 1 03:29:25 2010 @@ -52,8 +52,8 @@ // Since the function is marked readnone, LLVM may move it after the // exception check. Therefore, we trick LLVM to check the return value of the // function. -#define hack_check(type) \ - JavaObject* obj = JavaThread::get()->getPendingException(); \ +#define hack_check(type) \ + gc* obj = mvm::Thread::get()->getPendingException(); \ if (obj) return (type)obj; hack_check(void*); @@ -372,7 +372,7 @@ // Does not call any Java code. Can not yield a GC. extern "C" void j3ThrowException(JavaObject* obj) { llvm_gcroot(obj, 0); - return JavaThread::get()->throwException(obj); + return mvm::Thread::get()->setPendingException(obj)->throwIt(); } // Creates a Java object and then throws it. @@ -387,7 +387,8 @@ END_NATIVE_EXCEPTION - th->setPendingException(exc)->throwFromNative(); + th->mut->setPendingException(exc); + th->throwFromNative(); return exc; } @@ -404,7 +405,8 @@ END_NATIVE_EXCEPTION - th->setPendingException(exc)->throwFromNative(); + th->mut->setPendingException(exc); + th->throwFromNative(); return exc; } @@ -421,7 +423,8 @@ END_NATIVE_EXCEPTION - th->setPendingException(exc)->throwFromNative(); + th->mut->setPendingException(exc); + th->throwFromNative(); return exc; } @@ -438,7 +441,8 @@ END_NATIVE_EXCEPTION - th->setPendingException(exc)->throwFromNative(); + th->mut->setPendingException(exc); + th->throwFromNative(); return exc; } @@ -455,7 +459,8 @@ END_NATIVE_EXCEPTION - th->setPendingException(exc)->throwFromNative(); + th->mut->setPendingException(exc); + th->throwFromNative(); return exc; } @@ -475,7 +480,8 @@ END_NATIVE_EXCEPTION - th->setPendingException(exc)->throwFromNative(); + th->mut->setPendingException(exc); + th->throwFromNative(); return exc; } @@ -495,7 +501,8 @@ END_NATIVE_EXCEPTION - th->setPendingException(exc)->throwFromNative(); + th->mut->setPendingException(exc); + th->throwFromNative(); return exc; } @@ -512,7 +519,8 @@ END_NATIVE_EXCEPTION - th->setPendingException(exc)->throwFromNative(); + th->mut->setPendingException(exc); + th->throwFromNative(); return exc; } @@ -530,7 +538,8 @@ END_NATIVE_EXCEPTION - th->setPendingException(exc)->throwFromNative(); + th->mut->setPendingException(exc); + th->throwFromNative(); } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp Wed Dec 1 03:29:25 2010 @@ -63,23 +63,6 @@ #endif } -JavaThread* JavaThread::setPendingException(JavaObject *obj) { - llvm_gcroot(obj, 0); - assert(mvm::Thread::get()->pendingException == 0 && "pending exception already there?"); - mvm::Thread::get()->pendingException = obj; -} - -void JavaThread::throwIt() { - assert(mvm::Thread::get()->pendingException); - mvm::Thread::get()->internalThrowException(); -} - -void JavaThread::throwException(JavaObject* obj) { - llvm_gcroot(obj, 0); - setPendingException(obj); - throwIt(); -} - void JavaThread::startJNI() { // Interesting, but no need to do anything. } @@ -158,8 +141,8 @@ } } -JavaObject** JNILocalReferences::addJNIReference(JavaThread* th, - JavaObject* obj) { +gc** JNILocalReferences::addJNIReference(JavaThread* th, + gc* obj) { llvm_gcroot(obj, 0); if (length == MAXIMUM_REFERENCES) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h Wed Dec 1 03:29:25 2010 @@ -93,7 +93,7 @@ /// Jnjvm *jnjvm; - JavaObject** pushJNIRef(JavaObject* obj) { + gc** pushJNIRef(gc* obj) { llvm_gcroot(obj, 0); if (!obj) return 0; @@ -152,28 +152,6 @@ return javaThread; } - /// setException - only set the pending exception - /// - JavaThread* setPendingException(JavaObject *obj); - - /// throwException - Throw the given exception in the current thread. - /// - void throwException(JavaObject* obj); - - /// throwIt - Throw a pending exception. - /// - void throwIt(); - - /// clearPendingException - Clear the pending exception. - // - void clearPendingException() { mut->pendingException = 0; } - - /// getPendingException - Return the pending exception. - /// - JavaObject* getPendingException() { - return (JavaObject*)mut->pendingException; - } - /// throwFromJNI - Throw an exception after executing JNI code. /// void throwFromJNI(void* SP) { @@ -185,14 +163,14 @@ /// void throwFromNative() { #ifdef DWARF_EXCEPTIONS - throwIt(); + mut->throwIt(); #endif } /// throwFromJava - Throw an exception after executing Java code. /// void throwFromJava() { - throwIt(); + mut->throwIt(); } /// startJava - Interesting, but actually does nothing :) Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp Wed Dec 1 03:29:25 2010 @@ -173,7 +173,7 @@ false, true, 0); str = vm->asciizToStr(msg); init->invokeIntSpecial(vm, realCl, res, &str); - JavaThread::j3Thread(mut)->setPendingException(res); + mut->setPendingException(res); RETURN_FROM_JNI(1); @@ -187,7 +187,7 @@ BEGIN_JNI_EXCEPTION - JavaObject* obj = JavaThread::get()->getPendingException(); + gc* obj = mut->getPendingException(); llvm_gcroot(obj, 0); if (obj == NULL) RETURN_FROM_JNI(NULL); jthrowable res = (jthrowable)JavaThread::j3Thread(mut)->pushJNIRef(obj); @@ -3584,7 +3584,7 @@ jboolean ExceptionCheck(JNIEnv *env) { BEGIN_JNI_EXCEPTION - if (JavaThread::get()->getPendingException()) { + if (mut->getPendingException()) { RETURN_FROM_JNI(JNI_TRUE); } else { RETURN_FROM_JNI(JNI_FALSE); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 1 03:29:25 2010 @@ -46,7 +46,7 @@ /// initialiseClass - Java class initialisation. Java specification §2.17.5. void UserClass::initialiseClass(Jnjvm* vm) { - JavaObject* exc = NULL; + gc* exc = NULL; JavaObject* obj = NULL; llvm_gcroot(exc, 0); llvm_gcroot(obj, 0); @@ -147,9 +147,8 @@ release(); } END_CATCH; - JavaThread* th = JavaThread::get(); - if (th->getPendingException() != NULL) { - th->throwIt(); + if (mut->getPendingException() != NULL) { + mut->throwIt(); return; } } @@ -183,9 +182,9 @@ TRY { meth->invokeIntStatic(vm, cl); } CATCH { - exc = JavaThread::get()->getPendingException(); + exc = mut->getPendingException(); assert(exc && "no exception?"); - mvm::Thread::get()->clearPendingException(); + mut->clearPendingException(); } END_CATCH; } @@ -209,11 +208,13 @@ // ExceptionInInitializerError cannot be created because an // OutOfMemoryError occurs, then instead use an OutOfMemoryError object // in place of E in the following step. - JavaThread* th = JavaThread::get(); - if (JavaObject::getClass(exc)->isAssignableFrom(vm->upcalls->newException)) { + JavaObject* jexc; + llvm_gcroot(jexc, 0); + jexc = Jnjvm::asJavaException(exc); + if (jexc && JavaObject::getClass(jexc)->isAssignableFrom(vm->upcalls->newException)) { Classpath* upcalls = classLoader->bootstrapLoader->upcalls; UserClass* clExcp = upcalls->ExceptionInInitializerError; - Jnjvm* vm = th->getJVM(); + Jnjvm* vm = JavaThread::get()->getJVM(); obj = clExcp->doNew(vm); if (obj == NULL) { fprintf(stderr, "implement me"); @@ -232,7 +233,7 @@ setOwnerClass(0); broadcastClass(); release(); - th->throwException(exc); + mut->setPendingException(exc)->throwIt(); return; } } @@ -245,7 +246,7 @@ obj = cl->doNew(this); init->invokeIntSpecial(this, cl, obj, &excp); - JavaThread::get()->throwException(obj); + mvm::Thread::get()->setPendingException(obj)->throwIt(); } JavaObject* Jnjvm::CreateError(UserClass* cl, JavaMethod* init, @@ -277,7 +278,7 @@ llvm_gcroot(obj, 0); llvm_gcroot(str, 0); obj = CreateError(cl, init, str); - JavaThread::get()->throwException(obj); + mvm::Thread::get()->setPendingException(obj)->throwIt(); } void Jnjvm::arrayStoreException() { @@ -1175,7 +1176,7 @@ } void Jnjvm::executeClass(const char* className, ArrayObject* args) { - JavaObject* exc = NULL; + gc* exc = NULL; JavaObject* obj = NULL; JavaObject* group = NULL; @@ -1208,11 +1209,12 @@ } CATCH { } END_CATCH; - exc = JavaThread::get()->getPendingException(); + mvm::Thread* mut = mvm::Thread::get(); + exc = mut->getPendingException(); if (exc != NULL) { JavaThread* th = JavaThread::get(); - th->clearPendingException(); + mut->clearPendingException(); obj = th->currentThread(); group = upcalls->group->getInstanceObjectField(obj); TRY { @@ -1262,7 +1264,7 @@ JavaString* str = NULL; JavaObject* instrumenter = NULL; ArrayObject* args = NULL; - JavaObject* exc = NULL; + gc* exc = NULL; llvm_gcroot(str, 0); llvm_gcroot(instrumenter, 0); @@ -1286,12 +1288,15 @@ TRY { vm->loadBootstrap(); } CATCH { - exc = JavaThread::get()->getPendingException(); + exc = mvm::Thread::get()->getPendingException(); } END_CATCH; if (exc != NULL) { + JavaObject *jexc; + llvm_gcroot(jexc, 0); + jexc = Jnjvm::asJavaException(exc); fprintf(stderr, "Exception %s while bootstrapping VM.", - UTF8Buffer(JavaObject::getClass(exc)->name).cString()); + exc ? UTF8Buffer(JavaObject::getClass(jexc)->name).cString() : " foreign exception"); } else { ClArgumentsInfo& info = vm->argumentsInfo; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Wed Dec 1 03:29:25 2010 @@ -356,6 +356,10 @@ /// mapping the initial thread. /// void loadBootstrap(); + + // asjavaException - convert from gc to JavaObject. Will be used to identify the points + // where we must test the original vm of the exception + static JavaObject* asJavaException(gc* o) { llvm_gcroot(o, 0); return (JavaObject*)o; } }; } // end namespace j3 Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Wed Dec 1 03:29:25 2010 @@ -669,7 +669,7 @@ UserClass* JnjvmClassLoader::constructClass(const UTF8* name, ClassBytes* bytes) { - JavaObject* excp = NULL; + gc* excp = NULL; llvm_gcroot(excp, 0); UserClass* res = NULL; lock.lock(); @@ -694,12 +694,13 @@ classes->lock.unlock(); assert(success && "Could not add class in map"); } CATCH { - excp = JavaThread::get()->getPendingException(); - mvm::Thread::get()->clearPendingException(); + mvm::Thread* mut = mvm::Thread::get(); + excp = mut->getPendingException(); + mut->clearPendingException(); } END_CATCH; } if (excp != NULL) { - JavaThread::get()->throwException(excp); + mvm::Thread::get()->setPendingException(excp)->throwIt(); } lock.unlock(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Wed Dec 1 03:29:25 2010 @@ -336,7 +336,7 @@ JNILocalReferences* end = localJNIRefs; while (end != NULL) { for (uint32 i = 0; i < end->length; ++i) { - JavaObject** obj = end->localReferences + i; + gc** obj = end->localReferences + i; mvm::Collector::markAndTraceRoot(obj, closure); } end = end->prev; Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120566&r1=120565&r2=120566&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Wed Dec 1 03:29:25 2010 @@ -104,7 +104,16 @@ #define SELF_HANDLE 0 #endif -void Thread::internalThrowException() { +Thread* Thread::setPendingException(gc *obj) { + llvm_gcroot(obj, 0); + assert(pendingException == 0 && "pending exception already there?"); + pendingException = obj; + return this; +} + +void Thread::throwIt() { + assert(pendingException); + #ifdef RUNTIME_DWARF_EXCEPTIONS // Use dlsym instead of getting the functions statically with extern "C" // because gcc compiles exceptions differently. From gael.thomas at lip6.fr Wed Dec 1 02:06:57 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 10:06:57 -0000 Subject: [vmkit-commits] [vmkit] r120567 - in /vmkit/branches/multi-vm: include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/J3/Classpath/ClasspathConstructor.inc lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h tools/j3/Main.cpp tools/vmjc/vmjc.cpp tools/vmkit/Launcher.cpp Message-ID: <20101201100657.BFEED2A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 04:06:57 2010 New Revision: 120567 URL: http://llvm.org/viewvc/llvm-project?rev=120567&view=rev Log: add a new class VMKit that will hold all the global data. VirtualMachine will only hold vm specific data Added: vmkit/branches/multi-vm/include/mvm/VMKit.h Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/tools/j3/Main.cpp vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Added: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=120567&view=auto ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (added) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Wed Dec 1 04:06:57 2010 @@ -0,0 +1,19 @@ +#ifndef _VMKIT_H_ +#define _VMKIT_H_ + +#include "mvm/Allocator.h" + +namespace mvm { + +class VMKit : public mvm::PermanentObject { +public: + /// allocator - Bump pointer allocator to allocate permanent memory of VMKit + /// + mvm::BumpPtrAllocator& allocator; + + VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) {} +}; + +} + +#endif Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=120567&r1=120566&r2=120567&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Wed Dec 1 04:06:57 2010 @@ -21,6 +21,7 @@ namespace mvm { class MethodInfo; +class VMKit; class FunctionMap { public: @@ -53,10 +54,11 @@ /// class VirtualMachine : public mvm::PermanentObject { protected: - VirtualMachine(mvm::BumpPtrAllocator &Alloc) : + VirtualMachine(mvm::BumpPtrAllocator &Alloc, mvm::VMKit* vmk) : allocator(Alloc) { mainThread = 0; NumberOfThreads = 0; + vmkit = vmk; } virtual ~VirtualMachine() { @@ -84,6 +86,9 @@ /// ThreadLock - Lock to create or destroy a new thread. /// mvm::SpinLock ThreadLock; + + /// vmkit - a pointer to vmkit that contains information on all the vms + mvm::VMKit* vmkit; /// setMainThread - Set the main thread of this VM. /// Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc?rev=120567&r1=120566&r2=120567&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc Wed Dec 1 04:06:57 2010 @@ -79,12 +79,14 @@ JavaObject* Clazz, jint index) { JavaObject* res = 0; gc* excp = 0; - + JavaObject* jexcp; + llvm_gcroot(cons, 0); llvm_gcroot(args, 0); llvm_gcroot(Clazz, 0); llvm_gcroot(res, 0); llvm_gcroot(excp, 0); + llvm_gcroot(jexcp, 0); Jnjvm* vm = JavaThread::get()->getJVM(); JavaMethod* meth = JavaObjectConstructor::getInternalMethod(cons); @@ -124,8 +126,6 @@ } END_CATCH; mvm::Thread* mut = mvm::Thread::get(); if (excp) { - JavaObject* jexcp; - llvm_gcroot(jexcp, 0); jexcp = Jnjvm::asJavaException(excp); if (jexcp && JavaObject::getClass(jexcp)->isAssignableFrom(vm->upcalls->newException)) { mut->clearPendingException(); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=120567&r1=120566&r2=120567&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Wed Dec 1 04:06:57 2010 @@ -26,6 +26,7 @@ #include "MvmGC.h" #include "mvm/VirtualMachine.h" +#include "mvm/VMKit.h" #include "JavaClass.h" #include "JavaConstantPool.h" @@ -417,7 +418,6 @@ mvm::MvmModule::initialise(); mvm::Collector::initialise(); - mvm::ThreadAllocator allocator; char** newArgv = (char**)allocator.Allocate((argc + 1) * sizeof(char*)); memcpy(newArgv + 1, argv, argc * sizeof(void*)); @@ -425,10 +425,11 @@ newArgv[1] = mainClass; mvm::BumpPtrAllocator Allocator; + mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule"); JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") JnjvmBootstrapLoader(Allocator, Comp, true); - Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader); + Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader); vm->runApplication(argc + 1, newArgv); vm->waitForExit(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120567&r1=120566&r2=120567&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 1 04:06:57 2010 @@ -19,6 +19,7 @@ #include "debug.h" #include "mvm/Threads/Thread.h" +#include "mvm/VMKit.h" #include "MvmGC.h" #include "ClasspathReflect.h" @@ -48,6 +49,9 @@ void UserClass::initialiseClass(Jnjvm* vm) { gc* exc = NULL; JavaObject* obj = NULL; + JavaObject* jexc; + + llvm_gcroot(jexc, 0); llvm_gcroot(exc, 0); llvm_gcroot(obj, 0); @@ -208,8 +212,6 @@ // ExceptionInInitializerError cannot be created because an // OutOfMemoryError occurs, then instead use an OutOfMemoryError object // in place of E in the following step. - JavaObject* jexc; - llvm_gcroot(jexc, 0); jexc = Jnjvm::asJavaException(exc); if (jexc && JavaObject::getClass(jexc)->isAssignableFrom(vm->upcalls->newException)) { Classpath* upcalls = classLoader->bootstrapLoader->upcalls; @@ -1265,7 +1267,9 @@ JavaObject* instrumenter = NULL; ArrayObject* args = NULL; gc* exc = NULL; - + JavaObject *jexc; + + llvm_gcroot(jexc, 0); llvm_gcroot(str, 0); llvm_gcroot(instrumenter, 0); llvm_gcroot(args, 0); @@ -1292,8 +1296,6 @@ } END_CATCH; if (exc != NULL) { - JavaObject *jexc; - llvm_gcroot(jexc, 0); jexc = Jnjvm::asJavaException(exc); fprintf(stderr, "Exception %s while bootstrapping VM.", exc ? UTF8Buffer(JavaObject::getClass(jexc)->name).cString() : " foreign exception"); @@ -1341,8 +1343,8 @@ mainThread->start((void (*)(mvm::Thread*))mainJavaStart); } -Jnjvm::Jnjvm(mvm::BumpPtrAllocator& Alloc, JnjvmBootstrapLoader* loader) : - VirtualMachine(Alloc), lockSystem(Alloc) { +Jnjvm::Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JnjvmBootstrapLoader* loader) : + VirtualMachine(Alloc, vmkit), lockSystem(Alloc) { classpath = getenv("CLASSPATH"); if (!classpath) classpath = "."; @@ -1464,7 +1466,6 @@ // Helper function to run J3 without JIT. extern "C" int StartJnjvmWithoutJIT(int argc, char** argv, char* mainClass) { mvm::Collector::initialise(); - mvm::ThreadAllocator allocator; char** newArgv = (char**)allocator.Allocate((argc + 1) * sizeof(char*)); memcpy(newArgv + 1, argv, argc * sizeof(char*)); @@ -1472,10 +1473,11 @@ newArgv[1] = mainClass; mvm::BumpPtrAllocator Allocator; + mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); JavaCompiler* Comp = new JavaCompiler(); JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") JnjvmBootstrapLoader(Allocator, Comp, true); - Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader); + Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader); vm->runApplication(argc + 1, newArgv); vm->waitForExit(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=120567&r1=120566&r2=120567&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Wed Dec 1 04:06:57 2010 @@ -340,7 +340,7 @@ /// Jnjvm - Allocates a new JVM. /// - Jnjvm(mvm::BumpPtrAllocator& Alloc, JnjvmBootstrapLoader* loader); + Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JnjvmBootstrapLoader* loader); /// runApplication - Runs the application with the given command line. /// User-visible function, inherited by the VirtualMachine class. Modified: vmkit/branches/multi-vm/tools/j3/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/j3/Main.cpp?rev=120567&r1=120566&r2=120567&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/j3/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/j3/Main.cpp Wed Dec 1 04:06:57 2010 @@ -9,6 +9,7 @@ #include "MvmGC.h" #include "mvm/JIT.h" +#include "mvm/VMKit.h" #include "mvm/VirtualMachine.h" #include "mvm/Threads/Thread.h" @@ -39,7 +40,8 @@ JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule"); JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") JnjvmBootstrapLoader(Allocator, Comp, true); - Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader); + mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); + Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader); // Run the application. vm->runApplication(argc, argv); Modified: vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp?rev=120567&r1=120566&r2=120567&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp (original) +++ vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp Wed Dec 1 04:06:57 2010 @@ -38,6 +38,7 @@ #include "MvmGC.h" #include "mvm/JIT.h" +#include "mvm/VMKit.h" #include "mvm/VirtualMachine.h" #include "mvm/Threads/Thread.h" @@ -185,8 +186,9 @@ if (DisableStubs) Comp->generateStubs = false; if (AssumeCompiled) Comp->assumeCompiled = true; if (DisableCooperativeGC) Comp->disableCooperativeGC(); - - Jnjvm* vm = new(allocator, "Bootstrap loader") Jnjvm(allocator, loader); + + mvm::VMKit* vmkit = new(allocator, "VMKit") mvm::VMKit(allocator); + Jnjvm* vm = new(allocator, "Bootstrap loader") Jnjvm(allocator, vmkit, loader); for (std::vector::iterator i = Properties.begin(), e = Properties.end(); i != e; ++i) { Modified: vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp?rev=120567&r1=120566&r2=120567&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp (original) +++ vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Wed Dec 1 04:06:57 2010 @@ -21,6 +21,7 @@ #include "MvmGC.h" #include "mvm/Config/config.h" #include "mvm/JIT.h" +#include "mvm/VMKit.h" #include "mvm/VirtualMachine.h" #include "mvm/Threads/Thread.h" @@ -73,7 +74,8 @@ JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule"); JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") JnjvmBootstrapLoader(Allocator, Comp, true); - Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader); + mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); + Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader); vm->runApplication(argc, argv); vm->waitForExit(); } From gael.thomas at lip6.fr Wed Dec 1 02:31:04 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 10:31:04 -0000 Subject: [vmkit-commits] [vmkit] r120568 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h lib/J3/VMCore/JavaThread.cpp lib/J3/VMCore/JavaThread.h lib/Mvm/Compiler/mvm-runtime.ll Message-ID: <20101201103104.72C712A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 04:31:04 2010 New Revision: 120568 URL: http://llvm.org/viewvc/llvm-project?rev=120568&view=rev Log: add a field to hold the vm in the vm specific data Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120568&r1=120567&r2=120568&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Wed Dec 1 04:31:04 2010 @@ -146,14 +146,18 @@ class VMThreadData { public: /// mut - The associated thread mutator - MutatorThread* mut; + MutatorThread* mut; + VirtualMachine* vm; - VMThreadData(MutatorThread* m) { + VMThreadData(MutatorThread* m, VirtualMachine *v) { this->mut = m; + this->vm = v; } virtual void tracer(uintptr_t closure) = 0; + void attach(); + virtual ~VMThreadData() {} // force the construction of a VT }; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp?rev=120568&r1=120567&r2=120568&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp Wed Dec 1 04:31:04 2010 @@ -20,7 +20,7 @@ using namespace j3; JavaThread::JavaThread(mvm::MutatorThread* mut, Jnjvm* isolate) - : mvm::VMThreadData(mut) { + : mvm::VMThreadData(mut, isolate) { jniEnv = isolate->jniEnv; localJNIRefs = new JNILocalReferences(); currentAddedReferences = NULL; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h?rev=120568&r1=120567&r2=120568&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h Wed Dec 1 04:31:04 2010 @@ -89,10 +89,6 @@ /// JNILocalReferences* localJNIRefs; - /// jnjvm - my vm - /// - Jnjvm *jnjvm; - gc** pushJNIRef(gc* obj) { llvm_gcroot(obj, 0); if (!obj) return 0; @@ -108,7 +104,7 @@ /// JavaThread - Empty constructor, used to get the VT. /// - JavaThread() : mvm::VMThreadData(0) { + JavaThread() : mvm::VMThreadData(0, 0) { #ifdef SERVICE replacedEIPs = 0; #endif @@ -143,7 +139,7 @@ /// getJVM - Get the Java VM in which this thread executes. /// Jnjvm* getJVM() { - return jnjvm; + return (Jnjvm*)vm; } /// currentThread - Return the current thread as a Java object. Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll?rev=120568&r1=120567&r2=120568&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll Wed Dec 1 04:31:04 2010 @@ -22,7 +22,11 @@ ;;; field 12: void* vmData ;;; field 13: gc* pendingException %Thread = type { %CircularBase, i32, i8*, i8*, i1, i1, i1, i8*, i8*, i8*, i8*, i8*, i8*, i8* } -%VMThreadData = type { %VT*, %Thread* } + +;;; field 0: VT +;;; field 1: mvm::MutatorThread* mut +;;; field 2: mvm::VirtualMachine* vm +%VMThreadData = type { %VT*, %MutatorThread*, i8* } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Printing functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; From gael.thomas at lip6.fr Wed Dec 1 02:54:33 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 10:54:33 -0000 Subject: [vmkit-commits] [vmkit] r120569 - in /vmkit/branches/multi-vm/lib/J3: Classpath/ClasspathVMThread.inc Classpath/JavaUpcalls.cpp Compiler/JavaAOTCompiler.cpp VMCore/JavaThread.cpp VMCore/JavaThread.h VMCore/Jnjvm.cpp VMCore/Jnjvm.h VMCore/ReferenceQueue.cpp Message-ID: <20101201105433.1710C2A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 04:54:32 2010 New Revision: 120569 URL: http://llvm.org/viewvc/llvm-project?rev=120569&view=rev Log: store also mainThread, finalizerThread and referenceThread in JavaThread. Define a function attach in VMThreadData to attach the vm specific data to its thread Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc?rev=120569&r1=120568&r2=120569&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc Wed Dec 1 04:54:32 2010 @@ -93,13 +93,13 @@ javaThread = vm->upcalls->assocThread->getInstanceObjectField(vmThread); assert(javaThread && "VMThread with no Java equivalent"); - mvm::Thread* mut = JavaThread::create(vm); + JavaThread* th = JavaThread::create(vm); - if (!mut) vm->outOfMemoryError(); - mut->start((void (*)(mvm::Thread*))start); + if (!th) vm->outOfMemoryError(); + th->mut->start((void (*)(mvm::Thread*))start); // Now that the thread has been created, initialise its object fields. - JavaThread::j3Thread(mut)->initialise(javaThread, vmThread); + th->initialise(javaThread, vmThread); END_NATIVE_EXCEPTION } Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp?rev=120569&r1=120568&r2=120569&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp Wed Dec 1 04:54:32 2010 @@ -280,7 +280,7 @@ RG = rootGroup->getStaticObjectField(); assert(RG && "No root group"); assert(vm->getMainThread() && "VM did not set its main thread"); - CreateJavaThread(vm, JavaThread::j3Thread(vm->getMainThread()), "main", RG); + CreateJavaThread(vm, vm->javaMainThread, "main", RG); // Create the "system" group. SystemGroup = threadGroup->doNew(vm); @@ -290,11 +290,11 @@ // Create the finalizer thread. assert(vm->getFinalizerThread() && "VM did not set its finalizer thread"); - CreateJavaThread(vm, JavaThread::j3Thread(vm->getFinalizerThread()), "Finalizer", SystemGroup); + CreateJavaThread(vm, vm->javaFinalizerThread, "Finalizer", SystemGroup); // Create the enqueue thread. assert(vm->getReferenceThread() && "VM did not set its enqueue thread"); - CreateJavaThread(vm, JavaThread::j3Thread(vm->getReferenceThread()), "Reference", SystemGroup); + CreateJavaThread(vm, vm->javaReferenceThread, "Reference", SystemGroup); } extern "C" void Java_java_lang_ref_WeakReference__0003Cinit_0003E__Ljava_lang_Object_2( Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=120569&r1=120568&r2=120569&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Dec 1 04:54:32 2010 @@ -2133,9 +2133,9 @@ void JavaAOTCompiler::compileFile(Jnjvm* vm, const char* n) { name = n; - mvm::Thread* th = JavaThread::create(vm); - vm->setMainThread(th); - th->start(mainCompilerStart); + vm->javaMainThread = JavaThread::create(vm); + vm->mainThread = vm->javaMainThread->mut; + vm->javaMainThread->mut->start(mainCompilerStart); vm->waitForExit(); } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp?rev=120569&r1=120568&r2=120569&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp Wed Dec 1 04:54:32 2010 @@ -26,7 +26,6 @@ currentAddedReferences = NULL; javaThread = NULL; vmThread = NULL; - jnjvm = isolate; #ifdef SERVICE eipIndex = 0; @@ -41,12 +40,11 @@ return (JavaThread*)mut->vmData; } -mvm::Thread *JavaThread::create(Jnjvm* isolate) { +JavaThread *JavaThread::create(Jnjvm* isolate) { mvm::MutatorThread *mut = new mvm::MutatorThread(); JavaThread *th = new JavaThread(mut, isolate); - mut->MyVM = isolate; - mut->vmData = th; - return mut; + th->attach(); + return th; } void JavaThread::initialise(JavaObject* thread, JavaObject* vmth) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h?rev=120569&r1=120568&r2=120569&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h Wed Dec 1 04:54:32 2010 @@ -120,7 +120,7 @@ /// create - Creates a Java thread and a mutator thread. /// - static mvm::Thread* create(Jnjvm* isolate); + static JavaThread* create(Jnjvm* isolate); /// j3Thread - gives the JavaThread associated with the mutator thread /// Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120569&r1=120568&r2=120569&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 1 04:54:32 2010 @@ -1070,10 +1070,14 @@ // First create system threads. finalizerThread = new FinalizerThread(this); + javaFinalizerThread = new JavaThread(finalizerThread, this); + javaFinalizerThread->attach(); finalizerThread->start( (void (*)(mvm::Thread*))FinalizerThread::finalizerStart); referenceThread = new ReferenceThread(this); + javaReferenceThread = new JavaThread(referenceThread, this); + javaReferenceThread->attach(); referenceThread->start( (void (*)(mvm::Thread*))ReferenceThread::enqueueStart); @@ -1287,8 +1291,6 @@ vm->argumentsInfo.argv = vm->argumentsInfo.argv + pos - 1; vm->argumentsInfo.argc = vm->argumentsInfo.argc - pos + 1; - // vm->mainThread = thread; - TRY { vm->loadBootstrap(); } CATCH { @@ -1339,7 +1341,8 @@ void Jnjvm::runApplication(int argc, char** argv) { argumentsInfo.argc = argc; argumentsInfo.argv = argv; - mainThread = JavaThread::create(this); + javaMainThread = JavaThread::create(this); + mainThread = javaMainThread->mut; mainThread->start((void (*)(mvm::Thread*))mainJavaStart); } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=120569&r1=120568&r2=120569&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Wed Dec 1 04:54:32 2010 @@ -249,6 +249,15 @@ /// hashStr - Hash map of java/lang/String objects allocated by this JVM. /// StringMap hashStr; + + /// javaMainThread - the java main thread + JavaThread* javaMainThread; + + /// javaFinalizerThread - the java finalizer thread + JavaThread* javaFinalizerThread; + + /// javaReferenceThread - the java reference thread + JavaThread* javaReferenceThread; public: Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp?rev=120569&r1=120568&r2=120569&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp Wed Dec 1 04:54:32 2010 @@ -25,7 +25,6 @@ ToEnqueueIndex = 0; MyVM = vm; - vmData = new JavaThread(this, vm); } @@ -169,7 +168,6 @@ CurrentFinalizedIndex = 0; MyVM = vm; - vmData = new JavaThread(this, vm); } void FinalizerThread::growFinalizationQueue() { From gael.thomas at lip6.fr Wed Dec 1 03:37:52 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 11:37:52 -0000 Subject: [vmkit-commits] [vmkit] r120570 - /vmkit/branches/multi-vm/lib/Mvm/CommonThread/VMThreadData.cpp Message-ID: <20101201113752.523EB2A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 05:37:52 2010 New Revision: 120570 URL: http://llvm.org/viewvc/llvm-project?rev=120570&view=rev Log: forgot a file Added: vmkit/branches/multi-vm/lib/Mvm/CommonThread/VMThreadData.cpp Added: vmkit/branches/multi-vm/lib/Mvm/CommonThread/VMThreadData.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/VMThreadData.cpp?rev=120570&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/VMThreadData.cpp (added) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/VMThreadData.cpp Wed Dec 1 05:37:52 2010 @@ -0,0 +1,9 @@ +#include "mvm/Threads/Thread.h" +#include "MutatorThread.h" + +using namespace mvm; + +void VMThreadData::attach() { + mut->vmData = this; + mut->MyVM = vm; +} From gael.thomas at lip6.fr Wed Dec 1 03:41:22 2010 From: gael.thomas at lip6.fr (=?ISO-8859-1?Q?Ga=EBl_Thomas?=) Date: Wed, 1 Dec 2010 12:41:22 +0100 Subject: [vmkit-commits] [vmkit] r120563 - in /vmkit/branches/multi-vm: include/mvm/Object.h include/mvm/PrintBuffer.h include/mvm/UTF8.h lib/Mvm/Runtime/Object.cpp lib/Mvm/Runtime/PrintBuffer.cpp lib/Mvm/Runtime/UTF8.cpp tools/vmkit/CommandLine.cpp tools In-Reply-To: References: Message-ID: They are now in PrintBuffer.cpp :) Gaël 2010/12/1 nicolas geoffray : > Hi Gael, > > On Wed, Dec 1, 2010 at 9:18 AM, Gael Thomas wrote: >> >> Author: gthomas >> Date: Wed Dec  1 02:18:50 2010 >> New Revision: 120563 >> - >> -extern "C" void printFloat(float f) { >> -  fprintf(stderr, "%f\n", f); >> -} >> - >> -extern "C" void printDouble(double d) { >> -  fprintf(stderr, "%f\n", d); >> -} >> - >> -extern "C" void printLong(sint64 l) { >> -  fprintf(stderr, "%lld\n", (long long int)l); >> -} >> - >> -extern "C" void printInt(sint32 i) { >> -  fprintf(stderr, "%d\n", i); >> -} >> - >> -extern "C" void printObject(void* ptr) { >> -  fprintf(stderr, "%p\n", ptr); >> -} > > > These methods can be really useful for debugging. It looks like you removed > all of them. Could you put them back? > Thanks! > Nicolas > _______________________________________________ > vmkit-commits mailing list > vmkit-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits > > -- ------------------------------------------------------------------------------------------------- Gaël Thomas, Associate Professor, University of Pierre and Marie Curie Boite courrier 169, 217 - 26-00, REGAL Team, INRIA/LIP6, 4, place Jussieu, Paris F-75005 Web: http://pagesperso-systeme.lip6.fr/Gael.Thomas/ Phone (mob): +33 6 10 39 31 17           Fax : +33 1 44 27 70 00 ------------------------------------------------------------------------------------------------- From gael.thomas at lip6.fr Wed Dec 1 08:12:07 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 16:12:07 -0000 Subject: [vmkit-commits] [vmkit] r120578 - in /vmkit/branches/multi-vm: include/mvm/VMKit.h lib/J3/Classpath/ClasspathVMThread.inc Message-ID: <20101201161208.085982A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 10:12:07 2010 New Revision: 120578 URL: http://llvm.org/viewvc/llvm-project?rev=120578&view=rev Log: the argument of the start routine of a thread is a mvm::Thread, not a JavaThread Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=120578&r1=120577&r2=120578&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Wed Dec 1 10:12:07 2010 @@ -8,10 +8,14 @@ class VMKit : public mvm::PermanentObject { public: /// allocator - Bump pointer allocator to allocate permanent memory of VMKit - /// mvm::BumpPtrAllocator& allocator; - VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) {} + VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { + } + + /// ------------------------------------------------- /// + /// --- thread managment --- /// + /// ------------------------------------------------- /// }; } Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc?rev=120578&r1=120577&r2=120578&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc Wed Dec 1 10:12:07 2010 @@ -32,13 +32,13 @@ return JavaThread::get()->currentThread(); } -void start(JavaThread* thread) { - +void start(mvm::Thread* mut) { JavaObjectVMThread* vmThread = NULL; JavaObject* javaThread = NULL; llvm_gcroot(vmThread, 0); llvm_gcroot(javaThread, 0); + JavaThread* thread = JavaThread::j3Thread(mut); Jnjvm* vm = thread->getJVM(); // Wait some time to let the creator initialise these fields. while ((thread->javaThread == NULL) || (thread->vmThread == NULL)) { From gael.thomas at lip6.fr Wed Dec 1 08:50:10 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 16:50:10 -0000 Subject: [vmkit-commits] [vmkit] r120579 - in /vmkit/branches/multi-vm: include/mvm/Threads/CollectionRV.h include/mvm/VirtualMachine.h lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/CommonThread/ctthread.cpp mmtk/mmtk-j3/ActivePlan.cpp Message-ID: <20101201165010.6EFE62A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 10:50:10 2010 New Revision: 120579 URL: http://llvm.org/viewvc/llvm-project?rev=120579&view=rev Log: move the linked list of threads in CollectionRV Modified: vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h?rev=120579&r1=120578&r2=120579&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h Wed Dec 1 10:50:10 2010 @@ -17,7 +17,17 @@ namespace mvm { class CollectionRV { +public: + /// oneThread - The main thread of this VM. + mvm::Thread* oneThread; + protected: + /// numberOfThreads - The number of threads that currently run under this VM. + uint32_t numberOfThreads; + + /// threadLock - Lock to create or destroy a new thread. + mvm::SpinLock threadLock; + /// _lockRV - Lock for synchronization. LockNormal _lockRV; @@ -33,6 +43,8 @@ public: CollectionRV() { nbJoined = 0; + oneThread = 0; + numberOfThreads = 0; } void lockRV() { _lockRV.lock(); } @@ -60,7 +72,14 @@ virtual void joinAfterUncooperative(void* SP) = 0; virtual void joinBeforeUncooperative() = 0; - virtual void addThread(Thread* th) = 0; + /// addThread - Add a new thread to the list of threads. + void addThread(mvm::Thread* th); + + /// removeThread - Remove the thread from the list of threads. + void removeThread(mvm::Thread* th); + + /// prepareForJoin - for uncooperative gc, prepare the SIGGC handler + virtual void prepareForJoin() = 0; }; class CooperativeCollectionRV : public CollectionRV { @@ -71,7 +90,7 @@ void join(); void joinAfterUncooperative(void* SP); void joinBeforeUncooperative(); - void addThread(Thread* th); + void prepareForJoin(); }; class UncooperativeCollectionRV : public CollectionRV { @@ -82,7 +101,7 @@ void join(); void joinAfterUncooperative(void* SP); void joinBeforeUncooperative(); - void addThread(Thread* th); + void prepareForJoin(); }; Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=120579&r1=120578&r2=120579&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Wed Dec 1 10:50:10 2010 @@ -56,8 +56,6 @@ protected: VirtualMachine(mvm::BumpPtrAllocator &Alloc, mvm::VMKit* vmk) : allocator(Alloc) { - mainThread = 0; - NumberOfThreads = 0; vmkit = vmk; } @@ -71,55 +69,13 @@ /// mvm::BumpPtrAllocator& allocator; -//===----------------------------------------------------------------------===// -// (1) Thread-related methods. -//===----------------------------------------------------------------------===// - - /// mainThread - The main thread of this VM. - /// - mvm::Thread* mainThread; - - /// NumberOfThreads - The number of threads that currently run under this VM. - /// - uint32_t NumberOfThreads; - - /// ThreadLock - Lock to create or destroy a new thread. - /// - mvm::SpinLock ThreadLock; - /// vmkit - a pointer to vmkit that contains information on all the vms + /// mvm::VMKit* vmkit; - - /// setMainThread - Set the main thread of this VM. - /// - void setMainThread(mvm::Thread* th) { mainThread = th; } - - /// getMainThread - Get the main thread of this VM. - /// - mvm::Thread* getMainThread() const { return mainThread; } - /// addThread - Add a new thread to the list of threads. - /// - void addThread(mvm::Thread* th) { - ThreadLock.lock(); - NumberOfThreads++; - if (th != mainThread) { - if (mainThread) th->append(mainThread); - else mainThread = th; - } - ThreadLock.unlock(); - } - - /// removeThread - Remove the thread from the list of threads. - /// - void removeThread(mvm::Thread* th) { - ThreadLock.lock(); - NumberOfThreads--; - if (mainThread == th) mainThread = (Thread*)th->next(); - th->remove(); - if (!NumberOfThreads) mainThread = 0; - ThreadLock.unlock(); - } +//===----------------------------------------------------------------------===// +// (1) Thread-related methods. +//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// // (2) GC-related methods. Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=120579&r1=120578&r2=120579&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Dec 1 10:50:10 2010 @@ -2134,7 +2134,6 @@ void JavaAOTCompiler::compileFile(Jnjvm* vm, const char* n) { name = n; vm->javaMainThread = JavaThread::create(vm); - vm->mainThread = vm->javaMainThread->mut; vm->javaMainThread->mut->start(mainCompilerStart); vm->waitForExit(); } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120579&r1=120578&r2=120579&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 1 10:50:10 2010 @@ -1342,8 +1342,7 @@ argumentsInfo.argc = argc; argumentsInfo.argv = argv; javaMainThread = JavaThread::create(this); - mainThread = javaMainThread->mut; - mainThread->start((void (*)(mvm::Thread*))mainJavaStart); + javaMainThread->mut->start((void (*)(mvm::Thread*))mainJavaStart); } Jnjvm::Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JnjvmBootstrapLoader* loader) : Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120579&r1=120578&r2=120579&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Wed Dec 1 10:50:10 2010 @@ -17,12 +17,30 @@ using namespace mvm; +void CollectionRV::addThread(mvm::Thread* th) { + threadLock.lock(); + numberOfThreads++; + if (th != oneThread) { + if (oneThread) th->append(oneThread); + else oneThread = th; + } + threadLock.unlock(); +} + +void CollectionRV::removeThread(mvm::Thread* th) { + threadLock.lock(); + numberOfThreads--; + if (oneThread == th) oneThread = (Thread*)th->next(); + th->remove(); + if (!numberOfThreads) oneThread = 0; + threadLock.unlock(); +} + void CollectionRV::another_mark() { - mvm::Thread* th = mvm::Thread::get(); assert(th->getLastSP() != NULL); assert(nbJoined < th->MyVM->NumberOfThreads); nbJoined++; - if (nbJoined == th->MyVM->NumberOfThreads) { + if (nbJoined == numberOfThreads) { condInitiator.broadcast(); } } @@ -37,11 +55,10 @@ } void CollectionRV::waitRV() { - mvm::Thread* self = mvm::Thread::get(); // Add myself. nbJoined++; - while (nbJoined != self->MyVM->NumberOfThreads) { + while (nbJoined != numberOfThreads) { condInitiator.wait(&_lockRV); } } @@ -51,7 +68,7 @@ mvm::Thread* self = mvm::Thread::get(); // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. - self->MyVM->ThreadLock.lock(); + threadLock.lock(); mvm::Thread* cur = self; do { @@ -93,7 +110,7 @@ mvm::Thread* self = mvm::Thread::get(); // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. - self->MyVM->ThreadLock.lock(); + threadLock.lock(); for (mvm::Thread* cur = (mvm::Thread*)self->next(); cur != self; cur = (mvm::Thread*)cur->next()) { @@ -205,18 +222,22 @@ assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); nbJoined = 0; - initiator->MyVM->ThreadLock.unlock(); + threadLock.unlock(); condEndRV.broadcast(); unlockRV(); initiator->inRV = false; } +void CooperativeCollectionRV::prepareForJoin() { + /// nothing to do +} + void UncooperativeCollectionRV::finishRV() { lockRV(); mvm::Thread* initiator = mvm::Thread::get(); assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); nbJoined = 0; - initiator->MyVM->ThreadLock.unlock(); + threadLock.unlock(); condEndRV.broadcast(); unlockRV(); initiator->inRV = false; @@ -230,16 +251,12 @@ 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) { +void UncooperativeCollectionRV::prepareForJoin() { // Set the SIGGC handler for uncooperative rendezvous. struct sigaction sa; sigset_t mask; Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120579&r1=120578&r2=120579&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Wed Dec 1 10:50:10 2010 @@ -428,9 +428,9 @@ #ifdef ISOLATE th->IsolateID = th->MyVM->IsolateID; #endif - th->MyVM->rendezvous.addThread(th); + th->MyVM->rendezvous.prepareForJoin(); th->routine(th); - th->MyVM->removeThread(th); + th->MyVM->rendezvous.removeThread(th); } @@ -445,7 +445,7 @@ 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); + MyVM->rendezvous.addThread(this); int res = pthread_create((pthread_t*)(void*)(&internalThreadID), &attributs, (void* (*)(void *))internalThreadStart, this); pthread_detach((pthread_t)internalThreadID); Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp?rev=120579&r1=120578&r2=120579&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp Wed Dec 1 10:50:10 2010 @@ -18,8 +18,8 @@ assert(A && "No active plan"); if (A->current == NULL) { - A->current = (mvm::MutatorThread*)mvm::Thread::get()->MyVM->mainThread; - } else if (A->current->next() == mvm::Thread::get()->MyVM->mainThread) { + A->current = (mvm::MutatorThread*)mvm::Thread::get()->MyVM->rendezvous.oneThread; + } else if (A->current->next() == mvm::Thread::get()->MyVM->rendezvous.oneThread) { A->current = NULL; return NULL; } else { From gael.thomas at lip6.fr Wed Dec 1 09:05:14 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 17:05:14 -0000 Subject: [vmkit-commits] [vmkit] r120581 - in /vmkit/branches/multi-vm: include/mvm/Threads/CollectionRV.h include/mvm/Threads/Thread.h lib/J3/VMCore/JavaThread.cpp lib/J3/VMCore/ReferenceQueue.cpp lib/Mvm/Compiler/mvm-runtime.ll lib/Mvm/GCMmap2/MutatorThread.h lib/Mvm/MMTk/MutatorThread.h Message-ID: <20101201170514.BF8582A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 11:05:14 2010 New Revision: 120581 URL: http://llvm.org/viewvc/llvm-project?rev=120581&view=rev Log: add a shortcut to vmkit in mvm::Thread Modified: vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MutatorThread.h vmkit/branches/multi-vm/lib/Mvm/MMTk/MutatorThread.h Modified: vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h?rev=120581&r1=120580&r2=120581&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h Wed Dec 1 11:05:14 2010 @@ -18,7 +18,7 @@ class CollectionRV { public: - /// oneThread - The main thread of this VM. + /// oneThread - One of the threads mvm::Thread* oneThread; protected: Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120581&r1=120580&r2=120581&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Wed Dec 1 11:05:14 2010 @@ -142,6 +142,7 @@ class ExceptionBuffer; class MutatorThread; +class VMKit; class VMThreadData { public: @@ -166,12 +167,13 @@ /// contains all thread-specific informations. class Thread : public CircularBase { public: - Thread() { + Thread(VMKit* vmk) { #ifdef RUNTIME_DWARF_EXCEPTIONS internalPendingException = 0; #else lastExceptionBuffer = 0; #endif + vmkit = vmk; lastKnownFrame = 0; pendingException = 0; } @@ -377,6 +379,10 @@ /// pendingException - the pending exception /// gc* pendingException; + + /// vmkit - a (shortcut) pointer to vmkit that contains information on all the vms + /// + mvm::VMKit* vmkit; }; #ifndef RUNTIME_DWARF_EXCEPTIONS Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp?rev=120581&r1=120580&r2=120581&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp Wed Dec 1 11:05:14 2010 @@ -41,7 +41,7 @@ } JavaThread *JavaThread::create(Jnjvm* isolate) { - mvm::MutatorThread *mut = new mvm::MutatorThread(); + mvm::MutatorThread *mut = new mvm::MutatorThread(isolate->vmkit); JavaThread *th = new JavaThread(mut, isolate); th->attach(); return th; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp?rev=120581&r1=120580&r2=120581&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp Wed Dec 1 11:05:14 2010 @@ -15,7 +15,8 @@ using namespace j3; -ReferenceThread::ReferenceThread(Jnjvm* vm) : +ReferenceThread::ReferenceThread(Jnjvm* vm) : + MutatorThread(vm->vmkit), WeakReferencesQueue(ReferenceQueue::WEAK), SoftReferencesQueue(ReferenceQueue::SOFT), PhantomReferencesQueue(ReferenceQueue::PHANTOM) { @@ -158,7 +159,7 @@ } -FinalizerThread::FinalizerThread(Jnjvm* vm) { +FinalizerThread::FinalizerThread(Jnjvm* vm) : MutatorThread(vm->vmkit) { FinalizationQueue = new gc*[INITIAL_QUEUE_SIZE]; QueueLength = INITIAL_QUEUE_SIZE; CurrentIndex = 0; Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll?rev=120581&r1=120580&r2=120581&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll Wed Dec 1 11:05:14 2010 @@ -21,7 +21,8 @@ ;;; field 11: void* lastExceptionBuffer ;;; field 12: void* vmData ;;; field 13: gc* pendingException -%Thread = type { %CircularBase, i32, i8*, i8*, i1, i1, i1, i8*, i8*, i8*, i8*, i8*, i8*, i8* } +;;; field 14: VMkit* vmkit +%Thread = type { %CircularBase, i32, i8*, i8*, i1, i1, i1, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8* } ;;; field 0: VT ;;; field 1: mvm::MutatorThread* mut Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MutatorThread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MutatorThread.h?rev=120581&r1=120580&r2=120581&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MutatorThread.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MutatorThread.h Wed Dec 1 11:05:14 2010 @@ -17,7 +17,7 @@ class MutatorThread : public mvm::Thread { public: - MutatorThread() : mvm::Thread() {} + MutatorThread(VMKit* vmkit) : mvm::Thread(vmkit) {} }; } Modified: vmkit/branches/multi-vm/lib/Mvm/MMTk/MutatorThread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/MMTk/MutatorThread.h?rev=120581&r1=120580&r2=120581&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/MMTk/MutatorThread.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/MMTk/MutatorThread.h Wed Dec 1 11:05:14 2010 @@ -18,7 +18,7 @@ class MutatorThread : public mvm::Thread { public: - MutatorThread() : mvm::Thread() { + MutatorThread(VMKit* vmkit) : mvm::Thread(vmkit) { MutatorContext = 0; } mvm::ThreadAllocator Allocator; From nicolas.geoffray at lip6.fr Wed Dec 1 10:13:10 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Wed, 01 Dec 2010 18:13:10 -0000 Subject: [vmkit-commits] [vmkit] r120583 - /vmkit/trunk/www/use_mmtk.html Message-ID: <20101201181310.84C462A6C12D@llvm.org> Author: geoffray Date: Wed Dec 1 12:13:10 2010 New Revision: 120583 URL: http://llvm.org/viewvc/llvm-project?rev=120583&view=rev Log: Update information for MMTk. Modified: vmkit/trunk/www/use_mmtk.html Modified: vmkit/trunk/www/use_mmtk.html URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/www/use_mmtk.html?rev=120583&r1=120582&r2=120583&view=diff ============================================================================== --- vmkit/trunk/www/use_mmtk.html (original) +++ vmkit/trunk/www/use_mmtk.html Wed Dec 1 12:13:10 2010 @@ -24,7 +24,18 @@ and build LLVM-GCC from SVN head.
  • Update PATH to include the llvm-gcc binary.
  • Re-configure LLVM.
  • -
  • Configure VMKit with three additional options: --with-gc=mmtk, --with-llvmgcc, and --with-mmtk-plan={marksweep|copyms}
  • +
  • Configure VMKit with three additional options:
  • +
      +
    • --with-gc=mmtk
    • +
    • --with-llvmgcc
    • +
    • --with-mmtk-plan=
    • +
        +
      • org.mmtk.plan.marksweep.MS (default)
      • +
      • org.mmtk.plan.copyms.CopyMS
      • +
      • org.mmtk.plan.semispace.SS
      • +
      • org.mmtk.plan.immix.Immix
      • +
      +
  • Build VMKit:
    • make ENABLE_OPTIMIZED=1
    • From gael.thomas at lip6.fr Wed Dec 1 11:28:33 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 19:28:33 -0000 Subject: [vmkit-commits] [vmkit] r120591 - in /vmkit/branches/multi-vm: include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/CommonThread/ctthread.cpp mmtk/mmtk-j3/ActivePlan.cpp mmtk/mmtk-j3/Collection.cpp Message-ID: <20101201192833.BCF882A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 13:28:33 2010 New Revision: 120591 URL: http://llvm.org/viewvc/llvm-project?rev=120591&view=rev Log: move the rendezvous in mvm::VMKit Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=120591&r1=120590&r2=120591&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Wed Dec 1 13:28:33 2010 @@ -2,6 +2,7 @@ #define _VMKIT_H_ #include "mvm/Allocator.h" +#include "mvm/Threads/CollectionRV.h" namespace mvm { @@ -16,6 +17,15 @@ /// ------------------------------------------------- /// /// --- thread managment --- /// /// ------------------------------------------------- /// + + /// rendezvous - The rendezvous implementation for garbage collection. + /// +#ifdef WITH_LLVM_GCC + CooperativeCollectionRV rendezvous; +#else + UncooperativeCollectionRV rendezvous; +#endif + }; } Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=120591&r1=120590&r2=120591&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Wed Dec 1 13:28:33 2010 @@ -127,14 +127,6 @@ /// virtual const char* getObjectTypeName(gc* object) { return "An object"; } - /// rendezvous - The rendezvous implementation for garbage collection. - /// -#ifdef WITH_LLVM_GCC - CooperativeCollectionRV rendezvous; -#else - UncooperativeCollectionRV rendezvous; -#endif - //===----------------------------------------------------------------------===// // (3) Backtrace-related methods. //===----------------------------------------------------------------------===// Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120591&r1=120590&r2=120591&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Wed Dec 1 13:28:33 2010 @@ -12,6 +12,7 @@ #include "MvmGC.h" #include "mvm/VirtualMachine.h" #include "mvm/Threads/CollectionRV.h" +#include "mvm/VMKit.h" #include "debug.h" @@ -204,7 +205,7 @@ extern "C" void conditionalSafePoint() { mvm::Thread* th = mvm::Thread::get(); - th->MyVM->rendezvous.join(); + th->vmkit->rendezvous.join(); } void CooperativeCollectionRV::finishRV() { @@ -253,7 +254,7 @@ static void siggcHandler(int) { mvm::Thread* th = mvm::Thread::get(); - th->MyVM->rendezvous.join(); + th->vmkit->rendezvous.join(); } void UncooperativeCollectionRV::prepareForJoin() { Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120591&r1=120590&r2=120591&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Wed Dec 1 13:28:33 2010 @@ -15,6 +15,7 @@ #include "mvm/Threads/Cond.h" #include "mvm/Threads/Locks.h" #include "mvm/Threads/Thread.h" +#include "mvm/VMKit.h" #include #include @@ -51,18 +52,18 @@ Thread* th = mvm::Thread::get(); if (th->isMvmThread()) { if (th->doYield && !th->inRV) { - th->MyVM->rendezvous.join(); + th->vmkit->rendezvous.join(); } } sched_yield(); } void Thread::joinRVBeforeEnter() { - MyVM->rendezvous.joinBeforeUncooperative(); + vmkit->rendezvous.joinBeforeUncooperative(); } void Thread::joinRVAfterLeave(void* savedSP) { - MyVM->rendezvous.joinAfterUncooperative(savedSP); + vmkit->rendezvous.joinAfterUncooperative(savedSP); } void Thread::startKnownFrame(KnownFrame& F) { @@ -428,9 +429,9 @@ #ifdef ISOLATE th->IsolateID = th->MyVM->IsolateID; #endif - th->MyVM->rendezvous.prepareForJoin(); + th->vmkit->rendezvous.prepareForJoin(); th->routine(th); - th->MyVM->rendezvous.removeThread(th); + th->vmkit->rendezvous.removeThread(th); } @@ -445,7 +446,7 @@ 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->rendezvous.addThread(this); + vmkit->rendezvous.addThread(this); int res = pthread_create((pthread_t*)(void*)(&internalThreadID), &attributs, (void* (*)(void *))internalThreadStart, this); pthread_detach((pthread_t)internalThreadID); Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp?rev=120591&r1=120590&r2=120591&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp Wed Dec 1 13:28:33 2010 @@ -9,6 +9,7 @@ #include "debug.h" #include "mvm/VirtualMachine.h" +#include "mvm/VMKit.h" #include "MMTkObject.h" #include "MutatorThread.h" @@ -18,8 +19,8 @@ assert(A && "No active plan"); if (A->current == NULL) { - A->current = (mvm::MutatorThread*)mvm::Thread::get()->MyVM->rendezvous.oneThread; - } else if (A->current->next() == mvm::Thread::get()->MyVM->rendezvous.oneThread) { + A->current = (mvm::MutatorThread*)mvm::Thread::get()->vmkit->rendezvous.oneThread; + } else if (A->current->next() == mvm::Thread::get()->vmkit->rendezvous.oneThread) { A->current = NULL; return NULL; } else { Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp?rev=120591&r1=120590&r2=120591&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp Wed Dec 1 13:28:33 2010 @@ -9,6 +9,7 @@ #include "debug.h" #include "mvm/VirtualMachine.h" +#include "mvm/VMKit.h" #include "MMTkObject.h" #include "MvmGC.h" @@ -35,14 +36,14 @@ mvm::Thread* th = mvm::Thread::get(); // Verify that another collection is not happening. - th->MyVM->rendezvous.startRV(); + th->vmkit->rendezvous.startRV(); if (th->doYield) { - th->MyVM->rendezvous.cancelRV(); - th->MyVM->rendezvous.join(); + th->vmkit->rendezvous.cancelRV(); + th->vmkit->rendezvous.join(); return; } else { th->MyVM->startCollection(); - th->MyVM->rendezvous.synchronize(); + th->vmkit->rendezvous.synchronize(); JnJVM_org_mmtk_plan_Plan_setCollectionTriggered__(); @@ -72,7 +73,7 @@ elapsedTime / 1000000); } - th->MyVM->rendezvous.finishRV(); + th->vmkit->rendezvous.finishRV(); th->MyVM->endCollection(); } @@ -81,7 +82,7 @@ extern "C" void Java_org_j3_mmtk_Collection_joinCollection__ (MMTkObject* C) { mvm::Thread* th = mvm::Thread::get(); assert(th->inRV && "Joining collection without a rendezvous"); - th->MyVM->rendezvous.join(); + th->vmkit->rendezvous.join(); } extern "C" int Java_org_j3_mmtk_Collection_rendezvous__I (MMTkObject* C, int where) { From gael.thomas at lip6.fr Wed Dec 1 14:00:11 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 22:00:11 -0000 Subject: [vmkit-commits] [vmkit] r120611 - in /vmkit/branches/multi-vm: include/j3/ include/mvm/ include/mvm/GC/ include/mvm/Threads/ lib/J3/Classpath/ lib/J3/Compiler/ lib/J3/VMCore/ lib/Mvm/Allocator/ lib/Mvm/BoehmGC/ lib/Mvm/CommonThread/ lib/Mvm/Compiler/ lib/Mvm/GCMmap2/ lib/Mvm/MMTk/ lib/Mvm/Runtime/ mmtk/mmtk-alloc/ mmtk/mmtk-j3/ tools/j3/ tools/n3-mono/ tools/n3-pnetlib/ tools/testCollector/ tools/vmjc/ tools/vmkit/ tools/vtoffset/ Message-ID: <20101201220011.7AB032A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 16:00:10 2010 New Revision: 120611 URL: http://llvm.org/viewvc/llvm-project?rev=120611&view=rev Log: First, simplify the managment of the different gc. Externally, we just have to include mvm/GC.h (moved from mvm/GC/GC.h) which include the specific MvmGC.h. Second, a MvmGC.h must define the class collectable (was gc) and GCVirtualTable (was VirtualTable) and they must inherits from gcroot and CommonVirtualTable. The classes gc an VirtualTable are now defined in GC.h. Third, move gc and VirtualTable in namespace mvm. Added: vmkit/branches/multi-vm/include/mvm/GC.h - copied, changed from r120463, vmkit/branches/multi-vm/include/mvm/GC/GC.h Removed: vmkit/branches/multi-vm/include/mvm/GC/ vmkit/branches/multi-vm/lib/Mvm/MMTk/MutatorThread.cpp Modified: vmkit/branches/multi-vm/include/j3/JavaCompiler.h vmkit/branches/multi-vm/include/mvm/Allocator.h vmkit/branches/multi-vm/include/mvm/JIT.h vmkit/branches/multi-vm/include/mvm/MethodInfo.h vmkit/branches/multi-vm/include/mvm/Threads/Locks.h vmkit/branches/multi-vm/include/mvm/Threads/ObjectLocks.h vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathReflect.h vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMObject.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JNIReferences.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h vmkit/branches/multi-vm/lib/Mvm/BoehmGC/MvmGC.h vmkit/branches/multi-vm/lib/Mvm/BoehmGC/gc.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ObjectLocks.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctlock.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/Compiler/EscapeAnalysis.cpp vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gc.cpp vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gcinit.cpp vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.cpp vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h vmkit/branches/multi-vm/lib/Mvm/Runtime/MethodInfo.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp vmkit/branches/multi-vm/mmtk/mmtk-alloc/Selected.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/MMTkObject.h vmkit/branches/multi-vm/mmtk/mmtk-j3/ObjectModel.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp vmkit/branches/multi-vm/tools/j3/Main.cpp vmkit/branches/multi-vm/tools/n3-mono/Main.cpp vmkit/branches/multi-vm/tools/n3-pnetlib/Main.cpp vmkit/branches/multi-vm/tools/testCollector/Main.cpp vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp vmkit/branches/multi-vm/tools/vmkit/CommandLine.cpp vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp vmkit/branches/multi-vm/tools/vtoffset/VTOffset.cpp Modified: vmkit/branches/multi-vm/include/j3/JavaCompiler.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/j3/JavaCompiler.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/j3/JavaCompiler.h (original) +++ vmkit/branches/multi-vm/include/j3/JavaCompiler.h Wed Dec 1 16:00:10 2010 @@ -15,7 +15,7 @@ #include #include -#include "mvm/GC/GC.h" +#include "mvm/GC.h" #include "mvm/Allocator.h" namespace mvm { Modified: vmkit/branches/multi-vm/include/mvm/Allocator.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Allocator.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Allocator.h (original) +++ vmkit/branches/multi-vm/include/mvm/Allocator.h Wed Dec 1 16:00:10 2010 @@ -18,8 +18,6 @@ #include "mvm/Threads/Locks.h" -class VirtualTable; - #define declare_gcroot(type, name) type name; llvm_gcroot(name, 0); name namespace mvm { Copied: vmkit/branches/multi-vm/include/mvm/GC.h (from r120463, vmkit/branches/multi-vm/include/mvm/GC/GC.h) URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/GC.h?p2=vmkit/branches/multi-vm/include/mvm/GC.h&p1=vmkit/branches/multi-vm/include/mvm/GC/GC.h&r1=120463&r2=120611&rev=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/GC/GC.h (original) +++ vmkit/branches/multi-vm/include/mvm/GC.h Wed Dec 1 16:00:10 2010 @@ -8,36 +8,56 @@ //===----------------------------------------------------------------------===// -#ifndef MVM_GC_H -#define MVM_GC_H +#ifndef _GC_H_ +#define _GC_H_ #include #include "ObjectHeader.h" -struct VirtualTable; +namespace mvm { + + class VirtualTable; + class gc; -class gcRoot { -public: - virtual ~gcRoot() {} - virtual void tracer(uintptr_t closure) {} - uintptr_t header; + class gcRoot { + public: + virtual ~gcRoot() {} + virtual void tracer(uintptr_t closure) {} + uintptr_t header; - /// getVirtualTable - Returns the virtual table of this object. - /// - VirtualTable* getVirtualTable() const { - return ((VirtualTable**)(this))[0]; - } + /// getVirtualTable - Returns the virtual table of this object. + /// + VirtualTable* getVirtualTable() const { + return ((VirtualTable**)(this))[0]; + } - /// setVirtualTable - Sets the virtual table of this object. - /// - void setVirtualTable(VirtualTable* VT) { - ((VirtualTable**)(this))[0] = VT; - } -}; + /// setVirtualTable - Sets the virtual table of this object. + /// + void setVirtualTable(VirtualTable* VT) { + ((VirtualTable**)(this))[0] = VT; + } + }; + + class CommonVirtualTable { + public: + }; + +} // namespace mvm + +#include "MvmGC.h" namespace mvm { + class gc : public collectable { + }; + + class VirtualTable : public GCVirtualTable { + public: + VirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) : GCVirtualTable(d, o, t) {} + VirtualTable() {} + }; + static const uint32_t HashBits = 8; static const uint64_t GCBitMask = ((1 << GCBits) - 1); -} +} // namespace mvm #endif Modified: vmkit/branches/multi-vm/include/mvm/JIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/JIT.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/JIT.h (original) +++ vmkit/branches/multi-vm/include/mvm/JIT.h Wed Dec 1 16:00:10 2010 @@ -19,7 +19,7 @@ #include "llvm/Target/TargetMachine.h" #include "mvm/MethodInfo.h" -#include "mvm/GC/GC.h" +#include "mvm/GC.h" namespace llvm { class Constant; Modified: vmkit/branches/multi-vm/include/mvm/MethodInfo.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/MethodInfo.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/MethodInfo.h (original) +++ vmkit/branches/multi-vm/include/mvm/MethodInfo.h Wed Dec 1 16:00:10 2010 @@ -11,7 +11,7 @@ #define MVM_METHODINFO_H #include "mvm/Allocator.h" -#include "mvm/GC/GC.h" +#include "mvm/GC.h" namespace mvm { Modified: vmkit/branches/multi-vm/include/mvm/Threads/Locks.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Locks.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Locks.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Locks.h Wed Dec 1 16:00:10 2010 @@ -24,10 +24,10 @@ #define llvm_gcroot(a, b) #endif -class gc; - namespace mvm { +class gc; + extern "C" uint8 llvm_atomic_cmp_swap_i8(uint8* ptr, uint8 cmp, uint8 val); extern "C" uint16 llvm_atomic_cmp_swap_i16(uint16* ptr, uint16 cmp, Modified: vmkit/branches/multi-vm/include/mvm/Threads/ObjectLocks.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/ObjectLocks.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/ObjectLocks.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/ObjectLocks.h Wed Dec 1 16:00:10 2010 @@ -12,7 +12,7 @@ #include "ObjectHeader.h" #include "mvm/Allocator.h" -#include "mvm/GC/GC.h" +#include "mvm/GC.h" #include "mvm/Threads/Cond.h" #include "mvm/Threads/Locks.h" #include "mvm/Threads/Thread.h" Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Wed Dec 1 16:00:10 2010 @@ -34,10 +34,9 @@ #define END_CATCH } #endif -class gc; - namespace mvm { +class gc; class MethodInfo; class VirtualMachine; Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Wed Dec 1 16:00:10 2010 @@ -13,7 +13,7 @@ #include "mvm/Allocator.h" #include "mvm/Threads/CollectionRV.h" #include "mvm/Threads/Locks.h" -#include "mvm/GC/GC.h" +#include "mvm/GC.h" #include #include Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc Wed Dec 1 16:00:10 2010 @@ -78,7 +78,7 @@ ArrayObject* args, JavaObject* Clazz, jint index) { JavaObject* res = 0; - gc* excp = 0; + mvm::gc* excp = 0; JavaObject* jexcp; llvm_gcroot(cons, 0); Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc Wed Dec 1 16:00:10 2010 @@ -99,7 +99,7 @@ JavaObject* res = 0; JavaObject* jexc = 0; - gc* exc = 0; + mvm::gc* exc = 0; llvm_gcroot(res, 0); llvm_gcroot(Meth, 0); Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathReflect.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathReflect.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathReflect.h (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathReflect.h Wed Dec 1 16:00:10 2010 @@ -10,7 +10,7 @@ #ifndef JNJVM_CLASSPATH_REFLECT_H #define JNJVM_CLASSPATH_REFLECT_H -#include "MvmGC.h" +#include "mvm/GC.h" #include "JavaClass.h" #include "JavaObject.h" Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMObject.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMObject.inc?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMObject.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMObject.inc Wed Dec 1 16:00:10 2010 @@ -47,7 +47,7 @@ assert(cl->isClass() && "Not a class!"); size = cl->asClass()->getVirtualSize(); } - res = (JavaObject*)gc::operator new(size, src->getVirtualTable()); + res = (JavaObject*)mvm::gc::operator new(size, src->getVirtualTable()); memcpy((void*)((uintptr_t)res + 2 * sizeof(void*)), (void*)((uintptr_t)src + 2 * sizeof(void*)), size - 2 * sizeof(void*)); Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc Wed Dec 1 16:00:10 2010 @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// -#include "MvmGC.h" +#include "mvm/GC.h" #include "types.h" Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Dec 1 16:00:10 2010 @@ -1415,7 +1415,7 @@ Elemts.push_back(Tracer ? ConstantExpr::getCast(Instruction::BitCast, Tracer, PTy) : N); - for (uint32_t i = 0; i < VirtualTable::numberOfSpecializedTracers(); i++) { + for (uint32_t i = 0; i < mvm::VirtualTable::numberOfSpecializedTracers(); i++) { // Push null for now. Elemts.push_back(N); } @@ -2211,11 +2211,11 @@ #ifdef WITH_MMTK #include -extern std::set __InternalSet__; +extern std::set __InternalSet__; CommonClass* JavaAOTCompiler::getUniqueBaseClass(CommonClass* cl) { - std::set::iterator I = __InternalSet__.begin(); - std::set::iterator E = __InternalSet__.end(); + std::set::iterator I = __InternalSet__.begin(); + std::set::iterator E = __InternalSet__.end(); CommonClass* currentClass = 0; for (; I != E; ++I) { Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Wed Dec 1 16:00:10 2010 @@ -24,7 +24,7 @@ #include "llvm/Support/raw_ostream.h" #include <../lib/ExecutionEngine/JIT/JIT.h> -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/VirtualMachine.h" #include "mvm/VMKit.h" Modified: vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp Wed Dec 1 16:00:10 2010 @@ -16,7 +16,7 @@ #include "llvm/Support/MutexGuard.h" #include "llvm/Target/TargetData.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/JIT.h" #include "JavaConstantPool.h" Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JNIReferences.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JNIReferences.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JNIReferences.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JNIReferences.h Wed Dec 1 16:00:10 2010 @@ -25,7 +25,7 @@ private: JNILocalReferences* prev; uint32_t length; - gc* localReferences[MAXIMUM_REFERENCES]; + mvm::gc* localReferences[MAXIMUM_REFERENCES]; public: @@ -34,7 +34,7 @@ length = 0; } - gc** addJNIReference(JavaThread* th, gc* obj); + mvm::gc** addJNIReference(JavaThread* th, mvm::gc* obj); void removeJNIReferences(JavaThread* th, uint32_t num); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp Wed Dec 1 16:00:10 2010 @@ -263,9 +263,9 @@ UserCommonClass* cl = baseClass(); uint32 logSize = cl->isPrimitive() ? cl->asPrimitiveClass()->logSize : (sizeof(JavaObject*) == 8 ? 3 : 2); - VirtualTable* VT = virtualVT; + mvm::VirtualTable* VT = virtualVT; uint32 size = sizeof(JavaObject) + sizeof(ssize_t) + (n << logSize); - res = (JavaObject*)gc::operator new(size, VT); + res = (JavaObject*)mvm::gc::operator new(size, VT); JavaArray::setSize(res, n); return res; } @@ -456,7 +456,7 @@ this == classLoader->bootstrapLoader->upcalls->newClass) && "Uninitialized class when allocating."); assert(getVirtualVT() && "No VT\n"); - res = (JavaObject*)gc::operator new(getVirtualSize(), getVirtualVT()); + res = (JavaObject*)mvm::gc::operator new(getVirtualSize(), getVirtualVT()); return res; } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h Wed Dec 1 16:00:10 2010 @@ -11,7 +11,7 @@ #define JNJVM_JAVA_OBJECT_H #include "mvm/Allocator.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/UTF8.h" #include "mvm/Threads/Locks.h" #include "mvm/Threads/Thread.h" @@ -46,7 +46,7 @@ /// These are placed here for fast access of information from a Java object /// (that only points to the VT, not the class). /// -class JavaVirtualTable : public VirtualTable { +class JavaVirtualTable : public mvm::VirtualTable { public: /// cl - The class which defined this virtual table. @@ -228,7 +228,7 @@ /// JavaObject - This class represents a Java object. /// -class JavaObject : public gc { +class JavaObject : public mvm::gc { private: /// waitIntern - internal wait on a monitor Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp Wed Dec 1 16:00:10 2010 @@ -53,7 +53,7 @@ // exception check. Therefore, we trick LLVM to check the return value of the // function. #define hack_check(type) \ - gc* obj = mvm::Thread::get()->getPendingException(); \ + mvm::gc* obj = mvm::Thread::get()->getPendingException(); \ if (obj) return (type)obj; hack_check(void*); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp Wed Dec 1 16:00:10 2010 @@ -139,8 +139,7 @@ } } -gc** JNILocalReferences::addJNIReference(JavaThread* th, - gc* obj) { +mvm::gc** JNILocalReferences::addJNIReference(JavaThread* th, mvm::gc* obj) { llvm_gcroot(obj, 0); if (length == MAXIMUM_REFERENCES) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h Wed Dec 1 16:00:10 2010 @@ -89,7 +89,7 @@ /// JNILocalReferences* localJNIRefs; - gc** pushJNIRef(gc* obj) { + mvm::gc** pushJNIRef(mvm::gc* obj) { llvm_gcroot(obj, 0); if (!obj) return 0; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp Wed Dec 1 16:00:10 2010 @@ -187,7 +187,7 @@ BEGIN_JNI_EXCEPTION - gc* obj = mut->getPendingException(); + mvm::gc* obj = mut->getPendingException(); llvm_gcroot(obj, 0); if (obj == NULL) RETURN_FROM_JNI(NULL); jthrowable res = (jthrowable)JavaThread::j3Thread(mut)->pushJNIRef(obj); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 1 16:00:10 2010 @@ -20,7 +20,7 @@ #include "mvm/Threads/Thread.h" #include "mvm/VMKit.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include "ClasspathReflect.h" #include "JavaArray.h" @@ -47,7 +47,7 @@ /// initialiseClass - Java class initialisation. Java specification §2.17.5. void UserClass::initialiseClass(Jnjvm* vm) { - gc* exc = NULL; + mvm::gc* exc = NULL; JavaObject* obj = NULL; JavaObject* jexc; @@ -1182,7 +1182,7 @@ } void Jnjvm::executeClass(const char* className, ArrayObject* args) { - gc* exc = NULL; + mvm::gc* exc = NULL; JavaObject* obj = NULL; JavaObject* group = NULL; @@ -1270,7 +1270,7 @@ JavaString* str = NULL; JavaObject* instrumenter = NULL; ArrayObject* args = NULL; - gc* exc = NULL; + mvm::gc* exc = NULL; JavaObject *jexc; llvm_gcroot(jexc, 0); @@ -1422,12 +1422,12 @@ finalizerThread->scanFinalizationQueue(closure); } -void Jnjvm::addFinalizationCandidate(gc* object) { +void Jnjvm::addFinalizationCandidate(mvm::gc* object) { llvm_gcroot(object, 0); finalizerThread->addFinalizationCandidate(object); } -size_t Jnjvm::getObjectSize(gc* object) { +size_t Jnjvm::getObjectSize(mvm::gc* object) { // TODO: because this is called during GC, there is no need to do // llvm_gcroot. For clarity, it may be useful to have a special type // in this case. @@ -1453,7 +1453,7 @@ return size; } -const char* Jnjvm::getObjectTypeName(gc* object) { +const char* Jnjvm::getObjectTypeName(mvm::gc* object) { JavaObject* src = (JavaObject*)object; if (VMClassLoader::isVMClassLoader(src)) { return "VMClassLoader"; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Wed Dec 1 16:00:10 2010 @@ -137,9 +137,9 @@ virtual void scanSoftReferencesQueue(uintptr_t closure); virtual void scanPhantomReferencesQueue(uintptr_t closure); virtual void scanFinalizationQueue(uintptr_t closure); - virtual void addFinalizationCandidate(gc* obj); - virtual size_t getObjectSize(gc* obj); - virtual const char* getObjectTypeName(gc* obj); + virtual void addFinalizationCandidate(mvm::gc* obj); + virtual size_t getObjectSize(mvm::gc* obj); + virtual const char* getObjectTypeName(mvm::gc* obj); /// CreateError - Creates a Java object of the specified exception class /// and calling its function. @@ -368,7 +368,7 @@ // asjavaException - convert from gc to JavaObject. Will be used to identify the points // where we must test the original vm of the exception - static JavaObject* asJavaException(gc* o) { llvm_gcroot(o, 0); return (JavaObject*)o; } + static JavaObject* asJavaException(mvm::gc* o) { llvm_gcroot(o, 0); return (JavaObject*)o; } }; } // end namespace j3 Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Wed Dec 1 16:00:10 2010 @@ -669,7 +669,7 @@ UserClass* JnjvmClassLoader::constructClass(const UTF8* name, ClassBytes* bytes) { - gc* excp = NULL; + mvm::gc* excp = NULL; llvm_gcroot(excp, 0); UserClass* res = NULL; lock.lock(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h Wed Dec 1 16:00:10 2010 @@ -452,7 +452,7 @@ /// VT - The VirtualTable for this GC-class. /// - static VirtualTable VT; + static mvm::VirtualTable VT; /// Is the object a VMClassLoader object? /// Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp Wed Dec 1 16:00:10 2010 @@ -21,7 +21,7 @@ SoftReferencesQueue(ReferenceQueue::SOFT), PhantomReferencesQueue(ReferenceQueue::PHANTOM) { - ToEnqueue = new gc*[INITIAL_QUEUE_SIZE]; + ToEnqueue = new mvm::gc*[INITIAL_QUEUE_SIZE]; ToEnqueueLength = INITIAL_QUEUE_SIZE; ToEnqueueIndex = 0; @@ -29,7 +29,7 @@ } -bool enqueueReference(gc* _obj) { +bool enqueueReference(mvm::gc* _obj) { Jnjvm* vm = JavaThread::get()->getJVM(); JavaObject* obj = (JavaObject*)_obj; llvm_gcroot(obj, 0); @@ -38,7 +38,7 @@ return (bool)meth->invokeIntSpecialBuf(vm, cl, obj, 0); } -void invokeEnqueue(gc* res) { +void invokeEnqueue(mvm::gc* res) { llvm_gcroot(res, 0); TRY { enqueueReference(res); @@ -47,7 +47,7 @@ } void ReferenceThread::enqueueStart(ReferenceThread* th) { - gc* res = NULL; + mvm::gc* res = NULL; llvm_gcroot(res, 0); while (true) { @@ -73,11 +73,11 @@ } -void ReferenceThread::addToEnqueue(gc* obj) { +void ReferenceThread::addToEnqueue(mvm::gc* obj) { llvm_gcroot(obj, 0); if (ToEnqueueIndex >= ToEnqueueLength) { uint32 newLength = ToEnqueueLength * GROW_FACTOR; - gc** newQueue = new gc*[newLength]; + mvm::gc** newQueue = new mvm::gc*[newLength]; if (!newQueue) { fprintf(stderr, "I don't know how to handle reference overflow yet!\n"); abort(); @@ -92,32 +92,32 @@ ToEnqueue[ToEnqueueIndex++] = obj; } -gc** getReferentPtr(gc* _obj) { +mvm::gc** getReferentPtr(mvm::gc* _obj) { JavaObjectReference* obj = (JavaObjectReference*)_obj; llvm_gcroot(obj, 0); - return (gc**)JavaObjectReference::getReferentPtr(obj); + return (mvm::gc**)JavaObjectReference::getReferentPtr(obj); } -void setReferent(gc* _obj, gc* val) { +void setReferent(mvm::gc* _obj, mvm::gc* val) { JavaObjectReference* obj = (JavaObjectReference*)_obj; llvm_gcroot(obj, 0); llvm_gcroot(val, 0); JavaObjectReference::setReferent(obj, (JavaObject*)val); } -void clearReferent(gc* _obj) { +void clearReferent(mvm::gc* _obj) { JavaObjectReference* obj = (JavaObjectReference*)_obj; llvm_gcroot(obj, 0); JavaObjectReference::setReferent(obj, NULL); } -gc* ReferenceQueue::processReference(gc* reference, ReferenceThread* th, uintptr_t closure) { +mvm::gc* ReferenceQueue::processReference(mvm::gc* reference, ReferenceThread* th, uintptr_t closure) { if (!mvm::Collector::isLive(reference, closure)) { clearReferent(reference); return NULL; } - gc* referent = *(getReferentPtr(reference)); + mvm::gc* referent = *(getReferentPtr(reference)); if (!referent) { return NULL; @@ -132,10 +132,10 @@ // Nothing to do. } - gc* newReference = + mvm::gc* newReference = mvm::Collector::getForwardedReference(reference, closure); if (mvm::Collector::isLive(referent, closure)) { - gc* newReferent = mvm::Collector::getForwardedReferent(referent, closure); + mvm::gc* newReferent = mvm::Collector::getForwardedReferent(referent, closure); setReferent(newReference, newReferent); return newReference; } else { @@ -150,8 +150,8 @@ uint32 NewIndex = 0; for (uint32 i = 0; i < CurrentIndex; ++i) { - gc* obj = References[i]; - gc* res = processReference(obj, th, closure); + mvm::gc* obj = References[i]; + mvm::gc* res = processReference(obj, th, closure); if (res) References[NewIndex++] = res; } @@ -160,11 +160,11 @@ FinalizerThread::FinalizerThread(Jnjvm* vm) : MutatorThread(vm->vmkit) { - FinalizationQueue = new gc*[INITIAL_QUEUE_SIZE]; + FinalizationQueue = new mvm::gc*[INITIAL_QUEUE_SIZE]; QueueLength = INITIAL_QUEUE_SIZE; CurrentIndex = 0; - ToBeFinalized = new gc*[INITIAL_QUEUE_SIZE]; + ToBeFinalized = new mvm::gc*[INITIAL_QUEUE_SIZE]; ToBeFinalizedLength = INITIAL_QUEUE_SIZE; CurrentFinalizedIndex = 0; @@ -174,7 +174,7 @@ void FinalizerThread::growFinalizationQueue() { if (CurrentIndex >= QueueLength) { uint32 newLength = QueueLength * GROW_FACTOR; - gc** newQueue = new gc*[newLength]; + mvm::gc** newQueue = new mvm::gc*[newLength]; if (!newQueue) { fprintf(stderr, "I don't know how to handle finalizer overflows yet!\n"); abort(); @@ -189,7 +189,7 @@ void FinalizerThread::growToBeFinalizedQueue() { if (CurrentFinalizedIndex >= ToBeFinalizedLength) { uint32 newLength = ToBeFinalizedLength * GROW_FACTOR; - gc** newQueue = new gc*[newLength]; + mvm::gc** newQueue = new mvm::gc*[newLength]; if (!newQueue) { fprintf(stderr, "I don't know how to handle finalizer overflows yet!\n"); abort(); @@ -202,7 +202,7 @@ } -void FinalizerThread::addFinalizationCandidate(gc* obj) { +void FinalizerThread::addFinalizationCandidate(mvm::gc* obj) { llvm_gcroot(obj, 0); FinalizationQueueLock.acquire(); @@ -218,7 +218,7 @@ void FinalizerThread::scanFinalizationQueue(uintptr_t closure) { uint32 NewIndex = 0; for (uint32 i = 0; i < CurrentIndex; ++i) { - gc* obj = FinalizationQueue[i]; + mvm::gc* obj = FinalizationQueue[i]; if (!mvm::Collector::isLive(obj, closure)) { obj = mvm::Collector::retainForFinalize(FinalizationQueue[i], closure); @@ -238,7 +238,7 @@ typedef void (*destructor_t)(void*); -void invokeFinalizer(gc* _obj) { +void invokeFinalizer(mvm::gc* _obj) { Jnjvm* vm = JavaThread::get()->getJVM(); JavaObject* obj = (JavaObject*)_obj; llvm_gcroot(obj, 0); @@ -247,7 +247,7 @@ meth->invokeIntVirtualBuf(vm, cl, obj, 0); } -void invokeFinalize(gc* res) { +void invokeFinalize(mvm::gc* res) { llvm_gcroot(res, 0); TRY { invokeFinalizer(res); @@ -256,7 +256,7 @@ } void FinalizerThread::finalizerStart(FinalizerThread* th) { - gc* res = NULL; + mvm::gc* res = NULL; llvm_gcroot(res, 0); while (true) { @@ -275,7 +275,7 @@ th->FinalizationQueueLock.release(); if (!res) break; - VirtualTable* VT = res->getVirtualTable(); + mvm::VirtualTable* VT = res->getVirtualTable(); if (VT->operatorDelete) { destructor_t dest = (destructor_t)VT->destructor; dest(res); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h Wed Dec 1 16:00:10 2010 @@ -25,13 +25,13 @@ class ReferenceQueue { private: - gc** References; + mvm::gc** References; uint32 QueueLength; uint32 CurrentIndex; mvm::SpinLock QueueLock; uint8_t semantics; - gc* processReference(gc*, ReferenceThread*, uintptr_t closure); + mvm::gc* processReference(mvm::gc*, ReferenceThread*, uintptr_t closure); public: static const uint8_t WEAK = 1; @@ -40,8 +40,8 @@ ReferenceQueue(uint8_t s) { - References = new gc*[INITIAL_QUEUE_SIZE]; - memset(References, 0, INITIAL_QUEUE_SIZE * sizeof(gc*)); + References = new mvm::gc*[INITIAL_QUEUE_SIZE]; + memset(References, 0, INITIAL_QUEUE_SIZE * sizeof(mvm::gc*)); QueueLength = INITIAL_QUEUE_SIZE; CurrentIndex = 0; semantics = s; @@ -51,13 +51,13 @@ delete[] References; } - void addReference(gc* ref) { + void addReference(mvm::gc* ref) { llvm_gcroot(ref, 0); QueueLock.acquire(); if (CurrentIndex >= QueueLength) { uint32 newLength = QueueLength * GROW_FACTOR; - gc** newQueue = new gc*[newLength]; - memset(newQueue, 0, newLength * sizeof(gc*)); + mvm::gc** newQueue = new mvm::gc*[newLength]; + memset(newQueue, 0, newLength * sizeof(mvm::gc*)); if (!newQueue) { fprintf(stderr, "I don't know how to handle reference overflow yet!\n"); abort(); @@ -96,7 +96,7 @@ /// ReferenceQueue PhantomReferencesQueue; - gc** ToEnqueue; + mvm::gc** ToEnqueue; uint32 ToEnqueueLength; uint32 ToEnqueueIndex; @@ -106,27 +106,27 @@ mvm::Cond EnqueueCond; mvm::SpinLock ToEnqueueLock; - void addToEnqueue(gc* obj); + void addToEnqueue(mvm::gc* obj); static void enqueueStart(ReferenceThread*); /// addWeakReference - Add a weak reference to the queue. /// - void addWeakReference(gc* ref) { + void addWeakReference(mvm::gc* ref) { llvm_gcroot(ref, 0); WeakReferencesQueue.addReference(ref); } /// addSoftReference - Add a weak reference to the queue. /// - void addSoftReference(gc* ref) { + void addSoftReference(mvm::gc* ref) { llvm_gcroot(ref, 0); SoftReferencesQueue.addReference(ref); } /// addPhantomReference - Add a weak reference to the queue. /// - void addPhantomReference(gc* ref) { + void addPhantomReference(mvm::gc* ref) { llvm_gcroot(ref, 0); PhantomReferencesQueue.addReference(ref); } @@ -147,7 +147,7 @@ /// finalizationQueue - A list of allocated objets that contain a finalize /// method. /// - gc** FinalizationQueue; + mvm::gc** FinalizationQueue; /// CurrentIndex - Current index in the queue of finalizable objects. /// @@ -163,7 +163,7 @@ /// ToBeFinalized - List of objects that are scheduled to be finalized. /// - gc** ToBeFinalized; + mvm::gc** ToBeFinalized; /// ToBeFinalizedLength - Current length of the queue of objects scheduled /// for finalization. @@ -192,7 +192,7 @@ /// addFinalizationCandidate - Add an object to the queue of objects with /// a finalization method. /// - void addFinalizationCandidate(gc*); + void addFinalizationCandidate(mvm::gc*); /// scanFinalizationQueue - Scan objets with a finalized method and schedule /// them for finalization if they are not live. Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Wed Dec 1 16:00:10 2010 @@ -53,9 +53,9 @@ // Classpath with the vmdata field). //===----------------------------------------------------------------------===// -VirtualTable VMClassLoader::VT((uintptr_t)VMClassLoader::staticDestructor, - (uintptr_t)VMClassLoader::staticDestructor, - (uintptr_t)VMClassLoader::staticTracer); +mvm::VirtualTable VMClassLoader::VT((uintptr_t)VMClassLoader::staticDestructor, + (uintptr_t)VMClassLoader::staticDestructor, + (uintptr_t)VMClassLoader::staticTracer); //===----------------------------------------------------------------------===// // Trace methods for Java objects. There are four types of objects: @@ -336,7 +336,7 @@ JNILocalReferences* end = localJNIRefs; while (end != NULL) { for (uint32 i = 0; i < end->length; ++i) { - gc** obj = end->localReferences + i; + mvm::gc** obj = end->localReferences + i; mvm::Collector::markAndTraceRoot(obj, closure); } end = end->prev; Modified: vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h Wed Dec 1 16:00:10 2010 @@ -11,11 +11,12 @@ #define _GC_CHUNK_H_ #include "mvm/VirtualMachine.h" +#include "mvm/GC.h" #include "gcmapper.h" #include "types.h" -class gcRoot; /* object collectable */ +using namespace mvm; /* description d'un bout de mémoire */ class GCChunkNode { Modified: vmkit/branches/multi-vm/lib/Mvm/BoehmGC/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/BoehmGC/MvmGC.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/BoehmGC/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/BoehmGC/MvmGC.h Wed Dec 1 16:00:10 2010 @@ -29,12 +29,11 @@ extern "C" void * GC_dlopen(const char *path, int mode) throw (); -#include "mvm/GC/GC.h" - #define gc_new(Class) __gc_new(Class::VT) Class #define __gc_new new -class gc : public gcRoot { +namespace mvm { +class collectable : public gcRoot { public: void markAndTrace() const {} @@ -141,6 +140,6 @@ return true; } }; - +} #endif Modified: vmkit/branches/multi-vm/lib/Mvm/BoehmGC/gc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/BoehmGC/gc.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/BoehmGC/gc.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/BoehmGC/gc.cpp Wed Dec 1 16:00:10 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/Threads/Thread.h" using namespace mvm; Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Wed Dec 1 16:00:10 2010 @@ -9,7 +9,7 @@ #include #include -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/VirtualMachine.h" #include "mvm/Threads/CollectionRV.h" #include "mvm/VMKit.h" Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ObjectLocks.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ObjectLocks.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ObjectLocks.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ObjectLocks.cpp Wed Dec 1 16:00:10 2010 @@ -14,7 +14,7 @@ #include "mvm/Threads/ObjectLocks.h" #include "mvm/Threads/Thread.h" #include "mvm/VirtualMachine.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include "cterror.h" #include #include Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctlock.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctlock.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctlock.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctlock.cpp Wed Dec 1 16:00:10 2010 @@ -13,7 +13,7 @@ #include "mvm/Threads/Locks.h" #include "mvm/Threads/Thread.h" #include "mvm/VirtualMachine.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include "cterror.h" #include #include Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Wed Dec 1 16:00:10 2010 @@ -9,7 +9,7 @@ #include "debug.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/MethodInfo.h" #include "mvm/VirtualMachine.h" #include "mvm/Threads/Cond.h" Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/EscapeAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/EscapeAnalysis.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/EscapeAnalysis.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/EscapeAnalysis.cpp Wed Dec 1 16:00:10 2010 @@ -23,9 +23,10 @@ #include #include -#include "mvm/GC/GC.h" +#include "mvm/GC.h" using namespace llvm; +using namespace mvm; namespace { Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp Wed Dec 1 16:00:10 2010 @@ -42,9 +42,8 @@ #include "mvm/Threads/Locks.h" #include "mvm/Threads/Thread.h" #include "mvm/VirtualMachine.h" -#include "mvm/GC/GC.h" #include "MutatorThread.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include #include Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h Wed Dec 1 16:00:10 2010 @@ -11,13 +11,14 @@ #ifndef MVM_MMAP_GC_H #define MVM_MMAP_GC_H -#include "mvm/GC/GC.h" #include "types.h" #include "gcalloc.h" #define gc_allocator std::allocator -struct VirtualTable { +namespace mvm { +class GCVirtualTable : public CommonVirtualTable { +public: uintptr_t destructor; uintptr_t operatorDelete; uintptr_t tracer; @@ -34,19 +35,17 @@ return &destructor; } - VirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) { + GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) { destructor = d; operatorDelete = o; tracer = t; } - VirtualTable() {} + GCVirtualTable() {} static void emptyTracer(void*) {} }; -namespace mvm { - class Thread; class Collector { @@ -361,10 +360,7 @@ }; -} - - -class gc : public gcRoot { +class collectable : public gcRoot { public: size_t objectSize() const { @@ -389,4 +385,6 @@ }; +} + #endif Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gc.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gc.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gc.cpp Wed Dec 1 16:00:10 2010 @@ -9,7 +9,7 @@ #include "mvm/GC/GC.h" #include "mvm/Threads/Thread.h" -#include "MvmGC.h" +#include "mvm/GC.h" using namespace mvm; Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp Wed Dec 1 16:00:10 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "MvmGC.h" +#include "mvm/GC.h" using namespace mvm; Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gcinit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gcinit.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gcinit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gcinit.cpp Wed Dec 1 16:00:10 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "MvmGC.h" +#include "mvm/GC.h" using namespace mvm; Removed: vmkit/branches/multi-vm/lib/Mvm/MMTk/MutatorThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/MMTk/MutatorThread.cpp?rev=120610&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/MMTk/MutatorThread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/MMTk/MutatorThread.cpp (removed) @@ -1,14 +0,0 @@ -//===--------- MutatorThread.cpp - Thread for GC --------------------------===// -// -// The VMKit project -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -#include "MutatorThread.h" -#include "MvmGC.h" - -using namespace mvm; Modified: vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.cpp Wed Dec 1 16:00:10 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "MvmGC.h" +#include "mvm/GC.h" #include "MutatorThread.h" #include "mvm/VirtualMachine.h" Modified: vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h Wed Dec 1 16:00:10 2010 @@ -11,12 +11,14 @@ #ifndef MVM_MMTK_GC_H #define MVM_MMTK_GC_H -#include "mvm/GC/GC.h" #include #define gc_allocator std::allocator -struct VirtualTable { +namespace mvm { + +class GCVirtualTable : public CommonVirtualTable { +public: uintptr_t destructor; uintptr_t operatorDelete; uintptr_t tracer; @@ -34,20 +36,20 @@ return &destructor; } - VirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) { + GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) { destructor = d; operatorDelete = o; tracer = t; } - VirtualTable() {} + GCVirtualTable() {} static void emptyTracer(void*) {} }; extern "C" void* gcmallocUnresolved(uint32_t sz, VirtualTable* VT); -class gc : public gcRoot { +class collectable : public gcRoot { public: size_t objectSize() const { @@ -60,8 +62,6 @@ } }; - -namespace mvm { class Collector { public: Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/MethodInfo.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/MethodInfo.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/MethodInfo.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/MethodInfo.cpp Wed Dec 1 16:00:10 2010 @@ -10,7 +10,7 @@ #include "mvm/Allocator.h" #include "mvm/MethodInfo.h" #include "mvm/VirtualMachine.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include #include Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/PrintBuffer.cpp Wed Dec 1 16:00:10 2010 @@ -10,7 +10,7 @@ #include #include -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/PrintBuffer.h" using namespace mvm; Modified: vmkit/branches/multi-vm/mmtk/mmtk-alloc/Selected.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-alloc/Selected.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-alloc/Selected.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-alloc/Selected.cpp Wed Dec 1 16:00:10 2010 @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// #include "MutatorThread.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/VirtualMachine.h" Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp Wed Dec 1 16:00:10 2010 @@ -11,7 +11,7 @@ #include "mvm/VirtualMachine.h" #include "mvm/VMKit.h" #include "MMTkObject.h" -#include "MvmGC.h" +#include "mvm/GC.h" namespace mmtk { Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/MMTkObject.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/MMTkObject.h?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/MMTkObject.h (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/MMTkObject.h Wed Dec 1 16:00:10 2010 @@ -12,7 +12,7 @@ #include #include "MutatorThread.h" -#include "MvmGC.h" +#include "mvm/GC.h" namespace mmtk { @@ -22,7 +22,7 @@ MMTkObject* delegatee; }; -struct MMTkVirtualTable : public VirtualTable { +struct MMTkVirtualTable : public mvm::VirtualTable { MMTkClass* cl; }; Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/ObjectModel.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/ObjectModel.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/ObjectModel.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/ObjectModel.cpp Wed Dec 1 16:00:10 2010 @@ -21,24 +21,24 @@ return sizeof(void*); } -extern "C" uintptr_t Java_org_j3_mmtk_ObjectModel_readAvailableBitsWord__Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* OM, gc* obj) { +extern "C" uintptr_t Java_org_j3_mmtk_ObjectModel_readAvailableBitsWord__Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* OM, mvm::gc* obj) { return obj->header; } extern "C" void Java_org_j3_mmtk_ObjectModel_writeAvailableBitsWord__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Word_2 ( - MMTkObject* OM, gc* obj, uintptr_t val) { + MMTkObject* OM, mvm::gc* obj, uintptr_t val) { obj->header = val; } -extern "C" gc* Java_org_j3_mmtk_ObjectModel_objectStartRef__Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* OM, gc* obj) { +extern "C" mvm::gc* Java_org_j3_mmtk_ObjectModel_objectStartRef__Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* OM, mvm::gc* obj) { return obj; } -extern "C" gc* Java_org_j3_mmtk_ObjectModel_refToAddress__Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* OM, gc* obj) { +extern "C" mvm::gc* Java_org_j3_mmtk_ObjectModel_refToAddress__Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* OM, mvm::gc* obj) { return obj; } -extern "C" uint8_t Java_org_j3_mmtk_ObjectModel_readAvailableByte__Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* OM, gc* obj) { +extern "C" uint8_t Java_org_j3_mmtk_ObjectModel_readAvailableByte__Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* OM, mvm::gc* obj) { #if defined(__PPC__) return ((uint8_t*)obj)[7]; #else @@ -46,7 +46,7 @@ #endif } -extern "C" void Java_org_j3_mmtk_ObjectModel_writeAvailableByte__Lorg_vmmagic_unboxed_ObjectReference_2B (MMTkObject* OM, gc* obj, uint8_t val) { +extern "C" void Java_org_j3_mmtk_ObjectModel_writeAvailableByte__Lorg_vmmagic_unboxed_ObjectReference_2B (MMTkObject* OM, mvm::gc* obj, uint8_t val) { #if defined(__PPC__) ((uint8_t*)obj)[7] = val; #else @@ -54,17 +54,17 @@ #endif } -extern "C" gc* Java_org_j3_mmtk_ObjectModel_getObjectFromStartAddress__Lorg_vmmagic_unboxed_Address_2 (MMTkObject* OM, gc* obj) { +extern "C" mvm::gc* Java_org_j3_mmtk_ObjectModel_getObjectFromStartAddress__Lorg_vmmagic_unboxed_Address_2 (MMTkObject* OM, mvm::gc* obj) { return obj; } -extern "C" uintptr_t Java_org_j3_mmtk_ObjectModel_prepareAvailableBits__Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* OM, gc* obj) { +extern "C" uintptr_t Java_org_j3_mmtk_ObjectModel_prepareAvailableBits__Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* OM, mvm::gc* obj) { return obj->header; } extern "C" uint8_t Java_org_j3_mmtk_ObjectModel_attemptAvailableBits__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Word_2Lorg_vmmagic_unboxed_Word_2( - MMTkObject* OM, gc* obj, intptr_t oldValue, intptr_t newValue) { + MMTkObject* OM, mvm::gc* obj, intptr_t oldValue, intptr_t newValue) { intptr_t val = __sync_val_compare_and_swap(&(obj->header), oldValue, newValue); return (val == oldValue); } @@ -78,13 +78,13 @@ } extern "C" uintptr_t JnJVM_org_j3_bindings_Bindings_copy__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2II( - gc* obj, VirtualTable* VT, int size, int allocator) ALWAYS_INLINE; + mvm::gc* obj, mvm::VirtualTable* VT, int size, int allocator) ALWAYS_INLINE; extern "C" uintptr_t Java_org_j3_mmtk_ObjectModel_copy__Lorg_vmmagic_unboxed_ObjectReference_2I ( - MMTkObject* OM, gc* src, int allocator) ALWAYS_INLINE; + MMTkObject* OM, mvm::gc* src, int allocator) ALWAYS_INLINE; extern "C" uintptr_t Java_org_j3_mmtk_ObjectModel_copy__Lorg_vmmagic_unboxed_ObjectReference_2I ( - MMTkObject* OM, gc* src, int allocator) { + MMTkObject* OM, mvm::gc* src, int allocator) { size_t size = mvm::Thread::get()->MyVM->getObjectSize(src); size = llvm::RoundUpToAlignment(size, sizeof(void*)); uintptr_t res = JnJVM_org_j3_bindings_Bindings_copy__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2II( @@ -136,7 +136,7 @@ }; extern "C" FakeByteArray* Java_org_j3_mmtk_ObjectModel_getTypeDescriptor__Lorg_vmmagic_unboxed_ObjectReference_2 ( - MMTkObject* OM, gc* src) { + MMTkObject* OM, mvm::gc* src) { const char* name = mvm::Thread::get()->MyVM->getObjectTypeName(src); // This code is only used for debugging on a fatal error. It is fine to // allocate in the C++ heap. Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp Wed Dec 1 16:00:10 2010 @@ -10,7 +10,7 @@ #include "debug.h" #include "mvm/VirtualMachine.h" #include "MMTkObject.h" -#include "MvmGC.h" +#include "mvm/GC.h" namespace mmtk { @@ -46,9 +46,9 @@ // Nothing to do. } -extern "C" void Java_org_j3_mmtk_Scanning_specializedScanObject__ILorg_mmtk_plan_TransitiveClosure_2Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* Scanning, uint32_t id, MMTkObject* TC, gc* obj) ALWAYS_INLINE; +extern "C" void Java_org_j3_mmtk_Scanning_specializedScanObject__ILorg_mmtk_plan_TransitiveClosure_2Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* Scanning, uint32_t id, MMTkObject* TC, mvm::gc* obj) ALWAYS_INLINE; -extern "C" void Java_org_j3_mmtk_Scanning_specializedScanObject__ILorg_mmtk_plan_TransitiveClosure_2Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* Scanning, uint32_t id, MMTkObject* TC, gc* obj) { +extern "C" void Java_org_j3_mmtk_Scanning_specializedScanObject__ILorg_mmtk_plan_TransitiveClosure_2Lorg_vmmagic_unboxed_ObjectReference_2 (MMTkObject* Scanning, uint32_t id, MMTkObject* TC, mvm::gc* obj) { assert(obj && "No object to trace"); assert(obj->getVirtualTable() && "No virtual table"); assert(obj->getVirtualTable()->tracer && "No tracer in VT"); @@ -60,7 +60,7 @@ } extern "C" void Java_org_j3_mmtk_Scanning_scanObject__Lorg_mmtk_plan_TransitiveClosure_2Lorg_vmmagic_unboxed_ObjectReference_2 ( - MMTkObject* Scanning, uintptr_t TC, gc* obj) { + MMTkObject* Scanning, uintptr_t TC, mvm::gc* obj) { assert(obj && "No object to trace"); assert(obj->getVirtualTable() && "No virtual table"); assert(obj->getVirtualTable()->tracer && "No tracer in VT"); Modified: vmkit/branches/multi-vm/tools/j3/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/j3/Main.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/j3/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/j3/Main.cpp Wed Dec 1 16:00:10 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/JIT.h" #include "mvm/VMKit.h" #include "mvm/VirtualMachine.h" Modified: vmkit/branches/multi-vm/tools/n3-mono/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/n3-mono/Main.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/n3-mono/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/n3-mono/Main.cpp Wed Dec 1 16:00:10 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/JIT.h" #include "mvm/Object.h" #include "mvm/VirtualMachine.h" Modified: vmkit/branches/multi-vm/tools/n3-pnetlib/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/n3-pnetlib/Main.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/n3-pnetlib/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/n3-pnetlib/Main.cpp Wed Dec 1 16:00:10 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/JIT.h" #include "mvm/Object.h" #include "mvm/VirtualMachine.h" Modified: vmkit/branches/multi-vm/tools/testCollector/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/testCollector/Main.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/testCollector/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/testCollector/Main.cpp Wed Dec 1 16:00:10 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/Threads/Thread.h" #include Modified: vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp (original) +++ vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp Wed Dec 1 16:00:10 2010 @@ -36,7 +36,7 @@ #include "llvm/Target/TargetMachine.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/JIT.h" #include "mvm/VMKit.h" #include "mvm/VirtualMachine.h" Modified: vmkit/branches/multi-vm/tools/vmkit/CommandLine.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/CommandLine.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmkit/CommandLine.cpp (original) +++ vmkit/branches/multi-vm/tools/vmkit/CommandLine.cpp Wed Dec 1 16:00:10 2010 @@ -14,7 +14,7 @@ #include #include "CommandLine.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/Threads/Thread.h" using namespace mvm; Modified: vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp (original) +++ vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Wed Dec 1 16:00:10 2010 @@ -18,7 +18,7 @@ #include "llvm/Target/TargetData.h" -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/Config/config.h" #include "mvm/JIT.h" #include "mvm/VMKit.h" Modified: vmkit/branches/multi-vm/tools/vtoffset/VTOffset.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vtoffset/VTOffset.cpp?rev=120611&r1=120610&r2=120611&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vtoffset/VTOffset.cpp (original) +++ vmkit/branches/multi-vm/tools/vtoffset/VTOffset.cpp Wed Dec 1 16:00:10 2010 @@ -12,7 +12,7 @@ #include #include -#include "MvmGC.h" +#include "mvm/GC.h" #include "mvm/PrintBuffer.h" #include "mvm/Threads/Thread.h" #include "mvm/Sigsegv.h" From gael.thomas at lip6.fr Wed Dec 1 14:08:52 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 22:08:52 -0000 Subject: [vmkit-commits] [vmkit] r120612 - in /vmkit/branches/multi-vm: include/mvm/GC.h lib/Mvm/GCMmap2/MvmGC.h lib/Mvm/MMTk/MvmGC.h Message-ID: <20101201220853.065B42A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 16:08:52 2010 New Revision: 120612 URL: http://llvm.org/viewvc/llvm-project?rev=120612&view=rev Log: move common part of GCVirtualTable in CommonVirtualTable Modified: vmkit/branches/multi-vm/include/mvm/GC.h vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h Modified: vmkit/branches/multi-vm/include/mvm/GC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/GC.h?rev=120612&r1=120611&r2=120612&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/GC.h (original) +++ vmkit/branches/multi-vm/include/mvm/GC.h Wed Dec 1 16:08:52 2010 @@ -40,6 +40,23 @@ class CommonVirtualTable { public: + uintptr_t destructor; + uintptr_t operatorDelete; + uintptr_t tracer; + + uintptr_t* getFunctions() { + return &destructor; + } + + CommonVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) { + destructor = d; + operatorDelete = o; + tracer = t; + } + + CommonVirtualTable() {} + + static void emptyTracer(void*) {} }; } // namespace mvm Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h?rev=120612&r1=120611&r2=120612&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h Wed Dec 1 16:08:52 2010 @@ -19,10 +19,6 @@ namespace mvm { class GCVirtualTable : public CommonVirtualTable { public: - uintptr_t destructor; - uintptr_t operatorDelete; - uintptr_t tracer; - static uint32_t numberOfBaseFunctions() { return 3; } @@ -31,19 +27,8 @@ return 0; } - uintptr_t* getFunctions() { - return &destructor; - } - - GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) { - destructor = d; - operatorDelete = o; - tracer = t; - } - + GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) : CommonVirtualTable(d, o, t) {} GCVirtualTable() {} - - static void emptyTracer(void*) {} }; class Thread; Modified: vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h?rev=120612&r1=120611&r2=120612&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h Wed Dec 1 16:08:52 2010 @@ -19,9 +19,6 @@ class GCVirtualTable : public CommonVirtualTable { public: - uintptr_t destructor; - uintptr_t operatorDelete; - uintptr_t tracer; uintptr_t specializedTracers[1]; static uint32_t numberOfBaseFunctions() { @@ -32,19 +29,8 @@ return 1; } - uintptr_t* getFunctions() { - return &destructor; - } - - GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) { - destructor = d; - operatorDelete = o; - tracer = t; - } - + GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) : CommonVirtualTable(d, o, t) {} GCVirtualTable() {} - - static void emptyTracer(void*) {} }; extern "C" void* gcmallocUnresolved(uint32_t sz, VirtualTable* VT); From gael.thomas at lip6.fr Wed Dec 1 14:22:45 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 01 Dec 2010 22:22:45 -0000 Subject: [vmkit-commits] [vmkit] r120615 - in /vmkit/branches/multi-vm: include/mvm/GC.h lib/Mvm/GCMmap2/MvmGC.h lib/Mvm/MMTk/MvmGC.h Message-ID: <20101201222245.30A242A6C12D@llvm.org> Author: gthomas Date: Wed Dec 1 16:22:45 2010 New Revision: 120615 URL: http://llvm.org/viewvc/llvm-project?rev=120615&view=rev Log: the size of CommonVirtualTable is defined by a function Modified: vmkit/branches/multi-vm/include/mvm/GC.h vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h Modified: vmkit/branches/multi-vm/include/mvm/GC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/GC.h?rev=120615&r1=120614&r2=120615&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/GC.h (original) +++ vmkit/branches/multi-vm/include/mvm/GC.h Wed Dec 1 16:22:45 2010 @@ -56,6 +56,8 @@ CommonVirtualTable() {} + static int numberOfCommonEntries() { return 3; } + static void emptyTracer(void*) {} }; Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h?rev=120615&r1=120614&r2=120615&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h Wed Dec 1 16:22:45 2010 @@ -20,7 +20,7 @@ class GCVirtualTable : public CommonVirtualTable { public: static uint32_t numberOfBaseFunctions() { - return 3; + return numberOfCommonEntries(); } static uint32_t numberOfSpecializedTracers() { Modified: vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h?rev=120615&r1=120614&r2=120615&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h Wed Dec 1 16:22:45 2010 @@ -22,7 +22,7 @@ uintptr_t specializedTracers[1]; static uint32_t numberOfBaseFunctions() { - return 4; + return numberOfCommonEntries() + 1; } static uint32_t numberOfSpecializedTracers() { From gael.thomas at lip6.fr Thu Dec 2 01:43:09 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 02 Dec 2010 09:43:09 -0000 Subject: [vmkit-commits] [vmkit] r120699 - in /vmkit/branches/multi-vm: include/mvm/GC.h include/mvm/VirtualMachine.h lib/Mvm/Allocator/gcchunk.h lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/GCMmap2/MvmGC.h lib/Mvm/GCMmap2/ObjectHeader.h lib/Mvm/GCMmap2/gc.cpp lib/Mvm/GCMmap2/gccollector.cpp Message-ID: <20101202094309.9FE652A6C12F@llvm.org> Author: gthomas Date: Thu Dec 2 03:43:09 2010 New Revision: 120699 URL: http://llvm.org/viewvc/llvm-project?rev=120699&view=rev Log: gc mmap2 uses also the new interfaces Modified: vmkit/branches/multi-vm/include/mvm/GC.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h vmkit/branches/multi-vm/lib/Mvm/GCMmap2/ObjectHeader.h vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gc.cpp vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp Modified: vmkit/branches/multi-vm/include/mvm/GC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/GC.h?rev=120699&r1=120698&r2=120699&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/GC.h (original) +++ vmkit/branches/multi-vm/include/mvm/GC.h Thu Dec 2 03:43:09 2010 @@ -16,6 +16,7 @@ namespace mvm { + class VirtualMachine; class VirtualTable; class gc; @@ -40,9 +41,10 @@ class CommonVirtualTable { public: - uintptr_t destructor; - uintptr_t operatorDelete; - uintptr_t tracer; + uintptr_t destructor; + uintptr_t operatorDelete; + uintptr_t tracer; + // VirtualMachine* vm; uintptr_t* getFunctions() { return &destructor; Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=120699&r1=120698&r2=120699&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Thu Dec 2 03:43:09 2010 @@ -13,7 +13,6 @@ #include "mvm/Allocator.h" #include "mvm/Threads/CollectionRV.h" #include "mvm/Threads/Locks.h" -#include "mvm/GC.h" #include #include @@ -22,6 +21,7 @@ class MethodInfo; class VMKit; +class gc; class FunctionMap { public: Modified: vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h?rev=120699&r1=120698&r2=120699&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h Thu Dec 2 03:43:09 2010 @@ -10,12 +10,16 @@ #ifndef _GC_CHUNK_H_ #define _GC_CHUNK_H_ -#include "mvm/VirtualMachine.h" -#include "mvm/GC.h" +//#include "mvm/VirtualMachine.h" +//#include "mvm/GC.h" #include "gcmapper.h" #include "types.h" +namespace mvm { + class gcRoot; +} + using namespace mvm; /* description d'un bout de mémoire */ Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120699&r1=120698&r2=120699&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Thu Dec 2 03:43:09 2010 @@ -9,10 +9,10 @@ #include #include -#include "mvm/GC.h" #include "mvm/VirtualMachine.h" #include "mvm/Threads/CollectionRV.h" #include "mvm/VMKit.h" +#include "mvm/GC.h" #include "debug.h" Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h?rev=120699&r1=120698&r2=120699&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h Thu Dec 2 03:43:09 2010 @@ -1,4 +1,4 @@ -//===----------- GC.h - Garbage Collection Interface -----------------------===// +//===----------- MvmGC.h - Garbage Collection Interface -------------------===// // // The Micro Virtual Machine // @@ -13,10 +13,16 @@ #include "types.h" #include "gcalloc.h" +#include "mvm/VirtualMachine.h" #define gc_allocator std::allocator +using namespace mvm; + namespace mvm { + class Thread; + class VirtualMachine; + class GCVirtualTable : public CommonVirtualTable { public: static uint32_t numberOfBaseFunctions() { @@ -31,8 +37,6 @@ GCVirtualTable() {} }; -class Thread; - class Collector { friend class GCThread; friend class CollectionRV; @@ -185,7 +189,7 @@ unlock(); - if (vt->destructor) + if (((CommonVirtualTable*)vt)->destructor) mvm::Thread::get()->MyVM->addFinalizationCandidate((gc*)p); @@ -342,7 +346,6 @@ static gc* getForwardedFinalizable(gc* val, uintptr_t closure) { return val; } - }; class collectable : public gcRoot { @@ -369,7 +372,6 @@ } }; - } #endif Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/ObjectHeader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/ObjectHeader.h?rev=120699&r1=120698&r2=120699&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/ObjectHeader.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/ObjectHeader.h Thu Dec 2 03:43:09 2010 @@ -14,7 +14,6 @@ namespace mvm { static const uint32_t GCBits = 2; - static const uint64_t GCBitMask = 0x3; static const bool MovesObject = false; } Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gc.cpp?rev=120699&r1=120698&r2=120699&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gc.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gc.cpp Thu Dec 2 03:43:09 2010 @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "mvm/GC/GC.h" #include "mvm/Threads/Thread.h" #include "mvm/GC.h" Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp?rev=120699&r1=120698&r2=120699&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp Thu Dec 2 03:43:09 2010 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "mvm/GC.h" +#include "mvm/VMKit.h" using namespace mvm; @@ -40,10 +41,10 @@ unused_nodes->attrape(used_nodes); mvm::Thread* th = mvm::Thread::get(); - th->MyVM->rendezvous.startRV(); + th->vmkit->rendezvous.startRV(); th->MyVM->startCollection(); - th->MyVM->rendezvous.synchronize(); + th->vmkit->rendezvous.synchronize(); mvm::Thread* tcur = th; @@ -89,7 +90,7 @@ status = stat_alloc; // Wake up all threads. - th->MyVM->rendezvous.finishRV(); + th->vmkit->rendezvous.finishRV(); th->MyVM->endCollection(); // Kill unreachable objects. From gael.thomas at lip6.fr Thu Dec 2 02:57:05 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 02 Dec 2010 10:57:05 -0000 Subject: [vmkit-commits] [vmkit] r120702 - in /vmkit/branches/multi-vm: include/mvm/GC.h include/mvm/Threads/Thread.h lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/Compiler/JavaJITOpcodes.cpp lib/J3/VMCore/JavaClass.cpp lib/J3/VMCore/VirtualTables.cpp lib/Mvm/GCMmap2/MvmGC.h lib/Mvm/MMTk/MvmGC.h Message-ID: <20101202105705.D5D912A6C130@llvm.org> Author: gthomas Date: Thu Dec 2 04:57:05 2010 New Revision: 120702 URL: http://llvm.org/viewvc/llvm-project?rev=120702&view=rev Log: add the vm in CommonVirtualtable Modified: vmkit/branches/multi-vm/include/mvm/GC.h vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h Modified: vmkit/branches/multi-vm/include/mvm/GC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/GC.h?rev=120702&r1=120701&r2=120702&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/GC.h (original) +++ vmkit/branches/multi-vm/include/mvm/GC.h Thu Dec 2 04:57:05 2010 @@ -39,26 +39,28 @@ } }; + // WARNING: if you modify this class, you must also change the generation of VT in JavaAOTCompiler class CommonVirtualTable { public: uintptr_t destructor; uintptr_t operatorDelete; uintptr_t tracer; - // VirtualMachine* vm; + VirtualMachine* vm; uintptr_t* getFunctions() { return &destructor; } - CommonVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) { + CommonVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t, VirtualMachine* v) { destructor = d; operatorDelete = o; tracer = t; + vm = v; } CommonVirtualTable() {} - static int numberOfCommonEntries() { return 3; } + static int numberOfCommonEntries() { return 4; } static void emptyTracer(void*) {} }; @@ -73,7 +75,7 @@ class VirtualTable : public GCVirtualTable { public: - VirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) : GCVirtualTable(d, o, t) {} + VirtualTable(uintptr_t d, uintptr_t o, uintptr_t t, VirtualMachine* v) : GCVirtualTable(d, o, t, v) {} VirtualTable() {} }; Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120702&r1=120701&r2=120702&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Thu Dec 2 04:57:05 2010 @@ -43,6 +43,7 @@ /// CircularBase - This class represents a circular list. Classes that extend /// this class automatically place their instances in a circular list. /// +// WARNING: if you modify this class, you must also change mvm-runtime.ll class CircularBase { /// _next - The next object in the list. /// @@ -143,6 +144,7 @@ class MutatorThread; class VMKit; +// WARNING: if you modify this class, you must also change mvm-runtime.ll class VMThreadData { public: /// mut - The associated thread mutator @@ -164,6 +166,7 @@ /// Thread - This class is the base of custom virtual machines' Thread classes. /// It provides static functions to manage threads. An instance of this class /// contains all thread-specific informations. +// WARNING: if you modify this class, you must also change mvm-runtime.ll class Thread : public CircularBase { public: Thread(VMKit* vmk) { Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=120702&r1=120701&r2=120702&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Thu Dec 2 04:57:05 2010 @@ -1414,7 +1414,11 @@ Elemts.push_back(Tracer ? ConstantExpr::getCast(Instruction::BitCast, Tracer, PTy) : N); + + // vm + Elemts.push_back(N); + // specialized tracers for (uint32_t i = 0; i < mvm::VirtualTable::numberOfSpecializedTracers(); i++) { // Push null for now. Elemts.push_back(N); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=120702&r1=120701&r2=120702&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp Thu Dec 2 04:57:05 2010 @@ -156,6 +156,7 @@ } #if JNJVM_EXECUTE > 1 + // if (compilingMethod->name->equals(compilingClass->classLoader->asciizConstructUTF8("allocSlowOnce"))) { Value* args[3] = { ConstantInt::get(Type::getInt32Ty(*llvmContext), (int64_t)bytecode), Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp?rev=120702&r1=120701&r2=120702&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp Thu Dec 2 04:57:05 2010 @@ -1399,7 +1399,8 @@ } JavaVirtualTable::JavaVirtualTable(Class* C) { - + vm = C->classLoader->getIsolate(); + if (C->super) { Class* referenceClass = @@ -1495,6 +1496,7 @@ } JavaVirtualTable::JavaVirtualTable(ClassArray* C) { + vm = C->classLoader->getIsolate(); if (C->baseClass()->isClass()) C->baseClass()->asClass()->resolveClass(); @@ -1713,6 +1715,7 @@ JavaVirtualTable::JavaVirtualTable(ClassPrimitive* C) { // Only used for subtype checking + vm = C->classLoader->getIsolate(); cl = C; depth = 0; display[0] = this; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=120702&r1=120701&r2=120702&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Thu Dec 2 04:57:05 2010 @@ -55,7 +55,8 @@ mvm::VirtualTable VMClassLoader::VT((uintptr_t)VMClassLoader::staticDestructor, (uintptr_t)VMClassLoader::staticDestructor, - (uintptr_t)VMClassLoader::staticTracer); + (uintptr_t)VMClassLoader::staticTracer, + 0); //===----------------------------------------------------------------------===// // Trace methods for Java objects. There are four types of objects: Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h?rev=120702&r1=120701&r2=120702&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h Thu Dec 2 04:57:05 2010 @@ -33,7 +33,7 @@ return 0; } - GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) : CommonVirtualTable(d, o, t) {} + GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t, VirtualMachine *v) : CommonVirtualTable(d, o, t, v) {} GCVirtualTable() {} }; Modified: vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h?rev=120702&r1=120701&r2=120702&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h Thu Dec 2 04:57:05 2010 @@ -29,7 +29,7 @@ return 1; } - GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t) : CommonVirtualTable(d, o, t) {} + GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t, VirtualMachine* v) : CommonVirtualTable(d, o, t, v) {} GCVirtualTable() {} }; From gael.thomas at lip6.fr Thu Dec 2 04:59:46 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 02 Dec 2010 12:59:46 -0000 Subject: [vmkit-commits] [vmkit] r120703 - in /vmkit/branches/multi-vm: include/mvm/GC.h lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/J3/VMCore/JnjvmClassLoader.cpp lib/J3/VMCore/JnjvmClassLoader.h lib/J3/VMCore/VirtualTables.cpp lib/Mvm/GCMmap2/MvmGC.h lib/Mvm/MMTk/MvmGC.h Message-ID: <20101202125946.DA8832A6C12D@llvm.org> Author: gthomas Date: Thu Dec 2 06:59:46 2010 New Revision: 120703 URL: http://llvm.org/viewvc/llvm-project?rev=120703&view=rev Log: fill in the new field vm of virtualtable Modified: vmkit/branches/multi-vm/include/mvm/GC.h vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h Modified: vmkit/branches/multi-vm/include/mvm/GC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/GC.h?rev=120703&r1=120702&r2=120703&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/GC.h (original) +++ vmkit/branches/multi-vm/include/mvm/GC.h Thu Dec 2 06:59:46 2010 @@ -51,15 +51,6 @@ return &destructor; } - CommonVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t, VirtualMachine* v) { - destructor = d; - operatorDelete = o; - tracer = t; - vm = v; - } - - CommonVirtualTable() {} - static int numberOfCommonEntries() { return 4; } static void emptyTracer(void*) {} @@ -73,11 +64,7 @@ class gc : public collectable { }; - class VirtualTable : public GCVirtualTable { - public: - VirtualTable(uintptr_t d, uintptr_t o, uintptr_t t, VirtualMachine* v) : GCVirtualTable(d, o, t, v) {} - VirtualTable() {} - }; + class VirtualTable : public GCVirtualTable {}; static const uint32_t HashBits = 8; static const uint64_t GCBitMask = ((1 << GCBits) - 1); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=120703&r1=120702&r2=120703&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Thu Dec 2 06:59:46 2010 @@ -2224,7 +2224,7 @@ for (; I != E; ++I) { JavaObject* obj = (JavaObject*)(*I); - if (!VMClassLoader::isVMClassLoader(obj) && JavaObject::instanceOf(obj, cl)) { + if (!VMClassLoader::isVMClassLoader(cl->classLoader->getIsolate(), obj) && JavaObject::instanceOf(obj, cl)) { if (currentClass != NULL) { if (JavaObject::getClass(obj) != currentClass) { return 0; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120703&r1=120702&r2=120703&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Thu Dec 2 06:59:46 2010 @@ -1346,7 +1346,12 @@ } Jnjvm::Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JnjvmBootstrapLoader* loader) : - VirtualMachine(Alloc, vmkit), lockSystem(Alloc) { + VirtualMachine(Alloc, vmkit), + lockSystem(Alloc) { + + loader->isolate = this; + + initialiseInternalVTs(); classpath = getenv("CLASSPATH"); if (!classpath) classpath = "."; @@ -1433,7 +1438,7 @@ // in this case. size_t size = 0; JavaObject* src = (JavaObject*)object; - if (VMClassLoader::isVMClassLoader(src)) { + if (VMClassLoader::isVMClassLoader(this, src)) { size = sizeof(VMClassLoader); } else { CommonClass* cl = JavaObject::getClass(src); @@ -1455,7 +1460,7 @@ const char* Jnjvm::getObjectTypeName(mvm::gc* object) { JavaObject* src = (JavaObject*)object; - if (VMClassLoader::isVMClassLoader(src)) { + if (VMClassLoader::isVMClassLoader(this, src)) { return "VMClassLoader"; } else { CommonClass* cl = JavaObject::getClass(src); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=120703&r1=120702&r2=120703&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Thu Dec 2 06:59:46 2010 @@ -258,7 +258,11 @@ /// javaReferenceThread - the java reference thread JavaThread* javaReferenceThread; - + + + mvm::VirtualTable* VMClassLoader__VT; + + void initialiseInternalVTs(); public: /// CreateExceptions - These are the runtime exceptions thrown by Java code Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=120703&r1=120702&r2=120703&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Thu Dec 2 06:59:46 2010 @@ -884,13 +884,13 @@ Classpath* upcalls = vm->bootstrapLoader->upcalls; vmdata = (VMClassLoader*)(upcalls->vmdataClassLoader->getInstanceObjectField(loader)); - + if (vmdata == NULL) { JavaObject::acquire(loader); vmdata = (VMClassLoader*)(upcalls->vmdataClassLoader->getInstanceObjectField(loader)); if (!vmdata) { - vmdata = VMClassLoader::allocate(); + vmdata = VMClassLoader::allocate(vm); mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator(); JCL = new(*A, "Class loader") JnjvmClassLoader(*A, *vm->bootstrapLoader, loader, vmdata, vm); @@ -1197,6 +1197,7 @@ extern "C" void vmjcAddPreCompiledClass(JnjvmClassLoader* JCL, CommonClass* cl) { cl->classLoader = JCL; + cl->virtualVT->vm = JCL->getIsolate(); JCL->hashUTF8->insert(cl->name); @@ -1269,6 +1270,19 @@ return res; } +VMClassLoader* VMClassLoader::allocate(Jnjvm *vm) { + VMClassLoader* res = 0; + llvm_gcroot(res, 0); + res = (VMClassLoader*)gc::operator new(sizeof(VMClassLoader), vm->VMClassLoader__VT); + return res; +} + +bool VMClassLoader::isVMClassLoader(Jnjvm *vm, JavaObject* obj) { + llvm_gcroot(obj, 0); + // not safe: must verify that obj belongs to a jvm + return obj->getVirtualTable() == vm->VMClassLoader__VT; +} + extern "C" void staticCallback() { fprintf(stderr, "Implement me"); abort(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h?rev=120703&r1=120702&r2=120703&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h Thu Dec 2 06:59:46 2010 @@ -87,6 +87,7 @@ protected: + friend class Jnjvm; JnjvmClassLoader(mvm::BumpPtrAllocator& Alloc) : allocator(Alloc) {} /// TheCompiler - The Java compiler for this class loader. @@ -443,23 +444,13 @@ public: - static VMClassLoader* allocate() { - VMClassLoader* res = 0; - llvm_gcroot(res, 0); - res = (VMClassLoader*)gc::operator new(sizeof(VMClassLoader), &VT); - return res; - } - - /// VT - The VirtualTable for this GC-class. + /// Allocate a VMClassLoader /// - static mvm::VirtualTable VT; + static VMClassLoader* allocate(Jnjvm *vm); /// Is the object a VMClassLoader object? /// - static bool isVMClassLoader(JavaObject* obj) { - llvm_gcroot(obj, 0); - return obj->getVirtualTable() == &VT; - } + static bool isVMClassLoader(Jnjvm *vm, JavaObject* obj); /// staticTracer - Trace the internal class loader. /// Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=120703&r1=120702&r2=120703&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Thu Dec 2 06:59:46 2010 @@ -53,10 +53,13 @@ // Classpath with the vmdata field). //===----------------------------------------------------------------------===// -mvm::VirtualTable VMClassLoader::VT((uintptr_t)VMClassLoader::staticDestructor, - (uintptr_t)VMClassLoader::staticDestructor, - (uintptr_t)VMClassLoader::staticTracer, - 0); +void Jnjvm::initialiseInternalVTs() { + VMClassLoader__VT = (mvm::VirtualTable*)allocator.Allocate(sizeof(mvm::VirtualTable), "Virtual table"); + VMClassLoader__VT->destructor = (uintptr_t)VMClassLoader::staticDestructor; + VMClassLoader__VT->operatorDelete = 0; + VMClassLoader__VT->tracer = (uintptr_t)VMClassLoader::staticTracer; + VMClassLoader__VT->vm = this; +} //===----------------------------------------------------------------------===// // Trace methods for Java objects. There are four types of objects: Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h?rev=120703&r1=120702&r2=120703&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h Thu Dec 2 06:59:46 2010 @@ -32,9 +32,6 @@ static uint32_t numberOfSpecializedTracers() { return 0; } - - GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t, VirtualMachine *v) : CommonVirtualTable(d, o, t, v) {} - GCVirtualTable() {} }; class Collector { Modified: vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h?rev=120703&r1=120702&r2=120703&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.h Thu Dec 2 06:59:46 2010 @@ -28,9 +28,6 @@ static uint32_t numberOfSpecializedTracers() { return 1; } - - GCVirtualTable(uintptr_t d, uintptr_t o, uintptr_t t, VirtualMachine* v) : CommonVirtualTable(d, o, t, v) {} - GCVirtualTable() {} }; extern "C" void* gcmallocUnresolved(uint32_t sz, VirtualTable* VT); From gael.thomas at lip6.fr Thu Dec 2 08:40:26 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 02 Dec 2010 16:40:26 -0000 Subject: [vmkit-commits] [vmkit] r120710 - in /vmkit/branches/multi-vm: include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/Mvm/Runtime/VMKit.cpp lib/Mvm/Runtime/VirtualMachine.cpp Message-ID: <20101202164027.03F592A6C12D@llvm.org> Author: gthomas Date: Thu Dec 2 10:40:26 2010 New Revision: 120710 URL: http://llvm.org/viewvc/llvm-project?rev=120710&view=rev Log: register all the vms inside vmkit Added: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=120710&r1=120709&r2=120710&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Thu Dec 2 10:40:26 2010 @@ -1,8 +1,10 @@ #ifndef _VMKIT_H_ #define _VMKIT_H_ +#include #include "mvm/Allocator.h" #include "mvm/Threads/CollectionRV.h" +#include "mvm/VirtualMachine.h" namespace mvm { @@ -13,6 +15,14 @@ VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { } + /// ------------------------------------------------- /// + /// --- vm managment --- /// + /// ------------------------------------------------- /// + mvm::SpinLock lockvms; // lock for vms + std::vector vms; // array of vms + + size_t addVM(VirtualMachine* vm); + void removeVM(size_t id); /// ------------------------------------------------- /// /// --- thread managment --- /// Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=120710&r1=120709&r2=120710&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Thu Dec 2 10:40:26 2010 @@ -53,16 +53,15 @@ /// defines what a VM should be. /// class VirtualMachine : public mvm::PermanentObject { -protected: - VirtualMachine(mvm::BumpPtrAllocator &Alloc, mvm::VMKit* vmk) : - allocator(Alloc) { - vmkit = vmk; - } +private: + friend class VMKit; + VirtualMachine(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) {} - virtual ~VirtualMachine() { - } +protected: + VirtualMachine(mvm::BumpPtrAllocator &Alloc, mvm::VMKit* vmk); public: + virtual ~VirtualMachine(); /// allocator - Bump pointer allocator to allocate permanent memory /// related to this VM. @@ -73,9 +72,8 @@ /// mvm::VMKit* vmkit; -//===----------------------------------------------------------------------===// -// (1) Thread-related methods. -//===----------------------------------------------------------------------===// + /// vmID - id of the vm + size_t vmID; //===----------------------------------------------------------------------===// // (2) GC-related methods. @@ -120,7 +118,7 @@ /// getObjectSize - Get the size of this object. Used by copying collectors. /// - virtual size_t getObjectSize(gc* object) = 0; + virtual size_t getObjectSize(gc* object) { abort(); } /// getObjectTypeName - Get the type of this object. Used by the GC for /// debugging purposes. @@ -145,10 +143,10 @@ /// 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; + virtual void runApplication(int argc, char** argv) { abort(); } /// waitForExit - Wait until the virtual machine stops its execution. - virtual void waitForExit() = 0; + virtual void waitForExit() { abort(); } }; } // end namespace mvm Added: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120710&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (added) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Thu Dec 2 10:40:26 2010 @@ -0,0 +1,21 @@ +#include "mvm/VMKit.h" +#include "mvm/VirtualMachine.h" + +using namespace mvm; + +size_t VMKit::addVM(VirtualMachine* vm) { + lockvms.lock(); + for(size_t i=0; iaddVM(this); +} + +VirtualMachine::~VirtualMachine() { + vmkit->removeVM(vmID); +} From gael.thomas at lip6.fr Thu Dec 2 09:58:14 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 02 Dec 2010 17:58:14 -0000 Subject: [vmkit-commits] [vmkit] r120718 - in /vmkit/branches/multi-vm: include/mvm/JIT.h include/mvm/Threads/Thread.h include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/J3/Classpath/ClasspathVMThrowable.inc lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/VMCore/JnjvmClassLoader.cpp lib/J3/VMCore/VirtualTables.cpp lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Compiler/JIT.cpp lib/Mvm/Runtime/MethodInfo.cpp mmtk/mmtk-j3/ActivePlan.cpp mmtk/mmtk-j3/Collection.cpp Message-ID: <20101202175814.A8A502A6C12F@llvm.org> Author: gthomas Date: Thu Dec 2 11:58:14 2010 New Revision: 120718 URL: http://llvm.org/viewvc/llvm-project?rev=120718&view=rev Log: Move function map in vmkit. Hide the field vmkit. Modified: vmkit/branches/multi-vm/include/mvm/JIT.h vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/MethodInfo.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp Modified: vmkit/branches/multi-vm/include/mvm/JIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/JIT.h?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/JIT.h (original) +++ vmkit/branches/multi-vm/include/mvm/JIT.h Thu Dec 2 11:58:14 2010 @@ -220,7 +220,7 @@ public: virtual void scan(uintptr_t closure, void* ip, void* addr); JITMethodInfo(llvm::GCFunctionInfo* GFI) : GCInfo(GFI) {} - void addToVM(VirtualMachine* vm, llvm::JIT* jit); + void addToVMKit(VMKit* vmkit, llvm::JIT* jit); }; class MvmJITMethodInfo : public JITMethodInfo { Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Thu Dec 2 11:58:14 2010 @@ -175,7 +175,7 @@ #else lastExceptionBuffer = 0; #endif - vmkit = vmk; + _vmkit = vmk; lastKnownFrame = 0; pendingException = 0; } @@ -382,9 +382,13 @@ /// gc* pendingException; - /// vmkit - a (shortcut) pointer to vmkit that contains information on all the vms +private: + /// _vmkit - a (shortcut) pointer to vmkit that contains information on all the vms /// - mvm::VMKit* vmkit; + mvm::VMKit* _vmkit; + +public: + mvm::VMKit* vmkit(); }; #ifndef RUNTIME_DWARF_EXCEPTIONS Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Thu Dec 2 11:58:14 2010 @@ -7,6 +7,35 @@ #include "mvm/VirtualMachine.h" namespace mvm { +class MethodInfo; +class VMKit; +class gc; + +class FunctionMap { +public: + /// Functions - Map of applicative methods to function pointers. This map is + /// used when walking the stack so that VMKit knows which applicative method + /// is executing on the stack. + /// + std::map Functions; + + /// FunctionMapLock - Spin lock to protect the Functions map. + /// + mvm::SpinLock FunctionMapLock; + + /// IPToMethodInfo - Map a code start instruction instruction to the MethodInfo. + /// + MethodInfo* IPToMethodInfo(void* ip); + + /// addMethodInfo - A new instruction pointer in the function map. + /// + void addMethodInfo(MethodInfo* meth, void* ip); + + /// removeMethodInfos - Remove all MethodInfo owned by the given owner. + void removeMethodInfos(void* owner); + + FunctionMap(); +}; class VMKit : public mvm::PermanentObject { public: @@ -15,11 +44,14 @@ VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { } + /// ------------------------------------------------- /// /// --- vm managment --- /// /// ------------------------------------------------- /// - mvm::SpinLock lockvms; // lock for vms - std::vector vms; // array of vms + // locksvms - a lock for vms + mvm::SpinLock lockvms; + // vms - the list of vms. Could be directly an array and we could also directly use the vmID as index in this array. + std::vector vms; size_t addVM(VirtualMachine* vm); void removeVM(size_t id); @@ -27,7 +59,6 @@ /// ------------------------------------------------- /// /// --- thread managment --- /// /// ------------------------------------------------- /// - /// rendezvous - The rendezvous implementation for garbage collection. /// #ifdef WITH_LLVM_GCC @@ -36,6 +67,20 @@ UncooperativeCollectionRV rendezvous; #endif + /// ------------------------------------------------- /// + /// --- backtrace related methods --- /// + /// ------------------------------------------------- /// + /// FunctionsCache - cache of compiled functions + // + FunctionMap FunctionsCache; + + MethodInfo* IPToMethodInfo(void* ip) { + return FunctionsCache.IPToMethodInfo(ip); + } + + void removeMethodInfos(void* owner) { + FunctionsCache.removeMethodInfos(owner); + } }; } Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Thu Dec 2 11:58:14 2010 @@ -19,36 +19,6 @@ namespace mvm { -class MethodInfo; -class VMKit; -class gc; - -class FunctionMap { -public: - /// Functions - Map of applicative methods to function pointers. This map is - /// used when walking the stack so that VMKit knows which applicative method - /// is executing on the stack. - /// - std::map Functions; - - /// FunctionMapLock - Spin lock to protect the Functions map. - /// - mvm::SpinLock FunctionMapLock; - - /// IPToMethodInfo - Map a code start instruction instruction to the MethodInfo. - /// - MethodInfo* IPToMethodInfo(void* ip); - - /// addMethodInfo - A new instruction pointer in the function map. - /// - void addMethodInfo(MethodInfo* meth, void* ip); - - /// removeMethodInfos - Remove all MethodInfo owned by the given owner. - void removeMethodInfos(void* owner); - - FunctionMap(); -}; - /// VirtualMachine - This class is the root of virtual machine classes. It /// defines what a VM should be. /// @@ -126,18 +96,6 @@ virtual const char* getObjectTypeName(gc* object) { return "An object"; } //===----------------------------------------------------------------------===// -// (3) Backtrace-related methods. -//===----------------------------------------------------------------------===// - - FunctionMap FunctionsCache; - MethodInfo* IPToMethodInfo(void* ip) { - return FunctionsCache.IPToMethodInfo(ip); - } - void removeMethodInfos(void* owner) { - FunctionsCache.removeMethodInfos(owner); - } - -//===----------------------------------------------------------------------===// // (4) Launch-related methods. //===----------------------------------------------------------------------===// Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc Thu Dec 2 11:58:14 2010 @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +#include "mvm/VMKit.h" + #include "types.h" #include "Classpath.h" @@ -137,15 +139,18 @@ llvm_gcroot(stack, 0); BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - JavaField* field = vm->upcalls->vmDataVMThrowable; + + Jnjvm* vm = JavaThread::get()->getJVM(); + mvm::VMKit* vmkit = vm->vmkit; + JavaField* field = vm->upcalls->vmDataVMThrowable; + stack = field->getInstanceObjectField(vmthrow); // remove the VMThrowable.fillInStackTrace method and the last method // on the stack. sint32 index = 2;; while (index != JavaArray::getSize(stack)) { - mvm::MethodInfo* MI = vm->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, index)); + mvm::MethodInfo* MI = vmkit->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, index)); if (!MI->isHighLevelMethod()) ++index; else { JavaMethod* meth = (JavaMethod*)MI->MetaInfo; @@ -159,7 +164,7 @@ sint32 size = 0; sint32 cur = index; while (cur < JavaArray::getSize(stack)) { - mvm::MethodInfo* MI = vm->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, cur)); + mvm::MethodInfo* MI = vmkit->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, cur)); ++cur; if (MI->isHighLevelMethod()) ++size; } @@ -169,7 +174,7 @@ cur = 0; for (sint32 i = index; i < JavaArray::getSize(stack); ++i) { - mvm::MethodInfo* MI = vm->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, i)); + mvm::MethodInfo* MI = vmkit->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, i)); if (MI->isHighLevelMethod()) { JavaMethod* meth = (JavaMethod*)MI->MetaInfo; ArrayObject::setElement(result, consStackElement(meth, ArrayPtr::getElement((ArrayPtr*)stack, i)), cur); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Thu Dec 2 11:58:14 2010 @@ -359,10 +359,10 @@ llvm::GCFunctionInfo* GFI = &(GCInfo->getFunctionInfo(*func)); assert((GFI != NULL) && "No GC information"); - Jnjvm* vm = JavaThread::get()->getJVM(); + mvm::VMKit* vmkit = mvm::Thread::get()->vmkit(); mvm::JITMethodInfo* MI = new(allocator, "JavaJITMethodInfo") JavaJITMethodInfo(GFI, meth); - MI->addToVM(vm, (JIT*)executionEngine); + MI->addToVMKit(vmkit, (JIT*)executionEngine); uint32_t infoLength = GFI->size(); meth->codeInfoLength = infoLength; @@ -401,10 +401,10 @@ llvm::GCFunctionInfo* GFI = &(GCInfo->getFunctionInfo(*F)); assert((GFI != NULL) && "No GC information"); - Jnjvm* vm = JavaThread::get()->getJVM(); + mvm::VMKit* vmkit = mvm::Thread::get()->vmkit(); mvm::JITMethodInfo* MI = new(allocator, "JITMethodInfo") mvm::MvmJITMethodInfo(GFI, F, this); - MI->addToVM(vm, (JIT*)executionEngine); + MI->addToVMKit(vmkit, (JIT*)executionEngine); // Now that it's compiled, we don't need the IR anymore F->deleteBody(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Thu Dec 2 11:58:14 2010 @@ -34,6 +34,7 @@ #include "debug.h" #include "mvm/Allocator.h" +#include "mvm/VMKit.h" #include "Classpath.h" #include "ClasspathReflect.h" @@ -917,8 +918,10 @@ JnjvmClassLoader::~JnjvmClassLoader() { if (isolate) { - isolate->removeMethodInfos(TheCompiler); - } + isolate->vmkit->removeMethodInfos(TheCompiler); + } else { + mvm::Thread::get()->vmkit()->removeMethodInfos(TheCompiler); + } if (classes) { classes->~ClassMap(); @@ -1128,7 +1131,7 @@ if (!isAbstract(meth.access) && meth.code) { JavaStaticMethodInfo* MI = new (allocator, "JavaStaticMethodInfo") JavaStaticMethodInfo(0, meth.code, &meth); - vm->FunctionsCache.addMethodInfo(MI, meth.code); + vm->vmkit->FunctionsCache.addMethodInfo(MI, meth.code); } } @@ -1137,7 +1140,7 @@ if (!isAbstract(meth.access) && meth.code) { JavaStaticMethodInfo* MI = new (allocator, "JavaStaticMethodInfo") JavaStaticMethodInfo(0, meth.code, &meth); - vm->FunctionsCache.addMethodInfo(MI, meth.code); + vm->vmkit->FunctionsCache.addMethodInfo(MI, meth.code); } } } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Thu Dec 2 11:58:14 2010 @@ -56,7 +56,7 @@ void Jnjvm::initialiseInternalVTs() { VMClassLoader__VT = (mvm::VirtualTable*)allocator.Allocate(sizeof(mvm::VirtualTable), "Virtual table"); VMClassLoader__VT->destructor = (uintptr_t)VMClassLoader::staticDestructor; - VMClassLoader__VT->operatorDelete = 0; + VMClassLoader__VT->operatorDelete = (uintptr_t)VMClassLoader::staticDestructor; VMClassLoader__VT->tracer = (uintptr_t)VMClassLoader::staticTracer; VMClassLoader__VT->vm = this; } Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Thu Dec 2 11:58:14 2010 @@ -205,7 +205,7 @@ extern "C" void conditionalSafePoint() { mvm::Thread* th = mvm::Thread::get(); - th->vmkit->rendezvous.join(); + th->vmkit()->rendezvous.join(); } void CooperativeCollectionRV::finishRV() { @@ -254,7 +254,7 @@ static void siggcHandler(int) { mvm::Thread* th = mvm::Thread::get(); - th->vmkit->rendezvous.join(); + th->vmkit()->rendezvous.join(); } void UncooperativeCollectionRV::prepareForJoin() { Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Thu Dec 2 11:58:14 2010 @@ -31,6 +31,10 @@ using namespace mvm; +mvm::VMKit* Thread::vmkit() { + return vmData->vm->vmkit; +} + void Thread::tracer(uintptr_t closure) { mvm::Collector::markAndTraceRoot(&pendingException, closure); vmData->tracer(closure); @@ -52,18 +56,18 @@ Thread* th = mvm::Thread::get(); if (th->isMvmThread()) { if (th->doYield && !th->inRV) { - th->vmkit->rendezvous.join(); + th->vmkit()->rendezvous.join(); } } sched_yield(); } void Thread::joinRVBeforeEnter() { - vmkit->rendezvous.joinBeforeUncooperative(); + vmkit()->rendezvous.joinBeforeUncooperative(); } void Thread::joinRVAfterLeave(void* savedSP) { - vmkit->rendezvous.joinAfterUncooperative(savedSP); + vmkit()->rendezvous.joinAfterUncooperative(savedSP); } void Thread::startKnownFrame(KnownFrame& F) { @@ -177,7 +181,7 @@ ip = FRAME_IP(addr); bool isStub = ((unsigned char*)ip)[0] == 0xCE; if (isStub) ip = addr[2]; - return thread->MyVM->IPToMethodInfo(ip); + return thread->vmkit()->IPToMethodInfo(ip); } void* StackWalker::operator*() { @@ -429,9 +433,9 @@ #ifdef ISOLATE th->IsolateID = th->MyVM->IsolateID; #endif - th->vmkit->rendezvous.prepareForJoin(); + th->vmkit()->rendezvous.prepareForJoin(); th->routine(th); - th->vmkit->rendezvous.removeThread(th); + th->vmkit()->rendezvous.removeThread(th); } @@ -446,7 +450,7 @@ routine = fct; // Make sure to add it in the list of threads before leaving this function: // the garbage collector wants to trace this thread. - vmkit->rendezvous.addThread(this); + vmkit()->rendezvous.addThread(this); int res = pthread_create((pthread_t*)(void*)(&internalThreadID), &attributs, (void* (*)(void *))internalThreadStart, this); pthread_detach((pthread_t)internalThreadID); @@ -490,3 +494,4 @@ index = (index & ~TheStackManager.baseAddr) >> 20; TheStackManager.used[index] = 0; } + Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp Thu Dec 2 11:58:14 2010 @@ -44,6 +44,7 @@ #include "mvm/VirtualMachine.h" #include "MutatorThread.h" #include "mvm/GC.h" +#include "mvm/VMKit.h" #include #include @@ -99,11 +100,11 @@ llvm::GCFunctionInfo* GFI = *I; JITMethodInfo* MI = new(*MvmModule::Allocator, "MvmJITMethodInfo") MvmJITMethodInfo(GFI, &F, MvmModule::executionEngine); - MI->addToVM(mvm::Thread::get()->MyVM, (JIT*)MvmModule::executionEngine); + MI->addToVMKit(mvm::Thread::get()->vmkit(), (JIT*)MvmModule::executionEngine); } }; -void JITMethodInfo::addToVM(VirtualMachine* VM, JIT* jit) { +void JITMethodInfo::addToVMKit(VMKit* vmkit, JIT* jit) { JITCodeEmitter* JCE = jit->getCodeEmitter(); assert(GCInfo != NULL); for (GCFunctionInfo::iterator I = GCInfo->begin(), E = GCInfo->end(); @@ -111,7 +112,7 @@ I++) { uintptr_t address = JCE->getLabelAddress(I->Label); assert(address != 0); - VM->FunctionsCache.addMethodInfo(this, (void*)address); + vmkit->FunctionsCache.addMethodInfo(this, (void*)address); } } Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/MethodInfo.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/MethodInfo.cpp?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/MethodInfo.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/MethodInfo.cpp Thu Dec 2 11:58:14 2010 @@ -11,6 +11,7 @@ #include "mvm/MethodInfo.h" #include "mvm/VirtualMachine.h" #include "mvm/GC.h" +#include "mvm/VMKit.h" #include #include Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp Thu Dec 2 11:58:14 2010 @@ -19,8 +19,8 @@ assert(A && "No active plan"); if (A->current == NULL) { - A->current = (mvm::MutatorThread*)mvm::Thread::get()->vmkit->rendezvous.oneThread; - } else if (A->current->next() == mvm::Thread::get()->vmkit->rendezvous.oneThread) { + A->current = (mvm::MutatorThread*)mvm::Thread::get()->vmkit()->rendezvous.oneThread; + } else if (A->current->next() == mvm::Thread::get()->vmkit()->rendezvous.oneThread) { A->current = NULL; return NULL; } else { Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp?rev=120718&r1=120717&r2=120718&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp Thu Dec 2 11:58:14 2010 @@ -36,14 +36,14 @@ mvm::Thread* th = mvm::Thread::get(); // Verify that another collection is not happening. - th->vmkit->rendezvous.startRV(); + th->vmkit()->rendezvous.startRV(); if (th->doYield) { - th->vmkit->rendezvous.cancelRV(); - th->vmkit->rendezvous.join(); + th->vmkit()->rendezvous.cancelRV(); + th->vmkit()->rendezvous.join(); return; } else { th->MyVM->startCollection(); - th->vmkit->rendezvous.synchronize(); + th->vmkit()->rendezvous.synchronize(); JnJVM_org_mmtk_plan_Plan_setCollectionTriggered__(); @@ -73,7 +73,7 @@ elapsedTime / 1000000); } - th->vmkit->rendezvous.finishRV(); + th->vmkit()->rendezvous.finishRV(); th->MyVM->endCollection(); } @@ -82,7 +82,7 @@ extern "C" void Java_org_j3_mmtk_Collection_joinCollection__ (MMTkObject* C) { mvm::Thread* th = mvm::Thread::get(); assert(th->inRV && "Joining collection without a rendezvous"); - th->vmkit->rendezvous.join(); + th->vmkit()->rendezvous.join(); } extern "C" int Java_org_j3_mmtk_Collection_rendezvous__I (MMTkObject* C, int where) { From nicolas.geoffray at lip6.fr Fri Dec 3 10:34:46 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Fri, 03 Dec 2010 18:34:46 -0000 Subject: [vmkit-commits] [vmkit] r120823 - in /vmkit/trunk: lib/J3/Classpath/Classpath.inc lib/J3/Classpath/ClasspathReflect.h lib/J3/Classpath/ClasspathVMObject.inc lib/J3/Classpath/ClasspathVMSystem.inc lib/J3/VMCore/JavaArray.h lib/J3/VMCore/JavaClass.h lib/J3/VMCore/JavaString.h lib/Mvm/GCMmap2/MvmGC.h lib/Mvm/MMTk/MvmGC.cpp lib/Mvm/MMTk/MvmGC.h mmtk/mmtk-alloc/Selected.cpp Message-ID: <20101203183446.93D152A6C12D@llvm.org> Author: geoffray Date: Fri Dec 3 12:34:46 2010 New Revision: 120823 URL: http://llvm.org/viewvc/llvm-project?rev=120823&view=rev Log: Put write barriers in the GC and start calling them in J3 code. Modified: vmkit/trunk/lib/J3/Classpath/Classpath.inc vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h vmkit/trunk/lib/J3/Classpath/ClasspathVMObject.inc vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc vmkit/trunk/lib/J3/VMCore/JavaArray.h vmkit/trunk/lib/J3/VMCore/JavaClass.h vmkit/trunk/lib/J3/VMCore/JavaString.h vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp vmkit/trunk/lib/Mvm/MMTk/MvmGC.h vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp Modified: vmkit/trunk/lib/J3/Classpath/Classpath.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/Classpath.inc?rev=120823&r1=120822&r2=120823&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Classpath/Classpath.inc (original) +++ vmkit/trunk/lib/J3/Classpath/Classpath.inc Fri Dec 3 12:34:46 2010 @@ -334,11 +334,9 @@ llvm_gcroot(expect, 0); llvm_gcroot(update, 0); - jobject *ptr; + JavaObject** ptr = (JavaObject**) (((uint8 *) obj) + offset); - ptr = (jobject *) (((uint8 *) obj) + offset); - - return __sync_bool_compare_and_swap(ptr, expect, update); + return mvm::Collector::objectReferenceTryCASBarrier((gc*)obj, (gc**)ptr, (gc*)expect, (gc*)update); } // Never throws. @@ -351,11 +349,8 @@ llvm_gcroot(obj, 0); llvm_gcroot(value, 0); - JavaObject** ptr; - - ptr = (JavaObject**) (((uint8 *) obj) + offset); - - *ptr = value; - + JavaObject** ptr = (JavaObject**) (((uint8 *) obj) + offset); + mvm::Collector::objectReferenceWriteBarrier((gc*)obj, (gc**)ptr, (gc*)value); } + } Modified: vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h?rev=120823&r1=120822&r2=120823&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h (original) +++ vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h Fri Dec 3 12:34:46 2010 @@ -14,7 +14,7 @@ #include "JavaClass.h" #include "JavaObject.h" -#include +#include "JavaThread.h" extern "C" j3::JavaObject* internalFillInStackTrace(j3::JavaObject*); @@ -42,7 +42,8 @@ static void setProtectionDomain(JavaObjectClass* cl, JavaObject* pd) { llvm_gcroot(cl, 0); llvm_gcroot(pd, 0); - cl->pd = pd; + mvm::Collector::objectReferenceWriteBarrier( + (gc*)cl, (gc**)&(cl->pd), (gc*)pd); } static JavaObject* getProtectionDomain(JavaObjectClass* cl) { @@ -179,13 +180,22 @@ static void setDetailedMessage(JavaObjectThrowable* self, JavaObject* obj) { llvm_gcroot(self, 0); llvm_gcroot(obj, 0); - self->detailedMessage = obj; + mvm::Collector::objectReferenceWriteBarrier( + (gc*)self, (gc**)&(self->detailedMessage), (gc*)obj); } static void fillInStackTrace(JavaObjectThrowable* self) { + JavaObject* stackTrace = NULL; llvm_gcroot(self, 0); - self->cause = self; - self->vmState = internalFillInStackTrace(self); + llvm_gcroot(stackTrace, 0); + + stackTrace = internalFillInStackTrace(self); + mvm::Collector::objectReferenceWriteBarrier( + (gc*)self, (gc**)&(self->vmState), (gc*)stackTrace); + + mvm::Collector::objectReferenceWriteBarrier( + (gc*)self, (gc**)&(self->cause), (gc*)self); + self->stackTrace = NULL; } }; @@ -201,8 +211,10 @@ llvm_gcroot(self, 0); llvm_gcroot(r, 0); llvm_gcroot(q, 0); - self->referent = r; - self->queue = q; + mvm::Collector::objectReferenceWriteBarrier( + (gc*)self, (gc**)&(self->referent), (gc*)r); + mvm::Collector::objectReferenceWriteBarrier( + (gc*)self, (gc**)&(self->queue), (gc*)q); } static JavaObject** getReferentPtr(JavaObjectReference* self) { @@ -213,6 +225,7 @@ static void setReferent(JavaObjectReference* self, JavaObject* r) { llvm_gcroot(self, 0); llvm_gcroot(r, 0); + // No write barrier: this is only called by the GC. self->referent = r; } }; Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMObject.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMObject.inc?rev=120823&r1=120822&r2=120823&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Classpath/ClasspathVMObject.inc (original) +++ vmkit/trunk/lib/J3/Classpath/ClasspathVMObject.inc Fri Dec 3 12:34:46 2010 @@ -27,30 +27,60 @@ #endif JavaObject* src) { - JavaObject* res = 0; + JavaObject* res = NULL; + JavaObject* tmp = NULL; llvm_gcroot(res, 0); llvm_gcroot(src, 0); BEGIN_NATIVE_EXCEPTION(0) UserCommonClass* cl = JavaObject::getClass(src); - size_t size = 0; + Jnjvm* vm = JavaThread::get()->getJVM(); if (cl->isArray()) { UserClassArray* array = cl->asArrayClass(); + int length = JavaArray::getSize(src); + res = array->doNew(length, vm); UserCommonClass* base = array->baseClass(); - uint32 logSize = base->isPrimitive() ? - base->asPrimitiveClass()->logSize : (sizeof(JavaObject*) == 8 ? 3 : 2); - - size = sizeof(JavaObject) + sizeof(ssize_t) + - (JavaArray::getSize(src) << logSize); + if (base->isPrimitive()) { + int size = length << base->asPrimitiveClass()->logSize; + memcpy((void*)((uintptr_t)res + sizeof(JavaObject) + sizeof(size_t)), + (void*)((uintptr_t)src + sizeof(JavaObject) + sizeof(size_t)), + size); + } else { + for (int i = 0; i < length; i++) { + tmp = ArrayObject::getElement((ArrayObject*)src, i); + ArrayObject::setElement((ArrayObject*)res, tmp, i); + } + } } else { assert(cl->isClass() && "Not a class!"); - size = cl->asClass()->getVirtualSize(); + res = cl->asClass()->doNew(vm); + while (cl != NULL) { + for (uint32 i = 0; i < cl->asClass()->nbVirtualFields; ++i) { + JavaField& field = cl->asClass()->virtualFields[i]; + if (field.isReference()) { + tmp = field.getInstanceObjectField(src); + JavaObject** ptr = field.getInstanceObjectFieldPtr(res); + mvm::Collector::objectReferenceWriteBarrier((gc*)res, (gc**)ptr, (gc*)tmp); + } else if (field.isLong()) { + field.setInstanceLongField(res, field.getInstanceLongField(src)); + } else if (field.isDouble()) { + field.setInstanceDoubleField(res, field.getInstanceDoubleField(src)); + } else if (field.isInt()) { + field.setInstanceInt32Field(res, field.getInstanceInt32Field(src)); + } else if (field.isFloat()) { + field.setInstanceFloatField(res, field.getInstanceFloatField(src)); + } else if (field.isShort() || field.isChar()) { + field.setInstanceInt16Field(res, field.getInstanceInt16Field(src)); + } else if (field.isByte() || field.isBoolean()) { + field.setInstanceInt8Field(res, field.getInstanceInt8Field(src)); + } else { + UNREACHABLE(); + } + } + cl = cl->super; + } } - res = (JavaObject*)gc::operator new(size, src->getVirtualTable()); - memcpy((void*)((uintptr_t)res + 2 * sizeof(void*)), - (void*)((uintptr_t)src + 2 * sizeof(void*)), - size - 2 * sizeof(void*)); END_NATIVE_EXCEPTION Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc?rev=120823&r1=120822&r2=120823&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc (original) +++ vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc Fri Dec 3 12:34:46 2010 @@ -82,33 +82,26 @@ } if (th->pendingException != NULL) return; - jint i = sstart; - jint length = len; - bool doThrow = false; if (!(dstType->isPrimitive())) { - while (i < sstart + len && !doThrow) { - cur = ArrayObject::getElement((ArrayObject*)src, i); + for (int i = 0; i < len; i++) { + cur = ArrayObject::getElement((ArrayObject*)src, i + sstart); if (cur) { if (!(JavaObject::getClass(cur)->isAssignableFrom(dstType))) { - doThrow = true; - length = i; + th->pendingException = vm->CreateArrayStoreException( + (JavaVirtualTable*)dst->getVirtualTable()); + break; + } else { + ArrayObject::setElement((ArrayObject*)dst, cur, i + dstart); } } - ++i; } + } else { + uint32 logSize = dstType->asPrimitiveClass()->logSize; + void* ptrDst = (void*)((int64_t)JavaArray::getElements(dst) + (dstart << logSize)); + void* ptrSrc = (void*)((int64_t)JavaArray::getElements(src) + (sstart << logSize)); + memmove(ptrDst, ptrSrc, len << logSize); } - - uint32 logSize = dstType->isPrimitive() ? - dstType->asPrimitiveClass()->logSize : (sizeof(JavaObject*) == 8 ? 3 : 2); - - void* ptrDst = (void*)((int64_t)JavaArray::getElements(dst) + (dstart << logSize)); - void* ptrSrc = (void*)((int64_t)JavaArray::getElements(src) + (sstart << logSize)); - memmove(ptrDst, ptrSrc, length << logSize); - if (doThrow) { - th->pendingException = vm->CreateArrayStoreException( - (JavaVirtualTable*)dst->getVirtualTable()); - } } JNIEXPORT jint JNICALL Java_java_lang_VMSystem_identityHashCode( Modified: vmkit/trunk/lib/J3/VMCore/JavaArray.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaArray.h?rev=120823&r1=120822&r2=120823&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaArray.h (original) +++ vmkit/trunk/lib/J3/VMCore/JavaArray.h Fri Dec 3 12:34:46 2010 @@ -99,7 +99,8 @@ llvm_gcroot(self, 0); llvm_gcroot(value, 0); if (value != NULL) assert(value->getVirtualTable()); - self->elements[i] = value; + mvm::Collector::objectReferenceWriteBarrier( + (gc*)self, (gc**)&(self->elements[i]), (gc*)value); } static JavaObject** getElements(ArrayObject* self) { Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.h?rev=120823&r1=120822&r2=120823&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaClass.h (original) +++ vmkit/trunk/lib/J3/VMCore/JavaClass.h Fri Dec 3 12:34:46 2010 @@ -1264,7 +1264,7 @@ assert(classDef->isResolved()); \ void* ptr = (void*)((uint64)obj + ptrOffset); \ return ((TYPE*)ptr)[0]; \ - } + } \ /// setInstance*Field - Set an instance field. /// @@ -1299,8 +1299,8 @@ llvm_gcroot(val, 0); if (val != NULL) assert(val->getVirtualTable()); assert(classDef->isResolved()); - void* ptr = (void*)((uint64)classDef->getStaticInstance() + ptrOffset); - ((JavaObject**)ptr)[0] = val; + JavaObject** ptr = (JavaObject**)((uint64)classDef->getStaticInstance() + ptrOffset); + mvm::Collector::objectReferenceNonHeapWriteBarrier((gc**)ptr, (gc*)val); } JavaObject* getInstanceObjectField(JavaObject* obj) { @@ -1315,14 +1315,46 @@ llvm_gcroot(val, 0); if (val != NULL) assert(val->getVirtualTable()); assert(classDef->isResolved()); - void* ptr = (void*)((uint64)obj + ptrOffset); - ((JavaObject**)ptr)[0] = val; + JavaObject** ptr = (JavaObject**)((uint64)obj + ptrOffset); + mvm::Collector::objectReferenceWriteBarrier((gc*)obj, (gc**)ptr, (gc*)val); } bool isReference() { uint16 val = type->elements[0]; return (val == '[' || val == 'L'); } + + bool isDouble() { + return (type->elements[0] == 'D'); + } + + bool isLong() { + return (type->elements[0] == 'J'); + } + + bool isInt() { + return (type->elements[0] == 'I'); + } + + bool isFloat() { + return (type->elements[0] == 'F'); + } + + bool isShort() { + return (type->elements[0] == 'S'); + } + + bool isChar() { + return (type->elements[0] == 'C'); + } + + bool isByte() { + return (type->elements[0] == 'B'); + } + + bool isBoolean() { + return (type->elements[0] == 'Z'); + } }; Modified: vmkit/trunk/lib/J3/VMCore/JavaString.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaString.h?rev=120823&r1=120822&r2=120823&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaString.h (original) +++ vmkit/trunk/lib/J3/VMCore/JavaString.h Fri Dec 3 12:34:46 2010 @@ -21,9 +21,10 @@ class Jnjvm; class JavaString : public JavaObject { -public: + private: // CLASSPATH FIELDS!! const ArrayUInt16* value; + public: sint32 count; sint32 cachedHashCode; sint32 offset; @@ -31,7 +32,8 @@ static void setValue(JavaString* self, const ArrayUInt16* array) { llvm_gcroot(self, 0); llvm_gcroot(array, 0); - self->value = array; + mvm::Collector::objectReferenceWriteBarrier( + (gc*)self, (gc**)&(self->value), (gc*)array); } static const ArrayUInt16* getValue(const JavaString* self) { llvm_gcroot(self, 0); Modified: vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h?rev=120823&r1=120822&r2=120823&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h Fri Dec 3 12:34:46 2010 @@ -359,6 +359,18 @@ return val; } + static void objectReferenceWriteBarrier(gc* ref, gc** slot, gc* value) { + *slot = value; + } + + static void objectReferenceNonHeapWriteBarrier(gc** slot, gc* value) { + *slot = value; + } + + static bool objectReferenceTryCASBarrier(gc*ref, gc** slot, gc* old, gc* value) { + gc* res = __sync_val_compare_and_swap(slot, old, value); + return (res == old); + } }; } Modified: vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp?rev=120823&r1=120822&r2=120823&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp (original) +++ vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp Fri Dec 3 12:34:46 2010 @@ -109,6 +109,19 @@ return NULL; } +void Collector::objectReferenceWriteBarrier(gc* ref, gc** slot, gc* value) { + *slot = value; +} + +void Collector::objectReferenceNonHeapWriteBarrier(gc** slot, gc* value) { + *slot = value; +} + +bool Collector::objectReferenceTryCASBarrier(gc*ref, gc** slot, gc* old, gc* value) { + gc* res = __sync_val_compare_and_swap(slot, old, value); + return (old == res); +} + void Collector::collect() { // Do nothing. } Modified: vmkit/trunk/lib/Mvm/MMTk/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MvmGC.h?rev=120823&r1=120822&r2=120823&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/MMTk/MvmGC.h (original) +++ vmkit/trunk/lib/Mvm/MMTk/MvmGC.h Fri Dec 3 12:34:46 2010 @@ -71,11 +71,14 @@ static void scanObject(void** ptr, uintptr_t closure) __attribute__ ((always_inline)); static void markAndTrace(void* source, void* ptr, uintptr_t closure) __attribute__ ((always_inline)); static void markAndTraceRoot(void* ptr, uintptr_t closure) __attribute__ ((always_inline)); - static gc* retainForFinalize(gc* val, uintptr_t closure) __attribute__ ((always_inline)); - static gc* retainReferent(gc* val, uintptr_t closure) __attribute__ ((always_inline)); - static gc* getForwardedFinalizable(gc* val, uintptr_t closure) __attribute__ ((always_inline)); - static gc* getForwardedReference(gc* val, uintptr_t closure) __attribute__ ((always_inline)); - static gc* getForwardedReferent(gc* val, uintptr_t closure) __attribute__ ((always_inline)); + static gc* retainForFinalize(gc* val, uintptr_t closure) __attribute__ ((always_inline)); + static gc* retainReferent(gc* val, uintptr_t closure) __attribute__ ((always_inline)); + static gc* getForwardedFinalizable(gc* val, uintptr_t closure) __attribute__ ((always_inline)); + static gc* getForwardedReference(gc* val, uintptr_t closure) __attribute__ ((always_inline)); + static gc* getForwardedReferent(gc* val, uintptr_t closure) __attribute__ ((always_inline)); + static void objectReferenceWriteBarrier(gc* ref, gc** slot, gc* value) __attribute__ ((always_inline)); + static void objectReferenceNonHeapWriteBarrier(gc** slot, gc* value) __attribute__ ((always_inline)); + static bool objectReferenceTryCASBarrier(gc* ref, gc** slot, gc* old, gc* value) __attribute__ ((always_inline)); static void collect(); Modified: vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp?rev=120823&r1=120822&r2=120823&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp (original) +++ vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp Fri Dec 3 12:34:46 2010 @@ -155,6 +155,19 @@ return val; } +void Collector::objectReferenceWriteBarrier(gc* ref, gc** slot, gc* value) { + *slot = value; +} + +void Collector::objectReferenceNonHeapWriteBarrier(gc** slot, gc* value) { + *slot = value; +} + +bool Collector::objectReferenceTryCASBarrier(gc*ref, gc** slot, gc* old, gc* value) { + gc* res = __sync_val_compare_and_swap(slot, old, value); + return (old == res); +} + //TODO: Remove these. std::set __InternalSet__; void* Collector::begOf(gc* obj) { From nicolas.geoffray at lip6.fr Sat Dec 4 03:03:31 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sat, 04 Dec 2010 11:03:31 -0000 Subject: [vmkit-commits] [vmkit] r120903 - in /vmkit/trunk/lib/J3/VMCore: JNIReferences.h JavaClass.cpp JavaThread.cpp JnjvmClassLoader.cpp JnjvmClassLoader.h LockedMap.cpp VirtualTables.cpp Message-ID: <20101204110331.9FD722A6C12C@llvm.org> Author: geoffray Date: Sat Dec 4 05:03:31 2010 New Revision: 120903 URL: http://llvm.org/viewvc/llvm-project?rev=120903&view=rev Log: Continue adding write barriers in J3 code. Some are not strictly necessary because the objects will be traced by the global roots anyway, but we first have to make sure to get things right. Modified: vmkit/trunk/lib/J3/VMCore/JNIReferences.h vmkit/trunk/lib/J3/VMCore/JavaClass.cpp vmkit/trunk/lib/J3/VMCore/JavaThread.cpp vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h vmkit/trunk/lib/J3/VMCore/LockedMap.cpp vmkit/trunk/lib/J3/VMCore/VirtualTables.cpp Modified: vmkit/trunk/lib/J3/VMCore/JNIReferences.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JNIReferences.h?rev=120903&r1=120902&r2=120903&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JNIReferences.h (original) +++ vmkit/trunk/lib/J3/VMCore/JNIReferences.h Sat Dec 4 05:03:31 2010 @@ -69,7 +69,8 @@ return next->addJNIReference(obj); } else { ++count; - globalReferences[length] = obj; + mvm::Collector::objectReferenceNonHeapWriteBarrier( + (gc**)&(globalReferences[length]), (gc*)obj); return &globalReferences[length++]; } } @@ -77,7 +78,7 @@ void removeJNIReference(JavaObject** obj) { if (((uintptr_t)obj >= (uintptr_t)globalReferences) && ((uintptr_t)obj) < (uintptr_t)(globalReferences + MAXIMUM_REFERENCES)) { - *obj = 0; + *obj = NULL; --count; } else { assert(next && "No global reference located there"); Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.cpp?rev=120903&r1=120902&r2=120903&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaClass.cpp Sat Dec 4 05:03:31 2010 @@ -1066,8 +1066,13 @@ prev = (JavaObject*)__sync_val_compare_and_swap((uintptr_t)obj, NULL, val); - if (!prev) return val; - else return prev; + if (prev == NULL) { + // Write it again to execute the write barrier. + mvm::Collector::objectReferenceNonHeapWriteBarrier((gc**)obj, (gc*)val); + return val; + } else { + return prev; + } } #else @@ -1078,8 +1083,14 @@ llvm_gcroot(prev, 0); prev = (JavaObject*)__sync_val_compare_and_swap(&(delegatee[0]), NULL, val); - if (!prev) return val; - else return prev; + if (prev == NULL) { + // Write it again to execute the write barrier. + mvm::Collector::objectReferenceNonHeapWriteBarrier( + (gc**)&(delegatee[0]), (gc*)val); + return val; + } else { + return prev; + } } #endif Modified: vmkit/trunk/lib/J3/VMCore/JavaThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaThread.cpp?rev=120903&r1=120902&r2=120903&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaThread.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaThread.cpp Sat Dec 4 05:03:31 2010 @@ -40,8 +40,10 @@ void JavaThread::initialise(JavaObject* thread, JavaObject* vmth) { llvm_gcroot(thread, 0); llvm_gcroot(vmth, 0); - javaThread = thread; - vmThread = vmth; + mvm::Collector::objectReferenceNonHeapWriteBarrier( + (gc**)&javaThread, (gc*)thread); + mvm::Collector::objectReferenceNonHeapWriteBarrier( + (gc**)&vmThread, (gc*)vmth); } JavaThread::~JavaThread() { @@ -153,7 +155,8 @@ next->prev = this; return next->addJNIReference(th, obj); } else { - localReferences[length] = obj; + mvm::Collector::objectReferenceNonHeapWriteBarrier( + (gc**)&(localReferences[length]), (gc*)obj); return &localReferences[length++]; } } Modified: vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=120903&r1=120902&r2=120903&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp Sat Dec 4 05:03:31 2010 @@ -274,7 +274,8 @@ strings = new(allocator, "StringList") StringList(); vmdata->JCL = this; - javaLoader = loader; + mvm::Collector::objectReferenceNonHeapWriteBarrier( + (gc**)&javaLoader, (gc*)loader); isolate = I; JavaMethod* meth = bootstrapLoader->upcalls->loadInClassLoader; Modified: vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h?rev=120903&r1=120902&r2=120903&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h (original) +++ vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h Sat Dec 4 05:03:31 2010 @@ -513,7 +513,8 @@ JCL->strings = next; return next->addString(JCL, obj); } else { - strings[length] = obj; + mvm::Collector::objectReferenceNonHeapWriteBarrier( + (gc**)&(strings[length]), (gc*)obj); return &strings[length++]; } } Modified: vmkit/trunk/lib/J3/VMCore/LockedMap.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/LockedMap.cpp?rev=120903&r1=120902&r2=120903&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/LockedMap.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/LockedMap.cpp Sat Dec 4 05:03:31 2010 @@ -10,17 +10,24 @@ #include #include "JavaArray.h" -#include "JavaClass.h" #include "JavaString.h" -#include "JavaTypes.h" #include "LockedMap.h" -#include "Zip.h" - -#include using namespace j3; void StringMap::insert(JavaString* str) { + const ArrayUInt16* array = NULL; llvm_gcroot(str, 0); - map.insert(std::make_pair(JavaString::getValue(str), str)); + llvm_gcroot(array, 0); + array = JavaString::getValue(str); + StringMap::iterator it = map.insert(std::make_pair(array, str)).first; + assert(map.find(array)->second == str); + assert(map.find(array)->first == array); + assert(&(map.find(array)->second) == &(it->second)); + assert(&(map.find(array)->first) == &(it->first)); + // Inform the GC that we just stored a string here. + mvm::Collector::objectReferenceNonHeapWriteBarrier( + (gc**)&(it->second), (gc*)str); + mvm::Collector::objectReferenceNonHeapWriteBarrier( + (gc**)&(it->first), (gc*)array); } Modified: vmkit/trunk/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/VirtualTables.cpp?rev=120903&r1=120902&r2=120903&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/VirtualTables.cpp Sat Dec 4 05:03:31 2010 @@ -18,6 +18,9 @@ // referenced by classes. // (4) Tracing the roots of a program: the JVM and the threads. // +// Additionnaly, all write of GC objets in J3 data structures must go through +// a write barrier. +// //===----------------------------------------------------------------------===// #include "ClasspathReflect.h" @@ -229,20 +232,15 @@ void JnjvmBootstrapLoader::tracer(uintptr_t closure) { JnjvmClassLoader::tracer(closure); - -#define TRACE_DELEGATEE(prim) \ - prim->tracer(closure); - - TRACE_DELEGATEE(upcalls->OfVoid); - TRACE_DELEGATEE(upcalls->OfBool); - TRACE_DELEGATEE(upcalls->OfByte); - TRACE_DELEGATEE(upcalls->OfChar); - TRACE_DELEGATEE(upcalls->OfShort); - TRACE_DELEGATEE(upcalls->OfInt); - TRACE_DELEGATEE(upcalls->OfFloat); - TRACE_DELEGATEE(upcalls->OfLong); - TRACE_DELEGATEE(upcalls->OfDouble); -#undef TRACE_DELEGATEE + upcalls->OfVoid->tracer(closure); + upcalls->OfBool->tracer(closure); + upcalls->OfByte->tracer(closure); + upcalls->OfChar->tracer(closure); + upcalls->OfShort->tracer(closure); + upcalls->OfInt->tracer(closure); + upcalls->OfFloat->tracer(closure); + upcalls->OfLong->tracer(closure); + upcalls->OfDouble->tracer(closure); } //===----------------------------------------------------------------------===// @@ -316,24 +314,12 @@ 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 - -#ifdef SERVICE - parent->tracer(closure); -#endif } void JavaThread::tracer(uintptr_t closure) { mvm::Collector::markAndTraceRoot(&pendingException, closure); mvm::Collector::markAndTraceRoot(&javaThread, closure); mvm::Collector::markAndTraceRoot(&vmThread, closure); -#ifdef SERVICE - mvm::Collector::markAndTraceRoot(&ServiceException, closure); -#endif JNILocalReferences* end = localJNIRefs; while (end != NULL) { From gael.thomas at lip6.fr Sat Dec 4 04:46:27 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sat, 04 Dec 2010 12:46:27 -0000 Subject: [vmkit-commits] [vmkit] r120906 - in /vmkit/branches/multi-vm: include/debug.h include/mvm/Threads/CollectionRV.h include/mvm/Threads/Thread.h include/mvm/VMKit.h lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/J3/VMCore/ReferenceQueue.cpp lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Compiler/mvm-runtime.ll lib/Mvm/Runtime/VMKit.cpp mmtk/mmtk-j3/ActivePlan.cpp Message-ID: <20101204124627.826D62A6C12C@llvm.org> Author: gthomas Date: Sat Dec 4 06:46:27 2010 New Revision: 120906 URL: http://llvm.org/viewvc/llvm-project?rev=120906&view=rev Log: Add a lock in vmkit (vmkitLock) The list of virtual machine inside vmkit is an array instead of a vactor. Synchronize with vmkitLock. Move the list of threads in vmkit. Synchronized with vmkitLock. Add a list of thread specific data inside each thread. The finalizer thread uses to vm to finalize the thread. For the moment, the vm specific data is not changed. Will use the array of vm thread specific data. Modified: vmkit/branches/multi-vm/include/debug.h vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp Modified: vmkit/branches/multi-vm/include/debug.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/debug.h?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/debug.h (original) +++ vmkit/branches/multi-vm/include/debug.h Sat Dec 4 06:46:27 2010 @@ -73,7 +73,7 @@ #define UNREACHABLE() ABORT() #define ASSERT(cond) { \ - if (!cond) ABORT(); } \ + if (!cond) { fprintf(stderr, "fatal: assert("#cond")\n"); ABORT(); } } \ #undef ALWAYS_INLINE #define ALWAYS_INLINE __attribute__ ((always_inline)) Modified: vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/CollectionRV.h Sat Dec 4 06:46:27 2010 @@ -18,16 +18,6 @@ class CollectionRV { public: - /// oneThread - One of the threads - mvm::Thread* oneThread; - -protected: - /// numberOfThreads - The number of threads that currently run under this VM. - uint32_t numberOfThreads; - - /// threadLock - Lock to create or destroy a new thread. - mvm::SpinLock threadLock; - /// _lockRV - Lock for synchronization. LockNormal _lockRV; @@ -43,8 +33,6 @@ public: CollectionRV() { nbJoined = 0; - oneThread = 0; - numberOfThreads = 0; } void lockRV() { _lockRV.lock(); } @@ -72,12 +60,6 @@ virtual void joinAfterUncooperative(void* SP) = 0; virtual void joinBeforeUncooperative() = 0; - /// addThread - Add a new thread to the list of threads. - void addThread(mvm::Thread* th); - - /// removeThread - Remove the thread from the list of threads. - void removeThread(mvm::Thread* th); - /// prepareForJoin - for uncooperative gc, prepare the SIGGC handler virtual void prepareForJoin() = 0; }; Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Sat Dec 4 06:46:27 2010 @@ -149,6 +149,7 @@ public: /// mut - The associated thread mutator MutatorThread* mut; + /// vm - The associated virtual machine VirtualMachine* vm; VMThreadData(MutatorThread* m, VirtualMachine *v) { @@ -178,6 +179,7 @@ _vmkit = vmk; lastKnownFrame = 0; pendingException = 0; + allVmsData = 0; } /// yield - Yield the processor to another thread. @@ -389,6 +391,15 @@ public: mvm::VMKit* vmkit(); + + /// allVmsData - the array of thread specific data. + /// + VMThreadData** allVmsData; + + /// reallocAllVmsData - realloc the allVmsData from old to n or 0 to n if allVmsData=0 + /// must be protected by rendezvous.threadLock + /// + void reallocAllVmsData(int old, int n); }; #ifndef RUNTIME_DWARF_EXCEPTIONS Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Sat Dec 4 06:46:27 2010 @@ -42,16 +42,17 @@ /// allocator - Bump pointer allocator to allocate permanent memory of VMKit mvm::BumpPtrAllocator& allocator; - VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { - } + VMKit(mvm::BumpPtrAllocator &Alloc); + + SpinLock vmkitLock; /// ------------------------------------------------- /// /// --- vm managment --- /// /// ------------------------------------------------- /// - // locksvms - a lock for vms - mvm::SpinLock lockvms; // vms - the list of vms. Could be directly an array and we could also directly use the vmID as index in this array. - std::vector vms; + // synchronize with vmkitLock + VirtualMachine** vms; + size_t numberOfVms; size_t addVM(VirtualMachine* vm); void removeVM(size_t id); @@ -59,6 +60,13 @@ /// ------------------------------------------------- /// /// --- thread managment --- /// /// ------------------------------------------------- /// + /// oneThread - the linked list of thread. + /// + Thread* oneThread; + + /// numberOfThreads - The number of threads that currently run under this VM. + size_t numberOfThreads; + /// rendezvous - The rendezvous implementation for garbage collection. /// #ifdef WITH_LLVM_GCC @@ -67,6 +75,9 @@ UncooperativeCollectionRV rendezvous; #endif + void addThread(mvm::Thread* th); + void removeThread(mvm::Thread* th); + /// ------------------------------------------------- /// /// --- backtrace related methods --- /// /// ------------------------------------------------- /// Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Sat Dec 4 06:46:27 2010 @@ -1393,6 +1393,17 @@ return tmp; } +void Jnjvm::finalizeObject(mvm::gc* _o) { + JavaObject *obj = (JavaObject*)_o; + + llvm_gcroot(_o, 0); + llvm_gcroot(obj, 0); + + JavaMethod* meth = upcalls->FinalizeObject; + UserClass* cl = JavaObject::getClass(obj)->asClass(); + meth->invokeIntVirtualBuf(this, cl, obj, 0); +} + void Jnjvm::startCollection() { finalizerThread->FinalizationQueueLock.acquire(); referenceThread->ToEnqueueLock.acquire(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Sat Dec 4 06:46:27 2010 @@ -320,6 +320,10 @@ /// asciizToUTF8 - Constructs an UTF8 out of the asciiz. /// ArrayUInt16* asciizToArray(const char* asciiz); + + /// finalizeObject - invoke the finalizer of a java object + /// + void finalizeObject(mvm::gc* obj); /// setFinalizerThread - Set the finalizer thread of this VM. /// Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp Sat Dec 4 06:46:27 2010 @@ -239,12 +239,10 @@ typedef void (*destructor_t)(void*); void invokeFinalizer(mvm::gc* _obj) { - Jnjvm* vm = JavaThread::get()->getJVM(); JavaObject* obj = (JavaObject*)_obj; llvm_gcroot(obj, 0); - JavaMethod* meth = vm->upcalls->FinalizeObject; - UserClass* cl = JavaObject::getClass(obj)->asClass(); - meth->invokeIntVirtualBuf(vm, cl, obj, 0); + Jnjvm* vm = (Jnjvm*)obj->getVirtualTable()->vm; //JavaThread::get()->getJVM(); + vm->finalizeObject(obj); } void invokeFinalize(mvm::gc* res) { @@ -276,6 +274,7 @@ if (!res) break; mvm::VirtualTable* VT = res->getVirtualTable(); + ASSERT(VT->vm); if (VT->operatorDelete) { destructor_t dest = (destructor_t)VT->destructor; dest(res); Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Sat Dec 4 06:46:27 2010 @@ -18,30 +18,12 @@ using namespace mvm; -void CollectionRV::addThread(mvm::Thread* th) { - threadLock.lock(); - numberOfThreads++; - if (th != oneThread) { - if (oneThread) th->append(oneThread); - else oneThread = th; - } - threadLock.unlock(); -} - -void CollectionRV::removeThread(mvm::Thread* th) { - threadLock.lock(); - numberOfThreads--; - if (oneThread == th) oneThread = (Thread*)th->next(); - th->remove(); - if (!numberOfThreads) oneThread = 0; - threadLock.unlock(); -} - void CollectionRV::another_mark() { + VMKit *vmkit = mvm::Thread::get()->vmkit(); assert(th->getLastSP() != NULL); - assert(nbJoined < th->MyVM->NumberOfThreads); + assert(nbJoined < vmkit->NumberOfThreads); nbJoined++; - if (nbJoined == numberOfThreads) { + if (nbJoined == vmkit->numberOfThreads) { condInitiator.broadcast(); } } @@ -59,7 +41,7 @@ // Add myself. nbJoined++; - while (nbJoined != numberOfThreads) { + while (nbJoined != mvm::Thread::get()->vmkit()->numberOfThreads) { condInitiator.wait(&_lockRV); } } @@ -69,7 +51,7 @@ mvm::Thread* self = mvm::Thread::get(); // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. - threadLock.lock(); + self->vmkit()->vmkitLock.lock(); mvm::Thread* cur = self; do { @@ -111,7 +93,7 @@ mvm::Thread* self = mvm::Thread::get(); // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. - threadLock.lock(); + self->vmkit()->vmkitLock.lock(); for (mvm::Thread* cur = (mvm::Thread*)self->next(); cur != self; cur = (mvm::Thread*)cur->next()) { @@ -223,7 +205,7 @@ assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); nbJoined = 0; - threadLock.unlock(); + initiator->vmkit()->vmkitLock.unlock(); condEndRV.broadcast(); unlockRV(); initiator->inRV = false; @@ -236,9 +218,9 @@ void UncooperativeCollectionRV::finishRV() { lockRV(); mvm::Thread* initiator = mvm::Thread::get(); - assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); + assert(nbJoined == initiator->vmkit()->NumberOfThreads && "Inconsistent state"); nbJoined = 0; - threadLock.unlock(); + initiator->vmkit()->vmkitLock.unlock(); condEndRV.broadcast(); unlockRV(); initiator->inRV = false; Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Sat Dec 4 06:46:27 2010 @@ -31,6 +31,18 @@ using namespace mvm; +// must be protected by rendezvous.threadLock +void Thread::reallocAllVmsData(int old, int n) { + VMThreadData **newData = new VMThreadData*[n]; + if(old) { + memcpy(newData, allVmsData, old*sizeof(VMThreadData*)); + VMThreadData **oldData = allVmsData; + allVmsData = newData; + delete oldData; + } else + allVmsData = newData; +} + mvm::VMKit* Thread::vmkit() { return vmData->vm->vmkit; } @@ -435,7 +447,7 @@ #endif th->vmkit()->rendezvous.prepareForJoin(); th->routine(th); - th->vmkit()->rendezvous.removeThread(th); + th->vmkit()->removeThread(th); } @@ -450,7 +462,7 @@ routine = fct; // Make sure to add it in the list of threads before leaving this function: // the garbage collector wants to trace this thread. - vmkit()->rendezvous.addThread(this); + vmkit()->addThread(this); int res = pthread_create((pthread_t*)(void*)(&internalThreadID), &attributs, (void* (*)(void *))internalThreadStart, this); pthread_detach((pthread_t)internalThreadID); Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll Sat Dec 4 06:46:27 2010 @@ -22,7 +22,8 @@ ;;; field 12: void* vmData ;;; field 13: gc* pendingException ;;; field 14: VMkit* vmkit -%Thread = type { %CircularBase, i32, i8*, i8*, i1, i1, i1, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8* } +;;; field 15: void* allVMDatas +%Thread = type { %CircularBase, i32, i8*, i8*, i1, i1, i1, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8* } ;;; field 0: VT ;;; field 1: mvm::MutatorThread* mut Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Sat Dec 4 06:46:27 2010 @@ -3,19 +3,66 @@ using namespace mvm; +VMKit::VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { + vms = 0; + numberOfVms = 0; +} + size_t VMKit::addVM(VirtualMachine* vm) { - lockvms.lock(); - for(size_t i=0; ireallocAllVmsData(res, numberOfVms); + cur = (Thread*)cur->next(); + } while(cur!=oneThread); + } + + vmkitLock.unlock(); + return res; } void VMKit::removeVM(size_t id) { vms[id] = 0; } + +void VMKit::addThread(mvm::Thread* th) { + vmkitLock.lock(); + numberOfThreads++; + if (th != oneThread) { + if (oneThread) th->append(oneThread); + else oneThread = th; + } + th->reallocAllVmsData(0, numberOfVms); + vmkitLock.unlock(); +} + +void VMKit::removeThread(mvm::Thread* th) { + vmkitLock.lock(); + numberOfThreads--; + if (oneThread == th) oneThread = (Thread*)th->next(); + th->remove(); + if (!numberOfThreads) oneThread = 0; + delete th->allVmsData; + th->allVmsData = 0; + vmkitLock.unlock(); +} Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp?rev=120906&r1=120905&r2=120906&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp Sat Dec 4 06:46:27 2010 @@ -19,8 +19,8 @@ assert(A && "No active plan"); if (A->current == NULL) { - A->current = (mvm::MutatorThread*)mvm::Thread::get()->vmkit()->rendezvous.oneThread; - } else if (A->current->next() == mvm::Thread::get()->vmkit()->rendezvous.oneThread) { + A->current = (mvm::MutatorThread*)mvm::Thread::get()->vmkit()->oneThread; + } else if (A->current->next() == mvm::Thread::get()->vmkit()->oneThread) { A->current = NULL; return NULL; } else { From gael.thomas at lip6.fr Sun Dec 5 05:49:38 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 05 Dec 2010 13:49:38 -0000 Subject: [vmkit-commits] [vmkit] r120937 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h lib/Mvm/Runtime/VMKit.cpp Message-ID: <20101205134938.46DCD2A6C12C@llvm.org> Author: gthomas Date: Sun Dec 5 07:49:38 2010 New Revision: 120937 URL: http://llvm.org/viewvc/llvm-project?rev=120937&view=rev Log: define CircularBase as a template to avoid the cast from CircularBase to Thread Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120937&r1=120936&r2=120937&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Sun Dec 5 07:49:38 2010 @@ -44,68 +44,56 @@ /// this class automatically place their instances in a circular list. /// // WARNING: if you modify this class, you must also change mvm-runtime.ll +template class CircularBase { /// _next - The next object in the list. /// - CircularBase *_next; + T *_next; /// _prev - The previous object in the list. /// - CircularBase *_prev; + T *_prev; public: - /// ~CircularBase - Give the class a home. /// virtual ~CircularBase() {} /// next - Get the next object in the list. /// - inline CircularBase *next() { return _next; } + inline T *next() { return _next; } /// prev - Get the previous object in the list. /// - inline CircularBase *prev() { return _prev; } - - /// next - Set the next object in the list. - /// - inline void next(CircularBase *n) { _next = n; } - - /// prev - Set the previous object in the list. - /// - inline void prev(CircularBase *p) { _prev = p; } + inline T *prev() { return _prev; } /// CricularBase - Creates the object as a single element in the list. /// - inline CircularBase() { alone(); } + inline CircularBase() { _prev = _next = (T*)this; } /// CircularBase - Creates the object and place it in the given list. /// - inline explicit CircularBase(CircularBase *p) { append(p); } + inline explicit CircularBase(T *p) { appendTo(p); } /// remove - Remove the object from its list. /// inline void remove() { _prev->_next = _next; _next->_prev = _prev; - alone(); + _prev = _next = (T*)this; } /// append - Add the object in the list. /// - inline void append(CircularBase *p) { + inline void appendTo(T *p) { _prev = p; _next = p->_next; - _next->_prev = this; - _prev->_next = this; + _next->_prev = (T*)this; + _prev->_next = (T*)this; } - /// alone - Set the object as being part of a new empty list. - /// - inline void alone() { _prev = _next = this; } - /// print - Print the list for debug purposes. void print() { - CircularBase* temp = this; + T* temp = (T*)this; do { fprintf(stderr, "%p -> ", (void*)temp); temp = temp->next(); @@ -168,7 +156,7 @@ /// It provides static functions to manage threads. An instance of this class /// contains all thread-specific informations. // WARNING: if you modify this class, you must also change mvm-runtime.ll -class Thread : public CircularBase { +class Thread : public CircularBase { public: Thread(VMKit* vmk) { #ifdef RUNTIME_DWARF_EXCEPTIONS Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120937&r1=120936&r2=120937&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Sun Dec 5 07:49:38 2010 @@ -49,7 +49,7 @@ vmkitLock.lock(); numberOfThreads++; if (th != oneThread) { - if (oneThread) th->append(oneThread); + if (oneThread) th->appendTo(oneThread); else oneThread = th; } th->reallocAllVmsData(0, numberOfVms); From gael.thomas at lip6.fr Sun Dec 5 05:56:37 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 05 Dec 2010 13:56:37 -0000 Subject: [vmkit-commits] [vmkit] r120938 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/Runtime/VMKit.cpp mmtk/mmtk-j3/ActivePlan.cpp mmtk/mmtk-j3/Scanning.cpp Message-ID: <20101205135638.0605F2A6C12C@llvm.org> Author: gthomas Date: Sun Dec 5 07:56:37 2010 New Revision: 120938 URL: http://llvm.org/viewvc/llvm-project?rev=120938&view=rev Log: rename temporarly CircularBase.next() in next0 and remove useless casts Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120938&r1=120937&r2=120938&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Sun Dec 5 07:56:37 2010 @@ -60,11 +60,11 @@ /// next - Get the next object in the list. /// - inline T *next() { return _next; } + inline T *next0() { return _next; } /// prev - Get the previous object in the list. /// - inline T *prev() { return _prev; } + inline T *prev0() { return _prev; } /// CricularBase - Creates the object as a single element in the list. /// @@ -96,7 +96,7 @@ T* temp = (T*)this; do { fprintf(stderr, "%p -> ", (void*)temp); - temp = temp->next(); + temp = temp->next0(); } while (temp != this); fprintf(stderr, "\n"); } Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120938&r1=120937&r2=120938&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Sun Dec 5 07:56:37 2010 @@ -58,15 +58,15 @@ assert(!cur->doYield); cur->doYield = true; assert(!cur->joinedRV); - cur = (mvm::Thread*)cur->next(); + cur = cur->next0(); } while (cur != self); // The CAS is not necessary but it does a memory barrier. __sync_bool_compare_and_swap(&(self->joinedRV), false, true); // Lookup currently blocked threads. - for (cur = (mvm::Thread*)self->next(); cur != self; - cur = (mvm::Thread*)cur->next()) { + for (cur = self->next0(); cur != self; + cur = cur->next0()) { if (cur->getLastSP()) { nbJoined++; cur->joinedRV = true; @@ -95,8 +95,8 @@ // be released on finishRV. self->vmkit()->vmkitLock.lock(); - for (mvm::Thread* cur = (mvm::Thread*)self->next(); cur != self; - cur = (mvm::Thread*)cur->next()) { + for (mvm::Thread* cur = self->next0(); cur != self; + cur = cur->next0()) { int res = cur->kill(SIGGC); assert(!res && "Error on kill"); } @@ -200,7 +200,7 @@ assert(cur->joinedRV && "Inconsistent state"); cur->doYield = false; cur->joinedRV = false; - cur = (mvm::Thread*)cur->next(); + cur = cur->next0(); } while (cur != initiator); assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120938&r1=120937&r2=120938&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Sun Dec 5 07:56:37 2010 @@ -32,7 +32,7 @@ if(cur) { do { cur->reallocAllVmsData(res, numberOfVms); - cur = (Thread*)cur->next(); + cur = cur->next0(); } while(cur!=oneThread); } @@ -59,7 +59,7 @@ void VMKit::removeThread(mvm::Thread* th) { vmkitLock.lock(); numberOfThreads--; - if (oneThread == th) oneThread = (Thread*)th->next(); + if (oneThread == th) oneThread = th->next0(); th->remove(); if (!numberOfThreads) oneThread = 0; delete th->allVmsData; Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp?rev=120938&r1=120937&r2=120938&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp Sun Dec 5 07:56:37 2010 @@ -20,11 +20,11 @@ if (A->current == NULL) { A->current = (mvm::MutatorThread*)mvm::Thread::get()->vmkit()->oneThread; - } else if (A->current->next() == mvm::Thread::get()->vmkit()->oneThread) { + } else if (A->current->next0() == mvm::Thread::get()->vmkit()->oneThread) { A->current = NULL; return NULL; } else { - A->current = (mvm::MutatorThread*)A->current->next(); + A->current = (mvm::MutatorThread*)A->current->next0(); } if (A->current->MutatorContext == 0) { Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp?rev=120938&r1=120937&r2=120938&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp Sun Dec 5 07:56:37 2010 @@ -22,7 +22,7 @@ do { tcur->scanStack(reinterpret_cast(TL)); - tcur = (mvm::Thread*)tcur->next(); + tcur = tcur->next0(); } while (tcur != th); } @@ -34,7 +34,7 @@ do { tcur->tracer(reinterpret_cast(TL)); - tcur = (mvm::Thread*)tcur->next(); + tcur = tcur->next0(); } while (tcur != th); } From gael.thomas at lip6.fr Sun Dec 5 07:18:00 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 05 Dec 2010 15:18:00 -0000 Subject: [vmkit-commits] [vmkit] r120939 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h include/mvm/VMKit.h lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/Runtime/VMKit.cpp mmtk/mmtk-j3/ActivePlan.cpp mmtk/mmtk-j3/Scanning.cpp Message-ID: <20101205151800.62BD92A6C12C@llvm.org> Author: gthomas Date: Sun Dec 5 09:18:00 2010 New Revision: 120939 URL: http://llvm.org/viewvc/llvm-project?rev=120939&view=rev Log: Rename oneThread in runningThreads. Now runningThreads is a fake node of the double list, implies that we don't have to worry about the first node. Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120939&r1=120938&r2=120939&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Sun Dec 5 09:18:00 2010 @@ -60,11 +60,11 @@ /// next - Get the next object in the list. /// - inline T *next0() { return _next; } + inline T *next() { return _next; } /// prev - Get the previous object in the list. /// - inline T *prev0() { return _prev; } + inline T *prev() { return _prev; } /// CricularBase - Creates the object as a single element in the list. /// @@ -72,7 +72,7 @@ /// CircularBase - Creates the object and place it in the given list. /// - inline explicit CircularBase(T *p) { appendTo(p); } + inline explicit CircularBase(CircularBase *p) { appendTo(p); } /// remove - Remove the object from its list. /// @@ -84,8 +84,8 @@ /// append - Add the object in the list. /// - inline void appendTo(T *p) { - _prev = p; + inline void appendTo(CircularBase *p) { + _prev = (T*)p; _next = p->_next; _next->_prev = (T*)this; _prev->_next = (T*)this; Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=120939&r1=120938&r2=120939&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Sun Dec 5 09:18:00 2010 @@ -60,12 +60,12 @@ /// ------------------------------------------------- /// /// --- thread managment --- /// /// ------------------------------------------------- /// - /// oneThread - the linked list of thread. + /// runningThreads - the list of running threads /// - Thread* oneThread; + CircularBase runningThreads; - /// numberOfThreads - The number of threads that currently run under this VM. - size_t numberOfThreads; + /// numberOfRunningThreads - The number of threads that currently run under this VM. + size_t numberOfRunningThreads; /// rendezvous - The rendezvous implementation for garbage collection. /// Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120939&r1=120938&r2=120939&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Sun Dec 5 09:18:00 2010 @@ -23,7 +23,7 @@ assert(th->getLastSP() != NULL); assert(nbJoined < vmkit->NumberOfThreads); nbJoined++; - if (nbJoined == vmkit->numberOfThreads) { + if (nbJoined == vmkit->numberOfRunningThreads) { condInitiator.broadcast(); } } @@ -41,7 +41,7 @@ // Add myself. nbJoined++; - while (nbJoined != mvm::Thread::get()->vmkit()->numberOfThreads) { + while (nbJoined != mvm::Thread::get()->vmkit()->numberOfRunningThreads) { condInitiator.wait(&_lockRV); } } @@ -49,30 +49,29 @@ void CooperativeCollectionRV::synchronize() { assert(nbJoined == 0); mvm::Thread* self = mvm::Thread::get(); + mvm::VMKit* vmkit = self->vmkit(); + // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. - self->vmkit()->vmkitLock.lock(); + vmkit->vmkitLock.lock(); - mvm::Thread* cur = self; - do { + for(Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) { assert(!cur->doYield); cur->doYield = true; assert(!cur->joinedRV); - cur = cur->next0(); - } while (cur != self); - + } + // The CAS is not necessary but it does a memory barrier. __sync_bool_compare_and_swap(&(self->joinedRV), false, true); // Lookup currently blocked threads. - for (cur = self->next0(); cur != self; - cur = cur->next0()) { - if (cur->getLastSP()) { + for(Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) { + if(cur->getLastSP() && cur != self) { nbJoined++; cur->joinedRV = true; } } - + // And wait for other threads to finish. waitRV(); @@ -91,15 +90,18 @@ void UncooperativeCollectionRV::synchronize() { assert(nbJoined == 0); mvm::Thread* self = mvm::Thread::get(); + mvm::VMKit* vmkit = self->vmkit(); + // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. self->vmkit()->vmkitLock.lock(); - - for (mvm::Thread* cur = self->next0(); cur != self; - cur = cur->next0()) { - int res = cur->kill(SIGGC); - assert(!res && "Error on kill"); - } + + for(Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) { + if(cur!=self) { + int res = cur->kill(SIGGC); + assert(!res && "Error on kill"); + } + } // And wait for other threads to finish. waitRV(); @@ -194,15 +196,15 @@ lockRV(); mvm::Thread* initiator = mvm::Thread::get(); - mvm::Thread* cur = initiator; - do { + mvm::VMKit* vmkit = initiator->vmkit(); + + for(mvm::Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) { assert(cur->doYield && "Inconsistent state"); assert(cur->joinedRV && "Inconsistent state"); cur->doYield = false; cur->joinedRV = false; - cur = cur->next0(); - } while (cur != initiator); - + } + assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); nbJoined = 0; initiator->vmkit()->vmkitLock.unlock(); Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120939&r1=120938&r2=120939&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Sun Dec 5 09:18:00 2010 @@ -28,12 +28,8 @@ delete[] oldVms; // reallocate the allVMDatas - Thread* cur=oneThread; - if(cur) { - do { - cur->reallocAllVmsData(res, numberOfVms); - cur = cur->next0(); - } while(cur!=oneThread); + for(Thread* cur=runningThreads.next(); cur!=&runningThreads; cur=cur->next()) { + cur->reallocAllVmsData(res, numberOfVms); } vmkitLock.unlock(); @@ -47,22 +43,16 @@ void VMKit::addThread(mvm::Thread* th) { vmkitLock.lock(); - numberOfThreads++; - if (th != oneThread) { - if (oneThread) th->appendTo(oneThread); - else oneThread = th; - } + numberOfRunningThreads++; + th->appendTo(&runningThreads); th->reallocAllVmsData(0, numberOfVms); vmkitLock.unlock(); } void VMKit::removeThread(mvm::Thread* th) { vmkitLock.lock(); - numberOfThreads--; - if (oneThread == th) oneThread = th->next0(); + numberOfRunningThreads--; th->remove(); - if (!numberOfThreads) oneThread = 0; - delete th->allVmsData; th->allVmsData = 0; vmkitLock.unlock(); } Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp?rev=120939&r1=120938&r2=120939&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp Sun Dec 5 09:18:00 2010 @@ -17,15 +17,20 @@ extern "C" MMTkObject* Java_org_j3_mmtk_ActivePlan_getNextMutator__(MMTkActivePlan* A) { assert(A && "No active plan"); - - if (A->current == NULL) { - A->current = (mvm::MutatorThread*)mvm::Thread::get()->vmkit()->oneThread; - } else if (A->current->next0() == mvm::Thread::get()->vmkit()->oneThread) { - A->current = NULL; - return NULL; - } else { - A->current = (mvm::MutatorThread*)A->current->next0(); - } + + mvm::CircularBase* mut = A->current; + + if(!mut) + mut = &mvm::Thread::get()->vmkit()->runningThreads; + + mut = mut->next(); + + if(mut == &mvm::Thread::get()->vmkit()->runningThreads) { + A->current = NULL; + return NULL; + } + + A->current = (mvm::MutatorThread*)mut; if (A->current->MutatorContext == 0) { return Java_org_j3_mmtk_ActivePlan_getNextMutator__(A); Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp?rev=120939&r1=120938&r2=120939&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp Sun Dec 5 09:18:00 2010 @@ -11,31 +11,30 @@ #include "mvm/VirtualMachine.h" #include "MMTkObject.h" #include "mvm/GC.h" +#include "mvm/VMKit.h" namespace mmtk { extern "C" void Java_org_j3_mmtk_Scanning_computeThreadRoots__Lorg_mmtk_plan_TraceLocal_2 (MMTkObject* Scanning, MMTkObject* TL) { // When entering this function, all threads are waiting on the rendezvous to // finish. - mvm::Thread* th = mvm::Thread::get(); - mvm::Thread* tcur = th; + mvm::VMKit* vmkit = mvm::Thread::get()->vmkit(); + mvm::Thread* tcur; - do { + for(tcur=vmkit->runningThreads.next(); tcur!=&vmkit->runningThreads; tcur=tcur->next()) { tcur->scanStack(reinterpret_cast(TL)); - tcur = tcur->next0(); - } while (tcur != th); + } } extern "C" void Java_org_j3_mmtk_Scanning_computeGlobalRoots__Lorg_mmtk_plan_TraceLocal_2 (MMTkObject* Scanning, MMTkObject* TL) { mvm::Thread::get()->MyVM->tracer(reinterpret_cast(TL)); + + mvm::VMKit* vmkit = mvm::Thread::get()->vmkit(); + mvm::Thread* tcur; - mvm::Thread* th = mvm::Thread::get(); - mvm::Thread* tcur = th; - - do { + for(tcur=vmkit->runningThreads.next(); tcur!=&vmkit->runningThreads; tcur=tcur->next()) { tcur->tracer(reinterpret_cast(TL)); - tcur = tcur->next0(); - } while (tcur != th); + } } extern "C" void Java_org_j3_mmtk_Scanning_computeStaticRoots__Lorg_mmtk_plan_TraceLocal_2 (MMTkObject* Scanning, MMTkObject* TL) { From gael.thomas at lip6.fr Sun Dec 5 07:33:19 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 05 Dec 2010 15:33:19 -0000 Subject: [vmkit-commits] [vmkit] r120940 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h include/mvm/VMKit.h lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Runtime/VMKit.cpp Message-ID: <20101205153319.805972A6C12C@llvm.org> Author: gthomas Date: Sun Dec 5 09:33:19 2010 New Revision: 120940 URL: http://llvm.org/viewvc/llvm-project?rev=120940&view=rev Log: add a new state for threads: prepared. When a thread is prepared, vmkit realloc its allVmsData but it does not consider it for rendezvous Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120940&r1=120939&r2=120940&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Sun Dec 5 09:33:19 2010 @@ -157,18 +157,11 @@ /// contains all thread-specific informations. // WARNING: if you modify this class, you must also change mvm-runtime.ll class Thread : public CircularBase { +protected: + Thread(VMKit* vmk); + public: - Thread(VMKit* vmk) { -#ifdef RUNTIME_DWARF_EXCEPTIONS - internalPendingException = 0; -#else - lastExceptionBuffer = 0; -#endif - _vmkit = vmk; - lastKnownFrame = 0; - pendingException = 0; - allVmsData = 0; - } + ~Thread(); /// yield - Yield the processor to another thread. /// Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=120940&r1=120939&r2=120940&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Sun Dec 5 09:33:19 2010 @@ -60,6 +60,10 @@ /// ------------------------------------------------- /// /// --- thread managment --- /// /// ------------------------------------------------- /// + /// preparedThreads - the list of prepared threads, they are not yet running. + /// + CircularBase preparedThreads; + /// runningThreads - the list of running threads /// CircularBase runningThreads; @@ -75,8 +79,11 @@ UncooperativeCollectionRV rendezvous; #endif - void addThread(mvm::Thread* th); - void removeThread(mvm::Thread* th); + void registerPreparedThread(mvm::Thread* th); + void unregisterPreparedThread(mvm::Thread* th); + + void registerRunningThread(mvm::Thread* th); + void unregisterRunningThread(mvm::Thread* th); /// ------------------------------------------------- /// /// --- backtrace related methods --- /// Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120940&r1=120939&r2=120940&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Sun Dec 5 09:33:19 2010 @@ -31,6 +31,23 @@ using namespace mvm; +Thread::Thread(VMKit* vmk) { +#ifdef RUNTIME_DWARF_EXCEPTIONS + internalPendingException = 0; +#else + lastExceptionBuffer = 0; +#endif + _vmkit = vmk; + lastKnownFrame = 0; + pendingException = 0; + allVmsData = 0; + vmk->registerPreparedThread(this); +} + +Thread::~Thread() { + vmkit()->unregisterPreparedThread(this); +} + // must be protected by rendezvous.threadLock void Thread::reallocAllVmsData(int old, int n) { VMThreadData **newData = new VMThreadData*[n]; @@ -447,7 +464,7 @@ #endif th->vmkit()->rendezvous.prepareForJoin(); th->routine(th); - th->vmkit()->removeThread(th); + th->vmkit()->unregisterRunningThread(th); } @@ -462,7 +479,7 @@ routine = fct; // Make sure to add it in the list of threads before leaving this function: // the garbage collector wants to trace this thread. - vmkit()->addThread(this); + vmkit()->registerRunningThread(this); int res = pthread_create((pthread_t*)(void*)(&internalThreadID), &attributs, (void* (*)(void *))internalThreadStart, this); pthread_detach((pthread_t)internalThreadID); Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120940&r1=120939&r2=120940&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Sun Dec 5 09:33:19 2010 @@ -28,6 +28,10 @@ delete[] oldVms; // reallocate the allVMDatas + for(Thread* cur=preparedThreads.next(); cur!=&preparedThreads; cur=cur->next()) { + cur->reallocAllVmsData(res, numberOfVms); + } + for(Thread* cur=runningThreads.next(); cur!=&runningThreads; cur=cur->next()) { cur->reallocAllVmsData(res, numberOfVms); } @@ -38,21 +42,37 @@ } void VMKit::removeVM(size_t id) { + // what can I do with the VMThreadData? vms[id] = 0; } -void VMKit::addThread(mvm::Thread* th) { +void VMKit::registerPreparedThread(mvm::Thread* th) { + vmkitLock.lock(); + th->appendTo(&preparedThreads); + th->reallocAllVmsData(0, numberOfVms); + vmkitLock.unlock(); +} + +void VMKit::unregisterPreparedThread(mvm::Thread* th) { + vmkitLock.lock(); + numberOfRunningThreads--; + th->remove(); + delete th->allVmsData; + vmkitLock.unlock(); +} + +void VMKit::registerRunningThread(mvm::Thread* th) { vmkitLock.lock(); numberOfRunningThreads++; + th->remove(); th->appendTo(&runningThreads); - th->reallocAllVmsData(0, numberOfVms); vmkitLock.unlock(); } -void VMKit::removeThread(mvm::Thread* th) { +void VMKit::unregisterRunningThread(mvm::Thread* th) { vmkitLock.lock(); numberOfRunningThreads--; th->remove(); - th->allVmsData = 0; + th->appendTo(&preparedThreads); vmkitLock.unlock(); } From gael.thomas at lip6.fr Sun Dec 5 07:45:20 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 05 Dec 2010 15:45:20 -0000 Subject: [vmkit-commits] [vmkit] r120941 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h lib/J3/VMCore/JavaThread.cpp lib/J3/VMCore/JavaThread.h lib/J3/VMCore/Jnjvm.cpp lib/Mvm/CommonThread/VMThreadData.cpp lib/Mvm/CommonThread/ctthread.cpp Message-ID: <20101205154520.8C5062A6C12C@llvm.org> Author: gthomas Date: Sun Dec 5 09:45:20 2010 New Revision: 120941 URL: http://llvm.org/viewvc/llvm-project?rev=120941&view=rev Log: attach a vm specific data by changing the active vm Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/VMThreadData.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120941&r1=120940&r2=120941&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Sun Dec 5 09:45:20 2010 @@ -129,26 +129,25 @@ class ExceptionBuffer; -class MutatorThread; +class Thread; class VMKit; // WARNING: if you modify this class, you must also change mvm-runtime.ll class VMThreadData { public: /// mut - The associated thread mutator - MutatorThread* mut; + Thread* mut; + /// vm - The associated virtual machine VirtualMachine* vm; - VMThreadData(MutatorThread* m, VirtualMachine *v) { + VMThreadData(VirtualMachine *v, Thread* m) { this->mut = m; this->vm = v; } virtual void tracer(uintptr_t closure) = 0; - void attach(); - virtual ~VMThreadData() {} // force the construction of a VT }; @@ -381,6 +380,10 @@ /// must be protected by rendezvous.threadLock /// void reallocAllVmsData(int old, int n); + + /// attach - attach the vm specific data of the given virtual machine + /// + void attach(VirtualMachine* vm); }; #ifndef RUNTIME_DWARF_EXCEPTIONS Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp?rev=120941&r1=120940&r2=120941&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp Sun Dec 5 09:45:20 2010 @@ -19,9 +19,8 @@ using namespace j3; -JavaThread::JavaThread(mvm::MutatorThread* mut, Jnjvm* isolate) - : mvm::VMThreadData(mut, isolate) { - jniEnv = isolate->jniEnv; +JavaThread::JavaThread(Jnjvm* vm, mvm::Thread* mut) : mvm::VMThreadData(vm, mut) { + jniEnv = vm->jniEnv; localJNIRefs = new JNILocalReferences(); currentAddedReferences = NULL; javaThread = NULL; @@ -30,8 +29,8 @@ #ifdef SERVICE eipIndex = 0; replacedEIPs = new void*[100]; - if (isolate->upcalls->newThrowable) { - ServiceException = isolate->upcalls->newThrowable->doNew(isolate); + if (vm->upcalls->newThrowable) { + ServiceException = vm->upcalls->newThrowable->doNew(vm); } #endif } @@ -40,10 +39,11 @@ return (JavaThread*)mut->vmData; } -JavaThread *JavaThread::create(Jnjvm* isolate) { - mvm::MutatorThread *mut = new mvm::MutatorThread(isolate->vmkit); - JavaThread *th = new JavaThread(mut, isolate); - th->attach(); +JavaThread *JavaThread::create(Jnjvm* vm) { + mvm::Thread *mut = new mvm::MutatorThread(vm->vmkit); + JavaThread *th = new JavaThread(vm, mut); + mut->allVmsData[vm->vmID] = th; + mut->attach(vm); return th; } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h?rev=120941&r1=120940&r2=120941&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h Sun Dec 5 09:45:20 2010 @@ -116,11 +116,11 @@ /// JavaThread - Creates a Java thread. /// - JavaThread(mvm::MutatorThread*, Jnjvm* isolate); + JavaThread(Jnjvm* vm, mvm::Thread*mut); /// create - Creates a Java thread and a mutator thread. /// - static JavaThread* create(Jnjvm* isolate); + static JavaThread* create(Jnjvm* vm); /// j3Thread - gives the JavaThread associated with the mutator thread /// Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120941&r1=120940&r2=120941&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Sun Dec 5 09:45:20 2010 @@ -1070,14 +1070,16 @@ // First create system threads. finalizerThread = new FinalizerThread(this); - javaFinalizerThread = new JavaThread(finalizerThread, this); - javaFinalizerThread->attach(); + javaFinalizerThread = new JavaThread(this, finalizerThread); + finalizerThread->allVmsData[vmID] = javaFinalizerThread; + finalizerThread->attach(this); finalizerThread->start( (void (*)(mvm::Thread*))FinalizerThread::finalizerStart); referenceThread = new ReferenceThread(this); - javaReferenceThread = new JavaThread(referenceThread, this); - javaReferenceThread->attach(); + javaReferenceThread = new JavaThread(this, referenceThread); + referenceThread->allVmsData[vmID] = javaReferenceThread; + referenceThread->attach(this); referenceThread->start( (void (*)(mvm::Thread*))ReferenceThread::enqueueStart); Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/VMThreadData.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/VMThreadData.cpp?rev=120941&r1=120940&r2=120941&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/VMThreadData.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/VMThreadData.cpp Sun Dec 5 09:45:20 2010 @@ -2,8 +2,3 @@ #include "MutatorThread.h" using namespace mvm; - -void VMThreadData::attach() { - mut->vmData = this; - mut->MyVM = vm; -} Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120941&r1=120940&r2=120941&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Sun Dec 5 09:45:20 2010 @@ -48,6 +48,16 @@ vmkit()->unregisterPreparedThread(this); } +void Thread::attach(VirtualMachine* vm) { + MyVM = vm; + vmData = allVmsData[vm->vmID]; + + if(!vmData) { + printf("should not happen yet\n"); + abort(); + } +} + // must be protected by rendezvous.threadLock void Thread::reallocAllVmsData(int old, int n) { VMThreadData **newData = new VMThreadData*[n]; From gael.thomas at lip6.fr Sun Dec 5 09:19:46 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 05 Dec 2010 17:19:46 -0000 Subject: [vmkit-commits] [vmkit] r120942 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/VMCore/JnjvmClassLoader.cpp lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Compiler/JIT.cpp mmtk/mmtk-j3/ActivePlan.cpp mmtk/mmtk-j3/Collection.cpp mmtk/mmtk-j3/Scanning.cpp Message-ID: <20101205171946.CEB2C2A6C12C@llvm.org> Author: gthomas Date: Sun Dec 5 11:19:46 2010 New Revision: 120942 URL: http://llvm.org/viewvc/llvm-project?rev=120942&view=rev Log: remove the function vmkit() from Thread, uses directly the field vmkit Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120942&r1=120941&r2=120942&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Sun Dec 5 11:19:46 2010 @@ -364,13 +364,10 @@ /// gc* pendingException; -private: - /// _vmkit - a (shortcut) pointer to vmkit that contains information on all the vms - /// - mvm::VMKit* _vmkit; - public: - mvm::VMKit* vmkit(); + /// vmkit - a (shortcut) pointer to vmkit that contains information on all the vms + /// + mvm::VMKit* vmkit; /// allVmsData - the array of thread specific data. /// Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=120942&r1=120941&r2=120942&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Sun Dec 5 11:19:46 2010 @@ -359,7 +359,7 @@ llvm::GCFunctionInfo* GFI = &(GCInfo->getFunctionInfo(*func)); assert((GFI != NULL) && "No GC information"); - mvm::VMKit* vmkit = mvm::Thread::get()->vmkit(); + mvm::VMKit* vmkit = mvm::Thread::get()->vmkit; mvm::JITMethodInfo* MI = new(allocator, "JavaJITMethodInfo") JavaJITMethodInfo(GFI, meth); MI->addToVMKit(vmkit, (JIT*)executionEngine); @@ -401,7 +401,7 @@ llvm::GCFunctionInfo* GFI = &(GCInfo->getFunctionInfo(*F)); assert((GFI != NULL) && "No GC information"); - mvm::VMKit* vmkit = mvm::Thread::get()->vmkit(); + mvm::VMKit* vmkit = mvm::Thread::get()->vmkit; mvm::JITMethodInfo* MI = new(allocator, "JITMethodInfo") mvm::MvmJITMethodInfo(GFI, F, this); MI->addToVMKit(vmkit, (JIT*)executionEngine); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=120942&r1=120941&r2=120942&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Sun Dec 5 11:19:46 2010 @@ -920,7 +920,7 @@ if (isolate) { isolate->vmkit->removeMethodInfos(TheCompiler); } else { - mvm::Thread::get()->vmkit()->removeMethodInfos(TheCompiler); + mvm::Thread::get()->vmkit->removeMethodInfos(TheCompiler); } if (classes) { Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120942&r1=120941&r2=120942&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Sun Dec 5 11:19:46 2010 @@ -19,7 +19,7 @@ using namespace mvm; void CollectionRV::another_mark() { - VMKit *vmkit = mvm::Thread::get()->vmkit(); + VMKit *vmkit = mvm::Thread::get()->vmkit; assert(th->getLastSP() != NULL); assert(nbJoined < vmkit->NumberOfThreads); nbJoined++; @@ -41,7 +41,7 @@ // Add myself. nbJoined++; - while (nbJoined != mvm::Thread::get()->vmkit()->numberOfRunningThreads) { + while (nbJoined != mvm::Thread::get()->vmkit->numberOfRunningThreads) { condInitiator.wait(&_lockRV); } } @@ -49,7 +49,7 @@ void CooperativeCollectionRV::synchronize() { assert(nbJoined == 0); mvm::Thread* self = mvm::Thread::get(); - mvm::VMKit* vmkit = self->vmkit(); + mvm::VMKit* vmkit = self->vmkit; // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. @@ -90,11 +90,11 @@ void UncooperativeCollectionRV::synchronize() { assert(nbJoined == 0); mvm::Thread* self = mvm::Thread::get(); - mvm::VMKit* vmkit = self->vmkit(); + mvm::VMKit* vmkit = self->vmkit; // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. - self->vmkit()->vmkitLock.lock(); + self->vmkit->vmkitLock.lock(); for(Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) { if(cur!=self) { @@ -189,14 +189,14 @@ extern "C" void conditionalSafePoint() { mvm::Thread* th = mvm::Thread::get(); - th->vmkit()->rendezvous.join(); + th->vmkit->rendezvous.join(); } void CooperativeCollectionRV::finishRV() { lockRV(); mvm::Thread* initiator = mvm::Thread::get(); - mvm::VMKit* vmkit = initiator->vmkit(); + mvm::VMKit* vmkit = initiator->vmkit; for(mvm::Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) { assert(cur->doYield && "Inconsistent state"); @@ -207,7 +207,7 @@ assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); nbJoined = 0; - initiator->vmkit()->vmkitLock.unlock(); + initiator->vmkit->vmkitLock.unlock(); condEndRV.broadcast(); unlockRV(); initiator->inRV = false; @@ -220,9 +220,9 @@ void UncooperativeCollectionRV::finishRV() { lockRV(); mvm::Thread* initiator = mvm::Thread::get(); - assert(nbJoined == initiator->vmkit()->NumberOfThreads && "Inconsistent state"); + assert(nbJoined == initiator->vmkit->NumberOfThreads && "Inconsistent state"); nbJoined = 0; - initiator->vmkit()->vmkitLock.unlock(); + initiator->vmkit->vmkitLock.unlock(); condEndRV.broadcast(); unlockRV(); initiator->inRV = false; @@ -238,7 +238,7 @@ static void siggcHandler(int) { mvm::Thread* th = mvm::Thread::get(); - th->vmkit()->rendezvous.join(); + th->vmkit->rendezvous.join(); } void UncooperativeCollectionRV::prepareForJoin() { Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120942&r1=120941&r2=120942&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Sun Dec 5 11:19:46 2010 @@ -37,7 +37,7 @@ #else lastExceptionBuffer = 0; #endif - _vmkit = vmk; + vmkit = vmk; lastKnownFrame = 0; pendingException = 0; allVmsData = 0; @@ -45,7 +45,7 @@ } Thread::~Thread() { - vmkit()->unregisterPreparedThread(this); + vmkit->unregisterPreparedThread(this); } void Thread::attach(VirtualMachine* vm) { @@ -70,10 +70,6 @@ allVmsData = newData; } -mvm::VMKit* Thread::vmkit() { - return vmData->vm->vmkit; -} - void Thread::tracer(uintptr_t closure) { mvm::Collector::markAndTraceRoot(&pendingException, closure); vmData->tracer(closure); @@ -95,18 +91,18 @@ Thread* th = mvm::Thread::get(); if (th->isMvmThread()) { if (th->doYield && !th->inRV) { - th->vmkit()->rendezvous.join(); + th->vmkit->rendezvous.join(); } } sched_yield(); } void Thread::joinRVBeforeEnter() { - vmkit()->rendezvous.joinBeforeUncooperative(); + vmkit->rendezvous.joinBeforeUncooperative(); } void Thread::joinRVAfterLeave(void* savedSP) { - vmkit()->rendezvous.joinAfterUncooperative(savedSP); + vmkit->rendezvous.joinAfterUncooperative(savedSP); } void Thread::startKnownFrame(KnownFrame& F) { @@ -220,7 +216,7 @@ ip = FRAME_IP(addr); bool isStub = ((unsigned char*)ip)[0] == 0xCE; if (isStub) ip = addr[2]; - return thread->vmkit()->IPToMethodInfo(ip); + return thread->vmkit->IPToMethodInfo(ip); } void* StackWalker::operator*() { @@ -472,9 +468,9 @@ #ifdef ISOLATE th->IsolateID = th->MyVM->IsolateID; #endif - th->vmkit()->rendezvous.prepareForJoin(); + th->vmkit->rendezvous.prepareForJoin(); th->routine(th); - th->vmkit()->unregisterRunningThread(th); + th->vmkit->unregisterRunningThread(th); } @@ -489,7 +485,7 @@ routine = fct; // Make sure to add it in the list of threads before leaving this function: // the garbage collector wants to trace this thread. - vmkit()->registerRunningThread(this); + vmkit->registerRunningThread(this); int res = pthread_create((pthread_t*)(void*)(&internalThreadID), &attributs, (void* (*)(void *))internalThreadStart, this); pthread_detach((pthread_t)internalThreadID); Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp?rev=120942&r1=120941&r2=120942&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp Sun Dec 5 11:19:46 2010 @@ -100,7 +100,7 @@ llvm::GCFunctionInfo* GFI = *I; JITMethodInfo* MI = new(*MvmModule::Allocator, "MvmJITMethodInfo") MvmJITMethodInfo(GFI, &F, MvmModule::executionEngine); - MI->addToVMKit(mvm::Thread::get()->vmkit(), (JIT*)MvmModule::executionEngine); + MI->addToVMKit(mvm::Thread::get()->vmkit, (JIT*)MvmModule::executionEngine); } }; Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp?rev=120942&r1=120941&r2=120942&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp Sun Dec 5 11:19:46 2010 @@ -21,11 +21,11 @@ mvm::CircularBase* mut = A->current; if(!mut) - mut = &mvm::Thread::get()->vmkit()->runningThreads; + mut = &mvm::Thread::get()->vmkit->runningThreads; mut = mut->next(); - if(mut == &mvm::Thread::get()->vmkit()->runningThreads) { + if(mut == &mvm::Thread::get()->vmkit->runningThreads) { A->current = NULL; return NULL; } Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp?rev=120942&r1=120941&r2=120942&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp Sun Dec 5 11:19:46 2010 @@ -36,14 +36,14 @@ mvm::Thread* th = mvm::Thread::get(); // Verify that another collection is not happening. - th->vmkit()->rendezvous.startRV(); + th->vmkit->rendezvous.startRV(); if (th->doYield) { - th->vmkit()->rendezvous.cancelRV(); - th->vmkit()->rendezvous.join(); + th->vmkit->rendezvous.cancelRV(); + th->vmkit->rendezvous.join(); return; } else { th->MyVM->startCollection(); - th->vmkit()->rendezvous.synchronize(); + th->vmkit->rendezvous.synchronize(); JnJVM_org_mmtk_plan_Plan_setCollectionTriggered__(); @@ -73,7 +73,7 @@ elapsedTime / 1000000); } - th->vmkit()->rendezvous.finishRV(); + th->vmkit->rendezvous.finishRV(); th->MyVM->endCollection(); } @@ -82,7 +82,7 @@ extern "C" void Java_org_j3_mmtk_Collection_joinCollection__ (MMTkObject* C) { mvm::Thread* th = mvm::Thread::get(); assert(th->inRV && "Joining collection without a rendezvous"); - th->vmkit()->rendezvous.join(); + th->vmkit->rendezvous.join(); } extern "C" int Java_org_j3_mmtk_Collection_rendezvous__I (MMTkObject* C, int where) { Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp?rev=120942&r1=120941&r2=120942&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp Sun Dec 5 11:19:46 2010 @@ -18,7 +18,7 @@ extern "C" void Java_org_j3_mmtk_Scanning_computeThreadRoots__Lorg_mmtk_plan_TraceLocal_2 (MMTkObject* Scanning, MMTkObject* TL) { // When entering this function, all threads are waiting on the rendezvous to // finish. - mvm::VMKit* vmkit = mvm::Thread::get()->vmkit(); + mvm::VMKit* vmkit = mvm::Thread::get()->vmkit; mvm::Thread* tcur; for(tcur=vmkit->runningThreads.next(); tcur!=&vmkit->runningThreads; tcur=tcur->next()) { @@ -29,7 +29,7 @@ extern "C" void Java_org_j3_mmtk_Scanning_computeGlobalRoots__Lorg_mmtk_plan_TraceLocal_2 (MMTkObject* Scanning, MMTkObject* TL) { mvm::Thread::get()->MyVM->tracer(reinterpret_cast(TL)); - mvm::VMKit* vmkit = mvm::Thread::get()->vmkit(); + mvm::VMKit* vmkit = mvm::Thread::get()->vmkit; mvm::Thread* tcur; for(tcur=vmkit->runningThreads.next(); tcur!=&vmkit->runningThreads; tcur=tcur->next()) { From gael.thomas at lip6.fr Sun Dec 5 10:51:31 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 05 Dec 2010 18:51:31 -0000 Subject: [vmkit-commits] [vmkit] r120944 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h include/mvm/VirtualMachine.h lib/J3/Classpath/JavaUpcalls.cpp lib/J3/Classpath/JavaUpcalls.h lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/J3/VMCore/ReferenceQueue.cpp Message-ID: <20101205185132.0FB6C2A6C12C@llvm.org> Author: gthomas Date: Sun Dec 5 12:51:31 2010 New Revision: 120944 URL: http://llvm.org/viewvc/llvm-project?rev=120944&view=rev Log: allocate the vm finalizer thread specific data with a new function buildVMThreadData Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120944&r1=120943&r2=120944&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Sun Dec 5 12:51:31 2010 @@ -146,7 +146,7 @@ this->vm = v; } - virtual void tracer(uintptr_t closure) = 0; + virtual void tracer(uintptr_t closure) {}; virtual ~VMThreadData() {} // force the construction of a VT }; Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=120944&r1=120943&r2=120944&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Sun Dec 5 12:51:31 2010 @@ -46,6 +46,13 @@ size_t vmID; //===----------------------------------------------------------------------===// +// (1) thread-related methods. +//===----------------------------------------------------------------------===// + /// buildVMThreadData - allocate a java thread for the underlying mutator. Called when the java thread is a foreign thread. + /// + virtual VMThreadData* buildVMThreadData(Thread* mut) { return new VMThreadData(this, mut); } + +//===----------------------------------------------------------------------===// // (2) GC-related methods. //===----------------------------------------------------------------------===// Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp?rev=120944&r1=120943&r2=120944&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp Sun Dec 5 12:51:31 2010 @@ -257,6 +257,16 @@ finaliseCreateInitialThread->invokeIntStatic(vm, inheritableThreadLocal, &th); } + +void Classpath::CreateForeignJavaThread(Jnjvm* vm, JavaThread* myth) { + JavaObject* RG = 0; + llvm_gcroot(RG, 0); + + RG = rootGroup->getStaticObjectField(); // should be system group or a special group for foreign threads + CreateJavaThread(vm, myth, "foreign thread", RG); +} + + void Classpath::InitializeThreading(Jnjvm* vm) { JavaObject* RG = 0; @@ -288,10 +298,6 @@ systemName = vm->asciizToStr("system"); groupName->setInstanceObjectField(SystemGroup, systemName); - // Create the finalizer thread. - assert(vm->getFinalizerThread() && "VM did not set its finalizer thread"); - CreateJavaThread(vm, vm->javaFinalizerThread, "Finalizer", SystemGroup); - // Create the enqueue thread. assert(vm->getReferenceThread() && "VM did not set its enqueue thread"); CreateJavaThread(vm, vm->javaReferenceThread, "Reference", SystemGroup); Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.h?rev=120944&r1=120943&r2=120944&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.h (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.h Sun Dec 5 12:51:31 2010 @@ -267,6 +267,8 @@ public: ISOLATE_STATIC void InitializeThreading(Jnjvm* vm); + + ISOLATE_STATIC void CreateForeignJavaThread(Jnjvm* vm, JavaThread* myth); }; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120944&r1=120943&r2=120944&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Sun Dec 5 12:51:31 2010 @@ -1061,6 +1061,14 @@ return appClassLoader; } +mvm::VMThreadData* Jnjvm::buildVMThreadData(mvm::Thread* mut) { + JavaThread* th = new JavaThread(this, finalizerThread); + mut->allVmsData[vmID] = th; // will be done by my caller but I will call java code + mut->vmData = th; // will be done by my caller but I will call java code + bootstrapLoader->upcalls->CreateForeignJavaThread(this, th); + return th; +} + void Jnjvm::loadBootstrap() { JavaObject* obj = NULL; JavaObject* javaLoader = NULL; @@ -1070,11 +1078,7 @@ // First create system threads. finalizerThread = new FinalizerThread(this); - javaFinalizerThread = new JavaThread(this, finalizerThread); - finalizerThread->allVmsData[vmID] = javaFinalizerThread; - finalizerThread->attach(this); - finalizerThread->start( - (void (*)(mvm::Thread*))FinalizerThread::finalizerStart); + finalizerThread->start((void (*)(mvm::Thread*))FinalizerThread::finalizerStart); referenceThread = new ReferenceThread(this); javaReferenceThread = new JavaThread(this, referenceThread); @@ -1119,6 +1123,8 @@ // 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); + + buildVMThreadData(finalizerThread); LOAD_CLASS(upcalls->newClass); LOAD_CLASS(upcalls->newConstructor); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=120944&r1=120943&r2=120944&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Sun Dec 5 12:51:31 2010 @@ -253,9 +253,6 @@ /// javaMainThread - the java main thread JavaThread* javaMainThread; - /// javaFinalizerThread - the java finalizer thread - JavaThread* javaFinalizerThread; - /// javaReferenceThread - the java reference thread JavaThread* javaReferenceThread; @@ -368,6 +365,10 @@ /// virtual void waitForExit(); + /// buildVMThreadData - allocate a java thread for the underlying mutator. Called when the java thread is a foreign thread. + /// + virtual mvm::VMThreadData* buildVMThreadData(mvm::Thread* mut); + /// loadBootstrap - Bootstraps the JVM, getting the class loader, initializing /// bootstrap classes (e.g. java/lang/Class, java/lang/Exception) and /// mapping the initial thread. Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp?rev=120944&r1=120943&r2=120944&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp Sun Dec 5 12:51:31 2010 @@ -242,6 +242,7 @@ JavaObject* obj = (JavaObject*)_obj; llvm_gcroot(obj, 0); Jnjvm* vm = (Jnjvm*)obj->getVirtualTable()->vm; //JavaThread::get()->getJVM(); + mvm::Thread::get()->attach(vm); vm->finalizeObject(obj); } From gael.thomas at lip6.fr Sun Dec 5 13:37:57 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 05 Dec 2010 21:37:57 -0000 Subject: [vmkit-commits] [vmkit] r120958 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h lib/J3/VMCore/Jnjvm.cpp lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Runtime/VMKit.cpp Message-ID: <20101205213757.568662A6C12C@llvm.org> Author: gthomas Date: Sun Dec 5 15:37:57 2010 New Revision: 120958 URL: http://llvm.org/viewvc/llvm-project?rev=120958&view=rev Log: Allocate a vm thread specific data when a vm is attached to a mutator thread. The tracer of thread calls the tracers of the vm thread specific data. Build the java specific thread of the finalizer on demand. Don't use ~Thread because the destructor is never called :) For the moment, don't destroy the vm thread specific data when the thread is destroyed because I have a deadlock. Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120958&r1=120957&r2=120958&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Sun Dec 5 15:37:57 2010 @@ -160,7 +160,6 @@ Thread(VMKit* vmk); public: - ~Thread(); /// yield - Yield the processor to another thread. /// Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120958&r1=120957&r2=120958&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Sun Dec 5 15:37:57 2010 @@ -1063,8 +1063,8 @@ mvm::VMThreadData* Jnjvm::buildVMThreadData(mvm::Thread* mut) { JavaThread* th = new JavaThread(this, finalizerThread); - mut->allVmsData[vmID] = th; // will be done by my caller but I will call java code - mut->vmData = th; // will be done by my caller but I will call java code + mut->allVmsData[vmID] = th; // will be done by my caller but I have to call java code before + mut->vmData = th; // will be done by my caller but I have to call java code before bootstrapLoader->upcalls->CreateForeignJavaThread(this, th); return th; } @@ -1123,8 +1123,6 @@ // 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); - - buildVMThreadData(finalizerThread); LOAD_CLASS(upcalls->newClass); LOAD_CLASS(upcalls->newConstructor); Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120958&r1=120957&r2=120958&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Sun Dec 5 15:37:57 2010 @@ -44,17 +44,14 @@ vmk->registerPreparedThread(this); } -Thread::~Thread() { - vmkit->unregisterPreparedThread(this); -} - void Thread::attach(VirtualMachine* vm) { MyVM = vm; vmData = allVmsData[vm->vmID]; if(!vmData) { - printf("should not happen yet\n"); - abort(); + vmkit->vmkitLock.lock(); + vmData = allVmsData[vm->vmID] = vm->buildVMThreadData(this); + vmkit->vmkitLock.unlock(); } } @@ -68,11 +65,17 @@ delete oldData; } else allVmsData = newData; + memset(allVmsData + old*sizeof(VMThreadData*), 0, (n-old)*sizeof(VMThreadData*)); } void Thread::tracer(uintptr_t closure) { mvm::Collector::markAndTraceRoot(&pendingException, closure); - vmData->tracer(closure); + + // should we take the vmkit lock? I suppose that all the threads are suspended during the collection... + for(size_t i=0; inumberOfVms; i++) + if(allVmsData[i]) { + allVmsData[i]->tracer(closure); + } } int Thread::kill(void* tid, int signo) { @@ -525,6 +528,7 @@ // Wait for the thread to die. pthread_join((pthread_t)thread_id, NULL); } + // th->vmkit->unregisterPreparedThread(th); uintptr_t index = ((uintptr_t)th & Thread::IDMask); index = (index & ~TheStackManager.baseAddr) >> 20; TheStackManager.used[index] = 0; Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120958&r1=120957&r2=120958&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Sun Dec 5 15:37:57 2010 @@ -57,6 +57,9 @@ vmkitLock.lock(); numberOfRunningThreads--; th->remove(); + //for(int i=0; iallVmsData[i]) + // delete th->allVmsData[i]; -> Must make a choice for the destruction of threads... delete th->allVmsData; vmkitLock.unlock(); } From gael.thomas at lip6.fr Sun Dec 5 14:39:57 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 05 Dec 2010 22:39:57 -0000 Subject: [vmkit-commits] [vmkit] r120962 - in /vmkit/branches/multi-vm: include/mvm/VMKit.h lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Runtime/VMKit.cpp Message-ID: <20101205223957.109C32A6C12C@llvm.org> Author: gthomas Date: Sun Dec 5 16:39:56 2010 New Revision: 120962 URL: http://llvm.org/viewvc/llvm-project?rev=120962&view=rev Log: uses a function of vmkit to lock vmkit Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=120962&r1=120961&r2=120962&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Sun Dec 5 16:39:56 2010 @@ -44,7 +44,10 @@ VMKit(mvm::BumpPtrAllocator &Alloc); - SpinLock vmkitLock; + SpinLock _vmkitLock; + + void vmkitLock() { _vmkitLock.lock(); } + void vmkitUnlock() { _vmkitLock.unlock(); } /// ------------------------------------------------- /// /// --- vm managment --- /// Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=120962&r1=120961&r2=120962&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Sun Dec 5 16:39:56 2010 @@ -53,7 +53,7 @@ // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. - vmkit->vmkitLock.lock(); + vmkit->vmkitLock(); for(Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) { assert(!cur->doYield); @@ -94,7 +94,7 @@ // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. - self->vmkit->vmkitLock.lock(); + self->vmkit->vmkitLock(); for(Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) { if(cur!=self) { @@ -207,7 +207,7 @@ assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); nbJoined = 0; - initiator->vmkit->vmkitLock.unlock(); + initiator->vmkit->vmkitUnlock(); condEndRV.broadcast(); unlockRV(); initiator->inRV = false; @@ -222,7 +222,7 @@ mvm::Thread* initiator = mvm::Thread::get(); assert(nbJoined == initiator->vmkit->NumberOfThreads && "Inconsistent state"); nbJoined = 0; - initiator->vmkit->vmkitLock.unlock(); + initiator->vmkit->vmkitUnlock(); condEndRV.broadcast(); unlockRV(); initiator->inRV = false; Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120962&r1=120961&r2=120962&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Sun Dec 5 16:39:56 2010 @@ -49,9 +49,9 @@ vmData = allVmsData[vm->vmID]; if(!vmData) { - vmkit->vmkitLock.lock(); + vmkit->vmkitLock(); vmData = allVmsData[vm->vmID] = vm->buildVMThreadData(this); - vmkit->vmkitLock.unlock(); + vmkit->vmkitUnlock(); } } Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120962&r1=120961&r2=120962&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Sun Dec 5 16:39:56 2010 @@ -9,12 +9,12 @@ } size_t VMKit::addVM(VirtualMachine* vm) { - vmkitLock.lock(); + vmkitLock(); for(size_t i=0; ireallocAllVmsData(res, numberOfVms); } - vmkitLock.unlock(); + vmkitUnlock(); return res; } @@ -47,35 +47,35 @@ } void VMKit::registerPreparedThread(mvm::Thread* th) { - vmkitLock.lock(); + vmkitLock(); th->appendTo(&preparedThreads); th->reallocAllVmsData(0, numberOfVms); - vmkitLock.unlock(); + vmkitUnlock(); } void VMKit::unregisterPreparedThread(mvm::Thread* th) { - vmkitLock.lock(); + vmkitLock(); numberOfRunningThreads--; th->remove(); //for(int i=0; iallVmsData[i]) // delete th->allVmsData[i]; -> Must make a choice for the destruction of threads... delete th->allVmsData; - vmkitLock.unlock(); + vmkitUnlock(); } void VMKit::registerRunningThread(mvm::Thread* th) { - vmkitLock.lock(); + vmkitLock(); numberOfRunningThreads++; th->remove(); th->appendTo(&runningThreads); - vmkitLock.unlock(); + vmkitUnlock(); } void VMKit::unregisterRunningThread(mvm::Thread* th) { - vmkitLock.lock(); + vmkitLock(); numberOfRunningThreads--; th->remove(); th->appendTo(&preparedThreads); - vmkitLock.unlock(); + vmkitUnlock(); } From gael.thomas at lip6.fr Sun Dec 5 14:49:01 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 05 Dec 2010 22:49:01 -0000 Subject: [vmkit-commits] [vmkit] r120963 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Runtime/VMKit.cpp Message-ID: <20101205224901.5E9632A6C12C@llvm.org> Author: gthomas Date: Sun Dec 5 16:49:01 2010 New Revision: 120963 URL: http://llvm.org/viewvc/llvm-project?rev=120963&view=rev Log: delete all the vm thread data when the underlying mutator is released Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120963&r1=120962&r2=120963&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Sun Dec 5 16:49:01 2010 @@ -133,6 +133,7 @@ class VMKit; // WARNING: if you modify this class, you must also change mvm-runtime.ll +// WARNING: when a VMThreadData is store in a thread (in allVmsData), you must never delete it yourself. class VMThreadData { public: /// mut - The associated thread mutator Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120963&r1=120962&r2=120963&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Sun Dec 5 16:49:01 2010 @@ -528,7 +528,7 @@ // Wait for the thread to die. pthread_join((pthread_t)thread_id, NULL); } - // th->vmkit->unregisterPreparedThread(th); + th->vmkit->unregisterPreparedThread(th); uintptr_t index = ((uintptr_t)th & Thread::IDMask); index = (index & ~TheStackManager.baseAddr) >> 20; TheStackManager.used[index] = 0; Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120963&r1=120962&r2=120963&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Sun Dec 5 16:49:01 2010 @@ -55,11 +55,10 @@ void VMKit::unregisterPreparedThread(mvm::Thread* th) { vmkitLock(); - numberOfRunningThreads--; th->remove(); - //for(int i=0; iallVmsData[i]) - // delete th->allVmsData[i]; -> Must make a choice for the destruction of threads... + for(size_t i=0; iallVmsData[i]) + delete th->allVmsData[i]; delete th->allVmsData; vmkitUnlock(); } From gael.thomas at lip6.fr Mon Dec 6 04:03:01 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Mon, 06 Dec 2010 12:03:01 -0000 Subject: [vmkit-commits] [vmkit] r120999 - in /vmkit/branches/multi-vm: include/mvm/VMKit.h lib/J3/VMCore/Jnjvm.cpp lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/GCMmap2/gccollector.cpp lib/Mvm/Runtime/VMKit.cpp mmtk/mmtk-j3/Collection.cpp Message-ID: <20101206120301.78E222A6C12C@llvm.org> Author: gthomas Date: Mon Dec 6 06:03:01 2010 New Revision: 120999 URL: http://llvm.org/viewvc/llvm-project?rev=120999&view=rev Log: startCollection/endCollection are now centralized in vmkit. Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=120999&r1=120998&r2=120999&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Mon Dec 6 06:03:01 2010 @@ -55,7 +55,7 @@ // vms - the list of vms. Could be directly an array and we could also directly use the vmID as index in this array. // synchronize with vmkitLock VirtualMachine** vms; - size_t numberOfVms; + size_t vmsArraySize; size_t addVM(VirtualMachine* vm); void removeVM(size_t id); @@ -89,6 +89,13 @@ void unregisterRunningThread(mvm::Thread* th); /// ------------------------------------------------- /// + /// --- collection managment --- /// + /// ------------------------------------------------- /// + + void startCollection(); + void endCollection(); + + /// ------------------------------------------------- /// /// --- backtrace related methods --- /// /// ------------------------------------------------- /// /// FunctionsCache - cache of compiled functions Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120999&r1=120998&r2=120999&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Mon Dec 6 06:03:01 2010 @@ -1411,11 +1411,14 @@ } void Jnjvm::startCollection() { + printf("start collection of %p\n", this); + printf("%p - %p\n", finalizerThread, referenceThread); finalizerThread->FinalizationQueueLock.acquire(); referenceThread->ToEnqueueLock.acquire(); referenceThread->SoftReferencesQueue.acquire(); referenceThread->WeakReferencesQueue.acquire(); referenceThread->PhantomReferencesQueue.acquire(); + printf("yop\n"); } void Jnjvm::endCollection() { Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=120999&r1=120998&r2=120999&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Mon Dec 6 06:03:01 2010 @@ -72,7 +72,7 @@ mvm::Collector::markAndTraceRoot(&pendingException, closure); // should we take the vmkit lock? I suppose that all the threads are suspended during the collection... - for(size_t i=0; inumberOfVms; i++) + for(size_t i=0; ivmsArraySize; i++) if(allVmsData[i]) { allVmsData[i]->tracer(closure); } Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp?rev=120999&r1=120998&r2=120999&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp Mon Dec 6 06:03:01 2010 @@ -42,7 +42,7 @@ mvm::Thread* th = mvm::Thread::get(); th->vmkit->rendezvous.startRV(); - th->MyVM->startCollection(); + th->vmkit->startCollection(); th->vmkit->rendezvous.synchronize(); @@ -91,7 +91,7 @@ // Wake up all threads. th->vmkit->rendezvous.finishRV(); - th->MyVM->endCollection(); + th->vmkit->endCollection(); // Kill unreachable objects. GCChunkNode *next = 0; Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=120999&r1=120998&r2=120999&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Mon Dec 6 06:03:01 2010 @@ -4,36 +4,56 @@ using namespace mvm; VMKit::VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { - vms = 0; - numberOfVms = 0; + vms = 0; + vmsArraySize = 0; +} + +void VMKit::startCollection() { + vmkitLock(); + for(size_t i=0; istartCollection(); + vmkitUnlock(); +} + +void VMKit::endCollection() { + vmkitLock(); + for(size_t i=0; iendCollection(); + vmkitUnlock(); } size_t VMKit::addVM(VirtualMachine* vm) { vmkitLock(); - for(size_t i=0; inext()) { - cur->reallocAllVmsData(res, numberOfVms); + cur->reallocAllVmsData(res, vmsArraySize); } for(Thread* cur=runningThreads.next(); cur!=&runningThreads; cur=cur->next()) { - cur->reallocAllVmsData(res, numberOfVms); + cur->reallocAllVmsData(res, vmsArraySize); } vmkitUnlock(); @@ -49,14 +69,14 @@ void VMKit::registerPreparedThread(mvm::Thread* th) { vmkitLock(); th->appendTo(&preparedThreads); - th->reallocAllVmsData(0, numberOfVms); + th->reallocAllVmsData(0, vmsArraySize); vmkitUnlock(); } void VMKit::unregisterPreparedThread(mvm::Thread* th) { vmkitLock(); th->remove(); - for(size_t i=0; iallVmsData[i]) delete th->allVmsData[i]; delete th->allVmsData; Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp?rev=120999&r1=120998&r2=120999&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp Mon Dec 6 06:03:01 2010 @@ -42,7 +42,7 @@ th->vmkit->rendezvous.join(); return; } else { - th->MyVM->startCollection(); + th->vmkit->startCollection(); th->vmkit->rendezvous.synchronize(); JnJVM_org_mmtk_plan_Plan_setCollectionTriggered__(); @@ -74,7 +74,7 @@ } th->vmkit->rendezvous.finishRV(); - th->MyVM->endCollection(); + th->vmkit->endCollection(); } } From gael.thomas at lip6.fr Mon Dec 6 09:19:12 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Mon, 06 Dec 2010 17:19:12 -0000 Subject: [vmkit-commits] [vmkit] r121005 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/GCMmap2/gccollector.cpp lib/Mvm/Runtime/VMKit.cpp mmtk/mmtk-j3/Collection.cpp mmtk/mmtk-j3/Scanning.cpp Message-ID: <20101206171912.A78C12A6C12C@llvm.org> Author: gthomas Date: Mon Dec 6 11:19:12 2010 New Revision: 121005 URL: http://llvm.org/viewvc/llvm-project?rev=121005&view=rev Log: Use a normal lock to lock vmkit when a thread is added, a vm is added or during a collection. Define a tracer in vmkit. It calls the tracers of the different vms. Delete the data of the thread with the new function localDestroy called by releaseThread (notice: a thread is never destroyed!) Define a generic finalizeObject in VirtualMachine. Do not lock vmkit inside the collection rv but in the new functions startCollection and stopCollection of vmkit. Notice that the first one returns 1 if another collection is not happening and call directly startRV and synchronize. Fix therefore Collection.cpp/gccollector.cpp. Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=121005&r1=121004&r2=121005&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Mon Dec 6 11:19:12 2010 @@ -312,6 +312,10 @@ /// void* operator new(size_t sz); void operator delete(void* th) { UNREACHABLE(); } + + /// localDestroy - call by releaseThread. Used for sub classes. + /// + virtual void localDestroy() {} /// releaseThread - Free the stack so that another thread can use it. /// Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=121005&r1=121004&r2=121005&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Mon Dec 6 11:19:12 2010 @@ -44,7 +44,7 @@ VMKit(mvm::BumpPtrAllocator &Alloc); - SpinLock _vmkitLock; + LockNormal _vmkitLock; void vmkitLock() { _vmkitLock.lock(); } void vmkitUnlock() { _vmkitLock.unlock(); } @@ -52,8 +52,8 @@ /// ------------------------------------------------- /// /// --- vm managment --- /// /// ------------------------------------------------- /// - // vms - the list of vms. Could be directly an array and we could also directly use the vmID as index in this array. - // synchronize with vmkitLock + // vms - the list of vms. + // synchronized with vmkitLock VirtualMachine** vms; size_t vmsArraySize; @@ -64,22 +64,26 @@ /// --- thread managment --- /// /// ------------------------------------------------- /// /// preparedThreads - the list of prepared threads, they are not yet running. + /// synchronized with vmkitLock /// CircularBase preparedThreads; /// runningThreads - the list of running threads + /// synchronize with vmkitLock /// CircularBase runningThreads; /// numberOfRunningThreads - The number of threads that currently run under this VM. + /// synchronized with vmkitLock + /// size_t numberOfRunningThreads; /// rendezvous - The rendezvous implementation for garbage collection. /// #ifdef WITH_LLVM_GCC - CooperativeCollectionRV rendezvous; + CooperativeCollectionRV rendezvous; #else - UncooperativeCollectionRV rendezvous; + UncooperativeCollectionRV rendezvous; #endif void registerPreparedThread(mvm::Thread* th); @@ -92,9 +96,11 @@ /// --- collection managment --- /// /// ------------------------------------------------- /// - void startCollection(); + bool startCollection(); // 1 ok, begin collection, 0 do not start collection void endCollection(); + void tracer(uintptr_t closure); + /// ------------------------------------------------- /// /// --- backtrace related methods --- /// /// ------------------------------------------------- /// Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121005&r1=121004&r2=121005&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Mon Dec 6 11:19:12 2010 @@ -55,6 +55,9 @@ //===----------------------------------------------------------------------===// // (2) GC-related methods. //===----------------------------------------------------------------------===// + /// finalizeObject - invoke the finalizer of a java object + /// + virtual void finalizeObject(mvm::gc* obj) {} /// startCollection - Preliminary code before starting a GC. /// @@ -89,7 +92,8 @@ /// virtual void addFinalizationCandidate(gc* object) {} - /// tracer - Trace this virtual machine's GC-objects. + /// tracer - Trace this virtual machine's GC-objects. + /// Called once by vm. If you have GC-objects in a thread specific data, redefine the tracer of your VMThreadData. /// virtual void tracer(uintptr_t closure) {} Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121005&r1=121004&r2=121005&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Mon Dec 6 11:19:12 2010 @@ -1411,14 +1411,11 @@ } void Jnjvm::startCollection() { - printf("start collection of %p\n", this); - printf("%p - %p\n", finalizerThread, referenceThread); finalizerThread->FinalizationQueueLock.acquire(); referenceThread->ToEnqueueLock.acquire(); referenceThread->SoftReferencesQueue.acquire(); referenceThread->WeakReferencesQueue.acquire(); referenceThread->PhantomReferencesQueue.acquire(); - printf("yop\n"); } void Jnjvm::endCollection() { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121005&r1=121004&r2=121005&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Mon Dec 6 11:19:12 2010 @@ -320,7 +320,7 @@ /// finalizeObject - invoke the finalizer of a java object /// - void finalizeObject(mvm::gc* obj); + virtual void finalizeObject(mvm::gc* obj); /// setFinalizerThread - Set the finalizer thread of this VM. /// Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=121005&r1=121004&r2=121005&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Mon Dec 6 11:19:12 2010 @@ -51,10 +51,6 @@ mvm::Thread* self = mvm::Thread::get(); mvm::VMKit* vmkit = self->vmkit; - // Lock thread lock, so that we can traverse the thread list safely. This will - // be released on finishRV. - vmkit->vmkitLock(); - for(Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) { assert(!cur->doYield); cur->doYield = true; @@ -94,8 +90,6 @@ // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. - self->vmkit->vmkitLock(); - for(Thread* cur=vmkit->runningThreads.next(); cur!=&vmkit->runningThreads; cur=cur->next()) { if(cur!=self) { int res = cur->kill(SIGGC); @@ -207,7 +201,6 @@ assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); nbJoined = 0; - initiator->vmkit->vmkitUnlock(); condEndRV.broadcast(); unlockRV(); initiator->inRV = false; @@ -222,7 +215,6 @@ mvm::Thread* initiator = mvm::Thread::get(); assert(nbJoined == initiator->vmkit->NumberOfThreads && "Inconsistent state"); nbJoined = 0; - initiator->vmkit->vmkitUnlock(); condEndRV.broadcast(); unlockRV(); initiator->inRV = false; Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=121005&r1=121004&r2=121005&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Mon Dec 6 11:19:12 2010 @@ -528,6 +528,7 @@ // Wait for the thread to die. pthread_join((pthread_t)thread_id, NULL); } + th->localDestroy(); th->vmkit->unregisterPreparedThread(th); uintptr_t index = ((uintptr_t)th & Thread::IDMask); index = (index & ~TheStackManager.baseAddr) >> 20; Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp?rev=121005&r1=121004&r2=121005&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp Mon Dec 6 11:19:12 2010 @@ -41,64 +41,62 @@ unused_nodes->attrape(used_nodes); mvm::Thread* th = mvm::Thread::get(); - th->vmkit->rendezvous.startRV(); - th->vmkit->startCollection(); + if(th->startCollection()) { - th->vmkit->rendezvous.synchronize(); + mvm::Thread* tcur = th; - mvm::Thread* tcur = th; + // (1) Trace VMKit. + th->vmkit->tracer(0); - // (1) Trace the VM. - th->MyVM->tracer(0); + // (2) Trace the threads. + do { + tcur->scanStack(0); + tcur->tracer(0); + tcur = (mvm::Thread*)tcur->next(); + } while (tcur != th); - // (2) Trace the threads. - do { - tcur->scanStack(0); - tcur->tracer(0); - tcur = (mvm::Thread*)tcur->next(); - } while (tcur != th); + // (3) Trace stack objects. + for(cur = used_nodes->next(); cur != used_nodes; cur = cur->next()) + trace(cur); - // (3) Trace stack objects. - for(cur = used_nodes->next(); cur != used_nodes; cur = cur->next()) - trace(cur); + // Go back to the previous node. + cur = cur->prev(); - // Go back to the previous node. - cur = cur->prev(); + // (4) Trace the weak reference queue. + th->MyVM->scanWeakReferencesQueue(0); - // (4) Trace the weak reference queue. - th->MyVM->scanWeakReferencesQueue(0); - - // (5) Trace the soft reference queue. - th->MyVM->scanSoftReferencesQueue(0); + // (5) Trace the soft reference queue. + th->MyVM->scanSoftReferencesQueue(0); - // (6) Trace the finalization queue. - th->MyVM->scanFinalizationQueue(0); + // (6) Trace the finalization queue. + th->MyVM->scanFinalizationQueue(0); - // (7) Trace the phantom reference queue. - th->MyVM->scanPhantomReferencesQueue(0); + // (7) Trace the phantom reference queue. + th->MyVM->scanPhantomReferencesQueue(0); - // (8) Trace the new objects added by queues. - for(cur = cur->next(); cur != used_nodes; cur = cur->next()) - trace(cur); + // (8) Trace the new objects added by queues. + for(cur = cur->next(); cur != used_nodes; cur = cur->next()) + trace(cur); - // Finalize. - GCChunkNode finalizable; - finalizable.attrape(unused_nodes); + // Finalize. + GCChunkNode finalizable; + finalizable.attrape(unused_nodes); - // We have stopped collecting, go back to alloc state. - status = stat_alloc; + // We have stopped collecting, go back to alloc state. + status = stat_alloc; - // Wake up all threads. - th->vmkit->rendezvous.finishRV(); - th->vmkit->endCollection(); + // Wake up all threads. + th->vmkit->rendezvous.finishRV(); + th->vmkit->endCollection(); - // Kill unreachable objects. - GCChunkNode *next = 0; - for(cur=finalizable.next(); cur!=&finalizable; cur=next) { - next = cur->next(); - allocator->reject_chunk(cur); - } + // Kill unreachable objects. + GCChunkNode *next = 0; + for(cur=finalizable.next(); cur!=&finalizable; cur=next) { + next = cur->next(); + allocator->reject_chunk(cur); + } + } } Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=121005&r1=121004&r2=121005&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Mon Dec 6 11:19:12 2010 @@ -3,28 +3,65 @@ using namespace mvm; +#if 0 +#define dprintf(...) do { printf("[%p] ", (void*)mvm::Thread::get()); printf(__VA_ARGS__); } while(0) +#else +#define dprintf(...) +#endif + VMKit::VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { vms = 0; vmsArraySize = 0; } -void VMKit::startCollection() { - vmkitLock(); +void VMKit::tracer(uintptr_t closure) { + // don't have to take the vmkitLock, already taken by the rendezvous. for(size_t i=0; istartCollection(); - vmkitUnlock(); + vms[i]->tracer(closure); +} + +bool VMKit::startCollection() { + // do not take the lock here because if a gc is currently running, it could call enterUncooperativeCode + // which will execute the gc and we will therefore recall the gc just behind. Stupid because the previous one + // should have freed some memory + rendezvous.startRV(); + + if (mvm::Thread::get()->doYield) { + rendezvous.cancelRV(); + rendezvous.join(); + return 0; + } else { + dprintf("Start collection\n"); + // Lock thread lock, so that we can traverse the vm and thread lists safely. This will be released on finishRV. + vmkitLock(); + + // call first startCollection on each vm to avoid deadlock. + // indeed, a vm could want to execute applicative code + for(size_t i=0; istartCollection(); + + rendezvous.synchronize(); + + return 1; + } } void VMKit::endCollection() { - vmkitLock(); + dprintf("End collection\n"); + + rendezvous.finishRV(); + for(size_t i=0; iendCollection(); + vmkitUnlock(); } size_t VMKit::addVM(VirtualMachine* vm) { + dprintf("add vm: %p\n", vm); vmkitLock(); for(size_t i=0; iappendTo(&preparedThreads); th->reallocAllVmsData(0, vmsArraySize); @@ -74,6 +113,7 @@ } void VMKit::unregisterPreparedThread(mvm::Thread* th) { + dprintf("Delete thread: %p\n", th); vmkitLock(); th->remove(); for(size_t i=0; iremove(); @@ -92,6 +133,7 @@ } void VMKit::unregisterRunningThread(mvm::Thread* th) { + dprintf("Unregister thread: %p\n", th); vmkitLock(); numberOfRunningThreads--; th->remove(); Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp?rev=121005&r1=121004&r2=121005&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/Collection.cpp Mon Dec 6 11:19:12 2010 @@ -35,16 +35,8 @@ extern "C" void Java_org_j3_mmtk_Collection_triggerCollection__I (MMTkObject* C, int why) { mvm::Thread* th = mvm::Thread::get(); - // Verify that another collection is not happening. - th->vmkit->rendezvous.startRV(); - if (th->doYield) { - th->vmkit->rendezvous.cancelRV(); - th->vmkit->rendezvous.join(); - return; - } else { - th->vmkit->startCollection(); - th->vmkit->rendezvous.synchronize(); - + if (th->vmkit->startCollection()) { + JnJVM_org_mmtk_plan_Plan_setCollectionTriggered__(); // Record the starting time @@ -73,7 +65,6 @@ elapsedTime / 1000000); } - th->vmkit->rendezvous.finishRV(); th->vmkit->endCollection(); } Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp?rev=121005&r1=121004&r2=121005&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/Scanning.cpp Mon Dec 6 11:19:12 2010 @@ -27,7 +27,7 @@ } extern "C" void Java_org_j3_mmtk_Scanning_computeGlobalRoots__Lorg_mmtk_plan_TraceLocal_2 (MMTkObject* Scanning, MMTkObject* TL) { - mvm::Thread::get()->MyVM->tracer(reinterpret_cast(TL)); + mvm::Thread::get()->vmkit->tracer(reinterpret_cast(TL)); mvm::VMKit* vmkit = mvm::Thread::get()->vmkit; mvm::Thread* tcur; From gael.thomas at lip6.fr Mon Dec 6 09:43:31 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Mon, 06 Dec 2010 17:43:31 -0000 Subject: [vmkit-commits] [vmkit] r121008 - in /vmkit/branches/multi-vm: include/mvm/SystemThreads.h include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/J3/VMCore/ReferenceQueue.cpp lib/J3/VMCore/ReferenceQueue.h lib/J3/VMCore/VirtualTables.cpp lib/Mvm/GCMmap2/MvmGC.h lib/Mvm/GCMmap2/gccollector.cpp lib/Mvm/MMTk/MvmGC.cpp lib/Mvm/Runtime/SystemThreads.cpp lib/Mvm/Runtime/VMKit.cpp mmtk/mmtk-alloc/Selected.cpp mmtk/mmtk-j3/FinalizableProcessor.cpp Message-ID: <20101206174331.831642A6C12C@llvm.org> Author: gthomas Date: Mon Dec 6 11:43:31 2010 New Revision: 121008 URL: http://llvm.org/viewvc/llvm-project?rev=121008&view=rev Log: Move the finalizer threads in vmkit. Added: vmkit/branches/multi-vm/include/mvm/SystemThreads.h vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/mmtk/mmtk-alloc/Selected.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/FinalizableProcessor.cpp Added: vmkit/branches/multi-vm/include/mvm/SystemThreads.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/SystemThreads.h?rev=121008&view=auto ============================================================================== --- vmkit/branches/multi-vm/include/mvm/SystemThreads.h (added) +++ vmkit/branches/multi-vm/include/mvm/SystemThreads.h Mon Dec 6 11:43:31 2010 @@ -0,0 +1,88 @@ +#ifndef _SYSTEM_THREADS_H_ +#define _SYSTEM_THREADS_H_ + +#include "MutatorThread.h" +#include "mvm/Threads/Cond.h" + +// Same values than JikesRVM +#define INITIAL_QUEUE_SIZE 256 +#define GROW_FACTOR 2 + +namespace mvm { +class VirtualMachine; + +class FinalizerThread : public mvm::MutatorThread { +public: + /// FinalizationQueueLock - A lock to protect access to the queue. + /// + mvm::SpinLock FinalizationQueueLock; + + /// finalizationQueue - A list of allocated objets that contain a finalize + /// method. + /// + mvm::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. + /// + mvm::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; + + static void finalizerStart(FinalizerThread*); + + /// addFinalizationCandidate - Add an object to the queue of objects with + /// a finalization method. + /// + void addFinalizationCandidate(mvm::gc*); + + /// scanFinalizationQueue - Scan objets with a finalized method and schedule + /// them for finalization if they are not live. + /// + void scanFinalizationQueue(uintptr_t closure); + + FinalizerThread(VMKit* vmkit); + + virtual void localDestroy() { + delete[] FinalizationQueue; + delete[] ToBeFinalized; + } + + virtual void tracer(uintptr_t closure); +}; + +} // namespace mvm + + +#endif Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Mon Dec 6 11:43:31 2010 @@ -1,7 +1,6 @@ #ifndef _VMKIT_H_ #define _VMKIT_H_ -#include #include "mvm/Allocator.h" #include "mvm/Threads/CollectionRV.h" #include "mvm/VirtualMachine.h" @@ -10,6 +9,7 @@ class MethodInfo; class VMKit; class gc; +class FinalizerThread; class FunctionMap { public: @@ -92,6 +92,18 @@ void registerRunningThread(mvm::Thread* th); void unregisterRunningThread(mvm::Thread* th); + FinalizerThread* finalizerThread; + + /// scanFinalizationQueue - Scan objets with a finalized method and schedule + /// them for finalization if they are not live. + /// + void scanFinalizationQueue(uintptr_t closure); + + /// addFinalizationCandidate - Add an object to the queue of objects with + /// a finalization method. + /// + void addFinalizationCandidate(gc* object); + /// ------------------------------------------------- /// /// --- collection managment --- /// /// ------------------------------------------------- /// Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Mon Dec 6 11:43:31 2010 @@ -82,16 +82,6 @@ /// virtual void scanPhantomReferencesQueue(uintptr_t closure) {} - /// scanFinalizationQueue - Scan objets with a finalized method and schedule - /// them for finalization if they are not live. - /// - virtual void scanFinalizationQueue(uintptr_t closure) {} - - /// addFinalizationCandidate - Add an object to the queue of objects with - /// a finalization method. - /// - virtual void addFinalizationCandidate(gc* object) {} - /// tracer - Trace this virtual machine's GC-objects. /// Called once by vm. If you have GC-objects in a thread specific data, redefine the tracer of your VMThreadData. /// Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Mon Dec 6 11:43:31 2010 @@ -1062,7 +1062,7 @@ } mvm::VMThreadData* Jnjvm::buildVMThreadData(mvm::Thread* mut) { - JavaThread* th = new JavaThread(this, finalizerThread); + JavaThread* th = new JavaThread(this, mut); mut->allVmsData[vmID] = th; // will be done by my caller but I have to call java code before mut->vmData = th; // will be done by my caller but I have to call java code before bootstrapLoader->upcalls->CreateForeignJavaThread(this, th); @@ -1076,10 +1076,6 @@ llvm_gcroot(javaLoader, 0); JnjvmClassLoader* loader = bootstrapLoader; - // First create system threads. - finalizerThread = new FinalizerThread(this); - finalizerThread->start((void (*)(mvm::Thread*))FinalizerThread::finalizerStart); - referenceThread = new ReferenceThread(this); javaReferenceThread = new JavaThread(this, referenceThread); referenceThread->allVmsData[vmID] = javaReferenceThread; @@ -1411,7 +1407,6 @@ } void Jnjvm::startCollection() { - finalizerThread->FinalizationQueueLock.acquire(); referenceThread->ToEnqueueLock.acquire(); referenceThread->SoftReferencesQueue.acquire(); referenceThread->WeakReferencesQueue.acquire(); @@ -1419,12 +1414,10 @@ } void Jnjvm::endCollection() { - finalizerThread->FinalizationQueueLock.release(); referenceThread->ToEnqueueLock.release(); referenceThread->SoftReferencesQueue.release(); referenceThread->WeakReferencesQueue.release(); referenceThread->PhantomReferencesQueue.release(); - finalizerThread->FinalizationCond.broadcast(); referenceThread->EnqueueCond.broadcast(); } @@ -1440,15 +1433,6 @@ referenceThread->PhantomReferencesQueue.scan(referenceThread, closure); } -void Jnjvm::scanFinalizationQueue(uintptr_t closure) { - finalizerThread->scanFinalizationQueue(closure); -} - -void Jnjvm::addFinalizationCandidate(mvm::gc* object) { - llvm_gcroot(object, 0); - finalizerThread->addFinalizationCandidate(object); -} - size_t Jnjvm::getObjectSize(mvm::gc* object) { // TODO: because this is called during GC, there is no need to do // llvm_gcroot. For clarity, it may be useful to have a special type Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Mon Dec 6 11:43:31 2010 @@ -33,7 +33,6 @@ class ArrayObject; class Classpath; class CommonClass; -class FinalizerThread; class JavaField; class JavaMethod; class JavaObject; @@ -123,10 +122,6 @@ private: - /// finalizerThread - The thread that finalizes Java objects. - /// - FinalizerThread* finalizerThread; - /// enqueueThread - The thread that enqueue Java references. /// ReferenceThread* referenceThread; @@ -136,8 +131,6 @@ 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(mvm::gc* obj); virtual size_t getObjectSize(mvm::gc* obj); virtual const char* getObjectTypeName(mvm::gc* obj); @@ -321,15 +314,7 @@ /// finalizeObject - invoke the finalizer of a java object /// virtual void finalizeObject(mvm::gc* obj); - - /// setFinalizerThread - Set the finalizer thread of this VM. - /// - void setFinalizerThread(FinalizerThread* th) { finalizerThread = th; } - - /// getFinalizerThread - Get the finalizer thread of this VM. - /// - FinalizerThread* getFinalizerThread() const { return finalizerThread; } - + /// setReferenceThread - Set the enqueue thread of this VM. /// void setReferenceThread(ReferenceThread* th) { referenceThread = th; } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp Mon Dec 6 11:43:31 2010 @@ -158,131 +158,3 @@ CurrentIndex = NewIndex; } - -FinalizerThread::FinalizerThread(Jnjvm* vm) : MutatorThread(vm->vmkit) { - FinalizationQueue = new mvm::gc*[INITIAL_QUEUE_SIZE]; - QueueLength = INITIAL_QUEUE_SIZE; - CurrentIndex = 0; - - ToBeFinalized = new mvm::gc*[INITIAL_QUEUE_SIZE]; - ToBeFinalizedLength = INITIAL_QUEUE_SIZE; - CurrentFinalizedIndex = 0; - - MyVM = vm; -} - -void FinalizerThread::growFinalizationQueue() { - if (CurrentIndex >= QueueLength) { - uint32 newLength = QueueLength * GROW_FACTOR; - mvm::gc** newQueue = new mvm::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 FinalizerThread::growToBeFinalizedQueue() { - if (CurrentFinalizedIndex >= ToBeFinalizedLength) { - uint32 newLength = ToBeFinalizedLength * GROW_FACTOR; - mvm::gc** newQueue = new mvm::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 FinalizerThread::addFinalizationCandidate(mvm::gc* obj) { - llvm_gcroot(obj, 0); - FinalizationQueueLock.acquire(); - - if (CurrentIndex >= QueueLength) { - growFinalizationQueue(); - } - - FinalizationQueue[CurrentIndex++] = obj; - FinalizationQueueLock.release(); -} - - -void FinalizerThread::scanFinalizationQueue(uintptr_t closure) { - uint32 NewIndex = 0; - for (uint32 i = 0; i < CurrentIndex; ++i) { - mvm::gc* obj = FinalizationQueue[i]; - - if (!mvm::Collector::isLive(obj, closure)) { - obj = mvm::Collector::retainForFinalize(FinalizationQueue[i], closure); - - if (CurrentFinalizedIndex >= ToBeFinalizedLength) - growToBeFinalizedQueue(); - - /* Add to object table */ - ToBeFinalized[CurrentFinalizedIndex++] = obj; - } else { - FinalizationQueue[NewIndex++] = - mvm::Collector::getForwardedFinalizable(obj, closure); - } - } - CurrentIndex = NewIndex; -} - -typedef void (*destructor_t)(void*); - -void invokeFinalizer(mvm::gc* _obj) { - JavaObject* obj = (JavaObject*)_obj; - llvm_gcroot(obj, 0); - Jnjvm* vm = (Jnjvm*)obj->getVirtualTable()->vm; //JavaThread::get()->getJVM(); - mvm::Thread::get()->attach(vm); - vm->finalizeObject(obj); -} - -void invokeFinalize(mvm::gc* res) { - llvm_gcroot(res, 0); - TRY { - invokeFinalizer(res); - } IGNORE; - mvm::Thread::get()->clearPendingException(); -} - -void FinalizerThread::finalizerStart(FinalizerThread* th) { - mvm::gc* res = NULL; - llvm_gcroot(res, 0); - - while (true) { - th->FinalizationLock.lock(); - while (th->CurrentFinalizedIndex == 0) { - th->FinalizationCond.wait(&th->FinalizationLock); - } - th->FinalizationLock.unlock(); - - while (true) { - th->FinalizationQueueLock.acquire(); - if (th->CurrentFinalizedIndex != 0) { - res = th->ToBeFinalized[th->CurrentFinalizedIndex - 1]; - --th->CurrentFinalizedIndex; - } - th->FinalizationQueueLock.release(); - if (!res) break; - - mvm::VirtualTable* VT = res->getVirtualTable(); - ASSERT(VT->vm); - if (VT->operatorDelete) { - destructor_t dest = (destructor_t)VT->destructor; - dest(res); - } else { - invokeFinalize(res); - } - res = NULL; - } - } -} Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h Mon Dec 6 11:43:31 2010 @@ -133,81 +133,11 @@ ReferenceThread(Jnjvm* vm); - ~ReferenceThread() { + virtual void localDestroy() { delete[] ToEnqueue; } }; -class FinalizerThread : public mvm::MutatorThread { -public: - /// FinalizationQueueLock - A lock to protect access to the queue. - /// - mvm::SpinLock FinalizationQueueLock; - - /// finalizationQueue - A list of allocated objets that contain a finalize - /// method. - /// - mvm::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. - /// - mvm::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; - - static void finalizerStart(FinalizerThread*); - - /// addFinalizationCandidate - Add an object to the queue of objects with - /// a finalization method. - /// - void addFinalizationCandidate(mvm::gc*); - - /// scanFinalizationQueue - Scan objets with a finalized method and schedule - /// them for finalization if they are not live. - /// - void scanFinalizationQueue(uintptr_t closure); - - FinalizerThread(Jnjvm* vm); - - ~FinalizerThread() { - delete[] FinalizationQueue; - delete[] ToBeFinalized; - } - -}; - } // namespace j3 #endif //J3_REFERENCE_QUEUE_H Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Mon Dec 6 11:43:31 2010 @@ -290,11 +290,6 @@ ArrayUInt16** key = const_cast(&(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) { Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h Mon Dec 6 11:43:31 2010 @@ -187,7 +187,7 @@ unlock(); if (((CommonVirtualTable*)vt)->destructor) - mvm::Thread::get()->MyVM->addFinalizationCandidate((gc*)p); + mvm::Thread::get()->vmkit->addFinalizationCandidate((gc*)p); return p; Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp Mon Dec 6 11:43:31 2010 @@ -69,7 +69,7 @@ th->MyVM->scanSoftReferencesQueue(0); // (6) Trace the finalization queue. - th->MyVM->scanFinalizationQueue(0); + th->vmkit->scanFinalizationQueue(0); // (7) Trace the phantom reference queue. th->MyVM->scanPhantomReferencesQueue(0); Modified: vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.cpp?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/MMTk/MvmGC.cpp Mon Dec 6 11:43:31 2010 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "mvm/GC.h" +#include "mvm/VMKit.h" #include "MutatorThread.h" #include "mvm/VirtualMachine.h" @@ -37,12 +38,12 @@ extern "C" void* gcmallocUnresolved(uint32_t sz, VirtualTable* VT) { gc* res = (gc*)gcmalloc(sz, VT); if (VT->destructor) - mvm::Thread::get()->MyVM->addFinalizationCandidate(res); + mvm::Thread::get()->vmkit->addFinalizationCandidate(res); return res; } extern "C" void addFinalizationCandidate(gc* obj) { - mvm::Thread::get()->MyVM->addFinalizationCandidate(obj); + mvm::Thread::get()->vmkit->addFinalizationCandidate(obj); } extern "C" void* AllocateMagicArray(int32_t sz, void* length) { Added: vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp?rev=121008&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp (added) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp Mon Dec 6 11:43:31 2010 @@ -0,0 +1,137 @@ +#include "mvm/SystemThreads.h" +#include "mvm/GC.h" +#include "mvm/VirtualMachine.h" + +using namespace mvm; + +FinalizerThread::FinalizerThread(VMKit* vmkit) : MutatorThread(vmkit) { + FinalizationQueue = new mvm::gc*[INITIAL_QUEUE_SIZE]; + QueueLength = INITIAL_QUEUE_SIZE; + CurrentIndex = 0; + + ToBeFinalized = new mvm::gc*[INITIAL_QUEUE_SIZE]; + ToBeFinalizedLength = INITIAL_QUEUE_SIZE; + CurrentFinalizedIndex = 0; +} + +void FinalizerThread::growFinalizationQueue() { + if (CurrentIndex >= QueueLength) { + uint32 newLength = QueueLength * GROW_FACTOR; + mvm::gc** newQueue = new mvm::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 FinalizerThread::growToBeFinalizedQueue() { + if (CurrentFinalizedIndex >= ToBeFinalizedLength) { + uint32 newLength = ToBeFinalizedLength * GROW_FACTOR; + mvm::gc** newQueue = new mvm::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 FinalizerThread::addFinalizationCandidate(mvm::gc* obj) { + llvm_gcroot(obj, 0); + FinalizationQueueLock.acquire(); + + if (CurrentIndex >= QueueLength) { + growFinalizationQueue(); + } + + FinalizationQueue[CurrentIndex++] = obj; + FinalizationQueueLock.release(); +} + +void FinalizerThread::scanFinalizationQueue(uintptr_t closure) { + uint32 NewIndex = 0; + for (uint32 i = 0; i < CurrentIndex; ++i) { + mvm::gc* obj = FinalizationQueue[i]; + + if (!mvm::Collector::isLive(obj, closure)) { + obj = mvm::Collector::retainForFinalize(FinalizationQueue[i], closure); + + if (CurrentFinalizedIndex >= ToBeFinalizedLength) + growToBeFinalizedQueue(); + + /* Add to object table */ + ToBeFinalized[CurrentFinalizedIndex++] = obj; + } else { + FinalizationQueue[NewIndex++] = + mvm::Collector::getForwardedFinalizable(obj, closure); + } + } + CurrentIndex = NewIndex; +} + +typedef void (*destructor_t)(void*); + +void invokeFinalizer(mvm::gc* obj) { + llvm_gcroot(obj, 0); + VirtualMachine* vm = obj->getVirtualTable()->vm; //JavaThread::get()->getJVM(); + mvm::Thread::get()->attach(vm); + vm->finalizeObject(obj); +} + +void invokeFinalize(mvm::gc* res) { + llvm_gcroot(res, 0); + TRY { + invokeFinalizer(res); + } IGNORE; + mvm::Thread::get()->clearPendingException(); +} + +void FinalizerThread::finalizerStart(FinalizerThread* th) { + mvm::gc* res = NULL; + llvm_gcroot(res, 0); + + while (true) { + th->FinalizationLock.lock(); + while (th->CurrentFinalizedIndex == 0) { + th->FinalizationCond.wait(&th->FinalizationLock); + } + th->FinalizationLock.unlock(); + + while (true) { + th->FinalizationQueueLock.acquire(); + if (th->CurrentFinalizedIndex != 0) { + res = th->ToBeFinalized[th->CurrentFinalizedIndex - 1]; + --th->CurrentFinalizedIndex; + } + th->FinalizationQueueLock.release(); + if (!res) break; + + mvm::VirtualTable* VT = res->getVirtualTable(); + ASSERT(VT->vm); + if (VT->operatorDelete) { + destructor_t dest = (destructor_t)VT->destructor; + dest(res); + } else { + invokeFinalize(res); + } + res = NULL; + } + } +} + +void FinalizerThread::tracer(uintptr_t closure) { + // (5) Trace the finalization queue. + for (uint32 i = 0; i < CurrentFinalizedIndex; ++i) { + mvm::Collector::markAndTraceRoot(ToBeFinalized + i, closure); + } + MutatorThread::tracer(closure); +} Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Mon Dec 6 11:43:31 2010 @@ -1,5 +1,6 @@ #include "mvm/VMKit.h" #include "mvm/VirtualMachine.h" +#include "mvm/SystemThreads.h" using namespace mvm; @@ -12,6 +13,19 @@ VMKit::VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { vms = 0; vmsArraySize = 0; + + // First create system threads. + finalizerThread = new FinalizerThread(this); + finalizerThread->start((void (*)(mvm::Thread*))FinalizerThread::finalizerStart); +} + +void VMKit::scanFinalizationQueue(uintptr_t closure) { + finalizerThread->scanFinalizationQueue(closure); +} + +void VMKit::addFinalizationCandidate(mvm::gc* object) { + llvm_gcroot(object, 0); + finalizerThread->addFinalizationCandidate(object); } void VMKit::tracer(uintptr_t closure) { @@ -36,6 +50,8 @@ // Lock thread lock, so that we can traverse the vm and thread lists safely. This will be released on finishRV. vmkitLock(); + finalizerThread->FinalizationQueueLock.acquire(); + // call first startCollection on each vm to avoid deadlock. // indeed, a vm could want to execute applicative code for(size_t i=0; iendCollection(); + finalizerThread->FinalizationQueueLock.release(); + finalizerThread->FinalizationCond.broadcast(); + vmkitUnlock(); } Modified: vmkit/branches/multi-vm/mmtk/mmtk-alloc/Selected.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-alloc/Selected.cpp?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-alloc/Selected.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-alloc/Selected.cpp Mon Dec 6 11:43:31 2010 @@ -11,6 +11,7 @@ #include "mvm/GC.h" #include "mvm/VirtualMachine.h" +#include "mvm/VMKit.h" #include #include @@ -58,7 +59,7 @@ extern "C" void addFinalizationCandidate(void* obj) { llvm_gcroot(obj, 0); - mvm::Thread::get()->MyVM->addFinalizationCandidate((gc*)obj); + mvm::Thread::get()->vmkit->addFinalizationCandidate((gc*)obj); } extern "C" void* gcmallocUnresolved(uint32_t sz, VirtualTable* VT) { Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/FinalizableProcessor.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/FinalizableProcessor.cpp?rev=121008&r1=121007&r2=121008&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/FinalizableProcessor.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/FinalizableProcessor.cpp Mon Dec 6 11:43:31 2010 @@ -10,6 +10,7 @@ #include "debug.h" #include "mvm/VirtualMachine.h" +#include "mvm/VMKit.h" #include "MMTkObject.h" namespace mmtk { @@ -26,7 +27,7 @@ extern "C" void Java_org_j3_mmtk_FinalizableProcessor_scan__Lorg_mmtk_plan_TraceLocal_2Z (MMTkObject* FP, MMTkObject* TL, uint8_t nursery) { mvm::Thread* th = mvm::Thread::get(); - th->MyVM->scanFinalizationQueue(reinterpret_cast(TL)); + th->vmkit->scanFinalizationQueue(reinterpret_cast(TL)); } } From gael.thomas at lip6.fr Mon Dec 6 15:30:15 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Mon, 06 Dec 2010 23:30:15 -0000 Subject: [vmkit-commits] [vmkit] r121065 - in /vmkit/branches/multi-vm: include/mvm/VirtualMachine.h lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/J3/VMCore/ReferenceQueue.cpp lib/J3/VMCore/ReferenceQueue.h lib/Mvm/Runtime/SystemThreads.cpp Message-ID: <20101206233015.198342A6C12C@llvm.org> Author: gthomas Date: Mon Dec 6 17:30:14 2010 New Revision: 121065 URL: http://llvm.org/viewvc/llvm-project?rev=121065&view=rev Log: remove java specific functions from ReferenceThread Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121065&r1=121064&r2=121065&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Mon Dec 6 17:30:14 2010 @@ -55,10 +55,6 @@ //===----------------------------------------------------------------------===// // (2) GC-related methods. //===----------------------------------------------------------------------===// - /// finalizeObject - invoke the finalizer of a java object - /// - virtual void finalizeObject(mvm::gc* obj) {} - /// startCollection - Preliminary code before starting a GC. /// virtual void startCollection() {} @@ -66,6 +62,24 @@ /// endCollection - Code after running a GC. /// virtual void endCollection() {} + + /// finalizeObject - invoke the finalizer of a java object + /// + virtual void finalizeObject(mvm::gc* obj) {} + + /// getReferentPtr - return the referent of a reference + /// + virtual mvm::gc** getReferent(mvm::gc* ref) { abort(); } + + /// setReferentPtr - set the referent of a reference + /// + virtual void setReferent(mvm::gc* ref, mvm::gc* val) { abort(); } + + /// enqueueReference - enqueue the reference + /// + virtual bool enqueueReference(mvm::gc* _obj) { abort(); } + + /// scanWeakReferencesQueue - Scan all weak references. Called by the GC /// before scanning the finalization queue. Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121065&r1=121064&r2=121065&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Mon Dec 6 17:30:14 2010 @@ -1076,7 +1076,7 @@ llvm_gcroot(javaLoader, 0); JnjvmClassLoader* loader = bootstrapLoader; - referenceThread = new ReferenceThread(this); + referenceThread = new ReferenceThread(vmkit); javaReferenceThread = new JavaThread(this, referenceThread); referenceThread->allVmsData[vmID] = javaReferenceThread; referenceThread->attach(this); @@ -1406,6 +1406,29 @@ meth->invokeIntVirtualBuf(this, cl, obj, 0); } +mvm::gc** Jnjvm::getReferent(mvm::gc* _obj) { + llvm_gcroot(_obj, 0); + JavaObjectReference* obj = (JavaObjectReference*)_obj; + llvm_gcroot(obj, 0); + return (mvm::gc**)JavaObjectReference::getReferentPtr(obj); +} + +void Jnjvm::setReferent(mvm::gc* _obj, mvm::gc* val) { + llvm_gcroot(_obj, 0); + JavaObjectReference* obj = (JavaObjectReference*)_obj; + llvm_gcroot(obj, 0); + llvm_gcroot(val, 0); + JavaObjectReference::setReferent(obj, (JavaObject*)val); +} + +bool Jnjvm::enqueueReference(mvm::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); +} + void Jnjvm::startCollection() { referenceThread->ToEnqueueLock.acquire(); referenceThread->SoftReferencesQueue.acquire(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121065&r1=121064&r2=121065&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Mon Dec 6 17:30:14 2010 @@ -314,7 +314,19 @@ /// finalizeObject - invoke the finalizer of a java object /// virtual void finalizeObject(mvm::gc* obj); - + + /// getReferentPtr - return the referent of a reference + /// + virtual mvm::gc** getReferent(mvm::gc* ref); + + /// setReferentPtr - set the referent of a reference + /// + virtual void setReferent(mvm::gc* ref, mvm::gc* val); + + /// enqueueReference - enqueue the reference + /// + virtual bool enqueueReference(mvm::gc* _obj); + /// setReferenceThread - Set the enqueue thread of this VM. /// void setReferenceThread(ReferenceThread* th) { referenceThread = th; } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp?rev=121065&r1=121064&r2=121065&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp Mon Dec 6 17:30:14 2010 @@ -15,33 +15,40 @@ using namespace j3; -ReferenceThread::ReferenceThread(Jnjvm* vm) : - MutatorThread(vm->vmkit), - WeakReferencesQueue(ReferenceQueue::WEAK), - SoftReferencesQueue(ReferenceQueue::SOFT), - PhantomReferencesQueue(ReferenceQueue::PHANTOM) { +ReferenceThread::ReferenceThread(mvm::VMKit* vmkit) : + MutatorThread(vmkit), + WeakReferencesQueue(ReferenceQueue::WEAK), + SoftReferencesQueue(ReferenceQueue::SOFT), + PhantomReferencesQueue(ReferenceQueue::PHANTOM) { ToEnqueue = new mvm::gc*[INITIAL_QUEUE_SIZE]; ToEnqueueLength = INITIAL_QUEUE_SIZE; ToEnqueueIndex = 0; - - MyVM = vm; } - -bool enqueueReference(mvm::gc* _obj) { - Jnjvm* vm = JavaThread::get()->getJVM(); - JavaObject* obj = (JavaObject*)_obj; +mvm::gc** getReferent(mvm::gc* obj) { llvm_gcroot(obj, 0); - JavaMethod* meth = vm->upcalls->EnqueueReference; - UserClass* cl = JavaObject::getClass(obj)->asClass(); - return (bool)meth->invokeIntSpecialBuf(vm, cl, obj, 0); + mvm::VirtualMachine* vm = obj->getVirtualTable()->vm; + mvm::Thread::get()->attach(vm); + return vm->getReferent(obj); } -void invokeEnqueue(mvm::gc* res) { - llvm_gcroot(res, 0); +void setReferent(mvm::gc* obj, mvm::gc* val) { + printf("set referent: %p %p\n", obj, val); + llvm_gcroot(obj, 0); + llvm_gcroot(val, 0); + mvm::VirtualMachine* vm = obj->getVirtualTable()->vm; + mvm::Thread::get()->attach(vm); + vm->setReferent(obj, val); +} + +void invokeEnqueue(mvm::gc* obj) { + llvm_gcroot(obj, 0); TRY { - enqueueReference(res); + mvm::VirtualMachine* vm = obj->getVirtualTable()->vm; + mvm::Thread::get()->attach(vm); + + vm->enqueueReference(obj); } IGNORE; mvm::Thread::get()->clearPendingException(); } @@ -92,32 +99,13 @@ ToEnqueue[ToEnqueueIndex++] = obj; } -mvm::gc** getReferentPtr(mvm::gc* _obj) { - JavaObjectReference* obj = (JavaObjectReference*)_obj; - llvm_gcroot(obj, 0); - return (mvm::gc**)JavaObjectReference::getReferentPtr(obj); -} - -void setReferent(mvm::gc* _obj, mvm::gc* val) { - JavaObjectReference* obj = (JavaObjectReference*)_obj; - llvm_gcroot(obj, 0); - llvm_gcroot(val, 0); - JavaObjectReference::setReferent(obj, (JavaObject*)val); -} - -void clearReferent(mvm::gc* _obj) { - JavaObjectReference* obj = (JavaObjectReference*)_obj; - llvm_gcroot(obj, 0); - JavaObjectReference::setReferent(obj, NULL); -} - mvm::gc* ReferenceQueue::processReference(mvm::gc* reference, ReferenceThread* th, uintptr_t closure) { if (!mvm::Collector::isLive(reference, closure)) { - clearReferent(reference); + setReferent(reference, 0); return NULL; } - mvm::gc* referent = *(getReferentPtr(reference)); + mvm::gc* referent = *(getReferent(reference)); if (!referent) { return NULL; @@ -139,7 +127,7 @@ setReferent(newReference, newReferent); return newReference; } else { - clearReferent(newReference); + setReferent(newReference, 0); th->addToEnqueue(newReference); return NULL; } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h?rev=121065&r1=121064&r2=121065&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h Mon Dec 6 17:30:14 2010 @@ -131,7 +131,7 @@ PhantomReferencesQueue.addReference(ref); } - ReferenceThread(Jnjvm* vm); + ReferenceThread(mvm::VMKit* vmkit); virtual void localDestroy() { delete[] ToEnqueue; Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp?rev=121065&r1=121064&r2=121065&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp Mon Dec 6 17:30:14 2010 @@ -80,17 +80,13 @@ typedef void (*destructor_t)(void*); -void invokeFinalizer(mvm::gc* obj) { +void invokeFinalize(mvm::gc* obj) { llvm_gcroot(obj, 0); - VirtualMachine* vm = obj->getVirtualTable()->vm; //JavaThread::get()->getJVM(); - mvm::Thread::get()->attach(vm); - vm->finalizeObject(obj); -} - -void invokeFinalize(mvm::gc* res) { - llvm_gcroot(res, 0); TRY { - invokeFinalizer(res); + llvm_gcroot(obj, 0); + VirtualMachine* vm = obj->getVirtualTable()->vm; //JavaThread::get()->getJVM(); + mvm::Thread::get()->attach(vm); + vm->finalizeObject(obj); } IGNORE; mvm::Thread::get()->clearPendingException(); } From gael.thomas at lip6.fr Tue Dec 7 02:32:29 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 10:32:29 -0000 Subject: [vmkit-commits] [vmkit] r121128 - in /vmkit/branches/multi-vm/lib/J3: Classpath/JavaUpcalls.cpp VMCore/Jnjvm.cpp VMCore/Jnjvm.h Message-ID: <20101207103229.932D62A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 04:32:29 2010 New Revision: 121128 URL: http://llvm.org/viewvc/llvm-project?rev=121128&view=rev Log: lazily allocate the java thread specific data of ReferenceThread Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp?rev=121128&r1=121127&r2=121128&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp Tue Dec 7 04:32:29 2010 @@ -297,10 +297,6 @@ initGroup->invokeIntSpecial(vm, threadGroup, SystemGroup); systemName = vm->asciizToStr("system"); groupName->setInstanceObjectField(SystemGroup, systemName); - - // Create the enqueue thread. - assert(vm->getReferenceThread() && "VM did not set its enqueue thread"); - CreateJavaThread(vm, vm->javaReferenceThread, "Reference", SystemGroup); } extern "C" void Java_java_lang_ref_WeakReference__0003Cinit_0003E__Ljava_lang_Object_2( Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121128&r1=121127&r2=121128&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Tue Dec 7 04:32:29 2010 @@ -1077,9 +1077,9 @@ JnjvmClassLoader* loader = bootstrapLoader; referenceThread = new ReferenceThread(vmkit); - javaReferenceThread = new JavaThread(this, referenceThread); - referenceThread->allVmsData[vmID] = javaReferenceThread; - referenceThread->attach(this); + //javaReferenceThread = new JavaThread(this, referenceThread); + //referenceThread->allVmsData[vmID] = javaReferenceThread; + //referenceThread->attach(this); referenceThread->start( (void (*)(mvm::Thread*))ReferenceThread::enqueueStart); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121128&r1=121127&r2=121128&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Tue Dec 7 04:32:29 2010 @@ -246,10 +246,6 @@ /// javaMainThread - the java main thread JavaThread* javaMainThread; - /// javaReferenceThread - the java reference thread - JavaThread* javaReferenceThread; - - mvm::VirtualTable* VMClassLoader__VT; void initialiseInternalVTs(); From gael.thomas at lip6.fr Tue Dec 7 02:49:30 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 10:49:30 -0000 Subject: [vmkit-commits] [vmkit] r121129 - in /vmkit/branches/multi-vm: include/mvm/SystemThreads.h include/mvm/Threads/Thread.h lib/J3/Classpath/ClasspathReflect.h lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/ReferenceQueue.cpp lib/J3/VMCore/ReferenceQueue.h lib/Mvm/CommonThread/ctthread.cpp Message-ID: <20101207104930.F2C8B2A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 04:49:30 2010 New Revision: 121129 URL: http://llvm.org/viewvc/llvm-project?rev=121129&view=rev Log: uses operator delete/destructor to release a thread Modified: vmkit/branches/multi-vm/include/mvm/SystemThreads.h vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathReflect.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Modified: vmkit/branches/multi-vm/include/mvm/SystemThreads.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/SystemThreads.h?rev=121129&r1=121128&r2=121129&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/SystemThreads.h (original) +++ vmkit/branches/multi-vm/include/mvm/SystemThreads.h Tue Dec 7 04:49:30 2010 @@ -74,7 +74,7 @@ FinalizerThread(VMKit* vmkit); - virtual void localDestroy() { + ~FinalizerThread() { delete[] FinalizationQueue; delete[] ToBeFinalized; } Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=121129&r1=121128&r2=121129&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Tue Dec 7 04:49:30 2010 @@ -311,15 +311,8 @@ /// Thread. The thread object is inlined in the stack. /// void* operator new(size_t sz); - void operator delete(void* th) { UNREACHABLE(); } - - /// localDestroy - call by releaseThread. Used for sub classes. - /// - virtual void localDestroy() {} - - /// releaseThread - Free the stack so that another thread can use it. - /// - static void releaseThread(mvm::Thread* th); + void operator delete(void* th); + virtual ~Thread(); /// routine - The function to invoke when the thread starts. /// Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathReflect.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathReflect.h?rev=121129&r1=121128&r2=121129&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathReflect.h (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathReflect.h Tue Dec 7 04:49:30 2010 @@ -151,7 +151,7 @@ public: static void staticDestructor(JavaObjectVMThread* obj) { llvm_gcroot(obj, 0); - mvm::Thread::releaseThread(obj->vmdata->mut); + delete obj->vmdata->mut; } static void staticTracer(JavaObjectVMThread* obj, uintptr_t closure) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121129&r1=121128&r2=121129&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Tue Dec 7 04:49:30 2010 @@ -1077,9 +1077,6 @@ JnjvmClassLoader* loader = bootstrapLoader; referenceThread = new ReferenceThread(vmkit); - //javaReferenceThread = new JavaThread(this, referenceThread); - //referenceThread->allVmsData[vmID] = javaReferenceThread; - //referenceThread->attach(this); referenceThread->start( (void (*)(mvm::Thread*))ReferenceThread::enqueueStart); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp?rev=121129&r1=121128&r2=121129&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp Tue Dec 7 04:49:30 2010 @@ -48,6 +48,7 @@ mvm::VirtualMachine* vm = obj->getVirtualTable()->vm; mvm::Thread::get()->attach(vm); + printf("enqueue reference: %p\n", obj); vm->enqueueReference(obj); } IGNORE; mvm::Thread::get()->clearPendingException(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h?rev=121129&r1=121128&r2=121129&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h Tue Dec 7 04:49:30 2010 @@ -133,7 +133,7 @@ ReferenceThread(mvm::VMKit* vmkit); - virtual void localDestroy() { + virtual ~ReferenceThread() { delete[] ToEnqueue; } }; Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=121129&r1=121128&r2=121129&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Tue Dec 7 04:49:30 2010 @@ -517,21 +517,23 @@ return res; } -/// releaseThread - Remove the stack of the thread from the list of stacks -/// in use. -void Thread::releaseThread(mvm::Thread* th) { +void Thread::operator delete(void* th) { + printf("deleting %p\n", th); + uintptr_t index = ((uintptr_t)th & Thread::IDMask); + index = (index & ~TheStackManager.baseAddr) >> 20; + TheStackManager.used[index] = 0; +} + +Thread::~Thread() { + printf("destroying %p\n", this); // 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; + void* thread_id = internalThreadID; if (thread_id != NULL) { // Wait for the thread to die. pthread_join((pthread_t)thread_id, NULL); } - th->localDestroy(); - th->vmkit->unregisterPreparedThread(th); - uintptr_t index = ((uintptr_t)th & Thread::IDMask); - index = (index & ~TheStackManager.baseAddr) >> 20; - TheStackManager.used[index] = 0; + vmkit->unregisterPreparedThread(this); } From gael.thomas at lip6.fr Tue Dec 7 03:08:03 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 11:08:03 -0000 Subject: [vmkit-commits] [vmkit] r121130 - in /vmkit/branches/multi-vm: include/mvm/SystemThreads.h include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/J3/Classpath/JavaUpcalls.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/J3/VMCore/ReferenceQueue.cpp lib/J3/VMCore/ReferenceQueue.h lib/J3/VMCore/VirtualTables.cpp lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/GCMmap2/gccollector.cpp lib/Mvm/Runtime/SystemThreads.cpp lib/Mvm/Runtime/VMKit.cpp mmtk/mmtk-j3/ReferenceProcessor.cpp Message-ID: <20101207110803.4F7332A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 05:08:02 2010 New Revision: 121130 URL: http://llvm.org/viewvc/llvm-project?rev=121130&view=rev Log: move the reference thread in vmkit Modified: vmkit/branches/multi-vm/include/mvm/SystemThreads.h vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/ReferenceProcessor.cpp Modified: vmkit/branches/multi-vm/include/mvm/SystemThreads.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/SystemThreads.h?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/SystemThreads.h (original) +++ vmkit/branches/multi-vm/include/mvm/SystemThreads.h Tue Dec 7 05:08:02 2010 @@ -11,6 +11,126 @@ namespace mvm { class VirtualMachine; +class ReferenceThread; +class Jnjvm; + +class ReferenceQueue { +private: + mvm::gc** References; + uint32 QueueLength; + uint32 CurrentIndex; + mvm::SpinLock QueueLock; + uint8_t semantics; + + mvm::gc* processReference(mvm::gc*, ReferenceThread*, 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 mvm::gc*[INITIAL_QUEUE_SIZE]; + memset(References, 0, INITIAL_QUEUE_SIZE * sizeof(mvm::gc*)); + QueueLength = INITIAL_QUEUE_SIZE; + CurrentIndex = 0; + semantics = s; + } + + ~ReferenceQueue() { + delete[] References; + } + + void addReference(mvm::gc* ref) { + llvm_gcroot(ref, 0); + QueueLock.acquire(); + if (CurrentIndex >= QueueLength) { + uint32 newLength = QueueLength * GROW_FACTOR; + mvm::gc** newQueue = new mvm::gc*[newLength]; + memset(newQueue, 0, newLength * sizeof(mvm::gc*)); + 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(); + } + + void scan(ReferenceThread* thread, uintptr_t closure); +}; + +class ReferenceThread : public mvm::MutatorThread { +public: + /// WeakReferencesQueue - The queue of weak references. + /// + ReferenceQueue WeakReferencesQueue; + + /// SoftReferencesQueue - The queue of soft references. + /// + ReferenceQueue SoftReferencesQueue; + + /// PhantomReferencesQueue - The queue of phantom references. + /// + ReferenceQueue PhantomReferencesQueue; + + mvm::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(mvm::gc* obj); + + static void enqueueStart(ReferenceThread*); + + /// addWeakReference - Add a weak reference to the queue. + /// + void addWeakReference(mvm::gc* ref) { + llvm_gcroot(ref, 0); + WeakReferencesQueue.addReference(ref); + } + + /// addSoftReference - Add a weak reference to the queue. + /// + void addSoftReference(mvm::gc* ref) { + llvm_gcroot(ref, 0); + SoftReferencesQueue.addReference(ref); + } + + /// addPhantomReference - Add a weak reference to the queue. + /// + void addPhantomReference(mvm::gc* ref) { + llvm_gcroot(ref, 0); + PhantomReferencesQueue.addReference(ref); + } + + ReferenceThread(mvm::VMKit* vmkit); + + virtual ~ReferenceThread() { + delete[] ToEnqueue; + } + + virtual void tracer(uintptr_t closure); +}; + class FinalizerThread : public mvm::MutatorThread { public: /// FinalizationQueueLock - A lock to protect access to the queue. Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Tue Dec 7 05:08:02 2010 @@ -10,6 +10,7 @@ class VMKit; class gc; class FinalizerThread; +class ReferenceThread; class FunctionMap { public: @@ -92,7 +93,13 @@ void registerRunningThread(mvm::Thread* th); void unregisterRunningThread(mvm::Thread* th); + /// enqueueThread - The thread that finalizes references. + /// FinalizerThread* finalizerThread; + + /// enqueueThread - The thread that enqueues references. + /// + ReferenceThread* referenceThread; /// scanFinalizationQueue - Scan objets with a finalized method and schedule /// them for finalization if they are not live. @@ -103,6 +110,21 @@ /// a finalization method. /// void addFinalizationCandidate(gc* object); + + /// scanWeakReferencesQueue - Scan all weak references. Called by the GC + /// before scanning the finalization queue. + /// + void scanWeakReferencesQueue(uintptr_t closure); + + /// scanSoftReferencesQueue - Scan all soft references. Called by the GC + /// before scanning the finalization queue. + /// + void scanSoftReferencesQueue(uintptr_t closure); + + /// scanPhantomReferencesQueue - Scan all phantom references. Called by the GC + /// after the finalization queue. + /// + void scanPhantomReferencesQueue(uintptr_t closure); /// ------------------------------------------------- /// /// --- collection managment --- /// Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Tue Dec 7 05:08:02 2010 @@ -79,23 +79,6 @@ /// virtual bool enqueueReference(mvm::gc* _obj) { abort(); } - - - /// scanWeakReferencesQueue - Scan all weak references. Called by the GC - /// before scanning the finalization queue. - /// - virtual void scanWeakReferencesQueue(uintptr_t closure) {} - - /// scanSoftReferencesQueue - Scan all soft references. Called by the GC - /// before scanning the finalization queue. - /// - virtual void scanSoftReferencesQueue(uintptr_t closure) {} - - /// scanPhantomReferencesQueue - Scan all phantom references. Called by the GC - /// after the finalization queue. - /// - virtual void scanPhantomReferencesQueue(uintptr_t closure) {} - /// tracer - Trace this virtual machine's GC-objects. /// Called once by vm. If you have GC-objects in a thread specific data, redefine the tracer of your VMThreadData. /// Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp Tue Dec 7 05:08:02 2010 @@ -15,7 +15,8 @@ #include "JavaThread.h" #include "JavaUpcalls.h" #include "Jnjvm.h" -#include "ReferenceQueue.h" +#include "mvm/SystemThreads.h" +#include "mvm/VMKit.h" #define COMPILE_METHODS(cl) \ for (CommonClass::method_iterator i = cl->virtualMethods.begin(), \ @@ -307,7 +308,7 @@ BEGIN_NATIVE_EXCEPTION(0) JavaObjectReference::init(reference, referent, 0); - JavaThread::get()->getJVM()->getReferenceThread()->addWeakReference(reference); + mvm::Thread::get()->vmkit->referenceThread->addWeakReference(reference); END_NATIVE_EXCEPTION @@ -324,7 +325,7 @@ BEGIN_NATIVE_EXCEPTION(0) JavaObjectReference::init(reference, referent, queue); - JavaThread::get()->getJVM()->getReferenceThread()->addWeakReference(reference); + mvm::Thread::get()->vmkit->referenceThread->addWeakReference(reference); END_NATIVE_EXCEPTION @@ -338,7 +339,7 @@ BEGIN_NATIVE_EXCEPTION(0) JavaObjectReference::init(reference, referent, 0); - JavaThread::get()->getJVM()->getReferenceThread()->addSoftReference(reference); + mvm::Thread::get()->vmkit->referenceThread->addSoftReference(reference); END_NATIVE_EXCEPTION @@ -355,7 +356,7 @@ BEGIN_NATIVE_EXCEPTION(0) JavaObjectReference::init(reference, referent, queue); - JavaThread::get()->getJVM()->getReferenceThread()->addSoftReference(reference); + mvm::Thread::get()->vmkit->referenceThread->addSoftReference(reference); END_NATIVE_EXCEPTION @@ -372,7 +373,7 @@ BEGIN_NATIVE_EXCEPTION(0) JavaObjectReference::init(reference, referent, queue); - JavaThread::get()->getJVM()->getReferenceThread()->addPhantomReference(reference); + mvm::Thread::get()->vmkit->referenceThread->addPhantomReference(reference); END_NATIVE_EXCEPTION } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Tue Dec 7 05:08:02 2010 @@ -35,7 +35,6 @@ #include "LinkJavaRuntime.h" #include "LockedMap.h" #include "Reader.h" -#include "ReferenceQueue.h" #include "Zip.h" using namespace j3; @@ -1076,10 +1075,6 @@ llvm_gcroot(javaLoader, 0); JnjvmClassLoader* loader = bootstrapLoader; - referenceThread = new ReferenceThread(vmkit); - referenceThread->start( - (void (*)(mvm::Thread*))ReferenceThread::enqueueStart); - // Initialise the bootstrap class loader if it's not // done already. if (bootstrapLoader->upcalls->newString == NULL) { @@ -1425,34 +1420,7 @@ UserClass* cl = JavaObject::getClass(obj)->asClass(); return (bool)meth->invokeIntSpecialBuf(this, cl, obj, 0); } - -void Jnjvm::startCollection() { - referenceThread->ToEnqueueLock.acquire(); - referenceThread->SoftReferencesQueue.acquire(); - referenceThread->WeakReferencesQueue.acquire(); - referenceThread->PhantomReferencesQueue.acquire(); -} -void Jnjvm::endCollection() { - referenceThread->ToEnqueueLock.release(); - referenceThread->SoftReferencesQueue.release(); - referenceThread->WeakReferencesQueue.release(); - referenceThread->PhantomReferencesQueue.release(); - 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); -} - size_t Jnjvm::getObjectSize(mvm::gc* object) { // TODO: because this is called during GC, there is no need to do // llvm_gcroot. For clarity, it may be useful to have a special type Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Tue Dec 7 05:08:02 2010 @@ -121,16 +121,7 @@ UserClass* throwable; private: - - /// enqueueThread - The thread that enqueue Java references. - /// - 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 size_t getObjectSize(mvm::gc* obj); virtual const char* getObjectTypeName(mvm::gc* obj); @@ -322,14 +313,6 @@ /// enqueueReference - enqueue the reference /// virtual bool enqueueReference(mvm::gc* _obj); - - /// setReferenceThread - Set the enqueue thread of this VM. - /// - void setReferenceThread(ReferenceThread* th) { referenceThread = th; } - - /// getReferenceThread - Get the enqueue thread of this VM. - /// - ReferenceThread* getReferenceThread() const { return referenceThread; } /// ~Jnjvm - Destroy the JVM. /// Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp Tue Dec 7 05:08:02 2010 @@ -12,138 +12,3 @@ #include "JavaUpcalls.h" #include "Jnjvm.h" #include "ReferenceQueue.h" - -using namespace j3; - -ReferenceThread::ReferenceThread(mvm::VMKit* vmkit) : - MutatorThread(vmkit), - WeakReferencesQueue(ReferenceQueue::WEAK), - SoftReferencesQueue(ReferenceQueue::SOFT), - PhantomReferencesQueue(ReferenceQueue::PHANTOM) { - - ToEnqueue = new mvm::gc*[INITIAL_QUEUE_SIZE]; - ToEnqueueLength = INITIAL_QUEUE_SIZE; - ToEnqueueIndex = 0; -} - -mvm::gc** getReferent(mvm::gc* obj) { - llvm_gcroot(obj, 0); - mvm::VirtualMachine* vm = obj->getVirtualTable()->vm; - mvm::Thread::get()->attach(vm); - return vm->getReferent(obj); -} - -void setReferent(mvm::gc* obj, mvm::gc* val) { - printf("set referent: %p %p\n", obj, val); - llvm_gcroot(obj, 0); - llvm_gcroot(val, 0); - mvm::VirtualMachine* vm = obj->getVirtualTable()->vm; - mvm::Thread::get()->attach(vm); - vm->setReferent(obj, val); -} - -void invokeEnqueue(mvm::gc* obj) { - llvm_gcroot(obj, 0); - TRY { - mvm::VirtualMachine* vm = obj->getVirtualTable()->vm; - mvm::Thread::get()->attach(vm); - - printf("enqueue reference: %p\n", obj); - vm->enqueueReference(obj); - } IGNORE; - mvm::Thread::get()->clearPendingException(); -} - -void ReferenceThread::enqueueStart(ReferenceThread* th) { - mvm::gc* res = NULL; - llvm_gcroot(res, 0); - - while (true) { - th->EnqueueLock.lock(); - while (th->ToEnqueueIndex == 0) { - th->EnqueueCond.wait(&th->EnqueueLock); - } - th->EnqueueLock.unlock(); - - while (true) { - th->ToEnqueueLock.acquire(); - if (th->ToEnqueueIndex != 0) { - res = th->ToEnqueue[th->ToEnqueueIndex - 1]; - --th->ToEnqueueIndex; - } - th->ToEnqueueLock.release(); - if (!res) break; - - invokeEnqueue(res); - res = NULL; - } - } -} - - -void ReferenceThread::addToEnqueue(mvm::gc* obj) { - llvm_gcroot(obj, 0); - if (ToEnqueueIndex >= ToEnqueueLength) { - uint32 newLength = ToEnqueueLength * GROW_FACTOR; - mvm::gc** newQueue = new mvm::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; -} - -mvm::gc* ReferenceQueue::processReference(mvm::gc* reference, ReferenceThread* th, uintptr_t closure) { - if (!mvm::Collector::isLive(reference, closure)) { - setReferent(reference, 0); - return NULL; - } - - mvm::gc* referent = *(getReferent(reference)); - - if (!referent) { - return NULL; - } - - if (semantics == SOFT) { - // TODO: are we are out of memory? Consider that we always are for now. - if (false) { - mvm::Collector::retainReferent(referent, closure); - } - } else if (semantics == PHANTOM) { - // Nothing to do. - } - - mvm::gc* newReference = - mvm::Collector::getForwardedReference(reference, closure); - if (mvm::Collector::isLive(referent, closure)) { - mvm::gc* newReferent = mvm::Collector::getForwardedReferent(referent, closure); - setReferent(newReference, newReferent); - return newReference; - } else { - setReferent(newReference, 0); - th->addToEnqueue(newReference); - return NULL; - } -} - - -void ReferenceQueue::scan(ReferenceThread* th, uintptr_t closure) { - uint32 NewIndex = 0; - - for (uint32 i = 0; i < CurrentIndex; ++i) { - mvm::gc* obj = References[i]; - mvm::gc* res = processReference(obj, th, closure); - if (res) References[NewIndex++] = res; - } - - CurrentIndex = NewIndex; -} - Modified: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h Tue Dec 7 05:08:02 2010 @@ -20,124 +20,6 @@ namespace j3 { -class ReferenceThread; -class Jnjvm; - -class ReferenceQueue { -private: - mvm::gc** References; - uint32 QueueLength; - uint32 CurrentIndex; - mvm::SpinLock QueueLock; - uint8_t semantics; - - mvm::gc* processReference(mvm::gc*, ReferenceThread*, 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 mvm::gc*[INITIAL_QUEUE_SIZE]; - memset(References, 0, INITIAL_QUEUE_SIZE * sizeof(mvm::gc*)); - QueueLength = INITIAL_QUEUE_SIZE; - CurrentIndex = 0; - semantics = s; - } - - ~ReferenceQueue() { - delete[] References; - } - - void addReference(mvm::gc* ref) { - llvm_gcroot(ref, 0); - QueueLock.acquire(); - if (CurrentIndex >= QueueLength) { - uint32 newLength = QueueLength * GROW_FACTOR; - mvm::gc** newQueue = new mvm::gc*[newLength]; - memset(newQueue, 0, newLength * sizeof(mvm::gc*)); - 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(); - } - - void scan(ReferenceThread* thread, uintptr_t closure); -}; - -class ReferenceThread : public mvm::MutatorThread { -public: - /// WeakReferencesQueue - The queue of weak references. - /// - ReferenceQueue WeakReferencesQueue; - - /// SoftReferencesQueue - The queue of soft references. - /// - ReferenceQueue SoftReferencesQueue; - - /// PhantomReferencesQueue - The queue of phantom references. - /// - ReferenceQueue PhantomReferencesQueue; - - mvm::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(mvm::gc* obj); - - static void enqueueStart(ReferenceThread*); - - /// addWeakReference - Add a weak reference to the queue. - /// - void addWeakReference(mvm::gc* ref) { - llvm_gcroot(ref, 0); - WeakReferencesQueue.addReference(ref); - } - - /// addSoftReference - Add a weak reference to the queue. - /// - void addSoftReference(mvm::gc* ref) { - llvm_gcroot(ref, 0); - SoftReferencesQueue.addReference(ref); - } - - /// addPhantomReference - Add a weak reference to the queue. - /// - void addPhantomReference(mvm::gc* ref) { - llvm_gcroot(ref, 0); - PhantomReferencesQueue.addReference(ref); - } - - ReferenceThread(mvm::VMKit* vmkit); - - virtual ~ReferenceThread() { - delete[] ToEnqueue; - } -}; - } // namespace j3 #endif //J3_REFERENCE_QUEUE_H Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Tue Dec 7 05:08:02 2010 @@ -291,11 +291,6 @@ mvm::Collector::markAndTraceRoot(key, 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 < mvm::LockSystem::GlobalSize; i++) { Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Tue Dec 7 05:08:02 2010 @@ -518,14 +518,12 @@ } void Thread::operator delete(void* th) { - printf("deleting %p\n", th); uintptr_t index = ((uintptr_t)th & Thread::IDMask); index = (index & ~TheStackManager.baseAddr) >> 20; TheStackManager.used[index] = 0; } Thread::~Thread() { - printf("destroying %p\n", this); // 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. Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/gccollector.cpp Tue Dec 7 05:08:02 2010 @@ -9,6 +9,7 @@ #include "mvm/GC.h" #include "mvm/VMKit.h" +#include "mvm/SystemThreads.h" using namespace mvm; @@ -63,16 +64,16 @@ cur = cur->prev(); // (4) Trace the weak reference queue. - th->MyVM->scanWeakReferencesQueue(0); + th->vmkit->scanWeakReferencesQueue(0); // (5) Trace the soft reference queue. - th->MyVM->scanSoftReferencesQueue(0); + th->vmkit->scanSoftReferencesQueue(0); // (6) Trace the finalization queue. th->vmkit->scanFinalizationQueue(0); // (7) Trace the phantom reference queue. - th->MyVM->scanPhantomReferencesQueue(0); + th->vmkit->scanPhantomReferencesQueue(0); // (8) Trace the new objects added by queues. for(cur = cur->next(); cur != used_nodes; cur = cur->next()) Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp Tue Dec 7 05:08:02 2010 @@ -4,6 +4,144 @@ using namespace mvm; +ReferenceThread::ReferenceThread(mvm::VMKit* vmkit) : + MutatorThread(vmkit), + WeakReferencesQueue(ReferenceQueue::WEAK), + SoftReferencesQueue(ReferenceQueue::SOFT), + PhantomReferencesQueue(ReferenceQueue::PHANTOM) { + + ToEnqueue = new mvm::gc*[INITIAL_QUEUE_SIZE]; + ToEnqueueLength = INITIAL_QUEUE_SIZE; + ToEnqueueIndex = 0; +} + +mvm::gc** getReferent(mvm::gc* obj) { + llvm_gcroot(obj, 0); + mvm::VirtualMachine* vm = obj->getVirtualTable()->vm; + mvm::Thread::get()->attach(vm); + return vm->getReferent(obj); +} + +void setReferent(mvm::gc* obj, mvm::gc* val) { + llvm_gcroot(obj, 0); + llvm_gcroot(val, 0); + mvm::VirtualMachine* vm = obj->getVirtualTable()->vm; + mvm::Thread::get()->attach(vm); + vm->setReferent(obj, val); +} + +void invokeEnqueue(mvm::gc* obj) { + llvm_gcroot(obj, 0); + TRY { + mvm::VirtualMachine* vm = obj->getVirtualTable()->vm; + mvm::Thread::get()->attach(vm); + + vm->enqueueReference(obj); + } IGNORE; + mvm::Thread::get()->clearPendingException(); +} + +void ReferenceThread::enqueueStart(ReferenceThread* th) { + mvm::gc* res = NULL; + llvm_gcroot(res, 0); + + while (true) { + th->EnqueueLock.lock(); + while (th->ToEnqueueIndex == 0) { + th->EnqueueCond.wait(&th->EnqueueLock); + } + th->EnqueueLock.unlock(); + + while (true) { + th->ToEnqueueLock.acquire(); + if (th->ToEnqueueIndex != 0) { + res = th->ToEnqueue[th->ToEnqueueIndex - 1]; + --th->ToEnqueueIndex; + } + th->ToEnqueueLock.release(); + if (!res) break; + + invokeEnqueue(res); + res = NULL; + } + } +} + + +void ReferenceThread::addToEnqueue(mvm::gc* obj) { + llvm_gcroot(obj, 0); + if (ToEnqueueIndex >= ToEnqueueLength) { + uint32 newLength = ToEnqueueLength * GROW_FACTOR; + mvm::gc** newQueue = new mvm::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; +} + +mvm::gc* ReferenceQueue::processReference(mvm::gc* reference, ReferenceThread* th, uintptr_t closure) { + if (!mvm::Collector::isLive(reference, closure)) { + setReferent(reference, 0); + return NULL; + } + + mvm::gc* referent = *(getReferent(reference)); + + if (!referent) { + return NULL; + } + + if (semantics == SOFT) { + // TODO: are we are out of memory? Consider that we always are for now. + if (false) { + mvm::Collector::retainReferent(referent, closure); + } + } else if (semantics == PHANTOM) { + // Nothing to do. + } + + mvm::gc* newReference = + mvm::Collector::getForwardedReference(reference, closure); + if (mvm::Collector::isLive(referent, closure)) { + mvm::gc* newReferent = mvm::Collector::getForwardedReferent(referent, closure); + setReferent(newReference, newReferent); + return newReference; + } else { + setReferent(newReference, 0); + th->addToEnqueue(newReference); + return NULL; + } +} + + +void ReferenceQueue::scan(ReferenceThread* th, uintptr_t closure) { + uint32 NewIndex = 0; + + for (uint32 i = 0; i < CurrentIndex; ++i) { + mvm::gc* obj = References[i]; + mvm::gc* res = processReference(obj, th, closure); + if (res) References[NewIndex++] = res; + } + + CurrentIndex = NewIndex; +} + +void ReferenceThread::tracer(uintptr_t closure) { + for (uint32 i = 0; i < ToEnqueueIndex; ++i) { + mvm::Collector::markAndTraceRoot(ToEnqueue + i, closure); + } + MutatorThread::tracer(closure); +} + + FinalizerThread::FinalizerThread(VMKit* vmkit) : MutatorThread(vmkit) { FinalizationQueue = new mvm::gc*[INITIAL_QUEUE_SIZE]; QueueLength = INITIAL_QUEUE_SIZE; @@ -125,7 +263,6 @@ } void FinalizerThread::tracer(uintptr_t closure) { - // (5) Trace the finalization queue. for (uint32 i = 0; i < CurrentFinalizedIndex; ++i) { mvm::Collector::markAndTraceRoot(ToBeFinalized + i, closure); } Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Tue Dec 7 05:08:02 2010 @@ -17,6 +17,21 @@ // First create system threads. finalizerThread = new FinalizerThread(this); finalizerThread->start((void (*)(mvm::Thread*))FinalizerThread::finalizerStart); + + referenceThread = new ReferenceThread(this); + referenceThread->start((void (*)(mvm::Thread*))ReferenceThread::enqueueStart); +} + +void VMKit::scanWeakReferencesQueue(uintptr_t closure) { + referenceThread->WeakReferencesQueue.scan(referenceThread, closure); +} + +void VMKit::scanSoftReferencesQueue(uintptr_t closure) { + referenceThread->SoftReferencesQueue.scan(referenceThread, closure); +} + +void VMKit::scanPhantomReferencesQueue(uintptr_t closure) { + referenceThread->PhantomReferencesQueue.scan(referenceThread, closure); } void VMKit::scanFinalizationQueue(uintptr_t closure) { @@ -51,6 +66,10 @@ vmkitLock(); finalizerThread->FinalizationQueueLock.acquire(); + referenceThread->ToEnqueueLock.acquire(); + referenceThread->SoftReferencesQueue.acquire(); + referenceThread->WeakReferencesQueue.acquire(); + referenceThread->PhantomReferencesQueue.acquire(); // call first startCollection on each vm to avoid deadlock. // indeed, a vm could want to execute applicative code @@ -74,6 +93,11 @@ vms[i]->endCollection(); finalizerThread->FinalizationQueueLock.release(); + referenceThread->ToEnqueueLock.release(); + referenceThread->SoftReferencesQueue.release(); + referenceThread->WeakReferencesQueue.release(); + referenceThread->PhantomReferencesQueue.release(); + referenceThread->EnqueueCond.broadcast(); finalizerThread->FinalizationCond.broadcast(); vmkitUnlock(); Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/ReferenceProcessor.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/ReferenceProcessor.cpp?rev=121130&r1=121129&r2=121130&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/ReferenceProcessor.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/ReferenceProcessor.cpp Tue Dec 7 05:08:02 2010 @@ -10,6 +10,8 @@ #include "debug.h" #include "mvm/VirtualMachine.h" +#include "mvm/VMKit.h" +#include "mvm/SystemThreads.h" #include "MMTkObject.h" namespace mmtk { @@ -19,12 +21,12 @@ uint32_t val = RP->ordinal; if (val == 0) { - th->MyVM->scanSoftReferencesQueue(TL); + th->vmkit->scanSoftReferencesQueue(TL); } else if (val == 1) { - th->MyVM->scanWeakReferencesQueue(TL); + th->vmkit->scanWeakReferencesQueue(TL); } else { assert(val == 2); - th->MyVM->scanPhantomReferencesQueue(TL); + th->vmkit->scanPhantomReferencesQueue(TL); } } From gael.thomas at lip6.fr Tue Dec 7 04:01:55 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 12:01:55 -0000 Subject: [vmkit-commits] [vmkit] r121131 - in /vmkit/branches/multi-vm: lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/ReferenceQueue.cpp lib/J3/VMCore/ReferenceQueue.h lib/Mvm/Runtime/VMKit.cpp tools/vmjc/vmjc.cpp tools/vmkit/Launcher.cpp Message-ID: <20101207120155.627ED2A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 06:01:55 2010 New Revision: 121131 URL: http://llvm.org/viewvc/llvm-project?rev=121131&view=rev Log: initialise the gc in the constructor of vmkit. Remove the old ReferenceQueue.* files Removed: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=121131&r1=121130&r2=121131&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Tue Dec 7 06:01:55 2010 @@ -416,16 +416,18 @@ extern "C" int StartJnjvmWithJIT(int argc, char** argv, char* mainClass) { llvm::llvm_shutdown_obj X; + + mvm::BumpPtrAllocator Allocator; + mvm::MvmModule::initialise(); - mvm::Collector::initialise(); - mvm::ThreadAllocator allocator; - char** newArgv = (char**)allocator.Allocate((argc + 1) * sizeof(char*)); + mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); + + mvm::ThreadAllocator thallocator; + char** newArgv = (char**)thallocator.Allocate((argc + 1) * sizeof(char*)); memcpy(newArgv + 1, argv, argc * sizeof(void*)); newArgv[0] = newArgv[1]; newArgv[1] = mainClass; - mvm::BumpPtrAllocator Allocator; - mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule"); JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") JnjvmBootstrapLoader(Allocator, Comp, true); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121131&r1=121130&r2=121131&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Tue Dec 7 06:01:55 2010 @@ -1461,20 +1461,21 @@ // Helper function to run J3 without JIT. extern "C" int StartJnjvmWithoutJIT(int argc, char** argv, char* mainClass) { - mvm::Collector::initialise(); - mvm::ThreadAllocator allocator; - char** newArgv = (char**)allocator.Allocate((argc + 1) * sizeof(char*)); - memcpy(newArgv + 1, argv, argc * sizeof(char*)); - newArgv[0] = newArgv[1]; - newArgv[1] = mainClass; - mvm::BumpPtrAllocator Allocator; + mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); + JavaCompiler* Comp = new JavaCompiler(); JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") JnjvmBootstrapLoader(Allocator, Comp, true); Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader); + mvm::ThreadAllocator thallocator; + char** newArgv = (char**)thallocator.Allocate((argc + 1) * sizeof(char*)); + memcpy(newArgv + 1, argv, argc * sizeof(char*)); + newArgv[0] = newArgv[1]; + newArgv[1] = mainClass; + vm->runApplication(argc + 1, newArgv); vm->waitForExit(); Removed: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp?rev=121130&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.cpp (removed) @@ -1,14 +0,0 @@ -//===--ReferenceQueue.cpp - Implementation of soft/weak/phantom references-===// -// -// The VMKit project -// -// This file is distributed under the University of Pierre et Marie Curie -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "ClasspathReflect.h" -#include "JavaClass.h" -#include "JavaUpcalls.h" -#include "Jnjvm.h" -#include "ReferenceQueue.h" Removed: vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h?rev=121130&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/ReferenceQueue.h (removed) @@ -1,25 +0,0 @@ -//===---ReferenceQueue.h - Implementation of soft/weak/phantom references--===// -// -// The VMKit project -// -// This file is distributed under the University of Pierre et Marie Curie -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef J3_REFERENCE_QUEUE_H -#define J3_REFERENCE_QUEUE_H - -#include "mvm/Threads/Locks.h" - -#include "JavaThread.h" - -// Same values than JikesRVM -#define INITIAL_QUEUE_SIZE 256 -#define GROW_FACTOR 2 - -namespace j3 { - -} // namespace j3 - -#endif //J3_REFERENCE_QUEUE_H Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=121131&r1=121130&r2=121131&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Tue Dec 7 06:01:55 2010 @@ -1,6 +1,7 @@ #include "mvm/VMKit.h" #include "mvm/VirtualMachine.h" #include "mvm/SystemThreads.h" +#include "mvm/GC.h" using namespace mvm; @@ -10,7 +11,18 @@ #define dprintf(...) #endif +static SpinLock initedLock; +static bool inited = false; + VMKit::VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { + initedLock.lock(); + if(!inited) { + inited = true; + //mvm::MvmModule::initialise(); + mvm::Collector::initialise(); + } + initedLock.unlock(); + vms = 0; vmsArraySize = 0; @@ -115,7 +127,7 @@ } int res = vmsArraySize; - vmsArraySize = vmsArraySize ? (vmsArraySize<<1) : 4; + vmsArraySize = vmsArraySize ? (vmsArraySize<<1) : 1; // reallocate the vms VirtualMachine **newVms = new VirtualMachine*[vmsArraySize]; Modified: vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp?rev=121131&r1=121130&r2=121131&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp (original) +++ vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp Tue Dec 7 06:01:55 2010 @@ -174,11 +174,12 @@ mvm::MvmModule::initialise(); } + mvm::BumpPtrAllocator allocator; + JavaAOTCompiler* Comp = new JavaAOTCompiler("AOT"); - mvm::Collector::initialise(); + mvm::VMKit* vmkit = new(allocator, "VMKit") mvm::VMKit(allocator); - mvm::BumpPtrAllocator allocator; JnjvmBootstrapLoader* loader = new(allocator, "Bootstrap loader") JnjvmBootstrapLoader(allocator, Comp, false); @@ -187,7 +188,6 @@ if (AssumeCompiled) Comp->assumeCompiled = true; if (DisableCooperativeGC) Comp->disableCooperativeGC(); - mvm::VMKit* vmkit = new(allocator, "VMKit") mvm::VMKit(allocator); Jnjvm* vm = new(allocator, "Bootstrap loader") Jnjvm(allocator, vmkit, loader); for (std::vector::iterator i = Properties.begin(), Modified: vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp?rev=121131&r1=121130&r2=121131&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp (original) +++ vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Tue Dec 7 06:01:55 2010 @@ -66,15 +66,15 @@ return 0; } + mvm::BumpPtrAllocator Allocator; + mvm::MvmModule::initialise(Fast ? CodeGenOpt::None : CodeGenOpt::Aggressive); - mvm::Collector::initialise(); + mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); if (VMToRun == RunJava) { - mvm::BumpPtrAllocator Allocator; JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule"); JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") - JnjvmBootstrapLoader(Allocator, Comp, true); - mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); + JnjvmBootstrapLoader(Allocator, Comp, true); Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader); vm->runApplication(argc, argv); vm->waitForExit(); From gael.thomas at lip6.fr Tue Dec 7 04:25:19 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 12:25:19 -0000 Subject: [vmkit-commits] [vmkit] r121132 - in /vmkit/branches/multi-vm: include/mvm/VMKit.h lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/VMCore/VirtualTables.cpp lib/Mvm/Runtime/VMKit.cpp tools/j3/Main.cpp tools/vmjc/vmjc.cpp tools/vmkit/Launcher.cpp Message-ID: <20101207122519.DCC542A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 06:25:19 2010 New Revision: 121132 URL: http://llvm.org/viewvc/llvm-project?rev=121132&view=rev Log: initialise the gc and MvmModule in vmkit Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/tools/j3/Main.cpp vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=121132&r1=121131&r2=121132&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Tue Dec 7 06:25:19 2010 @@ -5,6 +5,13 @@ #include "mvm/Threads/CollectionRV.h" #include "mvm/VirtualMachine.h" +#include "llvm/Target/TargetMachine.h" + +namespace llvm { + class Module; + class TargetMachine; +} + namespace mvm { class MethodInfo; class VMKit; @@ -43,6 +50,11 @@ /// allocator - Bump pointer allocator to allocate permanent memory of VMKit mvm::BumpPtrAllocator& allocator; + // initialise - initialise vmkit. If never called, will be called by the first constructor of vmkit + static void initialise(llvm::CodeGenOpt::Level = llvm::CodeGenOpt::Default, + llvm::Module* TheModule = 0, + llvm::TargetMachine* TheTarget = 0); + VMKit(mvm::BumpPtrAllocator &Alloc); LockNormal _vmkitLock; Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=121132&r1=121131&r2=121132&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Tue Dec 7 06:25:19 2010 @@ -415,11 +415,8 @@ // Helper function to run an executable with a JIT extern "C" int StartJnjvmWithJIT(int argc, char** argv, char* mainClass) { llvm::llvm_shutdown_obj X; - mvm::BumpPtrAllocator Allocator; - - mvm::MvmModule::initialise(); mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); mvm::ThreadAllocator thallocator; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=121132&r1=121131&r2=121132&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Tue Dec 7 06:25:19 2010 @@ -30,7 +30,6 @@ #include "Jnjvm.h" #include "JnjvmClassLoader.h" #include "LockedMap.h" -#include "ReferenceQueue.h" #include "Zip.h" using namespace j3; Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=121132&r1=121131&r2=121132&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Tue Dec 7 06:25:19 2010 @@ -2,6 +2,7 @@ #include "mvm/VirtualMachine.h" #include "mvm/SystemThreads.h" #include "mvm/GC.h" +#include "mvm/JIT.h" using namespace mvm; @@ -14,14 +15,18 @@ static SpinLock initedLock; static bool inited = false; -VMKit::VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { +void VMKit::initialise(llvm::CodeGenOpt::Level level, llvm::Module* TheModule, llvm::TargetMachine* TheTarget) { initedLock.lock(); if(!inited) { inited = true; - //mvm::MvmModule::initialise(); + mvm::MvmModule::initialise(level, TheModule, TheTarget); mvm::Collector::initialise(); } initedLock.unlock(); +} + +VMKit::VMKit(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { + initialise(); vms = 0; vmsArraySize = 0; Modified: vmkit/branches/multi-vm/tools/j3/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/j3/Main.cpp?rev=121132&r1=121131&r2=121132&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/j3/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/j3/Main.cpp Tue Dec 7 06:25:19 2010 @@ -29,18 +29,16 @@ llvm::llvm_shutdown_obj X; // Initialize base components. - MvmModule::initialise(); - Collector::initialise(); + mvm::BumpPtrAllocator Allocator; + mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); // Tell the compiler to run all optimizations. StandardCompileOpts = true; // Create the allocator that will allocate the bootstrap loader and the JVM. - mvm::BumpPtrAllocator Allocator; JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule"); JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") JnjvmBootstrapLoader(Allocator, Comp, true); - mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader); // Run the application. Modified: vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp?rev=121132&r1=121131&r2=121132&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp (original) +++ vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp Tue Dec 7 06:25:19 2010 @@ -118,7 +118,7 @@ cl::PrintHelpMessage(); return 0; } - + // Disable cross-compiling for now. if (false) { Module* TheModule = new Module("bootstrap module", @@ -168,18 +168,15 @@ getStringRepresentation()); - mvm::MvmModule::initialise(CodeGenOpt::Default, TheModule, &Target); + mvm::VMKit::initialise(CodeGenOpt::Default, TheModule, &Target); #endif - } else { - mvm::MvmModule::initialise(); } mvm::BumpPtrAllocator allocator; + mvm::VMKit* vmkit = new(allocator, "VMKit") mvm::VMKit(allocator); JavaAOTCompiler* Comp = new JavaAOTCompiler("AOT"); - mvm::VMKit* vmkit = new(allocator, "VMKit") mvm::VMKit(allocator); - JnjvmBootstrapLoader* loader = new(allocator, "Bootstrap loader") JnjvmBootstrapLoader(allocator, Comp, false); Modified: vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp?rev=121132&r1=121131&r2=121132&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp (original) +++ vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Tue Dec 7 06:25:19 2010 @@ -68,7 +68,7 @@ mvm::BumpPtrAllocator Allocator; - mvm::MvmModule::initialise(Fast ? CodeGenOpt::None : CodeGenOpt::Aggressive); + mvm::VMKit::initialise(Fast ? CodeGenOpt::None : CodeGenOpt::Aggressive); mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); if (VMToRun == RunJava) { From gael.thomas at lip6.fr Tue Dec 7 07:02:20 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 15:02:20 -0000 Subject: [vmkit-commits] [vmkit] r121134 - in /vmkit/branches/multi-vm/lib: J3/Classpath/ClasspathVMRuntime.inc J3/Compiler/JavaAOTCompiler.cpp J3/Compiler/JavaJIT.cpp J3/Compiler/JavaJITCompiler.cpp J3/Compiler/LowerConstantCalls.cpp J3/VMCore/JavaClass.cpp J3/VMCore/JavaClass.h J3/VMCore/JavaRuntimeJIT.cpp J3/VMCore/JnjvmConfig.h Mvm/CommonThread/ctthread.cpp Message-ID: <20101207150221.16DA02A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 09:02:20 2010 New Revision: 121134 URL: http://llvm.org/viewvc/llvm-project?rev=121134&view=rev Log: remove all ISOLATE-depend code Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/branches/multi-vm/lib/J3/Compiler/LowerConstantCalls.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmConfig.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc?rev=121134&r1=121133&r2=121134&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc Tue Dec 7 09:02:20 2010 @@ -181,7 +181,7 @@ jclass clazz, #endif jint par1) { -#if defined(ISOLATE) || defined(ISOLATE_SHARING) +#if defined(ISOLATE_SHARING) // TODO: do a longjmp exit(par1); #else Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121134&r1=121133&r2=121134&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Tue Dec 7 09:02:20 2010 @@ -228,10 +228,6 @@ } Constant* JavaAOTCompiler::getJavaClassPtr(CommonClass* cl) { -#ifdef ISOLATE - abort(); - return 0; -#else // Make sure it's emitted. getJavaClass(cl); @@ -248,7 +244,6 @@ Constant* Ptr = ConstantExpr::getGetElementPtr(TCMArray, GEP2, 2); return Ptr; -#endif } JavaObject* JavaAOTCompiler::getFinalObject(llvm::Value* obj) { @@ -476,10 +471,6 @@ } Constant* JavaAOTCompiler::getStaticInstance(Class* classDef) { -#ifdef ISOLATE - assert(0 && "Should not be here"); - abort(); -#endif static_instance_iterator End = staticInstances.end(); static_instance_iterator I = staticInstances.find(classDef); if (I == End) { Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp?rev=121134&r1=121133&r2=121134&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp Tue Dec 7 09:02:20 2010 @@ -1373,10 +1373,7 @@ uint8 type = ctpInfo->typeAt(index); if (type == JavaConstantPool::ConstantString) { -#if defined(ISOLATE) - abort(); -#else - + if (TheCompiler->isStaticCompiling()) { const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]); JavaString* str = *(compilingClass->classLoader->UTF8ToStr(utf8)); @@ -1397,7 +1394,7 @@ push(val, false, upcalls->newString); } } -#endif + } else if (type == JavaConstantPool::ConstantLong) { push(ConstantInt::get(Type::getInt64Ty(*llvmContext), ctpInfo->LongAt(index)), false); @@ -1978,7 +1975,7 @@ Cl = invoke(intrinsics->InitialisationCheckFunction, Cl, "", currentBlock); } -#if !defined(ISOLATE) && !defined(ISOLATE_SHARING) +#if !defined(ISOLATE_SHARING) if (needsCheck) { CallInst::Create(intrinsics->ForceInitialisationCheckFunction, Cl, "", currentBlock); @@ -2085,7 +2082,7 @@ Value* ptr = ldResolved(index, true, NULL, LAI.llvmTypePtr); bool final = false; -#if !defined(ISOLATE) && !defined(ISOLATE_SHARING) +#if !defined(ISOLATE_SHARING) JnjvmBootstrapLoader* JBL = compilingClass->classLoader->bootstrapLoader; if (!compilingMethod->name->equals(JBL->clinitName)) { JavaField* field = compilingClass->ctpInfo->lookupField(index, true); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=121134&r1=121133&r2=121134&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Tue Dec 7 09:02:20 2010 @@ -155,10 +155,6 @@ } Constant* JavaJITCompiler::getStaticInstance(Class* classDef) { -#ifdef ISOLATE - assert(0 && "Should not be here"); - abort(); -#endif void* obj = classDef->getStaticInstance(); if (!obj) { classDef->acquire(); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/LowerConstantCalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/LowerConstantCalls.cpp?rev=121134&r1=121133&r2=121134&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/LowerConstantCalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/LowerConstantCalls.cpp Tue Dec 7 09:02:20 2010 @@ -42,59 +42,6 @@ #endif -#ifdef ISOLATE -static Value* getTCM(J3Intrinsics* intrinsics, Value* Arg, Instruction* CI) { - Value* GEP[2] = { intrinsics->constantZero, - intrinsics->OffsetTaskClassMirrorInClassConstant }; - Value* TCMArray = GetElementPtrInst::Create(Arg, GEP, GEP + 2, "", CI); - - Value* threadId = CallInst::Create(intrinsics->llvm_frameaddress, - intrinsics->constantZero, "", CI); - threadId = new PtrToIntInst(threadId, intrinsics->pointerSizeType, "", CI); - threadId = BinaryOperator::CreateAnd(threadId, intrinsics->constantThreadIDMask, - "", CI); - - threadId = new IntToPtrInst(threadId, intrinsics->ptr32Type, "", CI); - - Value* GEP1[2] = { intrinsics->OffsetThreadInMutatorThreadConstant, intrinsics->OffsetIsolateInThreadConstant } - Value* IsolateID = GetElementPtrInst::Create(threadId, GEP1, GEP1 + 2, "", CI); - - IsolateID = new LoadInst(IsolateID, "", CI); - - Value* GEP2[2] = { intrinsics->constantZero, IsolateID }; - - Value* TCM = GetElementPtrInst::Create(TCMArray, GEP2, GEP2 + 2, "", - CI); - return TCM; -} - -static Value* getDelegatee(J3Intrinsics* intrinsics, Value* Arg, Instruction* CI) { - Value* GEP[2] = { intrinsics->constantZero, - intrinsics->constantTwo }; - Value* TCMArray = GetElementPtrInst::Create(Arg, GEP, GEP + 2, "", CI); - - Value* threadId = CallInst::Create(intrinsics->llvm_frameaddress, - intrinsics->constantZero, "", CI); - threadId = new PtrToIntInst(threadId, intrinsics->pointerSizeType, "", CI); - threadId = BinaryOperator::CreateAnd(threadId, intrinsics->constantThreadIDMask, - "", CI); - - threadId = new IntToPtrInst(threadId, intrinsics->ptr32Type, "", CI); - - Value* GEP1[2] = { intrinsics->OffsetThreadInMutatorThreadConstant, intrinsics->OffsetIsolateInThreadConstant } - Value* IsolateID = GetElementPtrInst::Create(threadId, GEP1, GEP1 + 2, "", CI); - - IsolateID = new LoadInst(IsolateID, "", CI); - - Value* GEP2[2] = { intrinsics->constantZero, IsolateID }; - - Value* TCM = GetElementPtrInst::Create(TCMArray, GEP2, GEP2 + 2, "", - CI); - return new LoadInst(TCM, "", CI); -} - -#else - static Value* getTCM(J3Intrinsics* intrinsics, Value* Arg, Instruction* CI) { Value* GEP[2] = { intrinsics->constantZero, intrinsics->OffsetTaskClassMirrorInClassConstant }; @@ -120,7 +67,6 @@ return new LoadInst(TCM, "", CI); } -#endif bool LowerConstantCalls::runOnFunction(Function& F) { LLVMContext* Context = &F.getContext(); @@ -362,18 +308,6 @@ Value* Class = new LoadInst(ClassPtr, "", CI); CI->replaceAllUsesWith(Class); CI->eraseFromParent(); -#if defined(ISOLATE) - } else if (V == intrinsics->GetStaticInstanceFunction) { - Changed = true; - - Value* TCM = getTCM(intrinsics, Call.getArgument(0), CI); - Constant* C = intrinsics->OffsetStaticInstanceInTaskClassMirrorConstant; - Value* GEP[2] = { intrinsics->constantZero, C }; - Value* Replace = GetElementPtrInst::Create(TCM, GEP, GEP + 2, "", CI); - Replace = new LoadInst(Replace, "", CI); - CI->replaceAllUsesWith(Replace); - CI->eraseFromParent(); -#endif } else if (V == intrinsics->GetClassDelegateeFunction) { Changed = true; BasicBlock* NBB = II->getParent()->splitBasicBlock(II); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp?rev=121134&r1=121133&r2=121134&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp Tue Dec 7 09:02:20 2010 @@ -925,11 +925,6 @@ } #ifndef ISOLATE_SHARING -#ifdef ISOLATE -void Class::resolveClass() { - UNIMPLEMENTED(); -} -#else void Class::resolveClass() { if (isResolved() || isErroneous()) return; resolveParents(); @@ -939,7 +934,6 @@ &(getCurrentTaskClassMirror().status), loaded, resolved); assert(isResolved() || isErroneous()); } -#endif #else void Class::resolveClass() { assert(status >= resolved && @@ -1044,34 +1038,6 @@ } } - -#ifdef ISOLATE -TaskClassMirror& Class::getCurrentTaskClassMirror() { - return IsolateInfo[JavaThread::get()->getJVM()->IsolateID]; -} - -JavaObject* CommonClass::getDelegatee() { - return delegatee[JavaThread::get()->getJVM()->IsolateID]; -} - -JavaObject** CommonClass::getDelegateePtr() { - return &(delegatee[JavaThread::get()->getJVM()->IsolateID]); -} - -JavaObject* CommonClass::setDelegatee(JavaObject* val) { - JavaObject* prev = NULL; - llvm_gcroot(val, 0); - llvm_gcroot(prev, 0); - JavaObject** obj = &(delegatee[JavaThread::get()->getJVM()->IsolateID]); - - prev = (JavaObject*)__sync_val_compare_and_swap((uintptr_t)obj, NULL, val); - - if (!prev) return val; - else return prev; -} - -#else - JavaObject* CommonClass::setDelegatee(JavaObject* val) { JavaObject* prev = NULL; llvm_gcroot(val, 0); @@ -1082,8 +1048,6 @@ else return prev; } -#endif - UserCommonClass* UserCommonClass::resolvedImplClass(Jnjvm* vm, Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h?rev=121134&r1=121133&r2=121134&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h Tue Dec 7 09:02:20 2010 @@ -341,7 +341,7 @@ /// JavaObject* setDelegatee(JavaObject* val); -#if !defined(ISOLATE) && !defined(ISOLATE_SHARING) +#if !defined(ISOLATE_SHARING) /// getDelegatee - Get the java/lang/Class object representing this class. /// JavaObject* getDelegatee() const { @@ -355,11 +355,6 @@ return delegatee; } -#else -#if defined(ISOLATE) - JavaObject* getDelegatee(); - JavaObject** getDelegateePtr(); -#endif #endif /// resolvedImplClass - Return the internal representation of the @@ -691,8 +686,6 @@ /// void broadcastClass(); -#ifndef ISOLATE - /// getCurrentTaskClassMirror - Get the class task mirror of the executing /// isolate. /// @@ -724,35 +717,6 @@ getCurrentTaskClassMirror().status = resolving; } - -#else - - TaskClassMirror& getCurrentTaskClassMirror(); - - bool isReadyForCompilation() { - return false; - } - - void setResolved() { - for (uint32 i = 0; i < NR_ISOLATES; ++i) { - IsolateInfo[i].status = resolved; - } - } - - void setIsResolving() { - for (uint32 i = 0; i < NR_ISOLATES; ++i) { - IsolateInfo[i].status = resolving; - } - } - - void setErroneous() { - for (uint32 i = 0; i < NR_ISOLATES; ++i) { - IsolateInfo[i].status = erroneous; - } - } - -#endif - /// getStaticInstance - Get the memory that holds static variables. /// void* getStaticInstance() { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=121134&r1=121133&r2=121134&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp Tue Dec 7 09:02:20 2010 @@ -552,9 +552,7 @@ UserConstantPool* ctpInfo = cl->getConstantPool(); const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]); str = cl->classLoader->UTF8ToStr(utf8); -#if defined(ISOLATE_SHARING) || !defined(ISOLATE) ctpInfo->ctpRes[index] = str; -#endif END_NATIVE_EXCEPTION Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmConfig.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmConfig.h?rev=121134&r1=121133&r2=121134&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmConfig.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmConfig.h Tue Dec 7 09:02:20 2010 @@ -34,10 +34,6 @@ #endif -#ifdef ISOLATE -#define NR_ISOLATES 32 -#else #define NR_ISOLATES 1 -#endif #endif // JNJVM_CONFIG_H Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=121134&r1=121133&r2=121134&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Tue Dec 7 09:02:20 2010 @@ -467,10 +467,8 @@ sigaction(SIGSEGV, &sa, NULL); - assert(th->MyVM && "VM not set in a thread"); -#ifdef ISOLATE - th->IsolateID = th->MyVM->IsolateID; -#endif + assert(th->vmkit && "VM not set in a thread"); + th->vmkit->rendezvous.prepareForJoin(); th->routine(th); th->vmkit->unregisterRunningThread(th); From gael.thomas at lip6.fr Tue Dec 7 07:14:15 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 15:14:15 -0000 Subject: [vmkit-commits] [vmkit] r121135 - in /vmkit/branches/multi-vm: include/j3/ lib/J3/Classpath/ lib/J3/Compiler/ lib/J3/VMCore/ Message-ID: <20101207151415.D7BE02A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 09:14:15 2010 New Revision: 121135 URL: http://llvm.org/viewvc/llvm-project?rev=121135&view=rev Log: remove all ISOLATE-SHARING depend code Modified: vmkit/branches/multi-vm/include/j3/J3Intrinsics.h vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc vmkit/branches/multi-vm/lib/J3/Compiler/J3Intrinsics.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp vmkit/branches/multi-vm/lib/J3/Compiler/LLVMMaterializer.cpp vmkit/branches/multi-vm/lib/J3/Compiler/LowerConstantCalls.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmConfig.h vmkit/branches/multi-vm/lib/J3/VMCore/LinkJavaRuntime.h vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Modified: vmkit/branches/multi-vm/include/j3/J3Intrinsics.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/j3/J3Intrinsics.h?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/j3/J3Intrinsics.h (original) +++ vmkit/branches/multi-vm/include/j3/J3Intrinsics.h Tue Dec 7 09:14:15 2010 @@ -43,10 +43,6 @@ const llvm::Type* AttributType; const llvm::Type* JavaThreadType; -#ifdef ISOLATE_SHARING - const llvm::Type* JnjvmType; -#endif - llvm::Function* StartJNIFunction; llvm::Function* EndJNIFunction; llvm::Function* InterfaceLookupFunction; @@ -82,14 +78,6 @@ llvm::Function* MultiCallNewFunction; llvm::Function* GetArrayClassFunction; -#ifdef ISOLATE_SHARING - llvm::Function* GetCtpClassFunction; - llvm::Function* GetJnjvmExceptionClassFunction; - llvm::Function* GetJnjvmArrayClassFunction; - llvm::Function* StaticCtpLookupFunction; - llvm::Function* SpecialCtpLookupFunction; -#endif - #ifdef SERVICE llvm::Function* ServiceCallStartFunction; llvm::Function* ServiceCallStopFunction; Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc Tue Dec 7 09:14:15 2010 @@ -181,12 +181,7 @@ jclass clazz, #endif jint par1) { -#if defined(ISOLATE_SHARING) - // TODO: do a longjmp exit(par1); -#else - exit(par1); -#endif } JNIEXPORT jlong Java_java_lang_VMRuntime_freeMemory( Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp Tue Dec 7 09:14:15 2010 @@ -32,7 +32,6 @@ using namespace j3; -#ifndef ISOLATE_SHARING Class* Classpath::newThread; Class* Classpath::newVMThread; JavaField* Classpath::assocThread; @@ -227,8 +226,6 @@ JavaMethod* Classpath::EnqueueReference; Class* Classpath::newReference; -#endif - void Classpath::CreateJavaThread(Jnjvm* vm, JavaThread* myth, const char* thName, JavaObject* Group) { JavaObjectVMThread* vmth = NULL; Modified: vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc Tue Dec 7 09:14:15 2010 @@ -306,7 +306,6 @@ ex->catche = reader.readU2(); -#ifndef ISOLATE_SHARING if (ex->catche) { UserClass* cl = (UserClass*)(compilingClass->ctpInfo->isClassLoaded(ex->catche)); @@ -317,7 +316,6 @@ } else { ex->catchClass = Classpath::newThrowable; } -#endif ex->tester = createBasicBlock("testException"); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc Tue Dec 7 09:14:15 2010 @@ -237,7 +237,6 @@ ex->catche = reader.readU2(); -#ifndef ISOLATE_SHARING if (ex->catche) { UserClass* cl = (UserClass*)(compilingClass->ctpInfo->isClassLoaded(ex->catche)); @@ -248,7 +247,6 @@ } else { ex->catchClass = Classpath::newThrowable; } -#endif ex->catcher = createBasicBlock("testException"); @@ -369,17 +367,11 @@ currentBlock = cur->tester; Value* clVar = 0; -#ifdef ISOLATE_SHARING - // We're dealing with exceptions, don't catch the exception if the class can - // not be found. - if (cur->catche) clVar = getResolvedClass(cur->catche, false, false, 0); - else clVar = CallInst::Create(module->GetJnjvmExceptionClassFunction, - isolateLocal, "", currentBlock); -#else + // We know catchClass exists because we have loaded all exceptions catched // by the method when we loaded the class that defined this method. clVar = module->getNativeClass(cur->catchClass); -#endif + if (clVar->getType() != module->JavaCommonClassType) clVar = new BitCastInst(clVar, module->JavaCommonClassType, "", currentBlock); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/J3Intrinsics.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/J3Intrinsics.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/J3Intrinsics.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/J3Intrinsics.cpp Tue Dec 7 09:14:15 2010 @@ -37,10 +37,6 @@ LLVMContext& Context = module->getContext(); -#ifdef ISOLATE_SHARING - JnjvmType = - PointerType::getUnqual(module->getTypeByName("Jnjvm")); -#endif ConstantPoolType = ptrPtrType; JavaObjectType = @@ -215,15 +211,6 @@ GetFinalFloatFieldFunction = module->getFunction("getFinalFloatField"); GetFinalDoubleFieldFunction = module->getFunction("getFinalDoubleField"); -#ifdef ISOLATE_SHARING - GetCtpClassFunction = module->getFunction("getCtpClass"); - GetJnjvmExceptionClassFunction = - module->getFunction("getJnjvmExceptionClass"); - GetJnjvmArrayClassFunction = module->getFunction("getJnjvmArrayClass"); - StaticCtpLookupFunction = module->getFunction("j3StaticCtpLookup"); - SpecialCtpLookupFunction = module->getFunction("j3SpecialCtpLookup"); -#endif - #ifdef SERVICE ServiceCallStartFunction = module->getFunction("j3ServiceCallStart"); ServiceCallStopFunction = module->getFunction("j3ServiceCallStop"); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp Tue Dec 7 09:14:15 2010 @@ -168,17 +168,10 @@ Value* indexes2[2]; indexes2[0] = intrinsics->constantZero; -#ifdef ISOLATE_SHARING - Value* indexesCtp; //[3]; -#endif if (meth) { LLVMMethodInfo* LMI = TheCompiler->getMethodInfo(meth); Constant* Offset = LMI->getOffset(); indexes2[1] = Offset; -#ifdef ISOLATE_SHARING - indexesCtp = ConstantInt::get(Type::getInt32Ty(*llvmContext), - Offset->getZExtValue() * -1); -#endif } else { GlobalVariable* GV = new GlobalVariable(*llvmFunction->getParent(), @@ -211,11 +204,6 @@ currentBlock = endResolveVirtual; indexes2[1] = node; -#ifdef ISOLATE_SHARING - Value* mul = BinaryOperator::CreateMul(val, intrinsics->constantMinusOne, - "", currentBlock); - indexesCtp = mul; -#endif } makeArgs(it, index, args, signature->nbArguments + 1); @@ -229,13 +217,6 @@ Value* Func = new LoadInst(FuncPtr, "", currentBlock); Func = new BitCastInst(Func, LSI->getVirtualPtrType(), "", currentBlock); -#ifdef ISOLATE_SHARING - Value* CTP = GetElementPtrInst::Create(VT, indexesCtp, "", currentBlock); - - CTP = new LoadInst(CTP, "", currentBlock); - CTP = new BitCastInst(CTP, intrinsics->ConstantPoolType, "", currentBlock); - args.push_back(CTP); -#endif val = invoke(Func, args, "", currentBlock); if (endBlock) { @@ -436,13 +417,7 @@ uint32 index = 0; if (stat) { -#ifdef ISOLATE_SHARING - Value* val = getClassCtp(); - Value* cl = CallInst::Create(intrinsics->GetClassDelegateePtrFunction, - val, "", currentBlock); -#else Value* cl = TheCompiler->getJavaClassPtr(compilingClass); -#endif nativeArgs.push_back(cl); index = 2; } else { @@ -698,27 +673,6 @@ currentBlock = OK; } -#ifdef ISOLATE_SHARING -Value* JavaJIT::getStaticInstanceCtp() { - Value* cl = getClassCtp(); - Value* indexes[2] = { intrinsics->constantZero, module->constantSeven }; - Value* arg1 = GetElementPtrInst::Create(cl, indexes, indexes + 2, - "", currentBlock); - arg1 = new LoadInst(arg1, "", false, currentBlock); - return arg1; - -} - -Value* JavaJIT::getClassCtp() { - Value* indexes = intrinsics->constantOne; - Value* arg1 = GetElementPtrInst::Create(ctpCache, indexes.begin(), - indexes.end(), "", currentBlock); - arg1 = new LoadInst(arg1, "", false, currentBlock); - arg1 = new BitCastInst(arg1, intrinsics->JavaClassType, "", currentBlock); - return arg1; -} -#endif - void JavaJIT::beginSynchronize() { Value* obj = 0; if (isVirtual(compilingMethod->access)) { @@ -891,11 +845,7 @@ uint32 index = 0; uint32 count = 0; -#if defined(ISOLATE_SHARING) - uint32 max = args.size() - 2; -#else uint32 max = args.size(); -#endif Signdef* sign = compilingMethod->getSignature(); Typedef* const* arguments = sign->getArgumentsType(); uint32 type = 0; @@ -1057,11 +1007,7 @@ uint32 index = 0; uint32 count = 0; -#if defined(ISOLATE_SHARING) - uint32 max = func->arg_size() - 2; -#else uint32 max = func->arg_size(); -#endif Function::arg_iterator i = func->arg_begin(); Signdef* sign = compilingMethod->getSignature(); Typedef* const* arguments = sign->getArgumentsType(); @@ -1113,15 +1059,6 @@ } #endif -#if defined(ISOLATE_SHARING) - ctpCache = i; - Value* addrCtpCache = new AllocaInst(intrinsics->ConstantPoolType, "", - currentBlock); - /// make it volatile to be sure it's on the stack - new StoreInst(ctpCache, addrCtpCache, true, currentBlock); -#endif - - #if defined(SERVICE) JnjvmClassLoader* loader = compilingClass->classLoader; Value* Cmp = 0; @@ -1478,20 +1415,10 @@ void JavaJIT::makeArgs(FunctionType::param_iterator it, uint32 index, std::vector& Args, uint32 nb) { -#if defined(ISOLATE_SHARING) - nb += 1; -#endif Args.reserve(nb + 2); mvm::ThreadAllocator threadAllocator; Value** args = (Value**)threadAllocator.Allocate(nb*sizeof(Value*)); -#if defined(ISOLATE_SHARING) - args[nb - 1] = isolateLocal; - sint32 start = nb - 2; - it--; - it--; -#else sint32 start = nb - 1; -#endif for (sint32 i = start; i >= 0; --i) { it--; if (it->get() == Type::getInt64Ty(*llvmContext) || it->get() == Type::getDoubleTy(*llvmContext)) { @@ -1659,32 +1586,6 @@ const llvm::FunctionType* virtualType = LSI->getVirtualType(); llvm::Instruction* val = 0; -#if defined(ISOLATE_SHARING) - const Type* Ty = intrinsics->ConstantPoolType; - Constant* Nil = Constant::getNullValue(Ty); - GlobalVariable* GV = new GlobalVariable(*llvmFunction->getParent(),Ty, false, - GlobalValue::ExternalLinkage, Nil, - ""); - Value* res = new LoadInst(GV, "", false, currentBlock); - Value* test = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, res, Nil, ""); - - BasicBlock* trueCl = createBasicBlock("UserCtp OK"); - BasicBlock* falseCl = createBasicBlock("UserCtp Not OK"); - PHINode* node = llvm::PHINode::Create(Ty, "", trueCl); - node->addIncoming(res, currentBlock); - BranchInst::Create(falseCl, trueCl, test, currentBlock); - std::vector Args; - Args.push_back(ctpCache); - Args.push_back(ConstantInt::get(Type::getInt32Ty(*llvmContext), index)); - Args.push_back(GV); - res = CallInst::Create(intrinsics->SpecialCtpLookupFunction, Args.begin(), - Args.end(), "", falseCl); - node->addIncoming(res, falseCl); - BranchInst::Create(trueCl, falseCl); - currentBlock = trueCl; - args.push_back(node); -#endif - if (!meth) { meth = ctpInfo->infoOfStaticOrSpecialMethod(index, ACC_VIRTUAL, signature); } @@ -1775,18 +1676,9 @@ func = TheCompiler->getMethod(meth); } -#if defined(ISOLATE_SHARING) - Value* newCtpCache = getConstantPoolAt(index, - intrinsics->StaticCtpLookupFunction, - intrinsics->ConstantPoolType, 0, - false); -#endif std::vector args; // size = [signature->nbIn + 2]; FunctionType::param_iterator it = staticType->param_end(); makeArgs(it, index, args, signature->nbArguments); -#if defined(ISOLATE_SHARING) - args.push_back(newCtpCache); -#endif if (className->equals(loader->mathName)) { val = lowerMathOps(name, args); @@ -1821,16 +1713,9 @@ // This makes unswitch loop very unhappy time-wise, but makes GVN happy // number-wise. IMO, it's better to have this than Unswitch. -#ifdef ISOLATE_SHARING - Value* CTP = ctpCache; - Value* Cl = GetElementPtrInst::Create(CTP, intrinsics->ConstantOne, "", - currentBlock); - Cl = new LoadInst(Cl, "", currentBlock); -#else JavaConstantPool* ctp = compilingClass->ctpInfo; Value* CTP = TheCompiler->getConstantPool(ctp); Value* Cl = TheCompiler->getNativeClass(compilingClass); -#endif std::vector Args; Args.push_back(resolver); @@ -1975,17 +1860,12 @@ Cl = invoke(intrinsics->InitialisationCheckFunction, Cl, "", currentBlock); } -#if !defined(ISOLATE_SHARING) if (needsCheck) { CallInst::Create(intrinsics->ForceInitialisationCheckFunction, Cl, "", currentBlock); } object = TheCompiler->getStaticInstance(field->classDef); -#else - object = CallInst::Create(intrinsics->GetStaticInstanceFunction, Cl, "", - currentBlock); -#endif } else { object = new LoadInst( object, "", TheCompiler->useCooperativeGC(), currentBlock); @@ -2082,7 +1962,7 @@ Value* ptr = ldResolved(index, true, NULL, LAI.llvmTypePtr); bool final = false; -#if !defined(ISOLATE_SHARING) + JnjvmBootstrapLoader* JBL = compilingClass->classLoader->bootstrapLoader; if (!compilingMethod->name->equals(JBL->clinitName)) { JavaField* field = compilingClass->ctpInfo->lookupField(index, true); @@ -2135,7 +2015,6 @@ } } } -#endif if (!final) { JnjvmClassLoader* JCL = compilingClass->classLoader; Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h Tue Dec 7 09:14:15 2010 @@ -508,25 +508,6 @@ //===--------------------- Yield point support ---------------------------===// void checkYieldPoint(); - - -#if defined(ISOLATE_SHARING) -//===----------------- Sharing bytecode support ---------------------------===// - - /// isolateLocal - The Jnjvm object that the method is currently executing. - llvm::Value* isolateLocal; - - /// ctpCache - The constant pool cache. - llvm::Value* ctpCache; - - /// getStaticInstanceCtp - Get the static instance of the class of the method - /// being compiled. - llvm::Value* getStaticInstanceCtp(); - - /// getClassCtp - Get the class of the method being compiled. - llvm::Value* getClassCtp(); -#endif - }; enum Opcode { Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp Tue Dec 7 09:14:15 2010 @@ -2056,17 +2056,11 @@ uint8 id = reader.readU1(); i += 1; uint8 charId = arrayType(compilingMethod, id); -#ifndef ISOLATE_SHARING JnjvmBootstrapLoader* loader = compilingClass->classLoader->bootstrapLoader; + dcl = loader->getArrayClass(id); valCl = TheCompiler->getNativeClass(dcl); -#else - Value* args[2] = { isolateLocal, - ConstantInt::get(Type::getInt32Ty(*llvmContext), id - 4) }; - valCl = CallInst::Create(intrinsics->GetJnjvmArrayClassFunction, - args, args + 2, "", currentBlock); -#endif LLVMAssessorInfo& LAI = TheCompiler->AssessorInfo[charId]; sizeElement = ConstantInt::get(Type::getInt32Ty(*llvmContext), Modified: vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp Tue Dec 7 09:14:15 2010 @@ -235,10 +235,6 @@ llvmArgs.push_back(LAI.llvmType); } -#if defined(ISOLATE_SHARING) - llvmArgs.push_back(Mod->getIntrinsics()->ConstantPoolType); -#endif - LLVMAssessorInfo& LAI = Compiler->getTypedefInfo(signature->getReturnType()); virtualType = FunctionType::get(LAI.llvmType, llvmArgs, false); @@ -261,11 +257,6 @@ llvmArgs.push_back(LAI.llvmType); } -#if defined(ISOLATE_SHARING) - // cached constant pool - llvmArgs.push_back(Compiler->getIntrinsics()->ConstantPoolType); -#endif - LLVMAssessorInfo& LAI = Compiler->getTypedefInfo(signature->getReturnType()); staticType = FunctionType::get(LAI.llvmType, llvmArgs, false); @@ -299,11 +290,6 @@ } } -#if defined(ISOLATE_SHARING) - // cached constant pool - llvmArgs.push_back(Compiler->getIntrinsics()->ConstantPoolType); -#endif - LLVMAssessorInfo& LAI = Compiler->getTypedefInfo(signature->getReturnType()); const llvm::Type* RetType = @@ -343,9 +329,7 @@ BasicBlock* currentBlock = BasicBlock::Create(context, "enter", res); Function::arg_iterator i = res->arg_begin(); Value *obj, *ptr, *func; -#if defined(ISOLATE_SHARING) - Value* ctp = i; -#endif + ++i; func = i; ++i; @@ -396,10 +380,6 @@ currentBlock); } -#if defined(ISOLATE_SHARING) - Args.push_back(ctp); -#endif - Value* val = CallInst::Create(func, Args.begin(), Args.end(), "", currentBlock); if (!signature->getReturnType()->isVoid()) { @@ -435,9 +415,7 @@ BasicBlock* currentBlock = BasicBlock::Create(context, "enter", res); Function::arg_iterator i = res->arg_begin(); Value *obj, *ap, *func; -#if defined(ISOLATE_SHARING) - Value* ctp = i; -#endif + ++i; func = i; ++i; @@ -476,10 +454,6 @@ Args.push_back(arg); } -#if defined(ISOLATE_SHARING) - Args.push_back(ctp); -#endif - Value* val = CallInst::Create(func, Args.begin(), Args.end(), "", currentBlock); if (!signature->getReturnType()->isVoid()) { Modified: vmkit/branches/multi-vm/lib/J3/Compiler/LLVMMaterializer.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/LLVMMaterializer.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/LLVMMaterializer.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/LLVMMaterializer.cpp Tue Dec 7 09:14:15 2010 @@ -150,7 +150,7 @@ LLVMMethodInfo* LMI = Comp->getMethodInfo(meth); uint64_t offset = dyn_cast(LMI->getOffset())->getZExtValue(); assert(meth->classDef->isResolved() && "Class not resolved"); -#if !defined(ISOLATE_SHARING) && !defined(SERVICE) +#if !defined(SERVICE) assert(meth->classDef->isInitializing() && "Class not ready"); #endif assert(meth->classDef->virtualVT && "Class has no VT"); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/LowerConstantCalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/LowerConstantCalls.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/LowerConstantCalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/LowerConstantCalls.cpp Tue Dec 7 09:14:15 2010 @@ -423,14 +423,7 @@ NBB = Invoke->getNormalDest(); } -#ifdef ISOLATE_SHARING - ConstantInt* Cons = dyn_cast(Index); - assert(CI && "Wrong use of GetConstantPoolAt"); - uint64 val = Cons->getZExtValue(); - Value* indexes = ConstantInt::get(Type::getInt32Ty(*Context), val + 1); -#else Value* indexes = Index; -#endif Value* arg1 = GetElementPtrInst::Create(CTP, indexes, "", CI); arg1 = new LoadInst(arg1, "", false, CI); Value* test = new ICmpInst(CI, ICmpInst::ICMP_EQ, arg1, @@ -703,39 +696,6 @@ // And reanalyse the current block. break; } -#ifdef ISOLATE_SHARING - else if (V == intrinsics->GetCtpClassFunction) { - Changed = true; - Value* val = Call.getArgument(0); - Value* indexes[2] = { intrinsics->constantZero, - intrinsics->OffsetCtpInClassConstant }; - Value* VTPtr = GetElementPtrInst::Create(val, indexes, - indexes + 2, "", CI); - Value* VT = new LoadInst(VTPtr, "", CI); - CI->replaceAllUsesWith(VT); - CI->eraseFromParent(); - } else if (V == intrinsics->GetJnjvmArrayClassFunction) { - Changed = true; - Value* val = Call.getArgument(0); - Value* index = Call.getArgument(1); - Value* indexes[3] = { intrinsics->constantZero, intrinsics->constantTwo, - index }; - Value* VTPtr = GetElementPtrInst::Create(val, indexes, indexes + 3, - "", CI); - Value* VT = new LoadInst(VTPtr, "", CI); - CI->replaceAllUsesWith(VT); - CI->eraseFromParent(); - } else if (V == intrinsics->GetJnjvmExceptionClassFunction) { - Changed = true; - Value* val = Call.getArgument(0); - Value* indexes[2] = { intrinsics->constantZero, intrinsics->constantOne }; - Value* VTPtr = GetElementPtrInst::Create(val, indexes, indexes + 2, - "", CI); - Value* VT = new LoadInst(VTPtr, "", CI); - CI->replaceAllUsesWith(VT); - CI->eraseFromParent(); - } -#endif } } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp Tue Dec 7 09:14:15 2010 @@ -924,7 +924,6 @@ interfaces[i]->resolveClass(); } -#ifndef ISOLATE_SHARING void Class::resolveClass() { if (isResolved() || isErroneous()) return; resolveParents(); @@ -934,12 +933,6 @@ &(getCurrentTaskClassMirror().status), loaded, resolved); assert(isResolved() || isErroneous()); } -#else -void Class::resolveClass() { - assert(status >= resolved && - "Asking to resolve a not resolved-class in a isolate environment"); -} -#endif void UserClass::resolveInnerOuterClasses() { if (!innerOuterResolved) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h Tue Dec 7 09:14:15 2010 @@ -157,10 +157,6 @@ /// super or interfaces. /// class CommonClass : public mvm::PermanentObject { -#ifdef ISOLATE_SHARING -friend class UserCommonClass; -#endif - public: //===----------------------------------------------------------------------===// @@ -341,7 +337,6 @@ /// JavaObject* setDelegatee(JavaObject* val); -#if !defined(ISOLATE_SHARING) /// getDelegatee - Get the java/lang/Class object representing this class. /// JavaObject* getDelegatee() const { @@ -354,8 +349,6 @@ JavaObject* const* getDelegateePtr() const { return delegatee; } - -#endif /// resolvedImplClass - Return the internal representation of the /// java.lang.Class object. The class must be resolved. @@ -593,11 +586,9 @@ return staticSize; } -#ifndef ISOLATE_SHARING /// doNew - Allocates a Java object whose class is this class. /// JavaObject* doNew(Jnjvm* vm); -#endif /// tracer - Tracer function of instances of Class. /// @@ -1293,8 +1284,4 @@ } // end namespace j3 -#ifdef ISOLATE_SHARING -#include "IsolateCommonClass.h" -#endif - #endif Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp Tue Dec 7 09:14:15 2010 @@ -282,7 +282,6 @@ CommonClass* JavaConstantPool::loadClass(uint32 index, bool resolve) { CommonClass* temp = isClassLoaded(index); -#ifndef ISOLATE_SHARING if (!temp) { JnjvmClassLoader* loader = classDef->classLoader; const UTF8* name = UTF8At(ctpDef[index]); @@ -293,20 +292,17 @@ } ctpRes[index] = temp; } -#endif return temp; } CommonClass* JavaConstantPool::getMethodClassIfLoaded(uint32 index) { CommonClass* temp = isClassLoaded(index); -#ifndef ISOLATE_SHARING if (!temp) { JnjvmClassLoader* loader = classDef->classLoader; assert(loader && "Class has no loader?"); const UTF8* name = UTF8At(ctpDef[index]); temp = loader->lookupClassOrArray(name); } -#endif if (!temp && classDef->classLoader->getCompiler()->isStaticCompiling()) { temp = loadClass(index); @@ -504,13 +500,10 @@ if (field) { if (!stat) { ctpRes[index] = (void*)field->ptrOffset; - } -#ifndef ISOLATE_SHARING - else if (lookup->isReady()) { + } else if (lookup->isReady()) { void* S = field->classDef->getStaticInstance(); ctpRes[index] = (void*)((uint64)S + field->ptrOffset); } -#endif } return field; } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp Tue Dec 7 09:14:15 2010 @@ -167,7 +167,7 @@ *offset = dmeth->offset; } -#if !defined(ISOLATE_SHARING) && !defined(SERVICE) +#if !defined(SERVICE) assert(dmeth->classDef->isInitializing() && "Class not ready in a virtual lookup."); #endif @@ -595,7 +595,7 @@ // Update the virtual table. assert(lookup->isResolved() && "Class not resolved"); -#if !defined(ISOLATE_SHARING) && !defined(SERVICE) +#if !defined(SERVICE) assert(lookup->isInitializing() && "Class not ready"); #endif assert(lookup->virtualVT && "Class has no VT"); @@ -764,43 +764,3 @@ #endif -#ifdef ISOLATE_SHARING -extern "C" void* j3StaticCtpLookup(UserClass* cl, uint32 index) { - UserConstantPool* ctpInfo = cl->getConstantPool(); - JavaConstantPool* shared = ctpInfo->getSharedPool(); - uint32 clIndex = shared->getClassIndexFromMethod(index); - UserClass* refCl = (UserClass*)ctpInfo->loadClass(clIndex); - refCl->initialiseClass(JavaThread::get()->getJVM()); - - CommonClass* baseCl = 0; - const UTF8* utf8 = 0; - Signdef* sign = 0; - - shared->resolveMethod(index, baseCl, utf8, sign); - UserClass* methodCl = 0; - refCl->lookupMethod(utf8, sign->keyName, true, true, &methodCl); - ctpInfo->ctpRes[index] = methodCl->getConstantPool(); - shared->ctpRes[clIndex] = refCl->classDef; - return (void*)methodCl->getConstantPool(); -} - -extern "C" UserConstantPool* j3SpecialCtpLookup(UserConstantPool* ctpInfo, - uint32 index, - UserConstantPool** res) { - JavaConstantPool* shared = ctpInfo->getSharedPool(); - uint32 clIndex = shared->getClassIndexFromMethod(index); - UserClass* refCl = (UserClass*)ctpInfo->loadClass(clIndex); - - CommonClass* baseCl = 0; - const UTF8* utf8 = 0; - Signdef* sign = 0; - - shared->resolveMethod(index, baseCl, utf8, sign); - UserClass* methodCl = 0; - refCl->lookupMethod(utf8, sign->keyName, false, true, &methodCl); - shared->ctpRes[clIndex] = refCl->classDef; - *res = methodCl->getConstantPool(); - return methodCl->getConstantPool(); -} - -#endif Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp Tue Dec 7 09:14:15 2010 @@ -29,21 +29,13 @@ UserClass* getClassFromStaticMethod(Jnjvm* vm, JavaMethod* meth, JavaObject* clazz) { llvm_gcroot(clazz, 0); -#ifdef ISOLATE_SHARING - return (UserClass*)UserCommonClass::resolvedImplClass(vm, clazz, false); -#else return meth->classDef; -#endif } static UserClass* getClassFromVirtualMethod(Jnjvm* vm, JavaMethod* meth, UserCommonClass* cl) { -#ifdef ISOLATE_SHARING - return cl->lookupClassFromMethod(this); -#else return meth->classDef; -#endif } extern "C" const struct JNIInvokeInterface_ JNI_JavaVMTable; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmConfig.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmConfig.h?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmConfig.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmConfig.h Tue Dec 7 09:14:15 2010 @@ -11,10 +11,6 @@ #ifndef JNJVM_CONFIG_H #define JNJVM_CONFIG_H -#ifdef ISOLATE_SHARING -#define ISOLATE_STATIC -#else - namespace j3 { class ClassArray; @@ -31,7 +27,6 @@ } #define ISOLATE_STATIC static -#endif #define NR_ISOLATES 1 Modified: vmkit/branches/multi-vm/lib/J3/VMCore/LinkJavaRuntime.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/LinkJavaRuntime.h?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/LinkJavaRuntime.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/LinkJavaRuntime.h Tue Dec 7 09:14:15 2010 @@ -69,17 +69,6 @@ Jnjvm* NewService); #endif - - - -#ifdef ISOLATE_SHARING -extern "C" void* j3StaticCtpLookup(UserClass* cl, uint32 index); -extern "C" UserConstantPool* j3SpecialCtpLookup(UserConstantPool* ctpInfo, - uint32 index, - UserConstantPool** res); -#endif - - namespace force_linker { struct ForceRuntimeLinking { ForceRuntimeLinking() { @@ -121,12 +110,6 @@ (void) j3ServiceCallStart(0, 0); (void) j3ServiceCallStop(0, 0); #endif - -#ifdef ISOLATE_SHARING - (void) j3StaticCtpLookup(0, 0); - (void) j3SpecialCtpLookup(0, 0, 0); -#endif - } } ForcePassLinking; // Force link by creating a global definition. } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=121135&r1=121134&r2=121135&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Tue Dec 7 09:14:15 2010 @@ -310,10 +310,6 @@ } -#if defined(ISOLATE_SHARING) - mvm::Collector::markAndTraceRoot(&JnjvmSharedLoader::sharedLoader, closure); -#endif - #ifdef SERVICE parent->tracer(closure); #endif From gael.thomas at lip6.fr Tue Dec 7 07:15:01 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 15:15:01 -0000 Subject: [vmkit-commits] [vmkit] r121136 - /vmkit/branches/multi-vm/find-it.sh Message-ID: <20101207151501.1D58C2A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 09:15:00 2010 New Revision: 121136 URL: http://llvm.org/viewvc/llvm-project?rev=121136&view=rev Log: add a find-it.sh tool able to find a string in vmkit Added: vmkit/branches/multi-vm/find-it.sh (with props) Added: vmkit/branches/multi-vm/find-it.sh URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/find-it.sh?rev=121136&view=auto ============================================================================== --- vmkit/branches/multi-vm/find-it.sh (added) +++ vmkit/branches/multi-vm/find-it.sh Tue Dec 7 09:15:00 2010 @@ -0,0 +1,11 @@ +#!/bin/bash + +if [ -z "$1" ]; then + + echo $0 pattern + +else + + grep -w --exclude *.txt --exclude-dir autoconf --exclude config.status --exclude config.log --exclude configure --exclude *.xml --exclude *.html --exclude *.jar --exclude *.bc --exclude MMTkInline.inc --exclude-dir patches --exclude-dir N3 --exclude *.java --exclude *.class -R --exclude-dir .svn --exclude-dir Release --exclude *.s "$1" . + +fi \ No newline at end of file Propchange: vmkit/branches/multi-vm/find-it.sh ------------------------------------------------------------------------------ svn:executable = * From gael.thomas at lip6.fr Tue Dec 7 07:32:03 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 15:32:03 -0000 Subject: [vmkit-commits] [vmkit] r121138 - in /vmkit/branches/multi-vm: ./ include/j3/ include/mvm/Threads/ lib/J3/Compiler/ lib/J3/VMCore/ lib/Mvm/Allocator/ lib/Mvm/GCMmap2/ Message-ID: <20101207153203.89E1C2A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 09:32:03 2010 New Revision: 121138 URL: http://llvm.org/viewvc/llvm-project?rev=121138&view=rev Log: remove all SERVICE depend code Modified: vmkit/branches/multi-vm/find-it.sh vmkit/branches/multi-vm/include/j3/J3Intrinsics.h vmkit/branches/multi-vm/include/j3/JavaAOTCompiler.h vmkit/branches/multi-vm/include/j3/JavaLLVMCompiler.h vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc vmkit/branches/multi-vm/lib/J3/Compiler/J3Intrinsics.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/branches/multi-vm/lib/J3/Compiler/LLVMMaterializer.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/branches/multi-vm/lib/J3/VMCore/LinkJavaRuntime.h vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h Modified: vmkit/branches/multi-vm/find-it.sh URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/find-it.sh?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/find-it.sh (original) +++ vmkit/branches/multi-vm/find-it.sh Tue Dec 7 09:32:03 2010 @@ -6,6 +6,6 @@ else - grep -w --exclude *.txt --exclude-dir autoconf --exclude config.status --exclude config.log --exclude configure --exclude *.xml --exclude *.html --exclude *.jar --exclude *.bc --exclude MMTkInline.inc --exclude-dir patches --exclude-dir N3 --exclude *.java --exclude *.class -R --exclude-dir .svn --exclude-dir Release --exclude *.s "$1" . + grep -w --exclude-dir IJvm --exclude-dir Isolate --exclude *.txt --exclude-dir autoconf --exclude config.status --exclude config.log --exclude configure --exclude *.xml --exclude *.html --exclude *.jar --exclude *.bc --exclude MMTkInline.inc --exclude-dir patches --exclude-dir N3 --exclude *.java --exclude *.class -R --exclude-dir .svn --exclude-dir Release --exclude *.s "$1" . fi \ No newline at end of file Modified: vmkit/branches/multi-vm/include/j3/J3Intrinsics.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/j3/J3Intrinsics.h?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/j3/J3Intrinsics.h (original) +++ vmkit/branches/multi-vm/include/j3/J3Intrinsics.h Tue Dec 7 09:32:03 2010 @@ -78,11 +78,6 @@ llvm::Function* MultiCallNewFunction; llvm::Function* GetArrayClassFunction; -#ifdef SERVICE - llvm::Function* ServiceCallStartFunction; - llvm::Function* ServiceCallStopFunction; -#endif - llvm::Function* GetClassDelegateeFunction; llvm::Function* RuntimeDelegateeFunction; llvm::Function* ArrayLengthFunction; Modified: vmkit/branches/multi-vm/include/j3/JavaAOTCompiler.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/j3/JavaAOTCompiler.h?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/j3/JavaAOTCompiler.h (original) +++ vmkit/branches/multi-vm/include/j3/JavaAOTCompiler.h Tue Dec 7 09:32:03 2010 @@ -69,11 +69,6 @@ virtual void setMethod(llvm::Function* func, void* ptr, const char* name); - -#ifdef SERVICE - virtual llvm::Value* getIsolate(Jnjvm* vm, llvm::Value* Where); -#endif - virtual ~JavaAOTCompiler() {} virtual void* loadMethod(void* handle, const char* symbol); @@ -156,13 +151,6 @@ typedef std::map::iterator utf8_iterator; -#ifdef SERVICE - virtual llvm::Value* getIsolate(Jnjvm* vm, llvm::Value* Where); - std::map isolates; - typedef std::map::iterator - isolate_iterator; -#endif - bool isCompiling(const CommonClass* cl) const; public: Modified: vmkit/branches/multi-vm/include/j3/JavaLLVMCompiler.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/j3/JavaLLVMCompiler.h?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/j3/JavaLLVMCompiler.h (original) +++ vmkit/branches/multi-vm/include/j3/JavaLLVMCompiler.h Tue Dec 7 09:32:03 2010 @@ -197,10 +197,6 @@ virtual void setMethod(llvm::Function* func, void* ptr, const char* name) = 0; -#ifdef SERVICE - virtual llvm::Value* getIsolate(Jnjvm* vm, llvm::Value* Where) = 0; -#endif - virtual void* materializeFunction(JavaMethod* meth) = 0; llvm::Function* parseFunction(JavaMethod* meth); Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Tue Dec 7 09:32:03 2010 @@ -318,12 +318,6 @@ /// void (*routine)(mvm::Thread*); -#ifdef SERVICE - /// stoppingService - The service that is currently stopping. - /// - VirtualMachine* stoppingService; -#endif - /// printBacktrace - Print the backtrace. /// void printBacktrace(); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc Tue Dec 7 09:32:03 2010 @@ -379,34 +379,6 @@ "Class not loaded when reading the exception table"); Value* VTVar = TheCompiler->getVirtualTable(cur->catchClass->virtualVT); - - -#ifdef SERVICE - // Verifies that the current isolate is not stopped. If it is, we don't - // catch the exception but resume unwinding. - JnjvmClassLoader* loader = compilingClass->classLoader;; - if (loader != loader->bootstrapLoader) { - Value* Isolate = getVMPtr(getMutatorThread()); - - Isolate = new LoadInst(Isolate, "", currentBlock); - Isolate = new BitCastInst(Isolate, intrinsics->ptrPtrType, "", currentBlock); - Value* Status = GetElementPtrInst::Create(Isolate, intrinsics->constantOne, "", - currentBlock); - Status = new LoadInst(Status, "", currentBlock); - Status = new PtrToIntInst(Status, Type::Int32Ty, "", currentBlock); - - Value* stopping = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, Status, - intrinsics->constantOne, ""); - - BasicBlock* raiseBlock = createBasicBlock("raiseBlock"); - BasicBlock* continueBlock = createBasicBlock("continueBlock"); - BranchInst::Create(raiseBlock, continueBlock, stopping, currentBlock); - currentBlock = raiseBlock; - BranchInst::Create(endExceptionBlock, currentBlock); - - currentBlock = continueBlock; - } -#endif // Get the Java exception. Value* obj = currentBlock->begin(); @@ -462,38 +434,6 @@ new StoreInst(intrinsics->JavaObjectNullConstant, exceptionPtr, currentBlock); -#if defined(SERVICE) - - // Change the isolate we are currently running, now that we have catched - // the exception: the exception may have been thrown by another isolate. - Value* mutatorThreadId = 0; - Value* OldIsolateID = 0; - Value* IsolateIDPtr = 0; - Value* OldIsolate = 0; - Value* NewIsolate = 0; - Value* IsolatePtr = 0; - currentBlock = cur->javaHandler; - if (loader != loader->bootstrapLoader) { - mutatorThreadId = getGetMutatorThreadPtr(); - IsolateIDPtr = getIsolateIDPtr(mutatorThreadId); - const Type* realType = PointerType::getUnqual(intrinsics->pointerSizeType); - IsolateIDPtr = new BitCastInst(IsolateIDPtr, realType, "", - currentBlock); - OldIsolateID = new LoadInst(IsolateIDPtr, "", currentBlock); - - Value* MyID = ConstantInt::get(intrinsics->pointerSizeType, - loader->getIsolate()->IsolateID); - - new StoreInst(MyID, IsolateIDPtr, currentBlock); - IsolatePtr = getVMPtr(mutatorThreadPtr); - - OldIsolate = new LoadInst(IsolatePtr, "", currentBlock); - NewIsolate = intrinsics->getIsolate(loader->getIsolate(), currentBlock); - new StoreInst(NewIsolate, IsolatePtr, currentBlock); - - } -#endif - } // Restore currentBlock. Modified: vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc Tue Dec 7 09:32:03 2010 @@ -375,34 +375,6 @@ if (clVar->getType() != module->JavaCommonClassType) clVar = new BitCastInst(clVar, module->JavaCommonClassType, "", currentBlock); - - -#ifdef SERVICE - // Verifies that the current isolate is not stopped. If it is, we don't - // catch the exception but resume unwinding. - JnjvmClassLoader* loader = compilingClass->classLoader;; - if (loader != loader->bootstrapLoader) { - Value* Isolate = getVMPtr(getMutatorThreadPtr()); - - Isolate = new LoadInst(Isolate, "", currentBlock); - Isolate = new BitCastInst(Isolate, module->ptrPtrType, "", currentBlock); - Value* Status = GetElementPtrInst::Create(Isolate, module->constantOne, "", - currentBlock); - Status = new LoadInst(Status, "", currentBlock); - Status = new PtrToIntInst(Status, Type::Int32Ty, "", currentBlock); - - Value* stopping = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, Status, - module->constantOne, ""); - - BasicBlock* raiseBlock = createBasicBlock("raiseBlock"); - BasicBlock* continueBlock = createBasicBlock("continueBlock"); - BranchInst::Create(raiseBlock, continueBlock, stopping, currentBlock); - currentBlock = raiseBlock; - BranchInst::Create(endExceptionBlock, currentBlock); - - currentBlock = continueBlock; - } -#endif Value* mutatorThreadId = getMutatorThreadPtr(); Value* javaThreadId = getJavaThreadPtr(mutatorThreadId); @@ -489,39 +461,6 @@ node->addIncoming(exc, cur->nativeHandler); } - -#if defined(SERVICE) - - // Change the isolate we are currently running, now that we have catched - // the exception: the exception may have been thrown by another isolate. - Value* mutatorThreadId = 0; - Value* OldIsolateID = 0; - Value* IsolateIDPtr = 0; - Value* OldIsolate = 0; - Value* NewIsolate = 0; - Value* IsolatePtr = 0; - currentBlock = cur->javaHandler; - if (loader != loader->bootstrapLoader) { - mutatorThreadId = getGetMutatorThreadPtr(); - IsolateIDPtr = getIsolateIDPtr(mutatorThreadId); - const Type* realType = PointerType::getUnqual(intrinsics->pointerSizeType); - IsolateIDPtr = new BitCastInst(IsolateIDPtr, realType, "", - currentBlock); - OldIsolateID = new LoadInst(IsolateIDPtr, "", currentBlock); - - Value* MyID = ConstantInt::get(intrinsics->pointerSizeType, - loader->getIsolate()->IsolateID); - - new StoreInst(MyID, IsolateIDPtr, currentBlock); - IsolatePtr = getVMPtr(mutatorThreadPtr); - - OldIsolate = new LoadInst(IsolatePtr, "", currentBlock); - NewIsolate = intrinsics->getIsolate(loader->getIsolate(), currentBlock); - new StoreInst(NewIsolate, IsolatePtr, currentBlock); - - } -#endif - } // Restore currentBlock. Modified: vmkit/branches/multi-vm/lib/J3/Compiler/J3Intrinsics.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/J3Intrinsics.cpp?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/J3Intrinsics.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/J3Intrinsics.cpp Tue Dec 7 09:32:03 2010 @@ -211,11 +211,6 @@ GetFinalFloatFieldFunction = module->getFunction("getFinalFloatField"); GetFinalDoubleFieldFunction = module->getFunction("getFinalDoubleField"); -#ifdef SERVICE - ServiceCallStartFunction = module->getFunction("j3ServiceCallStart"); - ServiceCallStopFunction = module->getFunction("j3ServiceCallStop"); -#endif - #ifndef WITHOUT_VTABLE VirtualLookupFunction = module->getFunction("j3VirtualTableLookup"); #endif Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Tue Dec 7 09:32:03 2010 @@ -1681,38 +1681,6 @@ fprintf(stderr, "%lluB\n", (unsigned long long int)size); } - -#ifdef SERVICE -Value* JavaAOTCompiler::getIsolate(Jnjvm* isolate, Value* Where) { - llvm::Constant* varGV = 0; - isolate_iterator End = isolates.end(); - isolate_iterator I = isolates.find(isolate); - if (I == End) { - - - Constant* cons = - ConstantExpr::getIntToPtr(ConstantInt::get(Type::getInt64Ty(getLLVMContext()), - uint64_t(isolate)), - ptrType); - - Module& Mod = *getLLVMModule(); - varGV = new GlobalVariable(Mod, ptrType, !staticCompilation, - GlobalValue::ExternalLinkage, - cons, ""); - - isolates.insert(std::make_pair(isolate, varGV)); - } else { - varGV = I->second; - } - if (BasicBlock* BB = dyn_cast(Where)) { - return new LoadInst(varGV, "", BB); - } else { - assert(dyn_cast(Where) && "Wrong use of module"); - return new LoadInst(varGV, "", dyn_cast(Where)); - } -} -#endif - void JavaAOTCompiler::CreateStaticInitializer() { std::vector llvmArgs; Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp Tue Dec 7 09:32:03 2010 @@ -45,10 +45,6 @@ using namespace llvm; static bool needsInitialisationCheck(Class* cl, Class* compilingClass) { -#ifdef SERVICE - return true; -#else - if (cl->isReadyForCompilation() || (!cl->isInterface() && compilingClass->isAssignableFrom(cl))) { return false; @@ -62,7 +58,6 @@ } return true; -#endif } bool JavaJIT::canBeInlined(JavaMethod* meth) { @@ -1059,53 +1054,6 @@ } #endif -#if defined(SERVICE) - JnjvmClassLoader* loader = compilingClass->classLoader; - Value* Cmp = 0; - Value* mutatorThreadId = 0; - Value* OldIsolateID = 0; - Value* IsolateIDPtr = 0; - Value* OldIsolate = 0; - Value* NewIsolate = 0; - Value* IsolatePtr = 0; - if (loader != loader->bootstrapLoader && isPublic(compilingMethod->access)) { - mutatorThreadId = getMutatorThreadPtr(); - - IsolateIDPtr = getIsolateIDPtr(mutatorThreadPtr); - const Type* realType = PointerType::getUnqual(intrinsics->pointerSizeType); - IsolateIDPtr = new BitCastInst(IsolateIDPtr, realType, "", - currentBlock); - OldIsolateID = new LoadInst(IsolateIDPtr, "", currentBlock); - - Value* MyID = ConstantInt::get(intrinsics->pointerSizeType, - loader->getIsolate()->IsolateID); - Cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, OldIsolateID, MyID, - ""); - - BasicBlock* EndBB = createBasicBlock("After service check"); - BasicBlock* ServiceBB = createBasicBlock("Begin service call"); - - BranchInst::Create(EndBB, ServiceBB, Cmp, currentBlock); - - currentBlock = ServiceBB; - - new StoreInst(MyID, IsolateIDPtr, currentBlock); - IsolatePtr = getVMPtr(mutatorThreadId); - - OldIsolate = new LoadInst(IsolatePtr, "", currentBlock); - NewIsolate = intrinsics->getIsolate(loader->getIsolate(), currentBlock); - new StoreInst(NewIsolate, IsolatePtr, currentBlock); - -#if DEBUG - Value* GEP[2] = { OldIsolate, NewIsolate }; - CallInst::Create(intrinsics->ServiceCallStartFunction, GEP, GEP + 2, - "", currentBlock); -#endif - BranchInst::Create(EndBB, currentBlock); - currentBlock = EndBB; - } -#endif - readExceptionTable(reader, codeLen); reader.cursor = start; @@ -1199,28 +1147,6 @@ CallInst::Create(intrinsics->PrintMethodEndFunction, arg, "", currentBlock); } #endif - -#if defined(SERVICE) - if (Cmp) { - BasicBlock* EndBB = createBasicBlock("After service check"); - BasicBlock* ServiceBB = createBasicBlock("End Service call"); - - BranchInst::Create(EndBB, ServiceBB, Cmp, currentBlock); - - currentBlock = ServiceBB; - - new StoreInst(OldIsolateID, IsolateIDPtr, currentBlock); - new StoreInst(OldIsolate, IsolatePtr, currentBlock); - -#if DEBUG - Value* GEP[2] = { OldIsolate, NewIsolate }; - CallInst::Create(intrinsics->ServiceCallStopFunction, GEP, GEP + 2, - "", currentBlock); -#endif - BranchInst::Create(EndBB, currentBlock); - currentBlock = EndBB; - } -#endif PI = pred_begin(currentBlock); PE = pred_end(currentBlock); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Tue Dec 7 09:32:03 2010 @@ -211,14 +211,6 @@ // ~JavaLLVMCompiler will delete the module. } -#ifdef SERVICE -Value* JavaJITCompiler::getIsolate(Jnjvm* isolate, Value* Where) { - ConstantInt* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()), - uint64_t(isolate)); - return ConstantExpr::getIntToPtr(CI, JavaIntrinsics.ptrType); -} -#endif - void JavaJITCompiler::makeVT(Class* cl) { JavaVirtualTable* VT = cl->virtualVT; assert(VT && "No VT was allocated!"); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/LLVMMaterializer.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/LLVMMaterializer.cpp?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/LLVMMaterializer.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/LLVMMaterializer.cpp Tue Dec 7 09:32:03 2010 @@ -150,9 +150,7 @@ LLVMMethodInfo* LMI = Comp->getMethodInfo(meth); uint64_t offset = dyn_cast(LMI->getOffset())->getZExtValue(); assert(meth->classDef->isResolved() && "Class not resolved"); -#if !defined(SERVICE) assert(meth->classDef->isInitializing() && "Class not ready"); -#endif assert(meth->classDef->virtualVT && "Class has no VT"); assert(meth->classDef->virtualTableSize > offset && "The method's offset is greater than the virtual table size"); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp Tue Dec 7 09:32:03 2010 @@ -271,17 +271,10 @@ } void* JavaMethod::compiledPtr() { - if (code != 0) return code; - else { -#ifdef SERVICE - Jnjvm *vm = classDef->classLoader->getIsolate(); - if (vm && vm->status == 0) { - JavaThread* th = JavaThread::get(); - th->throwException(th->ServiceException); - } -#endif + if (code != 0) + return code; + else code = classDef->classLoader->getCompiler()->materializeFunction(this); - } return code; } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp Tue Dec 7 09:32:03 2010 @@ -167,10 +167,8 @@ *offset = dmeth->offset; } -#if !defined(SERVICE) assert(dmeth->classDef->isInitializing() && "Class not ready in a virtual lookup."); -#endif res = dmeth->offset; @@ -595,9 +593,7 @@ // Update the virtual table. assert(lookup->isResolved() && "Class not resolved"); -#if !defined(SERVICE) assert(lookup->isInitializing() && "Class not ready"); -#endif assert(lookup->virtualVT && "Class has no VT"); assert(lookup->virtualTableSize > Virt->offset && "The method's offset is greater than the virtual table size"); @@ -745,22 +741,3 @@ UTF8Buffer(meth->name).cString(), OpcodeNames[opcode], index); } - -#ifdef SERVICE - -extern "C" void j3ServiceCallStart(Jnjvm* OldService, - Jnjvm* NewService) { - fprintf(stderr, "I have switched from %d to %d\n", OldService->IsolateID, - NewService->IsolateID); - - fprintf(stderr, "Now the thread id is %d\n", mvm::Thread::get()->IsolateID); -} - -extern "C" void j3ServiceCallStop(Jnjvm* OldService, - Jnjvm* NewService) { - fprintf(stderr, "End service call\n"); -} - -#endif - - Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp Tue Dec 7 09:32:03 2010 @@ -25,14 +25,6 @@ currentAddedReferences = NULL; javaThread = NULL; vmThread = NULL; - -#ifdef SERVICE - eipIndex = 0; - replacedEIPs = new void*[100]; - if (vm->upcalls->newThrowable) { - ServiceException = vm->upcalls->newThrowable->doNew(vm); - } -#endif } JavaThread* JavaThread::j3Thread(mvm::Thread* mut) { @@ -56,9 +48,6 @@ JavaThread::~JavaThread() { delete localJNIRefs; -#ifdef SERVICE - delete replacedEIPs; -#endif } void JavaThread::startJNI() { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h Tue Dec 7 09:32:03 2010 @@ -105,9 +105,6 @@ /// JavaThread - Empty constructor, used to get the VT. /// JavaThread() : mvm::VMThreadData(0, 0) { -#ifdef SERVICE - replacedEIPs = 0; -#endif } /// ~JavaThread - Delete any potential malloc'ed objects used by this thread. @@ -205,23 +202,6 @@ /// the stack. /// uint32 getJavaFrameContext(void** buffer); - -#ifdef SERVICE - /// ServiceException - The exception that will be thrown if a bundle is - /// stopped. - JavaObject* ServiceException; - - /// replacedEIPs - List of instruction pointers which must be replaced - /// to a function that throws an exception. We maintain this list and update - /// the stack correctly so that Dwarf unwinding does not complain. - /// - void** replacedEIPs; - - /// eipIndex - The current index in the replacedIPs list. - /// - uint32_t eipIndex; -#endif - }; } // end namespace j3 Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Tue Dec 7 09:32:03 2010 @@ -283,28 +283,6 @@ JavaObject::getClass(loader)->asClass()->lookupMethodDontThrow( meth->name, meth->type, false, true, &loadClass); assert(loadClass && "Loader does not have a loadClass function"); - -#if defined(SERVICE) - /// If the appClassLoader is already set in the isolate, then we need - /// a new one each time a class loader is allocated. - if (isolate->appClassLoader) { - isolate = new Jnjvm(allocator, bootstrapLoader); - isolate->memoryLimit = 4000000; - isolate->threadLimit = 10; - isolate->parent = I->parent; - isolate->CU = this; - mvm::Thread* th = mvm::Thread::get(); - mvm::VirtualMachine* OldVM = th->MyVM; - th->MyVM = isolate; - th->IsolateID = isolate->IsolateID; - - isolate->loadBootstrap(); - - th->MyVM = OldVM; - th->IsolateID = OldVM->IsolateID; - } -#endif - } void JnjvmClassLoader::setCompiler(JavaCompiler* Comp) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/LinkJavaRuntime.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/LinkJavaRuntime.h?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/LinkJavaRuntime.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/LinkJavaRuntime.h Tue Dec 7 09:32:03 2010 @@ -62,13 +62,6 @@ JavaMethod* meth); -#ifdef SERVICE -extern "C" void j3ServiceCallStart(Jnjvm* OldService, - Jnjvm* NewService); -extern "C" void j3ServiceCallStop(Jnjvm* OldService, - Jnjvm* NewService); -#endif - namespace force_linker { struct ForceRuntimeLinking { ForceRuntimeLinking() { @@ -106,10 +99,6 @@ (void) j3PrintMethodEnd(0); (void) j3PrintExecution(0, 0, 0); (void) j3StringLookup(0, 0); -#ifdef SERVICE - (void) j3ServiceCallStart(0, 0); - (void) j3ServiceCallStop(0, 0); -#endif } } ForcePassLinking; // Force link by creating a global definition. } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Tue Dec 7 09:32:03 2010 @@ -308,19 +308,11 @@ for (i = i + 1; i < mvm::LockSystem::GlobalSize; i++) { assert(lockSystem.LockTable[i] == NULL); } - - -#ifdef SERVICE - parent->tracer(closure); -#endif } void JavaThread::tracer(uintptr_t closure) { mvm::Collector::markAndTraceRoot(&javaThread, closure); mvm::Collector::markAndTraceRoot(&vmThread, closure); -#ifdef SERVICE - mvm::Collector::markAndTraceRoot(&ServiceException, closure); -#endif JNILocalReferences* end = localJNIRefs; while (end != NULL) { Modified: vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/Allocator/gcchunk.h Tue Dec 7 09:32:03 2010 @@ -31,9 +31,6 @@ /* bit 0-2: la marque */ /* bit 3: est-on collectable */ public: -#ifdef SERVICE - mvm::VirtualMachine* meta; // who allocated me -#endif static const signed int maskCollectable = 8; static const signed int maskNotCollectable = 0; Modified: vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h?rev=121138&r1=121137&r2=121138&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/branches/multi-vm/lib/Mvm/GCMmap2/MvmGC.h Tue Dec 7 09:32:03 2010 @@ -120,13 +120,7 @@ } static inline void maybeCollect() { - if(_enable_auto && -#ifdef SERVICE - (mvm::Thread::get()->MyVM->_since_last_collection <= (_collect_freq_auto - _collect_freq_maybe)) -#else - (_since_last_collection <= (_collect_freq_auto - _collect_freq_maybe)) -#endif - ) + if(_enable_auto && (_since_last_collection <= (_collect_freq_auto - _collect_freq_maybe))) collect(); } @@ -138,47 +132,13 @@ return res; #else lock(); - -#ifdef SERVICE - if (threads->get_nb_threads()) { - VirtualMachine* vm = mvm::Thread::get()->MyVM; - vm->_since_last_collection -= n; - if (_enable_auto && (vm->_since_last_collection <= 0)) { - vm->gcTriggered++; - if (vm->gcTriggered > vm->GCLimit) { - vm->_since_last_collection += n; - unlock(); - vm->stopService(); - return 0; - } - collect_unprotect(); - } - - if (vm->memoryUsed + n > vm->memoryLimit) { - vm->_since_last_collection += n; - unlock(); - vm->stopService(); - return 0; - } - } else { -#endif _since_last_collection -= n; if(_enable_auto && (_since_last_collection <= 0)) { collect_unprotect(); } -#ifdef SERVICE - } -#endif register GCChunkNode *header = allocator->alloc_chunk(n, 1, current_mark & 1); -#ifdef SERVICE - if (threads->get_nb_threads()) { - VirtualMachine* vm = mvm::Thread::get()->MyVM; - header->meta = vm; - vm->memoryUsed += n; - } -#endif header->append(used_nodes); register struct gcRoot *p = header->chunk(); p->setVirtualTable(vt); @@ -208,28 +168,6 @@ gcfatal("%p isn't a avalid object", ptr); size_t old_sz = node->nbb(); -#ifdef SERVICE - if (threads->get_nb_threads()) { - VirtualMachine* vm = mvm::Thread::get()->MyVM; - vm->_since_last_collection -= (n - old_sz); - if (_enable_auto && (vm->_since_last_collection <= 0)) { - if (vm->gcTriggered + 1 > vm->GCLimit) { - unlock(); - vm->stopService(); - return 0; - } - vm->gcTriggered++; - collect_unprotect(); - } - - if (vm->memoryUsed + (n - old_sz) > vm->memoryLimit) { - vm->_since_last_collection += (n - old_sz); - unlock(); - vm->stopService(); - return 0; - } - } else { -#endif _since_last_collection -= (n - old_sz); @@ -237,20 +175,8 @@ collect_unprotect(); } -#ifdef SERVICE - } -#endif - GCChunkNode *res = allocator->realloc_chunk(desc, node, n); -#ifdef SERVICE - if (threads->get_nb_threads()) { - VirtualMachine* vm = mvm::Thread::get()->MyVM; - res->meta = vm; - vm->memoryUsed += (n - old_sz); - } -#endif - if(res != node) { res->append(used_nodes); mark(res); From gael.thomas at lip6.fr Tue Dec 7 07:49:28 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 15:49:28 -0000 Subject: [vmkit-commits] [vmkit] r121140 - in /vmkit/branches/multi-vm: ./ autoconf/ include/mvm/ lib/J3/Classpath/ lib/J3/Compiler/ lib/J3/LLVMRuntime/ lib/J3/VMCore/ lib/Mvm/Compiler/ Message-ID: <20101207154928.EE69B2A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 09:49:28 2010 New Revision: 121140 URL: http://llvm.org/viewvc/llvm-project?rev=121140&view=rev Log: remove useless .ll, remove options to build isolate vm from configure, remove useless assessor for IsolateID and MyVM Added: vmkit/branches/multi-vm/lib/J3/LLVMRuntime/j3-runtime.ll - copied, changed from r120561, vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-mmap2-thread.ll - copied unchanged from r120463, vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-default-thread.ll vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-mmtk-thread.ll - copied unchanged from r120463, vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-mmtk-thread.ll Removed: vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-default-thread.ll vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-mmtk-thread.ll Modified: vmkit/branches/multi-vm/Makefile.config.in vmkit/branches/multi-vm/autoconf/configure.ac vmkit/branches/multi-vm/configure vmkit/branches/multi-vm/find-it.sh vmkit/branches/multi-vm/include/mvm/JIT.h vmkit/branches/multi-vm/lib/J3/Classpath/Makefile vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h vmkit/branches/multi-vm/lib/J3/Compiler/Makefile vmkit/branches/multi-vm/lib/J3/LLVMRuntime/Makefile vmkit/branches/multi-vm/lib/J3/VMCore/Makefile vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp vmkit/branches/multi-vm/lib/Mvm/Compiler/Makefile Modified: vmkit/branches/multi-vm/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/Makefile.config.in?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/Makefile.config.in (original) +++ vmkit/branches/multi-vm/Makefile.config.in Tue Dec 7 09:49:28 2010 @@ -11,9 +11,6 @@ GC_MMTK = @GC_MMTK@ MMTK_PLAN = @MMTK_PLAN@ MMTK_PLAN_HEADER = @MMTK_PLAN_HEADER@ -ISOLATE_BUILD = @ISOLATE_BUILD@ -SERVICE_BUILD = @SERVICE_BUILD@ -SINGLE_BUILD = @SINGLE_BUILD@ WITH_64 = @WITH_64@ WITH_LLVM_GCC = @WITH_LLVM_GCC@ Modified: vmkit/branches/multi-vm/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/autoconf/configure.ac?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/autoconf/configure.ac (original) +++ vmkit/branches/multi-vm/autoconf/configure.ac Tue Dec 7 09:49:28 2010 @@ -193,6 +193,8 @@ VM_FLAGS="$VM_FLAGS -DWITHOUT_FINALIZER" fi +AC_SUBST([VM_FLAGS]) + dnl ************************************************************************** dnl Architecture dnl ************************************************************************** @@ -285,41 +287,6 @@ AC_SUBST([MMTK_PLAN_HEADER]) dnl ************************************************************************** -dnl Virtual Machine type -dnl ************************************************************************** -AC_ARG_WITH(vm-type, - [AS_HELP_STRING(--with-vm-type=something, - [VM type ('single' 'isolate' 'isolate-sharing' or 'service')])], - [[vmtype=$withval]], - [[ echo Using single as vm type. - vmtype=single - ]] -) - -if test "x$vmtype" = "xisolate"; then - VM_FLAGS="-DISOLATE" - ISOLATE_BUILD=1 - SERVICE_BUILD=0 - SINGLE_BUILD=0 -else - if test "x$vmtype" = "xservice"; then - VM_FLAGS="-DISOLATE -DSERVICE" - SERVICE_BUILD=1 - ISOLATE_BUILD=1 - SINGLE_BUILD=0 - else - SINGLE_BUILD=1 - ISOLATE_BUILD=0 - SERVICE_BUILD=0 - fi -fi - -AC_SUBST([SINGLE_BUILD]) -AC_SUBST([SERVICE_BUILD]) -AC_SUBST([ISOLATE_BUILD]) -AC_SUBST([VM_FLAGS]) - -dnl ************************************************************************** dnl Exception type dnl ************************************************************************** AC_ARG_WITH(exception-type, Modified: vmkit/branches/multi-vm/configure URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/configure?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/configure (original) +++ vmkit/branches/multi-vm/configure Tue Dec 7 09:49:28 2010 @@ -1,26 +1,22 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for vmkit 0.29svn. +# Generated by GNU Autoconf 2.63 for vmkit 0.29svn. # # Report bugs to . # -# # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# -# +# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # Copyright (c) 2003-2010 Universite Pierre et Marie Curie. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which @@ -28,15 +24,23 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; esac + fi + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + as_nl=' ' export as_nl @@ -44,13 +48,7 @@ as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else @@ -61,7 +59,7 @@ as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in #( + case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -84,6 +82,13 @@ } fi +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -93,15 +98,15 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in #(( +case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done IFS=$as_save_IFS ;; @@ -113,16 +118,12 @@ fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 + { (exit 1); exit 1; } fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' @@ -134,300 +135,330 @@ LANGUAGE=C export LANGUAGE +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + # CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +$as_unset CDPATH + if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST + if (eval ":") 2>/dev/null; then + as_have_required=yes else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac + as_have_required=no fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes +if as_func_success; then + : else - as_have_required=no + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : +if as_func_ret_success; then + : else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( + case $as_dir in /*) for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac - as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf at gnu.org and -$0: nicolas.geoffray at gmail.com about your system, including -$0: any error possibly output before this message. Then -$0: install a modern shell, or manually run the script -$0: under such a shell if you do have one." - fi - exit 1 -fi fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append + exitcode=1 + echo as_func_ret_success failed. +fi -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith + exitcode=1 + echo positional parameters were not saved. +fi +test $exitcode = 0) || { (exit 1); exit 1; } -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. -as_fn_error () -{ - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi - $as_echo "$as_me: error: $1" >&2 - as_fn_exit $as_status -} # as_fn_error +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : else - as_expr=false + exitcode=1 + echo as_func_success failed. fi -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : else - as_basename=false + exitcode=1 + echo as_func_ret_success failed. fi -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : else - as_dirname=false + exitcode=1 + echo positional parameters were not saved. fi -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell bug-autoconf at gnu.org about your system, + echo including any error possibly output before this message. + echo This can help us improve future autoconf versions. + echo Configuration will now proceed without shell functions. +} -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= @@ -444,7 +475,8 @@ s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the @@ -454,18 +486,29 @@ exit } -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then @@ -495,7 +538,7 @@ rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' + as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false @@ -514,10 +557,10 @@ if test -d "$1"; then test -d "$1/."; else - case $1 in #( + case $1 in -*)set "./$1";; esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' @@ -531,8 +574,8 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -test -n "$DJDIR" || exec 7<&0 &1 + +exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, @@ -550,6 +593,7 @@ subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='vmkit' @@ -557,7 +601,6 @@ PACKAGE_VERSION='0.29svn' PACKAGE_STRING='vmkit 0.29svn' PACKAGE_BUGREPORT='nicolas.geoffray at gmail.com' -PACKAGE_URL='' ac_unique_file="lib/Mvm/Runtime/Object.cpp" # Factoring default headers for most tests. @@ -637,10 +680,6 @@ classpathlibs classpathglibj EXCEPTION_FLAGS -VM_FLAGS -ISOLATE_BUILD -SERVICE_BUILD -SINGLE_BUILD MMTK_PLAN_HEADER MMTK_PLAN GC_LIBS @@ -651,6 +690,7 @@ GC_BOEHM GC_MMAP2 WITH_64 +VM_FLAGS EGREP GREP CPP @@ -709,7 +749,6 @@ program_transform_name prefix exec_prefix -PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION @@ -727,7 +766,6 @@ with_finalizer with_gc with_mmtk_plan -with_vm_type with_exception_type with_runtime_exception_type with_gnu_classpath_libs @@ -857,7 +895,8 @@ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -883,7 +922,8 @@ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1087,7 +1127,8 @@ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1103,7 +1144,8 @@ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1133,17 +1175,17 @@ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." + -*) { $as_echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; - esac + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1160,13 +1202,15 @@ if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" + { $as_echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 + { (exit 1); exit 1; }; } ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1189,7 +1233,8 @@ [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" + { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' @@ -1219,9 +1264,11 @@ ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" + { $as_echo "$as_me: error: working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" + { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } # Find the source files, if location was not specified. @@ -1260,11 +1307,13 @@ fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" + { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1372,9 +1421,6 @@ 'multi-mmap' or 'boehm') --with-mmtk-plan=something MMTk plan type ('marksweep') - --with-vm-type=something - VM type ('single' 'isolate' 'isolate-sharing' or - 'service') --with-exception-type=something Exception type ('check' or 'dwarf') --with-runtime-exception-type=something @@ -1399,7 +1445,7 @@ LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command @@ -1472,9 +1518,10 @@ if $ac_init_version; then cat <<\_ACEOF vmkit configure 0.29svn -generated by GNU Autoconf 2.65 +generated by GNU Autoconf 2.63 -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. @@ -1482,462 +1529,12 @@ _ACEOF exit fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( cat <<\_ASBOX -## ----------------------------------------- ## -## Report this to nicolas.geoffray at gmail.com ## -## ----------------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_type - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by vmkit $as_me 0.29svn, which was -generated by GNU Autoconf 2.65. Invocation command line was +generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -1973,8 +1570,8 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done + $as_echo "PATH: $as_dir" +done IFS=$as_save_IFS } >&5 @@ -2011,9 +1608,9 @@ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) - as_fn_append ac_configure_args1 " '$ac_arg'" + ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else @@ -2029,13 +1626,13 @@ -* ) ac_must_keep_next=true ;; esac fi - as_fn_append ac_configure_args " '$ac_arg'" + ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -2060,13 +1657,13 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; + *) $as_unset $ac_var ;; esac ;; esac done @@ -2138,39 +1735,37 @@ exit $exit_status ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h - # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF + cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF + cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF + cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF @@ -2190,8 +1785,8 @@ for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 + if test -r "$ac_site_file"; then + { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" @@ -2199,10 +1794,10 @@ done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; @@ -2210,7 +1805,7 @@ esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 + { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -2225,11 +1820,11 @@ eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; @@ -2239,17 +1834,17 @@ ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 + { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 + { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 + { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 + { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac @@ -2261,30 +1856,23 @@ esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 + { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -VMKIT_COPYRIGHT="Copyright (c) 2003-2010 Universite Pierre et Marie Curie." @@ -2293,24 +1881,64 @@ -if test ${srcdir} != "." ; then - if test -f ${srcdir}/include/mvm/Config/config.h ; then - as_fn_error "Already configured in ${srcdir}" "$LINENO" 5 - fi -fi -ac_aux_dir= + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +VMKIT_COPYRIGHT="Copyright (c) 2003-2010 Universite Pierre et Marie Curie." + + + + + + + + +if test ${srcdir} != "." ; then + if test -f ${srcdir}/include/mvm/Config/config.h ; then + { { $as_echo "$as_me:$LINENO: error: Already configured in ${srcdir}" >&5 +$as_echo "$as_me: error: Already configured in ${srcdir}" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +ac_aux_dir= for ac_dir in $LLVM_SRC_ROOT/autoconf "$srcdir"/$LLVM_SRC_ROOT/autoconf; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi done if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in $LLVM_SRC_ROOT/autoconf \"$srcdir\"/$LLVM_SRC_ROOT/autoconf" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $LLVM_SRC_ROOT/autoconf \"$srcdir\"/$LLVM_SRC_ROOT/autoconf" >&5 +$as_echo "$as_me: error: cannot find install-sh or install.sh in $LLVM_SRC_ROOT/autoconf \"$srcdir\"/$LLVM_SRC_ROOT/autoconf" >&2;} + { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, @@ -2325,7 +1953,7 @@ # Check whether --with-llvmsrc was given. -if test "${with_llvmsrc+set}" = set; then : +if test "${with_llvmsrc+set}" = set; then withval=$with_llvmsrc; llvm_src="$withval" else llvm_src="$LLVM_SRC_ROOT" @@ -2335,7 +1963,7 @@ # Check whether --with-llvmobj was given. -if test "${with_llvmobj+set}" = set; then : +if test "${with_llvmobj+set}" = set; then withval=$with_llvmobj; llvm_obj="$withval" else llvm_obj="$LLVM_OBJ_ROOT" @@ -2351,27 +1979,35 @@ # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +{ $as_echo "$as_me:$LINENO: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : +if test "${ac_cv_build+set}" = set; then $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +$as_echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -2387,24 +2023,28 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +{ $as_echo "$as_me:$LINENO: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : +if test "${ac_cv_host+set}" = set; then $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +$as_echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -2420,24 +2060,28 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +{ $as_echo "$as_me:$LINENO: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } -if test "${ac_cv_target+set}" = set; then : +if test "${ac_cv_target+set}" = set; then $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;} + { (exit 1); exit 1; }; } fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; -*) as_fn_error "invalid value of canonical target" "$LINENO" 5;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical target" >&5 +$as_echo "$as_me: error: invalid value of canonical target" >&2;} + { (exit 1); exit 1; }; };; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' @@ -2460,22 +2104,28 @@ NONENONEs,x,x, && program_prefix=${target_alias}- -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking type of operating system we're going to host on" >&5 +{ $as_echo "$as_me:$LINENO: checking type of operating system we're going to host on" >&5 $as_echo_n "checking type of operating system we're going to host on... " >&6; } -if test "${vmkit_cv_os_type+set}" = set; then : +if test "${vmkit_cv_os_type+set}" = set; then $as_echo_n "(cached) " >&6 else case $host in *-*-aix*) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="AIX" vmkit_cv_platform_type="Unix" ;; *-*-irix*) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="IRIX" vmkit_cv_platform_type="Unix" ;; *-*-cygwin*) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="Cygwin" vmkit_cv_platform_type="Unix" ;; *-*-darwin*) @@ -2483,23 +2133,33 @@ vmkit_cv_os_type="Darwin" vmkit_cv_platform_type="Unix" ;; *-*-freebsd*) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="FreeBSD" vmkit_cv_platform_type="Unix" ;; *-*-openbsd*) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="OpenBSD" vmkit_cv_platform_type="Unix" ;; *-*-netbsd*) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="NetBSD" vmkit_cv_platform_type="Unix" ;; *-*-hpux*) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="HP-UX" vmkit_cv_platform_type="Unix" ;; *-*-interix*) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="Interix" vmkit_cv_platform_type="Unix" ;; *-*-linux*) @@ -2507,24 +2167,32 @@ vmkit_cv_os_type="Linux" vmkit_cv_platform_type="Unix" ;; *-*-solaris*) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="SunOS" vmkit_cv_platform_type="Unix" ;; *-*-win32*) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="Win32" vmkit_cv_platform_type="Win32" ;; *-*-mingw*) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="MingW" vmkit_cv_platform_type="Win32" ;; *) - as_fn_error "Good luck porting vmkit to your host!" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Good luck porting vmkit to your host!" >&5 +$as_echo "$as_me: error: Good luck porting vmkit to your host!" >&2;} + { (exit 1); exit 1; }; } vmkit_cv_os_type="Unknown" vmkit_cv_platform_type="Unknown" ;; esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vmkit_cv_os_type" >&5 +{ $as_echo "$as_me:$LINENO: result: $vmkit_cv_os_type" >&5 $as_echo "$vmkit_cv_os_type" >&6; } @@ -2533,7 +2201,7 @@ # Check whether --with-llvmgcc was given. -if test "${with_llvmgcc+set}" = set; then : +if test "${with_llvmgcc+set}" = set; then withval=$with_llvmgcc; withllvm=yes else withllvm=no @@ -2550,7 +2218,7 @@ # Check whether --with-thread was given. -if test "${with_thread+set}" = set; then : +if test "${with_thread+set}" = set; then withval=$with_thread; thread=$withval else thread=common @@ -2566,9 +2234,9 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2579,24 +2247,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2606,9 +2274,9 @@ ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2619,24 +2287,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2645,7 +2313,7 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -2659,9 +2327,9 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2672,24 +2340,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2699,9 +2367,9 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2713,18 +2381,18 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then @@ -2743,10 +2411,10 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2758,9 +2426,9 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2771,24 +2439,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2802,9 +2470,9 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2815,24 +2483,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2845,7 +2513,7 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -2856,37 +2524,57 @@ fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" +{ (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -2902,8 +2590,8 @@ # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } +{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: @@ -2919,17 +2607,17 @@ done rm -f $ac_rmfiles -if { { ac_try="$ac_link_default" +if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -2946,7 +2634,7 @@ # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -2965,42 +2653,84 @@ else ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 + +{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +if test -z "$ac_file"; then + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; }; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } + ac_exeext=$ac_cv_exeext +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } + fi + fi +fi +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -3015,83 +2745,32 @@ esac done else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 + +rm -f conftest$ac_cv_exeext +{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if test "${ac_cv_objext+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3103,17 +2782,17 @@ } _ACEOF rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -3126,23 +2805,31 @@ $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } fi + rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3156,16 +2843,37 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else - ac_compiler_gnu=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes @@ -3174,16 +2882,20 @@ fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if test "${ac_cv_prog_cc_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3194,11 +2906,35 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3209,12 +2945,36 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : else - ac_c_werror_flag=$ac_save_c_werror_flag + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3225,17 +2985,42 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS @@ -3252,14 +3037,18 @@ CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -3316,9 +3105,32 @@ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi + rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done @@ -3329,19 +3141,17 @@ # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 + { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac -if test "x$ac_cv_prog_cc_c89" != xno; then : -fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3355,14 +3165,14 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if test "${ac_cv_prog_CPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -3377,7 +3187,11 @@ # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include @@ -3386,34 +3200,78 @@ #endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi + rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break fi + rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +if $ac_preproc_ok; then break fi @@ -3425,7 +3283,7 @@ else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -3436,7 +3294,11 @@ # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include @@ -3445,40 +3307,87 @@ #endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi + rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break fi + rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - +if $ac_preproc_ok; then + : else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } +{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } fi ac_ext=c @@ -3488,9 +3397,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if test "${ac_cv_path_GREP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -3501,7 +3410,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do + for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue @@ -3521,7 +3430,7 @@ $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val + ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" @@ -3536,24 +3445,26 @@ $ac_path_GREP_found && break 3 done done - done +done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if test "${ac_cv_path_EGREP+set}" = set; then $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -3567,7 +3478,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do + for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue @@ -3587,7 +3498,7 @@ $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val + ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" @@ -3602,10 +3513,12 @@ $ac_path_EGREP_found && break 3 done done - done +done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP @@ -3613,17 +3526,21 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -3638,23 +3555,48 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else - ac_cv_header_stdc=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - + $EGREP "memchr" >/dev/null 2>&1; then + : else ac_cv_header_stdc=no fi @@ -3664,14 +3606,18 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - + $EGREP "free" >/dev/null 2>&1; then + : else ac_cv_header_stdc=no fi @@ -3681,10 +3627,14 @@ if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes; then : else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -3711,34 +3661,118 @@ return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : else - ac_cv_header_stdc=no + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -3748,24 +3782,160 @@ done -if test "x$thread" != "xno"; then : - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = x""yes; then : +if test "x$thread" != "xno"; then + if test "${ac_cv_header_pthread_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for pthread.h" >&5 +$as_echo_n "checking for pthread.h... " >&6; } +if test "${ac_cv_header_pthread_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 +$as_echo "$ac_cv_header_pthread_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking pthread.h usability" >&5 +$as_echo_n "checking pthread.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking pthread.h presence" >&5 +$as_echo_n "checking pthread.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: pthread.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: pthread.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: pthread.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: pthread.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: pthread.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: pthread.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: pthread.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------------------- ## +## Report this to nicolas.geoffray at gmail.com ## +## ----------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for pthread.h" >&5 +$as_echo_n "checking for pthread.h... " >&6; } +if test "${ac_cv_header_pthread_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_header_pthread_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 +$as_echo "$ac_cv_header_pthread_h" >&6; } +fi +if test "x$ac_cv_header_pthread_h" = x""yes; then + : else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: phtread include NOT found" >&5 + { $as_echo "$as_me:$LINENO: WARNING: phtread include NOT found" >&5 $as_echo "$as_me: WARNING: phtread include NOT found" >&2;} fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 + +{ $as_echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then : +if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -3783,18 +3953,43 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_pthread_pthread_create=yes else - ac_cv_lib_pthread_pthread_create=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_pthread_pthread_create=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF @@ -3802,22 +3997,27 @@ LIBS="-lpthread $LIBS" else - as_fn_error "pthread library not found" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: pthread library not found" >&5 +$as_echo "$as_me: error: pthread library not found" >&2;} + { (exit 1); exit 1; }; } fi fi + if test "x$thread" = xcommon; then -$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_PTHREAD 1 +_ACEOF fi # Check whether --with-finalizer was given. -if test "${with_finalizer+set}" = set; then : +if test "${with_finalizer+set}" = set; then withval=$with_finalizer; withfinalizer=$withfinalizer else withfinalizer=yes @@ -3829,16 +4029,22 @@ fi + + case $target_cpu in powerpc) -$as_echo "#define WITH_64 0" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define WITH_64 0 +_ACEOF WITH_64=0 ;; *) -$as_echo "#define WITH_64 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define WITH_64 1 +_ACEOF WITH_64=1 ;; @@ -3848,7 +4054,7 @@ # Check whether --with-gc was given. -if test "${with_gc+set}" = set; then : +if test "${with_gc+set}" = set; then withval=$with_gc; gc=$withval else echo Using mmap2 as vvm gc type. @@ -3860,7 +4066,7 @@ # Check whether --with-mmtk-plan was given. -if test "${with_mmtk_plan+set}" = set; then : +if test "${with_mmtk_plan+set}" = set; then withval=$with_mmtk_plan; MMTK_PLAN_HEADER=$withval else MMTK_PLAN_HEADER=marksweep @@ -3871,7 +4077,9 @@ if test "x$gc" = "xboehm"; then GC_FLAGS="-I\$(PROJ_SRC_ROOT)/lib/Mvm/BoehmGC -DGC_THREADS" -$as_echo "#define USE_GC_BOEHM 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define USE_GC_BOEHM 1 +_ACEOF GC_MMAP2=0 @@ -3915,7 +4123,9 @@ fi -$as_echo "#define USE_GC_MMAP2 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define USE_GC_MMAP2 1 +_ACEOF GC_MMAP2=1 @@ -3945,43 +4155,8 @@ -# Check whether --with-vm-type was given. -if test "${with_vm_type+set}" = set; then : - withval=$with_vm_type; vmtype=$withval -else - echo Using single as vm type. - vmtype=single - - -fi - - -if test "x$vmtype" = "xisolate"; then - VM_FLAGS="-DISOLATE" - ISOLATE_BUILD=1 - SERVICE_BUILD=0 - SINGLE_BUILD=0 -else - if test "x$vmtype" = "xservice"; then - VM_FLAGS="-DISOLATE -DSERVICE" - SERVICE_BUILD=1 - ISOLATE_BUILD=1 - SINGLE_BUILD=0 - else - SINGLE_BUILD=1 - ISOLATE_BUILD=0 - SERVICE_BUILD=0 - fi -fi - - - - - - - # Check whether --with-exception-type was given. -if test "${with_exception_type+set}" = set; then : +if test "${with_exception_type+set}" = set; then withval=$with_exception_type; exceptiontype=$withval else echo Using check as exception type. @@ -3993,7 +4168,7 @@ # Check whether --with-runtime-exception-type was given. -if test "${with_runtime_exception_type+set}" = set; then : +if test "${with_runtime_exception_type+set}" = set; then withval=$with_runtime_exception_type; runtimeexceptiontype=$withval else echo Using setjmp as exception type. @@ -4024,7 +4199,7 @@ # Check whether --with-gnu-classpath-libs was given. -if test "${with_gnu_classpath_libs+set}" = set; then : +if test "${with_gnu_classpath_libs+set}" = set; then withval=$with_gnu_classpath_libs; classpathlibs=$withval else classpathlibs=/usr/lib/classpath @@ -4034,7 +4209,7 @@ # Check whether --with-gnu-classpath-glibj was given. -if test "${with_gnu_classpath_glibj+set}" = set; then : +if test "${with_gnu_classpath_glibj+set}" = set; then withval=$with_gnu_classpath_glibj; classpathglibj=$withval else classpathglibj=/usr/share/classpath/glibj.zip @@ -4044,7 +4219,7 @@ # Check whether --with-j3 was given. -if test "${with_j3+set}" = set; then : +if test "${with_j3+set}" = set; then withval=$with_j3; WITH_J3=$withval else WITH_J3=yes @@ -4057,7 +4232,9 @@ if test "x${WITH_J3}" = "xyes"; then WITH_J3=1; -$as_echo "#define WITH_J3 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define WITH_J3 1 +_ACEOF else WITH_J3=0; @@ -4071,7 +4248,7 @@ # Check whether --with-pnet-local-prefix was given. -if test "${with_pnet_local_prefix+set}" = set; then : +if test "${with_pnet_local_prefix+set}" = set; then withval=$with_pnet_local_prefix; pnetlocalprefix=$withval else echo Not using PNETlocal prefix. @@ -4083,7 +4260,7 @@ # Check whether --with-pnetlib was given. -if test "${with_pnetlib+set}" = set; then : +if test "${with_pnetlib+set}" = set; then withval=$with_pnetlib; pnetlibpath=$withval else pnetlibpath=/usr/lib/cscc/lib/ @@ -4098,7 +4275,9 @@ WITH_N3_PNETLIB=1; WITH_N3=1; -$as_echo "#define WITH_N3 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define WITH_N3 1 +_ACEOF else WITH_N3_PNETLIB=0; @@ -4113,7 +4292,7 @@ # Check whether --with-mono was given. -if test "${with_mono+set}" = set; then : +if test "${with_mono+set}" = set; then withval=$with_mono; monopath=$withval else echo Not using Mono @@ -4140,14 +4319,14 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if test "${ac_cv_prog_CPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -4162,7 +4341,11 @@ # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include @@ -4171,34 +4354,78 @@ #endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi + rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break fi + rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +if $ac_preproc_ok; then break fi @@ -4210,7 +4437,7 @@ else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -4221,7 +4448,11 @@ # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include @@ -4230,40 +4461,87 @@ #endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi + rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break fi + rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - +if $ac_preproc_ok; then + : else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } +{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } fi ac_ext=c @@ -4282,9 +4560,9 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -4295,24 +4573,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -4326,9 +4604,9 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -4339,24 +4617,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -4369,7 +4647,7 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -4378,42 +4656,62 @@ fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" +{ (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -4427,16 +4725,37 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else - ac_compiler_gnu=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes @@ -4445,16 +4764,20 @@ fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if test "${ac_cv_prog_cc_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -4465,11 +4788,35 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -4480,12 +4827,36 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : else - ac_c_werror_flag=$ac_save_c_werror_flag + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -4496,17 +4867,42 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS @@ -4523,14 +4919,18 @@ CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -4587,9 +4987,32 @@ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi + rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done @@ -4600,19 +5023,17 @@ # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 + { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac -if test "x$ac_cv_prog_cc_c89" != xno; then : -fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4634,9 +5055,9 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : +if test "${ac_cv_prog_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -4647,24 +5068,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 + { $as_echo "$as_me:$LINENO: result: $CXX" >&5 $as_echo "$CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -4678,9 +5099,9 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then @@ -4691,24 +5112,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -4721,7 +5142,7 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -4732,36 +5153,53 @@ fi fi # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +$as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" +{ (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -4775,16 +5213,37 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else - ac_compiler_gnu=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes @@ -4793,16 +5252,20 @@ fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +{ $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then : +if test "${ac_cv_prog_cxx_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -4813,11 +5276,35 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CXXFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -4828,12 +5315,36 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -4844,17 +5355,42 @@ return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS @@ -4878,9 +5414,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD-compatible nm" >&5 +{ $as_echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 $as_echo_n "checking for BSD-compatible nm... " >&6; } -if test "${lt_cv_path_NM+set}" = set; then : +if test "${lt_cv_path_NM+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$NM"; then @@ -4927,28 +5463,28 @@ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } NM="$lt_cv_path_NM" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 + { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # Extract the first word of "cmp", so it can be a program name with args. set dummy cmp; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CMP+set}" = set; then : +if test "${ac_cv_path_CMP+set}" = set; then $as_echo_n "(cached) " >&6 else case $CMP in @@ -4961,14 +5497,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_CMP="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_CMP" && ac_cv_path_CMP="cmp" @@ -4977,19 +5513,19 @@ fi CMP=$ac_cv_path_CMP if test -n "$CMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CMP" >&5 + { $as_echo "$as_me:$LINENO: result: $CMP" >&5 $as_echo "$CMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CP+set}" = set; then : +if test "${ac_cv_path_CP+set}" = set; then $as_echo_n "(cached) " >&6 else case $CP in @@ -5002,14 +5538,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_CP" && ac_cv_path_CP="cp" @@ -5018,19 +5554,19 @@ fi CP=$ac_cv_path_CP if test -n "$CP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CP" >&5 + { $as_echo "$as_me:$LINENO: result: $CP" >&5 $as_echo "$CP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "date", so it can be a program name with args. set dummy date; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_DATE+set}" = set; then : +if test "${ac_cv_path_DATE+set}" = set; then $as_echo_n "(cached) " >&6 else case $DATE in @@ -5043,14 +5579,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_DATE="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_DATE" && ac_cv_path_DATE="date" @@ -5059,19 +5595,19 @@ fi DATE=$ac_cv_path_DATE if test -n "$DATE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DATE" >&5 + { $as_echo "$as_me:$LINENO: result: $DATE" >&5 $as_echo "$DATE" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "find", so it can be a program name with args. set dummy find; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_FIND+set}" = set; then : +if test "${ac_cv_path_FIND+set}" = set; then $as_echo_n "(cached) " >&6 else case $FIND in @@ -5084,14 +5620,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_FIND="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_FIND" && ac_cv_path_FIND="find" @@ -5100,19 +5636,19 @@ fi FIND=$ac_cv_path_FIND if test -n "$FIND"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FIND" >&5 + { $as_echo "$as_me:$LINENO: result: $FIND" >&5 $as_echo "$FIND" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "grep", so it can be a program name with args. set dummy grep; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if test "${ac_cv_path_GREP+set}" = set; then $as_echo_n "(cached) " >&6 else case $GREP in @@ -5125,14 +5661,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_GREP" && ac_cv_path_GREP="grep" @@ -5141,19 +5677,19 @@ fi GREP=$ac_cv_path_GREP if test -n "$GREP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GREP" >&5 + { $as_echo "$as_me:$LINENO: result: $GREP" >&5 $as_echo "$GREP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "mkdir", so it can be a program name with args. set dummy mkdir; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_MKDIR+set}" = set; then : +if test "${ac_cv_path_MKDIR+set}" = set; then $as_echo_n "(cached) " >&6 else case $MKDIR in @@ -5166,14 +5702,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_MKDIR="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_MKDIR" && ac_cv_path_MKDIR="mkdir" @@ -5182,19 +5718,19 @@ fi MKDIR=$ac_cv_path_MKDIR if test -n "$MKDIR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR" >&5 + { $as_echo "$as_me:$LINENO: result: $MKDIR" >&5 $as_echo "$MKDIR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "mv", so it can be a program name with args. set dummy mv; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_MV+set}" = set; then : +if test "${ac_cv_path_MV+set}" = set; then $as_echo_n "(cached) " >&6 else case $MV in @@ -5207,14 +5743,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_MV="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_MV" && ac_cv_path_MV="mv" @@ -5223,10 +5759,10 @@ fi MV=$ac_cv_path_MV if test -n "$MV"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MV" >&5 + { $as_echo "$as_me:$LINENO: result: $MV" >&5 $as_echo "$MV" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5234,9 +5770,9 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : +if test "${ac_cv_prog_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -5247,24 +5783,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 + { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5274,9 +5810,9 @@ ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -5287,24 +5823,24 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5313,7 +5849,7 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -5325,9 +5861,9 @@ # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_RM+set}" = set; then : +if test "${ac_cv_path_RM+set}" = set; then $as_echo_n "(cached) " >&6 else case $RM in @@ -5340,14 +5876,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_RM" && ac_cv_path_RM="rm" @@ -5356,19 +5892,19 @@ fi RM=$ac_cv_path_RM if test -n "$RM"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5 + { $as_echo "$as_me:$LINENO: result: $RM" >&5 $as_echo "$RM" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "sed", so it can be a program name with args. set dummy sed; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_SED+set}" = set; then : +if test "${ac_cv_path_SED+set}" = set; then $as_echo_n "(cached) " >&6 else case $SED in @@ -5381,14 +5917,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_SED" && ac_cv_path_SED="sed" @@ -5397,19 +5933,19 @@ fi SED=$ac_cv_path_SED if test -n "$SED"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 + { $as_echo "$as_me:$LINENO: result: $SED" >&5 $as_echo "$SED" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "tar", so it can be a program name with args. set dummy tar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_TAR+set}" = set; then : +if test "${ac_cv_path_TAR+set}" = set; then $as_echo_n "(cached) " >&6 else case $TAR in @@ -5422,14 +5958,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_TAR="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_TAR" && ac_cv_path_TAR="gtar" @@ -5438,19 +5974,19 @@ fi TAR=$ac_cv_path_TAR if test -n "$TAR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5 + { $as_echo "$as_me:$LINENO: result: $TAR" >&5 $as_echo "$TAR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "pwd", so it can be a program name with args. set dummy pwd; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_BINPWD+set}" = set; then : +if test "${ac_cv_path_BINPWD+set}" = set; then $as_echo_n "(cached) " >&6 else case $BINPWD in @@ -5463,14 +5999,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_BINPWD="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_BINPWD" && ac_cv_path_BINPWD="pwd" @@ -5479,19 +6015,19 @@ fi BINPWD=$ac_cv_path_BINPWD if test -n "$BINPWD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BINPWD" >&5 + { $as_echo "$as_me:$LINENO: result: $BINPWD" >&5 $as_echo "$BINPWD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "cat", so it can be a program name with args. set dummy cat; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CAT+set}" = set; then : +if test "${ac_cv_path_CAT+set}" = set; then $as_echo_n "(cached) " >&6 else case $CAT in @@ -5504,14 +6040,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_CAT="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_CAT" && ac_cv_path_CAT="cat" @@ -5520,10 +6056,10 @@ fi CAT=$ac_cv_path_CAT if test -n "$CAT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAT" >&5 + { $as_echo "$as_me:$LINENO: result: $CAT" >&5 $as_echo "$CAT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5531,9 +6067,9 @@ # Extract the first word of "llvm-as", so it can be a program name with args. set dummy llvm-as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_LLVMAS+set}" = set; then : +if test "${ac_cv_path_LLVMAS+set}" = set; then $as_echo_n "(cached) " >&6 else case $LLVMAS in @@ -5546,14 +6082,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_LLVMAS="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_LLVMAS" && ac_cv_path_LLVMAS="llvm-as" @@ -5562,19 +6098,19 @@ fi LLVMAS=$ac_cv_path_LLVMAS if test -n "$LLVMAS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVMAS" >&5 + { $as_echo "$as_me:$LINENO: result: $LLVMAS" >&5 $as_echo "$LLVMAS" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "llc", so it can be a program name with args. set dummy llc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_LLC+set}" = set; then : +if test "${ac_cv_path_LLC+set}" = set; then $as_echo_n "(cached) " >&6 else case $LLC in @@ -5587,14 +6123,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_LLC="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_LLC" && ac_cv_path_LLC="llc" @@ -5603,10 +6139,10 @@ fi LLC=$ac_cv_path_LLC if test -n "$LLC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLC" >&5 + { $as_echo "$as_me:$LINENO: result: $LLC" >&5 $as_echo "$LLC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5615,9 +6151,9 @@ if test "x$gc" = "xmmtk"; then # Extract the first word of "ant", so it can be a program name with args. set dummy ant; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_ANT+set}" = set; then : +if test "${ac_cv_path_ANT+set}" = set; then $as_echo_n "(cached) " >&6 else case $ANT in @@ -5630,14 +6166,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ANT="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS ;; @@ -5645,16 +6181,18 @@ fi ANT=$ac_cv_path_ANT if test -n "$ANT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ANT" >&5 + { $as_echo "$as_me:$LINENO: result: $ANT" >&5 $as_echo "$ANT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$ANT"; then - as_fn_error "Apache ANT required for MMTk, but not found" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Apache ANT required for MMTk, but not found" >&5 +$as_echo "$as_me: error: Apache ANT required for MMTk, but not found" >&2;} + { (exit 1); exit 1; }; } fi fi @@ -5672,10 +6210,10 @@ # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5683,11 +6221,11 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -5724,7 +6262,7 @@ ;; esac - done +done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir @@ -5740,7 +6278,7 @@ INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -5757,9 +6295,9 @@ LLVMGXX="llvm-g++${EXEEXT}" # Extract the first word of "$LLVMGCC", so it can be a program name with args. set dummy $LLVMGCC; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_LLVMGCC+set}" = set; then : +if test "${ac_cv_path_LLVMGCC+set}" = set; then $as_echo_n "(cached) " >&6 else case $LLVMGCC in @@ -5772,14 +6310,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_LLVMGCC="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS ;; @@ -5787,19 +6325,19 @@ fi LLVMGCC=$ac_cv_path_LLVMGCC if test -n "$LLVMGCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVMGCC" >&5 + { $as_echo "$as_me:$LINENO: result: $LLVMGCC" >&5 $as_echo "$LLVMGCC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "$LLVMGXX", so it can be a program name with args. set dummy $LLVMGXX; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_LLVMGXX+set}" = set; then : +if test "${ac_cv_path_LLVMGXX+set}" = set; then $as_echo_n "(cached) " >&6 else case $LLVMGXX in @@ -5812,14 +6350,14 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_LLVMGXX="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS ;; @@ -5827,10 +6365,10 @@ fi LLVMGXX=$ac_cv_path_LLVMGXX if test -n "$LLVMGXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVMGXX" >&5 + { $as_echo "$as_me:$LINENO: result: $LLVMGXX" >&5 $as_echo "$LLVMGXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5848,7 +6386,7 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking tool compatibility" >&5 +{ $as_echo "$as_me:$LINENO: checking tool compatibility" >&5 $as_echo_n "checking tool compatibility... " >&6; } ICC=no @@ -5864,44 +6402,75 @@ if test "$GCC" != "yes" && test "$ICC" != "yes" then - as_fn_error "gcc|icc required but not found" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: gcc|icc required but not found" >&5 +$as_echo "$as_me: error: gcc|icc required but not found" >&2;} + { (exit 1); exit 1; }; } fi if test "$GXX" != "yes" && test "$IXX" != "yes" then - as_fn_error "g++|icc required but not found" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: g++|icc required but not found" >&5 +$as_echo "$as_me: error: g++|icc required but not found" >&2;} + { (exit 1); exit 1; }; } fi if test "$GCC" = "yes" then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + cat >conftest.$ac_ext <<_ACEOF #if !defined(__GNUC__) || __GNUC__ < 3 #error Unsupported GCC version #endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : else - as_fn_error "gcc 3.x required, but you have a lower version" "$LINENO" 5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { { $as_echo "$as_me:$LINENO: error: gcc 3.x required, but you have a lower version" >&5 +$as_echo "$as_me: error: gcc 3.x required, but you have a lower version" >&2;} + { (exit 1); exit 1; }; } fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +{ $as_echo "$as_me:$LINENO: result: ok" >&5 $as_echo "ok" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5 + +{ $as_echo "$as_me:$LINENO: checking for inflate in -lz" >&5 $as_echo_n "checking for inflate in -lz... " >&6; } -if test "${ac_cv_lib_z_inflate+set}" = set; then : +if test "${ac_cv_lib_z_inflate+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -5919,18 +6488,43 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_z_inflate=yes else - ac_cv_lib_z_inflate=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_z_inflate=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflate" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflate" >&5 $as_echo "$ac_cv_lib_z_inflate" >&6; } -if test "x$ac_cv_lib_z_inflate" = x""yes; then : +if test "x$ac_cv_lib_z_inflate" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF @@ -5939,20 +6533,27 @@ else \ - as_fn_error "You need to install the zlib package (z)." "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: You need to install the zlib package (z)." >&5 +$as_echo "$as_me: error: You need to install the zlib package (z)." >&2;} + { (exit 1); exit 1; }; } fi if test "x$gc" = "xboehm"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GC_malloc in -lgc" >&5 + +{ $as_echo "$as_me:$LINENO: checking for GC_malloc in -lgc" >&5 $as_echo_n "checking for GC_malloc in -lgc... " >&6; } -if test "${ac_cv_lib_gc_GC_malloc+set}" = set; then : +if test "${ac_cv_lib_gc_GC_malloc+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -5970,18 +6571,43 @@ return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_gc_GC_malloc=yes else - ac_cv_lib_gc_GC_malloc=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gc_GC_malloc=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gc_GC_malloc" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_gc_GC_malloc" >&5 $as_echo "$ac_cv_lib_gc_GC_malloc" >&6; } -if test "x$ac_cv_lib_gc_GC_malloc" = x""yes; then : +if test "x$ac_cv_lib_gc_GC_malloc" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBGC 1 _ACEOF @@ -5990,31 +6616,299 @@ else \ - as_fn_error "You need to install the boehm-gc package (gc)." "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: You need to install the boehm-gc package (gc)." >&5 +$as_echo "$as_me: error: You need to install the boehm-gc package (gc)." >&2;} + { (exit 1); exit 1; }; } + +fi + +fi + + +if test "${ac_cv_header_zlib_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for zlib.h" >&5 +$as_echo_n "checking for zlib.h... " >&6; } +if test "${ac_cv_header_zlib_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 +$as_echo "$ac_cv_header_zlib_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking zlib.h usability" >&5 +$as_echo_n "checking zlib.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_compiler=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking zlib.h presence" >&5 +$as_echo_n "checking zlib.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no fi +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } -ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = x""yes; then : +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------------------- ## +## Report this to nicolas.geoffray at gmail.com ## +## ----------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for zlib.h" >&5 +$as_echo_n "checking for zlib.h... " >&6; } +if test "${ac_cv_header_zlib_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_header_zlib_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 +$as_echo "$ac_cv_header_zlib_h" >&6; } +fi +if test "x$ac_cv_header_zlib_h" = x""yes; then + : else \ - as_fn_error "You need to install the zlib devel package (zlib.h)." "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: You need to install the zlib devel package (zlib.h)." >&5 +$as_echo "$as_me: error: You need to install the zlib devel package (zlib.h)." >&2;} + { (exit 1); exit 1; }; } fi if test "x$gc" = "xboehm"; then - ac_fn_c_check_header_mongrel "$LINENO" "gc/gc.h" "ac_cv_header_gc_gc_h" "$ac_includes_default" -if test "x$ac_cv_header_gc_gc_h" = x""yes; then : + if test "${ac_cv_header_gc_gc_h+set}" = set; then + { $as_echo "$as_me:$LINENO: checking for gc/gc.h" >&5 +$as_echo_n "checking for gc/gc.h... " >&6; } +if test "${ac_cv_header_gc_gc_h+set}" = set; then + $as_echo_n "(cached) " >&6 +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gc_gc_h" >&5 +$as_echo "$ac_cv_header_gc_gc_h" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking gc/gc.h usability" >&5 +$as_echo_n "checking gc/gc.h usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking gc/gc.h presence" >&5 +$as_echo_n "checking gc/gc.h presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: gc/gc.h: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: gc/gc.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gc/gc.h: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: gc/gc.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: gc/gc.h: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: gc/gc.h: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gc/gc.h: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: gc/gc.h: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gc/gc.h: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: gc/gc.h: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gc/gc.h: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: gc/gc.h: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gc/gc.h: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: gc/gc.h: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: gc/gc.h: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: gc/gc.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ----------------------------------------- ## +## Report this to nicolas.geoffray at gmail.com ## +## ----------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for gc/gc.h" >&5 +$as_echo_n "checking for gc/gc.h... " >&6; } +if test "${ac_cv_header_gc_gc_h+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_header_gc_gc_h=$ac_header_preproc +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gc_gc_h" >&5 +$as_echo "$ac_cv_header_gc_gc_h" >&6; } +fi +if test "x$ac_cv_header_gc_gc_h" = x""yes; then + : else \ - as_fn_error "You need to install the boehm-gc devel package (gc/gc.h)." "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: You need to install the boehm-gc devel package (gc/gc.h)." >&5 +$as_echo "$as_me: error: You need to install the boehm-gc devel package (gc/gc.h)." >&2;} + { (exit 1); exit 1; }; } fi @@ -6024,9 +6918,102 @@ nl===-----------------------------------------------------------------------=== -ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = x""yes; then : +{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5 +$as_echo_n "checking for pid_t... " >&6; } +if test "${ac_cv_type_pid_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_pid_t=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((pid_t))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_pid_t=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +$as_echo "$ac_cv_type_pid_t" >&6; } +if test "x$ac_cv_type_pid_t" = x""yes; then + : else cat >>confdefs.h <<_ACEOF @@ -6035,9 +7022,102 @@ fi -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = x""yes; then : +{ $as_echo "$as_me:$LINENO: checking for size_t" >&5 +$as_echo_n "checking for size_t... " >&6; } +if test "${ac_cv_type_size_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_size_t=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((size_t))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_size_t=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +$as_echo "$ac_cv_type_size_t" >&6; } +if test "x$ac_cv_type_size_t" = x""yes; then + : else cat >>confdefs.h <<_ACEOF @@ -6046,12 +7126,16 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 +{ $as_echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if test "${ac_cv_struct_tm+set}" = set; then : +if test "${ac_cv_struct_tm+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -6066,64 +7150,459 @@ return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_struct_tm=time.h else - ac_cv_struct_tm=sys/time.h + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_struct_tm=sys/time.h +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 +$as_echo "$ac_cv_struct_tm" >&6; } +if test $ac_cv_struct_tm = sys/time.h; then + +cat >>confdefs.h <<\_ACEOF +#define TM_IN_SYS_TIME 1 +_ACEOF + +fi + +{ $as_echo "$as_me:$LINENO: checking for int64_t" >&5 +$as_echo_n "checking for int64_t... " >&6; } +if test "${ac_cv_type_int64_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_int64_t=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (int64_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((int64_t))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_int64_t=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_int64_t" >&5 +$as_echo "$ac_cv_type_int64_t" >&6; } +if test "x$ac_cv_type_int64_t" = x""yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_INT64_T 1 +_ACEOF + + +else + { { $as_echo "$as_me:$LINENO: error: Type int64_t required but not found" >&5 +$as_echo "$as_me: error: Type int64_t required but not found" >&2;} + { (exit 1); exit 1; }; } +fi + +{ $as_echo "$as_me:$LINENO: checking for uint64_t" >&5 +$as_echo_n "checking for uint64_t... " >&6; } +if test "${ac_cv_type_uint64_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_uint64_t=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (uint64_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((uint64_t))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_uint64_t=yes +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5 +$as_echo "$ac_cv_type_uint64_t" >&6; } +if test "x$ac_cv_type_uint64_t" = x""yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINT64_T 1 +_ACEOF + + +else + { $as_echo "$as_me:$LINENO: checking for u_int64_t" >&5 +$as_echo_n "checking for u_int64_t... " >&6; } +if test "${ac_cv_type_u_int64_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_type_u_int64_t=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof (u_int64_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if (sizeof ((u_int64_t))) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_u_int64_t=yes fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 -$as_echo "$ac_cv_struct_tm" >&6; } -if test $ac_cv_struct_tm = sys/time.h; then +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h fi -ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default" -if test "x$ac_cv_type_int64_t" = x""yes; then : +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_u_int64_t" >&5 +$as_echo "$ac_cv_type_u_int64_t" >&6; } +if test "x$ac_cv_type_u_int64_t" = x""yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_INT64_T 1 +#define HAVE_U_INT64_T 1 _ACEOF else - as_fn_error "Type int64_t required but not found" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: Type uint64_t or u_int64_t required but not found" >&5 +$as_echo "$as_me: error: Type uint64_t or u_int64_t required but not found" >&2;} + { (exit 1); exit 1; }; } fi -ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default" -if test "x$ac_cv_type_uint64_t" = x""yes; then : +fi -cat >>confdefs.h <<_ACEOF -#define HAVE_UINT64_T 1 -_ACEOF -else - ac_fn_c_check_type "$LINENO" "u_int64_t" "ac_cv_type_u_int64_t" "$ac_includes_default" -if test "x$ac_cv_type_u_int64_t" = x""yes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE_U_INT64_T 1 + +for ac_func in setjmp longjmp +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -else - as_fn_error "Type uint64_t or u_int64_t required but not found" "$LINENO" 5 -fi +#ifdef __STDC__ +# include +#else +# include +#endif -fi +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + eval "$as_ac_var=no" +fi -for ac_func in setjmp longjmp -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -6186,13 +7665,13 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; + *) $as_unset $ac_var ;; esac ;; esac done @@ -6200,8 +7679,8 @@ (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" @@ -6224,11 +7703,11 @@ if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 + { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 + { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi @@ -6248,8 +7727,8 @@ ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -6261,10 +7740,9 @@ ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -6274,18 +7752,17 @@ debug=false ac_cs_recheck=false ac_cs_silent=false - SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which @@ -6293,15 +7770,23 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; esac + fi + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + as_nl=' ' export as_nl @@ -6309,13 +7794,7 @@ as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else @@ -6326,7 +7805,7 @@ as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in #( + case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -6349,6 +7828,13 @@ } fi +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -6358,15 +7844,15 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in #(( +case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done IFS=$as_save_IFS ;; @@ -6378,16 +7864,12 @@ fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 + { (exit 1); exit 1; } fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' @@ -6399,89 +7881,7 @@ LANGUAGE=C export LANGUAGE -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. -as_fn_error () -{ - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi - $as_echo "$as_me: error: $1" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - +# Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -6495,12 +7895,8 @@ as_basename=false fi -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi +# Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ @@ -6520,25 +7916,76 @@ } s/.*/./; q'` -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( +case `echo -n x` in -n*) - case `echo 'xy\c'` in + case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; + *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then @@ -6567,56 +8014,8 @@ rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" - - -} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' + as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false @@ -6635,10 +8034,10 @@ if test -d "$1"; then test -d "$1/."; else - case $1 in #( + case $1 in -*)set "./$1";; esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' @@ -6653,19 +8052,13 @@ exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to +# Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by vmkit $as_me 0.29svn, which was -generated by GNU Autoconf 2.65. Invocation command line was +generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -6697,15 +8090,13 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. +\`$as_me' instantiates files from templates according to the +current configuration. -Usage: $0 [OPTION]... [TAG]... +Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit - --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files @@ -6724,17 +8115,16 @@ Configuration commands: $config_commands -Report bugs to ." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ vmkit config.status 0.29svn -configured by $0, generated by GNU Autoconf 2.65, - with options \\"\$ac_cs_config\\" +configured by $0, generated by GNU Autoconf 2.63, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -6768,8 +8158,6 @@ ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) @@ -6777,19 +8165,20 @@ case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - as_fn_append CONFIG_FILES " '$ac_optarg'" + CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" + CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; + { $as_echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ @@ -6797,10 +8186,11 @@ ac_cs_silent=: ;; # This is an error. - -*) as_fn_error "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; + -*) { $as_echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; - *) as_fn_append ac_config_targets " $1" + *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac @@ -6861,7 +8251,9 @@ "Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "lib/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Makefile" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; esac done @@ -6888,7 +8280,7 @@ trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 - trap 'as_fn_exit 1' 1 2 13 15 + trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. @@ -6899,7 +8291,11 @@ { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 +} || +{ + $as_echo "$as_me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -6907,16 +8303,10 @@ if test -n "$CONFIG_FILES"; then -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi +ac_cr=' ' ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' + ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi @@ -6930,18 +8320,24 @@ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -6963,7 +8359,7 @@ t delim :nl h -s/\(.\{148\}\)..*/\1/ +s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p @@ -6977,7 +8373,7 @@ t nl :delim h -s/\(.\{148\}\)..*/\1/ +s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p @@ -7030,7 +8426,9 @@ else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 + || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 +$as_echo "$as_me: error: could not setup config files machinery" >&2;} + { (exit 1); exit 1; }; } _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), @@ -7071,7 +8469,9 @@ if test -z "$ac_t"; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} + { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -7156,7 +8556,9 @@ _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 +$as_echo "$as_me: error: could not setup config headers machinery" >&2;} + { (exit 1); exit 1; }; } fi # test -n "$CONFIG_HEADERS" @@ -7169,7 +8571,9 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 +$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} + { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -7197,10 +8601,12 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" + ac_file_inputs="$ac_file_inputs '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't @@ -7211,7 +8617,7 @@ `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 + { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. @@ -7224,7 +8630,9 @@ case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; esac ;; esac @@ -7252,7 +8660,47 @@ q } s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in @@ -7304,6 +8752,7 @@ # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= + ac_sed_dataroot=' /datarootdir/ { p @@ -7313,11 +8762,12 @@ /@docdir@/p /@infodir@/p /@localedir@/p -/@mandir@/p' +/@mandir@/p +' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 + { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 @@ -7327,7 +8777,7 @@ s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; + s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF @@ -7355,12 +8805,14 @@ $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} @@ -7370,7 +8822,9 @@ -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; :H) # @@ -7381,23 +8835,29 @@ $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 + { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 + || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 +$as_echo "$as_me: error: could not create -" >&2;} + { (exit 1); exit 1; }; } fi ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 + :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -7413,12 +8873,15 @@ done # for ac_tag -as_fn_exit 0 +{ (exit 0); exit 0; } _ACEOF +chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } # configure is writing to config.log, and then calls config.status. @@ -7439,10 +8902,10 @@ exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit $? + $ac_cs_success || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 + { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi Modified: vmkit/branches/multi-vm/find-it.sh URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/find-it.sh?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/find-it.sh (original) +++ vmkit/branches/multi-vm/find-it.sh Tue Dec 7 09:49:28 2010 @@ -6,6 +6,6 @@ else - grep -w --exclude-dir IJvm --exclude-dir Isolate --exclude *.txt --exclude-dir autoconf --exclude config.status --exclude config.log --exclude configure --exclude *.xml --exclude *.html --exclude *.jar --exclude *.bc --exclude MMTkInline.inc --exclude-dir patches --exclude-dir N3 --exclude *.java --exclude *.class -R --exclude-dir .svn --exclude-dir Release --exclude *.s "$1" . + grep --exclude-dir IJvm --exclude-dir Isolate --exclude *.txt --exclude-dir autoconf --exclude config.status --exclude config.log --exclude configure --exclude *.xml --exclude *.html --exclude *.jar --exclude *.bc --exclude MMTkInline.inc --exclude-dir patches --exclude-dir N3 --exclude *.java --exclude *.class -R --exclude-dir .svn --exclude-dir Release --exclude *.s "$1" . fi \ No newline at end of file Modified: vmkit/branches/multi-vm/include/mvm/JIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/JIT.h?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/JIT.h (original) +++ vmkit/branches/multi-vm/include/mvm/JIT.h Tue Dec 7 09:49:28 2010 @@ -178,8 +178,6 @@ const llvm::Type* VTType; llvm::Constant* OffsetDoYieldInThreadConstant; - llvm::Constant* OffsetIsolateIDInThreadConstant; - llvm::Constant* OffsetVMInThreadConstant; llvm::Constant* OffsetCXXExceptionInThreadConstant; llvm::Constant* OffsetVMDataInThreadConstant; llvm::Constant* OffsetPendingExceptionInThreadConstant; Modified: vmkit/branches/multi-vm/lib/J3/Classpath/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/Makefile?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/Makefile (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/Makefile Tue Dec 7 09:49:28 2010 @@ -26,6 +26,3 @@ CXX.Flags += -I$(PROJ_SRC_DIR)/../VMCore $(CLASSPATH_FLAGS) -ifeq ($(ISOLATE_BUILD), 1) - CXX.Flags += -I$(PROJ_SRC_DIR)/../Isolate -endif Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp Tue Dec 7 09:49:28 2010 @@ -249,22 +249,6 @@ return threadId; } -llvm::Value* JavaJIT::getIsolateIDPtr(llvm::Value* mutatorThreadPtr) { - Value* GEP[3] = { intrinsics->constantZero, - intrinsics->OffsetThreadInMutatorThreadConstant, - intrinsics->OffsetIsolateIDInThreadConstant }; - - return GetElementPtrInst::Create(mutatorThreadPtr, GEP, GEP + 3, "", currentBlock); -} - -llvm::Value* JavaJIT::getVMPtr(llvm::Value* mutatorThreadPtr) { - Value* GEP[3] = { intrinsics->constantZero, - intrinsics->OffsetThreadInMutatorThreadConstant, - intrinsics->OffsetVMInThreadConstant }; - - return GetElementPtrInst::Create(mutatorThreadPtr, GEP, GEP + 3, "", currentBlock); -} - llvm::Value* JavaJIT::getDoYieldPtr(llvm::Value* mutatorThreadPtr) { Value* GEP[3] = { intrinsics->constantZero, intrinsics->OffsetThreadInMutatorThreadConstant, Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h Tue Dec 7 09:49:28 2010 @@ -140,12 +140,6 @@ /// getMutatorThreadPtr - Emit code to get a pointer to the current MutatorThread. llvm::Value* getMutatorThreadPtr(); - /// getIsolateIDPtr - Emit code to get a pointer to IsolateID. - llvm::Value* getIsolateIDPtr(llvm::Value* mutatorThreadPtr); - - /// getVMPtr - Emit code to get a pointer to MyVM. - llvm::Value* getVMPtr(llvm::Value* mutatorThreadPtr); - /// getDoYieldPtr - Emit code to get a pointer to doYield. llvm::Value* getDoYieldPtr(llvm::Value* mutatorThreadPtr); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/Makefile?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/Makefile (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/Makefile Tue Dec 7 09:49:28 2010 @@ -23,6 +23,3 @@ CXX.Flags += -I$(PROJ_OBJ_DIR)/../LLVMRuntime -I$(PROJ_SRC_DIR)/../Classpath $(CLASSPATH_FLAGS) -I$(PROJ_SRC_DIR)/../VMCore -ifeq ($(ISOLATE_BUILD), 1) - CXX.Flags += -I$(PROJ_SRC_DIR)/../Isolate -endif Modified: vmkit/branches/multi-vm/lib/J3/LLVMRuntime/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/LLVMRuntime/Makefile?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/LLVMRuntime/Makefile (original) +++ vmkit/branches/multi-vm/lib/J3/LLVMRuntime/Makefile Tue Dec 7 09:49:28 2010 @@ -11,19 +11,7 @@ include $(LEVEL)/Makefile.config VMKIT_RUNTIME = $(PROJ_SRC_DIR)/../../Mvm/Compiler/LLVMRuntime.gen.ll \ - $(PROJ_SRC_DIR)/runtime-default.ll - -ifeq ($(ISOLATE_BUILD), 1) -VMKIT_RUNTIME += $(PROJ_SRC_DIR)/runtime-isolate.ll -endif - -ifeq ($(SERVICE_BUILD), 1) -VMKIT_RUNTIME += $(PROJ_SRC_DIR)/runtime-service.ll $(PROJ_SRC_DIR)/runtime-isolate.ll -endif - -ifeq ($(SINGLE_BUILD), 1) -VMKIT_RUNTIME += $(PROJ_SRC_DIR)/runtime-single.ll -endif + $(PROJ_SRC_DIR)/j3-runtime.ll BUILT_SOURCES = LLVMRuntime.inc Copied: vmkit/branches/multi-vm/lib/J3/LLVMRuntime/j3-runtime.ll (from r120561, vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll) URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/LLVMRuntime/j3-runtime.ll?p2=vmkit/branches/multi-vm/lib/J3/LLVMRuntime/j3-runtime.ll&p1=vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll&r1=120561&r2=121140&rev=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll (original) +++ vmkit/branches/multi-vm/lib/J3/LLVMRuntime/j3-runtime.ll Tue Dec 7 09:49:28 2010 @@ -47,6 +47,14 @@ %JavaClassPrimitive = type { %JavaCommonClass, i32 } %JavaClassArray = type { %JavaCommonClass, %JavaCommonClass* } +%JavaCommonClass = type { [1 x %JavaObject*], i16, + %JavaClass**, i16, %UTF8*, %JavaClass*, i8*, %VT* } + +%JavaClass = type { %JavaCommonClass, i32, i32, [1 x %TaskClassMirror], + %JavaField*, i16, %JavaField*, i16, %JavaMethod*, i16, + %JavaMethod*, i16, i8*, %ArrayUInt8*, i8*, %Attribut*, + i16, %JavaClass**, i16, %JavaClass*, i16, i8, i8, i32, i32 } + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;; Constant calls for Jnjvm runtime internal objects field accesses ;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Removed: vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll?rev=121139&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll (original) +++ vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll (removed) @@ -1,222 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;; Type definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;; The root of all Java Objects: a VT and a lock. -%JavaObject = type { %VT*, i8* } - -;;; Types for Java arrays. A size of 0 means an undefined size. -%JavaArray = type { %JavaObject, i8* } -%ArrayDouble = type { %JavaObject, i8*, [0 x double] } -%ArrayFloat = type { %JavaObject, i8*, [0 x float] } -%ArrayLong = type { %JavaObject, i8*, [0 x i64] } -%ArrayObject = type { %JavaObject, i8*, [0 x %JavaObject*] } -%ArraySInt16 = type { %JavaObject, i8*, [0 x i16] } -%ArraySInt32 = type { %JavaObject, i8*, [0 x i32] } -%ArraySInt8 = type { %JavaObject, i8*, [0 x i8] } -%ArrayUInt16 = type { %JavaObject, i8*, [0 x i16] } -%ArrayUInt32 = type { %JavaObject, i8*, [0 x i32] } -%ArrayUInt8 = type { %JavaObject, i8*, [0 x i8] } - -;;; The task class mirror. -;;; Field 1: The class state -;;; Field 2: The initialization state -;;; Field 3: The static instance -%TaskClassMirror = type { i8, i1, i8* } - -;;; The Java Thread -;;; Field 1: VMThreadData parent -;;; Field 2: void* jniEnv -%JavaThread = type { %VMThreadData, i8* } - -%JavaConstantPool = type { %JavaClass*, i32, i8*, i32*, i8** } - -%Attribut = type { %UTF8*, i32, i32 } - -%UTF8 = type { %JavaObject, i8*, [0 x i16] } - - -%JavaField = type { i8*, i16, %UTF8*, %UTF8*, %Attribut*, i16, %JavaClass*, i32, - i16 } - -%CodeLineInfo = type { i8*, %JavaMethod*, %CodeLineInfo* } - -%JavaMethod = type { i8*, i16, %Attribut*, i16, %JavaClass*, - %UTF8*, %UTF8*, i8, i8*, %CodeLineInfo*, i16, i32 } - -%JavaClassPrimitive = type { %JavaCommonClass, i32 } -%JavaClassArray = type { %JavaCommonClass, %JavaCommonClass* } - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;; Constant calls for Jnjvm runtime internal objects field accesses ;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;; j3RuntimeInitialiseClass - Initialises the class. -declare %JavaClass* @j3RuntimeInitialiseClass(%JavaClass*) - -;;; arrayLength - Get the length of an array. -declare i32 @arrayLength(%JavaObject*) readnone - -;;; getVT - Get the VT of the object. -declare %VT* @getVT(%JavaObject*) readnone - -;;; getIMT - Get the IMT of the VT. -declare %VT* @getIMT(%VT*) readnone - -;;; getClass - Get the class of an object. -declare %JavaCommonClass* @getClass(%JavaObject*) readnone - -;;; getLock - Get the lock of an object. -declare i8* @getLock(%JavaObject*) - -;;; getVTFromCommonClass - Get the VT of a class from its runtime -;;; representation. -declare %VT* @getVTFromCommonClass(%JavaCommonClass*) readnone - -;;; getVTFromClass - Get the VT of a class from its runtime representation. -declare %VT* @getVTFromClass(%JavaClass*) readnone - -;;; getVTFromClassArray - Get the VT of an array class from its runtime -;;; representation. -declare %VT* @getVTFromClassArray(%JavaClassArray*) readnone - -;;; getObjectSizeFromClass - Get the size of a class from its runtime -;;; representation. -declare i32 @getObjectSizeFromClass(%JavaClass*) readnone - -;;; getBaseClassVTFromVT - Get the VT of the base class of an array, or the -;;; VT of the array class of a regular class. -declare %VT* @getBaseClassVTFromVT(%VT*) readnone - -;;; getDisplay - Get the display array of this VT. -declare %VT** @getDisplay(%VT*) readnone - -;;; getVTInDisplay - Get the super class at the given offset. -declare %VT* @getVTInDisplay(%VT**, i32) readnone - -;;; getDepth - Get the depth of the VT. -declare i32 @getDepth(%VT*) readnone - -;;; getStaticInstance - Get the static instance of this class. -declare i8* @getStaticInstance(%JavaClass*) readnone - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;; Generic Runtime methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;; j3InterfaceLookup - Used for interface calls. -declare i8* @j3InterfaceLookup(%JavaClass*, i32, ...) - -;;; j3MultiCallNew - Allocate multi-dimensional arrays. This will go to -;;; allocation specific methods. -declare %JavaObject* @j3MultiCallNew(%JavaCommonClass*, i32, ...) - -;;; initialisationCheck - Checks if the class has been initialized and -;;; initializes if not. This is used for initialization barriers in an isolate -;;; environment, and in some specific scenario in a single environment. -declare %JavaClass* @initialisationCheck(%JavaClass*) readnone - -;;; forceInitialisationCheck - Force to check initialization. The difference -;;; between this function and the initialisationCheck function is that the -;;; latter is readnone and can thus be removed. This function is removed -;;; by Jnjvm after the GVN pass, therefore it does not have an actual -;;; implementation. -declare void @forceInitialisationCheck(%JavaClass*) - -;;; forceLoadedCheck - Force to check if the class was loaded. Since we do -;;; not want to run Java code in a callback, we have to make sure the class -;;; of the method that we want to compile is loaded. This is used for -;;; the invokespecial bytecode. -declare void @forceLoadedCheck(%JavaCommonClass*) - -;;; getConstantPoolAt - Get the value in the constant pool of this class. -;;; This function is removed by Jnjvm after the GVn pass, therefore it does -;;; not have an actual implementation. -declare i8* @getConstantPoolAt(i8* (%JavaClass*, i32, ...)*, i8**, - %JavaClass*, i32, ...) readnone - -;;; j3VirtualTableLookup - Look up the offset in a virtual table of a -;;; specific function. -declare i32 @j3VirtualTableLookup(%JavaClass*, i32, i32*, %JavaObject*) - -;;; j3ClassLookup - Look up a specific class. The function takes a class and -;;; an index to lookup in the constant pool and returns and stores it in the -;;; constant pool cache. -declare i8* @j3ClassLookup(%JavaClass*, i32, ...) - -;;; j3VirtualFieldLookup - Look up a specific virtual field. -declare i8* @j3VirtualFieldLookup(%JavaClass*, i32, ...) - -;;; j3StaticFieldLookup - Look up a specific static field. -declare i8* @j3StaticFieldLookup(%JavaClass*, i32, ...) - -;;; j3StringLookup - Get a pointer on a string. -declare i8* @j3StringLookup(%JavaClass*, i32, ...) readnone - -;;; j3JavaObjectAquire - This function is called when starting a synchronized -;;; block or method. -declare void @j3JavaObjectAquire(%JavaObject*) - -;;; j3JavaObjectRelease - This function is called when leaving a synchronized -;;; block or method. -declare void @j3JavaObjectRelease(%JavaObject*) - -;;; isAssignableFrom - Returns if a type is a subtype of another type. -declare i1 @isAssignableFrom(%VT*, %VT*) readnone - -;;; isSecondaryClass - Returns if a type is a secondary super type of -;;; another type. -declare i1 @isSecondaryClass(%VT*, %VT*) readnone - -;;; getClassDelegatee - Returns the java/lang/Class representation of the -;;; class. This method is lowered to the GEP to the class delegatee in -;;; the common class. -declare %JavaObject* @getClassDelegatee(%JavaCommonClass*) - -;;; j3RuntimeDelegatee - Returns the java/lang/Class representation of the -;;; class. This method is called if the class delegatee has not been created -;;; yet. -declare %JavaObject* @j3RuntimeDelegatee(%JavaCommonClass*) - -;;; j3GetArrayClass - Get the array user class of the user class. -declare %VT* @j3GetArrayClass(%JavaClass*, i32, %VT**) readnone - -declare i8 @getFinalInt8Field(i8*) readnone -declare i16 @getFinalInt16Field(i16*) readnone -declare i32 @getFinalInt32Field(i32*) readnone -declare i64 @getFinalLongField(i64*) readnone -declare double @getFinalDoubleField(double*) readnone -declare float @getFinalFloatField(float*) readnone - -declare i8* @j3ResolveVirtualStub(%JavaObject*) -declare i8* @j3ResolveSpecialStub() -declare i8* @j3ResolveStaticStub() -declare i8* @j3ResolveInterface(%JavaObject*, %JavaMethod*, i32) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Exception methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -declare %JavaObject* @j3NullPointerException() -declare %JavaObject* @j3ClassCastException(%JavaObject*, %JavaCommonClass*) -declare %JavaObject* @j3IndexOutOfBoundsException(%JavaObject*, i32) -declare %JavaObject* @j3NegativeArraySizeException(i32) -declare %JavaObject* @j3OutOfMemoryError(i32) -declare %JavaObject* @j3StackOverflowError() -declare %JavaObject* @j3ArrayStoreException(%VT*, %VT*) -declare %JavaObject* @j3ArithmeticException() -declare void @j3ThrowException(%JavaObject*) -declare void @j3ThrowExceptionFromJIT() - -declare void @j3EndJNI(i32**) -declare void @j3StartJNI(i32*, i32**, i8*) - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Debugging methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -declare void @j3PrintExecution(i32, i32, %JavaMethod*) -declare void @j3PrintMethodStart(%JavaMethod*) -declare void @j3PrintMethodEnd(%JavaMethod*) Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Makefile?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Makefile (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Makefile Tue Dec 7 09:49:28 2010 @@ -21,6 +21,3 @@ CXX.Flags += -I$(PROJ_OBJ_DIR)/../Classpath -I$(PROJ_OBJ_DIR)/../LLVMRuntime -I$(PROJ_SRC_DIR)/../Classpath $(CLASSPATH_FLAGS) -I$(PROJ_SRC_DIR)/../../../include/j3 -ifeq ($(ISOLATE_BUILD), 1) - CXX.Flags += -I$(PROJ_SRC_DIR)/../Isolate -endif Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp Tue Dec 7 09:49:28 2010 @@ -326,8 +326,6 @@ VTType = PointerType::getUnqual(module->getTypeByName("VT")); MutatorThreadType = PointerType::getUnqual(module->getTypeByName("MutatorThread")); - OffsetIsolateIDInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 1); - OffsetVMInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 2); OffsetDoYieldInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 4); OffsetCXXExceptionInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 11); OffsetVMDataInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 12); Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/Makefile?rev=121140&r1=121139&r2=121140&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/Makefile (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/Makefile Tue Dec 7 09:49:28 2010 @@ -19,9 +19,9 @@ VMKIT_RUNTIME = $(PROJ_SRC_DIR)/mvm-runtime.ll ifeq ($(GC_MMTK), 1) -VMKIT_RUNTIME += $(PROJ_SRC_DIR)/runtime-mmtk-thread.ll +VMKIT_RUNTIME += $(PROJ_SRC_DIR)/mvm-mmtk-thread.ll else -VMKIT_RUNTIME += $(PROJ_SRC_DIR)/runtime-default-thread.ll +VMKIT_RUNTIME += $(PROJ_SRC_DIR)/mvm-mmap2-thread.ll endif BUILT_SOURCES = LLVMRuntime.inc Removed: vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-default-thread.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-default-thread.ll?rev=121139&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-default-thread.ll (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-default-thread.ll (removed) @@ -1,2 +0,0 @@ -;;; Field 0: the thread -%MutatorThread = type { %Thread } Removed: vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-mmtk-thread.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-mmtk-thread.ll?rev=121139&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-mmtk-thread.ll (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/runtime-mmtk-thread.ll (removed) @@ -1,7 +0,0 @@ -%BumpPtrAllocator = type { i32, 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* } From gael.thomas at lip6.fr Tue Dec 7 07:50:12 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 15:50:12 -0000 Subject: [vmkit-commits] [vmkit] r121141 - in /vmkit/branches/multi-vm/lib/J3/LLVMRuntime: runtime-isolate.ll runtime-service.ll runtime-single.ll Message-ID: <20101207155012.E835C2A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 09:50:12 2010 New Revision: 121141 URL: http://llvm.org/viewvc/llvm-project?rev=121141&view=rev Log: remove more useless .ll Removed: vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-isolate.ll vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-service.ll vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-single.ll Removed: vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-isolate.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-isolate.ll?rev=121140&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-isolate.ll (original) +++ vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-isolate.ll (removed) @@ -1,46 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;; Isolate specific types ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -%Jnjvm = type { %VT*, %JavaClass*, [9 x %JavaClass*] } - -%JavaCommonClass = type { [32 x %JavaObject*], - i16, %JavaClass**, i16, %UTF8*, %JavaClass*, i8*, - %VT* } - - -%JavaClass = type { %JavaCommonClass, i32, i32, [32 x %TaskClassMirror], - %JavaField*, i16, %JavaField*, i16, %JavaMethod*, i16, - %JavaMethod*, i16, i8*, %ArrayUInt8*, i8*, %Attribut*, - i16, %JavaClass**, i16, %JavaClass*, i16, i8, i8, i32, i32 } - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;; Isolate specific methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;; j3EnveloppeLookup - Find the enveloppe for the current user class. -declare i8* @j3EnveloppeLookup(%JavaClass*, i32, ...) readnone - -;;; j3StaticCtpLookup - Find the user constant pool at the given offset in -;;; the constant pool. -declare i8* @j3StaticCtpLookup(%JavaClass*, i32, ...) readnone - -;;; j3SpecialCtpLookup - Find the user constant pool at the given offset in -;;; the constant pool. -declare i8** @j3SpecialCtpLookup(i8**, i32, i8**) readnone - -;;; getCtpCacheNode - Get the constant pool cache of a cache node. This is a -;;; constant call because the cache node never changes. -declare i8** @getCtpCacheNode(%CacheNode*) readnone - -;;; getCtpCacheNode - Get the constant pool cache of a class. This is a -;;; constant call because the constant pool never changes. -declare i8** @getCtpClass(%JavaClass*) readnone - -;;; getJnjvmExceptionClass - Get the exception user class for the given -;;; isolate. -declare %JavaClass* @getJnjvmExceptionClass(%Jnjvm*) readnone - -;;; getJnjvmArrayClass - Get the array user class of the index, for the given -;;; isolate. -declare %JavaClass* @getJnjvmArrayClass(%Jnjvm*, i32) readnone Removed: vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-service.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-service.ll?rev=121140&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-service.ll (original) +++ vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-service.ll (removed) @@ -1,9 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;; Service specific methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;; j3ServiceCallStart - Mark the switching between services. -declare void @j3ServiceCallStart(i8*, i8*) - -;;; j3ServiceCallStop - Mark the switching between services. -declare void @j3ServiceCallStop(i8*, i8*) Removed: vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-single.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-single.ll?rev=121140&view=auto ============================================================================== --- vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-single.ll (original) +++ vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-single.ll (removed) @@ -1,12 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;; Isolate specific types ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -%JavaCommonClass = type { [1 x %JavaObject*], i16, - %JavaClass**, i16, %UTF8*, %JavaClass*, i8*, %VT* } - - -%JavaClass = type { %JavaCommonClass, i32, i32, [1 x %TaskClassMirror], - %JavaField*, i16, %JavaField*, i16, %JavaMethod*, i16, - %JavaMethod*, i16, i8*, %ArrayUInt8*, i8*, %Attribut*, - i16, %JavaClass**, i16, %JavaClass*, i16, i8, i8, i32, i32 } From gael.thomas at lip6.fr Tue Dec 7 08:00:16 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 16:00:16 -0000 Subject: [vmkit-commits] [vmkit] r121144 - /vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Message-ID: <20101207160016.AF7822A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 10:00:16 2010 New Revision: 121144 URL: http://llvm.org/viewvc/llvm-project?rev=121144&view=rev Log: move thread's field at the beginning of the class Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=121144&r1=121143&r2=121144&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Tue Dec 7 10:00:16 2010 @@ -157,6 +157,61 @@ /// contains all thread-specific informations. // WARNING: if you modify this class, you must also change mvm-runtime.ll class Thread : public CircularBase { +public: + /// IsolateID - The Isolate ID of the thread's VM. + size_t IsolateID; // 1 + + /// MyVM - The VM attached to this Thread. + VirtualMachine* MyVM; // 2 + + /// baseSP - The base stack pointer. + void* baseSP; // 3 + + /// doYield - Flag to tell the thread to yield for GC reasons. + bool doYield; // 4 + + /// inRV - Flag to tell that the thread is being part of a rendezvous. + bool inRV; // 5 + + /// joinedRV - Flag to tell that the thread has joined a rendezvous. + bool joinedRV; // 6 + +private: + /// lastSP - If the thread is running native code that can not be + /// interrupted, lastSP is not null and contains the value of the + /// stack pointer before entering native. + void* lastSP; // 7 + + /// internalThreadID - The implementation specific thread id. + void* internalThreadID; // 8 + +public: + /// routine - The function to invoke when the thread starts. + void (*routine)(mvm::Thread*); // 9 + + /// lastKnownFrame - The last frame that we know of, before resuming to JNI. + KnownFrame* lastKnownFrame; // 10 + +#ifdef RUNTIME_DWARF_EXCEPTIONS + void* internalPendingException; +#else + /// lastExceptionBuffer - The last exception buffer on this thread's stack. + ExceptionBuffer* lastExceptionBuffer; // 11 +#endif + + /// vmData - vm specific data + VMThreadData* vmData; // 12 + + /// pendingException - the pending exception + gc* pendingException; // 13 + + /// vmkit - a (shortcut) pointer to vmkit that contains information on all the vms + mvm::VMKit* vmkit; // 14 + + /// allVmsData - the array of thread specific data. + VMThreadData** allVmsData; // 15 + + protected: Thread(VMKit* vmk); @@ -186,30 +241,6 @@ return (uint64_t)this; } -public: - - /// IsolateID - The Isolate ID of the thread's VM. - size_t IsolateID; - - /// MyVM - The VM attached to this Thread. - VirtualMachine* MyVM; - - /// baseSP - The base stack pointer. - /// - void* baseSP; - - /// doYield - Flag to tell the thread to yield for GC reasons. - /// - bool doYield; - - /// inRV - Flag to tell that the thread is being part of a rendezvous. - /// - bool inRV; - - /// joinedRV - Flag to tell that the thread has joined a rendezvous. - /// - bool joinedRV; - /// get - Get the thread specific data of the current thread. /// static Thread* get() { @@ -218,16 +249,6 @@ private: - /// lastSP - If the thread is running native code that can not be - /// interrupted, lastSP is not null and contains the value of the - /// stack pointer before entering native. - /// - void* lastSP; - - /// internalThreadID - The implementation specific thread id. - /// - void* internalThreadID; - /// internalThreadStart - The implementation sepcific thread starter /// function. /// @@ -314,10 +335,6 @@ void operator delete(void* th); virtual ~Thread(); - /// routine - The function to invoke when the thread starts. - /// - void (*routine)(mvm::Thread*); - /// printBacktrace - Print the backtrace. /// void printBacktrace(); @@ -330,40 +347,11 @@ /// uint32_t getFrameContextLength(); - /// lastKnownFrame - The last frame that we know of, before resuming to JNI. - /// - KnownFrame* lastKnownFrame; - -#ifdef RUNTIME_DWARF_EXCEPTIONS - void* internalPendingException; -#else - /// lastExceptionBuffer - The last exception buffer on this thread's stack. - /// - ExceptionBuffer* lastExceptionBuffer; -#endif - void startKnownFrame(KnownFrame& F) __attribute__ ((noinline)); void endKnownFrame(); void startUnknownFrame(KnownFrame& F) __attribute__ ((noinline)); void endUnknownFrame(); - /// vmData - vm specific data - /// - VMThreadData* vmData; - - /// pendingException - the pending exception - /// - gc* pendingException; - -public: - /// vmkit - a (shortcut) pointer to vmkit that contains information on all the vms - /// - mvm::VMKit* vmkit; - - /// allVmsData - the array of thread specific data. - /// - VMThreadData** allVmsData; - /// reallocAllVmsData - realloc the allVmsData from old to n or 0 to n if allVmsData=0 /// must be protected by rendezvous.threadLock /// From gael.thomas at lip6.fr Tue Dec 7 08:19:52 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 16:19:52 -0000 Subject: [vmkit-commits] [vmkit] r121145 - in /vmkit/branches/multi-vm: find-it.sh include/mvm/Threads/Thread.h lib/J3/Makefile lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/Compiler/JIT.cpp lib/Mvm/Compiler/mvm-runtime.ll tools/j3/Makefile tools/vmkit/Makefile Message-ID: <20101207161952.C2CC32A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 10:19:52 2010 New Revision: 121145 URL: http://llvm.org/viewvc/llvm-project?rev=121145&view=rev Log: remove IsolateID from the thread Modified: vmkit/branches/multi-vm/find-it.sh vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/J3/Makefile vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll vmkit/branches/multi-vm/tools/j3/Makefile vmkit/branches/multi-vm/tools/vmkit/Makefile Modified: vmkit/branches/multi-vm/find-it.sh URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/find-it.sh?rev=121145&r1=121144&r2=121145&view=diff ============================================================================== --- vmkit/branches/multi-vm/find-it.sh (original) +++ vmkit/branches/multi-vm/find-it.sh Tue Dec 7 10:19:52 2010 @@ -6,6 +6,6 @@ else - grep --exclude-dir IJvm --exclude-dir Isolate --exclude *.txt --exclude-dir autoconf --exclude config.status --exclude config.log --exclude configure --exclude *.xml --exclude *.html --exclude *.jar --exclude *.bc --exclude MMTkInline.inc --exclude-dir patches --exclude-dir N3 --exclude *.java --exclude *.class -R --exclude-dir .svn --exclude-dir Release --exclude *.s "$1" . + grep --exclude find-it.sh --exclude-dir IJvm --exclude-dir Isolate --exclude *.txt --exclude-dir autoconf --exclude config.status --exclude config.log --exclude configure --exclude *.xml --exclude *.html --exclude *.jar --exclude *.bc --exclude MMTkInline.inc --exclude-dir patches --exclude-dir N3 --exclude *.java --exclude *.class -R --exclude-dir .svn --exclude-dir Release --exclude *.s "$1" . fi \ No newline at end of file Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=121145&r1=121144&r2=121145&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Tue Dec 7 10:19:52 2010 @@ -158,58 +158,55 @@ // WARNING: if you modify this class, you must also change mvm-runtime.ll class Thread : public CircularBase { public: - /// IsolateID - The Isolate ID of the thread's VM. - size_t IsolateID; // 1 + /// doYield - Flag to tell the thread to yield for GC reasons. + bool doYield; // 1 - intrinsic + +#ifdef RUNTIME_DWARF_EXCEPTIONS + void* internalPendingException; +#else + /// lastExceptionBuffer - The last exception buffer on this thread's stack. + ExceptionBuffer* lastExceptionBuffer; // 2 - intrinsic +#endif + + /// vmData - vm specific data - notice that vmkit do not consider that this field has a value + VMThreadData* vmData; // 3 - intrinsic + + /// pendingException - the pending exception + gc* pendingException; // 4 - intrinsic + + /// vmkit - a (shortcut) pointer to vmkit that contains information on all the vms + mvm::VMKit* vmkit; // 5 /// MyVM - The VM attached to this Thread. - VirtualMachine* MyVM; // 2 + VirtualMachine* MyVM; // 6 /// baseSP - The base stack pointer. - void* baseSP; // 3 - - /// doYield - Flag to tell the thread to yield for GC reasons. - bool doYield; // 4 + void* baseSP; // 7 /// inRV - Flag to tell that the thread is being part of a rendezvous. - bool inRV; // 5 + bool inRV; // 8 /// joinedRV - Flag to tell that the thread has joined a rendezvous. - bool joinedRV; // 6 + bool joinedRV; // 9 private: /// lastSP - If the thread is running native code that can not be /// interrupted, lastSP is not null and contains the value of the /// stack pointer before entering native. - void* lastSP; // 7 + void* lastSP; // 10 /// internalThreadID - The implementation specific thread id. - void* internalThreadID; // 8 + void* internalThreadID; // 11 public: /// routine - The function to invoke when the thread starts. - void (*routine)(mvm::Thread*); // 9 + void (*routine)(mvm::Thread*); // 12 /// lastKnownFrame - The last frame that we know of, before resuming to JNI. - KnownFrame* lastKnownFrame; // 10 - -#ifdef RUNTIME_DWARF_EXCEPTIONS - void* internalPendingException; -#else - /// lastExceptionBuffer - The last exception buffer on this thread's stack. - ExceptionBuffer* lastExceptionBuffer; // 11 -#endif - - /// vmData - vm specific data - VMThreadData* vmData; // 12 - - /// pendingException - the pending exception - gc* pendingException; // 13 - - /// vmkit - a (shortcut) pointer to vmkit that contains information on all the vms - mvm::VMKit* vmkit; // 14 + KnownFrame* lastKnownFrame; // 13 /// allVmsData - the array of thread specific data. - VMThreadData** allVmsData; // 15 + VMThreadData** allVmsData; // 14 protected: Modified: vmkit/branches/multi-vm/lib/J3/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Makefile?rev=121145&r1=121144&r2=121145&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Makefile (original) +++ vmkit/branches/multi-vm/lib/J3/Makefile Tue Dec 7 10:19:52 2010 @@ -11,12 +11,5 @@ DIRS = LLVMRuntime VMCore Classpath Compiler include $(LEVEL)/Makefile.config - -ifeq ($(ISOLATE_SHARING_BUILD), 1) - DIRS += Isolate -endif - - - include $(LEVEL)/Makefile.common Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp?rev=121145&r1=121144&r2=121145&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/CollectionRV.cpp Tue Dec 7 10:19:52 2010 @@ -199,7 +199,7 @@ cur->joinedRV = false; } - assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); + assert(nbJoined == initiator->vmkit->NumberOfThreads && "Inconsistent state"); nbJoined = 0; condEndRV.broadcast(); unlockRV(); Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp?rev=121145&r1=121144&r2=121145&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/JIT.cpp Tue Dec 7 10:19:52 2010 @@ -326,10 +326,10 @@ VTType = PointerType::getUnqual(module->getTypeByName("VT")); MutatorThreadType = PointerType::getUnqual(module->getTypeByName("MutatorThread")); - OffsetDoYieldInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 4); - OffsetCXXExceptionInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 11); - OffsetVMDataInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 12); - OffsetPendingExceptionInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 13); + OffsetDoYieldInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 1); + OffsetCXXExceptionInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 2); + OffsetVMDataInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 3); + OffsetPendingExceptionInThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 4); OffsetThreadInMutatorThreadConstant = ConstantInt::get(Type::getInt32Ty(Context), 0); } Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll?rev=121145&r1=121144&r2=121145&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll Tue Dec 7 10:19:52 2010 @@ -8,22 +8,21 @@ %CircularBase = type { %VT*, %CircularBase*, %CircularBase* } ;;; Field 0: the parent (circular base) -;;; Field 1: size_t IsolateID -;;; Field 2: void* MyVM -;;; Field 3: void* baseSP -;;; Field 4: char doYield -;;; 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 -;;; field 12: void* vmData -;;; field 13: gc* pendingException -;;; field 14: VMkit* vmkit -;;; field 15: void* allVMDatas -%Thread = type { %CircularBase, i32, i8*, i8*, i1, i1, i1, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8* } +;;; Field 1: bool doYield +;;; field 2: void* lastExceptionBuffer/internalPendingException +;;; field 3: void* vmData +;;; field 4: gc* pendingException +;;; field 5: VMkit* vmkit +;;; Field 6: void* MyVM +;;; Field 7: void* baseSP +;;; Field 8: bool inRV +;;; Field 9: bool joinedRV +;;; Field 10: void* lastSP +;;; Field 11: void* internalThreadID +;;; field 12: void* routine +;;; field 13: void* lastKnownFrame +;;; field 14: void* allVMDatas +%Thread = type { %CircularBase, i1, i8*, i8*, i8*, i8*, i8*, i8*, i1, i1, i8*, i8*, i8*, i8*, i8* } ;;; field 0: VT ;;; field 1: mvm::MutatorThread* mut Modified: vmkit/branches/multi-vm/tools/j3/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/j3/Makefile?rev=121145&r1=121144&r2=121145&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/j3/Makefile (original) +++ vmkit/branches/multi-vm/tools/j3/Makefile Tue Dec 7 10:19:52 2010 @@ -24,10 +24,6 @@ USEDMODULES += $(GCLIB).bc endif - ifeq ($(ISOLATE_SHARING_BUILD), 1) - USEDMODULES += Isolate.bc - endif - BUILT_SOURCES = j3.s SOURCES = j3.s $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp)) @@ -36,10 +32,6 @@ USEDLIBS = J3.a Classpath.a J3.a J3Compiler.a Allocator.a \ Mvm.a MvmCompiler.a $(GCLIB).a Allocator.a CommonThread.a - ifeq ($(ISOLATE_SHARING_BUILD), 1) - USEDLIBS += Isolate - endif - endif LINK_COMPONENTS = jit nativecodegen scalaropts instrumentation ipa ipo bitreader asmparser linker Modified: vmkit/branches/multi-vm/tools/vmkit/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/Makefile?rev=121145&r1=121144&r2=121145&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmkit/Makefile (original) +++ vmkit/branches/multi-vm/tools/vmkit/Makefile Tue Dec 7 10:19:52 2010 @@ -21,10 +21,6 @@ USEDMODULES += J3.bc Classpath.bc J3Compiler.bc endif - ifeq ($(ISOLATE_SHARING_BUILD), 1) - USEDMODULES += Isolate.bc - endif - ifeq ($(WITH_N3_PNETLIB), 1) USEDMODULES += N3.bc PNetLib.bc endif @@ -42,21 +38,17 @@ else - + USEDLIBS += Allocator.a Mvm.a MvmCompiler.a $(GCLIB).a CommonThread.a ifeq ($(WITH_J3), 1) USEDLIBS += J3.a Classpath.a J3.a J3Compiler.a endif - ifeq ($(ISOLATE_SHARING_BUILD), 1) - USEDLIBS += Isolate.a - endif - ifeq ($(WITH_N3_PNETLIB), 1) USEDLIBS += N3.a PNetLib.a endif - + USEDLIBS += Allocator.a Mvm.a MvmCompiler.a $(GCLIB).a CommonThread.a endif From gael.thomas at lip6.fr Tue Dec 7 08:31:15 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 16:31:15 -0000 Subject: [vmkit-commits] [vmkit] r121147 - in /vmkit/branches/multi-vm: lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h tools/j3/Main.cpp tools/vmjc/vmjc.cpp tools/vmkit/Launcher.cpp Message-ID: <20101207163115.E14132A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 10:31:15 2010 New Revision: 121147 URL: http://llvm.org/viewvc/llvm-project?rev=121147&view=rev Log: allocate the jnjvm bootstrap class loadr in the constructor of jnjvm Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/tools/j3/Main.cpp vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=121147&r1=121146&r2=121147&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Tue Dec 7 10:31:15 2010 @@ -414,9 +414,7 @@ newArgv[1] = mainClass; JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule"); - JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") - JnjvmBootstrapLoader(Allocator, Comp, true); - Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader); + Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, Comp, true); vm->runApplication(argc + 1, newArgv); vm->waitForExit(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121147&r1=121146&r2=121147&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Tue Dec 7 10:31:15 2010 @@ -1339,11 +1339,12 @@ javaMainThread->mut->start((void (*)(mvm::Thread*))mainJavaStart); } -Jnjvm::Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JnjvmBootstrapLoader* loader) : +Jnjvm::Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JavaCompiler* Comp, bool dlLoad) : VirtualMachine(Alloc, vmkit), lockSystem(Alloc) { - loader->isolate = this; + bootstrapLoader = new(Alloc, "bootstrap loader") JnjvmBootstrapLoader(Alloc, Comp, dlLoad); + bootstrapLoader->isolate = this; initialiseInternalVTs(); @@ -1354,12 +1355,11 @@ jniEnv = &JNI_JNIEnvTable; javavmEnv = &JNI_JavaVMTable; - bootstrapLoader = loader; upcalls = bootstrapLoader->upcalls; throwable = upcalls->newThrowable; - StringList* end = loader->strings; + StringList* end = bootstrapLoader->strings; while (end) { for (uint32 i = 0; i < end->length; ++i) { JavaString* obj = end->strings[i]; @@ -1466,9 +1466,8 @@ mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); JavaCompiler* Comp = new JavaCompiler(); - JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") - JnjvmBootstrapLoader(Allocator, Comp, true); - Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader); + + Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, Comp, true); mvm::ThreadAllocator thallocator; char** newArgv = (char**)thallocator.Allocate((argc + 1) * sizeof(char*)); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121147&r1=121146&r2=121147&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Tue Dec 7 10:31:15 2010 @@ -330,7 +330,7 @@ /// Jnjvm - Allocates a new JVM. /// - Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JnjvmBootstrapLoader* loader); + Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JavaCompiler* Comp, bool dlLoad); /// runApplication - Runs the application with the given command line. /// User-visible function, inherited by the VirtualMachine class. Modified: vmkit/branches/multi-vm/tools/j3/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/j3/Main.cpp?rev=121147&r1=121146&r2=121147&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/j3/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/j3/Main.cpp Tue Dec 7 10:31:15 2010 @@ -37,9 +37,7 @@ // Create the allocator that will allocate the bootstrap loader and the JVM. JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule"); - JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") - JnjvmBootstrapLoader(Allocator, Comp, true); - Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader); + Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, Comp, true); // Run the application. vm->runApplication(argc, argv); Modified: vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp?rev=121147&r1=121146&r2=121147&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp (original) +++ vmkit/branches/multi-vm/tools/vmjc/vmjc.cpp Tue Dec 7 10:31:15 2010 @@ -177,15 +177,12 @@ JavaAOTCompiler* Comp = new JavaAOTCompiler("AOT"); - 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(); - Jnjvm* vm = new(allocator, "Bootstrap loader") Jnjvm(allocator, vmkit, loader); + Jnjvm* vm = new(allocator, "Bootstrap loader") Jnjvm(allocator, vmkit, Comp, false); for (std::vector::iterator i = Properties.begin(), e = Properties.end(); i != e; ++i) { Modified: vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp?rev=121147&r1=121146&r2=121147&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp (original) +++ vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Tue Dec 7 10:31:15 2010 @@ -73,9 +73,7 @@ if (VMToRun == RunJava) { JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule"); - JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader") - JnjvmBootstrapLoader(Allocator, Comp, true); - Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, loader); + Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, Comp, true); vm->runApplication(argc, argv); vm->waitForExit(); } From gael.thomas at lip6.fr Tue Dec 7 08:37:39 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Tue, 07 Dec 2010 16:37:39 -0000 Subject: [vmkit-commits] [vmkit] r121148 - in /vmkit/branches/multi-vm/lib/J3/VMCore: Jnjvm.cpp JnjvmClassLoader.cpp JnjvmClassLoader.h Message-ID: <20101207163739.620162A6C12C@llvm.org> Author: gthomas Date: Tue Dec 7 10:37:39 2010 New Revision: 121148 URL: http://llvm.org/viewvc/llvm-project?rev=121148&view=rev Log: a class loader holds now a pointer to its vm Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121148&r1=121147&r2=121148&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Tue Dec 7 10:37:39 2010 @@ -1343,7 +1343,7 @@ VirtualMachine(Alloc, vmkit), lockSystem(Alloc) { - bootstrapLoader = new(Alloc, "bootstrap loader") JnjvmBootstrapLoader(Alloc, Comp, dlLoad); + bootstrapLoader = new(Alloc, "bootstrap loader") JnjvmBootstrapLoader(Alloc, this, Comp, dlLoad); bootstrapLoader->isolate = this; initialiseInternalVTs(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=121148&r1=121147&r2=121148&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Tue Dec 7 10:37:39 2010 @@ -61,9 +61,10 @@ JnjvmBootstrapLoader::JnjvmBootstrapLoader(mvm::BumpPtrAllocator& Alloc, + Jnjvm* vm, JavaCompiler* Comp, bool dlLoad) : - JnjvmClassLoader(Alloc) { + JnjvmClassLoader(Alloc, vm) { TheCompiler = Comp; @@ -262,9 +263,13 @@ JnjvmClassLoader::JnjvmClassLoader(mvm::BumpPtrAllocator& Alloc, JnjvmClassLoader& JCL, JavaObject* loader, VMClassLoader* vmdata, - Jnjvm* I) : allocator(Alloc) { + Jnjvm* I, + Jnjvm* v) : allocator(Alloc) { llvm_gcroot(loader, 0); llvm_gcroot(vmdata, 0); + + vm = v; + bootstrapLoader = JCL.bootstrapLoader; TheCompiler = bootstrapLoader->getCompiler()->Create("Applicative loader"); @@ -872,7 +877,7 @@ vmdata = VMClassLoader::allocate(vm); mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator(); JCL = new(*A, "Class loader") JnjvmClassLoader(*A, *vm->bootstrapLoader, - loader, vmdata, vm); + loader, vmdata, vm, vm); upcalls->vmdataClassLoader->setInstanceObjectField(loader, (JavaObject*)vmdata); } JavaObject::release(loader); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h?rev=121148&r1=121147&r2=121148&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h Tue Dec 7 10:37:39 2010 @@ -58,6 +58,10 @@ /// Jnjvm* isolate; + /// vm - my vm + /// + Jnjvm* vm; + /// javaLoder - The Java representation of the class loader. Null for the /// bootstrap class loader. /// @@ -77,7 +81,7 @@ /// first use of a Java class loader. /// JnjvmClassLoader(mvm::BumpPtrAllocator& Alloc, JnjvmClassLoader& JCL, - JavaObject* loader, VMClassLoader* vmdata, Jnjvm* isolate); + JavaObject* loader, VMClassLoader* vmdata, Jnjvm* isolate, Jnjvm* vm); /// lookupComponentName - Try to find the component name of the given array /// name. If the component name is not in the table of UTF8s and holder @@ -88,7 +92,7 @@ protected: friend class Jnjvm; - JnjvmClassLoader(mvm::BumpPtrAllocator& Alloc) : allocator(Alloc) {} + JnjvmClassLoader(mvm::BumpPtrAllocator& Alloc, Jnjvm* v) : allocator(Alloc) { vm = v; } /// TheCompiler - The Java compiler for this class loader. /// @@ -352,8 +356,7 @@ /// to do before any execution of a JVM. Also try to load libvmjc.so /// if dlLoad is not false. /// - JnjvmBootstrapLoader(mvm::BumpPtrAllocator& Alloc, JavaCompiler* Comp, - bool dlLoad); + JnjvmBootstrapLoader(mvm::BumpPtrAllocator& Alloc, Jnjvm* vm, JavaCompiler* Comp, bool dlLoad); virtual JavaString** UTF8ToStr(const UTF8* utf8); From gael.thomas at lip6.fr Wed Dec 8 02:29:13 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 10:29:13 -0000 Subject: [vmkit-commits] [vmkit] r121248 - in /vmkit/branches/multi-vm/lib/J3: Classpath/Classpath.inc Classpath/ClasspathVMClass.inc Classpath/ClasspathVMRuntime.inc Classpath/JavaUpcalls.cpp Classpath/JavaUpcalls.h Compiler/ExceptionsCheck.inc Compiler/ExceptionsDwarf.inc Compiler/JavaAOTCompiler.cpp Compiler/JavaJIT.cpp Compiler/JavaJIT.h Compiler/JavaJITOpcodes.cpp VMCore/JavaClass.cpp VMCore/JavaConstantPool.cpp VMCore/Jni.cpp VMCore/Jnjvm.cpp VMCore/JnjvmClassLoader.cpp VMCore/JnjvmClassLoader.h VMCore/VirtualTables.cpp Message-ID: <20101208102913.740B62A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 04:29:13 2010 New Revision: 121248 URL: http://llvm.org/viewvc/llvm-project?rev=121248&view=rev Log: remove useless bootstrapLoader from classLoader, move the primitive classes in upcalls Modified: vmkit/branches/multi-vm/lib/J3/Classpath/Classpath.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.h vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Modified: vmkit/branches/multi-vm/lib/J3/Classpath/Classpath.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/Classpath.inc?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/Classpath.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/Classpath.inc Wed Dec 8 04:29:13 2010 @@ -38,8 +38,8 @@ UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, true); if (cl->isClass() && - cl->asClass()->lookupMethodDontThrow(vm->bootstrapLoader->clinitName, - vm->bootstrapLoader->clinitType, + cl->asClass()->lookupMethodDontThrow(vm->upcalls->clinitName, + vm->upcalls->clinitType, true, false, 0)) res = true; Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc Wed Dec 8 04:29:13 2010 @@ -100,13 +100,12 @@ ret = (ArrayObject*)vm->upcalls->constructorArrayClass->doNew(0, vm); } else { UserClass* realCl = cl->asClass();; - JnjvmClassLoader* classLoader = cl->classLoader; uint32 size = 0; for (uint32 i = 0; i < realCl->nbVirtualMethods; ++i) { JavaMethod* meth = &realCl->virtualMethods[i]; bool pub = isPublic(meth->access); - if (meth->name->equals(classLoader->bootstrapLoader->initName) && + if (meth->name->equals(vm->upcalls->initName) && (!publicOnly || pub)) { ++size; } @@ -118,7 +117,7 @@ for (uint32 i = 0; i < realCl->nbVirtualMethods; ++i) { JavaMethod* meth = &realCl->virtualMethods[i]; bool pub = isPublic(meth->access); - if (meth->name->equals(classLoader->bootstrapLoader->initName) && + if (meth->name->equals(vm->upcalls->initName) && (!publicOnly || pub)) { UserClass* Cons = vm->upcalls->newConstructor; tmp = Cons->doNew(vm); @@ -160,14 +159,13 @@ ret = (ArrayObject*)upcalls->methodArrayClass->doNew(0, vm); } else { UserClass* realCl = cl->asClass(); - JnjvmClassLoader* classLoader = cl->classLoader; uint32 size = 0; for (uint32 i = 0; i < realCl->nbVirtualMethods + realCl->nbStaticMethods; ++i) { JavaMethod* meth = &realCl->virtualMethods[i]; bool pub = isPublic(meth->access); - if (!(meth->name->equals(classLoader->bootstrapLoader->initName)) && + if (!(meth->name->equals(vm->upcalls->initName)) && (!publicOnly || pub)) { ++size; } @@ -181,7 +179,7 @@ ++i) { JavaMethod* meth = &realCl->virtualMethods[i]; bool pub = isPublic(meth->access); - if (!(meth->name->equals(classLoader->bootstrapLoader->initName)) && + if (!(meth->name->equals(vm->upcalls->initName)) && (!publicOnly || pub)) { // TODO: check parameter types UserClass* Meth = vm->upcalls->newMethod; Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc Wed Dec 8 04:29:13 2010 @@ -52,18 +52,18 @@ utf8Lib = JavaString::getValue(strLib); uint32 stLib = strLib->offset; sint32 lgLib = strLib->count; - sint32 lgPre = vm->bootstrapLoader->prelib->size; - sint32 lgPost = vm->bootstrapLoader->postlib->size; + sint32 lgPre = vm->upcalls->prelib->size; + sint32 lgPost = vm->upcalls->postlib->size; uint32 size = (uint32)(lgPre + lgLib + lgPost); array = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(size, vm); uint16* elements = ArrayUInt16::getElements(array); - memmove(elements, vm->bootstrapLoader->prelib->elements, + memmove(elements, vm->upcalls->prelib->elements, lgPre * sizeof(uint16)); memmove(&(elements[lgPre]), ArrayUInt16::getElements(utf8Lib) + stLib, lgLib * sizeof(uint16)); - memmove(&(elements[lgPre + lgLib]), vm->bootstrapLoader->postlib->elements, + memmove(&(elements[lgPre + lgLib]), vm->upcalls->postlib->elements, lgPost * sizeof(uint16)); res = vm->constructString(array); Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp Wed Dec 8 04:29:13 2010 @@ -17,6 +17,18 @@ #include "Jnjvm.h" #include "mvm/SystemThreads.h" #include "mvm/VMKit.h" +#include "j3/JavaCompiler.h" +#include "JavaTypes.h" + +// for dlopen and dlsym +#include + +using namespace j3; + +typedef void (*static_init_t)(JnjvmClassLoader*); + +const UTF8* JavaCompiler::InlinePragma = 0; +const UTF8* JavaCompiler::NoInlinePragma = 0; #define COMPILE_METHODS(cl) \ for (CommonClass::method_iterator i = cl->virtualMethods.begin(), \ @@ -29,203 +41,6 @@ i->second->compiledPtr(); \ } - -using namespace j3; - -Class* Classpath::newThread; -Class* Classpath::newVMThread; -JavaField* Classpath::assocThread; -JavaField* Classpath::vmdataVMThread; -JavaMethod* Classpath::finaliseCreateInitialThread; -JavaMethod* Classpath::initVMThread; -JavaMethod* Classpath::groupAddThread; -JavaField* Classpath::threadName; -JavaField* Classpath::groupName; -JavaMethod* Classpath::initGroup; -JavaField* Classpath::priority; -JavaField* Classpath::daemon; -JavaField* Classpath::group; -JavaField* Classpath::running; -Class* Classpath::threadGroup; -JavaField* Classpath::rootGroup; -JavaField* Classpath::vmThread; -JavaMethod* Classpath::uncaughtException; -Class* Classpath::inheritableThreadLocal; - -JavaMethod* Classpath::runVMThread; -JavaMethod* Classpath::setContextClassLoader; -JavaMethod* Classpath::getSystemClassLoader; -Class* Classpath::newString; -Class* Classpath::newClass; -Class* Classpath::newThrowable; -Class* Classpath::newException; -JavaMethod* Classpath::initClass; -JavaMethod* Classpath::initClassWithProtectionDomain; -JavaField* Classpath::vmdataClass; -JavaMethod* Classpath::setProperty; -JavaMethod* Classpath::initString; -JavaMethod* Classpath::getCallingClassLoader; -JavaMethod* Classpath::initConstructor; -Class* Classpath::newConstructor; -ClassArray* Classpath::constructorArrayClass; -ClassArray* Classpath::constructorArrayAnnotation; -JavaField* Classpath::constructorSlot; -JavaMethod* Classpath::initMethod; -JavaMethod* Classpath::initField; -Class* Classpath::newField; -Class* Classpath::newMethod; -ClassArray* Classpath::methodArrayClass; -ClassArray* Classpath::fieldArrayClass; -JavaField* Classpath::methodSlot; -JavaField* Classpath::fieldSlot; -ClassArray* Classpath::classArrayClass; -JavaMethod* Classpath::loadInClassLoader; -JavaMethod* Classpath::initVMThrowable; -JavaField* Classpath::vmDataVMThrowable; -Class* Classpath::newVMThrowable; -JavaField* Classpath::bufferAddress; -JavaField* Classpath::dataPointer32; -JavaField* Classpath::dataPointer64; -Class* Classpath::newPointer32; -Class* Classpath::newPointer64; -Class* Classpath::newDirectByteBuffer; -JavaField* Classpath::vmdataClassLoader; -JavaMethod* Classpath::InitDirectByteBuffer; -Class* Classpath::newClassLoader; - - -JavaField* Classpath::boolValue; -JavaField* Classpath::byteValue; -JavaField* Classpath::shortValue; -JavaField* Classpath::charValue; -JavaField* Classpath::intValue; -JavaField* Classpath::longValue; -JavaField* Classpath::floatValue; -JavaField* Classpath::doubleValue; - -Class* Classpath::newStackTraceElement; -ClassArray* Classpath::stackTraceArray; -JavaMethod* Classpath::initStackTraceElement; - -Class* Classpath::voidClass; -Class* Classpath::boolClass; -Class* Classpath::byteClass; -Class* Classpath::shortClass; -Class* Classpath::charClass; -Class* Classpath::intClass; -Class* Classpath::floatClass; -Class* Classpath::doubleClass; -Class* Classpath::longClass; - -Class* Classpath::vmStackWalker; - -Class* Classpath::InvocationTargetException; -Class* Classpath::ArrayStoreException; -Class* Classpath::ClassCastException; -Class* Classpath::IllegalMonitorStateException; -Class* Classpath::IllegalArgumentException; -Class* Classpath::InterruptedException; -Class* Classpath::IndexOutOfBoundsException; -Class* Classpath::ArrayIndexOutOfBoundsException; -Class* Classpath::NegativeArraySizeException; -Class* Classpath::NullPointerException; -Class* Classpath::SecurityException; -Class* Classpath::ClassFormatError; -Class* Classpath::ClassCircularityError; -Class* Classpath::NoClassDefFoundError; -Class* Classpath::UnsupportedClassVersionError; -Class* Classpath::NoSuchFieldError; -Class* Classpath::NoSuchMethodError; -Class* Classpath::InstantiationError; -Class* Classpath::InstantiationException; -Class* Classpath::IllegalAccessError; -Class* Classpath::IllegalAccessException; -Class* Classpath::VerifyError; -Class* Classpath::ExceptionInInitializerError; -Class* Classpath::LinkageError; -Class* Classpath::AbstractMethodError; -Class* Classpath::UnsatisfiedLinkError; -Class* Classpath::InternalError; -Class* Classpath::OutOfMemoryError; -Class* Classpath::StackOverflowError; -Class* Classpath::UnknownError; -Class* Classpath::ClassNotFoundException; -Class* Classpath::ArithmeticException; - -JavaMethod* Classpath::InitInvocationTargetException; -JavaMethod* Classpath::InitArrayStoreException; -JavaMethod* Classpath::InitClassCastException; -JavaMethod* Classpath::InitIllegalMonitorStateException; -JavaMethod* Classpath::InitIllegalArgumentException; -JavaMethod* Classpath::InitInterruptedException; -JavaMethod* Classpath::InitIndexOutOfBoundsException; -JavaMethod* Classpath::InitArrayIndexOutOfBoundsException; -JavaMethod* Classpath::InitNegativeArraySizeException; -JavaMethod* Classpath::InitNullPointerException; -JavaMethod* Classpath::InitSecurityException; -JavaMethod* Classpath::InitClassFormatError; -JavaMethod* Classpath::InitClassCircularityError; -JavaMethod* Classpath::InitNoClassDefFoundError; -JavaMethod* Classpath::InitUnsupportedClassVersionError; -JavaMethod* Classpath::InitNoSuchFieldError; -JavaMethod* Classpath::InitNoSuchMethodError; -JavaMethod* Classpath::InitInstantiationError; -JavaMethod* Classpath::InitInstantiationException; -JavaMethod* Classpath::InitIllegalAccessError; -JavaMethod* Classpath::InitIllegalAccessException; -JavaMethod* Classpath::InitVerifyError; -JavaMethod* Classpath::InitExceptionInInitializerError; -JavaMethod* Classpath::InitLinkageError; -JavaMethod* Classpath::InitAbstractMethodError; -JavaMethod* Classpath::InitUnsatisfiedLinkError; -JavaMethod* Classpath::InitInternalError; -JavaMethod* Classpath::InitOutOfMemoryError; -JavaMethod* Classpath::InitStackOverflowError; -JavaMethod* Classpath::InitUnknownError; -JavaMethod* Classpath::InitClassNotFoundException; -JavaMethod* Classpath::InitArithmeticException; -JavaMethod* Classpath::InitObject; -JavaMethod* Classpath::FinalizeObject; -JavaMethod* Classpath::IntToString; - -JavaMethod* Classpath::SystemArraycopy; -JavaMethod* Classpath::VMSystemArraycopy; -Class* Classpath::SystemClass; - -JavaMethod* Classpath::ErrorWithExcpNoClassDefFoundError; -JavaMethod* Classpath::ErrorWithExcpExceptionInInitializerError; -JavaMethod* Classpath::ErrorWithExcpInvocationTargetException; - -ClassArray* Classpath::ArrayOfByte; -ClassArray* Classpath::ArrayOfChar; -ClassArray* Classpath::ArrayOfString; -ClassArray* Classpath::ArrayOfInt; -ClassArray* Classpath::ArrayOfShort; -ClassArray* Classpath::ArrayOfBool; -ClassArray* Classpath::ArrayOfLong; -ClassArray* Classpath::ArrayOfFloat; -ClassArray* Classpath::ArrayOfDouble; -ClassArray* Classpath::ArrayOfObject; - -ClassPrimitive* Classpath::OfByte; -ClassPrimitive* Classpath::OfChar; -ClassPrimitive* Classpath::OfInt; -ClassPrimitive* Classpath::OfShort; -ClassPrimitive* Classpath::OfBool; -ClassPrimitive* Classpath::OfLong; -ClassPrimitive* Classpath::OfFloat; -ClassPrimitive* Classpath::OfDouble; -ClassPrimitive* Classpath::OfVoid; - -Class* Classpath::OfObject; - -JavaField* Classpath::methodClass; -JavaField* Classpath::fieldClass; -JavaField* Classpath::constructorClass; - -JavaMethod* Classpath::EnqueueReference; -Class* Classpath::newReference; - void Classpath::CreateJavaThread(Jnjvm* vm, JavaThread* myth, const char* thName, JavaObject* Group) { JavaObjectVMThread* vmth = NULL; @@ -543,7 +358,162 @@ return ret; } -void Classpath::initialiseClasspath(JnjvmClassLoader* loader) { + +Classpath::Classpath(JnjvmBootstrapLoader* loader, bool dlLoad) { + + // Try to find if we have a pre-compiled rt.jar + if (dlLoad) { + SuperArray = (Class*)dlsym(SELF_HANDLE, "java_lang_Object"); + if (!SuperArray) { + loader->nativeHandle = dlopen("libvmjc"DYLD_EXTENSION, RTLD_LAZY | RTLD_GLOBAL); + if (loader->nativeHandle) { + // Found it! + SuperArray = (Class*)dlsym(loader->nativeHandle, "java_lang_Object"); + } + } + + if (SuperArray) { + assert(TheCompiler && + "Loading libvmjc"DYLD_EXTENSION" requires a compiler"); + ClassArray::SuperArray = (Class*)SuperArray->getInternal(); + + // Get the native classes. + OfVoid = (ClassPrimitive*)dlsym(loader->nativeHandle, "void"); + OfBool = (ClassPrimitive*)dlsym(loader->nativeHandle, "boolean"); + OfByte = (ClassPrimitive*)dlsym(loader->nativeHandle, "byte"); + OfChar = (ClassPrimitive*)dlsym(loader->nativeHandle, "char"); + OfShort = (ClassPrimitive*)dlsym(loader->nativeHandle, "short"); + OfInt = (ClassPrimitive*)dlsym(loader->nativeHandle, "int"); + OfFloat = (ClassPrimitive*)dlsym(loader->nativeHandle, "float"); + OfLong = (ClassPrimitive*)dlsym(loader->nativeHandle, "long"); + OfDouble = (ClassPrimitive*)dlsym(loader->nativeHandle, "double"); + + + // We have the java/lang/Object class, execute the static initializer. + static_init_t init = (static_init_t)(uintptr_t)SuperArray->classLoader; + assert(init && "Loaded the wrong boot library"); + init(loader); + + // Get the base object arrays after the init, because init puts arrays + // in the class loader map. + ArrayOfString = + loader->constructArray(loader->asciizConstructUTF8("[Ljava/lang/String;")); + + ArrayOfObject = + loader->constructArray(loader->asciizConstructUTF8("[Ljava/lang/Object;")); + + InterfacesArray = ArrayOfObject->interfaces; + ClassArray::InterfacesArray = InterfacesArray; + + } + } + + if (!OfChar) { + // Allocate interfaces. + InterfacesArray = (Class**)loader->allocator.Allocate(2 * sizeof(UserClass*), + "Interface array"); + ClassArray::InterfacesArray = InterfacesArray; + + // Create the primitive classes. + OfChar = UPCALL_PRIMITIVE_CLASS(loader, "char", 1); + OfBool = UPCALL_PRIMITIVE_CLASS(loader, "boolean", 0); + OfShort = UPCALL_PRIMITIVE_CLASS(loader, "short", 1); + OfInt = UPCALL_PRIMITIVE_CLASS(loader, "int", 2); + OfLong = UPCALL_PRIMITIVE_CLASS(loader, "long", 3); + OfFloat = UPCALL_PRIMITIVE_CLASS(loader, "float", 2); + OfDouble = UPCALL_PRIMITIVE_CLASS(loader, "double", 3); + OfVoid = UPCALL_PRIMITIVE_CLASS(loader, "void", 0); + OfByte = UPCALL_PRIMITIVE_CLASS(loader, "byte", 0); + } + + // Create the primitive arrays. + ArrayOfChar = loader->constructArray(loader->asciizConstructUTF8("[C"), OfChar); + ArrayOfByte = loader->constructArray(loader->asciizConstructUTF8("[B"), OfByte); + ArrayOfInt = loader->constructArray(loader->asciizConstructUTF8("[I"), OfInt); + ArrayOfBool = loader->constructArray(loader->asciizConstructUTF8("[Z"), OfBool); + ArrayOfLong = loader->constructArray(loader->asciizConstructUTF8("[J"), OfLong); + ArrayOfFloat = loader->constructArray(loader->asciizConstructUTF8("[F"), OfFloat); + ArrayOfDouble = loader->constructArray(loader->asciizConstructUTF8("[D"), OfDouble); + ArrayOfShort = loader->constructArray(loader->asciizConstructUTF8("[S"), OfShort); + + // Fill the maps. + primitiveMap[I_VOID] = OfVoid; + primitiveMap[I_BOOL] = OfBool; + primitiveMap[I_BYTE] = OfByte; + primitiveMap[I_CHAR] = OfChar; + primitiveMap[I_SHORT] = OfShort; + primitiveMap[I_INT] = OfInt; + primitiveMap[I_FLOAT] = OfFloat; + primitiveMap[I_LONG] = OfLong; + primitiveMap[I_DOUBLE] = OfDouble; + + arrayTable[JavaArray::T_BOOLEAN - 4] = ArrayOfBool; + arrayTable[JavaArray::T_BYTE - 4] = ArrayOfByte; + arrayTable[JavaArray::T_CHAR - 4] = ArrayOfChar; + arrayTable[JavaArray::T_SHORT - 4] = ArrayOfShort; + arrayTable[JavaArray::T_INT - 4] = ArrayOfInt; + arrayTable[JavaArray::T_FLOAT - 4] = ArrayOfFloat; + arrayTable[JavaArray::T_LONG - 4] = ArrayOfLong; + arrayTable[JavaArray::T_DOUBLE - 4] = ArrayOfDouble; + + Attribut::annotationsAttribut = loader->asciizConstructUTF8("RuntimeVisibleAnnotations"); + Attribut::codeAttribut = loader->asciizConstructUTF8("Code"); + Attribut::exceptionsAttribut = loader->asciizConstructUTF8("Exceptions"); + Attribut::constantAttribut = loader->asciizConstructUTF8("ConstantValue"); + Attribut::lineNumberTableAttribut = loader->asciizConstructUTF8("LineNumberTable"); + Attribut::innerClassesAttribut = loader->asciizConstructUTF8("InnerClasses"); + Attribut::sourceFileAttribut = loader->asciizConstructUTF8("SourceFile"); + + JavaCompiler::InlinePragma = loader->asciizConstructUTF8("Lorg/vmmagic/pragma/Inline;"); + JavaCompiler::NoInlinePragma = loader->asciizConstructUTF8("Lorg/vmmagic/pragma/NoInline;"); + + initName = loader->asciizConstructUTF8(""); + initExceptionSig = loader->asciizConstructUTF8("(Ljava/lang/String;)V"); + clinitName = loader->asciizConstructUTF8(""); + clinitType = loader->asciizConstructUTF8("()V"); + runName = loader->asciizConstructUTF8("run"); + prelib = loader->asciizConstructUTF8("lib"); +#if defined(__MACH__) + postlib = loader->asciizConstructUTF8(".dylib"); +#else + postlib = loader->asciizConstructUTF8(".so"); +#endif + mathName = loader->asciizConstructUTF8("java/lang/Math"); + stackWalkerName = loader->asciizConstructUTF8("gnu/classpath/VMStackWalker"); + NoClassDefFoundErrorName = loader->asciizConstructUTF8("java/lang/NoClassDefFoundError"); + +#define DEF_UTF8(var) \ + var = loader->asciizConstructUTF8(#var) + + DEF_UTF8(abs); + DEF_UTF8(sqrt); + DEF_UTF8(sin); + DEF_UTF8(cos); + DEF_UTF8(tan); + DEF_UTF8(asin); + DEF_UTF8(acos); + DEF_UTF8(atan); + DEF_UTF8(atan2); + DEF_UTF8(exp); + DEF_UTF8(log); + DEF_UTF8(pow); + DEF_UTF8(ceil); + DEF_UTF8(floor); + DEF_UTF8(rint); + DEF_UTF8(cbrt); + DEF_UTF8(cosh); + DEF_UTF8(expm1); + DEF_UTF8(hypot); + DEF_UTF8(log10); + DEF_UTF8(log1p); + DEF_UTF8(sinh); + DEF_UTF8(tanh); + DEF_UTF8(finalize); + +#undef DEF_UTF8 +} + +void Classpath::postInitialiseClasspath(JnjvmClassLoader* loader) { newClassLoader = UPCALL_CLASS(loader, "java/lang/ClassLoader"); Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.h?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.h (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.h Wed Dec 8 04:29:13 2010 @@ -59,216 +59,288 @@ class Class; class ClassArray; +#if defined(__MACH__) +#define SELF_HANDLE RTLD_DEFAULT +#define DYLD_EXTENSION ".dylib" +#else +#define SELF_HANDLE 0 +#define DYLD_EXTENSION ".so" +#endif + class Classpath : public mvm::PermanentObject { public: - ISOLATE_STATIC UserClass* newClassLoader; - ISOLATE_STATIC JavaMethod* getSystemClassLoader; - ISOLATE_STATIC JavaMethod* setContextClassLoader; - ISOLATE_STATIC UserClass* newString; - ISOLATE_STATIC UserClass* newClass; - ISOLATE_STATIC UserClass* newThrowable; - ISOLATE_STATIC UserClass* newException; - ISOLATE_STATIC JavaMethod* initClass; - ISOLATE_STATIC JavaMethod* initClassWithProtectionDomain; - ISOLATE_STATIC JavaField* vmdataClass; - ISOLATE_STATIC JavaMethod* setProperty; - ISOLATE_STATIC JavaMethod* initString; - ISOLATE_STATIC JavaMethod* getCallingClassLoader; - ISOLATE_STATIC JavaMethod* initConstructor; - ISOLATE_STATIC UserClassArray* constructorArrayClass; - ISOLATE_STATIC UserClassArray* constructorArrayAnnotation; - ISOLATE_STATIC UserClass* newConstructor; - ISOLATE_STATIC JavaField* constructorSlot; - ISOLATE_STATIC JavaMethod* initMethod; - ISOLATE_STATIC JavaMethod* initField; - ISOLATE_STATIC UserClassArray* methodArrayClass; - ISOLATE_STATIC UserClassArray* fieldArrayClass; - ISOLATE_STATIC UserClass* newMethod; - ISOLATE_STATIC UserClass* newField; - ISOLATE_STATIC JavaField* methodSlot; - ISOLATE_STATIC JavaField* fieldSlot; - ISOLATE_STATIC UserClassArray* classArrayClass; - ISOLATE_STATIC JavaMethod* loadInClassLoader; - ISOLATE_STATIC JavaMethod* initVMThrowable; - ISOLATE_STATIC JavaField* vmDataVMThrowable; - ISOLATE_STATIC UserClass* newVMThrowable; - ISOLATE_STATIC JavaField* bufferAddress; - ISOLATE_STATIC JavaField* dataPointer32; - ISOLATE_STATIC JavaField* dataPointer64; - ISOLATE_STATIC UserClass* newPointer32; - ISOLATE_STATIC UserClass* newPointer64; - ISOLATE_STATIC UserClass* newDirectByteBuffer; - ISOLATE_STATIC JavaMethod* InitDirectByteBuffer; - ISOLATE_STATIC JavaField* vmdataClassLoader; - - ISOLATE_STATIC JavaField* boolValue; - ISOLATE_STATIC JavaField* byteValue; - ISOLATE_STATIC JavaField* shortValue; - ISOLATE_STATIC JavaField* charValue; - ISOLATE_STATIC JavaField* intValue; - ISOLATE_STATIC JavaField* longValue; - ISOLATE_STATIC JavaField* floatValue; - ISOLATE_STATIC JavaField* doubleValue; - - ISOLATE_STATIC UserClass* newStackTraceElement; - ISOLATE_STATIC UserClassArray* stackTraceArray; - ISOLATE_STATIC JavaMethod* initStackTraceElement; - - ISOLATE_STATIC void initialiseClasspath(JnjvmClassLoader* loader); - - ISOLATE_STATIC UserClass* voidClass; - ISOLATE_STATIC UserClass* boolClass; - ISOLATE_STATIC UserClass* byteClass; - ISOLATE_STATIC UserClass* shortClass; - ISOLATE_STATIC UserClass* charClass; - ISOLATE_STATIC UserClass* intClass; - ISOLATE_STATIC UserClass* floatClass; - ISOLATE_STATIC UserClass* doubleClass; - ISOLATE_STATIC UserClass* longClass; - - ISOLATE_STATIC UserClass* vmStackWalker; - - ISOLATE_STATIC UserClass* newThread; - ISOLATE_STATIC UserClass* newVMThread; - ISOLATE_STATIC JavaField* assocThread; - ISOLATE_STATIC JavaField* vmdataVMThread; - ISOLATE_STATIC JavaMethod* finaliseCreateInitialThread; - ISOLATE_STATIC JavaMethod* initVMThread; - ISOLATE_STATIC JavaMethod* runVMThread; - ISOLATE_STATIC JavaMethod* groupAddThread; - ISOLATE_STATIC JavaField* threadName; - ISOLATE_STATIC JavaField* groupName; - ISOLATE_STATIC JavaMethod* initGroup; - ISOLATE_STATIC JavaField* priority; - ISOLATE_STATIC JavaField* daemon; - ISOLATE_STATIC JavaField* group; - ISOLATE_STATIC JavaField* running; - ISOLATE_STATIC UserClass* threadGroup; - ISOLATE_STATIC JavaField* rootGroup; - ISOLATE_STATIC JavaField* vmThread; - ISOLATE_STATIC JavaMethod* uncaughtException; - ISOLATE_STATIC UserClass* inheritableThreadLocal; - - - ISOLATE_STATIC UserClass* InvocationTargetException; - ISOLATE_STATIC UserClass* ArrayStoreException; - ISOLATE_STATIC UserClass* ClassCastException; - ISOLATE_STATIC UserClass* IllegalMonitorStateException; - ISOLATE_STATIC UserClass* IllegalArgumentException; - ISOLATE_STATIC UserClass* InterruptedException; - ISOLATE_STATIC UserClass* IndexOutOfBoundsException; - ISOLATE_STATIC UserClass* ArrayIndexOutOfBoundsException; - ISOLATE_STATIC UserClass* NegativeArraySizeException; - ISOLATE_STATIC UserClass* NullPointerException; - ISOLATE_STATIC UserClass* SecurityException; - ISOLATE_STATIC UserClass* ClassFormatError; - ISOLATE_STATIC UserClass* ClassCircularityError; - ISOLATE_STATIC UserClass* NoClassDefFoundError; - ISOLATE_STATIC UserClass* UnsupportedClassVersionError; - ISOLATE_STATIC UserClass* NoSuchFieldError; - ISOLATE_STATIC UserClass* NoSuchMethodError; - ISOLATE_STATIC UserClass* InstantiationError; - ISOLATE_STATIC UserClass* InstantiationException; - ISOLATE_STATIC UserClass* IllegalAccessError; - ISOLATE_STATIC UserClass* IllegalAccessException; - ISOLATE_STATIC UserClass* VerifyError; - ISOLATE_STATIC UserClass* ExceptionInInitializerError; - ISOLATE_STATIC UserClass* LinkageError; - ISOLATE_STATIC UserClass* AbstractMethodError; - ISOLATE_STATIC UserClass* UnsatisfiedLinkError; - ISOLATE_STATIC UserClass* InternalError; - ISOLATE_STATIC UserClass* OutOfMemoryError; - ISOLATE_STATIC UserClass* StackOverflowError; - ISOLATE_STATIC UserClass* UnknownError; - ISOLATE_STATIC UserClass* ClassNotFoundException; - ISOLATE_STATIC UserClass* ArithmeticException; - - ISOLATE_STATIC JavaMethod* InitInvocationTargetException; - ISOLATE_STATIC JavaMethod* InitArrayStoreException; - ISOLATE_STATIC JavaMethod* InitClassCastException; - ISOLATE_STATIC JavaMethod* InitIllegalMonitorStateException; - ISOLATE_STATIC JavaMethod* InitIllegalArgumentException; - ISOLATE_STATIC JavaMethod* InitInterruptedException; - ISOLATE_STATIC JavaMethod* InitIndexOutOfBoundsException; - ISOLATE_STATIC JavaMethod* InitArrayIndexOutOfBoundsException; - ISOLATE_STATIC JavaMethod* InitNegativeArraySizeException; - ISOLATE_STATIC JavaMethod* InitNullPointerException; - ISOLATE_STATIC JavaMethod* InitSecurityException; - ISOLATE_STATIC JavaMethod* InitClassFormatError; - ISOLATE_STATIC JavaMethod* InitClassCircularityError; - ISOLATE_STATIC JavaMethod* InitNoClassDefFoundError; - ISOLATE_STATIC JavaMethod* InitUnsupportedClassVersionError; - ISOLATE_STATIC JavaMethod* InitNoSuchFieldError; - ISOLATE_STATIC JavaMethod* InitNoSuchMethodError; - ISOLATE_STATIC JavaMethod* InitInstantiationError; - ISOLATE_STATIC JavaMethod* InitInstantiationException; - ISOLATE_STATIC JavaMethod* InitIllegalAccessError; - ISOLATE_STATIC JavaMethod* InitIllegalAccessException; - ISOLATE_STATIC JavaMethod* InitVerifyError; - ISOLATE_STATIC JavaMethod* InitExceptionInInitializerError; - ISOLATE_STATIC JavaMethod* InitLinkageError; - ISOLATE_STATIC JavaMethod* InitAbstractMethodError; - ISOLATE_STATIC JavaMethod* InitUnsatisfiedLinkError; - ISOLATE_STATIC JavaMethod* InitInternalError; - ISOLATE_STATIC JavaMethod* InitOutOfMemoryError; - ISOLATE_STATIC JavaMethod* InitStackOverflowError; - ISOLATE_STATIC JavaMethod* InitUnknownError; - ISOLATE_STATIC JavaMethod* InitClassNotFoundException; - ISOLATE_STATIC JavaMethod* InitArithmeticException; - - ISOLATE_STATIC JavaMethod* SystemArraycopy; - ISOLATE_STATIC JavaMethod* VMSystemArraycopy; - ISOLATE_STATIC Class* SystemClass; - - ISOLATE_STATIC JavaMethod* IntToString; - - ISOLATE_STATIC JavaMethod* InitObject; - ISOLATE_STATIC JavaMethod* FinalizeObject; - - ISOLATE_STATIC JavaMethod* ErrorWithExcpNoClassDefFoundError; - ISOLATE_STATIC JavaMethod* ErrorWithExcpExceptionInInitializerError; - ISOLATE_STATIC JavaMethod* ErrorWithExcpInvocationTargetException; - - - - ISOLATE_STATIC UserClassArray* ArrayOfByte; - ISOLATE_STATIC UserClassArray* ArrayOfChar; - ISOLATE_STATIC UserClassArray* ArrayOfInt; - ISOLATE_STATIC UserClassArray* ArrayOfShort; - ISOLATE_STATIC UserClassArray* ArrayOfBool; - ISOLATE_STATIC UserClassArray* ArrayOfLong; - ISOLATE_STATIC UserClassArray* ArrayOfFloat; - ISOLATE_STATIC UserClassArray* ArrayOfDouble; - ISOLATE_STATIC UserClassArray* ArrayOfObject; - ISOLATE_STATIC UserClassArray* ArrayOfString; - - ISOLATE_STATIC UserClassPrimitive* OfByte; - ISOLATE_STATIC UserClassPrimitive* OfChar; - ISOLATE_STATIC UserClassPrimitive* OfInt; - ISOLATE_STATIC UserClassPrimitive* OfShort; - ISOLATE_STATIC UserClassPrimitive* OfBool; - ISOLATE_STATIC UserClassPrimitive* OfLong; - ISOLATE_STATIC UserClassPrimitive* OfFloat; - ISOLATE_STATIC UserClassPrimitive* OfDouble; - ISOLATE_STATIC UserClassPrimitive* OfVoid; - - ISOLATE_STATIC UserClass* OfObject; - - ISOLATE_STATIC JavaField* methodClass; - ISOLATE_STATIC JavaField* fieldClass; - ISOLATE_STATIC JavaField* constructorClass; - - ISOLATE_STATIC JavaMethod* EnqueueReference; - ISOLATE_STATIC Class* newReference; + Classpath(JnjvmBootstrapLoader* loader, bool dlLoad); + + void postInitialiseClasspath(JnjvmClassLoader* loader); + + UserClass* newClassLoader; + JavaMethod* getSystemClassLoader; + JavaMethod* setContextClassLoader; + UserClass* newString; + UserClass* newClass; + UserClass* newThrowable; + UserClass* newException; + JavaMethod* initClass; + JavaMethod* initClassWithProtectionDomain; + JavaField* vmdataClass; + JavaMethod* setProperty; + JavaMethod* initString; + JavaMethod* getCallingClassLoader; + JavaMethod* initConstructor; + UserClassArray* constructorArrayClass; + UserClassArray* constructorArrayAnnotation; + UserClass* newConstructor; + JavaField* constructorSlot; + JavaMethod* initMethod; + JavaMethod* initField; + UserClassArray* methodArrayClass; + UserClassArray* fieldArrayClass; + UserClass* newMethod; + UserClass* newField; + JavaField* methodSlot; + JavaField* fieldSlot; + UserClassArray* classArrayClass; + JavaMethod* loadInClassLoader; + JavaMethod* initVMThrowable; + JavaField* vmDataVMThrowable; + UserClass* newVMThrowable; + JavaField* bufferAddress; + JavaField* dataPointer32; + JavaField* dataPointer64; + UserClass* newPointer32; + UserClass* newPointer64; + UserClass* newDirectByteBuffer; + JavaMethod* InitDirectByteBuffer; + JavaField* vmdataClassLoader; + + JavaField* boolValue; + JavaField* byteValue; + JavaField* shortValue; + JavaField* charValue; + JavaField* intValue; + JavaField* longValue; + JavaField* floatValue; + JavaField* doubleValue; + + UserClass* newStackTraceElement; + UserClassArray* stackTraceArray; + JavaMethod* initStackTraceElement; + + UserClass* voidClass; + UserClass* boolClass; + UserClass* byteClass; + UserClass* shortClass; + UserClass* charClass; + UserClass* intClass; + UserClass* floatClass; + UserClass* doubleClass; + UserClass* longClass; + + UserClass* vmStackWalker; + + UserClass* newThread; + UserClass* newVMThread; + JavaField* assocThread; + JavaField* vmdataVMThread; + JavaMethod* finaliseCreateInitialThread; + JavaMethod* initVMThread; + JavaMethod* runVMThread; + JavaMethod* groupAddThread; + JavaField* threadName; + JavaField* groupName; + JavaMethod* initGroup; + JavaField* priority; + JavaField* daemon; + JavaField* group; + JavaField* running; + UserClass* threadGroup; + JavaField* rootGroup; + JavaField* vmThread; + JavaMethod* uncaughtException; + UserClass* inheritableThreadLocal; + + + UserClass* InvocationTargetException; + UserClass* ArrayStoreException; + UserClass* ClassCastException; + UserClass* IllegalMonitorStateException; + UserClass* IllegalArgumentException; + UserClass* InterruptedException; + UserClass* IndexOutOfBoundsException; + UserClass* ArrayIndexOutOfBoundsException; + UserClass* NegativeArraySizeException; + UserClass* NullPointerException; + UserClass* SecurityException; + UserClass* ClassFormatError; + UserClass* ClassCircularityError; + UserClass* NoClassDefFoundError; + UserClass* UnsupportedClassVersionError; + UserClass* NoSuchFieldError; + UserClass* NoSuchMethodError; + UserClass* InstantiationError; + UserClass* InstantiationException; + UserClass* IllegalAccessError; + UserClass* IllegalAccessException; + UserClass* VerifyError; + UserClass* ExceptionInInitializerError; + UserClass* LinkageError; + UserClass* AbstractMethodError; + UserClass* UnsatisfiedLinkError; + UserClass* InternalError; + UserClass* OutOfMemoryError; + UserClass* StackOverflowError; + UserClass* UnknownError; + UserClass* ClassNotFoundException; + UserClass* ArithmeticException; + + JavaMethod* InitInvocationTargetException; + JavaMethod* InitArrayStoreException; + JavaMethod* InitClassCastException; + JavaMethod* InitIllegalMonitorStateException; + JavaMethod* InitIllegalArgumentException; + JavaMethod* InitInterruptedException; + JavaMethod* InitIndexOutOfBoundsException; + JavaMethod* InitArrayIndexOutOfBoundsException; + JavaMethod* InitNegativeArraySizeException; + JavaMethod* InitNullPointerException; + JavaMethod* InitSecurityException; + JavaMethod* InitClassFormatError; + JavaMethod* InitClassCircularityError; + JavaMethod* InitNoClassDefFoundError; + JavaMethod* InitUnsupportedClassVersionError; + JavaMethod* InitNoSuchFieldError; + JavaMethod* InitNoSuchMethodError; + JavaMethod* InitInstantiationError; + JavaMethod* InitInstantiationException; + JavaMethod* InitIllegalAccessError; + JavaMethod* InitIllegalAccessException; + JavaMethod* InitVerifyError; + JavaMethod* InitExceptionInInitializerError; + JavaMethod* InitLinkageError; + JavaMethod* InitAbstractMethodError; + JavaMethod* InitUnsatisfiedLinkError; + JavaMethod* InitInternalError; + JavaMethod* InitOutOfMemoryError; + JavaMethod* InitStackOverflowError; + JavaMethod* InitUnknownError; + JavaMethod* InitClassNotFoundException; + JavaMethod* InitArithmeticException; + + JavaMethod* SystemArraycopy; + JavaMethod* VMSystemArraycopy; + Class* SystemClass; + + JavaMethod* IntToString; + + JavaMethod* InitObject; + JavaMethod* FinalizeObject; + + JavaMethod* ErrorWithExcpNoClassDefFoundError; + JavaMethod* ErrorWithExcpExceptionInInitializerError; + JavaMethod* ErrorWithExcpInvocationTargetException; + + + + UserClassArray* ArrayOfByte; + UserClassArray* ArrayOfChar; + UserClassArray* ArrayOfInt; + UserClassArray* ArrayOfShort; + UserClassArray* ArrayOfBool; + UserClassArray* ArrayOfLong; + UserClassArray* ArrayOfFloat; + UserClassArray* ArrayOfDouble; + UserClassArray* ArrayOfObject; + UserClassArray* ArrayOfString; + + UserClassPrimitive* OfByte; + UserClassPrimitive* OfChar; + UserClassPrimitive* OfInt; + UserClassPrimitive* OfShort; + UserClassPrimitive* OfBool; + UserClassPrimitive* OfLong; + UserClassPrimitive* OfFloat; + UserClassPrimitive* OfDouble; + UserClassPrimitive* OfVoid; + + UserClass* OfObject; + + JavaField* methodClass; + JavaField* fieldClass; + JavaField* constructorClass; + + JavaMethod* EnqueueReference; + Class* newReference; + + /// upcalls - Upcall classes, fields and methods so that C++ code can call + /// Java code. + /// + Classpath* upcalls; + + /// InterfacesArray - The interfaces that array classes implement. + /// + UserClass** InterfacesArray; + + /// SuperArray - The super of array classes. + UserClass* SuperArray; + + /// Lists of UTF8s used internaly in VMKit. + const UTF8* NoClassDefFoundErrorName; + const UTF8* initName; + const UTF8* clinitName; + const UTF8* clinitType; + const UTF8* initExceptionSig; + const UTF8* runName; + const UTF8* prelib; + const UTF8* postlib; + const UTF8* mathName; + const UTF8* stackWalkerName; + const UTF8* abs; + const UTF8* sqrt; + const UTF8* sin; + const UTF8* cos; + const UTF8* tan; + const UTF8* asin; + const UTF8* acos; + const UTF8* atan; + const UTF8* atan2; + const UTF8* exp; + const UTF8* log; + const UTF8* pow; + const UTF8* ceil; + const UTF8* floor; + const UTF8* rint; + const UTF8* cbrt; + const UTF8* cosh; + const UTF8* expm1; + const UTF8* hypot; + const UTF8* log10; + const UTF8* log1p; + const UTF8* sinh; + const UTF8* tanh; + const UTF8* finalize; + + /// primitiveMap - Map of primitive classes, hashed by id. + std::map primitiveMap; + + UserClassPrimitive* getPrimitiveClass(char id) { + return primitiveMap[id]; + } + + /// arrayTable - Table of array classes. + UserClassArray* arrayTable[8]; + + UserClassArray* getArrayClass(unsigned id) { + return arrayTable[id - 4]; + } private: - ISOLATE_STATIC void CreateJavaThread(Jnjvm* vm, JavaThread* myth, + void CreateJavaThread(Jnjvm* vm, JavaThread* myth, const char* name, JavaObject* Group); public: - ISOLATE_STATIC void InitializeThreading(Jnjvm* vm); + void InitializeThreading(Jnjvm* vm); - ISOLATE_STATIC void CreateForeignJavaThread(Jnjvm* vm, JavaThread* myth); + void CreateForeignJavaThread(Jnjvm* vm, JavaThread* myth); }; Modified: vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsCheck.inc Wed Dec 8 04:29:13 2010 @@ -314,7 +314,7 @@ assert(cl && "exception class has not been loaded"); ex->catchClass = cl; } else { - ex->catchClass = Classpath::newThrowable; + ex->catchClass = upcalls->newThrowable; } ex->tester = createBasicBlock("testException"); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/ExceptionsDwarf.inc Wed Dec 8 04:29:13 2010 @@ -245,7 +245,7 @@ assert(cl && "exception class has not been loaded"); ex->catchClass = cl; } else { - ex->catchClass = Classpath::newThrowable; + ex->catchClass = upcalls->newThrowable; } ex->catcher = createBasicBlock("testException"); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Dec 8 04:29:13 2010 @@ -204,7 +204,7 @@ final_object_iterator I = finalObjects.find(cl->delegatee[0]); if (I == End) { - Class* javaClass = cl->classLoader->bootstrapLoader->upcalls->newClass; + Class* javaClass = cl->classLoader->vm->upcalls->newClass; LLVMClassInfo* LCI = getClassInfo(javaClass); const llvm::Type* Ty = LCI->getVirtualType(); Module& Mod = *getLLVMModule(); @@ -313,7 +313,7 @@ CommonClass* cl = JavaObject::getClass(obj); if (cl->isArray()) { - Classpath* upcalls = cl->classLoader->bootstrapLoader->upcalls; + Classpath* upcalls = cl->classLoader->vm->upcalls; CommonClass* subClass = cl->asArrayClass()->baseClass(); if (subClass->isPrimitive()) { if (subClass == upcalls->OfBool) { @@ -581,7 +581,7 @@ } Constant* JavaAOTCompiler::CreateConstantFromJavaClass(CommonClass* cl) { - Class* javaClass = cl->classLoader->bootstrapLoader->upcalls->newClass; + Class* javaClass = cl->classLoader->vm->upcalls->newClass; LLVMClassInfo* LCI = getClassInfo(javaClass); const StructType* STy = dyn_cast(LCI->getVirtualType()->getContainedType(0)); @@ -613,7 +613,7 @@ CommonClass* cl = JavaObject::getClass(obj); if (cl->isArray()) { - Classpath* upcalls = cl->classLoader->bootstrapLoader->upcalls; + Classpath* upcalls = cl->classLoader->vm->upcalls; CommonClass* subClass = cl->asArrayClass()->baseClass(); if (subClass->isPrimitive()) { if (subClass == upcalls->OfBool) { @@ -1395,8 +1395,7 @@ Tracer = ArrayObjectTracer; } } else if (classDef->isClass()) { - if (classDef->isAssignableFrom( - classDef->classLoader->bootstrapLoader->upcalls->newReference)) { + if (classDef->isAssignableFrom(classDef->classLoader->vm->upcalls->newReference)) { Tracer = ReferenceObjectTracer; } else { Tracer = RegularObjectTracer; @@ -1928,7 +1927,7 @@ bootstrapLoader->analyseClasspathEnv(vm->classpath); } else { bootstrapLoader->analyseClasspathEnv(vm->classpath); - bootstrapLoader->upcalls->initialiseClasspath(bootstrapLoader); + vm->upcalls->postInitialiseClasspath(bootstrapLoader); } @@ -2052,15 +2051,15 @@ if (M->compileRT) { // Make sure that if we compile RT, the native classes are emitted. - M->getNativeClass(bootstrapLoader->upcalls->OfVoid); - M->getNativeClass(bootstrapLoader->upcalls->OfBool); - M->getNativeClass(bootstrapLoader->upcalls->OfByte); - M->getNativeClass(bootstrapLoader->upcalls->OfChar); - M->getNativeClass(bootstrapLoader->upcalls->OfShort); - M->getNativeClass(bootstrapLoader->upcalls->OfInt); - M->getNativeClass(bootstrapLoader->upcalls->OfFloat); - M->getNativeClass(bootstrapLoader->upcalls->OfLong); - M->getNativeClass(bootstrapLoader->upcalls->OfDouble); + M->getNativeClass(vm->upcalls->OfVoid); + M->getNativeClass(vm->upcalls->OfBool); + M->getNativeClass(vm->upcalls->OfByte); + M->getNativeClass(vm->upcalls->OfChar); + M->getNativeClass(vm->upcalls->OfShort); + M->getNativeClass(vm->upcalls->OfInt); + M->getNativeClass(vm->upcalls->OfFloat); + M->getNativeClass(vm->upcalls->OfLong); + M->getNativeClass(vm->upcalls->OfDouble); // Also do not allow inling of some functions. #define SET_INLINE(NAME) { \ Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp Wed Dec 8 04:29:13 2010 @@ -65,7 +65,7 @@ return (meth->canBeInlined && meth != compilingMethod && inlineMethods[meth] == 0 && (loader == compilingClass->classLoader || - loader == compilingClass->classLoader->bootstrapLoader)); + loader == compilingClass->classLoader->vm->bootstrapLoader)); } void JavaJIT::invokeVirtual(uint16 index) { @@ -1363,8 +1363,7 @@ Instruction* JavaJIT::lowerMathOps(const UTF8* name, std::vector& args) { - JnjvmBootstrapLoader* loader = compilingClass->classLoader->bootstrapLoader; - if (name->equals(loader->abs)) { + if (name->equals(upcalls->abs)) { const Type* Ty = args[0]->getType(); if (Ty == Type::getInt32Ty(*llvmContext)) { Constant* const_int32_9 = intrinsics->constantZero; @@ -1397,71 +1396,71 @@ return llvm::CallInst::Create(intrinsics->func_llvm_fabs_f64, args[0], "tmp1", currentBlock); } - } else if (name->equals(loader->sqrt)) { + } else if (name->equals(upcalls->sqrt)) { return llvm::CallInst::Create(intrinsics->func_llvm_sqrt_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->sin)) { + } else if (name->equals(upcalls->sin)) { return llvm::CallInst::Create(intrinsics->func_llvm_sin_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->cos)) { + } else if (name->equals(upcalls->cos)) { return llvm::CallInst::Create(intrinsics->func_llvm_cos_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->tan)) { + } else if (name->equals(upcalls->tan)) { return llvm::CallInst::Create(intrinsics->func_llvm_tan_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->asin)) { + } else if (name->equals(upcalls->asin)) { return llvm::CallInst::Create(intrinsics->func_llvm_asin_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->acos)) { + } else if (name->equals(upcalls->acos)) { return llvm::CallInst::Create(intrinsics->func_llvm_acos_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->atan)) { + } else if (name->equals(upcalls->atan)) { return llvm::CallInst::Create(intrinsics->func_llvm_atan_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->atan2)) { + } else if (name->equals(upcalls->atan2)) { return llvm::CallInst::Create(intrinsics->func_llvm_atan2_f64, args.begin(), args.end(), "tmp1", currentBlock); - } else if (name->equals(loader->exp)) { + } else if (name->equals(upcalls->exp)) { return llvm::CallInst::Create(intrinsics->func_llvm_exp_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->log)) { + } else if (name->equals(upcalls->log)) { return llvm::CallInst::Create(intrinsics->func_llvm_log_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->pow)) { + } else if (name->equals(upcalls->pow)) { return llvm::CallInst::Create(intrinsics->func_llvm_pow_f64, args.begin(), args.end(), "tmp1", currentBlock); - } else if (name->equals(loader->ceil)) { + } else if (name->equals(upcalls->ceil)) { return llvm::CallInst::Create(intrinsics->func_llvm_ceil_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->floor)) { + } else if (name->equals(upcalls->floor)) { return llvm::CallInst::Create(intrinsics->func_llvm_floor_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->rint)) { + } else if (name->equals(upcalls->rint)) { return llvm::CallInst::Create(intrinsics->func_llvm_rint_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->cbrt)) { + } else if (name->equals(upcalls->cbrt)) { return llvm::CallInst::Create(intrinsics->func_llvm_cbrt_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->cosh)) { + } else if (name->equals(upcalls->cosh)) { return llvm::CallInst::Create(intrinsics->func_llvm_cosh_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->expm1)) { + } else if (name->equals(upcalls->expm1)) { return llvm::CallInst::Create(intrinsics->func_llvm_expm1_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->hypot)) { + } else if (name->equals(upcalls->hypot)) { return llvm::CallInst::Create(intrinsics->func_llvm_hypot_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->log10)) { + } else if (name->equals(upcalls->log10)) { return llvm::CallInst::Create(intrinsics->func_llvm_log10_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->log1p)) { + } else if (name->equals(upcalls->log1p)) { return llvm::CallInst::Create(intrinsics->func_llvm_log1p_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->sinh)) { + } else if (name->equals(upcalls->sinh)) { return llvm::CallInst::Create(intrinsics->func_llvm_sinh_f64, args[0], "tmp1", currentBlock); - } else if (name->equals(loader->tanh)) { + } else if (name->equals(upcalls->tanh)) { return llvm::CallInst::Create(intrinsics->func_llvm_tanh_f64, args[0], "tmp1", currentBlock); } @@ -1524,7 +1523,7 @@ makeArgs(it, index, args, signature->nbArguments + 1); JITVerifyNull(args[0]); - if (meth == compilingClass->classLoader->bootstrapLoader->upcalls->InitObject) { + if (meth == upcalls->InitObject) { return; } @@ -1558,10 +1557,9 @@ LLVMSignatureInfo* LSI = TheCompiler->getSignatureInfo(signature); const llvm::FunctionType* staticType = LSI->getStaticType(); ctpInfo->markAsStaticCall(index); - JnjvmBootstrapLoader* loader = compilingClass->classLoader->bootstrapLoader; llvm::Instruction* val = 0; - if (className->equals(loader->stackWalkerName)) { + if (className->equals(upcalls->stackWalkerName)) { callsStackWalker = true; } @@ -1590,7 +1588,7 @@ FunctionType::param_iterator it = staticType->param_end(); makeArgs(it, index, args, signature->nbArguments); - if (className->equals(loader->mathName)) { + if (className->equals(upcalls->mathName)) { val = lowerMathOps(name, args); } @@ -1873,8 +1871,7 @@ bool final = false; - JnjvmBootstrapLoader* JBL = compilingClass->classLoader->bootstrapLoader; - if (!compilingMethod->name->equals(JBL->clinitName)) { + if (!compilingMethod->name->equals(upcalls->clinitName)) { JavaField* field = compilingClass->ctpInfo->lookupField(index, true); if (field && field->classDef->isReady()) final = isFinal(field->access); if (final) { @@ -1975,11 +1972,10 @@ Value* ptr = ldResolved(index, false, obj, LAI.llvmTypePtr); - JnjvmBootstrapLoader* JBL = compilingClass->classLoader->bootstrapLoader; bool final = false; // In init methods, the fields have not been set yet. - if (!compilingMethod->name->equals(JBL->initName)) { + if (!compilingMethod->name->equals(upcalls->initName)) { JavaField* field = compilingClass->ctpInfo->lookupField(index, false); if (field) { final = isFinal(field->access) && sign->isPrimitive(); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.h Wed Dec 8 04:29:13 2010 @@ -29,6 +29,7 @@ #include "JavaClass.h" #include "JavaUpcalls.h" +#include "Jnjvm.h" namespace j3 { @@ -71,7 +72,7 @@ JavaJIT(JavaLLVMCompiler* C, JavaMethod* meth, llvm::Function* func) { compilingMethod = meth; compilingClass = meth->classDef; - upcalls = compilingClass->classLoader->bootstrapLoader->upcalls; + upcalls = compilingClass->classLoader->vm->upcalls; TheCompiler = C; intrinsics = TheCompiler->getIntrinsics(); llvmFunction = func; Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITOpcodes.cpp Wed Dec 8 04:29:13 2010 @@ -2056,10 +2056,8 @@ uint8 id = reader.readU1(); i += 1; uint8 charId = arrayType(compilingMethod, id); - JnjvmBootstrapLoader* loader = - compilingClass->classLoader->bootstrapLoader; - dcl = loader->getArrayClass(id); + dcl = upcalls->getArrayClass(id); valCl = TheCompiler->getNativeClass(dcl); LLVMAssessorInfo& LAI = TheCompiler->AssessorInfo[charId]; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp Wed Dec 8 04:29:13 2010 @@ -319,7 +319,7 @@ isSuper(current->access) && current != meth->classDef && meth->classDef->isAssignableFrom(current) && - !name->equals(classLoader->bootstrapLoader->initName)) { + !name->equals(classLoader->vm->upcalls->initName)) { meth = current->super->lookupMethodDontThrow(name, type, false, true, NULL); } @@ -781,8 +781,8 @@ for (uint32 i = 0; i < nbVirtualMethods; ++i) { JavaMethod& meth = virtualMethods[i]; - if (meth.name->equals(classLoader->bootstrapLoader->finalize) && - meth.type->equals(classLoader->bootstrapLoader->clinitType)) { + if (meth.name->equals(classLoader->vm->upcalls->finalize) && + meth.type->equals(classLoader->vm->upcalls->clinitType)) { meth.offset = 0; } else { JavaMethod* parent = super? @@ -1286,8 +1286,8 @@ if (nbStaticFields) return true; JavaMethod* meth = - lookupMethodDontThrow(classLoader->bootstrapLoader->clinitName, - classLoader->bootstrapLoader->clinitType, + lookupMethodDontThrow(classLoader->vm->upcalls->clinitName, + classLoader->vm->upcalls->clinitType, true, false, 0); if (meth) return true; @@ -1300,7 +1300,7 @@ ClassArray::SuperArray = javaLangObject; JnjvmClassLoader* JCL = javaLangObject->classLoader; - Classpath* upcalls = JCL->bootstrapLoader->upcalls; + Classpath* upcalls = JCL->vm->upcalls; assert(javaLangObject->virtualVT->init && "Initializing array VT before JavaObjectVT"); @@ -1354,7 +1354,7 @@ if (C->super) { Class* referenceClass = - C->classLoader->bootstrapLoader->upcalls->newReference; + C->classLoader->vm->upcalls->newReference; if (referenceClass != NULL && C->super->isAssignableFrom(referenceClass)) { tracer = (uintptr_t)ReferenceObjectTracer; } else { @@ -1466,7 +1466,7 @@ // Set depth and display for fast dynamic type checking. JnjvmClassLoader* JCL = cl->classLoader; - Classpath* upcalls = JCL->bootstrapLoader->upcalls; + Classpath* upcalls = JCL->vm->upcalls; if (upcalls->ArrayOfObject) { UserCommonClass* base = C->baseClass(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp Wed Dec 8 04:29:13 2010 @@ -25,6 +25,7 @@ #include "JavaTypes.h" #include "LockedMap.h" #include "Reader.h" +#include "JnjvmClassLoader.h" using namespace j3; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp Wed Dec 8 04:29:13 2010 @@ -160,8 +160,8 @@ UserClass* realCl = cl->asClass(); res = realCl->doNew(vm); - JavaMethod* init = realCl->lookupMethod(vm->bootstrapLoader->initName, - vm->bootstrapLoader->initExceptionSig, + JavaMethod* init = realCl->lookupMethod(vm->upcalls->initName, + vm->upcalls->initExceptionSig, false, true, 0); str = vm->asciizToStr(msg); init->invokeIntSpecial(vm, realCl, res, &str); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 8 04:29:13 2010 @@ -177,8 +177,8 @@ - JavaMethod* meth = lookupMethodDontThrow(vm->bootstrapLoader->clinitName, - vm->bootstrapLoader->clinitType, + JavaMethod* meth = lookupMethodDontThrow(vm->upcalls->clinitName, + vm->upcalls->clinitType, true, false, 0); if (meth) { @@ -213,7 +213,7 @@ // in place of E in the following step. jexc = Jnjvm::asJavaException(exc); if (jexc && JavaObject::getClass(jexc)->isAssignableFrom(vm->upcalls->newException)) { - Classpath* upcalls = classLoader->bootstrapLoader->upcalls; + Classpath* upcalls = vm->upcalls; UserClass* clExcp = upcalls->ExceptionInInitializerError; Jnjvm* vm = JavaThread::get()->getJVM(); obj = clExcp->doNew(vm); @@ -1064,7 +1064,7 @@ JavaThread* th = new JavaThread(this, mut); mut->allVmsData[vmID] = th; // will be done by my caller but I have to call java code before mut->vmData = th; // will be done by my caller but I have to call java code before - bootstrapLoader->upcalls->CreateForeignJavaThread(this, th); + upcalls->CreateForeignJavaThread(this, th); return th; } @@ -1077,8 +1077,8 @@ // Initialise the bootstrap class loader if it's not // done already. - if (bootstrapLoader->upcalls->newString == NULL) { - bootstrapLoader->upcalls->initialiseClasspath(bootstrapLoader); + if (upcalls->newString == NULL) { + upcalls->postInitialiseClasspath(bootstrapLoader); } #define LOAD_CLASS(cl) \ @@ -1308,7 +1308,7 @@ } } - UserClassArray* array = vm->bootstrapLoader->upcalls->ArrayOfString; + UserClassArray* array = vm->upcalls->ArrayOfString; args = (ArrayObject*)array->doNew(info.argc - 2, vm); for (int i = 2; i < info.argc; ++i) { ArrayObject::setElement(args, (JavaObject*)vm->asciizToStr(info.argv[i]), i - 2); @@ -1343,8 +1343,10 @@ VirtualMachine(Alloc, vmkit), lockSystem(Alloc) { - bootstrapLoader = new(Alloc, "bootstrap loader") JnjvmBootstrapLoader(Alloc, this, Comp, dlLoad); + bootstrapLoader = new(Alloc, "bootstrap loader") JnjvmBootstrapLoader(Alloc, this, Comp); bootstrapLoader->isolate = this; + + upcalls = new(allocator, "Classpath") Classpath(bootstrapLoader, dlLoad); initialiseInternalVTs(); @@ -1354,8 +1356,6 @@ appClassLoader = 0; jniEnv = &JNI_JNIEnvTable; javavmEnv = &JNI_JavaVMTable; - - upcalls = bootstrapLoader->upcalls; throwable = upcalls->newThrowable; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Wed Dec 8 04:29:13 2010 @@ -23,15 +23,6 @@ #include - -#if defined(__MACH__) -#define SELF_HANDLE RTLD_DEFAULT -#define DYLD_EXTENSION ".dylib" -#else -#define SELF_HANDLE 0 -#define DYLD_EXTENSION ".so" -#endif - #include "debug.h" #include "mvm/Allocator.h" #include "mvm/VMKit.h" @@ -51,19 +42,13 @@ #include "Reader.h" #include "Zip.h" - using namespace j3; typedef void (*static_init_t)(JnjvmClassLoader*); -const UTF8* JavaCompiler::InlinePragma = 0; -const UTF8* JavaCompiler::NoInlinePragma = 0; - - JnjvmBootstrapLoader::JnjvmBootstrapLoader(mvm::BumpPtrAllocator& Alloc, Jnjvm* vm, - JavaCompiler* Comp, - bool dlLoad) : + JavaCompiler* Comp) : JnjvmClassLoader(Alloc, vm) { TheCompiler = Comp; @@ -83,185 +68,10 @@ if (!libClasspathEnv) { libClasspathEnv = GNUClasspathLibs; } - - - upcalls = new(allocator, "Classpath") Classpath(); - bootstrapLoader = this; - - // Try to find if we have a pre-compiled rt.jar - if (dlLoad) { - SuperArray = (Class*)dlsym(SELF_HANDLE, "java_lang_Object"); - if (!SuperArray) { - nativeHandle = dlopen("libvmjc"DYLD_EXTENSION, RTLD_LAZY | RTLD_GLOBAL); - if (nativeHandle) { - // Found it! - SuperArray = (Class*)dlsym(nativeHandle, "java_lang_Object"); - } - } - - if (SuperArray) { - assert(TheCompiler && - "Loading libvmjc"DYLD_EXTENSION" requires a compiler"); - ClassArray::SuperArray = (Class*)SuperArray->getInternal(); - - // Get the native classes. - upcalls->OfVoid = (ClassPrimitive*)dlsym(nativeHandle, "void"); - upcalls->OfBool = (ClassPrimitive*)dlsym(nativeHandle, "boolean"); - upcalls->OfByte = (ClassPrimitive*)dlsym(nativeHandle, "byte"); - upcalls->OfChar = (ClassPrimitive*)dlsym(nativeHandle, "char"); - upcalls->OfShort = (ClassPrimitive*)dlsym(nativeHandle, "short"); - upcalls->OfInt = (ClassPrimitive*)dlsym(nativeHandle, "int"); - upcalls->OfFloat = (ClassPrimitive*)dlsym(nativeHandle, "float"); - upcalls->OfLong = (ClassPrimitive*)dlsym(nativeHandle, "long"); - upcalls->OfDouble = (ClassPrimitive*)dlsym(nativeHandle, "double"); - - - // We have the java/lang/Object class, execute the static initializer. - static_init_t init = (static_init_t)(uintptr_t)SuperArray->classLoader; - assert(init && "Loaded the wrong boot library"); - init(this); - - // Get the base object arrays after the init, because init puts arrays - // in the class loader map. - upcalls->ArrayOfString = - constructArray(asciizConstructUTF8("[Ljava/lang/String;")); - - upcalls->ArrayOfObject = - constructArray(asciizConstructUTF8("[Ljava/lang/Object;")); - - InterfacesArray = upcalls->ArrayOfObject->interfaces; - ClassArray::InterfacesArray = InterfacesArray; - - } - } - - if (!upcalls->OfChar) { - // Allocate interfaces. - InterfacesArray = (Class**)allocator.Allocate(2 * sizeof(UserClass*), - "Interface array"); - ClassArray::InterfacesArray = InterfacesArray; - - // Create the primitive classes. - upcalls->OfChar = UPCALL_PRIMITIVE_CLASS(this, "char", 1); - upcalls->OfBool = UPCALL_PRIMITIVE_CLASS(this, "boolean", 0); - upcalls->OfShort = UPCALL_PRIMITIVE_CLASS(this, "short", 1); - upcalls->OfInt = UPCALL_PRIMITIVE_CLASS(this, "int", 2); - upcalls->OfLong = UPCALL_PRIMITIVE_CLASS(this, "long", 3); - upcalls->OfFloat = UPCALL_PRIMITIVE_CLASS(this, "float", 2); - upcalls->OfDouble = UPCALL_PRIMITIVE_CLASS(this, "double", 3); - upcalls->OfVoid = UPCALL_PRIMITIVE_CLASS(this, "void", 0); - upcalls->OfByte = UPCALL_PRIMITIVE_CLASS(this, "byte", 0); - } - - // Create the primitive arrays. - upcalls->ArrayOfChar = constructArray(asciizConstructUTF8("[C"), - upcalls->OfChar); - - upcalls->ArrayOfByte = constructArray(asciizConstructUTF8("[B"), - upcalls->OfByte); - - upcalls->ArrayOfInt = constructArray(asciizConstructUTF8("[I"), - upcalls->OfInt); - - upcalls->ArrayOfBool = constructArray(asciizConstructUTF8("[Z"), - upcalls->OfBool); - - upcalls->ArrayOfLong = constructArray(asciizConstructUTF8("[J"), - upcalls->OfLong); - - upcalls->ArrayOfFloat = constructArray(asciizConstructUTF8("[F"), - upcalls->OfFloat); - - upcalls->ArrayOfDouble = constructArray(asciizConstructUTF8("[D"), - upcalls->OfDouble); - - upcalls->ArrayOfShort = constructArray(asciizConstructUTF8("[S"), - upcalls->OfShort); - - // Fill the maps. - primitiveMap[I_VOID] = upcalls->OfVoid; - primitiveMap[I_BOOL] = upcalls->OfBool; - primitiveMap[I_BYTE] = upcalls->OfByte; - primitiveMap[I_CHAR] = upcalls->OfChar; - primitiveMap[I_SHORT] = upcalls->OfShort; - primitiveMap[I_INT] = upcalls->OfInt; - primitiveMap[I_FLOAT] = upcalls->OfFloat; - primitiveMap[I_LONG] = upcalls->OfLong; - primitiveMap[I_DOUBLE] = upcalls->OfDouble; - - arrayTable[JavaArray::T_BOOLEAN - 4] = upcalls->ArrayOfBool; - arrayTable[JavaArray::T_BYTE - 4] = upcalls->ArrayOfByte; - arrayTable[JavaArray::T_CHAR - 4] = upcalls->ArrayOfChar; - arrayTable[JavaArray::T_SHORT - 4] = upcalls->ArrayOfShort; - arrayTable[JavaArray::T_INT - 4] = upcalls->ArrayOfInt; - arrayTable[JavaArray::T_FLOAT - 4] = upcalls->ArrayOfFloat; - arrayTable[JavaArray::T_LONG - 4] = upcalls->ArrayOfLong; - arrayTable[JavaArray::T_DOUBLE - 4] = upcalls->ArrayOfDouble; - - Attribut::annotationsAttribut = - asciizConstructUTF8("RuntimeVisibleAnnotations"); - Attribut::codeAttribut = asciizConstructUTF8("Code"); - Attribut::exceptionsAttribut = asciizConstructUTF8("Exceptions"); - Attribut::constantAttribut = asciizConstructUTF8("ConstantValue"); - Attribut::lineNumberTableAttribut = asciizConstructUTF8("LineNumberTable"); - Attribut::innerClassesAttribut = asciizConstructUTF8("InnerClasses"); - Attribut::sourceFileAttribut = asciizConstructUTF8("SourceFile"); - - JavaCompiler::InlinePragma = - asciizConstructUTF8("Lorg/vmmagic/pragma/Inline;"); - JavaCompiler::NoInlinePragma = - asciizConstructUTF8("Lorg/vmmagic/pragma/NoInline;"); - - initName = asciizConstructUTF8(""); - initExceptionSig = asciizConstructUTF8("(Ljava/lang/String;)V"); - clinitName = asciizConstructUTF8(""); - clinitType = asciizConstructUTF8("()V"); - runName = asciizConstructUTF8("run"); - prelib = asciizConstructUTF8("lib"); -#if defined(__MACH__) - postlib = asciizConstructUTF8(".dylib"); -#else - postlib = asciizConstructUTF8(".so"); -#endif - mathName = asciizConstructUTF8("java/lang/Math"); - stackWalkerName = asciizConstructUTF8("gnu/classpath/VMStackWalker"); - NoClassDefFoundError = asciizConstructUTF8("java/lang/NoClassDefFoundError"); - -#define DEF_UTF8(var) \ - var = asciizConstructUTF8(#var) - - DEF_UTF8(abs); - DEF_UTF8(sqrt); - DEF_UTF8(sin); - DEF_UTF8(cos); - DEF_UTF8(tan); - DEF_UTF8(asin); - DEF_UTF8(acos); - DEF_UTF8(atan); - DEF_UTF8(atan2); - DEF_UTF8(exp); - DEF_UTF8(log); - DEF_UTF8(pow); - DEF_UTF8(ceil); - DEF_UTF8(floor); - DEF_UTF8(rint); - DEF_UTF8(cbrt); - DEF_UTF8(cosh); - DEF_UTF8(expm1); - DEF_UTF8(hypot); - DEF_UTF8(log10); - DEF_UTF8(log1p); - DEF_UTF8(sinh); - DEF_UTF8(tanh); - DEF_UTF8(finalize); - -#undef DEF_UTF8 - - } JnjvmClassLoader::JnjvmClassLoader(mvm::BumpPtrAllocator& Alloc, - JnjvmClassLoader& JCL, JavaObject* loader, + JavaObject* loader, VMClassLoader* vmdata, Jnjvm* I, Jnjvm* v) : allocator(Alloc) { @@ -270,8 +80,7 @@ vm = v; - bootstrapLoader = JCL.bootstrapLoader; - TheCompiler = bootstrapLoader->getCompiler()->Create("Applicative loader"); + TheCompiler = vm->bootstrapLoader->getCompiler()->Create("Applicative loader"); hashUTF8 = new(allocator, "UTF8Map") UTF8Map(allocator); classes = new(allocator, "ClassMap") ClassMap(); @@ -283,7 +92,7 @@ javaLoader = loader; isolate = I; - JavaMethod* meth = bootstrapLoader->upcalls->loadInClassLoader; + JavaMethod* meth = vm->upcalls->loadInClassLoader; loadClassMethod = JavaObject::getClass(loader)->asClass()->lookupMethodDontThrow( meth->name, meth->type, false, true, &loadClass); @@ -389,7 +198,7 @@ if (!cl && doThrow) { Jnjvm* vm = JavaThread::get()->getJVM(); - if (name->equals(bootstrapLoader->NoClassDefFoundError)) { + if (name->equals(vm->upcalls->NoClassDefFoundErrorName)) { fprintf(stderr, "Unable to load NoClassDefFoundError"); abort(); } @@ -469,8 +278,8 @@ UserCommonClass* temp = lookupClass(name); if (temp) return temp; - if (this != bootstrapLoader) { - temp = bootstrapLoader->lookupClassOrArray(name); + if (this != vm->bootstrapLoader) { + temp = vm->bootstrapLoader->lookupClassOrArray(name); if (temp) return temp; } @@ -522,7 +331,7 @@ const UTF8* name = hashUTF8->lookupAsciiz(asciiz); mvm::ThreadAllocator threadAllocator; UserCommonClass* result = NULL; - if (!name) name = bootstrapLoader->hashUTF8->lookupAsciiz(asciiz); + if (!name) name = vm->bootstrapLoader->hashUTF8->lookupAsciiz(asciiz); if (!name) { uint32 size = strlen(asciiz); UTF8* temp = (UTF8*)threadAllocator.Allocate( @@ -536,8 +345,8 @@ } result = lookupClass(name); - if ((result == NULL) && (this != bootstrapLoader)) { - result = bootstrapLoader->lookupClassOrArray(name); + if ((result == NULL) && (this != vm->bootstrapLoader)) { + result = vm->bootstrapLoader->lookupClassOrArray(name); if (result != NULL) { if (result->isClass() && doResolve) { result->asClass()->resolveClass(); @@ -622,7 +431,7 @@ UserCommonClass* cl = loadName(componentName, false, true, NULL); return cl; } else { - Classpath* upcalls = bootstrapLoader->upcalls; + Classpath* upcalls = vm->upcalls; UserClassPrimitive* prim = UserClassPrimitive::byteIdToPrimitive(name->elements[start], upcalls); assert(prim && "No primitive found"); @@ -728,10 +537,10 @@ break; default : UserClassPrimitive* cl = - bootstrapLoader->getPrimitiveClass((char)name->elements[0]); + vm->upcalls->getPrimitiveClass((char)name->elements[0]); assert(cl && "No primitive"); - bool unsign = (cl == bootstrapLoader->upcalls->OfChar || - cl == bootstrapLoader->upcalls->OfBool); + bool unsign = (cl == vm->upcalls->OfChar || + cl == vm->upcalls->OfBool); res = new(allocator, "PrimitiveTypedef") PrimitiveTypedef(name, cl, unsign, cur); } @@ -855,35 +664,34 @@ JnjvmClassLoader* -JnjvmClassLoader::getJnjvmLoaderFromJavaObject(JavaObject* loader, Jnjvm* vm) { +JnjvmClassLoader::getJnjvmLoaderFromJavaObject(JavaObject* jloader, Jnjvm* vm) { VMClassLoader* vmdata = 0; - llvm_gcroot(loader, 0); + llvm_gcroot(jloader, 0); llvm_gcroot(vmdata, 0); - if (loader == NULL) return vm->bootstrapLoader; + if (jloader == NULL) return vm->bootstrapLoader; JnjvmClassLoader* JCL = 0; - Classpath* upcalls = vm->bootstrapLoader->upcalls; + Classpath* upcalls = vm->upcalls; vmdata = - (VMClassLoader*)(upcalls->vmdataClassLoader->getInstanceObjectField(loader)); + (VMClassLoader*)(upcalls->vmdataClassLoader->getInstanceObjectField(jloader)); if (vmdata == NULL) { - JavaObject::acquire(loader); + JavaObject::acquire(jloader); vmdata = - (VMClassLoader*)(upcalls->vmdataClassLoader->getInstanceObjectField(loader)); + (VMClassLoader*)(upcalls->vmdataClassLoader->getInstanceObjectField(jloader)); if (!vmdata) { vmdata = VMClassLoader::allocate(vm); mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator(); - JCL = new(*A, "Class loader") JnjvmClassLoader(*A, *vm->bootstrapLoader, - loader, vmdata, vm, vm); - upcalls->vmdataClassLoader->setInstanceObjectField(loader, (JavaObject*)vmdata); + JCL = new(*A, "Class loader") JnjvmClassLoader(*A, jloader, vmdata, vm, vm); + upcalls->vmdataClassLoader->setInstanceObjectField(jloader, (JavaObject*)vmdata); } - JavaObject::release(loader); + JavaObject::release(jloader); } else { JCL = vmdata->getClassLoader(); - assert(JCL->javaLoader == loader); + assert(JCL->javaLoader == jloader); } return JCL; @@ -1049,8 +857,8 @@ j3 = true; } - if (!res && this != bootstrapLoader) - res = bootstrapLoader->loadInLib(buf, j3); + if (!res && this != vm->bootstrapLoader) + res = vm->bootstrapLoader->loadInLib(buf, j3); return (intptr_t)res; } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h Wed Dec 8 04:29:13 2010 @@ -58,10 +58,12 @@ /// Jnjvm* isolate; +public: /// vm - my vm /// Jnjvm* vm; +private: /// javaLoder - The Java representation of the class loader. Null for the /// bootstrap class loader. /// @@ -80,8 +82,7 @@ /// JnjvmClassLoader - Allocate a user-defined class loader. Called on /// first use of a Java class loader. /// - JnjvmClassLoader(mvm::BumpPtrAllocator& Alloc, JnjvmClassLoader& JCL, - JavaObject* loader, VMClassLoader* vmdata, Jnjvm* isolate, Jnjvm* vm); + JnjvmClassLoader(mvm::BumpPtrAllocator& Alloc, JavaObject* loader, VMClassLoader* vmdata, Jnjvm* isolate, Jnjvm* vm); /// lookupComponentName - Try to find the component name of the given array /// name. If the component name is not in the table of UTF8s and holder @@ -234,11 +235,6 @@ /// const UTF8* readerConstructUTF8(const uint16* buf, uint32 size); - /// bootstrapLoader - The bootstrap loader of the JVM. Loads the base - /// classes. - /// - JnjvmBootstrapLoader* bootstrapLoader; - /// ~JnjvmClassLoader - Destroy the loader: destroy the tables, JIT module and /// module provider. /// @@ -353,10 +349,9 @@ void analyseClasspathEnv(const char*); /// createBootstrapLoader - Creates the bootstrap loader, first thing - /// to do before any execution of a JVM. Also try to load libvmjc.so - /// if dlLoad is not false. + /// to do before any execution of a JVM. /// - JnjvmBootstrapLoader(mvm::BumpPtrAllocator& Alloc, Jnjvm* vm, JavaCompiler* Comp, bool dlLoad); + JnjvmBootstrapLoader(mvm::BumpPtrAllocator& Alloc, Jnjvm* vm, JavaCompiler* Comp); virtual JavaString** UTF8ToStr(const UTF8* utf8); @@ -365,68 +360,6 @@ /// void* nativeHandle; - /// upcalls - Upcall classes, fields and methods so that C++ code can call - /// Java code. - /// - Classpath* upcalls; - - /// InterfacesArray - The interfaces that array classes implement. - /// - UserClass** InterfacesArray; - - /// SuperArray - The super of array classes. - UserClass* SuperArray; - - /// Lists of UTF8s used internaly in VMKit. - const UTF8* NoClassDefFoundError; - const UTF8* initName; - const UTF8* clinitName; - const UTF8* clinitType; - const UTF8* initExceptionSig; - const UTF8* runName; - const UTF8* prelib; - const UTF8* postlib; - const UTF8* mathName; - const UTF8* stackWalkerName; - const UTF8* abs; - const UTF8* sqrt; - const UTF8* sin; - const UTF8* cos; - const UTF8* tan; - const UTF8* asin; - const UTF8* acos; - const UTF8* atan; - const UTF8* atan2; - const UTF8* exp; - const UTF8* log; - const UTF8* pow; - const UTF8* ceil; - const UTF8* floor; - const UTF8* rint; - const UTF8* cbrt; - const UTF8* cosh; - const UTF8* expm1; - const UTF8* hypot; - const UTF8* log10; - const UTF8* log1p; - const UTF8* sinh; - const UTF8* tanh; - const UTF8* finalize; - - /// primitiveMap - Map of primitive classes, hashed by id. - std::map primitiveMap; - - UserClassPrimitive* getPrimitiveClass(char id) { - return primitiveMap[id]; - } - - /// arrayTable - Table of array classes. - UserClassArray* arrayTable[8]; - - UserClassArray* getArrayClass(unsigned id) { - return arrayTable[id - 4]; - } - virtual ~JnjvmBootstrapLoader(); friend class ClArgumentsInfo; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp?rev=121248&r1=121247&r2=121248&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/VirtualTables.cpp Wed Dec 8 04:29:13 2010 @@ -232,20 +232,6 @@ void JnjvmBootstrapLoader::tracer(uintptr_t closure) { JnjvmClassLoader::tracer(closure); - -#define TRACE_DELEGATEE(prim) \ - prim->tracer(closure); - - TRACE_DELEGATEE(upcalls->OfVoid); - TRACE_DELEGATEE(upcalls->OfBool); - TRACE_DELEGATEE(upcalls->OfByte); - TRACE_DELEGATEE(upcalls->OfChar); - TRACE_DELEGATEE(upcalls->OfShort); - TRACE_DELEGATEE(upcalls->OfInt); - TRACE_DELEGATEE(upcalls->OfFloat); - TRACE_DELEGATEE(upcalls->OfLong); - TRACE_DELEGATEE(upcalls->OfDouble); -#undef TRACE_DELEGATEE } //===----------------------------------------------------------------------===// @@ -289,8 +275,23 @@ ArrayUInt16** key = const_cast(&(i->first)); mvm::Collector::markAndTraceRoot(key, closure); } + + // (5) Trace the delegatees. +#define TRACE_DELEGATEE(prim) \ + prim->tracer(closure); + + TRACE_DELEGATEE(upcalls->OfVoid); + TRACE_DELEGATEE(upcalls->OfBool); + TRACE_DELEGATEE(upcalls->OfByte); + TRACE_DELEGATEE(upcalls->OfChar); + TRACE_DELEGATEE(upcalls->OfShort); + TRACE_DELEGATEE(upcalls->OfInt); + TRACE_DELEGATEE(upcalls->OfFloat); + TRACE_DELEGATEE(upcalls->OfLong); + TRACE_DELEGATEE(upcalls->OfDouble); +#undef TRACE_DELEGATEE - // (7) Trace the locks and their associated object. + // (6) Trace the locks and their associated object. uint32 i = 0; for (; i < mvm::LockSystem::GlobalSize; i++) { mvm::FatLock** array = lockSystem.LockTable[i]; From gael.thomas at lip6.fr Wed Dec 8 05:00:22 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 13:00:22 -0000 Subject: [vmkit-commits] [vmkit] r121249 - in /vmkit/branches/multi-vm/lib: J3/Classpath/ J3/Compiler/ J3/VMCore/ Mvm/Runtime/ Message-ID: <20101208130022.B3FFB2A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 07:00:22 2010 New Revision: 121249 URL: http://llvm.org/viewvc/llvm-project?rev=121249&view=rev Log: remove some useless vm as argument Modified: vmkit/branches/multi-vm/lib/J3/Classpath/Classpath.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathField.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClassLoader.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMObject.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMStackWalker.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMSystemProperties.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaMetaJIT.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaString.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp Modified: vmkit/branches/multi-vm/lib/J3/Classpath/Classpath.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/Classpath.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/Classpath.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/Classpath.inc Wed Dec 8 07:00:22 2010 @@ -35,7 +35,7 @@ verifyNull(Cl); Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, true); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, true); if (cl->isClass() && cl->asClass()->lookupMethodDontThrow(vm->upcalls->clinitName, @@ -230,12 +230,11 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = - (UserClass*)UserCommonClass::resolvedImplClass(vm, target, true); - res = cl->doNew(vm); + (UserClass*)UserCommonClass::resolvedImplClass(target, true); + res = cl->doNew(); JavaMethod* meth = JavaObjectConstructor::getInternalMethod(cons); - meth->invokeIntSpecial(vm, cl, res); + meth->invokeIntSpecial(cl, res); END_NATIVE_EXCEPTION @@ -255,14 +254,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserCommonClass* base = - UserCommonClass::resolvedImplClass(vm, arrayType, true); + UserCommonClass::resolvedImplClass(arrayType, true); JnjvmClassLoader* loader = base->classLoader; const UTF8* name = base->getName(); const UTF8* arrayName = loader->constructArrayName(1, name); UserClassArray* array = loader->constructArray(arrayName, base); - res = array->doNew(arrayLength, vm); + res = array->doNew(arrayLength); END_NATIVE_EXCEPTION Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc Wed Dec 8 07:00:22 2010 @@ -88,9 +88,9 @@ llvm_gcroot(excp, 0); llvm_gcroot(jexcp, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); JavaMethod* meth = JavaObjectConstructor::getInternalMethod(cons); UserClass* cl = JavaObjectConstructor::getClass(cons); + Jnjvm* vm = cl->classLoader->vm; sint32 nbArgs = args ? ArrayObject::getSize(args) : 0; Signdef* sign = meth->getSignature(); sint32 size = sign->nbArguments; @@ -103,11 +103,11 @@ (jvalue*)allocator.Allocate(size * sizeof(jvalue)) : NULL; if (nbArgs == size) { - UserCommonClass* _cl = UserCommonClass::resolvedImplClass(vm, Clazz, false); + UserCommonClass* _cl = UserCommonClass::resolvedImplClass(Clazz, false); UserClass* cl = _cl->asClass(); if (cl) { - cl->initialiseClass(vm); - res = cl->doNew(vm); + cl->initialiseClass(); + res = cl->doNew(); JavaObject** ptr = (JavaObject**)ArrayObject::getElements(args); Typedef* const* arguments = sign->getArgumentsType(); @@ -120,7 +120,7 @@ } TRY { - meth->invokeIntSpecialBuf(vm, cl, res, buf); + meth->invokeIntSpecialBuf(cl, res, buf); } CATCH { excp = mvm::Thread::get()->getPendingException(); } END_CATCH; @@ -213,7 +213,7 @@ verifyNull(Meth); JavaMethod* meth = JavaObjectConstructor::getInternalMethod(Meth); - Jnjvm* vm = JavaThread::get()->getJVM(); + Jnjvm* vm = meth->classDef->classLoader->vm; result = vm->internalUTF8ToStr(meth->type); END_NATIVE_EXCEPTION Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathField.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathField.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathField.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathField.inc Wed Dec 8 07:00:22 2010 @@ -52,12 +52,11 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); JavaField* field = JavaObjectField::getInternalField(Field); JnjvmClassLoader* loader = cl->classLoader; UserCommonClass* fieldCl = field->getSignature()->assocClass(loader); - res = fieldCl->getClassDelegatee(vm); + res = fieldCl->getClassDelegatee(); END_NATIVE_EXCEPTION @@ -77,14 +76,14 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); const Typedef* type = field->getSignature(); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -142,13 +141,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -212,13 +211,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -257,13 +256,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -332,13 +331,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -376,13 +375,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -422,13 +421,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -472,13 +471,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -554,13 +553,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -571,42 +570,42 @@ if (prim->isBool()) { uint8 val = stat ? field->getStaticInt8Field() : field->getInstanceInt8Field(obj); - res = vm->upcalls->boolClass->doNew(vm); + res = vm->upcalls->boolClass->doNew(); vm->upcalls->boolValue->setInstanceInt8Field(res, val); } else if (prim->isByte()) { sint8 val = stat ? field->getStaticInt8Field() : field->getInstanceInt8Field(obj); - res = vm->upcalls->byteClass->doNew(vm); + res = vm->upcalls->byteClass->doNew(); vm->upcalls->byteValue->setInstanceInt8Field(res, val); } else if (prim->isChar()) { uint16 val = stat ? field->getStaticInt16Field() : field->getInstanceInt16Field(obj); - res = vm->upcalls->charClass->doNew(vm); + res = vm->upcalls->charClass->doNew(); vm->upcalls->charValue->setInstanceInt16Field(res, val); } else if (prim->isShort()) { sint16 val = stat ? field->getStaticInt16Field() : field->getInstanceInt16Field(obj); - res = vm->upcalls->shortClass->doNew(vm); + res = vm->upcalls->shortClass->doNew(); vm->upcalls->shortValue->setInstanceInt16Field(res, val); } else if (prim->isInt()) { sint64 val = stat ? field->getStaticInt32Field() : field->getInstanceInt32Field(obj); - res = vm->upcalls->intClass->doNew(vm); + res = vm->upcalls->intClass->doNew(); vm->upcalls->intValue->setInstanceInt32Field(res, val); } else if (prim->isLong()) { sint64 val = stat ? field->getStaticLongField() : field->getInstanceLongField(obj); - res = vm->upcalls->longClass->doNew(vm); + res = vm->upcalls->longClass->doNew(); vm->upcalls->longValue->setInstanceLongField(res, val); } else if (prim->isFloat()) { float val = stat ? field->getStaticFloatField() : field->getInstanceFloatField(obj); - res = vm->upcalls->floatClass->doNew(vm); + res = vm->upcalls->floatClass->doNew(); vm->upcalls->floatValue->setInstanceFloatField(res, val); } else if (prim->isDouble()) { double val = stat ? field->getStaticDoubleField() : field->getInstanceDoubleField(obj); - res = vm->upcalls->doubleClass->doNew(vm); + res = vm->upcalls->doubleClass->doNew(); vm->upcalls->doubleValue->setInstanceDoubleField(res, val); } } else { @@ -634,15 +633,15 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); jvalue buf; bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -724,13 +723,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -766,13 +765,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -837,13 +836,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -901,13 +900,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -965,13 +964,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -1024,13 +1023,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -1077,13 +1076,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } @@ -1124,13 +1123,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = JavaObjectField::getClass(Field); + Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); bool stat = isStatic(field->access); if (stat) { - cl->initialiseClass(vm); + cl->initialiseClass(); } else { verifyNull(obj); } Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc Wed Dec 8 07:00:22 2010 @@ -122,7 +122,7 @@ (jvalue*)allocator.Allocate(size * sizeof(jvalue)) : NULL; if (nbArgs == size) { - UserCommonClass* _cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* _cl = UserCommonClass::resolvedImplClass(Cl, false); UserClass* cl = (UserClass*)_cl; if (isVirtual(meth->access)) { @@ -133,14 +133,14 @@ } if (isInterface(cl->access)) { - cl->initialiseClass(vm); + cl->initialiseClass(); UserClass* methodCl = 0; UserClass* lookup = objCl->isArray() ? objCl->super : objCl->asClass(); meth = lookup->lookupMethod(meth->name, meth->type, false, true, &methodCl); } } else { - cl->initialiseClass(vm); + cl->initialiseClass(); } JavaObject** ptr = ArrayObject::getElements(args); @@ -158,14 +158,14 @@ if (isVirtual(meth->access)) { \ if (isPublic(meth->access) && !isFinal(meth->access) && \ !isFinal(meth->classDef->access)) { \ - VAR = meth->invoke##TYPE##VirtualBuf(vm, cl, obj, buf); \ + VAR = meth->invoke##TYPE##VirtualBuf(cl, obj, buf); \ } else { \ - VAR = meth->invoke##TYPE##SpecialBuf(vm, cl, obj, buf); \ - } \ - } else { \ - VAR = meth->invoke##TYPE##StaticBuf(vm, cl, buf); \ - } \ - } CATCH { \ + VAR = meth->invoke##TYPE##SpecialBuf(cl, obj, buf); \ + } \ + } else { \ + VAR = meth->invoke##TYPE##StaticBuf(cl, buf); \ + } \ + } CATCH { \ exc = mvm::Thread::get()->getPendingException(); \ } END_CATCH; \ \ @@ -173,7 +173,7 @@ mvm::Thread* mut = mvm::Thread::get(); \ jexc = Jnjvm::asJavaException(exc); \ if (jexc && JavaObject::getClass(jexc)->isAssignableFrom( \ - vm->upcalls->newException)) { \ + vm->upcalls->newException)) { \ mut->clearPendingException(); \ JavaThread::j3Thread(mut)->getJVM()->invocationTargetException(jexc); \ } else { \ @@ -192,42 +192,42 @@ } else if (prim->isBool()) { uint32 val = 0; RUN_METH(Int, val); - res = vm->upcalls->boolClass->doNew(vm); + res = vm->upcalls->boolClass->doNew(); vm->upcalls->boolValue->setInstanceInt8Field(res, val); } else if (prim->isByte()) { uint32 val = 0; RUN_METH(Int, val); - res = vm->upcalls->byteClass->doNew(vm); + res = vm->upcalls->byteClass->doNew(); vm->upcalls->byteValue->setInstanceInt8Field(res, val); } else if (prim->isChar()) { uint32 val = 0; RUN_METH(Int, val); - res = vm->upcalls->charClass->doNew(vm); + res = vm->upcalls->charClass->doNew(); vm->upcalls->charValue->setInstanceInt16Field(res, val); } else if (prim->isShort()) { uint32 val = 0; RUN_METH(Int, val); - res = vm->upcalls->shortClass->doNew(vm); + res = vm->upcalls->shortClass->doNew(); vm->upcalls->shortValue->setInstanceInt16Field(res, val); } else if (prim->isInt()) { uint32 val = 0; RUN_METH(Int, val); - res = vm->upcalls->intClass->doNew(vm); + res = vm->upcalls->intClass->doNew(); vm->upcalls->intValue->setInstanceInt32Field(res, val); } else if (prim->isLong()) { sint64 val = 0; RUN_METH(Long, val); - res = vm->upcalls->longClass->doNew(vm); + res = vm->upcalls->longClass->doNew(); vm->upcalls->longValue->setInstanceLongField(res, val); } else if (prim->isFloat()) { float val = 0; RUN_METH(Float, val); - res = vm->upcalls->floatClass->doNew(vm); + res = vm->upcalls->floatClass->doNew(); vm->upcalls->floatValue->setInstanceFloatField(res, val); } else if (prim->isDouble()) { double val = 0; RUN_METH(Double, val); - res = vm->upcalls->doubleClass->doNew(vm); + res = vm->upcalls->doubleClass->doNew(); vm->upcalls->doubleValue->setInstanceDoubleField(res, val); } } else { Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClass.inc Wed Dec 8 07:00:22 2010 @@ -65,9 +65,9 @@ if (cl != 0) { if (clinit && cl->asClass()) { - cl->asClass()->initialiseClass(vm); + cl->asClass()->initialiseClass(); } - res = cl->getClassDelegatee(vm); + res = cl->getClassDelegatee(); } else { vm->classNotFoundException(str); } @@ -94,10 +94,10 @@ BEGIN_NATIVE_EXCEPTION(0) Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); if (cl->isArray() || cl->isInterface() || cl->isPrimitive()) { - ret = (ArrayObject*)vm->upcalls->constructorArrayClass->doNew(0, vm); + ret = (ArrayObject*)vm->upcalls->constructorArrayClass->doNew(0); } else { UserClass* realCl = cl->asClass();; uint32 size = 0; @@ -111,7 +111,7 @@ } } - ret = (ArrayObject*)vm->upcalls->constructorArrayClass->doNew(size, vm); + ret = (ArrayObject*)vm->upcalls->constructorArrayClass->doNew(size); sint32 index = 0; for (uint32 i = 0; i < realCl->nbVirtualMethods; ++i) { @@ -120,8 +120,8 @@ if (meth->name->equals(vm->upcalls->initName) && (!publicOnly || pub)) { UserClass* Cons = vm->upcalls->newConstructor; - tmp = Cons->doNew(vm); - vm->upcalls->initConstructor->invokeIntSpecial(vm, Cons, tmp, &Cl, i); + tmp = Cons->doNew(); + vm->upcalls->initConstructor->invokeIntSpecial(Cons, tmp, &Cl, i); ArrayObject::setElement(ret, tmp, index); index++; } @@ -152,11 +152,11 @@ BEGIN_NATIVE_EXCEPTION(0) Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); Classpath* upcalls = vm->upcalls; if (cl->isArray() || cl->isPrimitive()) { - ret = (ArrayObject*)upcalls->methodArrayClass->doNew(0, vm); + ret = (ArrayObject*)upcalls->methodArrayClass->doNew(0); } else { UserClass* realCl = cl->asClass(); uint32 size = 0; @@ -172,7 +172,7 @@ } - ret = (ArrayObject*)upcalls->methodArrayClass->doNew(size, vm); + ret = (ArrayObject*)upcalls->methodArrayClass->doNew(size); sint32 index = 0; for (uint32 i = 0; i < realCl->nbVirtualMethods + realCl->nbStaticMethods; @@ -183,9 +183,9 @@ (!publicOnly || pub)) { // TODO: check parameter types UserClass* Meth = vm->upcalls->newMethod; - tmp = Meth->doNew(vm); + tmp = Meth->doNew(); str = vm->internalUTF8ToStr(meth->name); - upcalls->initMethod->invokeIntSpecial(vm, Meth, tmp, &Cl, &str, i); + upcalls->initMethod->invokeIntSpecial(Meth, tmp, &Cl, &str, i); ArrayObject::setElement(ret, tmp, index); index++; } @@ -210,8 +210,7 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); res = cl->getAccess(); END_NATIVE_EXCEPTION @@ -232,7 +231,7 @@ BEGIN_NATIVE_EXCEPTION(0) Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); const UTF8* iname = cl->getName(); result = JavaString::internalToJava(iname, vm); @@ -254,8 +253,7 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); res = cl->isPrimitive(); @@ -276,8 +274,7 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); res = cl->isInterface(); @@ -300,12 +297,11 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); if (cl->isArray()) { UserCommonClass* bc = cl->asArrayClass()->baseClass(); - res = bc->getClassDelegatee(vm); + res = bc->getClassDelegatee(); } else { res = 0; } @@ -327,8 +323,7 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); res = cl->classLoader->getJavaClassLoader(); END_NATIVE_EXCEPTION @@ -352,8 +347,8 @@ Jnjvm* vm = JavaThread::get()->getJVM(); if (!Cl2) vm->nullPointerException(); - UserCommonClass* cl1 = UserCommonClass::resolvedImplClass(vm, Cl1, false); - UserCommonClass* cl2 = UserCommonClass::resolvedImplClass(vm, Cl2, false); + UserCommonClass* cl1 = UserCommonClass::resolvedImplClass(Cl1, false); + UserCommonClass* cl2 = UserCommonClass::resolvedImplClass(Cl2, false); res = cl2->isAssignableFrom(cl1); @@ -376,11 +371,10 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); if (cl->isInterface()) res = 0; else { - if (cl->getSuper()) res = cl->getSuper()->getClassDelegatee(vm); + if (cl->getSuper()) res = cl->getSuper()->getClassDelegatee(); else res = 0; } @@ -402,8 +396,7 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); res = JavaObject::instanceOf(obj, cl); END_NATIVE_EXCEPTION @@ -429,10 +422,10 @@ BEGIN_NATIVE_EXCEPTION(0) Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); if (!cl->isClass()) { - ret = (ArrayObject*)vm->upcalls->fieldArrayClass->doNew(0, vm); + ret = (ArrayObject*)vm->upcalls->fieldArrayClass->doNew(0); } else { UserClass* realCl = cl->asClass(); uint32 size = 0; @@ -445,7 +438,7 @@ } - ret = (ArrayObject*)vm->upcalls->fieldArrayClass->doNew(size, vm); + ret = (ArrayObject*)vm->upcalls->fieldArrayClass->doNew(size); sint32 index = 0; for (uint32 i = 0; i < realCl->nbVirtualFields + realCl->nbStaticFields; @@ -454,9 +447,9 @@ if (!publicOnly || isPublic(field->access)) { // TODO: check parameter types UserClass* Field = vm->upcalls->newField; - tmp = Field->doNew(vm); + tmp = Field->doNew(); name = vm->internalUTF8ToStr(field->name); - vm->upcalls->initField->invokeIntSpecial(vm, Field, tmp, &Cl, &name, i); + vm->upcalls->initField->invokeIntSpecial(Field, tmp, &Cl, &name, i); ArrayObject::setElement(ret, tmp, index); index++; } @@ -482,12 +475,12 @@ BEGIN_NATIVE_EXCEPTION(0) Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); - res = (ArrayObject*)vm->upcalls->classArrayClass->doNew(cl->nbInterfaces, vm); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); + res = (ArrayObject*)vm->upcalls->classArrayClass->doNew(cl->nbInterfaces); for (uint16 i = 0; i < cl->nbInterfaces; ++i) { UserClass* klass = cl->interfaces[i]; - ArrayObject::setElement(res, klass->getClassDelegatee(vm), i); + ArrayObject::setElement(res, klass->getClassDelegatee(), i); } END_NATIVE_EXCEPTION @@ -509,14 +502,13 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false)->asClass(); + UserClass* cl = UserCommonClass::resolvedImplClass(Cl, false)->asClass(); if (cl) { cl->resolveInnerOuterClasses(); UserClass* outer = cl->getOuterClass(); if (outer) { - res = outer->getClassDelegatee(vm); + res = outer->getClassDelegatee(); } } @@ -540,7 +532,7 @@ BEGIN_NATIVE_EXCEPTION(0) Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false)->asClass(); + UserClass* cl = UserCommonClass::resolvedImplClass(Cl, false)->asClass(); if (cl) { cl->resolveInnerOuterClasses(); UserClassArray* array = vm->upcalls->constructorArrayClass; @@ -556,11 +548,11 @@ sizeArray = cl->nbInnerClasses; } - result = (ArrayObject*)array->doNew(sizeArray, vm); + result = (ArrayObject*)array->doNew(sizeArray); for (uint16 i = 0; i < cl->nbInnerClasses; ++i) { UserClass* klass = cl->innerClasses[i]; if (!publicOnly || isPublic(klass->innerAccess)) - ArrayObject::setElement(result, klass->getClassDelegatee(vm), i); + ArrayObject::setElement(result, klass->getClassDelegatee(), i); } } @@ -601,7 +593,7 @@ Jnjvm* vm = JavaThread::get()->getJVM(); UserClassArray* array = vm->upcalls->constructorArrayAnnotation; - res = (ArrayObject*)array->doNew(0, vm); + res = (ArrayObject*)array->doNew(0); END_NATIVE_EXCEPTION @@ -620,8 +612,7 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false)->asClass(); + UserClass* cl = UserCommonClass::resolvedImplClass(Cl, false)->asClass(); if (cl) res = cl->isAnonymous; Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClassLoader.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClassLoader.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClassLoader.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMClassLoader.inc Wed Dec 8 07:00:22 2010 @@ -44,7 +44,7 @@ abort(); } - res = prim->getClassDelegatee(vm); + res = prim->getClassDelegatee(); END_NATIVE_EXCEPTION @@ -72,7 +72,7 @@ JnjvmClassLoader::getJnjvmLoaderFromJavaObject(loader, vm); UserCommonClass* cl = JCL->lookupClassFromJavaString(name); - if (cl) res = cl->getClassDelegatee(vm); + if (cl) res = cl->getClassDelegatee(); END_NATIVE_EXCEPTION @@ -100,7 +100,7 @@ JnjvmClassLoader* JCL = vm->bootstrapLoader; UserCommonClass* cl = JCL->loadClassFromJavaString(str, doResolve, false); - if (cl != 0) res = cl->getClassDelegatee(vm); + if (cl != 0) res = cl->getClassDelegatee(); END_NATIVE_EXCEPTION @@ -154,7 +154,7 @@ UserClass* cl = JCL->constructClass(name, classBytes); cl->resolveClass(); - res = cl->getClassDelegatee(vm, pd); + res = cl->getClassDelegatee(pd); } else { excp = vm->CreateLinkageError("duplicate class definition"); mvm::Thread::get()->setPendingException(excp)->throwIt(); @@ -177,8 +177,7 @@ BEGIN_NATIVE_EXCEPTION(0) verifyNull(Cl); - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass::resolvedImplClass(Cl, false); END_NATIVE_EXCEPTION } @@ -363,7 +362,7 @@ BEGIN_NATIVE_EXCEPTION(0) Jnjvm* vm = JavaThread::get()->getJVM(); - obj = (ArrayObject*)vm->upcalls->ArrayOfString->doNew(NUM_BOOT_PACKAGES, vm); + obj = (ArrayObject*)vm->upcalls->ArrayOfString->doNew(NUM_BOOT_PACKAGES); for (uint32 i = 0; i < NUM_BOOT_PACKAGES; ++i) { ArrayObject::setElement(obj, vm->asciizToStr(bootPackages[i]), i); } Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMObject.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMObject.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMObject.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMObject.inc Wed Dec 8 07:00:22 2010 @@ -70,8 +70,7 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - res = JavaObject::getClass(obj)->getClassDelegatee(vm); + res = JavaObject::getClass(obj)->getClassDelegatee(); END_NATIVE_EXCEPTION Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMRuntime.inc Wed Dec 8 07:00:22 2010 @@ -56,7 +56,7 @@ sint32 lgPost = vm->upcalls->postlib->size; uint32 size = (uint32)(lgPre + lgLib + lgPost); - array = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(size, vm); + array = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(size); uint16* elements = ArrayUInt16::getElements(array); memmove(elements, vm->upcalls->prelib->elements, Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMStackWalker.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMStackWalker.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMStackWalker.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMStackWalker.inc Wed Dec 8 07:00:22 2010 @@ -48,12 +48,12 @@ uint32 finalSize = th->getJavaFrameContext((void**)buffer); result = (ArrayObject*) - vm->upcalls->stackTraceArray->doNew(finalSize, vm); + vm->upcalls->stackTraceArray->doNew(finalSize); for (uint32 i = 0; i != finalSize; ++i) { JavaMethod* meth = ((JavaMethod**)buffer)[i]; assert(meth && "Wrong stack trace"); - delegatee = meth->classDef->getClassDelegatee(vm);; + delegatee = meth->classDef->getClassDelegatee();; ArrayObject::setElement(result, delegatee, i); } @@ -75,8 +75,7 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, false); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, false); res = cl->classLoader->getJavaClassLoader(); END_NATIVE_EXCEPTION Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMSystemProperties.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMSystemProperties.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMSystemProperties.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMSystemProperties.inc Wed Dec 8 07:00:22 2010 @@ -36,8 +36,7 @@ Val = vm->asciizToStr(val); Key = vm->asciizToStr(key); - vm->upcalls->setProperty->invokeIntSpecial( - vm, (UserClass*)JavaObject::getClass(prop), prop, &Key, &Val); + vm->upcalls->setProperty->invokeIntSpecial((UserClass*)JavaObject::getClass(prop), prop, &Key, &Val); } void setUnameProp(Jnjvm* vm, JavaObject* prop) { Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc Wed Dec 8 07:00:22 2010 @@ -67,7 +67,7 @@ assert(vmThread->getVirtualTable()); assert(javaThread->getVirtualTable()); // Run the VMThread::run function - vm->upcalls->runVMThread->invokeIntSpecial(vm, vmthClass, vmThread); + vm->upcalls->runVMThread->invokeIntSpecial(vmthClass, vmThread); // Remove the thread from the list. if (!isDaemon) { Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc Wed Dec 8 07:00:22 2010 @@ -44,10 +44,10 @@ if (sizeof(void*) == 4) { ClassArray* cl = vm->upcalls->ArrayOfInt; - result = (ArrayPtr*) cl->doNew(length, vm); + result = (ArrayPtr*) cl->doNew(length); } else { ClassArray* cl = vm->upcalls->ArrayOfLong; - result = (ArrayPtr*) cl->doNew(length, vm); + result = (ArrayPtr*) cl->doNew(length); } // Don't call th->getFrameContext because it is not GC-safe. @@ -61,7 +61,7 @@ } // Set the tempory data in the new VMThrowable object. - vmThrowable = vm->upcalls->newVMThrowable->doNew(vm); + vmThrowable = vm->upcalls->newVMThrowable->doNew(); vm->upcalls->vmDataVMThrowable->setInstanceObjectField(vmThrowable, result); return vmThrowable; } @@ -116,8 +116,8 @@ uint16 lineNumber = meth->lookupLineNumber(reinterpret_cast(ip)); UserClass* newS = vm->upcalls->newStackTraceElement; - res = newS->doNew(vm); - vm->upcalls->initStackTraceElement->invokeIntSpecial(vm, newS, res, + res = newS->doNew(); + vm->upcalls->initStackTraceElement->invokeIntSpecial(newS, res, &sourceName, lineNumber, &className, @@ -170,7 +170,7 @@ } result = (ArrayObject*) - vm->upcalls->stackTraceArray->doNew(size, vm); + vm->upcalls->stackTraceArray->doNew(size); cur = 0; for (sint32 i = index; i < JavaArray::getSize(stack); ++i) { Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp Wed Dec 8 07:00:22 2010 @@ -51,9 +51,9 @@ llvm_gcroot(th, 0); llvm_gcroot(name, 0); - th = newThread->doNew(vm); + th = newThread->doNew(); myth->javaThread = th; - vmth = (JavaObjectVMThread*)newVMThread->doNew(vm); + vmth = (JavaObjectVMThread*)newVMThread->doNew(); name = vm->asciizToStr(thName); threadName->setInstanceObjectField(th, name); @@ -65,9 +65,9 @@ JavaObjectVMThread::setVmdata(vmth, myth); group->setInstanceObjectField(th, Group); - groupAddThread->invokeIntSpecial(vm, threadGroup, Group, &th); + groupAddThread->invokeIntSpecial(threadGroup, Group, &th); - finaliseCreateInitialThread->invokeIntStatic(vm, inheritableThreadLocal, &th); + finaliseCreateInitialThread->invokeIntStatic(inheritableThreadLocal, &th); } @@ -91,13 +91,13 @@ // Resolve and initialize classes first. newThread->resolveClass(); - newThread->initialiseClass(vm); + newThread->initialiseClass(); newVMThread->resolveClass(); - newVMThread->initialiseClass(vm); + newVMThread->initialiseClass(); threadGroup->resolveClass(); - threadGroup->initialiseClass(vm); + threadGroup->initialiseClass(); // Create the main thread RG = rootGroup->getStaticObjectField(); @@ -106,8 +106,8 @@ CreateJavaThread(vm, vm->javaMainThread, "main", RG); // Create the "system" group. - SystemGroup = threadGroup->doNew(vm); - initGroup->invokeIntSpecial(vm, threadGroup, SystemGroup); + SystemGroup = threadGroup->doNew(); + initGroup->invokeIntSpecial(threadGroup, SystemGroup); systemName = vm->asciizToStr("system"); groupName->setInstanceObjectField(SystemGroup, systemName); } @@ -233,7 +233,7 @@ JavaThread* th = JavaThread::get(); UserClass* cl = th->getCallingClassLevel(2); - if (cl != NULL) res = cl->getClassDelegatee(th->getJVM()); + if (cl != NULL) res = cl->getClassDelegatee(); END_NATIVE_EXCEPTION @@ -278,9 +278,8 @@ BEGIN_NATIVE_EXCEPTION(0) JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); UserClass* cl = th->getCallingClassLevel(index); - if (cl) res = cl->getClassDelegatee(vm); + if (cl) res = cl->getClassDelegatee(); END_NATIVE_EXCEPTION @@ -301,7 +300,7 @@ Jnjvm* vm = JavaThread::get()->getJVM(); UserClassArray* array = vm->upcalls->constructorArrayAnnotation; - res = array->doNew(0, vm); + res = array->doNew(0); END_NATIVE_EXCEPTION Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Dec 8 07:00:22 2010 @@ -1980,7 +1980,7 @@ if (!strncmp(UTF8Buffer(cl->name).cString(), i->c_str(), i->length() - 1)) { TRY { - cl->asClass()->initialiseClass(vm); + cl->asClass()->initialiseClass(); } CATCH { fprintf(stderr, "Error when initializing %s\n", UTF8Buffer(cl->name).cString()); @@ -1994,7 +1994,7 @@ CommonClass* cl = bootstrapLoader->lookupClass(name); if (cl && cl->isClass()) { TRY { - cl->asClass()->initialiseClass(vm); + cl->asClass()->initialiseClass(); } CATCH { fprintf(stderr, "Error when initializing %s\n", UTF8Buffer(cl->name).cString()); @@ -2036,7 +2036,7 @@ if (!M->clinits->empty()) { vm->loadBootstrap(); - cl->initialiseClass(vm); + cl->initialiseClass(); bootstrapLoader->setCompiler(M); } Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Wed Dec 8 07:00:22 2010 @@ -135,8 +135,7 @@ } Constant* JavaJITCompiler::getJavaClassPtr(CommonClass* cl) { - Jnjvm* vm = JavaThread::get()->getJVM(); - JavaObject* const* obj = cl->getClassDelegateePtr(vm); + JavaObject* const* obj = cl->getClassDelegateePtr(); assert(obj && "Delegatee not created"); Constant* CI = ConstantInt::get(Type::getInt64Ty(getLLVMContext()), uint64(obj)); @@ -161,7 +160,7 @@ obj = classDef->getStaticInstance(); if (!obj) { // Allocate now so that compiled code can reference it. - obj = classDef->allocateStaticInstance(JavaThread::get()->getJVM()); + obj = classDef->allocateStaticInstance(); } classDef->release(); } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp Wed Dec 8 07:00:22 2010 @@ -145,7 +145,8 @@ } -UserClassPrimitive* CommonClass::toPrimitive(Jnjvm* vm) const { +UserClassPrimitive* CommonClass::toPrimitive() const { + Jnjvm* vm = classLoader->vm; if (this == vm->upcalls->voidClass) { return vm->upcalls->OfVoid; } else if (this == vm->upcalls->intClass) { @@ -252,13 +253,13 @@ access = ACC_FINAL | ACC_ABSTRACT | ACC_PUBLIC | JNJVM_ARRAY; } -JavaObject* UserClassArray::doNew(sint32 n, Jnjvm* vm) { +JavaObject* UserClassArray::doNew(sint32 n) { JavaObject* res = NULL; llvm_gcroot(res, 0); if (n < 0) { - vm->negativeArraySizeException(n); + classLoader->vm->negativeArraySizeException(n); } else if (n > JavaArray::MaxArraySize) { - vm->outOfMemoryError(); + classLoader->vm->outOfMemoryError(); } UserCommonClass* cl = baseClass(); uint32 logSize = cl->isPrimitive() ? @@ -373,7 +374,7 @@ JavaMethod* res = lookupMethodDontThrow(name, type, isStatic, recurse, methodCl); if (!res) { - JavaThread::get()->getJVM()->noSuchMethodError(this, name); + classLoader->vm->noSuchMethodError(this, name); } return res; } @@ -382,7 +383,7 @@ JavaMethod* res = lookupInterfaceMethodDontThrow(name, type); if (!res) { - JavaThread::get()->getJVM()->noSuchMethodError(this, name); + classLoader->vm->noSuchMethodError(this, name); } return res; } @@ -435,12 +436,12 @@ JavaField* res = lookupFieldDontThrow(name, type, isStatic, recurse, definingClass); if (!res) { - JavaThread::get()->getJVM()->noSuchFieldError(this, name); + classLoader->vm->noSuchFieldError(this, name); } return res; } -JavaObject* UserClass::doNew(Jnjvm* vm) { +JavaObject* UserClass::doNew() { JavaObject* res = NULL; llvm_gcroot(res, 0); assert(this && "No class when allocating."); @@ -586,7 +587,7 @@ ((float*)((uint64)obj + ptrOffset))[0] = val; } -void JavaField::InitStaticField(Jnjvm* vm) { +void JavaField::InitStaticField() { const Typedef* type = getSignature(); Attribut* attribut = lookupAttribut(Attribut::constantAttribut); @@ -597,6 +598,7 @@ JavaConstantPool * ctpInfo = classDef->ctpInfo; uint16 idx = reader.readU2(); if (type->isPrimitive()) { + Jnjvm* vm = classDef->classLoader->vm; UserCommonClass* cl = type->assocClass(vm->bootstrapLoader); if (cl == vm->upcalls->OfLong) { InitStaticField((uint64)ctpInfo->LongAt(idx)); @@ -619,7 +621,7 @@ } } -void* UserClass::allocateStaticInstance(Jnjvm* vm) { +void* UserClass::allocateStaticInstance() { #ifdef USE_GC_BOEHM void* val = GC_MALLOC(getStaticSize()); #else @@ -899,7 +901,7 @@ ctpInfo->resolveClassName(reader.readU2()); if (!(thisClassName->equals(name))) { - JavaThread::get()->getJVM()->noClassDefFoundError(this, thisClassName); + classLoader->vm->noClassDefFoundError(this, thisClassName); } readParents(reader); @@ -961,11 +963,11 @@ } } -static JavaObject* getClassType(Jnjvm* vm, JnjvmClassLoader* loader, +static JavaObject* getClassType(JnjvmClassLoader* loader, Typedef* type) { UserCommonClass* res = type->assocClass(loader); assert(res && "No associated class"); - return res->getClassDelegatee(vm); + return res->getClassDelegatee(); } ArrayObject* JavaMethod::getParameterTypes(JnjvmClassLoader* loader) { @@ -975,13 +977,12 @@ llvm_gcroot(res, 0); llvm_gcroot(delegatee, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); Signdef* sign = getSignature(); Typedef* const* arguments = sign->getArgumentsType(); - res = (ArrayObject*)vm->upcalls->classArrayClass->doNew(sign->nbArguments,vm); + res = (ArrayObject*)loader->vm->upcalls->classArrayClass->doNew(sign->nbArguments); for (uint32 index = 0; index < sign->nbArguments; ++index) { - delegatee = getClassType(vm, loader, arguments[index]); + delegatee = getClassType(loader, arguments[index]); ArrayObject::setElement(res, delegatee, index); } @@ -990,9 +991,8 @@ } JavaObject* JavaMethod::getReturnType(JnjvmClassLoader* loader) { - Jnjvm* vm = JavaThread::get()->getJVM(); Typedef* ret = getSignature()->getReturnType(); - return getClassType(vm, loader, ret); + return getClassType(loader, ret); } ArrayObject* JavaMethod::getExceptionTypes(JnjvmClassLoader* loader) { @@ -1003,21 +1003,21 @@ llvm_gcroot(delegatee, 0); Attribut* exceptionAtt = lookupAttribut(Attribut::exceptionsAttribut); - Jnjvm* vm = JavaThread::get()->getJVM(); + Jnjvm* vm = loader->vm; if (exceptionAtt == 0) { - return (ArrayObject*)vm->upcalls->classArrayClass->doNew(0, vm); + return (ArrayObject*)vm->upcalls->classArrayClass->doNew(0); } else { UserConstantPool* ctp = classDef->getConstantPool(); Reader reader(exceptionAtt, classDef->bytes); uint16 nbe = reader.readU2(); - res = (ArrayObject*)vm->upcalls->classArrayClass->doNew(nbe, vm); + res = (ArrayObject*)vm->upcalls->classArrayClass->doNew(nbe); for (uint16 i = 0; i < nbe; ++i) { uint16 idx = reader.readU2(); UserCommonClass* cl = ctp->loadClass(idx); assert(cl->asClass() && "Wrong exception type"); cl->asClass()->resolveClass(); - delegatee = cl->getClassDelegatee(vm); + delegatee = cl->getClassDelegatee(); ArrayObject::setElement(res, delegatee, i); } return res; @@ -1036,8 +1036,7 @@ -UserCommonClass* UserCommonClass::resolvedImplClass(Jnjvm* vm, - JavaObject* clazz, +UserCommonClass* UserCommonClass::resolvedImplClass(JavaObject* clazz, bool doClinit) { llvm_gcroot(clazz, 0); @@ -1046,7 +1045,7 @@ assert(cl && "No class in Class object"); if (cl->isClass()) { cl->asClass()->resolveClass(); - if (doClinit) cl->asClass()->initialiseClass(vm); + if (doClinit) cl->asClass()->initialiseClass(); } return cl; } @@ -1244,9 +1243,9 @@ ArrayUInt16* JavaMethod::toString() const { - Jnjvm* vm = JavaThread::get()->getJVM(); + Jnjvm* vm = classDef->classLoader->vm; uint32 size = classDef->name->size + name->size + type->size + 1; - ArrayUInt16* res = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(size, vm); + ArrayUInt16* res = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(size); llvm_gcroot(res, 0); uint32 i = 0; @@ -1763,27 +1762,27 @@ void Class::acquire() { JavaObject* delegatee = NULL; llvm_gcroot(delegatee, 0); - delegatee = getClassDelegatee(JavaThread::get()->getJVM()); + delegatee = getClassDelegatee(); JavaObject::acquire(delegatee); } void Class::release() { JavaObject* delegatee = NULL; llvm_gcroot(delegatee, 0); - delegatee = getClassDelegatee(JavaThread::get()->getJVM()); + delegatee = getClassDelegatee(); JavaObject::release(delegatee); } void Class::waitClass() { JavaObject* delegatee = NULL; llvm_gcroot(delegatee, 0); - delegatee = getClassDelegatee(JavaThread::get()->getJVM()); + delegatee = getClassDelegatee(); JavaObject::wait(delegatee); } void Class::broadcastClass() { JavaObject* delegatee = NULL; llvm_gcroot(delegatee, 0); - delegatee = getClassDelegatee(JavaThread::get()->getJVM()); + delegatee = getClassDelegatee(); JavaObject::notifyAll(delegatee); } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.h Wed Dec 8 07:00:22 2010 @@ -300,12 +300,12 @@ /// getClassDelegatee - Return the java/lang/Class representation of this /// class. /// - JavaObject* getClassDelegatee(Jnjvm* vm, JavaObject* pd = NULL); + JavaObject* getClassDelegatee(JavaObject* pd = NULL); /// getClassDelegateePtr - Return a pointer on the java/lang/Class /// representation of this class. Used for JNI. /// - JavaObject* const* getClassDelegateePtr(Jnjvm* vm, JavaObject* pd = NULL); + JavaObject* const* getClassDelegateePtr(JavaObject* pd = NULL); /// CommonClass - Create a class with th given name. /// @@ -325,7 +325,7 @@ /// toPrimitive - Returns the primitive class which represents /// this class, ie void for java/lang/Void. /// - UserClassPrimitive* toPrimitive(Jnjvm* vm) const; + UserClassPrimitive* toPrimitive() const; /// getInternal - Return the class. /// @@ -353,7 +353,7 @@ /// resolvedImplClass - Return the internal representation of the /// java.lang.Class object. The class must be resolved. // - static UserCommonClass* resolvedImplClass(Jnjvm* vm, JavaObject* delegatee, + static UserCommonClass* resolvedImplClass(JavaObject* delegatee, bool doClinit); #ifdef USE_GC_BOEHM void* operator new(size_t sz, mvm::BumpPtrAllocator& allocator) { @@ -588,7 +588,7 @@ /// doNew - Allocates a Java object whose class is this class. /// - JavaObject* doNew(Jnjvm* vm); + JavaObject* doNew(); /// tracer - Tracer function of instances of Class. /// @@ -603,7 +603,7 @@ /// allocateStaticInstance - Allocate the static instance of this class. /// - void* allocateStaticInstance(Jnjvm* vm); + void* allocateStaticInstance(); /// Class - Create a class in the given virtual machine and with the given /// name. @@ -658,7 +658,7 @@ /// initialiseClass - If the class has not been initialized yet, /// initialize it. /// - void initialiseClass(Jnjvm* vm); + void initialiseClass(); /// acquire - Acquire this class lock. /// @@ -802,7 +802,7 @@ /// doNew - Allocate a new array in the given vm. /// - JavaObject* doNew(sint32 n, Jnjvm* vm); + JavaObject* doNew(sint32 n); /// ClassArray - Construct a Java array class with the given name. /// @@ -998,106 +998,106 @@ //===----------------------------------------------------------------------===// /// This class of methods takes a variable argument list. - uint32 invokeIntSpecialAP(Jnjvm* vm, UserClass*, JavaObject* obj, va_list ap) + uint32 invokeIntSpecialAP(UserClass*, JavaObject* obj, va_list ap) __attribute__ ((noinline)); - float invokeFloatSpecialAP(Jnjvm* vm, UserClass*, JavaObject* obj, va_list ap) + float invokeFloatSpecialAP(UserClass*, JavaObject* obj, va_list ap) __attribute__ ((noinline)); - double invokeDoubleSpecialAP(Jnjvm* vm, UserClass*, JavaObject* obj, + double invokeDoubleSpecialAP(UserClass*, JavaObject* obj, va_list ap) __attribute__ ((noinline)); - sint64 invokeLongSpecialAP(Jnjvm* vm, UserClass*, JavaObject* obj, va_list ap) + sint64 invokeLongSpecialAP(UserClass*, JavaObject* obj, va_list ap) __attribute__ ((noinline)); - JavaObject* invokeJavaObjectSpecialAP(Jnjvm* vm, UserClass*, JavaObject* obj, + JavaObject* invokeJavaObjectSpecialAP(UserClass*, JavaObject* obj, va_list ap) __attribute__ ((noinline)); - uint32 invokeIntVirtualAP(Jnjvm* vm, UserClass*, JavaObject* obj, va_list ap) + uint32 invokeIntVirtualAP(UserClass*, JavaObject* obj, va_list ap) __attribute__ ((noinline)); - float invokeFloatVirtualAP(Jnjvm* vm, UserClass*, JavaObject* obj, va_list ap) + float invokeFloatVirtualAP(UserClass*, JavaObject* obj, va_list ap) __attribute__ ((noinline)); - double invokeDoubleVirtualAP(Jnjvm* vm, UserClass*, JavaObject* obj, + double invokeDoubleVirtualAP(UserClass*, JavaObject* obj, va_list ap) __attribute__ ((noinline)); - sint64 invokeLongVirtualAP(Jnjvm* vm, UserClass*, JavaObject* obj, va_list ap) + sint64 invokeLongVirtualAP(UserClass*, JavaObject* obj, va_list ap) __attribute__ ((noinline)); - JavaObject* invokeJavaObjectVirtualAP(Jnjvm* vm, UserClass*, JavaObject* obj, + JavaObject* invokeJavaObjectVirtualAP(UserClass*, JavaObject* obj, va_list ap) __attribute__ ((noinline)); - uint32 invokeIntStaticAP(Jnjvm* vm, UserClass*, va_list ap) + uint32 invokeIntStaticAP(UserClass*, va_list ap) __attribute__ ((noinline)); - float invokeFloatStaticAP(Jnjvm* vm, UserClass*, va_list ap) + float invokeFloatStaticAP(UserClass*, va_list ap) __attribute__ ((noinline)); - double invokeDoubleStaticAP(Jnjvm* vm, UserClass*, va_list ap) + double invokeDoubleStaticAP(UserClass*, va_list ap) __attribute__ ((noinline)); - sint64 invokeLongStaticAP(Jnjvm* vm, UserClass*, va_list ap) + sint64 invokeLongStaticAP(UserClass*, va_list ap) __attribute__ ((noinline)); - JavaObject* invokeJavaObjectStaticAP(Jnjvm* vm, UserClass*, va_list ap) + JavaObject* invokeJavaObjectStaticAP(UserClass*, va_list ap) __attribute__ ((noinline)); /// This class of methods takes a buffer which contain the arguments of the /// call. - uint32 invokeIntSpecialBuf(Jnjvm* vm, UserClass*, JavaObject* obj, void* buf) + uint32 invokeIntSpecialBuf(UserClass*, JavaObject* obj, void* buf) __attribute__ ((noinline)); - float invokeFloatSpecialBuf(Jnjvm* vm, UserClass*, JavaObject* obj, void* buf) + float invokeFloatSpecialBuf(UserClass*, JavaObject* obj, void* buf) __attribute__ ((noinline)); - double invokeDoubleSpecialBuf(Jnjvm* vm, UserClass*, JavaObject* obj, + double invokeDoubleSpecialBuf(UserClass*, JavaObject* obj, void* buf) __attribute__ ((noinline)); - sint64 invokeLongSpecialBuf(Jnjvm* vm, UserClass*, JavaObject* obj, void* buf) + sint64 invokeLongSpecialBuf(UserClass*, JavaObject* obj, void* buf) __attribute__ ((noinline)); - JavaObject* invokeJavaObjectSpecialBuf(Jnjvm* vm, UserClass*, JavaObject* obj, + JavaObject* invokeJavaObjectSpecialBuf(UserClass*, JavaObject* obj, void* buf) __attribute__ ((noinline)); - uint32 invokeIntVirtualBuf(Jnjvm* vm, UserClass*, JavaObject* obj, void* buf) + uint32 invokeIntVirtualBuf(UserClass*, JavaObject* obj, void* buf) __attribute__ ((noinline)); - float invokeFloatVirtualBuf(Jnjvm* vm, UserClass*, JavaObject* obj, void* buf) + float invokeFloatVirtualBuf(UserClass*, JavaObject* obj, void* buf) __attribute__ ((noinline)); - double invokeDoubleVirtualBuf(Jnjvm* vm, UserClass*, JavaObject* obj, + double invokeDoubleVirtualBuf(UserClass*, JavaObject* obj, void* buf) __attribute__ ((noinline)); - sint64 invokeLongVirtualBuf(Jnjvm* vm, UserClass*, JavaObject* obj, void* buf) + sint64 invokeLongVirtualBuf(UserClass*, JavaObject* obj, void* buf) __attribute__ ((noinline)); - JavaObject* invokeJavaObjectVirtualBuf(Jnjvm* vm, UserClass*, JavaObject* obj, + JavaObject* invokeJavaObjectVirtualBuf(UserClass*, JavaObject* obj, void* buf) __attribute__ ((noinline)); - uint32 invokeIntStaticBuf(Jnjvm* vm, UserClass*, void* buf) + uint32 invokeIntStaticBuf(UserClass*, void* buf) __attribute__ ((noinline)); - float invokeFloatStaticBuf(Jnjvm* vm, UserClass*, void* buf) + float invokeFloatStaticBuf(UserClass*, void* buf) __attribute__ ((noinline)); - double invokeDoubleStaticBuf(Jnjvm* vm, UserClass*, void* buf) + double invokeDoubleStaticBuf(UserClass*, void* buf) __attribute__ ((noinline)); - sint64 invokeLongStaticBuf(Jnjvm* vm, UserClass*, void* buf) + sint64 invokeLongStaticBuf(UserClass*, void* buf) __attribute__ ((noinline)); - JavaObject* invokeJavaObjectStaticBuf(Jnjvm* vm, UserClass*, void* buf) + JavaObject* invokeJavaObjectStaticBuf(UserClass*, void* buf) __attribute__ ((noinline)); /// This class of methods is variadic. - uint32 invokeIntSpecial(Jnjvm* vm, UserClass*, JavaObject* obj, ...) + uint32 invokeIntSpecial(UserClass*, JavaObject* obj, ...) __attribute__ ((noinline)); - float invokeFloatSpecial(Jnjvm* vm, UserClass*, JavaObject* obj, ...) + float invokeFloatSpecial(UserClass*, JavaObject* obj, ...) __attribute__ ((noinline)); - double invokeDoubleSpecial(Jnjvm* vm, UserClass*, JavaObject* obj, ...) + double invokeDoubleSpecial(UserClass*, JavaObject* obj, ...) __attribute__ ((noinline)); - sint64 invokeLongSpecial(Jnjvm* vm, UserClass*, JavaObject* obj, ...) + sint64 invokeLongSpecial(UserClass*, JavaObject* obj, ...) __attribute__ ((noinline)); - JavaObject* invokeJavaObjectSpecial(Jnjvm* vm, UserClass*, JavaObject* obj, + JavaObject* invokeJavaObjectSpecial(UserClass*, JavaObject* obj, ...) __attribute__ ((noinline)); - uint32 invokeIntVirtual(Jnjvm* vm, UserClass*, JavaObject* obj, ...) + uint32 invokeIntVirtual(UserClass*, JavaObject* obj, ...) __attribute__ ((noinline)); - float invokeFloatVirtual(Jnjvm* vm, UserClass*, JavaObject* obj, ...) + float invokeFloatVirtual(UserClass*, JavaObject* obj, ...) __attribute__ ((noinline)); - double invokeDoubleVirtual(Jnjvm* vm, UserClass*, JavaObject* obj, ...) + double invokeDoubleVirtual(UserClass*, JavaObject* obj, ...) __attribute__ ((noinline)); - sint64 invokeLongVirtual(Jnjvm* vm, UserClass*, JavaObject* obj, ...) + sint64 invokeLongVirtual(UserClass*, JavaObject* obj, ...) __attribute__ ((noinline)); - JavaObject* invokeJavaObjectVirtual(Jnjvm* vm, UserClass*, JavaObject* obj, + JavaObject* invokeJavaObjectVirtual(UserClass*, JavaObject* obj, ...) __attribute__ ((noinline)); - uint32 invokeIntStatic(Jnjvm* vm, UserClass*, ...) + uint32 invokeIntStatic(UserClass*, ...) __attribute__ ((noinline)); - float invokeFloatStatic(Jnjvm* vm, UserClass*, ...) + float invokeFloatStatic(UserClass*, ...) __attribute__ ((noinline)); - double invokeDoubleStatic(Jnjvm* vm, UserClass*, ...) + double invokeDoubleStatic(UserClass*, ...) __attribute__ ((noinline)); - sint64 invokeLongStatic(Jnjvm* vm, UserClass*, ...) + sint64 invokeLongStatic(UserClass*, ...) __attribute__ ((noinline)); - JavaObject* invokeJavaObjectStatic(Jnjvm* vm, UserClass*, ...) + JavaObject* invokeJavaObjectStatic(UserClass*, ...) __attribute__ ((noinline)); #define JNI_NAME_PRE "Java_" @@ -1176,7 +1176,7 @@ /// InitStaticField - Init the value of the field in the given object. This is /// used for static fields which have a default value. /// - void InitStaticField(Jnjvm* vm); + void InitStaticField(); /// lookupAttribut - Look up the attribut in the field's list of attributs. /// Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaMetaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaMetaJIT.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaMetaJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaMetaJIT.cpp Wed Dec 8 07:00:22 2010 @@ -77,38 +77,38 @@ #if 1 // VA_ARGS do not work on all platforms for LLVM. #define INVOKE_AP(TYPE, TYPE_NAME, FUNC_TYPE_VIRTUAL_AP, FUNC_TYPE_STATIC_AP, FUNC_TYPE_VIRTUAL_BUF, FUNC_TYPE_STATIC_BUF) \ \ -TYPE JavaMethod::invoke##TYPE_NAME##VirtualAP(Jnjvm* vm, UserClass* cl, JavaObject* obj, va_list ap) { \ +TYPE JavaMethod::invoke##TYPE_NAME##VirtualAP(UserClass* cl, JavaObject* obj, va_list ap) { \ llvm_gcroot(obj, 0); \ verifyNull(obj); \ Signdef* sign = getSignature(); \ mvm::ThreadAllocator allocator; \ jvalue* buf = (jvalue*)allocator.Allocate(sign->nbArguments * sizeof(jvalue)); \ readArgs(buf, sign, ap, jni); \ - return invoke##TYPE_NAME##VirtualBuf(vm, cl, obj, buf); \ + return invoke##TYPE_NAME##VirtualBuf(cl, obj, buf); \ }\ \ -TYPE JavaMethod::invoke##TYPE_NAME##SpecialAP(Jnjvm* vm, UserClass* cl, JavaObject* obj, va_list ap) {\ +TYPE JavaMethod::invoke##TYPE_NAME##SpecialAP(UserClass* cl, JavaObject* obj, va_list ap) {\ llvm_gcroot(obj, 0); \ verifyNull(obj); \ Signdef* sign = getSignature(); \ mvm::ThreadAllocator allocator; \ jvalue* buf = (jvalue*)allocator.Allocate(sign->nbArguments * sizeof(jvalue)); \ readArgs(buf, sign, ap, jni); \ - return invoke##TYPE_NAME##SpecialBuf(vm, cl, obj, buf); \ + return invoke##TYPE_NAME##SpecialBuf(cl, obj, buf); \ }\ \ -TYPE JavaMethod::invoke##TYPE_NAME##StaticAP(Jnjvm* vm, UserClass* cl, va_list ap) {\ +TYPE JavaMethod::invoke##TYPE_NAME##StaticAP(UserClass* cl, va_list ap) {\ Signdef* sign = getSignature(); \ mvm::ThreadAllocator allocator; \ jvalue* buf = (jvalue*)allocator.Allocate(sign->nbArguments * sizeof(jvalue)); \ readArgs(buf, sign, ap, jni); \ - return invoke##TYPE_NAME##StaticBuf(vm, cl, buf); \ + return invoke##TYPE_NAME##StaticBuf(cl, buf); \ } #else #define INVOKE_AP(TYPE, TYPE_NAME, FUNC_TYPE_VIRTUAL_AP, FUNC_TYPE_STATIC_AP, FUNC_TYPE_VIRTUAL_BUF, FUNC_TYPE_STATIC_BUF) \ -TYPE JavaMethod::invoke##TYPE_NAME##VirtualAP(Jnjvm* vm, UserClass* cl, JavaObject* obj, va_list ap) { \ +TYPE JavaMethod::invoke##TYPE_NAME##VirtualAP(UserClass* cl, JavaObject* obj, va_list ap) { \ llvm_gcroot(obj, 0); \ verifyNull(obj); \ UserClass* objCl = JavaObject::getClass(obj)->isArray() ? JavaObject::getClass(obj)->super : JavaObject::getClass(obj)->asClass(); \ @@ -131,7 +131,7 @@ return res; \ }\ \ -TYPE JavaMethod::invoke##TYPE_NAME##SpecialAP(Jnjvm* vm, UserClass* cl, JavaObject* obj, va_list ap) {\ +TYPE JavaMethod::invoke##TYPE_NAME##SpecialAP(UserClass* cl, JavaObject* obj, va_list ap) {\ llvm_gcroot(obj, 0); \ verifyNull(obj);\ void* func = this->compiledPtr();\ @@ -147,10 +147,10 @@ return res; \ }\ \ -TYPE JavaMethod::invoke##TYPE_NAME##StaticAP(Jnjvm* vm, UserClass* cl, va_list ap) {\ +TYPE JavaMethod::invoke##TYPE_NAME##StaticAP(UserClass* cl, va_list ap) {\ if (!cl->isReady()) { \ cl->resolveClass(); \ - cl->initialiseClass(vm); \ + cl->initialiseClass(); \ } \ \ void* func = this->compiledPtr();\ @@ -169,7 +169,7 @@ #endif #define INVOKE_BUF(TYPE, TYPE_NAME, FUNC_TYPE_VIRTUAL_AP, FUNC_TYPE_STATIC_AP, FUNC_TYPE_VIRTUAL_BUF, FUNC_TYPE_STATIC_BUF) \ -TYPE JavaMethod::invoke##TYPE_NAME##VirtualBuf(Jnjvm* vm, UserClass* cl, JavaObject* obj, void* buf) {\ +TYPE JavaMethod::invoke##TYPE_NAME##VirtualBuf(UserClass* cl, JavaObject* obj, void* buf) {\ llvm_gcroot(obj, 0); \ verifyNull(obj);\ Signdef* sign = getSignature(); \ @@ -193,7 +193,7 @@ th->endJava(); \ return res; \ }\ -TYPE JavaMethod::invoke##TYPE_NAME##SpecialBuf(Jnjvm* vm, UserClass* cl, JavaObject* obj, void* buf) {\ +TYPE JavaMethod::invoke##TYPE_NAME##SpecialBuf(UserClass* cl, JavaObject* obj, void* buf) {\ llvm_gcroot(obj, 0); \ verifyNull(obj);\ void* func = this->compiledPtr();\ @@ -209,10 +209,10 @@ return res; \ }\ \ -TYPE JavaMethod::invoke##TYPE_NAME##StaticBuf(Jnjvm* vm, UserClass* cl, void* buf) {\ +TYPE JavaMethod::invoke##TYPE_NAME##StaticBuf(UserClass* cl, void* buf) {\ if (!cl->isReady()) { \ cl->resolveClass(); \ - cl->initialiseClass(vm); \ + cl->initialiseClass(); \ } \ \ void* func = this->compiledPtr();\ @@ -229,28 +229,28 @@ }\ #define INVOKE_VA(TYPE, TYPE_NAME, FUNC_TYPE_VIRTUAL_AP, FUNC_TYPE_STATIC_AP, FUNC_TYPE_VIRTUAL_BUF, FUNC_TYPE_STATIC_BUF) \ -TYPE JavaMethod::invoke##TYPE_NAME##Virtual(Jnjvm* vm, UserClass* cl, JavaObject* obj, ...) { \ +TYPE JavaMethod::invoke##TYPE_NAME##Virtual(UserClass* cl, JavaObject* obj, ...) { \ llvm_gcroot(obj, 0); \ va_list ap;\ va_start(ap, obj);\ - TYPE res = invoke##TYPE_NAME##VirtualAP(vm, cl, obj, ap);\ + TYPE res = invoke##TYPE_NAME##VirtualAP(cl, obj, ap);\ va_end(ap); \ return res; \ }\ \ -TYPE JavaMethod::invoke##TYPE_NAME##Special(Jnjvm* vm, UserClass* cl, JavaObject* obj, ...) {\ +TYPE JavaMethod::invoke##TYPE_NAME##Special(UserClass* cl, JavaObject* obj, ...) {\ llvm_gcroot(obj, 0); \ va_list ap;\ va_start(ap, obj);\ - TYPE res = invoke##TYPE_NAME##SpecialAP(vm, cl, obj, ap);\ + TYPE res = invoke##TYPE_NAME##SpecialAP(cl, obj, ap);\ va_end(ap); \ return res; \ }\ \ -TYPE JavaMethod::invoke##TYPE_NAME##Static(Jnjvm* vm, UserClass* cl, ...) {\ +TYPE JavaMethod::invoke##TYPE_NAME##Static(UserClass* cl, ...) {\ va_list ap;\ va_start(ap, cl);\ - TYPE res = invoke##TYPE_NAME##StaticAP(vm, cl, ap);\ + TYPE res = invoke##TYPE_NAME##StaticAP(cl, ap);\ va_end(ap); \ return res; \ }\ Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp Wed Dec 8 07:00:22 2010 @@ -152,7 +152,7 @@ vm->illegalArgumentException(""); } else { UserCommonClass* cl = getClass(obj); - UserClassPrimitive* value = cl->toPrimitive(vm); + UserClassPrimitive* value = cl->toPrimitive(); const PrimitiveTypedef* prim = (const PrimitiveTypedef*)signature; if (value == 0) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaRuntimeJIT.cpp Wed Dec 8 07:00:22 2010 @@ -118,7 +118,7 @@ JavaField* field = cl->asClass()->lookupField(utf8, sign->keyName, true, true, &fieldCl); - fieldCl->initialiseClass(JavaThread::get()->getJVM()); + fieldCl->initialiseClass(); void* obj = ((UserClass*)fieldCl)->getStaticInstance(); assert(obj && "No static instance in static field lookup"); @@ -216,7 +216,7 @@ BEGIN_NATIVE_EXCEPTION(1) cl->resolveClass(); - cl->initialiseClass(JavaThread::get()->getJVM()); + cl->initialiseClass(); END_NATIVE_EXCEPTION @@ -231,8 +231,7 @@ llvm_gcroot(res, 0); BEGIN_NATIVE_EXCEPTION(1) - Jnjvm* vm = JavaThread::get()->getJVM(); - res = cl->getClassDelegatee(vm); + res = cl->getClassDelegatee(); END_NATIVE_EXCEPTION hack_check(JavaObject*); @@ -241,11 +240,10 @@ } // Throws if one of the dimension is negative. -JavaObject* multiCallNewIntern(UserClassArray* cl, uint32 len, - sint32* dims, Jnjvm* vm) { +JavaObject* multiCallNewIntern(UserClassArray* cl, uint32 len, sint32* dims) { assert(len > 0 && "Negative size given by VMKit"); - JavaObject* _res = cl->doNew(dims[0], vm); + JavaObject* _res = cl->doNew(dims[0]); ArrayObject* res = NULL; JavaObject* temp = NULL; llvm_gcroot(_res, 0); @@ -259,14 +257,14 @@ UserClassArray* base = (UserClassArray*)_base; if (dims[0] > 0) { for (sint32 i = 0; i < dims[0]; ++i) { - temp = multiCallNewIntern(base, (len - 1), &dims[1], vm); + temp = multiCallNewIntern(base, (len - 1), &dims[1]); ArrayObject::setElement(res, temp, i); } } else { for (uint32 i = 1; i < len; ++i) { sint32 p = dims[i]; if (p < 0) { - JavaThread::get()->getJVM()->negativeArraySizeException(p); + cl->classLoader->vm->negativeArraySizeException(p); } } } @@ -288,9 +286,8 @@ for (uint32 i = 0; i < len; ++i){ dims[i] = va_arg(ap, int); } - Jnjvm* vm = JavaThread::get()->getJVM(); - res = multiCallNewIntern(cl, len, dims, vm); - + res = multiCallNewIntern(cl, len, dims); + END_NATIVE_EXCEPTION return res; @@ -687,7 +684,7 @@ lookup->lookupSpecialMethodDontThrow(utf8, sign->keyName, caller->classDef); if (!callee) { - JavaThread::j3Thread(mut)->getJVM()->noSuchMethodError(lookup, utf8); + cl->classLoader->vm->noSuchMethodError(lookup, utf8); } // Compile the found method. Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaString.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaString.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaString.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaString.cpp Wed Dec 8 07:00:22 2010 @@ -27,7 +27,7 @@ llvm_gcroot(res, 0); UserClass* cl = vm->upcalls->newString; - res = (JavaString*)cl->doNew(vm); + res = (JavaString*)cl->doNew(); // It's a hashed string, set the destructor so that the string // removes itself from the vm string map. Do this only if @@ -80,7 +80,7 @@ assert(getValue(self) && "String without an array?"); if (self->offset || (self->count != ArrayUInt16::getSize(getValue(self)))) { - array = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(self->count, vm); + array = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(self->count); for (sint32 i = 0; i < self->count; i++) { ArrayUInt16::setElement( array, ArrayUInt16::getElement(value, i + self->offset), i); @@ -107,7 +107,7 @@ ArrayUInt16* array = 0; llvm_gcroot(array, 0); - array = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(name->size, vm); + array = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(name->size); for (sint32 i = 0; i < name->size; i++) { uint16 cur = name->elements[i]; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp Wed Dec 8 07:00:22 2010 @@ -26,14 +26,13 @@ return JavaThread::get()->getJVM(); } -UserClass* getClassFromStaticMethod(Jnjvm* vm, JavaMethod* meth, +UserClass* getClassFromStaticMethod(JavaMethod* meth, JavaObject* clazz) { llvm_gcroot(clazz, 0); return meth->classDef; } -static UserClass* getClassFromVirtualMethod(Jnjvm* vm, - JavaMethod* meth, +static UserClass* getClassFromVirtualMethod(JavaMethod* meth, UserCommonClass* cl) { return meth->classDef; } @@ -67,9 +66,9 @@ UserCommonClass* cl = loader->loadClassFromAsciiz(asciiz, true, true); if (cl && cl->asClass()) { assert(cl->asClass()->isResolved()); - cl->asClass()->initialiseClass(vm); + cl->asClass()->initialiseClass(); } - jclass res = (jclass)cl->getClassDelegateePtr(vm); + jclass res = (jclass)cl->getClassDelegateePtr(); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -85,9 +84,9 @@ JavaObject* meth = *(JavaObject**)method; llvm_gcroot(meth, 0); - Jnjvm* vm = myVM(env); - Classpath* upcalls = vm->upcalls; UserCommonClass* cl = JavaObject::getClass(meth); + Jnjvm* vm = cl->classLoader->vm; + Classpath* upcalls = vm->upcalls; if (cl == upcalls->newConstructor) { jmethodID res = (jmethodID)JavaObjectMethod::getInternalMethod((JavaObjectMethod*)meth); RETURN_FROM_JNI(res); @@ -118,11 +117,10 @@ llvm_gcroot(sub, 0); llvm_gcroot(sup, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); UserCommonClass* cl2 = - UserCommonClass::resolvedImplClass(vm, sup, false); + UserCommonClass::resolvedImplClass(sup, false); UserCommonClass* cl1 = - UserCommonClass::resolvedImplClass(vm, sub, false); + UserCommonClass::resolvedImplClass(sub, false); jboolean res = (jboolean)cl1->isAssignableFrom(cl2); RETURN_FROM_JNI(res); @@ -155,16 +153,16 @@ Jnjvm* vm = JavaThread::get()->getJVM(); verifyNull(Cl); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, Cl, true); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, true); if (!cl->isClass()) RETURN_FROM_JNI(0); UserClass* realCl = cl->asClass(); - res = realCl->doNew(vm); + res = realCl->doNew(); JavaMethod* init = realCl->lookupMethod(vm->upcalls->initName, vm->upcalls->initExceptionSig, false, true, 0); str = vm->asciizToStr(msg); - init->invokeIntSpecial(vm, realCl, res, &str); + init->invokeIntSpecial(realCl, res, &str); mut->setPendingException(res); RETURN_FROM_JNI(1); @@ -267,13 +265,12 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, clazz, true); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(clazz, true); if (!cl->isClass()) RETURN_FROM_JNI(0); // Store local reference - res = cl->asClass()->doNew(vm); + res = cl->asClass()->doNew(); jobject ret = (jobject)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -295,16 +292,15 @@ JavaMethod* meth = (JavaMethod*)methodID; JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, clazz, true); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(clazz, true); if (!cl->isClass()) RETURN_FROM_JNI(0); // Store local reference - res = cl->asClass()->doNew(vm); + res = cl->asClass()->doNew(); va_list ap; va_start(ap, methodID); - meth->invokeIntSpecialAP(vm, cl->asClass(), res, ap); + meth->invokeIntSpecialAP(cl->asClass(), res, ap); va_end(ap); jobject ret = (jobject)th->pushJNIRef(res); @@ -334,14 +330,13 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); JavaMethod* meth = (JavaMethod*)methodID; - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, clazz, true); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(clazz, true); // Store local reference - res = cl->asClass()->doNew(vm); + res = cl->asClass()->doNew(); - meth->invokeIntSpecialBuf(vm, cl->asClass(), res, (void*)args); + meth->invokeIntSpecialBuf(cl->asClass(), res, (void*)args); jobject ret = (jobject)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -359,11 +354,8 @@ JavaObject* obj = *(JavaObject**)_obj; llvm_gcroot(obj, 0); - JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - // Store local reference - jclass res = (jclass)JavaObject::getClass(obj)->getClassDelegateePtr(vm); + jclass res = (jclass)JavaObject::getClass(obj)->getClassDelegateePtr(); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -410,8 +402,7 @@ JavaObject* clazz = *(JavaObject**)_clazz; llvm_gcroot(clazz, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, clazz, true); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(clazz, true); UserClass* realCl = cl->isClass() ? cl->asClass() : cl->super; @@ -446,10 +437,9 @@ JavaMethod* meth = (JavaMethod*)methodID; JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); - res = meth->invokeJavaObjectVirtualAP(vm, cl, obj, ap); + res = meth->invokeJavaObjectVirtualAP(cl, obj, ap); va_end(ap); jobject ret = (jobject)th->pushJNIRef(res); @@ -475,11 +465,10 @@ JavaMethod* meth = (JavaMethod*)methodID; JavaThread* th = JavaThread::get(); - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); // Store local reference. - res = meth->invokeJavaObjectVirtualAP(vm, cl, obj, args); + res = meth->invokeJavaObjectVirtualAP(cl, obj, args); jobject ret = (jobject)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -512,11 +501,10 @@ llvm_gcroot(self, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); UserClass* cl = - getClassFromVirtualMethod(vm, meth, JavaObject::getClass(self)); + getClassFromVirtualMethod(meth, JavaObject::getClass(self)); - uint32 res = meth->invokeIntVirtualAP(vm, cl, self, ap); + uint32 res = meth->invokeIntVirtualAP(cl, self, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -538,9 +526,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - jboolean res = (jboolean)meth->invokeIntVirtualAP(vm, cl, obj, args); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + jboolean res = (jboolean)meth->invokeIntVirtualAP(cl, obj, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -575,9 +562,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - jbyte res = (jbyte)meth->invokeIntVirtualAP(vm, cl, obj, args); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + jbyte res = (jbyte)meth->invokeIntVirtualAP(cl, obj, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -613,9 +599,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - jchar res = (jchar)meth->invokeIntVirtualAP(vm, cl, obj, args); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + jchar res = (jchar)meth->invokeIntVirtualAP(cl, obj, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -651,9 +636,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - jshort res = (jshort)meth->invokeIntVirtualAP(vm, cl, obj, args); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + jshort res = (jshort)meth->invokeIntVirtualAP(cl, obj, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -685,10 +669,9 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); - uint32 res = meth->invokeIntVirtualAP(vm, cl, obj, ap); + uint32 res = meth->invokeIntVirtualAP(cl, obj, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -710,10 +693,9 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); - jint res = (jint)meth->invokeIntVirtualAP(vm, cl, obj, args); + jint res = (jint)meth->invokeIntVirtualAP(cl, obj, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -750,9 +732,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - jlong res = (jlong)meth->invokeLongVirtualAP(vm, cl, obj, args); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + jlong res = (jlong)meth->invokeLongVirtualAP(cl, obj, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -784,9 +765,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - jfloat res = meth->invokeFloatVirtualAP(vm, cl, obj, ap); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + jfloat res = meth->invokeFloatVirtualAP(cl, obj, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -807,9 +787,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - jfloat res = (jfloat)meth->invokeFloatVirtualAP(vm, cl, obj, args); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + jfloat res = (jfloat)meth->invokeFloatVirtualAP(cl, obj, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -841,9 +820,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - jdouble res = meth->invokeDoubleVirtualAP(vm, cl, obj, ap); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + jdouble res = meth->invokeDoubleVirtualAP(cl, obj, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -864,9 +842,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - jdouble res = (jdouble)meth->invokeDoubleVirtualAP(vm, cl, obj, args); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + jdouble res = (jdouble)meth->invokeDoubleVirtualAP(cl, obj, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -898,9 +875,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - meth->invokeIntVirtualAP(vm, cl, obj, ap); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + meth->invokeIntVirtualAP(cl, obj, ap); va_end(ap); RETURN_VOID_FROM_JNI; @@ -923,9 +899,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - meth->invokeIntVirtualAP(vm, cl, obj, args); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + meth->invokeIntVirtualAP(cl, obj, args); RETURN_VOID_FROM_JNI; @@ -946,10 +921,9 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); - meth->invokeIntVirtualBuf(vm, cl, obj, (void*)args); + meth->invokeIntVirtualBuf(cl, obj, (void*)args); RETURN_VOID_FROM_JNI; @@ -1199,9 +1173,8 @@ llvm_gcroot(obj, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromVirtualMethod(vm, meth, JavaObject::getClass(obj)); - meth->invokeIntSpecialAP(vm, cl, obj, ap); + UserClass* cl = getClassFromVirtualMethod(meth, JavaObject::getClass(obj)); + meth->invokeIntSpecialAP(cl, obj, ap); va_end(ap); RETURN_VOID_FROM_JNI; @@ -1235,8 +1208,7 @@ JavaObject* clazz = *(JavaObject**)_clazz; llvm_gcroot(clazz, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, clazz, true); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(clazz, true); if (cl->isClass()) { const UTF8* name = cl->classLoader->hashUTF8->lookupAsciiz(aname); @@ -1599,8 +1571,7 @@ JavaObject* clazz = *(JavaObject**)_clazz; llvm_gcroot(clazz, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, clazz, true); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(clazz, true); if (cl->isClass()) { const UTF8* name = cl->classLoader->hashUTF8->lookupAsciiz(aname); @@ -1636,11 +1607,10 @@ JavaMethod* meth = (JavaMethod*)methodID; JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); + UserClass* cl = getClassFromStaticMethod(meth, clazz); // Store local reference. - res = meth->invokeJavaObjectStaticAP(vm, cl, ap); + res = meth->invokeJavaObjectStaticAP(cl, ap); va_end(ap); jobject ret = (jobject)th->pushJNIRef(res); @@ -1663,11 +1633,10 @@ JavaMethod* meth = (JavaMethod*)methodID; JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); + UserClass* cl = getClassFromStaticMethod(meth, clazz); // Store local reference. - res = meth->invokeJavaObjectStaticAP(vm, cl, args); + res = meth->invokeJavaObjectStaticAP(cl, args); jobject ret = (jobject)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -1698,9 +1667,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - uint32 res = meth->invokeIntStaticAP(vm, cl, ap); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + uint32 res = meth->invokeIntStaticAP(cl, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -1719,9 +1687,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jboolean res = (jboolean)meth->invokeIntStaticAP(vm, cl, args); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jboolean res = (jboolean)meth->invokeIntStaticAP(cl, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -1748,9 +1715,8 @@ va_list ap; va_start(ap, methodID); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jbyte res = (jbyte) meth->invokeIntStaticAP(vm, cl, ap); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jbyte res = (jbyte) meth->invokeIntStaticAP(cl, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -1769,9 +1735,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jbyte res = (jbyte)meth->invokeIntStaticAP(vm, cl, args); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jbyte res = (jbyte)meth->invokeIntStaticAP(cl, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -1799,9 +1764,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jchar res = (jchar) meth->invokeIntStaticAP(vm, cl, ap); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jchar res = (jchar) meth->invokeIntStaticAP(cl, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -1819,9 +1783,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jchar res = (jchar)meth->invokeIntStaticAP(vm, cl, args); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jchar res = (jchar)meth->invokeIntStaticAP(cl, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -1850,9 +1813,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jshort res = (jshort) meth->invokeIntStaticAP(vm, cl, ap); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jshort res = (jshort) meth->invokeIntStaticAP(cl, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -1871,9 +1833,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jshort res = (jshort)meth->invokeIntStaticAP(vm, cl, args); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jshort res = (jshort)meth->invokeIntStaticAP(cl, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -1901,9 +1862,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jint res = (jint) meth->invokeIntStaticAP(vm, cl, ap); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jint res = (jint) meth->invokeIntStaticAP(cl, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -1921,9 +1881,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jint res = (jint)meth->invokeIntStaticAP(vm, cl, args); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jint res = (jint)meth->invokeIntStaticAP(cl, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -1952,9 +1911,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jlong res = (jlong) meth->invokeLongStaticAP(vm, cl, ap); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jlong res = (jlong) meth->invokeLongStaticAP(cl, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -1973,9 +1931,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jlong res = (jlong)meth->invokeLongStaticAP(vm, cl, args); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jlong res = (jlong)meth->invokeLongStaticAP(cl, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -2006,9 +1963,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jfloat res = (jfloat) meth->invokeFloatStaticAP(vm, cl, ap); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jfloat res = (jfloat) meth->invokeFloatStaticAP(cl, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -2027,9 +1983,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jfloat res = (jfloat)meth->invokeFloatStaticAP(vm, cl, args); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jfloat res = (jfloat)meth->invokeFloatStaticAP(cl, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -2059,9 +2014,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jdouble res = (jdouble) meth->invokeDoubleStaticAP(vm, cl, ap); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jdouble res = (jdouble) meth->invokeDoubleStaticAP(cl, ap); va_end(ap); RETURN_FROM_JNI(res); @@ -2079,9 +2033,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - jdouble res = (jdouble)meth->invokeDoubleStaticAP(vm, cl, args); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + jdouble res = (jdouble)meth->invokeDoubleStaticAP(cl, args); RETURN_FROM_JNI(res); END_JNI_EXCEPTION @@ -2110,9 +2063,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - meth->invokeIntStaticAP(vm, cl, ap); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + meth->invokeIntStaticAP(cl, ap); va_end(ap); RETURN_VOID_FROM_JNI; @@ -2133,9 +2085,8 @@ llvm_gcroot(clazz, 0); JavaMethod* meth = (JavaMethod*)methodID; - Jnjvm* vm = JavaThread::get()->getJVM(); - UserClass* cl = getClassFromStaticMethod(vm, meth, clazz); - meth->invokeIntStaticAP(vm, cl, args); + UserClass* cl = getClassFromStaticMethod(meth, clazz); + meth->invokeIntStaticAP(cl, args); RETURN_VOID_FROM_JNI; @@ -2161,8 +2112,7 @@ JavaObject* clazz = *(JavaObject**)_clazz; llvm_gcroot(clazz, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); - UserCommonClass* cl = UserCommonClass::resolvedImplClass(vm, clazz, true); + UserCommonClass* cl = UserCommonClass::resolvedImplClass(clazz, true); if (cl->isClass()) { const UTF8* name = cl->classLoader->hashUTF8->lookupAsciiz(aname); @@ -2560,12 +2510,12 @@ if (length < 0) vm->negativeArraySizeException(length); UserCommonClass* base = - UserCommonClass::resolvedImplClass(vm, elementClass, true); + UserCommonClass::resolvedImplClass(elementClass, true); JnjvmClassLoader* loader = base->classLoader; const UTF8* name = base->getName(); const UTF8* arrayName = loader->constructArrayName(1, name); UserClassArray* array = loader->constructArray(arrayName, base); - res = (ArrayObject*)array->doNew(length, vm); + res = (ArrayObject*)array->doNew(length); if (initialElement) { for (sint32 i = 0; i < length; ++i) { @@ -2645,7 +2595,7 @@ JavaThread* th = JavaThread::get(); Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfBool->doNew(len, vm); + res = vm->upcalls->ArrayOfBool->doNew(len); jbooleanArray ret = (jbooleanArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2664,7 +2614,7 @@ JavaThread* th = JavaThread::get(); Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfByte->doNew(len, vm); + res = vm->upcalls->ArrayOfByte->doNew(len); jbyteArray ret = (jbyteArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2682,7 +2632,7 @@ JavaThread* th = JavaThread::get(); Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfChar->doNew(len, vm); + res = vm->upcalls->ArrayOfChar->doNew(len); jcharArray ret = (jcharArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2700,7 +2650,7 @@ JavaThread* th = JavaThread::get(); Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfShort->doNew(len, vm); + res = vm->upcalls->ArrayOfShort->doNew(len); jshortArray ret = (jshortArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2718,7 +2668,7 @@ JavaThread* th = JavaThread::get(); Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfInt->doNew(len, vm); + res = vm->upcalls->ArrayOfInt->doNew(len); jintArray ret = (jintArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2736,7 +2686,7 @@ JavaThread* th = JavaThread::get(); Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfLong->doNew(len, vm); + res = vm->upcalls->ArrayOfLong->doNew(len); jlongArray ret = (jlongArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2754,7 +2704,7 @@ JavaThread* th = JavaThread::get(); Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfFloat->doNew(len, vm); + res = vm->upcalls->ArrayOfFloat->doNew(len); jfloatArray ret = (jfloatArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2772,7 +2722,7 @@ JavaThread* th = JavaThread::get(); Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfDouble->doNew(len, vm); + res = vm->upcalls->ArrayOfDouble->doNew(len); jdoubleArray ret = (jdoubleArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -3600,19 +3550,19 @@ Jnjvm* myvm = th->getJVM(); UserClass* BB = myvm->upcalls->newDirectByteBuffer; - res = BB->doNew(myvm); + res = BB->doNew(); #if (__WORDSIZE == 32) UserClass* PP = myvm->upcalls->newPointer32; - p = PP->doNew(myvm); + p = PP->doNew(); myvm->upcalls->dataPointer32->setInstanceInt32Field(p, (uint32)address); #else UserClass* PP = myvm->upcalls->newPointer64; - p = PP->doNew(myvm); + p = PP->doNew(); myvm->upcalls->dataPointer64->setInstanceLongField(p, (jlong)address); #endif - myvm->upcalls->InitDirectByteBuffer->invokeIntSpecial(myvm, BB, res, 0, &p, + myvm->upcalls->InitDirectByteBuffer->invokeIntSpecial(BB, res, 0, &p, (uint32)capacity, (uint32)capacity, 0); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 8 07:00:22 2010 @@ -45,7 +45,7 @@ /// initialiseClass - Java class initialisation. Java specification §2.17.5. -void UserClass::initialiseClass(Jnjvm* vm) { +void UserClass::initialiseClass() { mvm::gc* exc = NULL; JavaObject* obj = NULL; JavaObject* jexc; @@ -111,7 +111,7 @@ // NoClassDefFoundError. if (isErroneous()) { release(); - vm->noClassDefFoundError(name); + classLoader->vm->noClassDefFoundError(name); } // 6. Otherwise, record the fact that initialization of the Class object is @@ -125,7 +125,7 @@ // 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); + if (!cl->getStaticInstance()) cl->allocateStaticInstance(); release(); @@ -141,7 +141,7 @@ UserClass* super = getSuper(); if (super) { TRY { - super->initialiseClass(vm); + super->initialiseClass(); } CATCH { acquire(); setErroneous(); @@ -171,19 +171,19 @@ if (!vmjced) { JavaField* fields = cl->getStaticFields(); for (uint32 i = 0; i < cl->nbStaticFields; ++i) { - fields[i].InitStaticField(vm); + fields[i].InitStaticField(); } } - - JavaMethod* meth = lookupMethodDontThrow(vm->upcalls->clinitName, - vm->upcalls->clinitType, + + JavaMethod* meth = lookupMethodDontThrow(classLoader->vm->upcalls->clinitName, + classLoader->vm->upcalls->clinitType, true, false, 0); if (meth) { TRY { - meth->invokeIntStatic(vm, cl); + meth->invokeIntStatic(cl); } CATCH { exc = mut->getPendingException(); assert(exc && "no exception?"); @@ -212,17 +212,16 @@ // OutOfMemoryError occurs, then instead use an OutOfMemoryError object // in place of E in the following step. jexc = Jnjvm::asJavaException(exc); - if (jexc && JavaObject::getClass(jexc)->isAssignableFrom(vm->upcalls->newException)) { - Classpath* upcalls = vm->upcalls; + if (jexc && JavaObject::getClass(jexc)->isAssignableFrom(classLoader->vm->upcalls->newException)) { + Classpath* upcalls = classLoader->vm->upcalls; UserClass* clExcp = upcalls->ExceptionInInitializerError; - Jnjvm* vm = JavaThread::get()->getJVM(); - obj = clExcp->doNew(vm); + obj = clExcp->doNew(); if (obj == NULL) { fprintf(stderr, "implement me"); abort(); } JavaMethod* init = upcalls->ErrorWithExcpExceptionInInitializerError; - init->invokeIntSpecial(vm, clExcp, obj, &exc); + init->invokeIntSpecial(clExcp, obj, &exc); exc = obj; } @@ -245,8 +244,8 @@ llvm_gcroot(obj, 0); llvm_gcroot(excp, 0); - obj = cl->doNew(this); - init->invokeIntSpecial(this, cl, obj, &excp); + obj = cl->doNew(); + init->invokeIntSpecial(cl, obj, &excp); mvm::Thread::get()->setPendingException(obj)->throwIt(); } @@ -256,11 +255,11 @@ JavaString* str = NULL; llvm_gcroot(obj, 0); llvm_gcroot(str, 0); - obj = cl->doNew(this); + obj = cl->doNew(); if (asciiz) str = asciizToStr(asciiz); - init->invokeIntSpecial(this, cl, obj, &str); + init->invokeIntSpecial(cl, obj, &str); return obj; } @@ -269,8 +268,8 @@ JavaObject* obj = NULL; llvm_gcroot(str, 0); llvm_gcroot(obj, 0); - obj = cl->doNew(this); - init->invokeIntSpecial(this, cl, obj, &str); + obj = cl->doNew(); + init->invokeIntSpecial(cl, obj, &str); return obj; } @@ -292,7 +291,7 @@ llvm_gcroot(obj, 0); llvm_gcroot(str, 0); str = (JavaString*)upcalls->IntToString->invokeJavaObjectStatic( - this, upcalls->intClass, entry, 10); + upcalls->intClass, entry, 10); error(upcalls->ArrayIndexOutOfBoundsException, upcalls->InitArrayIndexOutOfBoundsException, str); } @@ -301,7 +300,7 @@ JavaString* str = NULL; llvm_gcroot(str, 0); str = (JavaString*) - upcalls->IntToString->invokeJavaObjectStatic(this, upcalls->intClass, + upcalls->IntToString->invokeJavaObjectStatic(upcalls->intClass, size, 10); error(upcalls->NegativeArraySizeException, upcalls->InitNegativeArraySizeException, str); @@ -316,7 +315,7 @@ JavaString* str = NULL; llvm_gcroot(str, 0); str = (JavaString*) - upcalls->IntToString->invokeJavaObjectStatic(this, upcalls->intClass, + upcalls->IntToString->invokeJavaObjectStatic(upcalls->intClass, entry, 10); return CreateError(upcalls->ArrayIndexOutOfBoundsException, upcalls->InitArrayIndexOutOfBoundsException, str); @@ -363,7 +362,7 @@ // Don't call init, or else we'll get a new stack overflow error. JavaObject* obj = NULL; llvm_gcroot(obj, 0); - obj = upcalls->StackOverflowError->doNew(this); + obj = upcalls->StackOverflowError->doNew(); JavaObjectThrowable::fillInStackTrace((JavaObjectThrowable*)obj); return obj; } @@ -482,7 +481,7 @@ llvm_gcroot(msg, 0); llvm_gcroot(str, 0); msg = (ArrayUInt16*) - vm->upcalls->ArrayOfChar->doNew(19 + cl->name->size + name->size, vm); + vm->upcalls->ArrayOfChar->doNew(19 + cl->name->size + name->size); uint32 i = 0; @@ -558,7 +557,7 @@ llvm_gcroot(msg, 0); llvm_gcroot(str, 0); - msg = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(15 + name->size, vm); + msg = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(15 + name->size); uint32 i = 0; @@ -597,7 +596,7 @@ llvm_gcroot(msg, 0); llvm_gcroot(str, 0); - msg = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(15 + name->count, vm); + msg = (ArrayUInt16*)vm->upcalls->ArrayOfChar->doNew(15 + name->count); uint32 i = 0; ArrayUInt16::setElement(msg, 'u', i); i++; @@ -654,7 +653,7 @@ llvm_gcroot(str, 0); uint32 size = 35 + name->size + cl->name->size; - msg = (ArrayUInt16*)upcalls->ArrayOfChar->doNew(size, this); + msg = (ArrayUInt16*)upcalls->ArrayOfChar->doNew(size); uint32 i = 0; @@ -729,7 +728,7 @@ ArrayUInt16* tmp = NULL; llvm_gcroot(tmp, 0); uint32 size = utf8->size; - tmp = (ArrayUInt16*)upcalls->ArrayOfChar->doNew(size, this); + tmp = (ArrayUInt16*)upcalls->ArrayOfChar->doNew(size); for (uint32 i = 0; i < size; i++) { ArrayUInt16::setElement(tmp, utf8->elements[i], i); @@ -760,7 +759,7 @@ } // Mimic what's happening in Classpath when creating a java.lang.Class object. -JavaObject* UserCommonClass::getClassDelegatee(Jnjvm* vm, JavaObject* pd) { +JavaObject* UserCommonClass::getClassDelegatee(JavaObject* pd) { JavaObjectClass* delegatee = 0; JavaObjectClass* base = 0; llvm_gcroot(pd, 0); @@ -768,12 +767,12 @@ llvm_gcroot(base, 0); if (getDelegatee() == NULL) { - UserClass* cl = vm->upcalls->newClass; - delegatee = (JavaObjectClass*)cl->doNew(vm); + UserClass* cl = classLoader->vm->upcalls->newClass; + delegatee = (JavaObjectClass*)cl->doNew(); JavaObjectClass::setClass(delegatee, this); if (pd == NULL && isArray()) { base = (JavaObjectClass*) - asArrayClass()->baseClass()->getClassDelegatee(vm, pd); + asArrayClass()->baseClass()->getClassDelegatee(pd); JavaObjectClass::setProtectionDomain( delegatee, JavaObjectClass::getProtectionDomain(base)); } else { @@ -784,10 +783,10 @@ return getDelegatee(); } -JavaObject* const* UserCommonClass::getClassDelegateePtr(Jnjvm* vm, JavaObject* pd) { +JavaObject* const* UserCommonClass::getClassDelegateePtr(JavaObject* pd) { llvm_gcroot(pd, 0); // Make sure it's created. - getClassDelegatee(vm, pd); + getClassDelegatee(pd); return getDelegateePtr(); } @@ -1047,7 +1046,7 @@ if (appClassLoader == NULL) { UserClass* cl = upcalls->newClassLoader; - loader = upcalls->getSystemClassLoader->invokeJavaObjectStatic(this, cl); + loader = upcalls->getSystemClassLoader->invokeJavaObjectStatic(cl); appClassLoader = JnjvmClassLoader::getJnjvmLoaderFromJavaObject(loader, this); if (argumentsInfo.jarFile) { @@ -1083,7 +1082,7 @@ #define LOAD_CLASS(cl) \ cl->resolveClass(); \ - cl->initialiseClass(this); + cl->initialiseClass(); // If a string belongs to the vm hashmap, we must remove it when // it's destroyed. So we define a new VT for strings that will be @@ -1106,7 +1105,7 @@ JavaString::internStringVT->operatorDelete = (uintptr_t)JavaString::stringDestructor; } - upcalls->newString->initialiseClass(this); + upcalls->newString->initialiseClass(); // The initialization code of the classes initialized below may require // to get the Java thread, so we create the Java thread object first. @@ -1166,13 +1165,13 @@ obj = JavaThread::get()->currentThread(); javaLoader = appClassLoader->getJavaClassLoader(); - upcalls->setContextClassLoader->invokeIntSpecial(this, upcalls->newThread, + upcalls->setContextClassLoader->invokeIntSpecial(upcalls->newThread, obj, &javaLoader); // load and initialise math since it is responsible for dlopen'ing // libjavalang.so and we are optimizing some math operations UserCommonClass* math = loader->loadName( loader->asciizConstructUTF8("java/lang/Math"), true, true, NULL); - math->asClass()->initialiseClass(this); + math->asClass()->initialiseClass(); } void Jnjvm::executeClass(const char* className, ArrayObject* args) { @@ -1195,14 +1194,14 @@ cl = (UserClass*)appClassLoader->loadName(name, true, true, NULL); } - cl->initialiseClass(this); + cl->initialiseClass(); const UTF8* funcSign = appClassLoader->asciizConstructUTF8("([Ljava/lang/String;)V"); const UTF8* funcName = appClassLoader->asciizConstructUTF8("main"); JavaMethod* method = cl->lookupMethod(funcName, funcSign, true, true, 0); if (isPublic(method->access)) { - method->invokeIntStatic(this, method->classDef, &args); + method->invokeIntStatic(method->classDef, &args); } else { fprintf(stderr, "Main method not public.\n"); } @@ -1218,7 +1217,7 @@ obj = th->currentThread(); group = upcalls->group->getInstanceObjectField(obj); TRY { - upcalls->uncaughtException->invokeIntSpecial(this, upcalls->threadGroup, + upcalls->uncaughtException->invokeIntSpecial(upcalls->threadGroup, group, &obj, &exc); } CATCH { fprintf(stderr, "Exception in thread \"main\": " @@ -1235,14 +1234,14 @@ const UTF8* name = appClassLoader->asciizConstructUTF8(className); UserClass* cl = (UserClass*) appClassLoader->loadName(name, true, true, NULL); - cl->initialiseClass(this); + cl->initialiseClass(); const UTF8* funcSign = appClassLoader->asciizConstructUTF8( "(Ljava/lang/String;Ljava/lang/instrument/Instrumentation;)V"); const UTF8* funcName = appClassLoader->asciizConstructUTF8("premain"); JavaMethod* method = cl->lookupMethod(funcName, funcSign, true, true, 0); - method->invokeIntStatic(this, method->classDef, &args, &instrumenter); + method->invokeIntStatic(method->classDef, &args, &instrumenter); } IGNORE; } @@ -1309,7 +1308,7 @@ } UserClassArray* array = vm->upcalls->ArrayOfString; - args = (ArrayObject*)array->doNew(info.argc - 2, vm); + args = (ArrayObject*)array->doNew(info.argc - 2); for (int i = 2; i < info.argc; ++i) { ArrayObject::setElement(args, (JavaObject*)vm->asciizToStr(info.argv[i]), i - 2); } @@ -1379,7 +1378,7 @@ llvm_gcroot(tmp, 0); uint32 size = strlen(asciiz); - tmp = (ArrayUInt16*)upcalls->ArrayOfChar->doNew(size, this); + tmp = (ArrayUInt16*)upcalls->ArrayOfChar->doNew(size); for (uint32 i = 0; i < size; i++) { ArrayUInt16::setElement(tmp, asciiz[i], i); @@ -1395,7 +1394,7 @@ JavaMethod* meth = upcalls->FinalizeObject; UserClass* cl = JavaObject::getClass(obj)->asClass(); - meth->invokeIntVirtualBuf(this, cl, obj, 0); + meth->invokeIntVirtualBuf(cl, obj, 0); } mvm::gc** Jnjvm::getReferent(mvm::gc* _obj) { @@ -1418,7 +1417,7 @@ llvm_gcroot(obj, 0); JavaMethod* meth = upcalls->EnqueueReference; UserClass* cl = JavaObject::getClass(obj)->asClass(); - return (bool)meth->invokeIntSpecialBuf(this, cl, obj, 0); + return (bool)meth->invokeIntSpecialBuf(cl, obj, 0); } size_t Jnjvm::getObjectSize(mvm::gc* object) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Wed Dec 8 07:00:22 2010 @@ -174,9 +174,9 @@ if (!cl) { UserClass* forCtp = loadClass; if (strName == NULL) { - strName = JavaString::internalToJava(name, isolate); + strName = JavaString::internalToJava(name, vm); } - obj = loadClassMethod->invokeJavaObjectVirtual(isolate, forCtp, javaLoader, + obj = loadClassMethod->invokeJavaObjectVirtual(forCtp, javaLoader, &strName); cl = JavaObjectClass::getClass(((JavaObjectClass*)obj)); } @@ -752,14 +752,6 @@ JavaString** JnjvmClassLoader::UTF8ToStr(const UTF8* val) { JavaString* res = NULL; llvm_gcroot(res, 0); - res = isolate->internalUTF8ToStr(val); - return strings->addString(this, res); -} - -JavaString** JnjvmBootstrapLoader::UTF8ToStr(const UTF8* val) { - JavaString* res = NULL; - llvm_gcroot(res, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); res = vm->internalUTF8ToStr(val); return strings->addString(this, res); } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h Wed Dec 8 07:00:22 2010 @@ -353,8 +353,6 @@ /// JnjvmBootstrapLoader(mvm::BumpPtrAllocator& Alloc, Jnjvm* vm, JavaCompiler* Comp); - virtual JavaString** UTF8ToStr(const UTF8* utf8); - /// nativeHandle - Non-null handle if boot classes were static compiled in /// a dynamic library /// Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp?rev=121249&r1=121248&r2=121249&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp Wed Dec 8 07:00:22 2010 @@ -222,7 +222,7 @@ llvm_gcroot(obj, 0); TRY { llvm_gcroot(obj, 0); - VirtualMachine* vm = obj->getVirtualTable()->vm; //JavaThread::get()->getJVM(); + VirtualMachine* vm = obj->getVirtualTable()->vm; mvm::Thread::get()->attach(vm); vm->finalizeObject(obj); } IGNORE; From gael.thomas at lip6.fr Wed Dec 8 05:21:15 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 13:21:15 -0000 Subject: [vmkit-commits] [vmkit] r121251 - in /vmkit/branches/multi-vm/lib/J3: Classpath/ClasspathVMThrowable.inc Classpath/JavaUpcalls.cpp VMCore/JavaConstantPool.cpp VMCore/JavaObject.cpp VMCore/JavaObject.h VMCore/JavaString.cpp VMCore/Jni.cpp VMCore/JnjvmClassLoader.cpp Message-ID: <20101208132115.3977C2A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 07:21:14 2010 New Revision: 121251 URL: http://llvm.org/viewvc/llvm-project?rev=121251&view=rev Log: verify some calls to getJVM Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h vmkit/branches/multi-vm/lib/J3/VMCore/JavaString.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc?rev=121251&r1=121250&r2=121251&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThrowable.inc Wed Dec 8 07:21:14 2010 @@ -38,9 +38,7 @@ mvm::Thread* mut = mvm::Thread::get(); uint32 length = mut->getFrameContextLength(); - JavaThread* th = JavaThread::j3Thread(mut); - Jnjvm* vm = th->getJVM(); - + Jnjvm* vm = JavaThread::j3Thread(mut)->getJVM(); if (sizeof(void*) == 4) { ClassArray* cl = vm->upcalls->ArrayOfInt; @@ -98,7 +96,7 @@ llvm_gcroot(sourceName, 0); llvm_gcroot(res, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); + Jnjvm* vm = meth->classDef->classLoader->vm; methodName = vm->internalUTF8ToStr(meth->name); Class* cl = meth->classDef; className = JavaString::internalToJava(cl->name, vm); Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp?rev=121251&r1=121250&r2=121251&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp Wed Dec 8 07:21:14 2010 @@ -202,7 +202,7 @@ BEGIN_NATIVE_EXCEPTION(0) - Jnjvm* vm = JavaThread::get()->getJVM(); + Jnjvm* vm = obj->getJVM(); array = JavaString::strToArray(obj, vm); res = vm->constructString(array); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp?rev=121251&r1=121250&r2=121251&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaConstantPool.cpp Wed Dec 8 07:21:14 2010 @@ -515,8 +515,7 @@ JavaString* JavaConstantPool::resolveString(const UTF8* utf8, uint16 index) { JavaString* str = NULL; llvm_gcroot(str, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); - str = vm->internalUTF8ToStr(utf8); + str = classDef->classLoader->vm->internalUTF8ToStr(utf8); return str; } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp?rev=121251&r1=121250&r2=121251&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp Wed Dec 8 07:21:14 2010 @@ -120,22 +120,22 @@ void JavaObject::overflowThinLock(JavaObject* self) { llvm_gcroot(self, 0); - mvm::ThinLock::overflowThinLock(self, JavaThread::get()->getJVM()->lockSystem); + mvm::ThinLock::overflowThinLock(self, self->getJVM()->lockSystem); } void JavaObject::acquire(JavaObject* self) { llvm_gcroot(self, 0); - mvm::ThinLock::acquire(self, JavaThread::get()->getJVM()->lockSystem); + mvm::ThinLock::acquire(self, self->getJVM()->lockSystem); } void JavaObject::release(JavaObject* self) { llvm_gcroot(self, 0); - mvm::ThinLock::release(self, JavaThread::get()->getJVM()->lockSystem); + mvm::ThinLock::release(self, self->getJVM()->lockSystem); } bool JavaObject::owner(JavaObject* self) { llvm_gcroot(self, 0); - return mvm::ThinLock::owner(self, JavaThread::get()->getJVM()->lockSystem); + return mvm::ThinLock::owner(self, self->getJVM()->lockSystem); } void JavaObject::decapsulePrimitive(JavaObject* obj, Jnjvm *vm, jvalue* buf, Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h?rev=121251&r1=121250&r2=121251&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h Wed Dec 8 07:21:14 2010 @@ -237,6 +237,8 @@ public: + Jnjvm* getJVM() { return (Jnjvm*)getVirtualTable()->vm; } + /// getClass - Returns the class of this object. /// static UserCommonClass* getClass(const JavaObject* self) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaString.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaString.cpp?rev=121251&r1=121250&r2=121251&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaString.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaString.cpp Wed Dec 8 07:21:14 2010 @@ -97,7 +97,7 @@ llvm_gcroot(value, 0); value = JavaString::getValue(str); - Jnjvm* vm = JavaThread::get()->getJVM(); + Jnjvm* vm = str->getJVM(); assert(vm && "No vm when destroying a string"); if (value != NULL) vm->hashStr.removeUnlocked(value, str); } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp?rev=121251&r1=121250&r2=121251&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jni.cpp Wed Dec 8 07:21:14 2010 @@ -58,10 +58,9 @@ JnjvmClassLoader* loader = 0; JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); UserClass* currentClass = th->getCallingClassLevel(0); if (currentClass) loader = currentClass->classLoader; - else loader = vm->appClassLoader; + else loader = myVM(env)->appClassLoader; UserCommonClass* cl = loader->loadClassFromAsciiz(asciiz, true, true); if (cl && cl->asClass()) { @@ -150,12 +149,12 @@ llvm_gcroot(res, 0); llvm_gcroot(str, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); - verifyNull(Cl); UserCommonClass* cl = UserCommonClass::resolvedImplClass(Cl, true); if (!cl->isClass()) RETURN_FROM_JNI(0); + Jnjvm* vm = cl->classLoader->vm; + UserClass* realCl = cl->asClass(); res = realCl->doNew(); JavaMethod* init = realCl->lookupMethod(vm->upcalls->initName, @@ -2505,9 +2504,8 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - if (length < 0) vm->negativeArraySizeException(length); + if (length < 0) th->getJVM()->negativeArraySizeException(length); UserCommonClass* base = UserCommonClass::resolvedImplClass(elementClass, true); @@ -2542,10 +2540,9 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); if (index >= ArrayObject::getSize(array)) { - vm->indexOutOfBounds(array, index); + th->getJVM()->indexOutOfBounds(array, index); } // Store local refererence. @@ -2572,7 +2569,7 @@ llvm_gcroot(val, 0); if (index >= ArrayObject::getSize(array)) { - JavaThread::get()->getJVM()->indexOutOfBounds(array, index); + myVM(env)->indexOutOfBounds(array, index); } // Store global reference. @@ -2594,8 +2591,7 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfBool->doNew(len); + res = th->getJVM()->upcalls->ArrayOfBool->doNew(len); jbooleanArray ret = (jbooleanArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2613,8 +2609,7 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfByte->doNew(len); + res = th->getJVM()->upcalls->ArrayOfByte->doNew(len); jbyteArray ret = (jbyteArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2631,8 +2626,7 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfChar->doNew(len); + res = th->getJVM()->upcalls->ArrayOfChar->doNew(len); jcharArray ret = (jcharArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2649,8 +2643,7 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfShort->doNew(len); + res = th->getJVM()->upcalls->ArrayOfShort->doNew(len); jshortArray ret = (jshortArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2667,8 +2660,7 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfInt->doNew(len); + res = th->getJVM()->upcalls->ArrayOfInt->doNew(len); jintArray ret = (jintArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2685,8 +2677,7 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfLong->doNew(len); + res = th->getJVM()->upcalls->ArrayOfLong->doNew(len); jlongArray ret = (jlongArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2703,8 +2694,7 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfFloat->doNew(len); + res = th->getJVM()->upcalls->ArrayOfFloat->doNew(len); jfloatArray ret = (jfloatArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -2721,8 +2711,7 @@ llvm_gcroot(res, 0); JavaThread* th = JavaThread::get(); - Jnjvm* vm = th->getJVM(); - res = vm->upcalls->ArrayOfDouble->doNew(len); + res = th->getJVM()->upcalls->ArrayOfDouble->doNew(len); jdoubleArray ret = (jdoubleArray)th->pushJNIRef(res); RETURN_FROM_JNI(ret); @@ -3369,7 +3358,7 @@ if (Obj != NULL) { if (!JavaObject::owner(Obj)) { - JavaThread::get()->getJVM()->illegalMonitorStateException(Obj); + myVM(env)->illegalMonitorStateException(Obj); } JavaObject::release(Obj); @@ -3385,8 +3374,7 @@ jint GetJavaVM(JNIEnv *env, JavaVM **vm) { BEGIN_JNI_EXCEPTION - Jnjvm* myvm = JavaThread::get()->getJVM(); - (*vm) = (JavaVM*)(void*)(&(myvm->javavmEnv)); + (*vm) = (JavaVM*)(void*)(&(myVM(env)->javavmEnv)); RETURN_FROM_JNI(0); END_JNI_EXCEPTION RETURN_FROM_JNI(0); @@ -3491,8 +3479,7 @@ Obj = *(JavaObject**)obj; llvm_gcroot(Obj, 0); - Jnjvm* vm = JavaThread::get()->getJVM(); - + Jnjvm* vm = myVM(env); vm->globalRefsLock.lock(); JavaObject** res = vm->globalRefs.addJNIReference(Obj); @@ -3547,22 +3534,22 @@ llvm_gcroot(p, 0); JavaThread* th = JavaThread::get(); - Jnjvm* myvm = th->getJVM(); - UserClass* BB = myvm->upcalls->newDirectByteBuffer; + Jnjvm* vm = th->getJVM(); + UserClass* BB = vm->upcalls->newDirectByteBuffer; res = BB->doNew(); #if (__WORDSIZE == 32) - UserClass* PP = myvm->upcalls->newPointer32; + UserClass* PP = vm->upcalls->newPointer32; p = PP->doNew(); - myvm->upcalls->dataPointer32->setInstanceInt32Field(p, (uint32)address); + vm->upcalls->dataPointer32->setInstanceInt32Field(p, (uint32)address); #else - UserClass* PP = myvm->upcalls->newPointer64; + UserClass* PP = vm->upcalls->newPointer64; p = PP->doNew(); - myvm->upcalls->dataPointer64->setInstanceLongField(p, (jlong)address); + vm->upcalls->dataPointer64->setInstanceLongField(p, (jlong)address); #endif - myvm->upcalls->InitDirectByteBuffer->invokeIntSpecial(BB, res, 0, &p, + vm->upcalls->InitDirectByteBuffer->invokeIntSpecial(BB, res, 0, &p, (uint32)capacity, (uint32)capacity, 0); @@ -3642,13 +3629,13 @@ BEGIN_JNI_EXCEPTION - JavaThread* _th = JavaThread::get(); - JavaObject* obj = _th->currentThread(); + JavaThread* th = JavaThread::get(); + JavaObject* obj = th->currentThread(); llvm_gcroot(obj, 0); - Jnjvm* myvm = _th->getJVM(); + Jnjvm* vm = th->getJVM(); if (obj != 0) { - (*env) = &(myvm->jniEnv); + (*env) = &(vm->jniEnv); RETURN_FROM_JNI(JNI_OK); } else { (*env) = 0; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=121251&r1=121250&r2=121251&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Wed Dec 8 07:21:14 2010 @@ -197,7 +197,6 @@ UserClass* cl = internalLoad(name, doResolve, strName); if (!cl && doThrow) { - Jnjvm* vm = JavaThread::get()->getJVM(); if (name->equals(vm->upcalls->NoClassDefFoundErrorName)) { fprintf(stderr, "Unable to load NoClassDefFoundError"); abort(); From gael.thomas at lip6.fr Wed Dec 8 05:26:21 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 13:26:21 -0000 Subject: [vmkit-commits] [vmkit] r121252 - in /vmkit/branches/multi-vm/lib/J3: Compiler/JavaAOTCompiler.cpp VMCore/JavaClass.cpp VMCore/JnjvmClassLoader.cpp VMCore/JnjvmClassLoader.h Message-ID: <20101208132621.6BCB02A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 07:26:21 2010 New Revision: 121252 URL: http://llvm.org/viewvc/llvm-project?rev=121252&view=rev Log: remove last calls to getIsolate Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121252&r1=121251&r2=121252&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Dec 8 07:26:21 2010 @@ -2182,7 +2182,7 @@ for (; I != E; ++I) { JavaObject* obj = (JavaObject*)(*I); - if (!VMClassLoader::isVMClassLoader(cl->classLoader->getIsolate(), obj) && JavaObject::instanceOf(obj, cl)) { + if (!VMClassLoader::isVMClassLoader(cl->classLoader->vm, obj) && JavaObject::instanceOf(obj, cl)) { if (currentClass != NULL) { if (JavaObject::getClass(obj) != currentClass) { return 0; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp?rev=121252&r1=121251&r2=121252&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaClass.cpp Wed Dec 8 07:26:21 2010 @@ -1348,7 +1348,7 @@ } JavaVirtualTable::JavaVirtualTable(Class* C) { - vm = C->classLoader->getIsolate(); + vm = C->classLoader->vm; if (C->super) { @@ -1445,7 +1445,7 @@ } JavaVirtualTable::JavaVirtualTable(ClassArray* C) { - vm = C->classLoader->getIsolate(); + vm = C->classLoader->vm; if (C->baseClass()->isClass()) C->baseClass()->asClass()->resolveClass(); @@ -1664,7 +1664,7 @@ JavaVirtualTable::JavaVirtualTable(ClassPrimitive* C) { // Only used for subtype checking - vm = C->classLoader->getIsolate(); + vm = C->classLoader->vm; cl = C; depth = 0; display[0] = this; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=121252&r1=121251&r2=121252&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Wed Dec 8 07:26:21 2010 @@ -982,7 +982,7 @@ extern "C" void vmjcAddPreCompiledClass(JnjvmClassLoader* JCL, CommonClass* cl) { cl->classLoader = JCL; - cl->virtualVT->vm = JCL->getIsolate(); + cl->virtualVT->vm = JCL->vm; JCL->hashUTF8->insert(cl->name); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h?rev=121252&r1=121251&r2=121252&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h Wed Dec 8 07:26:21 2010 @@ -122,10 +122,6 @@ /// mvm::BumpPtrAllocator& allocator; - /// getIsolate - Returns the isolate that created this class loader. - /// - Jnjvm* getIsolate() const { return isolate; } - /// getClasses - Returns the classes this class loader has loaded. /// ClassMap* getClasses() const { return classes; } From gael.thomas at lip6.fr Wed Dec 8 05:35:39 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 13:35:39 -0000 Subject: [vmkit-commits] [vmkit] r121253 - in /vmkit/branches/multi-vm/lib/J3: Classpath/ClasspathConstructor.inc Classpath/ClasspathField.inc Classpath/ClasspathMethod.inc VMCore/JavaObject.cpp VMCore/JavaObject.h VMCore/Jnjvm.cpp VMCore/JnjvmClassLoader.cpp VMCore/JnjvmClassLoader.h Message-ID: <20101208133539.C44ED2A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 07:35:39 2010 New Revision: 121253 URL: http://llvm.org/viewvc/llvm-project?rev=121253&view=rev Log: remove the field isolate from JnjvmClassLoader Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathField.inc vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc?rev=121253&r1=121252&r2=121253&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathConstructor.inc Wed Dec 8 07:35:39 2010 @@ -113,7 +113,7 @@ Typedef* const* arguments = sign->getArgumentsType(); // Store the arguments, unboxing primitives if necessary. for (sint32 i = 0; i < size; ++i) { - JavaObject::decapsulePrimitive(ptr[i], vm, &buf[i], arguments[i]); + JavaObject::decapsulePrimitive(ptr[i], &buf[i], arguments[i]); if (!arguments[i]->isPrimitive()) { buf[i].l = reinterpret_cast(&ptr[i]); } Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathField.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathField.inc?rev=121253&r1=121252&r2=121253&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathField.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathField.inc Wed Dec 8 07:35:39 2010 @@ -634,7 +634,6 @@ BEGIN_NATIVE_EXCEPTION(0) UserClass* cl = JavaObjectField::getClass(Field); - Jnjvm* vm = cl->classLoader->vm; JavaField* field = JavaObjectField::getInternalField(Field); jvalue buf; bool stat = isStatic(field->access); @@ -647,7 +646,7 @@ } const Typedef* type = field->getSignature(); - JavaObject::decapsulePrimitive(val, vm, &buf, type); + JavaObject::decapsulePrimitive(val, &buf, type); if (type->isPrimitive()) { Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc?rev=121253&r1=121252&r2=121253&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathMethod.inc Wed Dec 8 07:35:39 2010 @@ -146,7 +146,7 @@ JavaObject** ptr = ArrayObject::getElements(args); Typedef* const* arguments = sign->getArgumentsType(); for (sint32 i = 0; i < size; ++i) { - JavaObject::decapsulePrimitive(ptr[i], vm, &buf[i], arguments[i]); + JavaObject::decapsulePrimitive(ptr[i], &buf[i], arguments[i]); if (!arguments[i]->isPrimitive()) { buf[i].l = reinterpret_cast(&ptr[i]); } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp?rev=121253&r1=121252&r2=121253&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.cpp Wed Dec 8 07:35:39 2010 @@ -138,11 +138,13 @@ return mvm::ThinLock::owner(self, self->getJVM()->lockSystem); } -void JavaObject::decapsulePrimitive(JavaObject* obj, Jnjvm *vm, jvalue* buf, +void JavaObject::decapsulePrimitive(JavaObject* obj, jvalue* buf, const Typedef* signature) { llvm_gcroot(obj, 0); + Jnjvm* vm = obj->getJVM(); + if (!signature->isPrimitive()) { if (obj && !(getClass(obj)->isOfTypeName(signature->getName()))) { vm->illegalArgumentException("wrong type argument"); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h?rev=121253&r1=121252&r2=121253&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaObject.h Wed Dec 8 07:35:39 2010 @@ -293,7 +293,7 @@ /// decapsulePrimitive - Based on the signature argument, decapsule /// obj as a primitive and put it in the buffer. /// - static void decapsulePrimitive(JavaObject* self, Jnjvm* vm, jvalue* buf, + static void decapsulePrimitive(JavaObject* self, jvalue* buf, const Typedef* signature); static uint16_t hashCodeGenerator; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121253&r1=121252&r2=121253&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 8 07:35:39 2010 @@ -1343,7 +1343,6 @@ lockSystem(Alloc) { bootstrapLoader = new(Alloc, "bootstrap loader") JnjvmBootstrapLoader(Alloc, this, Comp); - bootstrapLoader->isolate = this; upcalls = new(allocator, "Classpath") Classpath(bootstrapLoader, dlLoad); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=121253&r1=121252&r2=121253&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Wed Dec 8 07:35:39 2010 @@ -73,7 +73,6 @@ JnjvmClassLoader::JnjvmClassLoader(mvm::BumpPtrAllocator& Alloc, JavaObject* loader, VMClassLoader* vmdata, - Jnjvm* I, Jnjvm* v) : allocator(Alloc) { llvm_gcroot(loader, 0); llvm_gcroot(vmdata, 0); @@ -90,7 +89,6 @@ vmdata->JCL = this; javaLoader = loader; - isolate = I; JavaMethod* meth = vm->upcalls->loadInClassLoader; loadClassMethod = @@ -684,7 +682,7 @@ if (!vmdata) { vmdata = VMClassLoader::allocate(vm); mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator(); - JCL = new(*A, "Class loader") JnjvmClassLoader(*A, jloader, vmdata, vm, vm); + JCL = new(*A, "Class loader") JnjvmClassLoader(*A, jloader, vmdata, vm); upcalls->vmdataClassLoader->setInstanceObjectField(jloader, (JavaObject*)vmdata); } JavaObject::release(jloader); @@ -707,11 +705,7 @@ JnjvmClassLoader::~JnjvmClassLoader() { - if (isolate) { - isolate->vmkit->removeMethodInfos(TheCompiler); - } else { - mvm::Thread::get()->vmkit->removeMethodInfos(TheCompiler); - } + mvm::Thread::get()->vmkit->removeMethodInfos(TheCompiler); if (classes) { classes->~ClassMap(); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h?rev=121253&r1=121252&r2=121253&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.h Wed Dec 8 07:35:39 2010 @@ -52,12 +52,6 @@ /// table for non-isolate environments. /// class JnjvmClassLoader : public mvm::PermanentObject { -private: - - /// isolate - Which isolate defined me? Null for the bootstrap class loader. - /// - Jnjvm* isolate; - public: /// vm - my vm /// @@ -82,7 +76,7 @@ /// JnjvmClassLoader - Allocate a user-defined class loader. Called on /// first use of a Java class loader. /// - JnjvmClassLoader(mvm::BumpPtrAllocator& Alloc, JavaObject* loader, VMClassLoader* vmdata, Jnjvm* isolate, Jnjvm* vm); + JnjvmClassLoader(mvm::BumpPtrAllocator& Alloc, JavaObject* loader, VMClassLoader* vmdata, Jnjvm* vm); /// lookupComponentName - Try to find the component name of the given array /// name. If the component name is not in the table of UTF8s and holder @@ -283,21 +277,21 @@ /// insertAllMethodsInVM - Insert all methods defined by this class loader /// in the VM. /// - void insertAllMethodsInVM(Jnjvm* vm); + void insertAllMethodsInVM(); /// loadLibFromJar - Try to load the shared library compiled by vmjc with /// this jar file. /// - void loadLibFromJar(Jnjvm* vm, const char* name, const char* file); + void loadLibFromJar(const char* name, const char* file); /// loadLibFromFile - Try to load the shared library compiled by vmjc with /// this class file. /// - void loadLibFromFile(Jnjvm* vm, const char* name); + void loadLibFromFile(const char* name); /// loadClassFromSelf - Load the main class if we are an executable. /// - Class* loadClassFromSelf(Jnjvm* vm, const char* name); + Class* loadClassFromSelf(const char* name); friend class Class; }; From gael.thomas at lip6.fr Wed Dec 8 05:43:01 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 13:43:01 -0000 Subject: [vmkit-commits] [vmkit] r121254 - in /vmkit/branches/multi-vm/lib/J3/VMCore: Jnjvm.cpp JnjvmClassLoader.cpp Message-ID: <20101208134301.60E0E2A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 07:43:01 2010 New Revision: 121254 URL: http://llvm.org/viewvc/llvm-project?rev=121254&view=rev Log: remove the useless vm arg from some function Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121254&r1=121253&r2=121254&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 8 07:43:01 2010 @@ -1050,10 +1050,10 @@ appClassLoader = JnjvmClassLoader::getJnjvmLoaderFromJavaObject(loader, this); if (argumentsInfo.jarFile) { - appClassLoader->loadLibFromJar(this, argumentsInfo.jarFile, + appClassLoader->loadLibFromJar(argumentsInfo.jarFile, argumentsInfo.className); } else if (argumentsInfo.className) { - appClassLoader->loadLibFromFile(this, argumentsInfo.className); + appClassLoader->loadLibFromFile(argumentsInfo.className); } } return appClassLoader; @@ -1186,7 +1186,7 @@ TRY { // First try to see if we are a self-contained executable. - UserClass* cl = appClassLoader->loadClassFromSelf(this, className); + UserClass* cl = appClassLoader->loadClassFromSelf(className); // If not, load the class. if (cl == NULL) { @@ -1366,7 +1366,7 @@ end = end->prev; } - bootstrapLoader->insertAllMethodsInVM(this); + bootstrapLoader->insertAllMethodsInVM(); } Jnjvm::~Jnjvm() { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=121254&r1=121253&r2=121254&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JnjvmClassLoader.cpp Wed Dec 8 07:43:01 2010 @@ -895,7 +895,7 @@ fprintf(stderr, "\n"); } -void JnjvmClassLoader::insertAllMethodsInVM(Jnjvm* vm) { +void JnjvmClassLoader::insertAllMethodsInVM() { for (ClassMap::iterator i = classes->map.begin(), e = classes->map.end(); i != e; ++i) { CommonClass* cl = i->second; @@ -923,7 +923,7 @@ } } -void JnjvmClassLoader::loadLibFromJar(Jnjvm* vm, const char* name, +void JnjvmClassLoader::loadLibFromJar(const char* name, const char* file) { mvm::ThreadAllocator threadAllocator; @@ -938,12 +938,12 @@ static_init_t init = (static_init_t)(uintptr_t)cl->classLoader; assert(init && "Loaded the wrong library"); init(this); - insertAllMethodsInVM(vm); + insertAllMethodsInVM(); } } } -void JnjvmClassLoader::loadLibFromFile(Jnjvm* vm, const char* name) { +void JnjvmClassLoader::loadLibFromFile(const char* name) { mvm::ThreadAllocator threadAllocator; assert(classes->map.size() == 0); char* soName = (char*)threadAllocator.Allocate( @@ -955,18 +955,18 @@ if (cl) { static_init_t init = (static_init_t)(uintptr_t)cl->classLoader; init(this); - insertAllMethodsInVM(vm); + insertAllMethodsInVM(); } } } -Class* JnjvmClassLoader::loadClassFromSelf(Jnjvm* vm, const char* name) { +Class* JnjvmClassLoader::loadClassFromSelf(const char* name) { assert(classes->map.size() == 0); Class* cl = (Class*)dlsym(SELF_HANDLE, name); if (cl) { static_init_t init = (static_init_t)(uintptr_t)cl->classLoader; init(this); - insertAllMethodsInVM(vm); + insertAllMethodsInVM(); } return cl; } From gael.thomas at lip6.fr Wed Dec 8 05:48:43 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 13:48:43 -0000 Subject: [vmkit-commits] [vmkit] r121255 - in /vmkit/branches/multi-vm: lib/Mvm/CommonThread/ObjectLocks.cpp mmtk/mmtk-j3/ObjectModel.cpp Message-ID: <20101208134843.B25CF2A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 07:48:43 2010 New Revision: 121255 URL: http://llvm.org/viewvc/llvm-project?rev=121255&view=rev Log: ObjectLocks and ObjectModel are using the virtual table to find the vm instead of using the thread Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ObjectLocks.cpp vmkit/branches/multi-vm/mmtk/mmtk-j3/ObjectModel.cpp Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ObjectLocks.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ObjectLocks.cpp?rev=121255&r1=121254&r2=121255&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ObjectLocks.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ObjectLocks.cpp Wed Dec 8 07:48:43 2010 @@ -348,7 +348,7 @@ FatLock** tab = LockTable[index >> BitIndex]; - VirtualMachine* vm = mvm::Thread::get()->MyVM; + VirtualMachine* vm = obj->getVirtualTable()->vm; if (tab == NULL) { tab = (FatLock**)vm->allocator.Allocate( IndexSize * sizeof(FatLock*), "Index LockTable"); Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/ObjectModel.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/ObjectModel.cpp?rev=121255&r1=121254&r2=121255&view=diff ============================================================================== --- vmkit/branches/multi-vm/mmtk/mmtk-j3/ObjectModel.cpp (original) +++ vmkit/branches/multi-vm/mmtk/mmtk-j3/ObjectModel.cpp Wed Dec 8 07:48:43 2010 @@ -85,7 +85,7 @@ extern "C" uintptr_t Java_org_j3_mmtk_ObjectModel_copy__Lorg_vmmagic_unboxed_ObjectReference_2I ( MMTkObject* OM, mvm::gc* src, int allocator) { - size_t size = mvm::Thread::get()->MyVM->getObjectSize(src); + size_t size = src->getVirtualTable()->vm->getObjectSize(src); size = llvm::RoundUpToAlignment(size, sizeof(void*)); uintptr_t res = JnJVM_org_j3_bindings_Bindings_copy__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2II( src, src->getVirtualTable(), size, allocator); @@ -137,7 +137,7 @@ extern "C" FakeByteArray* Java_org_j3_mmtk_ObjectModel_getTypeDescriptor__Lorg_vmmagic_unboxed_ObjectReference_2 ( MMTkObject* OM, mvm::gc* src) { - const char* name = mvm::Thread::get()->MyVM->getObjectTypeName(src); + const char* name = src->getVirtualTable()->vm->getObjectTypeName(src); // This code is only used for debugging on a fatal error. It is fine to // allocate in the C++ heap. return new (strlen(name)) FakeByteArray(name); From gael.thomas at lip6.fr Wed Dec 8 05:55:11 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 13:55:11 -0000 Subject: [vmkit-commits] [vmkit] r121256 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Compiler/mvm-runtime.ll Message-ID: <20101208135511.EC1372A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 07:55:11 2010 New Revision: 121256 URL: http://llvm.org/viewvc/llvm-project?rev=121256&view=rev Log: remove the field MyVM from mvm::Thread (yipa!) Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=121256&r1=121255&r2=121256&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Wed Dec 8 07:55:11 2010 @@ -177,36 +177,33 @@ /// vmkit - a (shortcut) pointer to vmkit that contains information on all the vms mvm::VMKit* vmkit; // 5 - /// MyVM - The VM attached to this Thread. - VirtualMachine* MyVM; // 6 - /// baseSP - The base stack pointer. - void* baseSP; // 7 + void* baseSP; // 6 /// inRV - Flag to tell that the thread is being part of a rendezvous. - bool inRV; // 8 + bool inRV; // 7 /// joinedRV - Flag to tell that the thread has joined a rendezvous. - bool joinedRV; // 9 + bool joinedRV; // 8 private: /// lastSP - If the thread is running native code that can not be /// interrupted, lastSP is not null and contains the value of the /// stack pointer before entering native. - void* lastSP; // 10 + void* lastSP; // 9 /// internalThreadID - The implementation specific thread id. - void* internalThreadID; // 11 + void* internalThreadID; // 10 public: /// routine - The function to invoke when the thread starts. - void (*routine)(mvm::Thread*); // 12 + void (*routine)(mvm::Thread*); // 11 /// lastKnownFrame - The last frame that we know of, before resuming to JNI. - KnownFrame* lastKnownFrame; // 13 + KnownFrame* lastKnownFrame; // 12 /// allVmsData - the array of thread specific data. - VMThreadData** allVmsData; // 14 + VMThreadData** allVmsData; // 13 protected: Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=121256&r1=121255&r2=121256&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Wed Dec 8 07:55:11 2010 @@ -45,7 +45,6 @@ } void Thread::attach(VirtualMachine* vm) { - MyVM = vm; vmData = allVmsData[vm->vmID]; if(!vmData) { Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll?rev=121256&r1=121255&r2=121256&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll Wed Dec 8 07:55:11 2010 @@ -13,16 +13,15 @@ ;;; field 3: void* vmData ;;; field 4: gc* pendingException ;;; field 5: VMkit* vmkit -;;; Field 6: void* MyVM -;;; Field 7: void* baseSP -;;; Field 8: bool inRV -;;; Field 9: bool joinedRV -;;; Field 10: void* lastSP -;;; Field 11: void* internalThreadID -;;; field 12: void* routine -;;; field 13: void* lastKnownFrame -;;; field 14: void* allVMDatas -%Thread = type { %CircularBase, i1, i8*, i8*, i8*, i8*, i8*, i8*, i1, i1, i8*, i8*, i8*, i8*, i8* } +;;; Field 6: void* baseSP +;;; Field 7: bool inRV +;;; Field 8: bool joinedRV +;;; Field 9: void* lastSP +;;; Field 10: void* internalThreadID +;;; field 11: void* routine +;;; field 12: void* lastKnownFrame +;;; field 13: void* allVMDatas +%Thread = type { %CircularBase, i1, i8*, i8*, i8*, i8*, i8*, i1, i1, i8*, i8*, i8*, i8*, i8* } ;;; field 0: VT ;;; field 1: mvm::MutatorThread* mut From gael.thomas at lip6.fr Wed Dec 8 05:58:09 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 13:58:09 -0000 Subject: [vmkit-commits] [vmkit] r121257 - /vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Message-ID: <20101208135809.398CE2A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 07:58:09 2010 New Revision: 121257 URL: http://llvm.org/viewvc/llvm-project?rev=121257&view=rev Log: just force the redefinition of vm-specific functions of a virtual machine Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121257&r1=121256&r2=121257&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Wed Dec 8 07:58:09 2010 @@ -69,15 +69,15 @@ /// getReferentPtr - return the referent of a reference /// - virtual mvm::gc** getReferent(mvm::gc* ref) { abort(); } + virtual mvm::gc** getReferent(mvm::gc* ref) = 0; /// setReferentPtr - set the referent of a reference /// - virtual void setReferent(mvm::gc* ref, mvm::gc* val) { abort(); } + virtual void setReferent(mvm::gc* ref, mvm::gc* val) = 0; /// enqueueReference - enqueue the reference /// - virtual bool enqueueReference(mvm::gc* _obj) { abort(); } + virtual bool enqueueReference(mvm::gc* _obj) = 0; /// tracer - Trace this virtual machine's GC-objects. /// Called once by vm. If you have GC-objects in a thread specific data, redefine the tracer of your VMThreadData. @@ -86,7 +86,7 @@ /// getObjectSize - Get the size of this object. Used by copying collectors. /// - virtual size_t getObjectSize(gc* object) { abort(); } + virtual size_t getObjectSize(gc* object) = 0; /// getObjectTypeName - Get the type of this object. Used by the GC for /// debugging purposes. @@ -99,10 +99,10 @@ /// 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) { abort(); } + virtual void runApplication(int argc, char** argv) = 0; /// waitForExit - Wait until the virtual machine stops its execution. - virtual void waitForExit() { abort(); } + virtual void waitForExit() = 0; }; } // end namespace mvm From gael.thomas at lip6.fr Wed Dec 8 06:24:31 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 14:24:31 -0000 Subject: [vmkit-commits] [vmkit] r121258 - in /vmkit/branches/multi-vm: Makefile.config.in Makefile.rules autoconf/configure.ac configure tools/Makefile Message-ID: <20101208142431.6AA272A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 08:24:31 2010 New Revision: 121258 URL: http://llvm.org/viewvc/llvm-project?rev=121258&view=rev Log: add a new option to build the toy vm. Modify the Makefile.rule to avoid the systematic rebuiding of FinalMMTk.bc Modified: vmkit/branches/multi-vm/Makefile.config.in vmkit/branches/multi-vm/Makefile.rules vmkit/branches/multi-vm/autoconf/configure.ac vmkit/branches/multi-vm/configure vmkit/branches/multi-vm/tools/Makefile Modified: vmkit/branches/multi-vm/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/Makefile.config.in?rev=121258&r1=121257&r2=121258&view=diff ============================================================================== --- vmkit/branches/multi-vm/Makefile.config.in (original) +++ vmkit/branches/multi-vm/Makefile.config.in Wed Dec 8 08:24:31 2010 @@ -13,5 +13,6 @@ MMTK_PLAN_HEADER = @MMTK_PLAN_HEADER@ WITH_64 = @WITH_64@ WITH_LLVM_GCC = @WITH_LLVM_GCC@ +WITH_TOY = @WITH_TOY@ ANT = @ANT@ Modified: vmkit/branches/multi-vm/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/Makefile.rules?rev=121258&r1=121257&r2=121258&view=diff ============================================================================== --- vmkit/branches/multi-vm/Makefile.rules (original) +++ vmkit/branches/multi-vm/Makefile.rules Wed Dec 8 08:24:31 2010 @@ -131,15 +131,21 @@ ifneq ($(DISABLE_MMTK_COMPILE), 1) ADDITIONAL_ARGS := -load-bc=$(LibDir)/MMTKRuntime.bc - all:: - $(Verb) $(ANT) -buildfile $(PROJ_OBJ_ROOT)/mmtk/java/build.xml - $(Echo) Building $(BuildMode) $(JARNAME).jar $(notdir $@) +all:: $(LibDir)/FinalMMTk.bc + +$(LibDir)/FinalMMTk.bc: $(JARNAME).jar $(VMJC) + $(Echo) Building $(BuildMode) FinalMMTk $(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 $(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 $(Verb) $(LLC) -march=cpp -cppgen=function -cppfor=gcmalloc $(LibDir)/FinalMMTk.bc -o $(PROJ_SRC_ROOT)/mmtk/inline/MMTkInline.inc + +$(JARNAME).jar: $(shell find $(PROJ_SRC_ROOT)/mmtk/java/src -type f -name "*.java") + $(Echo) Building $(BuildMode) $(JARNAME).jar $(notdir $@) + $(Verb) $(ANT) -buildfile $(PROJ_OBJ_ROOT)/mmtk/java/build.xml + endif endif Modified: vmkit/branches/multi-vm/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/autoconf/configure.ac?rev=121258&r1=121257&r2=121258&view=diff ============================================================================== --- vmkit/branches/multi-vm/autoconf/configure.ac (original) +++ vmkit/branches/multi-vm/autoconf/configure.ac Wed Dec 8 08:24:31 2010 @@ -422,6 +422,18 @@ AC_SUBST([WITH_N3]) +dnl ************************************************************************** +dnl toy vm +dnl ************************************************************************** +AC_ARG_WITH(toy, + [AS_HELP_STRING(--with-toy=yes|no, + [Build the toy virtual machine (default is yes)])], + [[WITH_TOY=$withval]], + [[WITH_TOY=yes]] +) + +AC_SUBST([WITH_TOY]) + dnl===-----------------------------------------------------------------------=== dnl=== dnl=== SECTION 4: Check for programs we need and that they are the right version Modified: vmkit/branches/multi-vm/configure URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/configure?rev=121258&r1=121257&r2=121258&view=diff ============================================================================== --- vmkit/branches/multi-vm/configure (original) +++ vmkit/branches/multi-vm/configure Wed Dec 8 08:24:31 2010 @@ -667,6 +667,7 @@ ac_ct_CXX CXXFLAGS CXX +WITH_TOY WITH_N3 monopath WITH_N3_MONO @@ -774,6 +775,7 @@ with_pnet_local_prefix with_pnetlib with_mono +with_toy ' ac_precious_vars='build_alias host_alias @@ -1438,6 +1440,7 @@ Pnetlib's mscorlib.dll location (default is /usr/lib/cscc/lib/) --with-mono=something Mono's mscorlib.dll location (no default) + --with-toy=yes|no Build the toy virtual machine (default is yes) Some influential environment variables: CC C compiler command @@ -4314,6 +4317,18 @@ +# Check whether --with-toy was given. +if test "${with_toy+set}" = set; then + withval=$with_toy; WITH_TOY=$withval +else + WITH_TOY=yes + +fi + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' Modified: vmkit/branches/multi-vm/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/Makefile?rev=121258&r1=121257&r2=121258&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/Makefile (original) +++ vmkit/branches/multi-vm/tools/Makefile Wed Dec 8 08:24:31 2010 @@ -26,6 +26,9 @@ PARALLEL_DIRS += n3-pnetlib endif +ifeq ($(WITH_J3), 1) + PARALLEL_DIRS += #toy-vm +endif include $(LEVEL)/Makefile.common From gael.thomas at lip6.fr Wed Dec 8 06:59:22 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 14:59:22 -0000 Subject: [vmkit-commits] [vmkit] r121259 - in /vmkit/branches/multi-vm/tools: Makefile toy-vm/ toy-vm/Main.cpp toy-vm/Makefile Message-ID: <20101208145922.BB09D2A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 08:59:22 2010 New Revision: 121259 URL: http://llvm.org/viewvc/llvm-project?rev=121259&view=rev Log: add a directory for a toy vm Added: vmkit/branches/multi-vm/tools/toy-vm/ (with props) vmkit/branches/multi-vm/tools/toy-vm/Main.cpp vmkit/branches/multi-vm/tools/toy-vm/Makefile Modified: vmkit/branches/multi-vm/tools/Makefile Modified: vmkit/branches/multi-vm/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/Makefile?rev=121259&r1=121258&r2=121259&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/Makefile (original) +++ vmkit/branches/multi-vm/tools/Makefile Wed Dec 8 08:59:22 2010 @@ -27,7 +27,7 @@ endif ifeq ($(WITH_J3), 1) - PARALLEL_DIRS += #toy-vm + PARALLEL_DIRS += toy-vm endif include $(LEVEL)/Makefile.common Propchange: vmkit/branches/multi-vm/tools/toy-vm/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Wed Dec 8 08:59:22 2010 @@ -0,0 +1,4 @@ +Release +vmkitoptimized.bc +toy-vm.s +toy-vm.bc Added: vmkit/branches/multi-vm/tools/toy-vm/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/toy-vm/Main.cpp?rev=121259&view=auto ============================================================================== --- vmkit/branches/multi-vm/tools/toy-vm/Main.cpp (added) +++ vmkit/branches/multi-vm/tools/toy-vm/Main.cpp Wed Dec 8 08:59:22 2010 @@ -0,0 +1,5 @@ + + +int main(int argc, char **argv) { + return 0; +} Added: vmkit/branches/multi-vm/tools/toy-vm/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/toy-vm/Makefile?rev=121259&view=auto ============================================================================== --- vmkit/branches/multi-vm/tools/toy-vm/Makefile (added) +++ vmkit/branches/multi-vm/tools/toy-vm/Makefile Wed Dec 8 08:59:22 2010 @@ -0,0 +1,39 @@ +##===- tools/toy-vm/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 + +TOOLNAME = toy-vm + +ifeq ($(WITH_LLVM_GCC), 1) + + MODULESNAME = toy-vm + USEDMODULES = J3.bc Classpath.bc J3Compiler.bc Allocator.bc CommonThread.bc Mvm.bc MvmCompiler.bc + + ifeq ($(GC_MMTK), 1) + USEDMODULES += FinalMMTk.bc InlineMMTk.bc + else + USEDMODULES += $(GCLIB).bc + endif + + BUILT_SOURCES = toy-vm.s + SOURCES = toy-vm.s $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp)) + +else + +USEDLIBS = J3.a Classpath.a J3.a J3Compiler.a Allocator.a \ + Mvm.a MvmCompiler.a $(GCLIB).a Allocator.a CommonThread.a + +endif + +LINK_COMPONENTS = jit nativecodegen scalaropts instrumentation ipa ipo bitreader asmparser linker + +include $(LEVEL)/Makefile.common + From gael.thomas at lip6.fr Wed Dec 8 07:11:59 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 15:11:59 -0000 Subject: [vmkit-commits] [vmkit] r121261 - /vmkit/branches/multi-vm/tools/toy-vm/Main.cpp Message-ID: <20101208151159.7B3A52A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 09:11:59 2010 New Revision: 121261 URL: http://llvm.org/viewvc/llvm-project?rev=121261&view=rev Log: create the class toy vm Modified: vmkit/branches/multi-vm/tools/toy-vm/Main.cpp Modified: vmkit/branches/multi-vm/tools/toy-vm/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/toy-vm/Main.cpp?rev=121261&r1=121260&r2=121261&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/toy-vm/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/toy-vm/Main.cpp Wed Dec 8 09:11:59 2010 @@ -1,5 +1,36 @@ +#include "mvm/VMKit.h" +#include "mvm/VirtualMachine.h" +#include "mvm/Threads/Thread.h" +#define NI() fprintf(stderr, "Not implemented\n"); abort() + +namespace toyvm { + + class ToyVM : public mvm::VirtualMachine { + public: + ToyVM(mvm::BumpPtrAllocator &alloc, mvm::VMKit* vmkit) : mvm::VirtualMachine(alloc, vmkit) {} + + virtual mvm::gc** getReferent(mvm::gc*) { NI(); } + virtual void setReferent(mvm::gc*, mvm::gc*) { NI(); } + virtual bool enqueueReference(mvm::gc*) { NI(); } + virtual size_t getObjectSize(mvm::gc*) { NI(); } + virtual void runApplication(int, char**) { NI(); } + virtual void waitForExit() { NI(); } + }; + + class ToyVMThread : public mvm::VMThreadData { + }; + +} + +using namespace toyvm; int main(int argc, char **argv) { + // Initialize base components. + mvm::BumpPtrAllocator Allocator; + mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); + + new(Allocator, "toy vm") ToyVM(Allocator, vmkit); + return 0; } From gael.thomas at lip6.fr Wed Dec 8 08:43:41 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 16:43:41 -0000 Subject: [vmkit-commits] [vmkit] r121264 - in /vmkit/branches/multi-vm: include/mvm/VirtualMachine.h lib/Mvm/Runtime/VirtualMachine.cpp Message-ID: <20101208164341.50F502A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 10:43:41 2010 New Revision: 121264 URL: http://llvm.org/viewvc/llvm-project?rev=121264&view=rev Log: Add functions to start the vm in a vmkit non deamon thread. Not used for the moment. Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121264&r1=121263&r2=121264&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Wed Dec 8 10:43:41 2010 @@ -50,7 +50,45 @@ //===----------------------------------------------------------------------===// /// buildVMThreadData - allocate a java thread for the underlying mutator. Called when the java thread is a foreign thread. /// - virtual VMThreadData* buildVMThreadData(Thread* mut) { return new VMThreadData(this, mut); } + virtual VMThreadData* buildVMThreadData(Thread* mut) = 0; //{ return new VMThreadData(this, mut); } + + /// nbNonDaemonThreads - Number of threads in the system that are not daemon + /// threads. + uint16 nbNonDaemonThreads; + + /// nonDaemonLock - Protection lock for the nonDaemonThreads variable. + mvm::LockNormal nonDaemonLock; + + /// nonDaemonVar - Condition variable to wake up the initial thread when it + /// waits for other non-daemon threads to end. The non-daemon thread that + /// decrements the nonDaemonThreads variable to zero wakes up the initial + /// thread. + mvm::Cond nonDaemonVar; + + /// enter - A thread calls this function when it enters the thread system. + virtual void enterNonDeamonMode(); + + /// leave - A thread calls this function when it leaves the thread system. + virtual void leaveNonDeamonMode(); + + virtual void runApplicationImpl(int argc, char** argv) {}; + + /// runInNonDeamonThread - start a non deamon thread a begin the code with start if != 0 and runApplicationImpl otherwise + /// the thread leaves the deamon mode when it finishs. + void runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char** argv); + + /// runInNonDeamonThread - start a non deamon thread a begin the code with runApplicationImpl, + void runInNonDeamonThread(int argc, char **argv) { runInNonDeamonThread(0, argc, argv); } + + /// waitNonDeamonThreads - wait until all the non deamon threads are terminated. + void waitForNonDeamonThreads(); + + /// 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; //===----------------------------------------------------------------------===// // (2) GC-related methods. @@ -96,13 +134,6 @@ //===----------------------------------------------------------------------===// // (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 Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp?rev=121264&r1=121263&r2=121264&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp Wed Dec 8 10:43:41 2010 @@ -11,3 +11,54 @@ VirtualMachine::~VirtualMachine() { vmkit->removeVM(vmID); } + +void VirtualMachine::leaveNonDeamonMode() { + nonDaemonLock.lock(); + --nbNonDaemonThreads; + if (nbNonDaemonThreads == 0) nonDaemonVar.signal(); + nonDaemonLock.unlock(); +} + +void VirtualMachine::enterNonDeamonMode() { + nonDaemonLock.lock(); + ++nbNonDaemonThreads; + nonDaemonLock.unlock(); +} + +void VirtualMachine::waitForNonDeamonThreads() { + nonDaemonLock.lock(); + + while (nbNonDaemonThreads) { + nonDaemonVar.wait(&nonDaemonLock); + } + + nonDaemonLock.unlock(); +} + +class LauncherThread : public Thread { +public: + void (*realStart)(VirtualMachine*, int, char**); + VirtualMachine *vm; + int argc; + char** argv; + + LauncherThread(VMKit* vmkit, void (*s)(VirtualMachine*, int, char**), VirtualMachine* v, int ac, char** av) : Thread(vmkit) { + realStart = s; + vm = v; + argc = ac; + argv = av; + } + + static void launch(LauncherThread* th) { + if(th->realStart) + th->realStart(th->vm, th->argc, th->argv); + else + th->vm->runApplicationImpl(th->argc, th->argv); + th->vm->leaveNonDeamonMode(); + } +}; + +void VirtualMachine::runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char **argv) { + enterNonDeamonMode(); + (new LauncherThread(vmkit, start, this, argc, argv))->start((void (*)(Thread*))LauncherThread::launch); +} From gael.thomas at lip6.fr Wed Dec 8 14:46:25 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 22:46:25 -0000 Subject: [vmkit-commits] [vmkit] r121303 - /vmkit/branches/multi-vm/Makefile.rules Message-ID: <20101208224625.3279A2A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 16:46:25 2010 New Revision: 121303 URL: http://llvm.org/viewvc/llvm-project?rev=121303&view=rev Log: Add dependencies for FinalMMTk Modified: vmkit/branches/multi-vm/Makefile.rules Modified: vmkit/branches/multi-vm/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/Makefile.rules?rev=121303&r1=121302&r2=121303&view=diff ============================================================================== --- vmkit/branches/multi-vm/Makefile.rules (original) +++ vmkit/branches/multi-vm/Makefile.rules Wed Dec 8 16:46:25 2010 @@ -133,7 +133,7 @@ all:: $(LibDir)/FinalMMTk.bc -$(LibDir)/FinalMMTk.bc: $(JARNAME).jar $(VMJC) +$(LibDir)/FinalMMTk.bc: $(JARNAME).jar $(VMJC) $(LibDir)/MMTKAlloc.bc $(LibDir)/MMTKMagic$(SHLIBEXT) $(LibDir)/MMTKRuntime.bc $(Echo) Building $(BuildMode) FinalMMTk $(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 $(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 From gael.thomas at lip6.fr Wed Dec 8 14:47:24 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Wed, 08 Dec 2010 22:47:24 -0000 Subject: [vmkit-commits] [vmkit] r121304 - in /vmkit/branches/multi-vm: lib/J3/Classpath/ClasspathVMThread.inc lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h tools/Makefile Message-ID: <20101208224724.52E602A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 16:47:23 2010 New Revision: 121304 URL: http://llvm.org/viewvc/llvm-project?rev=121304&view=rev Log: Remove the threadSystem class and insert it in Jnjvm. Don't try to compile toy-vm. Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/tools/Makefile Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc?rev=121304&r1=121303&r2=121304&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc Wed Dec 8 16:47:23 2010 @@ -61,7 +61,7 @@ bool isDaemon = vm->upcalls->daemon->getInstanceInt8Field(javaThread); if (!isDaemon) { - vm->threadSystem.enter(); + vm->enterNonDaemonMode(); } assert(vmThread->getVirtualTable()); @@ -71,7 +71,7 @@ // Remove the thread from the list. if (!isDaemon) { - vm->threadSystem.leave(); + vm->leaveNonDaemonMode(); } } Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121304&r1=121303&r2=121304&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Dec 8 16:47:23 2010 @@ -2084,13 +2084,7 @@ M->CreateStaticInitializer(); end: - - vm->threadSystem.nonDaemonLock.lock(); - --(vm->threadSystem.nonDaemonThreads); - if (vm->threadSystem.nonDaemonThreads == 0) - vm->threadSystem.nonDaemonVar.signal(); - vm->threadSystem.nonDaemonLock.unlock(); - + vm->leaveNonDaemonMode(); } void JavaAOTCompiler::compileFile(Jnjvm* vm, const char* n) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121304&r1=121303&r2=121304&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 8 16:47:23 2010 @@ -1247,15 +1247,13 @@ void Jnjvm::waitForExit() { - threadSystem.nonDaemonLock.lock(); + nonDaemonLock.lock(); - while (threadSystem.nonDaemonThreads) { - threadSystem.nonDaemonVar.wait(&threadSystem.nonDaemonLock); + while (nonDaemonThreads) { + nonDaemonVar.wait(&nonDaemonLock); } - threadSystem.nonDaemonLock.unlock(); - - return; + nonDaemonLock.unlock(); } void Jnjvm::mainJavaStart(mvm::Thread* thread) { @@ -1276,7 +1274,7 @@ vm->bootstrapLoader->analyseClasspathEnv(vm->bootstrapLoader->bootClasspathEnv); vm->argumentsInfo.readArgs(vm); if (vm->argumentsInfo.className == NULL) { - vm->threadSystem.leave(); + vm->leaveNonDaemonMode(); return; } @@ -1315,17 +1313,17 @@ vm->executeClass(info.className, args); } - vm->threadSystem.leave(); + vm->leaveNonDaemonMode(); } -void ThreadSystem::leave() { +void Jnjvm::leaveNonDaemonMode() { nonDaemonLock.lock(); --nonDaemonThreads; if (nonDaemonThreads == 0) nonDaemonVar.signal(); nonDaemonLock.unlock(); } -void ThreadSystem::enter() { +void Jnjvm::enterNonDaemonMode() { nonDaemonLock.lock(); ++nonDaemonThreads; nonDaemonLock.unlock(); @@ -1342,6 +1340,7 @@ VirtualMachine(Alloc, vmkit), lockSystem(Alloc) { + nonDaemonThreads = 1; bootstrapLoader = new(Alloc, "bootstrap loader") JnjvmBootstrapLoader(Alloc, this, Comp); upcalls = new(allocator, "Classpath") Classpath(bootstrapLoader, dlLoad); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121304&r1=121303&r2=121304&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Wed Dec 8 16:47:23 2010 @@ -47,52 +47,6 @@ class UserClassPrimitive; class UserCommonClass; -/// ThreadSystem - Thread management of a JVM. Each JVM has one thread -/// management system to count the number of non-daemon threads it owns. -/// The initial thread of the JVM is a non-daemon thread. When there are -/// no more non-daemon threads, the JVM stops executing. -/// -class ThreadSystem { -public: - /// nonDaemonThreads - Number of threads in the system that are not daemon - /// threads. - // - uint16 nonDaemonThreads; - - /// nonDaemonLock - Protection lock for the nonDaemonThreads variable. - /// - mvm::LockNormal nonDaemonLock; - - /// nonDaemonVar - Condition variable to wake up the initial thread when it - /// waits for other non-daemon threads to end. The non-daemon thread that - /// decrements the nonDaemonThreads variable to zero wakes up the initial - /// thread. - /// - mvm::Cond nonDaemonVar; - - /// ThreadSystem - Allocates a thread system management, initializing the - /// lock, the condition variable and setting the initial number of non - /// daemon threads to one, for the initial thread. - /// - ThreadSystem() { - nonDaemonThreads = 1; - } - - /// ~ThreadSystem - Destroys the thread system manager. Destroys the lock and - /// the condition variable. - /// - ~ThreadSystem() {} - - /// leave - A thread calls this function when it leaves the thread system. - /// - void leave(); - - /// enter - A thread calls this function when it enters the thread system. - /// - void enter(); - -}; - class ClArgumentsInfo { public: int argc; @@ -162,6 +116,31 @@ static void mainJavaStart(mvm::Thread* thread); public: + + /// nonDaemonThreads - Number of threads in the system that are not daemon + /// threads. + // + uint16 nonDaemonThreads; + + /// nonDaemonLock - Protection lock for the nonDaemonThreads variable. + /// + mvm::LockNormal nonDaemonLock; + + /// nonDaemonVar - Condition variable to wake up the initial thread when it + /// waits for other non-daemon threads to end. The non-daemon thread that + /// decrements the nonDaemonThreads variable to zero wakes up the initial + /// thread. + /// + mvm::Cond nonDaemonVar; + + /// leave - A thread calls this function when it leaves the thread system. + /// + void leaveNonDaemonMode(); + + /// enter - A thread calls this function when it enters the thread system. + /// + void enterNonDaemonMode(); + /// tracer - Traces instances of this class. /// @@ -188,11 +167,6 @@ /// upcalls - Upcalls to call Java methods and access Java fields. /// Classpath* upcalls; - - /// threadSystem - The thread system to manage non-daemon threads and - /// control the end of the JVM's execution. - /// - ThreadSystem threadSystem; /// lockSystem - The lock system to allocate and manage Java locks. /// Modified: vmkit/branches/multi-vm/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/Makefile?rev=121304&r1=121303&r2=121304&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/Makefile (original) +++ vmkit/branches/multi-vm/tools/Makefile Wed Dec 8 16:47:23 2010 @@ -27,7 +27,7 @@ endif ifeq ($(WITH_J3), 1) - PARALLEL_DIRS += toy-vm + PARALLEL_DIRS += #toy-vm endif include $(LEVEL)/Makefile.common From gael.thomas at lip6.fr Wed Dec 8 16:16:33 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 09 Dec 2010 00:16:33 -0000 Subject: [vmkit-commits] [vmkit] r121325 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/J3/Classpath/ClasspathVMThread.inc lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Compiler/mvm-runtime.ll lib/Mvm/Runtime/SystemThreads.cpp lib/Mvm/Runtime/VMKit.cpp lib/Mvm/Runtime/VirtualMachine.cpp Message-ID: <20101209001633.9F6942A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 18:16:33 2010 New Revision: 121325 URL: http://llvm.org/viewvc/llvm-project?rev=121325&view=rev Log: manage non daemon threads directly in vmkit Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Wed Dec 8 18:16:33 2010 @@ -152,6 +152,9 @@ virtual ~VMThreadData() {} // force the construction of a VT }; +#define THREAD_RUNNING 1 +#define THREAD_DAEMON 2 + /// Thread - This class is the base of custom virtual machines' Thread classes. /// It provides static functions to manage threads. An instance of this class /// contains all thread-specific informations. @@ -205,12 +208,24 @@ /// allVmsData - the array of thread specific data. VMThreadData** allVmsData; // 13 +private: + /// state - daemon, running + uint32 state; // 14 protected: Thread(VMKit* vmk); public: + /// setDaemon - the thread is a daemon + void setDaemon(); + + /// setDaemon - the thread is not a daemon + void setNonDaemon(); + + /// getDaemon - get the daemon flag of the thread + uint32 getState() { return state; } + /// yield - Yield the processor to another thread. /// static void yield(void); Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Wed Dec 8 18:16:33 2010 @@ -45,6 +45,41 @@ FunctionMap(); }; + +class NonDaemonThreadManager { + friend class Thread; +public: + NonDaemonThreadManager() { nonDaemonThreads = 0; } + +private: + /// nonDaemonThreads - Number of threads in the system that are not daemon + /// threads. + // + uint16 nonDaemonThreads; + + /// nonDaemonLock - Protection lock for the nonDaemonThreads variable. + /// + mvm::LockNormal nonDaemonLock; + + /// nonDaemonVar - Condition variable to wake up the initial thread when it + /// waits for other non-daemon threads to end. The non-daemon thread that + /// decrements the nonDaemonThreads variable to zero wakes up the initial + /// thread. + /// + mvm::Cond nonDaemonVar; + + /// leave - A thread calls this function when it leaves the thread system. + /// + void leaveNonDaemonMode(); + + /// enter - A thread calls this function when it enters the thread system. + /// + void enterNonDaemonMode(); + +public: + void waitNonDaemonThreads(); +}; + class VMKit : public mvm::PermanentObject { public: /// allocator - Bump pointer allocator to allocate permanent memory of VMKit @@ -91,6 +126,9 @@ /// size_t numberOfRunningThreads; + // nonDaemonThreadsManager - manager of the non daemon threads + NonDaemonThreadManager nonDaemonThreadsManager; + /// rendezvous - The rendezvous implementation for garbage collection. /// #ifdef WITH_LLVM_GCC Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Wed Dec 8 18:16:33 2010 @@ -52,43 +52,24 @@ /// virtual VMThreadData* buildVMThreadData(Thread* mut) = 0; //{ return new VMThreadData(this, mut); } - /// nbNonDaemonThreads - Number of threads in the system that are not daemon - /// threads. - uint16 nbNonDaemonThreads; - - /// nonDaemonLock - Protection lock for the nonDaemonThreads variable. - mvm::LockNormal nonDaemonLock; - - /// nonDaemonVar - Condition variable to wake up the initial thread when it - /// waits for other non-daemon threads to end. The non-daemon thread that - /// decrements the nonDaemonThreads variable to zero wakes up the initial - /// thread. - mvm::Cond nonDaemonVar; - - /// enter - A thread calls this function when it enters the thread system. - virtual void enterNonDeamonMode(); - - /// leave - A thread calls this function when it leaves the thread system. - virtual void leaveNonDeamonMode(); - virtual void runApplicationImpl(int argc, char** argv) {}; - /// runInNonDeamonThread - start a non deamon thread a begin the code with start if != 0 and runApplicationImpl otherwise - /// the thread leaves the deamon mode when it finishs. - void runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char** argv); - - /// runInNonDeamonThread - start a non deamon thread a begin the code with runApplicationImpl, - void runInNonDeamonThread(int argc, char **argv) { runInNonDeamonThread(0, argc, argv); } - - /// waitNonDeamonThreads - wait until all the non deamon threads are terminated. - void waitForNonDeamonThreads(); - - /// 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; +// /// runInNonDeamonThread - start a non deamon thread a begin the code with start if != 0 and runApplicationImpl otherwise +// /// the thread leaves the deamon mode when it finishs. +// void runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char** argv); + +// /// runInNonDeamonThread - start a non deamon thread a begin the code with runApplicationImpl, +// void runInNonDeamonThread(int argc, char **argv) { runInNonDeamonThread(0, argc, argv); } + +// /// waitNonDeamonThreads - wait until all the non deamon threads are terminated. +// void waitForNonDeamonThreads(); + +// /// 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; +// /// waitForExit - Wait until the virtual machine stops its execution. +// virtual void waitForExit() = 0; //===----------------------------------------------------------------------===// // (2) GC-related methods. Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc Wed Dec 8 18:16:33 2010 @@ -60,19 +60,13 @@ // wait until exit. bool isDaemon = vm->upcalls->daemon->getInstanceInt8Field(javaThread); - if (!isDaemon) { - vm->enterNonDaemonMode(); - } - + if (isDaemon) + mut->setDaemon(); + assert(vmThread->getVirtualTable()); assert(javaThread->getVirtualTable()); // Run the VMThread::run function vm->upcalls->runVMThread->invokeIntSpecial(vmthClass, vmThread); - - // Remove the thread from the list. - if (!isDaemon) { - vm->leaveNonDaemonMode(); - } } JNIEXPORT void JNICALL Java_java_lang_VMThread_start( Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Dec 8 18:16:33 2010 @@ -2084,7 +2084,7 @@ M->CreateStaticInitializer(); end: - vm->leaveNonDaemonMode(); + return; } void JavaAOTCompiler::compileFile(Jnjvm* vm, const char* n) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 8 18:16:33 2010 @@ -1246,14 +1246,7 @@ } void Jnjvm::waitForExit() { - - nonDaemonLock.lock(); - - while (nonDaemonThreads) { - nonDaemonVar.wait(&nonDaemonLock); - } - - nonDaemonLock.unlock(); + vmkit->nonDaemonThreadsManager.waitNonDaemonThreads(); } void Jnjvm::mainJavaStart(mvm::Thread* thread) { @@ -1273,10 +1266,8 @@ Jnjvm* vm = JavaThread::j3Thread(thread)->getJVM(); vm->bootstrapLoader->analyseClasspathEnv(vm->bootstrapLoader->bootClasspathEnv); vm->argumentsInfo.readArgs(vm); - if (vm->argumentsInfo.className == NULL) { - vm->leaveNonDaemonMode(); + if (vm->argumentsInfo.className == NULL) return; - } int pos = vm->argumentsInfo.appArgumentsPos; vm->argumentsInfo.argv = vm->argumentsInfo.argv + pos - 1; @@ -1313,20 +1304,6 @@ vm->executeClass(info.className, args); } - vm->leaveNonDaemonMode(); -} - -void Jnjvm::leaveNonDaemonMode() { - nonDaemonLock.lock(); - --nonDaemonThreads; - if (nonDaemonThreads == 0) nonDaemonVar.signal(); - nonDaemonLock.unlock(); -} - -void Jnjvm::enterNonDaemonMode() { - nonDaemonLock.lock(); - ++nonDaemonThreads; - nonDaemonLock.unlock(); } void Jnjvm::runApplication(int argc, char** argv) { @@ -1340,7 +1317,6 @@ VirtualMachine(Alloc, vmkit), lockSystem(Alloc) { - nonDaemonThreads = 1; bootstrapLoader = new(Alloc, "bootstrap loader") JnjvmBootstrapLoader(Alloc, this, Comp); upcalls = new(allocator, "Classpath") Classpath(bootstrapLoader, dlLoad); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Wed Dec 8 18:16:33 2010 @@ -116,31 +116,6 @@ static void mainJavaStart(mvm::Thread* thread); public: - - /// nonDaemonThreads - Number of threads in the system that are not daemon - /// threads. - // - uint16 nonDaemonThreads; - - /// nonDaemonLock - Protection lock for the nonDaemonThreads variable. - /// - mvm::LockNormal nonDaemonLock; - - /// nonDaemonVar - Condition variable to wake up the initial thread when it - /// waits for other non-daemon threads to end. The non-daemon thread that - /// decrements the nonDaemonThreads variable to zero wakes up the initial - /// thread. - /// - mvm::Cond nonDaemonVar; - - /// leave - A thread calls this function when it leaves the thread system. - /// - void leaveNonDaemonMode(); - - /// enter - A thread calls this function when it enters the thread system. - /// - void enterNonDaemonMode(); - /// tracer - Traces instances of this class. /// Modified: vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/CommonThread/ctthread.cpp Wed Dec 8 18:16:33 2010 @@ -41,9 +41,22 @@ lastKnownFrame = 0; pendingException = 0; allVmsData = 0; + state = 0; // not daemon, not running vmk->registerPreparedThread(this); } +void Thread::setDaemon() { + if((state & THREAD_RUNNING) && !(state & THREAD_DAEMON)) + vmkit->nonDaemonThreadsManager.leaveNonDaemonMode(); + state |= THREAD_DAEMON; +} + +void Thread::setNonDaemon() { + if((state & THREAD_RUNNING) && (state & THREAD_DAEMON)) + vmkit->nonDaemonThreadsManager.enterNonDaemonMode(); + state &= ~THREAD_DAEMON; +} + void Thread::attach(VirtualMachine* vm) { vmData = allVmsData[vm->vmID]; @@ -470,11 +483,12 @@ th->vmkit->rendezvous.prepareForJoin(); th->routine(th); + th->state &= ~THREAD_RUNNING; + if(!(th->state & THREAD_DAEMON)) + th->vmkit->nonDaemonThreadsManager.leaveNonDaemonMode(); th->vmkit->unregisterRunningThread(th); } - - /// start - Called by the creator of the thread to run the new thread. /// The thread is in a detached state, because each virtual machine has /// its own way of waiting for created threads. @@ -485,6 +499,9 @@ routine = fct; // Make sure to add it in the list of threads before leaving this function: // the garbage collector wants to trace this thread. + state |= THREAD_RUNNING; + if(!(state & THREAD_DAEMON)) + vmkit->nonDaemonThreadsManager.enterNonDaemonMode(); vmkit->registerRunningThread(this); int res = pthread_create((pthread_t*)(void*)(&internalThreadID), &attributs, (void* (*)(void *))internalThreadStart, this); @@ -493,7 +510,6 @@ return res; } - /// operator new - Get a stack from the stack manager. The Thread object /// will be placed in the first page at the bottom of the stack. Hence /// Thread objects can not exceed a page. Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll (original) +++ vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll Wed Dec 8 18:16:33 2010 @@ -8,20 +8,21 @@ %CircularBase = type { %VT*, %CircularBase*, %CircularBase* } ;;; Field 0: the parent (circular base) -;;; Field 1: bool doYield -;;; field 2: void* lastExceptionBuffer/internalPendingException -;;; field 3: void* vmData -;;; field 4: gc* pendingException -;;; field 5: VMkit* vmkit -;;; Field 6: void* baseSP -;;; Field 7: bool inRV -;;; Field 8: bool joinedRV -;;; Field 9: void* lastSP -;;; Field 10: void* internalThreadID -;;; field 11: void* routine -;;; field 12: void* lastKnownFrame -;;; field 13: void* allVMDatas -%Thread = type { %CircularBase, i1, i8*, i8*, i8*, i8*, i8*, i1, i1, i8*, i8*, i8*, i8*, i8* } +;;; Field 1: bool doYield +;;; field 2: void* lastExceptionBuffer/internalPendingException +;;; field 3: void* vmData +;;; field 4: gc* pendingException +;;; field 5: VMkit* vmkit +;;; Field 6: void* baseSP +;;; Field 7: bool inRV +;;; Field 8: bool joinedRV +;;; Field 9: void* lastSP +;;; Field 10: void* internalThreadID +;;; field 11: void* routine +;;; field 12: void* lastKnownFrame +;;; field 13: void* allVMDatas +;;; field 14: uint32 state +%Thread = type { %CircularBase, i1, i8*, i8*, i8*, i8*, i8*, i1, i1, i8*, i8*, i8*, i8*, i8*, i32 } ;;; field 0: VT ;;; field 1: mvm::MutatorThread* mut Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp Wed Dec 8 18:16:33 2010 @@ -13,6 +13,8 @@ ToEnqueue = new mvm::gc*[INITIAL_QUEUE_SIZE]; ToEnqueueLength = INITIAL_QUEUE_SIZE; ToEnqueueIndex = 0; + + setDaemon(); } mvm::gc** getReferent(mvm::gc* obj) { @@ -150,6 +152,8 @@ ToBeFinalized = new mvm::gc*[INITIAL_QUEUE_SIZE]; ToBeFinalizedLength = INITIAL_QUEUE_SIZE; CurrentFinalizedIndex = 0; + + setDaemon(); } void FinalizerThread::growFinalizationQueue() { Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Wed Dec 8 18:16:33 2010 @@ -200,3 +200,26 @@ th->appendTo(&preparedThreads); vmkitUnlock(); } + +void NonDaemonThreadManager::leaveNonDaemonMode() { + nonDaemonLock.lock(); + --nonDaemonThreads; + if (nonDaemonThreads == 0) nonDaemonVar.signal(); + nonDaemonLock.unlock(); +} + +void NonDaemonThreadManager::enterNonDaemonMode() { + nonDaemonLock.lock(); + ++nonDaemonThreads; + nonDaemonLock.unlock(); +} + +void NonDaemonThreadManager::waitNonDaemonThreads() { + nonDaemonLock.lock(); + + while (nonDaemonThreads) { + nonDaemonVar.wait(&nonDaemonLock); + } + + nonDaemonLock.unlock(); +} Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp?rev=121325&r1=121324&r2=121325&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp Wed Dec 8 18:16:33 2010 @@ -12,53 +12,31 @@ vmkit->removeVM(vmID); } -void VirtualMachine::leaveNonDeamonMode() { - nonDaemonLock.lock(); - --nbNonDaemonThreads; - if (nbNonDaemonThreads == 0) nonDaemonVar.signal(); - nonDaemonLock.unlock(); -} - -void VirtualMachine::enterNonDeamonMode() { - nonDaemonLock.lock(); - ++nbNonDaemonThreads; - nonDaemonLock.unlock(); -} - -void VirtualMachine::waitForNonDeamonThreads() { - nonDaemonLock.lock(); - - while (nbNonDaemonThreads) { - nonDaemonVar.wait(&nonDaemonLock); - } - - nonDaemonLock.unlock(); -} -class LauncherThread : public Thread { -public: - void (*realStart)(VirtualMachine*, int, char**); - VirtualMachine *vm; - int argc; - char** argv; - - LauncherThread(VMKit* vmkit, void (*s)(VirtualMachine*, int, char**), VirtualMachine* v, int ac, char** av) : Thread(vmkit) { - realStart = s; - vm = v; - argc = ac; - argv = av; - } - - static void launch(LauncherThread* th) { - if(th->realStart) - th->realStart(th->vm, th->argc, th->argv); - else - th->vm->runApplicationImpl(th->argc, th->argv); - th->vm->leaveNonDeamonMode(); - } -}; - -void VirtualMachine::runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char **argv) { - enterNonDeamonMode(); - (new LauncherThread(vmkit, start, this, argc, argv))->start((void (*)(Thread*))LauncherThread::launch); -} +// class LauncherThread : public Thread { +// public: +// void (*realStart)(VirtualMachine*, int, char**); +// VirtualMachine *vm; +// int argc; +// char** argv; + +// LauncherThread(VMKit* vmkit, void (*s)(VirtualMachine*, int, char**), VirtualMachine* v, int ac, char** av) : Thread(vmkit) { +// realStart = s; +// vm = v; +// argc = ac; +// argv = av; +// } + +// static void launch(LauncherThread* th) { +// if(th->realStart) +// th->realStart(th->vm, th->argc, th->argv); +// else +// th->vm->runApplicationImpl(th->argc, th->argv); +// th->vm->leaveNonDeamonMode(); +// } +// }; + +// void VirtualMachine::runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char **argv) { +// enterNonDeamonMode(); +// (new LauncherThread(vmkit, start, this, argc, argv))->start((void (*)(Thread*))LauncherThread::launch); +// } From gael.thomas at lip6.fr Wed Dec 8 16:29:16 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 09 Dec 2010 00:29:16 -0000 Subject: [vmkit-commits] [vmkit] r121331 - in /vmkit/branches/multi-vm: include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/Compiler/JavaJITCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/Mvm/Runtime/VMKit.cpp tools/j3/Main.cpp tools/toy-vm/Main.cpp tools/vmkit/Launcher.cpp Message-ID: <20101209002916.AB34E2A6C12C@llvm.org> Author: gthomas Date: Wed Dec 8 18:29:16 2010 New Revision: 121331 URL: http://llvm.org/viewvc/llvm-project?rev=121331&view=rev Log: remove waitForExit from the vm and uses vmkit->waitNonDaemonThreads instead Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/tools/j3/Main.cpp vmkit/branches/multi-vm/tools/toy-vm/Main.cpp vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=121331&r1=121330&r2=121331&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Wed Dec 8 18:29:16 2010 @@ -129,6 +129,17 @@ // nonDaemonThreadsManager - manager of the non daemon threads NonDaemonThreadManager nonDaemonThreadsManager; + void registerPreparedThread(mvm::Thread* th); + void unregisterPreparedThread(mvm::Thread* th); + + void registerRunningThread(mvm::Thread* th); + void unregisterRunningThread(mvm::Thread* th); + + void waitNonDaemonThreads(); + + /// ------------------------------------------------- /// + /// --- memory managment --- /// + /// ------------------------------------------------- /// /// rendezvous - The rendezvous implementation for garbage collection. /// #ifdef WITH_LLVM_GCC @@ -137,12 +148,6 @@ UncooperativeCollectionRV rendezvous; #endif - void registerPreparedThread(mvm::Thread* th); - void unregisterPreparedThread(mvm::Thread* th); - - void registerRunningThread(mvm::Thread* th); - void unregisterRunningThread(mvm::Thread* th); - /// enqueueThread - The thread that finalizes references. /// FinalizerThread* finalizerThread; @@ -176,10 +181,6 @@ /// void scanPhantomReferencesQueue(uintptr_t closure); - /// ------------------------------------------------- /// - /// --- collection managment --- /// - /// ------------------------------------------------- /// - bool startCollection(); // 1 ok, begin collection, 0 do not start collection void endCollection(); Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121331&r1=121330&r2=121331&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Wed Dec 8 18:29:16 2010 @@ -68,9 +68,6 @@ // /// 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; - //===----------------------------------------------------------------------===// // (2) GC-related methods. //===----------------------------------------------------------------------===// Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121331&r1=121330&r2=121331&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Wed Dec 8 18:29:16 2010 @@ -16,6 +16,7 @@ #include "llvm/Support/raw_ostream.h" #include "mvm/Threads/Thread.h" +#include "mvm/VMKit.h" #include "j3/J3Intrinsics.h" #include "j3/JavaAOTCompiler.h" @@ -2091,7 +2092,7 @@ name = n; vm->javaMainThread = JavaThread::create(vm); vm->javaMainThread->mut->start(mainCompilerStart); - vm->waitForExit(); + vm->vmkit->waitNonDaemonThreads(); } /// compileAllStubs - Compile all the native -> Java stubs. Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp?rev=121331&r1=121330&r2=121331&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJITCompiler.cpp Wed Dec 8 18:29:16 2010 @@ -415,7 +415,7 @@ JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule"); Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, Comp, true); vm->runApplication(argc + 1, newArgv); - vm->waitForExit(); + vmkit->waitNonDaemonThreads(); return 0; } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121331&r1=121330&r2=121331&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Wed Dec 8 18:29:16 2010 @@ -1245,10 +1245,6 @@ } IGNORE; } -void Jnjvm::waitForExit() { - vmkit->nonDaemonThreadsManager.waitNonDaemonThreads(); -} - void Jnjvm::mainJavaStart(mvm::Thread* thread) { JavaString* str = NULL; @@ -1449,7 +1445,8 @@ newArgv[1] = mainClass; vm->runApplication(argc + 1, newArgv); - vm->waitForExit(); + + vmkit->waitNonDaemonThreads(); return 0; } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121331&r1=121330&r2=121331&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Wed Dec 8 18:29:16 2010 @@ -286,10 +286,6 @@ /// virtual void runApplication(int argc, char** argv); - /// waitForExit - Waits that there are no more non-daemon threads in this JVM. - /// - virtual void waitForExit(); - /// buildVMThreadData - allocate a java thread for the underlying mutator. Called when the java thread is a foreign thread. /// virtual mvm::VMThreadData* buildVMThreadData(mvm::Thread* mut); Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=121331&r1=121330&r2=121331&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Wed Dec 8 18:29:16 2010 @@ -201,6 +201,11 @@ vmkitUnlock(); } +void VMKit::waitNonDaemonThreads() { + nonDaemonThreadsManager.waitNonDaemonThreads(); +} + + void NonDaemonThreadManager::leaveNonDaemonMode() { nonDaemonLock.lock(); --nonDaemonThreads; Modified: vmkit/branches/multi-vm/tools/j3/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/j3/Main.cpp?rev=121331&r1=121330&r2=121331&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/j3/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/j3/Main.cpp Wed Dec 8 18:29:16 2010 @@ -41,7 +41,7 @@ // Run the application. vm->runApplication(argc, argv); - vm->waitForExit(); + vmkit->waitNonDamonThreads(); exit(0); // Destroy everyone. Modified: vmkit/branches/multi-vm/tools/toy-vm/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/toy-vm/Main.cpp?rev=121331&r1=121330&r2=121331&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/toy-vm/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/toy-vm/Main.cpp Wed Dec 8 18:29:16 2010 @@ -15,7 +15,6 @@ virtual bool enqueueReference(mvm::gc*) { NI(); } virtual size_t getObjectSize(mvm::gc*) { NI(); } virtual void runApplication(int, char**) { NI(); } - virtual void waitForExit() { NI(); } }; class ToyVMThread : public mvm::VMThreadData { Modified: vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp?rev=121331&r1=121330&r2=121331&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp (original) +++ vmkit/branches/multi-vm/tools/vmkit/Launcher.cpp Wed Dec 8 18:29:16 2010 @@ -75,8 +75,9 @@ JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule"); Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, vmkit, Comp, true); vm->runApplication(argc, argv); - vm->waitForExit(); } + vmkit->waitNonDaemonThreads(); + return 0; } From gael.thomas at lip6.fr Thu Dec 9 02:40:40 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 09 Dec 2010 10:40:40 -0000 Subject: [vmkit-commits] [vmkit] r121364 - in /vmkit/branches/multi-vm: find-it.sh include/mvm/VirtualMachine.h lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/Mvm/Runtime/VMKit.cpp lib/Mvm/Runtime/VirtualMachine.cpp Message-ID: <20101209104040.F02F92A6C12C@llvm.org> Author: gthomas Date: Thu Dec 9 04:40:40 2010 New Revision: 121364 URL: http://llvm.org/viewvc/llvm-project?rev=121364&view=rev Log: add functions to bootstrap a vm directly in virtual machine Modified: vmkit/branches/multi-vm/find-it.sh vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp Modified: vmkit/branches/multi-vm/find-it.sh URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/find-it.sh?rev=121364&r1=121363&r2=121364&view=diff ============================================================================== --- vmkit/branches/multi-vm/find-it.sh (original) +++ vmkit/branches/multi-vm/find-it.sh Thu Dec 9 04:40:40 2010 @@ -6,6 +6,6 @@ else - grep --exclude find-it.sh --exclude-dir IJvm --exclude-dir Isolate --exclude *.txt --exclude-dir autoconf --exclude config.status --exclude config.log --exclude configure --exclude *.xml --exclude *.html --exclude *.jar --exclude *.bc --exclude MMTkInline.inc --exclude-dir patches --exclude-dir N3 --exclude *.java --exclude *.class -R --exclude-dir .svn --exclude-dir Release --exclude *.s "$1" . + grep -w --exclude find-it.sh --exclude-dir IJvm --exclude-dir Isolate --exclude *.txt --exclude-dir autoconf --exclude config.status --exclude config.log --exclude configure --exclude *.xml --exclude *.html --exclude *.jar --exclude *.bc --exclude MMTkInline.inc --exclude-dir patches --exclude-dir N3 --exclude *.java --exclude *.class -R --exclude-dir .svn --exclude-dir Release --exclude *.s "$1" . fi \ No newline at end of file Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121364&r1=121363&r2=121364&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Thu Dec 9 04:40:40 2010 @@ -52,21 +52,17 @@ /// virtual VMThreadData* buildVMThreadData(Thread* mut) = 0; //{ return new VMThreadData(this, mut); } - virtual void runApplicationImpl(int argc, char** argv) {}; - -// /// runInNonDeamonThread - start a non deamon thread a begin the code with start if != 0 and runApplicationImpl otherwise -// /// the thread leaves the deamon mode when it finishs. -// void runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char** argv); - -// /// runInNonDeamonThread - start a non deamon thread a begin the code with runApplicationImpl, -// void runInNonDeamonThread(int argc, char **argv) { runInNonDeamonThread(0, argc, argv); } + /// runApplicationImpl - code executed after a runApplication in a vmkit thread + /// + virtual void runApplicationImpl(int argc, char** argv) {} -// /// waitNonDeamonThreads - wait until all the non deamon threads are terminated. -// void waitForNonDeamonThreads(); + /// runApplication - launch runApplicationImpl in a vmkit thread. The vmData is not allocated. + /// + void runApplication0(int argc, char** argv); -// /// 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; + /// runApplication - launch starter in a vmkit thread. The vmData is not allocated. + /// + void runApplication0(void (*starter)(VirtualMachine* vm, int argc, char** argv), int argc, char** argv); //===----------------------------------------------------------------------===// // (2) GC-related methods. Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121364&r1=121363&r2=121364&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Thu Dec 9 04:40:40 2010 @@ -1302,6 +1302,20 @@ } } +void Jnjvm::associateBootstrapJavaThread() { + mvm::Thread* mut = mvm::Thread::get(); + JavaThread *th = new JavaThread(this, mut); + mut->allVmsData[vmID] = th; + mut->attach(this); +} + +void Jnjvm::runApplicationImpl(int argc, char** argv) { + associateBootstrapJavaThread(); + argumentsInfo.argc = argc; + argumentsInfo.argv = argv; + mainJavaStart(mvm::Thread::get()); +} + void Jnjvm::runApplication(int argc, char** argv) { argumentsInfo.argc = argc; argumentsInfo.argv = argv; Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121364&r1=121363&r2=121364&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Thu Dec 9 04:40:40 2010 @@ -280,12 +280,20 @@ /// Jnjvm - Allocates a new JVM. /// Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JavaCompiler* Comp, bool dlLoad); + + /// runApplicationImpl - function executed in a thread after a call to runApplication + /// + virtual void runApplicationImpl(int argc, char** argv); /// runApplication - Runs the application with the given command line. /// User-visible function, inherited by the VirtualMachine class. /// virtual void runApplication(int argc, char** argv); + /// associateBootstrapJavaThread - allocate a bootstrap java thread for the underlying mutator during bootstrap. + /// + void associateBootstrapJavaThread(); + /// buildVMThreadData - allocate a java thread for the underlying mutator. Called when the java thread is a foreign thread. /// virtual mvm::VMThreadData* buildVMThreadData(mvm::Thread* mut); Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=121364&r1=121363&r2=121364&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Thu Dec 9 04:40:40 2010 @@ -205,7 +205,6 @@ nonDaemonThreadsManager.waitNonDaemonThreads(); } - void NonDaemonThreadManager::leaveNonDaemonMode() { nonDaemonLock.lock(); --nonDaemonThreads; Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp?rev=121364&r1=121363&r2=121364&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp Thu Dec 9 04:40:40 2010 @@ -12,31 +12,32 @@ vmkit->removeVM(vmID); } +class LauncherThread : public Thread { +public: + void (*realStart)(VirtualMachine*, int, char**); + VirtualMachine *vm; + int argc; + char** argv; -// class LauncherThread : public Thread { -// public: -// void (*realStart)(VirtualMachine*, int, char**); -// VirtualMachine *vm; -// int argc; -// char** argv; + LauncherThread(VMKit* vmkit, void (*s)(VirtualMachine*, int, char**), VirtualMachine* v, int ac, char** av) : Thread(vmkit) { + realStart = s; + vm = v; + argc = ac; + argv = av; + } -// LauncherThread(VMKit* vmkit, void (*s)(VirtualMachine*, int, char**), VirtualMachine* v, int ac, char** av) : Thread(vmkit) { -// realStart = s; -// vm = v; -// argc = ac; -// argv = av; -// } + static void launch(LauncherThread* th) { + if(th->realStart) + th->realStart(th->vm, th->argc, th->argv); + else + th->vm->runApplicationImpl(th->argc, th->argv); + } +}; -// static void launch(LauncherThread* th) { -// if(th->realStart) -// th->realStart(th->vm, th->argc, th->argv); -// else -// th->vm->runApplicationImpl(th->argc, th->argv); -// th->vm->leaveNonDeamonMode(); -// } -// }; +void VirtualMachine::runApplication0(void (*starter)(VirtualMachine*, int, char**), int argc, char **argv) { + (new LauncherThread(vmkit, starter, this, argc, argv))->start((void (*)(Thread*))LauncherThread::launch); +} -// void VirtualMachine::runInNonDeamonThread(void (*start)(VirtualMachine*, int, char**), int argc, char **argv) { -// enterNonDeamonMode(); -// (new LauncherThread(vmkit, start, this, argc, argv))->start((void (*)(Thread*))LauncherThread::launch); -// } +void VirtualMachine::runApplication0(int argc, char** argv) { + runApplication0(0, argc, argv); +} From gael.thomas at lip6.fr Thu Dec 9 03:00:37 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 09 Dec 2010 11:00:37 -0000 Subject: [vmkit-commits] [vmkit] r121365 - in /vmkit/branches/multi-vm: lib/J3/Classpath/JavaUpcalls.cpp lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h tools/j3/Main.cpp Message-ID: <20101209110037.45DAA2A6C12C@llvm.org> Author: gthomas Date: Thu Dec 9 05:00:37 2010 New Revision: 121365 URL: http://llvm.org/viewvc/llvm-project?rev=121365&view=rev Log: remove the useless field javaMainThread Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/tools/j3/Main.cpp Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp?rev=121365&r1=121364&r2=121365&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp Thu Dec 9 05:00:37 2010 @@ -103,7 +103,7 @@ RG = rootGroup->getStaticObjectField(); assert(RG && "No root group"); assert(vm->getMainThread() && "VM did not set its main thread"); - CreateJavaThread(vm, vm->javaMainThread, "main", RG); + CreateJavaThread(vm, JavaThread::get(), "main", RG); // Create the "system" group. SystemGroup = threadGroup->doNew(); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121365&r1=121364&r2=121365&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Thu Dec 9 05:00:37 2010 @@ -2090,8 +2090,7 @@ void JavaAOTCompiler::compileFile(Jnjvm* vm, const char* n) { name = n; - vm->javaMainThread = JavaThread::create(vm); - vm->javaMainThread->mut->start(mainCompilerStart); + JavaThread::create(vm)->mut->start(mainCompilerStart); vm->vmkit->waitNonDaemonThreads(); } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121365&r1=121364&r2=121365&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Thu Dec 9 05:00:37 2010 @@ -1319,8 +1319,7 @@ void Jnjvm::runApplication(int argc, char** argv) { argumentsInfo.argc = argc; argumentsInfo.argv = argv; - javaMainThread = JavaThread::create(this); - javaMainThread->mut->start((void (*)(mvm::Thread*))mainJavaStart); + JavaThread::create(this)->mut->start((void (*)(mvm::Thread*))mainJavaStart); } Jnjvm::Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JavaCompiler* Comp, bool dlLoad) : Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121365&r1=121364&r2=121365&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Thu Dec 9 05:00:37 2010 @@ -183,9 +183,6 @@ /// StringMap hashStr; - /// javaMainThread - the java main thread - JavaThread* javaMainThread; - mvm::VirtualTable* VMClassLoader__VT; void initialiseInternalVTs(); Modified: vmkit/branches/multi-vm/tools/j3/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/j3/Main.cpp?rev=121365&r1=121364&r2=121365&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/j3/Main.cpp (original) +++ vmkit/branches/multi-vm/tools/j3/Main.cpp Thu Dec 9 05:00:37 2010 @@ -41,7 +41,7 @@ // Run the application. vm->runApplication(argc, argv); - vmkit->waitNonDamonThreads(); + vmkit->waitNonDaemonThreads(); exit(0); // Destroy everyone. From gael.thomas at lip6.fr Thu Dec 9 03:55:47 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 09 Dec 2010 11:55:47 -0000 Subject: [vmkit-commits] [vmkit] r121366 - in /vmkit/branches/multi-vm: include/mvm/VirtualMachine.h lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/Mvm/Runtime/VirtualMachine.cpp Message-ID: <20101209115547.B32E82A6C12C@llvm.org> Author: gthomas Date: Thu Dec 9 05:55:47 2010 New Revision: 121366 URL: http://llvm.org/viewvc/llvm-project?rev=121366&view=rev Log: uses the new runApplication function Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121366&r1=121365&r2=121366&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Thu Dec 9 05:55:47 2010 @@ -58,11 +58,11 @@ /// runApplication - launch runApplicationImpl in a vmkit thread. The vmData is not allocated. /// - void runApplication0(int argc, char** argv); + void runApplication(int argc, char** argv); /// runApplication - launch starter in a vmkit thread. The vmData is not allocated. /// - void runApplication0(void (*starter)(VirtualMachine* vm, int argc, char** argv), int argc, char** argv); + void runApplication(void (*starter)(VirtualMachine* vm, int argc, char** argv), int argc, char** argv); //===----------------------------------------------------------------------===// // (2) GC-related methods. Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121366&r1=121365&r2=121366&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Thu Dec 9 05:55:47 2010 @@ -1316,12 +1316,6 @@ mainJavaStart(mvm::Thread::get()); } -void Jnjvm::runApplication(int argc, char** argv) { - argumentsInfo.argc = argc; - argumentsInfo.argv = argv; - JavaThread::create(this)->mut->start((void (*)(mvm::Thread*))mainJavaStart); -} - Jnjvm::Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JavaCompiler* Comp, bool dlLoad) : VirtualMachine(Alloc, vmkit), lockSystem(Alloc) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121366&r1=121365&r2=121366&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Thu Dec 9 05:55:47 2010 @@ -282,11 +282,6 @@ /// virtual void runApplicationImpl(int argc, char** argv); - /// runApplication - Runs the application with the given command line. - /// User-visible function, inherited by the VirtualMachine class. - /// - virtual void runApplication(int argc, char** argv); - /// associateBootstrapJavaThread - allocate a bootstrap java thread for the underlying mutator during bootstrap. /// void associateBootstrapJavaThread(); Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp?rev=121366&r1=121365&r2=121366&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VirtualMachine.cpp Thu Dec 9 05:55:47 2010 @@ -1,5 +1,6 @@ #include "mvm/VirtualMachine.h" #include "mvm/VMKit.h" +#include "MutatorThread.h" using namespace mvm; @@ -12,14 +13,14 @@ vmkit->removeVM(vmID); } -class LauncherThread : public Thread { +class LauncherThread : public MutatorThread { public: - void (*realStart)(VirtualMachine*, int, char**); - VirtualMachine *vm; - int argc; - char** argv; + void (*realStart)(VirtualMachine*, int, char**); + VirtualMachine* vm; + int argc; + char** argv; - LauncherThread(VMKit* vmkit, void (*s)(VirtualMachine*, int, char**), VirtualMachine* v, int ac, char** av) : Thread(vmkit) { + LauncherThread(VMKit* vmkit, void (*s)(VirtualMachine*, int, char**), VirtualMachine* v, int ac, char** av) : MutatorThread(vmkit) { realStart = s; vm = v; argc = ac; @@ -34,10 +35,10 @@ } }; -void VirtualMachine::runApplication0(void (*starter)(VirtualMachine*, int, char**), int argc, char **argv) { +void VirtualMachine::runApplication(void (*starter)(VirtualMachine*, int, char**), int argc, char **argv) { (new LauncherThread(vmkit, starter, this, argc, argv))->start((void (*)(Thread*))LauncherThread::launch); } -void VirtualMachine::runApplication0(int argc, char** argv) { - runApplication0(0, argc, argv); +void VirtualMachine::runApplication(int argc, char** argv) { + runApplication(0, argc, argv); } From gael.thomas at lip6.fr Thu Dec 9 04:22:35 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 09 Dec 2010 12:22:35 -0000 Subject: [vmkit-commits] [vmkit] r121367 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h include/mvm/VirtualMachine.h lib/J3/Classpath/ClasspathVMThread.inc lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/VMCore/JavaThread.cpp lib/J3/VMCore/JavaThread.h lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h Message-ID: <20101209122235.F05352A6C12C@llvm.org> Author: gthomas Date: Thu Dec 9 06:22:35 2010 New Revision: 121367 URL: http://llvm.org/viewvc/llvm-project?rev=121367&view=rev Log: use the new runApplication function, unify the creation of JavaThread Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=121367&r1=121366&r2=121367&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Thu Dec 9 06:22:35 2010 @@ -133,7 +133,7 @@ class VMKit; // WARNING: if you modify this class, you must also change mvm-runtime.ll -// WARNING: when a VMThreadData is store in a thread (in allVmsData), you must never delete it yourself. +// WARNING: when a VMThreadData is in a thread (in allVmsData), you must never delete it yourself. class VMThreadData { public: /// mut - The associated thread mutator Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121367&r1=121366&r2=121367&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Thu Dec 9 06:22:35 2010 @@ -50,7 +50,7 @@ //===----------------------------------------------------------------------===// /// buildVMThreadData - allocate a java thread for the underlying mutator. Called when the java thread is a foreign thread. /// - virtual VMThreadData* buildVMThreadData(Thread* mut) = 0; //{ return new VMThreadData(this, mut); } + virtual VMThreadData* buildVMThreadData(Thread* mut) { return new VMThreadData(this, mut); } /// runApplicationImpl - code executed after a runApplication in a vmkit thread /// Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc?rev=121367&r1=121366&r2=121367&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc Thu Dec 9 06:22:35 2010 @@ -87,7 +87,7 @@ javaThread = vm->upcalls->assocThread->getInstanceObjectField(vmThread); assert(javaThread && "VMThread with no Java equivalent"); - JavaThread* th = JavaThread::create(vm); + JavaThread* th = JavaThread::associate(vm, new mvm::MutatorThread(vm->vmkit)); if (!th) vm->outOfMemoryError(); th->mut->start((void (*)(mvm::Thread*))start); Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121367&r1=121366&r2=121367&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Thu Dec 9 06:22:35 2010 @@ -1904,9 +1904,12 @@ static const char* name; -void mainCompilerStart(mvm::Thread* mut) { - JavaThread* th = JavaThread::j3Thread(mut); - Jnjvm* vm = th->getJVM(); + +void mainCompilerStart(mvm::VirtualMachine* _vm, int argc, char** argv) { + Jnjvm* vm = (Jnjvm*)_vm; + + JavaThread::associate(vm, mvm::Thread::get()); + JnjvmBootstrapLoader* bootstrapLoader = vm->bootstrapLoader; JavaAOTCompiler* M = (JavaAOTCompiler*)bootstrapLoader->getCompiler(); JavaJITCompiler* Comp = 0; @@ -2090,7 +2093,7 @@ void JavaAOTCompiler::compileFile(Jnjvm* vm, const char* n) { name = n; - JavaThread::create(vm)->mut->start(mainCompilerStart); + vm->runApplication(mainCompilerStart, 0, 0); vm->vmkit->waitNonDaemonThreads(); } Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp?rev=121367&r1=121366&r2=121367&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp Thu Dec 9 06:22:35 2010 @@ -31,14 +31,14 @@ return (JavaThread*)mut->vmData; } -JavaThread *JavaThread::create(Jnjvm* vm) { - mvm::Thread *mut = new mvm::MutatorThread(vm->vmkit); +JavaThread* JavaThread::associate(Jnjvm* vm, mvm::Thread* mut) { JavaThread *th = new JavaThread(vm, mut); mut->allVmsData[vm->vmID] = th; mut->attach(vm); return th; } + void JavaThread::initialise(JavaObject* thread, JavaObject* vmth) { llvm_gcroot(thread, 0); llvm_gcroot(vmth, 0); Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h?rev=121367&r1=121366&r2=121367&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h Thu Dec 9 06:22:35 2010 @@ -111,13 +111,15 @@ /// ~JavaThread(); +private: /// JavaThread - Creates a Java thread. /// JavaThread(Jnjvm* vm, mvm::Thread*mut); - /// create - Creates a Java thread and a mutator thread. +public: + /// associate - Associate a java thread to the mutator /// - static JavaThread* create(Jnjvm* vm); + static JavaThread* associate(Jnjvm* vm, mvm::Thread* mut); /// j3Thread - gives the JavaThread associated with the mutator thread /// Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=121367&r1=121366&r2=121367&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Thu Dec 9 06:22:35 2010 @@ -1060,9 +1060,7 @@ } mvm::VMThreadData* Jnjvm::buildVMThreadData(mvm::Thread* mut) { - JavaThread* th = new JavaThread(this, mut); - mut->allVmsData[vmID] = th; // will be done by my caller but I have to call java code before - mut->vmData = th; // will be done by my caller but I have to call java code before + JavaThread* th = JavaThread::associate(this, mut); upcalls->CreateForeignJavaThread(this, th); return th; } @@ -1245,8 +1243,7 @@ } IGNORE; } -void Jnjvm::mainJavaStart(mvm::Thread* thread) { - +void Jnjvm::runApplicationImpl(int argc, char** argv) { JavaString* str = NULL; JavaObject* instrumenter = NULL; ArrayObject* args = NULL; @@ -1259,18 +1256,22 @@ llvm_gcroot(args, 0); llvm_gcroot(exc, 0); - Jnjvm* vm = JavaThread::j3Thread(thread)->getJVM(); - vm->bootstrapLoader->analyseClasspathEnv(vm->bootstrapLoader->bootClasspathEnv); - vm->argumentsInfo.readArgs(vm); - if (vm->argumentsInfo.className == NULL) + JavaThread::associate(this, mvm::Thread::get()); + + argumentsInfo.argc = argc; + argumentsInfo.argv = argv; + + bootstrapLoader->analyseClasspathEnv(bootstrapLoader->bootClasspathEnv); + argumentsInfo.readArgs(this); + if (argumentsInfo.className == NULL) return; - int pos = vm->argumentsInfo.appArgumentsPos; - vm->argumentsInfo.argv = vm->argumentsInfo.argv + pos - 1; - vm->argumentsInfo.argc = vm->argumentsInfo.argc - pos + 1; + int pos = argumentsInfo.appArgumentsPos; + argumentsInfo.argv = argumentsInfo.argv + pos - 1; + argumentsInfo.argc = argumentsInfo.argc - pos + 1; TRY { - vm->loadBootstrap(); + loadBootstrap(); } CATCH { exc = mvm::Thread::get()->getPendingException(); } END_CATCH; @@ -1280,42 +1281,28 @@ fprintf(stderr, "Exception %s while bootstrapping VM.", exc ? UTF8Buffer(JavaObject::getClass(jexc)->name).cString() : " foreign exception"); } else { - ClArgumentsInfo& info = vm->argumentsInfo; + ClArgumentsInfo& info = argumentsInfo; if (info.agents.size()) { assert(0 && "implement me"); instrumenter = 0;//createInstrumenter(); for (std::vector< std::pair >::iterator i = info.agents.begin(), e = info.agents.end(); i!= e; ++i) { - str = vm->asciizToStr(i->second); - vm->executePremain(i->first, str, instrumenter); + str = asciizToStr(i->second); + executePremain(i->first, str, instrumenter); } } - UserClassArray* array = vm->upcalls->ArrayOfString; + UserClassArray* array = upcalls->ArrayOfString; args = (ArrayObject*)array->doNew(info.argc - 2); for (int i = 2; i < info.argc; ++i) { - ArrayObject::setElement(args, (JavaObject*)vm->asciizToStr(info.argv[i]), i - 2); + ArrayObject::setElement(args, (JavaObject*)asciizToStr(info.argv[i]), i - 2); } - vm->executeClass(info.className, args); + executeClass(info.className, args); } } -void Jnjvm::associateBootstrapJavaThread() { - mvm::Thread* mut = mvm::Thread::get(); - JavaThread *th = new JavaThread(this, mut); - mut->allVmsData[vmID] = th; - mut->attach(this); -} - -void Jnjvm::runApplicationImpl(int argc, char** argv) { - associateBootstrapJavaThread(); - argumentsInfo.argc = argc; - argumentsInfo.argv = argv; - mainJavaStart(mvm::Thread::get()); -} - Jnjvm::Jnjvm(mvm::BumpPtrAllocator& Alloc, mvm::VMKit* vmkit, JavaCompiler* Comp, bool dlLoad) : VirtualMachine(Alloc, vmkit), lockSystem(Alloc) { Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=121367&r1=121366&r2=121367&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Thu Dec 9 06:22:35 2010 @@ -282,10 +282,6 @@ /// virtual void runApplicationImpl(int argc, char** argv); - /// associateBootstrapJavaThread - allocate a bootstrap java thread for the underlying mutator during bootstrap. - /// - void associateBootstrapJavaThread(); - /// buildVMThreadData - allocate a java thread for the underlying mutator. Called when the java thread is a foreign thread. /// virtual mvm::VMThreadData* buildVMThreadData(mvm::Thread* mut); From gael.thomas at lip6.fr Thu Dec 9 04:28:21 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Thu, 09 Dec 2010 12:28:21 -0000 Subject: [vmkit-commits] [vmkit] r121368 - /vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Message-ID: <20101209122821.32E032A6C12C@llvm.org> Author: gthomas Date: Thu Dec 9 06:28:21 2010 New Revision: 121368 URL: http://llvm.org/viewvc/llvm-project?rev=121368&view=rev Log: allocating a thread is now forbidden, can only allocate a mutatorthread Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=121368&r1=121367&r2=121368&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Thu Dec 9 06:28:21 2010 @@ -212,7 +212,8 @@ /// state - daemon, running uint32 state; // 14 -protected: +private: + friend class MutatorThread; Thread(VMKit* vmk); public: From nicolas.geoffray at lip6.fr Thu Dec 9 07:44:10 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 09 Dec 2010 15:44:10 -0000 Subject: [vmkit-commits] [vmkit] r121369 - /vmkit/trunk/include/mvm/Threads/Locks.h Message-ID: <20101209154410.8510D2A6C12C@llvm.org> Author: geoffray Date: Thu Dec 9 09:44:10 2010 New Revision: 121369 URL: http://llvm.org/viewvc/llvm-project?rev=121369&view=rev Log: Remove macros that were useful for old systems that we should (hopefully) not care about. Modified: vmkit/trunk/include/mvm/Threads/Locks.h Modified: vmkit/trunk/include/mvm/Threads/Locks.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Locks.h?rev=121369&r1=121368&r2=121369&view=diff ============================================================================== --- vmkit/trunk/include/mvm/Threads/Locks.h (original) +++ vmkit/trunk/include/mvm/Threads/Locks.h Thu Dec 9 09:44:10 2010 @@ -27,50 +27,6 @@ namespace mvm { -extern "C" uint8 llvm_atomic_cmp_swap_i8(uint8* ptr, uint8 cmp, - uint8 val); -extern "C" uint16 llvm_atomic_cmp_swap_i16(uint16* ptr, uint16 cmp, - uint16 val); -extern "C" uint32 llvm_atomic_cmp_swap_i32(uint32* ptr, uint32 cmp, - uint32 val); -extern "C" uint64 llvm_atomic_cmp_swap_i64(uint64* ptr, uint64 cmp, - uint64 val); - -#ifndef WITH_LLVM_GCC - -// TODO: find what macro for gcc < 4.2 - -#define __sync_bool_compare_and_swap_32(ptr, cmp, val) \ - mvm::llvm_atomic_cmp_swap_i32((uint32*)(ptr), (uint32)(cmp), \ - (uint32)(val)) == (uint32)(cmp) - -#if (__WORDSIZE == 64) - -#define __sync_bool_compare_and_swap(ptr, cmp, val) \ - mvm::llvm_atomic_cmp_swap_i64((uint64*)(ptr), (uint64)(cmp), \ - (uint64)(val)) == (uint64)(cmp) - -#define __sync_val_compare_and_swap(ptr, cmp,val) \ - mvm::llvm_atomic_cmp_swap_i64((uint64*)(ptr), (uint64)(cmp), \ - (uint64)(val)) - - -#else - - - -#define __sync_bool_compare_and_swap(ptr, cmp, val) \ - mvm::llvm_atomic_cmp_swap_i32((uint32*)(ptr), (uint32)(cmp), \ - (uint32)(val)) == (uint32)(cmp) - -#define __sync_val_compare_and_swap(ptr, cmp,val) \ - mvm::llvm_atomic_cmp_swap_i32((uint32*)(ptr), (uint32)(cmp), \ - (uint32)(val)) -#endif - - -#endif - class Cond; class FatLock; class LockNormal; @@ -96,7 +52,6 @@ /// pthread_mutex_t internalLock; - public: /// Lock - Creates a lock, recursive if rec is true. From nicolas.geoffray at lip6.fr Thu Dec 9 14:08:31 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 09 Dec 2010 22:08:31 -0000 Subject: [vmkit-commits] [vmkit] r121420 - in /vmkit/trunk: include/mvm/ include/mvm/Threads/ lib/J3/Compiler/ lib/J3/VMCore/ lib/Mvm/CommonThread/ lib/Mvm/Compiler/ lib/Mvm/GCMmap2/ lib/Mvm/MMTk/ mmtk/java/src/org/j3/bindings/ mmtk/java/src/org/j3/mmtk/ mmtk/java/src/org/mmtk/plan/generational/ mmtk/mmtk-alloc/ mmtk/mmtk-j3/ Message-ID: <20101209220831.C6F092A6C12C@llvm.org> Author: geoffray Date: Thu Dec 9 16:08:31 2010 New Revision: 121420 URL: http://llvm.org/viewvc/llvm-project?rev=121420&view=rev Log: Support generationnal collectors! Modified: vmkit/trunk/include/mvm/JIT.h vmkit/trunk/include/mvm/Threads/CollectionRV.h vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp vmkit/trunk/lib/J3/VMCore/JNIReferences.h vmkit/trunk/lib/J3/VMCore/JavaArray.h vmkit/trunk/lib/J3/VMCore/JavaClass.cpp vmkit/trunk/lib/J3/VMCore/JavaThread.cpp vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h vmkit/trunk/lib/J3/VMCore/LockedMap.cpp vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/trunk/lib/Mvm/Compiler/InlineMalloc.cpp vmkit/trunk/lib/Mvm/Compiler/JIT.cpp vmkit/trunk/lib/Mvm/Compiler/LLVMRuntime.ll vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp vmkit/trunk/lib/Mvm/MMTk/MvmGC.h vmkit/trunk/mmtk/java/src/org/j3/bindings/Bindings.java vmkit/trunk/mmtk/java/src/org/j3/mmtk/Barriers.java vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/Gen.java vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp vmkit/trunk/mmtk/mmtk-j3/Collection.cpp Modified: vmkit/trunk/include/mvm/JIT.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/JIT.h?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/include/mvm/JIT.h (original) +++ vmkit/trunk/include/mvm/JIT.h Thu Dec 9 16:08:31 2010 @@ -122,6 +122,9 @@ llvm::Function* AllocateFunction; llvm::Function* AllocateUnresolvedFunction; llvm::Function* AddFinalizationCandidate; + llvm::Function* ArrayWriteBarrierFunction; + llvm::Function* FieldWriteBarrierFunction; + llvm::Function* NonHeapWriteBarrierFunction; llvm::Constant* constantInt8Zero; llvm::Constant* constantZero; Modified: vmkit/trunk/include/mvm/Threads/CollectionRV.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/CollectionRV.h?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/include/mvm/Threads/CollectionRV.h (original) +++ vmkit/trunk/include/mvm/Threads/CollectionRV.h Thu Dec 9 16:08:31 2010 @@ -29,10 +29,14 @@ /// nbJoined - Number of threads that joined the rendezvous. unsigned nbJoined; + + // initiator - The initiator of the rendesvous. + Thread* initiator; public: CollectionRV() { nbJoined = 0; + initiator = NULL; } void lockRV() { _lockRV.lock(); } @@ -52,6 +56,7 @@ } void another_mark(); + Thread* getInitiator() const { return initiator; } virtual void finishRV() = 0; virtual void synchronize() = 0; @@ -64,7 +69,7 @@ }; class CooperativeCollectionRV : public CollectionRV { -public: +public: void finishRV(); void synchronize(); @@ -72,6 +77,7 @@ void joinAfterUncooperative(void* SP); void joinBeforeUncooperative(); void addThread(Thread* th); + }; class UncooperativeCollectionRV : public CollectionRV { Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Thu Dec 9 16:08:31 2010 @@ -2066,8 +2066,15 @@ if (type != val->getType()) { // int1, int8, int16 convertValue(val, type, currentBlock, false); } - - new StoreInst(val, ptr, false, currentBlock); + + if (mvm::Collector::supportsWriteBarrier() && type == intrinsics->JavaObjectType) { + ptr = new BitCastInst(ptr, intrinsics->ptrPtrType, "", currentBlock); + val = new BitCastInst(val, intrinsics->ptrType, "", currentBlock); + Value* args[2] = { ptr, val }; + CallInst::Create(intrinsics->NonHeapWriteBarrierFunction, args, args + 2, "", currentBlock); + } else { + new StoreInst(val, ptr, false, currentBlock); + } } void JavaJIT::getStaticField(uint16 index) { @@ -2166,8 +2173,17 @@ if (type != val->getType()) { // int1, int8, int16 convertValue(val, type, currentBlock, false); } - - new StoreInst(val, ptr, false, currentBlock); + + if (mvm::Collector::supportsWriteBarrier() && type == intrinsics->JavaObjectType) { + ptr = new BitCastInst(ptr, intrinsics->ptrPtrType, "", currentBlock); + val = new BitCastInst(val, intrinsics->ptrType, "", currentBlock); + object = new LoadInst(object, "", currentBlock); + object = new BitCastInst(object, intrinsics->ptrType, "", currentBlock); + Value* args[3] = { object, ptr, val }; + CallInst::Create(intrinsics->FieldWriteBarrierFunction, args, args + 3, "", currentBlock); + } else { + new StoreInst(val, ptr, false, currentBlock); + } } void JavaJIT::getVirtualField(uint16 index) { Modified: vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Thu Dec 9 16:08:31 2010 @@ -721,8 +721,15 @@ Value* obj = pop(); Value* ptr = verifyAndComputePtr(obj, index, intrinsics->JavaArrayObjectType); - - new StoreInst(val, ptr, false, currentBlock); + if (mvm::Collector::supportsWriteBarrier()) { + ptr = new BitCastInst(ptr, intrinsics->ptrPtrType, "", currentBlock); + val = new BitCastInst(val, intrinsics->ptrType, "", currentBlock); + obj = new BitCastInst(obj, intrinsics->ptrType, "", currentBlock); + Value* args[3] = { obj, ptr, val }; + CallInst::Create(intrinsics->ArrayWriteBarrierFunction, args, args + 3, "", currentBlock); + } else { + new StoreInst(val, ptr, false, currentBlock); + } break; } Modified: vmkit/trunk/lib/J3/VMCore/JNIReferences.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JNIReferences.h?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JNIReferences.h (original) +++ vmkit/trunk/lib/J3/VMCore/JNIReferences.h Thu Dec 9 16:08:31 2010 @@ -69,8 +69,7 @@ return next->addJNIReference(obj); } else { ++count; - mvm::Collector::objectReferenceNonHeapWriteBarrier( - (gc**)&(globalReferences[length]), (gc*)obj); + globalReferences[length] = obj; return &globalReferences[length++]; } } Modified: vmkit/trunk/lib/J3/VMCore/JavaArray.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaArray.h?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaArray.h (original) +++ vmkit/trunk/lib/J3/VMCore/JavaArray.h Thu Dec 9 16:08:31 2010 @@ -99,7 +99,7 @@ llvm_gcroot(self, 0); llvm_gcroot(value, 0); if (value != NULL) assert(value->getVirtualTable()); - mvm::Collector::objectReferenceWriteBarrier( + mvm::Collector::objectReferenceArrayWriteBarrier( (gc*)self, (gc**)&(self->elements[i]), (gc*)value); } Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaClass.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaClass.cpp Thu Dec 9 16:08:31 2010 @@ -580,7 +580,9 @@ void JavaField::InitStaticField(JavaObject* val) { llvm_gcroot(val, 0); void* obj = classDef->getStaticInstance(); - ((JavaObject**)((uint64)obj + ptrOffset))[0] = val; + assert(isReference()); + JavaObject** ptr = (JavaObject**)((uint64)obj + ptrOffset); + mvm::Collector::objectReferenceNonHeapWriteBarrier((gc**)ptr, (gc*)val); } void JavaField::InitStaticField(double val) { @@ -1059,38 +1061,27 @@ } JavaObject* CommonClass::setDelegatee(JavaObject* val) { - JavaObject* prev = NULL; llvm_gcroot(val, 0); - llvm_gcroot(prev, 0); JavaObject** obj = &(delegatee[JavaThread::get()->getJVM()->IsolateID]); - - prev = (JavaObject*)__sync_val_compare_and_swap((uintptr_t)obj, NULL, val); - - if (prev == NULL) { - // Write it again to execute the write barrier. + classLoader->lock.lock(); + if (*obj == NULL) { mvm::Collector::objectReferenceNonHeapWriteBarrier((gc**)obj, (gc*)val); - return val; - } else { - return prev; } + classLoader->lock.unlock(); + return getDelegatee(); } #else JavaObject* CommonClass::setDelegatee(JavaObject* val) { - JavaObject* prev = NULL; llvm_gcroot(val, 0); - llvm_gcroot(prev, 0); - prev = (JavaObject*)__sync_val_compare_and_swap(&(delegatee[0]), NULL, val); - - if (prev == NULL) { - // Write it again to execute the write barrier. - mvm::Collector::objectReferenceNonHeapWriteBarrier( - (gc**)&(delegatee[0]), (gc*)val); - return val; - } else { - return prev; + JavaObject** obj = &(delegatee[0]); + classLoader->lock.lock(); + if (*obj == NULL) { + mvm::Collector::objectReferenceNonHeapWriteBarrier((gc**)obj, (gc*)val); } + classLoader->lock.unlock(); + return getDelegatee(); } #endif Modified: vmkit/trunk/lib/J3/VMCore/JavaThread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaThread.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JavaThread.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/JavaThread.cpp Thu Dec 9 16:08:31 2010 @@ -40,10 +40,8 @@ void JavaThread::initialise(JavaObject* thread, JavaObject* vmth) { llvm_gcroot(thread, 0); llvm_gcroot(vmth, 0); - mvm::Collector::objectReferenceNonHeapWriteBarrier( - (gc**)&javaThread, (gc*)thread); - mvm::Collector::objectReferenceNonHeapWriteBarrier( - (gc**)&vmThread, (gc*)vmth); + javaThread = thread; + vmThread = vmth; } JavaThread::~JavaThread() { @@ -155,8 +153,7 @@ next->prev = this; return next->addJNIReference(th, obj); } else { - mvm::Collector::objectReferenceNonHeapWriteBarrier( - (gc**)&(localReferences[length]), (gc*)obj); + localReferences[length] = obj; return &localReferences[length++]; } } Modified: vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h (original) +++ vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.h Thu Dec 9 16:08:31 2010 @@ -304,6 +304,8 @@ Class* loadClassFromSelf(Jnjvm* vm, const char* name); friend class Class; + friend class CommonClass; + friend class StringList; }; /// JnjvmBootstrapLoader - This class is for the bootstrap class loader, which @@ -513,9 +515,12 @@ JCL->strings = next; return next->addString(JCL, obj); } else { + JCL->lock.lock(); mvm::Collector::objectReferenceNonHeapWriteBarrier( (gc**)&(strings[length]), (gc*)obj); - return &strings[length++]; + JavaString** res = &strings[length++]; + JCL->lock.unlock(); + return res; } } }; Modified: vmkit/trunk/lib/J3/VMCore/LockedMap.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/LockedMap.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/LockedMap.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/LockedMap.cpp Thu Dec 9 16:08:31 2010 @@ -25,9 +25,4 @@ assert(map.find(array)->first == array); assert(&(map.find(array)->second) == &(it->second)); assert(&(map.find(array)->first) == &(it->first)); - // Inform the GC that we just stored a string here. - mvm::Collector::objectReferenceNonHeapWriteBarrier( - (gc**)&(it->second), (gc*)str); - mvm::Collector::objectReferenceNonHeapWriteBarrier( - (gc**)&(it->first), (gc*)array); } Modified: vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp Thu Dec 9 16:08:31 2010 @@ -54,8 +54,9 @@ self->MyVM->ThreadLock.lock(); mvm::Thread* cur = self; + assert(initiator == NULL); + initiator = self; do { - assert(!cur->doYield); cur->doYield = true; assert(!cur->joinedRV); cur = (mvm::Thread*)cur->next(); @@ -192,8 +193,8 @@ void CooperativeCollectionRV::finishRV() { lockRV(); - - mvm::Thread* initiator = mvm::Thread::get(); + + assert(mvm::Thread::get() == initiator); mvm::Thread* cur = initiator; do { assert(cur->doYield && "Inconsistent state"); @@ -207,8 +208,9 @@ nbJoined = 0; initiator->MyVM->ThreadLock.unlock(); condEndRV.broadcast(); + initiator = NULL; unlockRV(); - initiator->inRV = false; + mvm::Thread::get()->inRV = false; } void UncooperativeCollectionRV::finishRV() { Modified: vmkit/trunk/lib/Mvm/Compiler/InlineMalloc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/InlineMalloc.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Compiler/InlineMalloc.cpp (original) +++ vmkit/trunk/lib/Mvm/Compiler/InlineMalloc.cpp Thu Dec 9 16:08:31 2010 @@ -42,7 +42,9 @@ bool InlineMalloc::runOnFunction(Function& F) { Function* Malloc = F.getParent()->getFunction("gcmalloc"); - if (!Malloc || Malloc->isDeclaration()) return false; + Function* FieldWriteBarrier = F.getParent()->getFunction("fieldWriteBarrier"); + Function* ArrayWriteBarrier = F.getParent()->getFunction("arrayWriteBarrier"); + Function* NonHeapWriteBarrier = F.getParent()->getFunction("nonHeapWriteBarrier"); bool Changed = false; for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE; BI++) { BasicBlock *Cur = BI; @@ -61,6 +63,12 @@ Changed |= InlineFunction(Call, IFI); break; } + } else if (Temp == FieldWriteBarrier || + Temp == NonHeapWriteBarrier || + Temp == ArrayWriteBarrier) { + InlineFunctionInfo IFI(NULL, mvm::MvmModule::TheTargetData); + Changed |= InlineFunction(Call, IFI); + break; } } } Modified: vmkit/trunk/lib/Mvm/Compiler/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/JIT.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original) +++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Thu Dec 9 16:08:31 2010 @@ -322,6 +322,10 @@ assert(AllocateUnresolvedFunction && "No allocateUnresolved function"); AddFinalizationCandidate = module->getFunction("addFinalizationCandidate"); assert(AddFinalizationCandidate && "No addFinalizationCandidate function"); + + ArrayWriteBarrierFunction = module->getFunction("arrayWriteBarrier"); + FieldWriteBarrierFunction = module->getFunction("fieldWriteBarrier"); + NonHeapWriteBarrierFunction = module->getFunction("nonHeapWriteBarrier"); } const llvm::TargetData* MvmModule::TheTargetData; Modified: vmkit/trunk/lib/Mvm/Compiler/LLVMRuntime.ll URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/LLVMRuntime.ll?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Compiler/LLVMRuntime.ll (original) +++ vmkit/trunk/lib/Mvm/Compiler/LLVMRuntime.ll Thu Dec 9 16:08:31 2010 @@ -85,3 +85,6 @@ declare i8* @gcmalloc(i32, i8*) declare i8* @gcmallocUnresolved(i32, i8*) declare void @addFinalizationCandidate(i8*) +declare void @arrayWriteBarrier(i8*, i8**, i8*) +declare void @fieldWriteBarrier(i8*, i8**, i8*) +declare void @nonHeapWriteBarrier(i8**, i8*) Modified: vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h Thu Dec 9 16:08:31 2010 @@ -362,6 +362,10 @@ static void objectReferenceWriteBarrier(gc* ref, gc** slot, gc* value) { *slot = value; } + + static void objectReferenceArrayWriteBarrier(gc* ref, gc** slot, gc* value) { + *slot = value; + } static void objectReferenceNonHeapWriteBarrier(gc** slot, gc* value) { *slot = value; @@ -371,6 +375,10 @@ gc* res = __sync_val_compare_and_swap(slot, old, value); return (res == old); } + + static bool supportsWriteBarrier() { + return false; + } }; } Modified: vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/gc.cpp Thu Dec 9 16:08:31 2010 @@ -34,6 +34,18 @@ // This is useless with GCmmap2, as the gcmalloc already did it. } +extern "C" void fieldWriteBarrier(gc* ref, gc** slot, gc* value) { + *slot = value; +} + +extern "C" void arrayWriteBarrier(gc* ref, gc** slot, gc* value) { + *slot = value; +} + +extern "C" void nonHeapWriteBarrier(gc** slot, gc* value) { + *slot = value; +} + void Collector::scanObject(void** val, uintptr_t closure) { void* obj = *val; if (obj) { Modified: vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp (original) +++ vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp Thu Dec 9 16:08:31 2010 @@ -109,10 +109,27 @@ return NULL; } +extern "C" void arrayWriteBarrier(gc* ref, gc** ptr, gc* value) { + *ptr = value; +} + +extern "C" void fieldWriteBarrier(gc* ref, gc** ptr, gc* value) { + *ptr = value; +} + +extern "C" void nonHeapWriteBarrier(gc** ptr, gc* value) { + *ptr = value; +} + + void Collector::objectReferenceWriteBarrier(gc* ref, gc** slot, gc* value) { *slot = value; } +void Collector::objectReferenceArrayWriteBarrier(gc* ref, gc** slot, gc* value) { + *slot = value; +} + void Collector::objectReferenceNonHeapWriteBarrier(gc** slot, gc* value) { *slot = value; } @@ -128,3 +145,7 @@ void Collector::initialise() { } + +bool Collector::supportsWriteBarrier() { + return false; +} Modified: vmkit/trunk/lib/Mvm/MMTk/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MvmGC.h?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/MMTk/MvmGC.h (original) +++ vmkit/trunk/lib/Mvm/MMTk/MvmGC.h Thu Dec 9 16:08:31 2010 @@ -77,8 +77,10 @@ static gc* getForwardedReference(gc* val, uintptr_t closure) __attribute__ ((always_inline)); static gc* getForwardedReferent(gc* val, uintptr_t closure) __attribute__ ((always_inline)); static void objectReferenceWriteBarrier(gc* ref, gc** slot, gc* value) __attribute__ ((always_inline)); + static void objectReferenceArrayWriteBarrier(gc* ref, gc** slot, gc* value) __attribute__ ((always_inline)); static void objectReferenceNonHeapWriteBarrier(gc** slot, gc* value) __attribute__ ((always_inline)); static bool objectReferenceTryCASBarrier(gc* ref, gc** slot, gc* old, gc* value) __attribute__ ((always_inline)); + static bool supportsWriteBarrier(); static void collect(); Modified: vmkit/trunk/mmtk/java/src/org/j3/bindings/Bindings.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/j3/bindings/Bindings.java?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/j3/bindings/Bindings.java (original) +++ vmkit/trunk/mmtk/java/src/org/j3/bindings/Bindings.java Thu Dec 9 16:08:31 2010 @@ -15,6 +15,7 @@ import org.mmtk.plan.TraceLocal; import org.mmtk.plan.TransitiveClosure; import org.mmtk.utility.heap.HeapGrowthManager; +import org.mmtk.utility.Constants; import org.vmmagic.pragma.Inline; import org.vmmagic.unboxed.Address; import org.vmmagic.unboxed.Extent; @@ -114,4 +115,43 @@ private static native void memcpy( ObjectReference to, ObjectReference from, int size); + @Inline + private static void arrayWriteBarrier(ObjectReference ref, Address slot, ObjectReference value) { + if (Selected.Constraints.get().needsObjectReferenceWriteBarrier()) { + Selected.Mutator mutator = Selected.Mutator.get(); + mutator.objectReferenceWrite(ref, slot, value, slot.toWord(), slot.toWord(), Constants.ARRAY_ELEMENT); + } else { + slot.store(value); + } + } + + @Inline + private static void fieldWriteBarrier(ObjectReference ref, Address slot, ObjectReference value) { + if (Selected.Constraints.get().needsObjectReferenceWriteBarrier()) { + Selected.Mutator mutator = Selected.Mutator.get(); + mutator.objectReferenceWrite(ref, slot, value, slot.toWord(), slot.toWord(), Constants.INSTANCE_FIELD); + } else { + slot.store(value); + } + } + + @Inline + private static void nonHeapWriteBarrier(Address slot, ObjectReference value) { + if (Selected.Constraints.get().needsObjectReferenceNonHeapWriteBarrier()) { + Selected.Mutator mutator = Selected.Mutator.get(); + mutator.objectReferenceNonHeapWrite(slot, value, slot.toWord(), slot.toWord()); + } else { + slot.store(value); + } + } + + @Inline + private static boolean writeBarrierCAS(ObjectReference src, Address slot, ObjectReference old, ObjectReference value) { + if (Selected.Constraints.get().needsObjectReferenceWriteBarrier()) { + Selected.Mutator mutator = Selected.Mutator.get(); + return mutator.objectReferenceTryCompareAndSwap(src, slot, old, value, slot.toWord(), slot.toWord(), Constants.INSTANCE_FIELD); + } else { + return slot.attempt(old.toAddress().toWord(), value.toAddress().toWord()); + } + } } 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=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/j3/mmtk/Barriers.java (original) +++ vmkit/trunk/mmtk/java/src/org/j3/mmtk/Barriers.java Thu Dec 9 16:08:31 2010 @@ -14,7 +14,7 @@ import org.jikesrvm.SizeConstants; import org.jikesrvm.Magic; -import org.mmtk.vm.VM; +import org.j3.runtime.VM; import org.vmmagic.unboxed.*; import org.vmmagic.pragma.*; @@ -33,6 +33,7 @@ @Inline @Override public final void booleanWrite(ObjectReference objref, boolean value, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); Magic.setBooleanAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); } @@ -48,6 +49,7 @@ @Inline @Override public final boolean booleanRead(ObjectReference objref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getByteAtOffset(objref.toObject(), offset.toOffset()) == 0; } @@ -63,6 +65,7 @@ @Inline @Override public final void byteWrite(ObjectReference objref, byte value, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); Magic.setByteAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); } @@ -78,6 +81,7 @@ @Inline @Override public final byte byteRead(ObjectReference objref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getByteAtOffset(objref.toObject(), offset.toOffset()); } @@ -93,6 +97,7 @@ @Inline @Override public final void charWrite(ObjectReference objref, char value, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); Magic.setCharAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); } @@ -108,6 +113,7 @@ @Inline @Override public final char charRead(ObjectReference objref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getCharAtOffset(objref.toObject(), offset.toOffset()); } @@ -123,6 +129,7 @@ @Inline @Override public final void shortWrite(ObjectReference objref, short value, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); Magic.setShortAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); } @@ -138,6 +145,7 @@ @Inline @Override public final short shortRead(ObjectReference objref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getShortAtOffset(objref.toObject(), offset.toOffset()); } @@ -153,6 +161,7 @@ @Inline @Override public final void intWrite(ObjectReference objref, int value, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); Magic.setIntAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); } @@ -168,6 +177,7 @@ @Inline @Override public final int intRead(ObjectReference objref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getIntAtOffset(objref.toObject(), offset.toOffset()); } @@ -184,6 +194,7 @@ */ @Override public boolean intTryCompareAndSwap(ObjectReference objref, int expected, int newValue, Word offset, Word unused, int mode) { + VM._assert(VM.NOT_REACHED); int oldValue; do { oldValue = Magic.prepareInt(objref, offset.toOffset()); @@ -204,6 +215,7 @@ @Inline @Override public final void longWrite(ObjectReference objref, long value, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); Magic.setLongAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); } @@ -219,6 +231,7 @@ @Inline @Override public final long longRead(ObjectReference objref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getLongAtOffset(objref.toObject(), offset.toOffset()); } @@ -235,6 +248,7 @@ */ @Override public boolean longTryCompareAndSwap(ObjectReference objref, long expected, long newValue, Word offset, Word unused, int mode) { + VM._assert(VM.NOT_REACHED); long oldValue; do { oldValue = Magic.prepareLong(objref, offset.toOffset()); @@ -255,6 +269,7 @@ @Inline @Override public final void floatWrite(ObjectReference objref, float value, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); Magic.setFloatAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); } @@ -270,6 +285,7 @@ @Inline @Override public final float floatRead(ObjectReference objref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getFloatAtOffset(objref.toObject(), offset.toOffset()); } @@ -285,6 +301,7 @@ @Inline @Override public final void doubleWrite(ObjectReference objref, double value, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); Magic.setDoubleAtOffset(objref.toObject(), offset.toOffset(), value, location.toInt()); } @@ -300,6 +317,7 @@ @Inline @Override public final double doubleRead(ObjectReference objref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getDoubleAtOffset(objref.toObject(), offset.toOffset()); } @@ -314,8 +332,8 @@ */ @Inline @Override - public final void objectReferenceWrite(ObjectReference objref, ObjectReference value, Word offset, Word location, int mode) { - Magic.setObjectAtOffset(objref.toObject(), offset.toOffset(), value.toObject(), location.toInt()); + public final void objectReferenceWrite(ObjectReference objref, ObjectReference value, Word slot, Word location, int mode) { + slot.toAddress().store(value); } /** @@ -330,6 +348,7 @@ @Inline @Override public final ObjectReference objectReferenceRead(ObjectReference objref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return ObjectReference.fromObject(Magic.getObjectAtOffset(objref.toObject(), offset.toOffset(), location.toInt())); } @@ -362,6 +381,7 @@ @Inline @Override public final ObjectReference objectReferenceAtomicWrite(ObjectReference objref, ObjectReference target, Word offset, Word unused, int mode) { + VM._assert(VM.NOT_REACHED); Object obj = objref.toObject(); Object newObject = target.toObject(); Object oldObject; @@ -385,6 +405,7 @@ @Inline @Override public final boolean objectReferenceTryCompareAndSwap(ObjectReference objref, ObjectReference old, ObjectReference target, Word offset, Word unused, int mode) { + VM._assert(VM.NOT_REACHED); Object oldValue; do { oldValue = Magic.prepareObject(objref, offset.toOffset()); @@ -405,8 +426,8 @@ @Inline @Override public final void wordWrite(ObjectReference ref, Word target, - Word offset, Word location, int mode) { - Magic.setWordAtOffset(ref.toObject(), offset.toOffset(), target, location.toInt()); + Word slot, Word location, int mode) { + slot.toAddress().store(target); } /** @@ -424,6 +445,7 @@ @Override public final Word wordAtomicWrite(ObjectReference ref, Word target, Word offset, Word unused, int mode) { + VM._assert(VM.NOT_REACHED); Word oldValue; do { oldValue = Magic.prepareWord(ref.toObject(), offset.toOffset()); @@ -446,6 +468,7 @@ @Override public final boolean wordTryCompareAndSwap(ObjectReference ref, Word old, Word target, Word offset, Word unused, int mode) { + VM._assert(VM.NOT_REACHED); do { Word currentValue = Magic.prepareWord(ref, offset.toOffset()); if (currentValue != old) return false; @@ -466,6 +489,7 @@ @Override public final Word wordRead(ObjectReference ref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getWordAtOffset(ref.toObject(), offset.toOffset(), location.toInt()); } @@ -482,6 +506,7 @@ @Override public final void addressWrite(ObjectReference ref, Address target, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); Magic.setAddressAtOffset(ref.toObject(), offset.toOffset(), target, location.toInt()); } @@ -498,6 +523,7 @@ @Override public final Address addressRead(ObjectReference ref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getAddressAtOffset(ref.toObject(), offset.toOffset(), location.toInt()); } @@ -514,6 +540,7 @@ */ @Override public boolean addressTryCompareAndSwap(ObjectReference objref, Address expected, Address newValue, Word offset, Word unused, int mode) { + VM._assert(VM.NOT_REACHED); Address oldValue; do { oldValue = Magic.prepareAddress(objref, offset.toOffset()); @@ -535,6 +562,7 @@ @Override public final void offsetWrite(ObjectReference ref, Offset target, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); Magic.setOffsetAtOffset(ref.toObject(), offset.toOffset(), target, location.toInt()); } @@ -551,6 +579,7 @@ @Override public final Offset offsetRead(ObjectReference ref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getOffsetAtOffset(ref.toObject(), offset.toOffset(), location.toInt()); } @@ -567,6 +596,7 @@ @Override public final void extentWrite(ObjectReference ref, Extent target, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); Magic.setExtentAtOffset(ref.toObject(), offset.toOffset(), target, location.toInt()); } @@ -583,6 +613,7 @@ @Override public final Extent extentRead(ObjectReference ref, Word offset, Word location, int mode) { + VM._assert(VM.NOT_REACHED); return Magic.getExtentAtOffset(ref.toObject(), offset.toOffset(), location.toInt()); } Modified: vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/Gen.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/Gen.java?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/Gen.java (original) +++ vmkit/trunk/mmtk/java/src/org/mmtk/plan/generational/Gen.java Thu Dec 9 16:08:31 2010 @@ -56,7 +56,7 @@ protected static final float MATURE_FRACTION = 0.5f; // est yield private static final float WORST_CASE_COPY_EXPANSION = 1.5f; // worst case for addition of one word overhead due to address based hashing public static final boolean IGNORE_REMSETS = false; - public static final boolean USE_NON_HEAP_OBJECT_REFERENCE_WRITE_BARRIER = false; + public static final boolean USE_NON_HEAP_OBJECT_REFERENCE_WRITE_BARRIER = true; public static final boolean USE_OBJECT_BARRIER_FOR_AASTORE = false; // choose between slot and object barriers public static final boolean USE_OBJECT_BARRIER_FOR_PUTFIELD = false; // choose between slot and object barriers public static final boolean USE_OBJECT_BARRIER = USE_OBJECT_BARRIER_FOR_AASTORE || USE_OBJECT_BARRIER_FOR_PUTFIELD; Modified: vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp (original) +++ vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp Thu Dec 9 16:08:31 2010 @@ -45,6 +45,14 @@ uintptr_t TraceLocal, void* obj) ALWAYS_INLINE; extern "C" uint8_t JnJVM_org_j3_bindings_Bindings_isLive__Lorg_mmtk_plan_TraceLocal_2Lorg_vmmagic_unboxed_ObjectReference_2( uintptr_t TraceLocal, void* obj) ALWAYS_INLINE; + +extern "C" uint8_t JnJVM_org_j3_bindings_Bindings_writeBarrierCAS__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2(gc* ref, gc** slot, gc* old, gc* value) ALWAYS_INLINE; + +extern "C" void JnJVM_org_j3_bindings_Bindings_arrayWriteBarrier__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2(gc* ref, gc** ptr, gc* value) ALWAYS_INLINE; + +extern "C" void JnJVM_org_j3_bindings_Bindings_fieldWriteBarrier__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2(gc* ref, gc** ptr, gc* value) ALWAYS_INLINE; + +extern "C" void JnJVM_org_j3_bindings_Bindings_nonHeapWriteBarrier__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2(gc** ptr, gc* value) ALWAYS_INLINE; extern "C" void* JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2( int sz, void* VT) ALWAYS_INLINE; @@ -54,11 +62,11 @@ return (gc*)JnJVM_org_j3_bindings_Bindings_gcmalloc__ILorg_vmmagic_unboxed_ObjectReference_2(sz, VT); } -extern "C" void addFinalizationCandidate(void* obj) __attribute__((always_inline)); +extern "C" void addFinalizationCandidate(gc* obj) __attribute__((always_inline)); -extern "C" void addFinalizationCandidate(void* obj) { +extern "C" void addFinalizationCandidate(gc* obj) { llvm_gcroot(obj, 0); - mvm::Thread::get()->MyVM->addFinalizationCandidate((gc*)obj); + mvm::Thread::get()->MyVM->addFinalizationCandidate(obj); } extern "C" void* gcmallocUnresolved(uint32_t sz, VirtualTable* VT) { @@ -69,6 +77,23 @@ return res; } +extern "C" void arrayWriteBarrier(gc* ref, gc** ptr, gc* value) { + JnJVM_org_j3_bindings_Bindings_arrayWriteBarrier__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2( + ref, ptr, value); + if (mvm::Thread::get()->doYield) mvm::Collector::collect(); +} + +extern "C" void fieldWriteBarrier(gc* ref, gc** ptr, gc* value) { + JnJVM_org_j3_bindings_Bindings_fieldWriteBarrier__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2( + ref, ptr, value); + if (mvm::Thread::get()->doYield) mvm::Collector::collect(); +} + +extern "C" void nonHeapWriteBarrier(gc** ptr, gc* value) { + JnJVM_org_j3_bindings_Bindings_nonHeapWriteBarrier__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2(ptr, value); + if (mvm::Thread::get()->doYield) mvm::Collector::collect(); +} + void MutatorThread::init(Thread* _th) { MutatorThread* th = (MutatorThread*)_th; th->MutatorContext = @@ -156,16 +181,25 @@ } void Collector::objectReferenceWriteBarrier(gc* ref, gc** slot, gc* value) { - *slot = value; + fieldWriteBarrier(ref, slot, value); +} + +void Collector::objectReferenceArrayWriteBarrier(gc* ref, gc** slot, gc* value) { + arrayWriteBarrier(ref, slot, value); } void Collector::objectReferenceNonHeapWriteBarrier(gc** slot, gc* value) { - *slot = value; + nonHeapWriteBarrier(slot, value); +} + +bool Collector::objectReferenceTryCASBarrier(gc* ref, gc** slot, gc* old, gc* value) { + bool res = JnJVM_org_j3_bindings_Bindings_writeBarrierCAS__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_ObjectReference_2(ref, slot, old, value); + if (mvm::Thread::get()->doYield) mvm::Collector::collect(); + return res; } -bool Collector::objectReferenceTryCASBarrier(gc*ref, gc** slot, gc* old, gc* value) { - gc* res = __sync_val_compare_and_swap(slot, old, value); - return (old == res); +bool Collector::supportsWriteBarrier() { + return true; } //TODO: Remove these. Modified: vmkit/trunk/mmtk/mmtk-j3/Collection.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-j3/Collection.cpp?rev=121420&r1=121419&r2=121420&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-j3/Collection.cpp (original) +++ vmkit/trunk/mmtk/mmtk-j3/Collection.cpp Thu Dec 9 16:08:31 2010 @@ -36,7 +36,7 @@ // Verify that another collection is not happening. th->MyVM->rendezvous.startRV(); - if (th->doYield) { + if (th->MyVM->rendezvous.getInitiator() != NULL) { th->MyVM->rendezvous.cancelRV(); th->MyVM->rendezvous.join(); return; @@ -104,8 +104,16 @@ extern "C" void Java_org_j3_mmtk_Collection_reportPhysicalAllocationFailed__ (MMTkObject* C) { UNIMPLEMENTED(); } -extern "C" void Java_org_j3_mmtk_Collection_triggerAsyncCollection__I (MMTkObject* C, sint32 val) { UNIMPLEMENTED(); } -extern "C" void Java_org_j3_mmtk_Collection_noThreadsInGC__ (MMTkObject* C) { UNIMPLEMENTED(); } +extern "C" void Java_org_j3_mmtk_Collection_triggerAsyncCollection__I (MMTkObject* C, sint32 val) { + mvm::Thread::get()->doYield = true; +} + +extern "C" uint8_t Java_org_j3_mmtk_Collection_noThreadsInGC__ (MMTkObject* C) { + mvm::Thread* th = mvm::Thread::get(); + bool threadInGC = th->doYield; + return !threadInGC; +} + extern "C" void Java_org_j3_mmtk_Collection_requestMutatorFlush__ (MMTkObject* C) { UNIMPLEMENTED(); } } // namespace mmtk From nicolas.geoffray at lip6.fr Thu Dec 9 14:18:21 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Thu, 09 Dec 2010 22:18:21 -0000 Subject: [vmkit-commits] [vmkit] r121422 - /vmkit/trunk/www/use_mmtk.html Message-ID: <20101209221821.0FE5D2A6C12C@llvm.org> Author: geoffray Date: Thu Dec 9 16:18:20 2010 New Revision: 121422 URL: http://llvm.org/viewvc/llvm-project?rev=121422&view=rev Log: Add generational collectors. Modified: vmkit/trunk/www/use_mmtk.html Modified: vmkit/trunk/www/use_mmtk.html URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/www/use_mmtk.html?rev=121422&r1=121421&r2=121422&view=diff ============================================================================== --- vmkit/trunk/www/use_mmtk.html (original) +++ vmkit/trunk/www/use_mmtk.html Thu Dec 9 16:18:20 2010 @@ -34,6 +34,10 @@
    • org.mmtk.plan.copyms.CopyMS
    • org.mmtk.plan.semispace.SS
    • org.mmtk.plan.immix.Immix
    • +
    • org.mmtk.plan.generational.marksweep.GenMS
    • +
    • org.mmtk.plan.generational.copying.GenCopy
    • +
    • org.mmtk.plan.generational.immix.GenImmix
    • +
  • Build VMKit:
  • From nicolas.geoffray at lip6.fr Fri Dec 10 08:09:18 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Fri, 10 Dec 2010 16:09:18 -0000 Subject: [vmkit-commits] [vmkit] r121487 - in /vmkit/trunk: include/mvm/VirtualMachine.h lib/J3/Classpath/ClasspathReflect.h lib/J3/Classpath/JavaUpcalls.cpp lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/Mvm/CommonThread/CollectionRV.cpp lib/Mvm/CommonThread/ctthread.cpp lib/Mvm/Runtime/Object.cpp Message-ID: <20101210160918.A9A8C2A6C12C@llvm.org> Author: geoffray Date: Fri Dec 10 10:09:18 2010 New Revision: 121487 URL: http://llvm.org/viewvc/llvm-project?rev=121487&view=rev Log: Do not depend on finalizers to free thread stacks. Instead let the main native thread free them. Modified: vmkit/trunk/include/mvm/VirtualMachine.h vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h vmkit/trunk/lib/J3/Classpath/JavaUpcalls.cpp vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp vmkit/trunk/lib/J3/VMCore/Jnjvm.h vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp vmkit/trunk/lib/Mvm/Runtime/Object.cpp Modified: vmkit/trunk/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/VirtualMachine.h?rev=121487&r1=121486&r2=121487&view=diff ============================================================================== --- vmkit/trunk/include/mvm/VirtualMachine.h (original) +++ vmkit/trunk/include/mvm/VirtualMachine.h Fri Dec 10 10:09:18 2010 @@ -55,8 +55,10 @@ protected: VirtualMachine(mvm::BumpPtrAllocator &Alloc) : allocator(Alloc) { - mainThread = 0; - NumberOfThreads = 0; + mainThread = NULL; + numberOfThreads = 0; + doExit = false; + exitingThread = NULL; } virtual ~VirtualMachine() { @@ -79,11 +81,21 @@ /// NumberOfThreads - The number of threads that currently run under this VM. /// - uint32_t NumberOfThreads; + uint32_t numberOfThreads; /// ThreadLock - Lock to create or destroy a new thread. /// - mvm::SpinLock ThreadLock; + mvm::LockNormal threadLock; + + /// ThreadVar - Condition variable to wake up the thread manager. + mvm::Cond threadVar; + + /// exitingThread - Thread that is currently exiting. Used by the thread + /// manager to free the resources (stack) used by a thread. + mvm::Thread* exitingThread; + + /// doExit - Should the VM exit now? + bool doExit; /// setMainThread - Set the main thread of this VM. /// @@ -96,26 +108,41 @@ /// addThread - Add a new thread to the list of threads. /// void addThread(mvm::Thread* th) { - ThreadLock.lock(); - NumberOfThreads++; + threadLock.lock(); + numberOfThreads++; if (th != mainThread) { if (mainThread) th->append(mainThread); else mainThread = th; } - ThreadLock.unlock(); + threadLock.unlock(); } /// removeThread - Remove the thread from the list of threads. /// void removeThread(mvm::Thread* th) { - ThreadLock.lock(); - NumberOfThreads--; + threadLock.lock(); + while (exitingThread != NULL) { + // Make sure the thread manager had a chance to consume the previous + // dead thread. + threadLock.unlock(); + Thread::yield(); + threadLock.lock(); + } + numberOfThreads--; if (mainThread == th) mainThread = (Thread*)th->next(); th->remove(); - if (!NumberOfThreads) mainThread = 0; - ThreadLock.unlock(); + if (numberOfThreads == 0) mainThread = NULL; + exitingThread = th; + threadVar.signal(); + threadLock.unlock(); } + /// exit - Exit this virtual machine. + void exit(); + + /// waitForExit - Wait until the virtual machine stops its execution. + void waitForExit(); + //===----------------------------------------------------------------------===// // (2) GC-related methods. //===----------------------------------------------------------------------===// @@ -193,9 +220,6 @@ /// 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 Modified: vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h?rev=121487&r1=121486&r2=121487&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h (original) +++ vmkit/trunk/lib/J3/Classpath/ClasspathReflect.h Fri Dec 10 10:09:18 2010 @@ -150,11 +150,6 @@ JavaThread* vmdata; public: - static void staticDestructor(JavaObjectVMThread* obj) { - llvm_gcroot(obj, 0); - mvm::Thread::releaseThread(obj->vmdata); - } - static void staticTracer(JavaObjectVMThread* obj, uintptr_t closure) { mvm::Collector::markAndTrace(obj, &obj->thread, closure); } Modified: vmkit/trunk/lib/J3/Classpath/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/JavaUpcalls.cpp?rev=121487&r1=121486&r2=121487&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Classpath/JavaUpcalls.cpp (original) +++ vmkit/trunk/lib/J3/Classpath/JavaUpcalls.cpp Fri Dec 10 10:09:18 2010 @@ -518,11 +518,6 @@ JavaObjectVMThread::staticTracer(obj, closure); } -extern "C" void nativeJavaObjectVMThreadDestructor(JavaObjectVMThread* obj) { - llvm_gcroot(obj, 0); - JavaObjectVMThread::staticDestructor(obj); -} - extern "C" JavaString* Java_java_lang_VMSystem_getenv__Ljava_lang_String_2(JavaString* str) { JavaString* ret = 0; llvm_gcroot(str, 0); @@ -1018,11 +1013,6 @@ (uintptr_t)nativeJavaObjectVMThreadTracer, "nativeJavaObjectVMThreadTracer"); - newVMThread->getVirtualVT()->setNativeDestructor( - (uintptr_t)nativeJavaObjectVMThreadDestructor, - "nativeJavaObjectVMThreadDestructor"); - - newReference = UPCALL_CLASS(loader, "java/lang/ref/Reference"); EnqueueReference = Modified: vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=121487&r1=121486&r2=121487&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Fri Dec 10 10:09:18 2010 @@ -2123,12 +2123,7 @@ end: - vm->threadSystem.nonDaemonLock.lock(); - --(vm->threadSystem.nonDaemonThreads); - if (vm->threadSystem.nonDaemonThreads == 0) - vm->threadSystem.nonDaemonVar.signal(); - vm->threadSystem.nonDaemonLock.unlock(); - + vm->threadSystem.leave(); } void JavaAOTCompiler::compileFile(Jnjvm* vm, const char* n) { Modified: vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp?rev=121487&r1=121486&r2=121487&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp (original) +++ vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp Fri Dec 10 10:09:18 2010 @@ -1240,19 +1240,6 @@ } IGNORE; } -void Jnjvm::waitForExit() { - - threadSystem.nonDaemonLock.lock(); - - while (threadSystem.nonDaemonThreads) { - threadSystem.nonDaemonVar.wait(&threadSystem.nonDaemonLock); - } - - threadSystem.nonDaemonLock.unlock(); - - return; -} - void Jnjvm::mainJavaStart(JavaThread* thread) { JavaString* str = NULL; @@ -1315,7 +1302,7 @@ void ThreadSystem::leave() { nonDaemonLock.lock(); --nonDaemonThreads; - if (nonDaemonThreads == 0) nonDaemonVar.signal(); + if (nonDaemonThreads == 0) mvm::Thread::get()->MyVM->exit(); nonDaemonLock.unlock(); } Modified: vmkit/trunk/lib/J3/VMCore/Jnjvm.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Jnjvm.h?rev=121487&r1=121486&r2=121487&view=diff ============================================================================== --- vmkit/trunk/lib/J3/VMCore/Jnjvm.h (original) +++ vmkit/trunk/lib/J3/VMCore/Jnjvm.h Fri Dec 10 10:09:18 2010 @@ -59,15 +59,8 @@ /// nonDaemonLock - Protection lock for the nonDaemonThreads variable. /// - mvm::LockNormal nonDaemonLock; + mvm::SpinLock nonDaemonLock; - /// nonDaemonVar - Condition variable to wake up the initial thread when it - /// waits for other non-daemon threads to end. The non-daemon thread that - /// decrements the nonDaemonThreads variable to zero wakes up the initial - /// thread. - /// - mvm::Cond nonDaemonVar; - /// ThreadSystem - Allocates a thread system management, initializing the /// lock, the condition variable and setting the initial number of non /// daemon threads to one, for the initial thread. @@ -349,10 +342,6 @@ /// virtual void runApplication(int argc, char** argv); - /// waitForExit - Waits that there are no more non-daemon threads in this JVM. - /// - virtual void waitForExit(); - /// loadBootstrap - Bootstraps the JVM, getting the class loader, initializing /// bootstrap classes (e.g. java/lang/Class, java/lang/Exception) and /// mapping the initial thread. Modified: vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp?rev=121487&r1=121486&r2=121487&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp (original) +++ vmkit/trunk/lib/Mvm/CommonThread/CollectionRV.cpp Fri Dec 10 10:09:18 2010 @@ -20,9 +20,9 @@ void CollectionRV::another_mark() { mvm::Thread* th = mvm::Thread::get(); assert(th->getLastSP() != NULL); - assert(nbJoined < th->MyVM->NumberOfThreads); + assert(nbJoined < th->MyVM->numberOfThreads); nbJoined++; - if (nbJoined == th->MyVM->NumberOfThreads) { + if (nbJoined == th->MyVM->numberOfThreads) { condInitiator.broadcast(); } } @@ -41,7 +41,7 @@ // Add myself. nbJoined++; - while (nbJoined != self->MyVM->NumberOfThreads) { + while (nbJoined != self->MyVM->numberOfThreads) { condInitiator.wait(&_lockRV); } } @@ -51,7 +51,7 @@ mvm::Thread* self = mvm::Thread::get(); // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. - self->MyVM->ThreadLock.lock(); + self->MyVM->threadLock.lock(); mvm::Thread* cur = self; assert(initiator == NULL); @@ -94,7 +94,7 @@ mvm::Thread* self = mvm::Thread::get(); // Lock thread lock, so that we can traverse the thread list safely. This will // be released on finishRV. - self->MyVM->ThreadLock.lock(); + self->MyVM->threadLock.lock(); for (mvm::Thread* cur = (mvm::Thread*)self->next(); cur != self; cur = (mvm::Thread*)cur->next()) { @@ -204,9 +204,9 @@ cur = (mvm::Thread*)cur->next(); } while (cur != initiator); - assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); + assert(nbJoined == initiator->MyVM->numberOfThreads && "Inconsistent state"); nbJoined = 0; - initiator->MyVM->ThreadLock.unlock(); + initiator->MyVM->threadLock.unlock(); condEndRV.broadcast(); initiator = NULL; unlockRV(); @@ -216,9 +216,9 @@ void UncooperativeCollectionRV::finishRV() { lockRV(); mvm::Thread* initiator = mvm::Thread::get(); - assert(nbJoined == initiator->MyVM->NumberOfThreads && "Inconsistent state"); + assert(nbJoined == initiator->MyVM->numberOfThreads && "Inconsistent state"); nbJoined = 0; - initiator->MyVM->ThreadLock.unlock(); + initiator->MyVM->threadLock.unlock(); condEndRV.broadcast(); unlockRV(); initiator->inRV = false; Modified: vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp?rev=121487&r1=121486&r2=121487&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp (original) +++ vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Fri Dec 10 10:09:18 2010 @@ -446,17 +446,8 @@ void* Thread::operator new(size_t sz) { assert(sz < (size_t)getpagesize() && "Thread local data too big"); void* res = (void*)TheStackManager.allocate(); - // Give it a second chance. - if (res == NULL) { - Collector::collect(); - // Wait for the finalizer to have cleaned up the threads. - while (res == NULL) { - mvm::Thread::yield(); - res = (void*)TheStackManager.allocate(); - } - } // Make sure the thread information is cleared. - memset(res, 0, sz); + if (res != NULL) memset(res, 0, sz); return res; } Modified: vmkit/trunk/lib/Mvm/Runtime/Object.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/Object.cpp?rev=121487&r1=121486&r2=121487&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/Runtime/Object.cpp (original) +++ vmkit/trunk/lib/Mvm/Runtime/Object.cpp Fri Dec 10 10:09:18 2010 @@ -13,6 +13,7 @@ #include "MvmGC.h" #include "mvm/Object.h" #include "mvm/PrintBuffer.h" +#include "mvm/VirtualMachine.h" using namespace mvm; @@ -54,3 +55,25 @@ buf->writePtr((void*)o); buf->write(">"); } + +void VirtualMachine::waitForExit() { + threadLock.lock(); + + while (!doExit) { + threadVar.wait(&threadLock); + if (exitingThread != NULL) { + Thread* th = exitingThread; + exitingThread = NULL; + mvm::Thread::releaseThread(th); + } + } + + threadLock.unlock(); +} + +void VirtualMachine::exit() { + doExit = true; + threadLock.lock(); + threadVar.signal(); + threadLock.unlock(); +} From nicolas.geoffray at lip6.fr Fri Dec 10 09:11:57 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Fri, 10 Dec 2010 17:11:57 -0000 Subject: [vmkit-commits] [vmkit] r121492 - in /vmkit/trunk: lib/J3/Compiler/JavaJIT.cpp lib/J3/Compiler/JavaJITOpcodes.cpp lib/Mvm/GCMmap2/MvmGC.h lib/Mvm/MMTk/MvmGC.cpp lib/Mvm/MMTk/MvmGC.h mmtk/java/src/org/j3/bindings/Bindings.java mmtk/mmtk-alloc/Selected.cpp Message-ID: <20101210171157.853442A6C12C@llvm.org> Author: geoffray Date: Fri Dec 10 11:11:57 2010 New Revision: 121492 URL: http://llvm.org/viewvc/llvm-project?rev=121492&view=rev Log: Rename to needsWriteBarrier and needsNonHeapWriteBarrier. Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp vmkit/trunk/lib/Mvm/MMTk/MvmGC.h vmkit/trunk/mmtk/java/src/org/j3/bindings/Bindings.java vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=121492&r1=121491&r2=121492&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Fri Dec 10 11:11:57 2010 @@ -2067,7 +2067,7 @@ convertValue(val, type, currentBlock, false); } - if (mvm::Collector::supportsWriteBarrier() && type == intrinsics->JavaObjectType) { + if (mvm::Collector::needsNonHeapWriteBarrier() && type == intrinsics->JavaObjectType) { ptr = new BitCastInst(ptr, intrinsics->ptrPtrType, "", currentBlock); val = new BitCastInst(val, intrinsics->ptrType, "", currentBlock); Value* args[2] = { ptr, val }; @@ -2174,7 +2174,7 @@ convertValue(val, type, currentBlock, false); } - if (mvm::Collector::supportsWriteBarrier() && type == intrinsics->JavaObjectType) { + if (mvm::Collector::needsWriteBarrier() && type == intrinsics->JavaObjectType) { ptr = new BitCastInst(ptr, intrinsics->ptrPtrType, "", currentBlock); val = new BitCastInst(val, intrinsics->ptrType, "", currentBlock); object = new LoadInst(object, "", currentBlock); Modified: vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=121492&r1=121491&r2=121492&view=diff ============================================================================== --- vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp (original) +++ vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Fri Dec 10 11:11:57 2010 @@ -721,7 +721,7 @@ Value* obj = pop(); Value* ptr = verifyAndComputePtr(obj, index, intrinsics->JavaArrayObjectType); - if (mvm::Collector::supportsWriteBarrier()) { + if (mvm::Collector::needsWriteBarrier()) { ptr = new BitCastInst(ptr, intrinsics->ptrPtrType, "", currentBlock); val = new BitCastInst(val, intrinsics->ptrType, "", currentBlock); obj = new BitCastInst(obj, intrinsics->ptrType, "", currentBlock); Modified: vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h?rev=121492&r1=121491&r2=121492&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h (original) +++ vmkit/trunk/lib/Mvm/GCMmap2/MvmGC.h Fri Dec 10 11:11:57 2010 @@ -376,7 +376,11 @@ return (res == old); } - static bool supportsWriteBarrier() { + static bool needsWriteBarrier() { + return false; + } + + static bool needsNonHeapWriteBarrier() { return false; } }; Modified: vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp?rev=121492&r1=121491&r2=121492&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp (original) +++ vmkit/trunk/lib/Mvm/MMTk/MvmGC.cpp Fri Dec 10 11:11:57 2010 @@ -146,6 +146,10 @@ void Collector::initialise() { } -bool Collector::supportsWriteBarrier() { +bool Collector::needsWriteBarrier() { + return false; +} + +bool Collector::needsNonHeapWriteBarrier() { return false; } Modified: vmkit/trunk/lib/Mvm/MMTk/MvmGC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/MMTk/MvmGC.h?rev=121492&r1=121491&r2=121492&view=diff ============================================================================== --- vmkit/trunk/lib/Mvm/MMTk/MvmGC.h (original) +++ vmkit/trunk/lib/Mvm/MMTk/MvmGC.h Fri Dec 10 11:11:57 2010 @@ -80,7 +80,8 @@ static void objectReferenceArrayWriteBarrier(gc* ref, gc** slot, gc* value) __attribute__ ((always_inline)); static void objectReferenceNonHeapWriteBarrier(gc** slot, gc* value) __attribute__ ((always_inline)); static bool objectReferenceTryCASBarrier(gc* ref, gc** slot, gc* old, gc* value) __attribute__ ((always_inline)); - static bool supportsWriteBarrier(); + static bool needsWriteBarrier() __attribute__ ((always_inline)); + static bool needsNonHeapWriteBarrier() __attribute__ ((always_inline)); static void collect(); Modified: vmkit/trunk/mmtk/java/src/org/j3/bindings/Bindings.java URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/java/src/org/j3/bindings/Bindings.java?rev=121492&r1=121491&r2=121492&view=diff ============================================================================== --- vmkit/trunk/mmtk/java/src/org/j3/bindings/Bindings.java (original) +++ vmkit/trunk/mmtk/java/src/org/j3/bindings/Bindings.java Fri Dec 10 11:11:57 2010 @@ -154,4 +154,14 @@ return slot.attempt(old.toAddress().toWord(), value.toAddress().toWord()); } } + + @Inline + private static boolean needsWriteBarrier() { + return Selected.Constraints.get().needsObjectReferenceWriteBarrier(); + } + + @Inline + private static boolean needsNonHeapWriteBarrier() { + return Selected.Constraints.get().needsObjectReferenceNonHeapWriteBarrier(); + } } Modified: vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp?rev=121492&r1=121491&r2=121492&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp (original) +++ vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp Fri Dec 10 11:11:57 2010 @@ -198,8 +198,15 @@ return res; } -bool Collector::supportsWriteBarrier() { - return true; +extern "C" uint8_t JnJVM_org_j3_bindings_Bindings_needsWriteBarrier__() ALWAYS_INLINE; +extern "C" uint8_t JnJVM_org_j3_bindings_Bindings_needsNonHeapWriteBarrier__() ALWAYS_INLINE; + +bool Collector::needsWriteBarrier() { + return JnJVM_org_j3_bindings_Bindings_needsWriteBarrier__(); +} + +bool Collector::needsNonHeapWriteBarrier() { + return JnJVM_org_j3_bindings_Bindings_needsNonHeapWriteBarrier__(); } //TODO: Remove these. From gael.thomas at lip6.fr Sat Dec 11 03:00:03 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sat, 11 Dec 2010 11:00:03 -0000 Subject: [vmkit-commits] [vmkit] r121610 - in /vmkit/branches/multi-vm: Makefile.config.in autoconf/configure.ac configure find-it.sh include/mvm/GC.h include/mvm/SystemThreads.h include/mvm/Threads/Locks.h include/mvm/VMKit.h include/mvm/VirtualMachine.h lib/J3/Classpath/JavaUpcalls.cpp lib/Mvm/Runtime/SystemThreads.cpp lib/Mvm/Runtime/VMKit.cpp tools/Makefile tools/toy-vm/ Message-ID: <20101211110003.719752A6C12C@llvm.org> Author: gthomas Date: Sat Dec 11 05:00:03 2010 New Revision: 121610 URL: http://llvm.org/viewvc/llvm-project?rev=121610&view=rev Log: remove toy-vm, move llvm_gcroot in GC.H, lazily allocate reference and finalizerThread Removed: vmkit/branches/multi-vm/tools/toy-vm/ Modified: vmkit/branches/multi-vm/Makefile.config.in vmkit/branches/multi-vm/autoconf/configure.ac vmkit/branches/multi-vm/configure vmkit/branches/multi-vm/find-it.sh vmkit/branches/multi-vm/include/mvm/GC.h vmkit/branches/multi-vm/include/mvm/SystemThreads.h vmkit/branches/multi-vm/include/mvm/Threads/Locks.h vmkit/branches/multi-vm/include/mvm/VMKit.h vmkit/branches/multi-vm/include/mvm/VirtualMachine.h vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp vmkit/branches/multi-vm/tools/Makefile Modified: vmkit/branches/multi-vm/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/Makefile.config.in?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/Makefile.config.in (original) +++ vmkit/branches/multi-vm/Makefile.config.in Sat Dec 11 05:00:03 2010 @@ -13,6 +13,5 @@ MMTK_PLAN_HEADER = @MMTK_PLAN_HEADER@ WITH_64 = @WITH_64@ WITH_LLVM_GCC = @WITH_LLVM_GCC@ -WITH_TOY = @WITH_TOY@ ANT = @ANT@ Modified: vmkit/branches/multi-vm/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/autoconf/configure.ac?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/autoconf/configure.ac (original) +++ vmkit/branches/multi-vm/autoconf/configure.ac Sat Dec 11 05:00:03 2010 @@ -422,18 +422,6 @@ AC_SUBST([WITH_N3]) -dnl ************************************************************************** -dnl toy vm -dnl ************************************************************************** -AC_ARG_WITH(toy, - [AS_HELP_STRING(--with-toy=yes|no, - [Build the toy virtual machine (default is yes)])], - [[WITH_TOY=$withval]], - [[WITH_TOY=yes]] -) - -AC_SUBST([WITH_TOY]) - dnl===-----------------------------------------------------------------------=== dnl=== dnl=== SECTION 4: Check for programs we need and that they are the right version Modified: vmkit/branches/multi-vm/configure URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/configure?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/configure (original) +++ vmkit/branches/multi-vm/configure Sat Dec 11 05:00:03 2010 @@ -667,7 +667,6 @@ ac_ct_CXX CXXFLAGS CXX -WITH_TOY WITH_N3 monopath WITH_N3_MONO @@ -775,7 +774,6 @@ with_pnet_local_prefix with_pnetlib with_mono -with_toy ' ac_precious_vars='build_alias host_alias @@ -1440,7 +1438,6 @@ Pnetlib's mscorlib.dll location (default is /usr/lib/cscc/lib/) --with-mono=something Mono's mscorlib.dll location (no default) - --with-toy=yes|no Build the toy virtual machine (default is yes) Some influential environment variables: CC C compiler command @@ -4317,18 +4314,6 @@ -# Check whether --with-toy was given. -if test "${with_toy+set}" = set; then - withval=$with_toy; WITH_TOY=$withval -else - WITH_TOY=yes - -fi - - - - - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' Modified: vmkit/branches/multi-vm/find-it.sh URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/find-it.sh?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/find-it.sh (original) +++ vmkit/branches/multi-vm/find-it.sh Sat Dec 11 05:00:03 2010 @@ -6,6 +6,6 @@ else - grep -w --exclude find-it.sh --exclude-dir IJvm --exclude-dir Isolate --exclude *.txt --exclude-dir autoconf --exclude config.status --exclude config.log --exclude configure --exclude *.xml --exclude *.html --exclude *.jar --exclude *.bc --exclude MMTkInline.inc --exclude-dir patches --exclude-dir N3 --exclude *.java --exclude *.class -R --exclude-dir .svn --exclude-dir Release --exclude *.s "$1" . + grep --exclude find-it.sh --exclude-dir IJvm --exclude-dir Isolate --exclude *.txt --exclude-dir autoconf --exclude config.status --exclude config.log --exclude configure --exclude *.xml --exclude *.html --exclude *.jar --exclude *.bc --exclude MMTkInline.inc --exclude-dir patches --exclude-dir N3 --exclude *.java --exclude *.class -R --exclude-dir .svn --exclude-dir Release --exclude *.s "$1" . fi \ No newline at end of file Modified: vmkit/branches/multi-vm/include/mvm/GC.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/GC.h?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/GC.h (original) +++ vmkit/branches/multi-vm/include/mvm/GC.h Sat Dec 11 05:00:03 2010 @@ -14,6 +14,13 @@ #include #include "ObjectHeader.h" +#ifdef WITH_LLVM_GCC +extern "C" void __llvm_gcroot(void**, void*) __attribute__((nothrow)); +#define llvm_gcroot(a, b) __llvm_gcroot((void**)&a, b) +#else +#define llvm_gcroot(a, b) +#endif + namespace mvm { class VirtualMachine; Modified: vmkit/branches/multi-vm/include/mvm/SystemThreads.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/SystemThreads.h?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/SystemThreads.h (original) +++ vmkit/branches/multi-vm/include/mvm/SystemThreads.h Sat Dec 11 05:00:03 2010 @@ -42,25 +42,7 @@ delete[] References; } - void addReference(mvm::gc* ref) { - llvm_gcroot(ref, 0); - QueueLock.acquire(); - if (CurrentIndex >= QueueLength) { - uint32 newLength = QueueLength * GROW_FACTOR; - mvm::gc** newQueue = new mvm::gc*[newLength]; - memset(newQueue, 0, newLength * sizeof(mvm::gc*)); - 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 addReference(mvm::gc* ref); void acquire() { QueueLock.acquire(); @@ -103,24 +85,15 @@ /// addWeakReference - Add a weak reference to the queue. /// - void addWeakReference(mvm::gc* ref) { - llvm_gcroot(ref, 0); - WeakReferencesQueue.addReference(ref); - } + void addWeakReference(mvm::gc* ref); /// addSoftReference - Add a weak reference to the queue. /// - void addSoftReference(mvm::gc* ref) { - llvm_gcroot(ref, 0); - SoftReferencesQueue.addReference(ref); - } + void addSoftReference(mvm::gc* ref); /// addPhantomReference - Add a weak reference to the queue. /// - void addPhantomReference(mvm::gc* ref) { - llvm_gcroot(ref, 0); - PhantomReferencesQueue.addReference(ref); - } + void addPhantomReference(mvm::gc* ref); ReferenceThread(mvm::VMKit* vmkit); Modified: vmkit/branches/multi-vm/include/mvm/Threads/Locks.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Locks.h?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/Threads/Locks.h (original) +++ vmkit/branches/multi-vm/include/mvm/Threads/Locks.h Sat Dec 11 05:00:03 2010 @@ -17,13 +17,6 @@ #include "ObjectHeader.h" #include "mvm/Threads/Thread.h" -#ifdef WITH_LLVM_GCC -extern "C" void __llvm_gcroot(void**, void*) __attribute__((nothrow)); -#define llvm_gcroot(a, b) __llvm_gcroot((void**)&a, b) -#else -#define llvm_gcroot(a, b) -#endif - namespace mvm { class gc; Modified: vmkit/branches/multi-vm/include/mvm/VMKit.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VMKit.h?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VMKit.h (original) +++ vmkit/branches/multi-vm/include/mvm/VMKit.h Sat Dec 11 05:00:03 2010 @@ -92,7 +92,7 @@ VMKit(mvm::BumpPtrAllocator &Alloc); - LockNormal _vmkitLock; + LockRecursive _vmkitLock; void vmkitLock() { _vmkitLock.lock(); } void vmkitUnlock() { _vmkitLock.unlock(); } @@ -148,23 +148,45 @@ UncooperativeCollectionRV rendezvous; #endif +private: /// enqueueThread - The thread that finalizes references. /// FinalizerThread* finalizerThread; /// enqueueThread - The thread that enqueues references. /// - ReferenceThread* referenceThread; + ReferenceThread* referenceThread; - /// scanFinalizationQueue - Scan objets with a finalized method and schedule - /// them for finalization if they are not live. - /// - void scanFinalizationQueue(uintptr_t closure); + /// getAndAllocateFinalizerThread - get the finalizer thread and allocate it if it does not exist + /// + FinalizerThread* getAndAllocateFinalizerThread(); + + /// getAndAllocateReferenceThread - get the reference thread and allocate it if it does not exist + /// + ReferenceThread* getAndAllocateReferenceThread(); + +public: + /// addWeakReference - Add a weak reference to the queue. + /// + void addWeakReference(mvm::gc* ref); + + /// addSoftReference - Add a weak reference to the queue. + /// + void addSoftReference(mvm::gc* ref); + + /// addPhantomReference - Add a weak reference to the queue. + /// + void addPhantomReference(mvm::gc* ref); /// addFinalizationCandidate - Add an object to the queue of objects with /// a finalization method. /// void addFinalizationCandidate(gc* object); + + /// scanFinalizationQueue - Scan objets with a finalized method and schedule + /// them for finalization if they are not live. + /// + void scanFinalizationQueue(uintptr_t closure); /// scanWeakReferencesQueue - Scan all weak references. Called by the GC /// before scanning the finalization queue. Modified: vmkit/branches/multi-vm/include/mvm/VirtualMachine.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/VirtualMachine.h?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/include/mvm/VirtualMachine.h (original) +++ vmkit/branches/multi-vm/include/mvm/VirtualMachine.h Sat Dec 11 05:00:03 2010 @@ -77,7 +77,7 @@ /// finalizeObject - invoke the finalizer of a java object /// - virtual void finalizeObject(mvm::gc* obj) {} + virtual void finalizeObject(mvm::gc* obj) = 0; /// getReferentPtr - return the referent of a reference /// Modified: vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp (original) +++ vmkit/branches/multi-vm/lib/J3/Classpath/JavaUpcalls.cpp Sat Dec 11 05:00:03 2010 @@ -120,7 +120,7 @@ BEGIN_NATIVE_EXCEPTION(0) JavaObjectReference::init(reference, referent, 0); - mvm::Thread::get()->vmkit->referenceThread->addWeakReference(reference); + mvm::Thread::get()->vmkit->addWeakReference(reference); END_NATIVE_EXCEPTION @@ -137,7 +137,7 @@ BEGIN_NATIVE_EXCEPTION(0) JavaObjectReference::init(reference, referent, queue); - mvm::Thread::get()->vmkit->referenceThread->addWeakReference(reference); + mvm::Thread::get()->vmkit->addWeakReference(reference); END_NATIVE_EXCEPTION @@ -151,7 +151,7 @@ BEGIN_NATIVE_EXCEPTION(0) JavaObjectReference::init(reference, referent, 0); - mvm::Thread::get()->vmkit->referenceThread->addSoftReference(reference); + mvm::Thread::get()->vmkit->addSoftReference(reference); END_NATIVE_EXCEPTION @@ -168,7 +168,7 @@ BEGIN_NATIVE_EXCEPTION(0) JavaObjectReference::init(reference, referent, queue); - mvm::Thread::get()->vmkit->referenceThread->addSoftReference(reference); + mvm::Thread::get()->vmkit->addSoftReference(reference); END_NATIVE_EXCEPTION @@ -185,7 +185,7 @@ BEGIN_NATIVE_EXCEPTION(0) JavaObjectReference::init(reference, referent, queue); - mvm::Thread::get()->vmkit->referenceThread->addPhantomReference(reference); + mvm::Thread::get()->vmkit->addPhantomReference(reference); END_NATIVE_EXCEPTION } Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/SystemThreads.cpp Sat Dec 11 05:00:03 2010 @@ -17,6 +17,21 @@ setDaemon(); } +void ReferenceThread::addWeakReference(mvm::gc* ref) { + llvm_gcroot(ref, 0); + WeakReferencesQueue.addReference(ref); +} + +void ReferenceThread::addSoftReference(mvm::gc* ref) { + llvm_gcroot(ref, 0); + SoftReferencesQueue.addReference(ref); +} + +void ReferenceThread::addPhantomReference(mvm::gc* ref) { + llvm_gcroot(ref, 0); + PhantomReferencesQueue.addReference(ref); +} + mvm::gc** getReferent(mvm::gc* obj) { llvm_gcroot(obj, 0); mvm::VirtualMachine* vm = obj->getVirtualTable()->vm; @@ -89,6 +104,26 @@ ToEnqueue[ToEnqueueIndex++] = obj; } +void ReferenceQueue::addReference(mvm::gc* ref) { + llvm_gcroot(ref, 0); + QueueLock.acquire(); + if (CurrentIndex >= QueueLength) { + uint32 newLength = QueueLength * GROW_FACTOR; + mvm::gc** newQueue = new mvm::gc*[newLength]; + memset(newQueue, 0, newLength * sizeof(mvm::gc*)); + 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(); +} + mvm::gc* ReferenceQueue::processReference(mvm::gc* reference, ReferenceThread* th, uintptr_t closure) { if (!mvm::Collector::isLive(reference, closure)) { setReferent(reference, 0); Modified: vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp (original) +++ vmkit/branches/multi-vm/lib/Mvm/Runtime/VMKit.cpp Sat Dec 11 05:00:03 2010 @@ -30,34 +30,70 @@ vms = 0; vmsArraySize = 0; - - // First create system threads. - finalizerThread = new FinalizerThread(this); - finalizerThread->start((void (*)(mvm::Thread*))FinalizerThread::finalizerStart); - - referenceThread = new ReferenceThread(this); - referenceThread->start((void (*)(mvm::Thread*))ReferenceThread::enqueueStart); } void VMKit::scanWeakReferencesQueue(uintptr_t closure) { - referenceThread->WeakReferencesQueue.scan(referenceThread, closure); + if(referenceThread) + referenceThread->WeakReferencesQueue.scan(referenceThread, closure); } void VMKit::scanSoftReferencesQueue(uintptr_t closure) { - referenceThread->SoftReferencesQueue.scan(referenceThread, closure); + if(referenceThread) + referenceThread->SoftReferencesQueue.scan(referenceThread, closure); } void VMKit::scanPhantomReferencesQueue(uintptr_t closure) { - referenceThread->PhantomReferencesQueue.scan(referenceThread, closure); + if(referenceThread) + referenceThread->PhantomReferencesQueue.scan(referenceThread, closure); } void VMKit::scanFinalizationQueue(uintptr_t closure) { - finalizerThread->scanFinalizationQueue(closure); + if(finalizerThread) + finalizerThread->scanFinalizationQueue(closure); +} + +FinalizerThread* VMKit::getAndAllocateFinalizerThread() { + if(!finalizerThread) { + vmkitLock(); + if(!finalizerThread) { + finalizerThread = new FinalizerThread(this); + finalizerThread->start((void (*)(mvm::Thread*))FinalizerThread::finalizerStart); + } + vmkitUnlock(); + } + return finalizerThread; +} + +ReferenceThread* VMKit::getAndAllocateReferenceThread() { + if(!referenceThread) { + vmkitLock(); + if(!referenceThread) { + referenceThread = new ReferenceThread(this); + referenceThread->start((void (*)(mvm::Thread*))ReferenceThread::enqueueStart); + } + vmkitUnlock(); + } + return referenceThread; } void VMKit::addFinalizationCandidate(mvm::gc* object) { llvm_gcroot(object, 0); - finalizerThread->addFinalizationCandidate(object); + getAndAllocateFinalizerThread()->addFinalizationCandidate(object); +} + +void VMKit::addWeakReference(mvm::gc* ref) { + llvm_gcroot(ref, 0); + getAndAllocateReferenceThread()->addWeakReference(ref); +} + +void VMKit::addSoftReference(mvm::gc* ref) { + llvm_gcroot(ref, 0); + getAndAllocateReferenceThread()->addSoftReference(ref); +} + +void VMKit::addPhantomReference(mvm::gc* ref) { + llvm_gcroot(ref, 0); + getAndAllocateReferenceThread()->addPhantomReference(ref); } void VMKit::tracer(uintptr_t closure) { @@ -82,11 +118,14 @@ // Lock thread lock, so that we can traverse the vm and thread lists safely. This will be released on finishRV. vmkitLock(); - finalizerThread->FinalizationQueueLock.acquire(); - referenceThread->ToEnqueueLock.acquire(); - referenceThread->SoftReferencesQueue.acquire(); - referenceThread->WeakReferencesQueue.acquire(); - referenceThread->PhantomReferencesQueue.acquire(); + if(finalizerThread) + finalizerThread->FinalizationQueueLock.acquire(); + if(referenceThread) { + referenceThread->ToEnqueueLock.acquire(); + referenceThread->SoftReferencesQueue.acquire(); + referenceThread->WeakReferencesQueue.acquire(); + referenceThread->PhantomReferencesQueue.acquire(); + } // call first startCollection on each vm to avoid deadlock. // indeed, a vm could want to execute applicative code @@ -109,13 +148,18 @@ if(vms[i]) vms[i]->endCollection(); - finalizerThread->FinalizationQueueLock.release(); - referenceThread->ToEnqueueLock.release(); - referenceThread->SoftReferencesQueue.release(); - referenceThread->WeakReferencesQueue.release(); - referenceThread->PhantomReferencesQueue.release(); - referenceThread->EnqueueCond.broadcast(); - finalizerThread->FinalizationCond.broadcast(); + if(finalizerThread) { + finalizerThread->FinalizationQueueLock.release(); + finalizerThread->FinalizationCond.broadcast(); + } + + if(referenceThread) { + referenceThread->ToEnqueueLock.release(); + referenceThread->SoftReferencesQueue.release(); + referenceThread->WeakReferencesQueue.release(); + referenceThread->PhantomReferencesQueue.release(); + referenceThread->EnqueueCond.broadcast(); + } vmkitUnlock(); } Modified: vmkit/branches/multi-vm/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/tools/Makefile?rev=121610&r1=121609&r2=121610&view=diff ============================================================================== --- vmkit/branches/multi-vm/tools/Makefile (original) +++ vmkit/branches/multi-vm/tools/Makefile Sat Dec 11 05:00:03 2010 @@ -26,9 +26,5 @@ PARALLEL_DIRS += n3-pnetlib endif -ifeq ($(WITH_J3), 1) - PARALLEL_DIRS += #toy-vm -endif - include $(LEVEL)/Makefile.common From gael.thomas at lip6.fr Sat Dec 11 03:06:37 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sat, 11 Dec 2010 11:06:37 -0000 Subject: [vmkit-commits] [vmkit] r121611 - /vmkit/branches/py-vm/ Message-ID: <20101211110637.84B2C2A6C12C@llvm.org> Author: gthomas Date: Sat Dec 11 05:06:37 2010 New Revision: 121611 URL: http://llvm.org/viewvc/llvm-project?rev=121611&view=rev Log: new branch to build the python vm Added: vmkit/branches/py-vm/ (props changed) - copied from r121610, vmkit/branches/multi-vm/ Propchange: vmkit/branches/py-vm/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Sat Dec 11 05:06:37 2010 @@ -0,0 +1,14 @@ +do-find +Makefile.config +replace.sh +config.log +*.tmp +Release +do-conf +configure.out +config.status +Makefile.common +Release-Asserts +Debug +scratch + Propchange: vmkit/branches/py-vm/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Sat Dec 11 05:06:37 2010 @@ -0,0 +1,3 @@ +/vmkit/branches/precise:112509-120199 +/vmkit/branches/release_028:115466-116298 +/vmkit/trunk:120068-120292,120425-120456 From nicolas.geoffray at lip6.fr Sat Dec 11 03:19:09 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sat, 11 Dec 2010 11:19:09 -0000 Subject: [vmkit-commits] [vmkit] r121612 - in /vmkit/trunk: Makefile.rules mmtk/inline/InlineMethods.cpp mmtk/inline/Makefile mmtk/mmtk-alloc/Selected.cpp Message-ID: <20101211111909.8CF002A6C12C@llvm.org> Author: geoffray Date: Sat Dec 11 05:19:09 2010 New Revision: 121612 URL: http://llvm.org/viewvc/llvm-project?rev=121612&view=rev Log: Put the code to inline write barriers, but disable reading the write barriers llvm generated files: the llvm-cpp tool is not robust enough to support multiple functions. Modified: vmkit/trunk/Makefile.rules vmkit/trunk/mmtk/inline/InlineMethods.cpp vmkit/trunk/mmtk/inline/Makefile vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp Modified: vmkit/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.rules?rev=121612&r1=121611&r2=121612&view=diff ============================================================================== --- vmkit/trunk/Makefile.rules (original) +++ vmkit/trunk/Makefile.rules Sat Dec 11 05:19:09 2010 @@ -140,7 +140,10 @@ $(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 - $(Verb) $(LLC) -march=cpp -cppgen=function -cppfor=gcmalloc $(LibDir)/FinalMMTk.bc -o $(PROJ_SRC_ROOT)/mmtk/inline/MMTkInline.inc + $(Verb) $(LLC) -march=cpp -cppgen=function -cppfor=gcmalloc $(LibDir)/FinalMMTk.bc -o $(PROJ_SRC_ROOT)/mmtk/inline/MMTkMallocInline.inc + $(Verb) $(LLC) -march=cpp -cppgen=function -cppfor=fieldWriteBarrier $(LibDir)/FinalMMTk.bc -o $(PROJ_SRC_ROOT)/mmtk/inline/MMTkFieldWriteInline.inc + $(Verb) $(LLC) -march=cpp -cppgen=function -cppfor=arrayWriteBarrier $(LibDir)/FinalMMTk.bc -o $(PROJ_SRC_ROOT)/mmtk/inline/MMTkArrayWriteInline.inc + $(Verb) $(LLC) -march=cpp -cppgen=function -cppfor=nonHeapWriteBarrier $(LibDir)/FinalMMTk.bc -o $(PROJ_SRC_ROOT)/mmtk/inline/MMTkNonHeapWriteInline.inc endif endif Modified: vmkit/trunk/mmtk/inline/InlineMethods.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/inline/InlineMethods.cpp?rev=121612&r1=121611&r2=121612&view=diff ============================================================================== --- vmkit/trunk/mmtk/inline/InlineMethods.cpp (original) +++ vmkit/trunk/mmtk/inline/InlineMethods.cpp Sat Dec 11 05:19:09 2010 @@ -19,12 +19,27 @@ namespace mmtk { -namespace mmtk_runtime { - #include "MMTkInline.inc" +namespace mmtk_malloc { + #include "MMTkMallocInline.inc" +} + +namespace mmtk_array_write { + #include "MMTkArrayWriteInline.inc" +} + +namespace mmtk_field_write { + #include "MMTkFieldWriteInline.inc" +} + +namespace mmtk_non_heap_write { + #include "MMTkNonHeapWriteInline.inc" } extern "C" void MMTk_InlineMethods(llvm::Module* module) { - mmtk_runtime::makeLLVMFunction(module); + mmtk_malloc::makeLLVMFunction(module); + //mmtk_field_write::makeLLVMFunction(module); + //mmtk_array_write::makeLLVMFunction(module); + //mmtk_non_heap_write::makeLLVMFunction(module); } } Modified: vmkit/trunk/mmtk/inline/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/inline/Makefile?rev=121612&r1=121611&r2=121612&view=diff ============================================================================== --- vmkit/trunk/mmtk/inline/Makefile (original) +++ vmkit/trunk/mmtk/inline/Makefile Sat Dec 11 05:19:09 2010 @@ -14,3 +14,6 @@ include $(LEVEL)/Makefile.common +# Use CompileCommonOpts instead of CXX.Flags to make sure the flag is added +# after the -Wall added by LLVM. +CompileCommonOpts += -Wno-unused-variable Modified: vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp?rev=121612&r1=121611&r2=121612&view=diff ============================================================================== --- vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp (original) +++ vmkit/trunk/mmtk/mmtk-alloc/Selected.cpp Sat Dec 11 05:19:09 2010 @@ -77,20 +77,20 @@ return res; } -extern "C" void arrayWriteBarrier(gc* ref, gc** ptr, gc* value) { +extern "C" void arrayWriteBarrier(void* ref, void** ptr, void* value) { JnJVM_org_j3_bindings_Bindings_arrayWriteBarrier__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2( - ref, ptr, value); + (gc*)ref, (gc**)ptr, (gc*)value); if (mvm::Thread::get()->doYield) mvm::Collector::collect(); } -extern "C" void fieldWriteBarrier(gc* ref, gc** ptr, gc* value) { +extern "C" void fieldWriteBarrier(void* ref, void** ptr, void* value) { JnJVM_org_j3_bindings_Bindings_fieldWriteBarrier__Lorg_vmmagic_unboxed_ObjectReference_2Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2( - ref, ptr, value); + (gc*)ref, (gc**)ptr, (gc*)value); if (mvm::Thread::get()->doYield) mvm::Collector::collect(); } -extern "C" void nonHeapWriteBarrier(gc** ptr, gc* value) { - JnJVM_org_j3_bindings_Bindings_nonHeapWriteBarrier__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2(ptr, value); +extern "C" void nonHeapWriteBarrier(void** ptr, void* value) { + JnJVM_org_j3_bindings_Bindings_nonHeapWriteBarrier__Lorg_vmmagic_unboxed_Address_2Lorg_vmmagic_unboxed_ObjectReference_2((gc**)ptr, (gc*)value); if (mvm::Thread::get()->doYield) mvm::Collector::collect(); } @@ -181,15 +181,15 @@ } void Collector::objectReferenceWriteBarrier(gc* ref, gc** slot, gc* value) { - fieldWriteBarrier(ref, slot, value); + fieldWriteBarrier((void*)ref, (void**)slot, (void*)value); } void Collector::objectReferenceArrayWriteBarrier(gc* ref, gc** slot, gc* value) { - arrayWriteBarrier(ref, slot, value); + arrayWriteBarrier((void*)ref, (void**)slot, (void*)value); } void Collector::objectReferenceNonHeapWriteBarrier(gc** slot, gc* value) { - nonHeapWriteBarrier(slot, value); + nonHeapWriteBarrier((void**)slot, (void*)value); } bool Collector::objectReferenceTryCASBarrier(gc* ref, gc** slot, gc* old, gc* value) { From gael.thomas at lip6.fr Sat Dec 11 04:02:46 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sat, 11 Dec 2010 12:02:46 -0000 Subject: [vmkit-commits] [vmkit] r121613 - in /vmkit/branches/py-vm: Makefile.config.in autoconf/configure.ac configure lib/Makefile lib/P3/ lib/P3/Makefile lib/P3/VMCore/ lib/P3/VMCore/Makefile lib/P3/VMCore/P3.cpp lib/P3/VMCore/P3.h lib/P3/VMCore/P3Error.h lib/P3/VMCore/P3Tracer.cpp tools/Makefile tools/p3/ tools/p3/Main.cpp tools/p3/Makefile Message-ID: <20101211120246.B0C022A6C12C@llvm.org> Author: gthomas Date: Sat Dec 11 06:02:46 2010 New Revision: 121613 URL: http://llvm.org/viewvc/llvm-project?rev=121613&view=rev Log: begin the p3 (python) virtual machine Added: vmkit/branches/py-vm/lib/P3/ vmkit/branches/py-vm/lib/P3/Makefile vmkit/branches/py-vm/lib/P3/VMCore/ vmkit/branches/py-vm/lib/P3/VMCore/Makefile vmkit/branches/py-vm/lib/P3/VMCore/P3.cpp vmkit/branches/py-vm/lib/P3/VMCore/P3.h vmkit/branches/py-vm/lib/P3/VMCore/P3Error.h vmkit/branches/py-vm/lib/P3/VMCore/P3Tracer.cpp vmkit/branches/py-vm/tools/p3/ vmkit/branches/py-vm/tools/p3/Main.cpp vmkit/branches/py-vm/tools/p3/Makefile Modified: vmkit/branches/py-vm/Makefile.config.in vmkit/branches/py-vm/autoconf/configure.ac vmkit/branches/py-vm/configure vmkit/branches/py-vm/lib/Makefile vmkit/branches/py-vm/tools/Makefile Modified: vmkit/branches/py-vm/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/Makefile.config.in?rev=121613&r1=121612&r2=121613&view=diff ============================================================================== --- vmkit/branches/py-vm/Makefile.config.in (original) +++ vmkit/branches/py-vm/Makefile.config.in Sat Dec 11 06:02:46 2010 @@ -3,6 +3,7 @@ WITH_N3_PNETLIB = @WITH_N3_PNETLIB@ WITH_N3_MONO = @WITH_N3_MONO@ WITH_J3 = @WITH_J3@ +WITH_P3 = @WITH_P3@ N3_LIB = @N3_LIB@ GC_MULTI_MMAP = @GC_MULTI_MMAP@ GC_SINGLE_MMAP = @GC_SINGLE_MMAP@ Modified: vmkit/branches/py-vm/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/autoconf/configure.ac?rev=121613&r1=121612&r2=121613&view=diff ============================================================================== --- vmkit/branches/py-vm/autoconf/configure.ac (original) +++ vmkit/branches/py-vm/autoconf/configure.ac Sat Dec 11 06:02:46 2010 @@ -422,6 +422,25 @@ AC_SUBST([WITH_N3]) +dnl ************************************************************************** +dnl toy vm +dnl ************************************************************************** +AC_ARG_WITH(p3, + [AS_HELP_STRING(--with-p3=yes|no, + [Build the python virtual machine (default is no)])], + [[WITH_P3=$withval]], + [[WITH_P3=no]] +) + +if test "x${WITH_P3}" = "xyes"; then + echo Building P3; + WITH_P3=1; +else + WITH_P3=0; +fi + +AC_SUBST([WITH_P3]) + dnl===-----------------------------------------------------------------------=== dnl=== dnl=== SECTION 4: Check for programs we need and that they are the right version Modified: vmkit/branches/py-vm/configure URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/configure?rev=121613&r1=121612&r2=121613&view=diff ============================================================================== --- vmkit/branches/py-vm/configure (original) +++ vmkit/branches/py-vm/configure Sat Dec 11 06:02:46 2010 @@ -667,6 +667,7 @@ ac_ct_CXX CXXFLAGS CXX +WITH_P3 WITH_N3 monopath WITH_N3_MONO @@ -774,6 +775,7 @@ with_pnet_local_prefix with_pnetlib with_mono +with_p3 ' ac_precious_vars='build_alias host_alias @@ -1438,6 +1440,7 @@ Pnetlib's mscorlib.dll location (default is /usr/lib/cscc/lib/) --with-mono=something Mono's mscorlib.dll location (no default) + --with-p3=yes|no Build the python virtual machine (default is no) Some influential environment variables: CC C compiler command @@ -4314,6 +4317,25 @@ +# Check whether --with-p3 was given. +if test "${with_p3+set}" = set; then + withval=$with_p3; WITH_P3=$withval +else + WITH_P3=no + +fi + + +if test "x${WITH_P3}" = "xyes"; then + echo Building P3; + WITH_P3=1; +else + WITH_P3=0; +fi + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' Modified: vmkit/branches/py-vm/lib/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/Makefile?rev=121613&r1=121612&r2=121613&view=diff ============================================================================== --- vmkit/branches/py-vm/lib/Makefile (original) +++ vmkit/branches/py-vm/lib/Makefile Sat Dec 11 06:02:46 2010 @@ -20,5 +20,9 @@ PARALLEL_DIRS += N3 endif +ifeq ($(WITH_P3), 1) +PARALLEL_DIRS += P3 +endif + include $(LEVEL)/Makefile.common Added: vmkit/branches/py-vm/lib/P3/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/P3/Makefile?rev=121613&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/P3/Makefile (added) +++ vmkit/branches/py-vm/lib/P3/Makefile Sat Dec 11 06:02:46 2010 @@ -0,0 +1,15 @@ +##===- lib/JnJVM/Makefile ----------------------------------*- Makefile -*-===## +# +# The vmkit project +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../.. + +DIRS = VMCore + +include $(LEVEL)/Makefile.config +include $(LEVEL)/Makefile.common + Added: vmkit/branches/py-vm/lib/P3/VMCore/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/P3/VMCore/Makefile?rev=121613&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/P3/VMCore/Makefile (added) +++ vmkit/branches/py-vm/lib/P3/VMCore/Makefile Sat Dec 11 06:02:46 2010 @@ -0,0 +1,23 @@ +##===- lib/JnJVM/VMCore/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 = P3 +else + LIBRARYNAME = P3 +endif + + +include $(LEVEL)/Makefile.common + +#CXX.Flags += + Added: vmkit/branches/py-vm/lib/P3/VMCore/P3.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/P3/VMCore/P3.cpp?rev=121613&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/P3/VMCore/P3.cpp (added) +++ vmkit/branches/py-vm/lib/P3/VMCore/P3.cpp Sat Dec 11 06:02:46 2010 @@ -0,0 +1,18 @@ +#include "P3.h" +#include "P3Error.h" + +using namespace p3; + +P3::P3(mvm::BumpPtrAllocator& alloc, mvm::VMKit* vmkit) : mvm::VirtualMachine(alloc, vmkit) { +} + +void P3::finalizeObject(mvm::gc* obj) { NI(); } +mvm::gc** P3::getReferent(mvm::gc* ref) { NI(); } +void P3::setReferent(mvm::gc* ref, mvm::gc* val) { NI(); } +bool P3::enqueueReference(mvm::gc* _obj) { NI(); } +size_t P3::getObjectSize(mvm::gc* object) { NI(); } +const char* P3::getObjectTypeName(mvm::gc* object) { NI(); } + +void P3::runApplicationImpl(int argc, char** argv) { + NI(); +} Added: vmkit/branches/py-vm/lib/P3/VMCore/P3.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/P3/VMCore/P3.h?rev=121613&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/P3/VMCore/P3.h (added) +++ vmkit/branches/py-vm/lib/P3/VMCore/P3.h Sat Dec 11 06:02:46 2010 @@ -0,0 +1,52 @@ +#ifndef _P3_H_ +#define _P3_H_ + +#include "mvm/VirtualMachine.h" + +namespace p3 { + +class P3 : public mvm::VirtualMachine { +public: + /// P3 - default constructor + /// + P3(mvm::BumpPtrAllocator& alloc, mvm::VMKit* vmkit); + + + /// finalizeObject - invoke the finalizer of an object + /// + virtual void finalizeObject(mvm::gc* obj); + + /// getReferentPtr - return the referent of a reference + /// + virtual mvm::gc** getReferent(mvm::gc* ref); + + /// setReferentPtr - set the referent of a reference + /// + virtual void setReferent(mvm::gc* ref, mvm::gc* val); + + /// enqueueReference - enqueue the reference + /// + virtual bool enqueueReference(mvm::gc* _obj); + + /// tracer - Trace this virtual machine's GC-objects. + /// Called once by vm. If you have GC-objects in a thread specific data, redefine the tracer of your VMThreadData. + /// + virtual void tracer(uintptr_t closure); + + /// getObjectSize - Get the size of this object. Used by copying collectors. + /// + virtual size_t getObjectSize(mvm::gc* object); + + /// getObjectTypeName - Get the type of this object. Used by the GC for + /// debugging purposes. + /// + virtual const char* getObjectTypeName(mvm::gc* object); + + /// runApplicationImpl - code executed after a runApplication in a vmkit thread + /// + virtual void runApplicationImpl(int argc, char** argv); +}; + +} // namespace p3 + +#endif Added: vmkit/branches/py-vm/lib/P3/VMCore/P3Error.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/P3/VMCore/P3Error.h?rev=121613&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/P3/VMCore/P3Error.h (added) +++ vmkit/branches/py-vm/lib/P3/VMCore/P3Error.h Sat Dec 11 06:02:46 2010 @@ -0,0 +1,7 @@ +#ifndef _P3_ERROR_H_ +#define _P3_ERROR_H_ + +#define NI() \ + do { fprintf(stderr, "%s is not implemented at %s::%d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); abort(); } while(0) + +#endif Added: vmkit/branches/py-vm/lib/P3/VMCore/P3Tracer.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/P3/VMCore/P3Tracer.cpp?rev=121613&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/P3/VMCore/P3Tracer.cpp (added) +++ vmkit/branches/py-vm/lib/P3/VMCore/P3Tracer.cpp Sat Dec 11 06:02:46 2010 @@ -0,0 +1,9 @@ +#include "P3.h" +#include "P3Error.h" + +using namespace p3; + +void P3::tracer(uintptr_t closure) { + NI(); +} + Modified: vmkit/branches/py-vm/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/tools/Makefile?rev=121613&r1=121612&r2=121613&view=diff ============================================================================== --- vmkit/branches/py-vm/tools/Makefile (original) +++ vmkit/branches/py-vm/tools/Makefile Sat Dec 11 06:02:46 2010 @@ -26,5 +26,9 @@ PARALLEL_DIRS += n3-pnetlib endif +ifeq ($(WITH_P3), 1) + PARALLEL_DIRS += p3 +endif + include $(LEVEL)/Makefile.common Added: vmkit/branches/py-vm/tools/p3/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/tools/p3/Main.cpp?rev=121613&view=auto ============================================================================== --- vmkit/branches/py-vm/tools/p3/Main.cpp (added) +++ vmkit/branches/py-vm/tools/p3/Main.cpp Sat Dec 11 06:02:46 2010 @@ -0,0 +1,19 @@ +#include "mvm/VMKit.h" +#include "../../lib/P3/VMCore/P3.h" + +using namespace p3; + +int main(int argc, char **argv) { + // Initialize base components. + mvm::BumpPtrAllocator Allocator; + mvm::VMKit* vmkit = new(Allocator, "VMKit") mvm::VMKit(Allocator); + + // Create the allocator that will allocate the bootstrap loader and the JVM. + p3::P3* vm = new(Allocator, "VM") P3(Allocator, vmkit); + + // Run the application. + vm->runApplication(argc, argv); + vmkit->waitNonDaemonThreads(); + exit(0); +} + Added: vmkit/branches/py-vm/tools/p3/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/tools/p3/Makefile?rev=121613&view=auto ============================================================================== --- vmkit/branches/py-vm/tools/p3/Makefile (added) +++ vmkit/branches/py-vm/tools/p3/Makefile Sat Dec 11 06:02:46 2010 @@ -0,0 +1,40 @@ +##===- tools/p3/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 + +TOOLNAME = p3 + +ifeq ($(WITH_LLVM_GCC), 1) + + MODULESNAME = p3 + USEDMODULES = P3.bc J3.bc Classpath.bc J3Compiler.bc Allocator.bc CommonThread.bc \ + Mvm.bc MvmCompiler.bc + + ifeq ($(GC_MMTK), 1) + USEDMODULES += FinalMMTk.bc InlineMMTk.bc + else + USEDMODULES += $(GCLIB).bc + endif + + BUILT_SOURCES = p3.s + SOURCES = p3.s $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp)) + +else + +USEDLIBS = P3.a J3.a Classpath.a J3.a J3Compiler.a Allocator.a \ + Mvm.a MvmCompiler.a $(GCLIB).a Allocator.a CommonThread.a + +endif + +LINK_COMPONENTS = jit nativecodegen scalaropts instrumentation ipa ipo bitreader asmparser linker + + +include $(LEVEL)/Makefile.common From gael.thomas at lip6.fr Sat Dec 11 04:32:40 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sat, 11 Dec 2010 12:32:40 -0000 Subject: [vmkit-commits] [vmkit] r121614 - in /vmkit/branches/py-vm: lib/Makefile lib/P3/ lib/p3/ lib/p3/VMCore/ tools/p3/ tools/p3/Main.cpp Message-ID: <20101211123240.C6DEA2A6C12C@llvm.org> Author: gthomas Date: Sat Dec 11 06:32:40 2010 New Revision: 121614 URL: http://llvm.org/viewvc/llvm-project?rev=121614&view=rev Log: ignore some generated files in svn:ignore. Rename lib/P3 to lib/p3 Added: vmkit/branches/py-vm/lib/p3/ - copied from r121613, vmkit/branches/py-vm/lib/P3/ Removed: vmkit/branches/py-vm/lib/P3/ Modified: vmkit/branches/py-vm/lib/Makefile vmkit/branches/py-vm/lib/p3/VMCore/ (props changed) vmkit/branches/py-vm/tools/p3/ (props changed) vmkit/branches/py-vm/tools/p3/Main.cpp Modified: vmkit/branches/py-vm/lib/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/Makefile?rev=121614&r1=121613&r2=121614&view=diff ============================================================================== --- vmkit/branches/py-vm/lib/Makefile (original) +++ vmkit/branches/py-vm/lib/Makefile Sat Dec 11 06:32:40 2010 @@ -21,7 +21,7 @@ endif ifeq ($(WITH_P3), 1) -PARALLEL_DIRS += P3 +PARALLEL_DIRS += p3 endif include $(LEVEL)/Makefile.common Propchange: vmkit/branches/py-vm/lib/p3/VMCore/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Sat Dec 11 06:32:40 2010 @@ -0,0 +1 @@ +Release Propchange: vmkit/branches/py-vm/tools/p3/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Sat Dec 11 06:32:40 2010 @@ -0,0 +1,4 @@ +vmkitoptimized.bc +p3.bc +p3.s +Release Modified: vmkit/branches/py-vm/tools/p3/Main.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/tools/p3/Main.cpp?rev=121614&r1=121613&r2=121614&view=diff ============================================================================== --- vmkit/branches/py-vm/tools/p3/Main.cpp (original) +++ vmkit/branches/py-vm/tools/p3/Main.cpp Sat Dec 11 06:32:40 2010 @@ -1,5 +1,5 @@ #include "mvm/VMKit.h" -#include "../../lib/P3/VMCore/P3.h" +#include "../../lib/p3/VMCore/P3.h" using namespace p3; From gael.thomas at lip6.fr Sun Dec 12 01:20:46 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 12 Dec 2010 09:20:46 -0000 Subject: [vmkit-commits] [vmkit] r121631 - in /vmkit/branches/py-vm/lib/p3/VMCore: P3.cpp P3.h P3Error.h P3Extractor.cpp P3Extractor.h P3Reader.cpp P3Reader.h Message-ID: <20101212092046.3B0AC2A6C12D@llvm.org> Author: gthomas Date: Sun Dec 12 03:20:46 2010 New Revision: 121631 URL: http://llvm.org/viewvc/llvm-project?rev=121631&view=rev Log: read a pyc file Added: vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.cpp vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.h vmkit/branches/py-vm/lib/p3/VMCore/P3Reader.cpp vmkit/branches/py-vm/lib/p3/VMCore/P3Reader.h Modified: vmkit/branches/py-vm/lib/p3/VMCore/P3.cpp vmkit/branches/py-vm/lib/p3/VMCore/P3.h vmkit/branches/py-vm/lib/p3/VMCore/P3Error.h Modified: vmkit/branches/py-vm/lib/p3/VMCore/P3.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3.cpp?rev=121631&r1=121630&r2=121631&view=diff ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3.cpp (original) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3.cpp Sun Dec 12 03:20:46 2010 @@ -1,5 +1,7 @@ #include "P3.h" #include "P3Error.h" +#include "P3Reader.h" +#include "P3Extractor.h" using namespace p3; @@ -13,6 +15,26 @@ size_t P3::getObjectSize(mvm::gc* object) { NI(); } const char* P3::getObjectTypeName(mvm::gc* object) { NI(); } +void P3::runFile(const char* fileName) { + mvm::BumpPtrAllocator allocator; + P3ByteCode* bc = P3Reader::openFile(allocator, fileName); + if(!bc) + fatal("unable to open: %s", fileName); + P3Reader reader(bc); + + uint16 ver = reader.readU2(); + printf("ver: 0x%x\n", ver); + uint16 magic = reader.readU2(); + printf("magic: 0x%x\n", magic); + reader.readU4(); // last modification + + P3Extractor extractor(&reader); + extractor.readObject(); +} + void P3::runApplicationImpl(int argc, char** argv) { - NI(); + if(argc < 2) + fatal("usage: %s filename", argv[0]); + + runFile(argv[1]); } Modified: vmkit/branches/py-vm/lib/p3/VMCore/P3.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3.h?rev=121631&r1=121630&r2=121631&view=diff ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3.h (original) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3.h Sun Dec 12 03:20:46 2010 @@ -5,6 +5,8 @@ namespace p3 { +class P3Reader; + class P3 : public mvm::VirtualMachine { public: /// P3 - default constructor @@ -45,6 +47,11 @@ /// runApplicationImpl - code executed after a runApplication in a vmkit thread /// virtual void runApplicationImpl(int argc, char** argv); + +public: + /// runFile - execute the file fileName + /// + void runFile(const char* fileName); }; } // namespace p3 Modified: vmkit/branches/py-vm/lib/p3/VMCore/P3Error.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Error.h?rev=121631&r1=121630&r2=121631&view=diff ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Error.h (original) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Error.h Sun Dec 12 03:20:46 2010 @@ -4,4 +4,7 @@ #define NI() \ do { fprintf(stderr, "%s is not implemented at %s::%d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); abort(); } while(0) +#define fatal(...) \ + do { fprintf(stderr, "FATAL: "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); abort(); } while(0) + #endif Added: vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.cpp?rev=121631&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.cpp (added) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.cpp Sun Dec 12 03:20:46 2010 @@ -0,0 +1,87 @@ +#include "P3Extractor.h" +#include "P3Reader.h" +#include "P3Error.h" + +using namespace p3; + +#define TYPE_NULL '0' +#define TYPE_NONE 'N' +#define TYPE_FALSE 'F' +#define TYPE_TRUE 'T' +#define TYPE_STOPITER 'S' +#define TYPE_ELLIPSIS '.' +#define TYPE_INT 'i' +#define TYPE_INT64 'I' +#define TYPE_FLOAT 'f' +#define TYPE_BINARY_FLOAT 'g' +#define TYPE_COMPLEX 'x' +#define TYPE_BINARY_COMPLEX 'y' +#define TYPE_LONG 'l' +#define TYPE_STRING 's' +#define TYPE_INTERNED 't' +#define TYPE_STRINGREF 'R' +#define TYPE_TUPLE '(' +#define TYPE_LIST '[' +#define TYPE_DICT '{' +#define TYPE_CODE 'c' +#define TYPE_UNICODE 'u' +#define TYPE_UNKNOWN '?' +#define TYPE_SET '<' +#define TYPE_FROZENSET '>' + +void P3Extractor::readObject() { + uint8 type = reader->readU1(); + + printf("reading object with type: %d (%c)\n", type, type); + + switch(type) { + case TYPE_NONE: + break; + + case TYPE_TUPLE: + { + uint32 length = reader->readU4(); + printf(" tuple length: %d\n", length); + for(uint32 i=0; ireadU4(); + printf(" string length: %d\n", length); + if(length > INT_MAX) + fatal("wrong length for string"); + for(uint32 i=0; ireadU1(); + printf(" %-3d (%c) ", c, c); + } + printf("\n"); + } + break; + + case TYPE_CODE: + { + uint32 nargs = reader->readU4(); + uint32 nlocals = reader->readU4(); + uint32 ssize = reader->readU4(); + uint32 flags = reader->readU4(); + readObject(); // code + readObject(); // const + readObject(); // names + readObject(); // varnames + readObject(); // freevars + readObject(); // cellvars + readObject(); // filename + readObject(); // name + reader->readU4(); // line num + readObject(); // lnotab + } + break; + + default: + fatal("wrong type info: %d ('%c')", type, type); + } +} Added: vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.h?rev=121631&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.h (added) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.h Sun Dec 12 03:20:46 2010 @@ -0,0 +1,22 @@ +#ifndef _P3_EXTRACTOR_H_ +#define _P3_EXTRACTOR_H_ + +namespace p3 { + +class P3Reader; + +class P3Extractor { + /// reader - the reader + P3Reader* reader; + +public: + P3Extractor(P3Reader* r) { this->reader = r; } + + /// readObject - unmarshal an object + /// + void readObject(); +}; + +} // namespace p3 + +#endif Added: vmkit/branches/py-vm/lib/p3/VMCore/P3Reader.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Reader.cpp?rev=121631&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Reader.cpp (added) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Reader.cpp Sun Dec 12 03:20:46 2010 @@ -0,0 +1,55 @@ +//===--------------- P3Reader.cpp - Open and read files ---------------------===// +// +// The VMKit project +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include +#include + +#include "types.h" + +#include "P3Reader.h" + +using namespace p3; + +const int P3Reader::SeekSet = SEEK_SET; +const int P3Reader::SeekCur = SEEK_CUR; +const int P3Reader::SeekEnd = SEEK_END; + +P3ByteCode* P3Reader::openFile(mvm::BumpPtrAllocator& allocator, const char* path) { + P3ByteCode* res = NULL; + FILE* fp = fopen(path, "r"); + if (fp != 0) { + fseek(fp, 0, SeekEnd); + size_t nbb = ftell(fp); + fseek(fp, 0, SeekSet); + res = new(allocator, nbb) P3ByteCode(nbb); + if (fread(res->elements, nbb, 1, fp) == 0) { + fprintf(stderr, "fread error\n"); + abort(); + } + fclose(fp); + } + return res; +} + +void P3Reader::seek(uint32 pos, int from) { + uint32 n = 0; + uint32 start = min; + uint32 end = max; + + if (from == SeekCur) n = cursor + pos; + else if (from == SeekSet) n = start + pos; + else if (from == SeekEnd) n = end + pos; + + + assert(n >= start && n <= end && "out of range"); + + cursor = n; +} + + Added: vmkit/branches/py-vm/lib/p3/VMCore/P3Reader.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Reader.h?rev=121631&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Reader.h (added) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Reader.h Sun Dec 12 03:20:46 2010 @@ -0,0 +1,130 @@ +#ifndef _P3_READER_H_ +#define _P3_READER_H_ + +#include "mvm/Allocator.h" + +namespace p3 { + +class P3ByteCode { + public: + P3ByteCode(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 P3Reader { +public: + // bytes - Pointer to a reference array. The array is not manipulated directly + // in order to support copying GC. + P3ByteCode* bytes; + uint32 min; + uint32 cursor; + uint32 max; + + P3Reader(P3ByteCode* array, uint32 start = 0, uint32 end = 0) { + if (!end) end = array->size; + this->bytes = array; + this->cursor = start; + this->min = start; + this->max = start + end; + } + + P3Reader(P3Reader& r, uint32 nbb) { + bytes = r.bytes; + cursor = r.cursor; + min = r.min; + max = min + nbb; + } + + static const int SeekSet; + static const int SeekCur; + static const int SeekEnd; + + static P3ByteCode* openFile(mvm::BumpPtrAllocator& allocator, const char* path); + + uint8 readU1() { + ++cursor; + return bytes->elements[cursor - 1]; + } + + sint8 readS1() { + ++cursor; + return bytes->elements[cursor - 1]; + } + + uint16 readU2() { + uint16 tmp = ((uint16)(readU1())); + return tmp | ((uint16)(readU1())) << 8; + } + + sint16 readS2() { + sint16 tmp = ((sint16)(readS1())); + return tmp | ((sint16)(readU1())) << 8; + } + + uint32 readU4() { + uint32 tmp = ((uint32)(readU2())); + return tmp | ((uint32)(readU2())) << 16; + } + + sint32 readS4() { + sint32 tmp = ((sint32)(readS2())); + return tmp | ((sint32)(readU2())) << 16; + } + + uint64 readU8() { + uint64 tmp = ((uint64)(readU4())); + return tmp | ((uint64)(readU4())) << 32; + } + + sint64 readS8() { + sint64 tmp = ((sint64)(readS4())); + return tmp | ((sint64)(readU4())) << 32; + } + + static double readF8(int first, int second) { + int values[2]; + double res[1]; +#if defined(__PPC__) + values[0] = second; + values[1] = first; +#else + values[0] = first; + values[1] = second; +#endif + memcpy(res, values, 8); + return res[0]; + } + +// static sint64 readS8(int first, int second) { +// int values[2]; +// sint64 res[1]; +// #if defined(__PPC__) +// values[0] = second; +// values[1] = first; +// #else +// values[0] = first; +// values[1] = second; +// #endif +// memcpy(res, values, 8); +// return res[0]; +// } + + unsigned int tell() { + return cursor - min; + } + + void seek(uint32 pos, int from); +}; + +} // namespace p3 + +#endif From gael.thomas at lip6.fr Sun Dec 12 10:42:07 2010 From: gael.thomas at lip6.fr (Gael Thomas) Date: Sun, 12 Dec 2010 18:42:07 -0000 Subject: [vmkit-commits] [vmkit] r121637 - in /vmkit/branches/py-vm/lib/p3/VMCore: Makefile P3.cpp P3Error.h P3Extractor.cpp P3Extractor.h P3Interpretor.cpp P3Interpretor.h P3Object.cpp P3Object.h opcode.h Message-ID: <20101212184207.DA7B72A6C12C@llvm.org> Author: gthomas Date: Sun Dec 12 12:42:07 2010 New Revision: 121637 URL: http://llvm.org/viewvc/llvm-project?rev=121637&view=rev Log: able to interpret a simple helloworld. Object model not yet defined:) Added: vmkit/branches/py-vm/lib/p3/VMCore/P3Interpretor.cpp vmkit/branches/py-vm/lib/p3/VMCore/P3Interpretor.h vmkit/branches/py-vm/lib/p3/VMCore/P3Object.cpp vmkit/branches/py-vm/lib/p3/VMCore/P3Object.h vmkit/branches/py-vm/lib/p3/VMCore/opcode.h Modified: vmkit/branches/py-vm/lib/p3/VMCore/Makefile vmkit/branches/py-vm/lib/p3/VMCore/P3.cpp vmkit/branches/py-vm/lib/p3/VMCore/P3Error.h vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.cpp vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.h Modified: vmkit/branches/py-vm/lib/p3/VMCore/Makefile URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/Makefile?rev=121637&r1=121636&r2=121637&view=diff ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/Makefile (original) +++ vmkit/branches/py-vm/lib/p3/VMCore/Makefile Sun Dec 12 12:42:07 2010 @@ -10,6 +10,8 @@ include $(LEVEL)/Makefile.config +NO_PEDANTIC=1 + ifeq ($(WITH_LLVM_GCC), 1) MODULE_NAME = P3 else Modified: vmkit/branches/py-vm/lib/p3/VMCore/P3.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3.cpp?rev=121637&r1=121636&r2=121637&view=diff ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3.cpp (original) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3.cpp Sun Dec 12 12:42:07 2010 @@ -2,6 +2,8 @@ #include "P3Error.h" #include "P3Reader.h" #include "P3Extractor.h" +#include "P3Object.h" +#include "P3Interpretor.h" using namespace p3; @@ -22,14 +24,17 @@ fatal("unable to open: %s", fileName); P3Reader reader(bc); - uint16 ver = reader.readU2(); - printf("ver: 0x%x\n", ver); - uint16 magic = reader.readU2(); - printf("magic: 0x%x\n", magic); - reader.readU4(); // last modification + reader.readU2(); // version 0xf2d1 (???) + reader.readU2(); // magic 0xa0d + reader.readU4(); // last modification P3Extractor extractor(&reader); - extractor.readObject(); + P3Object* obj = extractor.readObject(); + + if(!obj->isCode()) + fatal("%s does not contain a code", fileName); + + (new P3Interpretor(obj->asCode()))->execute(); } void P3::runApplicationImpl(int argc, char** argv) { Modified: vmkit/branches/py-vm/lib/p3/VMCore/P3Error.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Error.h?rev=121637&r1=121636&r2=121637&view=diff ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Error.h (original) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Error.h Sun Dec 12 12:42:07 2010 @@ -1,6 +1,9 @@ #ifndef _P3_ERROR_H_ #define _P3_ERROR_H_ +#include +#include + #define NI() \ do { fprintf(stderr, "%s is not implemented at %s::%d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); abort(); } while(0) Modified: vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.cpp?rev=121637&r1=121636&r2=121637&view=diff ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.cpp (original) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.cpp Sun Dec 12 12:42:07 2010 @@ -1,6 +1,7 @@ #include "P3Extractor.h" #include "P3Reader.h" #include "P3Error.h" +#include "P3Object.h" using namespace p3; @@ -29,57 +30,53 @@ #define TYPE_SET '<' #define TYPE_FROZENSET '>' -void P3Extractor::readObject() { +P3Object* P3Extractor::readObject() { uint8 type = reader->readU1(); - printf("reading object with type: %d (%c)\n", type, type); - switch(type) { case TYPE_NONE: - break; + return new P3None(); case TYPE_TUPLE: { uint32 length = reader->readU4(); - printf(" tuple length: %d\n", length); + P3Tuple* res = new P3Tuple(length); for(uint32 i=0; icontent[i] = readObject(); + return res; } - break; case TYPE_INTERNED: case TYPE_STRING: { uint32 length = reader->readU4(); - printf(" string length: %d\n", length); + P3String* res = new P3String(length); if(length > INT_MAX) fatal("wrong length for string"); - for(uint32 i=0; ireadU1(); - printf(" %-3d (%c) ", c, c); - } - printf("\n"); + for(uint32 i=0; icontent[i] = reader->readU1(); + return res; } - break; case TYPE_CODE: { - uint32 nargs = reader->readU4(); - uint32 nlocals = reader->readU4(); - uint32 ssize = reader->readU4(); - uint32 flags = reader->readU4(); - readObject(); // code - readObject(); // const - readObject(); // names - readObject(); // varnames - readObject(); // freevars - readObject(); // cellvars - readObject(); // filename - readObject(); // name - reader->readU4(); // line num - readObject(); // lnotab + P3Code* res = new P3Code(); + res->py_nargs = reader->readU4(); + res->py_nlocals = reader->readU4(); + res->py_nstacks = reader->readU4(); + res->py_flag = reader->readU4(); + res->py_code = readObject()->asString(); + res->py_const = readObject()->asTuple(); + res->py_names = readObject(); + res->py_varnames = readObject(); + res->py_freevars = readObject(); + res->py_cellvars = readObject(); + res->py_filename = readObject(); + res->py_name = readObject(); + res->py_linenum = reader->readU4(); + res->py_lnotab = readObject(); + return res; } - break; default: fatal("wrong type info: %d ('%c')", type, type); Modified: vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.h?rev=121637&r1=121636&r2=121637&view=diff ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.h (original) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Extractor.h Sun Dec 12 12:42:07 2010 @@ -3,6 +3,7 @@ namespace p3 { +class P3Object; class P3Reader; class P3Extractor { @@ -14,7 +15,7 @@ /// readObject - unmarshal an object /// - void readObject(); + P3Object* readObject(); }; } // namespace p3 Added: vmkit/branches/py-vm/lib/p3/VMCore/P3Interpretor.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Interpretor.cpp?rev=121637&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Interpretor.cpp (added) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Interpretor.cpp Sun Dec 12 12:42:07 2010 @@ -0,0 +1,395 @@ +#include "P3Interpretor.h" +#include "P3Object.h" + +#include "opcode.h" + +using namespace p3; + +#define fetch_arg() (pc+=2, bc->content[pc-1]<<8+bc->content[pc-2]) +#define push(val) stack->content[stack->length++]=val +#define pop() stack->content[--stack->length] + +P3Object* P3Interpretor::execute() { + printf("Execute: "); + code->print(); + printf("\n"); + P3Stack* stack = new P3Stack(code->py_nstacks); + P3String* bc = code->py_code; + uint32 pc=0; + + while(1) { + uint8 op = bc->content[pc++]; + + printf(" -- stack: "); + stack->print(); + printf("\n"); + printf(" -- fetch opcode %d (%s)\n", op, opcodeNames[op]); + + switch(op) { + case STOP_CODE: //0 + case POP_TOP: //1 + case ROT_TWO: //2 + case ROT_THREE: //3 + case DUP_TOP: //4 + case ROT_FOUR: //5 + case NOP: //9 + + case UNARY_POSITIVE: //10 + case UNARY_NEGATIVE: //11 + case UNARY_NOT: //12 + case UNARY_CONVERT: //13 + + case UNARY_INVERT: //15 + + case LIST_APPEND: //18 + case BINARY_POWER: //19 + + case BINARY_MULTIPLY: //20 + case BINARY_DIVIDE: //21 + case BINARY_MODULO: //22 + case BINARY_ADD: //23 + case BINARY_SUBTRACT: //24 + case BINARY_SUBSCR: //25 + case BINARY_FLOOR_DIVIDE: //26 + case BINARY_TRUE_DIVIDE: //27 + case INPLACE_FLOOR_DIVIDE: //28 + case INPLACE_TRUE_DIVIDE: //29 + + case SLICE: //30 + /* Also uses : 31-33 */ + + case STORE_SLICE: //40 + /* Also uses : 41-43 */ + + case DELETE_SLICE: //50 + /* Also uses : 51-53 */ + + case STORE_MAP: //54 + case INPLACE_ADD: //55 + case INPLACE_SUBTRACT: //56 + case INPLACE_MULTIPLY: //57 + case INPLACE_DIVIDE: //58 + case INPLACE_MODULO: //59 + case STORE_SUBSCR: //60 + case DELETE_SUBSCR: //61 + + case BINARY_LSHIFT: //62 + case BINARY_RSHIFT: //63 + case BINARY_AND: //64 + case BINARY_XOR: //65 + case BINARY_OR: //66 + case INPLACE_POWER: //67 + case GET_ITER: //68 + + case PRINT_EXPR: //70 + NI(); + + case PRINT_ITEM: //71 + pop()->print(); + break; + + case PRINT_NEWLINE: //72 + printf("\n"); + break; + + case PRINT_ITEM_TO: //73 + case PRINT_NEWLINE_TO: //74 + case INPLACE_LSHIFT: //75 + case INPLACE_RSHIFT: //76 + case INPLACE_AND: //77 + case INPLACE_XOR: //78 + case INPLACE_OR: //79 + case BREAK_LOOP: //80 + case WITH_CLEANUP: //81 + case LOAD_LOCALS: //82 + NI(); + + case RETURN_VALUE: //83 + return pop(); + + case IMPORT_STAR: //84 + case EXEC_STMT: //85 + case YIELD_VALUE: //86 + case POP_BLOCK: //87 + case END_FINALLY: //88 + case BUILD_CLASS: //89 + + case HAVE_ARGUMENT: //90 + /* Opcodes from here have an argument: */ + + // case STORE_NAME: //90 + /* Index in name list */ + case DELETE_NAME: //91 + /* "" */ + case UNPACK_SEQUENCE: //92 + /* Number of sequence items */ + case FOR_ITER: //93 + + case STORE_ATTR: //95 + /* Index in name list */ + case DELETE_ATTR: //96 + /* "" */ + case STORE_GLOBAL: //97 + /* "" */ + case DELETE_GLOBAL: //98 + /* "" */ + case DUP_TOPX: //99 + /* number of items to duplicate */ + NI(); + + case LOAD_CONST: // 100 + push(code->py_const->at(fetch_arg())); + break; + + /* Index in const list */ + case LOAD_NAME: //101 + /* Index in name list */ + case BUILD_TUPLE: //102 + /* Number of tuple items */ + case BUILD_LIST: //103 + /* Number of list items */ + case BUILD_MAP: //104 + /* Always zero for now */ + case LOAD_ATTR: //105 + /* Index in name list */ + case COMPARE_OP: //106 + /* Comparison operator */ + case IMPORT_NAME: //107 + /* Index in name list */ + case IMPORT_FROM: //108 + /* Index in name list */ + + case JUMP_FORWARD: //110 + /* Number of bytes to skip */ + case JUMP_IF_FALSE: //111 + /* "" */ + case JUMP_IF_TRUE: //112 + /* "" */ + case JUMP_ABSOLUTE: //113 + /* Target byte offset from beginning of code */ + + case LOAD_GLOBAL: //116 + /* Index in name list */ + + case CONTINUE_LOOP: //119 + /* Start of loop (absolute) */ + case SETUP_LOOP: //120 + /* Target address (relative) */ + case SETUP_EXCEPT: //121 + /* "" */ + case SETUP_FINALLY: //122 + /* "" */ + + case LOAD_FAST: //124 + /* Local variable number */ + case STORE_FAST: //125 + /* Local variable number */ + case DELETE_FAST: //126 + /* Local variable number */ + + case RAISE_VARARGS: //130 + /* Number of raise arguments (1, 2 or 3) */ + /* CALL_FUNCTION_XXX opcodes defined below depend on this definition */ + case CALL_FUNCTION: //131 + /* #args + (#kwargs<<8) */ + case MAKE_FUNCTION: //132 + /* #defaults */ + case BUILD_SLICE: //133 + /* Number of items */ + + case MAKE_CLOSURE: //134 + /* #free vars */ + case LOAD_CLOSURE: //135 + /* Load free variable from closure */ + case LOAD_DEREF: //136 + /* Load and dereference from closure cell */ + case STORE_DEREF: //137 + /* Store into cell */ + + /* The next 3 opcodes must be contiguous and satisfy + (CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */ + case CALL_FUNCTION_VAR: //140 + /* #args + (#kwargs<<8) */ + case CALL_FUNCTION_KW: //141 + /* #args + (#kwargs<<8) */ + case CALL_FUNCTION_VAR_KW: //142 + /* #args + (#kwargs<<8) */ + + /* Support for opargs more than : //16 bits long */ + case EXTENDED_ARG: //143 + + default: + fatal("unable to interpret opcode: %d", op); + + } + } +} + +const char* P3Interpretor::opcodeNames[] = { + "STOP_CODE", // 0 + "POP_TOP", // 1 + "ROT_TWO", // 2 + "ROT_THREE", // 3 + "DUP_TOP", // 4 + "ROT_FOUR", // 5 + "6__unknow", // 6 + "7__unknow", // 7 + "8__unknow", // 8 + "NOP", // 9 + + "UNARY_POSITIVE", // 10 + "UNARY_NEGATIVE", // 11 + "UNARY_NOT", // 12 + "UNARY_CONVERT", // 13 + "14__unknow", // 14 + "UNARY_INVERT", // 15 + "16__unknow", // 16 + "17__unknow", // 17 + "LIST_APPEND", // 18 + "BINARY_POWER", // 19 + + "BINARY_MULTIPLY", // 20 + "BINARY_DIVIDE", // 21 + "BINARY_MODULO", // 22 + "BINARY_ADD", // 23 + "BINARY_SUBTRACT", // 24 + "BINARY_SUBSCR", // 25 + "BINARY_FLOOR_DIVIDE", // 26 + "BINARY_TRUE_DIVIDE", // 27 + "INPLACE_FLOOR_DIVIDE", // 28 + "INPLACE_TRUE_DIVIDE", // 29 + + "SLICE", // 30 + /* Also uses , // 31-, // 33 */ + "31__SLICE", // 31 + "32__SLICE", // 32 + "33__SLICE", // 33 + "34__unknow", // 34 + "35__unknow", // 35 + "36__unknow", // 36 + "37__unknow", // 37 + "38__unknow", // 38 + "39__unknow", // 39 + + "STORE_SLICE", // 40 + /* Also uses , // 41-, // 43 */ + "41__STORE_SLICE", // 41 + "42__STORE_SLICE", // 42 + "43__STORE_SLICE", // 43 + "44__unknow", // 44 + "45__unknow", // 45 + "46__unknow", // 46 + "47__unknow", // 47 + "48__unknow", // 48 + "49__unknow", // 49 + + "DELETE_SLICE", // 50 + /* Also uses , // 51-, // 53 */ + "51__DELETE_SLICE", // 51 + "52__DELETE_SLICE", // 52 + "53__DELETE_SLICE", // 53 + "STORE_MAP", // 54 + "INPLACE_ADD", // 55 + "INPLACE_SUBTRACT", // 56 + "INPLACE_MULTIPLY", // 57 + "INPLACE_DIVIDE", // 58 + "INPLACE_MODULO", // 59 + + "STORE_SUBSCR", // 60 + "DELETE_SUBSCR", // 61 + "BINARY_LSHIFT", // 62 + "BINARY_RSHIFT", // 63 + "BINARY_AND", // 64 + "BINARY_XOR", // 65 + "BINARY_OR", // 66 + "INPLACE_POWER", // 67 + "GET_ITER", // 68 + "69__unknow", // 69 + + "PRINT_EXPR", // 70 + "PRINT_ITEM", // 71 + "PRINT_NEWLINE", // 72 + "PRINT_ITEM_TO", // 73 + "PRINT_NEWLINE_TO", // 74 + "INPLACE_LSHIFT", // 75 + "INPLACE_RSHIFT", // 76 + "INPLACE_AND", // 77 + "INPLACE_XOR", // 78 + "INPLACE_OR", // 79 + + "BREAK_LOOP", // 80 + "WITH_CLEANUP", // 81 + "LOAD_LOCALS", // 82 + "RETURN_VALUE", // 83 + "IMPORT_STAR", // 84 + "EXEC_STMT", // 85 + "YIELD_VALUE", // 86 + "POP_BLOCK", // 87 + "END_FINALLY", // 88 + "BUILD_CLASS", // 89 + + "HAVE_ARGUMENT", // 90 /* Opcodes from here have an argument: */ + // "STORE_NAME", // 90 /* Index in name list */ + "DELETE_NAME", // 91 /* "", */ + "UNPACK_SEQUENCE", // 92 /* Number of sequence items */ + "FOR_ITER", // 93 + "94__unknow", // 94 + "STORE_ATTR", // 95 /* Index in name list */ + "DELETE_ATTR", // 96 /* "" */ + "STORE_GLOBAL", // 97 /* "" */ + "DELETE_GLOBAL", // 98 /* "" */ + "DUP_TOPX", // 99 /* number of items to duplicate */ + + "LOAD_CONST", // 100 /* Index in const list */ + "LOAD_NAME", // 101 /* Index in name list */ + "BUILD_TUPLE", // 102 /* Number of tuple items */ + "BUILD_LIST", // 103 /* Number of list items */ + "BUILD_MAP", // 104 /* Always zero for now */ + "LOAD_ATTR", // 105 /* Index in name list */ + "COMPARE_OP", // 106 /* Comparison operator */ + "IMPORT_NAME", // 107 /* Index in name list */ + "IMPORT_FROM", // 108 /* Index in name list */ + "109__unknow", // 109 + + "JUMP_FORWARD", // 110 /* Number of bytes to skip */ + "JUMP_IF_FALSE", // 111 /* "" */ + "JUMP_IF_TRUE", // 112 /* "" */ + "JUMP_ABSOLUTE", // 113 /* Target byte offset from beginning of code */ + "114__unknow", // 114 + "115__unknow", // 115 + "LOAD_GLOBAL", // 116 /* Index in name list */ + "117__unknow", // 117 + "118__unknow", // 118 + "CONTINUE_LOOP", // 119 /* Start of loop (absolute) */ + + "SETUP_LOOP", // 120 /* Target address (relative) */ + "SETUP_EXCEPT", // 121 /* "" */ + "SETUP_FINALLY", // 122 /* "" */ + "123__unknow", // 123 + "LOAD_FAST", // 124 /* Local variable number */ + "STORE_FAST", // 125 /* Local variable number */ + "DELETE_FAST", // 126 /* Local variable number */ + "127__unknow", // 127 + "128__unknow", // 128 + "129__unknow", // 129 + + "RAISE_VARARGS", // 130 /* Number of raise arguments (, // 1, , // 2 or , // 3) */ + /* CALL_FUNCTION_XXX opcodes defined below depend on this definition */ + "CALL_FUNCTION", // 131 /* #args + (#kwargs<<, // 8) */ + "MAKE_FUNCTION", // 132 /* #defaults */ + "BUILD_SLICE", // 133 /* Number of items */ + "MAKE_CLOSURE", // 134 /* #free vars */ + "LOAD_CLOSURE", // 135 /* Load free variable from closure */ + "LOAD_DEREF", // 136 /* Load and dereference from closure cell */ + "STORE_DEREF", // 137 /* Store into cell */ + "138__unknow", // 138 + "139__unknow", // 139 + + /* The next , // 3 opcodes must be contiguous and satisfy + (CALL_FUNCTION_VAR - CALL_FUNCTION) & == 1 */ + "CALL_FUNCTION_VAR", // 140 /* #args + (#kwargs<<8) */ + "CALL_FUNCTION_KW", // 141 /* #args + (#kwargs<<, // 8) */ + "CALL_FUNCTION_VAR_KW", // 142 /* #args + (#kwargs<<, // 8) */ + /* Support for opargs more than 16 bits long */ + "EXTENDED_ARG", // 143 +}; Added: vmkit/branches/py-vm/lib/p3/VMCore/P3Interpretor.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Interpretor.h?rev=121637&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Interpretor.h (added) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Interpretor.h Sun Dec 12 12:42:07 2010 @@ -0,0 +1,21 @@ +#ifndef _P3_INTERPRETOR_H_ +#define _P3_INTERPRETOR_H_ + +namespace p3 { + +class P3Code; +class P3Object; + +class P3Interpretor { + static const char *opcodeNames[]; + P3Code* code; + +public: + P3Interpretor(P3Code* c) { this->code = c; } + + P3Object* execute(); +}; + +} // namespace p3 + +#endif Added: vmkit/branches/py-vm/lib/p3/VMCore/P3Object.cpp URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Object.cpp?rev=121637&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Object.cpp (added) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Object.cpp Sun Dec 12 12:42:07 2010 @@ -0,0 +1,14 @@ +#include "P3Object.h" + +using namespace p3; + +P3String::P3String(uint32 l) { + content = new uint8[l+1]; + length = l; + content[l] = 0; +} + +P3Tuple::P3Tuple(uint32 l) { + content = new P3Object*[l]; + length = l; +} Added: vmkit/branches/py-vm/lib/p3/VMCore/P3Object.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/P3Object.h?rev=121637&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/P3Object.h (added) +++ vmkit/branches/py-vm/lib/p3/VMCore/P3Object.h Sun Dec 12 12:42:07 2010 @@ -0,0 +1,97 @@ +#ifndef _P3_OBJECT_H_ +#define _P3_OBJECT_H_ + +#include +#include + +#include "P3Error.h" + +namespace p3 { + +class P3String; +class P3Tuple; +class P3Code; +class P3None; + +class P3Object { +public: +#define do_type(type, name) \ + virtual bool is##name() { return 0; } \ + type* as##name() { if(!is##name()) fatal("%p is not a "#name, (void*)this); return (type*)this; } + + do_type(P3String, String) + do_type(P3Tuple, Tuple) + do_type(P3None, None) + do_type(P3Code, Code) + +#undef do_type + + virtual void print() { printf("object@%p", (void*)this); } +}; + +class P3None : public P3Object { +public: + virtual void print() { printf(""); } +}; + +class P3String : public P3Object { +public: + uint32 length; + uint8* content; + + P3String(uint32 n); + + virtual bool isString() { return 1; } + virtual void print() { printf("%s", content); } +}; + +class P3Tuple : public P3Object { +public: + uint32 length; + P3Object** content; + + P3Tuple(uint32 n); + + P3Object* at(uint32 idx) { + if(idx >= length) + fatal("array out of bound: %d", idx); + return content[idx]; + } + + virtual bool isTuple() { return 1; } + + virtual void print() { printf("["); for(uint32 i=0; iprint(); printf("]"); } +}; + +class P3Stack : public P3Tuple { +public: + uint32 capacity; + + P3Stack(uint32 c) : P3Tuple(c) { length = 0; capacity = c; } +}; + +class P3Code : public P3Object { +public: + uint32 py_nargs; + uint32 py_nlocals; + uint32 py_nstacks; + uint32 py_flag; + P3String* py_code; + P3Tuple* py_const; + P3Object* py_names; + P3Object* py_varnames; + P3Object* py_freevars; + P3Object* py_cellvars; + P3Object* py_filename; + P3Object* py_name; + uint32 py_linenum; + P3Object* py_lnotab; + + virtual bool isCode() { return 1; } + + virtual void print() { printf("Code<"); py_name->print(); printf(">"); } +}; + +} // namespace p3 + +#endif Added: vmkit/branches/py-vm/lib/p3/VMCore/opcode.h URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/py-vm/lib/p3/VMCore/opcode.h?rev=121637&view=auto ============================================================================== --- vmkit/branches/py-vm/lib/p3/VMCore/opcode.h (added) +++ vmkit/branches/py-vm/lib/p3/VMCore/opcode.h Sun Dec 12 12:42:07 2010 @@ -0,0 +1,161 @@ +#ifndef Py_OPCODE_H +#define Py_OPCODE_H + +#define Py_LT 0 +#define Py_LE 1 +#define Py_EQ 2 +#define Py_NE 3 +#define Py_GT 4 +#define Py_GE 5 + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Instruction opcodes for compiled code */ + +#define STOP_CODE 0 +#define POP_TOP 1 +#define ROT_TWO 2 +#define ROT_THREE 3 +#define DUP_TOP 4 +#define ROT_FOUR 5 +#define NOP 9 + +#define UNARY_POSITIVE 10 +#define UNARY_NEGATIVE 11 +#define UNARY_NOT 12 +#define UNARY_CONVERT 13 + +#define UNARY_INVERT 15 + +#define LIST_APPEND 18 +#define BINARY_POWER 19 + +#define BINARY_MULTIPLY 20 +#define BINARY_DIVIDE 21 +#define BINARY_MODULO 22 +#define BINARY_ADD 23 +#define BINARY_SUBTRACT 24 +#define BINARY_SUBSCR 25 +#define BINARY_FLOOR_DIVIDE 26 +#define BINARY_TRUE_DIVIDE 27 +#define INPLACE_FLOOR_DIVIDE 28 +#define INPLACE_TRUE_DIVIDE 29 + +#define SLICE 30 +/* Also uses 31-33 */ + +#define STORE_SLICE 40 +/* Also uses 41-43 */ + +#define DELETE_SLICE 50 +/* Also uses 51-53 */ + +#define STORE_MAP 54 +#define INPLACE_ADD 55 +#define INPLACE_SUBTRACT 56 +#define INPLACE_MULTIPLY 57 +#define INPLACE_DIVIDE 58 +#define INPLACE_MODULO 59 +#define STORE_SUBSCR 60 +#define DELETE_SUBSCR 61 + +#define BINARY_LSHIFT 62 +#define BINARY_RSHIFT 63 +#define BINARY_AND 64 +#define BINARY_XOR 65 +#define BINARY_OR 66 +#define INPLACE_POWER 67 +#define GET_ITER 68 + +#define PRINT_EXPR 70 +#define PRINT_ITEM 71 +#define PRINT_NEWLINE 72 +#define PRINT_ITEM_TO 73 +#define PRINT_NEWLINE_TO 74 +#define INPLACE_LSHIFT 75 +#define INPLACE_RSHIFT 76 +#define INPLACE_AND 77 +#define INPLACE_XOR 78 +#define INPLACE_OR 79 +#define BREAK_LOOP 80 +#define WITH_CLEANUP 81 +#define LOAD_LOCALS 82 +#define RETURN_VALUE 83 +#define IMPORT_STAR 84 +#define EXEC_STMT 85 +#define YIELD_VALUE 86 +#define POP_BLOCK 87 +#define END_FINALLY 88 +#define BUILD_CLASS 89 + +#define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */ + +#define STORE_NAME 90 /* Index in name list */ +#define DELETE_NAME 91 /* "" */ +#define UNPACK_SEQUENCE 92 /* Number of sequence items */ +#define FOR_ITER 93 + +#define STORE_ATTR 95 /* Index in name list */ +#define DELETE_ATTR 96 /* "" */ +#define STORE_GLOBAL 97 /* "" */ +#define DELETE_GLOBAL 98 /* "" */ +#define DUP_TOPX 99 /* number of items to duplicate */ +#define LOAD_CONST 100 /* Index in const list */ +#define LOAD_NAME 101 /* Index in name list */ +#define BUILD_TUPLE 102 /* Number of tuple items */ +#define BUILD_LIST 103 /* Number of list items */ +#define BUILD_MAP 104 /* Always zero for now */ +#define LOAD_ATTR 105 /* Index in name list */ +#define COMPARE_OP 106 /* Comparison operator */ +#define IMPORT_NAME 107 /* Index in name list */ +#define IMPORT_FROM 108 /* Index in name list */ + +#define JUMP_FORWARD 110 /* Number of bytes to skip */ +#define JUMP_IF_FALSE 111 /* "" */ +#define JUMP_IF_TRUE 112 /* "" */ +#define JUMP_ABSOLUTE 113 /* Target byte offset from beginning of code */ + +#define LOAD_GLOBAL 116 /* Index in name list */ + +#define CONTINUE_LOOP 119 /* Start of loop (absolute) */ +#define SETUP_LOOP 120 /* Target address (relative) */ +#define SETUP_EXCEPT 121 /* "" */ +#define SETUP_FINALLY 122 /* "" */ + +#define LOAD_FAST 124 /* Local variable number */ +#define STORE_FAST 125 /* Local variable number */ +#define DELETE_FAST 126 /* Local variable number */ + +#define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */ +/* CALL_FUNCTION_XXX opcodes defined below depend on this definition */ +#define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */ +#define MAKE_FUNCTION 132 /* #defaults */ +#define BUILD_SLICE 133 /* Number of items */ + +#define MAKE_CLOSURE 134 /* #free vars */ +#define LOAD_CLOSURE 135 /* Load free variable from closure */ +#define LOAD_DEREF 136 /* Load and dereference from closure cell */ +#define STORE_DEREF 137 /* Store into cell */ + +/* The next 3 opcodes must be contiguous and satisfy + (CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */ +#define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */ +#define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */ +#define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */ + +/* Support for opargs more than 16 bits long */ +#define EXTENDED_ARG 143 + + +enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, + PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD}; + +#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OPCODE_H */ From nicolas.geoffray at lip6.fr Sat Dec 18 01:30:24 2010 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Sat, 18 Dec 2010 09:30:24 -0000 Subject: [vmkit-commits] [vmkit] r122151 - /vmkit/trunk/README.txt Message-ID: <20101218093024.E7EDB2A6C12E@llvm.org> Author: geoffray Date: Sat Dec 18 03:30:24 2010 New Revision: 122151 URL: http://llvm.org/viewvc/llvm-project?rev=122151&view=rev Log: Remove useless file. Removed: vmkit/trunk/README.txt Removed: vmkit/trunk/README.txt URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/README.txt?rev=122150&view=auto ============================================================================== --- vmkit/trunk/README.txt (original) +++ vmkit/trunk/README.txt (removed) @@ -1,26 +0,0 @@ -//===---------------------------------------------------------------------===// -// General notes -//===---------------------------------------------------------------------===// - -VMKit is the composition of three libraries: -1) MVM: threads, GCs, and JIT interface -2) J3: a Java Virtual Machine implemented with MVM and LLVM -3) N3: a CLI implementation with MVM and LLVM - -These are the options you should pass to the ./configure script ---with-llvmsrc: the source directory of LLVM ---with-llvmobj: the object directory of LLVM ---with-gnu-classpath-libs: GNU classpath libraries ---with-gnu-classpath-glibj: GNU classpath glibj.zip ---with-pnet-local-prefix: the local build of PNET ---with-pnetlib: PNET's mscorlib.dll ---with-mono: Mono's mscorlib.dll ---with-gc: use either gc-mmap or MMTk (requires --with-llvmgcc) - -Running make on the root tree will produce the following "tools": -1) Debug|Release/bin/j3: running the J3 like any other JVM. -2) Debug|Release/bin/n3-pnetlib: running N3 like CLR. -2) Debug|Release/bin/vmkit: shell-like vm launcher. -2) Debug|Release/bin/vmjc: ahead of time compiler for .class files. - -J3 also has a README note. From minas.subs at gmail.com Sat Dec 18 16:26:26 2010 From: minas.subs at gmail.com (Minas Abrahamyan) Date: Sun, 19 Dec 2010 04:26:26 +0400 Subject: [vmkit-commits] [vmkit] r122151 - /vmkit/trunk/README.txt In-Reply-To: <20101218093024.E7EDB2A6C12E@llvm.org> References: <20101218093024.E7EDB2A6C12E@llvm.org> Message-ID: > Remove useless file. But It was useful for initial building of VMkit, isn't it? On Sat, Dec 18, 2010 at 1:30 PM, Nicolas Geoffray wrote: > Author: geoffray > Date: Sat Dec 18 03:30:24 2010 > New Revision: 122151 > > URL: http://llvm.org/viewvc/llvm-project?rev=122151&view=rev > Log: > Remove useless file. > > > Removed: >    vmkit/trunk/README.txt > > Removed: vmkit/trunk/README.txt > URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/README.txt?rev=122150&view=auto > ============================================================================== > --- vmkit/trunk/README.txt (original) > +++ vmkit/trunk/README.txt (removed) > @@ -1,26 +0,0 @@ > -//===---------------------------------------------------------------------===// > -// General notes > -//===---------------------------------------------------------------------===// > - > -VMKit is the composition of three libraries: > -1) MVM: threads, GCs, and JIT interface > -2) J3: a Java Virtual Machine implemented with MVM and LLVM > -3) N3: a CLI implementation with MVM and LLVM > - > -These are the options you should pass to the ./configure script > ---with-llvmsrc: the source directory of LLVM > ---with-llvmobj: the object directory of LLVM > ---with-gnu-classpath-libs: GNU classpath libraries > ---with-gnu-classpath-glibj: GNU classpath glibj.zip > ---with-pnet-local-prefix: the local build of PNET > ---with-pnetlib: PNET's mscorlib.dll > ---with-mono: Mono's mscorlib.dll > ---with-gc: use either gc-mmap or MMTk (requires --with-llvmgcc) > - > -Running make on the root tree will produce the following "tools": > -1) Debug|Release/bin/j3: running the J3 like any other JVM. > -2) Debug|Release/bin/n3-pnetlib: running N3 like CLR. > -2) Debug|Release/bin/vmkit: shell-like vm launcher. > -2) Debug|Release/bin/vmjc: ahead of time compiler for .class files. > - > -J3 also has a README note. > > > _______________________________________________ > vmkit-commits mailing list > vmkit-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits > From nicolas.geoffray at gmail.com Mon Dec 20 09:41:40 2010 From: nicolas.geoffray at gmail.com (nicolas geoffray) Date: Mon, 20 Dec 2010 18:41:40 +0100 Subject: [vmkit-commits] [vmkit] r122151 - /vmkit/trunk/README.txt In-Reply-To: References: <20101218093024.E7EDB2A6C12E@llvm.org> Message-ID: It was kind of outdated, and the instructions on the website should cover the initial building. Nicolas On Sun, Dec 19, 2010 at 1:26 AM, Minas Abrahamyan wrote: > > Remove useless file. > > But It was useful for initial building of VMkit, isn't it? > > On Sat, Dec 18, 2010 at 1:30 PM, Nicolas Geoffray > wrote: > > Author: geoffray > > Date: Sat Dec 18 03:30:24 2010 > > New Revision: 122151 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=122151&view=rev > > Log: > > Remove useless file. > > > > > > Removed: > > vmkit/trunk/README.txt > > > > Removed: vmkit/trunk/README.txt > > URL: > http://llvm.org/viewvc/llvm-project/vmkit/trunk/README.txt?rev=122150&view=auto > > > ============================================================================== > > --- vmkit/trunk/README.txt (original) > > +++ vmkit/trunk/README.txt (removed) > > @@ -1,26 +0,0 @@ > > > -//===---------------------------------------------------------------------===// > > -// General notes > > > -//===---------------------------------------------------------------------===// > > - > > -VMKit is the composition of three libraries: > > -1) MVM: threads, GCs, and JIT interface > > -2) J3: a Java Virtual Machine implemented with MVM and LLVM > > -3) N3: a CLI implementation with MVM and LLVM > > - > > -These are the options you should pass to the ./configure script > > ---with-llvmsrc: the source directory of LLVM > > ---with-llvmobj: the object directory of LLVM > > ---with-gnu-classpath-libs: GNU classpath libraries > > ---with-gnu-classpath-glibj: GNU classpath glibj.zip > > ---with-pnet-local-prefix: the local build of PNET > > ---with-pnetlib: PNET's mscorlib.dll > > ---with-mono: Mono's mscorlib.dll > > ---with-gc: use either gc-mmap or MMTk (requires --with-llvmgcc) > > - > > -Running make on the root tree will produce the following "tools": > > -1) Debug|Release/bin/j3: running the J3 like any other JVM. > > -2) Debug|Release/bin/n3-pnetlib: running N3 like CLR. > > -2) Debug|Release/bin/vmkit: shell-like vm launcher. > > -2) Debug|Release/bin/vmjc: ahead of time compiler for .class files. > > - > > -J3 also has a README note. > > > > > > _______________________________________________ > > vmkit-commits mailing list > > vmkit-commits at cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits > > > > _______________________________________________ > vmkit-commits mailing list > vmkit-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits > -------------- next part -------------- An HTML attachment was scrubbed... URL: