Tue, 11 May 2010 14:35:43 -0700
6931180: Migration to recent versions of MS Platform SDK
6951582: Build problems on win64
Summary: Changes to enable building JDK7 with Microsoft Visual Studio 2010
Reviewed-by: ohair, art, ccheung, dcubed
duke@435 | 1 | /* |
xdono@1014 | 2 | * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | # include "incls/_precompiled.incl" |
duke@435 | 26 | # include "incls/_oopFactory.cpp.incl" |
duke@435 | 27 | |
duke@435 | 28 | |
duke@435 | 29 | typeArrayOop oopFactory::new_charArray(const char* utf8_str, TRAPS) { |
duke@435 | 30 | int length = utf8_str == NULL ? 0 : UTF8::unicode_length(utf8_str); |
duke@435 | 31 | typeArrayOop result = new_charArray(length, CHECK_NULL); |
duke@435 | 32 | if (length > 0) { |
duke@435 | 33 | UTF8::convert_to_unicode(utf8_str, result->char_at_addr(0), length); |
duke@435 | 34 | } |
duke@435 | 35 | return result; |
duke@435 | 36 | } |
duke@435 | 37 | |
duke@435 | 38 | typeArrayOop oopFactory::new_permanent_charArray(int length, TRAPS) { |
duke@435 | 39 | return typeArrayKlass::cast(Universe::charArrayKlassObj())->allocate_permanent(length, THREAD); |
duke@435 | 40 | } |
duke@435 | 41 | |
duke@435 | 42 | typeArrayOop oopFactory::new_permanent_byteArray(int length, TRAPS) { |
duke@435 | 43 | return typeArrayKlass::cast(Universe::byteArrayKlassObj())->allocate_permanent(length, THREAD); |
duke@435 | 44 | } |
duke@435 | 45 | |
duke@435 | 46 | |
duke@435 | 47 | typeArrayOop oopFactory::new_permanent_shortArray(int length, TRAPS) { |
duke@435 | 48 | return typeArrayKlass::cast(Universe::shortArrayKlassObj())->allocate_permanent(length, THREAD); |
duke@435 | 49 | } |
duke@435 | 50 | |
duke@435 | 51 | |
duke@435 | 52 | typeArrayOop oopFactory::new_permanent_intArray(int length, TRAPS) { |
duke@435 | 53 | return typeArrayKlass::cast(Universe::intArrayKlassObj())->allocate_permanent(length, THREAD); |
duke@435 | 54 | } |
duke@435 | 55 | |
duke@435 | 56 | |
duke@435 | 57 | typeArrayOop oopFactory::new_typeArray(BasicType type, int length, TRAPS) { |
duke@435 | 58 | klassOop type_asKlassOop = Universe::typeArrayKlassObj(type); |
duke@435 | 59 | typeArrayKlass* type_asArrayKlass = typeArrayKlass::cast(type_asKlassOop); |
duke@435 | 60 | typeArrayOop result = type_asArrayKlass->allocate(length, THREAD); |
duke@435 | 61 | return result; |
duke@435 | 62 | } |
duke@435 | 63 | |
duke@435 | 64 | |
duke@435 | 65 | objArrayOop oopFactory::new_objArray(klassOop klass, int length, TRAPS) { |
duke@435 | 66 | assert(klass->is_klass(), "must be instance class"); |
duke@435 | 67 | if (klass->klass_part()->oop_is_array()) { |
duke@435 | 68 | return ((arrayKlass*)klass->klass_part())->allocate_arrayArray(1, length, THREAD); |
duke@435 | 69 | } else { |
duke@435 | 70 | assert (klass->klass_part()->oop_is_instance(), "new object array with klass not an instanceKlass"); |
duke@435 | 71 | return ((instanceKlass*)klass->klass_part())->allocate_objArray(1, length, THREAD); |
duke@435 | 72 | } |
duke@435 | 73 | } |
duke@435 | 74 | |
duke@435 | 75 | objArrayOop oopFactory::new_system_objArray(int length, TRAPS) { |
duke@435 | 76 | int size = objArrayOopDesc::object_size(length); |
duke@435 | 77 | KlassHandle klass (THREAD, Universe::systemObjArrayKlassObj()); |
duke@435 | 78 | objArrayOop o = (objArrayOop) |
duke@435 | 79 | Universe::heap()->permanent_array_allocate(klass, size, length, CHECK_NULL); |
duke@435 | 80 | // initialization not needed, allocated cleared |
duke@435 | 81 | return o; |
duke@435 | 82 | } |
duke@435 | 83 | |
duke@435 | 84 | |
jmasa@953 | 85 | constantPoolOop oopFactory::new_constantPool(int length, |
jmasa@953 | 86 | bool is_conc_safe, |
jmasa@953 | 87 | TRAPS) { |
duke@435 | 88 | constantPoolKlass* ck = constantPoolKlass::cast(Universe::constantPoolKlassObj()); |
jmasa@953 | 89 | return ck->allocate(length, is_conc_safe, CHECK_NULL); |
duke@435 | 90 | } |
duke@435 | 91 | |
duke@435 | 92 | |
jmasa@977 | 93 | constantPoolCacheOop oopFactory::new_constantPoolCache(int length, |
jmasa@977 | 94 | bool is_conc_safe, |
jmasa@977 | 95 | TRAPS) { |
duke@435 | 96 | constantPoolCacheKlass* ck = constantPoolCacheKlass::cast(Universe::constantPoolCacheKlassObj()); |
jmasa@977 | 97 | return ck->allocate(length, is_conc_safe, CHECK_NULL); |
duke@435 | 98 | } |
duke@435 | 99 | |
duke@435 | 100 | |
jcoomes@1374 | 101 | klassOop oopFactory::new_instanceKlass(int vtable_len, int itable_len, |
jcoomes@1374 | 102 | int static_field_size, |
jcoomes@1374 | 103 | unsigned int nonstatic_oop_map_count, |
jcoomes@1374 | 104 | ReferenceType rt, TRAPS) { |
duke@435 | 105 | instanceKlassKlass* ikk = instanceKlassKlass::cast(Universe::instanceKlassKlassObj()); |
jcoomes@1373 | 106 | return ikk->allocate_instance_klass(vtable_len, itable_len, static_field_size, nonstatic_oop_map_count, rt, CHECK_NULL); |
duke@435 | 107 | } |
duke@435 | 108 | |
duke@435 | 109 | |
duke@435 | 110 | constMethodOop oopFactory::new_constMethod(int byte_code_size, |
duke@435 | 111 | int compressed_line_number_size, |
duke@435 | 112 | int localvariable_table_length, |
duke@435 | 113 | int checked_exceptions_length, |
jmasa@953 | 114 | bool is_conc_safe, |
duke@435 | 115 | TRAPS) { |
duke@435 | 116 | klassOop cmkObj = Universe::constMethodKlassObj(); |
duke@435 | 117 | constMethodKlass* cmk = constMethodKlass::cast(cmkObj); |
duke@435 | 118 | return cmk->allocate(byte_code_size, compressed_line_number_size, |
duke@435 | 119 | localvariable_table_length, checked_exceptions_length, |
jmasa@953 | 120 | is_conc_safe, |
duke@435 | 121 | CHECK_NULL); |
duke@435 | 122 | } |
duke@435 | 123 | |
duke@435 | 124 | |
duke@435 | 125 | methodOop oopFactory::new_method(int byte_code_size, AccessFlags access_flags, |
duke@435 | 126 | int compressed_line_number_size, |
duke@435 | 127 | int localvariable_table_length, |
jmasa@953 | 128 | int checked_exceptions_length, |
jmasa@953 | 129 | bool is_conc_safe, |
jmasa@953 | 130 | TRAPS) { |
duke@435 | 131 | methodKlass* mk = methodKlass::cast(Universe::methodKlassObj()); |
duke@435 | 132 | assert(!access_flags.is_native() || byte_code_size == 0, |
duke@435 | 133 | "native methods should not contain byte codes"); |
duke@435 | 134 | constMethodOop cm = new_constMethod(byte_code_size, |
duke@435 | 135 | compressed_line_number_size, |
duke@435 | 136 | localvariable_table_length, |
jmasa@953 | 137 | checked_exceptions_length, |
jmasa@953 | 138 | is_conc_safe, CHECK_NULL); |
duke@435 | 139 | constMethodHandle rw(THREAD, cm); |
duke@435 | 140 | return mk->allocate(rw, access_flags, CHECK_NULL); |
duke@435 | 141 | } |
duke@435 | 142 | |
duke@435 | 143 | |
duke@435 | 144 | methodDataOop oopFactory::new_methodData(methodHandle method, TRAPS) { |
duke@435 | 145 | methodDataKlass* mdk = methodDataKlass::cast(Universe::methodDataKlassObj()); |
duke@435 | 146 | return mdk->allocate(method, CHECK_NULL); |
duke@435 | 147 | } |
duke@435 | 148 | |
duke@435 | 149 | |
duke@435 | 150 | compiledICHolderOop oopFactory::new_compiledICHolder(methodHandle method, KlassHandle klass, TRAPS) { |
duke@435 | 151 | compiledICHolderKlass* ck = (compiledICHolderKlass*) Universe::compiledICHolderKlassObj()->klass_part(); |
duke@435 | 152 | compiledICHolderOop c = ck->allocate(CHECK_NULL); |
duke@435 | 153 | c->set_holder_method(method()); |
duke@435 | 154 | c->set_holder_klass(klass()); |
duke@435 | 155 | return c; |
duke@435 | 156 | } |