@@ -36,6 +36,11 @@ var REFVAR_VM_HASH_STR_VAR = 10;
36
36
var REFVAR_STATIC_CODEREF = 11 ;
37
37
var REFVAR_CLONED_CODEREF = 12 ;
38
38
39
+ var STABLE_BOOLIFICATION_SPEC_MODE_MASK = 0x0F ;
40
+ var STABLE_HAS_CONTAINER_SPEC = 0x10 ;
41
+ var STABLE_HAS_INVOCATION_SPEC = 0x20 ;
42
+ var STABLE_HAS_HLL_OWNER = 0x40 ;
43
+
39
44
function BinaryWriteCursor ( writer ) {
40
45
this . buffer = new Buffer ( 1024 ) ;
41
46
this . writer = writer ;
@@ -465,16 +470,16 @@ SerializationWriter.prototype.serializeSTable = function(st) {
465
470
/*TODO serialize boolifcation spec*/
466
471
var flags ;
467
472
468
- if ( false ) {
469
- //if (st->boolification_spec->mode >= 0xF) {
470
- // MVM_exception_throw_adhoc(tc,
471
- // "Serialization error: boolification spec mode %u out of range and can't be serialized",
472
- // st->boolification_spec->mode);
473
- //}
474
- //flags = st->boolification_spec->mode;
473
+ if ( st . boolificationSpec ) {
474
+ var mode = st . boolificationSpec . mode ;
475
+ if ( mode >= 0xF ) {
476
+ throw "Serialization error: boolification spec mode " + mode + " out of range and can't be serialized" ;
477
+ }
478
+ flags = mode ;
475
479
} else {
476
480
flags = 0xF ;
477
481
}
482
+
478
483
/*
479
484
if (st->container_spec != NULL)
480
485
flags |= STABLE_HAS_CONTAINER_SPEC;
@@ -484,14 +489,13 @@ SerializationWriter.prototype.serializeSTable = function(st) {
484
489
flags |= STABLE_HAS_HLL_OWNER;
485
490
*/
486
491
487
- /* Boolification spec. */
488
492
this . stables_data . U8 ( flags ) ;
489
493
490
- /*writeInt(st.BoolificationSpec == null ? 0 : 1);
491
- if (st.BoolificationSpec != null) {
492
- writeInt (st.BoolificationSpec.Mode);
493
- writeRef (st.BoolificationSpec.Method );
494
- }*/
494
+ /* Boolification spec. */
495
+
496
+ if ( st . boolificationSpec ) {
497
+ this . stables_data . ref ( st . boolificationSpec . method ) ;
498
+ }
495
499
496
500
/*this.stables_data.writeInt(st.ContainerSpec == null ? 0 : 1);
497
501
if (st.ContainerSpec != null) {
0 commit comments