Commit 65e8066b by Tom Tromey Committed by Tom Tromey

Make-lang.in (JAVA_OBJS): Removed verify.o

	* Make-lang.in (JAVA_OBJS): Removed verify.o
	(java/verify.o): Removed.
	* verify.c: Removed.
	* lang.c (flag_new_verifier): Removed.
	(java_post_options): Updated.
	* java-tree.h (flag_new_verifier): Removed.
	(verify_jvm_instructions): Removed.
	* expr.c (pop_type_0): Assume flag_new_verifier is true.
	(build_java_check_indexed_type): Likewise.
	(expand_java_arraystore): Likewise.
	(expand_java_arrayload): Likewise.
	(pop_arguments): Likewise.
	(expand_byte_code): Likewise.
	(process_jvm_instruction): Likewise.

From-SVN: r103126
parent 30f86ec3
2005-08-15 Tom Tromey <tromey@redhat.com>
* Make-lang.in (JAVA_OBJS): Removed verify.o
(java/verify.o): Removed.
* verify.c: Removed.
* lang.c (flag_new_verifier): Removed.
(java_post_options): Updated.
* java-tree.h (flag_new_verifier): Removed.
(verify_jvm_instructions): Removed.
* expr.c (pop_type_0): Assume flag_new_verifier is true.
(build_java_check_indexed_type): Likewise.
(expand_java_arraystore): Likewise.
(expand_java_arrayload): Likewise.
(pop_arguments): Likewise.
(expand_byte_code): Likewise.
(process_jvm_instruction): Likewise.
2005-08-10 Andrew Haley <aph@redhat.com> 2005-08-10 Andrew Haley <aph@redhat.com>
* java-gimplify.c (java_gimplify_modify_expr): Fix any pointer * java-gimplify.c (java_gimplify_modify_expr): Fix any pointer
......
...@@ -102,7 +102,7 @@ gt-java-builtins.h gtype-java.h gt-java-resource.h : s-gtype ; @true ...@@ -102,7 +102,7 @@ gt-java-builtins.h gtype-java.h gt-java-resource.h : s-gtype ; @true
# Executables built by this Makefile: # Executables built by this Makefile:
JAVA_OBJS = java/parse.o java/class.o java/decl.o java/expr.o \ JAVA_OBJS = java/parse.o java/class.o java/decl.o java/expr.o \
java/constants.o java/lang.o java/typeck.o java/except.o java/verify.o \ java/constants.o java/lang.o java/typeck.o java/except.o \
java/verify-glue.o java/verify-impl.o \ java/verify-glue.o java/verify-impl.o \
java/zextract.o java/jcf-io.o java/win32-host.o java/jcf-parse.o java/mangle.o \ java/zextract.o java/jcf-io.o java/win32-host.o java/jcf-parse.o java/mangle.o \
java/mangle_name.o java/builtins.o java/resource.o \ java/mangle_name.o java/builtins.o java/resource.o \
...@@ -349,9 +349,6 @@ java/resource.o: java/resource.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ ...@@ -349,9 +349,6 @@ java/resource.o: java/resource.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
java/typeck.o: java/typeck.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \ java/typeck.o: java/typeck.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
java/convert.h toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) real.h java/convert.h toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) real.h
java/win32-host.o: java/win32-host.c $(CONFIG_H) $(SYSTEM_H) coretypes.h java/jcf.h java/win32-host.o: java/win32-host.c $(CONFIG_H) $(SYSTEM_H) coretypes.h java/jcf.h
java/verify.o: java/verify.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
java/javaop.h java/java-opcodes.h java/java-except.h toplev.h $(SYSTEM_H) \
coretypes.h $(TM_H)
java/verify-glue.o: java/verify-glue.c $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) \ java/verify-glue.o: java/verify-glue.c $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) \
coretypes.h $(TM_H) java/verify.h toplev.h coretypes.h $(TM_H) java/verify.h toplev.h
java/verify-impl.o: java/verify-impl.c $(CONFIG_H) java/verify.h $(SYSTEM_H) \ java/verify-impl.o: java/verify-impl.c $(CONFIG_H) java/verify.h $(SYSTEM_H) \
......
...@@ -350,29 +350,12 @@ pop_type_0 (tree type, char **messagep) ...@@ -350,29 +350,12 @@ pop_type_0 (tree type, char **messagep)
return t; return t;
if (TREE_CODE (type) == POINTER_TYPE && TREE_CODE (t) == POINTER_TYPE) if (TREE_CODE (type) == POINTER_TYPE && TREE_CODE (t) == POINTER_TYPE)
{ {
if (flag_new_verifier) /* Since the verifier has already run, we know that any
{ types we see will be compatible. In BC mode, this fact
/* Since the verifier has already run, we know that any may be checked at runtime, but if that is so then we can
types we see will be compatible. In BC mode, this fact assume its truth here as well. So, we always succeed
may be checked at runtime, but if that is so then we can here, with the expected type. */
assume its truth here as well. So, we always succeed return type;
here, with the expected type. */
return type;
}
else
{
if (type == ptr_type_node || type == object_ptr_type_node)
return t;
else if (t == ptr_type_node) /* Special case for null reference. */
return type;
/* This is a kludge, but matches what Sun's verifier does.
It can be tricked, but is safe as long as type errors
(i.e. interface method calls) are caught at run-time. */
else if (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (type))))
return object_ptr_type_node;
else if (can_widen_reference_to (t, type))
return t;
}
} }
if (! flag_verify_invocations && flag_indirect_dispatch if (! flag_verify_invocations && flag_indirect_dispatch
...@@ -1022,33 +1005,14 @@ build_java_arraystore_check (tree array, tree object) ...@@ -1022,33 +1005,14 @@ build_java_arraystore_check (tree array, tree object)
return unchanged. */ return unchanged. */
static tree static tree
build_java_check_indexed_type (tree array_node, tree indexed_type) build_java_check_indexed_type (tree array_node ATTRIBUTE_UNUSED,
tree indexed_type)
{ {
tree elt_type;
/* We used to check to see if ARRAY_NODE really had array type. /* We used to check to see if ARRAY_NODE really had array type.
However, with the new verifier, this is not necessary, as we know However, with the new verifier, this is not necessary, as we know
that the object will be an array of the appropriate type. */ that the object will be an array of the appropriate type. */
if (flag_new_verifier) return indexed_type;
return indexed_type;
if (!is_array_type_p (TREE_TYPE (array_node)))
abort ();
elt_type = (TYPE_ARRAY_ELEMENT (TREE_TYPE (TREE_TYPE (array_node))));
if (indexed_type == ptr_type_node)
return promote_type (elt_type);
/* BYTE/BOOLEAN store and load are used for both type */
if (indexed_type == byte_type_node && elt_type == boolean_type_node)
return boolean_type_node;
if (indexed_type != elt_type )
abort ();
else
return indexed_type;
} }
/* newarray triggers a call to _Jv_NewPrimArray. This function should be /* newarray triggers a call to _Jv_NewPrimArray. This function should be
...@@ -1155,23 +1119,18 @@ expand_java_arraystore (tree rhs_type_node) ...@@ -1155,23 +1119,18 @@ expand_java_arraystore (tree rhs_type_node)
tree index = pop_value (int_type_node); tree index = pop_value (int_type_node);
tree array_type, array; tree array_type, array;
if (flag_new_verifier) /* If we're processing an `aaload' we might as well just pick
`Object'. */
if (TREE_CODE (rhs_type_node) == POINTER_TYPE)
{ {
/* If we're processing an `aaload' we might as well just pick array_type = build_java_array_type (object_ptr_type_node, -1);
`Object'. */ rhs_type_node = object_ptr_type_node;
if (TREE_CODE (rhs_type_node) == POINTER_TYPE)
{
array_type = build_java_array_type (object_ptr_type_node, -1);
rhs_type_node = object_ptr_type_node;
}
else
array_type = build_java_array_type (rhs_type_node, -1);
} }
else else
array_type = ptr_type_node; array_type = build_java_array_type (rhs_type_node, -1);
array = pop_value (array_type); array = pop_value (array_type);
if (flag_new_verifier) array = build1 (NOP_EXPR, promote_type (array_type), array);
array = build1 (NOP_EXPR, promote_type (array_type), array);
rhs_type_node = build_java_check_indexed_type (array, rhs_type_node); rhs_type_node = build_java_check_indexed_type (array, rhs_type_node);
...@@ -1205,23 +1164,17 @@ expand_java_arrayload (tree lhs_type_node) ...@@ -1205,23 +1164,17 @@ expand_java_arrayload (tree lhs_type_node)
tree array_type; tree array_type;
tree array_node; tree array_node;
if (flag_new_verifier) /* If we're processing an `aaload' we might as well just pick
`Object'. */
if (TREE_CODE (lhs_type_node) == POINTER_TYPE)
{ {
/* If we're processing an `aaload' we might as well just pick array_type = build_java_array_type (object_ptr_type_node, -1);
`Object'. */ lhs_type_node = object_ptr_type_node;
if (TREE_CODE (lhs_type_node) == POINTER_TYPE)
{
array_type = build_java_array_type (object_ptr_type_node, -1);
lhs_type_node = object_ptr_type_node;
}
else
array_type = build_java_array_type (lhs_type_node, -1);
} }
else else
array_type = ptr_type_node; array_type = build_java_array_type (lhs_type_node, -1);
array_node = pop_value (array_type); array_node = pop_value (array_type);
if (flag_new_verifier) array_node = build1 (NOP_EXPR, promote_type (array_type), array_node);
array_node = build1 (NOP_EXPR, promote_type (array_type), array_node);
index_node = save_expr (index_node); index_node = save_expr (index_node);
array_node = save_expr (array_node); array_node = save_expr (array_node);
...@@ -1916,12 +1869,11 @@ pop_arguments (tree arg_types) ...@@ -1916,12 +1869,11 @@ pop_arguments (tree arg_types)
tree type = TREE_VALUE (arg_types); tree type = TREE_VALUE (arg_types);
tree arg = pop_value (type); tree arg = pop_value (type);
/* With the new verifier we simply cast each argument to its /* We simply cast each argument to its proper type. This is
proper type. This is needed since we lose type information needed since we lose type information coming out of the
coming out of the verifier. We also have to do this with the verifier. We also have to do this when we pop an integer
old verifier when we pop an integer type that must be type that must be promoted for the function call. */
promoted for the function call. */ if (TREE_CODE (type) == POINTER_TYPE)
if (flag_new_verifier && TREE_CODE (type) == POINTER_TYPE)
arg = build1 (NOP_EXPR, type, arg); arg = build1 (NOP_EXPR, type, arg);
else if (targetm.calls.promote_prototypes (type) else if (targetm.calls.promote_prototypes (type)
&& TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node) && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
...@@ -2943,16 +2895,8 @@ expand_byte_code (JCF *jcf, tree method) ...@@ -2943,16 +2895,8 @@ expand_byte_code (JCF *jcf, tree method)
} }
} }
if (flag_new_verifier) if (! verify_jvm_instructions_new (jcf, byte_ops, length))
{ return;
if (! verify_jvm_instructions_new (jcf, byte_ops, length))
return;
}
else
{
if (! verify_jvm_instructions (jcf, byte_ops, length))
return;
}
promote_arguments (); promote_arguments ();
...@@ -3065,10 +3009,10 @@ process_jvm_instruction (int PC, const unsigned char* byte_ops, ...@@ -3065,10 +3009,10 @@ process_jvm_instruction (int PC, const unsigned char* byte_ops,
replace the top of the stack with the thrown object reference */ replace the top of the stack with the thrown object reference */
if (instruction_bits [PC] & BCODE_EXCEPTION_TARGET) if (instruction_bits [PC] & BCODE_EXCEPTION_TARGET)
{ {
/* Note that the new verifier will not emit a type map at all /* Note that the verifier will not emit a type map at all for
for dead exception handlers. In this case we just ignore dead exception handlers. In this case we just ignore the
the situation. */ situation. */
if (! flag_new_verifier || (instruction_bits[PC] & BCODE_VERIFIED) != 0) if ((instruction_bits[PC] & BCODE_VERIFIED) != 0)
{ {
tree type = pop_type (promote_type (throwable_type_node)); tree type = pop_type (promote_type (throwable_type_node));
push_value (build_exception_object_ref (type)); push_value (build_exception_object_ref (type));
......
...@@ -219,9 +219,6 @@ extern int flag_indirect_dispatch; ...@@ -219,9 +219,6 @@ extern int flag_indirect_dispatch;
/* When zero, don't generate runtime array store checks. */ /* When zero, don't generate runtime array store checks. */
extern int flag_store_check; extern int flag_store_check;
/* When nonzero, use the new bytecode verifier. */
extern int flag_new_verifier;
/* Encoding used for source files. */ /* Encoding used for source files. */
extern const char *current_encoding; extern const char *current_encoding;
...@@ -1328,7 +1325,6 @@ extern void init_class_processing (void); ...@@ -1328,7 +1325,6 @@ extern void init_class_processing (void);
extern void add_type_assertion (tree, int, tree, tree); extern void add_type_assertion (tree, int, tree, tree);
extern int can_widen_reference_to (tree, tree); extern int can_widen_reference_to (tree, tree);
extern int class_depth (tree); extern int class_depth (tree);
extern int verify_jvm_instructions (struct JCF *, const unsigned char *, long);
extern int verify_jvm_instructions_new (struct JCF *, const unsigned char *, extern int verify_jvm_instructions_new (struct JCF *, const unsigned char *,
long); long);
extern void maybe_pushlevels (int); extern void maybe_pushlevels (int);
......
...@@ -133,9 +133,6 @@ int flag_deprecated = 1; ...@@ -133,9 +133,6 @@ int flag_deprecated = 1;
/* Don't attempt to verify invocations. */ /* Don't attempt to verify invocations. */
int flag_verify_invocations = 0; int flag_verify_invocations = 0;
/* True if the new bytecode verifier should be used. */
int flag_new_verifier = 1;
/* When nonzero, print extra version information. */ /* When nonzero, print extra version information. */
static int v_flag = 0; static int v_flag = 0;
...@@ -606,12 +603,6 @@ java_post_options (const char **pfilename) ...@@ -606,12 +603,6 @@ java_post_options (const char **pfilename)
must always verify everything. */ must always verify everything. */
if (! flag_indirect_dispatch) if (! flag_indirect_dispatch)
flag_verify_invocations = true; flag_verify_invocations = true;
else
{
/* If we are using indirect dispatch, then we want the new
verifier as well. */
flag_new_verifier = 1;
}
/* Open input file. */ /* Open input file. */
......
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