[Info-vax] LLVM, volatile and async VMS I/O and system calls
Arne Vajhøj
arne at vajhoej.dk
Wed Sep 22 19:22:39 EDT 2021
On 9/22/2021 4:25 PM, Simon Clubley wrote:
> On 2021-09-22, Bob Gezelter <gezelter at rlgsc.com> wrote:
>> In general, optimizers work within basic blocks. The example of concern is not a single basic block.
>>
>> A basic block is a section of code with one entry and one exit. Simple IF statements fall within that category. However, any out-of-line code invocation does not.
>>
>> The presence of the SYS$QIO system service, which one way or another involves a CALL, ends the basic block, as the optimizer cannot know what is modified by the out-of-line call or its descendants.
>
> But VMS writes directly into your process space at some random time
> X later _after_ you have returned from sys$qio() and are potentially
> busy doing something else.
>
> From the viewpoint of the application, it's exactly the same as hardware
> choosing to write an updated value into a register while your bare-metal
> code is busy doing something else.
>
> How does the compiler know VMS has done that or are there enough
> sequence points even in the VMS asynchronous I/O model for this
> to still work fine without having to use the volatile attribute,
> even in the presence of an highly aggressive optimising compiler ?
This is a bit outside my area of expertise.
But wouldn't a flow like:
- call SYS$QIO with buffer
- do something
- wait for IO to complete
- __MB()
- use buffer
work?
Arne
More information about the Info-vax
mailing list