| ... |
... |
@@ -25,19 +25,19 @@ import GHC.StgToCmm.Layout |
|
25
|
25
|
import GHC.StgToCmm.Foreign
|
|
26
|
26
|
import GHC.StgToCmm.Monad
|
|
27
|
27
|
import GHC.StgToCmm.Utils
|
|
28
|
|
-import GHC.StgToCmm.Lit ( newStringCLit )
|
|
|
28
|
+import GHC.StgToCmm.Lit ( newByteStringCLit )
|
|
29
|
29
|
import GHC.StgToCmm.Ticky
|
|
30
|
30
|
import GHC.StgToCmm.Heap
|
|
31
|
31
|
import GHC.StgToCmm.Prof ( costCentreFrom )
|
|
32
|
32
|
|
|
33
|
33
|
import GHC.Types.Basic
|
|
34
|
|
-import GHC.Types.Name.Occurrence ( occNameString )
|
|
|
34
|
+import GHC.Types.Name.Occurrence ( occNameFS )
|
|
35
|
35
|
import GHC.Types.Literal.Floating
|
|
36
|
36
|
import GHC.Cmm.BlockId
|
|
37
|
37
|
import GHC.Cmm.Graph
|
|
38
|
38
|
import GHC.Stg.Syntax
|
|
39
|
39
|
import GHC.Cmm
|
|
40
|
|
-import GHC.Unit ( rtsUnit )
|
|
|
40
|
+import GHC.Unit ( rtsUnit, moduleName, moduleNameFS )
|
|
41
|
41
|
import GHC.Core.Type ( Type, tyConAppTyCon_maybe )
|
|
42
|
42
|
import GHC.Core.TyCon
|
|
43
|
43
|
import GHC.Cmm.CLabel
|
| ... |
... |
@@ -101,7 +101,7 @@ cmmPrimOpApp cfg primop cmm_args mres_ty = do |
|
101
|
101
|
-- error message. Guarded by the flag so that the common (unchecked) case pays
|
|
102
|
102
|
-- nothing: no name thunk, no FCodeState update.
|
|
103
|
103
|
if stgToCmmDoBoundsCheck cfg
|
|
104
|
|
- then withCurrentPrimOpName (occNameString (primOpOcc primop)) (f res_ty)
|
|
|
104
|
+ then withCurrentPrimOpName (occNameFS (primOpOcc primop)) (f res_ty)
|
|
105
|
105
|
else f res_ty
|
|
106
|
106
|
|
|
107
|
107
|
externalPrimop :: PrimOp -> [CmmExpr] -> PrimopCmmEmit
|
| ... |
... |
@@ -3623,8 +3623,8 @@ emitCheckedMemcpyCall dst src n align = do |
|
3623
|
3623
|
emitMemcpyCall dst src n align
|
|
3624
|
3624
|
where
|
|
3625
|
3625
|
doCheck platform = do
|
|
3626
|
|
- name <- fromMaybe "<unknown primop>" <$> getCurrentPrimOpName
|
|
3627
|
|
- nameLbl <- newStringCLit name
|
|
|
3626
|
+ name <- fromMaybe (fsLit "<unknown primop>") <$> getCurrentPrimOpName
|
|
|
3627
|
+ nameLbl <- newByteStringCLit (bytesFS name)
|
|
3628
|
3628
|
modLbl <- getCurrentModuleCLit
|
|
3629
|
3629
|
overlapCheckFailed <- getCode $
|
|
3630
|
3630
|
emitCCallNeverReturns []
|
| ... |
... |
@@ -3742,13 +3742,12 @@ whenCheckBounds a = do |
|
3742
|
3742
|
False -> pure ()
|
|
3743
|
3743
|
True -> a
|
|
3744
|
3744
|
|
|
3745
|
|
--- | Render the module currently being code-generated as a string literal, for
|
|
3746
|
|
--- use in @-fcheck-prim-bounds@ failure diagnostics.
|
|
|
3745
|
+-- | The bare name of the module currently being code-generated, as a string
|
|
|
3746
|
+-- literal, for use in @-fcheck-prim-bounds@ failure diagnostics.
|
|
3747
|
3747
|
getCurrentModuleCLit :: FCode CmmLit
|
|
3748
|
3748
|
getCurrentModuleCLit = do
|
|
3749
|
3749
|
mod <- getModuleName
|
|
3750
|
|
- ctx <- getContext
|
|
3751
|
|
- newStringCLit (renderWithContext ctx (ppr mod))
|
|
|
3750
|
+ newByteStringCLit (bytesFS (moduleNameFS (moduleName mod)))
|
|
3752
|
3751
|
|
|
3753
|
3752
|
-- | Emit a call to the RTS @rtsOutOfBoundsAccess@ bounds-check failure
|
|
3754
|
3753
|
-- handler, passing the offending index, element count, array size, primop name
|
| ... |
... |
@@ -3758,8 +3757,8 @@ emitBoundsCheckFailed :: CmmExpr -- ^ accessed index |
|
3758
|
3757
|
-> CmmExpr -- ^ array size (in elements)
|
|
3759
|
3758
|
-> FCode ()
|
|
3760
|
3759
|
emitBoundsCheckFailed idx count sz = do
|
|
3761
|
|
- name <- fromMaybe "<unknown primop>" <$> getCurrentPrimOpName
|
|
3762
|
|
- nameLbl <- newStringCLit name
|
|
|
3760
|
+ name <- fromMaybe (fsLit "<unknown primop>") <$> getCurrentPrimOpName
|
|
|
3761
|
+ nameLbl <- newByteStringCLit (bytesFS name)
|
|
3763
|
3762
|
modLbl <- getCurrentModuleCLit
|
|
3764
|
3763
|
emitCCallNeverReturns []
|
|
3765
|
3764
|
(mkLblExpr mkOutOfBoundsAccessLabel)
|