Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,321
Issues
4,321
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
359
Merge Requests
359
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
52589e05
Commit
52589e05
authored
Aug 23, 2006
by
ei@vuokko.info
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add shared Typeable support
parent
22afade6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
0 deletions
+76
-0
includes/RtsTypeable.h
includes/RtsTypeable.h
+19
-0
rts/Linker.c
rts/Linker.c
+2
-0
rts/RtsStartup.c
rts/RtsStartup.c
+7
-0
rts/Typeable.c
rts/Typeable.c
+48
-0
No files found.
includes/RtsTypeable.h
0 → 100644
View file @
52589e05
/* -----------------------------------------------------------------------------
*
* (c) The GHC Team, 2006
*
* Support for shared Typeable
*
* ---------------------------------------------------------------------------*/
#ifndef GHC_RTS_TYPEABLE_H
#define GHC_RTS_TYPEABLE_H
#include "Stg.h"
void
initTypeableStore
(
void
);
void
exitTypeableStore
(
void
);
StgPtr
getOrSetTypeableStore
(
StgPtr
);
#endif
rts/Linker.c
View file @
52589e05
...
...
@@ -27,6 +27,7 @@
#include "Schedule.h"
#include "Storage.h"
#include "Sparks.h"
#include "RtsTypeable.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
...
...
@@ -508,6 +509,7 @@ typedef struct _RtsSymbolVal {
SymX(forkOS_createThread) \
SymX(freeHaskellFunctionPtr) \
SymX(freeStablePtr) \
SymX(getOrSetTypeableStore) \
SymX(gcdIntegerzh_fast) \
SymX(gcdIntegerIntzh_fast) \
SymX(gcdIntzh_fast) \
...
...
rts/RtsStartup.c
View file @
52589e05
...
...
@@ -28,6 +28,7 @@
#include "ThreadLabels.h"
#include "BlockAlloc.h"
#include "Trace.h"
#include "RtsTypeable.h"
#if defined(RTS_GTK_FRONTPANEL)
#include "FrontPanel.h"
...
...
@@ -196,6 +197,9 @@ hs_init(int *argc, char **argv[])
/* initialise the stable pointer table */
initStablePtrTable
();
/* initialise the shared Typeable store */
initTypeableStore
();
#if defined(DEBUG)
/* initialise thread label table (tso->char*) */
initThreadLabelTable
();
...
...
@@ -390,6 +394,9 @@ hs_exit(void)
// also outputs the stats (+RTS -s) info.
exitStorage
();
/* free shared Typeable store */
exitTypeableStore
();
/* initialise the stable pointer table */
exitStablePtrTable
();
...
...
rts/Typeable.c
0 → 100644
View file @
52589e05
#include "RtsTypeable.h"
#include "Rts.h"
static
StgPtr
typeableStore
=
0
;
#ifdef THREADED_RTS
Mutex
typeableStoreLock
;
#endif
void
initTypeableStore
()
{
typeableStore
=
0
;
#ifdef THREADED_RTS
initMutex
(
&
typeableStoreLock
);
#endif
}
void
exitTypeableStore
()
{
#ifdef THREADED_RTS
/* TODO: Free Mutex! */
#endif
if
(
typeableStore
!=
0
)
{
freeStablePtr
((
StgStablePtr
)
typeableStore
);
typeableStore
=
0
;
}
}
StgPtr
getOrSetTypeableStore
(
StgPtr
ptr
)
{
StgPtr
ret
=
typeableStore
;
if
(
ret
==
0
)
{
#ifdef THREADED_RTS
ACQUIRE_LOCK
(
&
typeableStoreLock
);
ret
=
typeableStore
;
if
(
ret
==
0
)
{
#endif
typeableStore
=
ret
=
ptr
;
#ifdef THREADED_RTS
}
RELEASE_LOCK
(
&
typeableStoreLock
);
#endif
}
return
ret
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment