verify.cc (_Jv_BytecodeVerifier::linked_utf8): New structure.
* verify.cc (_Jv_BytecodeVerifier::linked_utf8): New structure. (_Jv_BytecodeVerifier::utf8_list): New field. (_Jv_BytecodeVerifier::_Jv_BytecodeVerifier): Initialize it. (_Jv_BytecodeVerifier::~_Jv_BytecodeVerifier): Free it. (_Jv_BytecodeVerifier::make_utf8_const): New method. (_Jv_BytecodeVerifier::get_one_type): Use it. (_Jv_BytecodeVerifier::type::merge): When using local semantics, if the destination type is already unsuitable then we didn't change. From-SVN: r47634
This commit is contained in:
parent
7c1e833675
commit
0c88d7f819
|
@ -1,5 +1,15 @@
|
||||||
2001-12-04 Tom Tromey <tromey@redhat.com>
|
2001-12-04 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* verify.cc (_Jv_BytecodeVerifier::linked_utf8): New structure.
|
||||||
|
(_Jv_BytecodeVerifier::utf8_list): New field.
|
||||||
|
(_Jv_BytecodeVerifier::_Jv_BytecodeVerifier): Initialize it.
|
||||||
|
(_Jv_BytecodeVerifier::~_Jv_BytecodeVerifier): Free it.
|
||||||
|
(_Jv_BytecodeVerifier::make_utf8_const): New method.
|
||||||
|
(_Jv_BytecodeVerifier::get_one_type): Use it.
|
||||||
|
(_Jv_BytecodeVerifier::type::merge): When using local semantics,
|
||||||
|
if the destination type is already unsuitable then we didn't
|
||||||
|
change.
|
||||||
|
|
||||||
* defineclass.cc (read_one_method_attribute): `end_pc' for an
|
* defineclass.cc (read_one_method_attribute): `end_pc' for an
|
||||||
exception can be equal to code length.
|
exception can be equal to code length.
|
||||||
* verify.cc (_Jv_BytecodeVerifier::verify_instructions_0): Removed
|
* verify.cc (_Jv_BytecodeVerifier::verify_instructions_0): Removed
|
||||||
|
|
|
@ -50,6 +50,7 @@ private:
|
||||||
struct state;
|
struct state;
|
||||||
struct type;
|
struct type;
|
||||||
struct subr_info;
|
struct subr_info;
|
||||||
|
struct linked_utf8;
|
||||||
|
|
||||||
// The current PC.
|
// The current PC.
|
||||||
int PC;
|
int PC;
|
||||||
|
@ -93,6 +94,34 @@ private:
|
||||||
// This method.
|
// This method.
|
||||||
_Jv_InterpMethod *current_method;
|
_Jv_InterpMethod *current_method;
|
||||||
|
|
||||||
|
// A linked list of utf8 objects we allocate. This is really ugly,
|
||||||
|
// but without this our utf8 objects would be collected.
|
||||||
|
linked_utf8 *utf8_list;
|
||||||
|
|
||||||
|
struct linked_utf8
|
||||||
|
{
|
||||||
|
_Jv_Utf8Const *val;
|
||||||
|
linked_utf8 *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
_Jv_Utf8Const *make_utf8_const (char *s, int len)
|
||||||
|
{
|
||||||
|
_Jv_Utf8Const *val = _Jv_makeUtf8Const (s, len);
|
||||||
|
_Jv_Utf8Const *r = (_Jv_Utf8Const *) _Jv_Malloc (sizeof (_Jv_Utf8Const)
|
||||||
|
+ val->length
|
||||||
|
+ 1);
|
||||||
|
r->length = val->length;
|
||||||
|
r->hash = val->hash;
|
||||||
|
memcpy (r->data, val->data, val->length + 1);
|
||||||
|
|
||||||
|
linked_utf8 *lu = (linked_utf8 *) _Jv_Malloc (sizeof (linked_utf8));
|
||||||
|
lu->val = r;
|
||||||
|
lu->next = utf8_list;
|
||||||
|
utf8_list = lu;
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
// This enum holds a list of tags for all the different types we
|
// This enum holds a list of tags for all the different types we
|
||||||
// need to handle. Reference types are treated specially by the
|
// need to handle. Reference types are treated specially by the
|
||||||
// type class.
|
// type class.
|
||||||
|
@ -631,10 +660,15 @@ private:
|
||||||
else if (refo || refn || key != old_type.key)
|
else if (refo || refn || key != old_type.key)
|
||||||
{
|
{
|
||||||
if (local_semantics)
|
if (local_semantics)
|
||||||
|
{
|
||||||
|
// If we already have an `unsuitable' type, then we
|
||||||
|
// don't need to change again.
|
||||||
|
if (key != unsuitable_type)
|
||||||
{
|
{
|
||||||
key = unsuitable_type;
|
key = unsuitable_type;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
verify_fail ("unmergeable type");
|
verify_fail ("unmergeable type");
|
||||||
}
|
}
|
||||||
|
@ -1640,8 +1674,7 @@ private:
|
||||||
while (*p != ';')
|
while (*p != ';')
|
||||||
++p;
|
++p;
|
||||||
++p;
|
++p;
|
||||||
// FIXME! This will get collected!
|
_Jv_Utf8Const *name = make_utf8_const (start, p - start);
|
||||||
_Jv_Utf8Const *name = _Jv_makeUtf8Const (start, p - start);
|
|
||||||
return type (name);
|
return type (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2604,6 +2637,7 @@ public:
|
||||||
states = NULL;
|
states = NULL;
|
||||||
flags = NULL;
|
flags = NULL;
|
||||||
jsr_ptrs = NULL;
|
jsr_ptrs = NULL;
|
||||||
|
utf8_list = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
~_Jv_BytecodeVerifier ()
|
~_Jv_BytecodeVerifier ()
|
||||||
|
@ -2614,6 +2648,13 @@ public:
|
||||||
_Jv_Free (flags);
|
_Jv_Free (flags);
|
||||||
if (jsr_ptrs)
|
if (jsr_ptrs)
|
||||||
_Jv_Free (jsr_ptrs);
|
_Jv_Free (jsr_ptrs);
|
||||||
|
while (utf8_list != NULL)
|
||||||
|
{
|
||||||
|
linked_utf8 *n = utf8_list->next;
|
||||||
|
_Jv_Free (utf8_list->val);
|
||||||
|
_Jv_Free (utf8_list);
|
||||||
|
utf8_list = n;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue