[llvm-commits] [vmkit] r50551 - in /vmkit/trunk: Makefile.am README configure.ac lib/N3/Makefile.am lib/N3/README lib/N3/VMCore/Makefile.am lib/N3/VMCore/PNetLib.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu May 1 15:53:48 PDT 2008


Author: geoffray
Date: Thu May  1 17:53:48 2008
New Revision: 50551

URL: http://llvm.org/viewvc/llvm-project?rev=50551&view=rev
Log:
Port N3 to PNET 0.8.0. N3 does not require to patch pnet anymore.


Modified:
    vmkit/trunk/Makefile.am
    vmkit/trunk/README
    vmkit/trunk/configure.ac
    vmkit/trunk/lib/N3/Makefile.am
    vmkit/trunk/lib/N3/README
    vmkit/trunk/lib/N3/VMCore/Makefile.am
    vmkit/trunk/lib/N3/VMCore/PNetLib.cpp

Modified: vmkit/trunk/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.am?rev=50551&r1=50550&r2=50551&view=diff

==============================================================================
--- vmkit/trunk/Makefile.am (original)
+++ vmkit/trunk/Makefile.am Thu May  1 17:53:48 2008
@@ -1,4 +1,9 @@
-# $Id: Makefile.am,v 1.3 2008/03/21 11:25:06 varth Exp $
-SUBDIRS = lib/Mvm lib/JnJVM lib/N3
-DIST_SUBDIRS = lib/Mvm lib/JnJVM lib/N3
+SUBDIRS = lib/Mvm lib/JnJVM
+DIST_SUBDIRS = lib/Mvm lib/JnJVM
+
+if WITH_N3
+SUBDIRS += lib/N3
+DIST_SUBDIRS += lib/N3
+endif
+
 EXTRA_DIST = 

Modified: vmkit/trunk/README
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/README?rev=50551&r1=50550&r2=50551&view=diff

==============================================================================
--- vmkit/trunk/README (original)
+++ vmkit/trunk/README Thu May  1 17:53:48 2008
@@ -16,6 +16,7 @@
 
 There are mainly two options in the ./configure script
 --with-gnu-classpath-local-prefix: the local build of GNU classpath
+--with-pnet-local-prefix: the local build of PNET
 --with-llvm: the local build of LLVM
 --with-gc: user either boehm or single-mmap
 
@@ -24,7 +25,7 @@
 2) lib/JnJVM/main: running the JnJVM like any other JVM
 3) lib/N3/main: running N3 like CLR
 
-JnJVM and N3 have their own README notes. N3 requires to patch pnet-0.7.4.
+JnJVM and N3 have their own README notes.
 
 
 //===---------------------------------------------------------------------===//

Modified: vmkit/trunk/configure.ac
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/configure.ac?rev=50551&r1=50550&r2=50551&view=diff

==============================================================================
--- vmkit/trunk/configure.ac (original)
+++ vmkit/trunk/configure.ac Thu May  1 17:53:48 2008
@@ -292,6 +292,26 @@
 AC_SUBST([classpathglibj])
 AC_SUBST([classpathlibs])
 
+dnl **************************************************************************
+dnl Local PNet directory
+dnl **************************************************************************
+AC_ARG_WITH(pnet-local-prefix,
+       [AS_HELP_STRING(--with-pnet-local-prefix=something,
+           [PNET local prefix (no default)])],
+       [[pnetlocalprefix=$withval]],
+       [[       echo Not using PNETlocal prefix.    
+                                pnetlocalprefix=''
+       ]]
+)
+
+AM_CONDITIONAL([WITH_N3], [test "x$pnetlocalprefix" != "x"])
+if test "x$pnetlocalprefix" != x; then
+  echo Using ${pnetlocalprefix} as PNET local prefix;
+  AC_DEFINE([WITH_N3], [1], [Compiling N3])
+fi
+
+AC_SUBST([pnetlocalprefix])
+
 
 
 AC_CONFIG_FILES([

Modified: vmkit/trunk/lib/N3/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/Makefile.am?rev=50551&r1=50550&r2=50551&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/Makefile.am (original)
+++ vmkit/trunk/lib/N3/Makefile.am Thu May  1 17:53:48 2008
@@ -6,5 +6,6 @@
 main_SOURCES = ../Mvm/Object.cpp ../Mvm/Sigsegv.cpp Main.cpp ../Mvm/MvmMemoryManager.cpp ../Mvm/JIT.cpp ../Mvm/EscapeAnalysis.cpp
 
 main_CXXFLAGS = -DPREFIX=\"$(PREFIX)\" -W -Wall -ansi -Wno-unused-parameter -Wno-long-long -Wno-unused-function -fno-omit-frame-pointer -g -Werror -O2
-main_LDADD = VMCore/.libs/libN3.a @GC_LIBS@ @GCTHREAD_LIBS@ @LLVMDYLIB@
+main_LDADD = VMCore/.libs/libN3.a @GC_LIBS@ @GCTHREAD_LIBS@ @LLVMDYLIB@ @pnetlocalprefix@/engine/libILEngine.a @pnetlocalprefix@/image/libILImage.a @pnetlocalprefix@/support/libILSupport.a \
+	     @pnetlocalprefix@/libffi/.libs/libffi.a @pnetlocalprefix@/dumpasm/libILDumpAsm.a /usr/lib/libtermcap.a
 main_LDFLAGS = @rdynamic@

Modified: vmkit/trunk/lib/N3/README
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/README?rev=50551&r1=50550&r2=50551&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/README (original)
+++ vmkit/trunk/lib/N3/README Thu May  1 17:53:48 2008
@@ -1,15 +1,12 @@
-1 - Install pnetlib-0.7.4
+1 - Install pnetlib-0.8.0
 
-2 - Patch and compile pnet
-  tar zxvf pnet-0.7.4.tar.gz
-  patch -p0 < pnet-0.7.4.patch
-  ./auto_gen.sh
+2 - Download pnet 0.8.0
+  tar zxvf pnet-0.8.0.tar.gz
   ./configure
   make
 
 3 - Compile n3
 
-3 - Run
-  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{dynamic libraries compiled in 2: pnet-0.7.4/engine/.libs:pnet-0.7.4/support/.libs}
+4 - Run
   export MSCORLIB={directory of pnetlib's mscorlib.dll}
   ./run-n3 HelloWorld.exe

Modified: vmkit/trunk/lib/N3/VMCore/Makefile.am
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Makefile.am?rev=50551&r1=50550&r2=50551&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/Makefile.am (original)
+++ vmkit/trunk/lib/N3/VMCore/Makefile.am Thu May  1 17:53:48 2008
@@ -11,4 +11,5 @@
 	Opcodes.cpp NativeUtil.h NativeUtil.cpp PNetLib.cpp N3ModuleProvider.cpp N3ModuleProvider.h \
 	PNetLib.h BackTrace.cpp LowerArrayLength.cpp
 
-libN3_la_CXXFLAGS =-DPREFIX=\"$(PREFIX)\" -W -Wall -ansi -Wno-unused-parameter -Wno-long-long -Wno-unused-function -fno-omit-frame-pointer -g -O2
+libN3_la_CXXFLAGS =-DPREFIX=\"$(PREFIX)\" -W -Wall -ansi -Wno-unused-parameter -Wno-long-long -Wno-unused-function -fno-omit-frame-pointer -g -O2 -I at pnetlocalprefix@/include \
+		   -I at pnetlocalprefix@/engine

Modified: vmkit/trunk/lib/N3/VMCore/PNetLib.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/PNetLib.cpp?rev=50551&r1=50550&r2=50551&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/PNetLib.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/PNetLib.cpp Thu May  1 17:53:48 2008
@@ -50,32 +50,50 @@
 #define METHOD_SEMANTIC_ATTRIBUTES_FIRE     0x20
 
 
-typedef uint32 (*uint32_void)(void);
-typedef sint32 (*sint32_sint32)(sint32);
-typedef char* (*string_void)(void);
-typedef sint32 (*sint32_ptr_sint32_ptr_sint32)(uint16*, sint32, uint8*, sint32);
-typedef void (*void_ptr_sint32)(void*, sint32);
-typedef char (*char_sint32)(sint32);
-typedef sint64 (*sint64_ptr)(void*);
-typedef uint32 (*uint32_ptr_ptr_uint32)(void*, void*, uint32);
-typedef sint32 (*sint32_ptr_ptr_sint32)(void*, void*, sint32);
-
-static void* pnetLibSupport;
-static void* pnetLibStdio;
-static void* pnetLibTime;
-static uint32_void ILGetCodePage;
-static uint32_void ILGetCultureID;
-static string_void ILGetCultureName;
-static sint32_sint32 ILAnsiGetMaxByteCount;
-static sint32_sint32 ILConsoleWriteChar;
-static uint32_void ILConsoleGetMode;
-static sint32_ptr_sint32_ptr_sint32 ILAnsiGetBytes;
-static void_ptr_sint32 StdFlush;
-static char_sint32 ILGetUnicodeCategory;
-static sint64_ptr ILTimeMethodsGetCurrentTime;
-static uint32_ptr_ptr_uint32 ILUnicodeStringToLower;
-static sint32_ptr_ptr_sint32 ILUnicodeStringCompareIgnoreCase;
-static sint32_ptr_ptr_sint32 ILUnicodeStringCompareNoIgnoreCase;
+extern "C" {
+extern uint32 ILGetCodePage(void);
+extern uint32 ILGetCultureID(void);
+extern char* ILGetCultureName(void);
+extern sint32 ILAnsiGetMaxByteCount(sint32);
+extern sint32  ILConsoleWriteChar(sint32);
+extern uint32 ILConsoleGetMode(void);
+extern sint32 ILAnsiGetBytes(uint16*, sint32, uint8*, sint32);
+extern void _IL_Stdio_StdFlush(void*, sint32);
+extern char ILGetUnicodeCategory(sint32);
+extern sint64 _IL_TimeMethods_GetCurrentTime(void*);
+extern uint32 ILUnicodeStringToLower(void*, void*, uint32);
+extern sint32 ILUnicodeStringCompareIgnoreCase(void*, void*, sint32);
+extern sint32 ILUnicodeStringCompareNoIgnoreCase(void*, void*, sint32);
+
+// PNET wants this
+void *GC_run_thread(void *(*thread_func)(void *), void *arg){ return 0; }
+#ifndef USE_GC_BOEHM
+int GC_invoke_finalizers (void) { return 0; }
+int GC_should_invoke_finalizers (void) { return 0; }
+void GC_register_finalizer_no_order(void) { return; }
+void GC_gcollect(void) {}
+void GC_malloc_uncollectable(void) {}
+void GC_exclude_static_roots(void) {}
+void GC_free(void) {}
+void GC_malloc_explicitly_typed(void) {}
+void GC_get_heap_size(void) {}
+void GC_register_disappearing_link(void) {}
+void GC_general_register_disappearing_link(void) {}
+void GC_pthread_sigmask(void) {}
+void GC_pthread_detach(void) {}
+void GC_pthread_create(void) {}
+void GC_malloc(void) {}
+void GC_make_descriptor(void) {}
+void GC_unregister_disappearing_link(void) {}
+void GC_finalizer_notifier(void) {}
+void GC_java_finalization(void) {}
+void GC_finalize_on_demand(void) {}
+void GC_set_max_heap_size(void) {}
+void GC_malloc_atomic(void) {}
+#endif
+}
+
+
 
 extern "C" void System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray(
                                                VMArray* array, VMField* field) {
@@ -229,7 +247,7 @@
 }
 
 extern "C" void Platform_Stdio_StdFlush(sint32 fd) {
-  StdFlush(0, fd);
+  _IL_Stdio_StdFlush(0, fd);
 }
 
 extern "C" void System_Array_InternalCopy(VMArray* src, sint32 sstart, 
@@ -673,7 +691,7 @@
 }
 
 extern "C" int64_t Platform_TimeMethods_GetCurrentTime() {
-  return ILTimeMethodsGetCurrentTime(0);
+  return _IL_TimeMethods_GetCurrentTime(0);
 }
 
 #define ASSEMBLY_VALUE(obj) ((Assembly**)obj)[3]
@@ -1153,35 +1171,4 @@
   void* p;
   p = (void*)&System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray;
   p = (void*)&System_Type_GetTypeFromHandle;
-  pnetLibSupport  = dlopen("libILSupport.so", RTLD_LAZY | RTLD_GLOBAL);
-  if (!pnetLibSupport) {
-    printf("error = %s\n", dlerror());
-  }
-  pnetLibStdio    = dlopen("libStdio.so", RTLD_LAZY | RTLD_GLOBAL);
-  pnetLibTime  = dlopen("libTime.so", RTLD_LAZY | RTLD_GLOBAL);
-  ILGetCodePage = (uint32_void)dlsym(pnetLibSupport, "ILGetCodePage");
-  assert(ILGetCodePage);
-  ILGetCultureID = (uint32_void)dlsym(pnetLibSupport, "ILGetCultureID");
-  assert(ILGetCultureID);
-  ILGetCultureName = (string_void)dlsym(pnetLibSupport, "ILGetCultureName");
-  assert(ILGetCultureName);
-  ILAnsiGetMaxByteCount = (sint32_sint32)dlsym(pnetLibSupport, "ILAnsiGetMaxByteCount");
-  assert(ILAnsiGetMaxByteCount);
-  ILConsoleGetMode = (uint32_void)dlsym(pnetLibSupport, "ILConsoleGetMode");
-  assert(ILConsoleGetMode);
-  ILConsoleWriteChar = (sint32_sint32)dlsym(pnetLibSupport, "ILConsoleWriteChar");
-  assert(ILConsoleWriteChar);
-  ILUnicodeStringToLower = (uint32_ptr_ptr_uint32)dlsym(pnetLibSupport, "ILUnicodeStringToLower");
-  assert(ILUnicodeStringToLower);
-  ILAnsiGetBytes = (sint32_ptr_sint32_ptr_sint32)dlsym(pnetLibSupport, "ILAnsiGetBytes");
-  assert(ILAnsiGetBytes);
-  StdFlush = (void_ptr_sint32)dlsym(pnetLibStdio, "_IL_Stdio_StdFlush");
-  assert(StdFlush);
-  ILGetUnicodeCategory = (char_sint32)dlsym(pnetLibSupport, "ILGetUnicodeCategory");
-  assert(ILGetUnicodeCategory);
-  ILTimeMethodsGetCurrentTime = (sint64_ptr)dlsym(pnetLibTime, "_IL_TimeMethods_GetCurrentTime");
-  ILUnicodeStringCompareIgnoreCase = (sint32_ptr_ptr_sint32)dlsym(pnetLibSupport, "ILUnicodeStringCompareIgnoreCase");
-  ILUnicodeStringCompareNoIgnoreCase = (sint32_ptr_ptr_sint32)dlsym(pnetLibSupport, "ILUnicodeStringCompareNoIgnoreCase");
-  assert(ILUnicodeStringCompareIgnoreCase);
-  assert(ILUnicodeStringCompareNoIgnoreCase);
 }





More information about the llvm-commits mailing list