Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

As far as we know, our computer has never had an undetected error. -- Weisert


devel / comp.lang.forth / MOVE - when addr1 = addr2

SubjectAuthor
* MOVE - when addr1 = addr2dxforth
`* Re: MOVE - when addr1 = addr2Anton Ertl
 `- Re: MOVE - when addr1 = addr2dxforth

1
MOVE - when addr1 = addr2

<si4mef$grk$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=14707&group=comp.lang.forth#14707

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: MOVE - when addr1 = addr2
Date: Sat, 18 Sep 2021 22:35:27 +1000
Organization: Aioe.org NNTP Server
Message-ID: <si4mef$grk$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="17268"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
X-Mozilla-News-Host: news://nntp.aioe.org:119
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Sat, 18 Sep 2021 12:35 UTC

The spec for MOVE says do nothing when u=0.

But what about addr1 = addr2 ? The spec doesn't mention it so the presumption
is the copy should go ahead.

I don't recall seeing a MOVE implementation that tests addr1 = addr2, so no
past practice that I'm aware. The only situation I can think where it might
be a problem is 'ROM over RAM' i.e. where the read is from ROM but the write
is to RAM. In such case however one might opt to use CMOVE instead which is
typically dumb.

Any thoughts/experience?

Re: MOVE - when addr1 = addr2

<2021Sep18.171257@mips.complang.tuwien.ac.at>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=14708&group=comp.lang.forth#14708

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: MOVE - when addr1 = addr2
Date: Sat, 18 Sep 2021 15:12:57 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 36
Message-ID: <2021Sep18.171257@mips.complang.tuwien.ac.at>
References: <si4mef$grk$1@gioia.aioe.org>
Injection-Info: reader02.eternal-september.org; posting-host="546d30209ffe50da61a0540949b8a425";
logging-data="24784"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+5Unq64iWmWSoO0tABSKAD"
Cancel-Lock: sha1:TbkfYbMlPiJJ9Frz6iu2yhgDuSM=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sat, 18 Sep 2021 15:12 UTC

dxforth <dxforth@gmail.com> writes:
>The spec for MOVE says do nothing when u=0.
>
>But what about addr1 = addr2 ? The spec doesn't mention it so the presumption
>is the copy should go ahead.
>
>I don't recall seeing a MOVE implementation that tests addr1 = addr2, so no
>past practice that I'm aware. The only situation I can think where it might
>be a problem is 'ROM over RAM' i.e. where the read is from ROM but the write
>is to RAM. In such case however one might opt to use CMOVE instead which is
>typically dumb.
>
>Any thoughts/experience?

The specification says to copy, and what the result is. So copying is
certainly a correct way to implement it. Checking for addr1=addr2
seems to be a waste of time to me; it is unlikely to be a
frequent-enough case to merit optimizing it, and when it occurs, it
may be such a case as you describe, where the prorammer's intention is
to actually make the copy. So there's two reasons against
special-casing the addr1=addr2 case.

OTOH, if you feel the urge to special-case this case, and you know
that your MOVE is only used for memory that behaves like conventional
RAM, not doing anything satisfies the description of the result:

|After MOVE completes, the u consecutive address units at addr2 contain
|exactly what the u consecutive address units at addr1 contained before
|the move.

- 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: http://www.forth200x.org/forth200x.html
EuroForth 2021: https://euro.theforth.net/2021

Re: MOVE - when addr1 = addr2

<si6anr$gj8$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=14710&group=comp.lang.forth#14710

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: MOVE - when addr1 = addr2
Date: Sun, 19 Sep 2021 13:27:57 +1000
Organization: Aioe.org NNTP Server
Message-ID: <si6anr$gj8$1@gioia.aioe.org>
References: <si4mef$grk$1@gioia.aioe.org>
<2021Sep18.171257@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="17000"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Sun, 19 Sep 2021 03:27 UTC

On 19/09/2021 01:12, Anton Ertl wrote:
> dxforth <dxforth@gmail.com> writes:
>>The spec for MOVE says do nothing when u=0.
>>
>>But what about addr1 = addr2 ? The spec doesn't mention it so the presumption
>>is the copy should go ahead.
>>
>>I don't recall seeing a MOVE implementation that tests addr1 = addr2, so no
>>past practice that I'm aware. The only situation I can think where it might
>>be a problem is 'ROM over RAM' i.e. where the read is from ROM but the write
>>is to RAM. In such case however one might opt to use CMOVE instead which is
>>typically dumb.
>>
>>Any thoughts/experience?
>
> The specification says to copy, and what the result is. So copying is
> certainly a correct way to implement it. Checking for addr1=addr2
> seems to be a waste of time to me; it is unlikely to be a
> frequent-enough case to merit optimizing it, and when it occurs, it
> may be such a case as you describe, where the prorammer's intention is
> to actually make the copy. So there's two reasons against
> special-casing the addr1=addr2 case.
>
> OTOH, if you feel the urge to special-case this case, and you know
> that your MOVE is only used for memory that behaves like conventional
> RAM, not doing anything satisfies the description of the result:
>
> |After MOVE completes, the u consecutive address units at addr2 contain
> |exactly what the u consecutive address units at addr1 contained before
> |the move.

MOVE checking for overlap is an optimization difficult to justify on
the frequency! Given ANS mandates the test, exiting early amounts to
a conditional branch typically not taken - a small cost should one
choose to implement it.

old code:

mov dx,di
sub dx,ax
cmp dx,cx
jc bmovu ; overlap and moving-up

new code:

mov dx,di
sub dx,ax
jz ... ; dest=src
cmp dx,cx
jc bmovu ; overlap and moving-up

What prompted me to consider the addition was this:

(.) 20 (S.R) ( adr len)

(.) converts a number to a string in the HOLD buffer and (S.R) right-
justifies it with blanks whose result is also in the HOLD buffer.
Since the source string for (S.R) was already in place, the copy phase
which involved MOVE became redundant.

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor