1 /*
2 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
127 return any();
128 }
129
130 @Override
131 public MemoryNode getLastLocationAccess() {
132 return lastLocationAccess;
133 }
134
135 @Override
136 public void setLastLocationAccess(MemoryNode lla) {
137 updateUsagesInterface(lastLocationAccess, lla);
138 lastLocationAccess = lla;
139 }
140
141 @Override
142 public void lower(LoweringTool tool) {
143 tool.getLowerer().lower(this, tool);
144 }
145
146 private static boolean checkBounds(int position, int length, VirtualObjectNode virtualObject) {
147 return position >= 0 && position + length <= virtualObject.entryCount();
148 }
149
150 private static boolean checkEntryTypes(int srcPos, int length, VirtualObjectNode src, ResolvedJavaType destComponentType, VirtualizerTool tool) {
151 if (destComponentType.getJavaKind() == JavaKind.Object && !destComponentType.isJavaLangObject()) {
152 for (int i = 0; i < length; i++) {
153 ValueNode entry = tool.getEntry(src, srcPos + i);
154 ResolvedJavaType type = StampTool.typeOrNull(entry);
155 if (type == null || !destComponentType.isAssignableFrom(type)) {
156 return false;
157 }
158 }
159 }
160 return true;
161 }
162
163 /*
164 * Returns true if this copy doesn't require store checks. Trivially true for primitive arrays.
165 */
166 public boolean isExact() {
167 ResolvedJavaType srcType = StampTool.typeOrNull(getSource().stamp(NodeView.DEFAULT));
|
1 /*
2 * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
127 return any();
128 }
129
130 @Override
131 public MemoryNode getLastLocationAccess() {
132 return lastLocationAccess;
133 }
134
135 @Override
136 public void setLastLocationAccess(MemoryNode lla) {
137 updateUsagesInterface(lastLocationAccess, lla);
138 lastLocationAccess = lla;
139 }
140
141 @Override
142 public void lower(LoweringTool tool) {
143 tool.getLowerer().lower(this, tool);
144 }
145
146 private static boolean checkBounds(int position, int length, VirtualObjectNode virtualObject) {
147 assert length >= 0;
148 return position >= 0 && position <= virtualObject.entryCount() - length;
149 }
150
151 private static boolean checkEntryTypes(int srcPos, int length, VirtualObjectNode src, ResolvedJavaType destComponentType, VirtualizerTool tool) {
152 if (destComponentType.getJavaKind() == JavaKind.Object && !destComponentType.isJavaLangObject()) {
153 for (int i = 0; i < length; i++) {
154 ValueNode entry = tool.getEntry(src, srcPos + i);
155 ResolvedJavaType type = StampTool.typeOrNull(entry);
156 if (type == null || !destComponentType.isAssignableFrom(type)) {
157 return false;
158 }
159 }
160 }
161 return true;
162 }
163
164 /*
165 * Returns true if this copy doesn't require store checks. Trivially true for primitive arrays.
166 */
167 public boolean isExact() {
168 ResolvedJavaType srcType = StampTool.typeOrNull(getSource().stamp(NodeView.DEFAULT));
|