comparison graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledCode.java @ 21561:ce2113326bc8

Merge.
author Doug Simon <doug.simon@oracle.com>
date Thu, 28 May 2015 17:13:22 +0200
parents graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledCode.java@5cbaf1e9ff2e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledCode.java@48c1ebd24120
children
comparison
equal deleted inserted replaced
21560:a9fba0dfb155 21561:ce2113326bc8
34 import com.oracle.jvmci.code.CompilationResult.ExceptionHandler; 34 import com.oracle.jvmci.code.CompilationResult.ExceptionHandler;
35 import com.oracle.jvmci.code.CompilationResult.Infopoint; 35 import com.oracle.jvmci.code.CompilationResult.Infopoint;
36 import com.oracle.jvmci.code.CompilationResult.JumpTable; 36 import com.oracle.jvmci.code.CompilationResult.JumpTable;
37 import com.oracle.jvmci.code.CompilationResult.Mark; 37 import com.oracle.jvmci.code.CompilationResult.Mark;
38 import com.oracle.jvmci.code.CompilationResult.Site; 38 import com.oracle.jvmci.code.CompilationResult.Site;
39 import com.oracle.jvmci.meta.Assumptions.Assumption;
40 import com.oracle.jvmci.meta.*;
39 41
40 /** 42 /**
41 * A {@link CompilationResult} with additional HotSpot-specific information required for installing 43 * A {@link CompilationResult} with additional HotSpot-specific information required for installing
42 * the code in HotSpot's code cache. 44 * the code in HotSpot's code cache.
43 */ 45 */
44 public abstract class HotSpotCompiledCode { 46 public abstract class HotSpotCompiledCode {
45 47
46 public final CompilationResult comp; 48 public final String name;
47
48 public final Site[] sites; 49 public final Site[] sites;
49 public final ExceptionHandler[] exceptionHandlers; 50 public final ExceptionHandler[] exceptionHandlers;
50 public final Comment[] comments; 51 public final Comment[] comments;
52 public final Assumption[] assumptions;
53
54 public final byte[] targetCode;
55 public final int targetCodeSize;
51 56
52 public final byte[] dataSection; 57 public final byte[] dataSection;
53 public final int dataSectionAlignment; 58 public final int dataSectionAlignment;
54 public final DataPatch[] dataSectionPatches; 59 public final DataPatch[] dataSectionPatches;
60
61 public final int totalFrameSize;
62 public final int customStackAreaOffset;
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 public final ResolvedJavaMethod[] methods;
55 70
56 public static class Comment { 71 public static class Comment {
57 72
58 public final String text; 73 public final String text;
59 public final int pcOffset; 74 public final int pcOffset;
63 this.pcOffset = pcOffset; 78 this.pcOffset = pcOffset;
64 } 79 }
65 } 80 }
66 81
67 public HotSpotCompiledCode(CompilationResult compResult) { 82 public HotSpotCompiledCode(CompilationResult compResult) {
68 this.comp = compResult; 83 name = compResult.getName();
69 sites = getSortedSites(compResult); 84 sites = getSortedSites(compResult);
70 if (compResult.getExceptionHandlers().isEmpty()) { 85 if (compResult.getExceptionHandlers().isEmpty()) {
71 exceptionHandlers = null; 86 exceptionHandlers = null;
72 } else { 87 } else {
73 exceptionHandlers = compResult.getExceptionHandlers().toArray(new ExceptionHandler[compResult.getExceptionHandlers().size()]); 88 exceptionHandlers = compResult.getExceptionHandlers().toArray(new ExceptionHandler[compResult.getExceptionHandlers().size()]);
88 text = annotation.toString(); 103 text = annotation.toString();
89 } 104 }
90 comments[i] = new Comment(annotation.position, text); 105 comments[i] = new Comment(annotation.position, text);
91 } 106 }
92 } 107 }
108 assumptions = compResult.getAssumptions();
93 assert validateFrames(); 109 assert validateFrames();
110
111 targetCode = compResult.getTargetCode();
112 targetCodeSize = compResult.getTargetCodeSize();
94 113
95 DataSection data = compResult.getDataSection(); 114 DataSection data = compResult.getDataSection();
96 data.finalizeLayout(); 115 data.finalizeLayout();
97 dataSection = new byte[data.getSectionSize()]; 116 dataSection = new byte[data.getSectionSize()];
98 117
100 Builder<DataPatch> patchBuilder = Stream.builder(); 119 Builder<DataPatch> patchBuilder = Stream.builder();
101 data.buildDataSection(buffer, patchBuilder); 120 data.buildDataSection(buffer, patchBuilder);
102 121
103 dataSectionAlignment = data.getSectionAlignment(); 122 dataSectionAlignment = data.getSectionAlignment();
104 dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]); 123 dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]);
124
125 totalFrameSize = compResult.getTotalFrameSize();
126 customStackAreaOffset = compResult.getCustomStackAreaOffset();
127
128 methods = compResult.getMethods();
105 } 129 }
106 130
107 /** 131 /**
108 * Ensure that all the frames passed into HotSpot are properly formatted with an empty or 132 * Ensure that all the frames passed into HotSpot are properly formatted with an empty or
109 * illegal slot following double word slots. 133 * illegal slot following double word slots.