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 116,255 of 117,927   
   Anton Ertl to Krishna Myneni   
   Re: push for memory safe languages -- im   
   03 Mar 24 15:51:07   
   
   From: anton@mips.complang.tuwien.ac.at   
      
   Krishna Myneni  writes:   
   >The intent of the stack array access was to avoid stack pointer   
   >arithmetic altogether. Stack array access words provide a safe alternate   
   >to doing stack pointer arithmetic in Forth code. Pointer arithmetic   
   >appears to be the source of a lot of memory safety problems.   
      
   At the machine level and the standard Forth level, every array access   
   performs address arithmetics.  Given that standard Forth does not   
   expose the implementation of the stacks, there is no need to use some   
   specific implementation for them.  One may wonder, though, if using 4   
   stacks with guard pages around them (i.e., at least 9 pages per task,   
   set up with 6 system calls) is too expensive for multi-tasking; I   
   think Gforth currently only does it for the main task.   
      
   There are architectures (in particular, the 80286) that provide   
   hardware support for treating stretches of memory as segments with   
   bounds checking, and the idea probably was that every array becomes a   
   segment (not sure about structures; the 80286 supports only 8192   
   segments, which seems a little low if every struture needs a segment),   
   but anyway, using segments was too cumbersome, slow and limited, so   
   they have been let slide by the wayside in the descendents of the   
   architecture (IA-32, AMD64).   
      
   In any case, yes, in Safe Forth there are no addresses at the language   
   level.  You have objects with value-flavoured fields, and arrays with   
   indexed-fetch and indexed-store words.  But in the implementation of   
   Safe Forth, there will certainly be address arithmetics.   
      
   - 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: https://euro.theforth.net/2023   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

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


(c) 1994,  bbs@darkrealms.ca