Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CompiledCode.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 | 1d4ce2d19e52 |
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.code; | 23 package jdk.vm.ci.code; |
24 | 24 |
25 import jdk.vm.ci.code.site.Infopoint; | |
26 import jdk.vm.ci.code.site.Site; | |
27 import jdk.vm.ci.meta.Assumptions.Assumption; | |
28 import jdk.vm.ci.meta.ResolvedJavaMethod; | |
29 | |
30 /** | 25 /** |
31 * Abstract base class that represents the output from compiling a method. | 26 * The output from compiling a method. |
32 */ | 27 */ |
33 public abstract class CompiledCode { | 28 public interface CompiledCode { |
34 | |
35 /** | |
36 * The name of this compilation unit. | |
37 */ | |
38 protected final String name; | |
39 | |
40 /** | |
41 * The buffer containing the emitted machine code. | |
42 */ | |
43 protected final byte[] targetCode; | |
44 | |
45 /** | |
46 * The leading number of bytes in {@link #targetCode} containing the emitted machine code. | |
47 */ | |
48 protected final int targetCodeSize; | |
49 | |
50 /** | |
51 * A list of code annotations describing special sites in {@link #targetCode}. | |
52 */ | |
53 protected final Site[] sites; | |
54 | |
55 /** | |
56 * A list of {@link Assumption} this code relies on. | |
57 */ | |
58 protected final Assumption[] assumptions; | |
59 | |
60 /** | |
61 * The list of the methods whose bytecodes were used as input to the compilation. If | |
62 * {@code null}, then the compilation did not record method dependencies. Otherwise, the first | |
63 * element of this array is the root method of the compilation. | |
64 */ | |
65 protected final ResolvedJavaMethod[] methods; | |
66 | |
67 public CompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods) { | |
68 this.name = name; | |
69 this.targetCode = targetCode; | |
70 this.targetCodeSize = targetCodeSize; | |
71 this.sites = sites; | |
72 this.assumptions = assumptions; | |
73 this.methods = methods; | |
74 | |
75 assert validateFrames(); | |
76 } | |
77 | |
78 public String getName() { | |
79 return name; | |
80 } | |
81 | |
82 @Override | |
83 public String toString() { | |
84 return name; | |
85 } | |
86 | |
87 /** | |
88 * Ensure that all the frames passed into the VM are properly formatted with an empty or illegal | |
89 * slot following double word slots. | |
90 */ | |
91 private boolean validateFrames() { | |
92 for (Site site : sites) { | |
93 if (site instanceof Infopoint) { | |
94 Infopoint info = (Infopoint) site; | |
95 if (info.debugInfo != null) { | |
96 BytecodeFrame frame = info.debugInfo.frame(); | |
97 assert frame == null || frame.validateFormat(); | |
98 } | |
99 } | |
100 } | |
101 return true; | |
102 } | |
103 } | 29 } |