From f08a7114ae66b02546c66ae0261cd8ea378cef0e Mon Sep 17 00:00:00 2001 From: pierre Date: Tue, 2 Jun 1998 17:02:59 +0000 Subject: [PATCH] * with node corrected for objects * small bugs for SUPPORT_MMX fixed --- compiler/cg386mat.pas | 8 ++++-- compiler/cgi386.pas | 30 ++++++++++++++--------- compiler/pass_1.pas | 57 ++++++++++++++++++++++++++++++++++++------- compiler/pexpr.pas | 15 ++++++++++-- compiler/pstatmnt.pas | 48 +++++++++++++++++++++++++++++++++++- 5 files changed, 132 insertions(+), 26 deletions(-) diff --git a/compiler/cg386mat.pas b/compiler/cg386mat.pas index e1ac6c89d7..0da5edda2a 100644 --- a/compiler/cg386mat.pas +++ b/compiler/cg386mat.pas @@ -34,7 +34,7 @@ implementation uses cobjects,verbose,globals, symtable,aasm,i386, - cgi386,cgai386,tgeni386,hcodegen; + types,cgi386,cgai386,tgeni386,hcodegen; procedure secondmoddiv(var p : ptree); @@ -385,7 +385,11 @@ implementation end. { $Log$ - Revision 1.1 1998-06-01 16:50:18 peter + Revision 1.2 1998-06-02 17:02:59 pierre + * with node corrected for objects + * small bugs for SUPPORT_MMX fixed + + Revision 1.1 1998/06/01 16:50:18 peter + boolean -> ord conversion * fixed ord -> boolean conversion diff --git a/compiler/cgi386.pas b/compiler/cgi386.pas index b4c1e53ac3..b74f9208a2 100644 --- a/compiler/cgi386.pas +++ b/compiler/cgi386.pas @@ -1534,17 +1534,18 @@ implementation inc(pushedparasize,8); { was missing !!! (PM) } exprasmlist^.concat(new(pai386,op_const_reg( A_SUB,S_L,8,R_ESP))); - if inlined then - begin - r:=new_reference(procinfo.framepointer,para_offset-pushedparasize); - exprasmlist^.concat(new(pai386,op_reg_ref(A_MOVQ,S_NO, - p^.left^.location.register,r))); - end - else - begin - r:=new_reference(R_ESP,0); - exprasmlist^.concat(new(pai386,op_reg_ref( - A_MOVQ,S_NO,p^.left^.location.register,r))); + if inlined then + begin + r:=new_reference(procinfo.framepointer,para_offset-pushedparasize); + exprasmlist^.concat(new(pai386,op_reg_ref(A_MOVQ,S_NO, + p^.left^.location.register,r))); + end + else + begin + r:=new_reference(R_ESP,0); + exprasmlist^.concat(new(pai386,op_reg_ref( + A_MOVQ,S_NO,p^.left^.location.register,r))); + end; end; {$endif SUPPORT_MMX} end; @@ -4716,6 +4717,7 @@ do_jmp: inlineexitcode:=new(paasmoutput,init); proc_names.init; para_size:=p^.para_size; + make_global:=false; { to avoid warning } genentrycode(inlineentrycode,proc_names,make_global, 0,para_size,nostackframe,true); exprasmlist^.concatlist(inlineentrycode); @@ -5057,7 +5059,11 @@ do_jmp: end. { $Log$ - Revision 1.29 1998-06-01 16:50:18 peter + Revision 1.30 1998-06-02 17:03:00 pierre + * with node corrected for objects + * small bugs for SUPPORT_MMX fixed + + Revision 1.29 1998/06/01 16:50:18 peter + boolean -> ord conversion * fixed ord -> boolean conversion diff --git a/compiler/pass_1.pas b/compiler/pass_1.pas index 3483e7773c..def9b65b82 100644 --- a/compiler/pass_1.pas +++ b/compiler/pass_1.pas @@ -3123,7 +3123,8 @@ unit pass_1; p^.procdefinition:=procs^.data; p^.resulttype:=procs^.data^.retdef; - p^.symtableproc:=p^.procdefinition^.owner; + { big error for with statements + p^.symtableproc:=p^.procdefinition^.owner; } p^.location.loc:=LOC_MEM; {$ifdef CHAINPROCSYMS} { object with method read; @@ -3394,6 +3395,12 @@ unit pass_1; store_valid:=must_be_valid; store_count_ref:=count_ref; count_ref:=false; + if not (p^.inlinenumber in [in_read_x,in_readln_x,in_sizeof_x, + in_typeof_x,in_ord_x,in_str_x_string, + in_reset_typedfile,in_rewrite_typedfile]) then + must_be_valid:=true + else + must_be_valid:=false; { if we handle writeln; p^.left contains no valid address } if assigned(p^.left) then begin @@ -3408,11 +3415,6 @@ unit pass_1; {$endif SUPPORT_MMX} set_location(p^.location,p^.left^.location); end; - if not (p^.inlinenumber in [in_read_x,in_readln_x,in_sizeof_x, - in_typeof_x,in_ord_x, - in_reset_typedfile,in_rewrite_typedfile]) then - must_be_valid:=true - else must_be_valid:=false; case p^.inlinenumber of in_lo_word,in_hi_word: begin @@ -3734,9 +3736,9 @@ unit pass_1; count_ref:=true; p^.left^.right:=nil; firstcallparan(p^.left,nil); - p^.left^.right:=hp; must_be_valid:=true; - firstcallparan(p^.left,nil); + p^.left^.right:=hp; + firstcallparan(p^.left^.right,nil); hp:=p^.left; isreal:=false; { valid string ? } @@ -4919,7 +4921,43 @@ unit pass_1; end. { $Log$ - Revision 1.23 1998-06-01 16:50:20 peter + Revision 1.24 1998-06-02 17:03:01 pierre + * with node corrected for objects + * small bugs for SUPPORT_MMX fixed + +<<<<<<< PASS_1.pas + Revision 1.22 1998/05/28 17:26:49 peter + * fixed -R switch, it didn't work after my previous akt/init patch + * fixed bugs 110,130,136 + + Revision 1.21 1998/05/25 17:11:41 pierre + * firstpasscount bug fixed + now all is already set correctly the first time + under EXTDEBUG try -gp to skip all other firstpasses + it works !! + * small bug fixes + - for smallsets with -dTESTSMALLSET + - some warnings removed (by correcting code !) + + Revision 1.20 1998/05/23 01:21:17 peter + + aktasmmode, aktoptprocessor, aktoutputformat + + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches + + $LIBNAME to set the library name where the unit will be put in + * splitted cgi386 a bit (codeseg to large for bp7) + * nasm, tasm works again. nasm moved to ag386nsm.pas + + Revision 1.19 1998/05/20 09:42:34 pierre + + UseTokenInfo now default + * unit in interface uses and implementation uses gives error now + * only one error for unknown symbol (uses lastsymknown boolean) + the problem came from the label code ! + + first inlined procedures and function work + (warning there might be allowed cases were the result is still wrong !!) + * UseBrower updated gives a global list of all position of all used symbols + with switch -gb + +======= + Revision 1.23 1998/06/01 16:50:20 peter + boolean -> ord conversion * fixed ord -> boolean conversion @@ -4953,6 +4991,7 @@ end. * UseBrower updated gives a global list of all position of all used symbols with switch -gb +>>>>>>> h:/cvs/compiler/PASS_1.pas Revision 1.18 1998/05/11 13:07:55 peter + $ifdef NEWPPU for the new ppuformat + $define GDB not longer required diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 059dbd7ffd..8e41fa12b3 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -1,4 +1,4 @@ -{ + { $Id$ Copyright (c) 1998 by Florian Klaempfl @@ -1071,6 +1071,13 @@ unit pexpr; p1^.resulttype:=pd; srsymtable:=pobjectdef(pd)^.publicsyms; sym:=pvarsym(srsymtable^.search(pattern)); + { search also in inherited methods } + while sym=nil do + begin + pd:=pobjectdef(pd)^.childof; + srsymtable:=pobjectdef(pd)^.publicsyms; + sym:=pvarsym(srsymtable^.search(pattern)); + end; consume(ID); do_member_read(sym,p1,pd,again); end @@ -1745,7 +1752,11 @@ unit pexpr; end. { $Log$ - Revision 1.21 1998-05-27 19:45:05 peter + Revision 1.22 1998-06-02 17:03:03 pierre + * with node corrected for objects + * small bugs for SUPPORT_MMX fixed + + Revision 1.21 1998/05/27 19:45:05 peter * symtable.pas splitted into includefiles * symtable adapted for $ifdef NEWPPU diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index a35cfd4a2f..ecae763a81 100644 --- a/compiler/pstatmnt.pas +++ b/compiler/pstatmnt.pas @@ -350,6 +350,7 @@ unit pstatmnt; case p^.resulttype^.deftype of objectdef : begin obj:=pobjectdef(p^.resulttype); + { this creates the stack in the wrong order !! levelcount:=0; while assigned(obj) do begin @@ -360,7 +361,23 @@ unit pstatmnt; symtablestack:=withsymtable; obj:=obj^.childof; inc(levelcount); + end; } + + withsymtable:=new(psymtable,init(symtable.withsymtable)); + withsymtable^.root:=obj^.publicsyms^.root; + symtab:=withsymtable; + levelcount:=1; + obj:=obj^.childof; + while assigned(obj) do + begin + symtab^.next:=new(psymtable,init(symtable.withsymtable)); + symtab:=symtab^.next; + symtab^.root:=obj^.publicsyms^.root; + obj:=obj^.childof; + inc(levelcount); end; + symtab^.next:=symtablestack; + symtablestack:=withsymtable; end; recorddef : begin symtab:=precdef(p^.resulttype)^.symtable; @@ -1121,7 +1138,35 @@ unit pstatmnt; end. { $Log$ - Revision 1.15 1998-05-30 14:31:06 peter + Revision 1.16 1998-06-02 17:03:04 pierre + * with node corrected for objects + * small bugs for SUPPORT_MMX fixed + +<<<<<<< PSTATMNT.pas + Revision 1.14 1998/05/29 09:58:14 pierre + * OPR_REGISTER for 1 arg was missing in ratti386.pas + (probably a merging problem) + * errors at start of line were lost + + Revision 1.13 1998/05/28 17:26:50 peter + * fixed -R switch, it didn't work after my previous akt/init patch + * fixed bugs 110,130,136 + + Revision 1.12 1998/05/21 19:33:33 peter + + better procedure directive handling and only one table + + Revision 1.11 1998/05/20 09:42:35 pierre + + UseTokenInfo now default + * unit in interface uses and implementation uses gives error now + * only one error for unknown symbol (uses lastsymknown boolean) + the problem came from the label code ! + + first inlined procedures and function work + (warning there might be allowed cases were the result is still wrong !!) + * UseBrower updated gives a global list of all position of all used symbols + with switch -gb + +======= + Revision 1.15 1998/05/30 14:31:06 peter + $ASMMODE Revision 1.14 1998/05/29 09:58:14 pierre @@ -1146,6 +1191,7 @@ end. * UseBrower updated gives a global list of all position of all used symbols with switch -gb +>>>>>>> h:/cvs/compiler/PSTATMNT.pas Revision 1.10 1998/05/11 13:07:56 peter + $ifdef NEWPPU for the new ppuformat + $define GDB not longer required