aboutsummaryrefslogtreecommitdiff
path: root/libjava/verify.cc
AgeCommit message (Collapse)AuthorFilesLines
2002-12-28boehm.cc: Remove stray semicolon.Mark Mitchell1-28/+28
* boehm.cc: Remove stray semicolon. * interpret.cc: Likewise. * prims.cc: Likewise. * verify.cc (_Jv_BytecodeVerifier::verify_fail): Move definition earlier to ensure default arguments are processed. * gcj/array.h (JArray): Add forward declaration. (elements): Likewise. * gcj/javaprim.h: Remove stray semicolons. * include/bohm-gc.h: Likewise. * include/jni.h: Likewise. * include/jvm.h: Likewise. * java/lang/Class.h (_Jv_GetArrayClass): Declare _Jv_NewArrayClass. From-SVN: r60556
2002-12-05Fixed snafu caused when fixing previous snafu.Tom Tromey1-2/+2
From-SVN: r59846
2002-12-05Fixed ChangeLog patch snafuTom Tromey1-2/+2
From-SVN: r59844
2002-12-03natClassLoader.cc (_Jv_PrepareCompiledClass): Call _Jv_PushClass.Andrew Haley1-3/+3
2002-12-03 Andrew Haley <aph@redhat.com> * java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): Call _Jv_PushClass. (_Jv_InitNewClassFields): Set protectionDomain and chain = NULL. (_Jv_PopClass): New. (_Jv_PushClass): New. * java/lang/natClass.cc (forName (jstring)): Use a StackTrace to discover the ClassLoader of our caller. (_Jv_CheckArrayStore): Don't check that a class is assignment compatible with Object. * java/lang/natVMTHrowable.cc: Delete. * gnu/gcj/runtime/StackTrace.java: New, partly copied from java.lang.VMThrowable. (StackTrace(), StackTrace(int)): New constructors. (classAt, methodAt, update, methodAtAddress): New methods. (map): New field. * java/lang/VMThrowable.java: Use StackTrace instead of natVMTHrowable. * java/lang/Class.h (getClassLoaderInternal): New. (class Class): Be friendly with _Jv_PopClass and _Jv_PushClass. Be friendly with gnu::gcj::runtime::StackTrace. (Object.chain): New field. * include/java-interp.h (class _Jv_InterpMethod): Be friendly with gnu::gcj::runtime::StackTrace. * prims.cc (_Jv_NewObjectArray): Use getClassLoaderInternal() instead of getClassLoader(). * verify.cc (class _Jv_BytecodeVerifier): Likewise. java::lang::VMThrowable. * Makefile.am (core_java_source_files): Add MethodRef.java, StackTrace.java. (nat_source_files): Remove natVMThrowable.cc; add natStackTrace.cc. * Makefile.in: Rebuild. 2002-12-03 Andrew Haley <aph@redhat.com> * class.c (make_class_data): New field, "chain". * decl.c (java_init_decl_processing): Likewise. From-SVN: r59769
2002-11-27verify.cc (pop_init_ref): New method.Tom Tromey1-26/+48
* verify.cc (pop_init_ref): New method. (verify_instructions_0) [op_iaload, op_laload, op_faload, op_daload, op_aaload, op_baload, op_caload, op_saload, op_iastore, op_lastore, op_fastore, op_dastore, op_aastore, op_bastore, op_castore, op_sastore, op_areturn, op_arraylength, op_checkcast, op_instanceof, op_monitorenter, op_monitorexit]: Use it. (verify_instructions_0) [op_invokevirtual, op_invokespecial, op_invokestatic, op_invokeinterface]: Use pop_init_ref. Don't let `this' argument be uninitialized. Don't let `null' be passed as `this' to construtor. From-SVN: r59558
2002-11-26* verify.cc (type::compatible): Backed out broken change.Tom Tromey1-5/+5
From-SVN: r59496
2002-11-26verify.cc (type::compatible): Check initialization status first.Tom Tromey1-6/+5
* verify.cc (type::compatible): Check initialization status first. * interpret.cc (run) [insn_invokespecial, invokespecial_resolved]: Don't use NULLCHECK. From-SVN: r59494
2002-06-24verify.cc (branch_prepass): Updated for change to exception handler type.Tom Tromey1-12/+12
* verify.cc (branch_prepass): Updated for change to exception handler type. (verify_instructions_0): Likewise. * defineclass.cc (handleCodeAttribute): Initialize `prepared'. (handleExceptionTableEntry): Updated for change to exception handler type. * java/lang/Class.h (Class): Removed _Jv_InterpMethodInvocation. * include/java-interp.h (_Jv_InterpMethodInvocation): Removed. (union _Jv_InterpPC): New. (class _Jv_InterpException): Changed types to _Jv_InterpPC. (class _Jv_InterpMethod): Added new `prepared' field. (class _Jv_InterpMethod): Added `compile' method. Removed `continue1' and `find_exception'. Changed arguments to `run'. * interpret.cc (union insn_slot): New. (find_exception): Removed. (run_normal): Removed most logic. (run_synch_object): Likewise; also, use JvSynchronize. (run_synch_class): Likewise. (run): Removed. (continue1): Renamed as `run'. Compile bytecode if required. Add new code to allow refinement of direct-threaded code at runtime. Handle exceptions. (SAVE_PC): Removed. (compile): New method. (SET_ONE, SET_INSN, SET_INT, SET_DATUM): New defines. (NULLARRAYCHECK): Don't use SAVE_PC. (pc_t): New typedef. (TAKE_GOTO, GET1S, GET1U, GET2U, AVAL1U, AVAL2U, AVAL2UP, SKIP_GOTO, GOTO_VAL, PCVAL, AMPAMP): New macros. From-SVN: r54968
2002-04-26verify.cc (construct_primitive_array_type): New case.Tom Tromey1-0/+61
* verify.cc (construct_primitive_array_type) [void_type]: New case. (branch_prepass): Added dummy entries for unused instruction values. (verify_instructions_0): Likewise. * interpret.cc (continue1): Comment fix. * include/java-insns.h (op_xxxunusedxxx1): Removed. * Makefile.in: Rebuilt. * Makefile.am: Added -Wswitch-enum. From-SVN: r52814
2002-03-10verify.cc (state::NO_STACK): New constant.Tom Tromey1-22/+53
* verify.cc (state::NO_STACK): New constant. (state::is_unmerged_ret_state): Handle case where stacktop is NO_STACK. (state::merge): Handle NO_STACK merges. (handle_jsr_insn): Invalidate PC, and use special NO_STACK state for instruction following jsr. (stacktop, stackdepth): Removed unused variables. (pop_jump): Ignore case where all remaining states are skipped. From-SVN: r50526
2002-02-20re PR libgcj/5696 (natClass.cc run through superclasses of target if they ↵Tom Tromey1-12/+12
exist while comparing variable types.) Fix for PR libgcj/5696: * verify.cc (is_assignable_from_slow): Never call _Jv_IsAssignableFrom. (verify_instructions_0): Added new debug statement. (state::print): Print information about whether local has changed. (state::merge): Don't call note_variable when merging locals. (state::set_exception): Removed old FIXME comment. From-SVN: r49886
2002-02-15re PR libgcj/5695 (verify.cc test that target is an object before running ↵Tom Tromey1-4/+26
down interfaces) Fix for PR libgcj/5695: * verify.cc (is_assignable_from_slow): Check to see if target is an Object before checking to see if source is an interface. (verify_instructions_0) [op_invokeinterface]: Handle case where we're making an interface call on Object. From-SVN: r49783
2002-02-14re PR libgcj/5670 (verify.cc not properly merging states)Todd Stock1-2/+14
2002-02-13 Todd Stock <toddastock@yahoo.com> Fix for PR libgcj/5670: * verify.cc (is_assignable_from_slow): If `source' is interface, recursively look for merge with `target'. From-SVN: r49769
2002-02-13re PR libgcj/5671 (verify.cc problem merging local variables)Todd Stock1-2/+7
2002-02-13 Todd Stock <toddastock@yahoo.com> Fix for PR libgcj/5671: * verify.cc (state::merge): Handle case where we're merging against an interface. From-SVN: r49735
2002-02-07verify.cc (require_array_type): If argument is a null array of references, ↵Tom Tromey1-2/+4
return null as the element type. * verify.cc (require_array_type): If argument is a null array of references, return null as the element type. From-SVN: r49561
2002-02-07verify.cc (verify_instructions_0): Actually push the duplicate of a wide type.Mark Wielaard1-0/+2
2002-02-06 Mark Wielaard <mark@klomp.org> * verify.cc (verify_instructions_0) [op_dup2]: Actually push the duplicate of a wide type. From-SVN: r49559
2002-02-06verify.cc (type::isnull): New method.Tom Tromey1-1/+10
* verify.cc (type::isnull): New method. (require_array_type): Handle case where array is null. (verify_instructions_0) [op_arraylength]: Likewise. From-SVN: r49555
2002-02-01verify.cc (state::enter_subroutine): New method.Tom Tromey1-10/+30
* verify.cc (state::enter_subroutine): New method. (handle_jsr_insn): Use it. (state::merge): When processing a `ret', correctly use subroutine's state to determine which local variables have changed. (push_exception_jump): Don't let stack overflow. From-SVN: r49388
2002-01-30verify.cc (handle_ret_insn): Check for subroutine merge here...Tom Tromey1-9/+72
* verify.cc (handle_ret_insn): Check for subroutine merge here... (state::merge): ... not here. (subr_entry_info): New structure. (entry_points): New field. (~_Jv_BytecodeVerifier): Correctly free jsr_ptrs. Free entry_points. From-SVN: r49344
2002-01-28verify.cc (class _Jv_BytecodeVerifier): `nargs' byte is number of words, not ↵Tom Tromey1-7/+16
number of arguments. * verify.cc (class _Jv_BytecodeVerifier) [op_invokeinterface]: `nargs' byte is number of words, not number of arguments. From-SVN: r49292
2002-01-28verify.cc (class _Jv_BytecodeVerifier): Removed `FIXME' comment and to-do list.Tom Tromey1-13/+14
* verify.cc (class _Jv_BytecodeVerifier): Removed `FIXME' comment and to-do list. (state::merge): Use current class' class loader. (state::print): Print subroutine. (state::merge): Don't look at subroutine of unmerged `ret'. From-SVN: r49274
2002-01-25verify.cc (verify_fail): Change from being a top-level function to e method ↵Per Bothner1-106/+107
of _Jv_BytecodeVerifier. * verify.cc (verify_fail): Change from being a top-level function to e method of _Jv_BytecodeVerifier. Emit current method name. Pass the current verifier to type: and state: methods as needed, for better error messages, and for resolve. (resolve): Pass current class's loader for Class.forName and _Jv_FindClassFromSignature, rather than using the default loader. (various type: and state: methods): Take _Jv_BytecodeVerifier* arg. (get_type_val_for_signature): Make non-static. (various methods): Pass start_PC implicitly, not explicitly. From-SVN: r49240
2002-01-25Updated copyright dateTom Tromey1-1/+1
From-SVN: r49207
2002-01-24verify.cc (is_assignable_from_slow): If source is an interface, we must also ↵Per Bothner1-1/+3
check the superclass. * verify.cc (is_assignable_from_slow): If source is an interface, we must also check the superclass. From-SVN: r49189
2001-12-10resolve.cc (_Jv_PrepareClass): Verify method here...Tom Tromey1-28/+83
* resolve.cc (_Jv_PrepareClass): Verify method here... * defineclass.cc (handleMethodsEnd): ... not here. * verify.cc (_Jv_BytecodeVerifier::initialize_stack): New method. (_Jv_BytecodeVerifier::verify_instructions_0) [op_return]: Ensure there are no uninitialized objects. (_Jv_BytecodeVerifier::state::this_type): New field. (_Jv_BytecodeVerifier::state::state): Initialize this_type. (_Jv_BytecodeVerifier::state::copy): Copy this_type. (_Jv_BytecodeVerifier::state::merge): Merge this_type. (_Jv_BytecodeVerifier::state::check_no_uninitialized_objects): Handle this_type. (_Jv_BytecodeVerifier::state::check_this_initialized): New method. (_Jv_BytecodeVerifier::state::set_initialized): Handle this_type. (_Jv_BytecodeVerifier::state::set_this_type): New method. (_Jv_BytecodeVerifier::verify_instructions_0) [op_putfield]: Allow assignment to fields of `this' before another initializer is run. From-SVN: r47826
2001-12-09verify.cc (_Jv_BytecodeVerifier::is_assignable_from_slow): Handle case of ↵Tom Tromey1-6/+8
array whose component type is not prepared. * verify.cc (_Jv_BytecodeVerifier::is_assignable_from_slow): Handle case of array whose component type is not prepared. From-SVN: r47799
2001-12-07verify.cc (_Jv_BytecodeVerifier::branch_prepass): Set start_PC earlier, for ↵Tom Tromey1-3/+8
error handling. * verify.cc (_Jv_BytecodeVerifier::branch_prepass): Set start_PC earlier, for error handling. (_Jv_BytecodeVerifier::note_branch_target): Fixed branch target check. From-SVN: r47769
2001-12-07verify.cc (_Jv_BytecodeVerifier::FLAG_JSR_TARGET): Removed.Tom Tromey1-2/+0
* verify.cc (_Jv_BytecodeVerifier::FLAG_JSR_TARGET): Removed. (_Jv_BytecodeVerifier::note_branch_target): Likewise. From-SVN: r47745
2001-12-06verify.cc (_Jv_BytecodeVerifier::type_val): Added unused_by_subroutine_type.Tom Tromey1-19/+182
* verify.cc (_Jv_BytecodeVerifier::type_val): Added unused_by_subroutine_type. (_Jv_BytecodeVerifier::type::merge): Handle unused_by_subroutine_type. (_Jv_BytecodeVerifier::state::state): Added `ret_semantics' argument. (_Jv_BytecodeVerifier::state::copy): Likewise. (_Jv_BytecodeVerifier::push_jump_merge): Pass `ret_semantics' to state constructor. (_Jv_BytecodeVerifier::state::is_unmerged_ret_state): New method. (_Jv_BytecodeVerifier::pop_jump): Don't accept a jump which is from an unmerged ret. (_Jv_BytecodeVerifier::verify_instructions_0): Don't let an unmerged ret state skip verification in the fall-through case. (debug_print): New function. (_Jv_BytecodeVerifier::type::print): New method. (_Jv_BytecodeVerifier::state::print): New method. (_Jv_BytecodeVerifier::push_jump_merge): Print state. (_Jv_BytecodeVerifier::verify_instructions_0): Likewise. (_Jv_BytecodeVerifier::get_variable): Don't call note_variable. (_Jv_BytecodeVerifier::_Jv_BytecodeVerifier): Print debug information. From-SVN: r47734
2001-12-04verify.cc (_Jv_BytecodeVerifier::linked_utf8): New structure.Tom Tromey1-4/+45
* 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
2001-12-04defineclass.cc (read_one_method_attribute): `end_pc' for an exception can be ↵Tom Tromey1-33/+55
equal to code length. * defineclass.cc (read_one_method_attribute): `end_pc' for an exception can be equal to code length. * verify.cc (_Jv_BytecodeVerifier::verify_instructions_0): Removed `start_PC' from error invocation where it didn't make sense, and updated error message. Use `copy' to copy a state. Only try to merge current state with saved state when we've fallen through from the previous instruction. (_Jv_BytecodeVerifier::pop_ref_or_return): New method. (_Jv_BytecodeVerifier::verify_instructions_0) [op_astore_0]: Use pop_ref_or_return. (_Jv_BytecodeVerifier::verify_instructions_0) [op_astore]: Likewise. (_Jv_BytecodeVerifier::push_jump_merge): Pass max_locals, not max_stack, to merge. (_Jv_BytecodeVerifier::verify_instructions_0): Likewise. (_Jv_BytecodeVerifier::push_jump_merge): Merge from new state into state at branch target, not vice versa. (_Jv_BytecodeVerifier::branch_prepass): Allow end of exception to be equal to code length. Removed redundant test to see if exception start is after exception end. (_Jv_BytecodeVerifier::verify_instructions_0): Type of argument to `finally' is Throwable. From-SVN: r47623
2001-12-04defineclass.cc (handleMethodsEnd): Invoke verifier here...Tom Tromey1-2/+2
* defineclass.cc (handleMethodsEnd): Invoke verifier here... (handleCodeAttribute): ... not here. * verify.cc (_Jv_BytecodeVerifier::state::state): Use `copy', not structure assignment. From-SVN: r47591
2001-11-25verify.cc (_Jv_BytecodeVerifier::branch_prepass): Use java_opcode as type ↵Tom Tromey1-8/+8
for switch. * verify.cc (_Jv_BytecodeVerifier::branch_prepass): Use java_opcode as type for switch. [op_wide]: Likewise. (_Jv_BytecodeVerifier::verify_instructions_0): Likewise. [op_invokevirtual]: Likewise. * include/java-insns.h (java_opcode): Give enum a name. From-SVN: r47330
2001-11-20verify.cc (_Jv_BytecodeVerifier::branch_prepass): Uses two operand bytes, ↵Tom Tromey1-6/+6
not one. * verify.cc (_Jv_BytecodeVerifier::branch_prepass) [op_iinc]: Uses two operand bytes, not one. [op_arraylength]: Has no operands in bytecode. (_Jv_BytecodeVerifier::push_jump): Fixed call to check_no_uninitialized_objects. (_Jv_BytecodeVerifier::push_exception_jump): Likewise. (_Jv_BytecodeVerifier::handle_ret_insn): Likewise. (_Jv_BytecodeVerifier::handle_jsr_insn): Likewise. From-SVN: r47202
2001-11-20verify.cc (_Jv_BytecodeVerifier::require_array_type): Special case for ↵Tom Tromey1-3/+13
boolean arrays. * verify.cc (_Jv_BytecodeVerifier::require_array_type): Special case for boolean arrays. * verify.cc (_Jv_BytecodeVerifier::compute_jump): Put PC into error message. From-SVN: r47190
2001-11-19verify.cc (_Jv_BytecodeVerifier::verify_instructions_0): Shift argument is ↵Tom Tromey1-3/+6
an int, not a long. * verify.cc (_Jv_BytecodeVerifier::verify_instructions_0) [op_lshl, op_lshr, op_lushr]: Shift argument is an int, not a long. From-SVN: r47177
2001-11-19verify.cc (type::to_array): New method.Tom Tromey1-1/+18
* verify.cc (type::to_array): New method. (_Jv_BytecodeVerifier::verify_instructions_0) [op_anewarray]: Construct new array type. From-SVN: r47165
2001-11-19verify.cc (_Jv_BytecodeVerifier::branch_prepass): Skip a short, not a byte.Tom Tromey1-2/+2
* verify.cc (_Jv_BytecodeVerifier::branch_prepass) [op_sipush]: Skip a short, not a byte. [op_newarray]: Skip a byte, not a short. From-SVN: r47163
2001-11-19verify.cc (_Jv_BytecodeVerifier::get_type_val_for_signature): Added `B' case.Tom Tromey1-0/+3
* verify.cc (_Jv_BytecodeVerifier::get_type_val_for_signature): Added `B' case. From-SVN: r47162
2001-11-19verify.cc (_Jv_BytecodeVerifier::get_ushort): Use `jint' for temporary values.Tom Tromey1-10/+10
* verify.cc (_Jv_BytecodeVerifier::get_ushort): Use `jint' for temporary values. (_Jv_BytecodeVerifier::get_short): Likewise. (_Jv_BytecodeVerifier::get_int): Likewise. (_Jv_BytecodeVerifier::check_return_type): Reverse ordering of `compatible' call. From-SVN: r47161
2001-11-19verify.cc (_Jv_BytecodeVerifier::pop_type): Put PC into error message.Tom Tromey1-12/+16
* verify.cc (_Jv_BytecodeVerifier::pop_type): Put PC into error message. (_Jv_BytecodeVerifier::pop64): Likewise. (_Jv_BytecodeVerifier::pop32): Likewise. (_Jv_BytecodeVerifier::pop_raw): Likewise. (_Jv_BytecodeVerifier::pop_type): Promote the match type. (type::set_initialized): Only modify uninitialized types. (type::set_uninitialized): Fix shadowing bug. Simplify code. From-SVN: r47158
2001-11-18verify.cc: Include StringBuffer.h.Tom Tromey1-41/+80
* verify.cc: Include StringBuffer.h. (verify_fail): Added pc argument. Use StringBuffer to construct exception message. (_Jv_BytecodeVerifier::verify_instructions_0): Put PC into error message. (_Jv_BytecodeVerifier::check_return_type): Likewise. (_Jv_BytecodeVerifier::handle_field_or_method): Likewise. (_Jv_BytecodeVerifier::check_constant): Likewise. (_Jv_BytecodeVerifier::check_class_constant): Likewise. (_Jv_BytecodeVerifier::check_pool_index): Likewise. (_Jv_BytecodeVerifier::get_variable): Likewise. (_Jv_BytecodeVerifier::branch_prepass): Likewise. Also, correctly check exception handler endpoint. (_Jv_BytecodeVerifier::verify_instructions_0): Correctly handle wide arguments to current method. (_Jv_BytecodeVerifier::check_wide_constant): New method. (_Jv_BytecodeVerifier::verify_instructions_0) [op_ldc2_w]: Use it. From-SVN: r47155
2001-11-16verify.cc (_Jv_BytecodeVerifier::check_field_constant): Handle case where ↵Tom Tromey1-1/+3
field has primitive type. * verify.cc (_Jv_BytecodeVerifier::check_field_constant): Handle case where field has primitive type. From-SVN: r47112
2001-11-16verify.cc (_Jv_BytecodeVerifier::is_assignable_from_slow): New method.Tom Tromey1-8/+56
* verify.cc (_Jv_BytecodeVerifier::is_assignable_from_slow): New method. (type::compatible): Use it. (type::merge): Likewise. (type::promote): Return a `type&'. (get_one_type): Promote return value. From-SVN: r47097
2001-11-16verify.cc (type::compatible): Use _Jv_IsAssignableFrom.Tom Tromey1-2/+6
* verify.cc (type::compatible): Use _Jv_IsAssignableFrom. (type::merge): Likewise. From-SVN: r47077
2001-11-15verify.cc (class _Jv_BytecodeVerifier): Fixed logic.Tom Tromey1-18/+70
* verify.cc (class _Jv_BytecodeVerifier) [op_dup2]: Fixed logic. [op_dup_x2]: Likewise. [op_dup2_x1]: Likewise. [op_dup2_x2]: Likewise. (branch_prepass): Added `op_newarray' case. Updated unrecognized instruction error. (verify_instructions_0): Updated unrecognized instruction error. From-SVN: r47033
2001-11-09* verify.cc: Wrap in #ifdef INTERPRETER...#endif.Jeff Sturm1-0/+4
From-SVN: r46882
2001-11-07* verify.cc (skip_padding): Fail if padding byte is nonzero.Tom Tromey1-1/+2
From-SVN: r46830
2001-11-05Class.h (Class): Made _Jv_BytecodeVerifier a friend.Tom Tromey1-0/+2436
* java/lang/Class.h (Class): Made _Jv_BytecodeVerifier a friend. * Makefile.in: Rebuilt. * Makefile.am (libgcj_la_SOURCES): Added verify.cc. * verify.cc: New file. * include/java-interp.h (_Jv_count_arguments): Declare. (_Jv_VerifyMethod): Likewise. (class _Jv_InterpMethod): Made _Jv_BytecodeVerifier a friend. (class _Jv_InterpException): Likewise. * resolve.cc (_Jv_count_arguments): Renamed from count_arguments. No longer static. Updated callers. * defineclass.cc (int_bits_to_float): Removed. (long_bits_to_double): Likewise. (prepare_pool_entry): Updated. (handleCodeAttribute): Verify method (commented out for now). From-SVN: r46796