|
|
||
Rémi Forax's BlogDa Vinci runtime propertiesPosted by forax on March 23, 2008 at 02:07 PM | Comments (3)After a week without any internet access point surfing the snow of the Alp, monday, my fingers was eager to touch the keyboard again. Why not finishing my prototype of runtime properties that use the Da Vinci VM (i really love that name).
One ugly thing of the
draft
v3 of the property spec, is a property object
is implemented by a supplementary class generated by the compiler.
This means the compiler must create one class by property and so
bloat the application with lot of stupid code.
Da Vinci VM
The Da Vinci VM
is the prototype implementation of
JSR 292,
a modified hotspot VM patched with new entry points that help
to implement dynamic languages on top of the Java platform.
Great ! I've implemented a small library that allows to create property object at runtime. It detects if the current VM is the Da Vinci VM and uses VM anonymous class or uses reflection otherwise. How property object works
If you are not familiar with properties,
you can read
an old blog entry.
public class Bean {
private int x;
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
private String text;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public static void main(String[] args) {
Bean bean = new Bean();
Property
prints: int Bean.x cafebabe hello property How to test it ?
If your OS is Windows, Solaris or MacOs you have to compile the VM
by yourself, sorry.
On linux, you can download the
binary of the jdk7 b24
if you haven't already it, download the following zip
davinci.zip
and unzip it in your JAVA_HOME/jre/lib/i386/
java -davinci ...
Now download the property runtime support
property-runtime.jar,
because it adds new classes and overrides some existing classes to the JDK
you must prepend the jar to the bootclasspath.
java -davinci -Xbootclasspath/p:property.jar Bean The source of the property runtime support are available on the kijaro web site here: https://kijaro.dev.java.net/source/browse/kijaro/branches/properties/.
What's the next step, finish to write a new version of the property spec
and provide a modified compiler according to that spec.
I think i've solved most on the corner cases,
so it's just a matter of time.
Bookmark blog post: CommentsComments are listed in date ascending order (oldest first) | Post Comment
| ||
|
|