Skip to content

Commit 9161480

Browse files
committed
Changes based on review.
1 parent 08acc56 commit 9161480

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/main/java/org/truffleruby/cext/ValueWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import com.oracle.truffle.api.interop.TruffleObject;
1414

1515
/**
16-
* This layout represents a VALUE in C which wraps the raw Ruby object. This allows foreign access
16+
* This object represents a VALUE in C which wraps the raw Ruby object. This allows foreign access
1717
* methods to be set up which convert these value wrappers to native pointers without affecting the
1818
* semantics of the wrapped objects.
1919
*/

src/main/java/org/truffleruby/cext/WrapNode.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public abstract class WrapNode extends RubyBaseNode {
3838
public abstract TruffleObject execute(Object value);
3939

4040
@Specialization
41-
public TruffleObject wrapLong(long value,
41+
public ValueWrapper wrapLong(long value,
4242
@Cached("create()") BranchProfile smallFixnumProfile) {
4343
if (value >= ValueWrapperManager.MIN_FIXNUM_VALUE && value <= ValueWrapperManager.MAX_FIXNUM_VALUE) {
4444
smallFixnumProfile.enter();
@@ -50,40 +50,40 @@ public TruffleObject wrapLong(long value,
5050
}
5151

5252
@Specialization
53-
public TruffleObject wrapDouble(double value) {
53+
public ValueWrapper wrapDouble(double value) {
5454
return getContext().getValueWrapperManager().doubleWrapper(value);
5555
}
5656

5757
@Specialization
58-
public TruffleObject wrapBoolean(boolean value) {
58+
public ValueWrapper wrapBoolean(boolean value) {
5959
return new ValueWrapper(value, value ? TRUE_HANDLE : FALSE_HANDLE);
6060
}
6161

6262
@Specialization
63-
public TruffleObject wrapUndef(NotProvided value) {
63+
public ValueWrapper wrapUndef(NotProvided value) {
6464
return new ValueWrapper(value, UNDEF_HANDLE);
6565
}
6666

6767
@Specialization
68-
public TruffleObject wrapWrappedValue(ValueWrapper value) {
68+
public ValueWrapper wrapWrappedValue(ValueWrapper value) {
6969
throw new RaiseException(getContext(), coreExceptions().argumentError(RopeOperations.encodeAscii("Wrapping wrapped object", UTF8Encoding.INSTANCE), this));
7070
}
7171

7272
@Specialization(guards = "isNil(value)")
73-
public TruffleObject wrapNil(DynamicObject value) {
73+
public ValueWrapper wrapNil(DynamicObject value) {
7474
return new ValueWrapper(nil(), NIL_HANDLE);
7575
}
7676

7777
@Specialization(guards = { "isRubyBasicObject(value)", "!isNil(value)" })
78-
public TruffleObject wrapValue(DynamicObject value,
78+
public ValueWrapper wrapValue(DynamicObject value,
7979
@Cached("createReader()") ReadObjectFieldNode readWrapperNode,
8080
@Cached("createWriter()") WriteObjectFieldNode writeWrapperNode,
8181
@Cached("create()") BranchProfile noHandleProfile) {
82-
TruffleObject wrapper = (TruffleObject) readWrapperNode.execute(value);
82+
ValueWrapper wrapper = (ValueWrapper) readWrapperNode.execute(value);
8383
if (wrapper == null) {
8484
noHandleProfile.enter();
8585
synchronized (value) {
86-
wrapper = (DynamicObject) readWrapperNode.execute(value);
86+
wrapper = (ValueWrapper) readWrapperNode.execute(value);
8787
if (wrapper == null) {
8888
wrapper = new ValueWrapper(value, UNSET_HANDLE);
8989
writeWrapperNode.write(value, wrapper);
@@ -106,8 +106,4 @@ public WriteObjectFieldNode createWriter() {
106106
return WriteObjectFieldNodeGen.create(Layouts.VALUE_WRAPPER_IDENTIFIER);
107107
}
108108

109-
public boolean isWrapped(TruffleObject value) {
110-
return value instanceof ValueWrapper;
111-
}
112-
113109
}

0 commit comments

Comments
 (0)