Ignore:
Timestamp:
Feb 13, 2012, 10:07:12 PM (14 years ago)
Author:
dmik
Message:

trunk: Merged in openjdk6 b24 from branches/vendor/oracle.

Location:
trunk/openjdk
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk

  • trunk/openjdk/hotspot/agent/src/os/linux/libproc_impl.c

    r278 r309  
    11/*
    2  * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/os/linux/ps_core.c

    r278 r309  
    11/*
    2  * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/os/linux/ps_proc.c

    r278 r309  
    11/*
    2  * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    122122#endif
    123123
    124 #ifdef _LP64
    125 #ifdef PTRACE_GETREGS64
     124#if defined(_LP64) && defined(PTRACE_GETREGS64)
    126125#define PTRACE_GETREGS_REQ PTRACE_GETREGS64
    127 #endif
    128 #else
    129 #if defined(PTRACE_GETREGS) || defined(PT_GETREGS)
     126#elif defined(PTRACE_GETREGS)
    130127#define PTRACE_GETREGS_REQ PTRACE_GETREGS
    131 #endif
    132 #endif /* _LP64 */
     128#elif defined(PT_GETREGS)
     129#define PTRACE_GETREGS_REQ PT_GETREGS
     130#endif
    133131
    134132#ifdef PTRACE_GETREGS_REQ
  • trunk/openjdk/hotspot/agent/src/os/linux/symtab.c

    r278 r309  
    11/*
    2  * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/os/linux/symtab.h

    r278 r309  
    11/*
    2  * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java

    r278 r309  
    10381038                            }
    10391039                            public void visit(CodeBlob blob) {
    1040                                 fout.println(gen.genHTML(blob.instructionsBegin()));
     1040                                fout.println(gen.genHTML(blob.contentBegin()));
    10411041                            }
    10421042                            public void epilogue() {
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    100100    long typeEntryArrayStride;
    101101
     102    // Fetch the address of the VMTypeEntry*. We get this symbol first
     103    // and try to use it to make sure that symbol lookup is working.
     104    Address entryAddr = lookupInProcess("gHotSpotVMTypes");
     105    //    System.err.println("gHotSpotVMTypes address = " + entryAddr);
     106    // Dereference this once to get the pointer to the first VMTypeEntry
     107    //    dumpMemory(entryAddr, 80);
     108    entryAddr = entryAddr.getAddressAt(0);
     109
     110    if (entryAddr == null) {
     111      throw new RuntimeException("gHotSpotVMTypes was not initialized properly in the remote process; can not continue");
     112    }
     113
    102114    typeEntryTypeNameOffset       = getLongValueFromProcess("gHotSpotVMTypeEntryTypeNameOffset");
    103115    typeEntrySuperclassNameOffset = getLongValueFromProcess("gHotSpotVMTypeEntrySuperclassNameOffset");
     
    107119    typeEntrySizeOffset           = getLongValueFromProcess("gHotSpotVMTypeEntrySizeOffset");
    108120    typeEntryArrayStride          = getLongValueFromProcess("gHotSpotVMTypeEntryArrayStride");
    109 
    110     // Fetch the address of the VMTypeEntry*
    111     Address entryAddr = lookupInProcess("gHotSpotVMTypes");
    112     //    System.err.println("gHotSpotVMTypes address = " + entryAddr);
    113     // Dereference this once to get the pointer to the first VMTypeEntry
    114     //    dumpMemory(entryAddr, 80);
    115     entryAddr = entryAddr.getAddressAt(0);
    116 
    117     if (entryAddr == null) {
    118       throw new RuntimeException("gHotSpotVMTypes was not initialized properly in the remote process; can not continue");
    119     }
    120121
    121122    // Start iterating down it until we find an entry with no name
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/c1/Runtime1.java

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    5555  /** FIXME: consider making argument "type-safe" in Java port */
    5656  public Address entryFor(int id) {
    57     return blobFor(id).instructionsBegin();
     57    return blobFor(id).codeBegin();
    5858  }
    5959
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    4040  private static CIntegerField headerSizeField;
    4141  private static CIntegerField relocationSizeField;
    42   private static CIntegerField instructionsOffsetField;
     42  private static CIntegerField contentOffsetField;
     43  private static CIntegerField codeOffsetField;
    4344  private static CIntegerField frameCompleteOffsetField;
    4445  private static CIntegerField dataOffsetField;
     
    6970    relocationSizeField      = type.getCIntegerField("_relocation_size");
    7071    frameCompleteOffsetField = type.getCIntegerField("_frame_complete_offset");
    71     instructionsOffsetField  = type.getCIntegerField("_instructions_offset");
     72    contentOffsetField       = type.getCIntegerField("_content_offset");
     73    codeOffsetField          = type.getCIntegerField("_code_offset");
    7274    dataOffsetField          = type.getCIntegerField("_data_offset");
    7375    frameSizeField           = type.getCIntegerField("_frame_size");
     
    112114  //  public RelocInfo relocationEnd();
    113115
    114   public Address instructionsBegin() {
    115     return headerBegin().addOffsetTo(instructionsOffsetField.getValue(addr));
    116   }
    117 
    118   public Address instructionsEnd() {
     116  public Address contentBegin() {
     117    return headerBegin().addOffsetTo(contentOffsetField.getValue(addr));
     118  }
     119
     120  public Address contentEnd() {
     121    return headerBegin().addOffsetTo(dataOffsetField.getValue(addr));
     122  }
     123
     124  public Address codeBegin() {
     125    return headerBegin().addOffsetTo(contentOffsetField.getValue(addr));
     126  }
     127
     128  public Address codeEnd() {
    119129    return headerBegin().addOffsetTo(dataOffsetField.getValue(addr));
    120130  }
     
    129139
    130140  // Offsets
    131   public int getRelocationOffset()   { return (int) headerSizeField.getValue(addr);         }
    132   public int getInstructionsOffset() { return (int) instructionsOffsetField.getValue(addr); }
    133   public int getDataOffset()         { return (int) dataOffsetField.getValue(addr);         }
     141  public int getRelocationOffset() { return (int) headerSizeField   .getValue(addr); }
     142  public int getContentOffset()    { return (int) contentOffsetField.getValue(addr); }
     143  public int getCodeOffset()       { return (int) codeOffsetField   .getValue(addr); }
     144  public int getDataOffset()       { return (int) dataOffsetField   .getValue(addr); }
    134145
    135146  // Sizes
    136   public int getSize()             { return (int) sizeField.getValue(addr);                     }
    137   public int getHeaderSize()       { return (int) headerSizeField.getValue(addr);               }
     147  public int getSize()             { return (int) sizeField      .getValue(addr);     }
     148  public int getHeaderSize()       { return (int) headerSizeField.getValue(addr);     }
    138149  // FIXME: add getRelocationSize()
    139   public int getInstructionsSize() { return (int) instructionsEnd().minus(instructionsBegin()); }
    140   public int getDataSize()         { return (int) dataEnd().minus(dataBegin());                 }
     150  public int getContentSize()      { return (int) contentEnd().minus(contentBegin()); }
     151  public int getCodeSize()         { return (int) codeEnd()   .minus(codeBegin());    }
     152  public int getDataSize()         { return (int) dataEnd()   .minus(dataBegin());    }
    141153
    142154  // Containment
    143   public boolean blobContains(Address addr)         { return headerBegin().lessThanOrEqual(addr) && dataEnd().greaterThan(addr);              }
     155  public boolean blobContains(Address addr)    { return headerBegin() .lessThanOrEqual(addr) && dataEnd()   .greaterThan(addr); }
    144156  // FIXME: add relocationContains
    145   public boolean instructionsContains(Address addr) { return instructionsBegin().lessThanOrEqual(addr) && instructionsEnd().greaterThan(addr); }
    146   public boolean dataContains(Address addr)         { return dataBegin().lessThanOrEqual(addr) && dataEnd().greaterThan(addr);                 }
    147   public boolean contains(Address addr)             { return instructionsContains(addr);                                                       }
    148   public boolean isFrameCompleteAt(Address a)       { return instructionsContains(a) && a.minus(instructionsBegin()) >= frameCompleteOffsetField.getValue(addr); }
     157  public boolean contentContains(Address addr) { return contentBegin().lessThanOrEqual(addr) && contentEnd().greaterThan(addr); }
     158  public boolean codeContains(Address addr)    { return codeBegin()   .lessThanOrEqual(addr) && codeEnd()   .greaterThan(addr); }
     159  public boolean dataContains(Address addr)    { return dataBegin()   .lessThanOrEqual(addr) && dataEnd()   .greaterThan(addr); }
     160  public boolean contains(Address addr)        { return contentContains(addr);                                                  }
     161  public boolean isFrameCompleteAt(Address a)  { return codeContains(a) && a.minus(codeBegin()) >= frameCompleteOffsetField.getValue(addr); }
    149162
    150163  // Reclamation support (really only used by the nmethods, but in order to get asserts to work
     
    169182      Assert.that(getOopMaps() != null, "nope");
    170183    }
    171     return getOopMaps().findMapAtOffset(pc.minus(instructionsBegin()), debugging);
     184    return getOopMaps().findMapAtOffset(pc.minus(codeBegin()), debugging);
    172185  }
    173186
     
    201214
    202215  protected void printComponentsOn(PrintStream tty) {
    203     tty.println(" instructions: [" + instructionsBegin() + ", " + instructionsEnd() + "), " +
     216    tty.println(" content: [" + contentBegin() + ", " + contentEnd() + "), " +
     217                " code: [" + codeBegin() + ", " + codeEnd() + "), " +
    204218                " data: [" + dataBegin() + ", " + dataEnd() + "), " +
    205219                " frame size: " + getFrameSize());
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java

    r278 r309  
    135135
    136136  /** Boundaries for different parts */
    137   public Address constantsBegin()       { return instructionsBegin();                                }
     137  public Address constantsBegin()       { return contentBegin();                                     }
    138138  public Address constantsEnd()         { return getEntryPoint();                                    }
    139   public Address codeBegin()            { return getEntryPoint();                                    }
    140   public Address codeEnd()              { return headerBegin().addOffsetTo(getStubOffset());         }
     139  public Address instsBegin()           { return codeBegin();                                       }
     140  public Address instsEnd()             { return headerBegin().addOffsetTo(getStubOffset());         }
    141141  public Address exceptionBegin()       { return headerBegin().addOffsetTo(getExceptionOffset());    }
    142142  public Address deoptBegin()           { return headerBegin().addOffsetTo(getDeoptOffset());        }
     
    157157
    158158  public int constantsSize()            { return (int) constantsEnd()   .minus(constantsBegin());    }
    159   public int codeSize()                 { return (int) codeEnd()        .minus(codeBegin());         }
     159  public int instsSize()                { return (int) instsEnd()       .minus(instsBegin());        }
    160160  public int stubSize()                 { return (int) stubEnd()        .minus(stubBegin());         }
    161161  public int oopsSize()                 { return (int) oopsEnd()        .minus(oopsBegin());         }
     
    170170    return
    171171      constantsSize()    +
    172       codeSize()         +
     172      instsSize()        +
    173173      stubSize()         +
    174174      scopesDataSize()   +
     
    180180
    181181  public boolean constantsContains   (Address addr) { return constantsBegin()   .lessThanOrEqual(addr) && constantsEnd()   .greaterThan(addr); }
    182   public boolean codeContains        (Address addr) { return codeBegin()        .lessThanOrEqual(addr) && codeEnd()        .greaterThan(addr); }
     182  public boolean instsContains       (Address addr) { return instsBegin()       .lessThanOrEqual(addr) && instsEnd()       .greaterThan(addr); }
    183183  public boolean stubContains        (Address addr) { return stubBegin()        .lessThanOrEqual(addr) && stubEnd()        .greaterThan(addr); }
    184184  public boolean oopsContains        (Address addr) { return oopsBegin()        .lessThanOrEqual(addr) && oopsEnd()        .greaterThan(addr); }
     
    354354  protected void printComponentsOn(PrintStream tty) {
    355355    // FIXME: add relocation information
    356     tty.println(" instructions: [" + instructionsBegin() + ", " + instructionsEnd() + "), " +
     356    tty.println(" content: [" + contentBegin() + ", " + contentEnd() + "), " +
     357                " code: [" + codeBegin() + ", " + codeEnd() + "), " +
    357358                " data: [" + dataBegin() + ", " + dataEnd() + "), " +
    358359                " oops: [" + oopsBegin() + ", " + oopsEnd() + "), " +
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/PCDesc.java

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    7676
    7777  public Address getRealPC(NMethod code) {
    78     return code.instructionsBegin().addOffsetTo(getPCOffset());
     78    return code.codeBegin().addOffsetTo(getPCOffset());
    7979  }
    8080
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/coff/COFFFileParser.java

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    123123      private MemoizedObject[] symbols;
    124124
     125      // Init stringTable at decl time since other fields init'ed in the
     126      // constructor need the String Table.
    125127      private MemoizedObject stringTable = new MemoizedObject() {
    126128          public Object computeValue() {
     129            // the String Table follows the Symbol Table
    127130            int ptr = getPointerToSymbolTable();
    128131            if (ptr == 0) {
     132              // no Symbol Table so no String Table
    129133              return new StringTable(0);
    130134            } else {
     
    141145        pointerToSymbolTable = readInt();
    142146        numberOfSymbols = readInt();
     147        // String Table can be accessed at this point because
     148        // pointerToSymbolTable and numberOfSymbols fields are set.
    143149        sizeOfOptionalHeader = readShort();
    144150        characteristics = readShort();
     
    223229        private MemoizedObject dataDirectories;
    224230
     231        // We use an offset of 2 because OptionalHeaderStandardFieldsImpl doesn't
     232        // include the 'magic' field.
    225233        private static final int STANDARD_FIELDS_OFFSET = 2;
    226234        private static final int PE32_WINDOWS_SPECIFIC_FIELDS_OFFSET = 28;
     
    289297        private int addressOfEntryPoint;
    290298        private int baseOfCode;
    291         private int baseOfData;
     299        private int baseOfData;  // only set in PE32
    292300
    293301        OptionalHeaderStandardFieldsImpl(int offset,
     
    302310          addressOfEntryPoint = readInt();
    303311          baseOfCode = readInt();
    304           if (isPE32Plus) {
     312          if (!isPE32Plus) {
     313            // only available in PE32
    305314            baseOfData = readInt();
    306315          }
     
    434443                  return null;
    435444                }
    436                 return new ExportDirectoryTableImpl(rvaToFileOffset(dir.getRVA()), dir.getSize());
     445                // ExportDirectoryTableImpl needs both the RVA and the
     446                // RVA converted to a file offset.
     447                return new
     448                    ExportDirectoryTableImpl(dir.getRVA(), dir.getSize());
    437449              }
    438450            };
     
    527539
    528540      class ExportDirectoryTableImpl implements ExportDirectoryTable {
     541        private int exportDataDirRVA;
    529542        private int offset;
    530543        private int size;
     
    549562        private MemoizedObject exportAddressTable;
    550563
    551         ExportDirectoryTableImpl(int offset, int size) {
    552           this.offset = offset;
     564        ExportDirectoryTableImpl(int exportDataDirRVA, int size) {
     565          this.exportDataDirRVA = exportDataDirRVA;
     566          offset = rvaToFileOffset(exportDataDirRVA);
    553567          this.size   = size;
    554568          seek(offset);
     
    596610          exportOrdinalTable = new MemoizedObject() {
    597611              public Object computeValue() {
     612                // number of ordinals is same as the number of name pointers
    598613                short[] ordinals = new short[getNumberOfNamePointers()];
    599614                seek(rvaToFileOffset(getOrdinalTableRVA()));
     
    609624                int[] addresses = new int[getNumberOfAddressTableEntries()];
    610625                seek(rvaToFileOffset(getExportAddressTableRVA()));
    611                 // Must make two passes to avoid rvaToFileOffset
    612                 // destroying seek() position
     626                // The Export Address Table values are a union of two
     627                // possible values:
     628                //   Export RVA - The address of the exported symbol when
     629                //       loaded into memory, relative to the image base.
     630                //       This value doesn't get converted into a file offset.
     631                //   Forwarder RVA - The pointer to a null-terminated ASCII
     632                //       string in the export section. This value gets
     633                //       converted into a file offset because we have to
     634                //       fetch the string.
    613635                for (int i = 0; i < addresses.length; i++) {
    614636                  addresses[i] = readInt();
    615                 }
    616                 for (int i = 0; i < addresses.length; i++) {
    617                   addresses[i] = rvaToFileOffset(addresses[i]);
    618637                }
    619638                return addresses;
     
    649668        public boolean isExportAddressForwarder(short ordinal) {
    650669          int addr = getExportAddress(ordinal);
    651           return ((offset <= addr) && (addr < (offset + size)));
     670          return ((exportDataDirRVA <= addr) &&
     671              (addr < (exportDataDirRVA + size)));
    652672        }
    653673
    654674        public String getExportAddressForwarder(short ordinal) {
    655           seek(getExportAddress(ordinal));
     675          seek(rvaToFileOffset(getExportAddress(ordinal)));
    656676          return readCString();
    657677        }
     
    33723392            }
    33733393            // Look up in string table
     3394            // FIXME: this index value is assumed to be in the valid range
    33743395            name = getStringTable().get(index);
    33753396          } else {
    33763397            try {
    3377               name = new String(tmpName, US_ASCII);
     3398              int length = 0;
     3399              // find last non-NULL
     3400              for (; length < tmpName.length && tmpName[length] != '\0';) {
     3401                length++;
     3402              }
     3403              // don't include NULL chars in returned name String
     3404              name = new String(tmpName, 0, length, US_ASCII);
    33783405            } catch (UnsupportedEncodingException e) {
    33793406              throw new COFFException(e);
     
    34883515                                tmpName[6] <<  8 |
    34893516                                tmpName[7]);
     3517            // FIXME: stringOffset is assumed to be in the valid range
    34903518            name = getStringTable().getAtOffset(stringOffset);
    34913519          }
     
    36993727        StringTable(int offset) {
    37003728          if (offset == 0) {
     3729            // no String Table
    37013730            strings = new COFFString[0];
    37023731            return;
     
    37043733
    37053734          seek(offset);
    3706           int length = readInt();
     3735          int length = readInt();  // length includes itself
    37073736          byte[] data = new byte[length - 4];
    37083737          int numBytesRead = readBytes(data);
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/coff/DumpExports.java

    r278 r309  
    11/*
    2  * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    3838    String filename = args[0];
    3939    COFFFile file   = COFFFileParser.getParser().parse(filename);
    40     ExportDirectoryTable exports =
    41       file.getHeader().
    42         getOptionalHeader().
    43           getDataDirectories().
    44             getExportDirectoryTable();
     40
     41    // get common point for both things we want to dump
     42    OptionalHeaderDataDirectories dataDirs = file.getHeader().getOptionalHeader().
     43        getDataDirectories();
     44
     45    // dump the header data directory for the Export Table:
     46    DataDirectory dir = dataDirs.getExportTable();
     47    System.out.println("Export table: RVA = " + dir.getRVA() + "/0x" +
     48        Integer.toHexString(dir.getRVA()) + ", size = " + dir.getSize() + "/0x" +
     49        Integer.toHexString(dir.getSize()));
     50
     51    System.out.println(file.getHeader().getNumberOfSections() + " sections in file");
     52    for (int i = 1; i <= file.getHeader().getNumberOfSections(); i++) {
     53      SectionHeader sec = file.getHeader().getSectionHeader(i);
     54      System.out.println("  Section " + i + ":");
     55      System.out.println("    Name = '" + sec.getName() + "'");
     56      System.out.println("    VirtualSize = " + sec.getSize() + "/0x" +
     57          Integer.toHexString(sec.getSize()));
     58      System.out.println("    VirtualAddress = " + sec.getVirtualAddress() + "/0x" +
     59          Integer.toHexString(sec.getVirtualAddress()));
     60      System.out.println("    SizeOfRawData = " + sec.getSizeOfRawData() + "/0x" +
     61          Integer.toHexString(sec.getSizeOfRawData()));
     62      System.out.println("    PointerToRawData = " + sec.getPointerToRawData() + "/0x" +
     63          Integer.toHexString(sec.getPointerToRawData()));
     64    }
     65
     66    ExportDirectoryTable exports = dataDirs.getExportDirectoryTable();
    4567    if (exports == null) {
    4668      System.out.println("No exports found.");
    4769    } else {
    48       System.out.println(file.getHeader().getNumberOfSections() + " sections in file");
    49       for (int i = 0; i < file.getHeader().getNumberOfSections(); i++) {
    50         System.out.println("  Section " + i + ": " + file.getHeader().getSectionHeader(1 + i).getName());
    51       }
    52 
    53       DataDirectory dir = file.getHeader().getOptionalHeader().getDataDirectories().getExportTable();
    54       System.out.println("Export table: RVA = 0x" + Integer.toHexString(dir.getRVA()) +
    55                          ", size = 0x" + Integer.toHexString(dir.getSize()));
    56 
    5770      System.out.println("DLL name: " + exports.getDLLName());
    5871      System.out.println("Time/date stamp 0x" + Integer.toHexString(exports.getTimeDateStamp()));
    5972      System.out.println("Major version 0x" + Integer.toHexString(exports.getMajorVersion() & 0xFFFF));
    6073      System.out.println("Minor version 0x" + Integer.toHexString(exports.getMinorVersion() & 0xFFFF));
    61       System.out.println(exports.getNumberOfNamePointers() + " functions found");
     74      System.out.println(exports.getNumberOfNamePointers() + " exports found");
    6275      for (int i = 0; i < exports.getNumberOfNamePointers(); i++) {
    63         System.out.println("  0x" +
    64                            Integer.toHexString(exports.getExportAddress(exports.getExportOrdinal(i))) +
    65                            "  " +
    66                            (exports.isExportAddressForwarder(exports.getExportOrdinal(i))  ?
    67                             ("Forwarded to " + exports.getExportAddressForwarder(exports.getExportOrdinal(i))) :
    68                             exports.getExportName(i)));
     76        short ordinal = exports.getExportOrdinal(i);
     77        System.out.print("[" + i + "] '" + exports.getExportName(i) + "': [" +
     78            ordinal + "] = 0x" + Integer.toHexString(exports.getExportAddress(ordinal)));
     79        System.out.println(exports.isExportAddressForwarder(ordinal)
     80            ? "  Forwarded to '" + exports.getExportAddressForwarder(ordinal) + "'"
     81            : "");
    6982      }
    7083    }
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/coff/TestParser.java

    r278 r309  
    11/*
    2  * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    4343      int numSections = header.getNumberOfSections();
    4444      System.out.println(numSections + " sections detected.");
    45       for (int i = 0; i < numSections; i++) {
    46         SectionHeader secHeader = header.getSectionHeader(1 + i);
     45      for (int i = 1; i <= numSections; i++) {
     46        SectionHeader secHeader = header.getSectionHeader(i);
    4747        System.out.println(secHeader.getName());
    4848      }
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java

    r278 r309  
    11/*
    2  * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    507507  }
    508508
    509   private static String  DTFWHome;
    510509  private static String  imagePath;
    511510  private static String  symbolPath;
     
    515514
    516515     /*
    517       * sawindbg.dll depends on dbgeng.dll which
    518       * itself depends on dbghelp.dll. dbgeng.dll and dbghelp.dll.
    519       * On systems newer than Windows 2000, these two .dlls are
    520       * in the standard system directory so we will find them there.
    521       * On Windows 2000 and earlier, these files do not exist.
    522       * The user must download Debugging Tools For Windows (DTFW)
    523       * and install it in order to use SA.
     516      * sawindbg.dll depends on dbgeng.dll which itself depends on
     517      * dbghelp.dll. We have to make sure that the dbgeng.dll and
     518      * dbghelp.dll that we load are compatible with each other. We
     519      * load both of those libraries from the same directory based
     520      * on the theory that co-located libraries are compatible.
    524521      *
    525       * We have to make sure we use the two files from the same directory
    526       * in case there are more than one copy on the system because
    527       * one version of dbgeng.dll might not be compatible with a
    528       * different version of dbghelp.dll.
    529       * We first look for them in the directory pointed at by
    530       * env. var. DEBUGGINGTOOLSFORWINDOWS, next in the default
    531       * installation dir for DTFW, and lastly in the standard
    532       * system directory.  We expect that that we will find
    533       * them in the standard system directory on all systems
    534       * newer than Windows 2000.
     522      * On Windows 2000 and earlier, dbgeng.dll and dbghelp.dll were
     523      * not included as part of the standard system directory. On
     524      * systems newer than Windows 2000, dbgeng.dll and dbghelp.dll
     525      * are included in the standard system directory. However, the
     526      * versions included in the standard system directory may not
     527      * be able to handle symbol information for the newer compilers.
     528      *
     529      * We search for and explicitly load the libraries using the
     530      * following directory search order:
     531      *
     532      * - java.home/bin (same as $JAVA_HOME/jre/bin)
     533      * - dir named by DEBUGGINGTOOLSFORWINDOWS environment variable
     534      * - various "Debugging Tools For Windows" program directories
     535      * - the system directory ($SYSROOT/system32)
     536      *
     537      * If SA is invoked with -Dsun.jvm.hotspot.loadLibrary.DEBUG=1,
     538      * then debug messages about library loading are printed to
     539      * System.err.
    535540      */
    536     String dirName = null;
    537     DTFWHome = System.getenv("DEBUGGINGTOOLSFORWINDOWS");
    538 
    539     if (DTFWHome == null) {
    540       // See if we have the files in the default location.
     541
     542    String dbgengPath   = null;
     543    String dbghelpPath  = null;
     544    String sawindbgPath = null;
     545    List   searchList   = new ArrayList();
     546
     547    boolean loadLibraryDEBUG =
     548        System.getProperty("sun.jvm.hotspot.loadLibrary.DEBUG") != null;
     549
     550    {
     551      // First place to search is co-located with sawindbg.dll in
     552      // $JAVA_HOME/jre/bin (java.home property is set to $JAVA_HOME/jre):
     553      searchList.add(System.getProperty("java.home") + File.separator + "bin");
     554      sawindbgPath = (String) searchList.get(0) + File.separator +
     555          "sawindbg.dll";
     556
     557      // second place to search is specified by an environment variable:
     558      String DTFWHome = System.getenv("DEBUGGINGTOOLSFORWINDOWS");
     559      if (DTFWHome != null) {
     560        searchList.add(DTFWHome);
     561      }
     562
     563      // The third place to search is the install directory for the
     564      // "Debugging Tools For Windows" package; so far there are three
     565      // name variations that we know of:
    541566      String sysRoot = System.getenv("SYSTEMROOT");
    542       DTFWHome = sysRoot + File.separator +
    543           ".." + File.separator + "Program Files" +
    544           File.separator + "Debugging Tools For Windows";
    545     }
    546 
    547     {
    548       String dbghelp = DTFWHome + File.separator + "dbghelp.dll";
    549       String dbgeng = DTFWHome + File.separator + "dbgeng.dll";
    550       File fhelp = new File(dbghelp);
    551       File feng = new File(dbgeng);
    552       if (fhelp.exists() && feng.exists()) {
    553         // found both, we are happy.
    554         // NOTE: The order of loads is important! If we load dbgeng.dll
    555         // first, then the dependency - dbghelp.dll - will be loaded
    556         // from usual DLL search thereby defeating the purpose!
    557         System.load(dbghelp);
    558         System.load(dbgeng);
    559       } else if (! fhelp.exists() && ! feng.exists()) {
    560         // neither exist. We will ignore this dir and assume
    561         // they are in the system dir.
    562         DTFWHome = null;
     567      DTFWHome = sysRoot + File.separator + ".." + File.separator +
     568          "Program Files" + File.separator + "Debugging Tools For Windows";
     569      searchList.add(DTFWHome);
     570      searchList.add(DTFWHome + " (x86)");
     571      searchList.add(DTFWHome + " (x64)");
     572
     573      // The last place to search is the system directory:
     574      searchList.add(sysRoot + File.separator + "system32");
     575    }
     576
     577    for (int i = 0; i < searchList.size(); i++) {
     578      File dir = new File((String) searchList.get(i));
     579      if (!dir.exists()) {
     580        if (loadLibraryDEBUG) {
     581          System.err.println("DEBUG: '" + searchList.get(i) +
     582              "': directory does not exist.");
     583        }
     584        // this search directory doesn't exist so skip it
     585        continue;
     586      }
     587
     588      dbgengPath = (String) searchList.get(i) + File.separator + "dbgeng.dll";
     589      dbghelpPath = (String) searchList.get(i) + File.separator + "dbghelp.dll";
     590
     591      File feng = new File(dbgengPath);
     592      File fhelp = new File(dbghelpPath);
     593      if (feng.exists() && fhelp.exists()) {
     594        // both files exist so we have a match
     595        break;
     596      }
     597
     598      // At least one of the files does not exist; no warning if both
     599      // don't exist. If just one doesn't exist then we don't check
     600      // loadLibraryDEBUG because we have a mis-configured system.
     601      if (feng.exists()) {
     602        System.err.println("WARNING: found '" + dbgengPath +
     603            "' but did not find '" + dbghelpPath + "'; ignoring '" +
     604            dbgengPath + "'.");
     605      } else if (fhelp.exists()) {
     606        System.err.println("WARNING: found '" + dbghelpPath +
     607            "' but did not find '" + dbgengPath + "'; ignoring '" +
     608            dbghelpPath + "'.");
     609      } else if (loadLibraryDEBUG) {
     610        System.err.println("DEBUG: searched '" + searchList.get(i) +
     611          "': dbgeng.dll and dbghelp.dll were not found.");
     612      }
     613      dbgengPath = null;
     614      dbghelpPath = null;
     615    }
     616
     617    if (dbgengPath == null || dbghelpPath == null) {
     618      // at least one of the files wasn't found anywhere we searched
     619      String mesg = null;
     620
     621      if (dbgengPath == null && dbghelpPath == null) {
     622        mesg = "dbgeng.dll and dbghelp.dll cannot be found. ";
     623      } else if (dbgengPath == null) {
     624        mesg = "dbgeng.dll cannot be found (dbghelp.dll was found). ";
    563625      } else {
    564         // one exists but not the other
    565         //System.err.println("Error: Both files dbghelp.dll and dbgeng.dll "
    566         //                   "must exist in directory " + DTFWHome);
    567         throw new UnsatisfiedLinkError("Both files dbghelp.dll and " +
    568                                        "dbgeng.dll must exist in " +
    569                                        "directory " + DTFWHome);
    570       }
    571     }
    572     if (DTFWHome == null) {
    573       // The files better be in the system dir.
    574       String sysDir = System.getenv("SYSTEMROOT") +
    575           File.separator + "system32";
    576 
    577       File feng = new File(sysDir + File.separator + "dbgeng.dll");
    578       if (!feng.exists()) {
    579         throw new UnsatisfiedLinkError("File dbgeng.dll does not exist in " +
    580                                         sysDir + ".  Please search microsoft.com " +
    581                                        "for Debugging Tools For Windows, and " +
    582                                        "either download it to the default " +
    583                                        "location, or download it to a custom " +
    584                                        "location and set environment variable " +
    585                                        "   DEBUGGINGTOOLSFORWINDOWS  "  +
    586                                        "to the pathname of that location.");
    587       }
    588     }
     626        mesg = "dbghelp.dll cannot be found (dbgeng.dll was found). ";
     627      }
     628      throw new UnsatisfiedLinkError(mesg +
     629          "Please search microsoft.com for 'Debugging Tools For Windows', " +
     630          "and either download it to the default location, or download it " +
     631          "to a custom location and set environment variable " +
     632          "'DEBUGGINGTOOLSFORWINDOWS' to the pathname of that location.");
     633    }
     634
     635    // NOTE: The order of loads is important! If we load dbgeng.dll
     636    // first, then the dependency - dbghelp.dll - will be loaded
     637    // from usual DLL search thereby defeating the purpose!
     638    if (loadLibraryDEBUG) {
     639      System.err.println("DEBUG: loading '" + dbghelpPath + "'.");
     640    }
     641    System.load(dbghelpPath);
     642    if (loadLibraryDEBUG) {
     643      System.err.println("DEBUG: loading '" + dbgengPath + "'.");
     644    }
     645    System.load(dbgengPath);
    589646
    590647    // Now, load sawindbg.dll
    591     System.loadLibrary("sawindbg");
     648    if (loadLibraryDEBUG) {
     649      System.err.println("DEBUG: loading '" + sawindbgPath + "'.");
     650    }
     651    System.load(sawindbgPath);
     652
    592653    // where do I find '.exe', '.dll' files?
    593654    imagePath = System.getProperty("sun.jvm.hotspot.debugger.windbg.imagePath");
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeInvoke.java

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java

    r278 r309  
    11/*
    2  * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    189189          throw new RuntimeException("should not reach here");
    190190       }
    191     } else if (ctag.isMethodHandle() || ctag.isMethodType()) {
     191    } else if (ctag.isMethodHandle()) {
    192192       Oop x = getCachedConstant();
    193193       int refidx = cpool.getMethodHandleIndexAt(cpIndex);
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithCPIndex.java

    r278 r309  
    11/*
    2  * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/interpreter/Bytecodes.java

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java

    r278 r309  
    11/*
    2  * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SystemDictionary.java

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java

    r278 r309  
    5454    Type type   = db.lookupType("constantPoolOopDesc");
    5555    tags        = new OopField(type.getOopField("_tags"), 0);
     56    operands    = new OopField(type.getOopField("_operands"), 0);
    5657    cache       = new OopField(type.getOopField("_cache"), 0);
    5758    poolHolder  = new OopField(type.getOopField("_pool_holder"), 0);
     
    5960    headerSize  = type.getSize();
    6061    elementSize = 0;
     62    // fetch constants:
     63    INDY_BSM_OFFSET = db.lookupIntConstant("constantPoolOopDesc::_indy_bsm_offset").intValue();
     64    INDY_ARGC_OFFSET = db.lookupIntConstant("constantPoolOopDesc::_indy_argc_offset").intValue();
     65    INDY_ARGV_OFFSET = db.lookupIntConstant("constantPoolOopDesc::_indy_argv_offset").intValue();
    6166  }
    6267
     
    6873
    6974  private static OopField tags;
     75  private static OopField operands;
    7076  private static OopField cache;
    7177  private static OopField poolHolder;
     
    7581  private static long elementSize;
    7682
     83  private static int INDY_BSM_OFFSET;
     84  private static int INDY_ARGC_OFFSET;
     85  private static int INDY_ARGV_OFFSET;
     86
    7787  public TypeArray         getTags()       { return (TypeArray)         tags.getValue(this); }
     88  public TypeArray         getOperands()   { return (TypeArray)         operands.getValue(this); }
    7889  public ConstantPoolCache getCache()      { return (ConstantPoolCache) cache.getValue(this); }
    7990  public Klass             getPoolHolder() { return (Klass)             poolHolder.getValue(this); }
     
    277288    }
    278289    return res;
     290  }
     291
     292  /** Lookup for multi-operand (InvokeDynamic) entries. */
     293  public short[] getBootstrapSpecifierAt(int i) {
     294    if (Assert.ASSERTS_ENABLED) {
     295      Assert.that(getTagAt(i).isInvokeDynamic(), "Corrupted constant pool");
     296    }
     297    if (getTagAt(i).value() == JVM_CONSTANT_InvokeDynamicTrans)
     298        return null;
     299    int bsmSpec = extractLowShortFromInt(this.getIntAt(i));
     300    TypeArray operands = getOperands();
     301    if (operands == null)  return null;  // safety first
     302    int basePos = VM.getVM().buildIntFromShorts(operands.getShortAt(bsmSpec * 2 + 0),
     303                                                operands.getShortAt(bsmSpec * 2 + 1));
     304    int argv = basePos + INDY_ARGV_OFFSET;
     305    int argc = operands.getShortAt(basePos + INDY_ARGC_OFFSET);
     306    int endPos = argv + argc;
     307    short[] values = new short[endPos - basePos];
     308    for (int j = 0; j < values.length; j++) {
     309        values[j] = operands.getShortAt(basePos+j);
     310    }
     311    return values;
    279312  }
    280313
     
    299332    case JVM_CONSTANT_MethodType:         return "JVM_CONSTANT_MethodType";
    300333    case JVM_CONSTANT_InvokeDynamic:      return "JVM_CONSTANT_InvokeDynamic";
     334    case JVM_CONSTANT_InvokeDynamicTrans: return "JVM_CONSTANT_InvokeDynamic/transitional";
    301335    case JVM_CONSTANT_Invalid:            return "JVM_CONSTANT_Invalid";
    302336    case JVM_CONSTANT_UnresolvedClass:    return "JVM_CONSTANT_UnresolvedClass";
     
    358392        case JVM_CONSTANT_MethodType:
    359393        case JVM_CONSTANT_InvokeDynamic:
     394        case JVM_CONSTANT_InvokeDynamicTrans:
    360395          visitor.doInt(new IntField(new NamedFieldIdentifier(nameForTag(ctag)), indexOffset(index), true), true);
    361396          break;
     
    521556              }
    522557
     558              case JVM_CONSTANT_InvokeDynamicTrans:
    523559              case JVM_CONSTANT_InvokeDynamic: {
    524560                  dos.writeByte(cpConstType);
    525561                  int value = getIntAt(ci);
    526                   short bootstrapMethodIndex = (short) extractLowShortFromInt(value);
     562                  short bsmIndex = (short) extractLowShortFromInt(value);
    527563                  short nameAndTypeIndex = (short) extractHighShortFromInt(value);
    528                   dos.writeShort(bootstrapMethodIndex);
     564                  dos.writeShort(bsmIndex);
    529565                  dos.writeShort(nameAndTypeIndex);
    530                   if (DEBUG) debugMessage("CP[" + ci + "] = indy BSM = " + bootstrapMethodIndex
     566                  if (DEBUG) debugMessage("CP[" + ci + "] = indy BSM = " + bsmIndex
    531567                                          + ", N&T = " + nameAndTypeIndex);
    532568                  break;
    533569              }
     570
    534571              default:
    535572                  throw new InternalError("unknown tag: " + cpConstType);
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPoolCache.java

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPoolCacheEntry.java

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java

    r278 r309  
    4343    public static final int JVM_CONSTANT_MethodHandle       = 15;
    4444    public static final int JVM_CONSTANT_MethodType         = 16;
    45     public static final int JVM_CONSTANT_InvokeDynamic      = 17;
     45    public static final int JVM_CONSTANT_InvokeDynamicTrans = 17;  // only occurs in old class files
     46    public static final int JVM_CONSTANT_InvokeDynamic      = 18;
    4647
    4748    // JVM_CONSTANT_MethodHandle subtypes
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java

    r278 r309  
    11/*
    2  * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java

    r278 r309  
    304304                     dos.writeByte(cpConstType);
    305305                     int value = cpool.getIntAt(ci);
    306                      short bootstrapMethodIndex = (short) extractLowShortFromInt(value);
    307                      short nameAndTypeIndex = (short) extractHighShortFromInt(value);
    308                      dos.writeShort(bootstrapMethodIndex);
    309                      dos.writeShort(nameAndTypeIndex);
    310                      if (DEBUG) debugMessage("CP[" + ci + "] = indy BSM = " +
    311                            bootstrapMethodIndex + ", N&T = " + nameAndTypeIndex);
     306                     byte refKind = (byte) extractLowShortFromInt(value);
     307                     short memberIndex = (short) extractHighShortFromInt(value);
     308                     dos.writeByte(refKind);
     309                     dos.writeShort(memberIndex);
     310                     if (DEBUG) debugMessage("CP[" + ci + "] = MH kind = " +
     311                           refKind + ", mem = " + memberIndex);
    312312                     break;
    313313                }
     
    322322                }
    323323
     324                case JVM_CONSTANT_InvokeDynamicTrans:
    324325                case JVM_CONSTANT_InvokeDynamic: {
    325326                     dos.writeByte(cpConstType);
    326327                     int value = cpool.getIntAt(ci);
    327                      short refIndex = (short) value;
    328                      dos.writeShort(refIndex);
    329                      if (DEBUG) debugMessage("CP[" + ci + "] = MT index = " + refIndex);
     328                     short bsmIndex = (short) extractLowShortFromInt(value);
     329                     short nameAndTypeIndex = (short) extractHighShortFromInt(value);
     330                     dos.writeShort(bsmIndex);
     331                     dos.writeShort(nameAndTypeIndex);
     332                     if (DEBUG) debugMessage("CP[" + ci + "] = INDY bsm = " +
     333                           bsmIndex + ", N&T = " + nameAndTypeIndex);
    330334                     break;
    331335                }
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/FindInCodeCachePanel.java

    r278 r309  
    11/*
    2  * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    191191  private void reportResult(StringBuffer result, CodeBlob blob) {
    192192    result.append("<a href='blob:");
    193     result.append(blob.instructionsBegin().toString());
     193    result.append(blob.contentBegin().toString());
    194194    result.append("'>");
    195195    result.append(blob.getName());
    196196    result.append("@");
    197     result.append(blob.instructionsBegin());
     197    result.append(blob.contentBegin());
    198198    result.append("</a><br>");
    199199  }
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java

    r278 r309  
    3131import sun.jvm.hotspot.asm.x86.*;
    3232import sun.jvm.hotspot.asm.ia64.*;
     33import sun.jvm.hotspot.asm.amd64.*;
    3334import sun.jvm.hotspot.code.*;
    3435import sun.jvm.hotspot.compiler.*;
     
    199200      } else if (cpu.equals("x86")) {
    200201         cpuHelper = new X86Helper();
     202      } else if (cpu.equals("amd64")) {
     203         cpuHelper = new AMD64Helper();
    201204      } else if (cpu.equals("ia64")) {
    202205         cpuHelper = new IA64Helper();
     
    461464   }
    462465
     466   private String genListOfShort(short[] values) {
     467      if (values == null || values.length == 0)  return "";
     468      Formatter buf = new Formatter(genHTML);
     469      buf.append('[');
     470      for (int i = 0; i < values.length; i++) {
     471          if (i > 0)  buf.append(' ');
     472          buf.append('#');
     473          buf.append(Integer.toString(values[i]));
     474      }
     475      buf.append(']');
     476      return buf.toString();
     477   }
     478
    463479   protected String genHTMLTableForConstantPool(ConstantPool cpool) {
    464480      Formatter buf = new Formatter(genHTML);
     
    583599               break;
    584600
     601            case JVM_CONSTANT_InvokeDynamicTrans:
    585602            case JVM_CONSTANT_InvokeDynamic:
    586603               buf.cell("JVM_CONSTANT_InvokeDynamic");
    587                buf.cell(genLowHighShort(cpool.getIntAt(index)));
     604               buf.cell(genLowHighShort(cpool.getIntAt(index)) +
     605                        genListOfShort(cpool.getBootstrapSpecifierAt(index)));
    588606               break;
    589607
     
    14161434
    14171435         buf.h3("Compiled Code");
    1418          sun.jvm.hotspot.debugger.Address codeBegin = nmethod.codeBegin();
    1419          sun.jvm.hotspot.debugger.Address codeEnd   = nmethod.codeEnd();
    1420          final int codeSize = (int)codeEnd.minus(codeBegin);
    1421          final long startPc = addressToLong(codeBegin);
    1422          final byte[] code = new byte[codeSize];
     1436         sun.jvm.hotspot.debugger.Address instsBegin = nmethod.instsBegin();
     1437         sun.jvm.hotspot.debugger.Address instsEnd   = nmethod.instsEnd();
     1438         final int instsSize = nmethod.instsSize();
     1439         final long startPc = addressToLong(instsBegin);
     1440         final byte[] code = new byte[instsSize];
    14231441         for (int i=0; i < code.length; i++)
    1424             code[i] = codeBegin.getJByteAt(i);
     1442            code[i] = instsBegin.getJByteAt(i);
    14251443
    14261444         final long verifiedEntryPoint = addressToLong(nmethod.getVerifiedEntryPoint());
     
    15001518
    15011519         buf.h3("Compiled Code");
    1502          final sun.jvm.hotspot.debugger.Address codeBegin = blob.instructionsBegin();
    1503          final int codeSize = blob.getInstructionsSize();
     1520         final sun.jvm.hotspot.debugger.Address codeBegin = blob.codeBegin();
     1521         final int codeSize = blob.getCodeSize();
    15041522         final long startPc = addressToLong(codeBegin);
    15051523         final byte[] code = new byte[codeSize];
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/ConstantTag.java

    r278 r309  
    11/*
    2  * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    4141  private static int JVM_CONSTANT_MethodHandle            = 15;  // JSR 292
    4242  private static int JVM_CONSTANT_MethodType              = 16;  // JSR 292
    43   private static int JVM_CONSTANT_InvokeDynamic           = 17;  // JSR 292
     43  private static int JVM_CONSTANT_InvokeDynamicTrans      = 17;  // JSR 292, only occurs in old class files
     44  private static int JVM_CONSTANT_InvokeDynamic           = 18;  // JSR 292
    4445  private static int JVM_CONSTANT_Invalid                 = 0;   // For bad value initialization
    4546  private static int JVM_CONSTANT_UnresolvedClass         = 100; // Temporary tag until actual use
     
    6768  }
    6869
     70  public int value() { return tag; }
     71
    6972  public boolean isKlass()            { return tag == JVM_CONSTANT_Class; }
    7073  public boolean isField ()           { return tag == JVM_CONSTANT_Fieldref; }
     
    8184  public boolean isMethodType()       { return tag == JVM_CONSTANT_MethodType; }
    8285  public boolean isInvokeDynamic()    { return tag == JVM_CONSTANT_InvokeDynamic; }
     86  public boolean isInvokeDynamicTrans() { return tag == JVM_CONSTANT_InvokeDynamicTrans; }
    8387
    8488  public boolean isInvalid()          { return tag == JVM_CONSTANT_Invalid; }
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PointerFinder.java

    r278 r309  
    9797          Assert.that(loc.blob != null, "Should have found CodeBlob");
    9898        }
    99         loc.inBlobInstructions = loc.blob.instructionsContains(a);
    100         loc.inBlobData         = loc.blob.dataContains(a);
     99        loc.inBlobCode = loc.blob.codeContains(a);
     100        loc.inBlobData = loc.blob.dataContains(a);
    101101
    102102        if (loc.blob.isNMethod()) {
     
    105105        }
    106106
    107         loc.inBlobUnknownLocation = (!(loc.inBlobInstructions ||
     107        loc.inBlobUnknownLocation = (!(loc.inBlobCode ||
    108108                                       loc.inBlobData ||
    109109                                       loc.inBlobOops));
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/PointerLocation.java

    r278 r309  
    11/*
    2  * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
     
    6666  CodeBlob blob;
    6767  // FIXME: add more detail about CodeBlob
    68   boolean inBlobInstructions;
     68  boolean inBlobCode;
    6969  boolean inBlobData;
    7070  boolean inBlobOops;
     
    143143  }
    144144
    145   public boolean isInBlobInstructions() {
    146     return inBlobInstructions;
     145  public boolean isInBlobCode() {
     146    return inBlobCode;
    147147  }
    148148
     
    234234      CodeBlob b = getCodeBlob();
    235235      tty.print("In ");
    236       if (isInBlobInstructions()) {
    237         tty.print("instructions");
     236      if (isInBlobCode()) {
     237        tty.print("code");
    238238      } else if (isInBlobData()) {
    239239        tty.print("data");
  • trunk/openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js

    r278 r309  
    11/*
    2  * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
     2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
    33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44 *
Note: See TracChangeset for help on using the changeset viewer.