From: anton@mips.complang.tuwien.ac.at   
      
   albert@spenarnc.xs4all.nl writes:   
   >In article <2025Nov22.094635@mips.complang.tuwien.ac.at>,   
   >Anton Ertl wrote:   
   >   
   >>I have not tried to disable the output in Rust, because I expect that   
   >>the compiler would then eliminate parts of the rest (Forth compilers   
   >>are not that sophisticated yet, at least not for stuff like "<# #s #>"   
   >>if the result is eventually 2DROPped),   
   >   
   >It is hard to see that <# #S #> could be optimised away because of side   
   >effects in the PAD area in normal implementations.   
      
   Yes, if you don't know that the program terminates without accessing   
   the hold area, you would have perform at least the last <# #S #>. The   
   earlier ones can be eliminated in this program where the last one is   
   guaranteed to be at least as long as the preceeding ones, but that   
   kind of reasoning would be pretty extreme for a compiler optimizer.   
      
   If MAIN ends with BYE, however, the compiler can clearly see that the   
   hold area is never used, so <# #S #> could be optimized into 2DROP. I   
   don't think it makes much sense to teach that to Forth compilers, but   
   for the Rust compiler, I would not be surprised.   
      
   - anton   
   --   
   M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html   
   comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html   
    New standard: https://forth-standard.org/   
   EuroForth 2025 CFP: http://www.euroforth.org/ef25/cfp.html   
   EuroForth 2025 registration: https://euro.theforth.net/   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|