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

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Sun Jan 31 11:11:11 CET 2021


    > The unaligned data in a .rsc file is, I agree, unfortunate, as it could
    > have been aligned relatively easily and then data could have been
    > copied into memory a word at a time.

Isn’t any data - including string data . already word-aligned in the
compiler (and therefore also in the .rsc file)?

1. The array ORG.str itself is word-aligned, because...

    - Modules.AllocPtr is word-aligned (see Modules.Load)
    - Modules.DescSize is a multiple of 4, so mod.data is word-aligned
    - All type descriptors are word-aligned (see ORG.BuildTD)
    - All variables are word-aligned (see ORG.Declarations)
    - All strings are word-aligned (see ORG.MakeStringItem)

2. ORG.MakeStringItem

   WHILE strx MOD 4 # 0 DO str[strx] := 0X; INC(strx) END

3. ORP.Declarations

    IF sym = ORS.var THEN
        ...
        IF tp.size > 1 THEN varsize := (varsize + 3) DIV 4 * 4 (*align*) END ;
        …
    END ;
    varsize := (varsize + 3) DIV 4 * 4;







More information about the Oberon mailing list