diff options
author | Tom Tromey <tromey@redhat.com> | 2004-11-03 22:44:30 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2004-11-03 22:44:30 +0000 |
commit | 939347bb51d858d68453af710d4c8f9ef04e440d (patch) | |
tree | b1f85702b15403d3eb0926bc441dbacc7ce69ee0 /libjava | |
parent | 318627d5fc55180b3bb8619c408799eb14394cc1 (diff) | |
download | gcc-939347bb51d858d68453af710d4c8f9ef04e440d.zip gcc-939347bb51d858d68453af710d4c8f9ef04e440d.tar.gz gcc-939347bb51d858d68453af710d4c8f9ef04e440d.tar.bz2 |
verify.cc (state::check_no_uninitialized_objects): Removed.
* verify.cc (state::check_no_uninitialized_objects): Removed.
(push_jump): Updated.
(push_exception_jump): Likewise.
(handle_ret_insn): Likewise.
(handle_jsr_insn): Likewise.
From-SVN: r90040
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 8 | ||||
-rw-r--r-- | libjava/verify.cc | 55 |
2 files changed, 29 insertions, 34 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index b10c6f4..3f8e756 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2004-11-01 Tom Tromey <tromey@redhat.com> + + * verify.cc (state::check_no_uninitialized_objects): Removed. + (push_jump): Updated. + (push_exception_jump): Likewise. + (handle_ret_insn): Likewise. + (handle_jsr_insn): Likewise. + 2004-10-30 Mark Wielaard <mark@klomp.org> PR libgcj/18234 diff --git a/libjava/verify.cc b/libjava/verify.cc index 85a50aa..63857d0 100644 --- a/libjava/verify.cc +++ b/libjava/verify.cc @@ -100,13 +100,15 @@ debug_print (MAYBE_UNUSED const char *fmt, ...) // subroutine is exited via `goto' or `athrow' and not `ret'. // // In some other areas the JVM specification is (mildly) incorrect, -// but we still implement what is specified. For instance, you cannot +// so we diverge. For instance, you cannot // violate type safety by allocating an object with `new' and then // failing to initialize it, no matter how one branches or where one // stores the uninitialized reference. See "Improving the official // specification of Java bytecode verification" by Alessandro Coglio. -// Similarly, there's no real point in enforcing that padding bytes or -// the mystery byte of invokeinterface must be 0, but we do that too. +// +// Note that there's no real point in enforcing that padding bytes or +// the mystery byte of invokeinterface must be 0, but we do that +// regardless. // // The verifier is currently neither completely lazy nor eager when it // comes to loading classes. It tries to represent types by name when @@ -1098,28 +1100,6 @@ private: return changed; } - // Throw an exception if there is an uninitialized object on the - // stack or in a local variable. EXCEPTION_SEMANTICS controls - // whether we're using backwards-branch or exception-handing - // semantics. - void check_no_uninitialized_objects (int max_locals, - _Jv_BytecodeVerifier *verifier, - bool exception_semantics = false) - { - if (! exception_semantics) - { - for (int i = 0; i < stacktop; ++i) - if (stack[i].isreference () && ! stack[i].isinitialized ()) - verifier->verify_fail ("uninitialized object on stack"); - } - - for (int i = 0; i < max_locals; ++i) - if (locals[i].isreference () && ! locals[i].isinitialized ()) - verifier->verify_fail ("uninitialized object in local variable"); - - check_this_initialized (verifier); - } - // Ensure that `this' has been initialized. void check_this_initialized (_Jv_BytecodeVerifier *verifier) { @@ -1434,15 +1414,19 @@ private: void push_jump (int offset) { int npc = compute_jump (offset); - if (npc < PC) - current_state->check_no_uninitialized_objects (current_method->max_locals, this); + // According to the JVM Spec, we need to check for uninitialized + // objects here. However, this does not actually affect type + // safety, and the Eclipse java compiler generates code that + // violates this constraint. merge_into (npc, current_state); } void push_exception_jump (type t, int pc) { - current_state->check_no_uninitialized_objects (current_method->max_locals, - this, true); + // According to the JVM Spec, we need to check for uninitialized + // objects here. However, this does not actually affect type + // safety, and the Eclipse java compiler generates code that + // violates this constraint. state s (current_state, current_method->max_stack, current_method->max_locals); if (current_method->max_stack < 1) @@ -1504,9 +1488,10 @@ private: if (npc >= current_method->code_length) verify_fail ("fell off end"); - if (npc < PC) - current_state->check_no_uninitialized_objects (current_method->max_locals, - this); + // According to the JVM Spec, we need to check for uninitialized + // objects here. However, this does not actually affect type + // safety, and the Eclipse java compiler generates code that + // violates this constraint. merge_into (npc, current_state); invalidate_pc (); } @@ -1515,8 +1500,10 @@ private: { int npc = compute_jump (offset); - if (npc < PC) - current_state->check_no_uninitialized_objects (current_method->max_locals, this); + // According to the JVM Spec, we need to check for uninitialized + // objects here. However, this does not actually affect type + // safety, and the Eclipse java compiler generates code that + // violates this constraint. // Modify our state as appropriate for entry into a subroutine. type ret_addr (return_address_type); |