Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

FORTRAN is the language of Powerful Computers. -- Steven Feiner


devel / comp.lang.forth / Re: Sections formalization

SubjectAuthor
* Sections benefits quantifiedAnton Ertl
+* Re: Sections benefits quantifiedMarcel Hendrix
|`- Re: Sections benefits quantifiedAnton Ertl
+* Re: Sections benefits quantifiedAnton Ertl
|`- Re: Sections benefits quantifiedAnton Ertl
+* Re: Sections benefits quantifieddxforth
|`* Re: Sections benefits quantifiedAnton Ertl
| `* Re: Sections benefits quantifieddxforth
|  `- Re: Sections benefits quantifiedAnton Ertl
+* Re: Sections benefits quantifiedminf...@arcor.de
|`* Re: Sections benefits quantifiedAnton Ertl
| `- Re: Sections benefits quantifiedminf...@arcor.de
+* Re: Sections benefits quantifiedPaul Rubin
|+* Re: Sections benefits quantifieddxforth
||+* Re: Sections benefits quantifiedPaul Rubin
|||`- Re: Sections benefits quantifiedAnton Ertl
||`- Re: Sections benefits quantifiedAndy Valencia
|`* Re: Sections benefits quantifiedAnton Ertl
| `* Re: Sections benefits quantifiedPaul Rubin
|  `- Re: Sections benefits quantifiedAnton Ertl
+* Re: Sections benefits quantifiedGerry Jackson
|`* Re: Sections benefits quantifiedAnton Ertl
| `* Re: Sections benefits quantifiedGerry Jackson
|  +* Re: Sections benefits quantifiedHans Bezemer
|  |+- Re: Sections benefits quantifiedGerry Jackson
|  |`- Re: Sections benefits quantifieddxforth
|  `* Re: Sections benefits quantifiedAnton Ertl
|   `* Re: Sections benefits quantifiedKrishna Myneni
|    +- Re: Sections benefits quantifiedKrishna Myneni
|    `- Re: Sections benefits quantifiedAnton Ertl
+- Re: Sections benefits quantifiedMike
`* Sections formalization (was: Sections benefits quantified)Ruvim
 +* Re: Sections formalization (was: Sections benefits quantified)minf...@arcor.de
 |+- Re: Sections formalization (was: Sections benefits quantified)Ruvim
 |`* Re: Sections formalization (was: Sections benefits quantified)Anton Ertl
 | `* Re: Sections formalizationPaul Rubin
 |  +- Re: Sections formalizationdxforth
 |  `- Re: Sections formalizationAnton Ertl
 +* Re: Sections formalization (was: Sections benefits quantified)Anton Ertl
 |`* Re: Sections formalizationRuvim
 | `* Re: Sections formalizationAnton Ertl
 |  +* Re: Sections formalizationGerry Jackson
 |  |`- Re: Sections formalizationAnton Ertl
 |  `* Re: Sections formalizationRuvim
 |   `* Re: Sections formalizationAnton Ertl
 |    +- Re: Sections formalizationdxforth
 |    `* Re: Sections formalizationRuvim
 |     +* Re: Sections formalizationAnton Ertl
 |     |`* Re: Sections formalizationRuvim
 |     | `* Re: Sections formalizationAnton Ertl
 |     |  `- Re: Sections formalizationRuvim
 |     `* Re: Sections formalizationdxforth
 |      `- Re: Sections formalizationRuvim
 `- Re: Sections formalization (was: Sections benefits quantified)none

Pages:123
Re: Sections benefits quantified

<2021Aug9.223645@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Sections benefits quantified
Date: Mon, 09 Aug 2021 20:36:45 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 22
Message-ID: <2021Aug9.223645@mips.complang.tuwien.ac.at>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at> <sepg2l$kt6$1@dont-email.me> <2021Aug9.110036@mips.complang.tuwien.ac.at> <ser831$4kq$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="c0ded8ad0629ded41ae604c5bcdc7054";
logging-data="10674"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19G64l0muDQ6GPhYmCv7ar2"
Cancel-Lock: sha1:+Axen96GfCw0bZUsJEXBpwNSXQM=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Mon, 9 Aug 2021 20:36 UTC

Gerry Jackson <do-not-use@swldwa.uk> writes:
>Why does Gforth need a header for a nameless word?

It needs at least the code field in order to be able to EXECUTE the xt
of the word. It also needs the vt address and vt (which is typically
shared with other words) in order to be able to COMPILE, the xt of the
word. And that's what a nameless word has in terms of header fields.

Conceptually, there is also the idea that all headers are equal. In
an earlier version of the new Gforth header, this meant that headers
of nameless words still had count and link fields; but I think that in
the current version, this is abstracted into a NAME>STRING method that
return the address and length of the name (0 0 for nameless words),
and a NAME>LINK method that returns the link to the previous word, so
this conceptual equality does not cost much RAM.

- 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: Sections benefits quantified

<sescgo$s04$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: krishna....@ccreweb.org (Krishna Myneni)
Newsgroups: comp.lang.forth
Subject: Re: Sections benefits quantified
Date: Mon, 9 Aug 2021 18:08:06 -0500
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <sescgo$s04$1@dont-email.me>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sepg2l$kt6$1@dont-email.me> <2021Aug9.110036@mips.complang.tuwien.ac.at>
<ser831$4kq$1@dont-email.me> <2021Aug9.223645@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 9 Aug 2021 23:08:08 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="c4c9de0619001092010002b2d4b1874f";
logging-data="28676"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JF9rdMWpue93GqKXY6lB8"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:Pa4yHuvGGpcE2Q0s9X3cpXT+O8I=
In-Reply-To: <2021Aug9.223645@mips.complang.tuwien.ac.at>
Content-Language: en-US
 by: Krishna Myneni - Mon, 9 Aug 2021 23:08 UTC

On 8/9/21 3:36 PM, Anton Ertl wrote:
> Gerry Jackson <do-not-use@swldwa.uk> writes:
>> Why does Gforth need a header for a nameless word?
>
> It needs at least the code field in order to be able to EXECUTE the xt
> of the word. It also needs the vt address and vt (which is typically
> shared with other words) in order to be able to COMPILE, the xt of the
> word. And that's what a nameless word has in terms of header fields.
>
> Conceptually, there is also the idea that all headers are equal. In
> an earlier version of the new Gforth header, this meant that headers
> of nameless words still had count and link fields; but I think that in
> the current version, this is abstracted into a NAME>STRING method that
> return the address and length of the name (0 0 for nameless words),
> and a NAME>LINK method that returns the link to the previous word, so
> this conceptual equality does not cost much RAM.
>

What should the following code do?

variable xtFoo
marker m1
: foo ." foo" ;
' foo xtFoo !
:noname xtFoo @ execute ;
m1
execute \ execute the anonymous definition

Presumably the header for FOO is removed from the dictionary when M1 is
executed. In Gforth, I notice that the last EXECUTE in the above code
still works despite FOO no longer being in the dictionary.

In kForth, when the header for a word is removed from the dictionary,
e.g. using FORGET, the xt for the word is no longer valid. In contrast,
:NONAME definitions and quotations, which are derived from :NONAME
definitions, have no headers, and may always be executed provided the
named words which their definitions reference still exist in the
dictionary. So, for example, we can't do the following in kForth,

: foo ." foo" ;
:noname foo ;
forget foo
execute \ will cause error because the word FOO no longer exists.

However, the following will work just fine in kForth because there is no
header to remove for the :NONAME definition,

: bar ." bar" ;
: foo ." foo" ;
:noname bar ;
forget foo
execute

The xt associated with a :NONAME definition may be stored and used
without regard to MARKER or FORGET. Perhaps this is true in Gforth as well.

--
Krishna

Re: Sections benefits quantified

<sesehg$1go$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: krishna....@ccreweb.org (Krishna Myneni)
Newsgroups: comp.lang.forth
Subject: Re: Sections benefits quantified
Date: Mon, 9 Aug 2021 18:42:38 -0500
Organization: A noiseless patient Spider
Lines: 66
Message-ID: <sesehg$1go$1@dont-email.me>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sepg2l$kt6$1@dont-email.me> <2021Aug9.110036@mips.complang.tuwien.ac.at>
<ser831$4kq$1@dont-email.me> <2021Aug9.223645@mips.complang.tuwien.ac.at>
<sescgo$s04$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 9 Aug 2021 23:42:40 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="c4c9de0619001092010002b2d4b1874f";
logging-data="1560"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199ymc8AJaj8xNF5y1ePZaN"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:Ztj6CHTKL9iaZF9mePvL5hmnQfw=
In-Reply-To: <sescgo$s04$1@dont-email.me>
Content-Language: en-US
 by: Krishna Myneni - Mon, 9 Aug 2021 23:42 UTC

On 8/9/21 6:08 PM, Krishna Myneni wrote:
> On 8/9/21 3:36 PM, Anton Ertl wrote:
>> Gerry Jackson <do-not-use@swldwa.uk> writes:
>>> Why does Gforth need a header for a nameless word?
>>
>> It needs at least the code field in order to be able to EXECUTE the xt
>> of the word.  It also needs the vt address and vt (which is typically
>> shared with other words) in order to be able to COMPILE, the xt of the
>> word.  And that's what a nameless word has in terms of header fields.
>>
>> Conceptually, there is also the idea that all headers are equal.
....
> The xt associated with a :NONAME definition may be stored and used
> without regard to MARKER or FORGET. Perhaps this is true in Gforth as well.
>

Ok. I just answered my question with regards to Gforth's behavior. The
following does not work in Gforth:

: foo ." foo" ;
marker m1
:noname foo ;
m1
create arr 1000 allot
arr 1000 erase
execute

causes an Invalid memory address error. Similarly, the following also
does not work in Gforth:

marker m2
:noname 2 3 + . ;
m2
create arr2 1000 allot
arr2 1000 erase
execute

produces an invalid memory error.

In contrast, the :NONAME definitions persist in kForth, owing to their
lack of headers.

: foo ." foo" ;
: m1 ;
:noname foo ;
forget m1
create arr 1000 allot
arr 1000 erase
execute \ types "foo"

: m2 ;
:noname 2 3 + . ;
forget m2
create arr2 1000 allot
arr2 1000 erase
execute \ prints 5

It's worth noting that there can be a difference in the behavior of
Forth systems which provide headers for :NONAME definitions and those
which don't when MARKER and FORGET are involved.

--
Krishna

Re: Sections benefits quantified

<sesqf9$5pg$1@gioia.aioe.org>

  copy mid

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

  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: Sections benefits quantified
Date: Tue, 10 Aug 2021 13:06:19 +1000
Organization: Aioe.org NNTP Server
Message-ID: <sesqf9$5pg$1@gioia.aioe.org>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sepg2l$kt6$1@dont-email.me> <2021Aug9.110036@mips.complang.tuwien.ac.at>
<ser831$4kq$1@dont-email.me>
<d9df5328-5705-422d-b04b-8c9cf3de8137n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="5936"; 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.12.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Tue, 10 Aug 2021 03:06 UTC

On 10/08/2021 01:49, Hans Bezemer wrote:
> On Monday, August 9, 2021 at 2:46:27 PM UTC+2, Gerry Jackson wrote:
>> Why does Gforth need a header for a nameless word?
>
> I wouldn't know. Just branch over the shebang.
>
> Addr| Opcode Operand
>
> 0| branch 10
> 1| dup 0
> 2| literal 4
> 3| branch 7
> 4| swap 0
> 5| - 0
> 6| exit 0
> 7| swap 0
> 8| ! 0
> 9| exit 0
>
> You guys do have AHEAD, don't you?
>

Avoid quotations and the whole shebang goes away.

Re: Sections benefits quantified

<2021Aug10.070915@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Sections benefits quantified
Date: Tue, 10 Aug 2021 05:09:15 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 43
Message-ID: <2021Aug10.070915@mips.complang.tuwien.ac.at>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at> <sepg2l$kt6$1@dont-email.me> <2021Aug9.110036@mips.complang.tuwien.ac.at> <ser831$4kq$1@dont-email.me> <2021Aug9.223645@mips.complang.tuwien.ac.at> <sescgo$s04$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="6e32db1889c84d8ea6129b0ef97fdfce";
logging-data="16354"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+7LZt990aQC6wEEv82Buun"
Cancel-Lock: sha1:o9JHYPtWSBP078yEcdcyKPMJulQ=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Tue, 10 Aug 2021 05:09 UTC

Krishna Myneni <krishna.myneni@ccreweb.org> writes:
>On 8/9/21 3:36 PM, Anton Ertl wrote:
>> Gerry Jackson <do-not-use@swldwa.uk> writes:
>>> Why does Gforth need a header for a nameless word?
>>
>> It needs at least the code field in order to be able to EXECUTE the xt
>> of the word. It also needs the vt address and vt (which is typically
>> shared with other words) in order to be able to COMPILE, the xt of the
>> word. And that's what a nameless word has in terms of header fields.
>>
>> Conceptually, there is also the idea that all headers are equal. In
>> an earlier version of the new Gforth header, this meant that headers
>> of nameless words still had count and link fields; but I think that in
>> the current version, this is abstracted into a NAME>STRING method that
>> return the address and length of the name (0 0 for nameless words),
>> and a NAME>LINK method that returns the link to the previous word, so
>> this conceptual equality does not cost much RAM.
>>
>
>What should the following code do?
>
>variable xtFoo
>marker m1
>: foo ." foo" ;
>' foo xtFoo !
>:noname xtFoo @ execute ;
>m1
>execute \ execute the anonymous definition
>
>Presumably the header for FOO is removed from the dictionary when M1 is
>executed. In Gforth, I notice that the last EXECUTE in the above code
>still works despite FOO no longer being in the dictionary.

As you found out, markers don't overwrite the memory that they
reclaim, so until something else overwrites some of this memory, words
in that memory still work.

- 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: Sections benefits quantified

<98614219-d99c-487a-8b2e-c51a089140adn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:7207:: with SMTP id a7mr23865304qtp.32.1628579195066;
Tue, 10 Aug 2021 00:06:35 -0700 (PDT)
X-Received: by 2002:a05:620a:205b:: with SMTP id d27mr6139708qka.375.1628579194816;
Tue, 10 Aug 2021 00:06:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Tue, 10 Aug 2021 00:06:34 -0700 (PDT)
In-Reply-To: <2021Aug6.095019@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=82.203.166.51; posting-account=bfqVhAoAAABnxNiPDFL3mSrvM7YNO32Q
NNTP-Posting-Host: 82.203.166.51
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <98614219-d99c-487a-8b2e-c51a089140adn@googlegroups.com>
Subject: Re: Sections benefits quantified
From: oh2...@gmail.com (Mike)
Injection-Date: Tue, 10 Aug 2021 07:06:35 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mike - Tue, 10 Aug 2021 07:06 UTC

On Friday, August 6, 2021 at 11:56:05 AM UTC+3, Anton Ertl wrote:
> We have added multiple sections [ertl-sections16] to Gforth. Sections
> are the same concept as in assembly language and binary formats
> (e.g. ELF): Classical Forth has one section=dictionary: A stretch of
> memory from the start to HERE, with the address space behind available
> for future allocation. Each section works like the dictionary: It has
> a stretch of allocated memory, and behind that there is memory
> available for future allocation.
>
> Gforth offers the following interface for sections: There is a current
> section (by default the ordinary dictionary), and HERE and UNUSED
> produce the results for the current section, and ALLOT etc. work on
> that section. You can temporarily change the section.
>
In FlashForth I have three sections RAM, FLASH, EEPROM.
It was a design decision I made when I started writing it in 2005.
There is a current section pointer which allows ALLOT , HERE CREATE UNUSED to address the current section.
Code and headers go to FLASH, data goes to the current section.
MARKER stores and restores the section pointers and dictionary pointer and the turnkey.
FORGET works only with the FLASH section.

Sections formalization (was: Sections benefits quantified)

<sis0do$acl$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Sections formalization (was: Sections benefits quantified)
Date: Mon, 27 Sep 2021 11:46:45 +0300
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <sis0do$acl$1@dont-email.me>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Sep 2021 08:46:48 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="89820f39cde4b49157ceb18281fd0e94";
logging-data="10645"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cfpbNgxuyDrWlaThNSbD8"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Cancel-Lock: sha1:q12MP0g4PDvFxxYk2aY1nBKz6g4=
In-Reply-To: <2021Aug6.095019@mips.complang.tuwien.ac.at>
Content-Language: en-US
 by: Ruvim - Mon, 27 Sep 2021 08:46 UTC

On 2021-08-06 10:50, Anton Ertl wrote:
> We have added multiple sections [ertl-sections16] to Gforth. Sections
> are the same concept as in assembly language and binary formats
> (e.g. ELF): Classical Forth has one section=dictionary: A stretch of
> memory from the start to HERE, with the address space behind available
> for future allocation.

If data space and code space are separated in a Forth system, do you
consider them as one section, or two sections?

The question arises since a section (in binary formats) usually consists
of a single address range in memory.

> Each section works like the dictionary: It has
> a stretch of allocated memory, and behind that there is memory
> available for future allocation.

If a section works like the dictionary, it looks attractive to call it
"dictionary".

One problem is that "dictionary", "data space", "code space" are
singletons in the standard terminology, and the dictionary *contains*
data space and code space. So, if we introduce multiple dictionaries,
then data space and code space are not singletons anymore too. So the
terminology should be adjusted somehow, i.e., a dictionary (as a data
structure) does not contain data space and code space any more, but vice
versa, it's contained by them.

> Gforth offers the following interface for sections: There is a current
> section (by default the ordinary dictionary), and HERE and UNUSED
> produce the results for the current section, and ALLOT etc. work on
> that section. You can temporarily change the section.

In my very old extension for SP-Forth/4 the objects similar to your
sections can be created and destroyed (freed) by the user.

One problem that can arise is spreading a word list among several
sections, when some of them can be destroyed.

So, to create words in a temporary section, the user should create a
word list per each temporary section and retain the association of the
word list and the section, and change both the current section and the
compilation word list at the same time.

To make things simpler, this works automatically in my implementation,
i.e. the associated word list is created for new section, and the
compilation word list is changed automatically according to change of
the current section. When the current section is restored, the
compilation word list is restored too (what it was before).

In this regard, the questions are as following:

1. Can the compilation word list be local for the current section?

2. Can we allow a Forth system to prevent spreading a word list among
several sections?

--
Ruvim

Re: Sections formalization (was: Sections benefits quantified)

<8b594aaa-9265-4191-89c7-53cacd0038d1n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5905:: with SMTP id 5mr4539662qty.391.1632733423864;
Mon, 27 Sep 2021 02:03:43 -0700 (PDT)
X-Received: by 2002:a37:d50:: with SMTP id 77mr22993557qkn.299.1632733423709;
Mon, 27 Sep 2021 02:03:43 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Mon, 27 Sep 2021 02:03:43 -0700 (PDT)
In-Reply-To: <sis0do$acl$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f0f:8f1b:e1c8:9310:2599:5bff;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f0f:8f1b:e1c8:9310:2599:5bff
References: <2021Aug6.095019@mips.complang.tuwien.ac.at> <sis0do$acl$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8b594aaa-9265-4191-89c7-53cacd0038d1n@googlegroups.com>
Subject: Re: Sections formalization (was: Sections benefits quantified)
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Mon, 27 Sep 2021 09:03:43 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 58
 by: minf...@arcor.de - Mon, 27 Sep 2021 09:03 UTC

Ruvim schrieb am Montag, 27. September 2021 um 10:46:49 UTC+2:
> On 2021-08-06 10:50, Anton Ertl wrote:
> > We have added multiple sections [ertl-sections16] to Gforth. Sections
> > are the same concept as in assembly language and binary formats
> > (e.g. ELF): Classical Forth has one section=dictionary: A stretch of
> > memory from the start to HERE, with the address space behind available
> > for future allocation.
> If data space and code space are separated in a Forth system, do you
> consider them as one section, or two sections?
>
> The question arises since a section (in binary formats) usually consists
> of a single address range in memory.
> > Each section works like the dictionary: It has
> > a stretch of allocated memory, and behind that there is memory
> > available for future allocation.
> If a section works like the dictionary, it looks attractive to call it
> "dictionary".
>
> One problem is that "dictionary", "data space", "code space" are
> singletons in the standard terminology, and the dictionary *contains*
> data space and code space. So, if we introduce multiple dictionaries,
> then data space and code space are not singletons anymore too. So the
> terminology should be adjusted somehow, i.e., a dictionary (as a data
> structure) does not contain data space and code space any more, but vice
> versa, it's contained by them.
> > Gforth offers the following interface for sections: There is a current
> > section (by default the ordinary dictionary), and HERE and UNUSED
> > produce the results for the current section, and ALLOT etc. work on
> > that section. You can temporarily change the section.
> In my very old extension for SP-Forth/4 the objects similar to your
> sections can be created and destroyed (freed) by the user.
>
> One problem that can arise is spreading a word list among several
> sections, when some of them can be destroyed.
>
> So, to create words in a temporary section, the user should create a
> word list per each temporary section and retain the association of the
> word list and the section, and change both the current section and the
> compilation word list at the same time.
>
> To make things simpler, this works automatically in my implementation,
> i.e. the associated word list is created for new section, and the
> compilation word list is changed automatically according to change of
> the current section. When the current section is restored, the
> compilation word list is restored too (what it was before).
>
> In this regard, the questions are as following:
>
> 1. Can the compilation word list be local for the current section?
>
> 2. Can we allow a Forth system to prevent spreading a word list among
> several sections?
>

Adding to that:
The more sections you have, the more unused section space you have.
And each section can run out of space individually.
This could become an issue in memory-constrained systems.

Re: Sections formalization (was: Sections benefits quantified)

<sis6b9$odm$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Re: Sections formalization (was: Sections benefits quantified)
Date: Mon, 27 Sep 2021 13:27:51 +0300
Organization: A noiseless patient Spider
Lines: 100
Message-ID: <sis6b9$odm$1@dont-email.me>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sis0do$acl$1@dont-email.me>
<8b594aaa-9265-4191-89c7-53cacd0038d1n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Sep 2021 10:27:53 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="89820f39cde4b49157ceb18281fd0e94";
logging-data="25014"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Uc7EG6zYHXS8NwFr4q8gT"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Cancel-Lock: sha1:zBJuDOdM9GBJ1IllvVkoR4TuJJQ=
In-Reply-To: <8b594aaa-9265-4191-89c7-53cacd0038d1n@googlegroups.com>
Content-Language: en-US
 by: Ruvim - Mon, 27 Sep 2021 10:27 UTC

On 2021-09-27 12:03, minf...@arcor.de wrote:
> Ruvim schrieb am Montag, 27. September 2021 um 10:46:49 UTC+2:
>> On 2021-08-06 10:50, Anton Ertl wrote:
>>> We have added multiple sections [ertl-sections16] to Gforth. Sections
>>> are the same concept as in assembly language and binary formats
>>> (e.g. ELF): Classical Forth has one section=dictionary: A stretch of
>>> memory from the start to HERE, with the address space behind available
>>> for future allocation.
>> If data space and code space are separated in a Forth system, do you
>> consider them as one section, or two sections?
>>
>> The question arises since a section (in binary formats) usually consists
>> of a single address range in memory.
>>> Each section works like the dictionary: It has
>>> a stretch of allocated memory, and behind that there is memory
>>> available for future allocation.
>> If a section works like the dictionary, it looks attractive to call it
>> "dictionary".
>>
>> One problem is that "dictionary", "data space", "code space" are
>> singletons in the standard terminology, and the dictionary *contains*
>> data space and code space. So, if we introduce multiple dictionaries,
>> then data space and code space are not singletons anymore too. So the
>> terminology should be adjusted somehow, i.e., a dictionary (as a data
>> structure) does not contain data space and code space any more, but vice
>> versa, it's contained by them.
>>> Gforth offers the following interface for sections: There is a current
>>> section (by default the ordinary dictionary), and HERE and UNUSED
>>> produce the results for the current section, and ALLOT etc. work on
>>> that section. You can temporarily change the section.
>> In my very old extension for SP-Forth/4 the objects similar to your
>> sections can be created and destroyed (freed) by the user.
>>
>> One problem that can arise is spreading a word list among several
>> sections, when some of them can be destroyed.
>>
>> So, to create words in a temporary section, the user should create a
>> word list per each temporary section and retain the association of the
>> word list and the section, and change both the current section and the
>> compilation word list at the same time.
>>
>> To make things simpler, this works automatically in my implementation,
>> i.e. the associated word list is created for new section, and the
>> compilation word list is changed automatically according to change of
>> the current section. When the current section is restored, the
>> compilation word list is restored too (what it was before).
>>
>> In this regard, the questions are as following:
>>
>> 1. Can the compilation word list be local for the current section?
>>
>> 2. Can we allow a Forth system to prevent spreading a word list among
>> several sections?
>>
>
> Adding to that:
> The more sections you have, the more unused section space you have.
> And each section can run out of space individually.
> This could become an issue in memory-constrained systems.
>

Yes, of course.
But a memory-constrained system might not provide this feature at all.

Concerning the API.

If we associate a section (a dictionary?) with a word list (as it was
implemented in SP-Forth/4), then changing the compilation word list will
change the current dictionary too. And there is no need for other words
to control the current dictionary at all.

The only required new words are to create a word list with its own
dictionary, and to free such a word list (with its dictionary).
Something as follows:

allocate-wordlist ( u-datasize u-codesize -- wid ior )
free-wordlist ( wid -- ior )

The actually allocated memory can be greater than the given sizes, since
the system can reserve additional space to its own needs.

Management of dictionaries remains under the hood.

If we want to create a dictionary that is saved into the image, we can
have something as:

allocate-wordlist-persistent ( u-datasize u-codesize -- wid ior )

A question is: does somebody need the ability to spread one word list
among several dictionaries? I.e., that some words from the word list sit
in one dictionary/section, and other words in another dictionary/section.

--
Ruvim

Re: Sections formalization (was: Sections benefits quantified)

<2021Sep27.213201@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Sections formalization (was: Sections benefits quantified)
Date: Mon, 27 Sep 2021 19:32:01 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 62
Message-ID: <2021Sep27.213201@mips.complang.tuwien.ac.at>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at> <sis0do$acl$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="1eeee94989de9c9567ec36dc68183ad2";
logging-data="30166"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19RX9Ucmeb1P97O2LNh4Ixu"
Cancel-Lock: sha1:wWXm9G1MKE0UfF8M6G+mPN8jNpY=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Mon, 27 Sep 2021 19:32 UTC

Ruvim <ruvim.pinka@gmail.com> writes:
>On 2021-08-06 10:50, Anton Ertl wrote:
>> We have added multiple sections [ertl-sections16] to Gforth. Sections
>> are the same concept as in assembly language and binary formats
>> (e.g. ELF): Classical Forth has one section=dictionary: A stretch of
>> memory from the start to HERE, with the address space behind available
>> for future allocation.
>
>If data space and code space are separated in a Forth system, do you
>consider them as one section, or two sections?

Two.

>> Each section works like the dictionary: It has
>> a stretch of allocated memory, and behind that there is memory
>> available for future allocation.
>
>
>If a section works like the dictionary, it looks attractive to call it
>"dictionary".

More precisely, I should have written: Each section works like the
dictionary in classical Forth (which has no separate code space, data
space, name space etc.).

A multi-section Forth system still has only has one dictionary,
distributed across several sections.

>So, if we introduce multiple dictionaries,

We don't. Gforth has multiple sections.

>One problem that can arise is spreading a word list among several
>sections, when some of them can be destroyed.

Then don't.

>So, to create words in a temporary section, the user should create a
>word list per each temporary section and retain the association of the
>word list and the section, and change both the current section and the
>compilation word list at the same time.

No temporary sections in Gforth, and the idea is not to have
per-section wordlists (or per-wordlist sections), but to use sections
to avoid branching around strings and quotations, and for storing
locals names.

>1. Can the compilation word list be local for the current section?
>
>2. Can we allow a Forth system to prevent spreading a word list among
>several sections?

Given that sections are a non-standard feature, a system can do
whatever it wants. However, in the interest of communication clarity
we should use different names for different things.

- 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: Sections formalization (was: Sections benefits quantified)

<2021Sep27.215728@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Sections formalization (was: Sections benefits quantified)
Date: Mon, 27 Sep 2021 19:57:28 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 17
Message-ID: <2021Sep27.215728@mips.complang.tuwien.ac.at>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at> <sis0do$acl$1@dont-email.me> <8b594aaa-9265-4191-89c7-53cacd0038d1n@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="1eeee94989de9c9567ec36dc68183ad2";
logging-data="30166"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ajN2buo6s/mpVyT/H1JzZ"
Cancel-Lock: sha1:yT7nJRRuIPMgvYWMU9ZfH6x/ZOY=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Mon, 27 Sep 2021 19:57 UTC

"minf...@arcor.de" <minforth@arcor.de> writes:
>The more sections you have, the more unused section space you have.
>And each section can run out of space individually.
>This could become an issue in memory-constrained systems.

If a section runs out of memory, you configure more memory for it on
the next startup. You may need to configure less memory for some
other section (which can then overrun, and so on until you have found
the right sizes for all the sections). That's inconvenient, so you
won't implement sections unless the benefits are worth this cost.

- 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: Sections formalization

<878rzhda2g.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Sections formalization
Date: Mon, 27 Sep 2021 13:42:47 -0700
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <878rzhda2g.fsf@nightsong.com>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sis0do$acl$1@dont-email.me>
<8b594aaa-9265-4191-89c7-53cacd0038d1n@googlegroups.com>
<2021Sep27.215728@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="888a3255e4640c2f4dcd543f039137ff";
logging-data="17423"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XfGHeM9zAXMOKzuWRAGZl"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:kQAGiydPPVy0SUroJqBItpLvtmw=
sha1:9M1Z03oieYdxiAmQGHVkqMWVVk0=
 by: Paul Rubin - Mon, 27 Sep 2021 20:42 UTC

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> If a section runs out of memory, you configure more memory for it on
> the next startup.

This issue was traditionally handled by linkers that would relocate the
addresses after the assembler had figured out the sizes of each section,
so they would end up contiguous in memory. Is that terribly
unreasonable for Forth, which has always wanted to do everything in a
single pass?

Re: Sections formalization

<siuabk$se4$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!rocksolid2!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: Sections formalization
Date: Tue, 28 Sep 2021 15:48:36 +1000
Organization: Aioe.org NNTP Server
Message-ID: <siuabk$se4$1@gioia.aioe.org>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sis0do$acl$1@dont-email.me>
<8b594aaa-9265-4191-89c7-53cacd0038d1n@googlegroups.com>
<2021Sep27.215728@mips.complang.tuwien.ac.at> <878rzhda2g.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="29124"; 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 - Tue, 28 Sep 2021 05:48 UTC

On 28/09/2021 06:42, Paul Rubin wrote:
> anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> If a section runs out of memory, you configure more memory for it on
>> the next startup.
>
> This issue was traditionally handled by linkers that would relocate the
> addresses after the assembler had figured out the sizes of each section,
> so they would end up contiguous in memory. Is that terribly
> unreasonable for Forth, which has always wanted to do everything in a
> single pass?
>

LMI had run-time relocatable binary modules:

The Binary Overlay manager consists of separate modules which create
and load Forth binary overlay files. BSAVE creates a binary
overlay file. BGET loads a binary overlay file, relocates it and
links it into the dictionary. BRUN loads an overlay file using
BGET and then executes a specified definition within the overlay.

Re: Sections formalization

<2021Sep28.134140@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Sections formalization
Date: Tue, 28 Sep 2021 11:41:40 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 27
Message-ID: <2021Sep28.134140@mips.complang.tuwien.ac.at>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at> <sis0do$acl$1@dont-email.me> <8b594aaa-9265-4191-89c7-53cacd0038d1n@googlegroups.com> <2021Sep27.215728@mips.complang.tuwien.ac.at> <878rzhda2g.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="09f15a22341798cc2879755d48d25938";
logging-data="17137"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+++esBK43WS8Xvd/fCCLRs"
Cancel-Lock: sha1:Kg+GYDSA2eKJrC7MQ2H8936dgsA=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Tue, 28 Sep 2021 11:41 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> If a section runs out of memory, you configure more memory for it on
>> the next startup.
>
>This issue was traditionally handled by linkers that would relocate the
>addresses after the assembler had figured out the sizes of each section,
>so they would end up contiguous in memory. Is that terribly
>unreasonable for Forth, which has always wanted to do everything in a
>single pass?

The problem (at least for the kind of section usage in Gforth) is that
on creating an image, you get addresses that point to somewhere in a
section, and can use them anytime, so resizing (with relocation) the
section at run-time is not possible (whereas assemblers and linkers
probably can).

In Gforth we then save the image, and by comparing images, create a
relocatable image, so on loading that image you can set the sizes of
the sections (but there is no user facility for doing that yet).

- 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: Sections formalization

<sj4i57$613$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Re: Sections formalization
Date: Thu, 30 Sep 2021 17:38:31 +0300
Organization: A noiseless patient Spider
Lines: 80
Message-ID: <sj4i57$613$1@dont-email.me>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sis0do$acl$1@dont-email.me> <2021Sep27.213201@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 30 Sep 2021 14:38:31 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="595e77a6d76488b230c4402cde13d010";
logging-data="6179"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wVjPmREGqAhqj6ePHNaRk"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.1.2
Cancel-Lock: sha1:ZNCZ7hlDiqF5xr/LdK6jWZwbgIM=
In-Reply-To: <2021Sep27.213201@mips.complang.tuwien.ac.at>
Content-Language: en-US
 by: Ruvim - Thu, 30 Sep 2021 14:38 UTC

On 2021-09-27 22:32, Anton Ertl wrote:
> Ruvim <ruvim.pinka@gmail.com> writes:
>> On 2021-08-06 10:50, Anton Ertl wrote:
>>> We have added multiple sections [ertl-sections16] to Gforth. Sections
>>> are the same concept as in assembly language and binary formats
>>> (e.g. ELF): Classical Forth has one section=dictionary: A stretch of
>>> memory from the start to HERE, with the address space behind available
>>> for future allocation.
>>
>> If data space and code space are separated in a Forth system, do you
>> consider them as one section, or two sections?
>
> Two.
>
>>> Each section works like the dictionary: It has
>>> a stretch of allocated memory, and behind that there is memory
>>> available for future allocation.
>>
>>
>> If a section works like the dictionary, it looks attractive to call it
>> "dictionary".
>
> More precisely, I should have written: Each section works like the
> dictionary in classical Forth (which has no separate code space, data
> space, name space etc.).
>
> A multi-section Forth system still has only has one dictionary,
> distributed across several sections.

[...]

>> So, to create words in a temporary section, the user should create a
>> word list per each temporary section and retain the association of the
>> word list and the section, and change both the current section and the
>> compilation word list at the same time.
>
> No temporary sections in Gforth, and the idea is not to have
> per-section wordlists (or per-wordlist sections), but to use sections
> to avoid branching around strings and quotations, and for storing
> locals names.

Don't you free local names after using?

>
>> 1. Can the compilation word list be local for the current section?
>>
>> 2. Can we allow a Forth system to prevent spreading a word list among
>> several sections?
>
> Given that sections are a non-standard feature, a system can do
> whatever it wants.

Of course. I just think concerning possible compatibility, since these
general idea already implemented in several Forth systems, and it can be
useful for applications.

Having such a feature, an application has a portable way:
- to have a dictionary of required size;
- to hot reload some parts from the sources;
- to have some components (in object code) temporary in memory.

I use hot reloading in a web application server.

> However, in the interest of communication clarity
> we should use different names for different things.

Yes.

So, a section having a single address range of memory, cannot play the
role of the dictionary in any Forth system.

It seems, a portable API cannot be established for sections. What do you
think?

--
Ruvim

Re: Sections formalization

<2021Oct1.181119@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Sections formalization
Date: Fri, 01 Oct 2021 16:11:19 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 60
Message-ID: <2021Oct1.181119@mips.complang.tuwien.ac.at>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at> <sis0do$acl$1@dont-email.me> <2021Sep27.213201@mips.complang.tuwien.ac.at> <sj4i57$613$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="05209f9dd0d64b48841af6379d109ae3";
logging-data="5706"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19vphRWBzl08GIMRAppj4Me"
Cancel-Lock: sha1:aUfe+feoOaaHVKNLE4BrDNdycCM=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Fri, 1 Oct 2021 16:11 UTC

Ruvim <ruvim.pinka@gmail.com> writes:
>On 2021-09-27 22:32, Anton Ertl wrote:
>> More precisely, I should have written: Each section works like the
>> dictionary in classical Forth (which has no separate code space, data
>> space, name space etc.).
>>
>> A multi-section Forth system still has only has one dictionary,
>> distributed across several sections.
....
>> No temporary sections in Gforth, and the idea is not to have
>> per-section wordlists (or per-wordlist sections), but to use sections
>> to avoid branching around strings and quotations, and for storing
>> locals names.
>
>Don't you free local names after using?

Yes, Gforth frees the local names at the end of the colon definition.
That's easy given that they are in a separate section. Actually
that's pretty close to your idea of independently manageable
wordlist-sections, whereas other sections in Gforth are much more
intertwined (and therefore not independently manageable).

Why use a section for locals rather than ALLOCATEd memory (which is
what Gforth used earlier)? A section is part of the dictionary, and
therefore ALLOT works as a matter of course, including checking for
dictionary overflow. And creating a name calls ALLOT. With ALLOCATE
we needed quite a bit of extra code for implementing ALLOT in the
ALLOCATEd memory. Also, freeing the ALLOCATEd memory is more
complicated, because we used one ALLOCATE per name.

>Of course. I just think concerning possible compatibility, since these
>general idea already implemented in several Forth systems, and it can be
>useful for applications.

Well, the interface that Gforth has is relatively simple: You switch
to a section, and all ALLOTs then go into that section.

>So, a section having a single address range of memory, cannot play the
>role of the dictionary in any Forth system.

In mant Forth systems, the dictionary has only one section (of course
we don't speak about sections in that case), so I wonder why you write
that.

>It seems, a portable API cannot be established for sections. What do you
>think?

I see no reason why not. Of course, it may turn out that the systems
do something else with multiple address ranges, and their implementors
may not see the need for an API like Gforth offers. This could be
addressed by using different names for the different APIs. Of course,
the question remains if any system beyond Gforth will implement the
Gforth section API.

- 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: Sections formalization

<sj7kmc$n8q$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: do-not-...@swldwa.uk (Gerry Jackson)
Newsgroups: comp.lang.forth
Subject: Re: Sections formalization
Date: Fri, 1 Oct 2021 19:40:14 +0100
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <sj7kmc$n8q$1@dont-email.me>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sis0do$acl$1@dont-email.me> <2021Sep27.213201@mips.complang.tuwien.ac.at>
<sj4i57$613$1@dont-email.me> <2021Oct1.181119@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 1 Oct 2021 18:40:12 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="60e8bd2e6b520520d743fb6aa3de7367";
logging-data="23834"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Xtkm2nBwlIX+NTWWGBwqHxUtGHyzJm3c="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Cancel-Lock: sha1:efHvvg5YD1CSmGiOSfDnAJinrEk=
In-Reply-To: <2021Oct1.181119@mips.complang.tuwien.ac.at>
Content-Language: en-GB
 by: Gerry Jackson - Fri, 1 Oct 2021 18:40 UTC

On 01/10/2021 17:11, Anton Ertl wrote:
> Well, the interface that Gforth has is relatively simple: You switch
> to a section, and all ALLOTs then go into that section.
>

In my implementation of sections the interface includes HERE ALLOT ALIGN
C, , UNUSED (plus a few other words) that all operate on the current
section and not just dataspace - perhaps you do the same.

--
Gerry

Re: Sections formalization

<2021Oct2.073210@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!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: Sections formalization
Date: Sat, 02 Oct 2021 05:32:10 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 24
Message-ID: <2021Oct2.073210@mips.complang.tuwien.ac.at>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at> <sis0do$acl$1@dont-email.me> <2021Sep27.213201@mips.complang.tuwien.ac.at> <sj4i57$613$1@dont-email.me> <2021Oct1.181119@mips.complang.tuwien.ac.at> <sj7kmc$n8q$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="81cadf3233281a5051b93f8eb7f97336";
logging-data="6646"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YHNfUORD0ie80gg8NLnmz"
Cancel-Lock: sha1:LlgwWY4KsijDcQz+dZDFe6IdF/Q=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sat, 2 Oct 2021 05:32 UTC

Gerry Jackson <do-not-use@swldwa.uk> writes:
>On 01/10/2021 17:11, Anton Ertl wrote:
>> Well, the interface that Gforth has is relatively simple: You switch
>> to a section, and all ALLOTs then go into that section.
>>
>
>In my implementation of sections the interface includes HERE ALLOT ALIGN
>C, , UNUSED (plus a few other words) that all operate on the current
>section and not just dataspace - perhaps you do the same.

Yes, Gforth does the same:

unused . \ 7821090 ok
next-section unused . \ 2077250 ok
previous-section unused . \ 7821090 ok
' unused locals-headers . \ 15290 ok
unused . \ 7821090 ok

- 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: Sections formalization

<sjecsk$5vn$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Re: Sections formalization
Date: Mon, 4 Oct 2021 11:09:55 +0300
Organization: A noiseless patient Spider
Lines: 113
Message-ID: <sjecsk$5vn$1@dont-email.me>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sis0do$acl$1@dont-email.me> <2021Sep27.213201@mips.complang.tuwien.ac.at>
<sj4i57$613$1@dont-email.me> <2021Oct1.181119@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 4 Oct 2021 08:09:56 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="7efad9b728fdea35d416803065e000f7";
logging-data="6135"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UpvDXcSa5QFbylCrOdtJ9"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.1.2
Cancel-Lock: sha1:x52wOntF7aEPC2hi70/o3iKayXY=
In-Reply-To: <2021Oct1.181119@mips.complang.tuwien.ac.at>
Content-Language: en-US
 by: Ruvim - Mon, 4 Oct 2021 08:09 UTC

On 2021-10-01 19:11, Anton Ertl wrote:
> Ruvim <ruvim.pinka@gmail.com> writes:
>> On 2021-09-27 22:32, Anton Ertl wrote:
>>> More precisely, I should have written: Each section works like the
>>> dictionary in classical Forth (which has no separate code space, data
>>> space, name space etc.).
>>>
>>> A multi-section Forth system still has only has one dictionary,
>>> distributed across several sections.
> ...
>>> No temporary sections in Gforth, and the idea is not to have
>>> per-section wordlists (or per-wordlist sections), but to use sections
>>> to avoid branching around strings and quotations, and for storing
>>> locals names.
>>
>> Don't you free local names after using?
>
> Yes, Gforth frees the local names at the end of the colon definition.
> That's easy given that they are in a separate section. Actually
> that's pretty close to your idea of independently manageable
> wordlist-sections, whereas other sections in Gforth are much more
> intertwined (and therefore not independently manageable).
>
> Why use a section for locals rather than ALLOCATEd memory (which is
> what Gforth used earlier)? A section is part of the dictionary, and
> therefore ALLOT works as a matter of course, including checking for
> dictionary overflow. And creating a name calls ALLOT. With ALLOCATE
> we needed quite a bit of extra code for implementing ALLOT in the
> ALLOCATEd memory. Also, freeing the ALLOCATEd memory is more
> complicated, because we used one ALLOCATE per name.
>
>> Of course. I just think concerning possible compatibility, since these
>> general idea already implemented in several Forth systems, and it can be
>> useful for applications.
>
> Well, the interface that Gforth has is relatively simple: You switch
> to a section, and all ALLOTs then go into that section.

In Gforth, code generation also goes into that section.

But if a system separates code and data, code generation will not go
into that section, but remains in the original section.

I just don't see a common basis on this abstraction level.

>> So, a section having a single address range of memory, cannot play the
>> role of the dictionary in any Forth system.
>
> In mant Forth systems, the dictionary has only one section (of course
> we don't speak about sections in that case), so I wonder why you write
> that.

I wanted to say, the abstraction on the sections level seems too tight
to be compatible with all possible standard systems.

>
>> It seems, a portable API cannot be established for sections. What do you
>> think?
>
> I see no reason why not. Of course, it may turn out that the systems
> do something else with multiple address ranges, and their implementors
> may not see the need for an API like Gforth offers. This could be
> addressed by using different names for the different APIs. Of course,
> the question remains if any system beyond Gforth will implement the
> Gforth section API.

The sections that are *automatically* used for string literals,
quotations or other things, are an internal business of a Forth system.
A portable program should not directly manage these section, since the
program doesn't depend on whether the system uses them or not. In the
same way a program doesn't depend whether the system uses peephole
optimization, or not. Usually, a configuration for such features (if
any) is implementation-defined.

In principle, a portable configuration is possible too. Probably, it's
just not too much in demand.

One essential requirement for a portable configuration is that this
configuration should not depend on whether a feature being configured is
actually used by the system or not. Hence, the corresponding mechanism
should be able to skip unknown options.

Unlike configurations, when I talk about an API, I imagine a feature
that can be actually used by a program. I.e., if a program relies on the
feature, it cannot work without this feature.

Also, a portable API should be quite abstract to be compatible with any
allowed implementation of a standard system. E.g., if the standard
allows disjoint data space and code space, the API should not be
relevant to only the systems having joint data space and code space.

Concerning sections, a more appealing feature for programs is not just
to have separate parts in data space, but separate parts of dictionary
that can be used also to compile definitions. That is, creating a word
in one part doesn't change anything in other parts, and performing a
marker (or "forget") in one part doesn't change anything in other parts.

In Gforth this feature can be easy implemented via sections. But such a
part of the dictionary cannot be called "section", since in general case
it may consist of many sections internally.

So it seems this feature cannot be formalized only in terms of sections
in a portable manner.

--
Ruvim

Re: Sections formalization

<2021Oct4.183240@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!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: Sections formalization
Date: Mon, 04 Oct 2021 16:32:40 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 82
Message-ID: <2021Oct4.183240@mips.complang.tuwien.ac.at>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at> <sis0do$acl$1@dont-email.me> <2021Sep27.213201@mips.complang.tuwien.ac.at> <sj4i57$613$1@dont-email.me> <2021Oct1.181119@mips.complang.tuwien.ac.at> <sjecsk$5vn$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="39c5f5e74b5219b751c074a778ac9224";
logging-data="28223"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18tENBfQQiUt+aMYv5nYEtu"
Cancel-Lock: sha1:RGnuPZv5WV1relUasH7x9win0OM=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Mon, 4 Oct 2021 16:32 UTC

Ruvim <ruvim.pinka@gmail.com> writes:
>On 2021-10-01 19:11, Anton Ertl wrote:
>> Well, the interface that Gforth has is relatively simple: You switch
>> to a section, and all ALLOTs then go into that section.
>
>In Gforth, code generation also goes into that section.

The threaded code goes there, yes.

>But if a system separates code and data, code generation will not go
>into that section, but remains in the original section.

Why should it?

In Gforth the native code is in something that's not quite a section:
It consist of a sequence of fixed-size blocks and is therefore only
limited by total memory size. This works because we can insert a jump
to the next block if we run out of space in one block. And it's
somewhat complicated. A simpler solution would be to put the native
code for a section in another section, but then you could run of of
space in the native-code section.

For dealing with the native code of quotations there are many
different options, depending on other implementation details of the
system.

* E.g., a system could produce native code directly while compiling.
To separate code and data, the code could be generated in the next
section (from the header). Strings could be in a special strings
section, or back in the data section (no need to jump around the
string in the native code). To avoid jumping around quotations,
first-level quotations could be in the next section up from the first
native-code section (and so on).

* OTOH, a system that compiles to intermediate code that is only
compiled to native code later (e.g., to facilitate inlining) might
use sections for quotations at the intermediate level and strings,
and it might put the native code all in one section, because it can
compile the quotation before or after the word or quotation that
calls it, avoiding the need to jump around. But it might also keep
the intermediate code in one section and encode the jumps around
strings and quotations in a way that is optimized away when
generating the native code.

* Gforth has only one native code "section" (as described above, it's
not quite a section). But in the threaded code there is no jump
around a quotation (because the quotation is in a different section
on the threaded-code level), so Gforth doesn't compile a
threaded-code jump into the native code. Instead, it just compiles
a threaded-code dispatch, which means that the native code
corresponding to the next threaded-code primitive is executed, and
that native code is after the native code of the quotation. So on
the native-code level there is a jump, it's just not as expensive as
a jump on the threaded-code level.

>The sections that are *automatically* used for string literals,
>quotations or other things, are an internal business of a Forth system.

Yes. For now, Gforth sections are very much oriented towards out
internal needs, and are somewhat limited for other uses (e.g., better
don't try to compile colon definitions in named sections).

>Concerning sections, a more appealing feature for programs is not just
>to have separate parts in data space, but separate parts of dictionary
>that can be used also to compile definitions. That is, creating a word
>in one part doesn't change anything in other parts

Well, we are not far from that.

>and performing a
>marker (or "forget") in one part doesn't change anything in other parts.

Resetting to a specific point in time has always been a characteristic
of marker and forget, for better or for worse. These days, they are
just unneeded baggage IMO.

- 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: Sections formalization

<sjg9ou$1639$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!news.neodome.net!news.mixmin.net!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Sections formalization
Date: Tue, 5 Oct 2021 12:29:02 +1100
Organization: Aioe.org NNTP Server
Message-ID: <sjg9ou$1639$1@gioia.aioe.org>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sis0do$acl$1@dont-email.me> <2021Sep27.213201@mips.complang.tuwien.ac.at>
<sj4i57$613$1@dont-email.me> <2021Oct1.181119@mips.complang.tuwien.ac.at>
<sjecsk$5vn$1@dont-email.me> <2021Oct4.183240@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="39017"; 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
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Tue, 5 Oct 2021 01:29 UTC

On 5/10/2021 03:32, Anton Ertl wrote:
> Ruvim <ruvim.pinka@gmail.com> writes:
> ...
>>and performing a
>>marker (or "forget") in one part doesn't change anything in other parts.
>
> Resetting to a specific point in time has always been a characteristic
> of marker and forget, for better or for worse. These days, they are
> just unneeded baggage IMO.

EMPTY (a special case of FORGET/MARKER) precedes every application
I've written. In conjunction with a built-in editor it provides
for a fast compile/edit cycle.

Re: Sections formalization

<sjm7f3$gm4$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!news.neodome.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Re: Sections formalization
Date: Thu, 7 Oct 2021 10:26:24 +0300
Organization: A noiseless patient Spider
Lines: 134
Message-ID: <sjm7f3$gm4$1@dont-email.me>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sis0do$acl$1@dont-email.me> <2021Sep27.213201@mips.complang.tuwien.ac.at>
<sj4i57$613$1@dont-email.me> <2021Oct1.181119@mips.complang.tuwien.ac.at>
<sjecsk$5vn$1@dont-email.me> <2021Oct4.183240@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 7 Oct 2021 07:26:27 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="ca3293d87f28560a75becc0402fe280a";
logging-data="17092"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192kjU6LYjTxN+3Mz57hXK9"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.1.2
Cancel-Lock: sha1:fZsE88JZo7uVvPfpUfSxB1U+ph8=
In-Reply-To: <2021Oct4.183240@mips.complang.tuwien.ac.at>
Content-Language: en-US
 by: Ruvim - Thu, 7 Oct 2021 07:26 UTC

On 2021-10-04 19:32, Anton Ertl wrote:
> Ruvim <ruvim.pinka@gmail.com> writes:
>> On 2021-10-01 19:11, Anton Ertl wrote:
>>> Well, the interface that Gforth has is relatively simple: You switch
>>> to a section, and all ALLOTs then go into that section.
>>
>> In Gforth, code generation also goes into that section.
>
> The threaded code goes there, yes.
>
>> But if a system separates code and data, code generation will not go
>> into that section, but remains in the original section.
>
> Why should it?

Just to make sense for programs.

If code generation goes into the old section, then this feature does not
provide any substantially new capabilities to a *program*.

If both data and code generation go into the single new section, then
this way isn't compatible with some implementations, since it unites
data and code.

Actually, a capability to create a data section with a set of methods
like ",", "C,", "ALLOT", etc, can be useful for a program. Such a
section has the following advantages:
- it's completely separated from code generation;
- it provides a convenient way to build compound data objects;
- it allows to avoid allocating many small blocks in the heap;
- it allows to easy clear recently created objects in LIFO order;
- it allows to easy clear all objects (a whole section) at once;
- multiple sections can be used independently in the same time.
Thus, it's just a technique of memory management. I used this approach
in some applications.

One nuance is that this technique can be already implemented in a
portable way, as a reusable component.

So a more attractive option is to manage parts of dictionary that
include both code and data (and their mutual relation should remain
unspecified for compatibility with any implementation approach).

> In Gforth the native code is in something that's not quite a section:
> It consist of a sequence of fixed-size blocks and is therefore only
> limited by total memory size. This works because we can insert a jump
> to the next block if we run out of space in one block. And it's
> somewhat complicated. A simpler solution would be to put the native
> code for a section in another section, but then you could run of of
> space in the native-code section.

The problem of preset limited size is not so critical if a program/user
can configure initial size or create new sections of required size.

>
> For dealing with the native code of quotations there are many
> different options, depending on other implementation details of the
> system.

Yes, but it's another problem. It's a problem of internal
implementation. Internal things don't need to be formalized and
available for programs.

>
> * E.g., a system could produce native code directly while compiling.
> To separate code and data, the code could be generated in the next
> section (from the header). Strings could be in a special strings
> section, or back in the data section (no need to jump around the
> string in the native code). To avoid jumping around quotations,
> first-level quotations could be in the next section up from the first
> native-code section (and so on).
>
> * OTOH, a system that compiles to intermediate code that is only
> compiled to native code later (e.g., to facilitate inlining) might
> use sections for quotations at the intermediate level and strings,
> and it might put the native code all in one section, because it can
> compile the quotation before or after the word or quotation that
> calls it, avoiding the need to jump around. But it might also keep
> the intermediate code in one section and encode the jumps around
> strings and quotations in a way that is optimized away when
> generating the native code.
>
> * Gforth has only one native code "section" (as described above, it's
> not quite a section). But in the threaded code there is no jump
> around a quotation (because the quotation is in a different section
> on the threaded-code level), so Gforth doesn't compile a
> threaded-code jump into the native code. Instead, it just compiles
> a threaded-code dispatch, which means that the native code
> corresponding to the next threaded-code primitive is executed, and
> that native code is after the native code of the quotation. So on
> the native-code level there is a jump, it's just not as expensive as
> a jump on the threaded-code level.
>

>> The sections that are *automatically* used for string literals,
>> quotations or other things, are an internal business of a Forth system.
>
> Yes. For now, Gforth sections are very much oriented towards out
> internal needs, and are somewhat limited for other uses (e.g., better
> don't try to compile colon definitions in named sections).
>
>> Concerning sections, a more appealing feature for programs is not just
>> to have separate parts in data space, but separate parts of dictionary
>> that can be used also to compile definitions. That is, creating a word
>> in one part doesn't change anything in other parts
>
> Well, we are not far from that.
>
>> and performing a
>> marker (or "forget") in one part doesn't change anything in other parts.
>
> Resetting to a specific point in time has always been a characteristic
> of marker and forget, for better or for worse. These days, they are
> just unneeded baggage IMO.

I mention "marker" and "forget" as methods to clear/reset a part of the
dictionary. So if you don't have a method to free/destroy such a part,
you can at least clear the part by the standard means to reuse it. Of
course, a dedicated method to just clear a whole part can be introduced
as well as a method to free it.

--
Ruvim

Re: Sections formalization

<2021Oct7.121707@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!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: Sections formalization
Date: Thu, 07 Oct 2021 10:17:07 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 38
Message-ID: <2021Oct7.121707@mips.complang.tuwien.ac.at>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at> <sis0do$acl$1@dont-email.me> <2021Sep27.213201@mips.complang.tuwien.ac.at> <sj4i57$613$1@dont-email.me> <2021Oct1.181119@mips.complang.tuwien.ac.at> <sjecsk$5vn$1@dont-email.me> <2021Oct4.183240@mips.complang.tuwien.ac.at> <sjm7f3$gm4$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="aa157d3a970bd3e64c2f65957f8e8801";
logging-data="19622"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qM2pCGjLN0WrbbKhsOSE7"
Cancel-Lock: sha1:bZ5TR+yHYgfRkNPF9yRag9yrfEw=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Thu, 7 Oct 2021 10:17 UTC

Ruvim <ruvim.pinka@gmail.com> writes:
>On 2021-10-04 19:32, Anton Ertl wrote:
>> Ruvim <ruvim.pinka@gmail.com> writes:
>>> On 2021-10-01 19:11, Anton Ertl wrote:
>>>> Well, the interface that Gforth has is relatively simple: You switch
>>>> to a section, and all ALLOTs then go into that section.
>>>
>>> In Gforth, code generation also goes into that section.
>>
>> The threaded code goes there, yes.
>>
>>> But if a system separates code and data, code generation will not go
>>> into that section, but remains in the original section.
>>
>> Why should it?
>
>Just to make sense for programs.

"Not go into that section" makes sense, but "remains in the original
section" does not.

>So a more attractive option is to manage parts of dictionary that
>include both code and data (and their mutual relation should remain
>unspecified for compatibility with any implementation approach).

Their relation is partially specified, resulting in restrictions on
programs: No ALLOT (and friends) while compiling a colon defition,
creating a definition ends a contiguous region.

The relevance of a standardized sections wordset (aka API) would be to
get around such restrictions.

- 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: Sections formalization

<sjmlcn$74f$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!news.neodome.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ruvim.pi...@gmail.com (Ruvim)
Newsgroups: comp.lang.forth
Subject: Re: Sections formalization
Date: Thu, 7 Oct 2021 14:24:05 +0300
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <sjmlcn$74f$1@dont-email.me>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at>
<sis0do$acl$1@dont-email.me> <2021Sep27.213201@mips.complang.tuwien.ac.at>
<sj4i57$613$1@dont-email.me> <2021Oct1.181119@mips.complang.tuwien.ac.at>
<sjecsk$5vn$1@dont-email.me> <2021Oct4.183240@mips.complang.tuwien.ac.at>
<sjm7f3$gm4$1@dont-email.me> <2021Oct7.121707@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 7 Oct 2021 11:24:07 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="ca3293d87f28560a75becc0402fe280a";
logging-data="7311"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JFD31Rg+CCOlMTymvQIAc"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.1.2
Cancel-Lock: sha1:yBsnLcNKmZesCQY4W6PY8qKtV9E=
In-Reply-To: <2021Oct7.121707@mips.complang.tuwien.ac.at>
Content-Language: en-US
 by: Ruvim - Thu, 7 Oct 2021 11:24 UTC

On 2021-10-07 13:17, Anton Ertl wrote:
> Ruvim <ruvim.pinka@gmail.com> writes:
>> On 2021-10-04 19:32, Anton Ertl wrote:
>>> Ruvim <ruvim.pinka@gmail.com> writes:
>>>> On 2021-10-01 19:11, Anton Ertl wrote:
>>>>> Well, the interface that Gforth has is relatively simple: You switch
>>>>> to a section, and all ALLOTs then go into that section.
>>>>
>>>> In Gforth, code generation also goes into that section.
>>>
>>> The threaded code goes there, yes.
>>>
>>>> But if a system separates code and data, code generation will not go
>>>> into that section, but remains in the original section.
>>>
>>> Why should it?
>>
>> Just to make sense for programs.
>
> "Not go into that section" makes sense,
> but "remains in the original section" does not.

Yes, I meant that too.

>> So a more attractive option is to manage parts of dictionary that
>> include both code and data (and their mutual relation should remain
>> unspecified for compatibility with any implementation approach).
>
> Their relation is partially specified, resulting in restrictions on
> programs: No ALLOT (and friends) while compiling a colon defition,
> creating a definition ends a contiguous region.

Well, the *possible* options are specified. But what particular option
is used — it is unknown. Therefore, it restricts programs, and relaxes
implementations.

>
> The relevance of a standardized sections wordset (aka API) would be to
> get around such restrictions.

It's not easy, if possible at all. A library or extension can provide
defining words (or redefine some standard words) that uses data space. E.g.:

: variable ( "name" -- ) align here >r 0 , : r> lit, postpone ; ;

and now data space (the current data space section) is used when a
variable is created.

If you want to guarantee that the current section of data space is not
touched when a word is created (or a file is included), it would be too
restrictive for programs and libraries.

When a definition is created, both the current section of data space and
the current section of code space can be always used. It's their primary
function. No sense to avoid it.

--
Ruvim

Re: Sections formalization

<2021Oct7.165425@mips.complang.tuwien.ac.at>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: rocksolid2!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: Sections formalization
Date: Thu, 07 Oct 2021 14:54:25 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 35
Message-ID: <2021Oct7.165425@mips.complang.tuwien.ac.at>
References: <2021Aug6.095019@mips.complang.tuwien.ac.at> <sis0do$acl$1@dont-email.me> <2021Sep27.213201@mips.complang.tuwien.ac.at> <sj4i57$613$1@dont-email.me> <2021Oct1.181119@mips.complang.tuwien.ac.at> <sjecsk$5vn$1@dont-email.me> <2021Oct4.183240@mips.complang.tuwien.ac.at> <sjm7f3$gm4$1@dont-email.me> <2021Oct7.121707@mips.complang.tuwien.ac.at> <sjmlcn$74f$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="aa157d3a970bd3e64c2f65957f8e8801";
logging-data="27267"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1828g6sRABowhOH0FJ+vgFO"
Cancel-Lock: sha1:4sLyytU88tIKOxb0mh1/HIkh4g8=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Thu, 7 Oct 2021 14:54 UTC

Ruvim <ruvim.pinka@gmail.com> writes:
>On 2021-10-07 13:17, Anton Ertl wrote:
>> The relevance of a standardized sections wordset (aka API) would be to
>> get around such restrictions.
>
>It's not easy, if possible at all. A library or extension can provide
>defining words (or redefine some standard words) that uses data space. E.g.:
>
> : variable ( "name" -- ) align here >r 0 , : r> lit, postpone ; ;
>
>and now data space (the current data space section) is used when a
>variable is created.

Yes, but point is that it is in the current section. Other sections
are unaffected.

Therefore I can do

create foo 5 ,
next-section variable bar previous-section bar ,
6 ,

and get a contiguous region starting at the body of FOO, containing 5,
BAR, and 6.

I can also define your VARIABLE above a little differently:

: variable : next-section here 0 , previous-section lit, postpone ; ;

- 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

Pages:123
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor