File tree Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Original file line number Diff line number Diff line change 124
124
'heap2local-desc.wast' ,
125
125
'minimize-rec-groups-desc.wast' ,
126
126
'precompute-desc.wast' ,
127
+ 'gc-desc.wast' ,
127
128
# TODO: fix split_wast() on tricky escaping situations like a string ending
128
129
# in \\" (the " is not escaped - there is an escaped \ before it)
129
130
'string-lifting-section.wast' ,
Original file line number Diff line number Diff line change @@ -850,7 +850,7 @@ struct CtorEvalExternalInterface : EvallingModuleRunner::ExternalInterface {
850
850
} else {
851
851
// This is the first usage of this data. Generate a struct.new /
852
852
// array.new for it.
853
- auto & values = value. getGCData () ->values ;
853
+ auto & values = data ->values ;
854
854
std::vector<Expression*> args;
855
855
856
856
// The initial values for this allocation may themselves be GC
@@ -876,10 +876,15 @@ struct CtorEvalExternalInterface : EvallingModuleRunner::ExternalInterface {
876
876
args.push_back (getSerialization (value));
877
877
}
878
878
879
+ Expression* desc = nullptr ;
880
+ if (data->desc .getGCData ()) {
881
+ desc = getSerialization (data->desc );
882
+ }
883
+
879
884
Expression* init;
880
885
auto heapType = type.getHeapType ();
881
886
if (heapType.isStruct ()) {
882
- init = builder.makeStructNew (heapType, args);
887
+ init = builder.makeStructNew (heapType, args, desc );
883
888
} else if (heapType.isArray ()) {
884
889
// TODO: for repeated identical values, can use ArrayNew
885
890
init = builder.makeArrayNewFixed (heapType, args);
Original file line number Diff line number Diff line change
1
+ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
2
+ ;; RUN: wasm-ctor-eval %s --ctors=ctor --kept-exports=ctor --quiet -all -S -o - | filecheck %s
3
+
4
+ (module
5
+ (rec
6
+ ;; CHECK: (rec
7
+ ;; CHECK-NEXT: (type $struct (sub (descriptor $desc (struct))))
8
+ (type $struct (sub (descriptor $desc (struct ))))
9
+ ;; CHECK: (type $desc (describes $struct (struct)))
10
+ (type $desc (describes $struct (struct )))
11
+ )
12
+ ;; CHECK: (type $2 (func))
13
+
14
+ ;; CHECK: (global $ctor-eval$global_2 (ref (exact $desc)) (struct.new_default $desc))
15
+
16
+ ;; CHECK: (global $ctor-eval$global (ref (exact $struct)) (struct.new_default $struct
17
+ ;; CHECK-NEXT: (global.get $ctor-eval$global_2)
18
+ ;; CHECK-NEXT: ))
19
+
20
+ ;; CHECK: (global $global (ref $struct) (global.get $ctor-eval$global))
21
+ (global $global (export " g" ) (ref $struct )
22
+ (struct.new $struct
23
+ (struct.new $desc )
24
+ )
25
+ )
26
+
27
+ ;; Export some arbitrary ctor so we do anything at all.
28
+ (func $ctor (export " ctor" )
29
+ (nop )
30
+ )
31
+ )
32
+ ;; CHECK: (export "g" (global $global))
33
+
34
+ ;; CHECK: (export "ctor" (func $ctor_1))
35
+
36
+ ;; CHECK: (func $ctor_1 (type $2)
37
+ ;; CHECK-NEXT: (nop)
38
+ ;; CHECK-NEXT: )
You can’t perform that action at this time.
0 commit comments