Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledCode.java @ 21556:48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 27 May 2015 00:36:16 +0200 |
parents | 9579a3c62a9e |
children | ce2113326bc8 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21411
diff
changeset
|
23 package com.oracle.jvmci.hotspot; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
25 import java.nio.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 import java.util.*; |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
27 import java.util.stream.*; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
28 import java.util.stream.Stream.Builder; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
30 import com.oracle.jvmci.code.*; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
31 import com.oracle.jvmci.code.CompilationResult.CodeAnnotation; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
32 import com.oracle.jvmci.code.CompilationResult.CodeComment; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
33 import com.oracle.jvmci.code.CompilationResult.DataPatch; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
34 import com.oracle.jvmci.code.CompilationResult.ExceptionHandler; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
35 import com.oracle.jvmci.code.CompilationResult.Infopoint; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
36 import com.oracle.jvmci.code.CompilationResult.JumpTable; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
37 import com.oracle.jvmci.code.CompilationResult.Mark; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
38 import com.oracle.jvmci.code.CompilationResult.Site; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 /** |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
41 * A {@link CompilationResult} with additional HotSpot-specific information required for installing |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
42 * the code in HotSpot's code cache. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 */ |
21411
082417ac43e4
removed com.oracle.graal.hotspot.server and uses of Serializable it depended upon (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19739
diff
changeset
|
44 public abstract class HotSpotCompiledCode { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 |
5776
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5774
diff
changeset
|
46 public final CompilationResult comp; |
9338
0266549ff6e0
added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents:
9003
diff
changeset
|
47 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 public final Site[] sites; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 public final ExceptionHandler[] exceptionHandlers; |
9807
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
50 public final Comment[] comments; |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
51 |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
52 public final byte[] dataSection; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
53 public final int dataSectionAlignment; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
54 public final DataPatch[] dataSectionPatches; |
13576
4e679d50ba9a
Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents:
9807
diff
changeset
|
55 |
9807
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
56 public static class Comment { |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
57 |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
58 public final String text; |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
59 public final int pcOffset; |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
60 |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
61 public Comment(int pcOffset, String text) { |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
62 this.text = text; |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
63 this.pcOffset = pcOffset; |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
64 } |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
65 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
67 public HotSpotCompiledCode(CompilationResult compResult) { |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
68 this.comp = compResult; |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
69 sites = getSortedSites(compResult); |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
70 if (compResult.getExceptionHandlers().isEmpty()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 exceptionHandlers = null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 } else { |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
73 exceptionHandlers = compResult.getExceptionHandlers().toArray(new ExceptionHandler[compResult.getExceptionHandlers().size()]); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 } |
9807
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
75 List<CodeAnnotation> annotations = compResult.getAnnotations(); |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
76 comments = new Comment[annotations.size()]; |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
77 if (!annotations.isEmpty()) { |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
78 for (int i = 0; i < comments.length; i++) { |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
79 CodeAnnotation annotation = annotations.get(i); |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
80 String text; |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
81 if (annotation instanceof CodeComment) { |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
82 CodeComment codeComment = (CodeComment) annotation; |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
83 text = codeComment.value; |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
84 } else if (annotation instanceof JumpTable) { |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
85 JumpTable jumpTable = (JumpTable) annotation; |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
86 text = "JumpTable [" + jumpTable.low + " .. " + jumpTable.high + "]"; |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
87 } else { |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
88 text = annotation.toString(); |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
89 } |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
90 comments[i] = new Comment(annotation.position, text); |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
91 } |
d552919fbb05
Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents:
9669
diff
changeset
|
92 } |
13970
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
93 assert validateFrames(); |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
94 |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
95 DataSection data = compResult.getDataSection(); |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
96 data.finalizeLayout(); |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
97 dataSection = new byte[data.getSectionSize()]; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
98 |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
99 ByteBuffer buffer = ByteBuffer.wrap(dataSection).order(ByteOrder.nativeOrder()); |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
100 Builder<DataPatch> patchBuilder = Stream.builder(); |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
101 data.buildDataSection(buffer, patchBuilder); |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
102 |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
103 dataSectionAlignment = data.getSectionAlignment(); |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
104 dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]); |
13970
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
105 } |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
106 |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
107 /** |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
108 * Ensure that all the frames passed into HotSpot are properly formatted with an empty or |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
109 * illegal slot following double word slots. |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
110 */ |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
111 private boolean validateFrames() { |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
112 for (Site site : sites) { |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
113 if (site instanceof Infopoint) { |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
114 Infopoint info = (Infopoint) site; |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
115 if (info.debugInfo != null) { |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
116 BytecodeFrame frame = info.debugInfo.frame(); |
19739
6a3832494e24
Check for derived pointers before passing BytecodeFrame into HotSpot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18176
diff
changeset
|
117 assert frame == null || frame.validateFormat(false); |
13970
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
118 } |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
119 } |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
120 } |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
121 return true; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 |
6659
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
124 static class SiteComparator implements Comparator<Site> { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6674
diff
changeset
|
125 |
6659
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
126 public int compare(Site s1, Site s2) { |
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
127 if (s1.pcOffset == s2.pcOffset && (s1 instanceof Mark ^ s2 instanceof Mark)) { |
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
128 return s1 instanceof Mark ? -1 : 1; |
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
129 } |
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
130 return s1.pcOffset - s2.pcOffset; |
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
131 } |
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
132 } |
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
133 |
5546
e42c0df7212a
Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5530
diff
changeset
|
134 private static Site[] getSortedSites(CompilationResult target) { |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
135 List<?>[] lists = new List<?>[]{target.getInfopoints(), target.getDataPatches(), target.getMarks()}; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 int count = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
137 for (List<?> list : lists) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
138 count += list.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
139 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
140 Site[] result = new Site[count]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
141 int pos = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
142 for (List<?> list : lists) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 for (Object elem : list) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 result[pos++] = (Site) elem; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
146 } |
6659
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
147 Arrays.sort(result, new SiteComparator()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
148 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
149 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
150 } |