Skip to content

Commit 236de00

Browse files
committed
Migrated profiles to inlinable in debug package
1 parent 17ec84b commit 236de00

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

src/main/java/org/truffleruby/debug/SingleElementArray.java

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

12+
import com.oracle.truffle.api.dsl.Bind;
1213
import com.oracle.truffle.api.dsl.Cached;
1314
import com.oracle.truffle.api.interop.InteropLibrary;
1415
import com.oracle.truffle.api.interop.InvalidArrayIndexException;
1516
import com.oracle.truffle.api.interop.TruffleObject;
1617
import com.oracle.truffle.api.library.ExportLibrary;
1718
import com.oracle.truffle.api.library.ExportMessage;
18-
import com.oracle.truffle.api.profiles.BranchProfile;
19+
import com.oracle.truffle.api.nodes.Node;
20+
import com.oracle.truffle.api.profiles.InlinedBranchProfile;
1921

2022
@ExportLibrary(InteropLibrary.class)
2123
public class SingleElementArray implements TruffleObject {
@@ -38,11 +40,12 @@ protected long getArraySize() {
3840

3941
@ExportMessage
4042
protected Object readArrayElement(long index,
41-
@Cached BranchProfile errorProfile) throws InvalidArrayIndexException {
43+
@Cached InlinedBranchProfile errorProfile,
44+
@Bind("$node") Node node) throws InvalidArrayIndexException {
4245
if (isArrayElementReadable(index)) {
4346
return element;
4447
} else {
45-
errorProfile.enter();
48+
errorProfile.enter(node);
4649
throw InvalidArrayIndexException.create(index);
4750
}
4851
}

src/main/java/org/truffleruby/debug/SingleMemberDescriptor.java

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

12+
import com.oracle.truffle.api.dsl.Bind;
1213
import com.oracle.truffle.api.dsl.Cached;
1314
import com.oracle.truffle.api.interop.InteropLibrary;
1415
import com.oracle.truffle.api.interop.TruffleObject;
1516
import com.oracle.truffle.api.interop.UnknownIdentifierException;
1617
import com.oracle.truffle.api.library.ExportLibrary;
1718
import com.oracle.truffle.api.library.ExportMessage;
18-
import com.oracle.truffle.api.profiles.BranchProfile;
19+
import com.oracle.truffle.api.nodes.Node;
20+
import com.oracle.truffle.api.profiles.InlinedBranchProfile;
1921

2022
@ExportLibrary(InteropLibrary.class)
2123
public class SingleMemberDescriptor implements TruffleObject {
@@ -45,11 +47,12 @@ protected boolean isMemberReadable(String member) {
4547

4648
@ExportMessage
4749
protected Object readMember(String member,
48-
@Cached BranchProfile errorProfile) throws UnknownIdentifierException {
50+
@Cached InlinedBranchProfile errorProfile,
51+
@Bind("$node") Node node) throws UnknownIdentifierException {
4952
if (isMemberReadable(member)) {
5053
return value;
5154
} else {
52-
errorProfile.enter();
55+
errorProfile.enter(node);
5356
throw UnknownIdentifierException.create(member);
5457
}
5558
}

src/main/java/org/truffleruby/debug/VariableNamesObject.java

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

12+
import com.oracle.truffle.api.dsl.Bind;
1213
import com.oracle.truffle.api.dsl.Cached;
1314
import com.oracle.truffle.api.interop.InteropLibrary;
1415
import com.oracle.truffle.api.interop.InvalidArrayIndexException;
1516
import com.oracle.truffle.api.interop.TruffleObject;
1617
import com.oracle.truffle.api.library.ExportLibrary;
1718
import com.oracle.truffle.api.library.ExportMessage;
18-
import com.oracle.truffle.api.profiles.BranchProfile;
19+
import com.oracle.truffle.api.nodes.Node;
20+
import com.oracle.truffle.api.profiles.InlinedBranchProfile;
1921

2022
@ExportLibrary(InteropLibrary.class)
2123
public class VariableNamesObject implements TruffleObject {
@@ -38,11 +40,12 @@ protected long getArraySize() {
3840

3941
@ExportMessage
4042
protected Object readArrayElement(long index,
41-
@Cached BranchProfile errorProfile) throws InvalidArrayIndexException {
43+
@Cached InlinedBranchProfile errorProfile,
44+
@Bind("$node") Node node) throws InvalidArrayIndexException {
4245
if (isArrayElementReadable(index)) {
4346
return names[(int) index];
4447
} else {
45-
errorProfile.enter();
48+
errorProfile.enter(node);
4649
throw InvalidArrayIndexException.create(index);
4750
}
4851
}

src/main/java/org/truffleruby/debug/package-info.java

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/main/java/org/truffleruby/language/RubyBaseNode.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
package org.truffleruby.language;
1111

1212
import com.oracle.truffle.api.CompilerAsserts;
13+
import com.oracle.truffle.api.dsl.GenerateInline;
1314
import com.oracle.truffle.api.dsl.Idempotent;
1415
import com.oracle.truffle.api.dsl.ImportStatic;
1516
import com.oracle.truffle.api.dsl.TypeSystemReference;
@@ -41,6 +42,7 @@
4142
import java.math.BigInteger;
4243

4344
/** Base of all Ruby nodes */
45+
@GenerateInline(value = false, inherit = true)
4446
@TypeSystemReference(RubyTypes.class)
4547
@ImportStatic(RubyGuards.class)
4648
public abstract class RubyBaseNode extends Node {

0 commit comments

Comments
 (0)