NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Arlindo da Silva wrote:
On Mon, Dec 29, 2008 at 8:09 PM, John Caron <caron@xxxxxxxxxxxxxxxx <mailto:caron@xxxxxxxxxxxxxxxx>> wrote:So if i understand, one compiles C apps into Java.Although NestedVM can produce Java sources, it does not perform too well. What I've been using and works quite well is to compile C code right into Java byte code so it can run under the JVM. (In reality this is a 2 step process: first one compiles code into MIPS assembly code and from there into into Java byte code.The limiting problem are system calls and other libraries that your app uses. You've got it.These are possibly hard to code in a platform-neutral way.However, many of these can be mapped into Java classes. For example there is an elegant implementation of fork() and BSD sockets (almost) maps into Java sockets. BTW, I've been able to build curl and libcurl after tinkering with the syscals.The goal is simply to have a 100% Java version of your already coded C app, mostly for portability (?)Basically, yes. I'd say mostly for easy deployment, web start comes to mind.As a stop-gap measure, I was considering wrapping your NetCDF-Java classes to provide an implementation of the few low-level nc-dap calls that are used by grads. (Nested VM allows for you to call Java native methods from your "C" code.) Since other folks might have already done this work, I was trying not to duplicate any effort. As you indicate, there is good correspondence between the Java and C APIs, and although tedious this seems quite doable. At some point I'd interested in benchmarking my NestedVM build of NetCDF-3 against our native implementation. I've been very surprised by the performance of NestedVM. yes, that would be quite interesting. Is the Java code readable?Quite honestly, I never tried the .c to .java route. Apparently there are better tools out there for source code translation.
Yes, I see, it compiles to bytecode. So mature libraries are best. BTW, does it do only C, or C++ ?
I suppose you wouldnt have the same OO features as if you did the design yourself?Precisely. NestedVM are meant for those of us that are not really Java programmers but would like to easily build their application for the JVM without having to do any Java coding. If you would like to test drive my netcdf build get thisnetcdf-vm.jar <http://opengrads.org/devel/java/netcdf-vm.jar> and then try ncdump/curljava -cp netcdf-vm.jar ncdump -hjava -cp netcdf-vm.jar curl -h
ill give it a try when i get the chance. it would be useful for debugging/comparing the Java/C libraries for sure! I have a jni version (mostly) done that I am using to compare/debug. It would be interesting to compare performance/issues among these various flavors.
very cool, thanks for the heads up! You are welcome and keep up the good work. Happy New Year! Arlindo -- Arlindo da Silva dasilva@xxxxxxxxxxxx <mailto:dasilva@xxxxxxxxxxxx>
netcdf-java
archives: