--- old/agent/src/share/classes/sun/jvm/hotspot/code/Location.java	Wed Sep 10 16:50:10 2008
+++ new/agent/src/share/classes/sun/jvm/hotspot/code/Location.java	Wed Sep 10 16:50:09 2008
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@
     <P> Encoding: </P>
     <PRE>
     bits:
-    Where:  [15]
-    Type:   [14..12]
-    Offset: [11..0]
+    Type:   [3..0]
+    Where:  [4]
+    Offset: [31..5]
     </PRE>
 */
 
@@ -69,6 +69,7 @@
     // Location::Type constants
     TYPE_NORMAL = db.lookupIntConstant("Location::normal").intValue();
     TYPE_OOP = db.lookupIntConstant("Location::oop").intValue();
+    TYPE_NARROWOOP = db.lookupIntConstant("Location::narrowoop").intValue();
     TYPE_INT_IN_LONG = db.lookupIntConstant("Location::int_in_long").intValue();
     TYPE_LNG = db.lookupIntConstant("Location::lng").intValue();
     TYPE_FLOAT_IN_DBL = db.lookupIntConstant("Location::float_in_dbl").intValue();
@@ -115,6 +116,8 @@
     public static final Type NORMAL       = new Type("normal");
     /** Oop (please GC me!) */
     public static final Type OOP          = new Type("oop");
+    /** NarrowOop (please GC me!) */
+    public static final Type NARROWOOP    = new Type("narrowoop");
     /** Long held in one register */
     public static final Type INT_IN_LONG  = new Type("int_in_long");
     /** Long held in one register */
@@ -142,6 +145,8 @@
         return TYPE_NORMAL;
       } else if (this == OOP) {
         return TYPE_OOP;
+      } else if (this == NARROWOOP) {
+        return TYPE_NARROWOOP;
       } else if (this == INT_IN_LONG) {
         return TYPE_INT_IN_LONG;
       } else if (this == LNG) {
@@ -170,6 +175,7 @@
   // constants in Type enum
   private static int TYPE_NORMAL;
   private static int TYPE_OOP;
+  private static int TYPE_NARROWOOP;
   private static int TYPE_INT_IN_LONG;
   private static int TYPE_LNG;
   private static int TYPE_FLOAT_IN_DBL;
@@ -185,7 +191,7 @@
   Location(Where where, Type type, int offset) {
     setWhere(where);
     setType(type);
-    setOffset(offset & 0x0000FFFF);
+    setOffset(offset);
   }
 
   public Where getWhere() {
@@ -205,6 +211,8 @@
        return Type.NORMAL;
     } else if (type == TYPE_OOP) {
        return Type.OOP;
+    } else if (type == TYPE_NARROWOOP) {
+       return Type.NARROWOOP;
     } else if (type == TYPE_INT_IN_LONG) {
        return Type.INT_IN_LONG;
     } else if (type == TYPE_LNG) {
@@ -238,6 +246,10 @@
     return getType() == Type.OOP;
   }
 
+  public boolean holdsNarrowOop() {
+    return getType() == Type.NARROWOOP;
+  }
+
   public boolean holdsInt() {
     return getType() == Type.INT_IN_LONG;
   }
@@ -266,7 +278,7 @@
     if (Assert.ASSERTS_ENABLED) {
       Assert.that(getWhere() == Where.ON_STACK, "wrong Where");
     }
-    return getOffset() << VM.getVM().getLogAddressSize();
+    return getOffset() * (int)VM.getVM().getIntSize();
   }
 
   public int getRegisterNumber() {
@@ -296,6 +308,8 @@
       if (type == Type.NORMAL) {
       } else if (type == Type.OOP) {
         tty.print(",oop");
+      } else if (type == Type.NARROWOOP) {
+        tty.print(",narrowoop");
       } else if (type == Type.INT_IN_LONG) {
         tty.print(",int");
       } else if (type == Type.LNG) {
@@ -314,7 +328,7 @@
 
   /** Serialization of debugging information */
   public Location(DebugInfoReadStream stream) {
-    value = (0x0000FFFF & stream.readInt());
+    value = stream.readInt();
   }
 
   // FIXME: not yet implementable
@@ -321,19 +335,19 @@
   // void write_on(DebugInfoWriteStream* stream);
 
 
-  //--------------------------------------------------------------------------------
+  //-----------------------------------------------------------------------------
   // Internals only below this point
   //
 
   private void setWhere(Where where) {
-    value |= (where.getValue() << WHERE_SHIFT);
+    value |= ((where.getValue() << WHERE_SHIFT) & WHERE_MASK);
   }
 
   private void setType(Type type) {
-    value |= (type.getValue() << TYPE_SHIFT);
+    value |= ((type.getValue() << TYPE_SHIFT) & TYPE_MASK);
   }
 
   private void setOffset(int offset) {
-    value |= (offset << OFFSET_SHIFT);
+    value |= ((offset << OFFSET_SHIFT) & OFFSET_MASK);
   }
 }
