[Oberon] Why is RSC string data word-aligned?
joerg.straube at iaeth.ch
Sun Jan 31 11:42:18 CET 2021
Yes, it is word-aligned in the compiler and in the .rsc file, but for strings we CAN NOT take benefit of it during file reading, as the endianess is not defined.
Once in memory, we can copy words as the undefined endianess does not interfere anymore.
> Am 31.01.2021 um 11:11 schrieb Andreas Pirklbauer <andreas_pirklbauer at yahoo.com>:
>> 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;
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
More information about the Oberon