On Apr 29, 2008, at 4:21 PM, Jochen Theodorou wrote:

> well in case of adding two ints I get numbers telling me the factor is
> more 20, then 2.5.

Arithmetic is key use case for invokedynamic and primitive-heavy  
method handle signatures.

You want to say the bytecode equivalent of x.'+'(Object y).  But also  
if y is literally '1' (as it often is) you want x.'+'(int y).

Then invokedynamic can let you manage the types as they flow by  
dynamically; your runtime can pick more or less specific methods as  
the case may be.  And they do not have to be Java methods on  
x.getClass(); they can be anything you can express with a method  
handle that accept x and y.

With inlining and type profiling, you get the right machine code  
(addl eax, 1), guarded somewhere upstream by a cheap type test (cmpl  
[x+#klass], #Integer.klass).

-- John

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to