Skip to content

Commit c3f94fe

Browse files
committed
Profile condition and fix style
1 parent c5eaf18 commit c3f94fe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/org/truffleruby/language/supercall/ReadZSuperArgumentsNode.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
package org.truffleruby.language.supercall;
1111

12+
import com.oracle.truffle.api.profiles.ConditionProfile;
1213
import org.truffleruby.core.array.ArrayToObjectArrayNode;
1314
import org.truffleruby.core.array.ArrayToObjectArrayNodeGen;
1415
import org.truffleruby.core.array.ArrayUtils;
@@ -28,6 +29,7 @@ public class ReadZSuperArgumentsNode extends RubyContextSourceNode {
2829
@Child private ArrayToObjectArrayNode unsplatNode;
2930

3031
private final int restArgIndex;
32+
private final ConditionProfile isArrayProfile = ConditionProfile.create();
3133

3234
public ReadZSuperArgumentsNode(int restArgIndex, RubyNode[] reloadNodes) {
3335
this.restArgIndex = restArgIndex;
@@ -50,11 +52,10 @@ public final Object execute(VirtualFrame frame) {
5052
final Object restArg = superArguments[restArgIndex];
5153

5254
final Object[] restArgs;
53-
54-
if (restArg instanceof RubyArray) {
55+
if (isArrayProfile.profile(restArg instanceof RubyArray)) {
5556
restArgs = unsplat((RubyArray) restArg);
5657
} else {
57-
restArgs = new Object[]{restArg};
58+
restArgs = new Object[]{ restArg };
5859
}
5960

6061
final int after = superArguments.length - (restArgIndex + 1);

0 commit comments

Comments
 (0)