Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tobias Decking
GHC
Commits
164be785
Commit
164be785
authored
Dec 02, 2008
by
Simon Marlow
Browse files
Fix more problems caused by padding in the Capability structure
Fixes crashes on Windows and Sparc
parent
c0378a27
Changes
4
Hide whitespace changes
Inline
Side-by-side
includes/Regs.h
View file @
164be785
...
...
@@ -398,7 +398,7 @@ GLOBAL_REG_DECL(bdescr *,HpAlloc,REG_HpAlloc)
-------------------------------------------------------------------------- */
#define FunReg ((StgFunTable *)((void *)BaseReg -
sizeof(StgFunTable
)))
#define FunReg ((StgFunTable *)((void *)BaseReg -
FIELD_OFFSET(struct PartCapability_, r
)))
#define stg_EAGER_BLACKHOLE_info (FunReg->stgEagerBlackholeInfo)
#define stg_gc_enter_1 (FunReg->stgGCEnter1)
...
...
includes/Stg.h
View file @
164be785
...
...
@@ -74,6 +74,10 @@
#define BITS_PER_BYTE 8
#define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
/* Compute offsets of struct fields
*/
#define FIELD_OFFSET(s_type, field) ((StgWord)&(((s_type*)0)->field))
/*
* 'Portable' inlining:
* INLINE_HEADER is for inline functions in header files (macros)
...
...
rts/Capability.h
View file @
164be785
...
...
@@ -143,12 +143,10 @@ struct Capability_ {
// Converts a *StgRegTable into a *Capability.
//
#define OFFSET(s_type, field) ((size_t)&(((s_type*)0)->field))
INLINE_HEADER
Capability
*
regTableToCapability
(
StgRegTable
*
reg
)
{
return
(
Capability
*
)((
void
*
)((
unsigned
char
*
)
reg
-
OFFSET
(
Capability
,
r
)));
return
(
Capability
*
)((
void
*
)((
unsigned
char
*
)
reg
-
FIELD_
OFFSET
(
Capability
,
r
)));
}
// Initialise the available capabilities.
...
...
rts/Interpreter.c
View file @
164be785
...
...
@@ -1422,7 +1422,7 @@ run_BCO:
ffi_call
(
cif
,
fn
,
ret
,
argptrs
);
// And restart the thread again, popping the RET_DYN frame.
cap
=
(
Capability
*
)((
void
*
)((
unsigned
char
*
)
resumeThread
(
tok
)
-
sizeof
(
StgFunTable
)));
cap
=
(
Capability
*
)((
void
*
)((
unsigned
char
*
)
resumeThread
(
tok
)
-
FIELD_OFFSET
(
Capability
,
r
)));
LOAD_STACK_POINTERS
;
// Re-load the pointer to the BCO from the RET_DYN frame,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment