浏览代码

* fixed writing to global variables

git-svn-id: branches/wasm@47169 -
nickysn 4 年之前
父节点
当前提交
5128c07e68
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      compiler/wasm32/hlcgcpu.pas

+ 7 - 3
compiler/wasm32/hlcgcpu.pas

@@ -1033,9 +1033,13 @@ implementation
         exit;
 
       // setting up memory offset
-      if assigned(ref.symbol) then begin
-        //list.Concat(taicpu.op_sym(a_get_global, ref.symbol));
-      end else if ref.index <> NR_NO then // array access
+      if assigned(ref.symbol) then
+        begin
+          list.Concat(taicpu.op_const(a_i32_const,0));
+          incstack(list,1);
+          result:=1;
+        end
+      else if ref.index <> NR_NO then // array access
       begin
         // it's just faster to sum two of those together
         list.Concat(taicpu.op_reg(a_get_local, ref.base));