My questions are:
* Anyone know of a compiler toolchain for JVM which accepts an SSA
graph, or tools that might help with this process?
* Does this sound like a good idea? Perhaps there's a shared library
possibility here?
- Charlie
For the work I've done so far, I've been using Scala, and it's...okay. Calling Scala code from
Java/Groovy requires understanding of the non-obvious compiler mappings in Scala, so once you're in
Scala, it's best to stay there. Also, I'm not sold that the Scala pattern matching is really
gaining me much over polymorphic method calls in this particular case -- and this is coming from a
once-upon-a-time OCaml hacker/evangelist. So redoing what SSA library stuff I've got in raw Java
might be better, at least in terms of garnering contributions.
I'm not particularly interested in a dynamically-typed SSA library since correctness is critical in
the SSA, and if I didn't have the type safety, I'd want to implement it. Although I could be sold
another direction on that point.
I'm also less excited about CPS, since that's going to tend towards optimized code resulting in
non-recursive function tail calls, which I'm trying to avoid until we get a version of the JVM which
can optimize them.
~~ Robert Fischer.
Grails Training http://GroovyMag.com/training
Smokejumper Consulting http://SmokejumperIT.com
Enfranchised Mind Blog http://EnfranchisedMind.com/blog
Check out my book, "Grails Persistence with GORM and GSQL"!
http://www.smokejumperit.com/redirect.html
Any chance of sneak previews on github / A N Other?
Cheers,
James
2009/3/13 Robert Fischer <robert....@smokejumperit.com>:
>
> Want.
Isn't the static type verification pretty much done and over with by the time you get to SSA? You
need to keep type definitions around for method calls, but that's about it...
Tom and I will both be at Pycon, and sticking around for a couple days
of hacking afterward, so that would be a good time to talk about this. I
knew you were working on something similar, and figured I'd start
getting a leg up now on how to do a similar transform for JRuby.
I'll read up on "sea of nodes" SSA as well, so I don't go down the wrong
path.
- Charlie
Forgive me if I missed it, but what's Cornerstone? I'm intrigued.
> I'm not particularly interested in a dynamically-typed SSA library since correctness is critical in
> the SSA, and if I didn't have the type safety, I'd want to implement it. Although I could be sold
> another direction on that point.
Are you saying you'd rather have the SSA library implemented in Java? I
don't think any of us are against that, and it would definitely be more
generally-applicable.
> I'm also less excited about CPS, since that's going to tend towards optimized code resulting in
> non-recursive function tail calls, which I'm trying to avoid until we get a version of the JVM which
> can optimize them.
I believe TCO has already landed on MLVM, so it's at least on the way.
- Charlie
We'll be interested in the same aspects for JRuby, since we currently do
no type profiling/analysis at all and it would be nice to have a simple
way to propagate those types once we start gathering them.
In the interim, though, a fully dynamic SSA would be fine for my
purposes, since I'm mostly looking for flow-control and local var
optimizations.
- Charlie
Nevermind, I understand what you mean now. Ideally if we eventually
arrived at a static-typed SSA we could just pass "Object" or similar
through and and still have it work, albeit without any cross-call
optimizations.
- Charlie
>> I'm not particularly interested in a dynamically-typed SSA library since correctness is critical in
>> the SSA, and if I didn't have the type safety, I'd want to implement it. Although I could be sold
>> another direction on that point.
>
> Are you saying you'd rather have the SSA library implemented in Java? I
> don't think any of us are against that, and it would definitely be more
> generally-applicable.
>
I'm saying -- gently -- that my Scala stuff probably isn't worth sharing, and if I were to do it
over again, I'd do it in Java. But I'm also saying I'm willing to be sold on a non-statically typed
language impl given that the alternative is coding Java.
>> I'm also less excited about CPS, since that's going to tend towards optimized code resulting in
>> non-recursive function tail calls, which I'm trying to avoid until we get a version of the JVM which
>> can optimize them.
>
> I believe TCO has already landed on MLVM, so it's at least on the way.
>
I know, and I'm crazy excited. How is that being implemented, BTW? Did they remove the GOTO
restriction, or is there a new byte code to trigger a tail call?
Well, I have dozens of projects on my plate, but I'd like to hear more.
You should post a little description here on jvm-l when you're
comfortable doing so. And don't worry about getting back to
BiteScript...I'll have a 0.1 release out soon since I'm using it for
JRuby's Java type generator (compiler2), which will mark the second
real-world consumer of BiteScript. That should help ferret out issues,
and I'm also planning a mild refactoring soon too.
>>> I'm not particularly interested in a dynamically-typed SSA library since correctness is critical in
>>> the SSA, and if I didn't have the type safety, I'd want to implement it. Although I could be sold
>>> another direction on that point.
>> Are you saying you'd rather have the SSA library implemented in Java? I
>> don't think any of us are against that, and it would definitely be more
>> generally-applicable.
>>
> I'm saying -- gently -- that my Scala stuff probably isn't worth sharing, and if I were to do it
> over again, I'd do it in Java. But I'm also saying I'm willing to be sold on a non-statically typed
> language impl given that the alternative is coding Java.
Ok, gotcha. Java is quite all right by me.
>>> I'm also less excited about CPS, since that's going to tend towards optimized code resulting in
>>> non-recursive function tail calls, which I'm trying to avoid until we get a version of the JVM which
>>> can optimize them.
>> I believe TCO has already landed on MLVM, so it's at least on the way.
>>
> I know, and I'm crazy excited. How is that being implemented, BTW? Did they remove the GOTO
> restriction, or is there a new byte code to trigger a tail call?
I believe it's a new bytecode, or else some other artificial marker.
It's not done automatically.
Of course, once it's there, every compiler on the planet can start
tagging tail calls if they want, so I don't expect the artificial marker
will be a problem.
- Charlie
Ahh, good to know. Nice and simple.
- Charlie