--- /dev/null
+// temp.asm: WORD p_tempused,'TEMPUSED',dovariable
+
+anchor:p_tempused[]
+
+=== Word: TEMPUSED
+
+....
+Data stack: ( -- a )
+....
+
+"TEMPUSED" is a variable word that keeps the lowest offset of the
+<<p__tempspace,TEMPSPACE>> space to use next as temporary space. This
+is advance upon each allocation via <<p_temp,TEMP>>, and recycled back
+to <<p_tempheld,TEMPHELD>> when next allocation otherwise would exceed
+the space size.
include::separator.adoc[]
include::adoc/p_tempspace.adoc[]
include::separator.adoc[]
+include::adoc/p_tempused.adoc[]
+include::separator.adoc[]
include::adoc/p_terminate0.adoc[]
include::separator.adoc[]
include::adoc/p_tfa2cfa.adoc[]
;; Holds size and address of the object space.
dq 1073741824 ; [0] Total object space size (request size)
dq 0 ; [8] Object space base address.
+
+ WORD p_tempused,'TEMPUSED',dovariable
dq 0 ; [16] Currently used.
WORD p_tempheld,'TEMPHELD',dovariable
DOFORTH p_malloc
pop qword [p_objectspace_DFA+8]
p_objecthole_initialized:
+ mov rax,qword [p_tempheld_DFA]
+ cmp rax,qword [p_tempused_DFA]
+ jl p_objecthole_recycle
mov rax,qword [rsp]
- add rax,qword [p_objectspace_DFA+16]
+ add rax,qword [p_tempused_DFA]
cmp rax,qword [p_objectspace_DFA]
jl p_objecthole_from_tail
mov rax,qword [p_tempheld_DFA] ; cycling back to here
- mov qword [p_objectspace_DFA+16],rax
+p_objecthole_recycle:
+ mov qword [p_tempused_DFA],rax
add rax,qword [rsp]
p_objecthole_from_tail:
;; rax = new usage count
- mov rbx,qword [p_objectspace_DFA+16]
+ mov rbx,qword [p_tempused_DFA]
add rbx,qword [p_objectspace_DFA+8]
mov qword [rsp],rbx
- mov qword [p_objectspace_DFA+16],rax
+ mov qword [p_tempused_DFA],rax
popr rsi
next
xref:p_temp.adoc[TEMP] {nbsp}
xref:p_tempheld.adoc[TEMPHELD] {nbsp}
xref:p_tempspace[TEMPSPACE] {nbsp}
+xref:p_tempused.adoc[TEMPUSED] {nbsp}
xref:p_terminate0[TERMINATE0] {nbsp}
xref:p_tfa2cfa[TFA>CFA] {nbsp}
xref:p_tfa2dfa[TFA>DFA] {nbsp}