home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 117,011 of 117,927   
   Anton Ertl to albert@spenarnc.xs4all.nl   
   xts and return addresses (was: "Back & F   
   09 Jan 25 17:43:05   
   
   From: anton@mips.complang.tuwien.ac.at   
      
   albert@spenarnc.xs4all.nl writes:   
   >>R EXECUTE doesn't work for ciforth.   
   >There is no guarantee that a saved interpreter pointer on the   
   >stack is an execution token.   
      
   In development Gforth, if you use the xt of a colon definition as a   
   return address, you get the same effect as EXECUTE.  E.g.   
      
   : colon-execute >r ;   
      
   1 ' . colon-execute \ prints "1"   
      
   I have recently had a puzzling bug syndrome in the following word   
   (buggy version shown):   
      
   : reverse-sections-execute ( xt -- )   
       >r sections $@ cell mem-do   
           j i @ section-execute   
       loop ;   
      
   [: current-section @ cr h. ;] reverse-sections-execute   
      
   The output is:   
      
   $7FF5F428F000   
   $7FF5F3F1A000   
   $7FF5F3F3B000   
   $7FF5E5BFD000   
   $7FF5E5DFE040   
   $7FF5F4298000   
   $7FF5E5DFE040  ok   
      
   The last line should not be output.  What happens is that the xt   
   passed to REVERSE-SECTIONS-EXECUTE is pushed on the return stack, and   
   I then forgot to drop it.  But instead of that resulting in a crash   
   (as you would get in Gforth up to around 2020), with the new xt   
   implementation the ; at the end COLON-EXECUTEs the xt.  And because   
   the xt is a colon definition, this calls the xt again.   
      
   xt=pfa has it's advantages, but here a disadvantage showed up.   
      
   - 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 2023 proceedings: http://www.euroforth.org/ef23/papers/   
   EuroForth 2024 proceedings: http://www.euroforth.org/ef24/papers/   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca