Browse Source

+ support externref and funcref WebAssembly globals in the internal object writer

Nikolay Nikolov 2 years ago
parent
commit
9b4366e4f6
1 changed files with 12 additions and 0 deletions
  1. 12 0
      compiler/ogwasm.pas

+ 12 - 0
compiler/ogwasm.pas

@@ -1669,6 +1669,18 @@ implementation
                           WriteByte(FWasmSections[wsiGlobal],$00);
                           WriteByte(FWasmSections[wsiGlobal],$00);
                           WriteByte(FWasmSections[wsiGlobal],$0B);  { end }
                           WriteByte(FWasmSections[wsiGlobal],$0B);  { end }
                         end;
                         end;
+                      wbt_externref:
+                        begin
+                          WriteByte(FWasmSections[wsiGlobal],$D0); { ref.null extern }
+                          WriteByte(FWasmSections[wsiGlobal],$6F);
+                          WriteByte(FWasmSections[wsiGlobal],$0B);  { end }
+                        end;
+                      wbt_funcref:
+                        begin
+                          WriteByte(FWasmSections[wsiGlobal],$D0); { ref.null func }
+                          WriteByte(FWasmSections[wsiGlobal],$70);
+                          WriteByte(FWasmSections[wsiGlobal],$0B);  { end }
+                        end;
                       else
                       else
                         internalerror(2022052801);
                         internalerror(2022052801);
                     end;
                     end;