From 904715853c40f9a27b492794a6db817ea89a553a Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Fri, 24 Oct 2003 09:29:43 +0000 Subject: lang.c (LANG_HOOKS_GET_CALLEE_FNDECL): New. 2003-10-22 Andrew Haley * lang.c (LANG_HOOKS_GET_CALLEE_FNDECL): New. (java_get_callee_fndecl): New. * jcf-parse.c (java_parse_file): Call emit_catch_table(). * java-tree.h (ctable_decl): New. (catch_classes): New. (java_tree_index): Add JTI_CTABLE_DECL, JTI_CATCH_CLASSES. * decl.c (java_init_decl_processing): Add catch_class_type. Add ctable_decl. Add catch_classes field. * class.c (build_indirect_class_ref): Break out from build_class_ref. (make_field_value): Check flag_indirect_dispatch. (make_class_data): Ditto. Tidy uses of PUSH_FIELD_VALUE. Add field catch_classes. (make_catch_class_record): New. * java-tree.h (PUSH_FIELD_VALUE): Tidy. 2003-10-22 Andrew Haley * java/lang/natClass.cc (initializeClass): Call _Jv_linkExceptionClassTable. (_Jv_LinkSymbolTable): Call )_Jv_ThrowNoSuchMethodError. Call _Jv_Defer_Resolution on a method whose ncode is NULL. (_Jv_linkExceptionClassTable): New function. (_Jv_LayoutVTableMethods): If superclass looks like a constant pool entry, look it up. * java/lang/Class.h (struct _Jv_CatchClass): New. (_Jv_linkExceptionClassTable): New friend. (_Jv_Defer_Resolution): New friend. (class Class.catch_classes): New field. * include/java-interp.h (Jv_Defer_Resolution): New method. (_Jv_PrepareClass): Make a friend of _Jv_MethodBase. (_Jv_MethodBase.deferred): New field. (_Jv_Defer_Resolution): New function. * resolve.cc (_Jv_PrepareClass): Resolve deferred handlers. * exception.cc (get_ttype_entry): Change return type to void**. (PERSONALITY_FUNCTION): Remove all code related to using a Utf8Const* for a match type. Change match type to be a pointer to a pointer, rather than a pointer to a Class. * defineclass.cc (handleCodeAttribute): Initialize method->deferred. (handleMethodsEnd): Likewise. From-SVN: r72886 --- libjava/include/java-interp.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'libjava/include') diff --git a/libjava/include/java-interp.h b/libjava/include/java-interp.h index c801274..94acfae 100644 --- a/libjava/include/java-interp.h +++ b/libjava/include/java-interp.h @@ -88,6 +88,12 @@ protected: // Size of raw arguments. _Jv_ushort args_raw_size; + // Chain of addresses to fill in. See _Jv_Defer_Resolution. + void *deferred; + + friend void _Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **); + friend void _Jv_PrepareClass(jclass); + public: _Jv_Method *get_method () { @@ -167,8 +173,33 @@ class _Jv_InterpClass : public java::lang::Class #endif friend _Jv_MethodBase ** _Jv_GetFirstMethod (_Jv_InterpClass *klass); + friend void _Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **); }; +// We have an interpreted class CL and we're trying to find the +// address of the ncode of a method METH. That interpreted class +// hasn't yet been prepared, so we defer fixups until they are ready. +// To do this, we create a chain of fixups that will be resolved by +// _Jv_PrepareClass. +extern inline void +_Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **address) +{ + int i; + _Jv_InterpClass *self = (_Jv_InterpClass *)cl; + for (i = 0; i < self->method_count; i++) + { + _Jv_Method *m = &self->methods[i]; + if (m == meth) + { + _Jv_MethodBase *imeth = self->interpreted_methods[i]; + *address = imeth->deferred; + imeth->deferred = address; + return; + } + } + return; +} + extern inline _Jv_MethodBase ** _Jv_GetFirstMethod (_Jv_InterpClass *klass) { -- cgit v1.1