verifier.hpp revision 1522
2362N/A * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// The verifier class 0N/A * Verify the bytecodes for a class. If 'throw_exception' is true 0N/A * then the appropriate VerifyError or ClassFormatError will be thrown. 0N/A * Otherwise, no exception is thrown and the return indicates the 0N/A // Return false if the class is loaded by the bootstrap loader, 0N/A // or if defineClass was called requesting skipping verification 0N/A // Relax certain verifier checks to enable some broken 1.1 apps to run on 1.2. 0N/A// Summary of verifier's memory usage: 0N/A// StackMapTable is stack allocated. 0N/A// StackMapFrame are resource allocated. There is one ResourceMark 0N/A// There is one mutable StackMapFrame (current_frame) which is updated 0N/A// by abstract bytecode interpretation. frame_in_exception_handler() returns 0N/A// a frame that has a mutable one-item stack (ready for pushing the 0N/A// catch type exception object). All the other StackMapFrame's 0N/A// are immutable (including their locals and stack arrays) after 0N/A// their constructions. 0N/A// the mutable StackMapFrame (current_frame). 0N/A// Care needs to be taken to make sure resource objects don't outlive 0N/A// the lifetime of their ResourceMark. 0N/A// These macros are used similarly to CHECK macros but also check 0N/A// the status of the verifier and return if that has an error. 0N/A// A new instance of this class is created for each class being verified // Some recursive calls from the verifier to the name resolver // can cause the current class to be re-verified and rewritten. // If this happens, the original verification should not continue, // because constant pool indexes will have changed. // The rewriter is preceded by the verifier. If the verifier throws // an error, rewriting is prevented. Also, rewriting always precedes // bytecode execution or compilation. Thus, is_rewritten implies // that a class has been verified and prepared for execution. // Verifies the class. If a verify or class file format error occurs, // the '_exception_name' symbols will set to the exception name and // the message_buffer will be filled in with the exception message. // Called when verify or class format errors are encountered. // May throw an exception based upon the mode.