harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Prepscius <timprepsc...@gmail.com>
Subject Re: harmony vm as a lib
Date Sat, 26 Dec 2009 04:18:18 GMT
Greetings again,

I thought I would give an update on my latest hours of staring at working_vm.
So at this point, I've gotten everything to be a static.  I've gotten
things to link.

I've gotten all of the EM stuff to work.  (with a hack).  I've gotten
the interpreter to become the default _execute_method (with a hack).

At this point I'm trying to get the classes of
"luni-kernal-stubs.jar" (which I renamed to kernal.jar) and "luni.jar"
to load.

It seems to be getting through a few, and is crashing on java/lang/String.
Why? I have no idea as of yet.  I guess that is tomorrow or Sunday.


Hmm.. If any one looks over the changes and thinks, "man there is a
much easier way for him to be doing this.."   I would gladly take any
comments.  It is pretty cumbersome stepping through things and trying
to figure out what initializations actually do what.  Anyway.
Hopefully, soon I'll have a complete interpreter with kernal classes
.. (which is pretty much all I need)

Here's where it's crashing  (if you are interested):


runs runs runs....  gets to the initializing the java lang string

[trace] initializing class java/lang/String STEP 8
[trace]
{{{ interpreter_invoke: 013F7758.<clinit>()V
[trace] interpreter: 013F7758.<clinit>()V
[trace] StartLoading class java/lang/String$CaseInsensitiveComparator
with loader 013A12A8
[trace] 013A12A8 013BD608 I java/lang/String$CaseInsensitiveComparator
[trace] Loader (013A12A8) loading class:
java/lang/String$CaseInsensitiveComparator...
[trace] Defining class java/lang/String$CaseInsensitiveComparator with
loader 013A12A8
[trace] 013A12A8 013BD608 DC java/lang/String$CaseInsensitiveComparator
[trace] 013A12A8 013BD608 CDAI 013BD608
java/lang/String$CaseInsensitiveComparator
[trace] allocating Class for "java/lang/String$CaseInsensitiveComparator"
[trace] NewClass inserting class
"java/lang/String$CaseInsensitiveComparator" with key
java/lang/String$CaseInsensitiveComparator and object 01
[trace] classloader_name: <null> is trusted: 1
[trace] number of local vars:1
[trace] number of local vars:3
[trace] number of local vars:0
[trace] number of local vars:0
[trace] ByteReader::have: EOB
[trace] StartLoading class java/lang/Object with loader 013A12A8
[trace] StartLoading class java/util/Comparator with loader 013A12A8
[trace] 013A12A8 013BD608 I java/util/Comparator
[trace] Loader (013A12A8) loading class: java/util/Comparator...
[trace] Defining class java/util/Comparator with loader 013A12A8
[trace] 013A12A8 013BD608 DC java/util/Comparator
[trace] 013A12A8 013BD608 CDAI 013BD608 java/util/Comparator
[trace] allocating Class for "java/util/Comparator"
[trace] NewClass inserting class "java/util/Comparator" with key
java/util/Comparator and object 013A1B50@20770540
[trace] classloader_name: <null> is trusted: 1
[trace] ByteReader::have: EOB
[trace] StartLoading class java/lang/Object with loader 013A12A8
[trace] 013A12A8 013BD608 R java/util/Comparator
[Loaded java/util/Comparator from
c:\source3\harmony\working_vm\vm\executable\javaexe\luni.jar]
[trace] BEGIN class prepare, class name = java/util/Comparator
[trace] interface java/util/Comparator prepared
[trace] END class prepare, class name = java/util/Comparator
[trace] StartLoading class java/io/Serializable with loader 013A12A8
[trace] 013A12A8 013BD608 R java/lang/String$CaseInsensitiveComparator
[Loaded java/lang/String$CaseInsensitiveComparator from
c:\source3\harmony\working_vm\vm\executable\javaexe\luni.jar]
[trace] BEGIN class prepare, class name =
java/lang/String$CaseInsensitiveComparator
[trace] class 013F9A48 allocated size 8
[trace] class java/lang/String$CaseInsensitiveComparator prepared
[trace] END class prepare, class name =
java/lang/String$CaseInsensitiveComparator
[trace] initializing class java/lang/String$CaseInsensitiveComparator
[trace] initializing class java/lang/String$CaseInsensitiveComparator STEP 2
[trace] initializing class java/lang/String$CaseInsensitiveComparatorSTEP 6
[trace] class java/lang/String$CaseInsensitiveComparator initialized
[trace]
{{{ invoke_special    :
013F9A48.<init>(Ljava/lang/String$CaseInsensitiveComparator;)V
[trace] interpreter:
013F9A48.<init>(Ljava/lang/String$CaseInsensitiveComparator;)V
[trace]
{{{ invoke_special    : 013F9A48.<init>()V
[trace] interpreter: 013F9A48.<init>()V
[trace]
{{{ invoke_special    : 013A14E8.<init>()V
[trace] interpreter: 013A14E8.<init>()V
[trace] invoke_special }}}

[trace] invoke_special }}}

[trace] invoke_special }}}

[trace] initializing class java/lang/String
[trace] initializing class java/lang/String STEP 2
[trace] initializing class java/lang/String
[trace] initializing class java/lang/String STEP 2

... does STEP 2 for a while ...

[trace] initializing class java/lang/String
[trace] initializing class java/lang/String STEP 2
[trace] initializing class java/lang/String
[trace] initializing class java/lang/String STEP 2
[trace]
{{{ interpreter_invoke: 013F7C00.intern(Ljava/lang/String;)Ljava/lang/String;
[trace] interpreter: 013F7C00.intern(Ljava/lang/String;)Ljava/lang/String;
[trace] interpreter_invoke }}}

*** CRASH ***
well actually assert on

   vm_execute_java_method_array((jmethodID)env->VM_intern,
        (jvalue*)&string, args);

    if (exn_raised()) { //if RuntimeException or Error
        return NULL;
    }
    assert(string);  <<-------------- HERE


**************************************************

Here is a diff so far:  It's getting pretty long, maybe I should post
it somewhere else?
After I get finally a working VM, I'll go in an minimize the changes necessary.

Index: harmony/working_vm/vm/em/src/DrlEMImpl.cpp
===================================================================
--- harmony/working_vm/vm/em/src/DrlEMImpl.cpp	(revision 883577)
+++ harmony/working_vm/vm/em/src/DrlEMImpl.cpp	(working copy)
@@ -43,6 +43,8 @@
 #include "port_threadunsafe.h"
 #include "port_mutex.h"

+#include "dll_jit_intf.h"
+
 #define EDGE_PROFILER_STR  "EDGE_PROFILER"
 #define VALUE_PROFILER_STR  "VALUE_PROFILER"
 #define ENTRY_BACKEDGE_PROFILER_STR  "EB_PROFILER"
@@ -267,15 +269,32 @@
 }


-static std::string readFile(const std::string& fileName) {
+static std::string readFile(const std::string& fileName)
+{
+	char *c_string_tmp_value =
vm_properties_get_value("em.config_override", VM_PROPERTIES);
+	std::string configOverride = c_string_tmp_value ? c_string_tmp_value : "";
+	vm_properties_destroy_value (c_string_tmp_value);
+
     std::string config;
-    std::ifstream configFile;
-    configFile.open(fileName.c_str(), std::ios::in);
+    std::istream *configFile;
+
+	if (configOverride.empty())
+	{
+		configFile = new std::ifstream (fileName.c_str(), std::ios::in);
+		if (!((std::ifstream*)configFile)->is_open())
+		{
+			delete configFile;
+			configFile = NULL;
+		}
+	}
+	else
+		configFile = new std::istringstream (configOverride);
+
     bool rc = false;
-    if (configFile.is_open()) {
+    if (configFile) {
         std::string line;
         size_t idx = std::string::npos;
-        while (getline(configFile, line)) {
+        while (getline(*configFile, line)) {
             if (startsWith(line, "#")) {
                 continue;
             } else if (startsWith(line, "-D") && (idx =
line.find('=')) != std::string::npos) {
@@ -325,6 +344,8 @@
     if (!rc) {
         LECHO(1, "EM: Can't read configuration from '{0}'" <<
fileName.c_str());
     }
+
+	delete configFile;
     return config;
 }

@@ -439,30 +460,51 @@
         for (StringList::const_iterator jitIt = jitsInChain.begin(),
jitEnd = jitsInChain.end(); jitIt!=jitEnd; ++jitIt) {
             std::string jitName= *jitIt;
             std::string jitLib = getJITLibFromCmdLine(jitName);
+
             if (jitLib.empty()) {
                 jitLib = getParam(config, jitName+".file");
             }
-            if (jitLib.empty()) {
+
+			if (jitLib.empty()) {
                 LECHO(4, "EM: No JIT library specified for JIT
:'{0}'" << jitLib.c_str());
                 failed = true;
                 break;
             }
-            std::string fullJitLibPath = prepareLibPath(jitLib);
-            apr_dso_handle_t* libHandle;
-            JIT_Handle jh = vm_load_jit(fullJitLibPath.c_str(),
&libHandle); //todo: do not load the same dll twice!!!
-            if (jh == NULL) {
-                LECHO(5, "EM: JIT library loading error:'{0}'" <<
fullJitLibPath.c_str());
-                failed = true;
-                break;
-            }
-            RStep* step = new RStep(jh, jitName, chain, libHandle);
-            step->loggingEnabled = loggingEnabled ||
log_is_info_enabled(step->catName.c_str());
-            chain->steps.push_back(step);

-            if (!initJIT(fullJitLibPath, libHandle, *step)) {
-                failed = true;
-                break;
-            }
+			if (jitLib == "_static_")
+			{
+				apr_dso_handle_t* libHandle;
+				jh = vm_load_jit(NULL, &libHandle);
+				JIT_init (jh, jitName.c_str(), NULL);
+
+				RStep* step = new RStep(jh, jitName, chain, libHandle);
+				step->loggingEnabled = loggingEnabled ||
log_is_info_enabled(step->catName.c_str());
+				chain->steps.push_back(step);
+
+	            _execute_method =
+					(void(*)(JIT_Handle,jmethodID, jvalue*, jvalue*))
+						(((Dll_JIT *)jh)->_execute_method);
+			}
+			else
+			{
+				std::string fullJitLibPath = prepareLibPath(jitLib);
+				apr_dso_handle_t* libHandle;
+
+				JIT_Handle jh = vm_load_jit(fullJitLibPath.c_str(), &libHandle);
//todo: do not load the same dll twice!!!
+				if (jh == NULL) {
+					LECHO(5, "EM: JIT library loading error:'{0}'" << fullJitLibPath.c_str());
+					failed = true;
+					break;
+				}
+				RStep* step = new RStep(jh, jitName, chain, libHandle);
+				step->loggingEnabled = loggingEnabled ||
log_is_info_enabled(step->catName.c_str());
+				chain->steps.push_back(step);
+
+				if (!initJIT(fullJitLibPath, libHandle, *step)) {
+					failed = true;
+					break;
+				}
+			}
         }
         failed = failed || chain->steps.empty();
         if (!failed) {
Index: harmony/working_vm/vm/gc_gen/src/common/gc_for_vm.cpp
===================================================================
--- harmony/working_vm/vm/gc_gen/src/common/gc_for_vm.cpp	(revision 883577)
+++ harmony/working_vm/vm/gc_gen/src/common/gc_for_vm.cpp	(working copy)
@@ -36,6 +36,7 @@
 #include "../finalizer_weakref/finalizer_weakref.h"
 #include "collection_scheduler.h"
 #include "gc_concurrent.h"
+#include "open/gc.h"
 #ifdef USE_32BITS_HASHCODE
 #include "hashcode.h"
 #endif
@@ -65,6 +66,10 @@
     vm_helper_register_magic_helper(VM_RT_GET_IDENTITY_HASHCODE,
"org/apache/harmony/drlvm/gc_gen/GCHelper", "get_hashcode");
 }

+#pragma message("WHERE DOES THIS COMPILE?")
+
+
+
 int gc_init()
 {
   INFO2("gc.process", "GC: call GC init...\n");
@@ -177,6 +182,9 @@
 #endif
 }

+#pragma message("WHERE DOES THIS COMPILE?")
+
+
 /* this interface need reconsidering. is_pinned is unused. */
 void gc_add_root_set_entry(Managed_Object_Handle *ref, Boolean is_pinned)
 {
Index: harmony/working_vm/vm/include/jni_types.h
===================================================================
--- harmony/working_vm/vm/include/jni_types.h	(revision 883577)
+++ harmony/working_vm/vm/include/jni_types.h	(working copy)
@@ -49,8 +49,13 @@
  */
 #if defined (_WIN32) || defined (__WIN32__) || defined (WIN32)

+#if defined(STATIC_BUILD)
+#define JNIEXPORT
+#define JNIIMPORT
+#else
 #define JNIEXPORT __declspec(dllexport)
 #define JNIIMPORT __declspec(dllimport)
+#endif
 #define JNICALL __stdcall

 typedef signed __int64 jlong;
Index: harmony/working_vm/vm/include/open/gc.h
===================================================================
--- harmony/working_vm/vm/include/open/gc.h	(revision 883577)
+++ harmony/working_vm/vm/include/open/gc.h	(working copy)
@@ -61,6 +61,7 @@
 #define GCExport
 #endif /* #ifndef PLATFORM_POSIX */

+	
 #define BITS_PER_BYTE 8

 // Signed arithmetic is used when we do allocation pointer/limit compares.
@@ -75,6 +76,8 @@

 #if defined(USE_GC_STATIC) || defined(BUILDING_GC)

+#pragma message("USE_GC_STATIC OR BUILDING_GC defined")
+
 /**
  * @name Routines to support the initialization and termination of GC
  */
@@ -762,7 +765,7 @@
 /**
  * Get object hashcode.
  */
-GCExport I_32 gc_get_hashcode (Managed_Object_Handle p_object);
+GCExport I_32 gc_get_hashcode0 (Managed_Object_Handle p_object);

 /**
  * Iterate all live objects in heap.
Index: harmony/working_vm/vm/include/open/platform_types.h
===================================================================
--- harmony/working_vm/vm/include/open/platform_types.h	(revision 883577)
+++ harmony/working_vm/vm/include/open/platform_types.h	(working copy)
@@ -25,7 +25,8 @@
 /**
  * DLL stuff
  */
-#if defined(PLATFORM_POSIX) || (defined(USE_STATIC_GC) && defined(BUILDING_GC))
+#if defined(PLATFORM_POSIX) || (defined(USE_STATIC_GC) &&
defined(BUILDING_GC)) || defined(STATIC_BUILD)
+#pragma message("CORRECT VMEXPORT")

 #define VMEXPORT
 #define VMIMPORT
@@ -33,13 +34,9 @@
 #define EMEXPORT

 #else  // !PLATFORM_POSIX
+#pragma message("NOT CORRECt VMEXPORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")

-#if defined(STATIC_BUILD)
-#define VMEXPORT
-#define JITEXPORT
-#define EMEXPORT
-#define VMIMPORT
-#elif defined(BUILDING_VM)
+#if defined(BUILDING_VM)
 #define VMEXPORT __declspec(dllexport)
 #define JITEXPORT __declspec(dllimport)
 #define EMEXPORT __declspec(dllimport)
Index: harmony/working_vm/vm/include/em_intf.h
===================================================================
--- harmony/working_vm/vm/include/em_intf.h	(revision 883577)
+++ harmony/working_vm/vm/include/em_intf.h	(working copy)
@@ -22,6 +22,7 @@

 #include "open/types.h"
 #include "open/em.h"
+#include "open/compmgr.h"
 #include <apr_dso.h>

 #ifdef __cplusplus
@@ -30,6 +31,11 @@

 VMEXPORT JIT_Handle vm_load_jit(const char* file_name,
apr_dso_handle_t** handle);

+EMEXPORT
+int EmInitialize(OpenComponentHandle* p_component,
+                 OpenInstanceAllocatorHandle* p_allocator,
+                 apr_pool_t* pool);
+
 #ifdef __cplusplus
 }
 #endif
Index: harmony/working_vm/vm/interpreter/src/interp_exports.cpp
===================================================================
--- harmony/working_vm/vm/interpreter/src/interp_exports.cpp	(revision 883577)
+++ harmony/working_vm/vm/interpreter/src/interp_exports.cpp	(working copy)
@@ -25,18 +25,14 @@

 typedef void *GC_Enumeration_Handle;

-#ifndef PLATFORM_POSIX
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#define EXPORT JITEXPORT

 extern "C" {
     extern void EXPORT JIT_init(JIT_Handle h, const char* name,
vm_adaptor_t adaptor);
     EXPORT extern void JIT_deinit(JIT_Handle h);
     EXPORT extern void JIT_unwind_stack_frame(JIT_Handle,
Method_Handle, JitFrameContext *);
-    EXPORT extern void JIT_get_root_set_from_stack_frame(JIT_Handle,
Method_Handle, GC_Enumeration_Handle, JitFrameContext *);
-    EXPORT extern void JIT_get_root_set_for_thread_dump(JIT_Handle,
Method_Handle, GC_Enumeration_Handle, JitFrameContext *);
+    EXPORT extern void JIT_get_root_set_from_stack_frame(JIT_Handle,
Method_Handle, GC_Enumeration_Handle, const JitFrameContext *);
+    EXPORT extern void JIT_get_root_set_for_thread_dump(JIT_Handle,
Method_Handle, GC_Enumeration_Handle, const JitFrameContext *);
     EXPORT extern void JIT_fix_handler_context(JIT_Handle,
Method_Handle, JitFrameContext *);
     EXPORT extern void * JIT_get_address_of_this(JIT_Handle,
Method_Handle, const JitFrameContext *);
     EXPORT extern Boolean JIT_supports_compressed_references(JIT_Handle);
@@ -44,8 +40,8 @@
 }

 EXPORT void JIT_unwind_stack_frame(JIT_Handle, Method_Handle,
JitFrameContext *) { LDIE(51, "Not implemented"); }
-EXPORT void JIT_get_root_set_from_stack_frame(JIT_Handle,
Method_Handle, GC_Enumeration_Handle, JitFrameContext *) { LDIE(51,
"Not implemented"); }
-EXPORT void JIT_get_root_set_for_thread_dump(JIT_Handle,
Method_Handle, GC_Enumeration_Handle, JitFrameContext *) {return;}
+EXPORT void JIT_get_root_set_from_stack_frame(JIT_Handle,
Method_Handle, GC_Enumeration_Handle, const JitFrameContext *) {
LDIE(51, "Not implemented"); }
+EXPORT void JIT_get_root_set_for_thread_dump(JIT_Handle,
Method_Handle, GC_Enumeration_Handle, const JitFrameContext *)
{return;}
 EXPORT void JIT_fix_handler_context(JIT_Handle, Method_Handle,
JitFrameContext *) { LDIE(51, "Not implemented"); }
 EXPORT void * JIT_get_address_of_this(JIT_Handle, Method_Handle,
const JitFrameContext *) { LDIE(51, "Not implemented"); return (void
*)JIT_FAILURE;}

Index: harmony/working_vm/vm/port/include/cxxlog.h
===================================================================
--- harmony/working_vm/vm/port/include/cxxlog.h	(revision 883577)
+++ harmony/working_vm/vm/port/include/cxxlog.h	(working copy)
@@ -64,8 +64,12 @@
  * and debugging <code>printf</code>.
  */
 #ifdef NDEBUG
+#pragma message("NO DEBUG")
+
 #    define TRACE2(category, message)
 #else
+#pragma message("DEBUG!!!!!!")
+
 #    define TRACE2(category, message) LOG_SITE(trace, category, \
         log_printf("[trace] "); \
         log_header(category, __FILELINE__, __PRETTY_FUNCTION__); \
Index: harmony/working_vm/vm/port/src/logger/logger.cpp
===================================================================
--- harmony/working_vm/vm/port/src/logger/logger.cpp	(revision 883577)
+++ harmony/working_vm/vm/port/src/logger/logger.cpp	(working copy)
@@ -104,11 +104,12 @@
 }  light_logger = {
     NULL, &vfprintf, &exit, &abort, stdout, NULL, LOG_EMPTY, NULL,
NULL, NULL };

-Logger default_logger = {
-    NULL, &vfprintf, &exit, &abort, stdout, NULL, LOG_EMPTY, NULL,
NULL, NULL };

 static Logger* get()
 {
+	static Logger default_logger = {
+		NULL, &vfprintf, &exit, &abort, stdout, NULL, LOG_EMPTY, NULL, NULL, NULL };
+
     return &default_logger;
 }

@@ -382,7 +383,7 @@
  */
 static LogState is_enabled(const char *category, LogCategory *log_category) {
     int max_size = -1;
-    LogState enabled = LOG_DISABLED;
+    LogState enabled = LOG_ENABLED;
     while (log_category) {
         if (strncmp(log_category->name, category, log_category->len) == 0) {
             if (log_category->len > max_size) {
Index: harmony/working_vm/vm/vmcore/include/dll_jit_intf.h
===================================================================
--- harmony/working_vm/vm/vmcore/include/dll_jit_intf.h	(revision 883577)
+++ harmony/working_vm/vm/vmcore/include/dll_jit_intf.h	(working copy)
@@ -286,9 +286,13 @@
     Boolean
     (*_supports_compressed_references)(JIT_Handle jit);

+
+public:
     void
     (*_execute_method) (JIT_Handle jit, jmethodID method, jvalue
*return_value, jvalue *args);

+private:
+
     OpenExeJpdaError
         (*_get_bc_location_for_native)(JIT_Handle jit, Method_Handle  method,
         NativeCodePtr   native_pc, uint16 *bc_pc);
Index: harmony/working_vm/vm/vmcore/src/jit/dll_jit.cpp
===================================================================
--- harmony/working_vm/vm/vmcore/src/jit/dll_jit.cpp	(revision 883577)
+++ harmony/working_vm/vm/vmcore/src/jit/dll_jit.cpp	(working copy)
@@ -23,7 +23,54 @@
 #include "open/gc.h"
 #include "compile.h"

+//#ifdef STATIC_BUILD

+#include <stdlib.h>
+#include <stdio.h>
+#include "open/types.h"
+#include "open/vm.h"
+#include "platform_lowlevel.h"
+#include "interpreter_exports.h"
+#include "jit_export.h"
+#include "cxxlog.h"
+
+extern "C" {
+    extern void JIT_init(JIT_Handle h, const char* name, vm_adaptor_t adaptor);
+    extern void JIT_deinit(JIT_Handle h);
+    extern void JIT_unwind_stack_frame(JIT_Handle, Method_Handle,
JitFrameContext *);
+    extern void JIT_get_root_set_from_stack_frame(JIT_Handle,
Method_Handle, GC_Enumeration_Handle, const JitFrameContext *);
+    extern void JIT_get_root_set_for_thread_dump(JIT_Handle,
Method_Handle, GC_Enumeration_Handle, const JitFrameContext *);
+    extern void JIT_fix_handler_context(JIT_Handle, Method_Handle,
JitFrameContext *);
+    extern void * JIT_get_address_of_this(JIT_Handle, Method_Handle,
const JitFrameContext *);
+    extern Boolean JIT_supports_compressed_references(JIT_Handle);
+    extern void JIT_execute_method(JIT_Handle,jmethodID method,
jvalue *return_value, jvalue *args);
+}
+
+Dll_JIT::Dll_JIT () :
+	_deinit(&JIT_deinit),
+	_next_command_line_argument(NULL),
+	_compile_method_with_params(NULL),
+	_unwind_stack_frame(&JIT_unwind_stack_frame),
+	_get_root_set_from_stack_frame(&JIT_get_root_set_from_stack_frame),
+	_get_root_set_for_thread_dump(&JIT_get_root_set_for_thread_dump),
+	_fix_handler_context(&JIT_fix_handler_context),
+	_get_address_of_this(&JIT_get_address_of_this),
+	_recompiled_method_callback(NULL),
+	_execute_method(&JIT_execute_method),
+	_get_bc_location_for_native(NULL),
+	_get_native_location_for_bc(NULL),
+	_get_local_var(NULL),
+	_set_local_var(NULL),
+	jit_dll_filename(NULL),
+	lib_handle(NULL)
+{
+	apr_pool_t *pool;
+	apr_pool_create_ex(&pool, NULL, NULL, NULL);
+	apr_os_dso_handle_put (&lib_handle, NULL, pool);
+}
+
+//#endif
+
 Dll_JIT::Dll_JIT(const char *dll_filename) :
 _deinit(NULL),
 _next_command_line_argument(NULL),
Index: harmony/working_vm/vm/vmcore/src/gc/dll_gc.cpp
===================================================================
--- harmony/working_vm/vm/vmcore/src/gc/dll_gc.cpp	(revision 883577)
+++ harmony/working_vm/vm/vmcore/src/gc/dll_gc.cpp	(working copy)
@@ -17,8 +17,6 @@
 #define LOG_DOMAIN "vm.core"
 #include "cxxlog.h"

-#ifndef USE_GC_STATIC
-
 #include <apr_dso.h>
 #include <apr_errno.h>
 #include "dll_gc.h"
@@ -67,6 +65,8 @@

 static Boolean default_gc_supports_class_unloading();

+#if !defined(USE_GC_STATIC)
+
 Boolean (*gc_supports_compressed_references)() = 0;
 void (*gc_add_root_set_entry)(Managed_Object_Handle *ref, Boolean
is_pinned) = 0;
 void (*gc_add_weak_root_set_entry)(Managed_Object_Handle *ref,
Boolean is_pinned,Boolean is_short_weak) = 0;
@@ -353,6 +353,8 @@
     return result;
 } //vm_is_a_gc_dll

+#endif
+
 static Boolean default_gc_requires_barriers()
 {
     return FALSE;
@@ -558,4 +560,28 @@
 {
     return TRUE;
 } //default_gc_supports_class_unloading
-#endif // !USE_GC_STATIC
+
+#ifdef USE_GC_STATIC
+
+void gc_add_root_set_entry_managed_pointer(void **slot, Boolean is_pinned)
+{
+	default_gc_add_root_set_entry_managed_pointer(slot, is_pinned);
+}
+
+Boolean gc_supports_frontier_allocation (unsigned *offset_of_current,
unsigned *offset_of_limit)
+{
+	return default_gc_supports_frontier_allocation(offset_of_current,
offset_of_limit);
+}
+
+void gc_add_compressed_root_set_entry (U_32 * UNREF ref, Boolean is_pinned)
+{
+	default_gc_add_compressed_root_set_entry(ref);
+}
+
+I_32 gc_get_hashcode0 (Managed_Object_Handle handle)
+{
+	return default_gc_get_hashcode(handle);
+}
+
+#endif// !USE_GC_STATIC
+
Index: harmony/working_vm/vm/vmcore/src/jvmti/jvmti_roots.cpp
===================================================================
--- harmony/working_vm/vm/vmcore/src/jvmti/jvmti_roots.cpp	(revision 883577)
+++ harmony/working_vm/vm/vmcore/src/jvmti/jvmti_roots.cpp	(working copy)
@@ -337,7 +337,11 @@

 void ti_enumerate_roots(TIEnv *ti_env, hythread_iterator_t iterator)
 {
-    TRACE2("ti.trace", "enumerating roots");
+#if defined(USE_GC_STATIC)
+	// TJP.. THIS FUNCTION WON'T WORK WITH STATIC GC
+	assert(false);
+#else
+	TRACE2("ti.trace", "enumerating roots");

     // FIXME: weird function table manipulations
     void (*save_gc_add_root_set_entry)
@@ -392,4 +396,5 @@
         save_gc_add_compressed_root_set_entry;

     TRACE2("ti.trace", "completed root enumeration");
+#endif
 }
Index: harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp
===================================================================
--- harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp	(revision
883577)
+++ harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp	(working
copy)
@@ -1563,7 +1563,7 @@
     char *lib_list = m_env->VmProperties()->get("vm.other_natives_dlls");

     // separate natives libraries
-    char *lib_name = strtok( lib_list, PORT_PATH_SEPARATOR_STR );
+	char *lib_name = lib_list ? strtok( lib_list,
PORT_PATH_SEPARATOR_STR ) : NULL;

     while( lib_name != NULL )
     {
Index: harmony/working_vm/vm/vmcore/src/init/vm_properties.cpp
===================================================================
--- harmony/working_vm/vm/vmcore/src/init/vm_properties.cpp	(revision 883577)
+++ harmony/working_vm/vm/vmcore/src/init/vm_properties.cpp	(working copy)
@@ -289,6 +289,21 @@
 //vm part
 static void init_vm_properties(Properties & properties)
 {
+		properties.set_new(
+			"em.config_override",
+
+			"chains=chain1\n"
+			"chain1.jits=int\n"
+			"int.file=_static_\n"
+			"#system properties\n"
+			"-Djava.compiler=interpreter\n"
+			"-XX:+vm.use_interpreter\n"
+		);
+
+		properties.set_new (
+			"-Xbootclasspath:", "kernal.jar;luni.jar"
+			);
+
 #ifdef _DEBUG
         properties.set_new("vm.assert_dialog", "true");
 #else
@@ -313,7 +328,7 @@
         *  any path pre-pended
         */
         const char* path_buf =
compose_full_files_path_names_list(NULL, api_dll_files,
n_api_dll_files, true);
-        properties.set_new("vm.other_natives_dlls", path_buf);
+//        properties.set_new("vm.other_natives_dlls", path_buf);
 }

 jint initialize_properties(Global_Env * p_env)
Index: harmony/working_vm/vm/vmcore/src/init/vm_init.cpp
===================================================================
--- harmony/working_vm/vm/vmcore/src/init/vm_init.cpp	(revision 883577)
+++ harmony/working_vm/vm/vmcore/src/init/vm_init.cpp	(working copy)
@@ -53,6 +53,9 @@
 #include "jit_intf.h"
 #include "signals.h"

+#include "em_intf.h"
+#include <string.h>
+
 #ifdef _WIN32
 // 20040427 Used to turn on heap checking on every allocation
 #include <crtdbg.h>
@@ -174,18 +177,48 @@
 #define GC_DLL (vm_env->compress_references ? GC_DLL_COMP : GC_DLL_UNCOMP)
 #endif

+static jint process_properties_dlls_statics (Global_Env *vm_env)
+{
+    jint status;

+	CmAddComponent (&EmInitialize);
+
+    status = vm_env->cm->GetComponent(&(vm_env->em_component), OPEN_EM);
+    if (JNI_OK != status) {
+        return status;
+    }
+
+    status = vm_env->cm->CreateInstance(&(vm_env->em_instance), OPEN_EM);
+    if (JNI_OK != status) {
+        LWARN(14, "Cannot instantiate EM");
+        return status;
+    }
+
+	// this actually sets the em_interface pointer
+    status = vm_env->em_component->GetInterface((OpenInterfaceHandle*)
&(vm_env->em_interface), OPEN_INTF_EM_VM);
+    if (JNI_OK != status) {
+        LWARN(15, "Cannot get EM_VM interface");
+        return status;
+    }
+
+	return JNI_OK;
+}
+
 /**
  * Loads DLLs.
  */
 static jint process_properties_dlls(Global_Env * vm_env) {
+#ifdef STATIC_BUILD
+	return process_properties_dlls_statics (vm_env);
+#endif
+
     jint status;

     if (!vm_env->VmProperties()->is_set("vm.em_dll")) {
         vm_env->VmProperties()->set("vm.em_dll", PORT_DSO_NAME("em"));
     }

-    char* dll = vm_env->VmProperties()->get("vm.em_dll");
+	char* dll = vm_env->VmProperties()->get("vm.em_dll");
     TRACE("analyzing em dll " << dll);
     status = CmLoadComponent(dll, "EmInitialize");
     vm_env->VmProperties()->destroy(dll);
@@ -1084,7 +1117,13 @@
 }

 JIT_Handle vm_load_jit(const char* file_name, apr_dso_handle_t** handle) {
-        Dll_JIT* jit = new Dll_JIT(file_name);
+		Dll_JIT* jit;
+
+		if (!file_name)
+			jit = new Dll_JIT();
+		else
+			jit = new Dll_JIT(file_name);
+
         *handle = jit->get_lib_handle();
         if(!*handle) {
             delete jit;
Index: harmony/working_vm/vm/vmcore/src/interpreter/interp_exports.cpp
===================================================================
--- harmony/working_vm/vm/vmcore/src/interpreter/interp_exports.cpp	(revision
883577)
+++ harmony/working_vm/vm/vmcore/src/interpreter/interp_exports.cpp	(working
copy)
@@ -24,7 +24,7 @@
 #include "interpreter_exports.h"
 #include "cxxlog.h"

-char const * * opcodeNames = 0;
+//extern char const * * opcodeNames = 0;
 #define JVMTI_NYI 0

 static bool interp_enabled = false;
Index: harmony/working_vm/vm/vmcore/src/thread/verify_stack_enumeration.cpp
===================================================================
--- harmony/working_vm/vm/vmcore/src/thread/verify_stack_enumeration.cpp	(revision
883577)
+++ harmony/working_vm/vm/vmcore/src/thread/verify_stack_enumeration.cpp	(working
copy)
@@ -96,6 +96,11 @@

 void verify_stack_enumeration() {

+#if defined(USE_STATIC_GC) || defined(STATIC_BUILD)
+	// TJP THIS FUNCTION WILL NOT WORK WITH STATIC GC
+	assert (false);
+#else
+
     // XXX: workaround to avoid infinite recursion
     // due to suspend_enable() in vm_gc_lock_enum()
     verify_stack_enumeration_flag = false;
@@ -194,6 +199,7 @@
     // switch back to verification enabled
     // mode after releasing gc lock.
     verify_stack_enumeration_flag = true;
+#endif
 }

 // Let it be literate :)
Index: harmony/working_vm/vm/jitrino/src/vm/VMInterface.cpp
===================================================================
--- harmony/working_vm/vm/jitrino/src/vm/VMInterface.cpp	(revision 883577)
+++ harmony/working_vm/vm/jitrino/src/vm/VMInterface.cpp	(working copy)
@@ -22,7 +22,7 @@

 #include "mkernel.h"

-#define DYNAMIC_OPEN
+//#define DYNAMIC_OPEN
 #include "VMInterface.h"
 #include "open/vm_properties.h"
 #include "open/vm_class_manipulation.h"
@@ -46,11 +46,14 @@
 #include "PlatformDependant.h"

 #include "VMMagic.h"
+#include "open/hythread.h"
+#include "open/hythread_ext.h"

 namespace Jitrino {

 vm_adaptor_t VMInterface::vm = 0;

+#if defined(DYNAMIC_OPEN)

 static  allocation_handle_get_class_t  allocation_handle_get_class = 0;

@@ -433,8 +436,16 @@
         return NULL != vm(id);
     }

+#else

+IDATA vm_tls_alloc (hythread_tls_key_t * handle) {  return
hythread_tls_alloc(handle); }
+UDATA vm_tls_get_offset (hythread_tls_key_t key) { return
hythread_tls_get_offset(key); }
+UDATA vm_tls_get_request_offset () { return
hythread_tls_get_request_offset(); }
+UDATA vm_tls_is_fast () { return hythread_uses_fast_tls(); }
+IDATA vm_get_tls_offset_in_segment () { return
hythread_get_hythread_offset_in_tls(); }

+#endif
+
 // The JIT info block is laid out as:
 //    header
 //    stack info
Index: harmony/working_vm/make/vm/em.xml
===================================================================
--- harmony/working_vm/make/vm/em.xml	(revision 883577)
+++ harmony/working_vm/make/vm/em.xml	(working copy)
@@ -23,7 +23,7 @@

     <target name="build" depends="-common-vm">
         <init-native/>
-        <make-native libname="em" type="shared">
+        <make-native libname="em" type="static">
         <compiler id="cpp.compiler" extends="common.cpp.compiler">
             <includepath>
                 <dirset dir="${vm.home}">
@@ -36,6 +36,8 @@
                 <pathelement location="${drlvm.include.dir}" />
             </includepath>

+          <defineset define="APR_DECLARE_STATIC,STATIC_BUILD" />
+
             <fileset dir="${vm.home}/em/src">
                 <include name="*.cpp" />
             </fileset>
Index: harmony/working_vm/make/vm/gc_gen.xml
===================================================================
--- harmony/working_vm/make/vm/gc_gen.xml	(revision 883577)
+++ harmony/working_vm/make/vm/gc_gen.xml	(working copy)
@@ -114,7 +114,7 @@
         <compile-cc>
             <compiler refid="cpp.compiler"/>
         </compile-cc>
-        <link-lib name="gc_gen_uncomp" type="shared">
+        <link-lib name="gc_gen_uncomp" type="static">
             <linker refid="linker"/>
         </link-lib>
    </target>
@@ -127,7 +127,7 @@
             <compiler refid="cpp.compiler"/>
             <defineset define="COMPRESS_REFERENCE" />
         </compile-cc>
-        <link-lib name="gc_gen" type="shared">
+        <link-lib name="gc_gen" type="static">
             <linker refid="linker"/>
         </link-lib>
    </target>
Index: harmony/working_vm/make/vm/interpreter.xml
===================================================================
--- harmony/working_vm/make/vm/interpreter.xml	(revision 883577)
+++ harmony/working_vm/make/vm/interpreter.xml	(working copy)
@@ -78,7 +78,7 @@
         </compiler>
         </compile-cc>

-        <link-lib name="interpreter" type="shared">
+        <link-lib name="interpreter" type="static">
             <linker id="linker" extends="common.linker">
                 <linkerarg
value="--version-script=${vm.home}/interpreter/build/interpreter.exp"
if="is.unix"/>
                 <libset libs="harmonyvm,hythr" dir="${drlvm.shlib.dir}" />
Index: harmony/working_vm/make/vm/port.xml
===================================================================
--- harmony/working_vm/make/vm/port.xml	(revision 883577)
+++ harmony/working_vm/make/vm/port.xml	(working copy)
@@ -83,7 +83,7 @@
         <compile-cc>
             <includepath><path refid="port.includes"/></includepath>

-            <defineset define="APR_DECLARE_EXPORT" />
+            <defineset define="APR_DECLARE_STATIC" />
             <defineset define="BUILDING_VM" />

             <compiler id="c.compiler" extends="common.c.compiler">
Index: harmony/working_vm/make/vm/verifier.xml
===================================================================
--- harmony/working_vm/make/vm/verifier.xml	(revision 883577)
+++ harmony/working_vm/make/vm/verifier.xml	(working copy)
@@ -36,7 +36,7 @@
                     <include name="java6/*.cpp" />
                     <include name="x_verifier/*.cpp" if="cfg.is.debug" />
                 </fileset>
-	            <defineset define="BUILDING_VM" />
+	            <defineset define="STATIC_BUILD,BUILDING_VM" />
             </compiler>
         </make-native>
     </target>
Index: harmony/working_vm/make/vm/vmcore.xml
===================================================================
--- harmony/working_vm/make/vm/vmcore.xml	(revision 883577)
+++ harmony/working_vm/make/vm/vmcore.xml	(working copy)
@@ -211,11 +211,11 @@
             </fileset>

             <compilerarg value="/Qwd94" if="is.icl"/>
-            <defineset define="BUILDING_VM,APR_DECLARE_STATIC" />
+            <defineset define="BUILDING_VM,APR_DECLARE_STATIC,USE_GC_STATIC" />
         </compiler>
         </compile-cc>

-        <link-lib name="harmonyvm" type="shared">
+        <link-lib name="harmonyvm" type="static">
             <linker id="linker" extends="common.linker">
                 <libset libs="port,encoder,verifier,apr-1"
                     dir="${drlvm.lib.dir}" />
@@ -224,8 +224,8 @@
                 <libset libs="zdll" dir="${drlvm.lib.dir}" if="is.windows"/>
                 <libset libs="ch" dir="${drlvm.shlib.dir}" />

-                <linkerarg
value="/DEF:${vm.home}/vmcore/src/harmonyvm64.def"
if="is.windows.x86_64"/>
-                <linkerarg
value="/DEF:${vm.home}/vmcore/src/harmonyvm.def" if="is.windows.x86"/>
+<!--`                <linkerarg
value="/DEF:${vm.home}/vmcore/src/harmonyvm64.def"
if="is.windows.x86_64"/>
+                <linkerarg
value="/DEF:${vm.home}/vmcore/src/harmonyvm.def" if="is.windows.x86"/>
-->
                 <linkerarg
value="--version-script=${vm.home}/vmcore/build/vmcore.exp"
if="is.unix"/>

                 <syslibset type="shared"
libs="m,dl,stdc++,z,xml2,pthread,gcc_s,rt" if="is.linux"/>
Index: harmony/working_vm/make/vm/vmi.xml
===================================================================
--- harmony/working_vm/make/vm/vmi.xml	(revision 883577)
+++ harmony/working_vm/make/vm/vmi.xml	(working copy)
@@ -23,7 +23,7 @@

     <target name="build" depends="-common-vm">
         <init-native/>
-        <make-native libname="vmi" type="shared">
+        <make-native libname="vmi" type="static">
             <compiler id="cpp.compiler" extends="common.cpp.compiler">
                 <includepath>
                     <pathelement location="${drlvm.include.dir}" />
@@ -35,8 +35,9 @@
                     </dirset>
                     <pathelement location="${hy.hdk}/include" />
                 </includepath>
+              <defineset define="APR_DECLARE_STATIC,STATIC_BUILD" />

-                <fileset dir="${vm.home}/vmi/src" includes="*.cpp" />
+              <fileset dir="${vm.home}/vmi/src" includes="*.cpp" />
             </compiler>

             <linker id="linker" extends="common.linker">
Index: harmony/working_vm/make/vm/hythr.xml
===================================================================
--- harmony/working_vm/make/vm/hythr.xml	(revision 883577)
+++ harmony/working_vm/make/vm/hythr.xml	(working copy)
@@ -24,7 +24,7 @@
     <target name="build" depends="-common-vm">
         <init-native/>

-        <make-native libname="hythr" type="shared">
+        <make-native libname="hythr" type="static">
         <compiler id="c.compiler" extends="common.c.compiler">
             <includepath>
               <pathelement location="${drlvm.include.dir}" />
@@ -39,14 +39,14 @@
                 <include name="linux/*.c" if="is.unix"/>
             </fileset>

-            <defineset define="APR_DECLARE_STATIC" />
+            <defineset define="STATIC_BUILD,APR_DECLARE_STATIC" />
         </compiler>

         <linker id="linker" extends="common.linker">
             <libset libs="port,apr-1"
                     dir="${drlvm.lib.dir}" />

-            <linkerarg value="/DEF:${vm.home}/thread/src/hythr.def"
if="is.windows"/>
+<!--            <linkerarg
value="/DEF:${vm.home}/thread/src/hythr.def" if="is.windows"/> -->

             <syslibset type="shared" libs="stdc++,rt,pthread" if="is.linux"/>
             <syslibset type="shared" libs="stdc++,pthread" if="is.freebsd"/>
Index: harmony/working_vm/make/vm/jitrino.xml
===================================================================
--- harmony/working_vm/make/vm/jitrino.xml	(revision 883577)
+++ harmony/working_vm/make/vm/jitrino.xml	(working copy)
@@ -83,10 +83,10 @@
                 <defineset define="JIT_LOGS,JIT_STATS" if="is.cfg.debug" />
             </compiler>
         </compile-cc>
-        <link-lib name="jitrino" type="shared">
+        <link-lib name="jitrino" type="static">
             <linker id="jitrino.linker" extends="common.linker">
                 <libset libs="harmonyvm,encoder,hythr"
dir="${drlvm.lib.dir}" if="is.windows"/>
-                <linkerarg value="/OPT:REF" if="is.windows"/>
+<!--                <linkerarg value="/OPT:REF" if="is.windows"/> -->

                 <syslibset type="shared" libs="m" if="is.unix"/>
                 <syslibset type="shared" libs="dl" if="is.linux"/>
Index: harmony/working_vm/make/vm/port_ch.xml
===================================================================
--- harmony/working_vm/make/vm/port_ch.xml	(revision 883577)
+++ harmony/working_vm/make/vm/port_ch.xml	(working copy)
@@ -100,7 +100,7 @@
         <compile-cc>
             <includepath><path refid="ch.includes"/></includepath>

-            <defineset define="APR_DECLARE_EXPORT" />
+            <defineset define="APR_DECLARE_STATIC" />
             <defineset define="BUILDING_VM" />
             <defineset define="STRESS_MALLOC" />

@@ -122,7 +122,7 @@
             </compiler>
         </compile-cc>

-        <link-lib name="ch" type="shared">
+        <link-lib name="ch" type="static">
             <linker id="linker" extends="common.linker">
                 <libset libs="encoder" dir="${drlvm.lib.dir}" />

Index: harmony/working_vm/make/vm/encoder.xml
===================================================================
--- harmony/working_vm/make/vm/encoder.xml	(revision 883577)
+++ harmony/working_vm/make/vm/encoder.xml	(working copy)
@@ -36,6 +36,10 @@
             <compiler id="encoder.compiler" extends="common.cpp.compiler">
                 <!--defineset define="NO_EBCODER_INLINE" /-->
                 <fileset refid="encoder.src"/>
+
+              <defineset define="STATIC_BUILD" />
+              <defineset define="USE_GC_STATIC" />
+              <defineset define="APR_DECLARE_STATIC"/>
             </compiler>
         </make-native>
     </target>
Index: harmony/working_vm/make/build-native.xml
===================================================================
--- harmony/working_vm/make/build-native.xml	(revision 883577)
+++ harmony/working_vm/make/build-native.xml	(working copy)
@@ -140,6 +140,10 @@
                 <compilerarg value="/Fd${component.obj.dir}\" if="is.windows"/>
                 <compilerarg value="/Zi" if="is.windows"/>
                 <compilerarg value="-fpic" if="is.unix"/>
+
+                <defineset define="STATIC_BUILD" />
+                <defineset define="USE_GC_STATIC" />
+                <defineset define="APR_DECLARE_STATIC"/>
             </cc>
         </presetdef>

@@ -151,7 +155,7 @@
                 <condition property="component.need.pdb">
                     <and>
                         <isset property="is.windows"/>
-                        <equals arg1="@{type}" arg2="shared"/>
+                        <equals arg1="@{type}" arg2="static"/>
                     </and>
                 </condition>

Index: harmony/working_vm/make/extra/apr.xml
===================================================================
--- harmony/working_vm/make/extra/apr.xml	(revision 883577)
+++ harmony/working_vm/make/extra/apr.xml	(working copy)
@@ -133,7 +133,7 @@
                 <include name="poll/unix/select.c" />
             </fileset>

-            <defineset define="APR_DECLARE_EXPORT,WIN32,_WINDOWS" />
+            <defineset
define="STATIC_BUILD,APR_DECLARE_STATIC,WIN32,_WINDOWS" />
         </make-native>
     </target>






2009/12/1 Tony Wu <wuyuehao@gmail.com>:
> I think we could think about creating Harmony Select profiles along
> with Milestone builds to help people like Tim to customize our JRE
> easiler.
> (A friend of mine I met on the Apache Asia Roadshow this year
> complained to me that Harmony is dev-oriented and not so
> user-friendly, which may block potential contributors and users :-( )
>
> On Mon, Nov 30, 2009 at 9:51 AM, Regis <xu.regis@gmail.com> wrote:
>> Tim Prepscius wrote:
>>>
>>> Thanks for all of the input.  I really appreciate it.
>>>
>>> I guess I'll post progress to this thread, so that if someone else
>>> wishes to do something similar, my successes and failures will be
>>> available as some kind of road map.
>>>
>>> If you see me doing something which is an incredibly stupid thing to
>>> do, if I only knew this other way which is simple and nice..  Let me
>>> know!
>>>
>>> Here is the current state of things.
>>>
>>> 1) I have gotten stuff.
>>>
>>> 1.5) the msvc solutions are not up to date.  oh well.
>>>
>>> 2) The full classlib doesn't fully build cause it needs atl* ... but
>>> I've read online, this is because of swing.. don't need swing.
>>> somehow not sure how to just tell it not to build this part
>>
>> try -Dexclude.module=swing,awt
>>
>>>
>>> 2.5) The vm, amazingly, builds. :-)
>>>
>>> 3) I've figured out the any xml build files enough to be able to
>>> change things to static libraries, and exclude the /OPT:REF options
>>> (which I don't want)
>>>
>>> 4) I've gotten the ICU lib, and have changed things to compile as
>>> static LIBs.. Except for that one dll, where the programmer *really*
>>> wanted to use makefiles.. ...   sigh.  And of course his makefile is
>>> non-standard as they all are.  So will take a while to figure out what
>>> to change.
>>>
>>> 4.5) I have zlib from the main game-project compiling as static lib
>>>
>>> 5) I've changed the JNIEXPORT define to not do the dllexport... I
>>> think I'll need to do this with all of the other libraries as well.
>>> Wish they all used some underlying REALLY_DO_DLLEXPORT define or
>>> something, but oh well.
>>>
>>> 6) I've created a msvc solution that includes all of the newly created
>>> static libs.  And a simple .cpp file which   calls the
>>> JNI_CreateJavaVM.  Amazingly things link, and run.  However, dieing on
>>> errors of course when it tries to load dll libraries.
>>>
>>> Next step seems to me to be modifying the dll loading function
>>> "process_properties_dlls" into a "process_properties_statics."  Don't
>>> know what will be necessary for this:
>>>
>>> ------------------------------------------------------------------
>>> I like to make batch files which can replicate work.. For an accurate
>>> record, and cause I need to eventually build lots of different places.
>>>
>>> Here they are:
>>> -------------------------------------------------------------------
>>> C:\source3>type setup.bat
>>> call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
>>> set ANT_HOME=C:\ant
>>> set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_17
>>> set PATH=%PATH%;%ANT_HOME%\bin;c:\cygwin\bin
>>> set ANT_OPTS=-Xms256m -Xmx512m
>>>
>>> rem
>>> ###############################################################################
>>>
>>> if exist %ANT_HOME%\lib\ecj-* goto ECJ_OK
>>> echo Things won't work without ECJ, get 3.4.2 from
>>> http://download.eclipse.org/eclipse/downloads/ and put it in
>>> %ANT_HOME%\lib
>>> goto END
>>> :ECJ_OK
>>>
>>> if exist %windir%\system32\msvcr71* goto MSVC71_OK
>>> echo Somehow, they really really want msvcr71.dll, msvcp71.dll, you
>>> can google and download it.. stick it in %windir%\system32
>>> goto END
>>> :MSVC71_OK
>>>
>>> rem
>>> #################################################################################
>>>
>>>
>>> :END
>>>
>>> C:\source3>type build1.bat
>>> call setup.bat
>>>
>>> svn co http://svn.apache.org/repos/asf/harmony/enhanced/trunk harmony
>>>
>>> cd harmony
>>> cmd /C ant populate-src
>>> cd ..
>>>
>>>
>>> C:\source3>type build2.bat
>>> cd harmony
>>> cd working_classlib
>>>
>>> cmd /C ant fetch-depends
>>> cmd /C ant
>>>
>>> cd ..
>>> cd ..
>>>
>>> C:\source3>type build3.bat
>>> cd harmony
>>> cd working_vm
>>>
>>> rmdir /s /q build\windows_x86_msvc_debug
>>> rmdir /s /q build\windows_x86_msvc_release
>>>
>>> cmd /C ant -Dexclude.module=swing
>>> cmd /C ant -Dexclude.module=swing -Dhy.cfg=release
>>>
>>> cd ..
>>> cd ..
>>>
>>> --------------------------------
>>>
>>> Diff of files as of now:
>>>
>>> Index: harmony/working_vm/vm/include/jni_types.h
>>> ===================================================================
>>> --- harmony/working_vm/vm/include/jni_types.h   (revision 883577)
>>> +++ harmony/working_vm/vm/include/jni_types.h   (working copy)
>>> @@ -49,8 +49,10 @@
>>>  */
>>>  #if defined (_WIN32) || defined (__WIN32__) || defined (WIN32)
>>>
>>> -#define JNIEXPORT __declspec(dllexport)
>>> -#define JNIIMPORT __declspec(dllimport)
>>> +//#define JNIEXPORT __declspec(dllexport)
>>> +//#define JNIIMPORT __declspec(dllimport)
>>> +#define JNIEXPORT
>>> +#define JNIIMPORT
>>>  #define JNICALL __stdcall
>>>
>>>  typedef signed __int64 jlong;
>>> Index: harmony/working_vm/vm/vmcore/src/init/vm_init.cpp
>>> ===================================================================
>>> --- harmony/working_vm/vm/vmcore/src/init/vm_init.cpp   (revision 883577)
>>> +++ harmony/working_vm/vm/vmcore/src/init/vm_init.cpp   (working copy)
>>> @@ -174,6 +174,11 @@
>>>  #define GC_DLL (vm_env->compress_references ? GC_DLL_COMP :
>>> GC_DLL_UNCOMP)
>>>  #endif
>>>
>>> +static jint process_properties_dlls_statics (Global_Env *vm_env)
>>> +{
>>> +    jint status;
>>> +       return status;
>>> +}
>>>
>>>  /**
>>>  * Loads DLLs.
>>> Index: harmony/working_vm/make/vm/em.xml
>>> ===================================================================
>>> --- harmony/working_vm/make/vm/em.xml   (revision 883577)
>>> +++ harmony/working_vm/make/vm/em.xml   (working copy)
>>> @@ -23,7 +23,7 @@
>>>
>>>     <target name="build" depends="-common-vm">
>>>         <init-native/>
>>> -        <make-native libname="em" type="shared">
>>> +        <make-native libname="em" type="static">
>>>         <compiler id="cpp.compiler" extends="common.cpp.compiler">
>>>             <includepath>
>>>                 <dirset dir="${vm.home}">
>>> Index: harmony/working_vm/make/vm/gc_gen.xml
>>> ===================================================================
>>> --- harmony/working_vm/make/vm/gc_gen.xml       (revision 883577)
>>> +++ harmony/working_vm/make/vm/gc_gen.xml       (working copy)
>>> @@ -114,7 +114,7 @@
>>>         <compile-cc>
>>>             <compiler refid="cpp.compiler"/>
>>>         </compile-cc>
>>> -        <link-lib name="gc_gen_uncomp" type="shared">
>>> +        <link-lib name="gc_gen_uncomp" type="static">
>>>             <linker refid="linker"/>
>>>         </link-lib>
>>>    </target>
>>> @@ -127,7 +127,7 @@
>>>             <compiler refid="cpp.compiler"/>
>>>             <defineset define="COMPRESS_REFERENCE" />
>>>         </compile-cc>
>>> -        <link-lib name="gc_gen" type="shared">
>>> +        <link-lib name="gc_gen" type="static">
>>>             <linker refid="linker"/>
>>>         </link-lib>
>>>    </target>
>>> Index: harmony/working_vm/make/vm/interpreter.xml
>>> ===================================================================
>>> --- harmony/working_vm/make/vm/interpreter.xml  (revision 883577)
>>> +++ harmony/working_vm/make/vm/interpreter.xml  (working copy)
>>> @@ -78,7 +78,7 @@
>>>         </compiler>
>>>         </compile-cc>
>>>
>>> -        <link-lib name="interpreter" type="shared">
>>> +        <link-lib name="interpreter" type="static">
>>>             <linker id="linker" extends="common.linker">
>>>                 <linkerarg
>>> value="--version-script=${vm.home}/interpreter/build/interpreter.exp"
>>> if="is.unix"/>
>>>                 <libset libs="harmonyvm,hythr" dir="${drlvm.shlib.dir}" />
>>> Index: harmony/working_vm/make/vm/vmcore.xml
>>> ===================================================================
>>> --- harmony/working_vm/make/vm/vmcore.xml       (revision 883577)
>>> +++ harmony/working_vm/make/vm/vmcore.xml       (working copy)
>>> @@ -215,7 +215,7 @@
>>>         </compiler>
>>>         </compile-cc>
>>>
>>> -        <link-lib name="harmonyvm" type="shared">
>>> +        <link-lib name="harmonyvm" type="static">
>>>             <linker id="linker" extends="common.linker">
>>>                 <libset libs="port,encoder,verifier,apr-1"
>>>                     dir="${drlvm.lib.dir}" />
>>> @@ -224,8 +224,8 @@
>>>                 <libset libs="zdll" dir="${drlvm.lib.dir}"
>>> if="is.windows"/>
>>>                 <libset libs="ch" dir="${drlvm.shlib.dir}" />
>>>
>>> -                <linkerarg
>>> value="/DEF:${vm.home}/vmcore/src/harmonyvm64.def"
>>> if="is.windows.x86_64"/>
>>> -                <linkerarg
>>> value="/DEF:${vm.home}/vmcore/src/harmonyvm.def" if="is.windows.x86"/>
>>> +<!--`                <linkerarg
>>> value="/DEF:${vm.home}/vmcore/src/harmonyvm64.def"
>>> if="is.windows.x86_64"/>
>>> +                <linkerarg
>>> value="/DEF:${vm.home}/vmcore/src/harmonyvm.def" if="is.windows.x86"/>
>>> -->
>>>                 <linkerarg
>>> value="--version-script=${vm.home}/vmcore/build/vmcore.exp"
>>> if="is.unix"/>
>>>
>>>                 <syslibset type="shared"
>>> libs="m,dl,stdc++,z,xml2,pthread,gcc_s,rt" if="is.linux"/>
>>> Index: harmony/working_vm/make/vm/vmi.xml
>>> ===================================================================
>>> --- harmony/working_vm/make/vm/vmi.xml  (revision 883577)
>>> +++ harmony/working_vm/make/vm/vmi.xml  (working copy)
>>> @@ -23,7 +23,7 @@
>>>
>>>     <target name="build" depends="-common-vm">
>>>         <init-native/>
>>> -        <make-native libname="vmi" type="shared">
>>> +        <make-native libname="vmi" type="static">
>>>             <compiler id="cpp.compiler" extends="common.cpp.compiler">
>>>                 <includepath>
>>>                     <pathelement location="${drlvm.include.dir}" />
>>> Index: harmony/working_vm/make/vm/hythr.xml
>>> ===================================================================
>>> --- harmony/working_vm/make/vm/hythr.xml        (revision 883577)
>>> +++ harmony/working_vm/make/vm/hythr.xml        (working copy)
>>> @@ -24,7 +24,7 @@
>>>     <target name="build" depends="-common-vm">
>>>         <init-native/>
>>>
>>> -        <make-native libname="hythr" type="shared">
>>> +        <make-native libname="hythr" type="static">
>>>         <compiler id="c.compiler" extends="common.c.compiler">
>>>             <includepath>
>>>               <pathelement location="${drlvm.include.dir}" />
>>> @@ -46,7 +46,7 @@
>>>             <libset libs="port,apr-1"
>>>                     dir="${drlvm.lib.dir}" />
>>>
>>> -            <linkerarg value="/DEF:${vm.home}/thread/src/hythr.def"
>>> if="is.windows"/>
>>> +<!--            <linkerarg
>>> value="/DEF:${vm.home}/thread/src/hythr.def" if="is.windows"/> -->
>>>
>>>             <syslibset type="shared" libs="stdc++,rt,pthread"
>>> if="is.linux"/>
>>>             <syslibset type="shared" libs="stdc++,pthread"
>>> if="is.freebsd"/>
>>> Index: harmony/working_vm/make/vm/jitrino.xml
>>> ===================================================================
>>> --- harmony/working_vm/make/vm/jitrino.xml      (revision 883577)
>>> +++ harmony/working_vm/make/vm/jitrino.xml      (working copy)
>>> @@ -83,10 +83,10 @@
>>>                 <defineset define="JIT_LOGS,JIT_STATS" if="is.cfg.debug"
>>> />
>>>             </compiler>
>>>         </compile-cc>
>>> -        <link-lib name="jitrino" type="shared">
>>> +        <link-lib name="jitrino" type="static">
>>>             <linker id="jitrino.linker" extends="common.linker">
>>>                 <libset libs="harmonyvm,encoder,hythr"
>>> dir="${drlvm.lib.dir}" if="is.windows"/>
>>> -                <linkerarg value="/OPT:REF" if="is.windows"/>
>>> +<!--                <linkerarg value="/OPT:REF" if="is.windows"/> -->
>>>
>>>                 <syslibset type="shared" libs="m" if="is.unix"/>
>>>                 <syslibset type="shared" libs="dl" if="is.linux"/>
>>> Index: harmony/working_vm/make/vm/port_ch.xml
>>> ===================================================================
>>> --- harmony/working_vm/make/vm/port_ch.xml      (revision 883577)
>>> +++ harmony/working_vm/make/vm/port_ch.xml      (working copy)
>>> @@ -122,7 +122,7 @@
>>>             </compiler>
>>>         </compile-cc>
>>>
>>> -        <link-lib name="ch" type="shared">
>>> +        <link-lib name="ch" type="static">
>>>             <linker id="linker" extends="common.linker">
>>>                 <libset libs="encoder" dir="${drlvm.lib.dir}" />
>>>
>>> Index: harmony/working_vm/make/build-native.xml
>>> ===================================================================
>>> --- harmony/working_vm/make/build-native.xml    (revision 883577)
>>> +++ harmony/working_vm/make/build-native.xml    (working copy)
>>> @@ -151,7 +151,7 @@
>>>                 <condition property="component.need.pdb">
>>>                     <and>
>>>                         <isset property="is.windows"/>
>>> -                        <equals arg1="@{type}" arg2="shared"/>
>>> +                        <equals arg1="@{type}" arg2="static"/>
>>>                     </and>
>>>                 </condition>
>>>
>>>
>>> On 11/22/09, Alexei Fedotov <alexei.fedotov@gmail.com> wrote:
>>>>
>>>> Tim,
>>>> As for your willingness to create a lib, VM is a lib already [1], an
>>>> is successfully used in browser plug-ins.
>>>>
>>>> [1] http://java.sun.com/j2se/1.4.2/docs/guide/jni/spec/invocation.html
>>>>
>>>> On Mon, Nov 23, 2009 at 11:54 AM, Xiao-Feng Li <xiaofeng.li@gmail.com>
>>>> wrote:
>>>>>
>>>>> To reduce Harmony VM (DRLVM) is possible - and not very difficult. JIT
>>>>> and GC are modules that you can easily replace with very simple ones.
>>>>> Other modules can be largely reduced as well if you do not need them,
>>>>> e.g., threading, verifier, profiler, etc. I don't know your
>>>>> performance target, but my personal preference usually is to keep a
>>>>> simple JIT for the execution engine rather than the interpreter.
>>>>>
>>>>> Thanks,
>>>>> xiaofeng
>>>>>
>>>>> On Mon, Nov 23, 2009 at 10:52 AM, Tim Prepscius <timprepscius@gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> Greetings,
>>>>>>
>>>>>> I have been searching for a non-gpl replacement for sun's java for
>>>>>> quite a while now.  I can't believe I didn't see your project until
>>>>>> this month.  Let me tell you, when I saw your code I almost cried.
>>>>>> (haha, well, maybe not cried)
>>>>>>
>>>>>> It's really, really nice.  And I have not run yet into a hundred line
>>>>>> #define (as in "dalvik") yet.
>>>>>> Anyhow.
>>>>>>
>>>>>>
>>>>>> This is what I'd like to do.  I'm wondering whether anyone would
>>>>>> comment on accomplishing this, if it is possible.
>>>>>> Who knows, maybe somebody else has fiddled around with this.
>>>>>>
>>>>>> What I'm looking for:
>>>>>>
>>>>>> 1.  I'm really not looking for java.  I'm looking for a
>>>>>> micro-edition-ish java to embed in a video game engine.
>>>>>>
>>>>>> 2.  Don't need JIT, don't need two garbage collectors - 1 will do,
>>>>>> don't need the JVM to be accessible to the outside world. Don't need
>>>>>> almost *all* of the class libraries.  Don't need sockets (except for
>>>>>> debugging).  Don't actually need threads (I disable their creation via
>>>>>> the security manager anyway), but I suppose this is necessary for GC &
>>>>>> Debug.
>>>>>>
>>>>>> 3. Need JNI, which I see you have.
>>>>>>
>>>>>> So what I'm thinking I'd like to do:
>>>>>>
>>>>>>
>>>>>> Optimally I'd like to create a lib out of harmony-vm.  Statically link
>>>>>> with my application.  Create a single jar with all of my necessary
>>>>>> classes, cutting out all of the java extra stuff (everything pretty
>>>>>> much)
>>>>>>
>>>>>> If creating a lib creates problems for JNI (what problems I don't
>>>>>> know), I'd like to combine all of your dlls into one massive dll.
>>>>>> Then I was thinking, that after getting this done, I'd start cutting
>>>>>> out modules.  And try to reduce everything to under 1 meg.
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Is this crazy?
>>>>>>
>>>>>> Thanks in advance,
>>>>>>
>>>>>> -tim
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> http://people.apache.org/~xli
>>>>>
>>>>
>>>>
>>>> --
>>>> With best regards / с наилучшими пожеланиями,
>>>> Alexei Fedotov / Алексей Федотов,
>>>> http://www.telecom-express.ru/
>>>> http://harmony.apache.org/
>>>> http://www.expressaas.com/
>>>> http://openmeetings.googlecode.com/
>>>>
>>>
>>
>>
>> --
>> Best Regards,
>> Regis.
>>
>
>
>
> --
> Tony Wu
> China Software Development Lab, IBM
>

Mime
View raw message