[Oberon] Dynamic local array implementation
chris
chris at gcjd.org
Sun Oct 15 13:39:18 CEST 2017
On Sun, 15 Oct 2017 10:29:46 +0200, Andreas Pirklbauer wrote:
> 1) First, access to intermediate variables has been
> eliminated from the language. This eliminated the
> need for a static link (SL) in implementations.
I believe access to intermediate variables can be done without a static
link.
In the same way a programmer would rewrite the source by adding
reference parameters for the used intermediate variables a compiler can
do the same and pass one address for each used variable. That does not
complicate the regular case without intermediate access at all.
> 2) Second, only objects with a size known at compile-
> time are ever allocated on the stack. This eliminated
> the need for a dynamic link (DL) or a frame pointer.
> Now, adjusting a single register (namely the SP)
> by an amount known at compile-time suffices.
Which objects are you thinking about here, which are not covered by 1)
or 3) ?
> 3) Third, structured types (arrays and records) are
> always passed by reference, regardless of whether
> they are value- or VAR- parameters. This makes stack
> usage about as minimal as it gets, as no copying of
> structured parameters ever occurs (the implication
> is that structure value-parameters are ready-only).
That is indeed a good thing. This hidden copies can get quite large if
strings are passed around and most of the time in practice the copy
isn't even necessary. It's only done because the language did not allow
to express read only parameters.
> Hence, procedure calls are optimally efficient in
> Oberon-07. I’d say it’s rather pristine.
The only necessary improvement I see compared to Oberon is the removal
of the hidden copy machine for structured value parameters.
Greetings, chris
More information about the Oberon
mailing list