parse1.cpp revision 991
0N/A/*
844N/A * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A * CA 95054 USA or visit www.sun.com if you need additional information or
0N/A * have any questions.
0N/A *
0N/A */
0N/A
0N/A#include "incls/_precompiled.incl"
0N/A#include "incls/_parse1.cpp.incl"
0N/A
0N/A// Static array so we can figure out which bytecodes stop us from compiling
0N/A// the most. Some of the non-static variables are needed in bytecodeInfo.cpp
0N/A// and eventually should be encapsulated in a proper class (gri 8/18/98).
0N/A
367N/Aint nodes_created = 0;
367N/Aint methods_parsed = 0;
367N/Aint methods_seen = 0;
367N/Aint blocks_parsed = 0;
367N/Aint blocks_seen = 0;
0N/A
367N/Aint explicit_null_checks_inserted = 0;
367N/Aint explicit_null_checks_elided = 0;
0N/Aint all_null_checks_found = 0, implicit_null_checks = 0;
0N/Aint implicit_null_throws = 0;
0N/A
0N/Aint reclaim_idx = 0;
0N/Aint reclaim_in = 0;
0N/Aint reclaim_node = 0;
0N/A
0N/A#ifndef PRODUCT
0N/Abool Parse::BytecodeParseHistogram::_initialized = false;
0N/Auint Parse::BytecodeParseHistogram::_bytecodes_parsed [Bytecodes::number_of_codes];
0N/Auint Parse::BytecodeParseHistogram::_nodes_constructed[Bytecodes::number_of_codes];
0N/Auint Parse::BytecodeParseHistogram::_nodes_transformed[Bytecodes::number_of_codes];
0N/Auint Parse::BytecodeParseHistogram::_new_values [Bytecodes::number_of_codes];
0N/A#endif
0N/A
0N/A//------------------------------print_statistics-------------------------------
0N/A#ifndef PRODUCT
0N/Avoid Parse::print_statistics() {
0N/A tty->print_cr("--- Compiler Statistics ---");
0N/A tty->print("Methods seen: %d Methods parsed: %d", methods_seen, methods_parsed);
0N/A tty->print(" Nodes created: %d", nodes_created);
0N/A tty->cr();
0N/A if (methods_seen != methods_parsed)
0N/A tty->print_cr("Reasons for parse failures (NOT cumulative):");
367N/A tty->print_cr("Blocks parsed: %d Blocks seen: %d", blocks_parsed, blocks_seen);
0N/A
0N/A if( explicit_null_checks_inserted )
0N/A tty->print_cr("%d original NULL checks - %d elided (%2d%%); optimizer leaves %d,", explicit_null_checks_inserted, explicit_null_checks_elided, (100*explicit_null_checks_elided)/explicit_null_checks_inserted, all_null_checks_found);
0N/A if( all_null_checks_found )
0N/A tty->print_cr("%d made implicit (%2d%%)", implicit_null_checks,
0N/A (100*implicit_null_checks)/all_null_checks_found);
0N/A if( implicit_null_throws )
0N/A tty->print_cr("%d implicit null exceptions at runtime",
0N/A implicit_null_throws);
0N/A
0N/A if( PrintParseStatistics && BytecodeParseHistogram::initialized() ) {
0N/A BytecodeParseHistogram::print();
0N/A }
0N/A}
0N/A#endif
0N/A
0N/A//------------------------------ON STACK REPLACEMENT---------------------------
0N/A
0N/A// Construct a node which can be used to get incoming state for
0N/A// on stack replacement.
0N/ANode *Parse::fetch_interpreter_state(int index,
0N/A BasicType bt,
0N/A Node *local_addrs,
0N/A Node *local_addrs_base) {
0N/A Node *mem = memory(Compile::AliasIdxRaw);
0N/A Node *adr = basic_plus_adr( local_addrs_base, local_addrs, -index*wordSize );
0N/A
0N/A // Very similar to LoadNode::make, except we handle un-aligned longs and
0N/A // doubles on Sparc. Intel can handle them just fine directly.
0N/A Node *l;
0N/A switch( bt ) { // Signature is flattened
0N/A case T_INT: l = new (C, 3) LoadINode( 0, mem, adr, TypeRawPtr::BOTTOM ); break;
0N/A case T_FLOAT: l = new (C, 3) LoadFNode( 0, mem, adr, TypeRawPtr::BOTTOM ); break;
684N/A case T_ADDRESS: l = new (C, 3) LoadPNode( 0, mem, adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM ); break;
0N/A case T_OBJECT: l = new (C, 3) LoadPNode( 0, mem, adr, TypeRawPtr::BOTTOM, TypeInstPtr::BOTTOM ); break;
0N/A case T_LONG:
0N/A case T_DOUBLE: {
0N/A // Since arguments are in reverse order, the argument address 'adr'
0N/A // refers to the back half of the long/double. Recompute adr.
0N/A adr = basic_plus_adr( local_addrs_base, local_addrs, -(index+1)*wordSize );
0N/A if( Matcher::misaligned_doubles_ok ) {
0N/A l = (bt == T_DOUBLE)
0N/A ? (Node*)new (C, 3) LoadDNode( 0, mem, adr, TypeRawPtr::BOTTOM )
0N/A : (Node*)new (C, 3) LoadLNode( 0, mem, adr, TypeRawPtr::BOTTOM );
0N/A } else {
0N/A l = (bt == T_DOUBLE)
0N/A ? (Node*)new (C, 3) LoadD_unalignedNode( 0, mem, adr, TypeRawPtr::BOTTOM )
0N/A : (Node*)new (C, 3) LoadL_unalignedNode( 0, mem, adr, TypeRawPtr::BOTTOM );
0N/A }
0N/A break;
0N/A }
0N/A default: ShouldNotReachHere();
0N/A }
0N/A return _gvn.transform(l);
0N/A}
0N/A
0N/A// Helper routine to prevent the interpreter from handing
0N/A// unexpected typestate to an OSR method.
0N/A// The Node l is a value newly dug out of the interpreter frame.
0N/A// The type is the type predicted by ciTypeFlow. Note that it is
0N/A// not a general type, but can only come from Type::get_typeflow_type.
0N/A// The safepoint is a map which will feed an uncommon trap.
0N/ANode* Parse::check_interpreter_type(Node* l, const Type* type,
0N/A SafePointNode* &bad_type_exit) {
0N/A
0N/A const TypeOopPtr* tp = type->isa_oopptr();
0N/A
0N/A // TypeFlow may assert null-ness if a type appears unloaded.
0N/A if (type == TypePtr::NULL_PTR ||
0N/A (tp != NULL && !tp->klass()->is_loaded())) {
0N/A // Value must be null, not a real oop.
0N/A Node* chk = _gvn.transform( new (C, 3) CmpPNode(l, null()) );
0N/A Node* tst = _gvn.transform( new (C, 2) BoolNode(chk, BoolTest::eq) );
0N/A IfNode* iff = create_and_map_if(control(), tst, PROB_MAX, COUNT_UNKNOWN);
0N/A set_control(_gvn.transform( new (C, 1) IfTrueNode(iff) ));
0N/A Node* bad_type = _gvn.transform( new (C, 1) IfFalseNode(iff) );
0N/A bad_type_exit->control()->add_req(bad_type);
0N/A l = null();
0N/A }
0N/A
0N/A // Typeflow can also cut off paths from the CFG, based on
0N/A // types which appear unloaded, or call sites which appear unlinked.
0N/A // When paths are cut off, values at later merge points can rise
0N/A // toward more specific classes. Make sure these specific classes
0N/A // are still in effect.
0N/A if (tp != NULL && tp->klass() != C->env()->Object_klass()) {
0N/A // TypeFlow asserted a specific object type. Value must have that type.
0N/A Node* bad_type_ctrl = NULL;
0N/A l = gen_checkcast(l, makecon(TypeKlassPtr::make(tp->klass())), &bad_type_ctrl);
0N/A bad_type_exit->control()->add_req(bad_type_ctrl);
0N/A }
0N/A
0N/A BasicType bt_l = _gvn.type(l)->basic_type();
0N/A BasicType bt_t = type->basic_type();
0N/A assert(_gvn.type(l)->higher_equal(type), "must constrain OSR typestate");
0N/A return l;
0N/A}
0N/A
0N/A// Helper routine which sets up elements of the initial parser map when
0N/A// performing a parse for on stack replacement. Add values into map.
0N/A// The only parameter contains the address of a interpreter arguments.
0N/Avoid Parse::load_interpreter_state(Node* osr_buf) {
0N/A int index;
0N/A int max_locals = jvms()->loc_size();
0N/A int max_stack = jvms()->stk_size();
0N/A
0N/A
0N/A // Mismatch between method and jvms can occur since map briefly held
0N/A // an OSR entry state (which takes up one RawPtr word).
0N/A assert(max_locals == method()->max_locals(), "sanity");
0N/A assert(max_stack >= method()->max_stack(), "sanity");
0N/A assert((int)jvms()->endoff() == TypeFunc::Parms + max_locals + max_stack, "sanity");
0N/A assert((int)jvms()->endoff() == (int)map()->req(), "sanity");
0N/A
0N/A // Find the start block.
0N/A Block* osr_block = start_block();
0N/A assert(osr_block->start() == osr_bci(), "sanity");
0N/A
0N/A // Set initial BCI.
0N/A set_parse_bci(osr_block->start());
0N/A
0N/A // Set initial stack depth.
0N/A set_sp(osr_block->start_sp());
0N/A
0N/A // Check bailouts. We currently do not perform on stack replacement
0N/A // of loops in catch blocks or loops which branch with a non-empty stack.
0N/A if (sp() != 0) {
0N/A C->record_method_not_compilable("OSR starts with non-empty stack");
0N/A return;
0N/A }
0N/A // Do not OSR inside finally clauses:
0N/A if (osr_block->has_trap_at(osr_block->start())) {
0N/A C->record_method_not_compilable("OSR starts with an immediate trap");
0N/A return;
0N/A }
0N/A
0N/A // Commute monitors from interpreter frame to compiler frame.
0N/A assert(jvms()->monitor_depth() == 0, "should be no active locks at beginning of osr");
0N/A int mcnt = osr_block->flow()->monitor_count();
0N/A Node *monitors_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals+mcnt*2-1)*wordSize);
0N/A for (index = 0; index < mcnt; index++) {
0N/A // Make a BoxLockNode for the monitor.
0N/A Node *box = _gvn.transform(new (C, 1) BoxLockNode(next_monitor()));
0N/A
0N/A
0N/A // Displaced headers and locked objects are interleaved in the
0N/A // temp OSR buffer. We only copy the locked objects out here.
0N/A // Fetch the locked object from the OSR temp buffer and copy to our fastlock node.
0N/A Node *lock_object = fetch_interpreter_state(index*2, T_OBJECT, monitors_addr, osr_buf);
0N/A // Try and copy the displaced header to the BoxNode
0N/A Node *displaced_hdr = fetch_interpreter_state((index*2) + 1, T_ADDRESS, monitors_addr, osr_buf);
0N/A
0N/A
0N/A store_to_memory(control(), box, displaced_hdr, T_ADDRESS, Compile::AliasIdxRaw);
0N/A
0N/A // Build a bogus FastLockNode (no code will be generated) and push the
0N/A // monitor into our debug info.
0N/A const FastLockNode *flock = _gvn.transform(new (C, 3) FastLockNode( 0, lock_object, box ))->as_FastLock();
0N/A map()->push_monitor(flock);
0N/A
0N/A // If the lock is our method synchronization lock, tuck it away in
0N/A // _sync_lock for return and rethrow exit paths.
0N/A if (index == 0 && method()->is_synchronized()) {
0N/A _synch_lock = flock;
0N/A }
0N/A }
0N/A
991N/A // Use the raw liveness computation to make sure that unexpected
991N/A // values don't propagate into the OSR frame.
991N/A MethodLivenessResult live_locals = method()->raw_liveness_at_bci(osr_bci());
0N/A if (!live_locals.is_valid()) {
0N/A // Degenerate or breakpointed method.
0N/A C->record_method_not_compilable("OSR in empty or breakpointed method");
0N/A return;
0N/A }
0N/A
0N/A // Extract the needed locals from the interpreter frame.
0N/A Node *locals_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals-1)*wordSize);
0N/A
0N/A // find all the locals that the interpreter thinks contain live oops
0N/A const BitMap live_oops = method()->live_local_oops_at_bci(osr_bci());
0N/A for (index = 0; index < max_locals; index++) {
0N/A
0N/A if (!live_locals.at(index)) {
0N/A continue;
0N/A }
0N/A
0N/A const Type *type = osr_block->local_type_at(index);
0N/A
0N/A if (type->isa_oopptr() != NULL) {
0N/A
0N/A // 6403625: Verify that the interpreter oopMap thinks that the oop is live
0N/A // else we might load a stale oop if the MethodLiveness disagrees with the
0N/A // result of the interpreter. If the interpreter says it is dead we agree
0N/A // by making the value go to top.
0N/A //
0N/A
0N/A if (!live_oops.at(index)) {
0N/A if (C->log() != NULL) {
0N/A C->log()->elem("OSR_mismatch local_index='%d'",index);
0N/A }
0N/A set_local(index, null());
0N/A // and ignore it for the loads
0N/A continue;
0N/A }
0N/A }
0N/A
0N/A // Filter out TOP, HALF, and BOTTOM. (Cf. ensure_phi.)
0N/A if (type == Type::TOP || type == Type::HALF) {
0N/A continue;
0N/A }
0N/A // If the type falls to bottom, then this must be a local that
0N/A // is mixing ints and oops or some such. Forcing it to top
0N/A // makes it go dead.
0N/A if (type == Type::BOTTOM) {
0N/A continue;
0N/A }
0N/A // Construct code to access the appropriate local.
0N/A Node *value = fetch_interpreter_state(index, type->basic_type(), locals_addr, osr_buf);
0N/A set_local(index, value);
0N/A }
0N/A
0N/A // Extract the needed stack entries from the interpreter frame.
0N/A for (index = 0; index < sp(); index++) {
0N/A const Type *type = osr_block->stack_type_at(index);
0N/A if (type != Type::TOP) {
0N/A // Currently the compiler bails out when attempting to on stack replace
0N/A // at a bci with a non-empty stack. We should not reach here.
0N/A ShouldNotReachHere();
0N/A }
0N/A }
0N/A
0N/A // End the OSR migration
0N/A make_runtime_call(RC_LEAF, OptoRuntime::osr_end_Type(),
0N/A CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_end),
0N/A "OSR_migration_end", TypeRawPtr::BOTTOM,
0N/A osr_buf);
0N/A
0N/A // Now that the interpreter state is loaded, make sure it will match
0N/A // at execution time what the compiler is expecting now:
0N/A SafePointNode* bad_type_exit = clone_map();
0N/A bad_type_exit->set_control(new (C, 1) RegionNode(1));
0N/A
0N/A for (index = 0; index < max_locals; index++) {
0N/A if (stopped()) break;
0N/A Node* l = local(index);
0N/A if (l->is_top()) continue; // nothing here
0N/A const Type *type = osr_block->local_type_at(index);
0N/A if (type->isa_oopptr() != NULL) {
0N/A if (!live_oops.at(index)) {
0N/A // skip type check for dead oops
0N/A continue;
0N/A }
0N/A }
0N/A set_local(index, check_interpreter_type(l, type, bad_type_exit));
0N/A }
0N/A
0N/A for (index = 0; index < sp(); index++) {
0N/A if (stopped()) break;
0N/A Node* l = stack(index);
0N/A if (l->is_top()) continue; // nothing here
0N/A const Type *type = osr_block->stack_type_at(index);
0N/A set_stack(index, check_interpreter_type(l, type, bad_type_exit));
0N/A }
0N/A
0N/A if (bad_type_exit->control()->req() > 1) {
0N/A // Build an uncommon trap here, if any inputs can be unexpected.
0N/A bad_type_exit->set_control(_gvn.transform( bad_type_exit->control() ));
0N/A record_for_igvn(bad_type_exit->control());
0N/A SafePointNode* types_are_good = map();
0N/A set_map(bad_type_exit);
0N/A // The unexpected type happens because a new edge is active
0N/A // in the CFG, which typeflow had previously ignored.
0N/A // E.g., Object x = coldAtFirst() && notReached()? "str": new Integer(123).
0N/A // This x will be typed as Integer if notReached is not yet linked.
0N/A uncommon_trap(Deoptimization::Reason_unreached,
0N/A Deoptimization::Action_reinterpret);
0N/A set_map(types_are_good);
0N/A }
0N/A}
0N/A
0N/A//------------------------------Parse------------------------------------------
0N/A// Main parser constructor.
0N/AParse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses)
0N/A : _exits(caller)
0N/A{
0N/A // Init some variables
0N/A _caller = caller;
0N/A _method = parse_method;
0N/A _expected_uses = expected_uses;
0N/A _depth = 1 + (caller->has_method() ? caller->depth() : 0);
0N/A _wrote_final = false;
0N/A _entry_bci = InvocationEntryBci;
0N/A _tf = NULL;
0N/A _block = NULL;
0N/A debug_only(_block_count = -1);
0N/A debug_only(_blocks = (Block*)-1);
0N/A#ifndef PRODUCT
0N/A if (PrintCompilation || PrintOpto) {
0N/A // Make sure I have an inline tree, so I can print messages about it.
0N/A JVMState* ilt_caller = is_osr_parse() ? caller->caller() : caller;
0N/A InlineTree::find_subtree_from_root(C->ilt(), ilt_caller, parse_method, true);
0N/A }
0N/A _max_switch_depth = 0;
0N/A _est_switch_depth = 0;
0N/A#endif
0N/A
0N/A _tf = TypeFunc::make(method());
0N/A _iter.reset_to_method(method());
0N/A _flow = method()->get_flow_analysis();
0N/A if (_flow->failing()) {
0N/A C->record_method_not_compilable_all_tiers(_flow->failure_reason());
0N/A }
0N/A
367N/A#ifndef PRODUCT
367N/A if (_flow->has_irreducible_entry()) {
367N/A C->set_parsed_irreducible_loop(true);
367N/A }
367N/A#endif
367N/A
0N/A if (_expected_uses <= 0) {
0N/A _prof_factor = 1;
0N/A } else {
0N/A float prof_total = parse_method->interpreter_invocation_count();
0N/A if (prof_total <= _expected_uses) {
0N/A _prof_factor = 1;
0N/A } else {
0N/A _prof_factor = _expected_uses / prof_total;
0N/A }
0N/A }
0N/A
0N/A CompileLog* log = C->log();
0N/A if (log != NULL) {
0N/A log->begin_head("parse method='%d' uses='%g'",
0N/A log->identify(parse_method), expected_uses);
0N/A if (depth() == 1 && C->is_osr_compilation()) {
0N/A log->print(" osr_bci='%d'", C->entry_bci());
0N/A }
0N/A log->stamp();
0N/A log->end_head();
0N/A }
0N/A
0N/A // Accumulate deoptimization counts.
0N/A // (The range_check and store_check counts are checked elsewhere.)
0N/A ciMethodData* md = method()->method_data();
0N/A for (uint reason = 0; reason < md->trap_reason_limit(); reason++) {
0N/A uint md_count = md->trap_count(reason);
0N/A if (md_count != 0) {
0N/A if (md_count == md->trap_count_limit())
0N/A md_count += md->overflow_trap_count();
0N/A uint total_count = C->trap_count(reason);
0N/A uint old_count = total_count;
0N/A total_count += md_count;
0N/A // Saturate the add if it overflows.
0N/A if (total_count < old_count || total_count < md_count)
0N/A total_count = (uint)-1;
0N/A C->set_trap_count(reason, total_count);
0N/A if (log != NULL)
0N/A log->elem("observe trap='%s' count='%d' total='%d'",
0N/A Deoptimization::trap_reason_name(reason),
0N/A md_count, total_count);
0N/A }
0N/A }
0N/A // Accumulate total sum of decompilations, also.
0N/A C->set_decompile_count(C->decompile_count() + md->decompile_count());
0N/A
0N/A _count_invocations = C->do_count_invocations();
0N/A _method_data_update = C->do_method_data_update();
0N/A
0N/A if (log != NULL && method()->has_exception_handlers()) {
0N/A log->elem("observe that='has_exception_handlers'");
0N/A }
0N/A
0N/A assert(method()->can_be_compiled(), "Can not parse this method, cutout earlier");
0N/A assert(method()->has_balanced_monitors(), "Can not parse unbalanced monitors, cutout earlier");
0N/A
0N/A // Always register dependence if JVMTI is enabled, because
0N/A // either breakpoint setting or hotswapping of methods may
0N/A // cause deoptimization.
780N/A if (C->env()->jvmti_can_hotswap_or_post_breakpoint()) {
0N/A C->dependencies()->assert_evol_method(method());
0N/A }
0N/A
0N/A methods_seen++;
0N/A
0N/A // Do some special top-level things.
0N/A if (depth() == 1 && C->is_osr_compilation()) {
0N/A _entry_bci = C->entry_bci();
0N/A _flow = method()->get_osr_flow_analysis(osr_bci());
0N/A if (_flow->failing()) {
0N/A C->record_method_not_compilable(_flow->failure_reason());
0N/A#ifndef PRODUCT
0N/A if (PrintOpto && (Verbose || WizardMode)) {
0N/A tty->print_cr("OSR @%d type flow bailout: %s", _entry_bci, _flow->failure_reason());
0N/A if (Verbose) {
0N/A method()->print_oop();
0N/A method()->print_codes();
0N/A _flow->print();
0N/A }
0N/A }
0N/A#endif
0N/A }
0N/A _tf = C->tf(); // the OSR entry type is different
0N/A }
0N/A
0N/A#ifdef ASSERT
0N/A if (depth() == 1) {
0N/A assert(C->is_osr_compilation() == this->is_osr_parse(), "OSR in sync");
0N/A if (C->tf() != tf()) {
0N/A MutexLockerEx ml(Compile_lock, Mutex::_no_safepoint_check_flag);
0N/A assert(C->env()->system_dictionary_modification_counter_changed(),
0N/A "Must invalidate if TypeFuncs differ");
0N/A }
0N/A } else {
0N/A assert(!this->is_osr_parse(), "no recursive OSR");
0N/A }
0N/A#endif
0N/A
0N/A methods_parsed++;
0N/A#ifndef PRODUCT
0N/A // add method size here to guarantee that inlined methods are added too
0N/A if (TimeCompiler)
0N/A _total_bytes_compiled += method()->code_size();
0N/A
0N/A show_parse_info();
0N/A#endif
0N/A
0N/A if (failing()) {
0N/A if (log) log->done("parse");
0N/A return;
0N/A }
0N/A
0N/A gvn().set_type(root(), root()->bottom_type());
0N/A gvn().transform(top());
0N/A
0N/A // Import the results of the ciTypeFlow.
0N/A init_blocks();
0N/A
0N/A // Merge point for all normal exits
0N/A build_exits();
0N/A
0N/A // Setup the initial JVM state map.
0N/A SafePointNode* entry_map = create_entry_map();
0N/A
0N/A // Check for bailouts during map initialization
0N/A if (failing() || entry_map == NULL) {
0N/A if (log) log->done("parse");
0N/A return;
0N/A }
0N/A
0N/A Node_Notes* caller_nn = C->default_node_notes();
0N/A // Collect debug info for inlined calls unless -XX:-DebugInlinedCalls.
0N/A if (DebugInlinedCalls || depth() == 1) {
0N/A C->set_default_node_notes(make_node_notes(caller_nn));
0N/A }
0N/A
0N/A if (is_osr_parse()) {
0N/A Node* osr_buf = entry_map->in(TypeFunc::Parms+0);
0N/A entry_map->set_req(TypeFunc::Parms+0, top());
0N/A set_map(entry_map);
0N/A load_interpreter_state(osr_buf);
0N/A } else {
0N/A set_map(entry_map);
0N/A do_method_entry();
0N/A }
0N/A
0N/A // Check for bailouts during method entry.
0N/A if (failing()) {
0N/A if (log) log->done("parse");
0N/A C->set_default_node_notes(caller_nn);
0N/A return;
0N/A }
0N/A
0N/A entry_map = map(); // capture any changes performed by method setup code
0N/A assert(jvms()->endoff() == map()->req(), "map matches JVMS layout");
0N/A
0N/A // We begin parsing as if we have just encountered a jump to the
0N/A // method entry.
0N/A Block* entry_block = start_block();
0N/A assert(entry_block->start() == (is_osr_parse() ? osr_bci() : 0), "");
0N/A set_map_clone(entry_map);
0N/A merge_common(entry_block, entry_block->next_path_num());
0N/A
0N/A#ifndef PRODUCT
0N/A BytecodeParseHistogram *parse_histogram_obj = new (C->env()->arena()) BytecodeParseHistogram(this, C);
0N/A set_parse_histogram( parse_histogram_obj );
0N/A#endif
0N/A
0N/A // Parse all the basic blocks.
0N/A do_all_blocks();
0N/A
0N/A C->set_default_node_notes(caller_nn);
0N/A
0N/A // Check for bailouts during conversion to graph
0N/A if (failing()) {
0N/A if (log) log->done("parse");
0N/A return;
0N/A }
0N/A
0N/A // Fix up all exiting control flow.
0N/A set_map(entry_map);
0N/A do_exits();
0N/A
0N/A if (log) log->done("parse nodes='%d' memory='%d'",
0N/A C->unique(), C->node_arena()->used());
0N/A}
0N/A
0N/A//---------------------------do_all_blocks-------------------------------------
0N/Avoid Parse::do_all_blocks() {
367N/A bool has_irreducible = flow()->has_irreducible_entry();
367N/A
367N/A // Walk over all blocks in Reverse Post-Order.
367N/A while (true) {
367N/A bool progress = false;
367N/A for (int rpo = 0; rpo < block_count(); rpo++) {
367N/A Block* block = rpo_at(rpo);
367N/A
367N/A if (block->is_parsed()) continue;
0N/A
367N/A if (!block->is_merged()) {
367N/A // Dead block, no state reaches this block
367N/A continue;
367N/A }
0N/A
367N/A // Prepare to parse this block.
367N/A load_state_from(block);
367N/A
367N/A if (stopped()) {
367N/A // Block is dead.
367N/A continue;
367N/A }
367N/A
367N/A blocks_parsed++;
0N/A
367N/A progress = true;
367N/A if (block->is_loop_head() || block->is_handler() || has_irreducible && !block->is_ready()) {
367N/A // Not all preds have been parsed. We must build phis everywhere.
367N/A // (Note that dead locals do not get phis built, ever.)
367N/A ensure_phis_everywhere();
367N/A
367N/A // Leave behind an undisturbed copy of the map, for future merges.
367N/A set_map(clone_map());
367N/A }
0N/A
367N/A if (control()->is_Region() && !block->is_loop_head() && !has_irreducible && !block->is_handler()) {
367N/A // In the absence of irreducible loops, the Region and Phis
367N/A // associated with a merge that doesn't involve a backedge can
605N/A // be simplified now since the RPO parsing order guarantees
367N/A // that any path which was supposed to reach here has already
367N/A // been parsed or must be dead.
367N/A Node* c = control();
367N/A Node* result = _gvn.transform_no_reclaim(control());
367N/A if (c != result && TraceOptoParse) {
367N/A tty->print_cr("Block #%d replace %d with %d", block->rpo(), c->_idx, result->_idx);
367N/A }
367N/A if (result != top()) {
367N/A record_for_igvn(result);
367N/A }
367N/A }
0N/A
367N/A // Parse the block.
367N/A do_one_block();
367N/A
367N/A // Check for bailouts.
367N/A if (failing()) return;
367N/A }
367N/A
367N/A // with irreducible loops multiple passes might be necessary to parse everything
367N/A if (!has_irreducible || !progress) {
0N/A break;
0N/A }
367N/A }
0N/A
367N/A blocks_seen += block_count();
0N/A
0N/A#ifndef PRODUCT
0N/A // Make sure there are no half-processed blocks remaining.
0N/A // Every remaining unprocessed block is dead and may be ignored now.
367N/A for (int rpo = 0; rpo < block_count(); rpo++) {
367N/A Block* block = rpo_at(rpo);
0N/A if (!block->is_parsed()) {
0N/A if (TraceOptoParse) {
367N/A tty->print_cr("Skipped dead block %d at bci:%d", rpo, block->start());
0N/A }
367N/A assert(!block->is_merged(), "no half-processed blocks");
0N/A }
0N/A }
0N/A#endif
0N/A}
0N/A
0N/A//-------------------------------build_exits----------------------------------
0N/A// Build normal and exceptional exit merge points.
0N/Avoid Parse::build_exits() {
0N/A // make a clone of caller to prevent sharing of side-effects
0N/A _exits.set_map(_exits.clone_map());
0N/A _exits.clean_stack(_exits.sp());
0N/A _exits.sync_jvms();
0N/A
0N/A RegionNode* region = new (C, 1) RegionNode(1);
0N/A record_for_igvn(region);
0N/A gvn().set_type_bottom(region);
0N/A _exits.set_control(region);
0N/A
0N/A // Note: iophi and memphi are not transformed until do_exits.
0N/A Node* iophi = new (C, region->req()) PhiNode(region, Type::ABIO);
0N/A Node* memphi = new (C, region->req()) PhiNode(region, Type::MEMORY, TypePtr::BOTTOM);
0N/A _exits.set_i_o(iophi);
0N/A _exits.set_all_memory(memphi);
0N/A
0N/A // Add a return value to the exit state. (Do not push it yet.)
0N/A if (tf()->range()->cnt() > TypeFunc::Parms) {
0N/A const Type* ret_type = tf()->range()->field_at(TypeFunc::Parms);
0N/A // Don't "bind" an unloaded return klass to the ret_phi. If the klass
0N/A // becomes loaded during the subsequent parsing, the loaded and unloaded
0N/A // types will not join when we transform and push in do_exits().
0N/A const TypeOopPtr* ret_oop_type = ret_type->isa_oopptr();
0N/A if (ret_oop_type && !ret_oop_type->klass()->is_loaded()) {
0N/A ret_type = TypeOopPtr::BOTTOM;
0N/A }
0N/A int ret_size = type2size[ret_type->basic_type()];
0N/A Node* ret_phi = new (C, region->req()) PhiNode(region, ret_type);
0N/A _exits.ensure_stack(ret_size);
0N/A assert((int)(tf()->range()->cnt() - TypeFunc::Parms) == ret_size, "good tf range");
0N/A assert(method()->return_type()->size() == ret_size, "tf agrees w/ method");
0N/A _exits.set_argument(0, ret_phi); // here is where the parser finds it
0N/A // Note: ret_phi is not yet pushed, until do_exits.
0N/A }
0N/A}
0N/A
0N/A
0N/A//----------------------------build_start_state-------------------------------
0N/A// Construct a state which contains only the incoming arguments from an
0N/A// unknown caller. The method & bci will be NULL & InvocationEntryBci.
0N/AJVMState* Compile::build_start_state(StartNode* start, const TypeFunc* tf) {
0N/A int arg_size = tf->domain()->cnt();
0N/A int max_size = MAX2(arg_size, (int)tf->range()->cnt());
0N/A JVMState* jvms = new (this) JVMState(max_size - TypeFunc::Parms);
0N/A SafePointNode* map = new (this, max_size) SafePointNode(max_size, NULL);
0N/A record_for_igvn(map);
0N/A assert(arg_size == TypeFunc::Parms + (is_osr_compilation() ? 1 : method()->arg_size()), "correct arg_size");
0N/A Node_Notes* old_nn = default_node_notes();
0N/A if (old_nn != NULL && has_method()) {
0N/A Node_Notes* entry_nn = old_nn->clone(this);
0N/A JVMState* entry_jvms = new(this) JVMState(method(), old_nn->jvms());
0N/A entry_jvms->set_offsets(0);
0N/A entry_jvms->set_bci(entry_bci());
0N/A entry_nn->set_jvms(entry_jvms);
0N/A set_default_node_notes(entry_nn);
0N/A }
0N/A uint i;
0N/A for (i = 0; i < (uint)arg_size; i++) {
0N/A Node* parm = initial_gvn()->transform(new (this, 1) ParmNode(start, i));
0N/A map->init_req(i, parm);
0N/A // Record all these guys for later GVN.
0N/A record_for_igvn(parm);
0N/A }
0N/A for (; i < map->req(); i++) {
0N/A map->init_req(i, top());
0N/A }
0N/A assert(jvms->argoff() == TypeFunc::Parms, "parser gets arguments here");
0N/A set_default_node_notes(old_nn);
0N/A map->set_jvms(jvms);
0N/A jvms->set_map(map);
0N/A return jvms;
0N/A}
0N/A
0N/A//-----------------------------make_node_notes---------------------------------
0N/ANode_Notes* Parse::make_node_notes(Node_Notes* caller_nn) {
0N/A if (caller_nn == NULL) return NULL;
0N/A Node_Notes* nn = caller_nn->clone(C);
0N/A JVMState* caller_jvms = nn->jvms();
0N/A JVMState* jvms = new (C) JVMState(method(), caller_jvms);
0N/A jvms->set_offsets(0);
0N/A jvms->set_bci(_entry_bci);
0N/A nn->set_jvms(jvms);
0N/A return nn;
0N/A}
0N/A
0N/A
0N/A//--------------------------return_values--------------------------------------
0N/Avoid Compile::return_values(JVMState* jvms) {
0N/A GraphKit kit(jvms);
0N/A Node* ret = new (this, TypeFunc::Parms) ReturnNode(TypeFunc::Parms,
0N/A kit.control(),
0N/A kit.i_o(),
0N/A kit.reset_memory(),
0N/A kit.frameptr(),
0N/A kit.returnadr());
0N/A // Add zero or 1 return values
0N/A int ret_size = tf()->range()->cnt() - TypeFunc::Parms;
0N/A if (ret_size > 0) {
0N/A kit.inc_sp(-ret_size); // pop the return value(s)
0N/A kit.sync_jvms();
0N/A ret->add_req(kit.argument(0));
0N/A // Note: The second dummy edge is not needed by a ReturnNode.
0N/A }
0N/A // bind it to root
0N/A root()->add_req(ret);
0N/A record_for_igvn(ret);
0N/A initial_gvn()->transform_no_reclaim(ret);
0N/A}
0N/A
0N/A//------------------------rethrow_exceptions-----------------------------------
0N/A// Bind all exception states in the list into a single RethrowNode.
0N/Avoid Compile::rethrow_exceptions(JVMState* jvms) {
0N/A GraphKit kit(jvms);
0N/A if (!kit.has_exceptions()) return; // nothing to generate
0N/A // Load my combined exception state into the kit, with all phis transformed:
0N/A SafePointNode* ex_map = kit.combine_and_pop_all_exception_states();
0N/A Node* ex_oop = kit.use_exception_state(ex_map);
0N/A RethrowNode* exit = new (this, TypeFunc::Parms + 1) RethrowNode(kit.control(),
0N/A kit.i_o(), kit.reset_memory(),
0N/A kit.frameptr(), kit.returnadr(),
0N/A // like a return but with exception input
0N/A ex_oop);
0N/A // bind to root
0N/A root()->add_req(exit);
0N/A record_for_igvn(exit);
0N/A initial_gvn()->transform_no_reclaim(exit);
0N/A}
0N/A
0N/Abool Parse::can_rerun_bytecode() {
0N/A switch (bc()) {
0N/A case Bytecodes::_ldc:
0N/A case Bytecodes::_ldc_w:
0N/A case Bytecodes::_ldc2_w:
0N/A case Bytecodes::_getfield:
0N/A case Bytecodes::_putfield:
0N/A case Bytecodes::_getstatic:
0N/A case Bytecodes::_putstatic:
0N/A case Bytecodes::_arraylength:
0N/A case Bytecodes::_baload:
0N/A case Bytecodes::_caload:
0N/A case Bytecodes::_iaload:
0N/A case Bytecodes::_saload:
0N/A case Bytecodes::_faload:
0N/A case Bytecodes::_aaload:
0N/A case Bytecodes::_laload:
0N/A case Bytecodes::_daload:
0N/A case Bytecodes::_bastore:
0N/A case Bytecodes::_castore:
0N/A case Bytecodes::_iastore:
0N/A case Bytecodes::_sastore:
0N/A case Bytecodes::_fastore:
0N/A case Bytecodes::_aastore:
0N/A case Bytecodes::_lastore:
0N/A case Bytecodes::_dastore:
0N/A case Bytecodes::_irem:
0N/A case Bytecodes::_idiv:
0N/A case Bytecodes::_lrem:
0N/A case Bytecodes::_ldiv:
0N/A case Bytecodes::_frem:
0N/A case Bytecodes::_fdiv:
0N/A case Bytecodes::_drem:
0N/A case Bytecodes::_ddiv:
0N/A case Bytecodes::_checkcast:
0N/A case Bytecodes::_instanceof:
0N/A case Bytecodes::_athrow:
0N/A case Bytecodes::_anewarray:
0N/A case Bytecodes::_newarray:
0N/A case Bytecodes::_multianewarray:
0N/A case Bytecodes::_new:
0N/A case Bytecodes::_monitorenter: // can re-run initial null check, only
0N/A case Bytecodes::_return:
0N/A return true;
0N/A break;
0N/A
0N/A case Bytecodes::_invokestatic:
726N/A case Bytecodes::_invokedynamic:
0N/A case Bytecodes::_invokespecial:
0N/A case Bytecodes::_invokevirtual:
0N/A case Bytecodes::_invokeinterface:
0N/A return false;
0N/A break;
0N/A
0N/A default:
0N/A assert(false, "unexpected bytecode produced an exception");
0N/A return true;
0N/A }
0N/A}
0N/A
0N/A//---------------------------do_exceptions-------------------------------------
0N/A// Process exceptions arising from the current bytecode.
0N/A// Send caught exceptions to the proper handler within this method.
0N/A// Unhandled exceptions feed into _exit.
0N/Avoid Parse::do_exceptions() {
0N/A if (!has_exceptions()) return;
0N/A
0N/A if (failing()) {
0N/A // Pop them all off and throw them away.
0N/A while (pop_exception_state() != NULL) ;
0N/A return;
0N/A }
0N/A
0N/A // Make sure we can classify this bytecode if we need to.
0N/A debug_only(can_rerun_bytecode());
0N/A
0N/A PreserveJVMState pjvms(this, false);
0N/A
0N/A SafePointNode* ex_map;
0N/A while ((ex_map = pop_exception_state()) != NULL) {
0N/A if (!method()->has_exception_handlers()) {
0N/A // Common case: Transfer control outward.
0N/A // Doing it this early allows the exceptions to common up
0N/A // even between adjacent method calls.
0N/A throw_to_exit(ex_map);
0N/A } else {
0N/A // Have to look at the exception first.
0N/A assert(stopped(), "catch_inline_exceptions trashes the map");
0N/A catch_inline_exceptions(ex_map);
0N/A stop_and_kill_map(); // we used up this exception state; kill it
0N/A }
0N/A }
0N/A
0N/A // We now return to our regularly scheduled program:
0N/A}
0N/A
0N/A//---------------------------throw_to_exit-------------------------------------
0N/A// Merge the given map into an exception exit from this method.
0N/A// The exception exit will handle any unlocking of receiver.
0N/A// The ex_oop must be saved within the ex_map, unlike merge_exception.
0N/Avoid Parse::throw_to_exit(SafePointNode* ex_map) {
0N/A // Pop the JVMS to (a copy of) the caller.
0N/A GraphKit caller;
0N/A caller.set_map_clone(_caller->map());
0N/A caller.set_bci(_caller->bci());
0N/A caller.set_sp(_caller->sp());
0N/A // Copy out the standard machine state:
0N/A for (uint i = 0; i < TypeFunc::Parms; i++) {
0N/A caller.map()->set_req(i, ex_map->in(i));
0N/A }
0N/A // ...and the exception:
0N/A Node* ex_oop = saved_ex_oop(ex_map);
0N/A SafePointNode* caller_ex_map = caller.make_exception_state(ex_oop);
0N/A // Finally, collect the new exception state in my exits:
0N/A _exits.add_exception_state(caller_ex_map);
0N/A}
0N/A
0N/A//------------------------------do_exits---------------------------------------
0N/Avoid Parse::do_exits() {
0N/A set_parse_bci(InvocationEntryBci);
0N/A
0N/A // Now peephole on the return bits
0N/A Node* region = _exits.control();
0N/A _exits.set_control(gvn().transform(region));
0N/A
0N/A Node* iophi = _exits.i_o();
0N/A _exits.set_i_o(gvn().transform(iophi));
0N/A
0N/A if (wrote_final()) {
0N/A // This method (which must be a constructor by the rules of Java)
0N/A // wrote a final. The effects of all initializations must be
0N/A // committed to memory before any code after the constructor
0N/A // publishes the reference to the newly constructor object.
0N/A // Rather than wait for the publication, we simply block the
0N/A // writes here. Rather than put a barrier on only those writes
0N/A // which are required to complete, we force all writes to complete.
0N/A //
0N/A // "All bets are off" unless the first publication occurs after a
0N/A // normal return from the constructor. We do not attempt to detect
0N/A // such unusual early publications. But no barrier is needed on
0N/A // exceptional returns, since they cannot publish normally.
0N/A //
0N/A _exits.insert_mem_bar(Op_MemBarRelease);
0N/A#ifndef PRODUCT
0N/A if (PrintOpto && (Verbose || WizardMode)) {
0N/A method()->print_name();
0N/A tty->print_cr(" writes finals and needs a memory barrier");
0N/A }
0N/A#endif
0N/A }
0N/A
0N/A for (MergeMemStream mms(_exits.merged_memory()); mms.next_non_empty(); ) {
0N/A // transform each slice of the original memphi:
0N/A mms.set_memory(_gvn.transform(mms.memory()));
0N/A }
0N/A
0N/A if (tf()->range()->cnt() > TypeFunc::Parms) {
0N/A const Type* ret_type = tf()->range()->field_at(TypeFunc::Parms);
0N/A Node* ret_phi = _gvn.transform( _exits.argument(0) );
0N/A assert(_exits.control()->is_top() || !_gvn.type(ret_phi)->empty(), "return value must be well defined");
0N/A _exits.push_node(ret_type->basic_type(), ret_phi);
0N/A }
0N/A
0N/A // Note: Logic for creating and optimizing the ReturnNode is in Compile.
0N/A
0N/A // Unlock along the exceptional paths.
0N/A // This is done late so that we can common up equivalent exceptions
0N/A // (e.g., null checks) arising from multiple points within this method.
0N/A // See GraphKit::add_exception_state, which performs the commoning.
0N/A bool do_synch = method()->is_synchronized() && GenerateSynchronizationCode;
0N/A
0N/A // record exit from a method if compiled while Dtrace is turned on.
780N/A if (do_synch || C->env()->dtrace_method_probes()) {
0N/A // First move the exception list out of _exits:
0N/A GraphKit kit(_exits.transfer_exceptions_into_jvms());
0N/A SafePointNode* normal_map = kit.map(); // keep this guy safe
0N/A // Now re-collect the exceptions into _exits:
0N/A SafePointNode* ex_map;
0N/A while ((ex_map = kit.pop_exception_state()) != NULL) {
0N/A Node* ex_oop = kit.use_exception_state(ex_map);
0N/A // Force the exiting JVM state to have this method at InvocationEntryBci.
0N/A // The exiting JVM state is otherwise a copy of the calling JVMS.
0N/A JVMState* caller = kit.jvms();
0N/A JVMState* ex_jvms = caller->clone_shallow(C);
0N/A ex_jvms->set_map(kit.clone_map());
0N/A ex_jvms->map()->set_jvms(ex_jvms);
0N/A ex_jvms->set_bci( InvocationEntryBci);
0N/A kit.set_jvms(ex_jvms);
0N/A if (do_synch) {
0N/A // Add on the synchronized-method box/object combo
0N/A kit.map()->push_monitor(_synch_lock);
0N/A // Unlock!
0N/A kit.shared_unlock(_synch_lock->box_node(), _synch_lock->obj_node());
0N/A }
780N/A if (C->env()->dtrace_method_probes()) {
0N/A kit.make_dtrace_method_exit(method());
0N/A }
0N/A // Done with exception-path processing.
0N/A ex_map = kit.make_exception_state(ex_oop);
0N/A assert(ex_jvms->same_calls_as(ex_map->jvms()), "sanity");
0N/A // Pop the last vestige of this method:
0N/A ex_map->set_jvms(caller->clone_shallow(C));
0N/A ex_map->jvms()->set_map(ex_map);
0N/A _exits.push_exception_state(ex_map);
0N/A }
0N/A assert(_exits.map() == normal_map, "keep the same return state");
0N/A }
0N/A
0N/A {
0N/A // Capture very early exceptions (receiver null checks) from caller JVMS
0N/A GraphKit caller(_caller);
0N/A SafePointNode* ex_map;
0N/A while ((ex_map = caller.pop_exception_state()) != NULL) {
0N/A _exits.add_exception_state(ex_map);
0N/A }
0N/A }
0N/A}
0N/A
0N/A//-----------------------------create_entry_map-------------------------------
0N/A// Initialize our parser map to contain the types at method entry.
0N/A// For OSR, the map contains a single RawPtr parameter.
0N/A// Initial monitor locking for sync. methods is performed by do_method_entry.
0N/ASafePointNode* Parse::create_entry_map() {
0N/A // Check for really stupid bail-out cases.
0N/A uint len = TypeFunc::Parms + method()->max_locals() + method()->max_stack();
0N/A if (len >= 32760) {
0N/A C->record_method_not_compilable_all_tiers("too many local variables");
0N/A return NULL;
0N/A }
0N/A
0N/A // If this is an inlined method, we may have to do a receiver null check.
0N/A if (_caller->has_method() && is_normal_parse() && !method()->is_static()) {
0N/A GraphKit kit(_caller);
0N/A kit.null_check_receiver(method());
0N/A _caller = kit.transfer_exceptions_into_jvms();
0N/A if (kit.stopped()) {
0N/A _exits.add_exception_states_from(_caller);
0N/A _exits.set_jvms(_caller);
0N/A return NULL;
0N/A }
0N/A }
0N/A
0N/A assert(method() != NULL, "parser must have a method");
0N/A
0N/A // Create an initial safepoint to hold JVM state during parsing
0N/A JVMState* jvms = new (C) JVMState(method(), _caller->has_method() ? _caller : NULL);
0N/A set_map(new (C, len) SafePointNode(len, jvms));
0N/A jvms->set_map(map());
0N/A record_for_igvn(map());
0N/A assert(jvms->endoff() == len, "correct jvms sizing");
0N/A
0N/A SafePointNode* inmap = _caller->map();
0N/A assert(inmap != NULL, "must have inmap");
0N/A
0N/A uint i;
0N/A
0N/A // Pass thru the predefined input parameters.
0N/A for (i = 0; i < TypeFunc::Parms; i++) {
0N/A map()->init_req(i, inmap->in(i));
0N/A }
0N/A
0N/A if (depth() == 1) {
0N/A assert(map()->memory()->Opcode() == Op_Parm, "");
0N/A // Insert the memory aliasing node
0N/A set_all_memory(reset_memory());
0N/A }
0N/A assert(merged_memory(), "");
0N/A
0N/A // Now add the locals which are initially bound to arguments:
0N/A uint arg_size = tf()->domain()->cnt();
0N/A ensure_stack(arg_size - TypeFunc::Parms); // OSR methods have funny args
0N/A for (i = TypeFunc::Parms; i < arg_size; i++) {
0N/A map()->init_req(i, inmap->argument(_caller, i - TypeFunc::Parms));
0N/A }
0N/A
0N/A // Clear out the rest of the map (locals and stack)
0N/A for (i = arg_size; i < len; i++) {
0N/A map()->init_req(i, top());
0N/A }
0N/A
0N/A SafePointNode* entry_map = stop();
0N/A return entry_map;
0N/A}
0N/A
0N/A//-----------------------------do_method_entry--------------------------------
0N/A// Emit any code needed in the pseudo-block before BCI zero.
0N/A// The main thing to do is lock the receiver of a synchronized method.
0N/Avoid Parse::do_method_entry() {
0N/A set_parse_bci(InvocationEntryBci); // Pseudo-BCP
0N/A set_sp(0); // Java Stack Pointer
0N/A
0N/A NOT_PRODUCT( count_compiled_calls(true/*at_method_entry*/, false/*is_inline*/); )
0N/A
780N/A if (C->env()->dtrace_method_probes()) {
0N/A make_dtrace_method_entry(method());
0N/A }
0N/A
0N/A // If the method is synchronized, we need to construct a lock node, attach
0N/A // it to the Start node, and pin it there.
0N/A if (method()->is_synchronized()) {
0N/A // Insert a FastLockNode right after the Start which takes as arguments
0N/A // the current thread pointer, the "this" pointer & the address of the
0N/A // stack slot pair used for the lock. The "this" pointer is a projection
0N/A // off the start node, but the locking spot has to be constructed by
0N/A // creating a ConLNode of 0, and boxing it with a BoxLockNode. The BoxLockNode
0N/A // becomes the second argument to the FastLockNode call. The
0N/A // FastLockNode becomes the new control parent to pin it to the start.
0N/A
0N/A // Setup Object Pointer
0N/A Node *lock_obj = NULL;
0N/A if(method()->is_static()) {
0N/A ciInstance* mirror = _method->holder()->java_mirror();
0N/A const TypeInstPtr *t_lock = TypeInstPtr::make(mirror);
0N/A lock_obj = makecon(t_lock);
0N/A } else { // Else pass the "this" pointer,
0N/A lock_obj = local(0); // which is Parm0 from StartNode
0N/A }
0N/A // Clear out dead values from the debug info.
0N/A kill_dead_locals();
0N/A // Build the FastLockNode
0N/A _synch_lock = shared_lock(lock_obj);
0N/A }
0N/A
0N/A if (depth() == 1) {
0N/A increment_and_test_invocation_counter(Tier2CompileThreshold);
0N/A }
0N/A}
0N/A
0N/A//------------------------------init_blocks------------------------------------
0N/A// Initialize our parser map to contain the types/monitors at method entry.
0N/Avoid Parse::init_blocks() {
0N/A // Create the blocks.
0N/A _block_count = flow()->block_count();
0N/A _blocks = NEW_RESOURCE_ARRAY(Block, _block_count);
0N/A Copy::zero_to_bytes(_blocks, sizeof(Block)*_block_count);
0N/A
367N/A int rpo;
0N/A
0N/A // Initialize the structs.
367N/A for (rpo = 0; rpo < block_count(); rpo++) {
367N/A Block* block = rpo_at(rpo);
367N/A block->init_node(this, rpo);
0N/A }
0N/A
0N/A // Collect predecessor and successor information.
367N/A for (rpo = 0; rpo < block_count(); rpo++) {
367N/A Block* block = rpo_at(rpo);
0N/A block->init_graph(this);
0N/A }
0N/A}
0N/A
0N/A//-------------------------------init_node-------------------------------------
367N/Avoid Parse::Block::init_node(Parse* outer, int rpo) {
367N/A _flow = outer->flow()->rpo_at(rpo);
0N/A _pred_count = 0;
0N/A _preds_parsed = 0;
0N/A _count = 0;
0N/A assert(pred_count() == 0 && preds_parsed() == 0, "sanity");
0N/A assert(!(is_merged() || is_parsed() || is_handler()), "sanity");
0N/A assert(_live_locals.size() == 0, "sanity");
0N/A
0N/A // entry point has additional predecessor
0N/A if (flow()->is_start()) _pred_count++;
0N/A assert(flow()->is_start() == (this == outer->start_block()), "");
0N/A}
0N/A
0N/A//-------------------------------init_graph------------------------------------
0N/Avoid Parse::Block::init_graph(Parse* outer) {
0N/A // Create the successor list for this parser block.
0N/A GrowableArray<ciTypeFlow::Block*>* tfs = flow()->successors();
0N/A GrowableArray<ciTypeFlow::Block*>* tfe = flow()->exceptions();
0N/A int ns = tfs->length();
0N/A int ne = tfe->length();
0N/A _num_successors = ns;
0N/A _all_successors = ns+ne;
0N/A _successors = (ns+ne == 0) ? NULL : NEW_RESOURCE_ARRAY(Block*, ns+ne);
0N/A int p = 0;
0N/A for (int i = 0; i < ns+ne; i++) {
0N/A ciTypeFlow::Block* tf2 = (i < ns) ? tfs->at(i) : tfe->at(i-ns);
367N/A Block* block2 = outer->rpo_at(tf2->rpo());
0N/A _successors[i] = block2;
0N/A
0N/A // Accumulate pred info for the other block, too.
0N/A if (i < ns) {
0N/A block2->_pred_count++;
0N/A } else {
0N/A block2->_is_handler = true;
0N/A }
0N/A
0N/A #ifdef ASSERT
0N/A // A block's successors must be distinguishable by BCI.
0N/A // That is, no bytecode is allowed to branch to two different
0N/A // clones of the same code location.
0N/A for (int j = 0; j < i; j++) {
0N/A Block* block1 = _successors[j];
0N/A if (block1 == block2) continue; // duplicates are OK
0N/A assert(block1->start() != block2->start(), "successors have unique bcis");
0N/A }
0N/A #endif
0N/A }
0N/A
0N/A // Note: We never call next_path_num along exception paths, so they
0N/A // never get processed as "ready". Also, the input phis of exception
0N/A // handlers get specially processed, so that
0N/A}
0N/A
0N/A//---------------------------successor_for_bci---------------------------------
0N/AParse::Block* Parse::Block::successor_for_bci(int bci) {
0N/A for (int i = 0; i < all_successors(); i++) {
0N/A Block* block2 = successor_at(i);
0N/A if (block2->start() == bci) return block2;
0N/A }
0N/A // We can actually reach here if ciTypeFlow traps out a block
0N/A // due to an unloaded class, and concurrently with compilation the
0N/A // class is then loaded, so that a later phase of the parser is
0N/A // able to see more of the bytecode CFG. Or, the flow pass and
0N/A // the parser can have a minor difference of opinion about executability
0N/A // of bytecodes. For example, "obj.field = null" is executable even
0N/A // if the field's type is an unloaded class; the flow pass used to
0N/A // make a trap for such code.
0N/A return NULL;
0N/A}
0N/A
0N/A
0N/A//-----------------------------stack_type_at-----------------------------------
0N/Aconst Type* Parse::Block::stack_type_at(int i) const {
0N/A return get_type(flow()->stack_type_at(i));
0N/A}
0N/A
0N/A
0N/A//-----------------------------local_type_at-----------------------------------
0N/Aconst Type* Parse::Block::local_type_at(int i) const {
0N/A // Make dead locals fall to bottom.
0N/A if (_live_locals.size() == 0) {
0N/A MethodLivenessResult live_locals = flow()->outer()->method()->liveness_at_bci(start());
0N/A // This bitmap can be zero length if we saw a breakpoint.
0N/A // In such cases, pretend they are all live.
0N/A ((Block*)this)->_live_locals = live_locals;
0N/A }
0N/A if (_live_locals.size() > 0 && !_live_locals.at(i))
0N/A return Type::BOTTOM;
0N/A
0N/A return get_type(flow()->local_type_at(i));
0N/A}
0N/A
0N/A
0N/A#ifndef PRODUCT
0N/A
0N/A//----------------------------name_for_bc--------------------------------------
0N/A// helper method for BytecodeParseHistogram
0N/Astatic const char* name_for_bc(int i) {
0N/A return Bytecodes::is_defined(i) ? Bytecodes::name(Bytecodes::cast(i)) : "xxxunusedxxx";
0N/A}
0N/A
0N/A//----------------------------BytecodeParseHistogram------------------------------------
0N/AParse::BytecodeParseHistogram::BytecodeParseHistogram(Parse *p, Compile *c) {
0N/A _parser = p;
0N/A _compiler = c;
0N/A if( ! _initialized ) { _initialized = true; reset(); }
0N/A}
0N/A
0N/A//----------------------------current_count------------------------------------
0N/Aint Parse::BytecodeParseHistogram::current_count(BPHType bph_type) {
0N/A switch( bph_type ) {
0N/A case BPH_transforms: { return _parser->gvn().made_progress(); }
0N/A case BPH_values: { return _parser->gvn().made_new_values(); }
0N/A default: { ShouldNotReachHere(); return 0; }
0N/A }
0N/A}
0N/A
0N/A//----------------------------initialized--------------------------------------
0N/Abool Parse::BytecodeParseHistogram::initialized() { return _initialized; }
0N/A
0N/A//----------------------------reset--------------------------------------------
0N/Avoid Parse::BytecodeParseHistogram::reset() {
0N/A int i = Bytecodes::number_of_codes;
0N/A while (i-- > 0) { _bytecodes_parsed[i] = 0; _nodes_constructed[i] = 0; _nodes_transformed[i] = 0; _new_values[i] = 0; }
0N/A}
0N/A
0N/A//----------------------------set_initial_state--------------------------------
0N/A// Record info when starting to parse one bytecode
0N/Avoid Parse::BytecodeParseHistogram::set_initial_state( Bytecodes::Code bc ) {
0N/A if( PrintParseStatistics && !_parser->is_osr_parse() ) {
0N/A _initial_bytecode = bc;
0N/A _initial_node_count = _compiler->unique();
0N/A _initial_transforms = current_count(BPH_transforms);
0N/A _initial_values = current_count(BPH_values);
0N/A }
0N/A}
0N/A
0N/A//----------------------------record_change--------------------------------
0N/A// Record results of parsing one bytecode
0N/Avoid Parse::BytecodeParseHistogram::record_change() {
0N/A if( PrintParseStatistics && !_parser->is_osr_parse() ) {
0N/A ++_bytecodes_parsed[_initial_bytecode];
0N/A _nodes_constructed [_initial_bytecode] += (_compiler->unique() - _initial_node_count);
0N/A _nodes_transformed [_initial_bytecode] += (current_count(BPH_transforms) - _initial_transforms);
0N/A _new_values [_initial_bytecode] += (current_count(BPH_values) - _initial_values);
0N/A }
0N/A}
0N/A
0N/A
0N/A//----------------------------print--------------------------------------------
0N/Avoid Parse::BytecodeParseHistogram::print(float cutoff) {
0N/A ResourceMark rm;
0N/A // print profile
0N/A int total = 0;
0N/A int i = 0;
0N/A for( i = 0; i < Bytecodes::number_of_codes; ++i ) { total += _bytecodes_parsed[i]; }
0N/A int abs_sum = 0;
0N/A tty->cr(); //0123456789012345678901234567890123456789012345678901234567890123456789
0N/A tty->print_cr("Histogram of %d parsed bytecodes:", total);
0N/A if( total == 0 ) { return; }
0N/A tty->cr();
0N/A tty->print_cr("absolute: count of compiled bytecodes of this type");
0N/A tty->print_cr("relative: percentage contribution to compiled nodes");
0N/A tty->print_cr("nodes : Average number of nodes constructed per bytecode");
0N/A tty->print_cr("rnodes : Significance towards total nodes constructed, (nodes*relative)");
0N/A tty->print_cr("transforms: Average amount of tranform progress per bytecode compiled");
0N/A tty->print_cr("values : Average number of node values improved per bytecode");
0N/A tty->print_cr("name : Bytecode name");
0N/A tty->cr();
0N/A tty->print_cr(" absolute relative nodes rnodes transforms values name");
0N/A tty->print_cr("----------------------------------------------------------------------");
0N/A while (--i > 0) {
0N/A int abs = _bytecodes_parsed[i];
0N/A float rel = abs * 100.0F / total;
0N/A float nodes = _bytecodes_parsed[i] == 0 ? 0 : (1.0F * _nodes_constructed[i])/_bytecodes_parsed[i];
0N/A float rnodes = _bytecodes_parsed[i] == 0 ? 0 : rel * nodes;
0N/A float xforms = _bytecodes_parsed[i] == 0 ? 0 : (1.0F * _nodes_transformed[i])/_bytecodes_parsed[i];
0N/A float values = _bytecodes_parsed[i] == 0 ? 0 : (1.0F * _new_values [i])/_bytecodes_parsed[i];
0N/A if (cutoff <= rel) {
0N/A tty->print_cr("%10d %7.2f%% %6.1f %6.2f %6.1f %6.1f %s", abs, rel, nodes, rnodes, xforms, values, name_for_bc(i));
0N/A abs_sum += abs;
0N/A }
0N/A }
0N/A tty->print_cr("----------------------------------------------------------------------");
0N/A float rel_sum = abs_sum * 100.0F / total;
0N/A tty->print_cr("%10d %7.2f%% (cutoff = %.2f%%)", abs_sum, rel_sum, cutoff);
0N/A tty->print_cr("----------------------------------------------------------------------");
0N/A tty->cr();
0N/A}
0N/A#endif
0N/A
0N/A//----------------------------load_state_from----------------------------------
0N/A// Load block/map/sp. But not do not touch iter/bci.
0N/Avoid Parse::load_state_from(Block* block) {
0N/A set_block(block);
0N/A // load the block's JVM state:
0N/A set_map(block->start_map());
0N/A set_sp( block->start_sp());
0N/A}
0N/A
0N/A
0N/A//-----------------------------record_state------------------------------------
0N/Avoid Parse::Block::record_state(Parse* p) {
0N/A assert(!is_merged(), "can only record state once, on 1st inflow");
0N/A assert(start_sp() == p->sp(), "stack pointer must agree with ciTypeFlow");
0N/A set_start_map(p->stop());
0N/A}
0N/A
0N/A
0N/A//------------------------------do_one_block-----------------------------------
0N/Avoid Parse::do_one_block() {
0N/A if (TraceOptoParse) {
0N/A Block *b = block();
0N/A int ns = b->num_successors();
0N/A int nt = b->all_successors();
0N/A
0N/A tty->print("Parsing block #%d at bci [%d,%d), successors: ",
367N/A block()->rpo(), block()->start(), block()->limit());
0N/A for (int i = 0; i < nt; i++) {
367N/A tty->print((( i < ns) ? " %d" : " %d(e)"), b->successor_at(i)->rpo());
0N/A }
367N/A if (b->is_loop_head()) tty->print(" lphd");
0N/A tty->print_cr("");
0N/A }
0N/A
0N/A assert(block()->is_merged(), "must be merged before being parsed");
0N/A block()->mark_parsed();
0N/A ++_blocks_parsed;
0N/A
0N/A // Set iterator to start of block.
0N/A iter().reset_to_bci(block()->start());
0N/A
0N/A CompileLog* log = C->log();
0N/A
0N/A // Parse bytecodes
0N/A while (!stopped() && !failing()) {
0N/A iter().next();
0N/A
0N/A // Learn the current bci from the iterator:
0N/A set_parse_bci(iter().cur_bci());
0N/A
0N/A if (bci() == block()->limit()) {
0N/A // Do not walk into the next block until directed by do_all_blocks.
0N/A merge(bci());
0N/A break;
0N/A }
0N/A assert(bci() < block()->limit(), "bci still in block");
0N/A
0N/A if (log != NULL) {
0N/A // Output an optional context marker, to help place actions
0N/A // that occur during parsing of this BC. If there is no log
0N/A // output until the next context string, this context string
0N/A // will be silently ignored.
0N/A log->context()->reset();
0N/A log->context()->print_cr("<bc code='%d' bci='%d'/>", (int)bc(), bci());
0N/A }
0N/A
0N/A if (block()->has_trap_at(bci())) {
0N/A // We must respect the flow pass's traps, because it will refuse
0N/A // to produce successors for trapping blocks.
0N/A int trap_index = block()->flow()->trap_index();
0N/A assert(trap_index != 0, "trap index must be valid");
0N/A uncommon_trap(trap_index);
0N/A break;
0N/A }
0N/A
0N/A NOT_PRODUCT( parse_histogram()->set_initial_state(bc()); );
0N/A
0N/A#ifdef ASSERT
0N/A int pre_bc_sp = sp();
0N/A int inputs, depth;
0N/A bool have_se = !stopped() && compute_stack_effects(inputs, depth);
0N/A assert(!have_se || pre_bc_sp >= inputs, "have enough stack to execute this BC");
0N/A#endif //ASSERT
0N/A
0N/A do_one_bytecode();
0N/A
0N/A assert(!have_se || stopped() || failing() || (sp() - pre_bc_sp) == depth, "correct depth prediction");
0N/A
0N/A do_exceptions();
0N/A
0N/A NOT_PRODUCT( parse_histogram()->record_change(); );
0N/A
0N/A if (log != NULL) log->context()->reset(); // done w/ this one
0N/A
0N/A // Fall into next bytecode. Each bytecode normally has 1 sequential
0N/A // successor which is typically made ready by visiting this bytecode.
0N/A // If the successor has several predecessors, then it is a merge
0N/A // point, starts a new basic block, and is handled like other basic blocks.
0N/A }
0N/A}
0N/A
0N/A
0N/A//------------------------------merge------------------------------------------
0N/Avoid Parse::set_parse_bci(int bci) {
0N/A set_bci(bci);
0N/A Node_Notes* nn = C->default_node_notes();
0N/A if (nn == NULL) return;
0N/A
0N/A // Collect debug info for inlined calls unless -XX:-DebugInlinedCalls.
0N/A if (!DebugInlinedCalls && depth() > 1) {
0N/A return;
0N/A }
0N/A
0N/A // Update the JVMS annotation, if present.
0N/A JVMState* jvms = nn->jvms();
0N/A if (jvms != NULL && jvms->bci() != bci) {
0N/A // Update the JVMS.
0N/A jvms = jvms->clone_shallow(C);
0N/A jvms->set_bci(bci);
0N/A nn->set_jvms(jvms);
0N/A }
0N/A}
0N/A
0N/A//------------------------------merge------------------------------------------
0N/A// Merge the current mapping into the basic block starting at bci
0N/Avoid Parse::merge(int target_bci) {
0N/A Block* target = successor_for_bci(target_bci);
0N/A if (target == NULL) { handle_missing_successor(target_bci); return; }
0N/A assert(!target->is_ready(), "our arrival must be expected");
0N/A int pnum = target->next_path_num();
0N/A merge_common(target, pnum);
0N/A}
0N/A
0N/A//-------------------------merge_new_path--------------------------------------
0N/A// Merge the current mapping into the basic block, using a new path
0N/Avoid Parse::merge_new_path(int target_bci) {
0N/A Block* target = successor_for_bci(target_bci);
0N/A if (target == NULL) { handle_missing_successor(target_bci); return; }
0N/A assert(!target->is_ready(), "new path into frozen graph");
0N/A int pnum = target->add_new_path();
0N/A merge_common(target, pnum);
0N/A}
0N/A
0N/A//-------------------------merge_exception-------------------------------------
0N/A// Merge the current mapping into the basic block starting at bci
0N/A// The ex_oop must be pushed on the stack, unlike throw_to_exit.
0N/Avoid Parse::merge_exception(int target_bci) {
0N/A assert(sp() == 1, "must have only the throw exception on the stack");
0N/A Block* target = successor_for_bci(target_bci);
0N/A if (target == NULL) { handle_missing_successor(target_bci); return; }
0N/A assert(target->is_handler(), "exceptions are handled by special blocks");
0N/A int pnum = target->add_new_path();
0N/A merge_common(target, pnum);
0N/A}
0N/A
0N/A//--------------------handle_missing_successor---------------------------------
0N/Avoid Parse::handle_missing_successor(int target_bci) {
0N/A#ifndef PRODUCT
0N/A Block* b = block();
0N/A int trap_bci = b->flow()->has_trap()? b->flow()->trap_bci(): -1;
367N/A tty->print_cr("### Missing successor at bci:%d for block #%d (trap_bci:%d)", target_bci, b->rpo(), trap_bci);
0N/A#endif
0N/A ShouldNotReachHere();
0N/A}
0N/A
0N/A//--------------------------merge_common---------------------------------------
0N/Avoid Parse::merge_common(Parse::Block* target, int pnum) {
0N/A if (TraceOptoParse) {
367N/A tty->print("Merging state at block #%d bci:%d", target->rpo(), target->start());
0N/A }
0N/A
0N/A // Zap extra stack slots to top
0N/A assert(sp() == target->start_sp(), "");
0N/A clean_stack(sp());
0N/A
0N/A if (!target->is_merged()) { // No prior mapping at this bci
0N/A if (TraceOptoParse) { tty->print(" with empty state"); }
0N/A
0N/A // If this path is dead, do not bother capturing it as a merge.
0N/A // It is "as if" we had 1 fewer predecessors from the beginning.
0N/A if (stopped()) {
0N/A if (TraceOptoParse) tty->print_cr(", but path is dead and doesn't count");
0N/A return;
0N/A }
0N/A
0N/A // Record that a new block has been merged.
0N/A ++_blocks_merged;
0N/A
0N/A // Make a region if we know there are multiple or unpredictable inputs.
0N/A // (Also, if this is a plain fall-through, we might see another region,
0N/A // which must not be allowed into this block's map.)
0N/A if (pnum > PhiNode::Input // Known multiple inputs.
0N/A || target->is_handler() // These have unpredictable inputs.
367N/A || target->is_loop_head() // Known multiple inputs
0N/A || control()->is_Region()) { // We must hide this guy.
0N/A // Add a Region to start the new basic block. Phis will be added
0N/A // later lazily.
0N/A int edges = target->pred_count();
0N/A if (edges < pnum) edges = pnum; // might be a new path!
0N/A Node *r = new (C, edges+1) RegionNode(edges+1);
0N/A gvn().set_type(r, Type::CONTROL);
0N/A record_for_igvn(r);
0N/A // zap all inputs to NULL for debugging (done in Node(uint) constructor)
0N/A // for (int j = 1; j < edges+1; j++) { r->init_req(j, NULL); }
0N/A r->init_req(pnum, control());
0N/A set_control(r);
0N/A }
0N/A
0N/A // Convert the existing Parser mapping into a mapping at this bci.
0N/A store_state_to(target);
0N/A assert(target->is_merged(), "do not come here twice");
0N/A
0N/A } else { // Prior mapping at this bci
0N/A if (TraceOptoParse) { tty->print(" with previous state"); }
0N/A
0N/A // We must not manufacture more phis if the target is already parsed.
0N/A bool nophi = target->is_parsed();
0N/A
0N/A SafePointNode* newin = map();// Hang on to incoming mapping
0N/A Block* save_block = block(); // Hang on to incoming block;
0N/A load_state_from(target); // Get prior mapping
0N/A
0N/A assert(newin->jvms()->locoff() == jvms()->locoff(), "JVMS layouts agree");
0N/A assert(newin->jvms()->stkoff() == jvms()->stkoff(), "JVMS layouts agree");
0N/A assert(newin->jvms()->monoff() == jvms()->monoff(), "JVMS layouts agree");
0N/A assert(newin->jvms()->endoff() == jvms()->endoff(), "JVMS layouts agree");
0N/A
0N/A // Iterate over my current mapping and the old mapping.
0N/A // Where different, insert Phi functions.
0N/A // Use any existing Phi functions.
0N/A assert(control()->is_Region(), "must be merging to a region");
0N/A RegionNode* r = control()->as_Region();
0N/A
0N/A // Compute where to merge into
0N/A // Merge incoming control path
367N/A r->init_req(pnum, newin->control());
0N/A
0N/A if (pnum == 1) { // Last merge for this Region?
367N/A if (!block()->flow()->is_irreducible_entry()) {
367N/A Node* result = _gvn.transform_no_reclaim(r);
367N/A if (r != result && TraceOptoParse) {
367N/A tty->print_cr("Block #%d replace %d with %d", block()->rpo(), r->_idx, result->_idx);
367N/A }
367N/A }
0N/A record_for_igvn(r);
0N/A }
0N/A
0N/A // Update all the non-control inputs to map:
0N/A assert(TypeFunc::Parms == newin->jvms()->locoff(), "parser map should contain only youngest jvms");
367N/A bool check_elide_phi = target->is_SEL_backedge(save_block);
0N/A for (uint j = 1; j < newin->req(); j++) {
0N/A Node* m = map()->in(j); // Current state of target.
0N/A Node* n = newin->in(j); // Incoming change to target state.
0N/A PhiNode* phi;
0N/A if (m->is_Phi() && m->as_Phi()->region() == r)
0N/A phi = m->as_Phi();
0N/A else
0N/A phi = NULL;
0N/A if (m != n) { // Different; must merge
0N/A switch (j) {
0N/A // Frame pointer and Return Address never changes
0N/A case TypeFunc::FramePtr:// Drop m, use the original value
0N/A case TypeFunc::ReturnAdr:
0N/A break;
0N/A case TypeFunc::Memory: // Merge inputs to the MergeMem node
0N/A assert(phi == NULL, "the merge contains phis, not vice versa");
0N/A merge_memory_edges(n->as_MergeMem(), pnum, nophi);
0N/A continue;
0N/A default: // All normal stuff
367N/A if (phi == NULL) {
367N/A if (!check_elide_phi || !target->can_elide_SEL_phi(j)) {
367N/A phi = ensure_phi(j, nophi);
367N/A }
367N/A }
0N/A break;
0N/A }
0N/A }
0N/A // At this point, n might be top if:
0N/A // - there is no phi (because TypeFlow detected a conflict), or
0N/A // - the corresponding control edges is top (a dead incoming path)
0N/A // It is a bug if we create a phi which sees a garbage value on a live path.
0N/A
0N/A if (phi != NULL) {
0N/A assert(n != top() || r->in(pnum) == top(), "live value must not be garbage");
0N/A assert(phi->region() == r, "");
0N/A phi->set_req(pnum, n); // Then add 'n' to the merge
0N/A if (pnum == PhiNode::Input) {
0N/A // Last merge for this Phi.
0N/A // So far, Phis have had a reasonable type from ciTypeFlow.
0N/A // Now _gvn will join that with the meet of current inputs.
0N/A // BOTTOM is never permissible here, 'cause pessimistically
0N/A // Phis of pointers cannot lose the basic pointer type.
0N/A debug_only(const Type* bt1 = phi->bottom_type());
0N/A assert(bt1 != Type::BOTTOM, "should not be building conflict phis");
0N/A map()->set_req(j, _gvn.transform_no_reclaim(phi));
0N/A debug_only(const Type* bt2 = phi->bottom_type());
0N/A assert(bt2->higher_equal(bt1), "must be consistent with type-flow");
0N/A record_for_igvn(phi);
0N/A }
0N/A }
0N/A } // End of for all values to be merged
0N/A
0N/A if (pnum == PhiNode::Input &&
0N/A !r->in(0)) { // The occasional useless Region
0N/A assert(control() == r, "");
0N/A set_control(r->nonnull_req());
0N/A }
0N/A
0N/A // newin has been subsumed into the lazy merge, and is now dead.
0N/A set_block(save_block);
0N/A
0N/A stop(); // done with this guy, for now
0N/A }
0N/A
0N/A if (TraceOptoParse) {
0N/A tty->print_cr(" on path %d", pnum);
0N/A }
0N/A
0N/A // Done with this parser state.
0N/A assert(stopped(), "");
0N/A}
0N/A
0N/A
0N/A//--------------------------merge_memory_edges---------------------------------
0N/Avoid Parse::merge_memory_edges(MergeMemNode* n, int pnum, bool nophi) {
0N/A // (nophi means we must not create phis, because we already parsed here)
0N/A assert(n != NULL, "");
0N/A // Merge the inputs to the MergeMems
0N/A MergeMemNode* m = merged_memory();
0N/A
0N/A assert(control()->is_Region(), "must be merging to a region");
0N/A RegionNode* r = control()->as_Region();
0N/A
0N/A PhiNode* base = NULL;
0N/A MergeMemNode* remerge = NULL;
0N/A for (MergeMemStream mms(m, n); mms.next_non_empty2(); ) {
0N/A Node *p = mms.force_memory();
0N/A Node *q = mms.memory2();
0N/A if (mms.is_empty() && nophi) {
0N/A // Trouble: No new splits allowed after a loop body is parsed.
0N/A // Instead, wire the new split into a MergeMem on the backedge.
0N/A // The optimizer will sort it out, slicing the phi.
0N/A if (remerge == NULL) {
0N/A assert(base != NULL, "");
0N/A assert(base->in(0) != NULL, "should not be xformed away");
0N/A remerge = MergeMemNode::make(C, base->in(pnum));
0N/A gvn().set_type(remerge, Type::MEMORY);
0N/A base->set_req(pnum, remerge);
0N/A }
0N/A remerge->set_memory_at(mms.alias_idx(), q);
0N/A continue;
0N/A }
0N/A assert(!q->is_MergeMem(), "");
0N/A PhiNode* phi;
0N/A if (p != q) {
0N/A phi = ensure_memory_phi(mms.alias_idx(), nophi);
0N/A } else {
0N/A if (p->is_Phi() && p->as_Phi()->region() == r)
0N/A phi = p->as_Phi();
0N/A else
0N/A phi = NULL;
0N/A }
0N/A // Insert q into local phi
0N/A if (phi != NULL) {
0N/A assert(phi->region() == r, "");
0N/A p = phi;
0N/A phi->set_req(pnum, q);
0N/A if (mms.at_base_memory()) {
0N/A base = phi; // delay transforming it
0N/A } else if (pnum == 1) {
0N/A record_for_igvn(phi);
0N/A p = _gvn.transform_no_reclaim(phi);
0N/A }
0N/A mms.set_memory(p);// store back through the iterator
0N/A }
0N/A }
0N/A // Transform base last, in case we must fiddle with remerging.
0N/A if (base != NULL && pnum == 1) {
0N/A record_for_igvn(base);
0N/A m->set_base_memory( _gvn.transform_no_reclaim(base) );
0N/A }
0N/A}
0N/A
0N/A
0N/A//------------------------ensure_phis_everywhere-------------------------------
0N/Avoid Parse::ensure_phis_everywhere() {
0N/A ensure_phi(TypeFunc::I_O);
0N/A
0N/A // Ensure a phi on all currently known memories.
0N/A for (MergeMemStream mms(merged_memory()); mms.next_non_empty(); ) {
0N/A ensure_memory_phi(mms.alias_idx());
0N/A debug_only(mms.set_memory()); // keep the iterator happy
0N/A }
0N/A
0N/A // Note: This is our only chance to create phis for memory slices.
0N/A // If we miss a slice that crops up later, it will have to be
0N/A // merged into the base-memory phi that we are building here.
0N/A // Later, the optimizer will comb out the knot, and build separate
0N/A // phi-loops for each memory slice that matters.
0N/A
0N/A // Monitors must nest nicely and not get confused amongst themselves.
0N/A // Phi-ify everything up to the monitors, though.
0N/A uint monoff = map()->jvms()->monoff();
0N/A uint nof_monitors = map()->jvms()->nof_monitors();
0N/A
0N/A assert(TypeFunc::Parms == map()->jvms()->locoff(), "parser map should contain only youngest jvms");
367N/A bool check_elide_phi = block()->is_SEL_head();
0N/A for (uint i = TypeFunc::Parms; i < monoff; i++) {
367N/A if (!check_elide_phi || !block()->can_elide_SEL_phi(i)) {
367N/A ensure_phi(i);
367N/A }
0N/A }
367N/A
0N/A // Even monitors need Phis, though they are well-structured.
0N/A // This is true for OSR methods, and also for the rare cases where
0N/A // a monitor object is the subject of a replace_in_map operation.
0N/A // See bugs 4426707 and 5043395.
0N/A for (uint m = 0; m < nof_monitors; m++) {
0N/A ensure_phi(map()->jvms()->monitor_obj_offset(m));
0N/A }
0N/A}
0N/A
0N/A
0N/A//-----------------------------add_new_path------------------------------------
0N/A// Add a previously unaccounted predecessor to this block.
0N/Aint Parse::Block::add_new_path() {
0N/A // If there is no map, return the lowest unused path number.
0N/A if (!is_merged()) return pred_count()+1; // there will be a map shortly
0N/A
0N/A SafePointNode* map = start_map();
0N/A if (!map->control()->is_Region())
0N/A return pred_count()+1; // there may be a region some day
0N/A RegionNode* r = map->control()->as_Region();
0N/A
0N/A // Add new path to the region.
0N/A uint pnum = r->req();
0N/A r->add_req(NULL);
0N/A
0N/A for (uint i = 1; i < map->req(); i++) {
0N/A Node* n = map->in(i);
0N/A if (i == TypeFunc::Memory) {
0N/A // Ensure a phi on all currently known memories.
0N/A for (MergeMemStream mms(n->as_MergeMem()); mms.next_non_empty(); ) {
0N/A Node* phi = mms.memory();
0N/A if (phi->is_Phi() && phi->as_Phi()->region() == r) {
0N/A assert(phi->req() == pnum, "must be same size as region");
0N/A phi->add_req(NULL);
0N/A }
0N/A }
0N/A } else {
0N/A if (n->is_Phi() && n->as_Phi()->region() == r) {
0N/A assert(n->req() == pnum, "must be same size as region");
0N/A n->add_req(NULL);
0N/A }
0N/A }
0N/A }
0N/A
0N/A return pnum;
0N/A}
0N/A
0N/A//------------------------------ensure_phi-------------------------------------
0N/A// Turn the idx'th entry of the current map into a Phi
0N/APhiNode *Parse::ensure_phi(int idx, bool nocreate) {
0N/A SafePointNode* map = this->map();
0N/A Node* region = map->control();
0N/A assert(region->is_Region(), "");
0N/A
0N/A Node* o = map->in(idx);
0N/A assert(o != NULL, "");
0N/A
0N/A if (o == top()) return NULL; // TOP always merges into TOP
0N/A
0N/A if (o->is_Phi() && o->as_Phi()->region() == region) {
0N/A return o->as_Phi();
0N/A }
0N/A
0N/A // Now use a Phi here for merging
0N/A assert(!nocreate, "Cannot build a phi for a block already parsed.");
0N/A const JVMState* jvms = map->jvms();
0N/A const Type* t;
0N/A if (jvms->is_loc(idx)) {
0N/A t = block()->local_type_at(idx - jvms->locoff());
0N/A } else if (jvms->is_stk(idx)) {
0N/A t = block()->stack_type_at(idx - jvms->stkoff());
0N/A } else if (jvms->is_mon(idx)) {
0N/A assert(!jvms->is_monitor_box(idx), "no phis for boxes");
0N/A t = TypeInstPtr::BOTTOM; // this is sufficient for a lock object
0N/A } else if ((uint)idx < TypeFunc::Parms) {
0N/A t = o->bottom_type(); // Type::RETURN_ADDRESS or such-like.
0N/A } else {
0N/A assert(false, "no type information for this phi");
0N/A }
0N/A
0N/A // If the type falls to bottom, then this must be a local that
0N/A // is mixing ints and oops or some such. Forcing it to top
0N/A // makes it go dead.
0N/A if (t == Type::BOTTOM) {
0N/A map->set_req(idx, top());
0N/A return NULL;
0N/A }
0N/A
0N/A // Do not create phis for top either.
0N/A // A top on a non-null control flow must be an unused even after the.phi.
0N/A if (t == Type::TOP || t == Type::HALF) {
0N/A map->set_req(idx, top());
0N/A return NULL;
0N/A }
0N/A
0N/A PhiNode* phi = PhiNode::make(region, o, t);
0N/A gvn().set_type(phi, t);
38N/A if (C->do_escape_analysis()) record_for_igvn(phi);
0N/A map->set_req(idx, phi);
0N/A return phi;
0N/A}
0N/A
0N/A//--------------------------ensure_memory_phi----------------------------------
0N/A// Turn the idx'th slice of the current memory into a Phi
0N/APhiNode *Parse::ensure_memory_phi(int idx, bool nocreate) {
0N/A MergeMemNode* mem = merged_memory();
0N/A Node* region = control();
0N/A assert(region->is_Region(), "");
0N/A
0N/A Node *o = (idx == Compile::AliasIdxBot)? mem->base_memory(): mem->memory_at(idx);
0N/A assert(o != NULL && o != top(), "");
0N/A
0N/A PhiNode* phi;
0N/A if (o->is_Phi() && o->as_Phi()->region() == region) {
0N/A phi = o->as_Phi();
0N/A if (phi == mem->base_memory() && idx >= Compile::AliasIdxRaw) {
0N/A // clone the shared base memory phi to make a new memory split
0N/A assert(!nocreate, "Cannot build a phi for a block already parsed.");
0N/A const Type* t = phi->bottom_type();
0N/A const TypePtr* adr_type = C->get_adr_type(idx);
0N/A phi = phi->slice_memory(adr_type);
0N/A gvn().set_type(phi, t);
0N/A }
0N/A return phi;
0N/A }
0N/A
0N/A // Now use a Phi here for merging
0N/A assert(!nocreate, "Cannot build a phi for a block already parsed.");
0N/A const Type* t = o->bottom_type();
0N/A const TypePtr* adr_type = C->get_adr_type(idx);
0N/A phi = PhiNode::make(region, o, t, adr_type);
0N/A gvn().set_type(phi, t);
0N/A if (idx == Compile::AliasIdxBot)
0N/A mem->set_base_memory(phi);
0N/A else
0N/A mem->set_memory_at(idx, phi);
0N/A return phi;
0N/A}
0N/A
0N/A//------------------------------call_register_finalizer-----------------------
0N/A// Check the klass of the receiver and call register_finalizer if the
0N/A// class need finalization.
0N/Avoid Parse::call_register_finalizer() {
0N/A Node* receiver = local(0);
0N/A assert(receiver != NULL && receiver->bottom_type()->isa_instptr() != NULL,
0N/A "must have non-null instance type");
0N/A
0N/A const TypeInstPtr *tinst = receiver->bottom_type()->isa_instptr();
0N/A if (tinst != NULL && tinst->klass()->is_loaded() && !tinst->klass_is_exact()) {
0N/A // The type isn't known exactly so see if CHA tells us anything.
0N/A ciInstanceKlass* ik = tinst->klass()->as_instance_klass();
0N/A if (!Dependencies::has_finalizable_subclass(ik)) {
0N/A // No finalizable subclasses so skip the dynamic check.
0N/A C->dependencies()->assert_has_no_finalizable_subclasses(ik);
0N/A return;
0N/A }
0N/A }
0N/A
0N/A // Insert a dynamic test for whether the instance needs
0N/A // finalization. In general this will fold up since the concrete
0N/A // class is often visible so the access flags are constant.
0N/A Node* klass_addr = basic_plus_adr( receiver, receiver, oopDesc::klass_offset_in_bytes() );
164N/A Node* klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), klass_addr, TypeInstPtr::KLASS) );
0N/A
0N/A Node* access_flags_addr = basic_plus_adr(klass, klass, Klass::access_flags_offset_in_bytes() + sizeof(oopDesc));
0N/A Node* access_flags = make_load(NULL, access_flags_addr, TypeInt::INT, T_INT);
0N/A
0N/A Node* mask = _gvn.transform(new (C, 3) AndINode(access_flags, intcon(JVM_ACC_HAS_FINALIZER)));
0N/A Node* check = _gvn.transform(new (C, 3) CmpINode(mask, intcon(0)));
0N/A Node* test = _gvn.transform(new (C, 2) BoolNode(check, BoolTest::ne));
0N/A
0N/A IfNode* iff = create_and_map_if(control(), test, PROB_MAX, COUNT_UNKNOWN);
0N/A
0N/A RegionNode* result_rgn = new (C, 3) RegionNode(3);
0N/A record_for_igvn(result_rgn);
0N/A
0N/A Node *skip_register = _gvn.transform(new (C, 1) IfFalseNode(iff));
0N/A result_rgn->init_req(1, skip_register);
0N/A
0N/A Node *needs_register = _gvn.transform(new (C, 1) IfTrueNode(iff));
0N/A set_control(needs_register);
0N/A if (stopped()) {
0N/A // There is no slow path.
0N/A result_rgn->init_req(2, top());
0N/A } else {
0N/A Node *call = make_runtime_call(RC_NO_LEAF,
0N/A OptoRuntime::register_finalizer_Type(),
0N/A OptoRuntime::register_finalizer_Java(),
0N/A NULL, TypePtr::BOTTOM,
0N/A receiver);
0N/A make_slow_call_ex(call, env()->Throwable_klass(), true);
0N/A
0N/A Node* fast_io = call->in(TypeFunc::I_O);
0N/A Node* fast_mem = call->in(TypeFunc::Memory);
0N/A // These two phis are pre-filled with copies of of the fast IO and Memory
0N/A Node* io_phi = PhiNode::make(result_rgn, fast_io, Type::ABIO);
0N/A Node* mem_phi = PhiNode::make(result_rgn, fast_mem, Type::MEMORY, TypePtr::BOTTOM);
0N/A
0N/A result_rgn->init_req(2, control());
0N/A io_phi ->init_req(2, i_o());
0N/A mem_phi ->init_req(2, reset_memory());
0N/A
0N/A set_all_memory( _gvn.transform(mem_phi) );
0N/A set_i_o( _gvn.transform(io_phi) );
0N/A }
0N/A
0N/A set_control( _gvn.transform(result_rgn) );
0N/A}
0N/A
0N/A//------------------------------return_current---------------------------------
0N/A// Append current _map to _exit_return
0N/Avoid Parse::return_current(Node* value) {
0N/A if (RegisterFinalizersAtInit &&
0N/A method()->intrinsic_id() == vmIntrinsics::_Object_init) {
0N/A call_register_finalizer();
0N/A }
0N/A
0N/A // Do not set_parse_bci, so that return goo is credited to the return insn.
0N/A set_bci(InvocationEntryBci);
0N/A if (method()->is_synchronized() && GenerateSynchronizationCode) {
0N/A shared_unlock(_synch_lock->box_node(), _synch_lock->obj_node());
0N/A }
780N/A if (C->env()->dtrace_method_probes()) {
0N/A make_dtrace_method_exit(method());
0N/A }
0N/A SafePointNode* exit_return = _exits.map();
0N/A exit_return->in( TypeFunc::Control )->add_req( control() );
0N/A exit_return->in( TypeFunc::I_O )->add_req( i_o () );
0N/A Node *mem = exit_return->in( TypeFunc::Memory );
0N/A for (MergeMemStream mms(mem->as_MergeMem(), merged_memory()); mms.next_non_empty2(); ) {
0N/A if (mms.is_empty()) {
0N/A // get a copy of the base memory, and patch just this one input
0N/A const TypePtr* adr_type = mms.adr_type(C);
0N/A Node* phi = mms.force_memory()->as_Phi()->slice_memory(adr_type);
0N/A assert(phi->as_Phi()->region() == mms.base_memory()->in(0), "");
0N/A gvn().set_type_bottom(phi);
0N/A phi->del_req(phi->req()-1); // prepare to re-patch
0N/A mms.set_memory(phi);
0N/A }
0N/A mms.memory()->add_req(mms.memory2());
0N/A }
0N/A
0N/A // frame pointer is always same, already captured
0N/A if (value != NULL) {
0N/A // If returning oops to an interface-return, there is a silent free
0N/A // cast from oop to interface allowed by the Verifier. Make it explicit
0N/A // here.
0N/A Node* phi = _exits.argument(0);
0N/A const TypeInstPtr *tr = phi->bottom_type()->isa_instptr();
0N/A if( tr && tr->klass()->is_loaded() &&
0N/A tr->klass()->is_interface() ) {
0N/A const TypeInstPtr *tp = value->bottom_type()->isa_instptr();
0N/A if (tp && tp->klass()->is_loaded() &&
0N/A !tp->klass()->is_interface()) {
0N/A // sharpen the type eagerly; this eases certain assert checking
0N/A if (tp->higher_equal(TypeInstPtr::NOTNULL))
0N/A tr = tr->join(TypeInstPtr::NOTNULL)->is_instptr();
0N/A value = _gvn.transform(new (C, 2) CheckCastPPNode(0,value,tr));
0N/A }
0N/A }
0N/A phi->add_req(value);
0N/A }
0N/A
0N/A stop_and_kill_map(); // This CFG path dies here
0N/A}
0N/A
0N/A
0N/A//------------------------------add_safepoint----------------------------------
0N/Avoid Parse::add_safepoint() {
0N/A // See if we can avoid this safepoint. No need for a SafePoint immediately
0N/A // after a Call (except Leaf Call) or another SafePoint.
0N/A Node *proj = control();
0N/A bool add_poll_param = SafePointNode::needs_polling_address_input();
0N/A uint parms = add_poll_param ? TypeFunc::Parms+1 : TypeFunc::Parms;
0N/A if( proj->is_Proj() ) {
0N/A Node *n0 = proj->in(0);
0N/A if( n0->is_Catch() ) {
0N/A n0 = n0->in(0)->in(0);
0N/A assert( n0->is_Call(), "expect a call here" );
0N/A }
0N/A if( n0->is_Call() ) {
0N/A if( n0->as_Call()->guaranteed_safepoint() )
0N/A return;
0N/A } else if( n0->is_SafePoint() && n0->req() >= parms ) {
0N/A return;
0N/A }
0N/A }
0N/A
0N/A // Clear out dead values from the debug info.
0N/A kill_dead_locals();
0N/A
0N/A // Clone the JVM State
0N/A SafePointNode *sfpnt = new (C, parms) SafePointNode(parms, NULL);
0N/A
0N/A // Capture memory state BEFORE a SafePoint. Since we can block at a
0N/A // SafePoint we need our GC state to be safe; i.e. we need all our current
0N/A // write barriers (card marks) to not float down after the SafePoint so we
0N/A // must read raw memory. Likewise we need all oop stores to match the card
0N/A // marks. If deopt can happen, we need ALL stores (we need the correct JVM
0N/A // state on a deopt).
0N/A
0N/A // We do not need to WRITE the memory state after a SafePoint. The control
0N/A // edge will keep card-marks and oop-stores from floating up from below a
0N/A // SafePoint and our true dependency added here will keep them from floating
0N/A // down below a SafePoint.
0N/A
0N/A // Clone the current memory state
0N/A Node* mem = MergeMemNode::make(C, map()->memory());
0N/A
0N/A mem = _gvn.transform(mem);
0N/A
0N/A // Pass control through the safepoint
0N/A sfpnt->init_req(TypeFunc::Control , control());
0N/A // Fix edges normally used by a call
0N/A sfpnt->init_req(TypeFunc::I_O , top() );
0N/A sfpnt->init_req(TypeFunc::Memory , mem );
0N/A sfpnt->init_req(TypeFunc::ReturnAdr, top() );
0N/A sfpnt->init_req(TypeFunc::FramePtr , top() );
0N/A
0N/A // Create a node for the polling address
0N/A if( add_poll_param ) {
0N/A Node *polladr = ConPNode::make(C, (address)os::get_polling_page());
0N/A sfpnt->init_req(TypeFunc::Parms+0, _gvn.transform(polladr));
0N/A }
0N/A
0N/A // Fix up the JVM State edges
0N/A add_safepoint_edges(sfpnt);
0N/A Node *transformed_sfpnt = _gvn.transform(sfpnt);
0N/A set_control(transformed_sfpnt);
0N/A
0N/A // Provide an edge from root to safepoint. This makes the safepoint
0N/A // appear useful until the parse has completed.
0N/A if( OptoRemoveUseless && transformed_sfpnt->is_SafePoint() ) {
0N/A assert(C->root() != NULL, "Expect parse is still valid");
0N/A C->root()->add_prec(transformed_sfpnt);
0N/A }
0N/A}
0N/A
0N/A#ifndef PRODUCT
0N/A//------------------------show_parse_info--------------------------------------
0N/Avoid Parse::show_parse_info() {
0N/A InlineTree* ilt = NULL;
0N/A if (C->ilt() != NULL) {
0N/A JVMState* caller_jvms = is_osr_parse() ? caller()->caller() : caller();
0N/A ilt = InlineTree::find_subtree_from_root(C->ilt(), caller_jvms, method());
0N/A }
0N/A if (PrintCompilation && Verbose) {
0N/A if (depth() == 1) {
0N/A if( ilt->count_inlines() ) {
0N/A tty->print(" __inlined %d (%d bytes)", ilt->count_inlines(),
0N/A ilt->count_inline_bcs());
0N/A tty->cr();
0N/A }
0N/A } else {
0N/A if (method()->is_synchronized()) tty->print("s");
0N/A if (method()->has_exception_handlers()) tty->print("!");
0N/A // Check this is not the final compiled version
0N/A if (C->trap_can_recompile()) {
0N/A tty->print("-");
0N/A } else {
0N/A tty->print(" ");
0N/A }
0N/A method()->print_short_name();
0N/A if (is_osr_parse()) {
0N/A tty->print(" @ %d", osr_bci());
0N/A }
0N/A tty->print(" (%d bytes)",method()->code_size());
0N/A if (ilt->count_inlines()) {
0N/A tty->print(" __inlined %d (%d bytes)", ilt->count_inlines(),
0N/A ilt->count_inline_bcs());
0N/A }
0N/A tty->cr();
0N/A }
0N/A }
0N/A if (PrintOpto && (depth() == 1 || PrintOptoInlining)) {
0N/A // Print that we succeeded; suppress this message on the first osr parse.
0N/A
0N/A if (method()->is_synchronized()) tty->print("s");
0N/A if (method()->has_exception_handlers()) tty->print("!");
0N/A // Check this is not the final compiled version
0N/A if (C->trap_can_recompile() && depth() == 1) {
0N/A tty->print("-");
0N/A } else {
0N/A tty->print(" ");
0N/A }
0N/A if( depth() != 1 ) { tty->print(" "); } // missing compile count
0N/A for (int i = 1; i < depth(); ++i) { tty->print(" "); }
0N/A method()->print_short_name();
0N/A if (is_osr_parse()) {
0N/A tty->print(" @ %d", osr_bci());
0N/A }
0N/A if (ilt->caller_bci() != -1) {
0N/A tty->print(" @ %d", ilt->caller_bci());
0N/A }
0N/A tty->print(" (%d bytes)",method()->code_size());
0N/A if (ilt->count_inlines()) {
0N/A tty->print(" __inlined %d (%d bytes)", ilt->count_inlines(),
0N/A ilt->count_inline_bcs());
0N/A }
0N/A tty->cr();
0N/A }
0N/A}
0N/A
0N/A
0N/A//------------------------------dump-------------------------------------------
0N/A// Dump information associated with the bytecodes of current _method
0N/Avoid Parse::dump() {
0N/A if( method() != NULL ) {
0N/A // Iterate over bytecodes
0N/A ciBytecodeStream iter(method());
0N/A for( Bytecodes::Code bc = iter.next(); bc != ciBytecodeStream::EOBC() ; bc = iter.next() ) {
0N/A dump_bci( iter.cur_bci() );
0N/A tty->cr();
0N/A }
0N/A }
0N/A}
0N/A
0N/A// Dump information associated with a byte code index, 'bci'
0N/Avoid Parse::dump_bci(int bci) {
0N/A // Output info on merge-points, cloning, and within _jsr..._ret
0N/A // NYI
0N/A tty->print(" bci:%d", bci);
0N/A}
0N/A
0N/A#endif