Discussion:
[general] specialized JVM for Groovy
Jochen Theodorou
2011-06-04 13:28:08 UTC
Permalink
Hi all,

I noticed that there is recently not much going on in harmony, but I
hope there are still enough people to react to this mail.

As one implementing a dynamic language for the JVM, namely Groovy, I
continuously have to fight the JVM in so many terms, that I am wondering
if it would not be an idea to extend an existing JVM to make things
fast. For this I was thinking of an basically running implementation in
Java, but with special recognition by for example the JIT, to remove
some of the heavy stones in the pathway. This is for example the meta
class system, invoking methods in general, hopefully to be able to
collapse some code paths and maybe do some checks internally faster than
what we have now.

Of course with invokedynamic JSR292 we would get maybe many of these
things, but there will be still problems, only a bit less.

So I was wondering if Harmony would be a good starting point for this
kind of approach. I would like to hear some opinions of the developers
if you care.

bye Jochen
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead
http://blackdragsview.blogspot.com/
For Groovy programming sources visit http://groovy.codehaus.org
Alexei Fedotov
2011-06-04 13:45:37 UTC
Permalink
Jochen,
AFAIU, you have some problems with Oracle Java implementation. What do
you expect from Apache Harmony? Do you want to hack into the Apache
Harmony code?

--
With best regards / с наилучшими пожеланиями,
Alexei Fedotov / Алексей Федотов,
http://dataved.ru/
+7 916 562 8095
Post by Jochen Theodorou
Hi all,
I noticed that there is recently not much going on in harmony, but I hope
there are still enough people to react to this mail.
As one implementing a dynamic language for the JVM, namely Groovy, I
continuously have to fight the JVM in so many terms, that I am wondering if
it would not be an idea to extend an existing JVM to make things fast. For
this I was thinking of an basically running implementation in Java, but with
special recognition by for example the JIT, to remove some of the heavy
stones in the pathway. This is for example the meta class system, invoking
methods in general, hopefully to be able to collapse some code paths and
maybe do some checks internally faster than what we have now.
Of course with invokedynamic JSR292 we would get maybe many of these things,
but there will be still problems, only a bit less.
So I was wondering if Harmony would be a good starting point for this kind
of approach. I would like to hear some opinions of the developers if you
care.
bye Jochen
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead
http://blackdragsview.blogspot.com/
For Groovy programming sources visit http://groovy.codehaus.org
Jochen Theodorou
2011-06-04 14:16:06 UTC
Permalink
Post by Alexei Fedotov
Jochen,
AFAIU, you have some problems with Oracle Java implementation. What do
you expect from Apache Harmony? Do you want to hack into the Apache
Harmony code?
What I want from Harmony is that it allows me to change the internals of
the JVM. For example the layout of a class, or an "enhanced" JIT. And I
was hoping that Harmony allows me to do that somehow. Of course that
means to hack into the Harmony code.

Harmony is interesting for me, because as far as I am concerned it is a
Java compatible JVM and it is not GPL. I was thinking of Maxine, but GPL
is really not my favorite. I am not sure what will come out of this in
the end, and to limit myself to the GPL is not exactly motivating for me.

Of course I would need to ask questions, since I basically know nothing
of the Harmony internals yet and I am also wondering if there will be
people able to answer me those.

bye Jochen
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead
http://blackdragsview.blogspot.com/
For Groovy programming sources visit http://groovy.codehaus.org
Alexei Fedotov
2011-06-04 14:34:14 UTC
Permalink
If you strive for performance, do you have particular performance
numbers and platforms in mind?

--
With best regards / с наилучшими пожеланиями,
Alexei Fedotov / Алексей Федотов,
http://dataved.ru/
+7 916 562 8095
Post by Alexei Fedotov
Jochen,
AFAIU, you have some problems with Oracle Java implementation. What do
you expect from Apache Harmony? Do you want to hack into the Apache
Harmony code?
What I want from Harmony is that it allows me to change the internals of the
JVM. For example the layout of a class, or an "enhanced" JIT. And I was
hoping that Harmony allows me to do that somehow. Of course that means to
hack into the Harmony code.
Harmony is interesting for me, because as far as I am concerned it is a Java
compatible JVM and it is not GPL. I was thinking of Maxine, but GPL is
really not my favorite. I am not sure what will come out of this in the end,
and to limit myself to the GPL is not exactly motivating for me.
Of course I would need to ask questions, since I basically know nothing of
the Harmony internals yet and I am also wondering if there will be people
able to answer me those.
bye Jochen
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead
http://blackdragsview.blogspot.com/
For Groovy programming sources visit http://groovy.codehaus.org
Alexei Fedotov
2011-06-04 14:44:03 UTC
Permalink
Why I'm asking.

Hacking into Harmony (or other JVM) code to get particular performance
improvements can be potentially very difficult and require a lot of
effort and learning.

AFAIK, Harmony performance scores were better for one particular
benchmark (SPECjbb), otherwise they were not better than Oracle
scores. The guys from Oracle implemented Sergey Kuksenko and Alexey
Shipilev optimizations (and re-hired both of them later), so now they
probably can win even for that particular benchmark.

--
With best regards / с наилучшими пожеланиями,
Alexei Fedotov / Алексей Федотов,
http://dataved.ru/
+7 916 562 8095
Post by Alexei Fedotov
If you strive for performance, do you have particular performance
numbers and platforms in mind?
--
With best regards / с наилучшими пожеланиями,
Alexei Fedotov / Алексей Федотов,
http://dataved.ru/
+7 916 562 8095
Post by Alexei Fedotov
Jochen,
AFAIU, you have some problems with Oracle Java implementation. What do
you expect from Apache Harmony? Do you want to hack into the Apache
Harmony code?
What I want from Harmony is that it allows me to change the internals of the
JVM. For example the layout of a class, or an "enhanced" JIT. And I was
hoping that Harmony allows me to do that somehow. Of course that means to
hack into the Harmony code.
Harmony is interesting for me, because as far as I am concerned it is a Java
compatible JVM and it is not GPL. I was thinking of Maxine, but GPL is
really not my favorite. I am not sure what will come out of this in the end,
and to limit myself to the GPL is not exactly motivating for me.
Of course I would need to ask questions, since I basically know nothing of
the Harmony internals yet and I am also wondering if there will be people
able to answer me those.
bye Jochen
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead
http://blackdragsview.blogspot.com/
For Groovy programming sources visit http://groovy.codehaus.org
Krystal Mok
2011-06-04 14:35:37 UTC
Permalink
Hi Jochen,

What you proposed sure is technically feasible, but whether it'd happen in Harmony, that's another story.

The three big JVMs, namely HotSpot, JRockit and J9 all perform some sort of idiom recognition to speed up common idioms. But it's quite unlikely for them to optimize for any single language other than Java. If any other language want to run fast on them, it'd either behave a lot like Java, or it should rely on invokedynamic to talk to the VM. The latter should be the recommended way to go, as time goes on, these JVMs should do very good job of optimizing dynamic usage. The missing pieces would be things like fixnums and the like, but since Groovy's type system is pretty close to Java's (and doesn't use fixnums like Ruby does), these shouldn't be a problem.

The Maxine VM from Sun Labs (now Oracle Labs) would be pretty nice if you're experimenting ideas. I'd recommend a presentation "Leveraging Meta-Circularity in the Maxine VM" from JVM Language Summit 2008 (http://www.wiki.jvmlangsummit.com/pdf/12_Mathiske_max.pdf), page 28. I'm sure Charles Nutter wanted to try making a specialized version of Maxine VM for JRuby, maybe he can share his ideas on this.

Ah, I just saw your reply on Maxine and GPL...no wonder you're looking into Harmony.
With that, other options might include Jikes RVM and MRP (http://mrp.codehaus.org/), both of which are EPL-1.0 licensed.

Regards,
Kris Mok
Post by Jochen Theodorou
Hi all,
I noticed that there is recently not much going on in harmony, but I hope there are still enough people to react to this mail.
As one implementing a dynamic language for the JVM, namely Groovy, I continuously have to fight the JVM in so many terms, that I am wondering if it would not be an idea to extend an existing JVM to make things fast. For this I was thinking of an basically running implementation in Java, but with special recognition by for example the JIT, to remove some of the heavy stones in the pathway. This is for example the meta class system, invoking methods in general, hopefully to be able to collapse some code paths and maybe do some checks internally faster than what we have now.
Of course with invokedynamic JSR292 we would get maybe many of these things, but there will be still problems, only a bit less.
So I was wondering if Harmony would be a good starting point for this kind of approach. I would like to hear some opinions of the developers if you care.
bye Jochen
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead
http://blackdragsview.blogspot.com/
For Groovy programming sources visit http://groovy.codehaus.org
David Beberman
2011-06-04 16:05:21 UTC
Permalink
FYI -- always hurts to not see JamaicaVM from Aicas included as one of
the JVMs to
consider. We like to think that its the "big four" :)
If you want hard real-time, multicore, compiled performance and CPU/MCU
choices
we like to think we lead the market.
I don't want to do an advertisement on this mailing list.
Just thought I'd mention us and ask that we don't get forgotten.

(sitting down after raising hand and jumping up and down, shouting me
too, me too)

Regards,
David Beberman
Post by Krystal Mok
Hi Jochen,
What you proposed sure is technically feasible, but whether it'd happen in Harmony, that's another story.
The three big JVMs, namely HotSpot, JRockit and J9 all perform some sort of idiom recognition to speed up common idioms. But it's quite unlikely for them to optimize for any single language other than Java. If any other language want to run fast on them, it'd either behave a lot like Java, or it should rely on invokedynamic to talk to the VM. The latter should be the recommended way to go, as time goes on, these JVMs should do very good job of optimizing dynamic usage. The missing pieces would be things like fixnums and the like, but since Groovy's type system is pretty close to Java's (and doesn't use fixnums like Ruby does), these shouldn't be a problem.
The Maxine VM from Sun Labs (now Oracle Labs) would be pretty nice if you're experimenting ideas. I'd recommend a presentation "Leveraging Meta-Circularity in the Maxine VM" from JVM Language Summit 2008 (http://www.wiki.jvmlangsummit.com/pdf/12_Mathiske_max.pdf), page 28. I'm sure Charles Nutter wanted to try making a specialized version of Maxine VM for JRuby, maybe he can share his ideas on this.
Ah, I just saw your reply on Maxine and GPL...no wonder you're looking into Harmony.
With that, other options might include Jikes RVM and MRP (http://mrp.codehaus.org/), both of which are EPL-1.0 licensed.
Regards,
Kris Mok
Post by Jochen Theodorou
Hi all,
I noticed that there is recently not much going on in harmony, but I hope there are still enough people to react to this mail.
As one implementing a dynamic language for the JVM, namely Groovy, I continuously have to fight the JVM in so many terms, that I am wondering if it would not be an idea to extend an existing JVM to make things fast. For this I was thinking of an basically running implementation in Java, but with special recognition by for example the JIT, to remove some of the heavy stones in the pathway. This is for example the meta class system, invoking methods in general, hopefully to be able to collapse some code paths and maybe do some checks internally faster than what we have now.
Of course with invokedynamic JSR292 we would get maybe many of these things, but there will be still problems, only a bit less.
So I was wondering if Harmony would be a good starting point for this kind of approach. I would like to hear some opinions of the developers if you care.
bye Jochen
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead
http://blackdragsview.blogspot.com/
For Groovy programming sources visit http://groovy.codehaus.org
--
David Beberman
Dir. Business Development
Aicas, Inc.
***@aicas.com
www.aicas.com
The Leader in Embedded, Realtime, and Safety Critical Java Technology
C: 508 510 1155
T: 508 210 4083
Jochen Theodorou
2011-06-04 18:17:28 UTC
Permalink
Post by Krystal Mok
Hi Jochen,
What you proposed sure is technically feasible, but whether it'd
happen in Harmony, that's another story.
Oh I don't expect you guys to do that, I would do my own changed version.
Post by Krystal Mok
The three big JVMs, namely HotSpot, JRockit and J9 all perform some
sort of idiom recognition to speed up common idioms. But it's quite
unlikely for them to optimize for any single language other than
Java. If any other language want to run fast on them, it'd either
behave a lot like Java, or it should rely on invokedynamic to talk to
the VM. The latter should be the recommended way to go, as time goes
on, these JVMs should do very good job of optimizing dynamic usage.
The missing pieces would be things like fixnums and the like, but
since Groovy's type system is pretty close to Java's (and doesn't use
fixnums like Ruby does), these shouldn't be a problem.
invokedynamic (I am in the EG) is a good thing for sure. But it does not
solve all problems. Mainly there will be the guards, that swallow a lot
of performance if you compare pure method calls. And we will still have
to keep a lot of meta structures in memory, posing a GC problem.

bye Jochen
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead
http://blackdragsview.blogspot.com/
For Groovy programming sources visit http://groovy.codehaus.org
Loading...