1 /*
2 * Copyright (c) 1997, 2017, 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 *
183 bool on_stack() const { return (_flags &_on_stack) != 0; }
184 void set_on_stack(const bool value);
185
186 // Klass holding pool
187 InstanceKlass* pool_holder() const { return _pool_holder; }
188 void set_pool_holder(InstanceKlass* k) { _pool_holder = k; }
189 InstanceKlass** pool_holder_addr() { return &_pool_holder; }
190
191 // Interpreter runtime support
192 ConstantPoolCache* cache() const { return _cache; }
193 void set_cache(ConstantPoolCache* cache){ _cache = cache; }
194
195 // Create object cache in the constant pool
196 void initialize_resolved_references(ClassLoaderData* loader_data,
197 intStack reference_map,
198 int constant_pool_map_length,
199 TRAPS);
200
201 // resolved strings, methodHandles and callsite objects from the constant pool
202 objArrayOop resolved_references() const;
203 // mapping resolved object array indexes to cp indexes and back.
204 int object_to_cp_index(int index) { return _reference_map->at(index); }
205 int cp_to_object_index(int index);
206
207 // Invokedynamic indexes.
208 // They must look completely different from normal indexes.
209 // The main reason is that byte swapping is sometimes done on normal indexes.
210 // Finally, it is helpful for debugging to tell the two apart.
211 static bool is_invokedynamic_index(int i) { return (i < 0); }
212 static int decode_invokedynamic_index(int i) { assert(is_invokedynamic_index(i), ""); return ~i; }
213 static int encode_invokedynamic_index(int i) { assert(!is_invokedynamic_index(i), ""); return ~i; }
214
215
216 // The invokedynamic points at a CP cache entry. This entry points back
217 // at the original CP entry (CONSTANT_InvokeDynamic) and also (via f2) at an entry
218 // in the resolved_references array (which provides the appendix argument).
219 int invokedynamic_cp_cache_index(int index) const {
220 assert (is_invokedynamic_index(index), "should be a invokedynamic index");
221 int cache_index = decode_invokedynamic_index(index);
222 return cache_index;
|
1 /*
2 * Copyright (c) 1997, 2018, 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 *
183 bool on_stack() const { return (_flags &_on_stack) != 0; }
184 void set_on_stack(const bool value);
185
186 // Klass holding pool
187 InstanceKlass* pool_holder() const { return _pool_holder; }
188 void set_pool_holder(InstanceKlass* k) { _pool_holder = k; }
189 InstanceKlass** pool_holder_addr() { return &_pool_holder; }
190
191 // Interpreter runtime support
192 ConstantPoolCache* cache() const { return _cache; }
193 void set_cache(ConstantPoolCache* cache){ _cache = cache; }
194
195 // Create object cache in the constant pool
196 void initialize_resolved_references(ClassLoaderData* loader_data,
197 intStack reference_map,
198 int constant_pool_map_length,
199 TRAPS);
200
201 // resolved strings, methodHandles and callsite objects from the constant pool
202 objArrayOop resolved_references() const;
203 objArrayOop resolved_references_or_null() const;
204 // mapping resolved object array indexes to cp indexes and back.
205 int object_to_cp_index(int index) { return _reference_map->at(index); }
206 int cp_to_object_index(int index);
207
208 // Invokedynamic indexes.
209 // They must look completely different from normal indexes.
210 // The main reason is that byte swapping is sometimes done on normal indexes.
211 // Finally, it is helpful for debugging to tell the two apart.
212 static bool is_invokedynamic_index(int i) { return (i < 0); }
213 static int decode_invokedynamic_index(int i) { assert(is_invokedynamic_index(i), ""); return ~i; }
214 static int encode_invokedynamic_index(int i) { assert(!is_invokedynamic_index(i), ""); return ~i; }
215
216
217 // The invokedynamic points at a CP cache entry. This entry points back
218 // at the original CP entry (CONSTANT_InvokeDynamic) and also (via f2) at an entry
219 // in the resolved_references array (which provides the appendix argument).
220 int invokedynamic_cp_cache_index(int index) const {
221 assert (is_invokedynamic_index(index), "should be a invokedynamic index");
222 int cache_index = decode_invokedynamic_index(index);
223 return cache_index;
|