Re: Isolated Methods JEP

2016-08-13 Thread Jochen Theodorou

On 13.08.2016 00:54, John Rose wrote:
[...]

Probably the IM is just a faster, more compact way to make something you
could also have made by spinning MH's together.  If someone figures out
what an IM can do that you can't also do with MethodHandles.* methods,
I'm very eager to hear about it.  (And I'll probably want to take it
away, or else add a new MHs API point.)  Mainly, an IM gives you control
over packaging and backtrace structure.


how would throwing and catching exceptions behave there? Can I do these 
without showing the IM on the trace? Because... unless it got changed in 
the meantime... using a MethodHandle that does catch Exceptions 
introduces a trace element (and quite the speed penalty)


bye Jochen

___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev


Re: Isolated Methods JEP

2016-08-13 Thread Peter Levart

Hi Michael, John,


On 08/13/2016 12:46 AM, John Rose wrote:
So there will be no class hosting this method? Not even the "caller" 
class of the Lookup instance that loadCode was invoked upon? What 
will be reported by Reflection.getCallerClass() invoked in a 
@CallerSensitive method invoked from the isolated method?


That last question is easy:  When you create a MH on a @CS method, via 
the Lookup API, the caller is permanently bound to the caller class in 
the Lookup object.  (If you are wondering about security, note that 
you can't get a MH on a @CS method without a full-power Lookup 
object.)  After that, it is irrelevant where and how the MH is 
eventually invoked, including from an isolated method.



On 08/13/2016 12:46 AM, John Rose wrote:
A can see now that defining an isolated method in the context of a 
lookup class can only be allowed when the Lookup instance contains 
ALL_MODES in the mode bits as such method would have access to any 
members that a normal method defined in the lookup class has.


Not sure. I think this suggestion implies something like class 
membership, when in fact the IM should have the access rights defined 
by the Lookup, without belonging to the lookupClass. I may be 
misunderstanding your point.


Since access rights are permanently bound into the MH's stored in the 
isolated constant pool, there should be little or no reason to ask 
about access rights for the IM itself.  Access rights are checked 
during symbolic resolution of class, method, and field references. 
 (Class object access rights are a tricky case, since classes are easy 
to grab.)  Inside the IM constant pool, all references are "live", and 
previously resolved.  There's no reason for the IM to re-resolve them.



...Ah, I can see it now that I have once more looked at the 
specification about the types of entries in constant pool array:


CONSTANT_Methodref_info: a java.lang.invoke.DirectMethodHandle of 
the right kind, obtained via the appropriate API in 
java.lang.invoke.MethodHandles.Lookup


So all methods will be pre-resolved. There will be no symbolic 
references in the isolated methods. The name "isolated" has a clear 
meaning now. Thanks.



Regards, Peter

___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev