comparison src/share/vm/opto/buildOopMap.cpp @ 839:bb18957ad21e

Merge
author ysr
date Fri, 10 Jul 2009 16:01:20 -0700
parents acba6af809c8
children bd02caa94611
comparison
equal deleted inserted replaced
838:0316eac49d5a 839:bb18957ad21e
72 // or NULL if dead/conflict 72 // or NULL if dead/conflict
73 // OopFlow structs, when not being actively modified, describe the _end_ of 73 // OopFlow structs, when not being actively modified, describe the _end_ of
74 // this block. 74 // this block.
75 Block *_b; // Block for this struct 75 Block *_b; // Block for this struct
76 OopFlow *_next; // Next free OopFlow 76 OopFlow *_next; // Next free OopFlow
77 77 // or NULL if dead/conflict
78 OopFlow( short *callees, Node **defs ) : _callees(callees), _defs(defs), 78 Compile* C;
79 _b(NULL), _next(NULL) { } 79
80 OopFlow( short *callees, Node **defs, Compile* c ) : _callees(callees), _defs(defs),
81 _b(NULL), _next(NULL), C(c) { }
80 82
81 // Given reaching-defs for this block start, compute it for this block end 83 // Given reaching-defs for this block start, compute it for this block end
82 void compute_reach( PhaseRegAlloc *regalloc, int max_reg, Dict *safehash ); 84 void compute_reach( PhaseRegAlloc *regalloc, int max_reg, Dict *safehash );
83 85
84 // Merge these two OopFlows into the 'this' pointer. 86 // Merge these two OopFlows into the 'this' pointer.
86 88
87 // Copy a 'flow' over an existing flow 89 // Copy a 'flow' over an existing flow
88 void clone( OopFlow *flow, int max_size); 90 void clone( OopFlow *flow, int max_size);
89 91
90 // Make a new OopFlow from scratch 92 // Make a new OopFlow from scratch
91 static OopFlow *make( Arena *A, int max_size ); 93 static OopFlow *make( Arena *A, int max_size, Compile* C );
92 94
93 // Build an oopmap from the current flow info 95 // Build an oopmap from the current flow info
94 OopMap *build_oop_map( Node *n, int max_reg, PhaseRegAlloc *regalloc, int* live ); 96 OopMap *build_oop_map( Node *n, int max_reg, PhaseRegAlloc *regalloc, int* live );
95 }; 97 };
96 98
178 memcpy( _callees, flow->_callees, sizeof(short)*max_size); 180 memcpy( _callees, flow->_callees, sizeof(short)*max_size);
179 memcpy( _defs , flow->_defs , sizeof(Node*)*max_size); 181 memcpy( _defs , flow->_defs , sizeof(Node*)*max_size);
180 } 182 }
181 183
182 //------------------------------make------------------------------------------- 184 //------------------------------make-------------------------------------------
183 OopFlow *OopFlow::make( Arena *A, int max_size ) { 185 OopFlow *OopFlow::make( Arena *A, int max_size, Compile* C ) {
184 short *callees = NEW_ARENA_ARRAY(A,short,max_size+1); 186 short *callees = NEW_ARENA_ARRAY(A,short,max_size+1);
185 Node **defs = NEW_ARENA_ARRAY(A,Node*,max_size+1); 187 Node **defs = NEW_ARENA_ARRAY(A,Node*,max_size+1);
186 debug_only( memset(defs,0,(max_size+1)*sizeof(Node*)) ); 188 debug_only( memset(defs,0,(max_size+1)*sizeof(Node*)) );
187 OopFlow *flow = new (A) OopFlow(callees+1, defs+1); 189 OopFlow *flow = new (A) OopFlow(callees+1, defs+1, C);
188 assert( &flow->_callees[OptoReg::Bad] == callees, "Ok to index at OptoReg::Bad" ); 190 assert( &flow->_callees[OptoReg::Bad] == callees, "Ok to index at OptoReg::Bad" );
189 assert( &flow->_defs [OptoReg::Bad] == defs , "Ok to index at OptoReg::Bad" ); 191 assert( &flow->_defs [OptoReg::Bad] == defs , "Ok to index at OptoReg::Bad" );
190 return flow; 192 return flow;
191 } 193 }
192 194
286 int idx = m->is_Copy(); 288 int idx = m->is_Copy();
287 if( !idx ) break; 289 if( !idx ) break;
288 m = m->in(idx); 290 m = m->in(idx);
289 } 291 }
290 } 292 }
291 guarantee( 0, "must find derived/base pair" ); 293 guarantee( 0, "must find derived/base pair" );
292 } 294 }
293 found: ; 295 found: ;
294 Node *base = n->in(i+1); // Base is other half of pair 296 Node *base = n->in(i+1); // Base is other half of pair
295 int breg = regalloc->get_reg_first(base); 297 int breg = regalloc->get_reg_first(base);
296 VMReg b = OptoReg::as_VMReg(OptoReg::Name(breg), framesize, max_inarg_slot); 298 VMReg b = OptoReg::as_VMReg(OptoReg::Name(breg), framesize, max_inarg_slot);
345 } 347 }
346 348
347 } else { 349 } else {
348 // Other - some reaching non-oop value 350 // Other - some reaching non-oop value
349 omap->set_value( r); 351 omap->set_value( r);
352 #ifdef ASSERT
353 if( t->isa_rawptr() && C->cfg()->_raw_oops.member(def) ) {
354 def->dump();
355 n->dump();
356 assert(false, "there should be a oop in OopMap instead of a live raw oop at safepoint");
357 }
358 #endif
350 } 359 }
351 360
352 } 361 }
353 362
354 #ifdef ASSERT 363 #ifdef ASSERT
560 memset( flows, 0, _cfg->_num_blocks*sizeof(OopFlow*) ); 569 memset( flows, 0, _cfg->_num_blocks*sizeof(OopFlow*) );
561 570
562 571
563 // Do the first block 'by hand' to prime the worklist 572 // Do the first block 'by hand' to prime the worklist
564 Block *entry = _cfg->_blocks[1]; 573 Block *entry = _cfg->_blocks[1];
565 OopFlow *rootflow = OopFlow::make(A,max_reg); 574 OopFlow *rootflow = OopFlow::make(A,max_reg,this);
566 // Initialize to 'bottom' (not 'top') 575 // Initialize to 'bottom' (not 'top')
567 memset( rootflow->_callees, OptoReg::Bad, max_reg*sizeof(short) ); 576 memset( rootflow->_callees, OptoReg::Bad, max_reg*sizeof(short) );
568 memset( rootflow->_defs , 0, max_reg*sizeof(Node*) ); 577 memset( rootflow->_defs , 0, max_reg*sizeof(Node*) );
569 flows[entry->_pre_order] = rootflow; 578 flows[entry->_pre_order] = rootflow;
570 579
626 if( flow ) { 635 if( flow ) {
627 // We have an OopFlow that's the last-use of a predecessor. 636 // We have an OopFlow that's the last-use of a predecessor.
628 // Carry it forward. 637 // Carry it forward.
629 } else { // Draw a new OopFlow from the freelist 638 } else { // Draw a new OopFlow from the freelist
630 if( !free_list ) 639 if( !free_list )
631 free_list = OopFlow::make(A,max_reg); 640 free_list = OopFlow::make(A,max_reg,C);
632 flow = free_list; 641 flow = free_list;
633 assert( flow->_b == NULL, "oopFlow is not free" ); 642 assert( flow->_b == NULL, "oopFlow is not free" );
634 free_list = flow->_next; 643 free_list = flow->_next;
635 flow->_next = NULL; 644 flow->_next = NULL;
636 645