# HG changeset patch # User Doug Simon # Date 1428607404 -7200 # Node ID 5d9bad7192f80922801a6a4c76ab685e9b0f4c73 # Parent 9ea32f3fc8ce040ab83d3d1430089e72bfec3854 disable String.equals intrinsic if RegisterPressure is enabled diff -r 9ea32f3fc8ce -r 5d9bad7192f8 graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java --- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java Thu Apr 09 19:17:51 2015 +0200 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java Thu Apr 09 21:23:24 2015 +0200 @@ -202,7 +202,7 @@ public static final OptionValue HotSpotPrintInlining = new OptionValue<>(false); // Register allocator debugging - @Option(help = "Comma separated list of register that the allocation is limited to.", type = OptionType.Debug) + @Option(help = "Comma separated list of registers that register allocation is limited to.", type = OptionType.Debug) public static final OptionValue RegisterPressure = new OptionValue<>(null); @Option(help = "", type = OptionType.Debug) diff -r 9ea32f3fc8ce -r 5d9bad7192f8 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java Thu Apr 09 19:17:51 2015 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java Thu Apr 09 21:23:24 2015 +0200 @@ -23,6 +23,7 @@ package com.oracle.graal.replacements; import static com.oracle.graal.api.code.MemoryBarriers.*; +import static com.oracle.graal.compiler.common.GraalOptions.*; import java.lang.reflect.*; import java.util.*; @@ -96,17 +97,23 @@ } private static void registerStringPlugins(InvocationPlugins plugins) { - Registration r = new Registration(plugins, String.class); - r.registerMethodSubstitution(StringSubstitutions.class, "equals", Receiver.class, Object.class); + /* + * AMD64's String.equals substitution needs about 8 registers so we disable it if there is + * some artificial register pressure. + */ + if (RegisterPressure.getValue() == null) { + Registration r = new Registration(plugins, String.class); + r.registerMethodSubstitution(StringSubstitutions.class, "equals", Receiver.class, Object.class); - r = new Registration(plugins, StringSubstitutions.class); - r.register1("getValue", String.class, new InvocationPlugin() { - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) { - ResolvedJavaField field = b.getMetaAccess().lookupJavaField(STRING_VALUE_FIELD); - b.addPush(new LoadFieldNode(value, field)); - return true; - } - }); + r = new Registration(plugins, StringSubstitutions.class); + r.register1("getValue", String.class, new InvocationPlugin() { + public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) { + ResolvedJavaField field = b.getMetaAccess().lookupJavaField(STRING_VALUE_FIELD); + b.addPush(new LoadFieldNode(value, field)); + return true; + } + }); + } } private static void registerArraysPlugins(InvocationPlugins plugins) {