|
@@ -184,6 +184,8 @@ class ['key,'value] identity_pool = object(self)
|
|
DynArray.to_list items
|
|
DynArray.to_list items
|
|
|
|
|
|
method items = items
|
|
method items = items
|
|
|
|
+
|
|
|
|
+ method length = DynArray.length items
|
|
end
|
|
end
|
|
|
|
|
|
module SimnBuffer = struct
|
|
module SimnBuffer = struct
|
|
@@ -1702,7 +1704,7 @@ class hxb_writer
|
|
self#write_class_field_forward cf;
|
|
self#write_class_field_forward cf;
|
|
);
|
|
);
|
|
|
|
|
|
- method start_texpr (p: pos) =
|
|
|
|
|
|
+ method start_texpr (write_expr_immediately : bool) (p: pos) =
|
|
let restore = self#start_temporary_chunk 512 in
|
|
let restore = self#start_temporary_chunk 512 in
|
|
let fctx = create_field_writer_context (new pos_writer chunk stats p) in
|
|
let fctx = create_field_writer_context (new pos_writer chunk stats p) in
|
|
fctx,(fun () ->
|
|
fctx,(fun () ->
|
|
@@ -1711,7 +1713,15 @@ class hxb_writer
|
|
if self#in_nested_scope then
|
|
if self#in_nested_scope then
|
|
IOChunk.write_u8 chunk.io 0
|
|
IOChunk.write_u8 chunk.io 0
|
|
else begin
|
|
else begin
|
|
- IOChunk.write_u8 chunk.io 1;
|
|
|
|
|
|
+ if write_expr_immediately then
|
|
|
|
+ IOChunk.write_u8 chunk.io 1
|
|
|
|
+ else begin
|
|
|
|
+ IOChunk.write_u8 chunk.io 2;
|
|
|
|
+ (* For CFEX, we give the total number of field type parameters so that
|
|
|
|
+ the reader can allocate a fixed array. The first elements correspond
|
|
|
|
+ to cf_params, the rest will be filled by nested anon field params. *)
|
|
|
|
+ IOChunk.write_uleb128 chunk.io field_type_parameters#length;
|
|
|
|
+ end;
|
|
let ltp = List.map fst local_type_parameters#to_list in
|
|
let ltp = List.map fst local_type_parameters#to_list in
|
|
self#write_type_parameters ltp
|
|
self#write_type_parameters ltp
|
|
end;
|
|
end;
|
|
@@ -1754,14 +1764,14 @@ class hxb_writer
|
|
None
|
|
None
|
|
(* | Some e when not write_expr_immediately ->
|
|
(* | Some e when not write_expr_immediately ->
|
|
IOChunk.write_u8 chunk.io 0;
|
|
IOChunk.write_u8 chunk.io 0;
|
|
- let fctx,close = self#start_texpr e.epos in
|
|
|
|
|
|
+ let fctx,close = self#start_texpr false e.epos in
|
|
self#write_texpr fctx e;
|
|
self#write_texpr fctx e;
|
|
Chunk.write_option chunk cf.cf_expr_unoptimized (self#write_texpr fctx);
|
|
Chunk.write_option chunk cf.cf_expr_unoptimized (self#write_texpr fctx);
|
|
let expr_chunk = close() in
|
|
let expr_chunk = close() in
|
|
Some expr_chunk *)
|
|
Some expr_chunk *)
|
|
| Some e ->
|
|
| Some e ->
|
|
IOChunk.write_u8 chunk.io 1;
|
|
IOChunk.write_u8 chunk.io 1;
|
|
- let fctx,close = self#start_texpr e.epos in
|
|
|
|
|
|
+ let fctx,close = self#start_texpr true e.epos in
|
|
self#write_texpr fctx e;
|
|
self#write_texpr fctx e;
|
|
Chunk.write_option chunk cf.cf_expr_unoptimized (self#write_texpr fctx);
|
|
Chunk.write_option chunk cf.cf_expr_unoptimized (self#write_texpr fctx);
|
|
let expr_chunk = close() in
|
|
let expr_chunk = close() in
|
|
@@ -2021,10 +2031,11 @@ class hxb_writer
|
|
self#select_type c.cl_path;
|
|
self#select_type c.cl_path;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ let c_expr_chunks = ref [] in
|
|
let write_field ref_kind cf =
|
|
let write_field ref_kind cf =
|
|
let l = self#write_class_field_and_overloads_data false cf in
|
|
let l = self#write_class_field_and_overloads_data false cf in
|
|
List.iter (fun (cf,e) ->
|
|
List.iter (fun (cf,e) ->
|
|
- expr_chunks := (c,cf,ref_kind,e) :: !expr_chunks
|
|
|
|
|
|
+ c_expr_chunks := (cf,ref_kind,e) :: !c_expr_chunks
|
|
) l
|
|
) l
|
|
in
|
|
in
|
|
|
|
|
|
@@ -2032,16 +2043,20 @@ class hxb_writer
|
|
Chunk.write_list chunk c.cl_ordered_fields (write_field CfrMember);
|
|
Chunk.write_list chunk c.cl_ordered_fields (write_field CfrMember);
|
|
Chunk.write_list chunk c.cl_ordered_statics (write_field CfrStatic);
|
|
Chunk.write_list chunk c.cl_ordered_statics (write_field CfrStatic);
|
|
Chunk.write_option chunk c.cl_init (fun e ->
|
|
Chunk.write_option chunk c.cl_init (fun e ->
|
|
- let fctx,close = self#start_texpr e.epos in
|
|
|
|
|
|
+ let fctx,close = self#start_texpr true e.epos in
|
|
self#write_texpr fctx e;
|
|
self#write_texpr fctx e;
|
|
let new_chunk = close() in
|
|
let new_chunk = close() in
|
|
Chunk.export_data new_chunk chunk
|
|
Chunk.export_data new_chunk chunk
|
|
);
|
|
);
|
|
|
|
+ expr_chunks := (c,!c_expr_chunks) :: !expr_chunks
|
|
);
|
|
);
|
|
self#start_chunk CFEX;
|
|
self#start_chunk CFEX;
|
|
- Chunk.write_list chunk !expr_chunks (fun (c,cf,ref_kind,e) ->
|
|
|
|
- self#write_field_ref c ref_kind cf;
|
|
|
|
- Chunk.export_data e chunk
|
|
|
|
|
|
+ Chunk.write_list chunk !expr_chunks (fun (c,l) ->
|
|
|
|
+ self#write_class_ref c;
|
|
|
|
+ Chunk.write_list chunk l (fun (cf,ref_kind,e) ->
|
|
|
|
+ self#write_field_ref c ref_kind cf;
|
|
|
|
+ Chunk.export_data e chunk
|
|
|
|
+ )
|
|
)
|
|
)
|
|
end;
|
|
end;
|
|
begin match own_enums#to_list with
|
|
begin match own_enums#to_list with
|