30 #include "opto/loopnode.hpp" 31 #include "opto/machnode.hpp" 32 #include "opto/matcher.hpp" 33 #include "opto/node.hpp" 34 #include "opto/opcodes.hpp" 35 #include "opto/regmask.hpp" 36 #include "opto/type.hpp" 37 #include "utilities/copy.hpp" 38 39 class RegMask; 40 // #include "phase.hpp" 41 class PhaseTransform; 42 class PhaseGVN; 43 44 // Arena we are currently building Nodes in 45 const uint Node::NotAMachineReg = 0xffff0000; 46 47 #ifndef PRODUCT 48 extern int nodes_created; 49 #endif 50 51 #ifdef ASSERT 52 53 //-------------------------- construct_node------------------------------------ 54 // Set a breakpoint here to identify where a particular node index is built. 55 void Node::verify_construction() { 56 _debug_orig = NULL; 57 int old_debug_idx = Compile::debug_idx(); 58 int new_debug_idx = old_debug_idx+1; 59 if (new_debug_idx > 0) { 60 // Arrange that the lowest five decimal digits of _debug_idx 61 // will repeat those of _idx. In case this is somehow pathological, 62 // we continue to assign negative numbers (!) consecutively. 63 const int mod = 100000; 64 int bump = (int)(_idx - new_debug_idx) % mod; 65 if (bump < 0) bump += mod; 66 assert(bump >= 0 && bump < mod, ""); 67 new_debug_idx += bump; 68 } 69 Compile::set_debug_idx(new_debug_idx); 439 debug_only( verify_construction() ); 440 NOT_PRODUCT(nodes_created++); 441 // Assert we allocated space for input array already 442 assert( _in[6] == this, "Must pass arg count to 'new'" ); 443 assert( is_not_dead(n0), "can not use dead node"); 444 assert( is_not_dead(n1), "can not use dead node"); 445 assert( is_not_dead(n2), "can not use dead node"); 446 assert( is_not_dead(n3), "can not use dead node"); 447 assert( is_not_dead(n4), "can not use dead node"); 448 assert( is_not_dead(n5), "can not use dead node"); 449 assert( is_not_dead(n6), "can not use dead node"); 450 _in[0] = n0; if (n0 != NULL) n0->add_out((Node *)this); 451 _in[1] = n1; if (n1 != NULL) n1->add_out((Node *)this); 452 _in[2] = n2; if (n2 != NULL) n2->add_out((Node *)this); 453 _in[3] = n3; if (n3 != NULL) n3->add_out((Node *)this); 454 _in[4] = n4; if (n4 != NULL) n4->add_out((Node *)this); 455 _in[5] = n5; if (n5 != NULL) n5->add_out((Node *)this); 456 _in[6] = n6; if (n6 != NULL) n6->add_out((Node *)this); 457 } 458 459 460 //------------------------------clone------------------------------------------ 461 // Clone a Node. 462 Node *Node::clone() const { 463 Compile* C = Compile::current(); 464 uint s = size_of(); // Size of inherited Node 465 Node *n = (Node*)C->node_arena()->Amalloc_D(size_of() + _max*sizeof(Node*)); 466 Copy::conjoint_words_to_lower((HeapWord*)this, (HeapWord*)n, s); 467 // Set the new input pointer array 468 n->_in = (Node**)(((char*)n)+s); 469 // Cannot share the old output pointer array, so kill it 470 n->_out = NO_OUT_ARRAY; 471 // And reset the counters to 0 472 n->_outcnt = 0; 473 n->_outmax = 0; 474 // Unlock this guy, since he is not in any hash table. 475 debug_only(n->_hash_lock = 0); 476 // Walk the old node's input list to duplicate its edges 477 uint i; 478 for( i = 0; i < len(); i++ ) { | 30 #include "opto/loopnode.hpp" 31 #include "opto/machnode.hpp" 32 #include "opto/matcher.hpp" 33 #include "opto/node.hpp" 34 #include "opto/opcodes.hpp" 35 #include "opto/regmask.hpp" 36 #include "opto/type.hpp" 37 #include "utilities/copy.hpp" 38 39 class RegMask; 40 // #include "phase.hpp" 41 class PhaseTransform; 42 class PhaseGVN; 43 44 // Arena we are currently building Nodes in 45 const uint Node::NotAMachineReg = 0xffff0000; 46 47 #ifndef PRODUCT 48 extern int nodes_created; 49 #endif 50 #ifdef __clang__ 51 #pragma clang diagnostic push 52 #pragma GCC diagnostic ignored "-Wuninitialized" 53 #endif 54 55 #ifdef ASSERT 56 57 //-------------------------- construct_node------------------------------------ 58 // Set a breakpoint here to identify where a particular node index is built. 59 void Node::verify_construction() { 60 _debug_orig = NULL; 61 int old_debug_idx = Compile::debug_idx(); 62 int new_debug_idx = old_debug_idx+1; 63 if (new_debug_idx > 0) { 64 // Arrange that the lowest five decimal digits of _debug_idx 65 // will repeat those of _idx. In case this is somehow pathological, 66 // we continue to assign negative numbers (!) consecutively. 67 const int mod = 100000; 68 int bump = (int)(_idx - new_debug_idx) % mod; 69 if (bump < 0) bump += mod; 70 assert(bump >= 0 && bump < mod, ""); 71 new_debug_idx += bump; 72 } 73 Compile::set_debug_idx(new_debug_idx); 443 debug_only( verify_construction() ); 444 NOT_PRODUCT(nodes_created++); 445 // Assert we allocated space for input array already 446 assert( _in[6] == this, "Must pass arg count to 'new'" ); 447 assert( is_not_dead(n0), "can not use dead node"); 448 assert( is_not_dead(n1), "can not use dead node"); 449 assert( is_not_dead(n2), "can not use dead node"); 450 assert( is_not_dead(n3), "can not use dead node"); 451 assert( is_not_dead(n4), "can not use dead node"); 452 assert( is_not_dead(n5), "can not use dead node"); 453 assert( is_not_dead(n6), "can not use dead node"); 454 _in[0] = n0; if (n0 != NULL) n0->add_out((Node *)this); 455 _in[1] = n1; if (n1 != NULL) n1->add_out((Node *)this); 456 _in[2] = n2; if (n2 != NULL) n2->add_out((Node *)this); 457 _in[3] = n3; if (n3 != NULL) n3->add_out((Node *)this); 458 _in[4] = n4; if (n4 != NULL) n4->add_out((Node *)this); 459 _in[5] = n5; if (n5 != NULL) n5->add_out((Node *)this); 460 _in[6] = n6; if (n6 != NULL) n6->add_out((Node *)this); 461 } 462 463 #ifdef __clang__ 464 #pragma clang diagnostic pop 465 #endif 466 467 468 //------------------------------clone------------------------------------------ 469 // Clone a Node. 470 Node *Node::clone() const { 471 Compile* C = Compile::current(); 472 uint s = size_of(); // Size of inherited Node 473 Node *n = (Node*)C->node_arena()->Amalloc_D(size_of() + _max*sizeof(Node*)); 474 Copy::conjoint_words_to_lower((HeapWord*)this, (HeapWord*)n, s); 475 // Set the new input pointer array 476 n->_in = (Node**)(((char*)n)+s); 477 // Cannot share the old output pointer array, so kill it 478 n->_out = NO_OUT_ARRAY; 479 // And reset the counters to 0 480 n->_outcnt = 0; 481 n->_outmax = 0; 482 // Unlock this guy, since he is not in any hash table. 483 debug_only(n->_hash_lock = 0); 484 // Walk the old node's input list to duplicate its edges 485 uint i; 486 for( i = 0; i < len(); i++ ) { |