Ejemplo n.º 1
0
RegisterString registerMaskBit(Location l, fint stackLocs, fint nonRegisterArgs) {
  if (isRegister(l)) {
    if (l >= I0 && l < I0 + NumInRegisters) {
      // an in register
      return nthBit(l - I0 + NumLocalRegisters);
    } else {
      assert(l >= L0 && l < L0 + NumLocalRegisters, "unexpected register");
      return nthBit(l - L0);
    }
  } else if (isStackRegister(l)) {
    l = Location(l - StackLocations);
    if (l < BitsPerWord - (NumInRegisters + NumLocalRegisters)) {
      return nthBit(l + NumInRegisters + NumLocalRegisters);
    }
  } else if (isExtraArgRegister(l)) {
    fint which = ExtraArgLocations - l;
    assert(which <= nonRegisterArgs, "nonRegisterArgs too small");
    which = stackLocs + (nonRegisterArgs - which);  // translate into stack temp
    assert(which >= 0, "should be non-negative");
    if (which < BitsPerWord - (NumInRegisters + NumLocalRegisters)) {
      return nthBit(which + NumInRegisters + NumLocalRegisters);
    }
  }
  return 0;
}
Ejemplo n.º 2
0
 void LongRegisterString::deallocate(Location l) {
   if (isRegister(l)) {
     bv->remove(l);
   } else {
     assert(isStackRegister(l), "should be stack reg");
     fint i = tempToIndex(l);
     bv->remove(i);
   }
 }
Ejemplo n.º 3
0
 void LongRegisterString::doAllocate(Location l) {
   if (isRegister(l)) {
     bv->add(l);
   } else {
     assert(isStackRegister(l), "should be stack reg");
     fint i = tempToIndex(l);
     if (i >= bv->length) grow(i);
     bv->add(i);
   }
 }
Ejemplo n.º 4
0
int32 fpOffset_abstract(Location reg, fint frameSize) {
    // return offset (in bytes) off of fp
    if (isStackRegister(reg)) {
        return (local_slots_offset + StackLocations - reg) * oopSize;
    } else if (isExtraArgRegister(reg)) {
        return (local_slots_offset - frameSize + ExtraArgLocations - reg + 1)
               * oopSize;
    } else {
        assert(isExtraIArgRegister(reg), "not a stack register");
        return (arg_bottom_offset + ExtraIArgLocations - reg) * oopSize;
    }
}
Ejemplo n.º 5
0
 bool LongRegisterString::isAllocated(Location l) {
   if (isRegister(l)) {
     return bv->includes(l);
   } else {
     assert(isStackRegister(l), "should be stack reg");
     fint i = tempToIndex(l);
     if (i < bv->length) {
       return bv->includes(i);
     } else {
       return false;
     }
   }
 }
Ejemplo n.º 6
0
const char *locationName(Location l) {
  Location base;
  int num;
  if          (isStackRegister(l)) { base= StackLocations;     num= l - base; }
  else if  (isExtraArgRegister(l)) { base= ExtraArgLocations;  num= base - l; }
  else if (isExtraIArgRegister(l)) { base= ExtraIArgLocations; num= base - l; }
  else {
    assert(isRegister(l) || l == AnyLocation || l == AnyRegister ||
           l == UnAllocated || l == Temp || l == StackTemp ||
           l == DataRegister || l == AddressRegister, "unexpected location");
    return RegisterNames[l];
  }
  return locationNameHelper(base, num);
}
Ejemplo n.º 7
0
int32 spOffset(Location reg, fint totalFrameSize) {
    // return offset (in bytes) off of sp
    if (isRegister(reg)) {
        assert(isInFrame(reg), "can't access this register");
        return (first_register_offset - StackFromRegister[reg]) * oopSize;
    }
    else if (isStackRegister(reg)) {
        return (totalFrameSize + local_slots_offset + StackLocations - reg)
               * oopSize;
    } else if (isExtraArgRegister(reg)) {
        return (extra_arg_offset + ExtraArgLocations - reg) * oopSize;
    } else {
        assert(isExtraIArgRegister(reg), "not a stack register");
        // reg is <= ExtraIArgLocations, arg_bottom_offset is from sp
        return (totalFrameSize + arg_bottom_offset + ExtraIArgLocations - reg) * oopSize;
    }
}