[Oberon] Oberon-07 - SYSTEM.MSET

John R. Strohm strohm at airmail.net
Fri Jun 26 16:14:56 CEST 2020


> --- chris at cfbsoftware.com wrote:
>
> > -----Original Message-----
> > From: Tomas Kral [mailto:thomas.kral at email.cz]
> > Sent: Friday, 26 June 2020 4:51 PM
> > To: oberon at lists.inf.ethz.ch
> > Cc: chris at cfbsoftware.com
> > Subject: Re: [Oberon] Oberon-07 - SYSTEM.MSET
> > 
> > > Using the auto-increment extension to SYSTEM.PUT
> > 
> > Interesting, PUT(VAR addr...), addr passed by reference?
> > 
>
> Yes - there are two different signatures:
>
> PROCEDURE PUT*(address: INTEGER; x: <any basic type>);
>
> PROCEDURE PUT*(VAR address: INTEGER; x: <any basic type>; inc: INTEGER);

The original code fragment was (approximately)

   REPEAT SYSTEM.PUT(addr, value, incr) UNTIL addr > limit;

This is logically equivalent to

   REPEAT
      BEGIN
         SYSTEM.PUT(addr, value);
         addr := addr + incr;
      END
   UNTIL addr > limit;

I am admittedly not up on typical Oberon compiler optimization, but I would generally expect a compiler smart enough to inline the SYSTEM.PUT() call, in either case, to be able to optimize in the autoincrement as well.

And, if I was doing the above a lot, I would want a SYSTEM.MEMSET() that expanded inline.

--John R. Strohm


More information about the Oberon mailing list