harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Platform interface (was: Re: compiling bootJVM with MSVC)
Date Fri, 04 Nov 2005 11:44:13 GMT
Sebastian Hartte wrote:
> Hi you two,
> I tried a similar thing (using Visual Studio 2005 Professional). The
> empty structs are still an error in that compiler version (What do you
> need empyt structs for anyway? Allocation a zero byte memory region
> doesn't make much sense to me).
> But i also run into problems with pthread.h since that doesn't exist on
> Windows. Either i screwed up and included the wrong header files
> (but i think jvm.h belongs to the project) or the threading is entirely
> based on pthreads.
> Isn't there some form of platform independent threading in the apache httpd
> project that could be used over here? After all refactoring is cool ;-)

There was a discussion about using APR a while ago; and for people with
a really long memory I briefly discussed the model we use for class
library and VM portability [1].

We have a common libraries used to provide functionality to the VM and

 - the portlib has portable functions for file, socket, sysinfo, memory,
error codes, etc.
 - the thread library for portable threading and synchronization support.
 - other libraries for archive (zip/jar) and pooling support that are
usually required by both.

There are a couple of interesting design points.

The portlib is a table of function pointers, and it is passed-along in
the first arg of each function.  This means that you can trivially patch
a function implementation to do whatever you want (logging, resource
management, etc.) on those functions and that will 'flow-through' to
downstream calls.

The initial portlib is created and passed into the VM as an argument to
 JNI_CreateJavaVM.  The VM is expected to stash it so it can be
retrieved via either a JavaVM or JNIEnv.  This means that the classlibs
can use them in JNI code, and will pick-up the patched functions etc.



> bye,
> Sebastian
> Enrico Migliore wrote:
>>>Did Tim's comment help?  Did this resolve it?
>>>Have you had any other porting issues in either
>>>compilation or configuration?  I would like for us to
>>>keep up with these sorts of issues because it would
>>>be great if we could support MSVC as one of the
>>>development _and_ target type environments
>>>for bootJVM.
>>>Are you by chance familiar with doing InstallShield
>>>scripts?  This would give us an alternative for Windows
>>>platforms for doing configuration and installation.
>>>Please let everyone know what all you find as you
>>>work with the MSVC environment so that that source
>>>can be adjusted for portability when all the issues
>>>are resolved.  Just by the way, I'm still working on
>>>the final bit of basic functionality of the JVM runtime
>>>engine and should have something available soon.
>>>Thanks for your help and interest.
>>>Dan Lydick
>>Hi Dan,
>>I'm trying to compille bootJVM with MSVC 6.0.
>>Tim's. suggestion (long long = __int64) works fine.
>>I didn't translate the configuration and build scripts into .bat files
>>for Windows, I just
>>ran the scripts in Cygwin, in order to have the source tree available
>>and made a
>>"console application" in MSVC.
>>I'm not much familiar with InstallShield scripts and honestly I'd
>>prefer to dedicate
>>my spare time to work on the source code side (C is my "daily bread").
>>Right now I got some problems which I'm planning to solve during the
>>here are two examples:
>>rvoid argv_init(int argc, char **argv, char **envp)
>>   rchar *chkjh;
>>   chkjh =  (rchar *) rnull;
>>   rchar *chkcp;     <--- MSVC flags this as a compilation error
>>..\jvm\src\argv.c(127) : error C2275: 'rchar' : illegal use of this
>>type as an expression
>>typedef struct
>>   u1 tag;
>>   u2 string_index;
>>   struct LOCAL_String_binding
>>   {
>>                                                  <-- MSVC doesn't
>>like an empty struct
>>   } LOCAL_String_binding;
>>                                           } CONSTANT_String_info;
>>..\jvm\src\classfile.h(1031) : error C2059: syntax error : '}'
>>I have to add "int foo;" in order to proceed
>>Certainly, the code will have to be slightly adjusted for portability.
>>Let me proceed and after the weekend I'll write a report.


Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

View raw message