// Functions for Exception Support for Java.
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation
This file is part of libgcj.
#include <gcj/cni.h>
#include <jvm.h>
-#include "unwind.h"
-
-\f
-// More nastiness: the GC wants to define TRUE and FALSE. We don't
-// need the Java definitions (themselves a hack), so we undefine them.
-#undef TRUE
-#undef FALSE
-
-extern "C"
+// unwind-pe.h uses std::abort(), but sometimes we compile libjava
+// without libstdc++-v3. The following hack forces it to use
+// stdlib.h's abort().
+namespace std
{
-#include <gc_priv.h>
-#include <gc_mark.h>
-#include <include/gc_gcj.h>
-};
+ static __attribute__ ((__noreturn__)) void
+ abort ()
+ {
+ ::abort ();
+ }
+}
+#include "unwind.h"
-\f
struct alignment_test_struct
{
char space;
extern "C" void
_Jv_Throw (jthrowable value)
{
- /* FIXME: Use the proper API to the collector. */
java_exception_header *xh
- = static_cast<java_exception_header *>(GC_malloc (sizeof (*xh)));
+ = static_cast<java_exception_header *>(_Jv_AllocRawObj (sizeof (*xh)));
if (value == NULL)
value = new java::lang::NullPointerException ();
recover. As is the way of such things, almost certainly we will have
crashed before now, rather than actually being able to diagnose the
problem. */
- abort ();
+ abort();
}
\f
parse_lsda_header (_Unwind_Context *context, const unsigned char *p,
lsda_header_info *info)
{
- _Unwind_Ptr tmp;
+ _Unwind_Word tmp;
unsigned char lpstart_encoding;
info->Start = (context ? _Unwind_GetRegionStart (context) : 0);
return _URC_CONTINUE_UNWIND;
else
{
- _Unwind_Ptr cs_lp, cs_action;
+ _Unwind_Word cs_lp, cs_action;
do
{
p = read_uleb128 (p, &cs_lp);
// Search the call-site table for the action associated with this IP.
while (p < info.action_table)
{
- _Unwind_Ptr cs_start, cs_len, cs_lp, cs_action;
+ _Unwind_Ptr cs_start, cs_len, cs_lp;
+ _Unwind_Word cs_action;
// Note that all call-site encodings are "absolute" displacements.
p = read_encoded_value (0, info.call_site_encoding, p, &cs_start);
else
{
// Otherwise we have a catch handler.
- signed long ar_filter, ar_disp;
+ _Unwind_Sword ar_filter, ar_disp;
while (1)
{
- _Unwind_Ptr tmp;
-
p = action_record;
- p = read_sleb128 (p, &tmp); ar_filter = tmp;
- read_sleb128 (p, &tmp); ar_disp = tmp;
+ p = read_sleb128 (p, &ar_filter);
+ read_sleb128 (p, &ar_disp);
if (ar_filter == 0)
{
// The catch_type is either a (java::lang::Class*) or
// is one more than a (Utf8Const*).
if ((size_t)catch_type & 1)
- catch_type = _Jv_FindClass ((Utf8Const*)catch_type - 1, NULL);
+ catch_type = _Jv_FindClass ((Utf8Const*)((size_t)catch_type ^ 1), NULL);
if (_Jv_IsInstanceOf (xh->value, catch_type))
{