9
9
*/
10
10
package org .truffleruby .cext ;
11
11
12
+ import org .truffleruby .Layouts ;
12
13
import org .truffleruby .collections .LongHashMap ;
13
14
import org .truffleruby .language .NotProvided ;
14
15
19
20
20
21
public class ValueWrapperObjectType extends ObjectType {
21
22
22
- public static final ValueWrapperLayout VALUE_WRAPPER = ValueWrapperLayoutImpl .INSTANCE ;
23
-
24
23
private static DynamicObject UNDEF_WRAPPER = null ;
25
24
26
25
private static DynamicObject TRUE_WRAPPER = null ;
@@ -29,24 +28,24 @@ public class ValueWrapperObjectType extends ObjectType {
29
28
private static LongHashMap <DynamicObject > longMap = new LongHashMap <>(128 );
30
29
31
30
public static DynamicObject createValueWrapper (Object value ) {
32
- return VALUE_WRAPPER .createValueWrapper (value );
31
+ return Layouts . VALUE_WRAPPER .createValueWrapper (value );
33
32
}
34
33
35
34
public static synchronized DynamicObject createUndefWrapper (NotProvided value ) {
36
- return UNDEF_WRAPPER != null ? UNDEF_WRAPPER : (UNDEF_WRAPPER = VALUE_WRAPPER .createValueWrapper (value ));
35
+ return UNDEF_WRAPPER != null ? UNDEF_WRAPPER : (UNDEF_WRAPPER = Layouts . VALUE_WRAPPER .createValueWrapper (value ));
37
36
}
38
37
39
38
public static synchronized DynamicObject createBooleanWrapper (boolean value ) {
40
39
if (value ) {
41
- return TRUE_WRAPPER != null ? TRUE_WRAPPER : (TRUE_WRAPPER = VALUE_WRAPPER .createValueWrapper (true ));
40
+ return TRUE_WRAPPER != null ? TRUE_WRAPPER : (TRUE_WRAPPER = Layouts . VALUE_WRAPPER .createValueWrapper (true ));
42
41
} else {
43
42
return FALSE_WRAPPER != null ? FALSE_WRAPPER : (FALSE_WRAPPER = createFalseWrapper ());
44
43
}
45
44
}
46
45
47
- protected static DynamicObject createFalseWrapper () {
46
+ private static DynamicObject createFalseWrapper () {
48
47
// Ensure that Qfalse will by falsy in C.
49
- return VALUE_WRAPPER .createValueWrapper (false );
48
+ return Layouts . VALUE_WRAPPER .createValueWrapper (false );
50
49
}
51
50
52
51
/*
@@ -57,19 +56,19 @@ protected static DynamicObject createFalseWrapper() {
57
56
public static synchronized DynamicObject createLongWrapper (long value ) {
58
57
DynamicObject wrapper = longMap .get (value );
59
58
if (wrapper == null ) {
60
- wrapper = VALUE_WRAPPER .createValueWrapper (value );
59
+ wrapper = Layouts . VALUE_WRAPPER .createValueWrapper (value );
61
60
longMap .put (value , wrapper );
62
61
}
63
62
return wrapper ;
64
63
}
65
64
66
65
@ TruffleBoundary
67
66
public static synchronized DynamicObject createDoubleWrapper (double value ) {
68
- return VALUE_WRAPPER .createValueWrapper (value );
67
+ return Layouts . VALUE_WRAPPER .createValueWrapper (value );
69
68
}
70
69
71
70
public static boolean isInstance (TruffleObject receiver ) {
72
- return VALUE_WRAPPER .isValueWrapper (receiver );
71
+ return Layouts . VALUE_WRAPPER .isValueWrapper (receiver );
73
72
}
74
73
75
74
}
0 commit comments