1 /* 2 * Copyright (c) 2018, 2021, 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 * 23 */ 24 25 #ifndef SHARE_RUNTIME_FIELDDESCRIPTOR_INLINE_HPP 26 #define SHARE_RUNTIME_FIELDDESCRIPTOR_INLINE_HPP 27 28 #include "runtime/fieldDescriptor.hpp" 29 30 #include "runtime/handles.inline.hpp" 31 #include "runtime/signature.hpp" 32 33 // All fieldDescriptor inline functions that (directly or indirectly) use "_cp()" or "_cp->" 34 // must be put in this file, as they require runtime/handles.inline.hpp. 35 36 inline Symbol* fieldDescriptor::name() const { 37 return field()->name(_cp()); 38 } 39 40 inline Symbol* fieldDescriptor::signature() const { 41 return field()->signature(_cp()); 42 } 43 44 inline InstanceKlass* fieldDescriptor::field_holder() const { 45 return _cp->pool_holder(); 46 } 47 48 inline ConstantPool* fieldDescriptor::constants() const { 49 return _cp(); 50 } 51 52 inline FieldInfo* fieldDescriptor::field() const { 53 InstanceKlass* ik = field_holder(); 54 return ik->field(_index); 55 } 56 57 inline int fieldDescriptor::offset() const { return field()->offset(); } 58 inline bool fieldDescriptor::has_initial_value() const { return field()->initval_index() != 0; } 59 inline int fieldDescriptor::initial_value_index() const { return field()->initval_index(); } 60 61 inline void fieldDescriptor::update_klass_field_access_flag() { 62 InstanceKlass* ik = field_holder(); 63 ik->field(index())->set_access_flags(_access_flags.as_short()); 64 } 65 66 inline void fieldDescriptor::set_is_field_access_watched(const bool value) { 67 _access_flags.set_is_field_access_watched(value); 68 update_klass_field_access_flag(); 69 } 70 71 inline void fieldDescriptor::set_is_field_modification_watched(const bool value) { 72 _access_flags.set_is_field_modification_watched(value); 73 update_klass_field_access_flag(); 74 } 75 76 inline void fieldDescriptor::set_has_initialized_final_update(const bool value) { 77 _access_flags.set_has_field_initialized_final_update(value); 78 update_klass_field_access_flag(); 79 } 80 81 inline BasicType fieldDescriptor::field_type() const { 82 return Signature::basic_type(signature()); 83 } 84 85 inline bool fieldDescriptor::is_inlined() const { return field()->is_inlined(); } 86 inline bool fieldDescriptor::is_inline_type() const { return Signature::basic_type(field()->signature(_cp())) == T_PRIMITIVE_OBJECT; } 87 88 #endif // SHARE_RUNTIME_FIELDDESCRIPTOR_INLINE_HPP