Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Glasgow Haskell Compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
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
Shayne Fletcher
Glasgow Haskell Compiler
Commits
610e4248
Commit
610e4248
authored
Nov 19, 2011
by
dterei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tabs -> Spaces
parent
95768f4a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
67 deletions
+67
-67
includes/Stg.h
includes/Stg.h
+43
-43
rts/StgMiscClosures.cmm
rts/StgMiscClosures.cmm
+24
-24
No files found.
includes/Stg.h
View file @
610e4248
...
...
@@ -117,7 +117,7 @@
* 'Portable' inlining:
* INLINE_HEADER is for inline functions in header files (macros)
* STATIC_INLINE is for inline functions in source files
* EXTERN_INLINE is for functions that we want to inline sometimes
* EXTERN_INLINE is for functions that we want to inline sometimes
* (we also compile a static version of the function; see Inlines.c)
*/
#if defined(__GNUC__) || defined( __INTEL_COMPILER)
...
...
@@ -177,7 +177,7 @@
#define GNU_ATTRIBUTE(at)
#endif
#if __GNUC__ >= 3
#if __GNUC__ >= 3
#define GNUC3_ATTRIBUTE(at) __attribute__((at))
#else
#define GNUC3_ATTRIBUTE(at)
...
...
@@ -202,18 +202,18 @@
Shorthand forms
-------------------------------------------------------------------------- */
typedef
StgChar
C_
;
typedef
StgWord
W_
;
typedef
StgWord
*
P_
;
typedef
StgInt
I_
;
typedef
StgChar
C_
;
typedef
StgWord
W_
;
typedef
StgWord
*
P_
;
typedef
StgInt
I_
;
typedef
StgWord
StgWordArray
[];
typedef
StgFunPtr
F_
;
#define EI_(X) extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
#define II_(X) static StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
#define IF_(f)
static StgFunPtr GNUC3_ATTRIBUTE(used) f(void)
#define FN_(f)
StgFunPtr f(void)
#define EF_(f)
extern StgFunPtr f(void)
#define IF_(f)
static StgFunPtr GNUC3_ATTRIBUTE(used) f(void)
#define FN_(f)
StgFunPtr f(void)
#define EF_(f)
extern StgFunPtr f(void)
/* -----------------------------------------------------------------------------
Tail calls
...
...
@@ -236,25 +236,25 @@ typedef StgFunPtr F_;
#if IN_STG_CODE
/*
* This is included later for RTS sources, after definitions of
* StgInfoTable, StgClosure and so on.
* StgInfoTable, StgClosure and so on.
*/
#include "stg/MiscClosures.h"
#endif
#include "stg/SMP.h" // write_barrier() inline is required
#include "stg/SMP.h" // write_barrier() inline is required
/* -----------------------------------------------------------------------------
Moving Floats and Doubles
ASSIGN_FLT is for assigning a float to memory (usually the
stack/heap). The memory address is guaranteed to be
StgWord aligned (currently == sizeof(void *)).
StgWord aligned (currently == sizeof(void *)).
PK_FLT is for pulling a float out of memory. The memory is
guaranteed to be StgWord aligned.
-------------------------------------------------------------------------- */
INLINE_HEADER
void
ASSIGN_FLT
(
W_
[],
StgFloat
);
INLINE_HEADER
void
ASSIGN_FLT
(
W_
[],
StgFloat
);
INLINE_HEADER
StgFloat
PK_FLT
(
W_
[]);
#if ALIGNMENT_FLOAT <= ALIGNMENT_LONG
...
...
@@ -282,13 +282,13 @@ INLINE_HEADER StgFloat PK_FLT(W_ p_src[])
#if ALIGNMENT_DOUBLE <= ALIGNMENT_LONG
INLINE_HEADER
void
ASSIGN_DBL
(
W_
[],
StgDouble
);
INLINE_HEADER
void
ASSIGN_DBL
(
W_
[],
StgDouble
);
INLINE_HEADER
StgDouble
PK_DBL
(
W_
[]);
INLINE_HEADER
void
ASSIGN_DBL
(
W_
p_dest
[],
StgDouble
src
)
{
*
(
StgDouble
*
)
p_dest
=
src
;
}
INLINE_HEADER
StgDouble
PK_DBL
(
W_
p_src
[])
{
return
*
(
StgDouble
*
)
p_src
;
}
#else
/* ALIGNMENT_DOUBLE > ALIGNMENT_LONG */
#else
/* ALIGNMENT_DOUBLE > ALIGNMENT_LONG */
/* Sparc uses two floating point registers to hold a double. We can
* write ASSIGN_DBL and PK_DBL by directly accessing the registers
...
...
@@ -300,19 +300,19 @@ INLINE_HEADER StgDouble PK_DBL (W_ p_src[]) { return *(StgDou
#define ASSIGN_DBL(dst0,src) \
{ StgPtr dst = (StgPtr)(dst0); \
__asm__("st %2,%0\n\tst %R2,%1" : "=m" (((P_)(dst))[0]), \
"=m" (((P_)(dst))[1]) : "f" (src)); \
"=m" (((P_)(dst))[1]) : "f" (src)); \
}
#define PK_DBL(src0) \
( { StgPtr src = (StgPtr)(src0); \
register double d; \
__asm__("ld %1,%0\n\tld %2,%R0" : "=f" (d) : \
"m" (((P_)(src))[0]), "m" (((P_)(src))[1])); d; \
"m" (((P_)(src))[0]), "m" (((P_)(src))[1])); d; \
} )
#else
/* ! sparc_HOST_ARCH */
INLINE_HEADER
void
ASSIGN_DBL
(
W_
[],
StgDouble
);
INLINE_HEADER
void
ASSIGN_DBL
(
W_
[],
StgDouble
);
INLINE_HEADER
StgDouble
PK_DBL
(
W_
[]);
typedef
struct
...
...
@@ -337,8 +337,8 @@ INLINE_HEADER void ASSIGN_DBL(W_ p_dest[], StgDouble src)
the same code as the previous one, and is not ANSI
#define ASSIGN_DBL( p_dest, src ) \
*p_dest = ((double_thing) src).du.dhi; \
*(p_dest+1) = ((double_thing) src).du.dlo \
*p_dest = ((double_thing) src).du.dhi; \
*(p_dest+1) = ((double_thing) src).du.dlo \
*/
INLINE_HEADER
StgDouble
PK_DBL
(
W_
p_src
[])
...
...
@@ -416,7 +416,7 @@ INLINE_HEADER StgInt64 PK_Int64(W_ p_src[])
INLINE_HEADER
void
ASSIGN_Word64
(
W_
p_dest
[],
StgWord64
src
)
{
p_dest
[
0
]
=
src
;
p_dest
[
0
]
=
src
;
}
INLINE_HEADER
StgWord64
PK_Word64
(
W_
p_src
[])
...
...
@@ -457,12 +457,12 @@ INLINE_HEADER StgInt64 PK_Int64(W_ p_src[])
INLINE_HEADER
void
wcStore
(
StgPtr
p
,
StgWord
w
)
{
#ifdef x86_64_HOST_ARCH
#ifdef x86_64_HOST_ARCH
__asm__
(
"movnti
\t
%1, %0"
:
"=m"
(
*
p
)
:
"r"
(
w
)
);
"movnti
\t
%1, %0"
:
"=m"
(
*
p
)
:
"r"
(
w
)
);
#else
*
p
=
w
;
#endif
...
...
@@ -474,7 +474,7 @@ wcStore (StgPtr p, StgWord w)
/* Multiply with overflow checking.
*
* This is tricky - the usual sign rules for add/subtract don't apply.
* This is tricky - the usual sign rules for add/subtract don't apply.
*
* On 32-bit machines we use gcc's 'long long' types, finding
* overflow with some careful bit-twiddling.
...
...
@@ -504,17 +504,17 @@ typedef union {
StgInt32
i
[
2
];
}
long_long_u
;
#define mulIntMayOflo(a,b)
\
#define mulIntMayOflo(a,b)
\
({ \
StgInt32 r, c;
\
long_long_u z;
\
z.l = (StgInt64)a * (StgInt64)b;
\
r = z.i[RTS_REM_IDX__];
\
c = z.i[RTS_CARRY_IDX__];
\
if (c == 0 || c == -1) {
\
c = ((StgWord)((a^b) ^ r))
\
>> (BITS_IN (I_) - 1);
\
}
\
StgInt32 r, c;
\
long_long_u z;
\
z.l = (StgInt64)a * (StgInt64)b;
\
r = z.i[RTS_REM_IDX__];
\
c = z.i[RTS_CARRY_IDX__];
\
if (c == 0 || c == -1) {
\
c = ((StgWord)((a^b) ^ r))
\
>> (BITS_IN (I_) - 1);
\
}
\
c; \
})
...
...
@@ -531,15 +531,15 @@ typedef union {
#define HALF_POS_INT (((I_)1) << ((BITS_IN (I_) - 1) / 2))
#define HALF_NEG_INT (-HALF_POS_INT)
#define mulIntMayOflo(a,b)
\
#define mulIntMayOflo(a,b)
\
({ \
I_ c;
\
I_ c;
\
if ((I_)a <= HALF_NEG_INT || a >= HALF_POS_INT \
|| (I_)b <= HALF_NEG_INT || b >= HALF_POS_INT) {\
c = 1;
\
} else {
\
c = 0;
\
}
\
c = 1;
\
} else {
\
c = 0;
\
}
\
c; \
})
#endif
...
...
rts/StgMiscClosures.cmm
View file @
610e4248
...
...
@@ -54,7 +54,7 @@ INFO_TABLE_RET (stg_restore_cccs, RET_SMALL, W_ cccs)
/* 9 bits of return code for constructors created by the interpreter. */
stg_interp_constr_entry
{
{
/* R1 points at the constructor */
jump
%ENTRY_CODE
(
Sp
(
0
));
}
...
...
@@ -70,7 +70,7 @@ stg_interp_constr_entry
ptr to BCO holding return continuation
ptr to one of these info tables.
The info table code, both direct and vectored, must:
* push R1/F1/D1 on the stack, and its tag if necessary
* push the BCO (so it's now on the stack twice)
...
...
@@ -102,7 +102,7 @@ INFO_TABLE_RET( stg_ctoi_R1p, RET_BCO)
}
/*
* When the returned value is a pointer, but unlifted, in R1 ...
* When the returned value is a pointer, but unlifted, in R1 ...
*/
INFO_TABLE_RET
(
stg_ctoi_R1unpt
,
RET_BCO
)
{
...
...
@@ -202,7 +202,7 @@ INFO_TABLE_FUN( stg_BCO, 4, 0, BCO, "BCO", "BCO", ARG_BCO )
INFO_TABLE
(
stg_IND
,
1
,
0
,
IND
,
"
IND
"
,
"
IND
"
)
{
TICK_ENT_DYN_IND
();
/* tick */
TICK_ENT_DYN_IND
();
/* tick */
R1
=
UNTAG
(
StgInd_indirectee
(
R1
));
TICK_ENT_VIA_NODE
();
jump
%GET_ENTRY
(
R1
);
...
...
@@ -210,7 +210,7 @@ INFO_TABLE(stg_IND,1,0,IND,"IND","IND")
INFO_TABLE
(
stg_IND_direct
,
1
,
0
,
IND
,
"
IND
"
,
"
IND
"
)
{
TICK_ENT_DYN_IND
();
/* tick */
TICK_ENT_DYN_IND
();
/* tick */
R1
=
StgInd_indirectee
(
R1
);
TICK_ENT_VIA_NODE
();
jump
%ENTRY_CODE
(
Sp
(
0
));
...
...
@@ -218,7 +218,7 @@ INFO_TABLE(stg_IND_direct,1,0,IND,"IND","IND")
INFO_TABLE
(
stg_IND_STATIC
,
1
,
0
,
IND_STATIC
,
"
IND_STATIC
"
,
"
IND_STATIC
"
)
{
TICK_ENT_STATIC_IND
();
/* tick */
TICK_ENT_STATIC_IND
();
/* tick */
R1
=
UNTAG
(
StgInd_indirectee
(
R1
));
TICK_ENT_VIA_NODE
();
jump
%GET_ENTRY
(
R1
);
...
...
@@ -260,7 +260,7 @@ INFO_TABLE(stg_IND_PERM,1,0,IND_PERM,"IND_PERM","IND_PERM")
#endif
jump
%GET_ENTRY
(
R1
);
}
}
/* ----------------------------------------------------------------------------
Black holes.
...
...
@@ -275,7 +275,7 @@ INFO_TABLE(stg_BLACKHOLE,1,0,BLACKHOLE,"BLACKHOLE","BLACKHOLE")
{
W_
r
,
p
,
info
,
bq
,
msg
,
owner
,
bd
;
TICK_ENT_DYN_IND
();
/* tick */
TICK_ENT_DYN_IND
();
/* tick */
retry
:
p
=
StgInd_indirectee
(
R1
);
...
...
@@ -296,13 +296,13 @@ retry:
info
==
stg_BLOCKING_QUEUE_CLEAN_info
||
info
==
stg_BLOCKING_QUEUE_DIRTY_info
)
{
(
"
ptr
"
msg
)
=
foreign
"
C
"
allocate
(
MyCapability
()
"
ptr
"
,
(
"
ptr
"
msg
)
=
foreign
"
C
"
allocate
(
MyCapability
()
"
ptr
"
,
BYTES_TO_WDS
(
SIZEOF_MessageBlackHole
))
[
R1
];
SET_HDR
(
msg
,
stg_MSG_BLACKHOLE_info
,
CCS_SYSTEM
);
MessageBlackHole_tso
(
msg
)
=
CurrentTSO
;
MessageBlackHole_bh
(
msg
)
=
R1
;
(
r
)
=
foreign
"
C
"
messageBlackHole
(
MyCapability
()
"
ptr
"
,
msg
"
ptr
"
)
[
R1
];
if
(
r
==
0
)
{
...
...
@@ -338,18 +338,18 @@ INFO_TABLE(stg_CAF_BLACKHOLE,1,0,BLACKHOLE,"BLACKHOLE","BLACKHOLE")
INFO_TABLE
(
stg_BLOCKING_QUEUE_CLEAN
,
4
,
0
,
BLOCKING_QUEUE
,
"
BLOCKING_QUEUE
"
,
"
BLOCKING_QUEUE
"
)
{
foreign
"
C
"
barf
(
"
BLOCKING_QUEUE_CLEAN object entered!
"
)
never
returns
;
}
INFO_TABLE
(
stg_BLOCKING_QUEUE_DIRTY
,
4
,
0
,
BLOCKING_QUEUE
,
"
BLOCKING_QUEUE
"
,
"
BLOCKING_QUEUE
"
)
{
foreign
"
C
"
barf
(
"
BLOCKING_QUEUE_DIRTY object entered!
"
)
never
returns
;
}
/* ----------------------------------------------------------------------------
Whiteholes are used for the "locked" state of a closure (see lockClosure())
------------------------------------------------------------------------- */
INFO_TABLE
(
stg_WHITEHOLE
,
0
,
0
,
WHITEHOLE
,
"
WHITEHOLE
"
,
"
WHITEHOLE
"
)
{
{
#if
defined
(
THREADED_RTS
)
W_
info
,
i
;
...
...
@@ -514,10 +514,10 @@ CLOSURE(stg_END_TSO_QUEUE_closure,stg_END_TSO_QUEUE);
These come in two basic flavours: arrays of data (StgArrWords) and arrays of
pointers (StgArrPtrs). They all have a similar layout:
___________________________
| Info | No. of | data....
___________________________
| Info | No. of | data....
| Ptr | Words |
---------------------------
---------------------------
These are *unpointed* objects: i.e. they cannot be entered.
...
...
@@ -549,7 +549,7 @@ INFO_TABLE(stg_MUT_VAR_DIRTY, 1, 0, MUT_VAR_DIRTY, "MUT_VAR_DIRTY", "MUT_VAR_DIR
/* ----------------------------------------------------------------------------
Dummy return closure
Entering this closure will just return to the address on the top of the
stack. Useful for getting a thread in a canonical form where we can
just enter the top stack word to start the thread. (see deleteThread)
...
...
@@ -569,7 +569,7 @@ INFO_TABLE_CONSTR(stg_MVAR_TSO_QUEUE,2,0,0,PRIM,"MVAR_TSO_QUEUE","MVAR_TSO_QUEUE
{
foreign
"
C
"
barf
(
"
MVAR_TSO_QUEUE object entered!
"
)
never
returns
;
}
/* ----------------------------------------------------------------------------
CHARLIKE and INTLIKE closures.
CHARLIKE and INTLIKE closures.
These are static representations of Chars and small Ints, so that
we can remove dynamic Chars and Ints during garbage collection and
...
...
@@ -581,9 +581,9 @@ INFO_TABLE_CONSTR(stg_MVAR_TSO_QUEUE,2,0,0,PRIM,"MVAR_TSO_QUEUE","MVAR_TSO_QUEUE
* When sticking the RTS in a Windows DLL, we delay populating the
* Charlike and Intlike tables until load-time, which is only
* when we've got the real addresses to the C# and I# closures.
*
*
-- this is currently broken BL 2009/11/14.
*
we don't rewrite to static closures at all with Windows DLLs.
*
*
-- this is currently broken BL 2009/11/14.
*
we don't rewrite to static closures at all with Windows DLLs.
*/
// #warning Is this correct? _imp is a pointer!
#define
Char_hash_static_info
_imp__ghczmprim_GHCziTypes_Czh_static_info
...
...
@@ -864,7 +864,7 @@ section "data" {
section
"data"
{
stg_INTLIKE_closure
:
INTLIKE_HDR
(
-16
)
/* MIN_INTLIKE == -16 */
INTLIKE_HDR
(
-16
)
/* MIN_INTLIKE == -16 */
INTLIKE_HDR
(
-15
)
INTLIKE_HDR
(
-14
)
INTLIKE_HDR
(
-13
)
...
...
@@ -896,7 +896,7 @@ section "data" {
INTLIKE_HDR
(
13
)
INTLIKE_HDR
(
14
)
INTLIKE_HDR
(
15
)
INTLIKE_HDR
(
16
)
/* MAX_INTLIKE == 16 */
INTLIKE_HDR
(
16
)
/* MAX_INTLIKE == 16 */
}
#endif
// !(defined(__PIC__) && defined(mingw32_HOST_OS))
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