Thursday, November 21, 2002

ikvmc

Inspired by Stuart's comment to yesterday's post, I decided to clean up ikvmc a little to make it possible to compile executables.

Other changes:

  • it's now possible to specify an IL implementation of a native method in map.xml. At the moment this is used only for System.identityHashCode() to solve this issue.
  • map.xml is now parsed using the XmlSerializer (see yesterday's post on why this is not a good idea)
  • implemented a work-around for the stack overflow that occurred when the compiler couldn't find java.lang.ClassNotFoundException
  • ikvm now supports -classpath switch (thanks dIon)

I've only compiled a simple Hello World type executable with ikvmc and here are some things to look out for:

  • all classes (or jars) that are referenced by the application must be specified (except for the Classpath classes)
  • a reference (-reference:<path>) to the classpath.dll must be specified
  • when compiling an executable the class containing the main method must be specified
  • code that expects to be loaded by the system classloader will probably not work. Statically compiled code will be loaded by the bootstrap (aka null) classloader.

Example:
    ikvmc -out:hello.exe -reference:bin/classpath.dll -main:Hello Hello.class

Updated the binaries and source snaphots.

11/21/2002 12:53:45 PM (W. Europe Standard Time, UTC+01:00)  #    Comments [3]
11/21/2002 8:09:56 AM (W. Europe Standard Time, UTC+01:00)

Is it possible that through your project, SWT might be the one of the first UI's available for Mono? It uses native bindings for Win32 and GTK2 (www.eclipse.org). Any thoughts on that?
11/21/2002 12:23:19 AM (W. Europe Standard Time, UTC+01:00)

That's awesome! Have you thought about making the classpath.dll reference automatic (with a way to turn it *off* for when you're actually compiling classpath.dll, I guess) and using the CLASSPATH and the jar-file manifests to grab the other classes needed and the Main-Class: line? Oh, and defaulting the out: to be s/jar/exe/ on the main jar?


Those all seem pretty trivial but from a usage standpoint there's a big difference between


ikvmc -out:hello.exe -reference:bin/classpath.dll -main:Hello hello.jar dependency.jar


and


ikvmc hello.jar


(my suggestions would make them equivalent, assuming hello.jar specifies Main-Class, and dependency.jar is either in the CLASSPATH or referenced in the Class-Path of the jar)

11/22/2002 5:52:45 AM (W. Europe Standard Time, UTC+01:00)

I think I have found an interesting side under
http://www.experimentalstuff.com/sunr/people/mario/tracing-jvm/index.html


It is a JVM sponsored by Sun Microsystems. And the license seems to be the BSD-license.


And at the beginning, there stand:
"The Tracing JVM is a modified JavaTM Virtual Machine which can be used to gather data on the behavior of Java applications. The Tracing JVM is based on a production-quality JVM in which the interpreter and object management system have been modified so that it can emit data about how objects, stacks, classes, etc., are being used in the execution of a Java application. The data are recorded in trace files which characterize selected aspects of the execution behavior. Traces can be analyzed to learn about what the application is doing, used as input to simulators of new JVM implementations, etc."


I think, it sounds, that this is a modified version of the real Sun JVM.
And because its under an BSD-lixense, you can use code of the real Sun JVM.
I think that's great. :-)

Name
E-mail
Home page

I apologize for the lameness of this, but the comment spam was driving me nuts. In order to be able to post a comment, you need to answer a simple question. Hopefully this question is easy enough not to annoy serious commenters, but hard enough to keep the spammers away.

Anti-Spam Question: What method on java.lang.System returns an object's original hashcode (i.e. the one that would be returned by java.lang.Object.hashCode() if it wasn't overridden)? (case is significant)

Answer:  
Comment (HTML not allowed)