From 4349838a315de8ac9ad51ca2e0fa6f80f24f9241 Mon Sep 17 00:00:00 2001
From: Camil Staps
Date: Sun, 5 Mar 2023 19:47:49 +0100
Subject: Implement ap

---
 doc/docs/backend/rts.md | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

(limited to 'doc/docs/backend/rts.md')

diff --git a/doc/docs/backend/rts.md b/doc/docs/backend/rts.md
index d401f3a..36de2ce 100644
--- a/doc/docs/backend/rts.md
+++ b/doc/docs/backend/rts.md
@@ -53,19 +53,18 @@ The arguments of some built-in constructors can be unboxed:
 
 ### Hnf descriptors
 Descriptors of hnf nodes are located in the data section. They contain
-information about the arity of the node. It also contains the number of
-arguments to be curried in, which is 0 for all data constructors but non-zero
-for the [descriptors of closures](#closure-descriptors). (This means that, in
-principle, data constructor descriptors only need a halfword.)
+information about the arity of the node.
 
 ```mipsasm
 	.align	1
 __main_cTuple:
 	.byte	2	# pointer arity
 	.byte	0	# basic value arity
-	.byte	0	# number of arguments to be curried in
 ```
 
+NB: [descriptors of closures](#closure-descriptors) also contain the number of
+arguments to be curried in (minus 1).
+
 ### Thunk descriptors
 Thunk nodes point to the code that can evaluate them. Above this code a
 descriptor is used storing information about arity and strictness:
@@ -78,13 +77,13 @@ __main_nappend:
 	# ...
 ```
 
-!!! warning "Implementation may change"
-	Strictness will probably be removed in the future, as evaluating arguments
-	will be moved out of the driver into generated code (see
-	[evaluation](#evaluation)).
+!!! warning "Implementation will change"
+	Strictness will be removed in the future, as evaluating arguments will be
+	moved out of the driver into generated code (see [evaluation](#evaluation)).
 
-	This also makes the implementation of `ap` simpler, as it does not need to
-	check strictness of the function it evaluates any more.
+	This makes the implementation of `ap` simpler, as it does not need to check
+	strictness of the function it evaluates any more. Currently `ap` assumes all
+	arguments are strict.
 
 ### Closure descriptors
 For each thunk with a non-zero number of arguments there is also a closure
@@ -97,12 +96,12 @@ this:
 	# entry for closure with 0 arguments:
 	.byte	0	# pointer arity
 	.byte	0	# basic value arity
-	.byte	2	# number of arguments that are still to be curried in
+	.byte	1	# number of arguments that are still to be curried in minus 1
 	.byte	0	# reserved
 	# entry for closure with 1 argument:
 	.byte	1	# pointer arity
 	.byte	0	# basic value arity
-	.byte	1	# number of arguments that are still to be curried in
+	.byte	0	# number of arguments that are still to be curried in minus 1
 	.byte	0	# reserved
 	# pointer to corresponding code entry:
 __main_uappend:
-- 
cgit v1.2.3