Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/SpeculationLog.java @ 23376:ae27c683c128
Make ResolvedJava* types extend AnnotatedElement.
Contributed-by: Vojin Jovanovic <vojin.jovanovic@oracle.com>
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Fri, 06 May 2016 13:21:20 +0200 |
parents | 39f25354aeee |
children |
rev | line source |
---|---|
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
23 package jdk.vm.ci.meta; |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 /** |
22699
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
26 * Manages unique deoptimization reasons. Reasons are embedded in compiled code and can be |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
27 * invalidated at run time. Subsequent compilations then should not speculate again on such |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
28 * invalidated reasons to avoid repeated deoptimization. |
19510
1cde96b96673
Fixed code format issues.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
29 * |
22699
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
30 * All methods of this interface are called by the compiler. There is no need for API to register |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
31 * failed speculations during deoptimization, since every VM has different needs there. |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 */ |
22699
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
33 public interface SpeculationLog { |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 |
22699
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
35 /** |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
36 * Marker interface for speculation objects that can be added to the speculation log. |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
37 */ |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
38 public interface SpeculationReason { |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 } |
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 |
22699
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
41 /** |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
42 * Must be called before compilation, i.e., before a compiler calls {@link #maySpeculate}. |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
43 */ |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
44 void collectFailedSpeculations(); |
13673
bd94d77af2c1
SpeculationLog: split maySpeculate into maySpeculate (check only) and speculate (register)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13643
diff
changeset
|
45 |
22699
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
46 /** |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
47 * If this method returns true, the compiler is allowed to {@link #speculate} with the given |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
48 * reason. |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
49 */ |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
50 boolean maySpeculate(SpeculationReason reason); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13673
diff
changeset
|
51 |
22699
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
52 /** |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
53 * Registers a speculation that was performed by the compiler. |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
54 * |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
55 * @return A compiler constant encapsulating the provided reason. It is usually passed as an |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
56 * argument to the deoptimization function. |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
57 */ |
ea58bbafd5b9
Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22672
diff
changeset
|
58 JavaConstant speculate(SpeculationReason reason); |
23346
39f25354aeee
Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22699
diff
changeset
|
59 |
39f25354aeee
Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22699
diff
changeset
|
60 /** |
39f25354aeee
Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22699
diff
changeset
|
61 * Returns if this log has speculations. |
39f25354aeee
Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22699
diff
changeset
|
62 * |
39f25354aeee
Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22699
diff
changeset
|
63 * @return true if there are speculations, false otherwise |
39f25354aeee
Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22699
diff
changeset
|
64 */ |
39f25354aeee
Sync speculation log changes with JDK9 version
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22699
diff
changeset
|
65 boolean hasSpeculations(); |
8217
dce9cefed571
Draft speculation log.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 } |