[Info-vax] LLVM, volatile and async VMS I/O and system calls
chris
chris-nospam at tridac.net
Thu Sep 23 12:22:10 EDT 2021
On 09/23/21 16:25, Dave Froble wrote:
> On 9/23/2021 10:10 AM, chris wrote:
>
>> So what is the issue here ?. Keywords like volatile would not normally
>> ever be used at app level, being reserved for low level kernel and
>> driver code where it touches real hardware registers. or perhaps
>> memory locations reserved for a specific purpose. The 4th edition of
>> Harbison & Steele C reference manual has 2 or 3 pages devoted to the
>> volatile keyword and might be worth looking at; Section 4.4.5. The
>> whole point of a black box kernel is to isolate the internal workings
>> from an application. Thinking layers, of course.
>>
>> If systems and code are designed and written properly, then it should
>> compile to usable code irrespective of compiler, including
>> optimisation level, so long as the compiler is standards compliant.
>> Anything else is s system design issue...
>
> If your code was executed as you intended, then there should not be any
> issue, as you mention.
>
> But what if your code is NOT executed as you intended. An optimizer just
> might figure that it doesn't need to execute some instructions, that
> they are redundant. They do that. However, if they are not redundant,
> then results may not be as expected.
>
> So, one might consider "volatile" (or whatever else is used) as an edict
> to "don't optimize".
>
Not really, as no code in a high level language should be written so
as to depend on the sequence of instructions generated. If you want
that defined more tightly, then you should be using assembler, or
have intimate knowledge of compiler translations and output.
One of the functions of a high level language is to provide an
abstraction layer between applications and the underlying machine.
Of course, that doesn't apply to systems or kernel programming but
such work requires a much deeper understanding of comp sci algorithmics
than simple application programming...
Chris
More information about the Info-vax
mailing list