0N/A/*
3669N/A * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_MEMORY_OOPFACTORY_HPP
1879N/A#define SHARE_VM_MEMORY_OOPFACTORY_HPP
1879N/A
1879N/A#include "classfile/symbolTable.hpp"
1879N/A#include "classfile/systemDictionary.hpp"
4141N/A#include "memory/referenceType.hpp"
1879N/A#include "memory/universe.hpp"
1879N/A#include "oops/klassOop.hpp"
1879N/A#include "oops/objArrayKlass.hpp"
1879N/A#include "oops/oop.hpp"
1879N/A#include "oops/typeArrayKlass.hpp"
1879N/A#include "utilities/growableArray.hpp"
1879N/A
0N/A// oopFactory is a class used for creating new objects.
0N/A
0N/Aclass vframeArray;
0N/A
0N/Aclass oopFactory: AllStatic {
0N/A public:
0N/A // Basic type leaf array allocation
0N/A static typeArrayOop new_boolArray (int length, TRAPS) { return typeArrayKlass::cast(Universe::boolArrayKlassObj ())->allocate(length, CHECK_NULL); }
0N/A static typeArrayOop new_charArray (int length, TRAPS) { return typeArrayKlass::cast(Universe::charArrayKlassObj ())->allocate(length, CHECK_NULL); }
0N/A static typeArrayOop new_singleArray(int length, TRAPS) { return typeArrayKlass::cast(Universe::singleArrayKlassObj())->allocate(length, CHECK_NULL); }
0N/A static typeArrayOop new_doubleArray(int length, TRAPS) { return typeArrayKlass::cast(Universe::doubleArrayKlassObj())->allocate(length, CHECK_NULL); }
0N/A static typeArrayOop new_byteArray (int length, TRAPS) { return typeArrayKlass::cast(Universe::byteArrayKlassObj ())->allocate(length, CHECK_NULL); }
0N/A static typeArrayOop new_shortArray (int length, TRAPS) { return typeArrayKlass::cast(Universe::shortArrayKlassObj ())->allocate(length, CHECK_NULL); }
0N/A static typeArrayOop new_intArray (int length, TRAPS) { return typeArrayKlass::cast(Universe::intArrayKlassObj ())->allocate(length, CHECK_NULL); }
0N/A static typeArrayOop new_longArray (int length, TRAPS) { return typeArrayKlass::cast(Universe::longArrayKlassObj ())->allocate(length, CHECK_NULL); }
0N/A
0N/A // create java.lang.Object[]
0N/A static objArrayOop new_objectArray(int length, TRAPS) {
0N/A return objArrayKlass::
0N/A cast(Universe::objectArrayKlassObj())->allocate(length, CHECK_NULL);
0N/A }
0N/A
0N/A static typeArrayOop new_charArray (const char* utf8_str, TRAPS);
0N/A static typeArrayOop new_permanent_charArray (int length, TRAPS);
0N/A static typeArrayOop new_permanent_byteArray (int length, TRAPS); // used for class file structures
0N/A static typeArrayOop new_permanent_shortArray(int length, TRAPS); // used for class file structures
0N/A static typeArrayOop new_permanent_intArray (int length, TRAPS); // used for class file structures
0N/A
0N/A static typeArrayOop new_typeArray(BasicType type, int length, TRAPS);
2797N/A static typeArrayOop new_typeArray_nozero(BasicType type, int length, TRAPS);
0N/A
0N/A // Constant pools
518N/A static constantPoolOop new_constantPool (int length,
518N/A bool is_conc_safe,
518N/A TRAPS);
542N/A static constantPoolCacheOop new_constantPoolCache(int length,
542N/A TRAPS);
0N/A
0N/A // Instance classes
2223N/A static klassOop new_instanceKlass(Symbol* name,
2223N/A int vtable_len, int itable_len,
939N/A int static_field_size,
939N/A unsigned int nonstatic_oop_map_count,
3669N/A AccessFlags access_flags,
3707N/A ReferenceType rt,
3707N/A KlassHandle host_klass, TRAPS);
0N/A
0N/A // Methods
0N/Aprivate:
0N/A static constMethodOop new_constMethod(int byte_code_size,
0N/A int compressed_line_number_size,
0N/A int localvariable_table_length,
3879N/A int exception_table_length,
518N/A int checked_exceptions_length,
518N/A bool is_conc_safe,
518N/A TRAPS);
0N/Apublic:
518N/A // Set is_conc_safe for methods which cannot safely be
518N/A // processed by concurrent GC even after the return of
518N/A // the method.
518N/A static methodOop new_method(int byte_code_size,
518N/A AccessFlags access_flags,
518N/A int compressed_line_number_size,
518N/A int localvariable_table_length,
3879N/A int exception_table_length,
518N/A int checked_exceptions_length,
518N/A bool is_conc_safe,
518N/A TRAPS);
0N/A
0N/A // Method Data containers
0N/A static methodDataOop new_methodData(methodHandle method, TRAPS);
0N/A
0N/A // System object arrays
0N/A static objArrayOop new_system_objArray(int length, TRAPS);
0N/A
0N/A // Regular object arrays
0N/A static objArrayOop new_objArray(klassOop klass, int length, TRAPS);
0N/A
0N/A // For compiled ICs
0N/A static compiledICHolderOop new_compiledICHolder(methodHandle method, KlassHandle klass, TRAPS);
0N/A};
1879N/A
1879N/A#endif // SHARE_VM_MEMORY_OOPFACTORY_HPP