Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/constantPool.hpp @ 7949:5daaddd917a1
8006040: NPG: on_stack processing wastes space in ConstantPool
Summary: Added on_stack bit to flags. Also MetadataMarkOnStack is used for more than JVMTI so had to be moved.
Reviewed-by: dholmes, stefank
author | coleenp |
---|---|
date | Wed, 23 Jan 2013 10:34:29 -0500 |
parents | b5f6465019f6 |
children | edd76a5856f7 16fb9f942703 |
comparison
equal
deleted
inserted
replaced
7632:2ef7061f13b4 | 7949:5daaddd917a1 |
---|---|
93 // Array of resolved objects from the constant pool and map from resolved | 93 // Array of resolved objects from the constant pool and map from resolved |
94 // object index to original constant pool index | 94 // object index to original constant pool index |
95 jobject _resolved_references; | 95 jobject _resolved_references; |
96 Array<u2>* _reference_map; | 96 Array<u2>* _reference_map; |
97 | 97 |
98 int _flags; // a few header bits to describe contents for GC | 98 enum { |
99 _has_invokedynamic = 1, // Flags | |
100 _has_pseudo_string = 2, | |
101 _has_preresolution = 4, | |
102 _on_stack = 8 | |
103 }; | |
104 | |
105 int _flags; // old fashioned bit twiddling | |
99 int _length; // number of elements in the array | 106 int _length; // number of elements in the array |
100 | |
101 bool _on_stack; // Redefined method still executing refers to this constant pool. | |
102 | 107 |
103 union { | 108 union { |
104 // set for CDS to restore resolved references | 109 // set for CDS to restore resolved references |
105 int _resolved_reference_length; | 110 int _resolved_reference_length; |
106 // keeps version number for redefined classes (used in backtrace) | 111 // keeps version number for redefined classes (used in backtrace) |
113 void tag_at_put(int which, jbyte t) { tags()->at_put(which, t); } | 118 void tag_at_put(int which, jbyte t) { tags()->at_put(which, t); } |
114 void release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); } | 119 void release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); } |
115 | 120 |
116 void set_operands(Array<u2>* operands) { _operands = operands; } | 121 void set_operands(Array<u2>* operands) { _operands = operands; } |
117 | 122 |
118 enum FlagBit { | 123 int flags() const { return _flags; } |
119 FB_has_invokedynamic = 1, | 124 void set_flags(int f) { _flags = f; } |
120 FB_has_pseudo_string = 2, | |
121 FB_has_preresolution = 3 | |
122 }; | |
123 | |
124 int flags() const { return _flags; } | |
125 void set_flags(int f) { _flags = f; } | |
126 bool flag_at(FlagBit fb) const { return (_flags & (1 << (int)fb)) != 0; } | |
127 void set_flag_at(FlagBit fb); | |
128 // no clear_flag_at function; they only increase | |
129 | 125 |
130 private: | 126 private: |
131 intptr_t* base() const { return (intptr_t*) (((char*) this) + sizeof(ConstantPool)); } | 127 intptr_t* base() const { return (intptr_t*) (((char*) this) + sizeof(ConstantPool)); } |
132 | 128 |
133 CPSlot slot_at(int which) { | 129 CPSlot slot_at(int which) { |
176 bool is_constantPool() const volatile { return true; } | 172 bool is_constantPool() const volatile { return true; } |
177 | 173 |
178 Array<u1>* tags() const { return _tags; } | 174 Array<u1>* tags() const { return _tags; } |
179 Array<u2>* operands() const { return _operands; } | 175 Array<u2>* operands() const { return _operands; } |
180 | 176 |
181 bool has_pseudo_string() const { return flag_at(FB_has_pseudo_string); } | 177 bool has_invokedynamic() const { return (_flags & _has_invokedynamic) != 0; } |
182 bool has_invokedynamic() const { return flag_at(FB_has_invokedynamic); } | 178 void set_has_invokedynamic() { _flags |= _has_invokedynamic; } |
183 bool has_preresolution() const { return flag_at(FB_has_preresolution); } | 179 |
184 void set_pseudo_string() { set_flag_at(FB_has_pseudo_string); } | 180 bool has_pseudo_string() const { return (_flags & _has_pseudo_string) != 0; } |
185 void set_invokedynamic() { set_flag_at(FB_has_invokedynamic); } | 181 void set_has_pseudo_string() { _flags |= _has_pseudo_string; } |
186 void set_preresolution() { set_flag_at(FB_has_preresolution); } | 182 |
183 bool has_preresolution() const { return (_flags & _has_preresolution) != 0; } | |
184 void set_has_preresolution() { _flags |= _has_preresolution; } | |
187 | 185 |
188 // Redefine classes support. If a method refering to this constant pool | 186 // Redefine classes support. If a method refering to this constant pool |
189 // is on the executing stack, or as a handle in vm code, this constant pool | 187 // is on the executing stack, or as a handle in vm code, this constant pool |
190 // can't be removed from the set of previous versions saved in the instance | 188 // can't be removed from the set of previous versions saved in the instance |
191 // class. | 189 // class. |
192 bool on_stack() const { return _on_stack; } | 190 bool on_stack() const { return (_flags &_on_stack) != 0; } |
193 void set_on_stack(const bool value); | 191 void set_on_stack(const bool value); |
194 | 192 |
195 // Klass holding pool | 193 // Klass holding pool |
196 InstanceKlass* pool_holder() const { return _pool_holder; } | 194 InstanceKlass* pool_holder() const { return _pool_holder; } |
197 void set_pool_holder(InstanceKlass* k) { _pool_holder = k; } | 195 void set_pool_holder(InstanceKlass* k) { _pool_holder = k; } |
455 return s; | 453 return s; |
456 } | 454 } |
457 | 455 |
458 void pseudo_string_at_put(int which, int obj_index, oop x) { | 456 void pseudo_string_at_put(int which, int obj_index, oop x) { |
459 assert(EnableInvokeDynamic, ""); | 457 assert(EnableInvokeDynamic, ""); |
460 set_pseudo_string(); // mark header | 458 set_has_pseudo_string(); // mark header |
461 assert(tag_at(which).is_string(), "Corrupted constant pool"); | 459 assert(tag_at(which).is_string(), "Corrupted constant pool"); |
462 string_at_put(which, obj_index, x); // this works just fine | 460 string_at_put(which, obj_index, x); // this works just fine |
463 } | 461 } |
464 | 462 |
465 // only called when we are sure a string entry is already resolved (via an | 463 // only called when we are sure a string entry is already resolved (via an |