Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java @ 22780:b4ff1a18d19c
Move data fields from CompiledCode to HotSpotCompiledCode
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Tue, 19 Jan 2016 17:36:21 -0800 |
parents | 9273bb6ba33e |
children | 5d06abd6d35b |
comparison
equal
deleted
inserted
replaced
22779:b41377216cf9 | 22780:b4ff1a18d19c |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package jdk.vm.ci.hotspot; | 23 package jdk.vm.ci.hotspot; |
24 | 24 |
25 import jdk.vm.ci.code.BytecodeFrame; | |
25 import jdk.vm.ci.code.CompiledCode; | 26 import jdk.vm.ci.code.CompiledCode; |
26 import jdk.vm.ci.code.site.DataPatch; | 27 import jdk.vm.ci.code.site.DataPatch; |
28 import jdk.vm.ci.code.site.Infopoint; | |
27 import jdk.vm.ci.code.site.Site; | 29 import jdk.vm.ci.code.site.Site; |
28 import jdk.vm.ci.meta.Assumptions.Assumption; | 30 import jdk.vm.ci.meta.Assumptions.Assumption; |
29 import jdk.vm.ci.meta.ResolvedJavaMethod; | 31 import jdk.vm.ci.meta.ResolvedJavaMethod; |
30 | 32 |
31 /** | 33 /** |
32 * A {@link CompiledCode} with additional HotSpot-specific information required for installing the | 34 * A {@link CompiledCode} with additional HotSpot-specific information required for installing the |
33 * code in HotSpot's code cache. | 35 * code in HotSpot's code cache. |
34 */ | 36 */ |
35 public class HotSpotCompiledCode extends CompiledCode { | 37 public class HotSpotCompiledCode implements CompiledCode { |
38 | |
39 /** | |
40 * The name of this compilation unit. | |
41 */ | |
42 protected final String name; | |
43 | |
44 /** | |
45 * The buffer containing the emitted machine code. | |
46 */ | |
47 protected final byte[] targetCode; | |
48 | |
49 /** | |
50 * The leading number of bytes in {@link #targetCode} containing the emitted machine code. | |
51 */ | |
52 protected final int targetCodeSize; | |
53 | |
54 /** | |
55 * A list of code annotations describing special sites in {@link #targetCode}. | |
56 */ | |
57 protected final Site[] sites; | |
58 | |
59 /** | |
60 * A list of {@link Assumption} this code relies on. | |
61 */ | |
62 protected final Assumption[] assumptions; | |
63 | |
64 /** | |
65 * The list of the methods whose bytecodes were used as input to the compilation. If | |
66 * {@code null}, then the compilation did not record method dependencies. Otherwise, the first | |
67 * element of this array is the root method of the compilation. | |
68 */ | |
69 protected final ResolvedJavaMethod[] methods; | |
36 | 70 |
37 protected final Comment[] comments; | 71 protected final Comment[] comments; |
38 | 72 |
39 protected final byte[] dataSection; | 73 protected final byte[] dataSection; |
40 protected final int dataSectionAlignment; | 74 protected final int dataSectionAlignment; |
54 } | 88 } |
55 } | 89 } |
56 | 90 |
57 public HotSpotCompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection, | 91 public HotSpotCompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection, |
58 int dataSectionAlignment, DataPatch[] dataSectionPatches, int totalFrameSize, int customStackAreaOffset) { | 92 int dataSectionAlignment, DataPatch[] dataSectionPatches, int totalFrameSize, int customStackAreaOffset) { |
59 super(name, targetCode, targetCodeSize, sites, assumptions, methods); | 93 this.name = name; |
94 this.targetCode = targetCode; | |
95 this.targetCodeSize = targetCodeSize; | |
96 this.sites = sites; | |
97 this.assumptions = assumptions; | |
98 this.methods = methods; | |
99 | |
60 this.comments = comments; | 100 this.comments = comments; |
61 this.dataSection = dataSection; | 101 this.dataSection = dataSection; |
62 this.dataSectionAlignment = dataSectionAlignment; | 102 this.dataSectionAlignment = dataSectionAlignment; |
63 this.dataSectionPatches = dataSectionPatches; | 103 this.dataSectionPatches = dataSectionPatches; |
64 this.totalFrameSize = totalFrameSize; | 104 this.totalFrameSize = totalFrameSize; |
65 this.customStackAreaOffset = customStackAreaOffset; | 105 this.customStackAreaOffset = customStackAreaOffset; |
106 | |
107 assert validateFrames(); | |
108 } | |
109 | |
110 public String getName() { | |
111 return name; | |
112 } | |
113 | |
114 @Override | |
115 public String toString() { | |
116 return name; | |
117 } | |
118 | |
119 /** | |
120 * Ensure that all the frames passed into the VM are properly formatted with an empty or illegal | |
121 * slot following double word slots. | |
122 */ | |
123 private boolean validateFrames() { | |
124 for (Site site : sites) { | |
125 if (site instanceof Infopoint) { | |
126 Infopoint info = (Infopoint) site; | |
127 if (info.debugInfo != null) { | |
128 BytecodeFrame frame = info.debugInfo.frame(); | |
129 assert frame == null || frame.validateFormat(); | |
130 } | |
131 } | |
132 } | |
133 return true; | |
66 } | 134 } |
67 } | 135 } |