[Oberon] Why is RSC string data word-aligned?

Chris Burrows chris at cfbsoftware.com
Sun Jan 31 00:44:18 CET 2021

> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Colby Russell
> Sent: Sunday, 31 January 2021 8:22 AM
> To: ETH Oberon and related systems; Jörg
> Subject: Re: [Oberon] Why is RSC string data word-aligned?
> Copying my orginal response to Charles here, because I forgot to
> reply to the list.
> On 1/30/21 2:23 PM, Charles Perkins wrote:
>  > if string constants and string variables start on a word boundary
> and  > are padded with nul to a word boundary then a number of string
> > operations only require word access
> That's my intuition as well, but that's what I'm trying to verify.
> I'm trying to track down some specific, concrete examples where we
> can see that the cost of not having padding is higher than the cost
> of dealing with a string with padding.  Operations like printing a
> string, for example, are what I have in mind.  If you have a 5-
> character string, word alignment means you can get the full contents
> in 2 memory accesses, but the operations are still going to be
> occurring at the byte level...
> So where are the savings?
> On 1/30/21 3:16 PM, J rg wrote:
>  > Right. Look at ORG.CopyString then you know why
> ORG.CopyString operates on ORG `Item` objects representing in-memory
> strings, not the binary data contained within an RSC file.  By the
> time the generated code is executing, the module's string section has
> already been read from disk by the module loader--which happens a
> single character at a time.  Viz:
> <https://hypothes.is/a/Wx_nmmNEEeuHEi-6X3lPnQ>
> It appears this is an (unnoticed?) opportunity for further
> optimization of the Oberon system.  The caveat being that it
> constitutes a breaking change to the RSC file format.  So perhaps
> Wirth has noticed and just decided that it wasn't worth the trouble?

I checked a couple of the compiler modules (ORP and ORS) and the number of nulls in strings in the object file is about 1% of the total file size so I would agree that it is not worth the trouble.

Chris Burrows
CFB Software

More information about the Oberon mailing list