diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-11-11 21:02:48 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-11-11 21:02:48 +0000 |
commit | 34277c5228d466ffcd4260eea1805ca77972c83c (patch) | |
tree | 6dc91773cd2743418de4eb59e161cb0a4381c77a /libgo/runtime/go-panic.c | |
parent | 292b44341cc5355d353cb652eb3d78d3341c800f (diff) | |
download | gcc-34277c5228d466ffcd4260eea1805ca77972c83c.zip gcc-34277c5228d466ffcd4260eea1805ca77972c83c.tar.gz gcc-34277c5228d466ffcd4260eea1805ca77972c83c.tar.bz2 |
Introduce G structure and thread-local global g.
From-SVN: r181301
Diffstat (limited to 'libgo/runtime/go-panic.c')
-rw-r--r-- | libgo/runtime/go-panic.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/libgo/runtime/go-panic.c b/libgo/runtime/go-panic.c index f3e182d..8b95cd4 100644 --- a/libgo/runtime/go-panic.c +++ b/libgo/runtime/go-panic.c @@ -41,14 +41,10 @@ __go_panic (struct __go_empty_interface arg) { struct __go_panic_stack *n; - if (__go_panic_defer == NULL) - __go_panic_defer = ((struct __go_panic_defer_struct *) - __go_alloc (sizeof (struct __go_panic_defer_struct))); - n = (struct __go_panic_stack *) __go_alloc (sizeof (struct __go_panic_stack)); n->__arg = arg; - n->__next = __go_panic_defer->__panic; - __go_panic_defer->__panic = n; + n->__next = g->panic; + g->panic = n; /* Run all the defer functions. */ @@ -57,7 +53,7 @@ __go_panic (struct __go_empty_interface arg) struct __go_defer_stack *d; void (*pfn) (void *); - d = __go_panic_defer->__defer; + d = g->defer; if (d == NULL) break; @@ -73,7 +69,7 @@ __go_panic (struct __go_empty_interface arg) /* Some defer function called recover. That means that we should stop running this panic. */ - __go_panic_defer->__panic = n->__next; + g->panic = n->__next; __go_free (n); /* Now unwind the stack by throwing an exception. The @@ -96,13 +92,13 @@ __go_panic (struct __go_empty_interface arg) *d->__frame = 0; } - __go_panic_defer->__defer = d->__next; + g->defer = d->__next; __go_free (d); } /* The panic was not recovered. */ - __printpanics (__go_panic_defer->__panic); + __printpanics (g->panic); /* FIXME: We should dump a call stack here. */ abort (); |