Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

5 changed files:

Changes:

  • changelog.d/28012
    1
    +section: js-backend
    
    2
    +synopsis: The JavaScript RTS now implements ``performMinorGC`` and ``performBlockingMajorGC``; calling them used to throw a JavaScript ``ReferenceError``.
    
    3
    +issues: #28012
    
    4
    +mrs: !16847

  • rts/js/environment.js
    ... ... @@ -389,6 +389,13 @@ function h$performMajorGC() {
    389 389
         if(err) throw err;
    
    390 390
     }
    
    391 391
     
    
    392
    +function h$performGC() {
    
    393
    +    h$performMajorGC();
    
    394
    +}
    
    395
    +
    
    396
    +function h$performBlockingMajorGC() {
    
    397
    +    h$performMajorGC();
    
    398
    +}
    
    392 399
     
    
    393 400
     function h$ghczminternalZCSystemziCPUTimeZCgetrusage() {
    
    394 401
       return 0;
    

  • testsuite/tests/rts/T28012.hs
    1
    +-- Test for #28012.
    
    2
    +-- Check that every GC entry point exported by System.Mem can be called.
    
    3
    +-- The JS RTS used to define only performMajorGC: performMinorGC and
    
    4
    +-- performBlockingMajorGC were foreign imports of C symbols that had no
    
    5
    +-- JS implementation, so calling them threw a ReferenceError at runtime.
    
    6
    +module Main where
    
    7
    +
    
    8
    +import System.Mem
    
    9
    +
    
    10
    +main :: IO ()
    
    11
    +main = do
    
    12
    +  performGC
    
    13
    +  putStrLn "performGC ok"
    
    14
    +  performMinorGC
    
    15
    +  putStrLn "performMinorGC ok"
    
    16
    +  performMajorGC
    
    17
    +  putStrLn "performMajorGC ok"
    
    18
    +  performBlockingMajorGC
    
    19
    +  putStrLn "performBlockingMajorGC ok"

  • testsuite/tests/rts/T28012.stdout
    1
    +performGC ok
    
    2
    +performMinorGC ok
    
    3
    +performMajorGC ok
    
    4
    +performBlockingMajorGC ok

  • testsuite/tests/rts/all.T
    ... ... @@ -757,3 +757,5 @@ test('T27618',
    757 757
          [req_target_smp, omit_ghci],
    
    758 758
          compile_and_run, ['-O2 -threaded -with-rtsopts "-N4 -A32k"'])
    
    759 759
     
    
    760
    +
    
    761
    +test('T28012', normal, compile_and_run, [''])