174 }
175 }
176
177 private boolean closed;
178
179 private int entryBCI = -1;
180
181 private final DataSection dataSection = new DataSection();
182
183 private final List<Infopoint> infopoints = new ArrayList<>();
184 private final List<SourceMapping> sourceMapping = new ArrayList<>();
185 private final List<DataPatch> dataPatches = new ArrayList<>();
186 private final List<ExceptionHandler> exceptionHandlers = new ArrayList<>();
187 private final List<Mark> marks = new ArrayList<>();
188
189 private int totalFrameSize = -1;
190 private int maxInterpreterFrameSize = -1;
191
192 private StackSlot customStackArea = null;
193
194 private final String name;
195
196 private final CompilationIdentifier compilationId;
197
198 /**
199 * The buffer containing the emitted machine code.
200 */
201 private byte[] targetCode;
202
203 /**
204 * The leading number of bytes in {@link #targetCode} containing the emitted machine code.
205 */
206 private int targetCodeSize;
207
208 private ArrayList<CodeAnnotation> annotations;
209
210 private Assumption[] assumptions;
211
212 /**
213 * The list of the methods whose bytecodes were used as input to the compilation. If
214 * {@code null}, then the compilation did not record method dependencies. Otherwise, the first
215 * element of this array is the root method of the compilation.
216 */
217 private ResolvedJavaMethod[] methods;
218
219 /**
220 * The list of fields that were accessed from the bytecodes.
221 */
222 private ResolvedJavaField[] fields;
223
224 private int bytecodeSize;
225
226 private boolean hasUnsafeAccess;
227
228 private boolean isImmutablePIC;
229
230 public CompilationResult(CompilationIdentifier compilationId) {
231 this(compilationId, compilationId.toString(CompilationIdentifier.Verbosity.NAME), false);
232 }
233
234 public CompilationResult(CompilationIdentifier compilationId, String name) {
235 this(compilationId, name, false);
236 }
237
238 public CompilationResult(CompilationIdentifier compilationId, boolean isImmutablePIC) {
239 this(compilationId, null, isImmutablePIC);
240 }
241
242 public CompilationResult(CompilationIdentifier compilationId, String name, boolean isImmutablePIC) {
243 this.compilationId = compilationId;
244 this.name = name;
245 this.isImmutablePIC = isImmutablePIC;
246 }
247
248 public CompilationResult(String name) {
249 this(null, name);
250 }
251
660 /**
661 * @return the list of marks
662 */
663 public List<Mark> getMarks() {
664 if (marks.isEmpty()) {
665 return emptyList();
666 }
667 return unmodifiableList(marks);
668 }
669
670 /**
671 * @return the list of {@link SourceMapping}s
672 */
673 public List<SourceMapping> getSourceMappings() {
674 if (sourceMapping.isEmpty()) {
675 return emptyList();
676 }
677 return unmodifiableList(sourceMapping);
678 }
679
680 public String getName() {
681 return name;
682 }
683
684 public CompilationIdentifier getCompilationId() {
685 return compilationId;
686 }
687
688 public void setHasUnsafeAccess(boolean hasUnsafeAccess) {
689 checkOpen();
690 this.hasUnsafeAccess = hasUnsafeAccess;
691 }
692
693 public boolean hasUnsafeAccess() {
694 return hasUnsafeAccess;
695 }
696
697 /**
698 * Clears the information in this object pertaining to generating code. That is, the
699 * {@linkplain #getMarks() marks}, {@linkplain #getInfopoints() infopoints},
|
174 }
175 }
176
177 private boolean closed;
178
179 private int entryBCI = -1;
180
181 private final DataSection dataSection = new DataSection();
182
183 private final List<Infopoint> infopoints = new ArrayList<>();
184 private final List<SourceMapping> sourceMapping = new ArrayList<>();
185 private final List<DataPatch> dataPatches = new ArrayList<>();
186 private final List<ExceptionHandler> exceptionHandlers = new ArrayList<>();
187 private final List<Mark> marks = new ArrayList<>();
188
189 private int totalFrameSize = -1;
190 private int maxInterpreterFrameSize = -1;
191
192 private StackSlot customStackArea = null;
193
194 /**
195 * A customized name that is unrelated to {@link #compilationId}. Can be null if
196 * {@link #compilationId} fully describes the compilation.
197 */
198 private final String name;
199
200 private final CompilationIdentifier compilationId;
201
202 /**
203 * The buffer containing the emitted machine code.
204 */
205 private byte[] targetCode;
206
207 /**
208 * The leading number of bytes in {@link #targetCode} containing the emitted machine code.
209 */
210 private int targetCodeSize;
211
212 private ArrayList<CodeAnnotation> annotations;
213
214 private Assumption[] assumptions;
215
216 /**
217 * The list of the methods whose bytecodes were used as input to the compilation. If
218 * {@code null}, then the compilation did not record method dependencies. Otherwise, the first
219 * element of this array is the root method of the compilation.
220 */
221 private ResolvedJavaMethod[] methods;
222
223 /**
224 * The list of fields that were accessed from the bytecodes.
225 */
226 private ResolvedJavaField[] fields;
227
228 private int bytecodeSize;
229
230 private boolean hasUnsafeAccess;
231
232 private boolean isImmutablePIC;
233
234 public CompilationResult(CompilationIdentifier compilationId) {
235 this(compilationId, null, false);
236 }
237
238 public CompilationResult(CompilationIdentifier compilationId, String name) {
239 this(compilationId, name, false);
240 }
241
242 public CompilationResult(CompilationIdentifier compilationId, boolean isImmutablePIC) {
243 this(compilationId, null, isImmutablePIC);
244 }
245
246 public CompilationResult(CompilationIdentifier compilationId, String name, boolean isImmutablePIC) {
247 this.compilationId = compilationId;
248 this.name = name;
249 this.isImmutablePIC = isImmutablePIC;
250 }
251
252 public CompilationResult(String name) {
253 this(null, name);
254 }
255
664 /**
665 * @return the list of marks
666 */
667 public List<Mark> getMarks() {
668 if (marks.isEmpty()) {
669 return emptyList();
670 }
671 return unmodifiableList(marks);
672 }
673
674 /**
675 * @return the list of {@link SourceMapping}s
676 */
677 public List<SourceMapping> getSourceMappings() {
678 if (sourceMapping.isEmpty()) {
679 return emptyList();
680 }
681 return unmodifiableList(sourceMapping);
682 }
683
684 /**
685 * Gets the name for this compilation result. This will only be non-null when it provides a
686 * value unrelated to {@link #getCompilationId()}.
687 */
688 public String getName() {
689 return name;
690 }
691
692 public CompilationIdentifier getCompilationId() {
693 return compilationId;
694 }
695
696 public void setHasUnsafeAccess(boolean hasUnsafeAccess) {
697 checkOpen();
698 this.hasUnsafeAccess = hasUnsafeAccess;
699 }
700
701 public boolean hasUnsafeAccess() {
702 return hasUnsafeAccess;
703 }
704
705 /**
706 * Clears the information in this object pertaining to generating code. That is, the
707 * {@linkplain #getMarks() marks}, {@linkplain #getInfopoints() infopoints},
|