1 /*
2 * Copyright (c) 2000, 2016, 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 *
54 private static CIntegerField nmethodEndOffsetField;
55
56 /** Offsets for entry points */
57 /** Entry point with class check */
58 private static AddressField entryPointField;
59 /** Entry point without class check */
60 private static AddressField verifiedEntryPointField;
61 /** Entry point for on stack replacement */
62 private static AddressField osrEntryPointField;
63
64 // FIXME: add access to flags (how?)
65
66 /** NMethod Flushing lock (if non-zero, then the nmethod is not removed) */
67 private static JIntField lockCountField;
68
69 /** not_entrant method removal. Each mark_sweep pass will update
70 this mark to current sweep invocation count if it is seen on the
71 stack. An not_entrant method can be removed when there is no
72 more activations, i.e., when the _stack_traversal_mark is less than
73 current sweep traversal index. */
74 private static JLongField stackTraversalMarkField;
75
76 private static CIntegerField compLevelField;
77
78 static {
79 VM.registerVMInitializedObserver(new Observer() {
80 public void update(Observable o, Object data) {
81 initialize(VM.getVM().getTypeDataBase());
82 }
83 });
84 }
85
86 private static void initialize(TypeDataBase db) {
87 Type type = db.lookupType("nmethod");
88
89 entryBCIField = type.getCIntegerField("_entry_bci");
90 osrLinkField = type.getAddressField("_osr_link");
91 scavengeRootLinkField = type.getAddressField("_scavenge_root_link");
92 scavengeRootStateField = type.getJByteField("_scavenge_root_state");
93
94 exceptionOffsetField = type.getCIntegerField("_exception_offset");
95 origPCOffsetField = type.getCIntegerField("_orig_pc_offset");
96 stubOffsetField = type.getCIntegerField("_stub_offset");
97 oopsOffsetField = type.getCIntegerField("_oops_offset");
98 metadataOffsetField = type.getCIntegerField("_metadata_offset");
99 scopesPCsOffsetField = type.getCIntegerField("_scopes_pcs_offset");
100 dependenciesOffsetField = type.getCIntegerField("_dependencies_offset");
101 handlerTableOffsetField = type.getCIntegerField("_handler_table_offset");
102 nulChkTableOffsetField = type.getCIntegerField("_nul_chk_table_offset");
103 nmethodEndOffsetField = type.getCIntegerField("_nmethod_end_offset");
104 entryPointField = type.getAddressField("_entry_point");
105 verifiedEntryPointField = type.getAddressField("_verified_entry_point");
106 osrEntryPointField = type.getAddressField("_osr_entry_point");
107 lockCountField = type.getJIntField("_lock_count");
108 stackTraversalMarkField = type.getJLongField("_stack_traversal_mark");
109 compLevelField = type.getCIntegerField("_comp_level");
110 pcDescSize = db.lookupType("PcDesc").getSize();
111 }
112
113 public NMethod(Address addr) {
114 super(addr);
115 }
116
117 // Accessors
118 public Address getAddress() {
119 return addr;
120 }
121
122 // Type info
123 public boolean isNMethod() { return true; }
124 public boolean isJavaMethod() { return !getMethod().isNative(); }
125 public boolean isNativeMethod() { return getMethod().isNative(); }
126 public boolean isOSRMethod() { return getEntryBCI() != VM.getVM().getInvocationEntryBCI(); }
127
128 /** Boundaries for different parts */
|
1 /*
2 * Copyright (c) 2000, 2017, 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 *
54 private static CIntegerField nmethodEndOffsetField;
55
56 /** Offsets for entry points */
57 /** Entry point with class check */
58 private static AddressField entryPointField;
59 /** Entry point without class check */
60 private static AddressField verifiedEntryPointField;
61 /** Entry point for on stack replacement */
62 private static AddressField osrEntryPointField;
63
64 // FIXME: add access to flags (how?)
65
66 /** NMethod Flushing lock (if non-zero, then the nmethod is not removed) */
67 private static JIntField lockCountField;
68
69 /** not_entrant method removal. Each mark_sweep pass will update
70 this mark to current sweep invocation count if it is seen on the
71 stack. An not_entrant method can be removed when there is no
72 more activations, i.e., when the _stack_traversal_mark is less than
73 current sweep traversal index. */
74 private static CIntegerField stackTraversalMarkField;
75
76 private static CIntegerField compLevelField;
77
78 static {
79 VM.registerVMInitializedObserver(new Observer() {
80 public void update(Observable o, Object data) {
81 initialize(VM.getVM().getTypeDataBase());
82 }
83 });
84 }
85
86 private static void initialize(TypeDataBase db) {
87 Type type = db.lookupType("nmethod");
88
89 entryBCIField = type.getCIntegerField("_entry_bci");
90 osrLinkField = type.getAddressField("_osr_link");
91 scavengeRootLinkField = type.getAddressField("_scavenge_root_link");
92 scavengeRootStateField = type.getJByteField("_scavenge_root_state");
93
94 exceptionOffsetField = type.getCIntegerField("_exception_offset");
95 origPCOffsetField = type.getCIntegerField("_orig_pc_offset");
96 stubOffsetField = type.getCIntegerField("_stub_offset");
97 oopsOffsetField = type.getCIntegerField("_oops_offset");
98 metadataOffsetField = type.getCIntegerField("_metadata_offset");
99 scopesPCsOffsetField = type.getCIntegerField("_scopes_pcs_offset");
100 dependenciesOffsetField = type.getCIntegerField("_dependencies_offset");
101 handlerTableOffsetField = type.getCIntegerField("_handler_table_offset");
102 nulChkTableOffsetField = type.getCIntegerField("_nul_chk_table_offset");
103 nmethodEndOffsetField = type.getCIntegerField("_nmethod_end_offset");
104 entryPointField = type.getAddressField("_entry_point");
105 verifiedEntryPointField = type.getAddressField("_verified_entry_point");
106 osrEntryPointField = type.getAddressField("_osr_entry_point");
107 lockCountField = type.getJIntField("_lock_count");
108 stackTraversalMarkField = type.getCIntegerField("_stack_traversal_mark");
109 compLevelField = type.getCIntegerField("_comp_level");
110 pcDescSize = db.lookupType("PcDesc").getSize();
111 }
112
113 public NMethod(Address addr) {
114 super(addr);
115 }
116
117 // Accessors
118 public Address getAddress() {
119 return addr;
120 }
121
122 // Type info
123 public boolean isNMethod() { return true; }
124 public boolean isJavaMethod() { return !getMethod().isNative(); }
125 public boolean isNativeMethod() { return getMethod().isNative(); }
126 public boolean isOSRMethod() { return getEntryBCI() != VM.getVM().getInvocationEntryBCI(); }
127
128 /** Boundaries for different parts */
|