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_CLASSFILE_JAVACLASSES_HPP
26 #define SHARE_VM_CLASSFILE_JAVACLASSES_HPP
27
28 #include "classfile/systemDictionary.hpp"
29 #include "jvmtifiles/jvmti.h"
30 #include "oops/oop.hpp"
31 #include "runtime/os.hpp"
32 #include "utilities/utf8.hpp"
33
34 // Interface for manipulating the basic Java classes.
35 //
36 // All dependencies on layout of actual Java classes should be kept here.
37 // If the layout of any of the classes above changes the offsets must be adjusted.
38 //
39 // For most classes we hardwire the offsets for performance reasons. In certain
40 // cases (e.g. java.security.AccessControlContext) we compute the offsets at
41 // startup since the layout here differs between JDK1.2 and JDK1.3.
42 //
43 // Note that fields (static and non-static) are arranged with oops before non-oops
44 // on a per class basis. The offsets below have to reflect this ordering.
45 //
46 // When editing the layouts please update the check_offset verification code
47 // correspondingly. The names in the enums must be identical to the actual field
48 // names in order for the verification code to work.
49
50
1006 static int _vmindex_offset;
1007
1008 static void compute_offsets();
1009
1010 public:
1011 // Accessors
1012 static oop clazz(oop mname);
1013 static void set_clazz(oop mname, oop clazz);
1014
1015 static oop type(oop mname);
1016 static void set_type(oop mname, oop type);
1017
1018 static oop name(oop mname);
1019 static void set_name(oop mname, oop name);
1020
1021 static int flags(oop mname);
1022 static void set_flags(oop mname, int flags);
1023
1024 static oop vmtarget(oop mname);
1025 static void set_vmtarget(oop mname, oop target);
1026 static void adjust_vmtarget(oop mname, oop target);
1027
1028 static intptr_t vmindex(oop mname);
1029 static void set_vmindex(oop mname, intptr_t index);
1030
1031 // Testers
1032 static bool is_subclass(klassOop klass) {
1033 return Klass::cast(klass)->is_subclass_of(SystemDictionary::MemberName_klass());
1034 }
1035 static bool is_instance(oop obj) {
1036 return obj != NULL && is_subclass(obj->klass());
1037 }
1038
1039 // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1040 enum {
1041 MN_IS_METHOD = 0x00010000, // method (not constructor)
1042 MN_IS_CONSTRUCTOR = 0x00020000, // constructor
1043 MN_IS_FIELD = 0x00040000, // field
1044 MN_IS_TYPE = 0x00080000, // nested type
1045 MN_REFERENCE_KIND_SHIFT = 24, // refKind
1046 MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1047 // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1048 MN_SEARCH_SUPERCLASSES = 0x00100000, // walk super classes
1049 MN_SEARCH_INTERFACES = 0x00200000 // walk implemented interfaces
1050 };
1051
1052 // Accessors for code generation:
1053 static int clazz_offset_in_bytes() { return _clazz_offset; }
1054 static int type_offset_in_bytes() { return _type_offset; }
1055 static int name_offset_in_bytes() { return _name_offset; }
1056 static int flags_offset_in_bytes() { return _flags_offset; }
1057 static int vmtarget_offset_in_bytes() { return _vmtarget_offset; }
1058 static int vmindex_offset_in_bytes() { return _vmindex_offset; }
|
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_CLASSFILE_JAVACLASSES_HPP
26 #define SHARE_VM_CLASSFILE_JAVACLASSES_HPP
27
28 #include "classfile/systemDictionary.hpp"
29 #include "jvmtifiles/jvmti.h"
30 #include "oops/oop.hpp"
31 #include "oops/methodOop.hpp"
32 #include "runtime/os.hpp"
33 #include "utilities/utf8.hpp"
34
35 // Interface for manipulating the basic Java classes.
36 //
37 // All dependencies on layout of actual Java classes should be kept here.
38 // If the layout of any of the classes above changes the offsets must be adjusted.
39 //
40 // For most classes we hardwire the offsets for performance reasons. In certain
41 // cases (e.g. java.security.AccessControlContext) we compute the offsets at
42 // startup since the layout here differs between JDK1.2 and JDK1.3.
43 //
44 // Note that fields (static and non-static) are arranged with oops before non-oops
45 // on a per class basis. The offsets below have to reflect this ordering.
46 //
47 // When editing the layouts please update the check_offset verification code
48 // correspondingly. The names in the enums must be identical to the actual field
49 // names in order for the verification code to work.
50
51
1007 static int _vmindex_offset;
1008
1009 static void compute_offsets();
1010
1011 public:
1012 // Accessors
1013 static oop clazz(oop mname);
1014 static void set_clazz(oop mname, oop clazz);
1015
1016 static oop type(oop mname);
1017 static void set_type(oop mname, oop type);
1018
1019 static oop name(oop mname);
1020 static void set_name(oop mname, oop name);
1021
1022 static int flags(oop mname);
1023 static void set_flags(oop mname, int flags);
1024
1025 static oop vmtarget(oop mname);
1026 static void set_vmtarget(oop mname, oop target);
1027 static void adjust_vmtarget(oop mname, methodOop old_method, methodOop new_method,
1028 bool* trace_name_printed);
1029
1030 static intptr_t vmindex(oop mname);
1031 static void set_vmindex(oop mname, intptr_t index);
1032
1033 // Testers
1034 static bool is_subclass(klassOop klass) {
1035 return Klass::cast(klass)->is_subclass_of(SystemDictionary::MemberName_klass());
1036 }
1037 static bool is_instance(oop obj) {
1038 return obj != NULL && is_subclass(obj->klass());
1039 }
1040
1041 static bool is_method(oop obj);
1042
1043 // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
1044 enum {
1045 MN_IS_METHOD = 0x00010000, // method (not constructor)
1046 MN_IS_CONSTRUCTOR = 0x00020000, // constructor
1047 MN_IS_FIELD = 0x00040000, // field
1048 MN_IS_TYPE = 0x00080000, // nested type
1049 MN_REFERENCE_KIND_SHIFT = 24, // refKind
1050 MN_REFERENCE_KIND_MASK = 0x0F000000 >> MN_REFERENCE_KIND_SHIFT,
1051 // The SEARCH_* bits are not for MN.flags but for the matchFlags argument of MHN.getMembers:
1052 MN_SEARCH_SUPERCLASSES = 0x00100000, // walk super classes
1053 MN_SEARCH_INTERFACES = 0x00200000 // walk implemented interfaces
1054 };
1055
1056 // Accessors for code generation:
1057 static int clazz_offset_in_bytes() { return _clazz_offset; }
1058 static int type_offset_in_bytes() { return _type_offset; }
1059 static int name_offset_in_bytes() { return _name_offset; }
1060 static int flags_offset_in_bytes() { return _flags_offset; }
1061 static int vmtarget_offset_in_bytes() { return _vmtarget_offset; }
1062 static int vmindex_offset_in_bytes() { return _vmindex_offset; }
|