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; }
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; } }
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); }
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; } }