comparison src/share/vm/opto/matcher.cpp @ 14435:da862781b584

Merge
author kvn
date Thu, 21 Nov 2013 12:30:35 -0800
parents 2113136690bc 1dcea64e9f00
children 50fdb38839eb
comparison
equal deleted inserted replaced
14434:318d0622a6d7 14435:da862781b584
465 465
466 // At first, start with the empty mask 466 // At first, start with the empty mask
467 C->FIRST_STACK_mask().Clear(); 467 C->FIRST_STACK_mask().Clear();
468 468
469 // Add in the incoming argument area 469 // Add in the incoming argument area
470 OptoReg::Name init = OptoReg::add(_old_SP, C->out_preserve_stack_slots()); 470 OptoReg::Name init_in = OptoReg::add(_old_SP, C->out_preserve_stack_slots());
471 for (i = init; i < _in_arg_limit; i = OptoReg::add(i,1)) 471 for (i = init_in; i < _in_arg_limit; i = OptoReg::add(i,1)) {
472 C->FIRST_STACK_mask().Insert(i); 472 C->FIRST_STACK_mask().Insert(i);
473 473 }
474 // Add in all bits past the outgoing argument area 474 // Add in all bits past the outgoing argument area
475 guarantee(RegMask::can_represent_arg(OptoReg::add(_out_arg_limit,-1)), 475 guarantee(RegMask::can_represent_arg(OptoReg::add(_out_arg_limit,-1)),
476 "must be able to represent all call arguments in reg mask"); 476 "must be able to represent all call arguments in reg mask");
477 init = _out_arg_limit; 477 OptoReg::Name init = _out_arg_limit;
478 for (i = init; RegMask::can_represent(i); i = OptoReg::add(i,1)) 478 for (i = init; RegMask::can_represent(i); i = OptoReg::add(i,1)) {
479 C->FIRST_STACK_mask().Insert(i); 479 C->FIRST_STACK_mask().Insert(i);
480 480 }
481 // Finally, set the "infinite stack" bit. 481 // Finally, set the "infinite stack" bit.
482 C->FIRST_STACK_mask().set_AllStack(); 482 C->FIRST_STACK_mask().set_AllStack();
483 483
484 // Make spill masks. Registers for their class, plus FIRST_STACK_mask. 484 // Make spill masks. Registers for their class, plus FIRST_STACK_mask.
485 RegMask aligned_stack_mask = C->FIRST_STACK_mask(); 485 RegMask aligned_stack_mask = C->FIRST_STACK_mask();
507 if (Matcher::vector_size_supported(T_BYTE,4)) { 507 if (Matcher::vector_size_supported(T_BYTE,4)) {
508 *idealreg2spillmask[Op_VecS] = *idealreg2regmask[Op_VecS]; 508 *idealreg2spillmask[Op_VecS] = *idealreg2regmask[Op_VecS];
509 idealreg2spillmask[Op_VecS]->OR(C->FIRST_STACK_mask()); 509 idealreg2spillmask[Op_VecS]->OR(C->FIRST_STACK_mask());
510 } 510 }
511 if (Matcher::vector_size_supported(T_FLOAT,2)) { 511 if (Matcher::vector_size_supported(T_FLOAT,2)) {
512 // For VecD we need dual alignment and 8 bytes (2 slots) for spills.
513 // RA guarantees such alignment since it is needed for Double and Long values.
512 *idealreg2spillmask[Op_VecD] = *idealreg2regmask[Op_VecD]; 514 *idealreg2spillmask[Op_VecD] = *idealreg2regmask[Op_VecD];
513 idealreg2spillmask[Op_VecD]->OR(aligned_stack_mask); 515 idealreg2spillmask[Op_VecD]->OR(aligned_stack_mask);
514 } 516 }
515 if (Matcher::vector_size_supported(T_FLOAT,4)) { 517 if (Matcher::vector_size_supported(T_FLOAT,4)) {
518 // For VecX we need quadro alignment and 16 bytes (4 slots) for spills.
519 //
520 // RA can use input arguments stack slots for spills but until RA
521 // we don't know frame size and offset of input arg stack slots.
522 //
523 // Exclude last input arg stack slots to avoid spilling vectors there
524 // otherwise vector spills could stomp over stack slots in caller frame.
525 OptoReg::Name in = OptoReg::add(_in_arg_limit, -1);
526 for (int k = 1; (in >= init_in) && (k < RegMask::SlotsPerVecX); k++) {
527 aligned_stack_mask.Remove(in);
528 in = OptoReg::add(in, -1);
529 }
516 aligned_stack_mask.clear_to_sets(RegMask::SlotsPerVecX); 530 aligned_stack_mask.clear_to_sets(RegMask::SlotsPerVecX);
517 assert(aligned_stack_mask.is_AllStack(), "should be infinite stack"); 531 assert(aligned_stack_mask.is_AllStack(), "should be infinite stack");
518 *idealreg2spillmask[Op_VecX] = *idealreg2regmask[Op_VecX]; 532 *idealreg2spillmask[Op_VecX] = *idealreg2regmask[Op_VecX];
519 idealreg2spillmask[Op_VecX]->OR(aligned_stack_mask); 533 idealreg2spillmask[Op_VecX]->OR(aligned_stack_mask);
520 } 534 }
521 if (Matcher::vector_size_supported(T_FLOAT,8)) { 535 if (Matcher::vector_size_supported(T_FLOAT,8)) {
536 // For VecY we need octo alignment and 32 bytes (8 slots) for spills.
537 OptoReg::Name in = OptoReg::add(_in_arg_limit, -1);
538 for (int k = 1; (in >= init_in) && (k < RegMask::SlotsPerVecY); k++) {
539 aligned_stack_mask.Remove(in);
540 in = OptoReg::add(in, -1);
541 }
522 aligned_stack_mask.clear_to_sets(RegMask::SlotsPerVecY); 542 aligned_stack_mask.clear_to_sets(RegMask::SlotsPerVecY);
523 assert(aligned_stack_mask.is_AllStack(), "should be infinite stack"); 543 assert(aligned_stack_mask.is_AllStack(), "should be infinite stack");
524 *idealreg2spillmask[Op_VecY] = *idealreg2regmask[Op_VecY]; 544 *idealreg2spillmask[Op_VecY] = *idealreg2regmask[Op_VecY];
525 idealreg2spillmask[Op_VecY]->OR(aligned_stack_mask); 545 idealreg2spillmask[Op_VecY]->OR(aligned_stack_mask);
526 } 546 }