hotspot/src/share/vm/oops/cpCacheOop.cpp

Print this page
rev 611 : Merge
   1 #ifdef USE_PRAGMA_IDENT_SRC
   2 #pragma ident "@(#)cpCacheOop.cpp       1.79 07/05/29 09:44:19 JVM"
   3 #endif
   4 /*
   5  * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  


 204 }
 205 
 206 
 207 void ConstantPoolCacheEntry::set_interface_call(methodHandle method, int index) {
 208   klassOop interf = method->method_holder();
 209   assert(instanceKlass::cast(interf)->is_interface(), "must be an interface");
 210   set_f1(interf);
 211   set_f2(index);
 212   set_flags(as_flags(as_TosState(method->result_type()), method->is_final_method(), false, false, false, true) | method()->size_of_parameters());
 213   set_bytecode_1(Bytecodes::_invokeinterface);  
 214 }
 215 
 216 
 217 class LocalOopClosure: public OopClosure {
 218  private:
 219   void (*_f)(oop*);
 220 
 221  public:
 222   LocalOopClosure(void f(oop*))        { _f = f; }
 223   virtual void do_oop(oop* o)          { _f(o); }

 224 };
 225 
 226 
 227 void ConstantPoolCacheEntry::oops_do(void f(oop*)) {
 228   LocalOopClosure blk(f);
 229   oop_iterate(&blk);
 230 }
 231 
 232 
 233 void ConstantPoolCacheEntry::oop_iterate(OopClosure* blk) {
 234   assert(in_words(size()) == 4, "check code below - may need adjustment");
 235   // field[1] is always oop or NULL
 236   blk->do_oop((oop*)&_f1);
 237   if (is_vfinal()) {
 238     blk->do_oop((oop*)&_f2);
 239   }
 240 }
 241 
 242 
 243 void ConstantPoolCacheEntry::oop_iterate_m(OopClosure* blk, MemRegion mr) {


   1 #ifdef USE_PRAGMA_IDENT_SRC
   2 #pragma ident "@(#)cpCacheOop.cpp       1.79 07/05/29 09:44:19 JVM"
   3 #endif
   4 /*
   5  * Copyright 1998-2008 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  


 204 }
 205 
 206 
 207 void ConstantPoolCacheEntry::set_interface_call(methodHandle method, int index) {
 208   klassOop interf = method->method_holder();
 209   assert(instanceKlass::cast(interf)->is_interface(), "must be an interface");
 210   set_f1(interf);
 211   set_f2(index);
 212   set_flags(as_flags(as_TosState(method->result_type()), method->is_final_method(), false, false, false, true) | method()->size_of_parameters());
 213   set_bytecode_1(Bytecodes::_invokeinterface);  
 214 }
 215 
 216 
 217 class LocalOopClosure: public OopClosure {
 218  private:
 219   void (*_f)(oop*);
 220 
 221  public:
 222   LocalOopClosure(void f(oop*))        { _f = f; }
 223   virtual void do_oop(oop* o)          { _f(o); }
 224   virtual void do_oop(narrowOop *o)    { ShouldNotReachHere(); }
 225 };
 226 
 227 
 228 void ConstantPoolCacheEntry::oops_do(void f(oop*)) {
 229   LocalOopClosure blk(f);
 230   oop_iterate(&blk);
 231 }
 232 
 233 
 234 void ConstantPoolCacheEntry::oop_iterate(OopClosure* blk) {
 235   assert(in_words(size()) == 4, "check code below - may need adjustment");
 236   // field[1] is always oop or NULL
 237   blk->do_oop((oop*)&_f1);
 238   if (is_vfinal()) {
 239     blk->do_oop((oop*)&_f2);
 240   }
 241 }
 242 
 243 
 244 void ConstantPoolCacheEntry::oop_iterate_m(OopClosure* blk, MemRegion mr) {