src/share/vm/oops/constantPoolKlass.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2009, 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/_constantPoolKlass.cpp.incl"



























  27 
  28 constantPoolOop constantPoolKlass::allocate(int length, bool is_conc_safe, TRAPS) {
  29   int size = constantPoolOopDesc::object_size(length);
  30   KlassHandle klass (THREAD, as_klassOop());
  31   constantPoolOop c =
  32     (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
  33 
  34   c->set_length(length);
  35   c->set_tags(NULL);
  36   c->set_cache(NULL);
  37   c->set_pool_holder(NULL);
  38   c->set_flags(0);
  39   // only set to non-zero if constant pool is merged by RedefineClasses
  40   c->set_orig_length(0);
  41   // if constant pool may change during RedefineClasses, it is created
  42   // unsafe for GC concurrent processing.
  43   c->set_is_conc_safe(is_conc_safe);
  44   // all fields are initialized; needed for GC
  45 
  46   // initialize tag array


   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 "classfile/javaClasses.hpp"
  27 #include "gc_implementation/shared/markSweep.inline.hpp"
  28 #include "gc_interface/collectedHeap.inline.hpp"
  29 #include "memory/oopFactory.hpp"
  30 #include "memory/permGen.hpp"
  31 #include "memory/universe.inline.hpp"
  32 #include "oops/constantPoolKlass.hpp"
  33 #include "oops/constantPoolOop.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "oops/oop.inline2.hpp"
  36 #include "oops/symbolOop.hpp"
  37 #include "runtime/handles.inline.hpp"
  38 #ifdef TARGET_OS_FAMILY_linux
  39 # include "thread_linux.inline.hpp"
  40 #endif
  41 #ifdef TARGET_OS_FAMILY_solaris
  42 # include "thread_solaris.inline.hpp"
  43 #endif
  44 #ifdef TARGET_OS_FAMILY_windows
  45 # include "thread_windows.inline.hpp"
  46 #endif
  47 #ifndef SERIALGC
  48 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
  49 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
  50 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
  51 #include "memory/cardTableRS.hpp"
  52 #include "oops/oop.pcgc.inline.hpp"
  53 #endif
  54 
  55 constantPoolOop constantPoolKlass::allocate(int length, bool is_conc_safe, TRAPS) {
  56   int size = constantPoolOopDesc::object_size(length);
  57   KlassHandle klass (THREAD, as_klassOop());
  58   constantPoolOop c =
  59     (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
  60 
  61   c->set_length(length);
  62   c->set_tags(NULL);
  63   c->set_cache(NULL);
  64   c->set_pool_holder(NULL);
  65   c->set_flags(0);
  66   // only set to non-zero if constant pool is merged by RedefineClasses
  67   c->set_orig_length(0);
  68   // if constant pool may change during RedefineClasses, it is created
  69   // unsafe for GC concurrent processing.
  70   c->set_is_conc_safe(is_conc_safe);
  71   // all fields are initialized; needed for GC
  72 
  73   // initialize tag array