hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java

Print this page
rev 611 : Merge
   1 /*
   2  * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *  


 289         int value = (int) entryAddr.getCIntegerAt(intConstantEntryValueOffset, C_INT32_SIZE, false);
 290 
 291         // Be a little resilient
 292         Integer oldValue = lookupIntConstant(name, false);
 293         if (oldValue == null) {
 294           addIntConstant(name, value);
 295         } else {
 296           if (oldValue.intValue() != value) {
 297             throw new RuntimeException("Error: the integer constant \"" + name +
 298                                        "\" had its value redefined (old was " + oldValue +
 299                                        ", new is " + value + ". Aborting.");
 300           } else {
 301             System.err.println("Warning: the int constant \"" + name + "\" (declared in the remote VM in VMStructs::localHotSpotVMIntConstants) " +
 302                                "had its value declared as " + value + " twice. Continuing.");
 303           }
 304         }
 305       }
 306 
 307       entryAddr = entryAddr.addOffsetTo(intConstantEntryArrayStride);
 308     } while (nameAddr != null);


 309   }
 310 
 311   private void readVMLongConstants() {
 312     // Get the variables we need in order to traverse the VMLongConstantEntry[]
 313     long longConstantEntryNameOffset;
 314     long longConstantEntryValueOffset;
 315     long longConstantEntryArrayStride;
 316     
 317     longConstantEntryNameOffset  = getLongValueFromProcess("gHotSpotVMLongConstantEntryNameOffset");
 318     longConstantEntryValueOffset = getLongValueFromProcess("gHotSpotVMLongConstantEntryValueOffset");
 319     longConstantEntryArrayStride = getLongValueFromProcess("gHotSpotVMLongConstantEntryArrayStride");
 320 
 321     // Fetch the address of the VMLongConstantEntry*
 322     Address entryAddr = lookupInProcess("gHotSpotVMLongConstants");
 323     // Dereference this once to get the pointer to the first VMLongConstantEntry
 324     entryAddr = entryAddr.getAddressAt(0);
 325     if (entryAddr == null) {
 326       throw new RuntimeException("gHotSpotVMLongConstants was not initialized properly in the remote process; can not continue");
 327     }
 328 


   1 /*
   2  * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *  


 289         int value = (int) entryAddr.getCIntegerAt(intConstantEntryValueOffset, C_INT32_SIZE, false);
 290 
 291         // Be a little resilient
 292         Integer oldValue = lookupIntConstant(name, false);
 293         if (oldValue == null) {
 294           addIntConstant(name, value);
 295         } else {
 296           if (oldValue.intValue() != value) {
 297             throw new RuntimeException("Error: the integer constant \"" + name +
 298                                        "\" had its value redefined (old was " + oldValue +
 299                                        ", new is " + value + ". Aborting.");
 300           } else {
 301             System.err.println("Warning: the int constant \"" + name + "\" (declared in the remote VM in VMStructs::localHotSpotVMIntConstants) " +
 302                                "had its value declared as " + value + " twice. Continuing.");
 303           }
 304         }
 305       }
 306 
 307       entryAddr = entryAddr.addOffsetTo(intConstantEntryArrayStride);
 308     } while (nameAddr != null);
 309       String symbol = "heapOopSize"; // global int constant and value is initialized at runtime.
 310       addIntConstant(symbol, (int)lookupInProcess(symbol).getCIntegerAt(0, 4, false));
 311   }
 312 
 313   private void readVMLongConstants() {
 314     // Get the variables we need in order to traverse the VMLongConstantEntry[]
 315     long longConstantEntryNameOffset;
 316     long longConstantEntryValueOffset;
 317     long longConstantEntryArrayStride;
 318     
 319     longConstantEntryNameOffset  = getLongValueFromProcess("gHotSpotVMLongConstantEntryNameOffset");
 320     longConstantEntryValueOffset = getLongValueFromProcess("gHotSpotVMLongConstantEntryValueOffset");
 321     longConstantEntryArrayStride = getLongValueFromProcess("gHotSpotVMLongConstantEntryArrayStride");
 322 
 323     // Fetch the address of the VMLongConstantEntry*
 324     Address entryAddr = lookupInProcess("gHotSpotVMLongConstants");
 325     // Dereference this once to get the pointer to the first VMLongConstantEntry
 326     entryAddr = entryAddr.getAddressAt(0);
 327     if (entryAddr == null) {
 328       throw new RuntimeException("gHotSpotVMLongConstants was not initialized properly in the remote process; can not continue");
 329     }
 330