[Oberon] What does procedure BuildTD do?
joerg.straube at iaeth.ch
Mon Dec 18 10:00:43 CET 2017
BuildTD builds a type descriptor (TD). The type descriptor is used for NEW(), IS and CASE.
As the heap allocation works very efficiently for blocks of size 32, 64, 128 and 256, the compiler rounds up the real size of the type to one of these preferred sizes.
As the compiler and garbage collector needs some extra memory for internal housekeeping, 8 bytes have to be left free per block.
If the real size is 248, one 256 block is still okay, as 248+8=256.
But if the type needs 249 bytes one block of 256 is not enough anymore; you need two 256 blocks.
To capture this case you write (s+263) DIV 256 * 256
> Am 18.12.2017 um 09:04 schrieb Srinivas Nayak <sinu.nayak2001 at gmail.com>:
> Dear All,
> What does procedure BuildTD of ORG.Mod do?
> What is the purpose and idea behind it?
> s := (s+263) DIV 256 * 256
> correct? or should it be
> s := (s+255) DIV 256 * 256
> With thanks and best regards,
> Yours sincerely,
> Srinivas Nayak
> Home: http://www.mathmeth.com/sn/
> Blog: http://srinivas-nayak.blogspot.in/
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
More information about the Oberon