Skip to content

Commit 588815b

Browse files
committed
got rid of funny pointer magic flag
1 parent 0747c74 commit 588815b

File tree

3 files changed

+675
-717
lines changed

3 files changed

+675
-717
lines changed

Test/Expect/stest184.pasm

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ LR__0023
232232
call #__system___gc_pageindex
233233
wrword result1, __system___gc_tryalloc_saveptr
234234
add __system___gc_tryalloc_ptr, #8
235-
or __system___gc_tryalloc_ptr, imm_1669332992_
236235
mov result1, __system___gc_tryalloc_ptr
237236
__system___gc_tryalloc_ret
238237
ret
@@ -292,13 +291,7 @@ __system___gc_doalloc_ret
292291
ret
293292

294293
__system___gc_isvalidptr
295-
mov _var01, arg03
296-
and _var01, imm_4293918720_
297-
cmp _var01, imm_1669332992_ wz
298-
if_ne mov result1, #0
299-
if_ne jmp #__system___gc_isvalidptr_ret
300294
sub arg03, #8
301-
andn arg03, imm_4293918720_
302295
cmps arg03, arg01 wc
303296
if_b jmp #LR__0040
304297
cmps arg03, arg02 wc
@@ -543,23 +536,19 @@ fp
543536
long 0
544537
imm_1016_
545538
long 1016
546-
imm_1669332992_
547-
long 1669332992
548539
imm_27776_
549540
long 27776
550541
imm_27791_
551542
long 27791
552543
imm_27792_
553544
long 27792
554-
imm_4293918720_
555-
long -1048576
556545
imm_65472_
557546
long 65472
558547
ptr_L__0023_
559548
long @@@LR__0070
560549
ptr_L__0034_
561550
long @@@LR__0071
562-
ptr_L__0060_
551+
ptr_L__0059_
563552
long @@@LR__0072
564553
ptr___system__dat__
565554
long @@@__system__dat_

sys/gcalloc.spin

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ con
8484
' special offsets for block 0
8585
OFF_USED_LINK = 8
8686

87-
' magic constant added to pointers so we can spot them
88-
' more easily
89-
POINTER_MAGIC = $63800000
90-
POINTER_MAGIC_MASK = $fff00000
9187

9288
dat
9389
_memory_mutex
@@ -181,7 +177,7 @@ pri _gc_tryalloc(size, reserveflag) : ptr | availsize, lastptr, nextptr, heap_ba
181177
word[heap_base + OFF_USED_LINK] := _gc_pageindex(heap_base, ptr)
182178

183179
'' and return
184-
return (ptr + headersize) | POINTER_MAGIC
180+
return (ptr + headersize)
185181

186182
pri _gc_errmsg(s) | c
187183
if (__DEBUG__)
@@ -240,11 +236,8 @@ pri _gc_doalloc(size, reserveflag) : ptr | zptr
240236
' points to
241237
'
242238
pri _gc_isvalidptr(base, heap_end, ptr) | t
243-
' make sure the poiter came from alloc
244-
if (ptr & POINTER_MAGIC_MASK) <> POINTER_MAGIC
245-
return 0
246239
' step back to the header
247-
ptr := (ptr - headersize) & (!POINTER_MAGIC_MASK)
240+
ptr := (ptr - headersize)
248241
' make sure it is in the heap
249242
if (ptr < base) or (ptr => heap_end)
250243
return 0

0 commit comments

Comments
 (0)