JS: fix h$appendToHsString implementation (#24495)
h$appendToHsString needs to wrap its argument in an updatable thunk to behave like unpackAppendCString#. Otherwise if a SingleEntry thunk is passed, it is stored as-is in a CONS cell, making the resulting list impossible to deepseq (forcing the thunk doesn't update the contents of the CONS cell)! The added test checks that the optimization kicks in and that h$appendToHsString works as intended. Fix #24495 (cherry picked from commit 527616e9)
Showing
- compiler/GHC/StgToJS/Linker/Utils.hs 3 additions, 0 deletionscompiler/GHC/StgToJS/Linker/Utils.hs
- compiler/GHC/StgToJS/Rts/Rts.hs 13 additions, 0 deletionscompiler/GHC/StgToJS/Rts/Rts.hs
- rts/js/string.js 4 additions, 1 deletionrts/js/string.js
- testsuite/tests/javascript/Makefile 9 additions, 0 deletionstestsuite/tests/javascript/Makefile
- testsuite/tests/javascript/T24495.hs 22 additions, 0 deletionstestsuite/tests/javascript/T24495.hs
- testsuite/tests/javascript/T24495.stdout 2 additions, 0 deletionstestsuite/tests/javascript/T24495.stdout
- testsuite/tests/javascript/all.T 1 addition, 0 deletionstestsuite/tests/javascript/all.T
Loading
Please register or sign in to comment