muta...@gmail.com wrote:   
   > Something I noticed on the mainframe is that   
   > the transition from 32 bit to 64 bit simply   
   > involved changing instructions like st (store)   
   > to stg (store grand).   
   >   
   > You may as well have an assembler   
   > option to do that automatically.   
   >   
   > So you can just code st and tell the   
   > assembler whether you want 32 bit integers   
   > or 64 bit integers or 1024 bit integers.   
   >   
   > You could probably do the same thing   
   > with 16 bit integers except you run   
   > out of memory if you want to   
   > do much of anything so segmentation   
   > needs to be added to the mix.   
   >   
   > So you may only need one compiler,   
   > assembler and linker and os and c   
   > library, all doing s370 and you have a   
   > completely portable suite for   
   > eternity.   
      
   I am not sure what you want to do. If you want   
   your 32-bit code to run on 64-bit machine but   
   still be 32-bit, then on most 64-bit machines that   
   is reasonably easy. OTOH if you want to have   
   64-bit addresses, and use 64-bit data then things   
   are a bit more complicated. First, size of your   
   data increases. I you simply double size of everything,   
   then you need to multiply all addresses and offsets   
   by 2. You can not do this at assembler level, because   
   assembler does not know which number is an address   
   and which is simply data, so that must be done in   
   compiler.   
      
   In real life adjustment of size will be more complicated,   
   some types keep their size, some double. This is not   
   a problem for a compiler, but must be implemented.   
      
   Concerning 370: since data may be bigger also offsets   
   may be bigger. It may happen that offset which in   
   32-bit mode fits ino 12 bits will grow so that it no   
   longer fits int 12-bits. That will force you to do   
   some workarounds. Easiest one is to use newer   
   instructions with bigger offsets (this could be done   
   by assembler). But whatever you decide compiler must   
   know which offsets can be done by single instruction   
   and which need extra code to work around machine   
   limitation.   
      
   All this logic could be put in single compiler, you   
   just need a few parameters describing modes of your   
   machine. And something like command line argument   
   telling compiler what it should do: 32-bit mode or   
   64-bit mode. As long as you do not care about quality   
   of generated code this could be done in very simple   
   compiler. But one which is better organised than   
   SubC. In fact, rather simple compiler could generate   
   code for multiple machine architectures: original lcc   
   did this.   
      
   --   
    Waldek Hebisch   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|