Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Delta: The kids will love our inflatable slides. -- David Letterman


devel / comp.arch / Re: Any comments on:

SubjectAuthor
* Any comments on:MitchAlsup
+- Re: Any comments on:Ivan Godard
+- Re: Any comments on:Thomas Koenig
+* Re: Any comments on:Niklas Holsti
|+* Re: Any comments on:Tim Rentsch
||`* Re: Any comments on:Michael S
|| `- Re: Any comments on:Tim Rentsch
|`* Re: Any comments on:Michael S
| `- Re: Any comments on:Ivan Godard
+- Re: Any comments on:Tim Rentsch
`* Re: Any comments on:Marcus
 `* Re: Any comments on:BGB
  +* Re: Any comments on:MitchAlsup
  |+* Re: Any comments on:Ivan Godard
  ||`- Re: Any comments on:MitchAlsup
  |`* Re: Any comments on:BGB
  | `* Re: Any comments on:Ivan Godard
  |  `- Re: Any comments on:BGB
  +* Re: Any comments on:Stephen Fuld
  |+* Re: Any comments on:Ivan Godard
  ||+* Re: Any comments on:Stephen Fuld
  |||`- Re: Any comments on:Thomas Koenig
  ||`* Re: Any comments on:Thomas Koenig
  || `* Re: Any comments on:David Brown
  ||  +- Re: Any comments on:BGB
  ||  `* Re: Any comments on:Thomas Koenig
  ||   `* Re: Any comments on:David Brown
  ||    `- Re: Any comments on:BGB
  |+* Re: Any comments on:BGB
  ||`* Re: Any comments on:Stephen Fuld
  || `* Re: Any comments on:BGB
  ||  `* Re: Any comments on:Stephen Fuld
  ||   `* Re: Any comments on:BGB
  ||    `- Re: Any comments on:MitchAlsup
  |`* Re: Any comments on:Tim Rentsch
  | `* Re: Any comments on:BGB
  |  `- Re: Any comments on:Tim Rentsch
  +* Re: Any comments on:Niklas Holsti
  |`* Re: Any comments on:MitchAlsup
  | `- Re: Any comments on:Niklas Holsti
  `- Re: Any comments on:Timothy McCaffrey

Pages:12
Re: Any comments on:

<t09nr1$mhd$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24086&group=comp.arch#24086

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Wed, 9 Mar 2022 02:17:31 -0600
Organization: A noiseless patient Spider
Lines: 148
Message-ID: <t09nr1$mhd$1@dont-email.me>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
<t09722$d7f$1@dont-email.me> <t09bl8$5hf$1@dont-email.me>
<t09clp$b1m$1@dont-email.me> <t09gqn$2u0$1@dont-email.me>
<t09l11$18n$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 9 Mar 2022 08:17:37 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="8df13030d16cd666421288ad29864a11";
logging-data="23085"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19s8ckivyQAkb05f4L+D/N0"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.6.1
Cancel-Lock: sha1:qe2rX+G+8xiMVpQU0yHWJtAeJrU=
In-Reply-To: <t09l11$18n$1@dont-email.me>
Content-Language: en-US
 by: BGB - Wed, 9 Mar 2022 08:17 UTC

On 3/9/2022 1:29 AM, Stephen Fuld wrote:
> On 3/8/2022 10:17 PM, BGB wrote:
>> On 3/8/2022 11:07 PM, Stephen Fuld wrote:
>>> On 3/8/2022 8:49 PM, BGB wrote:
>>>> On 3/8/2022 9:31 PM, Stephen Fuld wrote:
>>>>> On 3/8/2022 1:54 PM, BGB wrote:
>>>>>
>>>>> snip
>>>>>
>>>>>>
>>>>>> initial {
>>>>>>    //block runs at program start-up (1)
>>>>>> }
>>>>>>
>>>>>> *1: Program startup sequence being:
>>>>>>    Load / Zero ".bss" / ...
>>>>>>    Initialize language runtime stuff;
>>>>>>    Initialize all the globals which require dynamic init;
>>>>>>    Run any 'initial' blocks in the program;
>>>>>>    Transfer control to "main()".
>>>>>>
>>>>>
>>>>> How is this different from or better than just putting whatever is
>>>>> in the "initial" block at the start of main (), like programmers
>>>>> have been doing for decades?
>>>>>
>>>>
>>>> The person writing "main()" does not need to put in calls to the
>>>> "Init()" functions, they don't even need to know they exist.
>>>>
>>>> They can also rely on the init logic having run, rather than having
>>>> to add "check and init" code that would otherwise be needed to deal
>>>> with code where the user is not expected to call some "Init()"
>>>> functions in advance (but, then one is potentially wasting time at
>>>> runtime by checking whether or not the library code has already been
>>>> initialized).
>>>>
>>>>
>>>> The actual implementation overhead wouldn't be that large as the
>>>> compiler may already need to do something like this to perform some
>>>> non-trivial global variable initialization. This is because programs
>>>> can sometimes initialize global variables with expressions that are
>>>> not really able to be evaluated at compile time.
>>>
>>> I am used to compilers that automatically add code to the start of
>>> the main program to do the "standard" stuff like initializing any
>>> language runtime stuff, and presumably any complex global
>>> initialization, so that argument goes away.  Do today's compilers not
>>> do that?
>>>
>>>
>>
>> Usually, IME, it is something like:
>> First, loader loads the binary, ...
>> Entry point points to a function with a name like '__start' or
>> similar, loader jumps to this address;
>> This does some very basic setup, and then zeroes '.bss' and similar;
>> The __start function does basic stuff to initialize the C library,
>> such as setting up malloc, setting up stdin/stdout, ...
>> May also do other things, like splitting up the argument list and
>> environment variables;
>> It may call another function, such as '__init' (or '__init_array') or
>> similar, which may call other functions from a list built at link time;
>> After all this, __start() calls main();
>> If main() returns, __start() calls _exit() or similar.
>>
>>
>> When compiling a program, compiler might do something like:
>>    int foo_global;  //no initalizer, put it in '.bss'
>>    int bar_global=3*5;  //simple constant, put it in '.data'
>>    int baz_global=&bar_global-&foo_global;   //oh no
>>
>> In some great wisdom, the compilers are expected to accept expressions
>> like the latter, and "make it work", but there is a problem here:
>> We don't necessarily know the answer when first compiling the program,
>> and it may not be known at link time either.
>>
>> So, the compiler may generate a small function whose sole purpose is
>> to calculate the value during program startup, and store it to the
>> variable. During linking, the linker may put a pointer to this
>> function in an linker-generated array named something like
>> "__init_array_start" or "__preinit_array_start" or similar.
>>
>> These are also apparently used for initializing various stuff in C++
>> and similar as well.
>
> That all makes sense.
>
>
>
>>
>> ...
>>
>>
>>
>> In this case, something like:
>>    initial {
>>       ... stuff ...
>>    }
>>
>> Would basically get transformed into a function like:
>>    void __init_ab69c1234()  //basically, a "gensym'ed" name
>>    {
>>       ... stuff ...
>>    }
>>
>> Which would also be added to "__init_array_start" by the linker.
>>
>
> So, let me get back to my original question.  Why do you need this
> separate "Initialize" block, when the compiler automatically does some
> of the work, and the programmer can simply put whatever else would be
> done in that block as the first few statements in "main"?  the "Initial"
> statement just seems to me to be extra syntax that accomplishes nothing.
>

Because:
Forcing people who use a library to first be like: "SomeLib_Init();"
kinda sucks from an API design POV;
The main alternative, namely checking and auto-initializing when the
user calls into API functions, wastes clock cycles;
If one is designing a new language, these sorts of syntax sugar don't
cost much if one will already have the underlying mechanism anyways.

Granted, one could have reason to avoid adding more keywords.
For example, Java did more or less the same thing with:
static {
... init-time stuff ...
}

Likewise, 'always' could be renamed as well, say:
abstract if(cc) { ... do stuff ... }

say, in a hypothetical language:
public class Foo {
private int x, y;
...
abstract if(x>y) {
int t;
printf("%d > %d\n", x, y);
t=x; x=y; y=t;
}
}

Where the conditional block is checked every time x or y is modified
(regardless of where this modification takes place).

Re: Any comments on:

<j8rd1jFj244U1@mid.individual.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24088&group=comp.arch#24088

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.h...@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Wed, 9 Mar 2022 12:15:14 +0200
Organization: Tidorum Ltd
Lines: 108
Message-ID: <j8rd1jFj244U1@mid.individual.net>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net hYugsyJFhB/1d9qnvdPvFgik7JDh4PQOO8KPRNZM76npjnqxK8
Cancel-Lock: sha1:RlOgaIS4PZnBqdy8KGpyrknnmOw=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0)
Gecko/20100101 Thunderbird/91.6.2
Content-Language: en-US
In-Reply-To: <t08jat$atu$1@dont-email.me>
 by: Niklas Holsti - Wed, 9 Mar 2022 10:15 UTC

(Advance apologies: this is a bit of Ada evangelism, hopefully not too
annoying.)

On 2022-03-08 23:54, BGB wrote:

[ discussion of OOP and various languages ]

> Ideally, we need a language design which can do adequately at both. It
> could rope off class/instance objects into their own category, while
> still being friendly to an efficient bare-metal implementation (and
> allowing all the usual C level stuff).

Ada comes to mind as having met those requirements (and others).

> It is possible that crossing the line between the class/instance system
> and bare memory could be allowed, but within the confine of "there be
> dragons here".

Ada mostly requires using something called "Unchecked_<Xxx>" as a
dragon-warning.

> For bonus points, could also be cool to see a few features from Verilog,
> such as exact bit-width values the ability to compose and decompose bit
> vectors, ...

Ada has some of that, but certainly not all.

> Someone could maybe also get extra wacky and borrow concepts like
> 'always' and 'initial' blocks.
>
> always(cc) {
>   //triggers whenever cc becomes true
>   //does not depend on sequential control flow
> }

Could be done with an event-triggered Ada task. But someone would have
to signal the event when "cc" becomes true, so not really implemented,
as such, in Ada.

> initial {
>   //block runs at program start-up (1)
> }
>
> *1: Program startup sequence being:
>   Load / Zero ".bss" / ...
>   Initialize language runtime stuff;
>   Initialize all the globals which require dynamic init;
>   Run any 'initial' blocks in the program;
>   Transfer control to "main()".

This is called "library-level elaboration" in Ada. Any Ada package can
have such an "initial" block at its end. The compiler generates calls to
these blocks, in a valid order per the define-use relations, before
entering the main subprogram.

> I guess one other question could be if one could add asynchronous and
> event-driven abstractions to a language which play nicer with multiple
> cores than do more traditional approaches to multithreading (eg:
> explicit thread creation).

[snip]

> One idea could be that we don't so much "call" into synchronized methods
> directly, but rather that they queue up and put the caller on standby.
> When the method call is handled (possibly in a different thread from the
> caller), it then wakes the caller, which may resume execution in its own
> thread.

Sounds a bit like Ada rendez-vous, but I don't fully understand what is
being proposed.

> Maybe also have async blocks which could have a condition for when they
> trigger:
>   async(cc) { ... }
>
> But, which differs slightly in that control needs to reach the block
> before it is created, and that its execution is one-off (once 'cc' is
> true, the block executes once, or at least once for each time control
> passes over the declaration of the async block).

This resembles an Ada "select" statement that contains
ccondition-guarded "accept entry" statements. But again, someone would
have to be calling those entries for them to be executed when the guard
becomes true, so the various threads implied in the suggestion have to
be made explicit in Ada.

> Granted, all of this would add a bit of complexity to a compiler.

Yes. Ada mitigates that by requiring the threads (tasks) to be made
explicit.

Re: Any comments on:

<ec446ab6-f817-4ba3-8abe-64755ea2167fn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24100&group=comp.arch#24100

 copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:2981:b0:649:68a4:e4ea with SMTP id r1-20020a05620a298100b0064968a4e4eamr555629qkp.462.1646848495234;
Wed, 09 Mar 2022 09:54:55 -0800 (PST)
X-Received: by 2002:a9d:6e89:0:b0:5b2:4c01:2210 with SMTP id
a9-20020a9d6e89000000b005b24c012210mr490138otr.85.1646848494501; Wed, 09 Mar
2022 09:54:54 -0800 (PST)
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.arch
Date: Wed, 9 Mar 2022 09:54:54 -0800 (PST)
In-Reply-To: <t09nr1$mhd$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:bcfe:c7b0:9f9e:9c9d;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:bcfe:c7b0:9f9e:9c9d
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me> <t09722$d7f$1@dont-email.me>
<t09bl8$5hf$1@dont-email.me> <t09clp$b1m$1@dont-email.me> <t09gqn$2u0$1@dont-email.me>
<t09l11$18n$1@dont-email.me> <t09nr1$mhd$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ec446ab6-f817-4ba3-8abe-64755ea2167fn@googlegroups.com>
Subject: Re: Any comments on:
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Wed, 09 Mar 2022 17:54:55 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 161
 by: MitchAlsup - Wed, 9 Mar 2022 17:54 UTC

On Wednesday, March 9, 2022 at 2:17:40 AM UTC-6, BGB wrote:
> On 3/9/2022 1:29 AM, Stephen Fuld wrote:
> > On 3/8/2022 10:17 PM, BGB wrote:
> >> On 3/8/2022 11:07 PM, Stephen Fuld wrote:
> >>> On 3/8/2022 8:49 PM, BGB wrote:
> >>>> On 3/8/2022 9:31 PM, Stephen Fuld wrote:
> >>>>> On 3/8/2022 1:54 PM, BGB wrote:
> >>>>>
> >>>>> snip
> >>>>>
> >>>>>>
> >>>>>> initial {
> >>>>>> //block runs at program start-up (1)
> >>>>>> }
> >>>>>>
> >>>>>> *1: Program startup sequence being:
> >>>>>> Load / Zero ".bss" / ...
> >>>>>> Initialize language runtime stuff;
> >>>>>> Initialize all the globals which require dynamic init;
> >>>>>> Run any 'initial' blocks in the program;
> >>>>>> Transfer control to "main()".
> >>>>>>
> >>>>>
> >>>>> How is this different from or better than just putting whatever is
> >>>>> in the "initial" block at the start of main (), like programmers
> >>>>> have been doing for decades?
> >>>>>
> >>>>
> >>>> The person writing "main()" does not need to put in calls to the
> >>>> "Init()" functions, they don't even need to know they exist.
> >>>>
> >>>> They can also rely on the init logic having run, rather than having
> >>>> to add "check and init" code that would otherwise be needed to deal
> >>>> with code where the user is not expected to call some "Init()"
> >>>> functions in advance (but, then one is potentially wasting time at
> >>>> runtime by checking whether or not the library code has already been
> >>>> initialized).
> >>>>
> >>>>
> >>>> The actual implementation overhead wouldn't be that large as the
> >>>> compiler may already need to do something like this to perform some
> >>>> non-trivial global variable initialization. This is because programs
> >>>> can sometimes initialize global variables with expressions that are
> >>>> not really able to be evaluated at compile time.
> >>>
> >>> I am used to compilers that automatically add code to the start of
> >>> the main program to do the "standard" stuff like initializing any
> >>> language runtime stuff, and presumably any complex global
> >>> initialization, so that argument goes away. Do today's compilers not
> >>> do that?
> >>>
> >>>
> >>
> >> Usually, IME, it is something like:
> >> First, loader loads the binary, ...
> >> Entry point points to a function with a name like '__start' or
> >> similar, loader jumps to this address;
> >> This does some very basic setup, and then zeroes '.bss' and similar;
> >> The __start function does basic stuff to initialize the C library,
> >> such as setting up malloc, setting up stdin/stdout, ...
> >> May also do other things, like splitting up the argument list and
> >> environment variables;
> >> It may call another function, such as '__init' (or '__init_array') or
> >> similar, which may call other functions from a list built at link time;
> >> After all this, __start() calls main();
> >> If main() returns, __start() calls _exit() or similar.
> >>
> >>
> >> When compiling a program, compiler might do something like:
> >> int foo_global; //no initalizer, put it in '.bss'
> >> int bar_global=3*5; //simple constant, put it in '.data'
> >> int baz_global=&bar_global-&foo_global; //oh no
> >>
> >> In some great wisdom, the compilers are expected to accept expressions
> >> like the latter, and "make it work", but there is a problem here:
> >> We don't necessarily know the answer when first compiling the program,
> >> and it may not be known at link time either.
> >>
> >> So, the compiler may generate a small function whose sole purpose is
> >> to calculate the value during program startup, and store it to the
> >> variable. During linking, the linker may put a pointer to this
> >> function in an linker-generated array named something like
> >> "__init_array_start" or "__preinit_array_start" or similar.
> >>
> >> These are also apparently used for initializing various stuff in C++
> >> and similar as well.
> >
> > That all makes sense.
> >
> >
> >
> >>
> >> ...
> >>
> >>
> >>
> >> In this case, something like:
> >> initial {
> >> ... stuff ...
> >> }
> >>
> >> Would basically get transformed into a function like:
> >> void __init_ab69c1234() //basically, a "gensym'ed" name
> >> {
> >> ... stuff ...
> >> }
> >>
> >> Which would also be added to "__init_array_start" by the linker.
> >>
> >
> > So, let me get back to my original question. Why do you need this
> > separate "Initialize" block, when the compiler automatically does some
> > of the work, and the programmer can simply put whatever else would be
> > done in that block as the first few statements in "main"? the "Initial"
> > statement just seems to me to be extra syntax that accomplishes nothing.
> >
> Because:
> Forcing people who use a library to first be like: "SomeLib_Init();"
> kinda sucks from an API design POV;
<
Then every entry point in the library has:
returnType x function( argument list )
{ if( non_initialized ) SomeLib_Init();
....
} <
> The main alternative, namely checking and auto-initializing when the
> user calls into API functions, wastes clock cycles;
<
It does not take the branch predictor long to figure out that the function
is called but once.
<
> If one is designing a new language, these sorts of syntax sugar don't
> cost much if one will already have the underlying mechanism anyways.
>
Note: I am not arguing against your proposal; but perhaps your syntactic
sugar would be to have the compiler recognize the if.._Init(); phrase.
>
> Granted, one could have reason to avoid adding more keywords.
> For example, Java did more or less the same thing with:
> static {
> ... init-time stuff ...
> }
>
> Likewise, 'always' could be renamed as well, say:
> abstract if(cc) { ... do stuff ... }
>
>
> say, in a hypothetical language:
> public class Foo {
> private int x, y;
> ...
> abstract if(x>y) {
> int t;
> printf("%d > %d\n", x, y);
> t=x; x=y; y=t;
> }
> }
>
> Where the conditional block is checked every time x or y is modified
> (regardless of where this modification takes place).

Re: Any comments on:

<86wnh2ddz6.fsf@linuxsc.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24110&group=comp.arch#24110

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Wed, 09 Mar 2022 13:15:41 -0800
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <86wnh2ddz6.fsf@linuxsc.com>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com> <t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me> <t09722$d7f$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="1412bf34eca16359aaf8eff3827b9264";
logging-data="29955"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LW8NFcqUIoqclewbFBdFtd5GhmaYt5cI="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:DgZE3DAna+RKMNdRfh8jX4MUa5Q=
sha1:rv/d5K1yyKoyfGLfhHYDUVFDGCw=
 by: Tim Rentsch - Wed, 9 Mar 2022 21:15 UTC

Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:

> On 3/8/2022 1:54 PM, BGB wrote:
>
> snip
>
>> initial {
>> //block runs at program start-up (1)
>> }
>>
>> *1: Program startup sequence being:
>> Load / Zero ".bss" / ...
>> Initialize language runtime stuff;
>> Initialize all the globals which require dynamic init;
>> Run any 'initial' blocks in the program;
>> Transfer control to "main()".
>
> How is this different from or better than just putting whatever is
> in the "initial" block at the start of main (), like programmers
> have been doing for decades?

Putting calls in main(), we get to choose the order in which the
blocks are run, but the function names (assuming they are in
other translation units) have to be global so they can be called.

With initial blocks, the initial blocks don't have any names
(except of course there may be some linker magic so that they
call can be called), but there is no way to choose a specific
order in which the initial blocks are run.

To me "initial blocks" seem like a needless complication. Better
just to use explicit calls in main().

Re: Any comments on:

<t0bdlt$v32$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24114&group=comp.arch#24114

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Wed, 9 Mar 2022 17:36:24 -0600
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <t0bdlt$v32$1@dont-email.me>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
<t09722$d7f$1@dont-email.me> <86wnh2ddz6.fsf@linuxsc.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 9 Mar 2022 23:36:29 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="ee42f2d046a766e1e323b9bf0d816cc9";
logging-data="31842"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+a6tg58Ps28OgyZZyz40Wz"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.6.1
Cancel-Lock: sha1:ccqzaje8TYcW+umoNcJxHj3/ahU=
In-Reply-To: <86wnh2ddz6.fsf@linuxsc.com>
Content-Language: en-US
 by: BGB - Wed, 9 Mar 2022 23:36 UTC

On 3/9/2022 3:15 PM, Tim Rentsch wrote:
> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:
>
>> On 3/8/2022 1:54 PM, BGB wrote:
>>
>> snip
>>
>>> initial {
>>> //block runs at program start-up (1)
>>> }
>>>
>>> *1: Program startup sequence being:
>>> Load / Zero ".bss" / ...
>>> Initialize language runtime stuff;
>>> Initialize all the globals which require dynamic init;
>>> Run any 'initial' blocks in the program;
>>> Transfer control to "main()".
>>
>> How is this different from or better than just putting whatever is
>> in the "initial" block at the start of main (), like programmers
>> have been doing for decades?
>
> Putting calls in main(), we get to choose the order in which the
> blocks are run, but the function names (assuming they are in
> other translation units) have to be global so they can be called.
>
> With initial blocks, the initial blocks don't have any names
> (except of course there may be some linker magic so that they
> call can be called), but there is no way to choose a specific
> order in which the initial blocks are run.
>
> To me "initial blocks" seem like a needless complication. Better
> just to use explicit calls in main().

Yeah, I guess ordering is a potential drawback.

As well, if something is initialized but then never used (wasting time
and resources), or one ends up needing to manually initialize more stuff
later due to a more needing a more involved or expensive initialization
process (partly defeating the original purpose, *).

Its main use case then would be things like "calculate stuff and fill
these tables of numbers" or similar.

*: For example, while simple things can be handled, a more complex
process might not fit or be unworkable. For example, simply linking
against a graphics library and then having it create the display window
on its own is probably not ideal from a library design POV (normally,
the application will in some way request the creation of a display
window, ...).

It could end up like things like exceptions, which have some use-cases
but if not used correctly can become a major annoyance.

I later thought about it, and also adding more keywords is probably not
ideal. For example, Java did more or less the same thing while reusing
the 'static' keyword.

....

Re: Any comments on:

<30bdbad1-c201-4060-badd-b73aa556b472n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24115&group=comp.arch#24115

 copy link   Newsgroups: comp.arch
X-Received: by 2002:ac8:5d8b:0:b0:2dd:d1a3:8f61 with SMTP id d11-20020ac85d8b000000b002ddd1a38f61mr1880216qtx.290.1646869763064;
Wed, 09 Mar 2022 15:49:23 -0800 (PST)
X-Received: by 2002:a05:6870:5829:b0:c8:9f42:f919 with SMTP id
r41-20020a056870582900b000c89f42f919mr1218978oap.54.1646869762430; Wed, 09
Mar 2022 15:49:22 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border1.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.arch
Date: Wed, 9 Mar 2022 15:49:22 -0800 (PST)
In-Reply-To: <j8rd1jFj244U1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:bcfe:c7b0:9f9e:9c9d;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:bcfe:c7b0:9f9e:9c9d
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me> <j8rd1jFj244U1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <30bdbad1-c201-4060-badd-b73aa556b472n@googlegroups.com>
Subject: Re: Any comments on:
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Wed, 09 Mar 2022 23:49:22 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 6
 by: MitchAlsup - Wed, 9 Mar 2022 23:49 UTC

On Wednesday, March 9, 2022 at 4:15:20 AM UTC-6, Niklas Holsti wrote:
<snip>
Is it possible for a single ADA application to span Guest OSs ?
<
For example, part of the ADA application understands how to talk to
Linux NIC, while the rest of the ADA application talks to Windows File
System for the protection of NTFS ?

Re: Any comments on:

<j8trafF2tvcU1@mid.individual.net>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24124&group=comp.arch#24124

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.h...@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Thu, 10 Mar 2022 10:31:11 +0200
Organization: Tidorum Ltd
Lines: 35
Message-ID: <j8trafF2tvcU1@mid.individual.net>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
<j8rd1jFj244U1@mid.individual.net>
<30bdbad1-c201-4060-badd-b73aa556b472n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net czFYs03b27dR6OVlM0LR0wILqztjOitkelm+GBkonbWiaUCBJF
Cancel-Lock: sha1:zpOCr/cbc6WrWboqZW+F0D9pxQY=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0)
Gecko/20100101 Thunderbird/91.6.2
Content-Language: en-US
In-Reply-To: <30bdbad1-c201-4060-badd-b73aa556b472n@googlegroups.com>
 by: Niklas Holsti - Thu, 10 Mar 2022 08:31 UTC

On 2022-03-10 1:49, MitchAlsup wrote:
> On Wednesday, March 9, 2022 at 4:15:20 AM UTC-6, Niklas Holsti wrote:
> <snip>
> Is it possible for a single ADA application to span Guest OSs ?
> <
> For example, part of the ADA application understands how to talk to
> Linux NIC, while the rest of the ADA application talks to Windows File
> System for the protection of NTFS ?

I'm not sure that I understand the question, but it seems to me that it
is mostly independent of the programming language. So you could ask the
same thing about a C application, a C++ application, a Java application,
etc.

There are some Ada applications that use the XtratuM hypervisor where
different XtratuM "partitions" use different "Guest OSs" (for example,
VxWorks, RTEMS, bare-machine Ada RTS), with the application consisting
of one program in each partition, communicating through the XtratuM
inter-partition channels. But that is just an approach to time-and-space
partitioning, and the program in a partition can be written in any
supported language, with possibly different languages in different
partitions.

Similarly, in a system with several Guest OSs an application, in Ada or
any other language, could be divided into several programs, each running
in a different Guest OS and communicating through a shared file system,
shared memory, local network-like connections, or any other means
provided by the Host OS.

Are you asking if a single Ada program can use the services of several
Guest OSs without itself running "on" any specific Guest OS? I suppose
one could make an Ada run-time system in which different tasks could
execute in different Guest OSs, but inter-task communication could
become difficult, and I don't really see the benefit.

Re: Any comments on:

<8635jpdbm5.fsf@linuxsc.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24130&group=comp.arch#24130

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Thu, 10 Mar 2022 08:18:58 -0800
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <8635jpdbm5.fsf@linuxsc.com>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com> <t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me> <t09722$d7f$1@dont-email.me> <86wnh2ddz6.fsf@linuxsc.com> <t0bdlt$v32$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="999dd4059456035731e616df40c2b94e";
logging-data="11790"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Wp8UKyne/hWxtQRhki49HQFe96XA9Gq4="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:VljRXAFnnIirVPfMdWGA7oy1Cyc=
sha1:K06+v0j7j9g/hNcoeT+IMSvKhd4=
 by: Tim Rentsch - Thu, 10 Mar 2022 16:18 UTC

BGB <cr88192@gmail.com> writes:

> On 3/9/2022 3:15 PM, Tim Rentsch wrote:
>
>> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> writes:
>>
>>> On 3/8/2022 1:54 PM, BGB wrote:
>>>
>>> snip
>>>
>>>> initial {
>>>> //block runs at program start-up (1)
>>>> }
>>>>
>>>> *1: Program startup sequence being:
>>>> Load / Zero ".bss" / ...
>>>> Initialize language runtime stuff;
>>>> Initialize all the globals which require dynamic init;
>>>> Run any 'initial' blocks in the program;
>>>> Transfer control to "main()".
>>>
>>> How is this different from or better than just putting whatever is
>>> in the "initial" block at the start of main (), like programmers
>>> have been doing for decades?
>>
>> Putting calls in main(), we get to choose the order in which the
>> blocks are run, but the function names (assuming they are in
>> other translation units) have to be global so they can be called.
>>
>> With initial blocks, the initial blocks don't have any names
>> (except of course there may be some linker magic so that they
>> call can be called), but there is no way to choose a specific
>> order in which the initial blocks are run.
>>
>> To me "initial blocks" seem like a needless complication. Better
>> just to use explicit calls in main().
>
> Yeah, I guess ordering is a potential drawback.
>
> As well, if something is initialized but then never used (wasting time
> and resources), or one ends up needing to manually initialize more
> stuff later due to a more needing a more involved or expensive
> initialization process (partly defeating the original purpose, *).
>
> Its main use case then would be things like "calculate stuff and fill
> these tables of numbers" or similar.

For what it's worth, my usual metric for such things is to
consider two factors: how much does it complicate the language,
and how much expressive power does it add? Initial blocks (of
the variety that must be run at program start time) add a lot
of complication - look at the C++ standard to see what is needed
for this capability. On the flip side, initial blocks add very
little expressive power, because the same effect can be achieved
using code in main(), with not much downside. The combination of
very little upside and a pretty significant downside leads me to
think the ROI is very definitely below threshold.

Re: Any comments on:

<t0db40$dp5$1@newsreader4.netcologne.de>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24133&group=comp.arch#24133

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!news.freedyn.de!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd4-fef8-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Thu, 10 Mar 2022 17:05:05 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <t0db40$dp5$1@newsreader4.netcologne.de>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
<t09722$d7f$1@dont-email.me> <t098dq$k1s$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 10 Mar 2022 17:05:05 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd4-fef8-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd4:fef8:0:7285:c2ff:fe6c:992d";
logging-data="14117"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Thu, 10 Mar 2022 17:05 UTC

Ivan Godard <ivan@millcomputing.com> schrieb:
> On 3/8/2022 7:31 PM, Stephen Fuld wrote:
>> On 3/8/2022 1:54 PM, BGB wrote:
>>
>> snip
>>
>>>
>>> initial {
>>>    //block runs at program start-up (1)
>>> }
>>>
>>> *1: Program startup sequence being:
>>>    Load / Zero ".bss" / ...
>>>    Initialize language runtime stuff;
>>>    Initialize all the globals which require dynamic init;
>>>    Run any 'initial' blocks in the program;
>>>    Transfer control to "main()".
>>>
>>
>> How is this different from or better than just putting whatever is in
>> the "initial" block at the start of main (), like programmers have been
>> doing for decades?
>>
>>
>
> There's pre-main stuff that is done by __start

Nitpick: _start .

Re: Any comments on:

<t0dbn9$dp5$2@newsreader4.netcologne.de>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24134&group=comp.arch#24134

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!news.freedyn.de!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd4-fef8-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Thu, 10 Mar 2022 17:15:21 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <t0dbn9$dp5$2@newsreader4.netcologne.de>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
<t09722$d7f$1@dont-email.me> <t098dq$k1s$1@dont-email.me>
<t09cnu$b1m$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 10 Mar 2022 17:15:21 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd4-fef8-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd4:fef8:0:7285:c2ff:fe6c:992d";
logging-data="14117"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Thu, 10 Mar 2022 17:15 UTC

Stephen Fuld <sfuld@alumni.cmu.edu.invalid> schrieb:
> On 3/8/2022 7:54 PM, Ivan Godard wrote:
>> On 3/8/2022 7:31 PM, Stephen Fuld wrote:
>>> On 3/8/2022 1:54 PM, BGB wrote:
>>>
>>> snip
>>>
>>>>
>>>> initial {
>>>>    //block runs at program start-up (1)
>>>> }
>>>>
>>>> *1: Program startup sequence being:
>>>>    Load / Zero ".bss" / ...
>>>>    Initialize language runtime stuff;
>>>>    Initialize all the globals which require dynamic init;
>>>>    Run any 'initial' blocks in the program;
>>>>    Transfer control to "main()".
>>>>
>>>
>>> How is this different from or better than just putting whatever is in
>>> the "initial" block at the start of main (), like programmers have
>>> been doing for decades?
>>>
>>>
>>
>> There's pre-main stuff that is done by __start
>
> Agreed. But can't the compiler just put in the code to do that?

There is a whole lot of stuff that needs to be done before main(),
initialization is only one of them. C++ constructors for static
variables also need to run prior to main (or you can use the
non-standard __attribute__((constructor)) in gcc at least).

You can run a whole program from constructors if you so chose,
with just a "return 0;" as the body of main(). Of course, you
can also put that into a library.

(I don't think there is an obfuscated C++ contest, there is
no need.)

Re: Any comments on:

<bead604e-3d6d-43f6-981f-9efcc6c7fe67n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24137&group=comp.arch#24137

 copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:622a:1210:b0:2e0:6e26:23a8 with SMTP id y16-20020a05622a121000b002e06e2623a8mr5515027qtx.267.1646944105045;
Thu, 10 Mar 2022 12:28:25 -0800 (PST)
X-Received: by 2002:a05:6870:f2a5:b0:da:b3f:2b50 with SMTP id
u37-20020a056870f2a500b000da0b3f2b50mr9465213oap.239.1646944104828; Thu, 10
Mar 2022 12:28:24 -0800 (PST)
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.arch
Date: Thu, 10 Mar 2022 12:28:24 -0800 (PST)
In-Reply-To: <t08jat$atu$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=73.188.126.34; posting-account=ujX_IwoAAACu0_cef9hMHeR8g0ZYDNHh
NNTP-Posting-Host: 73.188.126.34
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bead604e-3d6d-43f6-981f-9efcc6c7fe67n@googlegroups.com>
Subject: Re: Any comments on:
From: timcaff...@aol.com (Timothy McCaffrey)
Injection-Date: Thu, 10 Mar 2022 20:28:25 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Timothy McCaffrey - Thu, 10 Mar 2022 20:28 UTC

On Tuesday, March 8, 2022 at 4:54:41 PM UTC-5, BGB wrote:

> One idea could be that we don't so much "call" into synchronized methods
> directly, but rather that they queue up and put the caller on standby.
> When the method call is handled (possibly in a different thread from the
> caller), it then wakes the caller, which may resume execution in its own
> thread.
>
> Or, in effect, an RPC like abstraction is hidden inside what appears
> like a normal method call. Potentially, getters and setters could use a
> similar abstraction.
>
> In contrast, an asynchronous method call would in effect detach the
> caller from the callee, which may continue on independent of the other.
> Within a synchronized object, both cases would have the behavior of
> forcing sequential execution.
>
> Maybe also have async blocks which could have a condition for when they
> trigger:
> async(cc) { ... }
>
> But, which differs slightly in that control needs to reach the block
> before it is created, and that its execution is one-off (once 'cc' is
> true, the block executes once, or at least once for each time control
> passes over the declaration of the async block).
>
> Likely, state capture for an async block would be similar to that for a
> lambda. It also seems likely also that the 'cc' mechanism would be
> implemented similar to a constraint variable (modifying an input
> triggers re-computation, rather than endlessly re-evaluating the
> predicate to see if it has changed since the last time it was checked).
>
>
> Granted, all of this would add a bit of complexity to a compiler.
>
>
You should check out Capn'proto:
https://capnproto.org/

It might be most of what you want without modifying the language.

- Tim

Re: Any comments on:

<t0doel$144$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24138&group=comp.arch#24138

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Thu, 10 Mar 2022 21:52:37 +0100
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <t0doel$144$1@dont-email.me>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
<t09722$d7f$1@dont-email.me> <t098dq$k1s$1@dont-email.me>
<t0db40$dp5$1@newsreader4.netcologne.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 10 Mar 2022 20:52:37 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="0124e0edae3b13a75355bfd90d59edf2";
logging-data="1156"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+D3qsXLT86Eawv74dRgMlbQZNaWqi49EU="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:T0NRUZ5ZMrehsKU+BLfMUweG4tw=
In-Reply-To: <t0db40$dp5$1@newsreader4.netcologne.de>
Content-Language: en-GB
 by: David Brown - Thu, 10 Mar 2022 20:52 UTC

On 10/03/2022 18:05, Thomas Koenig wrote:
> Ivan Godard <ivan@millcomputing.com> schrieb:
>> On 3/8/2022 7:31 PM, Stephen Fuld wrote:
>>> On 3/8/2022 1:54 PM, BGB wrote:
>>>
>>> snip
>>>
>>>>
>>>> initial {
>>>>    //block runs at program start-up (1)
>>>> }
>>>>
>>>> *1: Program startup sequence being:
>>>>    Load / Zero ".bss" / ...
>>>>    Initialize language runtime stuff;
>>>>    Initialize all the globals which require dynamic init;
>>>>    Run any 'initial' blocks in the program;
>>>>    Transfer control to "main()".
>>>>
>>>
>>> How is this different from or better than just putting whatever is in
>>> the "initial" block at the start of main (), like programmers have been
>>> doing for decades?
>>>
>>>
>>
>> There's pre-main stuff that is done by __start
>
> Nitpick: _start .
>

It could be any name reserved for the implementation. It could be
"__start", or "__init", or "__reset", or anything the implementation
wants. Since the start symbol is going to be visible at linking, it
should (as far as I understand it) be a reserved identifier so that
there will be no possible conflict with user code - an identifier
starting with two underscores is therefore ideal. Identifiers starting
with a single underscore and a small letter are reserved for file scope
identifiers, and should not be used for external linkage symbols - thus
"_start" is a bad choice.

In real implementations, "_start" is probably not uncommon.

Re: Any comments on:

<t0e176$710$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24140&group=comp.arch#24140

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Thu, 10 Mar 2022 17:22:07 -0600
Organization: A noiseless patient Spider
Lines: 166
Message-ID: <t0e176$710$1@dont-email.me>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
<t09722$d7f$1@dont-email.me> <t098dq$k1s$1@dont-email.me>
<t0db40$dp5$1@newsreader4.netcologne.de> <t0doel$144$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 10 Mar 2022 23:22:14 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="e8d2320aa770a4595efb7be99d1ecbe4";
logging-data="7200"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180HFvXe1woLP4UQ07mG9e3"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.6.1
Cancel-Lock: sha1:cM9V/wuPHqlmvO9oSNFfdLyolco=
In-Reply-To: <t0doel$144$1@dont-email.me>
Content-Language: en-US
 by: BGB - Thu, 10 Mar 2022 23:22 UTC

On 3/10/2022 2:52 PM, David Brown wrote:
> On 10/03/2022 18:05, Thomas Koenig wrote:
>> Ivan Godard <ivan@millcomputing.com> schrieb:
>>> On 3/8/2022 7:31 PM, Stephen Fuld wrote:
>>>> On 3/8/2022 1:54 PM, BGB wrote:
>>>>
>>>> snip
>>>>
>>>>>
>>>>> initial {
>>>>>    //block runs at program start-up (1)
>>>>> }
>>>>>
>>>>> *1: Program startup sequence being:
>>>>>    Load / Zero ".bss" / ...
>>>>>    Initialize language runtime stuff;
>>>>>    Initialize all the globals which require dynamic init;
>>>>>    Run any 'initial' blocks in the program;
>>>>>    Transfer control to "main()".
>>>>>
>>>>
>>>> How is this different from or better than just putting whatever is in
>>>> the "initial" block at the start of main (), like programmers have been
>>>> doing for decades?
>>>>
>>>>
>>>
>>> There's pre-main stuff that is done by __start
>>
>> Nitpick: _start .
>>
>
> It could be any name reserved for the implementation. It could be
> "__start", or "__init", or "__reset", or anything the implementation
> wants. Since the start symbol is going to be visible at linking, it
> should (as far as I understand it) be a reserved identifier so that
> there will be no possible conflict with user code - an identifier
> starting with two underscores is therefore ideal. Identifiers starting
> with a single underscore and a small letter are reserved for file scope
> identifiers, and should not be used for external linkage symbols - thus
> "_start" is a bad choice.
>
> In real implementations, "_start" is probably not uncommon.

In my case, it is "__start", with "__" also being used for a lot of
symbols shared between the runtime library and compiler.

Some amount of the naming conventions in this case were borrowed from GCC.

It can be noted that "_lower" is also a common naming convention for
extended C library functions.

So:
lower, user names
Upper, user names
_lower, C library extensions
_Upper, C standard convention for new keywords.
__lower, typically used by the compiler.
__Upper, hardly anything does this.

In some cases, '__' has also been used as a separator within names,
typically within auto-generated names:
__prefixname__autogeneratedsuffix.

....

In one of my own languages (BGBScript2 as implemented by BGBCC, *) the
toplevel is shared with C, and so shares C naming rules and restrictions
(Eg: no overloaded names at the toplevel).

*: There was another implementation inside a VM which used a P/Invoke
style mechanism. However, the version within BGBCC more or less just
shares the C toplevel, sorta like C++ but with 'extern "C"' behavior as
the default.

Though, there are "potential gotchas" as BS2's type-name conventions are
more aligned with Java and C# than with C, so type names not necessarily
line up 1:1 with C.

Within package names (AKA: namespaces), the rules differ some as the
names will not (usually) conflict with anything which exists at the
top-level (though, there is a name-mangling scheme in use).

The name mangling scheme is a bit non-standard, but in effect follows a
similar set of patterns to those used in JNI (the notation partly
evolved out of mash up of the JVM/JNI conventions and parts of the IA-64
C++ ABI).

or, say:
package foo {
void bar(int x, double y) { ... }
}
Might first be expressed as:
"foo/bar(id)v" (QName Form)
And, then further mangled to:
_X_foo_6bar_4id_5v

Where, _1.._8 may escape normal characters (from a predefined list),
_9xx escapes U+0000..U+00FF, and _0xxxx escapes U+0000 to U+FFFF
(non-BMP characters would be expressed in surrogate pair form).
Underscores are also escaped ("_1"), so decoding this form back into the
prior form is unambiguous.

....

As for language design, it's structure is more loose (like C and C++) in
that it allows declaring functions wherever.

As can be noted though, BS2 hasn't seen much use on BJX2 thus far, as
far more ends up being done in C.

Though, it is arguably possible I could write a BS2 -> C transpiler,
which would allow using it on other targets (without the overhead and
complexity of using a VM).

I could "almost" just add C# support to BGBCC and use that instead,
however some design assumptions for C# wouldn't map over well to "bare
metal" operation (eg: my BS2 language is not built around the assumption
of having a garbage collector, and so uses a mix of manual new/delete
and explicit semantics for things like object lifetime and similar;
which are "not really a thing" in C#).

It is a little simpler than C++ though, due to not having either
multiple inheritance or templates (eg: there is a whole lot of cruft in
C++ that just goes poof and disappears if one gets rid of multiple
inheritance).

As for memory-management, there was on-off floated idea of adding in
some mechanisms loosely similar to Doom's Z_Malloc system (such as the
ability to assign objects to a zone-tag and then bulk-free any objects
from the given tag or a subtag), which can work OK in practice, but I am
on the fence about making it a built-in feature.

As can be noted, BS2 (on BJX2) shares the same underlying heap as C's
malloc, so adding zone-tag support here would also require all of the
malloc'ed objects to also support zone tags (in addition to also
supporting type-tagging, which C doesn't use either).

But, as can be noted, using multiple heaps also sucks, and if one has a
shared runtime implementation internally, almost may as well use the
same types.

For the most part, BS2 lacks its own "standard library", as I didn't
really define one, and to what extent one exists, it is basically just
reusing the C standard library. (Didn't really feel a strong need to go
write wrapper classes or similar).

Well, and while there is a 'string' type, it is itself mostly a thin
wrapper over a C style ASCIZ string, with some additional restrictions
(these strings are treated as opaque immutable values, with some extra
hidden prefix bytes to encode the character encoding and similar).
Though, converting the other way does generally involve interning the
string.

This part is, as can be noted, very much unlike Java or C#.

....

Re: Any comments on:

<t0etba$eha$1@newsreader4.netcologne.de>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24144&group=comp.arch#24144

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd4-fef8-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoe...@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Fri, 11 Mar 2022 07:22:18 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <t0etba$eha$1@newsreader4.netcologne.de>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
<t09722$d7f$1@dont-email.me> <t098dq$k1s$1@dont-email.me>
<t0db40$dp5$1@newsreader4.netcologne.de> <t0doel$144$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 11 Mar 2022 07:22:18 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd4-fef8-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd4:fef8:0:7285:c2ff:fe6c:992d";
logging-data="14890"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Fri, 11 Mar 2022 07:22 UTC

David Brown <david.brown@hesbynett.no> schrieb:
> On 10/03/2022 18:05, Thomas Koenig wrote:
>> Ivan Godard <ivan@millcomputing.com> schrieb:
>>> On 3/8/2022 7:31 PM, Stephen Fuld wrote:
>>>> On 3/8/2022 1:54 PM, BGB wrote:
>>>>
>>>> snip
>>>>
>>>>>
>>>>> initial {
>>>>>    //block runs at program start-up (1)
>>>>> }
>>>>>
>>>>> *1: Program startup sequence being:
>>>>>    Load / Zero ".bss" / ...
>>>>>    Initialize language runtime stuff;
>>>>>    Initialize all the globals which require dynamic init;
>>>>>    Run any 'initial' blocks in the program;
>>>>>    Transfer control to "main()".
>>>>>
>>>>
>>>> How is this different from or better than just putting whatever is in
>>>> the "initial" block at the start of main (), like programmers have been
>>>> doing for decades?
>>>>
>>>>
>>>
>>> There's pre-main stuff that is done by __start
>>
>> Nitpick: _start .
>>
>
> It could be any name reserved for the implementation. It could be
> "__start", or "__init", or "__reset", or anything the implementation
> wants.

I was talking about ELF, where it is indeed _start.

In ELF-land, there is a general rule that identifiers which start
with a single underscore are reserved for the library, and those
with a double underscore for the compiler.

Both are reserved for the implementation.

> Since the start symbol is going to be visible at linking, it
> should (as far as I understand it) be a reserved identifier so that
> there will be no possible conflict with user code - an identifier
> starting with two underscores is therefore ideal. Identifiers starting
> with a single underscore and a small letter are reserved for file scope
> identifiers, and should not be used for external linkage symbols - thus
> "_start" is a bad choice.

> In real implementations, "_start" is probably not uncommon.

Not uncommon, indeed. Linux (using gcc) uses it, as does OpenBSD
using clang, so it is a safe bet that the vast majority of UNIX
installations do.

Re: Any comments on:

<t0ev5r$k9f$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24145&group=comp.arch#24145

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Fri, 11 Mar 2022 08:53:31 +0100
Organization: A noiseless patient Spider
Lines: 91
Message-ID: <t0ev5r$k9f$1@dont-email.me>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
<t09722$d7f$1@dont-email.me> <t098dq$k1s$1@dont-email.me>
<t0db40$dp5$1@newsreader4.netcologne.de> <t0doel$144$1@dont-email.me>
<t0etba$eha$1@newsreader4.netcologne.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 11 Mar 2022 07:53:31 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="e2360f8970ab9f2702d354248f601f1d";
logging-data="20783"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+yc20dop/LyyML9V7M8qcNN9lDyXSPKZM="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:aqVwZ4z5UWeykU1LaIAv3vdvrLk=
In-Reply-To: <t0etba$eha$1@newsreader4.netcologne.de>
Content-Language: en-GB
 by: David Brown - Fri, 11 Mar 2022 07:53 UTC

On 11/03/2022 08:22, Thomas Koenig wrote:
> David Brown <david.brown@hesbynett.no> schrieb:
>> On 10/03/2022 18:05, Thomas Koenig wrote:
>>> Ivan Godard <ivan@millcomputing.com> schrieb:
>>>> On 3/8/2022 7:31 PM, Stephen Fuld wrote:
>>>>> On 3/8/2022 1:54 PM, BGB wrote:
>>>>>
>>>>> snip
>>>>>
>>>>>>
>>>>>> initial {
>>>>>>    //block runs at program start-up (1)
>>>>>> }
>>>>>>
>>>>>> *1: Program startup sequence being:
>>>>>>    Load / Zero ".bss" / ...
>>>>>>    Initialize language runtime stuff;
>>>>>>    Initialize all the globals which require dynamic init;
>>>>>>    Run any 'initial' blocks in the program;
>>>>>>    Transfer control to "main()".
>>>>>>
>>>>>
>>>>> How is this different from or better than just putting whatever is in
>>>>> the "initial" block at the start of main (), like programmers have been
>>>>> doing for decades?
>>>>>
>>>>>
>>>>
>>>> There's pre-main stuff that is done by __start
>>>
>>> Nitpick: _start .
>>>
>>
>> It could be any name reserved for the implementation. It could be
>> "__start", or "__init", or "__reset", or anything the implementation
>> wants.
>
> I was talking about ELF, where it is indeed _start.
>
> In ELF-land, there is a general rule that identifiers which start
> with a single underscore are reserved for the library, and those
> with a double underscore for the compiler.

Fair enough.

>
> Both are reserved for the implementation.

Single underscore then a small letter identifiers are not reserved for
the implementation in C or C++. But they are not supposed to be used
(by the user) for symbols with external linkage. I suppose that means
the library can safely use such symbols for external names that are not
seen by users (so not declared in headers that the programmer might use).

>
>> Since the start symbol is going to be visible at linking, it
>> should (as far as I understand it) be a reserved identifier so that
>> there will be no possible conflict with user code - an identifier
>> starting with two underscores is therefore ideal. Identifiers starting
>> with a single underscore and a small letter are reserved for file scope
>> identifiers, and should not be used for external linkage symbols - thus
>> "_start" is a bad choice.
>
>
>> In real implementations, "_start" is probably not uncommon.
>
> Not uncommon, indeed. Linux (using gcc) uses it, as does OpenBSD
> using clang, so it is a safe bet that the vast majority of UNIX
> installations do.
>

ELF is indeed common! Looking at the map files for a couple of my
gcc-compiled embedded projects, one of them has "_start" as well as a
"reset_isr" symbol at the start point. The other has no "_start" or
"__start", merely a reset vector symbol.

When you have an OS that loads and starts programs, it will need a known
symbol name (or known position in the image or file) for starting the
code - so having a standard name in programs for *nix systems makes a
great deal of sense. For embedded systems, the startup code is much
more system-specific, and often at least part of it is visible to the
programmer as "wizard" or "template" generated startup code. This code
is thus technically user code, and follows user rules for identifiers.

It's been a while since I used a toolchain that generated COFF files, or
toolchain-specific formats. But I do remember that some toolchains I
used add an underscore prefix to each C symbol. On such systems, a
library might be better using symbols /without/ an underscore to avoid
conflicts!

Re: Any comments on:

<t0f3ln$ads$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=24146&group=comp.arch#24146

 copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: Any comments on:
Date: Fri, 11 Mar 2022 03:10:09 -0600
Organization: A noiseless patient Spider
Lines: 115
Message-ID: <t0f3ln$ads$1@dont-email.me>
References: <8b7379c0-275a-44de-b1a3-439bf9efd210n@googlegroups.com>
<t0512s$upd$1@dont-email.me> <t08jat$atu$1@dont-email.me>
<t09722$d7f$1@dont-email.me> <t098dq$k1s$1@dont-email.me>
<t0db40$dp5$1@newsreader4.netcologne.de> <t0doel$144$1@dont-email.me>
<t0etba$eha$1@newsreader4.netcologne.de> <t0ev5r$k9f$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 11 Mar 2022 09:10:15 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="e8d2320aa770a4595efb7be99d1ecbe4";
logging-data="10684"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kXa1cCfQXqIg8WtPbngV/"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.6.1
Cancel-Lock: sha1:W8lqDKjvIASutyR1dVbdhQ3gfKI=
In-Reply-To: <t0ev5r$k9f$1@dont-email.me>
Content-Language: en-US
 by: BGB - Fri, 11 Mar 2022 09:10 UTC

On 3/11/2022 1:53 AM, David Brown wrote:
> On 11/03/2022 08:22, Thomas Koenig wrote:
>> David Brown <david.brown@hesbynett.no> schrieb:
>>> On 10/03/2022 18:05, Thomas Koenig wrote:
>>>> Ivan Godard <ivan@millcomputing.com> schrieb:
>>>>> On 3/8/2022 7:31 PM, Stephen Fuld wrote:
>>>>>> On 3/8/2022 1:54 PM, BGB wrote:
>>>>>>
>>>>>> snip
>>>>>>
>>>>>>>
>>>>>>> initial {
>>>>>>>    //block runs at program start-up (1)
>>>>>>> }
>>>>>>>
>>>>>>> *1: Program startup sequence being:
>>>>>>>    Load / Zero ".bss" / ...
>>>>>>>    Initialize language runtime stuff;
>>>>>>>    Initialize all the globals which require dynamic init;
>>>>>>>    Run any 'initial' blocks in the program;
>>>>>>>    Transfer control to "main()".
>>>>>>>
>>>>>>
>>>>>> How is this different from or better than just putting whatever is in
>>>>>> the "initial" block at the start of main (), like programmers have been
>>>>>> doing for decades?
>>>>>>
>>>>>>
>>>>>
>>>>> There's pre-main stuff that is done by __start
>>>>
>>>> Nitpick: _start .
>>>>
>>>
>>> It could be any name reserved for the implementation. It could be
>>> "__start", or "__init", or "__reset", or anything the implementation
>>> wants.
>>
>> I was talking about ELF, where it is indeed _start.
>>
>> In ELF-land, there is a general rule that identifiers which start
>> with a single underscore are reserved for the library, and those
>> with a double underscore for the compiler.
>
> Fair enough.
>
>>
>> Both are reserved for the implementation.
>
> Single underscore then a small letter identifiers are not reserved for
> the implementation in C or C++. But they are not supposed to be used
> (by the user) for symbols with external linkage. I suppose that means
> the library can safely use such symbols for external names that are not
> seen by users (so not declared in headers that the programmer might use).
>
>>
>>> Since the start symbol is going to be visible at linking, it
>>> should (as far as I understand it) be a reserved identifier so that
>>> there will be no possible conflict with user code - an identifier
>>> starting with two underscores is therefore ideal. Identifiers starting
>>> with a single underscore and a small letter are reserved for file scope
>>> identifiers, and should not be used for external linkage symbols - thus
>>> "_start" is a bad choice.
>>
>>
>>> In real implementations, "_start" is probably not uncommon.
>>
>> Not uncommon, indeed. Linux (using gcc) uses it, as does OpenBSD
>> using clang, so it is a safe bet that the vast majority of UNIX
>> installations do.
>>
>
> ELF is indeed common! Looking at the map files for a couple of my
> gcc-compiled embedded projects, one of them has "_start" as well as a
> "reset_isr" symbol at the start point. The other has no "_start" or
> "__start", merely a reset vector symbol.
>
> When you have an OS that loads and starts programs, it will need a known
> symbol name (or known position in the image or file) for starting the
> code - so having a standard name in programs for *nix systems makes a
> great deal of sense. For embedded systems, the startup code is much
> more system-specific, and often at least part of it is visible to the
> programmer as "wizard" or "template" generated startup code. This code
> is thus technically user code, and follows user rules for identifiers.
>
>
> It's been a while since I used a toolchain that generated COFF files, or
> toolchain-specific formats. But I do remember that some toolchains I
> used add an underscore prefix to each C symbol. On such systems, a
> library might be better using symbols /without/ an underscore to avoid
> conflicts!
>

FWIW: In my case I am using a PE/COFF variant, where the entry point RVA
is encoded in the PE/COFF headers (or, "COFF Optional Header").

I guess it is debatable if it is still really PE/COFF though, given it
omits the MZ stub (as it is irrelevant) and uses LZ4 compression on the
binary (with the program loaders using a built-in LZ4 decompressor).

Then again, I guess it is possible that maybe a lot of the compiler
symbols in my case ended up with an extra underscore, as on the original
SuperH targets from which my stuff developed, the symbol names in ASM
had an extra '_' on the front (so "main()" in C was "_main" in the ASM).

In BGBCC, with the extra underscore on normal names being dropped, but
kept for the compiler internal names?...
(Originally, when I started my BJX1 project, a lot of the original ASM
support code was more or less copy/pasted from the SH versions).

Would probably need to do some level of code archeology to sort this out
though.

Pages:12
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor