Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewInstanceSnippets.java @ 5720:46ad94a0574a
moved everything from com.oracle.graal.nodes.cri into com.oracle.graal.nodes.spi
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 28 Jun 2012 13:39:40 +0200 |
parents | 10341299528c |
children |
rev | line source |
---|---|
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.snippets; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
5683
0ca242de9383
improved type stamp for value flowing out of a lowered NEW bytecode instruction
Doug Simon <doug.simon@oracle.com>
parents:
5679
diff
changeset
|
25 import static com.oracle.graal.hotspot.nodes.CastFromHub.*; |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 import static com.oracle.graal.hotspot.nodes.RegisterNode.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import static com.oracle.graal.hotspot.snippets.DirectObjectStoreNode.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 import static com.oracle.graal.nodes.extended.UnsafeLoadNode.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 import static com.oracle.graal.snippets.SnippetTemplate.Arguments.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import static com.oracle.graal.snippets.nodes.ExplodeLoopNode.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 import static com.oracle.max.asm.target.amd64.AMD64.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 import com.oracle.graal.api.code.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 import com.oracle.graal.api.meta.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.graal.debug.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 import com.oracle.graal.graph.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 import com.oracle.graal.hotspot.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 import com.oracle.graal.hotspot.meta.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 import com.oracle.graal.hotspot.nodes.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 import com.oracle.graal.nodes.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 import com.oracle.graal.nodes.java.*; |
5720
46ad94a0574a
moved everything from com.oracle.graal.nodes.cri into com.oracle.graal.nodes.spi
Doug Simon <doug.simon@oracle.com>
parents:
5718
diff
changeset
|
42 import com.oracle.graal.nodes.spi.*; |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 import com.oracle.graal.snippets.*; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 import com.oracle.graal.snippets.Snippet.ConstantParameter; |
5576
a4d0ded32ddd
moved @Fold from Node.java to Snippet.java
Doug Simon <doug.simon@oracle.com>
parents:
5563
diff
changeset
|
45 import com.oracle.graal.snippets.Snippet.Fold; |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 import com.oracle.graal.snippets.Snippet.Parameter; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 import com.oracle.graal.snippets.SnippetTemplate.Arguments; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 import com.oracle.graal.snippets.SnippetTemplate.Cache; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 import com.oracle.graal.snippets.SnippetTemplate.Key; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 /** |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 * Snippets used for implementing NEW. |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 */ |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 public class NewInstanceSnippets implements SnippetsInterface { |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
56 @Snippet |
5666
48a2505efb54
added verification phase for snippets to ensure word types are not incorrectly mixed with Object types
Doug Simon <doug.simon@oracle.com>
parents:
5663
diff
changeset
|
57 public static Word allocate(@ConstantParameter("size") int size) { |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
58 Word thread = asWord(register(r15, wordKind())); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
59 Word top = loadWord(thread, threadTlabTopOffset()); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
60 Word end = loadWord(thread, threadTlabEndOffset()); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
61 Word newTop = top.plus(size); |
5666
48a2505efb54
added verification phase for snippets to ensure word types are not incorrectly mixed with Object types
Doug Simon <doug.simon@oracle.com>
parents:
5663
diff
changeset
|
62 if (newTop.belowOrEqual(end)) { |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
63 store(thread, 0, threadTlabTopOffset(), newTop); |
5666
48a2505efb54
added verification phase for snippets to ensure word types are not incorrectly mixed with Object types
Doug Simon <doug.simon@oracle.com>
parents:
5663
diff
changeset
|
64 return top; |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
65 } |
5666
48a2505efb54
added verification phase for snippets to ensure word types are not incorrectly mixed with Object types
Doug Simon <doug.simon@oracle.com>
parents:
5663
diff
changeset
|
66 return Word.zero(); |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
67 } |
5587
bf4f499cc538
added allocation logging to NewInstanceSnippets
Doug Simon <doug.simon@oracle.com>
parents:
5576
diff
changeset
|
68 |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 @Snippet |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
70 public static Object initialize( |
5666
48a2505efb54
added verification phase for snippets to ensure word types are not incorrectly mixed with Object types
Doug Simon <doug.simon@oracle.com>
parents:
5663
diff
changeset
|
71 @Parameter("memory") Word memory, |
5602
e79b593e0632
made NewInstanceSnippets respect the UseTLAB HotSpot option
Doug Simon <doug.simon@oracle.com>
parents:
5594
diff
changeset
|
72 @Parameter("hub") Object hub, |
5686
6cb39a47da14
replaced loading of instance prototype header word with a constant obtained from HotSpotResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
5683
diff
changeset
|
73 @Parameter("prototypeHeader") Word headerPrototype, |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
74 @ConstantParameter("size") int size) { |
5602
e79b593e0632
made NewInstanceSnippets respect the UseTLAB HotSpot option
Doug Simon <doug.simon@oracle.com>
parents:
5594
diff
changeset
|
75 |
5666
48a2505efb54
added verification phase for snippets to ensure word types are not incorrectly mixed with Object types
Doug Simon <doug.simon@oracle.com>
parents:
5663
diff
changeset
|
76 if (memory == Word.zero()) { |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
77 return NewInstanceStubCall.call(hub); |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 } |
5686
6cb39a47da14
replaced loading of instance prototype header word with a constant obtained from HotSpotResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
5683
diff
changeset
|
79 formatObject(hub, size, memory, headerPrototype); |
5666
48a2505efb54
added verification phase for snippets to ensure word types are not incorrectly mixed with Object types
Doug Simon <doug.simon@oracle.com>
parents:
5663
diff
changeset
|
80 Object instance = memory.toObject(); |
5683
0ca242de9383
improved type stamp for value flowing out of a lowered NEW bytecode instruction
Doug Simon <doug.simon@oracle.com>
parents:
5679
diff
changeset
|
81 return castFromHub(verifyOop(instance), hub); |
5624
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
82 } |
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
83 |
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
84 private static Object verifyOop(Object object) { |
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
85 if (verifyOops()) { |
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
86 VerifyOopStubCall.call(object); |
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
87 } |
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
88 return object; |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 private static Word asWord(Object object) { |
5666
48a2505efb54
added verification phase for snippets to ensure word types are not incorrectly mixed with Object types
Doug Simon <doug.simon@oracle.com>
parents:
5663
diff
changeset
|
92 return Word.fromObject(object); |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 |
5666
48a2505efb54
added verification phase for snippets to ensure word types are not incorrectly mixed with Object types
Doug Simon <doug.simon@oracle.com>
parents:
5663
diff
changeset
|
95 private static Word loadWord(Word address, int offset) { |
48a2505efb54
added verification phase for snippets to ensure word types are not incorrectly mixed with Object types
Doug Simon <doug.simon@oracle.com>
parents:
5663
diff
changeset
|
96 Object value = loadObject(address, 0, offset, true); |
48a2505efb54
added verification phase for snippets to ensure word types are not incorrectly mixed with Object types
Doug Simon <doug.simon@oracle.com>
parents:
5663
diff
changeset
|
97 return asWord(value); |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
99 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 /** |
5687
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
101 * Maximum size of an object whose body is initialized by a sequence of |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
102 * zero-stores to its fields. Larger objects have their bodies initialized |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
103 * in a loop. |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
104 */ |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
105 private static final int MAX_UNROLLED_OBJECT_INITIALIZATION_SIZE = 10 * wordSize(); |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
106 |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
107 /** |
5683
0ca242de9383
improved type stamp for value flowing out of a lowered NEW bytecode instruction
Doug Simon <doug.simon@oracle.com>
parents:
5679
diff
changeset
|
108 * Formats some allocated memory with an object header zeroes out the rest. |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 */ |
5686
6cb39a47da14
replaced loading of instance prototype header word with a constant obtained from HotSpotResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
5683
diff
changeset
|
110 private static void formatObject(Object hub, int size, Word memory, Word headerPrototype) { |
5683
0ca242de9383
improved type stamp for value flowing out of a lowered NEW bytecode instruction
Doug Simon <doug.simon@oracle.com>
parents:
5679
diff
changeset
|
111 store(memory, 0, 0, headerPrototype); |
0ca242de9383
improved type stamp for value flowing out of a lowered NEW bytecode instruction
Doug Simon <doug.simon@oracle.com>
parents:
5679
diff
changeset
|
112 store(memory, 0, hubOffset(), hub); |
5687
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
113 if (size <= MAX_UNROLLED_OBJECT_INITIALIZATION_SIZE) { |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
114 explodeLoop(); |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
115 for (int offset = 2 * wordSize(); offset < size; offset += wordSize()) { |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
116 store(memory, 0, offset, 0); |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
117 } |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
118 } else { |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
119 for (int offset = 2 * wordSize(); offset < size; offset += wordSize()) { |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
120 store(memory, 0, offset, 0); |
5d06e32f10df
limited length of zeroing instructions for object initialization to object below a certain size
Doug Simon <doug.simon@oracle.com>
parents:
5686
diff
changeset
|
121 } |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 @Fold |
5624
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
126 private static boolean verifyOops() { |
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
127 return HotSpotGraalRuntime.getInstance().getConfig().verifyOops; |
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
128 } |
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
129 |
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5616
diff
changeset
|
130 @Fold |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
131 private static int threadTlabTopOffset() { |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
132 return HotSpotGraalRuntime.getInstance().getConfig().threadTlabTopOffset; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
133 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 @Fold |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 private static int threadTlabEndOffset() { |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
137 return HotSpotGraalRuntime.getInstance().getConfig().threadTlabEndOffset; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 @Fold |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 private static Kind wordKind() { |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
142 return HotSpotGraalRuntime.getInstance().getTarget().wordKind; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 @Fold |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
146 private static int wordSize() { |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 return HotSpotGraalRuntime.getInstance().getTarget().wordSize; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
148 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
149 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
150 @Fold |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
151 private static int hubOffset() { |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
152 return HotSpotGraalRuntime.getInstance().getConfig().hubOffset; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
153 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
154 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
155 public static class Templates { |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
157 private final Cache cache; |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
158 private final ResolvedJavaMethod allocate; |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
159 private final ResolvedJavaMethod initialize; |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
160 private final CodeCacheProvider runtime; |
5602
e79b593e0632
made NewInstanceSnippets respect the UseTLAB HotSpot option
Doug Simon <doug.simon@oracle.com>
parents:
5594
diff
changeset
|
161 private final boolean useTLAB; |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
162 |
5602
e79b593e0632
made NewInstanceSnippets respect the UseTLAB HotSpot option
Doug Simon <doug.simon@oracle.com>
parents:
5594
diff
changeset
|
163 public Templates(CodeCacheProvider runtime, boolean useTLAB) { |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
164 this.runtime = runtime; |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
165 this.cache = new Cache(runtime); |
5602
e79b593e0632
made NewInstanceSnippets respect the UseTLAB HotSpot option
Doug Simon <doug.simon@oracle.com>
parents:
5594
diff
changeset
|
166 this.useTLAB = useTLAB; |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
167 try { |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
168 allocate = runtime.getResolvedJavaMethod(NewInstanceSnippets.class.getDeclaredMethod("allocate", int.class)); |
5686
6cb39a47da14
replaced loading of instance prototype header word with a constant obtained from HotSpotResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
5683
diff
changeset
|
169 initialize = runtime.getResolvedJavaMethod(NewInstanceSnippets.class.getDeclaredMethod("initialize", Word.class, Object.class, Word.class, int.class)); |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
170 } catch (NoSuchMethodException e) { |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
171 throw new GraalInternalError(e); |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
172 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
173 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
174 |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
175 /** |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
176 * Lowers a {@link NewInstanceNode}. |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
177 */ |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 @SuppressWarnings("unused") |
5718
10341299528c
renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents:
5687
diff
changeset
|
179 public void lower(NewInstanceNode newInstanceNode, LoweringTool tool) { |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
180 StructuredGraph graph = (StructuredGraph) newInstanceNode.graph(); |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
181 HotSpotResolvedJavaType type = (HotSpotResolvedJavaType) newInstanceNode.instanceClass(); |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
182 HotSpotKlassOop hub = type.klassOop(); |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
183 int size = type.instanceSize(); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
184 assert (size % wordSize()) == 0; |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
185 assert size >= 0; |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
186 |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
187 ValueNode memory; |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
188 if (!useTLAB) { |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
189 memory = ConstantNode.forObject(null, runtime, graph); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
190 } else { |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
191 TLABAllocateNode tlabAllocateNode = graph.add(new TLABAllocateNode(size, wordKind())); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
192 graph.addBeforeFixed(newInstanceNode, tlabAllocateNode); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
193 memory = tlabAllocateNode; |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
194 } |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
195 InitializeNode initializeNode = graph.add(new InitializeNode(memory, type)); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
196 graph.replaceFixedWithFixed(newInstanceNode, initializeNode); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
197 } |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
198 |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
199 @SuppressWarnings("unused") |
5718
10341299528c
renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents:
5687
diff
changeset
|
200 public void lower(TLABAllocateNode tlabAllocateNode, LoweringTool tool) { |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
201 StructuredGraph graph = (StructuredGraph) tlabAllocateNode.graph(); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
202 int size = tlabAllocateNode.size(); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
203 assert (size % wordSize()) == 0; |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
204 assert size >= 0; |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
205 Key key = new Key(allocate).add("size", size); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
206 Arguments arguments = new Arguments(); |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
207 SnippetTemplate template = cache.get(key); |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
208 Debug.log("Lowering fastAllocate in %s: node=%s, template=%s, arguments=%s", graph, tlabAllocateNode, template, arguments); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
209 template.instantiate(runtime, tlabAllocateNode, tlabAllocateNode, arguments); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
210 } |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
211 |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
212 @SuppressWarnings("unused") |
5718
10341299528c
renamings: ExtendedRiRuntime -> GraalCodeCacheProvider, CiLoweringTool -> LoweringTool, RiGraphCache -> GraphCache
Doug Simon <doug.simon@oracle.com>
parents:
5687
diff
changeset
|
213 public void lower(InitializeNode initializeNode, LoweringTool tool) { |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
214 StructuredGraph graph = (StructuredGraph) initializeNode.graph(); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
215 HotSpotResolvedJavaType type = (HotSpotResolvedJavaType) initializeNode.type(); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
216 HotSpotKlassOop hub = type.klassOop(); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
217 int size = type.instanceSize(); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
218 assert (size % wordSize()) == 0; |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
219 assert size >= 0; |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
220 Key key = new Key(initialize).add("size", size); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
221 ValueNode memory = initializeNode.memory(); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
222 //assert memory instanceof AllocateNode || memory instanceof ConstantNode : memory; |
5686
6cb39a47da14
replaced loading of instance prototype header word with a constant obtained from HotSpotResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
5683
diff
changeset
|
223 Arguments arguments = arguments("memory", memory).add("hub", hub).add("prototypeHeader", type.prototypeHeader()); |
5663
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
224 SnippetTemplate template = cache.get(key); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
225 Debug.log("Lowering initialize in %s: node=%s, template=%s, arguments=%s", graph, initializeNode, template, arguments); |
77069a28a983
split lowering of NEW into two separate nodes - one for doing the allocation and one for doing the object formatting. Both of these nodes are in turn lowered via snippets.
Doug Simon <doug.simon@oracle.com>
parents:
5648
diff
changeset
|
226 template.instantiate(runtime, initializeNode, initializeNode, arguments); |
5563
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
227 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
228 } |
6a2671066204
added NewInstanceSnippets for lowering NewInstanceNodes (currently disabled by default)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
229 } |