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