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


Groups > comp.lang.forth > #8527

Re: Stack optimizer

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: Stack optimizer
References <4eff0ee1$0$6951$e4fe514c@news2.news.xs4all.nl>
Date 2011-12-31 15:41 -0800
Message-ID <7xty4ge2cm.fsf@ruckus.brouhaha.com> (permalink)
Organization Nightsong/Fort GNOX

Show all headers | View raw


Hans Bezemer <thebeez@xs4all.nl> writes:
> Too little code is published here, so here is a port of the 4tH stack
> optimizer. Confirmed to work with gForth. Should be a breeze to port to
> others.
>
> Typical use:
>   s" abc" s" abcabc" stackopt

That is pretty cool.  I was just yesterday playing with the idea of
writing something like it for optimizing GA144 code.  The GA144 has many
weird artifacts like "+ DROP" being better than "DROP DROP" for removing
the top 2 stack elements, since + fits in the 3-bit 4th slot of an
instruction word while DROP does not.  The savings can be quite
consequential (not just 1 insn slot) since it might let you get an extra
subroutine into the first 8 memory slots which can in turn save you a
whole word if you call the function from slot 3.  After trying to write
some code by hand and constantly running into stuff like this, I started
to think an automatic optimizer would be a big help.

There is a literature on "superoptimization", i.e. finding optimal code
sequences using either brute force or goal directed search with SAT
solvers.  I started looking at it and it is interesting.

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


Thread

Stack optimizer Hans Bezemer <thebeez@xs4all.nl> - 2011-12-31 14:33 +0100
  Re: Stack optimizer Hans Bezemer <thebeez@xs4all.nl> - 2011-12-31 20:03 +0100
  Re: Stack optimizer Paul Rubin <no.email@nospam.invalid> - 2011-12-31 15:41 -0800
    Re: Stack optimizer Hans Bezemer <thebeez@xs4all.nl> - 2012-01-01 00:58 +0100
    Re: Stack optimizer "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2011-12-31 20:09 -0500
  Re: Stack optimizer Josh Grams <josh@qualdan.com> - 2011-12-31 23:50 +0000
  Re: Stack optimizer Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-12-31 16:34 -0800
    Re: Stack optimizer Paul Rubin <no.email@nospam.invalid> - 2011-12-31 17:03 -0800
      Re: Stack optimizer Krishna Myneni <krishna.myneni@ccreweb.org> - 2011-12-31 20:18 -0800
        Re: Stack optimizer Doug Hoffman <glidedog@gmail.com> - 2012-01-01 03:41 -0500
          Re: Stack optimizer Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-01-01 03:49 -0800
            Re: Stack optimizer Doug Hoffman <glidedog@gmail.com> - 2012-01-01 10:08 -0500
        Re: Stack optimizer Alex McDonald <blog@rivadpm.com> - 2012-01-04 06:36 -0800
          Re: Stack optimizer Krishna Myneni <krishna.myneni@ccreweb.org> - 2012-01-04 20:06 -0800
            Re: Stack optimizer Alex McDonald <blog@rivadpm.com> - 2012-01-05 03:44 -0800
              Re: Stack optimizer anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-01-05 16:34 +0000
              Re: Stack optimizer Alex McDonald <blog@rivadpm.com> - 2012-01-09 06:00 -0800
          Re: Stack optimizer "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-01-05 06:48 -0500
            Re: Stack optimizer Alex McDonald <blog@rivadpm.com> - 2012-01-05 05:06 -0800
              Re: Stack optimizer Alex McDonald <blog@rivadpm.com> - 2012-01-05 05:08 -0800
                Re: Stack optimizer Alex McDonald <blog@rivadpm.com> - 2012-01-05 11:38 -0800
              Re: Stack optimizer "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-01-05 19:05 -0500
                Re: Stack optimizer Alex McDonald <blog@rivadpm.com> - 2012-01-06 03:39 -0800
              Re: Stack optimizer "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-01-06 21:41 -0500
                Re: Stack optimizer Alex McDonald <blog@rivadpm.com> - 2012-01-07 12:47 -0800
  Re: Stack optimizer "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-01-02 02:16 -0500
    Re: Stack optimizer "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-01-02 16:08 -0500
      Re: Stack optimizer Alex McDonald <blog@rivadpm.com> - 2012-01-03 14:13 -0800

csiph-web