summaryrefslogtreecommitdiff
path: root/libgo/runtime/go-panic.c
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-11 21:02:48 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-11 21:02:48 +0000
commitb65306f72d107388210b3cab1fc9989693daa634 (patch)
tree6dc91773cd2743418de4eb59e161cb0a4381c77a /libgo/runtime/go-panic.c
parent74460d8c34a44befb1dff1f3d119ca36257a5978 (diff)
downloadgcc-b65306f72d107388210b3cab1fc9989693daa634.tar.gz
Introduce G structure and thread-local global g.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181301 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime/go-panic.c')
-rw-r--r--libgo/runtime/go-panic.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/libgo/runtime/go-panic.c b/libgo/runtime/go-panic.c
index f3e182d9bcc..8b95cd4e4d1 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 ();