link.cc: Added variant of create_error_method that will not complain about unused...

2006-02-21  Robert Schuster  <robertschuster@fsfe.org>

        * link.cc: Added variant of create_error_method that
        will not complain about unused parameter if compiled with
        USE_LIBFFI not being defined.
        (_Jv_Linker::find_field_helper): Fixed indentation.
        (_Jv_Linker::create_error_method): Fixed indentation.
        (_Jv_Linker::link_symbol_table): Fixed indentation.

From-SVN: r111331
This commit is contained in:
Robert Schuster 2006-02-21 10:32:31 +00:00 committed by Robert Schuster
parent f5e605e540
commit 592fb5106a
2 changed files with 27 additions and 14 deletions

View File

@ -1,3 +1,12 @@
2006-02-21 Robert Schuster <robertschuster@fsfe.org>
* link.cc: Added variant of create_error_method that
will not complain about unused parameter if compiled with
USE_LIBFFI not being defined.
(_Jv_Linker::find_field_helper): Fixed indentation.
(_Jv_Linker::create_error_method): Fixed indentation.
(_Jv_Linker::link_symbol_table): Fixed indentation.
2006-02-16 Andrew Haley <aph@redhat.com>
* stacktrace.cc (GetStackTraceElements): Call

View File

@ -142,10 +142,10 @@ _Jv_Linker::find_field_helper (jclass search, _Jv_Utf8Const *name,
// pass in the descriptor and check that way, because when
// the field is already resolved there is no easy way to
// find its descriptor again.
if ( (field->isResolved () ?
_Jv_equalUtf8Classnames (type_name, field->type->name) :
_Jv_equalUtf8Classnames (
type_name, (_Jv_Utf8Const *) field->type)) )
if ((field->isResolved ()
? _Jv_equalUtf8Classnames (type_name, field->type->name)
: _Jv_equalUtf8Classnames (type_name,
(_Jv_Utf8Const *) field->type)))
{
*declarer = search;
return field;
@ -771,7 +771,7 @@ _Jv_ThrowNoClassDefFoundErrorTrampoline(ffi_cif *,
void *data)
{
throw new java::lang::NoClassDefFoundError(
_Jv_NewStringUtf8Const( (_Jv_Utf8Const *) data));
_Jv_NewStringUtf8Const((_Jv_Utf8Const *) data));
}
#else
// A variant of the NoClassDefFoundError throwing method that can
@ -947,7 +947,6 @@ _Jv_Linker::find_iindex (jclass *ifaces, jshort *offsets, jshort num)
}
#ifdef USE_LIBFFI
// We use a structure of this type to store the closure that
// represents a missing method.
struct method_closure
@ -960,12 +959,9 @@ struct method_closure
ffi_type *arg_types[1];
};
#endif // USE_LIBFFI
void *
_Jv_Linker::create_error_method (_Jv_Utf8Const *class_name)
{
#ifdef USE_LIBFFI
method_closure *closure
= (method_closure *) _Jv_AllocBytes(sizeof (method_closure));
@ -974,9 +970,13 @@ _Jv_Linker::create_error_method (_Jv_Utf8Const *class_name)
// Initializes the cif and the closure. If that worked the closure
// is returned and can be used as a function pointer in a class'
// atable.
if (ffi_prep_cif (&closure->cif, FFI_DEFAULT_ABI, 1, &ffi_type_void,
closure->arg_types) == FFI_OK
&& ffi_prep_closure (&closure->closure, &closure->cif,
if ( ffi_prep_cif (&closure->cif,
FFI_DEFAULT_ABI,
1,
&ffi_type_void,
closure->arg_types) == FFI_OK
&& ffi_prep_closure (&closure->closure,
&closure->cif,
_Jv_ThrowNoClassDefFoundErrorTrampoline,
class_name) == FFI_OK)
return &closure->closure;
@ -989,13 +989,17 @@ _Jv_Linker::create_error_method (_Jv_Utf8Const *class_name)
buffer->append (_Jv_NewStringUtf8Const(class_name));
throw new java::lang::InternalError(buffer->toString());
}
}
#else
void *
_Jv_Linker::create_error_method (_Jv_Utf8Const *)
{
// Codepath for platforms which do not support (or want) libffi.
// You have to accept that it is impossible to provide the name
// of the missing class then.
return (void *) _Jv_ThrowNoClassDefFoundError;
#endif
}
#endif // USE_LIBFFI
// Functions for indirect dispatch (symbolic virtual binding) support.
@ -1213,7 +1217,7 @@ _Jv_Linker::link_symbol_table (jclass klass)
}
// Try fields only if the target class exists.
if ( target_class != NULL )
if (target_class != NULL)
{
wait_for_state(target_class, JV_STATE_PREPARED);
jclass found_class;