[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
Gael Thomas
gael.thomas at lip6.fr
Sat Dec 11 04:02:46 PST 2010
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
More information about the vmkit-commits
mailing list