Ver Fonte

* index the llvm shadow symtable with a fieldvarsym rather than with the
index of the corresponding llvm fieldvar, as this index is a member
of the fieldvarsym that only gets initialised once the llvm shadow
symtable gets built, which in turn is triggered by trying to access
it for the first time -> if fieldvarsym.llvmfieldnr got loaded by
the compiler before evaluating the llvmst expression and if the
llvmst hadn't been built yet, this llvmfieldnr was not yet initialized

git-svn-id: trunk@31060 -

Jonas Maebe há 10 anos atrás
pai
commit
89c4bd8522
3 ficheiros alterados com 6 adições e 6 exclusões
  1. 1 1
      compiler/llvm/nllvmmem.pas
  2. 1 1
      compiler/llvm/nllvmtcon.pas
  3. 4 4
      compiler/symtable.pas

+ 1 - 1
compiler/llvm/nllvmmem.pas

@@ -114,7 +114,7 @@ implementation
               end;
             { get the type of the corresponding field in the llvm shadow
               definition }
-            llvmfielddef:=tabstractrecordsymtable(tabstractrecorddef(currentstructdef).symtable).llvmst[vs.llvmfieldnr].def;
+            llvmfielddef:=tabstractrecordsymtable(tabstractrecorddef(currentstructdef).symtable).llvmst[vs].def;
             if implicitpointer then
               subscriptdef:=currentstructdef
             else

+ 1 - 1
compiler/llvm/nllvmtcon.pas

@@ -393,7 +393,7 @@ implementation
     begin
       { update range checking info }
       inherited;
-      llvmfielddef:=tabstractrecordsymtable(def.symtable).llvmst[vs.llvmfieldnr].def;
+      llvmfielddef:=tabstractrecordsymtable(def.symtable).llvmst[vs].def;
       { get the address of the llvm-struct field that corresponds to this
         Pascal field }
       getllvmfieldaddr:=taillvm.getelementptr_reg_tai_size_const(NR_NO,nil,s32inttype,vs.llvmfieldnr,true);

+ 4 - 4
compiler/symtable.pas

@@ -154,7 +154,7 @@ interface
          equivst: tabstractrecordsymtable;
          curroffset: aint;
          recordalignmin: shortint;
-         function get(index: longint): tllvmshadowsymtableentry;
+         function get(f: tfieldvarsym): tllvmshadowsymtableentry;
         public
          symdeflist: TFPObjectList;
 
@@ -169,7 +169,7 @@ interface
          procedure addalignmentpadding(finalsize: aint);
          procedure buildmapping(variantstarts: tfplist);
          procedure buildtable(variantstarts: tfplist);
-         property items[index: longint]: tllvmshadowsymtableentry read get; default;
+         property items[index: tfieldvarsym]: tllvmshadowsymtableentry read get; default;
        end;
 {$endif llvm}
 
@@ -1686,9 +1686,9 @@ implementation
                               TLlvmShadowSymtable
 ****************************************************************************}
 
-   function tllvmshadowsymtable.get(index: longint): tllvmshadowsymtableentry;
+   function tllvmshadowsymtable.get(f: tfieldvarsym): tllvmshadowsymtableentry;
       begin
-        result:=tllvmshadowsymtableentry(symdeflist[index])
+        result:=tllvmshadowsymtableentry(symdeflist[f.llvmfieldnr])
       end;