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 */
23 package org.graalvm.compiler.hotspot.amd64;
24
25 import static jdk.vm.ci.amd64.AMD64.rax;
26 import static jdk.vm.ci.amd64.AMD64.rdx;
27 import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall;
28 import static jdk.vm.ci.meta.Value.ILLEGAL;
29 import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER;
30 import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER_IN_CALLER;
31 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRESS;
32 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
33 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF;
34 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NOFP;
35 import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32;
36 import static org.graalvm.word.LocationIdentity.any;
37
38 import org.graalvm.compiler.core.common.LIRKind;
39 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
40 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
41 import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl;
42 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider;
43 import org.graalvm.compiler.hotspot.meta.HotSpotHostForeignCallsProvider;
44 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
45 import org.graalvm.compiler.options.OptionValues;
46 import org.graalvm.compiler.word.WordTypes;
47
48 import jdk.vm.ci.code.CallingConvention;
49 import jdk.vm.ci.code.CodeCacheProvider;
50 import jdk.vm.ci.code.RegisterValue;
51 import jdk.vm.ci.code.TargetDescription;
52 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
53 import jdk.vm.ci.meta.MetaAccessProvider;
54 import jdk.vm.ci.meta.PlatformKind;
55 import jdk.vm.ci.meta.Value;
82 // TemplateInterpreterGenerator::generate_throw_exception()
83 // in templateInterpreter_x86_64.cpp around line 1923
84 RegisterValue exception = rax.asValue(LIRKind.reference(word));
85 RegisterValue exceptionPc = rdx.asValue(LIRKind.value(word));
86 CallingConvention exceptionCc = new CallingConvention(0, ILLEGAL, exception, exceptionPc);
87 register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, exceptionCc, null, NOT_REEXECUTABLE, any()));
88 register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, exceptionCc, null, NOT_REEXECUTABLE, any()));
89
90 link(new AMD64MathStub(ARITHMETIC_LOG_STUB, options, providers, registerStubCall(ARITHMETIC_LOG_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
91 link(new AMD64MathStub(ARITHMETIC_LOG10_STUB, options, providers, registerStubCall(ARITHMETIC_LOG10_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
92 link(new AMD64MathStub(ARITHMETIC_SIN_STUB, options, providers, registerStubCall(ARITHMETIC_SIN_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
93 link(new AMD64MathStub(ARITHMETIC_COS_STUB, options, providers, registerStubCall(ARITHMETIC_COS_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
94 link(new AMD64MathStub(ARITHMETIC_TAN_STUB, options, providers, registerStubCall(ARITHMETIC_TAN_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
95 link(new AMD64MathStub(ARITHMETIC_EXP_STUB, options, providers, registerStubCall(ARITHMETIC_EXP_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
96 link(new AMD64MathStub(ARITHMETIC_POW_STUB, options, providers, registerStubCall(ARITHMETIC_POW_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
97
98 if (config.useCRC32Intrinsics) {
99 // This stub does callee saving
100 registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
101 }
102
103 super.initialize(providers, options);
104 }
105
106 @Override
107 public Value[] getNativeABICallerSaveRegisters() {
108 return nativeABICallerSaveRegisters;
109 }
110
111 }
|
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 */
23 package org.graalvm.compiler.hotspot.amd64;
24
25 import static jdk.vm.ci.amd64.AMD64.rax;
26 import static jdk.vm.ci.amd64.AMD64.rdx;
27 import static jdk.vm.ci.hotspot.HotSpotCallingConventionType.NativeCall;
28 import static jdk.vm.ci.meta.Value.ILLEGAL;
29 import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER;
30 import static org.graalvm.compiler.hotspot.HotSpotBackend.EXCEPTION_HANDLER_IN_CALLER;
31 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRESS;
32 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS;
33 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF;
34 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NOFP;
35 import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32;
36 import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C;
37 import static org.graalvm.word.LocationIdentity.any;
38
39 import org.graalvm.compiler.core.common.LIRKind;
40 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
41 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
42 import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl;
43 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider;
44 import org.graalvm.compiler.hotspot.meta.HotSpotHostForeignCallsProvider;
45 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
46 import org.graalvm.compiler.options.OptionValues;
47 import org.graalvm.compiler.word.WordTypes;
48
49 import jdk.vm.ci.code.CallingConvention;
50 import jdk.vm.ci.code.CodeCacheProvider;
51 import jdk.vm.ci.code.RegisterValue;
52 import jdk.vm.ci.code.TargetDescription;
53 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
54 import jdk.vm.ci.meta.MetaAccessProvider;
55 import jdk.vm.ci.meta.PlatformKind;
56 import jdk.vm.ci.meta.Value;
83 // TemplateInterpreterGenerator::generate_throw_exception()
84 // in templateInterpreter_x86_64.cpp around line 1923
85 RegisterValue exception = rax.asValue(LIRKind.reference(word));
86 RegisterValue exceptionPc = rdx.asValue(LIRKind.value(word));
87 CallingConvention exceptionCc = new CallingConvention(0, ILLEGAL, exception, exceptionPc);
88 register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, exceptionCc, null, NOT_REEXECUTABLE, any()));
89 register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, exceptionCc, null, NOT_REEXECUTABLE, any()));
90
91 link(new AMD64MathStub(ARITHMETIC_LOG_STUB, options, providers, registerStubCall(ARITHMETIC_LOG_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
92 link(new AMD64MathStub(ARITHMETIC_LOG10_STUB, options, providers, registerStubCall(ARITHMETIC_LOG10_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
93 link(new AMD64MathStub(ARITHMETIC_SIN_STUB, options, providers, registerStubCall(ARITHMETIC_SIN_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
94 link(new AMD64MathStub(ARITHMETIC_COS_STUB, options, providers, registerStubCall(ARITHMETIC_COS_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
95 link(new AMD64MathStub(ARITHMETIC_TAN_STUB, options, providers, registerStubCall(ARITHMETIC_TAN_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
96 link(new AMD64MathStub(ARITHMETIC_EXP_STUB, options, providers, registerStubCall(ARITHMETIC_EXP_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
97 link(new AMD64MathStub(ARITHMETIC_POW_STUB, options, providers, registerStubCall(ARITHMETIC_POW_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
98
99 if (config.useCRC32Intrinsics) {
100 // This stub does callee saving
101 registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
102 }
103 if (config.useCRC32CIntrinsics) {
104 registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
105 }
106
107 super.initialize(providers, options);
108 }
109
110 @Override
111 public Value[] getNativeABICallerSaveRegisters() {
112 return nativeABICallerSaveRegisters;
113 }
114
115 }
|