comparison src/share/vm/opto/output.cpp @ 415:4d9884b01ba6

6754519: don't emit flag fixup for NaN when condition being tested doesn't need it Reviewed-by: kvn, rasbold
author never
date Tue, 28 Oct 2008 09:31:30 -0700
parents cecd8eb4e0ca
children 72c5366e5d86
comparison
equal deleted inserted replaced
407:ebfd4ae89bf6 415:4d9884b01ba6
330 // ------------------ 330 // ------------------
331 // Compute size of each block, method size, and relocation information size 331 // Compute size of each block, method size, and relocation information size
332 uint *jmp_end = NEW_RESOURCE_ARRAY(uint,_cfg->_num_blocks); 332 uint *jmp_end = NEW_RESOURCE_ARRAY(uint,_cfg->_num_blocks);
333 uint *blk_starts = NEW_RESOURCE_ARRAY(uint,_cfg->_num_blocks+1); 333 uint *blk_starts = NEW_RESOURCE_ARRAY(uint,_cfg->_num_blocks+1);
334 DEBUG_ONLY( uint *jmp_target = NEW_RESOURCE_ARRAY(uint,_cfg->_num_blocks); ) 334 DEBUG_ONLY( uint *jmp_target = NEW_RESOURCE_ARRAY(uint,_cfg->_num_blocks); )
335 DEBUG_ONLY( uint *jmp_rule = NEW_RESOURCE_ARRAY(uint,_cfg->_num_blocks); )
335 blk_starts[0] = 0; 336 blk_starts[0] = 0;
336 337
337 // Initialize the sizes to 0 338 // Initialize the sizes to 0
338 code_size = 0; // Size in bytes of generated code 339 code_size = 0; // Size in bytes of generated code
339 stub_size = 0; // Size in bytes of all stub entries 340 stub_size = 0; // Size in bytes of all stub entries
441 // This requires the TRUE branch target be in succs[0] 442 // This requires the TRUE branch target be in succs[0]
442 uint bnum = b->non_connector_successor(0)->_pre_order; 443 uint bnum = b->non_connector_successor(0)->_pre_order;
443 uintptr_t target = blk_starts[bnum]; 444 uintptr_t target = blk_starts[bnum];
444 if( mach->is_pc_relative() ) { 445 if( mach->is_pc_relative() ) {
445 int offset = target-(blk_starts[i] + jmp_end[i]); 446 int offset = target-(blk_starts[i] + jmp_end[i]);
446 if (_matcher->is_short_branch_offset(offset)) { 447 if (_matcher->is_short_branch_offset(mach->rule(), offset)) {
447 // We've got a winner. Replace this branch. 448 // We've got a winner. Replace this branch.
448 MachNode *replacement = mach->short_branch_version(this); 449 MachNode* replacement = mach->short_branch_version(this);
449 b->_nodes.map(j, replacement); 450 b->_nodes.map(j, replacement);
450 mach->subsume_by(replacement); 451 mach->subsume_by(replacement);
451 452
452 // Update the jmp_end size to save time in our 453 // Update the jmp_end size to save time in our
453 // next pass. 454 // next pass.
454 jmp_end[i] -= (mach->size(_regalloc) - replacement->size(_regalloc)); 455 jmp_end[i] -= (mach->size(_regalloc) - replacement->size(_regalloc));
455 DEBUG_ONLY( jmp_target[i] = bnum; ); 456 DEBUG_ONLY( jmp_target[i] = bnum; );
457 DEBUG_ONLY( jmp_rule[i] = mach->rule(); );
456 } 458 }
457 } else { 459 } else {
458 #ifndef PRODUCT 460 #ifndef PRODUCT
459 mach->dump(3); 461 mach->dump(3);
460 #endif 462 #endif
522 524
523 #ifdef ASSERT 525 #ifdef ASSERT
524 for( i=0; i<_cfg->_num_blocks; i++ ) { // For all blocks 526 for( i=0; i<_cfg->_num_blocks; i++ ) { // For all blocks
525 if( jmp_target[i] != 0 ) { 527 if( jmp_target[i] != 0 ) {
526 int offset = blk_starts[jmp_target[i]]-(blk_starts[i] + jmp_end[i]); 528 int offset = blk_starts[jmp_target[i]]-(blk_starts[i] + jmp_end[i]);
527 if (!_matcher->is_short_branch_offset(offset)) { 529 if (!_matcher->is_short_branch_offset(jmp_rule[i], offset)) {
528 tty->print_cr("target (%d) - jmp_end(%d) = offset (%d), jmp_block B%d, target_block B%d", blk_starts[jmp_target[i]], blk_starts[i] + jmp_end[i], offset, i, jmp_target[i]); 530 tty->print_cr("target (%d) - jmp_end(%d) = offset (%d), jmp_block B%d, target_block B%d", blk_starts[jmp_target[i]], blk_starts[i] + jmp_end[i], offset, i, jmp_target[i]);
529 } 531 }
530 assert(_matcher->is_short_branch_offset(offset), "Displacement too large for short jmp"); 532 assert(_matcher->is_short_branch_offset(jmp_rule[i], offset), "Displacement too large for short jmp");
531 } 533 }
532 } 534 }
533 #endif 535 #endif
534 536
535 // ------------------ 537 // ------------------
1067 blk_labels[i].init(); 1069 blk_labels[i].init();
1068 } 1070 }
1069 1071
1070 // If this machine supports different size branch offsets, then pre-compute 1072 // If this machine supports different size branch offsets, then pre-compute
1071 // the length of the blocks 1073 // the length of the blocks
1072 if( _matcher->is_short_branch_offset(0) ) { 1074 if( _matcher->is_short_branch_offset(-1, 0) ) {
1073 Shorten_branches(blk_labels, code_req, locs_req, stub_req, const_req); 1075 Shorten_branches(blk_labels, code_req, locs_req, stub_req, const_req);
1074 labels_not_set = false; 1076 labels_not_set = false;
1075 } 1077 }
1076 1078
1077 // nmethod and CodeBuffer count stubs & constants as part of method's code. 1079 // nmethod and CodeBuffer count stubs & constants as part of method's code.