harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Wu <wuyue...@gmail.com>
Subject Re: harmony vm as a lib
Date Tue, 01 Dec 2009 15:48:50 GMT
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