Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneSnippets.java @ 11839:0e2cceed1caf
Temporarily move encodeDeoptActionAndReason to MetaAccessProvider
Add AbstractDeoptimizeNode.getActionAndReason
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Mon, 30 Sep 2013 16:09:40 +0200 |
parents | 8db5e8c4f542 |
children | 69a527047c40 |
rev | line source |
---|---|
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
1 /* |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
4 * |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
8 * |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
14 * |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
18 * |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
21 * questions. |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
22 */ |
8415
2361bf148c06
rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents:
8413
diff
changeset
|
23 package com.oracle.graal.hotspot.replacements; |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
24 |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9688
diff
changeset
|
25 import static com.oracle.graal.api.meta.LocationIdentity.*; |
9513
659bb6cf930c
rename: HotSpotSnippetUtils -> HotSpotReplacementsUtil
Doug Simon <doug.simon@oracle.com>
parents:
9316
diff
changeset
|
26 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; |
10787
388fbd0dd4a4
moved BranchNodeProbabilities to graal.nodes project
Doug Simon <doug.simon@oracle.com>
parents:
10760
diff
changeset
|
27 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*; |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9793
diff
changeset
|
28 import static com.oracle.graal.phases.GraalOptions.*; |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
29 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
30 import java.lang.reflect.*; |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
31 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
32 import com.oracle.graal.api.meta.*; |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
33 import com.oracle.graal.graph.*; |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
34 import com.oracle.graal.nodes.*; |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
35 import com.oracle.graal.nodes.java.*; |
8415
2361bf148c06
rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents:
8413
diff
changeset
|
36 import com.oracle.graal.replacements.*; |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
37 import com.oracle.graal.word.*; |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
38 |
8413
d9347ee39fbe
rename: SnippetsInterface -> Snippets
Doug Simon <doug.simon@oracle.com>
parents:
7868
diff
changeset
|
39 public class ObjectCloneSnippets implements Snippets { |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
40 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
41 public static final Method instanceCloneMethod = getCloneMethod("instanceClone"); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
42 public static final Method arrayCloneMethod = getCloneMethod("arrayClone"); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
43 public static final Method genericCloneMethod = getCloneMethod("genericClone"); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
44 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
45 private static Method getCloneMethod(String name) { |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
46 try { |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
47 return ObjectCloneSnippets.class.getDeclaredMethod(name, Object.class); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
48 } catch (SecurityException | NoSuchMethodException e) { |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
49 throw new GraalInternalError(e); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
50 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
51 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
52 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
53 private static Object instanceClone(Object src, Word hub, int layoutHelper) { |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
54 int instanceSize = layoutHelper; |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7764
diff
changeset
|
55 Word prototypeMarkWord = hub.readWord(prototypeMarkWordOffset(), PROTOTYPE_MARK_WORD_LOCATION); |
10760
59d2d6a30d29
Re-enable omission of array initialization for G1.
Roland Schatz <roland.schatz@oracle.com>
parents:
10745
diff
changeset
|
56 Object result = NewObjectSnippets.allocateInstance(instanceSize, hub, prototypeMarkWord, false); |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
57 |
10745
cbaf26740df8
Method renaming
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10717
diff
changeset
|
58 for (int offset = instanceHeaderSize(); offset < instanceSize; offset += wordSize()) { |
11816
8db5e8c4f542
Provide object read/write methods similar to Pointer.readXxxx/writeXxx that do not require casts to Word first, and use them in relevant places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
10787
diff
changeset
|
59 /* |
8db5e8c4f542
Provide object read/write methods similar to Pointer.readXxxx/writeXxx that do not require casts to Word first, and use them in relevant places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
10787
diff
changeset
|
60 * TODO atomicity problem on 32-bit architectures: The JVM spec requires double values |
8db5e8c4f542
Provide object read/write methods similar to Pointer.readXxxx/writeXxx that do not require casts to Word first, and use them in relevant places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
10787
diff
changeset
|
61 * to be copied atomically, but here they are copied as two 4-byte word values. |
8db5e8c4f542
Provide object read/write methods similar to Pointer.readXxxx/writeXxx that do not require casts to Word first, and use them in relevant places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
10787
diff
changeset
|
62 */ |
8db5e8c4f542
Provide object read/write methods similar to Pointer.readXxxx/writeXxx that do not require casts to Word first, and use them in relevant places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
10787
diff
changeset
|
63 ObjectAccess.writeWord(result, offset, ObjectAccess.readWord(src, offset, ANY_LOCATION), ANY_LOCATION); |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
64 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
65 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
66 return result; |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
67 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
68 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
69 private static Object arrayClone(Object src, Word hub, int layoutHelper) { |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
70 int arrayLength = ArrayLengthNode.arrayLength(src); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
71 int log2ElementSize = (layoutHelper >> layoutHelperLog2ElementSizeShift()) & layoutHelperLog2ElementSizeMask(); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
72 int headerSize = (layoutHelper >> layoutHelperHeaderSizeShift()) & layoutHelperHeaderSizeMask(); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
73 int sizeInBytes = NewObjectSnippets.computeArrayAllocationSize(arrayLength, wordSize(), headerSize, log2ElementSize); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
74 |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7764
diff
changeset
|
75 Word prototypeMarkWord = hub.readWord(prototypeMarkWordOffset(), PROTOTYPE_MARK_WORD_LOCATION); |
10760
59d2d6a30d29
Re-enable omission of array initialization for G1.
Roland Schatz <roland.schatz@oracle.com>
parents:
10745
diff
changeset
|
76 Object result = NewObjectSnippets.allocateArray(hub, arrayLength, prototypeMarkWord, headerSize, log2ElementSize, false); |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
77 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
78 for (int offset = headerSize; offset < sizeInBytes; offset += wordSize()) { |
11816
8db5e8c4f542
Provide object read/write methods similar to Pointer.readXxxx/writeXxx that do not require casts to Word first, and use them in relevant places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
10787
diff
changeset
|
79 /* |
8db5e8c4f542
Provide object read/write methods similar to Pointer.readXxxx/writeXxx that do not require casts to Word first, and use them in relevant places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
10787
diff
changeset
|
80 * TODO atomicity problem on 32-bit architectures: The JVM spec requires double values |
8db5e8c4f542
Provide object read/write methods similar to Pointer.readXxxx/writeXxx that do not require casts to Word first, and use them in relevant places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
10787
diff
changeset
|
81 * to be copied atomically, but here they are copied as two 4-byte word values. |
8db5e8c4f542
Provide object read/write methods similar to Pointer.readXxxx/writeXxx that do not require casts to Word first, and use them in relevant places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
10787
diff
changeset
|
82 */ |
8db5e8c4f542
Provide object read/write methods similar to Pointer.readXxxx/writeXxx that do not require casts to Word first, and use them in relevant places
Christian Wimmer <christian.wimmer@oracle.com>
parents:
10787
diff
changeset
|
83 ObjectAccess.writeWord(result, offset, ObjectAccess.readWord(src, offset, ANY_LOCATION), ANY_LOCATION); |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
84 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
85 return result; |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
86 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
87 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
88 private static Word getAndCheckHub(Object src) { |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
89 Word hub = loadHub(src); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
90 if (!(src instanceof Cloneable)) { |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
91 DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
92 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
93 return hub; |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
94 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
95 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
96 @Snippet |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
97 public static Object instanceClone(Object src) { |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
98 instanceCloneCounter.inc(); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
99 Word hub = getAndCheckHub(src); |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7764
diff
changeset
|
100 return instanceClone(src, hub, hub.readInt(layoutHelperOffset(), FINAL_LOCATION)); |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
101 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
102 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
103 @Snippet |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
104 public static Object arrayClone(Object src) { |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
105 arrayCloneCounter.inc(); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
106 Word hub = getAndCheckHub(src); |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7764
diff
changeset
|
107 int layoutHelper = hub.readInt(layoutHelperOffset(), FINAL_LOCATION); |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
108 return arrayClone(src, hub, layoutHelper); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
109 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
110 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
111 @Snippet |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
112 public static Object genericClone(Object src) { |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
113 genericCloneCounter.inc(); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
114 Word hub = getAndCheckHub(src); |
7868
7a5bbcc36bb2
add location identity to Pointer read and write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
7764
diff
changeset
|
115 int layoutHelper = hub.readInt(layoutHelperOffset(), FINAL_LOCATION); |
9316
5e1465ec46d6
Change the way branch probabilities are injected. Update all snippets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8634
diff
changeset
|
116 if (probability(LIKELY_PROBABILITY, layoutHelper < 0)) { |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
117 genericArrayCloneCounter.inc(); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
118 return arrayClone(src, hub, layoutHelper); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
119 } else { |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
120 genericInstanceCloneCounter.inc(); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
121 return instanceClone(src, hub, layoutHelper); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
122 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
123 } |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
124 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9793
diff
changeset
|
125 private static final SnippetCounter.Group cloneCounters = SnippetCounters.getValue() ? new SnippetCounter.Group("Object.clone") : null; |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
126 private static final SnippetCounter instanceCloneCounter = new SnippetCounter(cloneCounters, "instanceClone", "clone snippet for instances"); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
127 private static final SnippetCounter arrayCloneCounter = new SnippetCounter(cloneCounters, "arrayClone", "clone snippet for arrays"); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
128 private static final SnippetCounter genericCloneCounter = new SnippetCounter(cloneCounters, "genericClone", "clone snippet for arrays and instances"); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
129 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9793
diff
changeset
|
130 private static final SnippetCounter.Group genericCloneCounters = SnippetCounters.getValue() ? new SnippetCounter.Group("Object.clone generic snippet") : null; |
7764
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
131 private static final SnippetCounter genericInstanceCloneCounter = new SnippetCounter(genericCloneCounters, "genericInstanceClone", "generic clone implementation took instance path"); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
132 private static final SnippetCounter genericArrayCloneCounter = new SnippetCounter(genericCloneCounters, "genericArrayClone", "generic clone implementation took array path"); |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
133 |
cff55cdeea48
implement Object.clone snippets and macro node
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
134 } |