comparison agent/src/share/classes/sun/jvm/hotspot/compiler/OopMapValue.java @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents a61af66fc99e
children d1605aabd0a1
comparison
equal deleted inserted replaced
110:a49a647afe9a 113:ba764ed4b6f2
48 48
49 // Types of OopValues 49 // Types of OopValues
50 static int UNUSED_VALUE; 50 static int UNUSED_VALUE;
51 static int OOP_VALUE; 51 static int OOP_VALUE;
52 static int VALUE_VALUE; 52 static int VALUE_VALUE;
53 static int DEAD_VALUE; 53 static int NARROWOOP_VALUE;
54 static int CALLEE_SAVED_VALUE; 54 static int CALLEE_SAVED_VALUE;
55 static int DERIVED_OOP_VALUE; 55 static int DERIVED_OOP_VALUE;
56 56
57 static { 57 static {
58 VM.registerVMInitializedObserver(new Observer() { 58 VM.registerVMInitializedObserver(new Observer() {
72 REGISTER_MASK = db.lookupIntConstant("OopMapValue::register_mask").intValue(); 72 REGISTER_MASK = db.lookupIntConstant("OopMapValue::register_mask").intValue();
73 REGISTER_MASK_IN_PLACE = db.lookupIntConstant("OopMapValue::register_mask_in_place").intValue(); 73 REGISTER_MASK_IN_PLACE = db.lookupIntConstant("OopMapValue::register_mask_in_place").intValue();
74 UNUSED_VALUE = db.lookupIntConstant("OopMapValue::unused_value").intValue(); 74 UNUSED_VALUE = db.lookupIntConstant("OopMapValue::unused_value").intValue();
75 OOP_VALUE = db.lookupIntConstant("OopMapValue::oop_value").intValue(); 75 OOP_VALUE = db.lookupIntConstant("OopMapValue::oop_value").intValue();
76 VALUE_VALUE = db.lookupIntConstant("OopMapValue::value_value").intValue(); 76 VALUE_VALUE = db.lookupIntConstant("OopMapValue::value_value").intValue();
77 DEAD_VALUE = db.lookupIntConstant("OopMapValue::dead_value").intValue(); 77 NARROWOOP_VALUE = db.lookupIntConstant("OopMapValue::narrowoop_value").intValue();
78 CALLEE_SAVED_VALUE = db.lookupIntConstant("OopMapValue::callee_saved_value").intValue(); 78 CALLEE_SAVED_VALUE = db.lookupIntConstant("OopMapValue::callee_saved_value").intValue();
79 DERIVED_OOP_VALUE = db.lookupIntConstant("OopMapValue::derived_oop_value").intValue(); 79 DERIVED_OOP_VALUE = db.lookupIntConstant("OopMapValue::derived_oop_value").intValue();
80 } 80 }
81 81
82 public static abstract class OopTypes { 82 public static abstract class OopTypes {
83 public static final OopTypes UNUSED_VALUE = new OopTypes() { int getValue() { return OopMapValue.UNUSED_VALUE; }}; 83 public static final OopTypes UNUSED_VALUE = new OopTypes() { int getValue() { return OopMapValue.UNUSED_VALUE; }};
84 public static final OopTypes OOP_VALUE = new OopTypes() { int getValue() { return OopMapValue.OOP_VALUE; }}; 84 public static final OopTypes OOP_VALUE = new OopTypes() { int getValue() { return OopMapValue.OOP_VALUE; }};
85 public static final OopTypes VALUE_VALUE = new OopTypes() { int getValue() { return OopMapValue.VALUE_VALUE; }}; 85 public static final OopTypes VALUE_VALUE = new OopTypes() { int getValue() { return OopMapValue.VALUE_VALUE; }};
86 public static final OopTypes DEAD_VALUE = new OopTypes() { int getValue() { return OopMapValue.DEAD_VALUE; }}; 86 public static final OopTypes NARROWOOP_VALUE = new OopTypes() { int getValue() { return OopMapValue.NARROWOOP_VALUE; }};
87 public static final OopTypes CALLEE_SAVED_VALUE = new OopTypes() { int getValue() { return OopMapValue.CALLEE_SAVED_VALUE; }}; 87 public static final OopTypes CALLEE_SAVED_VALUE = new OopTypes() { int getValue() { return OopMapValue.CALLEE_SAVED_VALUE; }};
88 public static final OopTypes DERIVED_OOP_VALUE = new OopTypes() { int getValue() { return OopMapValue.DERIVED_OOP_VALUE; }}; 88 public static final OopTypes DERIVED_OOP_VALUE = new OopTypes() { int getValue() { return OopMapValue.DERIVED_OOP_VALUE; }};
89 89
90 abstract int getValue(); 90 abstract int getValue();
91 protected OopTypes() {} 91 protected OopTypes() {}
104 } 104 }
105 105
106 // Querying 106 // Querying
107 public boolean isOop() { return (getValue() & TYPE_MASK_IN_PLACE) == OOP_VALUE; } 107 public boolean isOop() { return (getValue() & TYPE_MASK_IN_PLACE) == OOP_VALUE; }
108 public boolean isValue() { return (getValue() & TYPE_MASK_IN_PLACE) == VALUE_VALUE; } 108 public boolean isValue() { return (getValue() & TYPE_MASK_IN_PLACE) == VALUE_VALUE; }
109 public boolean isDead() { return (getValue() & TYPE_MASK_IN_PLACE) == DEAD_VALUE; } 109 public boolean isNarrowOop() { return (getValue() & TYPE_MASK_IN_PLACE) == NARROWOOP_VALUE; }
110 public boolean isCalleeSaved() { return (getValue() & TYPE_MASK_IN_PLACE) == CALLEE_SAVED_VALUE; } 110 public boolean isCalleeSaved() { return (getValue() & TYPE_MASK_IN_PLACE) == CALLEE_SAVED_VALUE; }
111 public boolean isDerivedOop() { return (getValue() & TYPE_MASK_IN_PLACE) == DERIVED_OOP_VALUE; } 111 public boolean isDerivedOop() { return (getValue() & TYPE_MASK_IN_PLACE) == DERIVED_OOP_VALUE; }
112 112
113 public VMReg getReg() { return new VMReg((getValue() & REGISTER_MASK_IN_PLACE) >> REGISTER_SHIFT); } 113 public VMReg getReg() { return new VMReg((getValue() & REGISTER_MASK_IN_PLACE) >> REGISTER_SHIFT); }
114 public void setReg(VMReg r) { setValue((short) (r.getValue() << REGISTER_SHIFT | (getValue() & TYPE_MASK_IN_PLACE))); } 114 public void setReg(VMReg r) { setValue((short) (r.getValue() << REGISTER_SHIFT | (getValue() & TYPE_MASK_IN_PLACE))); }
116 public OopTypes getType() { 116 public OopTypes getType() {
117 int which = (getValue() & TYPE_MASK_IN_PLACE); 117 int which = (getValue() & TYPE_MASK_IN_PLACE);
118 if (which == UNUSED_VALUE) return OopTypes.UNUSED_VALUE; 118 if (which == UNUSED_VALUE) return OopTypes.UNUSED_VALUE;
119 else if (which == OOP_VALUE) return OopTypes.OOP_VALUE; 119 else if (which == OOP_VALUE) return OopTypes.OOP_VALUE;
120 else if (which == VALUE_VALUE) return OopTypes.VALUE_VALUE; 120 else if (which == VALUE_VALUE) return OopTypes.VALUE_VALUE;
121 else if (which == DEAD_VALUE) return OopTypes.DEAD_VALUE; 121 else if (which == NARROWOOP_VALUE) return OopTypes.NARROWOOP_VALUE;
122 else if (which == CALLEE_SAVED_VALUE) return OopTypes.CALLEE_SAVED_VALUE; 122 else if (which == CALLEE_SAVED_VALUE) return OopTypes.CALLEE_SAVED_VALUE;
123 else if (which == DERIVED_OOP_VALUE) return OopTypes.DERIVED_OOP_VALUE; 123 else if (which == DERIVED_OOP_VALUE) return OopTypes.DERIVED_OOP_VALUE;
124 else throw new InternalError("unknown which " + which + " (TYPE_MASK_IN_PLACE = " + TYPE_MASK_IN_PLACE + ")"); 124 else throw new InternalError("unknown which " + which + " (TYPE_MASK_IN_PLACE = " + TYPE_MASK_IN_PLACE + ")");
125 } 125 }
126 public void setType(OopTypes t) { setValue((short) ((getValue() & REGISTER_MASK_IN_PLACE) | t.getValue())); } 126 public void setType(OopTypes t) { setValue((short) ((getValue() & REGISTER_MASK_IN_PLACE) | t.getValue())); }