summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-10-16 14:45:22 +0200
committerCamil Staps2016-10-16 14:45:22 +0200
commit90f4a7f41042241abf4c6a17fc9f1018b6acdf48 (patch)
treed9ec1ccb9f791e749498545bd87bfddebe9e3552
parentlog (diff)
Log
-rw-r--r--log.md64
1 files changed, 64 insertions, 0 deletions
diff --git a/log.md b/log.md
index fb61cdc..693990b 100644
--- a/log.md
+++ b/log.md
@@ -216,7 +216,71 @@ The problem that the copying collector segfaults has to do with `thumb2copy.s`
The issue above arises due to the fact that `r6`, which holds the node address,
has the lowest bit set. Hence, it isn't copied.
+John pointed at a new **problem** that arises with a standard `append` program:
+
+```clean
+append [] ys = ys
+append [x:xs] ys = [x:append xs ys]
+Start = append (fromto 1 15) (fromto 30 40)
+```
+
+This uses `fromto` from above and segfaults with `-h 1k -gcc`. In
+`thumb2copy.s`, `not_in_hnf_2`, the address right above the node entry point is
+loaded. Here, the arity is stored. This should be 2, but the generated assembly
+looks like:
+
+```objdump
+ 10f8e: 00000000 andeq r0, r0, r0
+ 10f92: 00000002 andeq r0, r0, r2
+ 10f96: f8dfbf00 ; <UNDEFINED>
+
+00010f98 <n3>:
+ 10f98: f8df c030 ldr.w ip, [pc, #48]
+ @ etc.
+```
+
+Hence, the instruction `ldr r4,[r6,#-4]` with `r6=0x10f98` reads `0xbf000000`.
+Note that `bf00` is `nop`.
+
### 2016-10-15
As suggested by John on the 13th, this is temporarily fixed by settings the
lowest bit to 0 manually (rts `887b38e`). Should be fixed properly.
+
+**Idea**: if the start of a function would look like
+
+```armasm
+ .align
+ .thumb_func
+n7:
+ nop
+ @ etc.
+```
+
+Then both `=n7` and `=n7+2` are good addresses to `n7`. Hence, bit 1 is free
+for use.
+
+On second thought, this is not necessary: when bit 1 is set, the node is in
+HNF, so we don't jump to it any more.
+
+### 2016-10-16
+
+In the branch rts:gc-flipped and cg:gc-flipped, I'm trying to not
+`orr lr,lr,#1` every time you want to jump to a label (to make sure you stay in
+Thumb mode). It seems the LSB is used only *internally* by the copying
+collector (see above: LSB is set iff the node is a redirection to the other
+semispace = iff it has been copied already). In these branches, the meaning is
+flipped: LSB is cleared under that condition. For nodes being used it would
+then be set, so we don't need to `orr`.
+
+In general the copying collector seems much more difficult than the marking
+collector. Consider e.g. the following programs:
+
+```clean
+Start = fromto 1 100
+Start = take 200 [x \\ x <- fromto 1 100000 | isEven x]
+Start = append (fromto 1 15) (fromto 30 40)
+```
+
+Only the first works in the gc-flipped branches with `-gcc -h 1k`, but all work
+with `-gcm -h 1k`.