Bläddra i källkod

+ added the wasmfuncref directive for procvars. Not actually implemented, just
parsed.

Nikolay Nikolov 2 år sedan
förälder
incheckning
93438ef1a5
3 ändrade filer med 21 tillägg och 3 borttagningar
  1. 10 1
      compiler/pdecsub.pas
  2. 9 2
      compiler/symconst.pas
  3. 2 0
      compiler/tokens.pas

+ 10 - 1
compiler/pdecsub.pas

@@ -2476,7 +2476,7 @@ type
    end;
 const
   {Should contain the number of procedure directives we support.}
-  num_proc_directives=54;
+  num_proc_directives=55;
   proc_direcdata:array[1..num_proc_directives] of proc_dir_rec=
    (
     (
@@ -2983,6 +2983,15 @@ const
       mutexclpocall : [];
       mutexclpotype : [potype_constructor,potype_destructor,potype_class_constructor,potype_class_destructor];
       mutexclpo     : [po_interrupt]
+    ),(
+      idtok:_WASMFUNCREF;
+      pd_flags : [pd_procvar];
+      handler  : nil;
+      pocall   : pocall_none;
+      pooption : [po_wasm_funcref];
+      mutexclpocall : [];
+      mutexclpotype : [potype_constructor,potype_destructor,potype_class_constructor,potype_class_destructor];
+      mutexclpo     : [po_interrupt]
     )
    );
 

+ 9 - 2
compiler/symconst.pas

@@ -446,7 +446,13 @@ type
     { implicitly return same type as the class instance to which the message is sent }
     po_objc_related_result_type,
     { Delphi-style anonymous function }
-    po_anonymous
+    po_anonymous,
+    { WebAssembly funcref reference type (an opaque reference to a function, that
+      is managed by the host. It doesn't have an in-memory representation, which
+      means it cannot be stored in linear memory or have its address taken. It can
+      however be stored in WebAssembly globals, locals, used in function parameters
+      and returns and it can be called.) }
+    po_wasm_funcref
   );
   tprocoptions=set of tprocoption;
 
@@ -1113,7 +1119,8 @@ inherited_objectoptions : tobjectoptions = [oo_has_virtual,oo_has_private,oo_has
       'po_noinline',{po_noinline}
       'C-style array-of-const', {po_variadic}
       'objc-related-result-type', {po_objc_related_result_type}
-      'po_anonymous' {po_anonymous}
+      'po_anonymous', {po_anonymous}
+      '"WASMFUNCREF"' {po_wasm_funcref}
     );
 
 implementation

+ 2 - 0
compiler/tokens.pas

@@ -297,6 +297,7 @@ type
     _INTERNCONST,
     _REINTRODUCE,
     _SHORTSTRING,
+    _WASMFUNCREF,
     _COMPILERPROC,
     _EXPERIMENTAL,
     _FINALIZATION,
@@ -639,6 +640,7 @@ const
       (str:'INTERNCONST'   ;special:false;keyword:[m_none];op:NOTOKEN),
       (str:'REINTRODUCE'   ;special:false;keyword:[m_none];op:NOTOKEN),
       (str:'SHORTSTRING'   ;special:false;keyword:[m_none];op:NOTOKEN),
+      (str:'WASMFUNCREF'   ;special:false;keyword:[m_none];op:NOTOKEN),
       (str:'COMPILERPROC'  ;special:false;keyword:[m_none];op:NOTOKEN),
       (str:'EXPERIMENTAL'  ;special:false;keyword:[m_none];op:NOTOKEN),
       (str:'FINALIZATION'  ;special:false;keyword:[m_initfinal];op:NOTOKEN),