11
11
#include "pmc_serializationcontext.h"
12
12
#include "pmc_nqplexinfo.h"
13
13
#include "pmc_ownedhash.h"
14
+ #include "pmc_ownedresizablepmcarray.h"
14
15
#include "pmc/pmc_sub.h"
15
16
#include "base64.h"
16
17
@@ -56,6 +57,7 @@ static INTVAL nqp_lexpad_id = 0;
56
57
static INTVAL perl6_lexpad_id = 0 ;
57
58
static INTVAL ctmthunk_id = 0 ;
58
59
static INTVAL ownedhash_id = 0 ;
60
+ static INTVAL ownedrpa_id = 0 ;
59
61
60
62
/* ***************************************************************************
61
63
* Serialization (writing related)
@@ -459,6 +461,9 @@ void write_ref_func(PARROT_INTERP, SerializationWriter *writer, PMC *ref) {
459
461
else if (ref -> vtable -> base_type == enum_class_ResizablePMCArray ) {
460
462
discrim = REFVAR_VM_ARR_VAR ;
461
463
}
464
+ else if (ref -> vtable -> base_type == ownedrpa_id ) {
465
+ discrim = REFVAR_VM_ARR_VAR ;
466
+ }
462
467
else if (ref -> vtable -> base_type == enum_class_ResizableIntegerArray ) {
463
468
discrim = REFVAR_VM_ARR_INT ;
464
469
}
@@ -984,6 +989,7 @@ STRING * Serialization_serialize(PARROT_INTERP, PMC *sc, PMC *empty_string_heap)
984
989
perl6_lexpad_id = Parrot_pmc_get_type_str (interp , Parrot_str_new (interp , "Perl6LexInfo" , 0 ));
985
990
ctmthunk_id = Parrot_pmc_get_type_str (interp , Parrot_str_new (interp , "CTMThunk" , 0 ));
986
991
ownedhash_id = Parrot_pmc_get_type_str (interp , Parrot_str_new (interp , "OwnedHash" , 0 ));
992
+ ownedrpa_id = Parrot_pmc_get_type_str (interp , Parrot_str_new (interp , "OwnedResizablePMCArray" , 0 ));
987
993
988
994
/* Initialize string heap so first entry is the NULL string. */
989
995
VTABLE_push_string (interp , empty_string_heap , STRINGNULL );
@@ -1123,7 +1129,7 @@ PMC * read_obj_ref(PARROT_INTERP, SerializationReader *reader) {
1123
1129
/* Reads in an array of variant references. */
1124
1130
PMC * read_ref_func (PARROT_INTERP , SerializationReader * reader );
1125
1131
static PMC * read_array_var (PARROT_INTERP , SerializationReader * reader ) {
1126
- PMC * result = Parrot_pmc_new (interp , enum_class_ResizablePMCArray );
1132
+ PMC * result = Parrot_pmc_new (interp , ownedrpa_id );
1127
1133
Parrot_Int4 elems , i ;
1128
1134
1129
1135
/* Read the element count. */
@@ -1135,6 +1141,9 @@ static PMC * read_array_var(PARROT_INTERP, SerializationReader *reader) {
1135
1141
for (i = 0 ; i < elems ; i ++ )
1136
1142
VTABLE_set_pmc_keyed_int (interp , result , i , read_ref_func (interp , reader ));
1137
1143
1144
+ /* Set the owner. */
1145
+ PARROT_OWNEDRESIZABLEPMCARRAY (result )-> owner = reader -> cur_object ;
1146
+
1138
1147
return result ;
1139
1148
}
1140
1149
@@ -1735,6 +1744,7 @@ void Serialization_deserialize(PARROT_INTERP, PMC *sc, PMC *string_heap, PMC *st
1735
1744
/* Other init. */
1736
1745
smo_id = Parrot_pmc_get_type_str (interp , Parrot_str_new (interp , "SixModelObject" , 0 ));
1737
1746
ownedhash_id = Parrot_pmc_get_type_str (interp , Parrot_str_new (interp , "OwnedHash" , 0 ));
1747
+ ownedrpa_id = Parrot_pmc_get_type_str (interp , Parrot_str_new (interp , "OwnedResizablePMCArray" , 0 ));
1738
1748
1739
1749
/* Read header and disect the data into its parts. */
1740
1750
check_and_disect_input (interp , reader , data );
0 commit comments