1 /* |
1 /* |
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
359 // Additionally return the declared signature to get more concrete |
359 // Additionally return the declared signature to get more concrete |
360 // type information if required (Cf. invokedynamic and invokehandle). |
360 // type information if required (Cf. invokedynamic and invokehandle). |
361 ciMethod* ciBytecodeStream::get_method(bool& will_link, ciSignature* *declared_signature_result) { |
361 ciMethod* ciBytecodeStream::get_method(bool& will_link, ciSignature* *declared_signature_result) { |
362 VM_ENTRY_MARK; |
362 VM_ENTRY_MARK; |
363 ciEnv* env = CURRENT_ENV; |
363 ciEnv* env = CURRENT_ENV; |
364 constantPoolHandle cpool(_method->get_Method()->constants()); |
364 constantPoolHandle cpool(THREAD, _method->get_Method()->constants()); |
365 ciMethod* m = env->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder); |
365 ciMethod* m = env->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder); |
366 will_link = m->is_loaded(); |
366 will_link = m->is_loaded(); |
367 |
367 |
368 // Use the MethodType stored in the CP cache to create a signature |
368 // Use the MethodType stored in the CP cache to create a signature |
369 // with correct types (in respect to class loaders). |
369 // with correct types (in respect to class loaders). |
370 if (has_method_type()) { |
370 if (has_method_type()) { |
371 ciSymbol* sig_sym = env->get_symbol(cpool->symbol_at(get_method_signature_index())); |
371 ciSymbol* sig_sym = env->get_symbol(cpool->symbol_at(get_method_signature_index(cpool))); |
372 ciKlass* pool_holder = env->get_klass(cpool->pool_holder()); |
372 ciKlass* pool_holder = env->get_klass(cpool->pool_holder()); |
373 ciMethodType* method_type = get_method_type(); |
373 ciMethodType* method_type = get_method_type(); |
374 ciSignature* declared_signature = new (env->arena()) ciSignature(pool_holder, sig_sym, method_type); |
374 ciSignature* declared_signature = new (env->arena()) ciSignature(pool_holder, sig_sym, method_type); |
375 (*declared_signature_result) = declared_signature; |
375 (*declared_signature_result) = declared_signature; |
376 } else { |
376 } else { |
463 // ciBytecodeStream::get_method_signature_index |
463 // ciBytecodeStream::get_method_signature_index |
464 // |
464 // |
465 // Get the constant pool index of the signature of the method |
465 // Get the constant pool index of the signature of the method |
466 // referenced by the current bytecode. Used for generating |
466 // referenced by the current bytecode. Used for generating |
467 // deoptimization information. |
467 // deoptimization information. |
468 int ciBytecodeStream::get_method_signature_index() { |
468 int ciBytecodeStream::get_method_signature_index(const constantPoolHandle& cpool) { |
469 GUARDED_VM_ENTRY( |
469 GUARDED_VM_ENTRY( |
470 ConstantPool* cpool = _holder->get_instanceKlass()->constants(); |
|
471 const int method_index = get_method_index(); |
470 const int method_index = get_method_index(); |
472 const int name_and_type_index = cpool->name_and_type_ref_index_at(method_index); |
471 const int name_and_type_index = cpool->name_and_type_ref_index_at(method_index); |
473 return cpool->signature_ref_index_at(name_and_type_index); |
472 return cpool->signature_ref_index_at(name_and_type_index); |
474 ) |
473 ) |
475 } |
474 } |