comparison src/share/vm/interpreter/bytecode.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 1d7922586cf6
children
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "interpreter/bytecode.hpp" 26 #include "interpreter/bytecode.hpp"
27 #include "interpreter/linkResolver.hpp" 27 #include "interpreter/linkResolver.hpp"
28 #include "oops/constantPoolOop.hpp" 28 #include "oops/constantPool.hpp"
29 #include "oops/oop.inline.hpp" 29 #include "oops/oop.inline.hpp"
30 #include "runtime/fieldType.hpp" 30 #include "runtime/fieldType.hpp"
31 #include "runtime/handles.inline.hpp" 31 #include "runtime/handles.inline.hpp"
32 #include "runtime/safepoint.hpp" 32 #include "runtime/safepoint.hpp"
33 #include "runtime/signature.hpp" 33 #include "runtime/signature.hpp"
157 } 157 }
158 158
159 Handle Bytecode_invoke::appendix(TRAPS) { 159 Handle Bytecode_invoke::appendix(TRAPS) {
160 ConstantPoolCacheEntry* cpce = cpcache_entry(); 160 ConstantPoolCacheEntry* cpce = cpcache_entry();
161 if (cpce->has_appendix()) 161 if (cpce->has_appendix())
162 return Handle(THREAD, cpce->f1_appendix()); 162 return Handle(THREAD, cpce->appendix_if_resolved(constants()));
163 return Handle(); // usual case 163 return Handle(); // usual case
164 } 164 }
165 165
166 int Bytecode_member_ref::index() const { 166 int Bytecode_member_ref::index() const {
167 // Note: Rewriter::rewrite changes the Java_u2 of an invokedynamic to a native_u4, 167 // Note: Rewriter::rewrite changes the Java_u2 of an invokedynamic to a native_u4,
177 return cpcache_entry()->constant_pool_index(); 177 return cpcache_entry()->constant_pool_index();
178 } 178 }
179 179
180 ConstantPoolCacheEntry* Bytecode_member_ref::cpcache_entry() const { 180 ConstantPoolCacheEntry* Bytecode_member_ref::cpcache_entry() const {
181 int index = this->index(); 181 int index = this->index();
182 DEBUG_ONLY({ 182 return cpcache()->entry_at(ConstantPool::decode_cpcache_index(index, true));
183 if (!has_index_u4(code()))
184 index = constantPoolOopDesc::get_cpcache_index(index);
185 });
186 return cpcache()->entry_at(index);
187 } 183 }
188 184
189 // Implementation of Bytecode_field 185 // Implementation of Bytecode_field
190 186
191 void Bytecode_field::verify() const { 187 void Bytecode_field::verify() const {
205 } 201 }
206 202
207 int Bytecode_loadconstant::pool_index() const { 203 int Bytecode_loadconstant::pool_index() const {
208 int index = raw_index(); 204 int index = raw_index();
209 if (has_cache_index()) { 205 if (has_cache_index()) {
210 return _method->constants()->cache()->entry_at(index)->constant_pool_index(); 206 return _method->constants()->object_to_cp_index(index);
211 } 207 }
212 return index; 208 return index;
213 } 209 }
214 210
215 BasicType Bytecode_loadconstant::result_type() const { 211 BasicType Bytecode_loadconstant::result_type() const {
219 } 215 }
220 216
221 oop Bytecode_loadconstant::resolve_constant(TRAPS) const { 217 oop Bytecode_loadconstant::resolve_constant(TRAPS) const {
222 assert(_method.not_null(), "must supply method to resolve constant"); 218 assert(_method.not_null(), "must supply method to resolve constant");
223 int index = raw_index(); 219 int index = raw_index();
224 constantPoolOop constants = _method->constants(); 220 ConstantPool* constants = _method->constants();
225 if (has_cache_index()) { 221 if (has_cache_index()) {
226 return constants->resolve_cached_constant_at(index, THREAD); 222 return constants->resolve_cached_constant_at(index, THREAD);
227 } else { 223 } else {
228 return constants->resolve_constant_at(index, THREAD); 224 return constants->resolve_constant_at(index, THREAD);
229 } 225 }