Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java @ 22740:22110ef74a40
8144083 [JVMCI] CompilationResult should be finalized by JVMCI compiler and made effectively final
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 26 Nov 2015 00:47:01 +0100 |
parents | f41ed1d87d68 |
children | e9424bc1e288 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
2 * Copyright (c) 2011, 2015, 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 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22478
diff
changeset
|
25 import java.nio.ByteBuffer; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22478
diff
changeset
|
26 import java.nio.ByteOrder; |
22739
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
27 import java.util.ArrayList; |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22478
diff
changeset
|
28 import java.util.Arrays; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22478
diff
changeset
|
29 import java.util.Comparator; |
22739
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
30 import java.util.EnumMap; |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22478
diff
changeset
|
31 import java.util.List; |
22739
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
32 import java.util.Map; |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22478
diff
changeset
|
33 import java.util.stream.Stream; |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
34 import java.util.stream.Stream.Builder; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
36 import jdk.vm.ci.code.BytecodeFrame; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
37 import jdk.vm.ci.code.CompilationResult; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
38 import jdk.vm.ci.code.CompilationResult.CodeAnnotation; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
39 import jdk.vm.ci.code.CompilationResult.CodeComment; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
40 import jdk.vm.ci.code.CompilationResult.DataPatch; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
41 import jdk.vm.ci.code.CompilationResult.ExceptionHandler; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
42 import jdk.vm.ci.code.CompilationResult.Infopoint; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
43 import jdk.vm.ci.code.CompilationResult.JumpTable; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
44 import jdk.vm.ci.code.CompilationResult.Mark; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
45 import jdk.vm.ci.code.CompilationResult.Site; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
46 import jdk.vm.ci.code.DataSection; |
22739
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
47 import jdk.vm.ci.code.InfopointReason; |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
48 import jdk.vm.ci.meta.Assumptions.Assumption; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22625
diff
changeset
|
49 import jdk.vm.ci.meta.ResolvedJavaMethod; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 /** |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
52 * 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
|
53 * the code in HotSpot's code cache. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 */ |
22625
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
55 public class HotSpotCompiledCode { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 |
21561 | 57 public final String name; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 public final Site[] sites; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 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
|
60 public final Comment[] comments; |
21506
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
61 public final Assumption[] assumptions; |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
62 |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
63 public final byte[] targetCode; |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
64 public final int targetCodeSize; |
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
|
65 |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
66 public final byte[] dataSection; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
67 public final int dataSectionAlignment; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
68 public final DataPatch[] dataSectionPatches; |
13576
4e679d50ba9a
Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents:
9807
diff
changeset
|
69 |
21506
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
70 public final int totalFrameSize; |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
71 public final int customStackAreaOffset; |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
72 |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
73 /** |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
74 * The list of the methods whose bytecodes were used as input to the compilation. If |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
75 * {@code null}, then the compilation did not record method dependencies. Otherwise, the first |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
76 * element of this array is the root method of the compilation. |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
77 */ |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
78 public final ResolvedJavaMethod[] methods; |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
79 |
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
|
80 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
|
81 |
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 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
|
83 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
|
84 |
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 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
|
86 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
|
87 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
|
88 } |
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 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
90 |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
91 public HotSpotCompiledCode(CompilationResult compResult) { |
21561 | 92 name = compResult.getName(); |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
93 sites = getSortedSites(compResult); |
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
94 if (compResult.getExceptionHandlers().isEmpty()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
95 exceptionHandlers = null; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
96 } else { |
9669
ed6202820ecf
renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
9654
diff
changeset
|
97 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
|
98 } |
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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 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
|
106 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
|
107 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
|
108 } 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
|
109 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
|
110 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
|
111 } 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
|
112 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
|
113 } |
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
|
114 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
|
115 } |
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
|
116 } |
21506
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
117 assumptions = compResult.getAssumptions(); |
13970
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
118 assert validateFrames(); |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
119 |
21506
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
120 targetCode = compResult.getTargetCode(); |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
121 targetCodeSize = compResult.getTargetCodeSize(); |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
122 |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
123 DataSection data = compResult.getDataSection(); |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
124 dataSection = new byte[data.getSectionSize()]; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
125 |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
126 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
|
127 Builder<DataPatch> patchBuilder = Stream.builder(); |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
128 data.buildDataSection(buffer, patchBuilder); |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
129 |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
130 dataSectionAlignment = data.getSectionAlignment(); |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
14561
diff
changeset
|
131 dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]); |
21506
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
132 |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
133 totalFrameSize = compResult.getTotalFrameSize(); |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
134 customStackAreaOffset = compResult.getCustomStackAreaOffset(); |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
135 |
5cbaf1e9ff2e
Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21411
diff
changeset
|
136 methods = compResult.getMethods(); |
13970
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
137 } |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
138 |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
139 /** |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
140 * 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
|
141 * illegal slot following double word slots. |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
142 */ |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
143 private boolean validateFrames() { |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
144 for (Site site : sites) { |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
145 if (site instanceof Infopoint) { |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
146 Infopoint info = (Infopoint) site; |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
147 if (info.debugInfo != null) { |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
148 BytecodeFrame frame = info.debugInfo.frame(); |
22478
822922922f3c
Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
149 assert frame == null || frame.validateFormat(); |
13970
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
150 } |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
151 } |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
152 } |
bbf84e85b775
Move BytecodeFrame validation into the HotSpot backend
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13676
diff
changeset
|
153 return true; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
155 |
6659
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
156 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
|
157 |
22739
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
158 /** |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
159 * Defines an order for sorting {@link Infopoint}s based on their |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
160 * {@linkplain Infopoint#reason reasons}. This is used to choose which infopoint to preserve |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
161 * when multiple infopoints collide on the same PC offset. |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
162 */ |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
163 static final Map<InfopointReason, Integer> HOTSPOT_INFOPOINT_SORT_ORDER = new EnumMap<>(InfopointReason.class); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
164 static { |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
165 int order = 0; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
166 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.SAFEPOINT, ++order); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
167 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.CALL, ++order); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
168 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.IMPLICIT_EXCEPTION, ++order); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
169 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.METHOD_START, ++order); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
170 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.METHOD_END, ++order); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
171 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.BYTECODE_POSITION, ++order); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
172 HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.SAFEPOINT, ++order); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
173 } |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
174 |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
175 /** |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
176 * Records whether any two {@link Infopoint}s had the same {@link Infopoint#pcOffset}. |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
177 */ |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
178 boolean sawCollidingInfopoints; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
179 |
6659
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
180 public int compare(Site s1, Site s2) { |
22739
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
181 if (s1.pcOffset == s2.pcOffset) { |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
182 // Marks must come first since patching a call site |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
183 // may need to know the mark denoting the call type |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
184 // (see uses of CodeInstaller::_next_call_type). |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
185 boolean s1IsMark = s1 instanceof Mark; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
186 boolean s2IsMark = s2 instanceof Mark; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
187 if (s1IsMark != s2IsMark) { |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
188 return s1IsMark ? -1 : 1; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
189 } |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
190 |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
191 // Infopoints must group together so put them after |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
192 // other Site types. |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
193 boolean s1IsInfopoint = s1 instanceof Infopoint; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
194 boolean s2IsInfopoint = s2 instanceof Infopoint; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
195 if (s1IsInfopoint != s2IsInfopoint) { |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
196 return s1IsInfopoint ? 1 : -1; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
197 } |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
198 |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
199 if (s1IsInfopoint) { |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
200 assert s2IsInfopoint; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
201 Infopoint s1Info = (Infopoint) s1; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
202 Infopoint s2Info = (Infopoint) s2; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
203 sawCollidingInfopoints = true; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
204 return HOTSPOT_INFOPOINT_SORT_ORDER.get(s1Info.reason) - HOTSPOT_INFOPOINT_SORT_ORDER.get(s2Info.reason); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
205 } |
6659
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
206 } |
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
207 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
|
208 } |
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
209 } |
eb980b869753
refactored anonymous class into inner class to ease debugging
Doug Simon <doug.simon@oracle.com>
parents:
6341
diff
changeset
|
210 |
22739
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
211 /** |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
212 * HotSpot expects sites to be presented in ascending order of PC (see |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
213 * {@code DebugInformationRecorder::add_new_pc_offset}). In addition, it expects |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
214 * {@link Infopoint} PCs to be unique. |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
215 */ |
5546
e42c0df7212a
Rename CiTargetMethod => CompilationResult.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5530
diff
changeset
|
216 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
|
217 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
|
218 int count = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
219 for (List<?> list : lists) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
220 count += list.size(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
221 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
222 Site[] result = new Site[count]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
223 int pos = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 for (List<?> list : lists) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 for (Object elem : list) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 result[pos++] = (Site) elem; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
227 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
228 } |
22739
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
229 SiteComparator c = new SiteComparator(); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
230 Arrays.sort(result, c); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
231 if (c.sawCollidingInfopoints) { |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
232 Infopoint lastInfopoint = null; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
233 List<Site> copy = new ArrayList<>(count); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
234 for (int i = 0; i < count; i++) { |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
235 if (result[i] instanceof Infopoint) { |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
236 Infopoint info = (Infopoint) result[i]; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
237 if (lastInfopoint == null || lastInfopoint.pcOffset != info.pcOffset) { |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
238 lastInfopoint = info; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
239 copy.add(info); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
240 } else { |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
241 // Omit this colliding infopoint |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
242 assert lastInfopoint.reason.compareTo(info.reason) < 0; |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
243 } |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
244 } else { |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
245 copy.add(result[i]); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
246 } |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
247 } |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
248 result = copy.toArray(new Site[copy.size()]); |
f41ed1d87d68
8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents:
22738
diff
changeset
|
249 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
250 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
251 } |
22625
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
252 |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
253 @Override |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
254 public String toString() { |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
255 return name; |
545590b1ab83
expanded CodeCacheProvider so that it supports all forms of code installation and made CompilerToVM.installCode package-private
Doug Simon <doug.simon@oracle.com>
parents:
22569
diff
changeset
|
256 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 } |