Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CompiledMethod.java
41171 views
1
/*
2
* Copyright (c) 2016, 2020, 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
package sun.jvm.hotspot.code;
24
25
import java.util.*;
26
27
import sun.jvm.hotspot.debugger.Address;
28
import sun.jvm.hotspot.oops.*;
29
import sun.jvm.hotspot.runtime.*;
30
import sun.jvm.hotspot.types.*;
31
import sun.jvm.hotspot.utilities.*;
32
import sun.jvm.hotspot.utilities.Observable;
33
import sun.jvm.hotspot.utilities.Observer;
34
35
public abstract class CompiledMethod extends CodeBlob {
36
private static AddressField methodField;
37
private static AddressField deoptHandlerBeginField;
38
private static AddressField deoptMhHandlerBeginField;
39
private static AddressField scopesDataBeginField;
40
41
static {
42
VM.registerVMInitializedObserver(new Observer() {
43
public void update(Observable o, Object data) {
44
initialize(VM.getVM().getTypeDataBase());
45
}
46
});
47
}
48
49
private static void initialize(TypeDataBase db) {
50
Type type = db.lookupType("CompiledMethod");
51
52
methodField = type.getAddressField("_method");
53
deoptHandlerBeginField = type.getAddressField("_deopt_handler_begin");
54
deoptMhHandlerBeginField = type.getAddressField("_deopt_mh_handler_begin");
55
scopesDataBeginField = type.getAddressField("_scopes_data_begin");
56
}
57
58
public CompiledMethod(Address addr) {
59
super(addr);
60
}
61
62
public Method getMethod() {
63
return (Method)Metadata.instantiateWrapperFor(methodField.getValue(addr));
64
}
65
66
public Address deoptHandlerBegin() { return deoptHandlerBeginField.getValue(addr); }
67
public Address deoptMhHandlerBegin() { return deoptMhHandlerBeginField.getValue(addr); }
68
public Address scopesDataBegin() { return scopesDataBeginField.getValue(addr); }
69
70
public static int getMethodOffset() { return (int) methodField.getOffset(); }
71
72
@Override
73
public boolean isCompiled() {
74
return true;
75
}
76
}
77
78