atom feed37 messages in net.java.openjdk.mlvm-devRe: TaggedArrays (Proposal)
FromSent OnAttachments
Jim LaskeyJul 2, 2012 6:04 am.zip, .zip
Rémi ForaxJul 2, 2012 6:54 am 
Jim LaskeyJul 2, 2012 7:05 am 
ravenexJul 2, 2012 7:11 am 
Jim LaskeyJul 2, 2012 7:21 am 
ravenexJul 2, 2012 7:33 am 
Rémi ForaxJul 2, 2012 7:41 am 
Mark RoosJul 2, 2012 10:23 am 
Jim LaskeyJul 2, 2012 11:50 am 
Mark RoosJul 2, 2012 4:13 pm 
Charles Oliver NutterJul 2, 2012 5:51 pm 
Howard LovattJul 2, 2012 10:28 pm 
Krystal MokJul 2, 2012 10:39 pm 
Howard LovattJul 2, 2012 10:45 pm 
Krystal MokJul 2, 2012 10:57 pm 
Thomas WuerthingerJul 3, 2012 6:49 am 
Mark RoosJul 3, 2012 6:01 pm 
Jim LaskeyJul 3, 2012 6:18 pm 
Rémi ForaxJul 4, 2012 2:00 am 
Jim LaskeyJul 4, 2012 2:12 am 
Jim LaskeyJul 4, 2012 2:18 am 
Mark RoosJul 5, 2012 1:25 pm 
Jim LaskeyJul 5, 2012 1:41 pm 
Rémi ForaxJul 5, 2012 5:23 pm 
Jim LaskeyJul 5, 2012 5:58 pm 
Mark RoosJul 5, 2012 7:41 pm 
Mark RoosJul 6, 2012 11:48 am 
Rémi ForaxJul 6, 2012 2:17 pm 
Mark RoosJul 6, 2012 7:54 pm 
Rémi ForaxJul 7, 2012 1:53 am 
Dain SundstromJul 7, 2012 10:02 am 
Rémi ForaxJul 7, 2012 11:42 am 
Vitaly DavidovichJul 7, 2012 11:48 am 
Dain SundstromJul 7, 2012 12:07 pm 
Mark RoosJul 7, 2012 12:08 pm 
Mark RoosJul 7, 2012 2:43 pm 
Charles Oliver NutterJul 7, 2012 2:44 pm 
Subject:Re: TaggedArrays (Proposal)
From:Rémi Forax (for@univ-mlv.fr)
Date:Jul 7, 2012 1:53:44 am
List:net.java.openjdk.mlvm-dev

On 07/07/2012 04:54 AM, Mark Roos wrote:

Hi Rémi, you mention And now the trick, there is a nice way (several in fact) to explain to the JIT that even if the bytecode contains tests, if the variable contains effectively an int, it's a good idea to remove them.

Ok, in Smalltalk there are some methods which are usually integer ops so its easy to determine vars that are likely integer. I have slots in the stack reserved for just this idea.

So if I have a pair of slots A and B where A would be the integer from and B the reference. Would I test B to be null and if so do an integer op on A?

yes, that the basic idea.

So plese point me at the bytecode tricks that make the test go away.

It's not a bytecode trick, it's a JIT trick. The VM profiles jump instruction like 'if' to know which branch is taken, and doesn't generate code but a deoptimization code if a branch is never taken. So the generator of a backend will generate a code like this for a + 1:

int r1 = ... Object o1 = ... if (o1 == null) { r2 = r1 + 1 o2 = null } else { r2 = 0 o2 = invokedynamic + o1, 1 }

if (o2 == null) { // next instruction ... } else { ... ...

and because o1 is never null, the JIT will generate

jne a_deoptimization_code inc r2

also because the JIT propagates null value aggressively, the jump can also disappear because there is perhaps already another check before, by example, the check o2 == null will be removed here.

So the idea is to consider that if a variable can store an int, you should use two variables in the bytecode, so result of an operation will be spilled into two variables instead of using the stack. I call this idea, split-path and this is really effective, the main drawback is that the generated bytecode size is big compared to the code of the generated assembler so the JIT may decide to not inline something that it should.

You have also to figure out how to get two return values from a method call, but exceptions are your best friend here.

regards mark

rgds, Rémi