projects
/
rrq
/
rrqforth.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6d52695
)
BUG fix: avoid cycling unless needed
master
author
Ralph Ronnquist
<rrq@rrq.au>
Mon, 29 Dec 2025 22:27:44 +0000
(09:27 +1100)
committer
Ralph Ronnquist
<rrq@rrq.au>
Mon, 29 Dec 2025 22:27:44 +0000
(09:27 +1100)
temp.asm
patch
|
blob
|
history
diff --git
a/temp.asm
b/temp.asm
index 932b1bb3e9e26bf4bf9d3fce01cbc231bbc171af..8931fd4273873c339145d6b8ab762fec45487354 100644
(file)
--- a/
temp.asm
+++ b/
temp.asm
@@
-21,31
+21,36
@@
dq 0 ; [24] Currently held.
WORD p_temp,'TEMP',fasm
dq 0 ; [24] Currently held.
WORD p_temp,'TEMP',fasm
- ;; ( size -- addr )
- ;; Allocate an object of given size
+ ;; ( n -- a ; allocate a temp region of given size )
pushr rsi
cmp qword [p_objectspace_DFA+8],0
pushr rsi
cmp qword [p_objectspace_DFA+8],0
- jg p_objecthole_initialized
- ;; initialize object space
+ jg p_temp_initialized
push qword [p_objectspace_DFA]
DOFORTH p_malloc
pop qword [p_objectspace_DFA+8]
push qword [p_objectspace_DFA]
DOFORTH p_malloc
pop qword [p_objectspace_DFA+8]
-p_objecthole_initialized:
+p_temp_initialized:
+ ;;-- temp space is initialised (allocated)
+ ;;---- first test for a possible "forced cycling", in case
+ ;;---- TEMPHELD@ has been moved above TEMPUSED@.
mov rax,qword [p_tempheld_DFA]
cmp rax,qword [p_tempused_DFA]
mov rax,qword [p_tempheld_DFA]
cmp rax,qword [p_tempused_DFA]
- jl p_objecthole_recycle
+ jg p_temp_cycle
+p_temp_checklimit:
+ ;;-- consider using object at TEMPUSED@
mov rax,qword [rsp]
add rax,qword [p_tempused_DFA]
cmp rax,qword [p_objectspace_DFA]
mov rax,qword [rsp]
add rax,qword [p_tempused_DFA]
cmp rax,qword [p_objectspace_DFA]
- jl p_objecthole_from_tail
+ jl p_temp_from_tail ; jmp = tail is large enough
+p_temp_cycle:
+ ;;-- recycle temp space from TEMPHELD@
mov rax,qword [p_tempheld_DFA] ; cycling back to here
mov rax,qword [p_tempheld_DFA] ; cycling back to here
-p_objecthole_recycle:
mov qword [p_tempused_DFA],rax
add rax,qword [rsp]
mov qword [p_tempused_DFA],rax
add rax,qword [rsp]
-p_objecthole_from_tail:
+ ;;-- note that possible tail overflow is ignored here!!
+p_temp_from_tail:
;; rax = new usage count
mov rbx,qword [p_tempused_DFA]
;; rax = new usage count
mov rbx,qword [p_tempused_DFA]
- add rbx,qword [p_objectspace_DFA+8]
+ add rbx,qword [p_objectspace_DFA+8]
; form actual pointer
mov qword [rsp],rbx
mov qword [p_tempused_DFA],rax
popr rsi
mov qword [rsp],rbx
mov qword [p_tempused_DFA],rax
popr rsi