static void leaveFrameAndRestoreRbp(
     AllocatableValue savedRbp, CompilationResultBuilder crb, AMD64MacroAssembler masm) {
   if (isStackSlot(savedRbp)) {
     // Restoring RBP from the stack must be done before the frame is removed
     masm.movq(rbp, (AMD64Address) crb.asAddress(savedRbp));
   } else {
     Register framePointer = asRegister(savedRbp);
     if (!framePointer.equals(rbp)) {
       masm.movq(rbp, framePointer);
     }
   }
   crb.frameContext.leave(crb);
 }
  public void finalizeAddress(Backend backend) {
    if (address == 0) {
      assert stub != null
          : "linkage without an address must be a stub - forgot to register a Stub associated with "
              + descriptor
              + "?";
      InstalledCode code = stub.getCode(backend);

      Set<Register> destroyedRegisters = stub.getDestroyedRegisters();
      if (!destroyedRegisters.isEmpty()) {
        AllocatableValue[] temporaryLocations = new AllocatableValue[destroyedRegisters.size()];
        int i = 0;
        for (Register reg : destroyedRegisters) {
          temporaryLocations[i++] = reg.asValue();
        }
        temporaries = temporaryLocations;
      }
      address = code.getStart();
    }
  }
 /** Create RegisterValue. */
 private static RegisterValue v(Register r) {
   return r.asValue(kind);
 }