< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/DefaultHotSpotLoweringProvider.java

Print this page




   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 package org.graalvm.compiler.hotspot.meta;
  26 
  27 import static jdk.vm.ci.services.Services.IS_IN_NATIVE_IMAGE;
  28 import static org.graalvm.compiler.core.common.GraalOptions.AlwaysInlineVTableStubs;
  29 import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
  30 import static org.graalvm.compiler.core.common.GraalOptions.InlineVTableStubs;
  31 import static org.graalvm.compiler.core.common.GraalOptions.OmitHotExceptionStacktrace;
  32 import static org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProviderImpl.OSR_MIGRATION_END;
  33 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_KLASS_LOCATION;
  34 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_MIRROR_HANDLE_LOCATION;
  35 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_MIRROR_LOCATION;
  36 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.COMPRESSED_HUB_LOCATION;
  37 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.DISPLACED_MARK_WORD_LOCATION;
  38 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_LOCATION;
  39 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_WRITE_LOCATION;
  40 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.KLASS_LAYOUT_HELPER_LOCATION;
  41 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION;
  42 import static jdk.internal.vm.compiler.word.LocationIdentity.any;
  43 
  44 import java.lang.ref.Reference;
  45 import java.util.EnumMap;
  46 
  47 import org.graalvm.compiler.api.directives.GraalDirectives;
  48 import org.graalvm.compiler.core.common.CompressEncoding;
  49 import org.graalvm.compiler.core.common.GraalOptions;


 211         this.registers = registers;
 212         this.constantReflection = constantReflection;
 213     }
 214 
 215     @Override
 216     public void initialize(OptionValues options, Iterable<DebugHandlersFactory> factories, HotSpotProviders providers, GraalHotSpotVMConfig config) {
 217         super.initialize(options, factories, runtime, providers, providers.getSnippetReflection());
 218 
 219         assert target == providers.getCodeCache().getTarget();
 220         instanceofSnippets = new InstanceOfSnippets.Templates(options, factories, runtime, providers, target);
 221         newObjectSnippets = new NewObjectSnippets.Templates(options, factories, runtime, providers, target, config);
 222         monitorSnippets = new MonitorSnippets.Templates(options, factories, runtime, providers, target, config.useFastLocking);
 223         writeBarrierSnippets = new WriteBarrierSnippets.Templates(options, factories, runtime, providers, target, config);
 224         exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(options, factories, providers, target);
 225         unsafeLoadSnippets = new UnsafeLoadSnippets.Templates(options, factories, providers, target);
 226         assertionSnippets = new AssertionSnippets.Templates(options, factories, providers, target);
 227         arraycopySnippets = new ArrayCopySnippets.Templates(new HotSpotArraycopySnippets(), options, factories, runtime, providers, providers.getSnippetReflection(), target);
 228         stringToBytesSnippets = new StringToBytesSnippets.Templates(options, factories, providers, target);
 229         hashCodeSnippets = new HashCodeSnippets.Templates(options, factories, providers, target);
 230         resolveConstantSnippets = new ResolveConstantSnippets.Templates(options, factories, providers, target);
 231         if (!JavaVersionUtil.Java8OrEarlier && GeneratePIC.getValue(options)) {
 232             profileSnippets = new ProfileSnippets.Templates(options, factories, providers, target);
 233         }
 234         objectCloneSnippets = new ObjectCloneSnippets.Templates(options, factories, providers, target);
 235         foreignCallSnippets = new ForeignCallSnippets.Templates(options, factories, providers, target);
 236     }
 237 
 238     public ArrayCopySnippets.Templates getArraycopySnippets() {
 239         return arraycopySnippets;
 240     }
 241 
 242     public MonitorSnippets.Templates getMonitorSnippets() {
 243         return monitorSnippets;
 244     }
 245 
 246     @Override
 247     @SuppressWarnings("try")
 248     public void lower(Node n, LoweringTool tool) {
 249         StructuredGraph graph = (StructuredGraph) n.graph();
 250         try (DebugCloseable context = n.withNodeSourcePosition()) {
 251             if (n instanceof Invoke) {




   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 package org.graalvm.compiler.hotspot.meta;
  26 
  27 import static jdk.vm.ci.services.Services.IS_IN_NATIVE_IMAGE;
  28 import static org.graalvm.compiler.core.common.GraalOptions.AlwaysInlineVTableStubs;

  29 import static org.graalvm.compiler.core.common.GraalOptions.InlineVTableStubs;
  30 import static org.graalvm.compiler.core.common.GraalOptions.OmitHotExceptionStacktrace;
  31 import static org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProviderImpl.OSR_MIGRATION_END;
  32 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_KLASS_LOCATION;
  33 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_MIRROR_HANDLE_LOCATION;
  34 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_MIRROR_LOCATION;
  35 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.COMPRESSED_HUB_LOCATION;
  36 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.DISPLACED_MARK_WORD_LOCATION;
  37 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_LOCATION;
  38 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_WRITE_LOCATION;
  39 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.KLASS_LAYOUT_HELPER_LOCATION;
  40 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.OBJ_ARRAY_KLASS_ELEMENT_KLASS_LOCATION;
  41 import static jdk.internal.vm.compiler.word.LocationIdentity.any;
  42 
  43 import java.lang.ref.Reference;
  44 import java.util.EnumMap;
  45 
  46 import org.graalvm.compiler.api.directives.GraalDirectives;
  47 import org.graalvm.compiler.core.common.CompressEncoding;
  48 import org.graalvm.compiler.core.common.GraalOptions;


 210         this.registers = registers;
 211         this.constantReflection = constantReflection;
 212     }
 213 
 214     @Override
 215     public void initialize(OptionValues options, Iterable<DebugHandlersFactory> factories, HotSpotProviders providers, GraalHotSpotVMConfig config) {
 216         super.initialize(options, factories, runtime, providers, providers.getSnippetReflection());
 217 
 218         assert target == providers.getCodeCache().getTarget();
 219         instanceofSnippets = new InstanceOfSnippets.Templates(options, factories, runtime, providers, target);
 220         newObjectSnippets = new NewObjectSnippets.Templates(options, factories, runtime, providers, target, config);
 221         monitorSnippets = new MonitorSnippets.Templates(options, factories, runtime, providers, target, config.useFastLocking);
 222         writeBarrierSnippets = new WriteBarrierSnippets.Templates(options, factories, runtime, providers, target, config);
 223         exceptionObjectSnippets = new LoadExceptionObjectSnippets.Templates(options, factories, providers, target);
 224         unsafeLoadSnippets = new UnsafeLoadSnippets.Templates(options, factories, providers, target);
 225         assertionSnippets = new AssertionSnippets.Templates(options, factories, providers, target);
 226         arraycopySnippets = new ArrayCopySnippets.Templates(new HotSpotArraycopySnippets(), options, factories, runtime, providers, providers.getSnippetReflection(), target);
 227         stringToBytesSnippets = new StringToBytesSnippets.Templates(options, factories, providers, target);
 228         hashCodeSnippets = new HashCodeSnippets.Templates(options, factories, providers, target);
 229         resolveConstantSnippets = new ResolveConstantSnippets.Templates(options, factories, providers, target);
 230         if (!JavaVersionUtil.Java8OrEarlier) {
 231             profileSnippets = new ProfileSnippets.Templates(options, factories, providers, target);
 232         }
 233         objectCloneSnippets = new ObjectCloneSnippets.Templates(options, factories, providers, target);
 234         foreignCallSnippets = new ForeignCallSnippets.Templates(options, factories, providers, target);
 235     }
 236 
 237     public ArrayCopySnippets.Templates getArraycopySnippets() {
 238         return arraycopySnippets;
 239     }
 240 
 241     public MonitorSnippets.Templates getMonitorSnippets() {
 242         return monitorSnippets;
 243     }
 244 
 245     @Override
 246     @SuppressWarnings("try")
 247     public void lower(Node n, LoweringTool tool) {
 248         StructuredGraph graph = (StructuredGraph) n.graph();
 249         try (DebugCloseable context = n.withNodeSourcePosition()) {
 250             if (n instanceof Invoke) {


< prev index next >