Various MSVC-related changes.

This commit is contained in:
Peter Rosin
2012-03-30 08:14:08 -04:00
committed by Anthony Green
parent e1539266e6
commit 0a1ab12a8d
167 changed files with 20323 additions and 350 deletions

View File

@@ -121,6 +121,7 @@ ca_jumpdata:
dd offset ca_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B
dd offset ca_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B
dd offset ca_retint ;; FFI_TYPE_SMALL_STRUCT_4B
dd offset ca_epilogue ;; FFI_TYPE_MS_STRUCT
ca_retint8:
;; Load %ecx with the pointer to storage for the return value
@@ -171,8 +172,6 @@ ca_epilogue:
ffi_call_win32 ENDP
ffi_closure_THISCALL PROC NEAR FORCEFRAME
push ebp
mov ebp, esp
sub esp, 40
lea edx, [ebp -24]
mov [ebp - 12], edx /* resp */
@@ -217,6 +216,7 @@ cs_jumpdata:
dd offset cs_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B
dd offset cs_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B
dd offset cs_retint ;; FFI_TYPE_SMALL_STRUCT_4B
dd offset cs_retmsstruct ;; FFI_TYPE_MS_STRUCT
cs_retint8:
mov al, [ecx]
@@ -252,6 +252,12 @@ cs_retstruct:
;; Epilogue code is autogenerated.
ret 4
cs_retmsstruct:
;; Caller expects us to return a pointer to the real return value.
mov eax, ecx
;; Caller doesn't expects us to pop struct return value pointer hidden arg.
jmp cs_epilogue
cs_epilogue:
;; Epilogue code is autogenerated.
ret
@@ -264,19 +270,16 @@ ffi_closure_SYSV ENDP
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
#define CIF_FLAGS_OFFSET 20
ffi_closure_raw_THISCALL PROC NEAR
push ebp
mov ebp, esp
push esi
ffi_closure_raw_THISCALL PROC NEAR USES esi FORCEFRAME
sub esp, 36
mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif
mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data
mov [esp + 12], edx
lea edx, [ebp + 12], edx
lea edx, [ebp + 12]
jmp stubraw
ffi_closure_raw_SYSV ENDP
ffi_closure_raw_THISCALL ENDP
ffi_closure_raw_SYSV PROC NEAR USES esi
ffi_closure_raw_SYSV PROC NEAR USES esi FORCEFRAME
;; the ffi_closure ctx is passed in eax by the trampoline.
sub esp, 40
@@ -284,7 +287,7 @@ ffi_closure_raw_SYSV PROC NEAR USES esi
mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data
mov [esp + 12], edx ;; user_data
lea edx, [ebp + 8]
stubraw:
stubraw::
mov [esp + 8], edx ;; raw_args
lea edx, [ebp - 24]
mov [esp + 4], edx ;; &res
@@ -315,6 +318,7 @@ cr_jumpdata:
dd offset cr_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B
dd offset cr_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B
dd offset cr_retint ;; FFI_TYPE_SMALL_STRUCT_4B
dd offset cr_epilogue ;; FFI_TYPE_MS_STRUCT
cr_retint8:
mov al, [ecx]
@@ -515,6 +519,7 @@ _ffi_call_win32:
.long .Lretstruct1b /* FFI_TYPE_SMALL_STRUCT_1B */
.long .Lretstruct2b /* FFI_TYPE_SMALL_STRUCT_2B */
.long .Lretstruct4b /* FFI_TYPE_SMALL_STRUCT_4B */
.long .Lretstruct /* FFI_TYPE_MS_STRUCT */
1:
add %ecx, %ecx
add %ecx, %ecx
@@ -657,6 +662,7 @@ _ffi_closure_SYSV:
.long .Lcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */
.long .Lcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */
.long .Lcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */
.long .Lcls_retmsstruct /* FFI_TYPE_MS_STRUCT */
1:
add %eax, %eax
@@ -721,6 +727,12 @@ _ffi_closure_SYSV:
popl %ebp
ret $0x4
.Lcls_retmsstruct:
# Caller expects us to return a pointer to the real return value.
mov %ecx, %eax
# Caller doesn't expects us to pop struct return value pointer hidden arg.
jmp .Lcls_epilogue
.Lcls_noretval:
.Lcls_epilogue:
movl %ebp, %esp
@@ -798,6 +810,7 @@ _ffi_closure_raw_SYSV:
.long .Lrcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */
.long .Lrcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */
.long .Lrcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */
.long .Lrcls_retstruct /* FFI_TYPE_MS_STRUCT */
1:
add %eax, %eax
add %eax, %eax