src/share/vm/opto/output.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/opto/output.cpp

src/share/vm/opto/output.cpp

Print this page

        

*** 114,129 **** _cfg->map_node_to_block(epilog, block); } } } - # ifdef ENABLE_ZAP_DEAD_LOCALS - if (ZapDeadCompiledLocals) { - Insert_zap_nodes(); - } - # endif - uint* blk_starts = NEW_RESOURCE_ARRAY(uint, _cfg->number_of_blocks() + 1); blk_starts[0] = 0; // Initialize code buffer and process short branches. CodeBuffer* cb = init_buffer(blk_starts); --- 114,123 ----
*** 182,298 **** // and memory stacks (ie. IA64). // Bang if the method is not a stub function and has java calls return (stub_function() == NULL && has_java_calls()); } - # ifdef ENABLE_ZAP_DEAD_LOCALS - - - // In order to catch compiler oop-map bugs, we have implemented - // a debugging mode called ZapDeadCompilerLocals. - // This mode causes the compiler to insert a call to a runtime routine, - // "zap_dead_locals", right before each place in compiled code - // that could potentially be a gc-point (i.e., a safepoint or oop map point). - // The runtime routine checks that locations mapped as oops are really - // oops, that locations mapped as values do not look like oops, - // and that locations mapped as dead are not used later - // (by zapping them to an invalid address). - - int Compile::_CompiledZap_count = 0; - - void Compile::Insert_zap_nodes() { - bool skip = false; - - - // Dink with static counts because code code without the extra - // runtime calls is MUCH faster for debugging purposes - - if ( CompileZapFirst == 0 ) ; // nothing special - else if ( CompileZapFirst > CompiledZap_count() ) skip = true; - else if ( CompileZapFirst == CompiledZap_count() ) - warning("starting zap compilation after skipping"); - - if ( CompileZapLast == -1 ) ; // nothing special - else if ( CompileZapLast < CompiledZap_count() ) skip = true; - else if ( CompileZapLast == CompiledZap_count() ) - warning("about to compile last zap"); - - ++_CompiledZap_count; // counts skipped zaps, too - - if ( skip ) return; - - - if ( _method == NULL ) - return; // no safepoints/oopmaps emitted for calls in stubs,so we don't care - - // Insert call to zap runtime stub before every node with an oop map - for( uint i=0; i<_cfg->number_of_blocks(); i++ ) { - Block *b = _cfg->get_block(i); - for ( uint j = 0; j < b->number_of_nodes(); ++j ) { - Node *n = b->get_node(j); - - // Determining if we should insert a zap-a-lot node in output. - // We do that for all nodes that has oopmap info, except for calls - // to allocation. Calls to allocation passes in the old top-of-eden pointer - // and expect the C code to reset it. Hence, there can be no safepoints between - // the inlined-allocation and the call to new_Java, etc. - // We also cannot zap monitor calls, as they must hold the microlock - // during the call to Zap, which also wants to grab the microlock. - bool insert = n->is_MachSafePoint() && (n->as_MachSafePoint()->oop_map() != NULL); - if ( insert ) { // it is MachSafePoint - if ( !n->is_MachCall() ) { - insert = false; - } else if ( n->is_MachCall() ) { - MachCallNode* call = n->as_MachCall(); - if (call->entry_point() == OptoRuntime::new_instance_Java() || - call->entry_point() == OptoRuntime::new_array_Java() || - call->entry_point() == OptoRuntime::multianewarray2_Java() || - call->entry_point() == OptoRuntime::multianewarray3_Java() || - call->entry_point() == OptoRuntime::multianewarray4_Java() || - call->entry_point() == OptoRuntime::multianewarray5_Java() || - call->entry_point() == OptoRuntime::slow_arraycopy_Java() || - call->entry_point() == OptoRuntime::complete_monitor_locking_Java() - ) { - insert = false; - } - } - if (insert) { - Node *zap = call_zap_node(n->as_MachSafePoint(), i); - b->insert_node(zap, j); - _cfg->map_node_to_block(zap, b); - ++j; - } - } - } - } - } - - - Node* Compile::call_zap_node(MachSafePointNode* node_to_check, int block_no) { - const TypeFunc *tf = OptoRuntime::zap_dead_locals_Type(); - CallStaticJavaNode* ideal_node = - new CallStaticJavaNode( tf, - OptoRuntime::zap_dead_locals_stub(_method->flags().is_native()), - "call zap dead locals stub", 0, TypePtr::BOTTOM); - // We need to copy the OopMap from the site we're zapping at. - // We have to make a copy, because the zap site might not be - // a call site, and zap_dead is a call site. - OopMap* clone = node_to_check->oop_map()->deep_copy(); - - // Add the cloned OopMap to the zap node - ideal_node->set_oop_map(clone); - return _matcher->match_sfpt(ideal_node); - } - - bool Compile::is_node_getting_a_safepoint( Node* n) { - // This code duplicates the logic prior to the call of add_safepoint - // below in this file. - if( n->is_MachSafePoint() ) return true; - return false; - } - - # endif // ENABLE_ZAP_DEAD_LOCALS // Compute the size of first NumberOfLoopInstrToAlign instructions at the top // of a loop. When aligning a loop we need to provide enough instructions // in cpu's fetch buffer to feed decoders. The loop alignment could be // avoided if we have enough instructions in fetch buffer at the head of a loop. --- 176,185 ----
*** 832,845 **** // Handle special safepoint nodes for synchronization MachSafePointNode *sfn = mach->as_MachSafePoint(); MachCallNode *mcall; - #ifdef ENABLE_ZAP_DEAD_LOCALS - assert( is_node_getting_a_safepoint(mach), "logic does not match; false negative"); - #endif - int safepoint_pc_offset = current_offset; bool is_method_handle_invoke = false; bool return_oop = false; // Add the safepoint in the DebugInfoRecorder --- 719,728 ----
*** 1292,1305 **** // If this starts a new instruction group, then flush the current one // (but allow split bundles) if (Pipeline::requires_bundling() && starts_bundle(n)) cb->flush_bundle(false); - // The following logic is duplicated in the code ifdeffed for - // ENABLE_ZAP_DEAD_LOCALS which appears above in this file. It - // should be factored out. Or maybe dispersed to the nodes? - // Special handling for SafePoint/Call Nodes bool is_mcall = false; if (n->is_Mach()) { MachNode *mach = n->as_Mach(); is_mcall = n->is_MachCall(); --- 1175,1184 ----
*** 1362,1374 **** if (!is_mcall) { MachSafePointNode *sfn = mach->as_MachSafePoint(); // !!!!! Stubs only need an oopmap right now, so bail out if (sfn->jvms()->method() == NULL) { // Write the oopmap directly to the code blob??!! - # ifdef ENABLE_ZAP_DEAD_LOCALS - assert( !is_node_getting_a_safepoint(sfn), "logic does not match; false positive"); - # endif continue; } } // End synchronization non_safepoints.observe_safepoint(mach->as_MachSafePoint()->jvms(), --- 1241,1250 ----
*** 1552,1564 **** if (delay_slot->is_MachSafePoint()) { MachNode *mach = delay_slot->as_Mach(); // !!!!! Stubs only need an oopmap right now, so bail out if (!mach->is_MachCall() && mach->as_MachSafePoint()->jvms()->method() == NULL) { // Write the oopmap directly to the code blob??!! - # ifdef ENABLE_ZAP_DEAD_LOCALS - assert( !is_node_getting_a_safepoint(mach), "logic does not match; false positive"); - # endif delay_slot = NULL; continue; } int adjusted_offset = current_offset - Pipeline::instr_unit_size(); --- 1428,1437 ----
src/share/vm/opto/output.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File