[vmkit-commits] [vmkit] r53025 - in /vmkit/trunk: ./ autoconf/ lib/ lib/N3/ lib/N3/Mono/ lib/N3/PNetLib/ lib/N3/VMCore/ tools/ tools/n3-mono/ tools/n3-pnetlib/ tools/n3/
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Wed Jul 2 09:09:57 PDT 2008
Author: geoffray
Date: Wed Jul 2 11:09:46 2008
New Revision: 53025
URL: http://llvm.org/viewvc/llvm-project?rev=53025&view=rev
Log:
Make room for Mono support (currently unsupported).
No need to set the environment variable MSCORLIB anymore,
the path to the mscorlib.dll file is given to configure.
n3 is now either n3-mono or n3-pnetlib. n3-pnetlib is
the previous n3.
Added:
vmkit/trunk/lib/N3/Mono/
vmkit/trunk/lib/N3/Mono/Makefile
vmkit/trunk/lib/N3/Mono/Mono.cpp
vmkit/trunk/lib/N3/Mono/MonoMSCorlib.cpp
vmkit/trunk/lib/N3/Mono/MonoPath.cpp.in
vmkit/trunk/lib/N3/Mono/MonoString.cpp
vmkit/trunk/lib/N3/Mono/MonoString.h
vmkit/trunk/lib/N3/PNetLib/PNetPath.cpp.in
vmkit/trunk/tools/n3-mono/
vmkit/trunk/tools/n3-mono/Makefile (with props)
vmkit/trunk/tools/n3-pnetlib/
vmkit/trunk/tools/n3-pnetlib/Makefile (with props)
Removed:
vmkit/trunk/tools/n3/
Modified:
vmkit/trunk/Makefile.config.in
vmkit/trunk/autoconf/configure.ac
vmkit/trunk/configure
vmkit/trunk/lib/Makefile
vmkit/trunk/lib/N3/Makefile
vmkit/trunk/lib/N3/PNetLib/PNetMSCorlib.cpp
vmkit/trunk/lib/N3/VMCore/CLISignature.cpp
vmkit/trunk/lib/N3/VMCore/MSCorlib.h
vmkit/trunk/lib/N3/VMCore/N3.cpp
vmkit/trunk/lib/N3/VMCore/N3.h
vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp
vmkit/trunk/tools/Makefile
Modified: vmkit/trunk/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.config.in?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/Makefile.config.in (original)
+++ vmkit/trunk/Makefile.config.in Wed Jul 2 11:09:46 2008
@@ -1,4 +1,5 @@
GCLIB = @GC_LIBS@
-WITH_N3 = @WITH_N3@
+WITH_N3_PNETLIB = @WITH_N3_PNETLIB@
+WITH_N3_MONO = @WITH_N3_MONO@
WITH_JNJVM = @WITH_JNJVM@
N3_LIB = @N3_LIB@
Modified: vmkit/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/autoconf/configure.ac?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/autoconf/configure.ac (original)
+++ vmkit/trunk/autoconf/configure.ac Wed Jul 2 11:09:46 2008
@@ -262,7 +262,7 @@
)
if test "x${classpathlibs}" != "x/usr/lib/classpath"; then
- classpathinclude=${classpathlibs}/../include:/usr/include/classpath;
+ classpathinclude=${classpathlibs}/../include;
else
classpathinclude=/usr/include/classpath;
fi
@@ -291,18 +291,43 @@
]]
)
+AC_ARG_WITH(pnetlib,
+ [AS_HELP_STRING(--with-pnetlib=something,
+ [Pnetlib's mscorlib.dll location (default is /usr/lib/cscc/lib/)])],
+ [[pnetlibpath=$withval]],
+ [[pnetlibpath=/usr/lib/cscc/lib/]]
+)
+
if test "x$pnetlocalprefix" != x; then
echo Using ${pnetlocalprefix} as PNET local prefix;
- WITH_N3=1;
+ WITH_N3_PNETLIB=1;
else
- WITH_N3=0;
+ WITH_N3_PNETLIB=0;
fi
AC_SUBST([pnetlocalprefix])
-AC_SUBST([WITH_N3])
+AC_SUBST([WITH_N3_PNETLIB])
N3_LIB=PNetLib
AC_SUBST([N3_LIB])
+AC_SUBST([pnetlibpath])
+
+AC_ARG_WITH(mono,
+ [AS_HELP_STRING(--with-mono=something,
+ [Mono's mscorlib.dll location (no default)])],
+ [[monopath=$withval]],
+ [[echo Not using Mono]]
+)
+
+if test "x$monopath" != x; then
+ echo Building N3 with Mono;
+ WITH_N3_MONO=1;
+else
+ WITH_N3_MONO=0;
+fi
+
+AC_SUBST([WITH_N3_MONO])
+AC_SUBST([monopath])
dnl===-----------------------------------------------------------------------===
dnl===
@@ -481,16 +506,12 @@
AC_CONFIG_FILES(Makefile.common)
AC_CONFIG_FILES(Makefile.config)
AC_CONFIG_FILES([lib/JnJVM/Classpath/Classpath.h])
+AC_CONFIG_FILES([lib/N3/PNetLib/PNetPath.cpp])
+AC_CONFIG_FILES([lib/N3/Mono/MonoPath.cpp])
dnl Do special configuration of Makefiles
AC_CONFIG_MAKEFILE(Makefile)
AC_CONFIG_MAKEFILE(lib/Makefile)
-dnl **************************************************************************
-dnl LLVM Installation Prefix
-dnl **************************************************************************
-dnl LLVMDYLIB="`$llvmprefix/Release/bin/llvm-config --ldflags all` `$llvmprefix/Release/bin/llvm-config --libs all`"
-dnl AC_SUBST([LLVMDYLIB])
-
AC_OUTPUT
Modified: vmkit/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/configure?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/configure (original)
+++ vmkit/trunk/configure Wed Jul 2 11:09:46 2008
@@ -697,8 +697,11 @@
classpathversion
WITH_JNJVM
pnetlocalprefix
-WITH_N3
+WITH_N3_PNETLIB
N3_LIB
+pnetlibpath
+WITH_N3_MONO
+monopath
CXX
CXXFLAGS
ac_ct_CXX
@@ -1328,6 +1331,10 @@
--with-jnjvm=yes|no Build JnJVM (default is yes)
--with-pnet-local-prefix=something
PNET local prefix (no default)
+ --with-pnetlib=something
+ Pnetlib's mscorlib.dll location (default is
+ /usr/lib/cscc/lib/)
+ --with-mono=something Mono's mscorlib.dll location (no default)
Some influential environment variables:
CC C compiler command
@@ -4000,7 +4007,7 @@
if test "x${classpathlibs}" != "x/usr/lib/classpath"; then
- classpathinclude=${classpathlibs}/../include:/usr/include/classpath;
+ classpathinclude=${classpathlibs}/../include;
else
classpathinclude=/usr/include/classpath;
fi
@@ -4029,11 +4036,21 @@
fi
+
+# Check whether --with-pnetlib was given.
+if test "${with_pnetlib+set}" = set; then
+ withval=$with_pnetlib; pnetlibpath=$withval
+else
+ pnetlibpath=/usr/lib/cscc/lib/
+
+fi
+
+
if test "x$pnetlocalprefix" != x; then
echo Using ${pnetlocalprefix} as PNET local prefix;
- WITH_N3=1;
+ WITH_N3_PNETLIB=1;
else
- WITH_N3=0;
+ WITH_N3_PNETLIB=0;
fi
@@ -4043,6 +4060,27 @@
+
+# Check whether --with-mono was given.
+if test "${with_mono+set}" = set; then
+ withval=$with_mono; monopath=$withval
+else
+ echo Not using Mono
+
+fi
+
+
+if test "x$monopath" != x; then
+ echo Building N3 with Mono;
+ WITH_N3_MONO=1;
+else
+ WITH_N3_MONO=0;
+fi
+
+
+
+
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -7103,6 +7141,10 @@
ac_config_files="$ac_config_files lib/JnJVM/Classpath/Classpath.h"
+ac_config_files="$ac_config_files lib/N3/PNetLib/PNetPath.cpp"
+
+ac_config_files="$ac_config_files lib/N3/Mono/MonoPath.cpp"
+
ac_config_commands="$ac_config_commands Makefile"
@@ -7112,7 +7154,6 @@
-
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -7694,6 +7735,8 @@
"Makefile.common") CONFIG_FILES="$CONFIG_FILES Makefile.common" ;;
"Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;;
"lib/JnJVM/Classpath/Classpath.h") CONFIG_FILES="$CONFIG_FILES lib/JnJVM/Classpath/Classpath.h" ;;
+ "lib/N3/PNetLib/PNetPath.cpp") CONFIG_FILES="$CONFIG_FILES lib/N3/PNetLib/PNetPath.cpp" ;;
+ "lib/N3/Mono/MonoPath.cpp") CONFIG_FILES="$CONFIG_FILES lib/N3/Mono/MonoPath.cpp" ;;
"Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;;
"lib/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Makefile" ;;
@@ -7837,8 +7880,11 @@
classpathversion!$classpathversion$ac_delim
WITH_JNJVM!$WITH_JNJVM$ac_delim
pnetlocalprefix!$pnetlocalprefix$ac_delim
-WITH_N3!$WITH_N3$ac_delim
+WITH_N3_PNETLIB!$WITH_N3_PNETLIB$ac_delim
N3_LIB!$N3_LIB$ac_delim
+pnetlibpath!$pnetlibpath$ac_delim
+WITH_N3_MONO!$WITH_N3_MONO$ac_delim
+monopath!$monopath$ac_delim
CXX!$CXX$ac_delim
CXXFLAGS!$CXXFLAGS$ac_delim
ac_ct_CXX!$ac_ct_CXX$ac_delim
@@ -7852,9 +7898,6 @@
MV!$MV$ac_delim
RANLIB!$RANLIB$ac_delim
RM!$RM$ac_delim
-SED!$SED$ac_delim
-TAR!$TAR$ac_delim
-BINPWD!$BINPWD$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -7896,6 +7939,9 @@
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+SED!$SED$ac_delim
+TAR!$TAR$ac_delim
+BINPWD!$BINPWD$ac_delim
CAT!$CAT$ac_delim
LLVMAS!$LLVMAS$ac_delim
LLC!$LLC$ac_delim
@@ -7908,7 +7954,7 @@
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 10; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 13; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
Modified: vmkit/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Makefile?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/lib/Makefile (original)
+++ vmkit/trunk/lib/Makefile Wed Jul 2 11:09:46 2008
@@ -16,9 +16,7 @@
PARALLEL_DIRS += JnJVM
endif
-ifeq ($(WITH_N3), 1)
PARALLEL_DIRS += N3
-endif
LIBRARYNAME = Main
Modified: vmkit/trunk/lib/N3/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Makefile?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/Makefile (original)
+++ vmkit/trunk/lib/N3/Makefile Wed Jul 2 11:09:46 2008
@@ -10,6 +10,15 @@
include $(LEVEL)/Makefile.config
-DIRS = VMCore $(N3_LIB)
+DIRS = VMCore
+
+ifeq ($(WITH_N3_MONO), 1)
+ DIRS += Mono
+endif
+
+ifeq ($(WITH_N3_PNETLIB), 1)
+ DIRS += PNetLib
+endif
+
include $(LEVEL)/Makefile.common
Added: vmkit/trunk/lib/N3/Mono/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Mono/Makefile?rev=53025&view=auto
==============================================================================
--- vmkit/trunk/lib/N3/Mono/Makefile (added)
+++ vmkit/trunk/lib/N3/Mono/Makefile Wed Jul 2 11:09:46 2008
@@ -0,0 +1,13 @@
+##===- lib/N3/Mono/Makefile --------------------------------*- Makefile -*-===##
+#
+# The vmkit project
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+LEVEL = ../../..
+
+LIBRARYNAME = Mono
+include $(LEVEL)/Makefile.common
+CXX.Flags += -I../VMCore
Added: vmkit/trunk/lib/N3/Mono/Mono.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Mono/Mono.cpp?rev=53025&view=auto
==============================================================================
--- vmkit/trunk/lib/N3/Mono/Mono.cpp (added)
+++ vmkit/trunk/lib/N3/Mono/Mono.cpp Wed Jul 2 11:09:46 2008
@@ -0,0 +1,59 @@
+//===-------------- Mono.cpp - The Mono interface -------------------------===//
+//
+// N3
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+#include "mvm/JIT.h"
+
+#include "Assembly.h"
+#include "MSCorlib.h"
+#include "N3.h"
+#include "Reader.h"
+#include "VMArray.h"
+#include "VMClass.h"
+#include "VMObject.h"
+#include "VMThread.h"
+
+using namespace n3;
+
+extern "C" void System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray(
+ VMArray* array, VMField* field) {
+ if (!array || !field) return;
+
+ VMClass* type = field->classDef;
+ VMClassArray* ts = (VMClassArray*)array->classOf;
+ VMCommonClass* bs = ts->baseClass;
+ Assembly* ass = type->assembly;
+
+ uint32 rva = ass->getRVAFromField(field->token);
+ Section* rsrcSection = ass->rsrcSection;
+
+ uint32 size = array->size;
+ uint32 offset = rsrcSection->rawAddress + (rva - rsrcSection->virtualAddress);
+ ArrayUInt8* bytes = ass->bytes;
+
+ if (bs == MSCorlib::pChar) {
+ for (uint32 i = 0; i < size; ++i) {
+ ((ArrayUInt16*)array)->elements[i] = READ_U2(bytes, offset);
+ }
+ } else if (bs == MSCorlib::pSInt32) {
+ for (uint32 i = 0; i < size; ++i) {
+ ((ArraySInt32*)array)->elements[i] = READ_U4(bytes, offset);
+ }
+ } else if (bs == MSCorlib::pDouble) {
+ for (uint32 i = 0; i < size; ++i) {
+ ((ArrayDouble*)array)->elements[i] = READ_U8(bytes, offset);
+ }
+ } else {
+ VMThread::get()->vm->error("implement me");
+ }
+}
+
+extern "C" VMObject* System_Type_GetTypeFromHandle(VMCommonClass* cl) {
+ return cl->getClassDelegatee();
+}
Added: vmkit/trunk/lib/N3/Mono/MonoMSCorlib.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Mono/MonoMSCorlib.cpp?rev=53025&view=auto
==============================================================================
--- vmkit/trunk/lib/N3/Mono/MonoMSCorlib.cpp (added)
+++ vmkit/trunk/lib/N3/Mono/MonoMSCorlib.cpp Wed Jul 2 11:09:46 2008
@@ -0,0 +1,166 @@
+//===----- MonoMSCorlib.cpp - The Mono MSCorlib implementation ------------===//
+//
+// N3
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+
+#include "mvm/JIT.h"
+
+#include "Assembly.h"
+#include "MSCorlib.h"
+#include "N3.h"
+#include "VMClass.h"
+#include "VMObject.h"
+#include "VMThread.h"
+
+using namespace n3;
+
+void MSCorlib::loadStringClass(N3* vm) {
+ VMClass* type = (VMClass*)vm->coreAssembly->loadTypeFromName(
+ vm->asciizConstructUTF8("String"),
+ vm->asciizConstructUTF8("System"),
+ false, false, false, true);
+ MSCorlib::pString = type;
+ type->resolveType(false, false);
+
+ uint64 size = mvm::jit::getTypeSize(type->virtualType->getContainedType(0)) + sizeof(const UTF8*) + sizeof(llvm::GlobalVariable*);
+ type->virtualInstance =
+ (VMObject*)gc::operator new(size, type->virtualInstance->getVirtualTable());
+ type->virtualInstance->initialise(type);
+}
+
+
+void MSCorlib::initialise(N3* vm) {
+
+ VMClass* runtimeTypeHandle = 0;
+ VMClass* realClrType = 0;
+ #define INIT(var, nameSpace, name, type, prim) {\
+ var = (VMClass*)vm->coreAssembly->loadTypeFromName( \
+ vm->asciizConstructUTF8(name), \
+ vm->asciizConstructUTF8(nameSpace),\
+ false, false, false, true); \
+ var->isPrimitive = prim; \
+ if (type) { \
+ var->naturalType = type; \
+ var->virtualType = type; \
+ }}
+
+ INIT(MSCorlib::clrType, "System", "MonoType", 0, false);
+ INIT(realClrType, "System", "Type", 0, false);
+ INIT(runtimeTypeHandle, "System", "RuntimeTypeHandle", 0, false);
+ /*
+ INIT(MSCorlib::assemblyReflection, "System.Reflection", "Assembly", 0, false);
+ INIT(MSCorlib::typedReference, "System", "TypedReference", 0, false);
+ INIT(MSCorlib::propertyType, "System.Reflection", "ClrProperty", 0, false);
+ INIT(MSCorlib::methodType, "System.Reflection", "ClrMethod", 0, false);
+ INIT(MSCorlib::resourceStreamType, "System.Reflection", "ClrResourceStream", 0, false);*/
+#undef INIT
+
+ {
+ MSCorlib::clrType->resolveType(false, false);
+ MSCorlib::typeClrType = realClrType->lookupField(vm->asciizConstructUTF8("_impl"), runtimeTypeHandle, false, false);
+ }
+
+/*
+ {
+ MSCorlib::assemblyReflection->resolveType(false, false);
+ std::vector<VMCommonClass*> args;
+ args.push_back(MSCorlib::pVoid);
+ args.push_back(MSCorlib::assemblyReflection);
+ MSCorlib::ctorAssemblyReflection = MSCorlib::assemblyReflection->lookupMethod(vm->asciizConstructUTF8(".ctor"), args, false, false);
+ MSCorlib::assemblyAssemblyReflection = MSCorlib::assemblyReflection->lookupField(vm->asciizConstructUTF8("privateData"), MSCorlib::pIntPtr, false, false);
+ }
+
+ {
+ MSCorlib::propertyType->resolveType(false, false);
+ std::vector<VMCommonClass*> args;
+ args.push_back(MSCorlib::pVoid);
+ args.push_back(MSCorlib::propertyType);
+ MSCorlib::ctorPropertyType = MSCorlib::propertyType->lookupMethod(vm->asciizConstructUTF8(".ctor"), args, false, false);
+ MSCorlib::propertyPropertyType = MSCorlib::propertyType->lookupField(vm->asciizConstructUTF8("privateData"), MSCorlib::pIntPtr, false, false);
+ }
+
+ {
+ MSCorlib::methodType->resolveType(false, false);
+ std::vector<VMCommonClass*> args;
+ args.push_back(MSCorlib::pVoid);
+ args.push_back(MSCorlib::methodType);
+ MSCorlib::ctorMethodType = MSCorlib::methodType->lookupMethod(vm->asciizConstructUTF8(".ctor"), args, false, false);
+ MSCorlib::methodMethodType = MSCorlib::methodType->lookupField(vm->asciizConstructUTF8("privateData"), MSCorlib::pIntPtr, false, false);
+ }
+
+ {
+ MSCorlib::resourceStreamType->resolveType(false, false);
+ std::vector<VMCommonClass*> args;
+ args.push_back(MSCorlib::pVoid);
+ args.push_back(MSCorlib::resourceStreamType);
+ args.push_back(MSCorlib::pIntPtr);
+ args.push_back(MSCorlib::pSInt64);
+ args.push_back(MSCorlib::pSInt64);
+ MSCorlib::ctorResourceStreamType = MSCorlib::resourceStreamType->lookupMethod(vm->asciizConstructUTF8(".ctor"), args, false, false);
+ }
+
+ VMCommonClass* voidPtr = vm->coreAssembly->constructPointer(MSCorlib::pVoid, 1);
+#define INIT(var, cl, type) {\
+ cl->resolveType(false, false); \
+ var = cl->lookupField(vm->asciizConstructUTF8("value_"), type, false, false); \
+ }
+
+ INIT(MSCorlib::ctorBoolean, MSCorlib::pBoolean, MSCorlib::pBoolean);
+ INIT(MSCorlib::ctorUInt8, MSCorlib::pUInt8, MSCorlib::pUInt8);
+ INIT(MSCorlib::ctorSInt8, MSCorlib::pSInt8, MSCorlib::pSInt8);
+ INIT(MSCorlib::ctorChar, MSCorlib::pChar, MSCorlib::pChar);
+ INIT(MSCorlib::ctorSInt16, MSCorlib::pSInt16, MSCorlib::pSInt16);
+ INIT(MSCorlib::ctorUInt16, MSCorlib::pUInt16, MSCorlib::pUInt16);
+ INIT(MSCorlib::ctorSInt32, MSCorlib::pSInt32, MSCorlib::pSInt32);
+ INIT(MSCorlib::ctorUInt32, MSCorlib::pUInt32, MSCorlib::pUInt32);
+ INIT(MSCorlib::ctorSInt64, MSCorlib::pSInt64, MSCorlib::pSInt64);
+ INIT(MSCorlib::ctorUInt64, MSCorlib::pUInt64, MSCorlib::pUInt64);
+ INIT(MSCorlib::ctorIntPtr, MSCorlib::pIntPtr, voidPtr);
+ INIT(MSCorlib::ctorUIntPtr, MSCorlib::pUIntPtr, voidPtr);
+ INIT(MSCorlib::ctorDouble, MSCorlib::pDouble, MSCorlib::pDouble);
+ INIT(MSCorlib::ctorFloat, MSCorlib::pFloat, MSCorlib::pFloat);
+
+#undef INIT
+
+ */
+}
+#include "NativeUtil.h"
+void NativeUtil::initialise() {
+}
+
+VMObject* Property::getPropertyDelegatee() {
+ if (!delegatee) {
+ VMThread::get()->vm->error("implement me");
+ }
+ return delegatee;
+}
+
+VMObject* VMMethod::getMethodDelegatee() {
+ if (!delegatee) {
+ VMThread::get()->vm->error("implement me");
+ }
+ return delegatee;
+}
+
+VMObject* VMCommonClass::getClassDelegatee() {
+ if (!delegatee) {
+ delegatee = (*MSCorlib::clrType)();
+ (*MSCorlib::typeClrType)(delegatee, (VMObject*)this);
+ }
+ return delegatee;
+}
+
+VMObject* Assembly::getAssemblyDelegatee() {
+ if (!delegatee) {
+ VMThread::get()->vm->error("implement me");
+ }
+ return delegatee;
+}
+
+void MSCorlib::loadBootstrap(N3* vm) {
+}
Added: vmkit/trunk/lib/N3/Mono/MonoPath.cpp.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Mono/MonoPath.cpp.in?rev=53025&view=auto
==============================================================================
--- vmkit/trunk/lib/N3/Mono/MonoPath.cpp.in (added)
+++ vmkit/trunk/lib/N3/Mono/MonoPath.cpp.in Wed Jul 2 11:09:46 2008
@@ -0,0 +1,15 @@
+//===------ MonoPath.cpp - mscorlib.dll location for mono -----------------===//
+//
+// N3
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "MSCorlib.h"
+
+using namespace n3;
+
+const char* MSCorlib::libsPath = "@monopath@/";
+
Added: vmkit/trunk/lib/N3/Mono/MonoString.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Mono/MonoString.cpp?rev=53025&view=auto
==============================================================================
--- vmkit/trunk/lib/N3/Mono/MonoString.cpp (added)
+++ vmkit/trunk/lib/N3/Mono/MonoString.cpp Wed Jul 2 11:09:46 2008
@@ -0,0 +1,62 @@
+//===--- PNetString.cpp - Implementation of PNet string interface ---------===//
+//
+// N3
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/GlobalVariable.h"
+
+#include "mvm/JIT.h"
+
+#include "CLIString.h"
+#include "MSCorlib.h"
+#include "N3.h"
+#include "MonoString.h"
+#include "VMArray.h"
+#include "VMClass.h"
+#include "VMThread.h"
+
+using namespace n3;
+using namespace llvm;
+
+
+CLIString* CLIString::stringDup(const UTF8*& utf8, N3* vm) {
+ MonoString* obj = (MonoString*)(*MSCorlib::pString)();
+ obj->length = utf8->size;
+ if (utf8->size == 0) {
+ obj->startChar = 0;
+ } else {
+ obj->startChar = utf8->at(0);
+ }
+ obj->value = utf8;
+ return obj;
+}
+
+char* CLIString::strToAsciiz() {
+ return ((MonoString*)this)->value->UTF8ToAsciiz();
+}
+
+const UTF8* CLIString::strToUTF8(N3* vm) {
+ return ((MonoString*)this)->value;
+}
+
+GlobalVariable* CLIString::llvmVar() {
+ MonoString* str = (MonoString*)this;
+ if (!str->_llvmVar) {
+ VirtualMachine* vm = VMThread::get()->vm;
+ if (!str->_llvmVar) {
+ const Type* pty = mvm::jit::ptrType;
+ Constant* cons =
+ ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, uint64_t (this)),
+ pty);
+ str->_llvmVar = new GlobalVariable(pty, true,
+ GlobalValue::ExternalLinkage,
+ cons, "",
+ vm->module);
+ }
+ }
+ return str->_llvmVar;
+}
Added: vmkit/trunk/lib/N3/Mono/MonoString.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Mono/MonoString.h?rev=53025&view=auto
==============================================================================
--- vmkit/trunk/lib/N3/Mono/MonoString.h (added)
+++ vmkit/trunk/lib/N3/Mono/MonoString.h Wed Jul 2 11:09:46 2008
@@ -0,0 +1,37 @@
+//===---------- MonoString.h - String representation in Mono --------------===//
+//
+// N3
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef N3_MONO_STRING_H
+#define N3_MONO_STRING_H
+
+#include "llvm/GlobalVariable.h"
+
+#include "types.h"
+#include "mvm/PrintBuffer.h"
+
+#include "CLIString.h"
+
+namespace n3 {
+
+class UTF8;
+
+class MonoString : public CLIString {
+public:
+
+ // !!! mono layout !!!
+ sint32 length;
+ uint8 startChar;
+ const UTF8* value;
+ llvm::GlobalVariable* _llvmVar;
+
+};
+
+} // end namespace n3
+
+#endif
Modified: vmkit/trunk/lib/N3/PNetLib/PNetMSCorlib.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/PNetLib/PNetMSCorlib.cpp?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/PNetLib/PNetMSCorlib.cpp (original)
+++ vmkit/trunk/lib/N3/PNetLib/PNetMSCorlib.cpp Wed Jul 2 11:09:46 2008
@@ -15,6 +15,7 @@
#include "N3.h"
#include "VMClass.h"
#include "VMObject.h"
+#include "VMThread.h"
using namespace n3;
@@ -162,3 +163,24 @@
}
return delegatee;
}
+
+static void mapInitialThread(N3* vm) {
+ VMClass* cl = (VMClass*)vm->coreAssembly->loadTypeFromName(
+ vm->asciizConstructUTF8("Thread"),
+ vm->asciizConstructUTF8("System.Threading"),
+ true, true, true, true);
+ VMObject* th = (*cl)();
+ std::vector<VMCommonClass*> args;
+ args.push_back(MSCorlib::pVoid);
+ args.push_back(cl);
+ args.push_back(MSCorlib::pIntPtr);
+ VMMethod* meth = cl->lookupMethod(vm->asciizConstructUTF8(".ctor"), args,
+ false, false);
+ VMThread* myth = VMThread::get();
+ (*meth)(th, myth);
+ myth->vmThread = th;
+}
+
+void MSCorlib::loadBootstrap(N3* vm) {
+ mapInitialThread(vm);
+}
Added: vmkit/trunk/lib/N3/PNetLib/PNetPath.cpp.in
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/PNetLib/PNetPath.cpp.in?rev=53025&view=auto
==============================================================================
--- vmkit/trunk/lib/N3/PNetLib/PNetPath.cpp.in (added)
+++ vmkit/trunk/lib/N3/PNetLib/PNetPath.cpp.in Wed Jul 2 11:09:46 2008
@@ -0,0 +1,15 @@
+//===---------- PNetPath.h - Configuration for pnetlib --------------------===//
+//
+// N3
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "MSCorlib.h"
+
+using namespace n3;
+
+const char* MSCorlib::libsPath = "@pnetlibpath@/";
+
Modified: vmkit/trunk/lib/N3/VMCore/CLISignature.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLISignature.cpp?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLISignature.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLISignature.cpp Wed Jul 2 11:09:46 2008
@@ -19,6 +19,9 @@
using namespace n3;
+// ECMA 335: page 150 23.1.16 Element types used in signatures
+
+
static VMCommonClass* METHOD_ElementTypeEnd(uint32 op, Assembly* ass, uint32& offset) {
VMThread::get()->vm->error("implement me");
return 0;
Modified: vmkit/trunk/lib/N3/VMCore/MSCorlib.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/MSCorlib.h?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/MSCorlib.h (original)
+++ vmkit/trunk/lib/N3/VMCore/MSCorlib.h Wed Jul 2 11:09:46 2008
@@ -22,6 +22,9 @@
public:
static void initialise(N3* vm);
static void loadStringClass(N3* vm);
+ static void loadBootstrap(N3* vm);
+
+ static const char* libsPath;
static VMMethod* ctorClrType;
static VMClass* clrType;
Modified: vmkit/trunk/lib/N3/VMCore/N3.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/N3.cpp?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/N3.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/N3.cpp Wed Jul 2 11:09:46 2008
@@ -198,27 +198,6 @@
}
-void N3::mapInitialThread() {
- VMClass* cl = (VMClass*)coreAssembly->loadTypeFromName(
- asciizConstructUTF8("Thread"),
- asciizConstructUTF8("System.Threading"),
- true, true, true, true);
- VMObject* th = (*cl)();
- std::vector<VMCommonClass*> args;
- args.push_back(MSCorlib::pVoid);
- args.push_back(cl);
- args.push_back(MSCorlib::pIntPtr);
- VMMethod* meth = cl->lookupMethod(asciizConstructUTF8(".ctor"), args,
- false, false);
- VMThread* myth = VMThread::get();
- (*meth)(th, myth);
- myth->vmThread = th;
-}
-
-void N3::loadBootstrap() {
- mapInitialThread();
-}
-
void N3::waitForExit() {
threadSystem->nonDaemonLock->lock();
--(threadSystem->nonDaemonThreads);
@@ -277,7 +256,7 @@
argv = argv + info.appArgumentsPos - 1;
argc = argc - info.appArgumentsPos + 1;
- loadBootstrap();
+ MSCorlib::loadBootstrap(this);
ArrayObject* args = ArrayObject::acons(argc - 2, MSCorlib::arrayString);
for (int i = 2; i < argc; ++i) {
Modified: vmkit/trunk/lib/N3/VMCore/N3.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/N3.h?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/N3.h (original)
+++ vmkit/trunk/lib/N3/VMCore/N3.h Wed Jul 2 11:09:46 2008
@@ -58,8 +58,6 @@
Assembly* loadAssembly(const UTF8* name, const char* extension);
void executeAssembly(const char* name, ArrayObject* args);
void runMain(int argc, char** argv);
- void mapInitialThread();
- void loadBootstrap();
void waitForExit();
static N3* bootstrapVM;
Modified: vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp Wed Jul 2 11:09:46 2008
@@ -228,12 +228,8 @@
- char* assemblyName = getenv("MSCORLIB");
- if (assemblyName == 0)
- VMThread::get()->vm->error("can not find mscorlib.dll. Abort");
-
vm->assemblyPath.push_back("");
- vm->assemblyPath.push_back(assemblyName);
+ vm->assemblyPath.push_back(MSCorlib::libsPath);
const UTF8* mscorlib = vm->asciizConstructUTF8("mscorlib");
Assembly* ass = vm->loadAssembly(mscorlib, "dll");
Modified: vmkit/trunk/tools/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/Makefile?rev=53025&r1=53024&r2=53025&view=diff
==============================================================================
--- vmkit/trunk/tools/Makefile (original)
+++ vmkit/trunk/tools/Makefile Wed Jul 2 11:09:46 2008
@@ -16,8 +16,12 @@
PARALLEL_DIRS += jnjvm
endif
-ifeq ($(WITH_N3), 1)
- PARALLEL_DIRS += n3
+ifeq ($(WITH_N3_MONO), 1)
+ PARALLEL_DIRS += n3-mono
+endif
+
+ifeq ($(WITH_N3_PNETLIB), 1)
+ PARALLEL_DIRS += n3-pnetlib
endif
Added: vmkit/trunk/tools/n3-mono/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/n3-mono/Makefile?rev=53025&view=auto
==============================================================================
--- vmkit/trunk/tools/n3-mono/Makefile (added)
+++ vmkit/trunk/tools/n3-mono/Makefile Wed Jul 2 11:09:46 2008
@@ -0,0 +1,17 @@
+##===- tools/n3/Mono/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 = n3-mono
+LINK_COMPONENTS = engine scalaropts instrumentation ipa ipo
+USEDLIBS = Allocator CommonThread Mvm N3 Main $(GCLIB) Mono
+
+include $(LEVEL)/Makefile.common
Propchange: vmkit/trunk/tools/n3-mono/Makefile
------------------------------------------------------------------------------
svn:executable = *
Added: vmkit/trunk/tools/n3-pnetlib/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/n3-pnetlib/Makefile?rev=53025&view=auto
==============================================================================
--- vmkit/trunk/tools/n3-pnetlib/Makefile (added)
+++ vmkit/trunk/tools/n3-pnetlib/Makefile Wed Jul 2 11:09:46 2008
@@ -0,0 +1,22 @@
+##===- tools/n3/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 = n3-pnetlib
+LINK_COMPONENTS = engine scalaropts instrumentation ipa ipo
+USEDLIBS = Allocator CommonThread Mvm N3 Main $(GCLIB) PNetLib
+
+include $(LEVEL)/Makefile.common
+
+
+LIBS += $(PNETLIB)/engine/libILEngine.a $(PNETLIB)/image/libILImage.a $(PNETLIB)/support/libILSupport.a \
+ $(PNETLIB)/libffi/.libs/libffi.a $(PNETLIB)//dumpasm/libILDumpAsm.a
+
Propchange: vmkit/trunk/tools/n3-pnetlib/Makefile
------------------------------------------------------------------------------
svn:executable = *
More information about the vmkit-commits
mailing list