Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub.java @ 20944:354b7f1b4acf
Truffle-DSL: fixed frame may be null for shared polymorphic execute methods.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 14 Apr 2015 19:23:32 +0200 |
parents | 2b392a92e27b |
children | 082417ac43e4 |
rev | line source |
---|---|
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot; |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
15456
bb97b75d1d65
AMD64: implemented DeoptimizationStub.deoptimizationHandler
twisti
parents:
15104
diff
changeset
|
25 import static com.oracle.graal.hotspot.HotSpotHostBackend.*; |
15104 | 26 |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.graal.api.code.*; |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 import com.oracle.graal.api.code.CompilationResult.Call; |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
29 import com.oracle.graal.api.code.CompilationResult.ConstantReference; |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.graal.api.code.CompilationResult.DataPatch; |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 import com.oracle.graal.api.code.CompilationResult.Infopoint; |
15085
9f1995f6d9a3
Keep metadata annotation in NewArrayStub, and add exception to stub invariants.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
32 import com.oracle.graal.hotspot.meta.*; |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 import com.oracle.graal.hotspot.stubs.*; |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 /** |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 * {@link HotSpotCompiledCode} destined for installation as a RuntimeStub. |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 */ |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 public final class HotSpotCompiledRuntimeStub extends HotSpotCompiledCode { |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 private static final long serialVersionUID = -4506206868419153274L; |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 public final String stubName; |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
44 public HotSpotCompiledRuntimeStub(Stub stub, CompilationResult compResult) { |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
45 super(compResult); |
15104 | 46 this.stubName = stub.toString(); |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 assert checkStubInvariants(compResult); |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 } |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 /** |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 * Checks the conditions a compilation must satisfy to be installed as a RuntimeStub. |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 */ |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 private boolean checkStubInvariants(CompilationResult compResult) { |
19319
5664cadb3cee
don't record method dependencies for snippets, stubs or replacements
Doug Simon <doug.simon@oracle.com>
parents:
18539
diff
changeset
|
54 assert compResult.getExceptionHandlers().isEmpty() : this; |
5664cadb3cee
don't record method dependencies for snippets, stubs or replacements
Doug Simon <doug.simon@oracle.com>
parents:
18539
diff
changeset
|
55 |
5664cadb3cee
don't record method dependencies for snippets, stubs or replacements
Doug Simon <doug.simon@oracle.com>
parents:
18539
diff
changeset
|
56 // Stubs cannot be recompiled so they cannot be compiled with |
5664cadb3cee
don't record method dependencies for snippets, stubs or replacements
Doug Simon <doug.simon@oracle.com>
parents:
18539
diff
changeset
|
57 // assumptions and there is no point in recording evol_method dependencies |
5664cadb3cee
don't record method dependencies for snippets, stubs or replacements
Doug Simon <doug.simon@oracle.com>
parents:
18539
diff
changeset
|
58 assert compResult.getAssumptions().isEmpty() : "stubs should not use assumptions: " + this; |
19346
2b392a92e27b
made it explicit that a StructuredGraph only records method dependencies for inlined methods - the root method is not recorded as it is already available in the 'method' field
Doug Simon <doug.simon@oracle.com>
parents:
19319
diff
changeset
|
59 assert compResult.getMethods() == null : "stubs should not record evol_method dependencies: " + this; |
19319
5664cadb3cee
don't record method dependencies for snippets, stubs or replacements
Doug Simon <doug.simon@oracle.com>
parents:
18539
diff
changeset
|
60 |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
61 for (DataPatch data : compResult.getDataPatches()) { |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
62 if (data.reference instanceof ConstantReference) { |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
63 ConstantReference ref = (ConstantReference) data.reference; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
64 if (ref.getConstant() instanceof HotSpotMetaspaceConstant) { |
18296
a6e7531d3dd3
made HotSpotMetaspaceConstantImpl.forMetaspaceObject and HotSpotMetaspaceConstantImpl.getMetaspaceObject package private
Doug Simon <doug.simon@oracle.com>
parents:
18266
diff
changeset
|
65 HotSpotMetaspaceConstant c = (HotSpotMetaspaceConstant) ref.getConstant(); |
a6e7531d3dd3
made HotSpotMetaspaceConstantImpl.forMetaspaceObject and HotSpotMetaspaceConstantImpl.getMetaspaceObject package private
Doug Simon <doug.simon@oracle.com>
parents:
18266
diff
changeset
|
66 if (c.asResolvedJavaType() != null && c.asResolvedJavaType().getName().equals("[I")) { |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
67 // special handling for NewArrayStub |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
68 // embedding the type '[I' is safe, since it is never unloaded |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
69 continue; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
70 } |
15085
9f1995f6d9a3
Keep metadata annotation in NewArrayStub, and add exception to stub invariants.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
71 } |
9f1995f6d9a3
Keep metadata annotation in NewArrayStub, and add exception to stub invariants.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
72 } |
9f1995f6d9a3
Keep metadata annotation in NewArrayStub, and add exception to stub invariants.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
73 |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15456
diff
changeset
|
74 assert !(data.reference instanceof ConstantReference) : this + " cannot have embedded object or metadata constant: " + data.reference; |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 } |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 for (Infopoint infopoint : compResult.getInfopoints()) { |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 assert infopoint instanceof Call : this + " cannot have non-call infopoint: " + infopoint; |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 Call call = (Call) infopoint; |
9740
c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
79 assert call.target instanceof HotSpotForeignCallLinkage : this + " cannot have non runtime call: " + call.target; |
c4b1aa93b9af
rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9693
diff
changeset
|
80 HotSpotForeignCallLinkage linkage = (HotSpotForeignCallLinkage) call.target; |
18539
3b7dbb34bd9e
replaced use of == with .equals()
Doug Simon <doug.simon@oracle.com>
parents:
18296
diff
changeset
|
81 assert !linkage.isCompiledStub() || linkage.getDescriptor().equals(UNCOMMON_TRAP_HANDLER) : this + " cannot call compiled stub " + linkage; |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 } |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 return true; |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 } |
15104 | 85 |
86 @Override | |
87 public String toString() { | |
88 return stubName != null ? stubName : super.toString(); | |
89 } | |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 } |