Skip to content

Numeric exceptions: replace FFI calls with primops (#21078)

Sylvain Henry requested to merge hsyl20/ghc:hsyl20/exception-primops into master

ghc-bignum needs a way to raise numerical exceptions defined in base package. At the time we used FFI calls into primops defined in the RTS. These FFI calls had to be wrapped into hacky bottoming functions because "foreign import prim" syntax doesn't support giving a bottoming demand to the foreign call (cf #16929).

These hacky wrapper functions trip up the JavaScript backend (#21078 (closed)) because they are levity polymorphic in their return type. This commit replaces them with primops very similar to raise# but raising predefined exceptions.

Merge request reports