Mercurial > hg > truffle
diff src/share/vm/ci/ciMethod.cpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | 597bc897257d 1d7922586cf6 |
children | c38f13903fdf |
line wrap: on
line diff
--- a/src/share/vm/ci/ciMethod.cpp Mon Aug 20 15:21:31 2012 +0200 +++ b/src/share/vm/ci/ciMethod.cpp Tue Aug 21 10:39:19 2012 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,7 +79,7 @@ _max_locals = h_m()->max_locals(); _code_size = h_m()->code_size(); _intrinsic_id = h_m()->intrinsic_id(); - _handler_count = h_m()->exception_table()->length() / 4; + _handler_count = h_m()->exception_table_length(); _uses_monitors = h_m()->access_flags().has_monitor_bytecodes(); _balanced_monitors = !_uses_monitors || h_m()->access_flags().is_monitor_matching(); _is_c1_compilable = !h_m()->is_not_c1_compilable(); @@ -198,7 +198,7 @@ } // And load the exception table. - typeArrayOop exc_table = me->exception_table(); + ExceptionTable exc_table(me); // Allocate one extra spot in our list of exceptions. This // last entry will be used to represent the possibility that @@ -209,13 +209,12 @@ * (_handler_count + 1)); if (_handler_count > 0) { for (int i=0; i<_handler_count; i++) { - int base = i*4; _exception_handlers[i] = new (arena) ciExceptionHandler( holder(), - /* start */ exc_table->int_at(base), - /* limit */ exc_table->int_at(base+1), - /* goto pc */ exc_table->int_at(base+2), - /* cp index */ exc_table->int_at(base+3)); + /* start */ exc_table.start_pc(i), + /* limit */ exc_table.end_pc(i), + /* goto pc */ exc_table.handler_pc(i), + /* cp index */ exc_table.catch_type_index(i)); } } @@ -770,39 +769,37 @@ // invokedynamic support // ------------------------------------------------------------------ -// ciMethod::is_method_handle_invoke +// ciMethod::is_method_handle_intrinsic // -// Return true if the method is an instance of one of the two -// signature-polymorphic MethodHandle methods, invokeExact or invokeGeneric. -bool ciMethod::is_method_handle_invoke() const { - if (!is_loaded()) { - bool flag = (holder()->name() == ciSymbol::java_lang_invoke_MethodHandle() && - methodOopDesc::is_method_handle_invoke_name(name()->sid())); - return flag; - } - VM_ENTRY_MARK; - return get_methodOop()->is_method_handle_invoke(); +// Return true if the method is an instance of the JVM-generated +// signature-polymorphic MethodHandle methods, _invokeBasic, _linkToVirtual, etc. +bool ciMethod::is_method_handle_intrinsic() const { + vmIntrinsics::ID iid = _intrinsic_id; // do not check if loaded + return (MethodHandles::is_signature_polymorphic(iid) && + MethodHandles::is_signature_polymorphic_intrinsic(iid)); } // ------------------------------------------------------------------ -// ciMethod::is_method_handle_adapter +// ciMethod::is_compiled_lambda_form // // Return true if the method is a generated MethodHandle adapter. -// These are built by MethodHandleCompiler. -bool ciMethod::is_method_handle_adapter() const { - if (!is_loaded()) return false; - VM_ENTRY_MARK; - return get_methodOop()->is_method_handle_adapter(); +// These are built by Java code. +bool ciMethod::is_compiled_lambda_form() const { + vmIntrinsics::ID iid = _intrinsic_id; // do not check if loaded + return iid == vmIntrinsics::_compiledLambdaForm; } -ciInstance* ciMethod::method_handle_type() { - check_is_loaded(); - VM_ENTRY_MARK; - oop mtype = get_methodOop()->method_handle_type(); - return CURRENT_THREAD_ENV->get_object(mtype)->as_instance(); +// ------------------------------------------------------------------ +// ciMethod::has_member_arg +// +// Return true if the method is a linker intrinsic like _linkToVirtual. +// These are built by the JVM. +bool ciMethod::has_member_arg() const { + vmIntrinsics::ID iid = _intrinsic_id; // do not check if loaded + return (MethodHandles::is_signature_polymorphic(iid) && + MethodHandles::has_member_arg(iid)); } - // ------------------------------------------------------------------ // ciMethod::ensure_method_data // @@ -1025,28 +1022,13 @@ // ------------------------------------------------------------------ // ciMethod::code_size_for_inlining // -// Code size for inlining decisions. -// -// Don't fully count method handle adapters against inlining budgets: -// the metric we use here is the number of call sites in the adapter -// as they are probably the instructions which generate some code. +// Code size for inlining decisions. This method returns a code +// size of 1 for methods which has the ForceInline annotation. int ciMethod::code_size_for_inlining() { check_is_loaded(); - - // Method handle adapters - if (is_method_handle_adapter()) { - // Count call sites - int call_site_count = 0; - ciBytecodeStream iter(this); - while (iter.next() != ciBytecodeStream::EOBC()) { - if (Bytecodes::is_invoke(iter.cur_bc())) { - call_site_count++; - } - } - return call_site_count; + if (get_methodOop()->force_inline()) { + return 1; } - - // Normal method return code_size(); } @@ -1128,7 +1110,8 @@ constantPoolHandle pool (THREAD, get_methodOop()->constants()); methodHandle spec_method; KlassHandle spec_klass; - LinkResolver::resolve_method(spec_method, spec_klass, pool, refinfo_index, THREAD); + Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual); + LinkResolver::resolve_method_statically(spec_method, spec_klass, code, pool, refinfo_index, THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; return false; @@ -1208,8 +1191,16 @@ // // Print the name of this method, without signature. void ciMethod::print_short_name(outputStream* st) { - check_is_loaded(); - GUARDED_VM_ENTRY(get_methodOop()->print_short_name(st);) + if (is_loaded()) { + GUARDED_VM_ENTRY(get_methodOop()->print_short_name(st);); + } else { + // Fall back if method is not loaded. + holder()->print_name_on(st); + st->print("::"); + name()->print_symbol_on(st); + if (WizardMode) + signature()->as_symbol()->print_symbol_on(st); + } } // ------------------------------------------------------------------ @@ -1224,6 +1215,7 @@ holder()->print_name_on(st); st->print(" signature="); signature()->as_symbol()->print_symbol_on(st); + st->print(" arg_size=%d", arg_size()); if (is_loaded()) { st->print(" loaded=true flags="); flags().print_member_flags(st);