src/share/vm/oops/constantPoolOop.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6893268 Sdiff src/share/vm/oops

src/share/vm/oops/constantPoolOop.hpp

Print this page
rev 1021 : 6858164: invokedynamic code needs some cleanup (post-6655638)
Note: The bug ID for this change set was erroneously used to call for review of 6815692.
Summary: Fix several crashers, remove needless paths for boxed-style bootstrap method call, refactor & simplify APIs for rewriter constantPoolOop, remove sun.dyn.CallSiteImpl
Reviewed-by: ?
rev 1026 : imported patch indy.compiler.inline.patch


 174     // *double_at_addr(which) = d;
 175     // u8 temp = *(u8*) &d;
 176     Bytes::put_native_u8((address) double_at_addr(which), *((u8*) &d));
 177   }
 178 
 179   void symbol_at_put(int which, symbolOop s) {
 180     tag_at_put(which, JVM_CONSTANT_Utf8);
 181     oop_store_without_check(obj_at_addr(which), oop(s));
 182   }
 183 
 184   void string_at_put(int which, oop str) {
 185     oop_store((volatile oop*)obj_at_addr(which), str);
 186     release_tag_at_put(which, JVM_CONSTANT_String);
 187     if (UseConcMarkSweepGC) {
 188       // In case the earlier card-mark was consumed by a concurrent
 189       // marking thread before the tag was updated, redirty the card.
 190       oop_store_without_check((volatile oop *)obj_at_addr(which), str);
 191     }
 192   }
 193 










 194   // For temporary use while constructing constant pool
 195   void string_index_at_put(int which, int string_index) {
 196     tag_at_put(which, JVM_CONSTANT_StringIndex);
 197     *int_at_addr(which) = string_index;
 198   }
 199 
 200   void field_at_put(int which, int class_index, int name_and_type_index) {
 201     tag_at_put(which, JVM_CONSTANT_Fieldref);
 202     *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index;
 203   }
 204 
 205   void method_at_put(int which, int class_index, int name_and_type_index) {
 206     tag_at_put(which, JVM_CONSTANT_Methodref);
 207     *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index;
 208   }
 209 
 210   void interface_method_at_put(int which, int class_index, int name_and_type_index) {
 211     tag_at_put(which, JVM_CONSTANT_InterfaceMethodref);
 212     *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index;  // Not so nice
 213   }
 214 
 215   void name_and_type_at_put(int which, int name_index, int signature_index) {
 216     tag_at_put(which, JVM_CONSTANT_NameAndType);
 217     *int_at_addr(which) = ((jint) signature_index<<16) | name_index;  // Not so nice
 218   }
 219 
 220   // Tag query
 221 
 222   constantTag tag_at(int which) const { return (constantTag)tags()->byte_at_acquire(which); }
 223 
 224   // Whether the entry is a pointer that must be GC'd.
 225   bool is_pointer_entry(int which) {
 226     constantTag tag = tag_at(which);
 227     return tag.is_klass() ||
 228       tag.is_unresolved_klass() ||
 229       tag.is_symbol() ||
 230       tag.is_unresolved_string() ||
 231       tag.is_string();

 232   }
 233 
 234   // Fetching constants
 235 
 236   klassOop klass_at(int which, TRAPS) {
 237     constantPoolHandle h_this(THREAD, this);
 238     return klass_at_impl(h_this, which, CHECK_NULL);
 239   }
 240 
 241   symbolOop klass_name_at(int which);  // Returns the name, w/o resolving.
 242 
 243   klassOop resolved_klass_at(int which) {  // Used by Compiler
 244     guarantee(tag_at(which).is_klass(), "Corrupted constant pool");
 245     // Must do an acquire here in case another thread resolved the klass
 246     // behind our back, lest we later load stale values thru the oop.
 247     return klassOop((oop)OrderAccess::load_ptr_acquire(obj_at_addr(which)));
 248   }
 249 
 250   // This method should only be used with a cpool lock or during parsing or gc
 251   symbolOop unresolved_klass_at(int which) {     // Temporary until actual use


 274     assert(tag_at(which).is_float(), "Corrupted constant pool");
 275     return *float_at_addr(which);
 276   }
 277 
 278   jdouble double_at(int which) {
 279     assert(tag_at(which).is_double(), "Corrupted constant pool");
 280     u8 tmp = Bytes::get_native_u8((address)&base()[which]);
 281     return *((jdouble*)&tmp);
 282   }
 283 
 284   symbolOop symbol_at(int which) {
 285     assert(tag_at(which).is_utf8(), "Corrupted constant pool");
 286     return symbolOop(*obj_at_addr(which));
 287   }
 288 
 289   oop string_at(int which, TRAPS) {
 290     constantPoolHandle h_this(THREAD, this);
 291     return string_at_impl(h_this, which, CHECK_NULL);
 292   }
 293 





 294   // A "pseudo-string" is an non-string oop that has found is way into
 295   // a String entry.
 296   // Under AnonymousClasses this can happen if the user patches a live
 297   // object into a CONSTANT_String entry of an anonymous class.
 298   // Method oops internally created for method handles may also
 299   // use pseudo-strings to link themselves to related metaobjects.
 300 
 301   bool is_pseudo_string_at(int which);
 302 
 303   oop pseudo_string_at(int which) {
 304     assert(tag_at(which).is_string(), "Corrupted constant pool");
 305     return *obj_at_addr(which);
 306   }
 307 
 308   void pseudo_string_at_put(int which, oop x) {
 309     assert(AnonymousClasses, "");
 310     set_pseudo_string();        // mark header
 311     assert(tag_at(which).is_string() || tag_at(which).is_unresolved_string(), "Corrupted constant pool");
 312     string_at_put(which, x);    // this works just fine
 313   }




 174     // *double_at_addr(which) = d;
 175     // u8 temp = *(u8*) &d;
 176     Bytes::put_native_u8((address) double_at_addr(which), *((u8*) &d));
 177   }
 178 
 179   void symbol_at_put(int which, symbolOop s) {
 180     tag_at_put(which, JVM_CONSTANT_Utf8);
 181     oop_store_without_check(obj_at_addr(which), oop(s));
 182   }
 183 
 184   void string_at_put(int which, oop str) {
 185     oop_store((volatile oop*)obj_at_addr(which), str);
 186     release_tag_at_put(which, JVM_CONSTANT_String);
 187     if (UseConcMarkSweepGC) {
 188       // In case the earlier card-mark was consumed by a concurrent
 189       // marking thread before the tag was updated, redirty the card.
 190       oop_store_without_check((volatile oop *)obj_at_addr(which), str);
 191     }
 192   }
 193 
 194   void object_at_put(int which, oop str) {
 195     oop_store((volatile oop*) obj_at_addr(which), str);
 196     release_tag_at_put(which, JVM_CONSTANT_Object);
 197     if (UseConcMarkSweepGC) {
 198       // In case the earlier card-mark was consumed by a concurrent
 199       // marking thread before the tag was updated, redirty the card.
 200       oop_store_without_check((volatile oop*) obj_at_addr(which), str);
 201     }
 202   }
 203 
 204   // For temporary use while constructing constant pool
 205   void string_index_at_put(int which, int string_index) {
 206     tag_at_put(which, JVM_CONSTANT_StringIndex);
 207     *int_at_addr(which) = string_index;
 208   }
 209 
 210   void field_at_put(int which, int class_index, int name_and_type_index) {
 211     tag_at_put(which, JVM_CONSTANT_Fieldref);
 212     *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index;
 213   }
 214 
 215   void method_at_put(int which, int class_index, int name_and_type_index) {
 216     tag_at_put(which, JVM_CONSTANT_Methodref);
 217     *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index;
 218   }
 219 
 220   void interface_method_at_put(int which, int class_index, int name_and_type_index) {
 221     tag_at_put(which, JVM_CONSTANT_InterfaceMethodref);
 222     *int_at_addr(which) = ((jint) name_and_type_index<<16) | class_index;  // Not so nice
 223   }
 224 
 225   void name_and_type_at_put(int which, int name_index, int signature_index) {
 226     tag_at_put(which, JVM_CONSTANT_NameAndType);
 227     *int_at_addr(which) = ((jint) signature_index<<16) | name_index;  // Not so nice
 228   }
 229 
 230   // Tag query
 231 
 232   constantTag tag_at(int which) const { return (constantTag)tags()->byte_at_acquire(which); }
 233 
 234   // Whether the entry is a pointer that must be GC'd.
 235   bool is_pointer_entry(int which) {
 236     constantTag tag = tag_at(which);
 237     return tag.is_klass() ||
 238       tag.is_unresolved_klass() ||
 239       tag.is_symbol() ||
 240       tag.is_unresolved_string() ||
 241       tag.is_string() ||
 242       tag.is_object();
 243   }
 244 
 245   // Fetching constants
 246 
 247   klassOop klass_at(int which, TRAPS) {
 248     constantPoolHandle h_this(THREAD, this);
 249     return klass_at_impl(h_this, which, CHECK_NULL);
 250   }
 251 
 252   symbolOop klass_name_at(int which);  // Returns the name, w/o resolving.
 253 
 254   klassOop resolved_klass_at(int which) {  // Used by Compiler
 255     guarantee(tag_at(which).is_klass(), "Corrupted constant pool");
 256     // Must do an acquire here in case another thread resolved the klass
 257     // behind our back, lest we later load stale values thru the oop.
 258     return klassOop((oop)OrderAccess::load_ptr_acquire(obj_at_addr(which)));
 259   }
 260 
 261   // This method should only be used with a cpool lock or during parsing or gc
 262   symbolOop unresolved_klass_at(int which) {     // Temporary until actual use


 285     assert(tag_at(which).is_float(), "Corrupted constant pool");
 286     return *float_at_addr(which);
 287   }
 288 
 289   jdouble double_at(int which) {
 290     assert(tag_at(which).is_double(), "Corrupted constant pool");
 291     u8 tmp = Bytes::get_native_u8((address)&base()[which]);
 292     return *((jdouble*)&tmp);
 293   }
 294 
 295   symbolOop symbol_at(int which) {
 296     assert(tag_at(which).is_utf8(), "Corrupted constant pool");
 297     return symbolOop(*obj_at_addr(which));
 298   }
 299 
 300   oop string_at(int which, TRAPS) {
 301     constantPoolHandle h_this(THREAD, this);
 302     return string_at_impl(h_this, which, CHECK_NULL);
 303   }
 304 
 305   oop object_at(int which) {
 306     assert(tag_at(which).is_object(), "Corrupted constant pool");
 307     return *obj_at_addr(which);
 308   }
 309 
 310   // A "pseudo-string" is an non-string oop that has found is way into
 311   // a String entry.
 312   // Under AnonymousClasses this can happen if the user patches a live
 313   // object into a CONSTANT_String entry of an anonymous class.
 314   // Method oops internally created for method handles may also
 315   // use pseudo-strings to link themselves to related metaobjects.
 316 
 317   bool is_pseudo_string_at(int which);
 318 
 319   oop pseudo_string_at(int which) {
 320     assert(tag_at(which).is_string(), "Corrupted constant pool");
 321     return *obj_at_addr(which);
 322   }
 323 
 324   void pseudo_string_at_put(int which, oop x) {
 325     assert(AnonymousClasses, "");
 326     set_pseudo_string();        // mark header
 327     assert(tag_at(which).is_string() || tag_at(which).is_unresolved_string(), "Corrupted constant pool");
 328     string_at_put(which, x);    // this works just fine
 329   }


src/share/vm/oops/constantPoolOop.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File