hotspot/agent/src/share/classes/sun/jvm/hotspot/code/PCDesc.java
changeset 3686 69c1b5228547
parent 3600 27aa4477d039
child 4095 6e0acfda1d47
equal deleted inserted replaced
3685:e14965d942e3 3686:69c1b5228547
     1 /*
     1 /*
     2  * Copyright 2000-2004 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    34     to the corresponding source scope and byte code index. */
    34     to the corresponding source scope and byte code index. */
    35 
    35 
    36 public class PCDesc extends VMObject {
    36 public class PCDesc extends VMObject {
    37   private static CIntegerField pcOffsetField;
    37   private static CIntegerField pcOffsetField;
    38   private static CIntegerField scopeDecodeOffsetField;
    38   private static CIntegerField scopeDecodeOffsetField;
       
    39   private static CIntegerField pcFlagsField;
    39 
    40 
    40   static {
    41   static {
    41     VM.registerVMInitializedObserver(new Observer() {
    42     VM.registerVMInitializedObserver(new Observer() {
    42         public void update(Observable o, Object data) {
    43         public void update(Observable o, Object data) {
    43           initialize(VM.getVM().getTypeDataBase());
    44           initialize(VM.getVM().getTypeDataBase());
    48   private static void initialize(TypeDataBase db) {
    49   private static void initialize(TypeDataBase db) {
    49     Type type = db.lookupType("PcDesc");
    50     Type type = db.lookupType("PcDesc");
    50 
    51 
    51     pcOffsetField          = type.getCIntegerField("_pc_offset");
    52     pcOffsetField          = type.getCIntegerField("_pc_offset");
    52     scopeDecodeOffsetField = type.getCIntegerField("_scope_decode_offset");
    53     scopeDecodeOffsetField = type.getCIntegerField("_scope_decode_offset");
       
    54     pcFlagsField           = type.getCIntegerField("_flags");
    53   }
    55   }
    54 
    56 
    55   public PCDesc(Address addr) {
    57   public PCDesc(Address addr) {
    56     super(addr);
    58     super(addr);
    57   }
    59   }
    68 
    70 
    69   public Address getRealPC(NMethod code) {
    71   public Address getRealPC(NMethod code) {
    70     return code.instructionsBegin().addOffsetTo(getPCOffset());
    72     return code.instructionsBegin().addOffsetTo(getPCOffset());
    71   }
    73   }
    72 
    74 
       
    75 
       
    76   public boolean getReexecute() {
       
    77     int flags = (int)pcFlagsField.getValue(addr);
       
    78     return ((flags & 0x1)== 1); //first is the reexecute bit
       
    79   }
       
    80 
    73   public void print(NMethod code) {
    81   public void print(NMethod code) {
    74     printOn(System.out, code);
    82     printOn(System.out, code);
    75   }
    83   }
    76 
    84 
    77   public void printOn(PrintStream tty, NMethod code) {
    85   public void printOn(PrintStream tty, NMethod code) {