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,552 of 117,927   
   Anton Ertl to Krishna Myneni   
   Re: Proposal: Special memory access word   
   15 Jun 24 07:19:52   
   
   From: anton@mips.complang.tuwien.ac.at   
      
   Krishna Myneni  writes:   
   >In particular, I don't like the necessity of two separate steps to fetch   
   >a sign-extended word, preferring instead two separate words, one for   
   >unsigned fetch and one for sign extended fetch.   
      
   That used to be my position, too, but if we add the need to deal with   
   different byte orders, this results in   
      
   sw@ uw@ be-sw@ be-uw@ le-sw@ le-uw@   
      
   and when you have the precomposed words for fetching, you also want   
   them for storing:   
      
   w! be-w! le-w!   
      
   And another 9 words for l, and another 9 words for x.  And if you also   
   add stuff like w, etc., precomposing leads to even more words.   
      
   That is the memory access proposal from Federico de Ceballos, but the   
   committe (in particular, Leon Wagner) has experimented with it and   
   found that the number of words is too high.   
      
   One idea have is to provide a library that defines the precomposed   
   words in terms of the decomposed ones.   
      
   >These words are indispensable for writing portable code between 32-bit   
   >and 64-bit systems.   
      
   I have good experiences with Forth's cell, char, float model for   
   portability and bad experiences with the portability of C code, thanks   
   to its large number of integer types: you can produce portable C code,   
   but unless you test it on both 32-bit and 64-bit systems, I would not   
   bet on its portability, while debugged Forth code often is also   
   portable.   
      
   I discovered one exception recently: brainless produced different   
   results on 32-bit systems and 64-bit systems.  I found that the reason   
   was that it used double-cells on 32-bit systems and single-cells on   
   64-bit systems, and it sometimes accesses only one cell.  If it had   
   always accessed double-cells with 2@ and 2!, it would have worked fine   
   (and that's my fix).   
      
   >I do not have X@ or X! which are simply @ and ! on a 64-bit system.   
      
   @ and ! require aligned addresses, X@ and X! don't.  Also X@ and X!   
   will continue to access 64-bit values even on systems where cells are   
   larger than 64 bits (if it ever comes to that).   
      
   - 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