[Oberon] V4, 64 bit version; was: Re: Starting V4. (Hellwig Geisse)

scrutinizer scruty at users.sourceforge.net
Fri Jan 15 21:30:33 CET 2021

> It would be nice to have a version running in
> a 64-bit environment, but I'm not sure that this

I'd propose to take a little plunge and change LONGINT to 64 bit
and bootstrap V4 on 64 bit operating system(s).

Apart from modifying the compiler to 64 bit, the source code changes
to the whole [Linz] V4 package are minimal as the port to AOS
(Alpha Oberon System) for 64 bit Alpha OpenVMS in the mid
1990s showed. Most Elems and apps, etc. could be compiled and ran
without any source code changes. Only very few modules
required source code changes.
This port left no 32 bit restrictions.*


The Alpha processor is history since about 20 years (due to the sales of DEC
to Compaq to HP and finally to Intel for the Alpha processor. Intel burried
the Alpha in a drawer to push Itanium.)

But to give an impression of the number and kind of changes needed for a 64 bit port of V4,
attached is an edited output of

$ grep -a -e "_32" -e "ADDRESS32" -e "INTEGER32" -e "INT32" -- *.mod* >diff64bit.lis

for the V4 modules. (The "-a" is needed to also get 'about' readable grep-results
for those source files which are in oberon text format.)

Another challenge would be the 64 port of FPGA Oberon.


*) Apart from the main- and coroutine-*stack*, which is due to an
implementation restriction of OpenVMS Alpha 7.1
(The number after the colon in the filename is the file version number, i.e., the number of edits.)

browser.mod:62:      a0, a1, a2:  SYSTEM.SIGNED_32;  (* a0 gives org in module list *) (* 20+2, 24+2, 28+2 *)
browser.mod:62:      size :SYSTEM.SIGNED_32;
browser.mod:62:    id: SYSTEM.SIGNED_32;
browser.mod:62:      m^.a0 := SYSTEM.VAL(SYSTEM.SIGNED_32, W.buf.len);
browser.mod:62:  PROCEDURE Index(name: ARRAY OF CHAR): SYSTEM.SIGNED_32;
browser.mod:62:    VAR id0, j: SYSTEM.SIGNED_32; ch: CHAR; (*enter identifier*)
browser.mod:62:    VAR i, j, s, h, h1, h2, class, mm: INTEGER; m, k, k1, k2: SYSTEM.SIGNED_32; strno: LONGINT;
browser.mod:62:    PROCEDURE Read4 (VAR i: SYSTEM.SIGNED_32);
browser.mod:62:    BEGIN Files.ReadLInt(SF, x); i := SYSTEM.VAL(SYSTEM.SIGNED_32, x) END Read4;
browser.mod:62:      VAR i,j: SYSTEM.SIGNED_32; ch: CHAR;
browser.mod:62:    EnterTyp("SIGNED_32",  LInt, 4, linttyp); (* was "LONGINT" *)
browser.mod:62:      better use SIGNED_32 instead of LONGINT
browser.mod:62:    EnterTyp("SYSTEM.ADDRESS_32", Pointer, 4, sysptrtyp); (* = SYSTEM.PTR with /pointersize=32 *)
browser.mod:62:  EnterTyp("SYSTEM.UNSIGNED_32", Card,   4, cardtyp);

files.mod:119:  VAR i: SYSTEM.SIGNED_32;
files.mod:119:	BEGIN ReadBytes(R, i, SIZE(SYSTEM.SIGNED_32)); x := i;
files.mod:119:  VAR i: SYSTEM.SIGNED_32;
files.mod:119:      WriteBytes(R, x, SIZE(SYSTEM.SIGNED_32));
files.mod:119:      i := SYSTEM.SHORT(x); WriteBytes(R, i, SIZE(SYSTEM.SIGNED_32));

fonts.mod:22:      pixmap, pixmapX, pixmapDX, pixmapW, pixmapH, RasterBase, b, n, a, count, list: SYSTEM.SIGNED_32;

input.mod:41:    RETURN S.VAL(S.SIGNED_32, (timeval.usec DIV 1000 + timeval.sec * 1000 - timeStart) MOD 7FFFFFFFH);

kernel.mod:480:  TYPE Tag = POINTER TO RECORD (*size,*) ptroff: INTEGER32; END; (* todo x64 Bit: ptrofs -> 64Bit *)
kernel.mod:480:  PROCEDURE ALLOCATE * (VAR v: ADDRESS32; size: INTEGER32);
kernel.mod:480:    v := S.VAL(ADDRESS32, NewBlock(size));

modules0.mod:31:    INTEGER32 = S.SIGNED_32;
modules0.mod:31:      data-, const-, code-: POINTER TO ARRAY OF INTEGER32;
modules0.mod:31:    VAR fp, sp, p: LONGINT; q: INTEGER32; invoContext: EX.InvoContext;
modules0.mod:31:      k1     :S.SIGNED_32;        (* todo x64: substitute k1 by k to get long consts *)
modules0.mod:31:        ext: RECORD extlev, maxIdentLen: INTEGER32; END;
modules0.mod:31:          ASSERT(j <= MAX(INTEGER32));
modules0.mod:31:          S.PUT(t, S.VAL(INTEGER32, j));                    (* todo x64 Bit: remove 32Bit boundary *)
modules0.mod:31:        S.PUT(t, S.VAL(INTEGER32, -(nofptr+2)*ptroffSize)); (* todo x64 Bit: remove 32Bit boundary *)
modules0.mod:31:      TYPE STdPtr = POINTER TO RECORD tag: ADDRESS64; size: INTEGER64; p0, p1: INTEGER32; END; (* todo x64 bit; *)

modules.mod:539:    INTEGER32  = S.SIGNED_32;
modules.mod:539:    PointerOffset = INTEGER32; (* type used for ptr offsets in TypeDescs; todo 64 xbit: change to INT64 *)
modules.mod:539:      data-, const-, code-: POINTER TO ARRAY OF INTEGER32;
modules.mod:539:        ext: RECORD extlev, maxIdentLen: INTEGER32; END;
modules.mod:539:          extlev: INTEGER32;

oberon.mod:33:  PROCEDURE MinTime(): SYSTEM.SIGNED_32;  (* << *)
oberon.mod:33:    minTime := MAX(SYSTEM.SIGNED_32); t := PrevTask;
oberon.mod:33:    RETURN

pictures.mod:6:	INT32 = S.SIGNED_32;
pictures.mod:6:		pixels: ARRAY 256 OF INT32; 			(* Handle to X11 - Color cell *)
pictures.mod:6:	truePix: ARRAY trueColorPaletteSize, trueColorPaletteSize, trueColorPaletteSize OF INT32;
pictures.mod:6:	VAR iPtr: X11.ImagePtr; img: X11.Image; filler, bits: INTEGER; x, y, z, n, dummy2: INT32;

put.mod:3:	INTEGER32 = SYS.SIGNED_32;
put.mod:3:	VAR i: INTEGER; si: SHORTINT; li: INTEGER32; qi: INTEGER64; r1: Ref.Rider;
put.mod:3:	VAR r, r1: Ref.Rider; i, j: INTEGER; si: SHORTINT; li: INTEGER32; qi: INTEGER64;

reals.mod:45:    VAR i: S.SIGNED_64; k: INTEGER; h, q, q2:S.SIGNED_32;

ref.mod:6:  PROCEDURE (VAR r: Rider) WriteLInt* (li: S.SIGNED_32);
ref.mod:6:	IF r.form = Procedure THEN S.PUT(r.Adr(), S.VAL(S.ADDRESS_32, p))
ref.mod:6:	IF r.form = Pointer THEN S.PUT(r.Adr(), S.VAL(S.ADDRESS_32, p))

refelems.mod:6:	VAR si: SHORTINT; i, j: INTEGER; li: S.SIGNED_32; qi: S.SIGNED_64; adr: LONGINT;

rtdt.mod:174:	Instruction* = SYS.SIGNED_32;		(* 4 byte *)
rtdt.mod:174: PROCEDURE Trap (VAR sigArgs: Sys.SigArgs; mechArgs: Sys.MechArgs): SYS.SIGNED_32;

rtdt.mod:174: VAR retval: SYS.SIGNED_32; p: Proc;
rtdt.mod:174:	instr := SYS.VAL(SYS.SIGNED_32, ASH(01AH, 26) + ASH(R31, 21) + ASH(RA, 16) + ASH(0, 0)); SYS.PUT(codeseg + 8, instr);

system.mod:285:  PROCEDURE Trap (VAR sigArgs: EX.SigArgs; mechArgs: EX.MechArgs): SYSTEM.SIGNED_32;
system.mod:285:      Texts.WriteInt(W, LEN(m.code^)*SIZE(SYSTEM.SIGNED_32), 5);
system.mod:285:      ch: CHAR; cv, completion: SYSTEM.SIGNED_32;
system.mod:285:      context, status: SYSTEM.SIGNED_32;

types.mod:61:    ext-: RECORD extlev-, maxIdentLen-: INTEGER32; END;

unix.mod hides the OpenVMS operating system interface)

unix.mod:334:  PID* = SY.SIGNED_32;       (* Process Id. *)
unix.mod:334:    sec*, usec*: SY.SIGNED_32
unix.mod:334:  BaseSecs:  SY.SIGNED_32;     (* TimeBase - UnixEpoch in seconds *)
unix.mod:334:	PROCEDURE Adr32* (VAR s :ARRAY OF SY.BYTE):SY.SIGNED_32;
unix.mod:334:    RETURN (SY.VAL(SY.SIGNED_32, adr) # adr); (* hG/28-Oct-1997 faster than next line*)
unix.mod:334: PROCEDURE Exit*(status: SY.SIGNED_32);
unix.mod:334: VAR mem: SY.SIGNED_32;
unix.mod:334:		result:SY.SIGNED_32; l: SY.SIGNED_64;
unix.mod:334: VAR size: SY.SIGNED_64; result: SY.SIGNED_32;
unix.mod:334:  result := lib.LIB$FREE_VM (SY.SHORT(size), SY.VAL(SY.SIGNED_32, mem));
unix.mod:334:    secs, usecs, n:SY.SIGNED_32;
unix.mod:334:      f0.fab.XAB := SY.VAL(SY.SIGNED_32, NIL);
unix.mod:334:    n:    SY.SIGNED_32;
unix.mod:334: VAR n:  SY.SIGNED_32;
unix.mod:334:  ut.sec := SY.VAL(SY.SIGNED_32, clock); ut.usec := 0;
unix.mod:334:    dummy_length: SY.SIGNED_32;
unix.mod:334:    dummy_length: SY.SIGNED_32;
unix.mod:334:  cv := VMS.SYS$DCLEXH(SY.VAL(SY.SIGNED_32, ep)); (* todo 64Bit *)
unix.mod:334:    completion: SY.SIGNED_32 (*CV*);
unix.mod:334:    m : SY.SIGNED_32;

More information about the Oberon mailing list