Mercurial > hg > truffle
annotate graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java @ 20994:68ff637e95b1
Merge
author | Stefan Anzinger <stefan.anzinger@oracle.com> |
---|---|
date | Thu, 16 Apr 2015 17:09:06 +0200 |
parents | ec36daea3cf0 abc059cb0acf |
children | 9f45587ad8f5 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
15937
diff
changeset
|
2 * Copyright (c) 2009, 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 */ |
19166
39e99cf01468
Move LinearScan to c.o.g.lir.alloc.lsra.
Josef Eisl <josef.eisl@jku.at>
parents:
19162
diff
changeset
|
23 package com.oracle.graal.lir.alloc.lsra; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
25 import static com.oracle.graal.api.code.CodeUtil.*; |
6316
2e25b9c14b84
Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5733
diff
changeset
|
26 import static com.oracle.graal.api.code.ValueUtil.*; |
2e25b9c14b84
Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5733
diff
changeset
|
27 import static com.oracle.graal.lir.LIRValueUtil.*; |
14152
42013bd831d6
Make LinearScan use AbstractBlock.
Josef Eisl <josef.eisl@jku.at>
parents:
13546
diff
changeset
|
28 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 import java.util.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
31 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
32 import com.oracle.graal.api.meta.*; |
15192
644dfe49c0f4
Move packages com.oracle.graal.cfg to com.oracle.graal.compiler.common.cfg.
Josef Eisl <josef.eisl@jku.at>
parents:
15157
diff
changeset
|
33 import com.oracle.graal.compiler.common.cfg.*; |
19162
c06f39fa2228
Move HIR independent utilities to c.o.g.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
18512
diff
changeset
|
34 import com.oracle.graal.compiler.common.util.*; |
6500
8fd4201ce98c
moved TTY and LogStream to com.oracle.graal.debug
Doug Simon <doug.simon@oracle.com>
parents:
6411
diff
changeset
|
35 import com.oracle.graal.debug.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
36 import com.oracle.graal.lir.*; |
6651
c162fcf45ce7
CodeCacheProvider.callKillsRegisters is not necessary because this information can be inferred from the register configuration
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6581
diff
changeset
|
37 import com.oracle.graal.lir.StandardOp.MoveOp; |
19166
39e99cf01468
Move LinearScan to c.o.g.lir.alloc.lsra.
Josef Eisl <josef.eisl@jku.at>
parents:
19162
diff
changeset
|
38 import com.oracle.graal.lir.alloc.lsra.Interval.*; |
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 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 */ |
15927
96229f219351
LSRA: add OptimizingLinearScanWalker.
Josef Eisl <josef.eisl@jku.at>
parents:
15903
diff
changeset
|
42 class LinearScanWalker extends IntervalWalker { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 |
15937
e5b1e4babf59
LSRA optimization: assign location to intervals.
Josef Eisl <josef.eisl@jku.at>
parents:
15930
diff
changeset
|
44 protected Register[] availableRegs; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 |
15937
e5b1e4babf59
LSRA optimization: assign location to intervals.
Josef Eisl <josef.eisl@jku.at>
parents:
15930
diff
changeset
|
46 protected final int[] usePos; |
e5b1e4babf59
LSRA optimization: assign location to intervals.
Josef Eisl <josef.eisl@jku.at>
parents:
15930
diff
changeset
|
47 protected final int[] blockPos; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 |
15937
e5b1e4babf59
LSRA optimization: assign location to intervals.
Josef Eisl <josef.eisl@jku.at>
parents:
15930
diff
changeset
|
49 protected List<Interval>[] spillIntervals; |
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 private MoveResolver moveResolver; // for ordering spill moves |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 |
14644
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
53 /** |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
54 * Only 10% of the lists in {@link #spillIntervals} are actually used. But when they are used, |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
55 * they can grow quite long. The maximum length observed was 45 (all numbers taken from a |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
56 * bootstrap run of Graal). Therefore, we initialize {@link #spillIntervals} with this marker |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
57 * value, and allocate a "real" list only on demand in {@link #setUsePos}. |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
58 */ |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
59 private static final List<Interval> EMPTY_LIST = new ArrayList<>(0); |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
60 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 // accessors mapped to same functions in class LinearScan |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 int blockCount() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 return allocator.blockCount(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 |
19560
4d70d150944f
Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19166
diff
changeset
|
66 AbstractBlockBase<?> blockAt(int idx) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 return allocator.blockAt(idx); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 |
19560
4d70d150944f
Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19166
diff
changeset
|
70 AbstractBlockBase<?> blockOfOpWithId(int opId) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 return allocator.blockForId(opId); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 |
6581
2a456986716b
removed Architecture.isX86() and Architecture.isSPARC()
Doug Simon <doug.simon@oracle.com>
parents:
6529
diff
changeset
|
74 LinearScanWalker(LinearScan allocator, Interval unhandledFixedFirst, Interval unhandledAnyFirst) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 super(allocator, unhandledFixedFirst, unhandledAnyFirst); |
6651
c162fcf45ce7
CodeCacheProvider.callKillsRegisters is not necessary because this information can be inferred from the register configuration
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6581
diff
changeset
|
76 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
77 moveResolver = new MoveResolver(allocator); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 spillIntervals = Util.uncheckedCast(new List[allocator.registers.length]); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 for (int i = 0; i < allocator.registers.length; i++) { |
14644
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
80 spillIntervals[i] = EMPTY_LIST; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 usePos = new int[allocator.registers.length]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
83 blockPos = new int[allocator.registers.length]; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
84 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
85 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
86 void initUseLists(boolean onlyProcessUsePos) { |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
87 for (Register register : availableRegs) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
88 int i = register.number; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
89 usePos[i] = Integer.MAX_VALUE; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
90 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
91 if (!onlyProcessUsePos) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 blockPos[i] = Integer.MAX_VALUE; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
93 spillIntervals[i].clear(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
95 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
96 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
98 void excludeFromUse(Interval i) { |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
99 Value location = i.location(); |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4165
diff
changeset
|
100 int i1 = asRegister(location).number; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 if (i1 >= availableRegs[0].number && i1 <= availableRegs[availableRegs.length - 1].number) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 usePos[i1] = 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
103 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
106 void setUsePos(Interval interval, int usePos, boolean onlyProcessUsePos) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 if (usePos != -1) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
108 assert usePos != 0 : "must use excludeFromUse to set usePos to 0"; |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4165
diff
changeset
|
109 int i = asRegister(interval.location()).number; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
110 if (i >= availableRegs[0].number && i <= availableRegs[availableRegs.length - 1].number) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 if (this.usePos[i] > usePos) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 this.usePos[i] = usePos; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
113 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
114 if (!onlyProcessUsePos) { |
14644
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
115 List<Interval> list = spillIntervals[i]; |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
116 if (list == EMPTY_LIST) { |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
117 list = new ArrayList<>(2); |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
118 spillIntervals[i] = list; |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
119 } |
07ce8ff3603d
Reduce unncessary list allocations in register allocator
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14614
diff
changeset
|
120 list.add(interval); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 } |
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 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
124 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
125 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
126 void setBlockPos(Interval i, int blockPos) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
127 if (blockPos != -1) { |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4165
diff
changeset
|
128 int reg = asRegister(i.location()).number; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
129 if (reg >= availableRegs[0].number && reg <= availableRegs[availableRegs.length - 1].number) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
130 if (this.blockPos[reg] > blockPos) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
131 this.blockPos[reg] = blockPos; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
132 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
133 if (usePos[reg] > blockPos) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
134 usePos[reg] = blockPos; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
135 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
137 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
138 } |
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 void freeExcludeActiveFixed() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
141 Interval interval = activeLists.get(RegisterBinding.Fixed); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
142 while (interval != Interval.EndMarker) { |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4165
diff
changeset
|
143 assert isRegister(interval.location()) : "active interval must have a register assigned"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 excludeFromUse(interval); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 interval = interval.next; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
146 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
148 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
149 void freeExcludeActiveAny() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
150 Interval interval = activeLists.get(RegisterBinding.Any); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 while (interval != Interval.EndMarker) { |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4165
diff
changeset
|
152 assert isRegister(interval.location()) : "active interval must have a register assigned"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
153 excludeFromUse(interval); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 interval = interval.next; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
155 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 void freeCollectInactiveFixed(Interval current) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 Interval interval = inactiveLists.get(RegisterBinding.Fixed); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
160 while (interval != Interval.EndMarker) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
161 if (current.to() <= interval.currentFrom()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
162 assert interval.currentIntersectsAt(current) == -1 : "must not intersect"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 setUsePos(interval, interval.currentFrom(), true); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
164 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 setUsePos(interval, interval.currentIntersectsAt(current), true); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
167 interval = interval.next; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
168 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
171 void freeCollectInactiveAny(Interval current) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 Interval interval = inactiveLists.get(RegisterBinding.Any); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
173 while (interval != Interval.EndMarker) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
174 setUsePos(interval, interval.currentIntersectsAt(current), true); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
175 interval = interval.next; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
177 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
178 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
179 void freeCollectUnhandled(RegisterBinding kind, Interval current) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
180 Interval interval = unhandledLists.get(kind); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
181 while (interval != Interval.EndMarker) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
182 setUsePos(interval, interval.intersectsAt(current), true); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
183 if (kind == RegisterBinding.Fixed && current.to() <= interval.from()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
184 setUsePos(interval, interval.from(), true); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
185 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
186 interval = interval.next; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
188 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
189 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
190 void spillExcludeActiveFixed() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
191 Interval interval = activeLists.get(RegisterBinding.Fixed); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
192 while (interval != Interval.EndMarker) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
193 excludeFromUse(interval); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 interval = interval.next; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
195 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
196 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
197 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 void spillBlockUnhandledFixed(Interval current) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
199 Interval interval = unhandledLists.get(RegisterBinding.Fixed); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
200 while (interval != Interval.EndMarker) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
201 setBlockPos(interval, interval.intersectsAt(current)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
202 interval = interval.next; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
203 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
204 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
205 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
206 void spillBlockInactiveFixed(Interval current) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
207 Interval interval = inactiveLists.get(RegisterBinding.Fixed); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 while (interval != Interval.EndMarker) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
209 if (current.to() > interval.currentFrom()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
210 setBlockPos(interval, interval.currentIntersectsAt(current)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
212 assert interval.currentIntersectsAt(current) == -1 : "invalid optimization: intervals intersect"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
213 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
214 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
215 interval = interval.next; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
216 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
217 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
218 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
219 void spillCollectActiveAny() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
220 Interval interval = activeLists.get(RegisterBinding.Any); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
221 while (interval != Interval.EndMarker) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
222 setUsePos(interval, Math.min(interval.nextUsage(RegisterPriority.LiveAtLoopEnd, currentPosition), interval.to()), false); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
223 interval = interval.next; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
227 void spillCollectInactiveAny(Interval current) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
228 Interval interval = inactiveLists.get(RegisterBinding.Any); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
229 while (interval != Interval.EndMarker) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
230 if (interval.currentIntersects(current)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
231 setUsePos(interval, Math.min(interval.nextUsage(RegisterPriority.LiveAtLoopEnd, currentPosition), interval.to()), false); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 interval = interval.next; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
234 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
236 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
237 void insertMove(int operandId, Interval srcIt, Interval dstIt) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
238 // output all moves here. When source and target are equal, the move is |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
239 // optimized away later in assignRegNums |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
240 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
241 int opId = (operandId + 1) & ~1; |
19560
4d70d150944f
Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19166
diff
changeset
|
242 AbstractBlockBase<?> opBlock = allocator.blockForId(opId); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 assert opId > 0 && allocator.blockForId(opId - 2) == opBlock : "cannot insert move at block boundary"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 // calculate index of instruction inside instruction list of current block |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 // the minimal index (for a block with no spill moves) can be calculated because the |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
247 // numbering of instructions is known. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
248 // When the block already contains spill moves, the index must be increased until the |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
249 // correct index is reached. |
14806
a8723f1ff542
LIR renamed setter and getter functions.
Josef Eisl <josef.eisl@jku.at>
parents:
14157
diff
changeset
|
250 List<LIRInstruction> instructions = allocator.ir.getLIRforBlock(opBlock); |
6411
c5afcc2ebd3d
change of project structure: separate compiler and LIR, put EA into separate project
Lukas Stadler <lukas.stadler@jku.at>
parents:
6316
diff
changeset
|
251 int index = (opId - instructions.get(0).id()) >> 1; |
c5afcc2ebd3d
change of project structure: separate compiler and LIR, put EA into separate project
Lukas Stadler <lukas.stadler@jku.at>
parents:
6316
diff
changeset
|
252 assert instructions.get(index).id() <= opId : "error in calculation"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 |
6411
c5afcc2ebd3d
change of project structure: separate compiler and LIR, put EA into separate project
Lukas Stadler <lukas.stadler@jku.at>
parents:
6316
diff
changeset
|
254 while (instructions.get(index).id() != opId) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
255 index++; |
6411
c5afcc2ebd3d
change of project structure: separate compiler and LIR, put EA into separate project
Lukas Stadler <lukas.stadler@jku.at>
parents:
6316
diff
changeset
|
256 assert 0 <= index && index < instructions.size() : "index out of bounds"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 } |
6411
c5afcc2ebd3d
change of project structure: separate compiler and LIR, put EA into separate project
Lukas Stadler <lukas.stadler@jku.at>
parents:
6316
diff
changeset
|
258 assert 1 <= index && index < instructions.size() : "index out of bounds"; |
c5afcc2ebd3d
change of project structure: separate compiler and LIR, put EA into separate project
Lukas Stadler <lukas.stadler@jku.at>
parents:
6316
diff
changeset
|
259 assert instructions.get(index).id() == opId : "error in calculation"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
261 // insert new instruction before instruction at position index |
6411
c5afcc2ebd3d
change of project structure: separate compiler and LIR, put EA into separate project
Lukas Stadler <lukas.stadler@jku.at>
parents:
6316
diff
changeset
|
262 moveResolver.moveInsertPosition(instructions, index); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 moveResolver.addMapping(srcIt, dstIt); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 |
19560
4d70d150944f
Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19166
diff
changeset
|
266 int findOptimalSplitPos(AbstractBlockBase<?> minBlock, AbstractBlockBase<?> maxBlock, int maxSplitPos) { |
7497
0f8c6dbf68be
Code clean up and documentation for ComputeBlockOrder class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
6651
diff
changeset
|
267 int fromBlockNr = minBlock.getLinearScanNumber(); |
0f8c6dbf68be
Code clean up and documentation for ComputeBlockOrder class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
6651
diff
changeset
|
268 int toBlockNr = maxBlock.getLinearScanNumber(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
269 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
270 assert 0 <= fromBlockNr && fromBlockNr < blockCount() : "out of range"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
271 assert 0 <= toBlockNr && toBlockNr < blockCount() : "out of range"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
272 assert fromBlockNr < toBlockNr : "must cross block boundary"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
273 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
274 // Try to split at end of maxBlock. If this would be after |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
275 // maxSplitPos, then use the begin of maxBlock |
6411
c5afcc2ebd3d
change of project structure: separate compiler and LIR, put EA into separate project
Lukas Stadler <lukas.stadler@jku.at>
parents:
6316
diff
changeset
|
276 int optimalSplitPos = allocator.getLastLirInstructionId(maxBlock) + 2; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
277 if (optimalSplitPos > maxSplitPos) { |
6411
c5afcc2ebd3d
change of project structure: separate compiler and LIR, put EA into separate project
Lukas Stadler <lukas.stadler@jku.at>
parents:
6316
diff
changeset
|
278 optimalSplitPos = allocator.getFirstLirInstructionId(maxBlock); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
279 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
280 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
281 int minLoopDepth = maxBlock.getLoopDepth(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 for (int i = toBlockNr - 1; i >= fromBlockNr; i--) { |
19560
4d70d150944f
Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19166
diff
changeset
|
283 AbstractBlockBase<?> cur = blockAt(i); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
284 |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
285 if (cur.getLoopDepth() < minLoopDepth) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
286 // block with lower loop-depth found . split at the end of this block |
4435
57cb8ec5f6bb
Restructure block and control flow graph data structures
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
287 minLoopDepth = cur.getLoopDepth(); |
6411
c5afcc2ebd3d
change of project structure: separate compiler and LIR, put EA into separate project
Lukas Stadler <lukas.stadler@jku.at>
parents:
6316
diff
changeset
|
288 optimalSplitPos = allocator.getLastLirInstructionId(cur) + 2; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
289 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 assert optimalSplitPos > allocator.maxOpId() || allocator.isBlockBegin(optimalSplitPos) : "algorithm must move split pos to block boundary"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
292 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
293 return optimalSplitPos; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
294 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
295 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
296 int findOptimalSplitPos(Interval interval, int minSplitPos, int maxSplitPos, boolean doLoopOptimization) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
297 int optimalSplitPos = -1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 if (minSplitPos == maxSplitPos) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 // trivial case, no optimization of split position possible |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
300 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
301 Debug.log("min-pos and max-pos are equal, no optimization possible"); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
302 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
303 optimalSplitPos = minSplitPos; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
304 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
305 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
306 assert minSplitPos < maxSplitPos : "must be true then"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
307 assert minSplitPos > 0 : "cannot access minSplitPos - 1 otherwise"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
308 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
309 // reason for using minSplitPos - 1: when the minimal split pos is exactly at the |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
310 // beginning of a block, then minSplitPos is also a possible split position. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
311 // Use the block before as minBlock, because then minBlock.lastLirInstructionId() + 2 == |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
312 // minSplitPos |
19560
4d70d150944f
Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19166
diff
changeset
|
313 AbstractBlockBase<?> minBlock = allocator.blockForId(minSplitPos - 1); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
314 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
315 // reason for using maxSplitPos - 1: otherwise there would be an assert on failure |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
316 // when an interval ends at the end of the last block of the method |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
317 // (in this case, maxSplitPos == allocator().maxLirOpId() + 2, and there is no |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 // block at this opId) |
19560
4d70d150944f
Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19166
diff
changeset
|
319 AbstractBlockBase<?> maxBlock = allocator.blockForId(maxSplitPos - 1); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
320 |
7497
0f8c6dbf68be
Code clean up and documentation for ComputeBlockOrder class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
6651
diff
changeset
|
321 assert minBlock.getLinearScanNumber() <= maxBlock.getLinearScanNumber() : "invalid order"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
322 if (minBlock == maxBlock) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
323 // split position cannot be moved to block boundary : so split as late as possible |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
324 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
325 Debug.log("cannot move split pos to block boundary because minPos and maxPos are in same block"); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
326 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
327 optimalSplitPos = maxSplitPos; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
328 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
329 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
330 if (interval.hasHoleBetween(maxSplitPos - 1, maxSplitPos) && !allocator.isBlockBegin(maxSplitPos)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
331 // Do not move split position if the interval has a hole before maxSplitPos. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
332 // Intervals resulting from Phi-Functions have more than one definition (marked |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
333 // as mustHaveRegister) with a hole before each definition. When the register is |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
334 // needed |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
335 // for the second definition : an earlier reloading is unnecessary. |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
336 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
337 Debug.log("interval has hole just before maxSplitPos, so splitting at maxSplitPos"); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
338 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
339 optimalSplitPos = maxSplitPos; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
340 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
341 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
342 // seach optimal block boundary between minSplitPos and maxSplitPos |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
343 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
344 Debug.log("moving split pos to optimal block boundary between block B%d and B%d", minBlock.getId(), maxBlock.getId()); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
345 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
346 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
347 if (doLoopOptimization) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
348 // Loop optimization: if a loop-end marker is found between min- and |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
349 // max-position : |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
350 // then split before this loop |
6411
c5afcc2ebd3d
change of project structure: separate compiler and LIR, put EA into separate project
Lukas Stadler <lukas.stadler@jku.at>
parents:
6316
diff
changeset
|
351 int loopEndPos = interval.nextUsageExact(RegisterPriority.LiveAtLoopEnd, allocator.getLastLirInstructionId(minBlock) + 2); |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
352 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
353 Debug.log("loop optimization: loop end found at pos %d", loopEndPos); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
354 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
355 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
356 assert loopEndPos > minSplitPos : "invalid order"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
357 if (loopEndPos < maxSplitPos) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
358 // loop-end marker found between min- and max-position |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
359 // if it is not the end marker for the same loop as the min-position : |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
360 // then move |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
361 // the max-position to this loop block. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
362 // Desired result: uses tagged as shouldHaveRegister inside a loop cause |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
363 // a reloading |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
364 // of the interval (normally, only mustHaveRegister causes a reloading) |
19560
4d70d150944f
Remove AbstractBlock interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19166
diff
changeset
|
365 AbstractBlockBase<?> loopBlock = allocator.blockForId(loopEndPos); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
366 |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
367 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
368 Debug.log("interval is used in loop that ends in block B%d, so trying to move maxBlock back from B%d to B%d", loopBlock.getId(), maxBlock.getId(), loopBlock.getId()); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
369 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
370 assert loopBlock != minBlock : "loopBlock and minBlock must be different because block boundary is needed between"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
371 |
20979
65d8d305f9c0
Minor linear scan tweaks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20921
diff
changeset
|
372 int maxSpillPos = allocator.getLastLirInstructionId(loopBlock) + 2; |
65d8d305f9c0
Minor linear scan tweaks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20921
diff
changeset
|
373 optimalSplitPos = findOptimalSplitPos(minBlock, loopBlock, maxSpillPos); |
65d8d305f9c0
Minor linear scan tweaks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20921
diff
changeset
|
374 if (optimalSplitPos == maxSpillPos) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
375 optimalSplitPos = -1; |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
376 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
377 Debug.log("loop optimization not necessary"); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
378 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
379 } else { |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
380 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
381 Debug.log("loop optimization successful"); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
382 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
383 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
384 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
385 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
386 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
387 if (optimalSplitPos == -1) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
388 // not calculated by loop optimization |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
389 optimalSplitPos = findOptimalSplitPos(minBlock, maxBlock, maxSplitPos); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
390 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
391 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
392 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
393 } |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
394 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
395 Debug.log("optimal split position: %d", optimalSplitPos); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
396 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
397 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
398 return optimalSplitPos; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
399 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
400 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
401 // split an interval at the optimal position between minSplitPos and |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
402 // maxSplitPos in two parts: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
403 // 1) the left part has already a location assigned |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
404 // 2) the right part is sorted into to the unhandled-list |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
405 void splitBeforeUsage(Interval interval, int minSplitPos, int maxSplitPos) { |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
406 |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
407 try (Indent indent = Debug.logAndIndent("splitting interval %s between %d and %d", interval, minSplitPos, maxSplitPos)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
408 |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
409 assert interval.from() < minSplitPos : "cannot split at start of interval"; |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
410 assert currentPosition < minSplitPos : "cannot split before current position"; |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
411 assert minSplitPos <= maxSplitPos : "invalid order"; |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
412 assert maxSplitPos <= interval.to() : "cannot split after end of interval"; |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
413 |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
414 int optimalSplitPos = findOptimalSplitPos(interval, minSplitPos, maxSplitPos, true); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
415 |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
416 assert minSplitPos <= optimalSplitPos && optimalSplitPos <= maxSplitPos : "out of range"; |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
417 assert optimalSplitPos <= interval.to() : "cannot split after end of interval"; |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
418 assert optimalSplitPos > interval.from() : "cannot split at start of interval"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
419 |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
420 if (optimalSplitPos == interval.to() && interval.nextUsage(RegisterPriority.MustHaveRegister, minSplitPos) == Integer.MAX_VALUE) { |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
421 // the split position would be just before the end of the interval |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
422 // . no split at all necessary |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
423 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
424 Debug.log("no split necessary because optimal split position is at end of interval"); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
425 } |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
426 return; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
427 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
428 |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
429 // must calculate this before the actual split is performed and before split position is |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
430 // moved to odd opId |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
431 boolean moveNecessary = !allocator.isBlockBegin(optimalSplitPos) && !interval.hasHoleBetween(optimalSplitPos - 1, optimalSplitPos); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
432 |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
433 if (!allocator.isBlockBegin(optimalSplitPos)) { |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
434 // move position before actual instruction (odd opId) |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
435 optimalSplitPos = (optimalSplitPos - 1) | 1; |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
436 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
437 |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
438 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
439 Debug.log("splitting at position %d", optimalSplitPos); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
440 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
441 |
14157 | 442 assert allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 1) : "split pos must be odd when not on block boundary"; |
443 assert !allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 0) : "split pos must be even on block boundary"; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
444 |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
445 Interval splitPart = interval.split(optimalSplitPos, allocator); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
446 |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
447 splitPart.setInsertMoveWhenActivated(moveNecessary); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
448 |
15903
5d734275cc5f
LSRA: make IntervalWalker.currentInterval private.
Josef Eisl <josef.eisl@jku.at>
parents:
15902
diff
changeset
|
449 assert splitPart.from() >= currentPosition : "cannot append new interval before current walk position"; |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
450 unhandledLists.addToListSortedByStartAndUsePositions(RegisterBinding.Any, splitPart); |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
451 |
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
452 if (Debug.isLogEnabled()) { |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
453 Debug.log("left interval %s: %s", moveNecessary ? " " : "", interval.logString(allocator)); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
454 Debug.log("right interval %s: %s", moveNecessary ? "(move)" : "", splitPart.logString(allocator)); |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
455 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
456 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
457 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
458 |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
459 // split an interval at the optimal position between minSplitPos and |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
460 // maxSplitPos in two parts: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
461 // 1) the left part has already a location assigned |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
462 // 2) the right part is always on the stack and therefore ignored in further processing |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
463 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
464 void splitForSpilling(Interval interval) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
465 // calculate allowed range of splitting position |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
466 int maxSplitPos = currentPosition; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
467 int minSplitPos = Math.max(interval.previousUsage(RegisterPriority.ShouldHaveRegister, maxSplitPos) + 1, interval.from()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
468 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
469 try (Indent indent = Debug.logAndIndent("splitting and spilling interval %s between %d and %d", interval, minSplitPos, maxSplitPos)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
470 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
471 assert interval.state == State.Active : "why spill interval that is not active?"; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
472 assert interval.from() <= minSplitPos : "cannot split before start of interval"; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
473 assert minSplitPos <= maxSplitPos : "invalid order"; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
474 assert maxSplitPos < interval.to() : "cannot split at end end of interval"; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
475 assert currentPosition < interval.to() : "interval must not end before current position"; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
476 |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
477 if (minSplitPos == interval.from()) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
478 // the whole interval is never used, so spill it entirely to memory |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
479 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
480 try (Indent indent2 = Debug.logAndIndent("spilling entire interval because split pos is at beginning of interval (use positions: %d)", interval.usePosList().size())) { |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
481 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
482 assert interval.firstUsage(RegisterPriority.ShouldHaveRegister) > currentPosition : "interval must not have use position before currentPosition"; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
483 |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
484 allocator.assignSpillSlot(interval); |
15930
1ec990b3e556
LSRA optimization: add LinearScanWalker.handleSpillSlot().
Josef Eisl <josef.eisl@jku.at>
parents:
15927
diff
changeset
|
485 handleSpillSlot(interval); |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
486 allocator.changeSpillState(interval, minSplitPos); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
487 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
488 // Also kick parent intervals out of register to memory when they have no use |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
489 // position. This avoids short interval in register surrounded by intervals in |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
490 // memory . avoid useless moves from memory to register and back |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
491 Interval parent = interval; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
492 while (parent != null && parent.isSplitChild()) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
493 parent = parent.getSplitChildBeforeOpId(parent.from()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
494 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
495 if (isRegister(parent.location())) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
496 if (parent.firstUsage(RegisterPriority.ShouldHaveRegister) == Integer.MAX_VALUE) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
497 // parent is never used, so kick it out of its assigned register |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
498 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
499 Debug.log("kicking out interval %d out of its register because it is never used", parent.operandNumber); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
500 } |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
501 allocator.assignSpillSlot(parent); |
15930
1ec990b3e556
LSRA optimization: add LinearScanWalker.handleSpillSlot().
Josef Eisl <josef.eisl@jku.at>
parents:
15927
diff
changeset
|
502 handleSpillSlot(parent); |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
503 } else { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
504 // do not go further back because the register is actually used by |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
505 // the interval |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
506 parent = null; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
507 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
508 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
509 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
510 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
511 |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
512 } else { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
513 // search optimal split pos, split interval and spill only the right hand part |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
514 int optimalSplitPos = findOptimalSplitPos(interval, minSplitPos, maxSplitPos, false); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
515 |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
516 assert minSplitPos <= optimalSplitPos && optimalSplitPos <= maxSplitPos : "out of range"; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
517 assert optimalSplitPos < interval.to() : "cannot split at end of interval"; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
518 assert optimalSplitPos >= interval.from() : "cannot split before start of interval"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
519 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
520 if (!allocator.isBlockBegin(optimalSplitPos)) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
521 // move position before actual instruction (odd opId) |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
522 optimalSplitPos = (optimalSplitPos - 1) | 1; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
523 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
524 |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
525 try (Indent indent2 = Debug.logAndIndent("splitting at position %d", optimalSplitPos)) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
526 assert allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 1) : "split pos must be odd when not on block boundary"; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
527 assert !allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 0) : "split pos must be even on block boundary"; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
528 |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
529 Interval spilledPart = interval.split(optimalSplitPos, allocator); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
530 allocator.assignSpillSlot(spilledPart); |
15930
1ec990b3e556
LSRA optimization: add LinearScanWalker.handleSpillSlot().
Josef Eisl <josef.eisl@jku.at>
parents:
15927
diff
changeset
|
531 handleSpillSlot(spilledPart); |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
532 allocator.changeSpillState(spilledPart, optimalSplitPos); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
533 |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
534 if (!allocator.isBlockBegin(optimalSplitPos)) { |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
535 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
536 Debug.log("inserting move from interval %d to %d", interval.operandNumber, spilledPart.operandNumber); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
537 } |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
538 insertMove(optimalSplitPos, interval, spilledPart); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
539 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
540 |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
541 // the currentSplitChild is needed later when moves are inserted for reloading |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
542 assert spilledPart.currentSplitChild() == interval : "overwriting wrong currentSplitChild"; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
543 spilledPart.makeCurrentSplitChild(); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
544 |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
545 if (Debug.isLogEnabled()) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
546 Debug.log("left interval: %s", interval.logString(allocator)); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
547 Debug.log("spilled interval : %s", spilledPart.logString(allocator)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
548 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
549 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
550 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
551 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
552 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
553 |
15930
1ec990b3e556
LSRA optimization: add LinearScanWalker.handleSpillSlot().
Josef Eisl <josef.eisl@jku.at>
parents:
15927
diff
changeset
|
554 /** |
1ec990b3e556
LSRA optimization: add LinearScanWalker.handleSpillSlot().
Josef Eisl <josef.eisl@jku.at>
parents:
15927
diff
changeset
|
555 * This is called for every interval that is assigned to a stack slot. |
1ec990b3e556
LSRA optimization: add LinearScanWalker.handleSpillSlot().
Josef Eisl <josef.eisl@jku.at>
parents:
15927
diff
changeset
|
556 */ |
1ec990b3e556
LSRA optimization: add LinearScanWalker.handleSpillSlot().
Josef Eisl <josef.eisl@jku.at>
parents:
15927
diff
changeset
|
557 protected void handleSpillSlot(Interval interval) { |
18436
59e65d3aa2fc
Use StackSlotValue where appropriate.
Josef Eisl <josef.eisl@jku.at>
parents:
18150
diff
changeset
|
558 assert interval.location() != null && (interval.canMaterialize() || isStackSlotValue(interval.location())) : "interval not assigned to a stack slot " + interval; |
15930
1ec990b3e556
LSRA optimization: add LinearScanWalker.handleSpillSlot().
Josef Eisl <josef.eisl@jku.at>
parents:
15927
diff
changeset
|
559 // Do nothing. Stack slots are not processed in this implementation. |
1ec990b3e556
LSRA optimization: add LinearScanWalker.handleSpillSlot().
Josef Eisl <josef.eisl@jku.at>
parents:
15927
diff
changeset
|
560 } |
1ec990b3e556
LSRA optimization: add LinearScanWalker.handleSpillSlot().
Josef Eisl <josef.eisl@jku.at>
parents:
15927
diff
changeset
|
561 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
562 void splitStackInterval(Interval interval) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
563 int minSplitPos = currentPosition + 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
564 int maxSplitPos = Math.min(interval.firstUsage(RegisterPriority.ShouldHaveRegister), interval.to()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
565 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
566 splitBeforeUsage(interval, minSplitPos, maxSplitPos); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
567 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
568 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
569 void splitWhenPartialRegisterAvailable(Interval interval, int registerAvailableUntil) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
570 int minSplitPos = Math.max(interval.previousUsage(RegisterPriority.ShouldHaveRegister, registerAvailableUntil), interval.from() + 1); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
571 splitBeforeUsage(interval, minSplitPos, registerAvailableUntil); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
572 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
573 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
574 void splitAndSpillInterval(Interval interval) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
575 assert interval.state == State.Active || interval.state == State.Inactive : "other states not allowed"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
576 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
577 int currentPos = currentPosition; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
578 if (interval.state == State.Inactive) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
579 // the interval is currently inactive, so no spill slot is needed for now. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
580 // when the split part is activated, the interval has a new chance to get a register, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
581 // so in the best case no stack slot is necessary |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
582 assert interval.hasHoleBetween(currentPos - 1, currentPos + 1) : "interval can not be inactive otherwise"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
583 splitBeforeUsage(interval, currentPos + 1, currentPos + 1); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
584 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
585 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
586 // search the position where the interval must have a register and split |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
587 // at the optimal position before. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
588 // The new created part is added to the unhandled list and will get a register |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
589 // when it is activated |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
590 int minSplitPos = currentPos + 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
591 int maxSplitPos = Math.min(interval.nextUsage(RegisterPriority.MustHaveRegister, minSplitPos), interval.to()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
592 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
593 splitBeforeUsage(interval, minSplitPos, maxSplitPos); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
594 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
595 assert interval.nextUsage(RegisterPriority.MustHaveRegister, currentPos) == Integer.MAX_VALUE : "the remaining part is spilled to stack and therefore has no register"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
596 splitForSpilling(interval); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
597 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
598 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
599 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
600 boolean allocFreeRegister(Interval interval) { |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
601 try (Indent indent = Debug.logAndIndent("trying to find free register for %s", interval)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
602 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
603 initUseLists(true); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
604 freeExcludeActiveFixed(); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
605 freeExcludeActiveAny(); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
606 freeCollectInactiveFixed(interval); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
607 freeCollectInactiveAny(interval); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
608 // freeCollectUnhandled(fixedKind, cur); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
609 assert unhandledLists.get(RegisterBinding.Fixed) == Interval.EndMarker : "must not have unhandled fixed intervals because all fixed intervals have a use at position 0"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
610 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
611 // usePos contains the start of the next interval that has this register assigned |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
612 // (either as a fixed register or a normal allocated register in the past) |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
613 // only intervals overlapping with cur are processed, non-overlapping invervals can be |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
614 // ignored safely |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
615 if (Debug.isLogEnabled()) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
616 // Enable this logging to see all register states |
13546
43bd3d7254d1
don?t explicitly disable debug log output in linear scan and graphbuilder
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13467
diff
changeset
|
617 try (Indent indent2 = Debug.logAndIndent("state of registers:")) { |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
618 for (Register register : availableRegs) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
619 int i = register.number; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
620 Debug.log("reg %d: usePos: %d", register.number, usePos[i]); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
621 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
622 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
623 } |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
624 |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
625 Register hint = null; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
626 Interval locationHint = interval.locationHint(true); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
627 if (locationHint != null && locationHint.location() != null && isRegister(locationHint.location())) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
628 hint = asRegister(locationHint.location()); |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
629 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
630 Debug.log("hint register %d from interval %s", hint.number, locationHint); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
631 } |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
632 } |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
633 assert interval.location() == null : "register already assigned to interval"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
634 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
635 // the register must be free at least until this position |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
636 int regNeededUntil = interval.from() + 1; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
637 int intervalTo = interval.to(); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
638 |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
639 boolean needSplit = false; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
640 int splitPos = -1; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
641 |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
642 Register reg = null; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
643 Register minFullReg = null; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
644 Register maxPartialReg = null; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
645 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
646 for (int i = 0; i < availableRegs.length; ++i) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
647 Register availableReg = availableRegs[i]; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
648 int number = availableReg.number; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
649 if (usePos[number] >= intervalTo) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
650 // this register is free for the full interval |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
651 if (minFullReg == null || availableReg.equals(hint) || (usePos[number] < usePos[minFullReg.number] && !minFullReg.equals(hint))) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
652 minFullReg = availableReg; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
653 } |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
654 } else if (usePos[number] > regNeededUntil) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
655 // this register is at least free until regNeededUntil |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
656 if (maxPartialReg == null || availableReg.equals(hint) || (usePos[number] > usePos[maxPartialReg.number] && !maxPartialReg.equals(hint))) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
657 maxPartialReg = availableReg; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
658 } |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
659 } |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
660 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
661 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
662 if (minFullReg != null) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
663 reg = minFullReg; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
664 } else if (maxPartialReg != null) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
665 needSplit = true; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
666 reg = maxPartialReg; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
667 } else { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
668 return false; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
669 } |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
670 |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
671 splitPos = usePos[reg.number]; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
672 interval.assignLocation(reg.asValue(interval.kind())); |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
673 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
674 Debug.log("selected register %d", reg.number); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
675 } |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
676 |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
677 assert splitPos > 0 : "invalid splitPos"; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
678 if (needSplit) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
679 // register not available for full interval, so split it |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
680 splitWhenPartialRegisterAvailable(interval, splitPos); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
681 } |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
682 // only return true if interval is completely assigned |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
683 return true; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
684 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
685 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
686 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
687 void splitAndSpillIntersectingIntervals(Register reg) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
688 assert reg != null : "no register assigned"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
689 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
690 for (int i = 0; i < spillIntervals[reg.number].size(); i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
691 Interval interval = spillIntervals[reg.number].get(i); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
692 removeFromList(interval); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
693 splitAndSpillInterval(interval); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
694 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
695 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
696 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
697 // Split an Interval and spill it to memory so that cur can be placed in a register |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
698 void allocLockedRegister(Interval interval) { |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
699 try (Indent indent = Debug.logAndIndent("alloc locked register: need to split and spill to get register for %s", interval)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
700 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
701 // collect current usage of registers |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
702 initUseLists(false); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
703 spillExcludeActiveFixed(); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
704 // spillBlockUnhandledFixed(cur); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
705 assert unhandledLists.get(RegisterBinding.Fixed) == Interval.EndMarker : "must not have unhandled fixed intervals because all fixed intervals have a use at position 0"; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
706 spillBlockInactiveFixed(interval); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
707 spillCollectActiveAny(); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
708 spillCollectInactiveAny(interval); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
709 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
710 if (Debug.isLogEnabled()) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
711 try (Indent indent2 = Debug.logAndIndent("state of registers:")) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
712 for (Register reg : availableRegs) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
713 int i = reg.number; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
714 try (Indent indent3 = Debug.logAndIndent("reg %d: usePos: %d, blockPos: %d, intervals: ", i, usePos[i], blockPos[i])) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
715 for (int j = 0; j < spillIntervals[i].size(); j++) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
716 Debug.log("%d ", spillIntervals[i].get(j).operandNumber); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
717 } |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
718 } |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
719 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
720 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
721 } |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
722 |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
723 // the register must be free at least until this position |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
724 int firstUsage = interval.firstUsage(RegisterPriority.MustHaveRegister); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
725 int regNeededUntil = Math.min(firstUsage, interval.from() + 1); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
726 int intervalTo = interval.to(); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
727 assert regNeededUntil > 0 && regNeededUntil < Integer.MAX_VALUE : "interval has no use"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
728 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
729 Register reg = null; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
730 Register ignore = interval.location() != null && isRegister(interval.location()) ? asRegister(interval.location()) : null; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
731 for (Register availableReg : availableRegs) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
732 int number = availableReg.number; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
733 if (availableReg.equals(ignore)) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
734 // this register must be ignored |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
735 } else if (usePos[number] > regNeededUntil) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
736 if (reg == null || (usePos[number] > usePos[reg.number])) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
737 reg = availableReg; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
738 } |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
739 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
740 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
741 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
742 int regUsePos = (reg == null ? 0 : usePos[reg.number]); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
743 if (regUsePos <= firstUsage) { |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
744 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
745 Debug.log("able to spill current interval. firstUsage(register): %d, usePos: %d", firstUsage, regUsePos); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
746 } |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
747 |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
748 if (firstUsage <= interval.from() + 1) { |
20917
6aea1527de7b
Add OutOfRegistersException.
Josef Eisl <josef.eisl@jku.at>
parents:
20915
diff
changeset
|
749 String description = "cannot spill interval that is used in first instruction (possible reason: no register found) firstUsage=" + firstUsage + ", interval.from()=" + |
20993
ec36daea3cf0
When OutOfRegisters, give a hint in the exceptions description, which kind of register is running out
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
20921
diff
changeset
|
750 interval.from() + "; already used candidates: " + Arrays.toString(availableRegs); |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
751 // assign a reasonable register and do a bailout in product mode to avoid errors |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
752 allocator.assignSpillSlot(interval); |
20921
2b10bb41a298
LinearScan: dump intervals before throwing a OutOfRegistersException.
Josef Eisl <josef.eisl@jku.at>
parents:
20917
diff
changeset
|
753 allocator.printIntervals(description); |
20917
6aea1527de7b
Add OutOfRegistersException.
Josef Eisl <josef.eisl@jku.at>
parents:
20915
diff
changeset
|
754 throw new OutOfRegistersException("LinearScan: no register found", description); |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
755 } |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
756 |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
757 splitAndSpillInterval(interval); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
758 return; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
759 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
760 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
761 boolean needSplit = blockPos[reg.number] <= intervalTo; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
762 |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
763 int splitPos = blockPos[reg.number]; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
764 |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
765 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
766 Debug.log("decided to use register %d", reg.number); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
767 } |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
768 assert splitPos > 0 : "invalid splitPos"; |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
769 assert needSplit || splitPos > interval.from() : "splitting interval at from"; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
770 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
771 interval.assignLocation(reg.asValue(interval.kind())); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
772 if (needSplit) { |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
773 // register not available for full interval : so split it |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
774 splitWhenPartialRegisterAvailable(interval, splitPos); |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
775 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
776 |
13467
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
777 // perform splitting and spilling for all affected intervals |
7c694e3e97e5
remove remaining old style TTY debug logging in LinearScan and remove TraceLinearScan option
Erik Eckstein <erik.eckstein@oracle.com>
parents:
13463
diff
changeset
|
778 splitAndSpillIntersectingIntervals(reg); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
779 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
780 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
781 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
782 boolean noAllocationPossible(Interval interval) { |
10961 | 783 if (allocator.callKillsRegisters) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
784 // fast calculation of intervals that can never get a register because the |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
785 // the next instruction is a call that blocks all registers |
6581
2a456986716b
removed Architecture.isX86() and Architecture.isSPARC()
Doug Simon <doug.simon@oracle.com>
parents:
6529
diff
changeset
|
786 // Note: this only works if a call kills all registers |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
787 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
788 // check if this interval is the result of a split operation |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
789 // (an interval got a register until this position) |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
790 int pos = interval.from(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
791 if (isOdd(pos)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
792 // the current instruction is a call that blocks all registers |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
793 if (pos < allocator.maxOpId() && allocator.hasCall(pos + 1) && interval.to() > pos + 1) { |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
794 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
795 Debug.log("free register cannot be available because all registers blocked by following call"); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
796 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
797 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
798 // safety check that there is really no register available |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
799 assert !allocFreeRegister(interval) : "found a register for this interval"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
800 return true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
801 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
802 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
803 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
804 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
805 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
806 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
807 void initVarsForAlloc(Interval interval) { |
20915
916aac9fe6f7
LinearScan: use RegisterAllocationConfig.
Josef Eisl <josef.eisl@jku.at>
parents:
20913
diff
changeset
|
808 availableRegs = allocator.regAllocConfig.getAllocatableRegisters(interval.kind().getPlatformKind()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
809 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
810 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
811 static boolean isMove(LIRInstruction op, Interval from, Interval to) { |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
812 if (op instanceof MoveOp) { |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4265
diff
changeset
|
813 MoveOp move = (MoveOp) op; |
9632
97db51025787
Value: use `equals()' instead of object equality
Bernhard Urban <bernhard.urban@jku.at>
parents:
9425
diff
changeset
|
814 if (isVariable(move.getInput()) && isVariable(move.getResult())) { |
97db51025787
Value: use `equals()' instead of object equality
Bernhard Urban <bernhard.urban@jku.at>
parents:
9425
diff
changeset
|
815 return move.getInput() != null && move.getInput().equals(from.operand) && move.getResult() != null && move.getResult().equals(to.operand); |
97db51025787
Value: use `equals()' instead of object equality
Bernhard Urban <bernhard.urban@jku.at>
parents:
9425
diff
changeset
|
816 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
817 } |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4207
diff
changeset
|
818 return false; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
819 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
820 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
821 // optimization (especially for phi functions of nested loops): |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
822 // assign same spill slot to non-intersecting intervals |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
823 void combineSpilledIntervals(Interval interval) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
824 if (interval.isSplitChild()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
825 // optimization is only suitable for split parents |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
826 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
827 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
828 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
829 Interval registerHint = interval.locationHint(false); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
830 if (registerHint == null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
831 // cur is not the target of a move : otherwise registerHint would be set |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
832 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
833 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
834 assert registerHint.isSplitParent() : "register hint must be split parent"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
835 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
836 if (interval.spillState() != SpillState.NoOptimization || registerHint.spillState() != SpillState.NoOptimization) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
837 // combining the stack slots for intervals where spill move optimization is applied |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
838 // is not benefitial and would cause problems |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
839 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
840 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
841 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
842 int beginPos = interval.from(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
843 int endPos = interval.to(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
844 if (endPos > allocator.maxOpId() || isOdd(beginPos) || isOdd(endPos)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
845 // safety check that lirOpWithId is allowed |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
846 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
847 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
848 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
849 if (!isMove(allocator.instructionForId(beginPos), registerHint, interval) || !isMove(allocator.instructionForId(endPos), interval, registerHint)) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
850 // cur and registerHint are not connected with two moves |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
851 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
852 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
853 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
854 Interval beginHint = registerHint.getSplitChildAtOpId(beginPos, LIRInstruction.OperandMode.USE, allocator); |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
855 Interval endHint = registerHint.getSplitChildAtOpId(endPos, LIRInstruction.OperandMode.DEF, allocator); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
856 if (beginHint == endHint || beginHint.to() != beginPos || endHint.from() != endPos) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
857 // registerHint must be split : otherwise the re-writing of use positions does not work |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
858 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
859 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
860 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
861 assert beginHint.location() != null : "must have register assigned"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
862 assert endHint.location() == null : "must not have register assigned"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
863 assert interval.firstUsage(RegisterPriority.MustHaveRegister) == beginPos : "must have use position at begin of interval because of move"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
864 assert endHint.firstUsage(RegisterPriority.MustHaveRegister) == endPos : "must have use position at begin of interval because of move"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
865 |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4165
diff
changeset
|
866 if (isRegister(beginHint.location())) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
867 // registerHint is not spilled at beginPos : so it would not be benefitial to |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7497
diff
changeset
|
868 // immediately spill cur |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
869 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
870 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
871 assert registerHint.spillSlot() != null : "must be set when part of interval was spilled"; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
872 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
873 // modify intervals such that cur gets the same stack slot as registerHint |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
874 // delete use positions to prevent the intervals to get a register at beginning |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
875 interval.setSpillSlot(registerHint.spillSlot()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
876 interval.removeFirstUsePos(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
877 endHint.removeFirstUsePos(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
878 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
879 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
880 // allocate a physical register or memory location to an interval |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
881 @Override |
15903
5d734275cc5f
LSRA: make IntervalWalker.currentInterval private.
Josef Eisl <josef.eisl@jku.at>
parents:
15902
diff
changeset
|
882 protected boolean activateCurrent(Interval interval) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
883 boolean result = true; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
884 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
885 try (Indent indent = Debug.logAndIndent("activating interval %s, splitParent: %d", interval, interval.splitParent().operandNumber)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
886 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
887 final Value operand = interval.operand; |
18436
59e65d3aa2fc
Use StackSlotValue where appropriate.
Josef Eisl <josef.eisl@jku.at>
parents:
18150
diff
changeset
|
888 if (interval.location() != null && isStackSlotValue(interval.location())) { |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
889 // activating an interval that has a stack slot assigned . split it at first use |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
890 // position |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
891 // used for method parameters |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
892 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
893 Debug.log("interval has spill slot assigned (method parameter) . split it before first use"); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
894 } |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
895 splitStackInterval(interval); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
896 result = false; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
897 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
898 } else { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
899 if (interval.location() == null) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
900 // interval has not assigned register . normal allocation |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
901 // (this is the normal case for most intervals) |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
902 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
903 Debug.log("normal allocation of register"); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
904 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
905 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
906 // assign same spill slot to non-intersecting intervals |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
907 combineSpilledIntervals(interval); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
908 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
909 initVarsForAlloc(interval); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
910 if (noAllocationPossible(interval) || !allocFreeRegister(interval)) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
911 // no empty register available. |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
912 // split and spill another interval so that this interval gets a register |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
913 allocLockedRegister(interval); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
914 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
915 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
916 // spilled intervals need not be move to active-list |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
917 if (!isRegister(interval.location())) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
918 result = false; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
919 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
920 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
921 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
922 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
923 // load spilled values that become active from stack slot to register |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
924 if (interval.insertMoveWhenActivated()) { |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
925 assert interval.isSplitChild(); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
926 assert interval.currentSplitChild() != null; |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
927 assert !interval.currentSplitChild().operand.equals(operand) : "cannot insert move between same interval"; |
20980
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
928 if (Debug.isLogEnabled()) { |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
929 Debug.log("Inserting move from interval %d to %d because insertMoveWhenActivated is set", interval.currentSplitChild().operandNumber, interval.operandNumber); |
abc059cb0acf
Guard usages of Debug.log in LinearScan
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20979
diff
changeset
|
930 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
931 |
14871
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
932 insertMove(interval.from(), interval.currentSplitChild(), interval); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
933 } |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
934 interval.makeCurrentSplitChild(); |
667710021ea1
removed methods in Indent that are redundant with those in Debug
Doug Simon <doug.simon@oracle.com>
parents:
14850
diff
changeset
|
935 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
936 } |
13340
9423a38d6437
added rematerialization of constants in LinearScan, but still disabled
Erik Eckstein <erik.eckstein@oracle.com>
parents:
12683
diff
changeset
|
937 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
938 return result; // true = interval is moved to active list |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
939 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
940 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
941 public void finishAllocation() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
942 // must be called when all intervals are allocated |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
943 moveResolver.resolveAndAppendMoves(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
944 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
945 } |