Explorar o código

[PATCH 48/83] updating getting of an address for symbols

From 9c484ef5a3c0f277b80c27b067aa9b963c2c8b5d Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Thu, 19 Sep 2019 23:35:56 -0400

git-svn-id: branches/wasm@45925 -
nickysn %!s(int64=5) %!d(string=hai) anos
pai
achega
8ad77296b2
Modificáronse 1 ficheiros con 9 adicións e 1 borrados
  1. 9 1
      compiler/wasm/hlcgcpu.pas

+ 9 - 1
compiler/wasm/hlcgcpu.pas

@@ -1134,7 +1134,15 @@ implementation
         return that pointer) }
         return that pointer) }
       if not wasmimplicitpointertype(fromsize) then
       if not wasmimplicitpointertype(fromsize) then
         internalerror(2010120534);
         internalerror(2010120534);
-      a_load_ref_reg(list,ptruinttype,ptruinttype,ref,r);
+
+      if assigned(ref.symbol) then begin
+        // pushing address on stack
+        list.Concat(taicpu.op_ref(a_get_global, ref));
+        incstack(list, 1);
+        // reading back to the register
+        a_load_stack_reg(list, tosize, r);
+      end else
+        a_load_ref_reg(list,ptruinttype,ptruinttype,ref,r);
     end;
     end;
 
 
   procedure thlcgwasm.a_op_const_reg(list: TAsmList; Op: TOpCG; size: tdef; a: tcgint; reg: TRegister);
   procedure thlcgwasm.a_op_const_reg(list: TAsmList; Op: TOpCG; size: tdef; a: tcgint; reg: TRegister);