< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64.test/src/org/graalvm/compiler/hotspot/amd64/test/StubAVXTest.java

Print this page
rev 56282 : [mq]: graal
   1 /*
   2  * Copyright (c) 2016, 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  */
  23 
  24 
  25 
  26 package org.graalvm.compiler.hotspot.amd64.test;
  27 

  28 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
  29 
  30 import org.graalvm.compiler.api.replacements.Snippet;
  31 import org.graalvm.compiler.asm.amd64.AMD64Address;
  32 import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler;
  33 import org.graalvm.compiler.bytecode.BytecodeProvider;
  34 import org.graalvm.compiler.core.common.CompilationIdentifier;
  35 import org.graalvm.compiler.core.common.LIRKind;
  36 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
  37 import org.graalvm.compiler.core.common.type.DataPointerConstant;
  38 import org.graalvm.compiler.debug.DebugContext;
  39 import org.graalvm.compiler.hotspot.HotSpotBackend;
  40 import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage;
  41 import org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProviderImpl;
  42 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
  43 import org.graalvm.compiler.hotspot.stubs.SnippetStub;
  44 import org.graalvm.compiler.lir.LIRInstructionClass;
  45 import org.graalvm.compiler.lir.Variable;
  46 import org.graalvm.compiler.lir.amd64.AMD64LIRInstruction;
  47 import org.graalvm.compiler.lir.asm.ArrayDataPointerConstant;


 217                 return true;
 218             }
 219         });
 220         return super.editGraphBuilderConfiguration(conf);
 221     }
 222 
 223     public static int testStub() {
 224         Object preStub = loadAVXConstant(loadAVXConstant);
 225 
 226         // do something to potentially destroy the value
 227         TestStub.testStub();
 228 
 229         Object postStub = loadAVXConstant(loadAVXConstant);
 230         return compareAVXRegister(compareAVXRegister, preStub, postStub);
 231     }
 232 
 233     @Test
 234     public void test() {
 235         HotSpotProviders providers = (HotSpotProviders) getProviders();
 236         HotSpotForeignCallsProviderImpl foreignCalls = (HotSpotForeignCallsProviderImpl) providers.getForeignCalls();
 237         HotSpotForeignCallLinkage linkage = foreignCalls.registerStubCall(TEST_STUB, HotSpotForeignCallLinkage.Transition.LEAF_NO_VZERO, HotSpotForeignCallLinkage.Reexecutability.REEXECUTABLE);

 238         linkage.setCompiledStub(new TestStub(getInitialOptions(), providers, linkage));
 239         runTest("testStub");
 240     }
 241 }
   1 /*
   2  * Copyright (c) 2016, 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  */
  23 
  24 
  25 
  26 package org.graalvm.compiler.hotspot.amd64.test;
  27 
  28 import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.COMPUTES_REGISTERS_KILLED;
  29 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
  30 
  31 import org.graalvm.compiler.api.replacements.Snippet;
  32 import org.graalvm.compiler.asm.amd64.AMD64Address;
  33 import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler;
  34 import org.graalvm.compiler.bytecode.BytecodeProvider;
  35 import org.graalvm.compiler.core.common.CompilationIdentifier;
  36 import org.graalvm.compiler.core.common.LIRKind;
  37 import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
  38 import org.graalvm.compiler.core.common.type.DataPointerConstant;
  39 import org.graalvm.compiler.debug.DebugContext;
  40 import org.graalvm.compiler.hotspot.HotSpotBackend;
  41 import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage;
  42 import org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProviderImpl;
  43 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
  44 import org.graalvm.compiler.hotspot.stubs.SnippetStub;
  45 import org.graalvm.compiler.lir.LIRInstructionClass;
  46 import org.graalvm.compiler.lir.Variable;
  47 import org.graalvm.compiler.lir.amd64.AMD64LIRInstruction;
  48 import org.graalvm.compiler.lir.asm.ArrayDataPointerConstant;


 218                 return true;
 219             }
 220         });
 221         return super.editGraphBuilderConfiguration(conf);
 222     }
 223 
 224     public static int testStub() {
 225         Object preStub = loadAVXConstant(loadAVXConstant);
 226 
 227         // do something to potentially destroy the value
 228         TestStub.testStub();
 229 
 230         Object postStub = loadAVXConstant(loadAVXConstant);
 231         return compareAVXRegister(compareAVXRegister, preStub, postStub);
 232     }
 233 
 234     @Test
 235     public void test() {
 236         HotSpotProviders providers = (HotSpotProviders) getProviders();
 237         HotSpotForeignCallsProviderImpl foreignCalls = (HotSpotForeignCallsProviderImpl) providers.getForeignCalls();
 238         HotSpotForeignCallLinkage linkage = foreignCalls.registerStubCall(TEST_STUB, HotSpotForeignCallLinkage.Transition.LEAF_NO_VZERO, HotSpotForeignCallLinkage.Reexecutability.REEXECUTABLE,
 239                         COMPUTES_REGISTERS_KILLED);
 240         linkage.setCompiledStub(new TestStub(getInitialOptions(), providers, linkage));
 241         runTest("testStub");
 242     }
 243 }
< prev index next >