src/ held to report 2026-10.37 whole: import SYSTEM where it reaches memory so Every module but none indexes or converts a pointer, so each imports SYSTEM; X64.isReg and operand and Elf.sizeTables take var where they took ADR. The compiler compiles itself under -strict -Werror, and makes the same bytes as before for every program tried.
| @@ -18,6 +18,7 @@ | ||
| 18 | 18 | end do what the seed's other units do to these. *) |
| 19 | 19 | module Chunk; |
| 20 | 20 | import Fmt, Diag, Scan; |
| 21 | +import SYSTEM; | |
| 21 | 22 | |
| 22 | 23 | type |
| 23 | 24 | Section* = (secText, secRodata, secBss); |
| @@ -151,7 +152,7 @@ | ||
| 151 | 152 | chunks := ^Chunk(Scan.regrab(^U8(chunks), numChunks * SIZE(Chunk), chunkCap * 2 * SIZE(Chunk))); |
| 152 | 153 | chunkCap := chunkCap * 2; |
| 153 | 154 | end; |
| 154 | - c := ADR(chunks[numChunks]); | |
| 155 | + c := SYSTEM.ADR(chunks[numChunks]); | |
| 155 | 156 | c^ := {}; |
| 156 | 157 | c^.sec := sec; |
| 157 | 158 | c^.home := home; |
| @@ -16,6 +16,7 @@ | ||
| 16 | 16 | made only where it is about to be shown. *) |
| 17 | 17 | module Diag; |
| 18 | 18 | import Sys, Rt, Heap, Mem, Buf, Fmt, Str; |
| 19 | +import SYSTEM; | |
| 19 | 20 | |
| 20 | 21 | type |
| 21 | 22 | (* A stretch of a source file: bytes a up to but not including b. |
| @@ -249,7 +250,7 @@ | ||
| 249 | 250 | return; |
| 250 | 251 | end; |
| 251 | 252 | line, start := locate(p); |
| 252 | - f := ADR(files[p.f]); | |
| 253 | + f := SYSTEM.ADR(files[p.f]); | |
| 253 | 254 | buf := f^.buf; |
| 254 | 255 | paintOn(Bold); |
| 255 | 256 | put(f^.path); put(":"); putNum(line); put(":"); putNum(chars(buf, start, p.a) + 1); put(":"); |
| @@ -322,7 +323,7 @@ | ||
| 322 | 323 | begin |
| 323 | 324 | want := shownPath(path); |
| 324 | 325 | for i := 0 to numFiles - 1 do |
| 325 | - f := ADR(files[i]); | |
| 326 | + f := SYSTEM.ADR(files[i]); | |
| 326 | 327 | if f^.path = want then |
| 327 | 328 | k := 0; |
| 328 | 329 | n := 1; |
| @@ -26,6 +26,7 @@ | ||
| 26 | 26 | setMainPath and setStripped do it. *) |
| 27 | 27 | module Elf; |
| 28 | 28 | import Sys, Files, Fmt, Diag, Scan, Chunk, Link; |
| 29 | +import SYSTEM; | |
| 29 | 30 | |
| 30 | 31 | var |
| 31 | 32 | needed: [32]INT; (* the libraries to load, names interned *) |
| @@ -166,7 +167,7 @@ | ||
| 166 | 167 | |
| 167 | 168 | proc putStr(s: []const U8); |
| 168 | 169 | begin |
| 169 | - putBytes(PTR(s), LEN(s)); | |
| 170 | + putBytes(SYSTEM.PTR(s), LEN(s)); | |
| 170 | 171 | putN(0, 1); |
| 171 | 172 | end; |
| 172 | 173 | |
| @@ -230,7 +231,7 @@ | ||
| 230 | 231 | end; |
| 231 | 232 | |
| 232 | 233 | (* The sizes of the loader's tables: what linkAll must leave room for. *) |
| 233 | -proc sizeTables(roExtra, dynSize: ^INT); | |
| 234 | +proc sizeTables(var roExtra, dynSize: INT); | |
| 234 | 235 | var c, i: INT; |
| 235 | 236 | begin |
| 236 | 237 | nsym := 1; |
| @@ -246,8 +247,8 @@ | ||
| 246 | 247 | relaAt := symAt + nsym * 24; |
| 247 | 248 | hashAt := relaAt + (nsym - 1) * 24; |
| 248 | 249 | strAt := hashAt + 4 * (3 + nsym); |
| 249 | - roExtra^ := strAt + strLen; | |
| 250 | - dynSize^ := (numNeeded + 10) * 16; | |
| 250 | + roExtra := strAt + strLen; | |
| 251 | + dynSize := (numNeeded + 10) * 16; | |
| 251 | 252 | end; |
| 252 | 253 | |
| 253 | 254 | (* The loader's tables in the room at the end of rodata, which the |
| @@ -324,7 +325,7 @@ | ||
| 324 | 325 | len := 0; |
| 325 | 326 | dyn := numNeeded > 0; |
| 326 | 327 | roExtra := 0; dynSize := 0; |
| 327 | - if dyn then sizeTables(ADR(roExtra), ADR(dynSize)); end; | |
| 328 | + if dyn then sizeTables(roExtra, dynSize); end; | |
| 328 | 329 | (* room for the most program headers either kind of program has *) |
| 329 | 330 | Link.linkAll(64 + 6 * 56, roExtra, dynSize); |
| 330 | 331 | if dyn then |
| @@ -409,7 +410,7 @@ | ||
| 409 | 410 | strOff := len; |
| 410 | 411 | putBytes(strs, strsLen); |
| 411 | 412 | shstrOff := len; |
| 412 | - putBytes(ADR(ShNames[0]), LEN(ShNames)); | |
| 413 | + putBytes(SYSTEM.PTR(ShNames), LEN(ShNames)); | |
| 413 | 414 | if stripped or (Link.placesChunk < 0) then |
| 414 | 415 | for c := 0 to 2 do dbgOff[c] := len; dbgSize[c] := 0; end; |
| 415 | 416 | else |
| @@ -57,6 +57,7 @@ | ||
| 57 | 57 | takes, is `CallInfo`. *) |
| 58 | 58 | module Gen; |
| 59 | 59 | import Fmt, Diag, Scan, Sym, Chunk, X := X64; |
| 60 | +import SYSTEM; | |
| 60 | 61 | |
| 61 | 62 | const |
| 62 | 63 | NoLabel* = -1; |
| @@ -293,7 +294,7 @@ | ||
| 293 | 294 | var c: INT; |
| 294 | 295 | begin |
| 295 | 296 | c := Chunk.newChunk(Chunk.secRodata, -1, -1); |
| 296 | - Chunk.setData(c, ^U8(ADR(v)), 8, 8); | |
| 297 | + Chunk.setData(c, ^U8(SYSTEM.ADR(v)), 8, 8); | |
| 297 | 298 | return X.memRip(c, 0); |
| 298 | 299 | end; |
| 299 | 300 | |
| @@ -1575,7 +1576,7 @@ | ||
| 1575 | 1576 | (* The name s, interned *) |
| 1576 | 1577 | proc internStr(s: []const U8): INT; |
| 1577 | 1578 | begin |
| 1578 | - return Scan.intern(PTR(s), LEN(s)); | |
| 1579 | + return Scan.intern(SYSTEM.PTR(s), LEN(s)); | |
| 1579 | 1580 | end; |
| 1580 | 1581 | |
| 1581 | 1582 | (* The program goes on if the condition cc holds, and otherwise stops |
| @@ -25,6 +25,7 @@ | ||
| 25 | 25 | in lower case. *) |
| 26 | 26 | module Item; |
| 27 | 27 | import Fmt, Diag, Scan, Sym, Chunk, Gen; |
| 28 | +import SYSTEM; | |
| 28 | 29 | |
| 29 | 30 | type |
| 30 | 31 | Mode* = (mConst, mVar, mStack, mProc, mType, mStr, mBuiltin, mCase, mNone, mCond, |
| @@ -173,7 +174,7 @@ | ||
| 173 | 174 | var p: ^F64; |
| 174 | 175 | begin |
| 175 | 176 | makeConst(x, Sym.tRConst, 0); |
| 176 | - p := ^F64(ADR(x.val)); | |
| 177 | + p := ^F64(SYSTEM.ADR(x.val)); | |
| 177 | 178 | p^ := r; |
| 178 | 179 | end; |
| 179 | 180 | |
| @@ -186,7 +187,7 @@ | ||
| 186 | 187 | var v: I64; p: ^F64; |
| 187 | 188 | begin |
| 188 | 189 | v := x.val; |
| 189 | - p := ^F64(ADR(v)); | |
| 190 | + p := ^F64(SYSTEM.ADR(v)); | |
| 190 | 191 | return p^; |
| 191 | 192 | end; |
| 192 | 193 | |
| @@ -385,7 +386,7 @@ | ||
| 385 | 386 | if (x.typ^.form = Sym.fError) and (x.val > 0) then Gen.pushAdr(globalAdr(INT(x.val) - 1)); |
| 386 | 387 | elsif isF32(x.typ) then |
| 387 | 388 | f := F32(realOf(x)); |
| 388 | - p := ^U32(ADR(f)); | |
| 389 | + p := ^U32(SYSTEM.ADR(f)); | |
| 389 | 390 | Gen.pushConst(Gen.kF32, I64(p^)); |
| 390 | 391 | else Gen.pushConst(Gen.kindOf(x.typ), x.val); end; |
| 391 | 392 | | mVar: |
| @@ -17,6 +17,7 @@ | ||
| 17 | 17 | Leaves out: the file format; that is Elf. *) |
| 18 | 18 | module Link; |
| 19 | 19 | import Fmt, Diag, Scan, Chunk; |
| 20 | +import SYSTEM; | |
| 20 | 21 | |
| 21 | 22 | const |
| 22 | 23 | Page* = 4096; |
| @@ -27,6 +27,7 @@ | ||
| 27 | 27 | holds. *) |
| 28 | 28 | module Parse; |
| 29 | 29 | import Fmt, Diag, Scan, Sym, Chunk, Gen, Item, Sys, Str, Buf, Heap; |
| 30 | +import SYSTEM; | |
| 30 | 31 | |
| 31 | 32 | type |
| 32 | 33 | PType = ^Sym.Type; |
| @@ -183,7 +184,7 @@ | ||
| 183 | 184 | (* The name number of s, which isn't empty *) |
| 184 | 185 | proc internName(s: []const U8): INT; |
| 185 | 186 | begin |
| 186 | - return Scan.intern(PTR(s), LEN(s)); | |
| 187 | + return Scan.intern(SYSTEM.PTR(s), LEN(s)); | |
| 187 | 188 | end; |
| 188 | 189 | |
| 189 | 190 | proc say1(f, a: []const U8): []const U8; |
| @@ -2101,7 +2102,7 @@ | ||
| 2101 | 2102 | lp.cont := Gen.NoLabel; |
| 2102 | 2103 | lp.base := numDefers; |
| 2103 | 2104 | old := curLoop; |
| 2104 | - curLoop := ADR(lp); | |
| 2105 | + curLoop := SYSTEM.ADR(lp); | |
| 2105 | 2106 | end; |
| 2106 | 2107 | |
| 2107 | 2108 | (* Runs the deferred statements in force above base, newest first. *) |
| @@ -3640,7 +3641,7 @@ | ||
| 3640 | 3641 | proc putBytes(off, n: INT; v: I64); |
| 3641 | 3642 | var src: ^U8; |
| 3642 | 3643 | begin |
| 3643 | - src := ^U8(ADR(v)); | |
| 3644 | + src := ^U8(SYSTEM.ADR(v)); | |
| 3644 | 3645 | COPY(constBytes[off..off + n], src[0..n]); |
| 3645 | 3646 | end; |
| 3646 | 3647 | |
| @@ -3839,7 +3840,7 @@ | ||
| 3839 | 3840 | return Scan.markAt(e.pos, "a constant pointer is nil"); |
| 3840 | 3841 | elsif (t^.form = Sym.fReal) and (t^.size = 4) then |
| 3841 | 3842 | r := F32(Item.realOf(e)); |
| 3842 | - src := ^U8(ADR(r)); | |
| 3843 | + src := ^U8(SYSTEM.ADR(r)); | |
| 3843 | 3844 | COPY(constBytes[off..off + 4], src[0..4]); |
| 3844 | 3845 | else |
| 3845 | 3846 | putBytes(off, INT(t^.size), e.val); |
| @@ -4312,7 +4313,7 @@ | ||
| 4312 | 4313 | if LEN(path) >= 4096 then return 0, 0; end; |
| 4313 | 4314 | COPY(a[0..LEN(path)], path); |
| 4314 | 4315 | a[LEN(path)] := 0; |
| 4315 | - if SYSCALL(4, ADR(a[0]), ADR(st)) < 0 then return 0, 0; end; | |
| 4316 | + if SYSTEM.SYSCALL(4, SYSTEM.ADR(a[0]), SYSTEM.ADR(st)) < 0 then return 0, 0; end; | |
| 4316 | 4317 | return st[0], st[1]; |
| 4317 | 4318 | end; |
| 4318 | 4319 |
| @@ -30,6 +30,7 @@ | ||
| 30 | 30 | write, and this only reads the command line and runs them in order. *) |
| 31 | 31 | module Raz; |
| 32 | 32 | import Sys, Out, Version, Files, Fmt, Diag, Scan, Sym, Chunk, X64, Gen, Item, Parse, Link, Elf; |
| 33 | +import SYSTEM; | |
| 33 | 34 | |
| 34 | 35 | const |
| 35 | 36 | Report = "2026-10.37"; (* the version of doc/raz.md it follows *) |
| @@ -51,7 +52,7 @@ | ||
| 51 | 52 | (* The number of the name s *) |
| 52 | 53 | proc internStr(s: []const U8): INT; |
| 53 | 54 | begin |
| 54 | - return Scan.intern(PTR(s), LEN(s)); | |
| 55 | + return Scan.intern(SYSTEM.PTR(s), LEN(s)); | |
| 55 | 56 | end; |
| 56 | 57 | |
| 57 | 58 | (* The modules the program uses: the main module, Rt, and every module |
| @@ -410,11 +411,11 @@ | ||
| 410 | 411 | Elf.setMainPath(path); |
| 411 | 412 | if run then |
| 412 | 413 | (* argv from Main.raz on is the program's, ending in nil as it must *) |
| 413 | - fd := SYSCALL(MemfdCreate, cstr("raz"), MfdCloexec); | |
| 414 | + fd := SYSTEM.SYSCALL(MemfdCreate, cstr("raz"), MfdCloexec); | |
| 414 | 415 | if fd < 0 then Diag.fatal("can't create a memfd"); end; |
| 415 | 416 | outPath := Diag.say("/proc/self/fd/{}", [Fmt.int(fd)]); |
| 416 | 417 | Elf.writeElf(outPath, entry); |
| 417 | - _ := SYSCALL(Execve, cstr(outPath), ARGV() + first, ARGV() + (ARGC() + 1)); | |
| 418 | + _ := SYSTEM.SYSCALL(Execve, cstr(outPath), SYSTEM.ARGV() + first, SYSTEM.ARGV() + (ARGC() + 1)); | |
| 418 | 419 | Diag.fatal(say1("can't run {}", path)); |
| 419 | 420 | end; |
| 420 | 421 | Elf.writeElf(outPath, entry); |
| @@ -13,6 +13,7 @@ | ||
| 13 | 13 | back Failed, which it passes up with try to where it can read on. *) |
| 14 | 14 | module Scan; |
| 15 | 15 | import Sys, Heap, Mem, Fmt, Str, Diag; |
| 16 | +import SYSTEM; | |
| 16 | 17 | |
| 17 | 18 | type |
| 18 | 19 | NamePtr = ^U8; |
| @@ -116,7 +117,7 @@ | ||
| 116 | 117 | chunk of it: an empty string has bytes to point at, though none to index *) |
| 117 | 118 | proc strWithZero*: ^U8; |
| 118 | 119 | begin |
| 119 | - return ADR(sbuf[0]); | |
| 120 | + return SYSTEM.ADR(sbuf[0]); | |
| 120 | 121 | end; |
| 121 | 122 | |
| 122 | 123 | (* Memory, or the end of the compile when there is none *) |
| @@ -897,7 +898,7 @@ | ||
| 897 | 898 | else |
| 898 | 899 | b := q; (* below the least normal, e is -1074 *) |
| 899 | 900 | end; |
| 900 | - bits := ^F64(ADR(b)); | |
| 901 | + bits := ^F64(SYSTEM.ADR(b)); | |
| 901 | 902 | return bits^, true; |
| 902 | 903 | end; |
| 903 | 904 | |
| @@ -1165,5 +1166,5 @@ | ||
| 1165 | 1166 | nameHash := ^INT(grab(nameCap * SIZE(INT))); |
| 1166 | 1167 | tableMask := 2 * nameCap - 1; |
| 1167 | 1168 | table := words64(tableMask + 1); |
| 1168 | - for i := 0 to NumWords - 1 do _ := intern(PTR(words[i]), LEN(words[i])); end; | |
| 1169 | + for i := 0 to NumWords - 1 do _ := intern(SYSTEM.PTR(words[i]), LEN(words[i])); end; | |
| 1169 | 1170 | end Scan. |
| @@ -17,6 +17,7 @@ | ||
| 17 | 17 | its `home`, an object's `link` its `chain`. *) |
| 18 | 18 | module Sym; |
| 19 | 19 | import Mem, Heap, Buf, Fmt, Diag, Scan; |
| 20 | +import SYSTEM; | |
| 20 | 21 | |
| 21 | 22 | type |
| 22 | 23 | Form* = (fNone, fBool, fInt, fReal, fConst, fNil, fStr, fPtr, fArray, |
| @@ -705,7 +706,7 @@ | ||
| 705 | 706 | begin |
| 706 | 707 | t := newType(form, size, size); |
| 707 | 708 | t^.signed := signed; |
| 708 | - o := newObj(oType, Scan.intern(PTR(name), LEN(name)), t); | |
| 709 | + o := newObj(oType, Scan.intern(SYSTEM.PTR(name), LEN(name)), t); | |
| 709 | 710 | o^.exported := true; |
| 710 | 711 | t^.obj := o; |
| 711 | 712 | _ := insert(o, 0); |
| @@ -715,7 +716,7 @@ | ||
| 715 | 716 | (* The name s, interned *) |
| 716 | 717 | proc internOf(s: []const U8): INT; |
| 717 | 718 | begin |
| 718 | - return Scan.intern(PTR(s), LEN(s)); | |
| 719 | + return Scan.intern(SYSTEM.PTR(s), LEN(s)); | |
| 719 | 720 | end; |
| 720 | 721 | |
| 721 | 722 | (* Declares name in the scope s, exported, as a built-in is *) |
| @@ -14,6 +14,7 @@ | ||
| 14 | 14 | an error back from; the compile ends with the error shown. *) |
| 15 | 15 | module X64; |
| 16 | 16 | import Out, Fmt, Heap, Buf, Str, Diag, Scan, Chunk; |
| 17 | +import SYSTEM; | |
| 17 | 18 | |
| 18 | 19 | const |
| 19 | 20 | RAX* = 0; RCX* = 1; RDX* = 2; RBX* = 3; RSP* = 4; RBP* = 5; RSI* = 6; RDI* = 7; |
| @@ -980,27 +981,27 @@ | ||
| 980 | 981 | |
| 981 | 982 | (* Whether w names a register: rax, eax, ax, al and so on, or xmm0 to |
| 982 | 983 | xmm15 (size 16); r and size are set if so *) |
| 983 | -proc isReg(w: []const U8; r, size: ^INT): BOOL; | |
| 984 | +proc isReg(w: []const U8; var r, size: INT): BOOL; | |
| 984 | 985 | const Sizes: [4]INT = [8, 4, 2, 1]; |
| 985 | 986 | var i, j, n, d: INT; |
| 986 | 987 | begin |
| 987 | 988 | for i := 0 to 3 do |
| 988 | 989 | for j := 0 to 15 do |
| 989 | - if RegNames[i][j] = w then r^ := j; size^ := Sizes[i]; return true; end; | |
| 990 | + if RegNames[i][j] = w then r := j; size := Sizes[i]; return true; end; | |
| 990 | 991 | end; |
| 991 | 992 | end; |
| 992 | - size^ := 16; | |
| 993 | + size := 16; | |
| 993 | 994 | if not Str.hasPrefix(w, "xmm") or (LEN(w) <= 3) then return false; end; |
| 994 | 995 | (* the seed read the two bytes after xmm as a number, whatever follows *) |
| 995 | 996 | n := LEN(w) - 3; |
| 996 | 997 | if n > 2 then n := 2; end; |
| 997 | - r^ := 0; | |
| 998 | + r := 0; | |
| 998 | 999 | for i := 0 to n - 1 do |
| 999 | 1000 | d := INT(w[3 + i]) - 48; |
| 1000 | 1001 | if (d < 0) or (d > 9) then return false; end; |
| 1001 | - r^ := r^ * 10 + d; | |
| 1002 | + r := r * 10 + d; | |
| 1002 | 1003 | end; |
| 1003 | - return r^ <= 15; | |
| 1004 | + return r <= 15; | |
| 1004 | 1005 | end; |
| 1005 | 1006 | |
| 1006 | 1007 | (* Which word of list, a list of words each with a space either side, |
| @@ -1046,10 +1047,10 @@ | ||
| 1046 | 1047 | return -1; |
| 1047 | 1048 | end; |
| 1048 | 1049 | |
| 1049 | -proc operand(o: ^Operand; constExpr: ConstFn): ERROR; | |
| 1050 | +proc operand(var o: Operand; constExpr: ConstFn): ERROR; | |
| 1050 | 1051 | var w: []const U8; r, size, sz: INT; st: Scan.State; v: I64; isR, wasMinus: BOOL; |
| 1051 | 1052 | begin |
| 1052 | - o^ := {}; | |
| 1053 | + o := {}; | |
| 1053 | 1054 | w := asmWord(); |
| 1054 | 1055 | sz := 0; |
| 1055 | 1056 | if w = "byte" then sz := 1; |
| @@ -1061,50 +1062,50 @@ | ||
| 1061 | 1062 | if Scan.tok = Scan.sLbrak then |
| 1062 | 1063 | (* [base + index * scale + disp], the displacement last *) |
| 1063 | 1064 | Scan.next; |
| 1064 | - o^.kind := oMem; o^.size := sz; | |
| 1065 | - o^.m := mem(NoBase, 0); | |
| 1065 | + o.kind := oMem; o.size := sz; | |
| 1066 | + o.m := mem(NoBase, 0); | |
| 1066 | 1067 | repeat |
| 1067 | - if isReg(asmWord(), ADR(r), ADR(size)) and (size = 8) then | |
| 1068 | + if isReg(asmWord(), r, size) and (size = 8) then | |
| 1068 | 1069 | Scan.next; |
| 1069 | 1070 | (* the scale is a single number or constant: a whole expression |
| 1070 | 1071 | would take in the displacement after it, as 4 + 16 in |
| 1071 | 1072 | [rdi + rsi * 4 + 16] *) |
| 1072 | 1073 | if Scan.tok = Scan.sTimes then |
| 1073 | 1074 | Scan.next; |
| 1074 | - o^.m.index := r; | |
| 1075 | + o.m.index := r; | |
| 1075 | 1076 | v := try constExpr(false); |
| 1076 | - o^.m.scale := INT(v); | |
| 1077 | - elsif o^.m.base = NoBase then | |
| 1078 | - o^.m.base := r; | |
| 1077 | + o.m.scale := INT(v); | |
| 1078 | + elsif o.m.base = NoBase then | |
| 1079 | + o.m.base := r; | |
| 1079 | 1080 | else |
| 1080 | - o^.m.index := r; o^.m.scale := 1; | |
| 1081 | + o.m.index := r; o.m.scale := 1; | |
| 1081 | 1082 | end; |
| 1082 | 1083 | else |
| 1083 | 1084 | v := try constExpr(true); |
| 1084 | - o^.m.disp := o^.m.disp + INT(v); | |
| 1085 | + o.m.disp := o.m.disp + INT(v); | |
| 1085 | 1086 | end; |
| 1086 | 1087 | if (Scan.tok # Scan.sPlus) and (Scan.tok # Scan.sMinus) then break; end; |
| 1087 | 1088 | wasMinus := Scan.tok = Scan.sMinus; |
| 1088 | 1089 | Scan.saveScan(st); |
| 1089 | 1090 | Scan.next; |
| 1090 | - isR := isReg(asmWord(), ADR(r), ADR(size)); | |
| 1091 | + isR := isReg(asmWord(), r, size); | |
| 1091 | 1092 | if not isR and wasMinus then Scan.restoreScan(st); end; |
| 1092 | 1093 | until false; |
| 1093 | - if (Scan.tok # Scan.sRbrak) or (o^.m.base = NoBase) | |
| 1094 | - or not ((o^.m.scale = 1) or (o^.m.scale = 2) or (o^.m.scale = 4) or (o^.m.scale = 8)) then | |
| 1094 | + if (Scan.tok # Scan.sRbrak) or (o.m.base = NoBase) | |
| 1095 | + or not ((o.m.scale = 1) or (o.m.scale = 2) or (o.m.scale = 4) or (o.m.scale = 8)) then | |
| 1095 | 1096 | return Scan.mark("expected a memory operand, [base + index * scale + disp]"); |
| 1096 | 1097 | end; |
| 1097 | 1098 | Scan.next; |
| 1098 | 1099 | elsif (w = "cr0") or (w = "cr2") or (w = "cr3") or (w = "cr4") or (w = "cr8") then |
| 1099 | 1100 | (* a control register, for mov to and from a general one *) |
| 1100 | - o^.kind := oCr; o^.r := INT(w[2]) - 48; o^.size := 8; | |
| 1101 | + o.kind := oCr; o.r := INT(w[2]) - 48; o.size := 8; | |
| 1101 | 1102 | Scan.next; |
| 1102 | - elsif isReg(w, ADR(o^.r), ADR(o^.size)) then | |
| 1103 | - if o^.size = 16 then o^.kind := oXmm; else o^.kind := oReg; end; | |
| 1103 | + elsif isReg(w, o.r, o.size) then | |
| 1104 | + if o.size = 16 then o.kind := oXmm; else o.kind := oReg; end; | |
| 1104 | 1105 | Scan.next; |
| 1105 | 1106 | else |
| 1106 | - o^.kind := oImm; | |
| 1107 | - o^.v := try constExpr(true); | |
| 1107 | + o.kind := oImm; | |
| 1108 | + o.v := try constExpr(true); | |
| 1108 | 1109 | end; |
| 1109 | 1110 | return nil; |
| 1110 | 1111 | end; |
| @@ -1434,7 +1435,7 @@ | ||
| 1434 | 1435 | proc atRegister(): BOOL; |
| 1435 | 1436 | var r, size: INT; |
| 1436 | 1437 | begin |
| 1437 | - return isReg(asmWord(), ADR(r), ADR(size)); | |
| 1438 | + return isReg(asmWord(), r, size); | |
| 1438 | 1439 | end; |
| 1439 | 1440 | |
| 1440 | 1441 | (* One instruction or label, as assemble reads it *) |
| @@ -1448,7 +1449,7 @@ | ||
| 1448 | 1449 | Scan.next; |
| 1449 | 1450 | if Scan.tok = Scan.sColon then |
| 1450 | 1451 | sayAt(Chunk.pc, Diag.say("{}:", [Fmt.str(aw)])); |
| 1451 | - k := try lab(Scan.intern(PTR(aw), LEN(aw))); | |
| 1452 | + k := try lab(Scan.intern(SYSTEM.PTR(aw), LEN(aw))); | |
| 1452 | 1453 | if lplaces[k] >= 0 then |
| 1453 | 1454 | return Scan.markAt(aat, Diag.say("label {} is defined twice", [Fmt.str(aw)])); |
| 1454 | 1455 | end; |
| @@ -1494,7 +1495,7 @@ | ||
| 1494 | 1495 | if Scan.tok # Scan.sSemicolon then |
| 1495 | 1496 | repeat |
| 1496 | 1497 | if an > 2 then return Scan.mark("too many operands"); end; |
| 1497 | - try operand(ADR(ao[an]), constExpr); | |
| 1498 | + try operand(ao[an], constExpr); | |
| 1498 | 1499 | INC(an); |
| 1499 | 1500 | if Scan.tok # Scan.sComma then break; end; |
| 1500 | 1501 | Scan.next; |