Commit fbb4c46b by Tom Tromey Committed by Tom Tromey

re PR libgcj/21906 (hang when invoking abstract method)

gcc/java/:
	PR libgcj/21906:
	* class.c (make_method_value): Use soft_abstractmethod_node for
	abstract method.
	* java-tree.h (soft_abstractmethod_node): New define.
	(JTI_SOFT_ABSTRACTMETHOD_NODE): New enum constant.
	* decl.c (java_init_decl_processing): Initialize
	soft_abstractmethod_node.
libjava/:
	PR libgcj/21906:
	* defineclass.cc (handleMethodsEnd): Set ncode for abstract
	methods.
	* include/jvm.h (_Jv_ThrowAbstractMethodError): Declare.
	* link.cc (_Jv_ThrowAbstractMethodError): Renamed.  No longer
	static.
	(append_partial_itable): Use it.
	(set_vtable_entries): Likewise.

From-SVN: r100992
parent 92b5fbc5
2005-06-15 Tom Tromey <tromey@redhat.com>
PR libgcj/21906:
* class.c (make_method_value): Use soft_abstractmethod_node for
abstract method.
* java-tree.h (soft_abstractmethod_node): New define.
(JTI_SOFT_ABSTRACTMETHOD_NODE): New enum constant.
* decl.c (java_init_decl_processing): Initialize
soft_abstractmethod_node.
2005-06-13 Geoffrey Keating <geoffk@apple.com> 2005-06-13 Geoffrey Keating <geoffk@apple.com>
* Make-lang.in (rule for installing gcj.1): Depends on installdirs. * Make-lang.in (rule for installing gcj.1): Depends on installdirs.
......
...@@ -1315,7 +1315,10 @@ make_method_value (tree mdecl) ...@@ -1315,7 +1315,10 @@ make_method_value (tree mdecl)
index = integer_minus_one_node; index = integer_minus_one_node;
code = null_pointer_node; code = null_pointer_node;
if (!METHOD_ABSTRACT (mdecl)) if (METHOD_ABSTRACT (mdecl))
code = build1 (ADDR_EXPR, nativecode_ptr_type_node,
soft_abstractmethod_node);
else
code = build1 (ADDR_EXPR, nativecode_ptr_type_node, code = build1 (ADDR_EXPR, nativecode_ptr_type_node,
make_local_function_alias (mdecl)); make_local_function_alias (mdecl));
START_RECORD_CONSTRUCTOR (minit, method_type_node); START_RECORD_CONSTRUCTOR (minit, method_type_node);
......
...@@ -1107,6 +1107,15 @@ java_init_decl_processing (void) ...@@ -1107,6 +1107,15 @@ java_init_decl_processing (void)
TREE_THIS_VOLATILE (soft_nullpointer_node) = 1; TREE_THIS_VOLATILE (soft_nullpointer_node) = 1;
TREE_SIDE_EFFECTS (soft_nullpointer_node) = 1; TREE_SIDE_EFFECTS (soft_nullpointer_node) = 1;
soft_abstractmethod_node
= builtin_function ("_Jv_ThrowAbstractMethodError",
build_function_type (void_type_node, endlink),
0, NOT_BUILT_IN, NULL, NULL_TREE);
/* Mark soft_abstractmethod_node as a `noreturn' function with side
effects. */
TREE_THIS_VOLATILE (soft_abstractmethod_node) = 1;
TREE_SIDE_EFFECTS (soft_abstractmethod_node) = 1;
t = tree_cons (NULL_TREE, class_ptr_type, t = tree_cons (NULL_TREE, class_ptr_type,
tree_cons (NULL_TREE, object_ptr_type_node, endlink)); tree_cons (NULL_TREE, object_ptr_type_node, endlink));
soft_checkcast_node soft_checkcast_node
......
...@@ -392,6 +392,7 @@ enum java_tree_index ...@@ -392,6 +392,7 @@ enum java_tree_index
JTI_SOFT_MULTIANEWARRAY_NODE, JTI_SOFT_MULTIANEWARRAY_NODE,
JTI_SOFT_BADARRAYINDEX_NODE, JTI_SOFT_BADARRAYINDEX_NODE,
JTI_SOFT_NULLPOINTER_NODE, JTI_SOFT_NULLPOINTER_NODE,
JTI_SOFT_ABSTRACTMETHOD_NODE,
JTI_SOFT_CHECKARRAYSTORE_NODE, JTI_SOFT_CHECKARRAYSTORE_NODE,
JTI_SOFT_MONITORENTER_NODE, JTI_SOFT_MONITORENTER_NODE,
JTI_SOFT_MONITOREXIT_NODE, JTI_SOFT_MONITOREXIT_NODE,
...@@ -651,6 +652,8 @@ extern GTY(()) tree java_global_trees[JTI_MAX]; ...@@ -651,6 +652,8 @@ extern GTY(()) tree java_global_trees[JTI_MAX];
java_global_trees[JTI_SOFT_BADARRAYINDEX_NODE] java_global_trees[JTI_SOFT_BADARRAYINDEX_NODE]
#define soft_nullpointer_node \ #define soft_nullpointer_node \
java_global_trees[JTI_SOFT_NULLPOINTER_NODE] java_global_trees[JTI_SOFT_NULLPOINTER_NODE]
#define soft_abstractmethod_node \
java_global_trees[JTI_SOFT_ABSTRACTMETHOD_NODE]
#define soft_checkarraystore_node \ #define soft_checkarraystore_node \
java_global_trees[JTI_SOFT_CHECKARRAYSTORE_NODE] java_global_trees[JTI_SOFT_CHECKARRAYSTORE_NODE]
#define soft_monitorenter_node \ #define soft_monitorenter_node \
......
2005-06-15 Tom Tromey <tromey@redhat.com> 2005-06-15 Tom Tromey <tromey@redhat.com>
PR libgcj/21906:
* defineclass.cc (handleMethodsEnd): Set ncode for abstract
methods.
* include/jvm.h (_Jv_ThrowAbstractMethodError): Declare.
* link.cc (_Jv_ThrowAbstractMethodError): Renamed. No longer
static.
(append_partial_itable): Use it.
(set_vtable_entries): Likewise.
2005-06-15 Tom Tromey <tromey@redhat.com>
* gnu/gcj/runtime/SystemClassLoader.java (init): Clear * gnu/gcj/runtime/SystemClassLoader.java (init): Clear
last_was_sep in loop. last_was_sep in loop.
......
...@@ -1288,7 +1288,7 @@ void _Jv_ClassReader::handleMethod ...@@ -1288,7 +1288,7 @@ void _Jv_ClassReader::handleMethod
throw_class_format_error ("erroneous method access flags"); throw_class_format_error ("erroneous method access flags");
// FIXME: JVM spec S4.6: if ABSTRACT modifier is set, verify other // FIXME: JVM spec S4.6: if ABSTRACT modifier is set, verify other
// flags are not set. Verify flags for interface methods. Verifiy // flags are not set. Verify flags for interface methods. Verify
// modifiers for initializers. // modifiers for initializers.
} }
} }
...@@ -1378,6 +1378,7 @@ void _Jv_ClassReader::handleMethodsEnd () ...@@ -1378,6 +1378,7 @@ void _Jv_ClassReader::handleMethodsEnd ()
{ {
if (def_interp->interpreted_methods[i] != 0) if (def_interp->interpreted_methods[i] != 0)
throw_class_format_error ("code provided for abstract method"); throw_class_format_error ("code provided for abstract method");
method->ncode = (void *) &_Jv_ThrowAbstractMethodError;
} }
else else
{ {
......
...@@ -482,6 +482,8 @@ extern void _Jv_CallAnyMethodA (jobject obj, ...@@ -482,6 +482,8 @@ extern void _Jv_CallAnyMethodA (jobject obj,
extern jobject _Jv_NewMultiArray (jclass, jint ndims, jint* dims) extern jobject _Jv_NewMultiArray (jclass, jint ndims, jint* dims)
__attribute__((__malloc__)); __attribute__((__malloc__));
extern "C" void _Jv_ThrowAbstractMethodError () __attribute__((__noreturn__));
/* Checked divide subroutines. */ /* Checked divide subroutines. */
extern "C" extern "C"
{ {
......
...@@ -714,8 +714,8 @@ _Jv_ThrowNoSuchMethodError () ...@@ -714,8 +714,8 @@ _Jv_ThrowNoSuchMethodError ()
} }
// This is put in empty vtable slots. // This is put in empty vtable slots.
static void void
_Jv_abstractMethodError (void) _Jv_ThrowAbstractMethodError ()
{ {
throw new java::lang::AbstractMethodError(); throw new java::lang::AbstractMethodError();
} }
...@@ -767,7 +767,7 @@ _Jv_Linker::append_partial_itable (jclass klass, jclass iface, ...@@ -767,7 +767,7 @@ _Jv_Linker::append_partial_itable (jclass klass, jclass iface,
(_Jv_GetMethodString (klass, meth)); (_Jv_GetMethodString (klass, meth));
if ((meth->accflags & Modifier::ABSTRACT) != 0) if ((meth->accflags & Modifier::ABSTRACT) != 0)
itable[pos] = (void *) &_Jv_abstractMethodError; itable[pos] = (void *) &_Jv_ThrowAbstractMethodError;
else else
itable[pos] = meth->ncode; itable[pos] = meth->ncode;
} }
...@@ -1228,7 +1228,8 @@ _Jv_Linker::set_vtable_entries (jclass klass, _Jv_VTable *vtable) ...@@ -1228,7 +1228,8 @@ _Jv_Linker::set_vtable_entries (jclass klass, _Jv_VTable *vtable)
if ((meth->accflags & Modifier::ABSTRACT)) if ((meth->accflags & Modifier::ABSTRACT))
// FIXME: it might be nice to have a libffi trampoline here, // FIXME: it might be nice to have a libffi trampoline here,
// so we could pass in the method name and other information. // so we could pass in the method name and other information.
vtable->set_method(meth->index, (void *) &_Jv_abstractMethodError); vtable->set_method(meth->index,
(void *) &_Jv_ThrowAbstractMethodError);
else else
vtable->set_method(meth->index, meth->ncode); vtable->set_method(meth->index, meth->ncode);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment