tree.h (struct tree_label_decl): Removed old "java" fields.

gcc:
	* tree.h (struct tree_label_decl): Removed old "java" fields.
gcc/java:
	* java-tree.h (LABEL_TYPE_STATE): Removed.
	(load_type_state): Removed.
	(LABEL_PC): Removed.
	(LABEL_VERIFIED): Removed.
	(type_states): Declare.
	* expr.c (type_states): New global.
	(load_type_state): Now static.  Use type_states.  Changed
	argument.
	(lookup_label): Don't set LABEL_PC.
	(expand_byte_code): Don't use LABEL_VERIFIED.
	(note_instructions): Initialize type_states.
	* verify-glue.c (vfy_note_stack_depth): Rewrote.
	(vfy_note_stack_type): Use type_states.
	(vfy_note_local_type): Likewise.

From-SVN: r127587
This commit is contained in:
Tom Tromey 2007-08-17 15:19:39 +00:00 committed by Tom Tromey
parent 4bf6c438d2
commit 3d4e276625
6 changed files with 50 additions and 34 deletions

View File

@ -1,3 +1,7 @@
2007-08-17 Tom Tromey <tromey@redhat.com>
* tree.h (struct tree_label_decl): Removed old "java" fields.
2007-08-17 Richard Sandiford <richard@codesourcery.com>
Nigel Stephens <nigel@mips.com>

View File

@ -1,3 +1,20 @@
2007-08-17 Tom Tromey <tromey@redhat.com>
* java-tree.h (LABEL_TYPE_STATE): Removed.
(load_type_state): Removed.
(LABEL_PC): Removed.
(LABEL_VERIFIED): Removed.
(type_states): Declare.
* expr.c (type_states): New global.
(load_type_state): Now static. Use type_states. Changed
argument.
(lookup_label): Don't set LABEL_PC.
(expand_byte_code): Don't use LABEL_VERIFIED.
(note_instructions): Initialize type_states.
* verify-glue.c (vfy_note_stack_depth): Rewrote.
(vfy_note_stack_type): Use type_states.
(vfy_note_local_type): Likewise.
2007-08-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* jcf-parse.c (read_class, java_parse_file): Use CONST_CAST.

View File

@ -1772,7 +1772,6 @@ lookup_label (int pc)
{
/* The type of the address of a label is return_address_type_node. */
tree decl = create_label_decl (name);
LABEL_PC (decl) = pc;
return pushdecl (decl);
}
}
@ -1801,9 +1800,15 @@ create_label_decl (tree name)
return decl;
}
/* This maps a bytecode offset (PC) to various flags. */
/* This maps a bytecode offset (PC) to various flags. */
char *instruction_bits;
/* This is a vector of type states for the current method. It is
indexed by PC. Each element is a tree vector holding the type
state at that PC. We only note type states at basic block
boundaries. */
VEC(tree, gc) *type_states;
static void
note_label (int current_pc ATTRIBUTE_UNUSED, int target_pc)
{
@ -2953,11 +2958,11 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index)
TREE_THIS_VOLATILE (field_ref) = TREE_THIS_VOLATILE (field_decl);
}
void
load_type_state (tree label)
static void
load_type_state (int pc)
{
int i;
tree vec = LABEL_TYPE_STATE (label);
tree vec = VEC_index (tree, type_states, pc);
int cur_length = TREE_VEC_LENGTH (vec);
stack_pointer = cur_length - DECL_MAX_LOCALS(current_function_decl);
for (i = 0; i < cur_length; i++)
@ -3000,6 +3005,8 @@ note_instructions (JCF *jcf, tree method)
byte_ops = jcf->read_ptr;
instruction_bits = xrealloc (instruction_bits, length + 1);
memset (instruction_bits, 0, length + 1);
type_states = VEC_alloc (tree, gc, length + 1);
VEC_safe_grow_cleared (tree, gc, type_states, length + 1);
/* This pass figures out which PC can be the targets of jumps. */
for (PC = 0; PC < length;)
@ -3158,8 +3165,8 @@ expand_byte_code (JCF *jcf, tree method)
flush_quick_stack ();
if ((instruction_bits [PC] & BCODE_TARGET) != 0)
java_add_stmt (build1 (LABEL_EXPR, void_type_node, label));
if (LABEL_VERIFIED (label) || PC == 0)
load_type_state (label);
if ((instruction_bits[PC] & BCODE_VERIFIED) != 0)
load_type_state (PC);
}
if (! (instruction_bits [PC] & BCODE_VERIFIED))

View File

@ -771,16 +771,6 @@ union lang_tree_node
FIELD_LOCAL_ALIAS. */
#define FIELD_THISN(DECL) DECL_LANG_FLAG_7 (VAR_OR_FIELD_CHECK (DECL))
/* In a LABEL_DECL, a TREE_VEC that saves the type_map at that point. */
#define LABEL_TYPE_STATE(NODE) (LABEL_DECL_CHECK (NODE)->label_decl.java_field_1)
/* In a LABEL_DECL, the corresponding bytecode program counter. */
#define LABEL_PC(NODE) (LABEL_DECL_CHECK (NODE)->label_decl.java_field_4)
/* In a LABEL_DECL, true if we have verified instructions starting here. */
#define LABEL_VERIFIED(NODE) \
(instruction_bits[LABEL_PC (NODE)] & BCODE_VERIFIED)
/* The slot number for this local variable. */
#define DECL_LOCAL_SLOT_NUMBER(NODE) \
(DECL_LANG_SPECIFIC (NODE)->u.v.slot_number)
@ -1248,7 +1238,6 @@ extern void set_local_type (int, tree);
extern int merge_type_state (tree);
extern int push_type_0 (tree);
extern void push_type (tree);
extern void load_type_state (tree);
extern void add_interface (tree, tree);
extern tree force_evaluation_order (tree);
extern tree java_create_object (tree);
@ -1418,6 +1407,9 @@ extern void rewrite_reflection_indexes (void *);
/* Use CLASS_LOADED_P? FIXME */
#define CLASS_COMPLETE_P(DECL) DECL_LANG_FLAG_2 (DECL)
/* A vector used to track type states for the current method. */
extern VEC(tree, gc) *type_states;
/* This maps a bytecode offset (PC) to various flags,
listed below (starting with BCODE_). */
extern char *instruction_bits;

View File

@ -393,37 +393,41 @@ vfy_get_primitive_type (int type)
void
vfy_note_stack_depth (vfy_method *method, int pc, int depth)
{
tree label = lookup_label (pc);
LABEL_TYPE_STATE (label) = make_tree_vec (method->max_locals + depth);
tree val = make_tree_vec (method->max_locals + depth);
VEC_replace (tree, type_states, pc, val);
/* Called for side effects. */
lookup_label (pc);
}
void
vfy_note_stack_type (vfy_method *method, int pc, int slot, vfy_jclass type)
{
tree label, vec;
tree vec;
slot += method->max_locals;
if (type == object_type_node)
type = object_ptr_type_node;
label = lookup_label (pc);
vec = LABEL_TYPE_STATE (label);
vec = VEC_index (tree, type_states, pc);
TREE_VEC_ELT (vec, slot) = type;
/* Called for side effects. */
lookup_label (pc);
}
void
vfy_note_local_type (vfy_method *method ATTRIBUTE_UNUSED, int pc, int slot,
vfy_jclass type)
{
tree label, vec;
tree vec;
if (type == object_type_node)
type = object_ptr_type_node;
label = lookup_label (pc);
vec = LABEL_TYPE_STATE (label);
vec = VEC_index (tree, type_states, pc);
TREE_VEC_ELT (vec, slot) = type;
/* Called for side effects. */
lookup_label (pc);
}
void

View File

@ -2914,14 +2914,6 @@ struct tree_field_decl GTY(())
struct tree_label_decl GTY(())
{
struct tree_decl_with_rtl common;
/* Java's verifier has some need to store information about labels,
and was using fields that no longer exist on labels.
Once the verifier doesn't need these anymore, they should be removed. */
tree java_field_1;
tree java_field_2;
tree java_field_3;
unsigned int java_field_4;
};
struct tree_result_decl GTY(())