src/share/vm/oops/klassKlass.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2006, 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  *
  23  */
  24 
  25 # include "incls/_precompiled.incl"
  26 # include "incls/_klassKlass.cpp.incl"




















  27 
  28 int klassKlass::oop_size(oop obj) const {
  29   assert (obj->is_klass(), "must be a klassOop");
  30   return klassOop(obj)->klass_part()->klass_oop_size();
  31 }
  32 
  33 klassOop klassKlass::create_klass(TRAPS) {
  34   KlassHandle h_this_klass;
  35   klassKlass o;
  36   // for bootstrapping, handles may not be available yet.
  37   klassOop k = base_create_klass_oop(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
  38   k->set_klass(k); // point to thyself
  39   // Do not try to allocate mirror, java.lang.Class not loaded at this point.
  40   // See Universe::fixup_mirrors()
  41   return k;
  42 }
  43 
  44 void klassKlass::oop_follow_contents(oop obj) {
  45   Klass* k = Klass::cast(klassOop(obj));
  46   // If we are alive it is valid to keep our superclass and subtype caches alive


   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc_implementation/shared/markSweep.inline.hpp"
  27 #include "gc_interface/collectedHeap.hpp"
  28 #include "gc_interface/collectedHeap.inline.hpp"
  29 #include "memory/oopFactory.hpp"
  30 #include "memory/permGen.hpp"
  31 #include "oops/constantPoolKlass.hpp"
  32 #include "oops/instanceKlass.hpp"
  33 #include "oops/instanceOop.hpp"
  34 #include "oops/klassKlass.hpp"
  35 #include "oops/klassOop.hpp"
  36 #include "oops/methodKlass.hpp"
  37 #include "oops/objArrayKlass.hpp"
  38 #include "oops/oop.inline.hpp"
  39 #include "oops/oop.inline2.hpp"
  40 #include "oops/symbolKlass.hpp"
  41 #include "oops/symbolOop.hpp"
  42 #include "oops/typeArrayKlass.hpp"
  43 #include "runtime/handles.inline.hpp"
  44 #ifndef SERIALGC
  45 #include "oops/oop.pcgc.inline.hpp"
  46 #endif
  47 
  48 int klassKlass::oop_size(oop obj) const {
  49   assert (obj->is_klass(), "must be a klassOop");
  50   return klassOop(obj)->klass_part()->klass_oop_size();
  51 }
  52 
  53 klassOop klassKlass::create_klass(TRAPS) {
  54   KlassHandle h_this_klass;
  55   klassKlass o;
  56   // for bootstrapping, handles may not be available yet.
  57   klassOop k = base_create_klass_oop(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
  58   k->set_klass(k); // point to thyself
  59   // Do not try to allocate mirror, java.lang.Class not loaded at this point.
  60   // See Universe::fixup_mirrors()
  61   return k;
  62 }
  63 
  64 void klassKlass::oop_follow_contents(oop obj) {
  65   Klass* k = Klass::cast(klassOop(obj));
  66   // If we are alive it is valid to keep our superclass and subtype caches alive