annotate jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/InstalledCode.java @ 24218:719853999215 jvmci-0.32

Merge with jdk8u141-b15
author Doug Simon <doug.simon@oracle.com>
date Mon, 14 Aug 2017 23:20:38 +0200
parents 088d24f0be35
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
1 /*
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
4 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
7 * published by the Free Software Foundation.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
8 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
13 * accompanied this code).
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
14 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
18 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
21 * questions.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
22 */
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22643
diff changeset
23 package jdk.vm.ci.code;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
24
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
25 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
26 * Represents a compiled instance of a method. It may have been invalidated or removed in the
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
27 * meantime.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
28 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
29 public class InstalledCode {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
30
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
31 /**
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
32 * Raw address address of entity representing this installed code.
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
33 */
22713
088d24f0be35 Remove setAddressAndEntryPoint
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22672
diff changeset
34 protected long address;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
35
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
36 /**
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
37 * Raw address of entryPoint of this installed code.
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
38 */
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
39 protected long entryPoint;
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
40
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
41 /**
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
42 * Counts how often the address field was reassigned.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
43 */
22713
088d24f0be35 Remove setAddressAndEntryPoint
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22672
diff changeset
44 protected long version;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
45
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
46 protected final String name;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
47
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
48 public InstalledCode(String name) {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
49 this.name = name;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
50 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
51
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
52 /**
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
53 * @return the address of entity representing this installed code.
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
54 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
55 public final long getAddress() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
56 return address;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
57 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
58
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
59 /**
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
60 * @return the address of the normal entry point of the installed code.
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
61 */
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
62 public final long getEntryPoint() {
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
63 return entryPoint;
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
64 }
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
65
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
66 /**
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
67 * @return the version number of this installed code
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
68 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
69 public final long getVersion() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
70 return version;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
71 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
72
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
73 /**
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
74 * Returns the name of this installed code.
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
75 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
76 public String getName() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
77 return name;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
78 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
79
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
80 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
81 * Returns the start address of this installed code if it is {@linkplain #isValid() valid}, 0
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
82 * otherwise.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
83 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
84 public long getStart() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
85 return 0;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
86 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
87
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
88 /**
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
89 * @return true if the code represented by this object is still valid for invocation, false
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
90 * otherwise (may happen due to deopt, etc.)
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
91 */
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
92 public boolean isValid() {
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
93 return entryPoint != 0;
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
94 }
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
95
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
96 /**
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
97 * @return true if the code represented by this object still exists and might have live
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
98 * activations, false otherwise (may happen due to deopt, etc.)
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
99 */
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
100 public boolean isAlive() {
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
101 return address != 0;
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
102 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
103
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
104 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
105 * Returns a copy of this installed code if it is {@linkplain #isValid() valid}, null otherwise.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
106 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
107 public byte[] getCode() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
108 return null;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
109 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
110
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
111 /**
22420
e3d9e0f9b50c cleaned up and added more javadoc to CompilerToVM (JDK-8133194)
Doug Simon <doug.simon@oracle.com>
parents: 22054
diff changeset
112 * Invalidates this installed code such that any subsequent
e3d9e0f9b50c cleaned up and added more javadoc to CompilerToVM (JDK-8133194)
Doug Simon <doug.simon@oracle.com>
parents: 22054
diff changeset
113 * {@linkplain #executeVarargs(Object...) invocation} will throw an
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
114 * {@link InvalidInstalledCodeException} and all existing invocations will be deoptimized.
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
115 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
116 public void invalidate() {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
117 throw new UnsupportedOperationException();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
118 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
119
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
120 /**
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
121 * Executes the installed code with a variable number of arguments.
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
122 *
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
123 * @param args the array of object arguments
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
124 * @return the value returned by the executed code
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
125 */
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
126 @SuppressWarnings("unused")
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
127 public Object executeVarargs(Object... args) throws InvalidInstalledCodeException {
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
128 throw new UnsupportedOperationException();
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
129 }
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents:
diff changeset
130 }