Object instructions = method.getMostRecentlyGeneratedInstructions();
Object instructions = method.getCurrentInstructions();
  private static void writeAddressMap(String mapFileName) throws IOException {    if (verbose >= 1) say("writing ", mapFileName);    FileOutputStream fos = new FileOutputStream(mapFileName);    BufferedOutputStream bos = new BufferedOutputStream(fos, 128);    PrintStream out = new PrintStream(bos, false);    out.println("#!/bin/ksh");    out.println("# Note: to sort by \"code\" address, type \"ksh <name-of-this-file>\".");    out.println();    out.println("(/bin/grep 'code     0x' | /bin/sort -k 4.3,4) << EOF-EOF-EOF");    out.println();    out.println("JTOC Map");    out.println("--------");    out.println("slot  offset     category contents            details");    out.println("----  ------     -------- --------            -------");    String pad = "        ";    for (int jtocSlot = 0;         jtocSlot < VM_Statics.getNumberOfSlots();         ++jtocSlot)    {      byte   description = VM_Statics.getSlotDescription(jtocSlot);      String category;      int    rawslot;      int    rawslot1;  // used for longs, doubles and address conversion      String contents;      String details;      switch (description) {        case VM_Statics.EMPTY:          category = "unused ";          rawslot  = VM_Statics.getSlotContentsAsInt(jtocSlot);          contents = VM.intAsHexString(rawslot) + pad;          details  = "";          break;        case VM_Statics.INT_LITERAL:          category = "literal";          rawslot  = VM_Statics.getSlotContentsAsInt(jtocSlot);          contents = VM.intAsHexString(rawslot) + pad;          details  = VM_Statics.getSlotContentsAsInt(jtocSlot) + "";          break;        case VM_Statics.FLOAT_LITERAL:          category = "literal";          rawslot  = VM_Statics.getSlotContentsAsInt(jtocSlot);          contents = VM.intAsHexString(rawslot) + pad;          details  = Float.intBitsToFloat(rawslot) + "F";          break;        case VM_Statics.LONG_LITERAL:          category = "literal";          rawslot  = VM_Statics.getSlotContentsAsInt(jtocSlot);          rawslot1 = VM_Statics.getSlotContentsAsInt(jtocSlot + 1);          contents = VM.intAsHexString(rawslot) +                     VM.intAsHexString(rawslot1).substring(2);          details  = VM_Statics.getSlotContentsAsLong(jtocSlot) + "L";          break;        case VM_Statics.DOUBLE_LITERAL:          category = "literal";          rawslot  = VM_Statics.getSlotContentsAsInt(jtocSlot);          rawslot1 = VM_Statics.getSlotContentsAsInt(jtocSlot + 1);          contents = VM.intAsHexString(rawslot) +                     VM.intAsHexString(rawslot+1).substring(2);          details  = Double.longBitsToDouble(                       VM_Statics.getSlotContentsAsLong(jtocSlot)) + "D";          break;        case VM_Statics.STRING_LITERAL:          category = "literal";          rawslot  = VM_Statics.getSlotContentsAsInt(jtocSlot);          rawslot1 = BootImageMap.getImageAddress(bootImageAddress,                       BootImageMap.getObject(rawslot));          contents = VM.intAsHexString(rawslot1) + pad;          details  = "\"" +                     ((String) BootImageMap.getObject(rawslot)).                       replace('\n', ' ') +                     "\"";          break;        case VM_Statics.NUMERIC_FIELD:          category = "field  ";          rawslot  = VM_Statics.getSlotContentsAsInt(jtocSlot);          contents = VM.intAsHexString(rawslot) + pad;          details  = getRvmStaticFieldName(jtocSlot);          break;        case VM_Statics.WIDE_NUMERIC_FIELD:          category = "field  ";          rawslot  = VM_Statics.getSlotContentsAsInt(jtocSlot);          rawslot1 = VM_Statics.getSlotContentsAsInt(jtocSlot + 1);          contents = VM.intAsHexString(rawslot) +                     VM.intAsHexString(rawslot1).substring(2);          details  = getRvmStaticFieldName(jtocSlot);          break;        case VM_Statics.REFERENCE_FIELD:          category = "field  ";          rawslot  = VM_Statics.getSlotContentsAsInt(jtocSlot);          rawslot1 = BootImageMap.getImageAddress(bootImageAddress,                       BootImageMap.getObject(rawslot));          contents = VM.intAsHexString(rawslot1) + pad;          details  = getRvmStaticFieldName(jtocSlot);          break;        case VM_Statics.METHOD:          category = "code   ";          rawslot  = VM_Statics.getSlotContentsAsInt(jtocSlot);          rawslot1 = BootImageMap.getImageAddress(bootImageAddress,                       BootImageMap.getObject(rawslot));          contents = VM.intAsHexString(rawslot1) + pad;          details = "<?>";          // search for a method that this is the code for          INSTRUCTION[] instructions =            (INSTRUCTION[]) BootImageMap.getObject(rawslot);          VM_CompiledMethod[] compiledMethods =            VM_CompiledMethods.getCompiledMethods();          for (int i = 0; i < VM_CompiledMethods.numCompiledMethods(); ++i) {            VM_CompiledMethod compiledMethod = compiledMethods[i];            if (compiledMethod != null &&                compiledMethod.getInstructions() == instructions)            {              details = compiledMethod.getMethod().toString();              break;            }          }          break;        case VM_Statics.TIB:          category = "tib    ";          rawslot  = VM_Statics.getSlotContentsAsInt(jtocSlot);          rawslot1 = BootImageMap.getImageAddress(bootImageAddress,                       BootImageMap.getObject(rawslot));          contents = VM.intAsHexString(rawslot1) + pad;          details = "<?>";          // search for a type that this is the TIB for          VM_Type[] types = VM_TypeDictionary.getValues();          for (int i = FIRST_TYPE_DICTIONARY_INDEX; i < types.length; ++i)            if (types[i].getTibSlot() == jtocSlot) {              details = types[i].toString();              break;            }          break;        default:          category = "<?>    ";          contents = "<?>       " + pad;          details  = "<?>";          break;      }      out.println((jtocSlot + "      ").substring(0,6) +                  VM.intAsHexString(jtocSlot << 2) + " " +                  category + "  " + contents + "  " + details);      if ((description & VM_Statics.WIDE_TAG) != 0)        jtocSlot += 1;    }    out.println();    out.println("Method Map");    out.println("----------");    out.println("                          address             method");    out.println("                          -------             ------");    out.println();    // If java crashes, replace the following with    //for (int i = 0, n = VM_MethodDictionary.getNumValues(); i < n; ++i)    for (int i = 0; i < VM_MethodDictionary.getNumValues(); ++i) {      VM_Method method = VM_MethodDictionary.getValue(i);      if (method == null)       continue;      if (!method.isLoaded()) continue; // bogus or unresolved      if (!method.isCompiled()) continue;      Object instructions = method.getMostRecentlyGeneratedInstructions();      int code = BootImageMap.getImageAddress(bootImageAddress, instructions);      out.println(".     .          code     " + VM.intAsHexString(code) +                  "          " + method);    }    out.println();    out.println("EOF-EOF-EOF");    out.flush();    out.close();  }