File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
src/main/java/org/truffleruby Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ public abstract class Layouts {
21
21
// Standard identifiers
22
22
23
23
public static final HiddenKey OBJECT_ID_IDENTIFIER = new HiddenKey ("object_id" ); // long
24
- public static final HiddenKey FROZEN_IDENTIFIER = new HiddenKey ("frozen?" ); // boolean
25
24
public static final HiddenKey OBJECT_LOCK = new HiddenKey ("object_lock" ); // ReentrantLock
26
25
public static final HiddenKey ASSOCIATED_IDENTIFIER = new HiddenKey ("associated" ); // Pointer[]
27
26
public static final HiddenKey FINALIZER_REF_IDENTIFIER = new HiddenKey ("finalizerRef" ); // FinalizerReference
Original file line number Diff line number Diff line change 11
11
12
12
import com .oracle .truffle .api .interop .StopIterationException ;
13
13
import com .oracle .truffle .api .interop .UnknownKeyException ;
14
- import org .truffleruby .Layouts ;
15
14
import org .truffleruby .RubyContext ;
16
15
import org .truffleruby .RubyLanguage ;
17
16
import org .truffleruby .core .array .ArrayUtils ;
62
61
@ ExportLibrary (InteropLibrary .class )
63
62
public abstract class RubyDynamicObject extends DynamicObject {
64
63
64
+ private static final int FROZEN = 1 ;
65
+
65
66
private RubyClass metaClass ;
66
67
67
68
public RubyDynamicObject (RubyClass metaClass , Shape shape ) {
@@ -98,14 +99,14 @@ public String toString() {
98
99
// region RubyLibrary messages
99
100
@ ExportMessage
100
101
public void freeze (
101
- @ Exclusive @ Cached WriteObjectFieldNode writeFrozenNode ) {
102
- writeFrozenNode . execute (this , Layouts . FROZEN_IDENTIFIER , true );
102
+ @ CachedLibrary ( "this" ) DynamicObjectLibrary objLib ) {
103
+ objLib . setShapeFlags (this , objLib . getShapeFlags ( this ) | FROZEN );
103
104
}
104
105
105
106
@ ExportMessage
106
107
public boolean isFrozen (
107
- @ CachedLibrary ("this" ) DynamicObjectLibrary readFrozenNode ) {
108
- return (boolean ) readFrozenNode . getOrDefault (this , Layouts . FROZEN_IDENTIFIER , false ) ;
108
+ @ CachedLibrary ("this" ) DynamicObjectLibrary objLib ) {
109
+ return (objLib . getShapeFlags (this ) & FROZEN ) != 0 ;
109
110
}
110
111
// endregion
111
112
You can’t perform that action at this time.
0 commit comments