The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Steffen Nurpmeso <steffen@sdaoden.eu>
To: Jon Steinhart <jon@fourwinds.com>
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] A Reiser tour de force
Date: Fri, 01 Apr 2022 21:41:59 +0200	[thread overview]
Message-ID: <20220401194159.HF6gb%steffen@sdaoden.eu> (raw)
In-Reply-To: <202204011726.231HQFm03349496@darkstar.fourwinds.com>

Jon Steinhart wrote in
 <202204011726.231HQFm03349496@darkstar.fourwinds.com>:
 |David Barto writes:
 |>> On Apr 1, 2022, at 8:59 AM, Douglas McIlroy <douglas.mcilroy@dartmouth.e\
 |>> du> wrote:
 |>> The recent discussion about Research choosing BSD's paging over
 |>> Reiser-London's brought to mind a stunning program by Reiser that
 |>> Research did adopt.
 |>> 
 |>> A critical primitive in the Blit terminal was bitblt (block transfer
 |>> of a rectangular area). It was used ubiquitously, for example to
 ...
 |>> Bitblt got refined (i.e. elaborated) several times before Reiser did
 |>> away with it entirely. Instead he wrote a just-in-time generator of
 |>> optimal code. Thousands of distinct variants, which varied in size
 |>> from 16 to 72 bytes, could be produced by the same 400 lines of
 |>> assembler code.
 ...
 |> Does this exist for the rest of us to study?
 ...
 |It's not insanely complicated by modern standards.  Without any knowledge
 |of other work, I did the same thing for a 68020 based graphics system where
 |the JIT code went into the I-cache and was amazingly fast for its day.
 |
 |If I remember correctly, things started with an outer-loop test to see
 |if there were overlapping regions to determine whether to go forward
 |to backwards to avoid having the destination trash the source.
 ...

Only to add that "modern standard" C libraries define
"overlapping" by means of exclusivity, meaning that memcpy(x,
&x[1], 1) is an invalid overlapping that requires memmove() to be
used.

 |#?132(0.02 1/76)|alp-2022:tmp$ cat t.c
 |#include <string.h>
 |void doit(char *cp);
 |int main(void){
 |  char buf[3] = {'1', '2', '\0'};
 |  doit(buf);
 |  return buf[0];
 |}
 |void doit(char *cp){
 |  memcpy(cp, &cp[1], 2);
 |}
 |#?0(0.02 1/76)|alp-2022:tmp$ gcc -D_FORTIFY_SOURCE=2 -O -o zt t.c
 |#?0(0.02 1/76)|alp-2022:tmp$ ./zt
 |Illegal instruction
 |#?132(0.02 1/76)|alp-2022:tmp$ gcc --version
 |gcc (Alpine 11.2.1_git20220219) 11.2.1 20220219
 |Copyright (C) 2021 Free Software Foundation, Inc.
 |This is free software; see the source for copying conditions.  There is NO
 |warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 |
 |#?0(0.02 1/76)|alp-2022:tmp$

Your mileage will vary though.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

  reply	other threads:[~2022-04-01 19:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 15:59 Douglas McIlroy
2022-04-01 17:15 ` David Barto
2022-04-01 17:26   ` Jon Steinhart
2022-04-01 19:41     ` Steffen Nurpmeso [this message]
2022-04-01 21:29       ` Rob Pike
2022-04-01 21:31         ` Rob Pike
2022-04-01 21:43       ` Jon Steinhart
2022-04-03 11:22 Paul Ruizendaal via TUHS
2022-04-03 12:24 ` Rob Pike

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220401194159.HF6gb%steffen@sdaoden.eu \
    --to=steffen@sdaoden.eu \
    --cc=jon@fourwinds.com \
    --cc=tuhs@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).