comparison src/share/vm/ci/ciStreams.cpp @ 6266:1d7922586cf6

7023639: JSR 292 method handle invocation needs a fast path for compiled code 6984705: JSR 292 method handle creation should not go through JNI Summary: remove assembly code for JDK 7 chained method handles Reviewed-by: jrose, twisti, kvn, mhaupt Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>
author twisti
date Tue, 24 Jul 2012 10:51:00 -0700
parents 8033953d67ff
children 7f813940ac35
comparison
equal deleted inserted replaced
6241:aba91a731143 6266:1d7922586cf6
362 will_link = m->is_loaded(); 362 will_link = m->is_loaded();
363 return m; 363 return m;
364 } 364 }
365 365
366 // ------------------------------------------------------------------ 366 // ------------------------------------------------------------------
367 // ciBytecodeStream::has_appendix
368 //
369 // Returns true if there is an appendix argument stored in the
370 // constant pool cache at the current bci.
371 bool ciBytecodeStream::has_appendix() {
372 VM_ENTRY_MARK;
373 constantPoolHandle cpool(_method->get_methodOop()->constants());
374 return constantPoolOopDesc::has_appendix_at_if_loaded(cpool, get_method_index());
375 }
376
377 // ------------------------------------------------------------------
378 // ciBytecodeStream::get_appendix
379 //
380 // Return the appendix argument stored in the constant pool cache at
381 // the current bci.
382 ciObject* ciBytecodeStream::get_appendix() {
383 VM_ENTRY_MARK;
384 constantPoolHandle cpool(_method->get_methodOop()->constants());
385 oop appendix_oop = constantPoolOopDesc::appendix_at_if_loaded(cpool, get_method_index());
386 return CURRENT_ENV->get_object(appendix_oop);
387 }
388
389 // ------------------------------------------------------------------
367 // ciBytecodeStream::get_declared_method_holder 390 // ciBytecodeStream::get_declared_method_holder
368 // 391 //
369 // Get the declared holder of the currently referenced method. 392 // Get the declared holder of the currently referenced method.
370 // 393 //
371 // Usage note: the holder() of a ciMethod class returns the canonical 394 // Usage note: the holder() of a ciMethod class returns the canonical
376 // for checking linkability when retrieving the associated method. 399 // for checking linkability when retrieving the associated method.
377 ciKlass* ciBytecodeStream::get_declared_method_holder() { 400 ciKlass* ciBytecodeStream::get_declared_method_holder() {
378 VM_ENTRY_MARK; 401 VM_ENTRY_MARK;
379 constantPoolHandle cpool(_method->get_methodOop()->constants()); 402 constantPoolHandle cpool(_method->get_methodOop()->constants());
380 bool ignore; 403 bool ignore;
381 // report as InvokeDynamic for invokedynamic, which is syntactically classless 404 // report as MethodHandle for invokedynamic, which is syntactically classless
382 if (cur_bc() == Bytecodes::_invokedynamic) 405 if (cur_bc() == Bytecodes::_invokedynamic)
383 return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_lang_invoke_InvokeDynamic(), false); 406 return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_lang_invoke_MethodHandle(), false);
384 return CURRENT_ENV->get_klass_by_index(cpool, get_method_holder_index(), ignore, _holder); 407 return CURRENT_ENV->get_klass_by_index(cpool, get_method_holder_index(), ignore, _holder);
385 } 408 }
386 409
387 // ------------------------------------------------------------------ 410 // ------------------------------------------------------------------
388 // ciBytecodeStream::get_method_holder_index 411 // ciBytecodeStream::get_method_holder_index
391 // referenced by the current bytecode. Used for generating 414 // referenced by the current bytecode. Used for generating
392 // deoptimization information. 415 // deoptimization information.
393 int ciBytecodeStream::get_method_holder_index() { 416 int ciBytecodeStream::get_method_holder_index() {
394 constantPoolOop cpool = _method->get_methodOop()->constants(); 417 constantPoolOop cpool = _method->get_methodOop()->constants();
395 return cpool->klass_ref_index_at(get_method_index()); 418 return cpool->klass_ref_index_at(get_method_index());
419 }
420
421 // ------------------------------------------------------------------
422 // ciBytecodeStream::get_declared_method_signature
423 //
424 // Get the declared signature of the currently referenced method.
425 //
426 // This is always the same as the signature of the resolved method
427 // itself, except for _invokehandle and _invokedynamic calls.
428 //
429 ciSignature* ciBytecodeStream::get_declared_method_signature() {
430 int sig_index = get_method_signature_index();
431 VM_ENTRY_MARK;
432 ciEnv* env = CURRENT_ENV;
433 constantPoolHandle cpool(_method->get_methodOop()->constants());
434 Symbol* sig_sym = cpool->symbol_at(sig_index);
435 ciKlass* pool_holder = env->get_object(cpool->pool_holder())->as_klass();
436 return new (env->arena()) ciSignature(pool_holder, cpool, env->get_symbol(sig_sym));
396 } 437 }
397 438
398 // ------------------------------------------------------------------ 439 // ------------------------------------------------------------------
399 // ciBytecodeStream::get_method_signature_index 440 // ciBytecodeStream::get_method_signature_index
400 // 441 //
432 constantPoolCacheOop cpcache = cpool->cache(); 473 constantPoolCacheOop cpcache = cpool->cache();
433 474
434 // Get the CallSite from the constant pool cache. 475 // Get the CallSite from the constant pool cache.
435 int method_index = get_method_index(); 476 int method_index = get_method_index();
436 ConstantPoolCacheEntry* cpcache_entry = cpcache->secondary_entry_at(method_index); 477 ConstantPoolCacheEntry* cpcache_entry = cpcache->secondary_entry_at(method_index);
437 oop call_site_oop = cpcache_entry->f1(); 478 oop call_site_oop = cpcache_entry->f1_as_instance();
438 479
439 // Create a CallSite object and return it. 480 // Create a CallSite object and return it.
440 return CURRENT_ENV->get_object(call_site_oop)->as_call_site(); 481 return CURRENT_ENV->get_object(call_site_oop)->as_call_site();
441 } 482 }