I thought I would give an update, since I have spent many an hour,
since the last post, and I will not be able to spend much time for a
little while.
So I've discovered several defines. STATIC_BUILD, USE_GC_STATIC,
DYNAMIC_OPEN to name a few.
I've also discovered how to set defines in the build xml. Across the
whole project. Well sort of. If it includes compile-cc
Basically, my current step is getting the GC to statically link.
cause there is that gc_init() call in the processing of dlls, which
fails. Cause it turns out that gc_init, atleast before, was a
function pointer.
I sort of wonder why there isn't a standard interface mechanism like:
getComponent (*nameOrWhatNot) {
getComponentFactoryRegistry::getInstance()->getInterface(nameOrWhatNot);
In which static components would register themselves during startup..
via startup code. And dynamic components could be sought after. }
There is actually the building blocks of how to do this really cleanly
in Eberly's graphics library if anyone is interested. oh well.. I'm
sure there is a reason this isn't done. So much code is here.. Not
complaining! :-)
So as I got the GC to compile as a static, it then in turns needs all
of these other libraries to be proper statics as well. And so now, I
recompile my simple javacreatevm project and I see warnings like this:
1>em.lib(DrlEMImpl.obj) : warning LNK4217: locally defined symbol
_vm_create_helper_for_function imported in function "private: void
__thiscall DrlEMImpl::initProfileAccess(void)"
(?initprofileacc...@drlemimpl@@AAEXXZ)
I'm going through and finding out which define was used as a prep for
vm_create_helper_for_function, in this case VMEXPORT:
VMEXPORT void * vm_create_helper_for_function(void* (*fptr)(void*))
And I'm trying to figure out why in the case of whatever library has
vm_create_helper_function it was a stdcall (or something like that),
and in the case of EM it was imported.
This involves searching for where VMEXPORT is defined. Looking at the
surrounding #ifdefs, and figuring out what I need to define in the
project xml. And then I have to look in the project xml and see if it
uses the base compile-cc, if it doesn't I need to add the defines to
that project xml.. (as in the case of "encoder")
Perhaps there is some sort of base compiler definition I should be
changing somewhere. Haven't yet found it. Anyone?
...
Is there a list of these defines anywhere, so I could reduce this search time?
..
Finally, I've only found one definite bug so far:
search for +GCExport I_32 gc_get_hashcode0 (Managed_Object_Handle
p_object); in the text below.
gc_get_hashcode was declared twice. compiler doesn't care since they
are identical. But I think the second one needs to be with a 0 on the
end.
Maybe this isn't a definite bug :-) Actually not quite sure yet.
---
Here is current diff.. I wonder if I should post these diffs
differently. I have a feeling it will be quite long when I'm done.
Hopefully not. Disk space is cheap I guess.
============================================== SNIP
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.
@@ -762,7 +763,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,11 +25,7 @@
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);
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,7 @@
#define LOG_DOMAIN "vm.core"
#include "cxxlog.h"
-#ifndef USE_GC_STATIC
-
+#if !defined(USE_GC_STATIC)
#include <apr_dso.h>
#include <apr_errno.h>
#include "dll_gc.h"
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/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,8 @@
#include "jit_intf.h"
#include "signals.h"
+#include "em_intf.h"
+
#ifdef _WIN32
// 20040427 Used to turn on heap checking on every allocation
#include <crtdbg.h>
@@ -174,17 +176,25 @@
#define GC_DLL (vm_env->compress_references ? GC_DLL_COMP : GC_DLL_UNCOMP)
#endif
+static jint process_properties_dlls_statics (Global_Env *vm_env)
+{
+ CmAddComponent (&EmInitialize);
+ return JNI_OK;
+}
+
/**
* Loads DLLs.
*/
static jint process_properties_dlls(Global_Env * vm_env) {
+ process_properties_dlls_statics (vm_env);
+
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");
TRACE("analyzing em dll " << dll);
status = CmLoadComponent(dll, "EmInitialize");
@@ -193,6 +203,7 @@
LWARN(13, "Cannot load EM component from {0}" << dll);
return status;
}
+*/
status = vm_env->cm->GetComponent(&(vm_env->em_component), OPEN_EM);
if (JNI_OK != status) {
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/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}" />
@@ -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}" />
@@ -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)
@@ -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="APR_DECLARE_STATIC,WIN32,_WINDOWS" />
</make-native>
</target>
2009/11/27 Tim Prepscius <[email protected]>
>
> 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
>
> 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 <[email protected]> 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 <[email protected]>
> > 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 <[email protected]>
> >> 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/
> >