[Oberon] SystemV - Link Loader Strategy
Tomas Kral
thomas.kral at email.cz
Wed Mar 6 18:56:44 CET 2019
> I am toying with best/sensible fit strategy, I am coding these lines.
Recoded to this.
MODULE Fit; (*TK 6.3.2019, best fit strategy*)
IMPORT Modules, Files, In, Out;
PROCEDURE Load*;
VAR m, mod: Modules.Module; name: ARRAY 32 OF CHAR;
size, ds, (*size, delta*) i, j (*debug*): INTEGER;
BEGIN
In.Open; In.Name(name); In.Int(size); i := 0; j := -1;
m := Modules.root; mod := NIL; ds:= 100H; (*heuristic granularity*)
WHILE m # NIL DO
IF (m.name[0] = 0X) & (m.size-size >= 0) & (m.size-size < ds) THEN ds := m.size-size; mod := m; j := i END ;
m := m.next; INC(i)
END ;
IF mod = NIL THEN Out.String("no fit")
ELSE Out.String("gap no#"); Out.Int(j, 3); Out.Int(mod.size, 8) END ;
Out.Int(ds, 6); Out.Ln;
END Load;
END Fit.
END Fit.
Fit.Load Screen 4388 ~
System.ShowModules
--
Tomas Kral <thomas.kral at email.cz>
More information about the Oberon
mailing list