summaryrefslogtreecommitdiff
path: root/compiler/ghci/ByteCodeAsm.hs
diff options
context:
space:
mode:
authorSylvain Henry <hsyl20@gmail.com>2018-11-22 11:31:16 -0500
committerBen Gamari <ben@smart-cactus.org>2018-11-22 12:11:15 -0500
commit13bb4bf44e6e690133be334bbf0c63fcae5db34a (patch)
treeee7a9a9f60ca936b16cc15a46c758d4dc51abfd7 /compiler/ghci/ByteCodeAsm.hs
parentf5fbecc85967218fd8ba6512f10eea2daf2812ac (diff)
downloadhaskell-13bb4bf44e6e690133be334bbf0c63fcae5db34a.tar.gz
Rename literal constructors
In a previous patch we replaced some built-in literal constructors (MachInt, MachWord, etc.) with a single LitNumber constructor. In this patch we replace the `Mach` prefix of the remaining constructors with `Lit` for consistency (e.g., LitChar, LitLabel, etc.). Sadly the name `LitString` was already taken for a kind of FastString and it would become misleading to have both `LitStr` (literal constructor renamed after `MachStr`) and `LitString` (FastString variant). Hence this patch renames the FastString variant `PtrString` (which is more accurate) and the literal string constructor now uses the least surprising `LitString` name. Both `Literal` and `LitString/PtrString` have recently seen breaking changes so doing this kind of renaming now shouldn't harm much. Reviewers: hvr, goldfire, bgamari, simonmar, jrtc27, tdammers Subscribers: tdammers, rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4881
Diffstat (limited to 'compiler/ghci/ByteCodeAsm.hs')
-rw-r--r--compiler/ghci/ByteCodeAsm.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/ghci/ByteCodeAsm.hs b/compiler/ghci/ByteCodeAsm.hs
index 4473a9e9b2..0776e406d6 100644
--- a/compiler/ghci/ByteCodeAsm.hs
+++ b/compiler/ghci/ByteCodeAsm.hs
@@ -441,18 +441,18 @@ assembleI dflags i = case i of
Op q, Op np]
where
- literal (MachLabel fs (Just sz) _)
+ literal (LitLabel fs (Just sz) _)
| platformOS (targetPlatform dflags) == OSMinGW32
= litlabel (appendFS fs (mkFastString ('@':show sz)))
-- On Windows, stdcall labels have a suffix indicating the no. of
-- arg words, e.g. foo@8. testcase: ffi012(ghci)
- literal (MachLabel fs _ _) = litlabel fs
- literal MachNullAddr = int 0
- literal (MachFloat r) = float (fromRational r)
- literal (MachDouble r) = double (fromRational r)
- literal (MachChar c) = int (ord c)
- literal (MachStr bs) = lit [BCONPtrStr bs]
- -- MachStr requires a zero-terminator when emitted
+ literal (LitLabel fs _ _) = litlabel fs
+ literal LitNullAddr = int 0
+ literal (LitFloat r) = float (fromRational r)
+ literal (LitDouble r) = double (fromRational r)
+ literal (LitChar c) = int (ord c)
+ literal (LitString bs) = lit [BCONPtrStr bs]
+ -- LitString requires a zero-terminator when emitted
literal (LitNumber nt i _) = case nt of
LitNumInt -> int (fromIntegral i)
LitNumWord -> int (fromIntegral i)
@@ -460,10 +460,10 @@ assembleI dflags i = case i of
LitNumWord64 -> int64 (fromIntegral i)
LitNumInteger -> panic "ByteCodeAsm.literal: LitNumInteger"
LitNumNatural -> panic "ByteCodeAsm.literal: LitNumNatural"
- -- We can lower 'RubbishLit' to an arbitrary constant, but @NULL@ is most
+ -- We can lower 'LitRubbish' to an arbitrary constant, but @NULL@ is most
-- likely to elicit a crash (rather than corrupt memory) in case absence
-- analysis messed up.
- literal RubbishLit = int 0
+ literal LitRubbish = int 0
litlabel fs = lit [BCONPtrLbl fs]
addr (RemotePtr a) = words [fromIntegral a]