Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
ghc-debug
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
ghc-debug
Commits
60b60621
Commit
60b60621
authored
1 year ago
by
Matthew Pickering
Browse files
Options
Downloads
Patches
Plain Diff
Fix warnings in Decode module
parent
286c137d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#88499
passed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/src/GHC/Debug/Decode.hs
+3
-37
3 additions, 37 deletions
common/src/GHC/Debug/Decode.hs
with
3 additions
and
37 deletions
common/src/GHC/Debug/Decode.hs
+
3
−
37
View file @
60b60621
...
...
@@ -13,53 +13,19 @@ module GHC.Debug.Decode ( decodeClosure
,
decodeInfoTable
)
where
import
GHC.Ptr
(
plusPtr
,
castPtr
)
import
GHC.Exts
hiding
(
closureSize
#
)
-- (Addr#, unsafeCoerce#, Any, Word#, ByteArray#)
-- (Addr#, unsafeCoerce#, Any, Word#, ByteArray#)
import
GHC.Word
import
GHC.IO.Unsafe
import
Foreign.Storable
import
qualified
Data.ByteString.Internal
as
BSI
import
Data.ByteString.Short.Internal
(
ShortByteString
(
..
),
toShort
)
import
qualified
Data.ByteString.Lazy
as
BSL
import
GHC.Debug.Types.Ptr
import
GHC.Debug.Types.Version
import
GHC.Debug.Types.Closures
import
Foreign.Marshal.Alloc
(
allocaBytes
)
import
Foreign.ForeignPtr
(
withForeignPtr
)
import
Data.Binary.Get
as
B
import
Data.Binary
import
Control.Monad
import
Data.Void
import
Control.DeepSeq
import
Foreign.Marshal.Utils
(
copyBytes
)
import
Data.Functor
import
Data.Bits
import
qualified
Data.ByteString
as
B
foreign
import
prim
"unpackClosurePtrzh"
unpackClosurePtr
#
::
Addr
#
->
(
#
ByteArray
#
#
)
foreign
import
prim
"closureSizezh"
closureSize
#
::
Addr
#
->
(
#
Word
#
#
)
-- | Allow access directly to the chunk of memory used by a bytestring
allocate
::
BSI
.
ByteString
->
(
Ptr
a
->
IO
a
)
->
IO
a
allocate
=
allocateByCopy
-- | Allocate a bytestring directly into memory and return a pointer to the
-- allocated buffer
allocateByCopy
::
BSI
.
ByteString
->
(
Ptr
a
->
IO
a
)
->
IO
a
allocateByCopy
(
BSI
.
PS
fp
o
l
)
action
=
allocaBytes
l
$
\
buf
->
withForeignPtr
fp
$
\
p
->
do
--print (fp, o, l)
copyBytes
buf
(
p
`
plusPtr
`
o
)
(
fromIntegral
l
)
action
(
castPtr
buf
)
decodeClosureHeader
::
Version
->
Get
(
Maybe
ProfHeaderWithPtr
)
decodeClosureHeader
ver
=
do
()
<$
skip
(
8
*
1
)
...
...
@@ -251,10 +217,10 @@ ceilIntDiv :: Integral a => a -> a -> a
ceilIntDiv
a
b
=
(
a
+
b
-
1
)
`
div
`
b
tsoVersionChanged
::
Version
->
Bool
tsoVersionChanged
(
Version
maj
min
_
_
)
=
(
maj
>
905
)
||
(
maj
==
905
&&
min
>=
20220925
)
tsoVersionChanged
(
Version
maj
v
min
v
_
_
)
=
(
maj
v
>
905
)
||
(
maj
v
==
905
&&
min
v
>=
20220925
)
weakNotNull
::
Version
->
Bool
weakNotNull
(
Version
maj
min
_
_
)
=
(
maj
>
904
)
||
(
maj
==
904
&&
min
>=
2
)
weakNotNull
(
Version
maj
v
min
v
_
_
)
=
(
maj
v
>
904
)
||
(
maj
v
==
904
&&
min
v
>=
2
)
decodeTSO
::
Version
->
(
StgInfoTableWithPtr
,
RawInfoTable
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment