1 /*
2 * Copyright (c) 1998, 2013, 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 *
329 int constant_pool_index() const { return (indices() & cp_index_mask); }
330 Bytecodes::Code bytecode_1() const { return Bytecodes::cast((indices_ord() >> bytecode_1_shift) & bytecode_1_mask); }
331 Bytecodes::Code bytecode_2() const { return Bytecodes::cast((indices_ord() >> bytecode_2_shift) & bytecode_2_mask); }
332 Metadata* f1_ord() const { return (Metadata *)OrderAccess::load_ptr_acquire(&_f1); }
333 Method* f1_as_method() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_method(), ""); return (Method*)f1; }
334 Klass* f1_as_klass() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_klass(), ""); return (Klass*)f1; }
335 // Use the accessor f1() to acquire _f1's value. This is needed for
336 // example in BytecodeInterpreter::run(), where is_f1_null() is
337 // called to check if an invokedynamic call is resolved. This load
338 // of _f1 must be ordered with the loads performed by
339 // cache->main_entry_index().
340 bool is_f1_null() const { Metadata* f1 = f1_ord(); return f1 == NULL; } // classifies a CPC entry as unbound
341 int f2_as_index() const { assert(!is_vfinal(), ""); return (int) _f2; }
342 Method* f2_as_vfinal_method() const { assert(is_vfinal(), ""); return (Method*)_f2; }
343 int field_index() const { assert(is_field_entry(), ""); return (_flags & field_index_mask); }
344 int parameter_size() const { assert(is_method_entry(), ""); return (_flags & parameter_size_mask); }
345 bool is_volatile() const { return (_flags & (1 << is_volatile_shift)) != 0; }
346 bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; }
347 bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; }
348 bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; }
349 bool has_appendix() const { return (_flags & (1 << has_appendix_shift)) != 0; }
350 bool has_method_type() const { return (_flags & (1 << has_method_type_shift)) != 0; }
351 bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; }
352 bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; }
353 bool is_byte() const { return flag_state() == btos; }
354 bool is_char() const { return flag_state() == ctos; }
355 bool is_short() const { return flag_state() == stos; }
356 bool is_int() const { return flag_state() == itos; }
357 bool is_long() const { return flag_state() == ltos; }
358 bool is_float() const { return flag_state() == ftos; }
359 bool is_double() const { return flag_state() == dtos; }
360 bool is_object() const { return flag_state() == atos; }
361 TosState flag_state() const { assert((uint)number_of_states <= (uint)tos_state_mask+1, "");
362 return (TosState)((_flags >> tos_state_shift) & tos_state_mask); }
363
364 // Code generation support
365 static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / HeapWordSize); }
366 static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
367 static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
368 static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
369 static ByteSize f2_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f2); }
370 static ByteSize flags_offset() { return byte_offset_of(ConstantPoolCacheEntry, _flags); }
|
1 /*
2 * Copyright (c) 1998, 2014, 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 *
329 int constant_pool_index() const { return (indices() & cp_index_mask); }
330 Bytecodes::Code bytecode_1() const { return Bytecodes::cast((indices_ord() >> bytecode_1_shift) & bytecode_1_mask); }
331 Bytecodes::Code bytecode_2() const { return Bytecodes::cast((indices_ord() >> bytecode_2_shift) & bytecode_2_mask); }
332 Metadata* f1_ord() const { return (Metadata *)OrderAccess::load_ptr_acquire(&_f1); }
333 Method* f1_as_method() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_method(), ""); return (Method*)f1; }
334 Klass* f1_as_klass() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_klass(), ""); return (Klass*)f1; }
335 // Use the accessor f1() to acquire _f1's value. This is needed for
336 // example in BytecodeInterpreter::run(), where is_f1_null() is
337 // called to check if an invokedynamic call is resolved. This load
338 // of _f1 must be ordered with the loads performed by
339 // cache->main_entry_index().
340 bool is_f1_null() const { Metadata* f1 = f1_ord(); return f1 == NULL; } // classifies a CPC entry as unbound
341 int f2_as_index() const { assert(!is_vfinal(), ""); return (int) _f2; }
342 Method* f2_as_vfinal_method() const { assert(is_vfinal(), ""); return (Method*)_f2; }
343 int field_index() const { assert(is_field_entry(), ""); return (_flags & field_index_mask); }
344 int parameter_size() const { assert(is_method_entry(), ""); return (_flags & parameter_size_mask); }
345 bool is_volatile() const { return (_flags & (1 << is_volatile_shift)) != 0; }
346 bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; }
347 bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; }
348 bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; }
349 bool has_appendix() const { return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0; }
350 bool has_method_type() const { return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0; }
351 bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; }
352 bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; }
353 bool is_byte() const { return flag_state() == btos; }
354 bool is_char() const { return flag_state() == ctos; }
355 bool is_short() const { return flag_state() == stos; }
356 bool is_int() const { return flag_state() == itos; }
357 bool is_long() const { return flag_state() == ltos; }
358 bool is_float() const { return flag_state() == ftos; }
359 bool is_double() const { return flag_state() == dtos; }
360 bool is_object() const { return flag_state() == atos; }
361 TosState flag_state() const { assert((uint)number_of_states <= (uint)tos_state_mask+1, "");
362 return (TosState)((_flags >> tos_state_shift) & tos_state_mask); }
363
364 // Code generation support
365 static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / HeapWordSize); }
366 static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
367 static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
368 static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
369 static ByteSize f2_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f2); }
370 static ByteSize flags_offset() { return byte_offset_of(ConstantPoolCacheEntry, _flags); }
|