Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Model registry
Operate
Terraform modules
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
Gesh
GHC
Commits
f9a1e689
Commit
f9a1e689
authored
26 years ago
by
Simon Marlow
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1999-01-26 14:04:46 by simonm]
add missing file.
parent
e9e74aa5
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/includes/Stable.h
+62
-0
62 additions, 0 deletions
ghc/includes/Stable.h
with
62 additions
and
0 deletions
ghc/includes/Stable.h
0 → 100644
+
62
−
0
View file @
f9a1e689
/* -----------------------------------------------------------------------------
* $Id: Stable.h,v 1.1 1999/01/26 14:04:46 simonm Exp $
*
* Stable names and stable pointers
*
* ---------------------------------------------------------------------------*/
/* -----------------------------------------------------------------------------
External C Interface
-------------------------------------------------------------------------- */
extern
StgPtr
deRefStablePtr
(
StgStablePtr
stable_ptr
);
extern
void
freeStablePtr
(
StgStablePtr
sp
);
extern
StgStablePtr
splitStablePtr
(
StgStablePtr
sp
);
/* -----------------------------------------------------------------------------
PRIVATE from here.
-------------------------------------------------------------------------- */
extern
StgStablePtr
getStablePtr
(
StgPtr
p
);
typedef
struct
{
StgPtr
addr
;
/* either Haskell object or free list */
StgWord
weight
;
/* used for reference counting */
unsigned
int
keep
;
/* set by the garbage collector */
}
snEntry
;
extern
snEntry
*
stable_ptr_table
;
extern
snEntry
*
stable_ptr_free
;
extern
unsigned
int
SPT_size
;
extern
inline
StgPtr
deRefStablePtr
(
StgStablePtr
sp
)
{
ASSERT
(
stable_ptr_table
[
sp
&
~
STABLEPTR_WEIGHT_MASK
].
weight
>
0
);
return
stable_ptr_table
[
sp
&
~
STABLEPTR_WEIGHT_MASK
].
addr
;
}
extern
inline
void
freeStablePtr
(
StgStablePtr
sp
)
{
StgWord
sn
=
sp
&
~
STABLEPTR_WEIGHT_MASK
;
ASSERT
(
sn
<
SPT_size
&&
stable_ptr_table
[
sn
].
addr
!=
NULL
&&
stable_ptr_table
[
sn
].
weight
>
0
);
stable_ptr_table
[
sn
].
weight
+=
(
sp
&
STABLEPTR_WEIGHT_MASK
)
>>
STABLEPTR_WEIGHT_SHIFT
;
}
extern
inline
StgStablePtr
splitStablePtr
(
StgStablePtr
sp
)
{
/* doesn't need access to the stable pointer table */
StgWord
weight
=
(
sp
&
STABLEPTR_WEIGHT_MASK
)
/
2
;
return
(
sp
&
~
STABLEPTR_WEIGHT_MASK
)
+
weight
;
}
/* No deRefStableName, because the existence of a stable name doesn't
* guarantee the existence of the object itself.
*/
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