Skip to content

Commit 02c9988

Browse files
committed
[GR-38057] Do not always split blocks/Procs
* It is unnecessary in most cases, and the heuristic split works for the rest of the cases. * What we typically want to split is what is calling the block, that already works with @ReportPolymorphism on CallBlockNode.
1 parent 6e38470 commit 02c9988

File tree

4 files changed

+1
-21
lines changed

4 files changed

+1
-21
lines changed

src/main/java/org/truffleruby/language/yield/CallBlockNode.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ private Object[] packArguments(DeclarationContext declarationContext, RubyProc b
111111
protected DirectCallNode createBlockCallNode(RootCallTarget callTarget) {
112112
final DirectCallNode callNode = Truffle.getRuntime().createDirectCallNode(callTarget);
113113

114-
final boolean clone = RubyRootNode.of(callTarget).shouldAlwaysClone() ||
115-
getContext().getOptions().YIELD_ALWAYS_CLONE;
116-
if (clone && callNode.isCallTargetCloningAllowed()) {
114+
if (RubyRootNode.of(callTarget).shouldAlwaysClone() && callNode.isCallTargetCloningAllowed()) {
117115
callNode.cloneCallTarget();
118116
}
119117

src/main/java/org/truffleruby/options/Options.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ public class Options {
186186
public final boolean NEVER_SPLIT_HONOR;
187187
/** --inline-needs-caller-frame=INLINE_DEFAULT */
188188
public final boolean INLINE_NEEDS_CALLER_FRAME;
189-
/** --yield-always-clone=CLONE_DEFAULT */
190-
public final boolean YIELD_ALWAYS_CLONE;
191189
/** --yield-always-inline=INLINE_DEFAULT */
192190
public final boolean YIELD_ALWAYS_INLINE;
193191
/** --method-missing-always-clone=CLONE_DEFAULT */
@@ -291,7 +289,6 @@ public Options(Env env, OptionValues options, LanguageOptions languageOptions) {
291289
ALWAYS_SPLIT_HONOR = options.hasBeenSet(OptionsCatalog.ALWAYS_SPLIT_HONOR_KEY) ? options.get(OptionsCatalog.ALWAYS_SPLIT_HONOR_KEY) : CLONE_DEFAULT;
292290
NEVER_SPLIT_HONOR = options.get(OptionsCatalog.NEVER_SPLIT_HONOR_KEY);
293291
INLINE_NEEDS_CALLER_FRAME = options.hasBeenSet(OptionsCatalog.INLINE_NEEDS_CALLER_FRAME_KEY) ? options.get(OptionsCatalog.INLINE_NEEDS_CALLER_FRAME_KEY) : INLINE_DEFAULT;
294-
YIELD_ALWAYS_CLONE = options.hasBeenSet(OptionsCatalog.YIELD_ALWAYS_CLONE_KEY) ? options.get(OptionsCatalog.YIELD_ALWAYS_CLONE_KEY) : CLONE_DEFAULT;
295292
YIELD_ALWAYS_INLINE = options.hasBeenSet(OptionsCatalog.YIELD_ALWAYS_INLINE_KEY) ? options.get(OptionsCatalog.YIELD_ALWAYS_INLINE_KEY) : INLINE_DEFAULT;
296293
METHODMISSING_ALWAYS_CLONE = options.hasBeenSet(OptionsCatalog.METHODMISSING_ALWAYS_CLONE_KEY) ? options.get(OptionsCatalog.METHODMISSING_ALWAYS_CLONE_KEY) : CLONE_DEFAULT;
297294
METHODMISSING_ALWAYS_INLINE = options.hasBeenSet(OptionsCatalog.METHODMISSING_ALWAYS_INLINE_KEY) ? options.get(OptionsCatalog.METHODMISSING_ALWAYS_INLINE_KEY) : INLINE_DEFAULT;
@@ -468,8 +465,6 @@ public Object fromDescriptor(OptionDescriptor descriptor) {
468465
return NEVER_SPLIT_HONOR;
469466
case "ruby.inline-needs-caller-frame":
470467
return INLINE_NEEDS_CALLER_FRAME;
471-
case "ruby.yield-always-clone":
472-
return YIELD_ALWAYS_CLONE;
473468
case "ruby.yield-always-inline":
474469
return YIELD_ALWAYS_INLINE;
475470
case "ruby.method-missing-always-clone":

src/options.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ INTERNAL: # Options for debugging the TruffleRuby implementation
229229
ALWAYS_SPLIT_HONOR: [always-split-honor, boolean, CLONE_DEFAULT, 'Honor Truffle::Graal.always_split annotations']
230230
NEVER_SPLIT_HONOR: [never-split-honor, boolean, true, 'Honor Truffle::Graal.never_split annotations']
231231
INLINE_NEEDS_CALLER_FRAME: [inline-needs-caller-frame, boolean, INLINE_DEFAULT, Inline methods that need their caller frame]
232-
YIELD_ALWAYS_CLONE: [yield-always-clone, boolean, CLONE_DEFAULT, Always clone yields]
233232
YIELD_ALWAYS_INLINE: [yield-always-inline, boolean, INLINE_DEFAULT, Always inline yields]
234233
METHODMISSING_ALWAYS_CLONE: [method-missing-always-clone, boolean, CLONE_DEFAULT, 'Always clone #method_missing']
235234
METHODMISSING_ALWAYS_INLINE: [method-missing-always-inline, boolean, INLINE_DEFAULT, 'Always inline #method_missing']

src/shared/java/org/truffleruby/shared/options/OptionsCatalog.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ public class OptionsCatalog {
146146
public static final OptionKey<Boolean> ALWAYS_SPLIT_HONOR_KEY = new OptionKey<>(CLONE_DEFAULT_KEY.getDefaultValue());
147147
public static final OptionKey<Boolean> NEVER_SPLIT_HONOR_KEY = new OptionKey<>(true);
148148
public static final OptionKey<Boolean> INLINE_NEEDS_CALLER_FRAME_KEY = new OptionKey<>(INLINE_DEFAULT_KEY.getDefaultValue());
149-
public static final OptionKey<Boolean> YIELD_ALWAYS_CLONE_KEY = new OptionKey<>(CLONE_DEFAULT_KEY.getDefaultValue());
150149
public static final OptionKey<Boolean> YIELD_ALWAYS_INLINE_KEY = new OptionKey<>(INLINE_DEFAULT_KEY.getDefaultValue());
151150
public static final OptionKey<Boolean> METHODMISSING_ALWAYS_CLONE_KEY = new OptionKey<>(CLONE_DEFAULT_KEY.getDefaultValue());
152151
public static final OptionKey<Boolean> METHODMISSING_ALWAYS_INLINE_KEY = new OptionKey<>(INLINE_DEFAULT_KEY.getDefaultValue());
@@ -1172,14 +1171,6 @@ public class OptionsCatalog {
11721171
.usageSyntax("")
11731172
.build();
11741173

1175-
public static final OptionDescriptor YIELD_ALWAYS_CLONE = OptionDescriptor
1176-
.newBuilder(YIELD_ALWAYS_CLONE_KEY, "ruby.yield-always-clone")
1177-
.help("Always clone yields")
1178-
.category(OptionCategory.INTERNAL)
1179-
.stability(OptionStability.EXPERIMENTAL)
1180-
.usageSyntax("")
1181-
.build();
1182-
11831174
public static final OptionDescriptor YIELD_ALWAYS_INLINE = OptionDescriptor
11841175
.newBuilder(YIELD_ALWAYS_INLINE_KEY, "ruby.yield-always-inline")
11851176
.help("Always inline yields")
@@ -1562,8 +1553,6 @@ public static OptionDescriptor fromName(String name) {
15621553
return NEVER_SPLIT_HONOR;
15631554
case "ruby.inline-needs-caller-frame":
15641555
return INLINE_NEEDS_CALLER_FRAME;
1565-
case "ruby.yield-always-clone":
1566-
return YIELD_ALWAYS_CLONE;
15671556
case "ruby.yield-always-inline":
15681557
return YIELD_ALWAYS_INLINE;
15691558
case "ruby.method-missing-always-clone":
@@ -1729,7 +1718,6 @@ public static OptionDescriptor[] allDescriptors() {
17291718
ALWAYS_SPLIT_HONOR,
17301719
NEVER_SPLIT_HONOR,
17311720
INLINE_NEEDS_CALLER_FRAME,
1732-
YIELD_ALWAYS_CLONE,
17331721
YIELD_ALWAYS_INLINE,
17341722
METHODMISSING_ALWAYS_CLONE,
17351723
METHODMISSING_ALWAYS_INLINE,

0 commit comments

Comments
 (0)