@@ -692,22 +692,34 @@ void jl_serialize_methtable_from_mod(ios_t *s, jl_module_t *m, jl_sym_t *name, j
692
692
mt = jl_gf_mtable (mt -> kwsorter );
693
693
assert (!mt -> kwsorter );
694
694
}
695
+ struct _chain {
696
+ jl_methlist_t * ml ;
697
+ struct _chain * next ;
698
+ } * chain = NULL ;
695
699
jl_methlist_t * ml = mt -> defs ;
696
700
while (ml != JL_NULL ) {
697
701
if (is_submodule (jl_current_module , ml -> func -> linfo -> module )) {
698
- jl_serialize_value (s , m );
699
- jl_serialize_value (s , name );
700
- write_int8 (s , iskw );
701
- jl_serialize_value (s , ml -> sig );
702
- jl_serialize_value (s , ml -> func );
703
- if (jl_is_tuple (ml -> tvars ))
704
- jl_serialize_value (s , ml -> tvars );
705
- else
706
- jl_serialize_value (s , jl_tuple1 (ml -> tvars ));
707
- write_int8 (s , ml -> isstaged );
702
+ struct _chain * link = (struct _chain * )alloca (sizeof (struct _chain ));
703
+ link -> ml = ml ;
704
+ link -> next = chain ;
705
+ chain = link ;
708
706
}
709
707
ml = ml -> next ;
710
708
}
709
+ while (chain ) {
710
+ ml = chain -> ml ;
711
+ jl_serialize_value (s , m );
712
+ jl_serialize_value (s , name );
713
+ write_int8 (s , iskw );
714
+ jl_serialize_value (s , ml -> sig );
715
+ jl_serialize_value (s , ml -> func );
716
+ if (jl_is_tuple (ml -> tvars ))
717
+ jl_serialize_value (s , ml -> tvars );
718
+ else
719
+ jl_serialize_value (s , jl_tuple1 (ml -> tvars ));
720
+ write_int8 (s , ml -> isstaged );
721
+ chain = chain -> next ;
722
+ }
711
723
}
712
724
713
725
void jl_serialize_lambdas_from_mod (ios_t * s , jl_module_t * m )
@@ -726,6 +738,7 @@ void jl_serialize_lambdas_from_mod(ios_t *s, jl_module_t *m)
726
738
jl_serialize_methtable_from_mod (s , m , b -> name , mt , 0 );
727
739
jl_serialize_methtable_from_mod (s , m , b -> name , mt , 1 );
728
740
}
741
+ //TODO: look in datatype cache?
729
742
}
730
743
else if (jl_is_module (b -> value )) {
731
744
jl_module_t * child = (jl_module_t * )b -> value ;
0 commit comments