[Oberon] Fw: FPGA - Bitmaps.Mod
Tomas Kral
thomas.kral at email.cz
Wed Apr 19 12:53:09 CEST 2017
Hi Andreas, Joerg,
I have tried both methods suggested here.
(a) without tag declaration, simply calling
Kernel.New(b.base, SYSTEM.ADR(b.size));
(b) with tag declaration and persistence
tag.size := <size of your object to be allocated>;
tag.ext[0] := 0; tag.ext[1] := 0; tag.ext[2] := 0;
tag.ptr := -1;
Kernel.New(b.base, SYSTEM.ADR(tag.size))
They both seem to allocate a block of requested size, however when GC is
run, sometimes heap is inconsistent and `System.Watch' reports strange
values, e.g.
Heap speace -1111221223-1100000%
Tomas
On Fri, 7 Apr 2017 18:12:38 +0200
Andreas Pirklbauer <andreas_pirklbauer at yahoo.com> wrote:
>
> Correction: This should read 'TypeDesc' of course, and not
> 'TypeTag' (which is the *address* of the TypeDesc).
>
> From: Andreas Pirklbauer <andreas_pirklbauer at yahoo.com>
> To: ETH Oberon and Related Systems <oberon at lists.inf.ethz.ch>
>
> ...
>
> You don't really need b) and c), so you could write something like:
>
>
> TYPE TypeTag = RECORD size: LONGINT;
>
> ext: ARRAY 3 OF LONGINT;
>
> ptr: LONGINT;
>
> <other fields that you may want to add>
>
> END ;
>
>
> Then create the "type tag" by writing:
>
>
> VAR tag: TypeTag;
>
>
> and initialise it with:
>
>
> tag.size := <size of your object to be allocated>;
> tag.ext[0] := 0; tag.ext[1] := 0; tag.ext[2] := 0;
> tag.ptr := -1;
>
>
> 4. If you want your objects to be automatically collected by the
> Oberon garbage collector, you must make it globally reachable via a
> global pointer. Then they will appear in mod.ptr in the module block
> which are used as roots for the garbage collector. (Oberon uses all
> named pointer variables in existence as roots for the mark phase of
> the garbage collector. See Oberon.GC for the details. It simply calls
> Kernel.Mark(mod.ptr) for each loaded module mod.
>
>
> Andreas
>
>
>
>
More information about the Oberon
mailing list