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

src/share/vm/oops/constantPoolOop.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 412     return *((jdouble*)&tmp);
 413   }
 414 
 415   Symbol* symbol_at(int which) {
 416     assert(tag_at(which).is_utf8(), "Corrupted constant pool");
 417     return slot_at(which).get_symbol();
 418   }
 419 
 420   oop string_at(int which, TRAPS) {
 421     constantPoolHandle h_this(THREAD, this);
 422     return string_at_impl(h_this, which, CHECK_NULL);
 423   }
 424 
 425   oop object_at(int which) {
 426     assert(tag_at(which).is_object(), "Corrupted constant pool");
 427     return slot_at(which).get_oop();
 428   }
 429 
 430   // A "pseudo-string" is an non-string oop that has found is way into
 431   // a String entry.
 432   // Under AnonymousClasses this can happen if the user patches a live
 433   // object into a CONSTANT_String entry of an anonymous class.
 434   // Method oops internally created for method handles may also
 435   // use pseudo-strings to link themselves to related metaobjects.
 436 
 437   bool is_pseudo_string_at(int which);
 438 
 439   oop pseudo_string_at(int which) {
 440     assert(tag_at(which).is_string(), "Corrupted constant pool");
 441     return slot_at(which).get_oop();
 442   }
 443 
 444   void pseudo_string_at_put(int which, oop x) {
 445     assert(AnonymousClasses, "");
 446     set_pseudo_string();        // mark header
 447     assert(tag_at(which).is_string() || tag_at(which).is_unresolved_string(), "Corrupted constant pool");
 448     string_at_put(which, x);    // this works just fine
 449   }
 450 
 451   // only called when we are sure a string entry is already resolved (via an
 452   // earlier string_at call.
 453   oop resolved_string_at(int which) {
 454     assert(tag_at(which).is_string(), "Corrupted constant pool");
 455     // Must do an acquire here in case another thread resolved the klass
 456     // behind our back, lest we later load stale values thru the oop.
 457     return CPSlot(OrderAccess::load_ptr_acquire(obj_at_addr_raw(which))).get_oop();
 458   }
 459 
 460   // This method should only be used with a cpool lock or during parsing or gc
 461   Symbol* unresolved_string_at(int which) {    // Temporary until actual use
 462     Symbol* s = CPSlot(OrderAccess::load_ptr_acquire(obj_at_addr_raw(which))).get_symbol();
 463     // check that the string is still unresolved.
 464     assert(tag_at(which).is_unresolved_string(), "Corrupted constant pool");
 465     return s;


   1 /*
   2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 412     return *((jdouble*)&tmp);
 413   }
 414 
 415   Symbol* symbol_at(int which) {
 416     assert(tag_at(which).is_utf8(), "Corrupted constant pool");
 417     return slot_at(which).get_symbol();
 418   }
 419 
 420   oop string_at(int which, TRAPS) {
 421     constantPoolHandle h_this(THREAD, this);
 422     return string_at_impl(h_this, which, CHECK_NULL);
 423   }
 424 
 425   oop object_at(int which) {
 426     assert(tag_at(which).is_object(), "Corrupted constant pool");
 427     return slot_at(which).get_oop();
 428   }
 429 
 430   // A "pseudo-string" is an non-string oop that has found is way into
 431   // a String entry.
 432   // Under EnableInvokeDynamic this can happen if the user patches a live
 433   // object into a CONSTANT_String entry of an anonymous class.
 434   // Method oops internally created for method handles may also
 435   // use pseudo-strings to link themselves to related metaobjects.
 436 
 437   bool is_pseudo_string_at(int which);
 438 
 439   oop pseudo_string_at(int which) {
 440     assert(tag_at(which).is_string(), "Corrupted constant pool");
 441     return slot_at(which).get_oop();
 442   }
 443 
 444   void pseudo_string_at_put(int which, oop x) {
 445     assert(EnableInvokeDynamic, "");
 446     set_pseudo_string();        // mark header
 447     assert(tag_at(which).is_string() || tag_at(which).is_unresolved_string(), "Corrupted constant pool");
 448     string_at_put(which, x);    // this works just fine
 449   }
 450 
 451   // only called when we are sure a string entry is already resolved (via an
 452   // earlier string_at call.
 453   oop resolved_string_at(int which) {
 454     assert(tag_at(which).is_string(), "Corrupted constant pool");
 455     // Must do an acquire here in case another thread resolved the klass
 456     // behind our back, lest we later load stale values thru the oop.
 457     return CPSlot(OrderAccess::load_ptr_acquire(obj_at_addr_raw(which))).get_oop();
 458   }
 459 
 460   // This method should only be used with a cpool lock or during parsing or gc
 461   Symbol* unresolved_string_at(int which) {    // Temporary until actual use
 462     Symbol* s = CPSlot(OrderAccess::load_ptr_acquire(obj_at_addr_raw(which))).get_symbol();
 463     // check that the string is still unresolved.
 464     assert(tag_at(which).is_unresolved_string(), "Corrupted constant pool");
 465     return s;


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