diff options
author | Ian Lance Taylor <iant@google.com> | 2016-11-22 17:58:04 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-11-22 17:58:04 +0000 |
commit | 9d1e3afb5484c71eaaea23fc3a4b86fe35418d43 (patch) | |
tree | 2110ef75ee2708c685482ea2ace4dfbf1461d4aa /libgo/go/reflect | |
parent | 6c7509bc070b29293ca9874518b89227ce05361c (diff) | |
download | gcc-9d1e3afb5484c71eaaea23fc3a4b86fe35418d43.tar.gz |
runtime: rewrite panic/defer code from C to Go
The actual stack unwind code is still in C, but the rest of the code,
notably all the memory allocation, is now in Go. The names are changed
to the names used in the Go 1.7 runtime, but the code is necessarily
somewhat different.
The __go_makefunc_can_recover function is dropped, as the uses of it
were removed in https://golang.org/cl/198770044.
Reviewed-on: https://go-review.googlesource.com/33414
From-SVN: r242715
Diffstat (limited to 'libgo/go/reflect')
-rw-r--r-- | libgo/go/reflect/makefunc_ffi_c.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/libgo/go/reflect/makefunc_ffi_c.c b/libgo/go/reflect/makefunc_ffi_c.c index d3935eb0b73..ef5fb9f083f 100644 --- a/libgo/go/reflect/makefunc_ffi_c.c +++ b/libgo/go/reflect/makefunc_ffi_c.c @@ -4,7 +4,6 @@ #include "runtime.h" #include "go-type.h" -#include "go-panic.h" #ifdef USE_LIBFFI @@ -27,9 +26,15 @@ void makeFuncFFI(void *cif, void *impl) function ffiCall with the pointer to the arguments, the results area, and the closure structure. */ -void FFICallbackGo(void *result, void **args, ffi_go_closure *closure) +extern void FFICallbackGo(void *result, void **args, ffi_go_closure *closure) __asm__ (GOSYM_PREFIX "reflect.FFICallbackGo"); +extern void makefuncfficanrecover(Slice) + __asm__ (GOSYM_PREFIX "runtime.makefuncfficanrecover"); + +extern void makefuncreturning(void) + __asm__ (GOSYM_PREFIX "runtime.makefuncreturning"); + static void ffi_callback (ffi_cif *, void *, void **, void *) __asm__ ("reflect.ffi_callback"); @@ -59,12 +64,19 @@ ffi_callback (ffi_cif* cif __attribute__ ((unused)), void *results, break; } if (i < n) - __go_makefunc_ffi_can_recover (locs + i, n - i); + { + Slice s; + + s.__values = (void *) &locs[i]; + s.__count = n - i; + s.__capacity = n - i; + makefuncfficanrecover (s); + } FFICallbackGo(results, args, closure); if (i < n) - __go_makefunc_returning (); + makefuncreturning (); } /* Allocate an FFI closure and arrange to call ffi_callback. */ |