annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostForeignCallsProvider.java @ 20854:3081a57f95fd

converted @MethodSubstitutions for java.lang.Math to MethodSubstitutionPlugins moved support for AMD64 specific Math intrinsics into AMD64 specific name spaces
author Doug Simon <doug.simon@oracle.com>
date Wed, 08 Apr 2015 22:09:05 +0200
parents 63b6ad88b08f
children ac9d0db0716e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.hotspot.meta;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 import static com.oracle.graal.api.code.CallingConvention.Type.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 import static com.oracle.graal.api.meta.LocationIdentity.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27 import static com.oracle.graal.hotspot.HotSpotBackend.*;
19462
33a783b15758 made use of Graal stubs instead of equivalent HotSpot stubs optional and off by default
Doug Simon <doug.simon@oracle.com>
parents: 18593
diff changeset
28 import static com.oracle.graal.hotspot.HotSpotBackend.Options.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
30 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition.*;
19462
33a783b15758 made use of Graal stubs instead of equivalent HotSpot stubs optional and off by default
Doug Simon <doug.simon@oracle.com>
parents: 18593
diff changeset
31 import static com.oracle.graal.hotspot.HotSpotHostBackend.*;
15926
af0e42dad358 reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents: 15456
diff changeset
32 import static com.oracle.graal.hotspot.meta.DefaultHotSpotLoweringProvider.RuntimeCalls.*;
16084
b37dbfdfbbfb assertion mechanism for snippets and stubs
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16028
diff changeset
33 import static com.oracle.graal.hotspot.replacements.AssertionSnippets.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35 import static com.oracle.graal.hotspot.replacements.MonitorSnippets.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36 import static com.oracle.graal.hotspot.replacements.NewObjectSnippets.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
37 import static com.oracle.graal.hotspot.replacements.SystemSubstitutions.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38 import static com.oracle.graal.hotspot.replacements.ThreadSubstitutions.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39 import static com.oracle.graal.hotspot.replacements.WriteBarrierSnippets.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
40 import static com.oracle.graal.hotspot.stubs.ExceptionHandlerStub.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
41 import static com.oracle.graal.hotspot.stubs.NewArrayStub.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 import static com.oracle.graal.hotspot.stubs.NewInstanceStub.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
43 import static com.oracle.graal.hotspot.stubs.StubUtil.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
44 import static com.oracle.graal.hotspot.stubs.UnwindExceptionToCallerStub.*;
15926
af0e42dad358 reduced time to initialize ForeignCallProviders by avoiding triggering class initialization of Node subclasses as well as making annotation parsing lazy in SnippetInfo
Doug Simon <doug.simon@oracle.com>
parents: 15456
diff changeset
45 import static com.oracle.graal.nodes.java.ForeignCallDescriptors.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
46 import static com.oracle.graal.replacements.Log.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
47
13977
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
48 import java.util.*;
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
49
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
50 import com.oracle.graal.api.code.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
51 import com.oracle.graal.api.meta.*;
18114
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
52 import com.oracle.graal.compiler.common.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
53 import com.oracle.graal.hotspot.*;
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
54 import com.oracle.graal.hotspot.stubs.*;
13977
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
55 import com.oracle.graal.word.*;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
56
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
57 /**
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
58 * HotSpot implementation of {@link ForeignCallsProvider}.
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
59 */
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
60 public abstract class HotSpotHostForeignCallsProvider extends HotSpotForeignCallsProviderImpl {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
61
18525
c538c2c6b7e2 changed most references to HotSpotGraalRuntime to use HotSpotGraalRuntimeProvider instead
Doug Simon <doug.simon@oracle.com>
parents: 18227
diff changeset
62 public HotSpotHostForeignCallsProvider(HotSpotGraalRuntimeProvider runtime, MetaAccessProvider metaAccess, CodeCacheProvider codeCache) {
12588
3b178baf3edb fleshed out HSAIL backend a little to demonstrate changes needed after recent API/infrastructure updates
Doug Simon <doug.simon@oracle.com>
parents: 12559
diff changeset
63 super(runtime, metaAccess, codeCache);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
64 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
65
15104
ed29f7ff71eb add DeoptimizationStub
twisti
parents: 15041
diff changeset
66 protected static void link(Stub stub) {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
67 stub.getLinkage().setCompiledStub(stub);
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
68 }
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
69
18593
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
70 public static ForeignCallDescriptor lookupCheckcastArraycopyDescriptor(boolean uninit) {
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
71 return checkcastArraycopyDescriptors[uninit ? 1 : 0];
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
72 }
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
73
16028
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
74 public static ForeignCallDescriptor lookupArraycopyDescriptor(Kind kind, boolean aligned, boolean disjoint, boolean uninit) {
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
75 if (uninit) {
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
76 assert kind == Kind.Object;
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
77 return uninitObjectArraycopyDescriptors[aligned ? 1 : 0][disjoint ? 1 : 0];
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
78 }
15041
1e7dd666b3ad Fix raw type references in HotSpotHostForeignCallsProvider.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
79 return arraycopyDescriptors[aligned ? 1 : 0][disjoint ? 1 : 0].get(kind);
13977
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
80 }
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
81
15041
1e7dd666b3ad Fix raw type references in HotSpotHostForeignCallsProvider.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
82 @SuppressWarnings("unchecked") private static final EnumMap<Kind, ForeignCallDescriptor>[][] arraycopyDescriptors = new EnumMap[2][2];
13977
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
83
16028
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
84 private static final ForeignCallDescriptor[][] uninitObjectArraycopyDescriptors = new ForeignCallDescriptor[2][2];
18593
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
85 private static final ForeignCallDescriptor[] checkcastArraycopyDescriptors = new ForeignCallDescriptor[2];
16028
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
86
13977
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
87 static {
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
88 // Populate the EnumMap instances
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
89 for (int i = 0; i < arraycopyDescriptors.length; i++) {
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
90 for (int j = 0; j < arraycopyDescriptors[i].length; j++) {
15041
1e7dd666b3ad Fix raw type references in HotSpotHostForeignCallsProvider.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
91 arraycopyDescriptors[i][j] = new EnumMap<>(Kind.class);
13977
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
92 }
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
93 }
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
94 }
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
95
17240
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
96 private void registerArraycopyDescriptor(Map<Long, ForeignCallDescriptor> descMap, Kind kind, boolean aligned, boolean disjoint, boolean uninit, long routine) {
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
97 ForeignCallDescriptor desc = descMap.get(routine);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
98 if (desc == null) {
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
99 String name = kind + (aligned ? "Aligned" : "") + (disjoint ? "Disjoint" : "") + (uninit ? "Uninit" : "") + "Arraycopy";
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
100 desc = new ForeignCallDescriptor(name, void.class, Word.class, Word.class, Word.class);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
101 LocationIdentity killed = NamedLocationIdentity.getArrayLocation(kind);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
102 registerForeignCall(desc, routine, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, killed);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
103 descMap.put(routine, desc);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
104 }
16028
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
105 if (uninit) {
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
106 assert kind == Kind.Object;
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
107 uninitObjectArraycopyDescriptors[aligned ? 1 : 0][disjoint ? 1 : 0] = desc;
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
108 } else {
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
109 arraycopyDescriptors[aligned ? 1 : 0][disjoint ? 1 : 0].put(kind, desc);
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
110 }
13977
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
111 }
39076a984c33 lower arraycopy calls later and support unchecked object arraycopy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13933
diff changeset
112
18593
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
113 private void registerCheckcastArraycopyDescriptor(boolean uninit, long routine) {
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
114 String name = "Object" + (uninit ? "Uninit" : "") + "Checkcast";
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
115 // Input:
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
116 // c_rarg0 - source array address
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
117 // c_rarg1 - destination array address
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
118 // c_rarg2 - element count, treated as ssize_t, can be zero
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
119 // c_rarg3 - size_t ckoff (super_check_offset)
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
120 // c_rarg4 - oop ckval (super_klass)
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
121 // return: 0 = success, n = number of copied elements xor'd with -1.
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
122 ForeignCallDescriptor desc = new ForeignCallDescriptor(name, int.class, Word.class, Word.class, Word.class, Word.class, Word.class);
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
123 LocationIdentity killed = NamedLocationIdentity.getArrayLocation(Kind.Object);
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
124 registerForeignCall(desc, routine, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, killed);
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
125 checkcastArraycopyDescriptors[uninit ? 1 : 0] = desc;
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
126 }
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
127
17240
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
128 private void registerArrayCopy(Map<Long, ForeignCallDescriptor> descMap, Kind kind, long routine, long alignedRoutine, long disjointRoutine, long alignedDisjointRoutine) {
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
129 registerArrayCopy(descMap, kind, routine, alignedRoutine, disjointRoutine, alignedDisjointRoutine, false);
16028
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
130 }
bca2ed3b97fd skip initialization and use arraycopy for cloning arrays
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15968
diff changeset
131
17240
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
132 private void registerArrayCopy(Map<Long, ForeignCallDescriptor> descMap, Kind kind, long routine, long alignedRoutine, long disjointRoutine, long alignedDisjointRoutine, boolean uninit) {
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
133 registerArraycopyDescriptor(descMap, kind, false, false, uninit, routine);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
134 registerArraycopyDescriptor(descMap, kind, true, false, uninit, alignedRoutine);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
135 registerArraycopyDescriptor(descMap, kind, false, true, uninit, disjointRoutine);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
136 registerArraycopyDescriptor(descMap, kind, true, true, uninit, alignedDisjointRoutine);
13933
ebd2dfc2b780 use hotspot stubs for primitive arraycopy calls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13578
diff changeset
137 }
ebd2dfc2b780 use hotspot stubs for primitive arraycopy calls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13578
diff changeset
138
12463
3661954321aa removed more uses of HotSpotGraalRuntime.getHostProviders() (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12456
diff changeset
139 public void initialize(HotSpotProviders providers, HotSpotVMConfig c) {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
140
19462
33a783b15758 made use of Graal stubs instead of equivalent HotSpot stubs optional and off by default
Doug Simon <doug.simon@oracle.com>
parents: 18593
diff changeset
141 if (!PreferGraalStubs.getValue()) {
33a783b15758 made use of Graal stubs instead of equivalent HotSpot stubs optional and off by default
Doug Simon <doug.simon@oracle.com>
parents: 18593
diff changeset
142 registerForeignCall(DEOPTIMIZATION_HANDLER, c.handleDeoptStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS);
33a783b15758 made use of Graal stubs instead of equivalent HotSpot stubs optional and off by default
Doug Simon <doug.simon@oracle.com>
parents: 18593
diff changeset
143 registerForeignCall(UNCOMMON_TRAP_HANDLER, c.uncommonTrapStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS);
33a783b15758 made use of Graal stubs instead of equivalent HotSpot stubs optional and off by default
Doug Simon <doug.simon@oracle.com>
parents: 18593
diff changeset
144 }
13301
126ef8e8aa59 Separate foreign calls into LEAF and LEAF_NOFP.
Roland Schatz <roland.schatz@oracle.com>
parents: 12588
diff changeset
145 registerForeignCall(IC_MISS_HANDLER, c.inlineCacheMissStub(), NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
146
13301
126ef8e8aa59 Separate foreign calls into LEAF and LEAF_NOFP.
Roland Schatz <roland.schatz@oracle.com>
parents: 12588
diff changeset
147 registerForeignCall(JAVA_TIME_MILLIS, c.javaTimeMillisAddress, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS);
126ef8e8aa59 Separate foreign calls into LEAF and LEAF_NOFP.
Roland Schatz <roland.schatz@oracle.com>
parents: 12588
diff changeset
148 registerForeignCall(JAVA_TIME_NANOS, c.javaTimeNanosAddress, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
149 registerForeignCall(ARITHMETIC_SIN, c.arithmeticSinAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
150 registerForeignCall(ARITHMETIC_COS, c.arithmeticCosAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
151 registerForeignCall(ARITHMETIC_TAN, c.arithmeticTanAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
19813
853f84c7cc6f fixed Math.pow intrinsic to make a runtime call instead of calling the original method
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
152 registerForeignCall(ARITHMETIC_POW, c.arithmeticPowAddress, NativeCall, DESTROYS_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
19845
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
153 registerForeignCall(LOAD_AND_CLEAR_EXCEPTION, c.loadAndClearExceptionAddress, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
154
19845
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
155 registerForeignCall(EXCEPTION_HANDLER_FOR_PC, c.exceptionHandlerForPcAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, any());
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
156 registerForeignCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, c.exceptionHandlerForReturnAddressAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, any());
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
157 registerForeignCall(FETCH_UNROLL_INFO, c.deoptimizationFetchUnrollInfo, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, any());
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
158 registerForeignCall(NEW_ARRAY_C, c.newArrayAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, any());
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
159 registerForeignCall(NEW_INSTANCE_C, c.newInstanceAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, any());
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
160 registerForeignCall(UNCOMMON_TRAP, c.deoptimizationUncommonTrap, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, NOT_REEXECUTABLE, any());
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15104
diff changeset
161
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15104
diff changeset
162 /*
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15104
diff changeset
163 * We cannot use LEAF_SP here because on some architectures we have to align the stack
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15104
diff changeset
164 * manually before calling into the VM. See {@link
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15104
diff changeset
165 * AMD64HotSpotEnterUnpackFramesStackFrameOp#emitCode}.
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15104
diff changeset
166 */
19845
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
167 registerForeignCall(UNPACK_FRAMES, c.deoptimizationUnpackFrames, NativeCall, DESTROYS_REGISTERS, LEAF, NOT_REEXECUTABLE, any());
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15104
diff changeset
168
16406
ed91068c8af5 cleanup in AssertionNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16182
diff changeset
169 /*
ed91068c8af5 cleanup in AssertionNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16182
diff changeset
170 * This message call is registered twice, where the second one must only be used for calls
ed91068c8af5 cleanup in AssertionNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16182
diff changeset
171 * that do not return, i.e., that exit the VM.
ed91068c8af5 cleanup in AssertionNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16182
diff changeset
172 */
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
173 registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, NO_LOCATIONS);
16084
b37dbfdfbbfb assertion mechanism for snippets and stubs
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16028
diff changeset
174 registerForeignCall(ASSERTION_VM_MESSAGE_C, c.vmMessageAddress, NativeCall, PRESERVES_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
175
19856
63b6ad88b08f Consolidation of new allocation stubs to use the standard ForeignCallNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19845
diff changeset
176 link(new NewInstanceStub(providers, registerStubCall(NEW_INSTANCE, REEXECUTABLE, NOT_LEAF, INIT_LOCATION, TLAB_TOP_LOCATION, TLAB_END_LOCATION)));
63b6ad88b08f Consolidation of new allocation stubs to use the standard ForeignCallNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19845
diff changeset
177 link(new NewArrayStub(providers, registerStubCall(NEW_ARRAY, REEXECUTABLE, NOT_LEAF, INIT_LOCATION, TLAB_TOP_LOCATION, TLAB_END_LOCATION)));
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19462
diff changeset
178 link(new ExceptionHandlerStub(providers, foreignCalls.get(EXCEPTION_HANDLER)));
19845
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
179 link(new UnwindExceptionToCallerStub(providers, registerStubCall(UNWIND_EXCEPTION_TO_CALLER, NOT_REEXECUTABLE, NOT_LEAF, any())));
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19462
diff changeset
180 link(new VerifyOopStub(providers, registerStubCall(VERIFY_OOP, REEXECUTABLE, LEAF_NOFP, NO_LOCATIONS)));
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
181
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
182 linkForeignCall(providers, IDENTITY_HASHCODE, c.identityHashCodeAddress, PREPEND_THREAD, NOT_LEAF, NOT_REEXECUTABLE, MARK_WORD_LOCATION);
19845
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
183 linkForeignCall(providers, REGISTER_FINALIZER, c.registerFinalizerAddress, PREPEND_THREAD, NOT_LEAF, NOT_REEXECUTABLE, any());
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
184 linkForeignCall(providers, CREATE_NULL_POINTER_EXCEPTION, c.createNullPointerExceptionAddress, PREPEND_THREAD, NOT_LEAF, REEXECUTABLE, any());
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
185 linkForeignCall(providers, CREATE_OUT_OF_BOUNDS_EXCEPTION, c.createOutOfBoundsExceptionAddress, PREPEND_THREAD, NOT_LEAF, REEXECUTABLE, any());
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
186 linkForeignCall(providers, MONITORENTER, c.monitorenterAddress, PREPEND_THREAD, NOT_LEAF, NOT_REEXECUTABLE, any());
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
187 linkForeignCall(providers, MONITOREXIT, c.monitorexitAddress, PREPEND_THREAD, LEAF_SP, NOT_REEXECUTABLE, any());
19856
63b6ad88b08f Consolidation of new allocation stubs to use the standard ForeignCallNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19845
diff changeset
188 linkForeignCall(providers, NEW_MULTI_ARRAY, c.newMultiArrayAddress, PREPEND_THREAD, NOT_LEAF, REEXECUTABLE, INIT_LOCATION, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
189 linkForeignCall(providers, DYNAMIC_NEW_ARRAY, c.dynamicNewArrayAddress, PREPEND_THREAD, NOT_LEAF, REEXECUTABLE, INIT_LOCATION);
13578
d8143c431d63 Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13301
diff changeset
190 linkForeignCall(providers, DYNAMIC_NEW_INSTANCE, c.dynamicNewInstanceAddress, PREPEND_THREAD, NOT_LEAF, REEXECUTABLE, INIT_LOCATION);
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
191 linkForeignCall(providers, LOG_PRINTF, c.logPrintfAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS);
16887
aa412e64808e logObject and logPrimitive should be leaf
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16406
diff changeset
192 linkForeignCall(providers, LOG_OBJECT, c.logObjectAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS);
aa412e64808e logObject and logPrimitive should be leaf
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16406
diff changeset
193 linkForeignCall(providers, LOG_PRIMITIVE, c.logPrimitiveAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS);
19845
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
194 linkForeignCall(providers, THREAD_IS_INTERRUPTED, c.threadIsInterruptedAddress, PREPEND_THREAD, NOT_LEAF, NOT_REEXECUTABLE, any());
13301
126ef8e8aa59 Separate foreign calls into LEAF and LEAF_NOFP.
Roland Schatz <roland.schatz@oracle.com>
parents: 12588
diff changeset
195 linkForeignCall(providers, VM_ERROR, c.vmErrorAddress, PREPEND_THREAD, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS);
126ef8e8aa59 Separate foreign calls into LEAF and LEAF_NOFP.
Roland Schatz <roland.schatz@oracle.com>
parents: 12588
diff changeset
196 linkForeignCall(providers, OSR_MIGRATION_END, c.osrMigrationEndAddress, DONT_PREPEND_THREAD, LEAF_NOFP, NOT_REEXECUTABLE, NO_LOCATIONS);
126ef8e8aa59 Separate foreign calls into LEAF and LEAF_NOFP.
Roland Schatz <roland.schatz@oracle.com>
parents: 12588
diff changeset
197 linkForeignCall(providers, G1WBPRECALL, c.writeBarrierPreAddress, PREPEND_THREAD, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS);
126ef8e8aa59 Separate foreign calls into LEAF and LEAF_NOFP.
Roland Schatz <roland.schatz@oracle.com>
parents: 12588
diff changeset
198 linkForeignCall(providers, G1WBPOSTCALL, c.writeBarrierPostAddress, PREPEND_THREAD, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS);
126ef8e8aa59 Separate foreign calls into LEAF and LEAF_NOFP.
Roland Schatz <roland.schatz@oracle.com>
parents: 12588
diff changeset
199 linkForeignCall(providers, VALIDATE_OBJECT, c.validateObject, PREPEND_THREAD, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS);
13933
ebd2dfc2b780 use hotspot stubs for primitive arraycopy calls
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13578
diff changeset
200
19845
3d0116ec99c5 Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19813
diff changeset
201 linkForeignCall(providers, TEST_DEOPTIMIZE_CALL_INT, c.testDeoptimizeCallInt, PREPEND_THREAD, NOT_LEAF, NOT_REEXECUTABLE, any());
18227
bcb1e5c232d8 Test deoptimization inside ForeignCallNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18114
diff changeset
202
17240
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
203 // sometimes the same function is used for different kinds of arraycopy so check for
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
204 // duplicates using a map.
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
205 Map<Long, ForeignCallDescriptor> descMap = new HashMap<>();
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
206 registerArrayCopy(descMap, Kind.Byte, c.jbyteArraycopy, c.jbyteAlignedArraycopy, c.jbyteDisjointArraycopy, c.jbyteAlignedDisjointArraycopy);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
207 registerArrayCopy(descMap, Kind.Boolean, c.jbyteArraycopy, c.jbyteAlignedArraycopy, c.jbyteDisjointArraycopy, c.jbyteAlignedDisjointArraycopy);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
208 registerArrayCopy(descMap, Kind.Char, c.jshortArraycopy, c.jshortAlignedArraycopy, c.jshortDisjointArraycopy, c.jshortAlignedDisjointArraycopy);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
209 registerArrayCopy(descMap, Kind.Short, c.jshortArraycopy, c.jshortAlignedArraycopy, c.jshortDisjointArraycopy, c.jshortAlignedDisjointArraycopy);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
210 registerArrayCopy(descMap, Kind.Int, c.jintArraycopy, c.jintAlignedArraycopy, c.jintDisjointArraycopy, c.jintAlignedDisjointArraycopy);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
211 registerArrayCopy(descMap, Kind.Float, c.jintArraycopy, c.jintAlignedArraycopy, c.jintDisjointArraycopy, c.jintAlignedDisjointArraycopy);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
212 registerArrayCopy(descMap, Kind.Long, c.jlongArraycopy, c.jlongAlignedArraycopy, c.jlongDisjointArraycopy, c.jlongAlignedDisjointArraycopy);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
213 registerArrayCopy(descMap, Kind.Double, c.jlongArraycopy, c.jlongAlignedArraycopy, c.jlongDisjointArraycopy, c.jlongAlignedDisjointArraycopy);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
214 registerArrayCopy(descMap, Kind.Object, c.oopArraycopy, c.oopAlignedArraycopy, c.oopDisjointArraycopy, c.oopAlignedDisjointArraycopy);
136ba6d379f2 avoid different names for the same arraycopy routine
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16887
diff changeset
215 registerArrayCopy(descMap, Kind.Object, c.oopArraycopyUninit, c.oopAlignedArraycopyUninit, c.oopDisjointArraycopyUninit, c.oopAlignedDisjointArraycopyUninit, true);
18114
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
216
18593
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
217 registerCheckcastArraycopyDescriptor(true, c.checkcastArraycopyUninit);
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
218 registerCheckcastArraycopyDescriptor(false, c.checkcastArraycopy);
58ea6b98cb09 ArrayCopy: use hotspot stub for checkcastArraycopy.
Bernhard Urban <bernhard.urban@jku.at>
parents: 18525
diff changeset
219
18114
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
220 if (c.useAESIntrinsics) {
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
221 /*
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
222 * When the java.ext.dirs property is modified then the crypto classes might not be
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
223 * found. If that's the case we ignore the ClassNotFoundException and continue since we
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
224 * cannot replace a non-existing method anyway.
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
225 */
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
226 try {
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
227 // These stubs do callee saving
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
228 registerForeignCall(ENCRYPT_BLOCK, c.aescryptEncryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(Kind.Byte));
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
229 registerForeignCall(DECRYPT_BLOCK, c.aescryptDecryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(Kind.Byte));
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
230 } catch (GraalInternalError e) {
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
231 if (!(e.getCause() instanceof ClassNotFoundException)) {
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
232 throw e;
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
233 }
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
234 }
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
235 try {
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
236 // These stubs do callee saving
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
237 registerForeignCall(ENCRYPT, c.cipherBlockChainingEncryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(Kind.Byte));
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
238 registerForeignCall(DECRYPT, c.cipherBlockChainingDecryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(Kind.Byte));
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
239 } catch (GraalInternalError e) {
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
240 if (!(e.getCause() instanceof ClassNotFoundException)) {
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
241 throw e;
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
242 }
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
243 }
6d2b2671c63a Move crypto foreign call registering from AMD64HotSpot to HotSpot
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17240
diff changeset
244 }
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
245 }
16182
0a7e9347f8d0 Add an ability to specify the signature of a C/C++ foreign function in HotSpotVMConfig and get the full symbol string; add a couple of convenience getters and setters for stubs with foreign call linkage.
bharadwaj
parents: 16084
diff changeset
246
0a7e9347f8d0 Add an ability to specify the signature of a C/C++ foreign function in HotSpotVMConfig and get the full symbol string; add a couple of convenience getters and setters for stubs with foreign call linkage.
bharadwaj
parents: 16084
diff changeset
247 public HotSpotForeignCallLinkage getForeignCall(ForeignCallDescriptor descriptor) {
0a7e9347f8d0 Add an ability to specify the signature of a C/C++ foreign function in HotSpotVMConfig and get the full symbol string; add a couple of convenience getters and setters for stubs with foreign call linkage.
bharadwaj
parents: 16084
diff changeset
248 assert foreignCalls != null : descriptor;
0a7e9347f8d0 Add an ability to specify the signature of a C/C++ foreign function in HotSpotVMConfig and get the full symbol string; add a couple of convenience getters and setters for stubs with foreign call linkage.
bharadwaj
parents: 16084
diff changeset
249 return foreignCalls.get(descriptor);
0a7e9347f8d0 Add an ability to specify the signature of a C/C++ foreign function in HotSpotVMConfig and get the full symbol string; add a couple of convenience getters and setters for stubs with foreign call linkage.
bharadwaj
parents: 16084
diff changeset
250 }
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
251 }