[Oberon] Dynamic local array implementation

Diego Sardina dsar at eml.cc
Sun Oct 15 17:49:13 CEST 2017


On Sun, Oct 15, 2017, at 02:36 PM, Andreas Pirklbauer wrote:
> 
> > On Sun Oct 15 13:39:18 CEST 2017 Chris wrote:
> 
> > The only necessary improvement I see compared to Oberon
> > is the removal of the hidden copy machine for structured
> > value parameters.
> 
> Made possible by postulating read-only semantics for
> structured value parameters. Regarding the other changes
> (leading to even less data passed on the stack) one may
> debate whether the gain is material enough. Certainly
> from a (stack) space utilization perspective, preventing
> copy semantics for structured types was the biggest change.
> But there were other considerations, some academic/purist.
> 

Note that this can cause aliasing problems, expecially in
multithreading programs. One has to copy the content of
the structure parameter in a local variable to make sure
that it remains constant (and consistent) during the whole
processing.
This is also where an OUT parameter would be very useful.

There are also cases where the content is processed so many
times that the cost of dereferencing is higher than the cost of
the (initial) copying.
But this could be optimised away by the compiler (with a copy).

Copying is not an evil operation because there are times that
makes more sense to have a copy and not a read-only reference.

But I understand the general simplification of prologue.


--
Diego Sardina


More information about the Oberon mailing list