java-tree.h (enum java_tree_index): Add JTI_SOFT_NOSUCHFIELD_NODE.

2005-12-08  Andrew Haley  <aph@redhat.com>

	* java-tree.h (enum java_tree_index): Add JTI_SOFT_NOSUCHFIELD_NODE.
	(soft_abstractmethod_node): New.
	* expr.c (build_field_ref): Add in-line check for missing field.
	* decl.c (java_init_decl_processing): Add soft_nosuchfield_node.

2005-12-08  Andrew Haley  <aph@redhat.com>

	* java/lang/Object.h (throwNoSuchMethodError): New method.
	* java/lang/Object.java (throwNoSuchMethodError): New method.
	* include/jvm.h (_Jv_ThrowNoSuchFieldError): Declare.
	* link.cc (_Jv_ThrowNoSuchFieldError): New.
	(link_symbol_table): Don't throw a NoSuchFieldError if a field is
	missing.  Instead, set the otable entry to zero.
	(link_symbol_table): If we don't find a nonstatic method, insert
	the vtable offset of Object.throwNoSuchMethodError() into the
	otable.


[[Split portion of a mixed commit.]]

From-SVN: r108230.2
This commit is contained in:
Andrew Haley 2005-12-08 13:52:39 +00:00 committed by Andrew Haley
parent ac3ebe93b6
commit e00388458d
4 changed files with 30 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2005-12-08 Andrew Haley <aph@redhat.com>
* java-tree.h (enum java_tree_index): Add JTI_SOFT_NOSUCHFIELD_NODE.
(soft_abstractmethod_node): New.
* expr.c (build_field_ref): Add in-line check for missing field.
* decl.c (java_init_decl_processing): Add soft_nosuchfield_node.
2005-12-07 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
* Make-lang.in (java.all.build, java.install-normal): Remove.

View file

@ -1116,6 +1116,15 @@ java_init_decl_processing (void)
TREE_THIS_VOLATILE (soft_abstractmethod_node) = 1;
TREE_SIDE_EFFECTS (soft_abstractmethod_node) = 1;
soft_nosuchfield_node
= builtin_function ("_Jv_ThrowNoSuchFieldError",
build_function_type (void_type_node, endlink),
0, NOT_BUILT_IN, NULL, NULL_TREE);
/* Mark soft_nosuchfield_node as a `noreturn' function with side
effects. */
TREE_THIS_VOLATILE (soft_nosuchfield_node) = 1;
TREE_SIDE_EFFECTS (soft_nosuchfield_node) = 1;
t = tree_cons (NULL_TREE, class_ptr_type,
tree_cons (NULL_TREE, object_ptr_type_node, endlink));
soft_checkcast_node

View file

@ -1703,6 +1703,17 @@ build_field_ref (tree self_value, tree self_class, tree name)
NULL_TREE, NULL_TREE);
tree address;
if (DECL_CONTEXT (field_decl) != output_class)
field_offset
= build3 (COND_EXPR, TREE_TYPE (field_offset),
build2 (EQ_EXPR, boolean_type_node,
field_offset, integer_zero_node),
build3 (CALL_EXPR, void_type_node,
build_address_of (soft_nosuchfield_node),
build_tree_list (NULL_TREE, otable_index),
NULL_TREE),
field_offset);
field_offset = fold (convert (sizetype, field_offset));
address
= fold_build2 (PLUS_EXPR,

View file

@ -386,6 +386,7 @@ enum java_tree_index
JTI_SOFT_BADARRAYINDEX_NODE,
JTI_SOFT_NULLPOINTER_NODE,
JTI_SOFT_ABSTRACTMETHOD_NODE,
JTI_SOFT_NOSUCHFIELD_NODE,
JTI_SOFT_CHECKARRAYSTORE_NODE,
JTI_SOFT_MONITORENTER_NODE,
JTI_SOFT_MONITOREXIT_NODE,
@ -648,6 +649,8 @@ extern GTY(()) tree java_global_trees[JTI_MAX];
java_global_trees[JTI_SOFT_NULLPOINTER_NODE]
#define soft_abstractmethod_node \
java_global_trees[JTI_SOFT_ABSTRACTMETHOD_NODE]
#define soft_nosuchfield_node \
java_global_trees[JTI_SOFT_NOSUCHFIELD_NODE]
#define soft_checkarraystore_node \
java_global_trees[JTI_SOFT_CHECKARRAYSTORE_NODE]
#define soft_monitorenter_node \