312 // Use ideal type if it is oop ptr.
313 const TypePtr *tp = oper->type()->isa_ptr();
314 if( tp != NULL) {
315 adr_type = tp;
316 }
317 }
318 }
319
320 }
321 return base;
322 }
323
324
325 //---------------------------------adr_type---------------------------------
326 const class TypePtr *MachNode::adr_type() const {
327 intptr_t offset = 0;
328 const TypePtr *adr_type = TYPE_PTR_SENTINAL; // attempt computing adr_type
329 Node *base = get_base_and_disp(offset, adr_type);
330
331 if( adr_type != TYPE_PTR_SENTINAL ) {
332 return ShenandoahBarrierNode::fix_addp_type(adr_type, base); // get_base_and_disp has the answer
333 }
334
335 // Direct addressing modes have no base node, simply an indirect
336 // offset, which is always to raw memory.
337 // %%%%% Someday we'd like to allow constant oop offsets which
338 // would let Intel load from static globals in 1 instruction.
339 // Currently Intel requires 2 instructions and a register temp.
340 if (base == NULL) {
341 // NULL base, zero offset means no memory at all (a null pointer!)
342 if (offset == 0) {
343 return NULL;
344 }
345 // NULL base, any offset means any pointer whatever
346 if (offset == Type::OffsetBot) {
347 return TypePtr::BOTTOM;
348 }
349 // %%% make offset be intptr_t
350 assert(!Universe::heap()->is_in_reserved(cast_to_oop(offset)), "must be a raw ptr");
351 return TypeRawPtr::BOTTOM;
352 }
364 t = t->make_ptr();
365 }
366 if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) {
367 // We cannot assert that the offset does not look oop-ish here.
368 // Depending on the heap layout the cardmark base could land
369 // inside some oopish region. It definitely does for Win2K.
370 // The sum of cardmark-base plus shift-by-9-oop lands outside
371 // the oop-ish area but we can't assert for that statically.
372 return TypeRawPtr::BOTTOM;
373 }
374
375 const TypePtr *tp = t->isa_ptr();
376
377 // be conservative if we do not recognize the type
378 if (tp == NULL) {
379 assert(false, "this path may produce not optimal code");
380 return TypePtr::BOTTOM;
381 }
382 assert(tp->base() != Type::AnyPtr, "not a bare pointer");
383
384 return ShenandoahBarrierNode::fix_addp_type(tp->add_offset(offset), base);
385 }
386
387
388 //-----------------------------operand_index---------------------------------
389 int MachNode::operand_index( uint operand ) const {
390 if( operand < 1 ) return -1;
391 assert(operand < num_opnds(), "oob");
392 if( _opnds[operand]->num_edges() == 0 ) return -1;
393
394 uint skipped = oper_input_base(); // Sum of leaves skipped so far
395 for (uint opcnt = 1; opcnt < operand; opcnt++) {
396 uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand
397 skipped += num_edges;
398 }
399 return skipped;
400 }
401
402 int MachNode::operand_index(const MachOper *oper) const {
403 uint skipped = oper_input_base(); // Sum of leaves skipped so far
404 uint opcnt;
|
312 // Use ideal type if it is oop ptr.
313 const TypePtr *tp = oper->type()->isa_ptr();
314 if( tp != NULL) {
315 adr_type = tp;
316 }
317 }
318 }
319
320 }
321 return base;
322 }
323
324
325 //---------------------------------adr_type---------------------------------
326 const class TypePtr *MachNode::adr_type() const {
327 intptr_t offset = 0;
328 const TypePtr *adr_type = TYPE_PTR_SENTINAL; // attempt computing adr_type
329 Node *base = get_base_and_disp(offset, adr_type);
330
331 if( adr_type != TYPE_PTR_SENTINAL ) {
332 return adr_type; // get_base_and_disp has the answer
333 }
334
335 // Direct addressing modes have no base node, simply an indirect
336 // offset, which is always to raw memory.
337 // %%%%% Someday we'd like to allow constant oop offsets which
338 // would let Intel load from static globals in 1 instruction.
339 // Currently Intel requires 2 instructions and a register temp.
340 if (base == NULL) {
341 // NULL base, zero offset means no memory at all (a null pointer!)
342 if (offset == 0) {
343 return NULL;
344 }
345 // NULL base, any offset means any pointer whatever
346 if (offset == Type::OffsetBot) {
347 return TypePtr::BOTTOM;
348 }
349 // %%% make offset be intptr_t
350 assert(!Universe::heap()->is_in_reserved(cast_to_oop(offset)), "must be a raw ptr");
351 return TypeRawPtr::BOTTOM;
352 }
364 t = t->make_ptr();
365 }
366 if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) {
367 // We cannot assert that the offset does not look oop-ish here.
368 // Depending on the heap layout the cardmark base could land
369 // inside some oopish region. It definitely does for Win2K.
370 // The sum of cardmark-base plus shift-by-9-oop lands outside
371 // the oop-ish area but we can't assert for that statically.
372 return TypeRawPtr::BOTTOM;
373 }
374
375 const TypePtr *tp = t->isa_ptr();
376
377 // be conservative if we do not recognize the type
378 if (tp == NULL) {
379 assert(false, "this path may produce not optimal code");
380 return TypePtr::BOTTOM;
381 }
382 assert(tp->base() != Type::AnyPtr, "not a bare pointer");
383
384 return tp->add_offset(offset);
385 }
386
387
388 //-----------------------------operand_index---------------------------------
389 int MachNode::operand_index( uint operand ) const {
390 if( operand < 1 ) return -1;
391 assert(operand < num_opnds(), "oob");
392 if( _opnds[operand]->num_edges() == 0 ) return -1;
393
394 uint skipped = oper_input_base(); // Sum of leaves skipped so far
395 for (uint opcnt = 1; opcnt < operand; opcnt++) {
396 uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand
397 skipped += num_edges;
398 }
399 return skipped;
400 }
401
402 int MachNode::operand_index(const MachOper *oper) const {
403 uint skipped = oper_input_base(); // Sum of leaves skipped so far
404 uint opcnt;
|