Mercurial > hg > graal-jvmci-8
comparison agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java @ 7587:4a916f2ce331
8003985: Support @Contended Annotation - JEP 142
Summary: HotSpot changes to support @Contended annotation.
Reviewed-by: coleenp, kvn, jrose
Contributed-by: Aleksey Shipilev <aleksey.shipilev@oracle.com>
author | jwilhelm |
---|---|
date | Mon, 14 Jan 2013 15:17:47 +0100 |
parents | bd7a7ce2e264 |
children | e94ed1591b42 |
comparison
equal
deleted
inserted
replaced
7586:90a92d5bca17 | 7587:4a916f2ce331 |
---|---|
50 private static int SIGNATURE_INDEX_OFFSET; | 50 private static int SIGNATURE_INDEX_OFFSET; |
51 private static int INITVAL_INDEX_OFFSET; | 51 private static int INITVAL_INDEX_OFFSET; |
52 private static int LOW_OFFSET; | 52 private static int LOW_OFFSET; |
53 private static int HIGH_OFFSET; | 53 private static int HIGH_OFFSET; |
54 private static int FIELD_SLOTS; | 54 private static int FIELD_SLOTS; |
55 private static short FIELDINFO_TAG_SIZE; | |
56 private static short FIELDINFO_TAG_OFFSET; | |
55 | 57 |
56 // ClassState constants | 58 // ClassState constants |
57 private static int CLASS_STATE_ALLOCATED; | 59 private static int CLASS_STATE_ALLOCATED; |
58 private static int CLASS_STATE_LOADED; | 60 private static int CLASS_STATE_LOADED; |
59 private static int CLASS_STATE_LINKED; | 61 private static int CLASS_STATE_LINKED; |
94 // read field offset constants | 96 // read field offset constants |
95 ACCESS_FLAGS_OFFSET = db.lookupIntConstant("FieldInfo::access_flags_offset").intValue(); | 97 ACCESS_FLAGS_OFFSET = db.lookupIntConstant("FieldInfo::access_flags_offset").intValue(); |
96 NAME_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::name_index_offset").intValue(); | 98 NAME_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::name_index_offset").intValue(); |
97 SIGNATURE_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::signature_index_offset").intValue(); | 99 SIGNATURE_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::signature_index_offset").intValue(); |
98 INITVAL_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::initval_index_offset").intValue(); | 100 INITVAL_INDEX_OFFSET = db.lookupIntConstant("FieldInfo::initval_index_offset").intValue(); |
99 LOW_OFFSET = db.lookupIntConstant("FieldInfo::low_offset").intValue(); | 101 LOW_OFFSET = db.lookupIntConstant("FieldInfo::low_packed_offset").intValue(); |
100 HIGH_OFFSET = db.lookupIntConstant("FieldInfo::high_offset").intValue(); | 102 HIGH_OFFSET = db.lookupIntConstant("FieldInfo::high_packed_offset").intValue(); |
101 FIELD_SLOTS = db.lookupIntConstant("FieldInfo::field_slots").intValue(); | 103 FIELD_SLOTS = db.lookupIntConstant("FieldInfo::field_slots").intValue(); |
104 FIELDINFO_TAG_SIZE = db.lookupIntConstant("FIELDINFO_TAG_SIZE").shortValue(); | |
105 FIELDINFO_TAG_OFFSET = db.lookupIntConstant("FIELDINFO_TAG_OFFSET").shortValue(); | |
106 | |
102 // read ClassState constants | 107 // read ClassState constants |
103 CLASS_STATE_ALLOCATED = db.lookupIntConstant("InstanceKlass::allocated").intValue(); | 108 CLASS_STATE_ALLOCATED = db.lookupIntConstant("InstanceKlass::allocated").intValue(); |
104 CLASS_STATE_LOADED = db.lookupIntConstant("InstanceKlass::loaded").intValue(); | 109 CLASS_STATE_LOADED = db.lookupIntConstant("InstanceKlass::loaded").intValue(); |
105 CLASS_STATE_LINKED = db.lookupIntConstant("InstanceKlass::linked").intValue(); | 110 CLASS_STATE_LINKED = db.lookupIntConstant("InstanceKlass::linked").intValue(); |
106 CLASS_STATE_BEING_INITIALIZED = db.lookupIntConstant("InstanceKlass::being_initialized").intValue(); | 111 CLASS_STATE_BEING_INITIALIZED = db.lookupIntConstant("InstanceKlass::being_initialized").intValue(); |
312 return getFields().at(index * FIELD_SLOTS + INITVAL_INDEX_OFFSET); | 317 return getFields().at(index * FIELD_SLOTS + INITVAL_INDEX_OFFSET); |
313 } | 318 } |
314 | 319 |
315 public int getFieldOffset(int index) { | 320 public int getFieldOffset(int index) { |
316 U2Array fields = getFields(); | 321 U2Array fields = getFields(); |
317 return VM.getVM().buildIntFromShorts(fields.at(index * FIELD_SLOTS + LOW_OFFSET), | 322 short lo = fields.at(index * FIELD_SLOTS + LOW_OFFSET); |
318 fields.at(index * FIELD_SLOTS + HIGH_OFFSET)); | 323 short hi = fields.at(index * FIELD_SLOTS + HIGH_OFFSET); |
324 if ((lo & FIELDINFO_TAG_SIZE) == FIELDINFO_TAG_OFFSET) { | |
325 return VM.getVM().buildIntFromShorts(lo, hi) >> FIELDINFO_TAG_SIZE; | |
326 } | |
327 throw new RuntimeException("should not reach here"); | |
319 } | 328 } |
320 | 329 |
321 // Accessors for declared fields | 330 // Accessors for declared fields |
322 public Klass getArrayKlasses() { return (Klass) arrayKlasses.getValue(this); } | 331 public Klass getArrayKlasses() { return (Klass) arrayKlasses.getValue(this); } |
323 public MethodArray getMethods() { return new MethodArray(methods.getValue(getAddress())); } | 332 public MethodArray getMethods() { return new MethodArray(methods.getValue(getAddress())); } |