Browse Source

+ added is_really_const booleanfield for typedconstsym
for Delphi in $J- mode (not yet implemented !)

pierre 26 years ago
parent
commit
03b80377e0
2 changed files with 34 additions and 11 deletions
  1. 27 9
      compiler/symsym.inc
  2. 7 2
      compiler/symsymh.inc

+ 27 - 9
compiler/symsym.inc

@@ -1347,12 +1347,13 @@
                              TTYPEDCONSTSYM
                              TTYPEDCONSTSYM
 *****************************************************************************}
 *****************************************************************************}
 
 
-    constructor ttypedconstsym.init(const n : string;p : pdef);
+    constructor ttypedconstsym.init(const n : string;p : pdef;really_const : boolean);
 
 
       begin
       begin
          tsym.init(n);
          tsym.init(n);
          typ:=typedconstsym;
          typ:=typedconstsym;
          definition:=p;
          definition:=p;
+         is_really_const:=really_const;
          prefix:=stringdup(procprefix);
          prefix:=stringdup(procprefix);
       end;
       end;
 
 
@@ -1362,6 +1363,11 @@
          tsym.load;
          tsym.load;
          typ:=typedconstsym;
          typ:=typedconstsym;
          definition:=readdefref;
          definition:=readdefref;
+{$ifdef DELPHI_CONST_IN_RODATA}
+         is_really_const:=boolean(readbyte);
+{$else DELPHI_CONST_IN_RODATA}
+         is_really_const:=false;
+{$endif DELPHI_CONST_IN_RODATA}
          prefix:=stringdup(readstring);
          prefix:=stringdup(readstring);
       end;
       end;
 
 
@@ -1400,6 +1406,9 @@
          tsym.write;
          tsym.write;
          writedefref(definition);
          writedefref(definition);
          writestring(prefix^);
          writestring(prefix^);
+{$ifdef DELPHI_CONST_IN_RODATA}
+         writebyte(byte(is_really_const));
+{$endif DELPHI_CONST_IN_RODATA}
          current_ppu^.writeentry(ibtypedconstsym);
          current_ppu^.writeentry(ibtypedconstsym);
       end;
       end;
 
 
@@ -1416,30 +1425,35 @@
         end;
         end;
 
 
       procedure ttypedconstsym.really_insert_in_data;
       procedure ttypedconstsym.really_insert_in_data;
+        var curconstsegment : paasmoutput;
         begin
         begin
+           if is_really_const then
+             curconstsegment:=consts
+           else
+             curconstsegment:=datasegment;
            if owner^.symtabletype=globalsymtable then
            if owner^.symtabletype=globalsymtable then
              begin
              begin
                 if (cs_smartlink in aktmoduleswitches) then
                 if (cs_smartlink in aktmoduleswitches) then
-                  datasegment^.concat(new(pai_cut,init));
+                  curconstsegment^.concat(new(pai_cut,init));
 {$ifdef GDB}
 {$ifdef GDB}
                 if cs_debuginfo in aktmoduleswitches then
                 if cs_debuginfo in aktmoduleswitches then
-                  concatstabto(datasegment);
+                  concatstabto(curconstsegment);
 {$endif GDB}
 {$endif GDB}
-                datasegment^.concat(new(pai_symbol,init_global(mangledname)));
+                curconstsegment^.concat(new(pai_symbol,init_global(mangledname)));
              end
              end
            else
            else
              if owner^.symtabletype<>unitsymtable then
              if owner^.symtabletype<>unitsymtable then
                begin
                begin
                  if (cs_smartlink in aktmoduleswitches) then
                  if (cs_smartlink in aktmoduleswitches) then
-                   datasegment^.concat(new(pai_cut,init));
+                   curconstsegment^.concat(new(pai_cut,init));
 {$ifdef GDB}
 {$ifdef GDB}
                  if cs_debuginfo in aktmoduleswitches then
                  if cs_debuginfo in aktmoduleswitches then
-                   concatstabto(datasegment);
+                   concatstabto(curconstsegment);
 {$endif GDB}
 {$endif GDB}
                  if (cs_smartlink in aktmoduleswitches) then
                  if (cs_smartlink in aktmoduleswitches) then
-                   datasegment^.concat(new(pai_symbol,init_global(mangledname)))
+                   curconstsegment^.concat(new(pai_symbol,init_global(mangledname)))
                  else
                  else
-                   datasegment^.concat(new(pai_symbol,init(mangledname)));
+                   curconstsegment^.concat(new(pai_symbol,init(mangledname)));
                end;
                end;
            end;
            end;
 
 
@@ -1943,7 +1957,11 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.80  1999-04-21 09:43:54  peter
+  Revision 1.81  1999-04-25 22:38:39  pierre
+    + added is_really_const booleanfield for typedconstsym
+      for Delphi in $J- mode (not yet implemented !)
+
+  Revision 1.80  1999/04/21 09:43:54  peter
     * storenumber works
     * storenumber works
     * fixed some typos in double_checksum
     * fixed some typos in double_checksum
     + incompatible types type1 and type2 message (with storenumber)
     + incompatible types type1 and type2 message (with storenumber)

+ 7 - 2
compiler/symsymh.inc

@@ -275,7 +275,8 @@
        ttypedconstsym = object(tsym)
        ttypedconstsym = object(tsym)
           prefix : pstring;
           prefix : pstring;
           definition : pdef;
           definition : pdef;
-          constructor init(const n : string;p : pdef);
+          is_really_const : boolean;
+          constructor init(const n : string;p : pdef;really_const : boolean);
           constructor load;
           constructor load;
           destructor done;virtual;
           destructor done;virtual;
           function  mangledname : string;virtual;
           function  mangledname : string;virtual;
@@ -345,7 +346,11 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.20  1999-04-21 09:43:56  peter
+  Revision 1.21  1999-04-25 22:38:40  pierre
+    + added is_really_const booleanfield for typedconstsym
+      for Delphi in $J- mode (not yet implemented !)
+
+  Revision 1.20  1999/04/21 09:43:56  peter
     * storenumber works
     * storenumber works
     * fixed some typos in double_checksum
     * fixed some typos in double_checksum
     + incompatible types type1 and type2 message (with storenumber)
     + incompatible types type1 and type2 message (with storenumber)