diff options
author | Simon Marlow <marlowsd@gmail.com> | 2011-06-30 15:50:19 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2011-07-01 09:01:48 +0100 |
commit | 2450eca2c0596eade8dce7d85c7e87bcc848d135 (patch) | |
tree | 328a15627690c04ab3aaee9e470bc4166892b9af | |
parent | 566d1300059476334cf1f4a699dc14f3b98bac99 (diff) | |
download | haskell-2450eca2c0596eade8dce7d85c7e87bcc848d135.tar.gz |
update freeHaskellFuncationPtr following changes to x86 adjustors
(fixes various ffi test failures on x86. This change was supposed to
be part of 9f61598ce7b0cb3448e8f0c3d627c0ca47b7f55f, but somehow it
got lost).
-rw-r--r-- | rts/Adjustor.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/rts/Adjustor.c b/rts/Adjustor.c index 0d5829368f..038c649578 100644 --- a/rts/Adjustor.c +++ b/rts/Adjustor.c @@ -1067,25 +1067,17 @@ TODO: Depending on how much allocation overhead stgMallocBytes uses for void freeHaskellFunctionPtr(void* ptr) { -#if defined(i386_HOST_ARCH) && !defined(darwin_HOST_OS) - if ( *(unsigned char*)ptr != 0x68 && +#if defined(i386_HOST_ARCH) + if ( *(unsigned char*)ptr != 0xe8 && *(unsigned char*)ptr != 0x58 ) { errorBelch("freeHaskellFunctionPtr: not for me, guv! %p\n", ptr); return; } - - /* Free the stable pointer first..*/ - if (*(unsigned char*)ptr == 0x68) { /* Aha, a ccall adjustor! */ - freeStablePtr(*((StgStablePtr*)((unsigned char*)ptr + 0x01))); + if (*(unsigned char*)ptr == 0xe8) { /* Aha, a ccall adjustor! */ + freeStablePtr(((AdjustorStub*)ptr)->hptr); } else { freeStablePtr(*((StgStablePtr*)((unsigned char*)ptr + 0x02))); } -#elif defined(i386_HOST_ARCH) && defined(darwin_HOST_OS) -if ( *(unsigned char*)ptr != 0xe8 ) { - errorBelch("freeHaskellFunctionPtr: not for me, guv! %p\n", ptr); - return; - } - freeStablePtr(((AdjustorStub*)ptr)->hptr); #elif defined(x86_64_HOST_ARCH) if ( *(StgWord16 *)ptr == 0x894d ) { freeStablePtr(*(StgStablePtr*)((StgWord8*)ptr+0x20)); |