Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #30914

Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target?

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target?
Date 2014-05-28 11:00 -0700
Organization Nightsong/Fort GNOX
Message-ID <7xoayheqcb.fsf@ruckus.brouhaha.com> (permalink)
References (6 earlier) <85y4xmoydw.fsf@junk.nocrew.org> <7x38ftkh9f.fsf@ruckus.brouhaha.com> <85sintq1tx.fsf@junk.nocrew.org> <7xd2exesgq.fsf@ruckus.brouhaha.com> <85oayhq04t.fsf@junk.nocrew.org>

Show all headers | View raw


Lars Brinkhoff <lars.spam@nocrew.org> writes:
> PICK can be simulated in software on a stack machine.  Thus no breakage.

If you're going to simulate PICK in software, I have to question why
you're using the stack machine in the first place.  Perhaps the OP could
explain more specifically what he's trying to do and which stack-based
CPU's he's interested in.

Philip Koopman in "Stack computers, the new wave" advises using a
software stack instead of PICK for C locals:

  ... the best choice for a stack machine is to maintain the
  conventional language stack frames in program memory, with a Frame
  Pointer register available as a hardware pointer for stack frame
  accesses. If chip space is plentiful, a stack machine might provide
  on-chip RAM as part of the program memory space to speed up access to
  the stack frames. ...

  Normally, one would think that keeping local variables on the hardware
  data stack would be faster than placing them in memory. The reason
  this is not so is because stack machines are relatively inefficient at
  accessing deeply buried elements, especially if they may have been
  spilled out of the stack buffer and into program memory. Much of the
  time in the all-on-hardware-stack approach is spent thrashing elements
  about on the stack. While access to memory-resident frame elements is
  somewhat slower than access to data on the hardware stack, in the end
  the savings on stack manipulations make up the difference.[1]
  
Another issue he points out is that a C compiler has to support taking
the addresses of local variables.

[1] http://users.ece.cmu.edu/~koopman/stack_computers/sec9_1.html

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? nachtmann@gmail.com - 2014-05-26 14:44 -0700
  Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? Paul Rubin <no.email@nospam.invalid> - 2014-05-26 14:51 -0700
    Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? nachtmann@gmail.com - 2014-05-27 11:25 -0700
      Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? Paul Rubin <no.email@nospam.invalid> - 2014-05-27 18:43 -0700
        Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? Mark Wills <markwills1970@gmail.com> - 2014-05-28 01:41 -0700
          Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? Paul Rubin <no.email@nospam.invalid> - 2014-05-28 01:56 -0700
            Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? Lars Brinkhoff <lars.spam@nocrew.org> - 2014-05-28 14:56 +0200
              Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? Paul Rubin <no.email@nospam.invalid> - 2014-05-28 09:19 -0700
                Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? Lars Brinkhoff <lars.spam@nocrew.org> - 2014-05-28 18:56 +0200
                Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? Paul Rubin <no.email@nospam.invalid> - 2014-05-28 10:14 -0700
                Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? Lars Brinkhoff <lars.spam@nocrew.org> - 2014-05-28 19:33 +0200
                Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? Paul Rubin <no.email@nospam.invalid> - 2014-05-28 11:00 -0700
                Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-05-29 12:45 +0000
                Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? Paul Rubin <no.email@nospam.invalid> - 2014-05-29 12:02 -0700
                Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? nachtmann@gmail.com - 2014-05-29 18:50 -0700
  Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? stephenXXX@mpeforth.com (Stephen Pelc) - 2014-05-28 09:55 +0000
  Re: If Emscripten can translate C/C++ via LLVM into JavaScript, could it be possible to use Forth as a compiler target? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-05-31 15:06 +0000

csiph-web