1 /* 2 * Copyright (c) 1999, 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/_ciObjectFactory.cpp.incl" 27 28 // ciObjectFactory 29 // 30 // This class handles requests for the creation of new instances 31 // of ciObject and its subclasses. It contains a caching mechanism 32 // which ensures that for each oop, at most one ciObject is created. 33 // This invariant allows more efficient implementation of ciObject. 34 // 35 // Implementation note: the oop->ciObject mapping is represented as 36 // a table stored in an array. Even though objects are moved 37 // by the garbage collector, the compactor preserves their relative 38 // order; address comparison of oops (in perm space) is safe so long 39 // as we prohibit GC during our comparisons. We currently use binary 40 // search to find the oop in the table, and inserting a new oop 41 // into the table may be costly. If this cost ends up being 42 // problematic the underlying data structure can be switched to some 43 // sort of balanced binary tree. 44 45 GrowableArray<ciObject*>* ciObjectFactory::_shared_ci_objects = NULL; 46 ciSymbol* ciObjectFactory::_shared_ci_symbols[vmSymbols::SID_LIMIT]; | 1 /* 2 * Copyright (c) 1999, 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 "ci/ciCPCache.hpp" 27 #include "ci/ciCallSite.hpp" 28 #include "ci/ciInstance.hpp" 29 #include "ci/ciInstanceKlass.hpp" 30 #include "ci/ciInstanceKlassKlass.hpp" 31 #include "ci/ciMethod.hpp" 32 #include "ci/ciMethodData.hpp" 33 #include "ci/ciMethodHandle.hpp" 34 #include "ci/ciMethodKlass.hpp" 35 #include "ci/ciNullObject.hpp" 36 #include "ci/ciObjArray.hpp" 37 #include "ci/ciObjArrayKlass.hpp" 38 #include "ci/ciObjArrayKlassKlass.hpp" 39 #include "ci/ciObjectFactory.hpp" 40 #include "ci/ciSymbol.hpp" 41 #include "ci/ciSymbolKlass.hpp" 42 #include "ci/ciTypeArray.hpp" 43 #include "ci/ciTypeArrayKlass.hpp" 44 #include "ci/ciTypeArrayKlassKlass.hpp" 45 #include "ci/ciUtilities.hpp" 46 #include "classfile/systemDictionary.hpp" 47 #include "gc_interface/collectedHeap.inline.hpp" 48 #include "memory/allocation.inline.hpp" 49 #include "oops/oop.inline.hpp" 50 #include "oops/oop.inline2.hpp" 51 #include "runtime/fieldType.hpp" 52 53 // ciObjectFactory 54 // 55 // This class handles requests for the creation of new instances 56 // of ciObject and its subclasses. It contains a caching mechanism 57 // which ensures that for each oop, at most one ciObject is created. 58 // This invariant allows more efficient implementation of ciObject. 59 // 60 // Implementation note: the oop->ciObject mapping is represented as 61 // a table stored in an array. Even though objects are moved 62 // by the garbage collector, the compactor preserves their relative 63 // order; address comparison of oops (in perm space) is safe so long 64 // as we prohibit GC during our comparisons. We currently use binary 65 // search to find the oop in the table, and inserting a new oop 66 // into the table may be costly. If this cost ends up being 67 // problematic the underlying data structure can be switched to some 68 // sort of balanced binary tree. 69 70 GrowableArray<ciObject*>* ciObjectFactory::_shared_ci_objects = NULL; 71 ciSymbol* ciObjectFactory::_shared_ci_symbols[vmSymbols::SID_LIMIT]; |