diff options
author | Camil Staps | 2016-10-16 14:45:22 +0200 |
---|---|---|
committer | Camil Staps | 2016-10-16 14:45:22 +0200 |
commit | 90f4a7f41042241abf4c6a17fc9f1018b6acdf48 (patch) | |
tree | d9ec1ccb9f791e749498545bd87bfddebe9e3552 | |
parent | log (diff) |
Log
-rw-r--r-- | log.md | 64 |
1 files changed, 64 insertions, 0 deletions
@@ -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`. |