1 /*
2 * Copyright (c) 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 *
23 */
24
25 #ifndef SHARE_VM_RUNTIME_FIELDDESCRIPTOR_INLINE_HPP
26 #define SHARE_VM_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
name() const33 inline Symbol* fieldDescriptor::name() const {
34 return field()->name(_cp());
35 }
36
signature() const37 inline Symbol* fieldDescriptor::signature() const {
38 return field()->signature(_cp());
39 }
40
field_holder() const41 inline InstanceKlass* fieldDescriptor::field_holder() const {
42 return _cp->pool_holder();
43 }
44
constants() const45 inline ConstantPool* fieldDescriptor::constants() const {
46 return _cp();
47 }
48
field() const49 inline FieldInfo* fieldDescriptor::field() const {
50 InstanceKlass* ik = field_holder();
51 return ik->field(_index);
52 }
53
offset() const54 inline int fieldDescriptor::offset() const { return field()->offset(); }
has_initial_value() const55 inline bool fieldDescriptor::has_initial_value() const { return field()->initval_index() != 0; }
initial_value_index() const56 inline int fieldDescriptor::initial_value_index() const { return field()->initval_index(); }
57
update_klass_field_access_flag()58 inline 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
set_is_field_access_watched(const bool value)63 inline 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
set_is_field_modification_watched(const bool value)68 inline 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
set_has_initialized_final_update(const bool value)73 inline 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
field_type() const78 inline BasicType fieldDescriptor::field_type() const {
79 return FieldType::basic_type(signature());
80 }
81
82 #endif // SHARE_VM_RUNTIME_FIELDDESCRIPTOR_INLINE_HPP
83