Missing invokehandle handling in bytecodeInterpreter.cpp

Roman Kennke rkennke at redhat.com
Wed Aug 1 09:30:31 PDT 2012


Sorry folks for the funny language, the heat plays tricks with my
brain... Let me rewrite it in English:

Thannks Chris for the tip, I looked at the implementations in
TemplateTable and the existing implementations for the other invoke*
bytecodes in bytecodeInterpreter.cpp, and came up with the following
implementation for invokehandle:

>       CASE(_invokehandle): {
>         if (!EnableInvokeDynamic) {
>           ShouldNotReachHere();
>         }
> 
>         u2 index = Bytes::get_native_u2(pc+1);
> 
>         ConstantPoolCacheEntry* cache = cp->entry_at(index);
> 
>         if (! cache->is_resolved((Bytecodes::Code) opcode)) {
>           CALL_VM(InterpreterRuntime::resolve_invokehandle(THREAD),
>                   handle_exception);
>           cache = cp->entry_at(index);
>         }
> 
>         oop result = cache->f1_as_instance();
> 
>         VERIFY_OOP(result);
>         oop method_handle = java_lang_invoke_CallSite::target(result);
>         CHECK_NULL(method_handle);
> 
>         istate->set_msg(call_method_handle);
>         istate->set_callee((methodOop) method_handle);
>         istate->set_bcp_advance(3);
> 
>         UPDATE_PC_AND_RETURN(0); // I'll be back...
>       }
> 

This is based on some guessing, because I really don't know 100% what
invokehandle is supposed to do. In my understanding it first resolves a
polymorphic call to MethodHandle.invoke*() and then calls it. Is that
right? Does the implementation look correct? I really need some help,
hotspot and JSR292 are still fairly cold waters to jump into for me :-)

> Cheers, Roman


> 
> Am Dienstag, den 31.07.2012, 17:28 -0700 schrieb Christian Thalinger:
> > On Jul 31, 2012, at 8:24 AM, Roman Kennke wrote:
> > 
> > > Am Dienstag, den 31.07.2012, 14:19 +0200 schrieb Roman Kennke:
> > >> Hi there,
> > >> 
> > >> I am currently (trying to) get the Hotspot-Zero port in shape for MLVM.
> > >> I am running into a road block here:
> > >> 
> > >> #  Internal Error
> > >> (/home/rkennke/src/openjdk/hotspot-comp/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp:2464), pid=18585, tid=140737337317120
> > >> #  fatal error: Unimplemented opcode 232 = invokehandle
> > >> 
> > >> Looking at bytecodeInterpreter.cpp it seem to simply not handle
> > >> invokehandle. I would like to add this, but I don't know what exactly
> > >> this bytecode is supposed to do. Could you give me pointers to the
> > >> necessary information or provide some help with this? (Or maybe I am
> > >> doing something wrong here, and should not arrive there at all?)
> > > 
> > > I disabled the invokevirtual->invokehandle rewriting for now (this
> > > should be safe/correct, right?), and it brings me further into my
> > > unimplemented handler for vmIntrinsics::_invokeBasic. Need to figure out
> > > what this is supposed to do (any hints about this one?)..
> > 
> > You can't disable the rewriting and run JSR 292 code.  That simply won't work.  Look at one of the implementations of TemplateTable::_invokehandle and try to do the same in the C++ interpreter.
> > 
> > -- Chris
> > 
> > > 
> > > Regards,
> > > Roman
> > > 
> > > 
> > > _______________________________________________
> > > mlvm-dev mailing list
> > > mlvm-dev at openjdk.java.net
> > > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
> > 
> > _______________________________________________
> > mlvm-dev mailing list
> > mlvm-dev at openjdk.java.net
> > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
> 




More information about the mlvm-dev mailing list