@@ -18,8 +18,25 @@ public SixModelObject type_object_for(ThreadContext tc, SixModelObject HOW) {
18
18
SixModelObject obj = new TypeObject ();
19
19
obj .st = st ;
20
20
st .WHAT = obj ;
21
+
22
+ StorageSpec ss = new StorageSpec ();
23
+ ss .inlineable = StorageSpec .INLINED ;
24
+ ss .boxed_primitive = StorageSpec .BP_INT ;
25
+ ss .bits = 64 ;
26
+ ss .can_box = StorageSpec .CAN_BOX_INT ;
27
+ st .REPRData = ss ;
28
+
21
29
return st .WHAT ;
22
30
}
31
+
32
+ public void compose (ThreadContext tc , STable st , SixModelObject repr_info ) {
33
+ SixModelObject integerInfo = repr_info .at_key_boxed (tc , "integer" );
34
+ if (integerInfo != null ) {
35
+ SixModelObject bits = integerInfo .at_key_boxed (tc , "bits" );
36
+ if (bits != null )
37
+ ((StorageSpec )st .REPRData ).bits = (short )bits .get_int (tc );
38
+ }
39
+ }
23
40
24
41
public SixModelObject allocate (ThreadContext tc , STable st ) {
25
42
P6intInstance obj = new P6intInstance ();
@@ -28,12 +45,7 @@ public SixModelObject allocate(ThreadContext tc, STable st) {
28
45
}
29
46
30
47
public StorageSpec get_storage_spec (ThreadContext tc , STable st ) {
31
- StorageSpec ss = new StorageSpec ();
32
- ss .inlineable = StorageSpec .INLINED ;
33
- ss .boxed_primitive = StorageSpec .BP_INT ;
34
- ss .bits = 64 ;
35
- ss .can_box = StorageSpec .CAN_BOX_INT ;
36
- return ss ;
48
+ return (StorageSpec )st .REPRData ;
37
49
}
38
50
39
51
public void inlineStorage (ThreadContext tc , STable st , ClassWriter cw , String prefix ) {
@@ -117,4 +129,30 @@ public void serialize_inlined(ThreadContext tc, STable st, SerializationWriter w
117
129
throw new RuntimeException (e );
118
130
}
119
131
}
132
+
133
+ /**
134
+ * REPR data serialization. Serializes the per-type representation data that
135
+ * is attached to the supplied STable.
136
+ */
137
+ public void serialize_repr_data (ThreadContext tc , STable st , SerializationWriter writer )
138
+ {
139
+ writer .writeInt (((StorageSpec )st .REPRData ).bits );
140
+ }
141
+
142
+ /**
143
+ * REPR data deserialization. Deserializes the per-type representation data and
144
+ * attaches it to the supplied STable.
145
+ */
146
+ public void deserialize_repr_data (ThreadContext tc , STable st , SerializationReader reader )
147
+ {
148
+ StorageSpec ss = new StorageSpec ();
149
+ ss .inlineable = StorageSpec .INLINED ;
150
+ ss .boxed_primitive = StorageSpec .BP_INT ;
151
+ if (reader .version >= 7 )
152
+ ss .bits = (short )reader .readLong ();
153
+ else
154
+ ss .bits = 64 ;
155
+ ss .can_box = StorageSpec .CAN_BOX_INT ;
156
+ st .REPRData = ss ;
157
+ }
120
158
}
0 commit comments