/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_CLASSFILE_VERIFIER_HPP
#define SHARE_VM_CLASSFILE_VERIFIER_HPP
#include "classfile/verificationType.hpp"
#include "memory/gcLocker.hpp"
#include "oops/methodOop.hpp"
#include "runtime/handles.hpp"
#include "utilities/exceptions.hpp"
// The verifier class
public:
enum {
};
/**
* Verify the bytecodes for a class. If 'throw_exception' is true
* then the appropriate VerifyError or ClassFormatError will be thrown.
* Otherwise, no exception is thrown and the return indicates the
* error.
*/
// Return false if the class is loaded by the bootstrap loader,
// or if defineClass was called requesting skipping verification
// Relax certain verifier checks to enable some broken 1.1 apps to run on 1.2.
private:
static Symbol* inference_verify(
};
class RawBytecodeStream;
class StackMapFrame;
class StackMapTable;
// Summary of verifier's memory usage:
// StackMapTable is stack allocated.
// StackMapFrame are resource allocated. There is only one ResourceMark
// for each class verification, which is created at the top level.
// There is one mutable StackMapFrame (current_frame) which is updated
// by abstract bytecode interpretation. frame_in_exception_handler() returns
// a frame that has a mutable one-item stack (ready for pushing the
// catch type exception object). All the other StackMapFrame's
// are immutable (including their locals and stack arrays) after
// their constructions.
// the mutable StackMapFrame (current_frame).
// These macros are used similarly to CHECK macros but also check
// the status of the verifier and return if that has an error.
private:
typedef enum {
} Origin;
public:
static TypeOrigin null();
void reset_frame();
#ifdef ASSERT
#endif
};
private:
typedef enum {
} FaultType;
int _bci;
public:
}
}
}
}
}
}
}
}
}
}
}
}
}
void reset_frames() {
_type.reset_frame();
}
#ifdef ASSERT
}
#endif
private:
};
// A new instance of this class is created for each class being verified
private:
char* _message;
}
bool is_protected_access(
void verify_ldc(
void verify_switch(
void verify_invoke_init(
void verify_return_value(
VerificationType object_type() const;
// 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.
public:
enum {
};
// constructor
// destructor
~ClassVerifier();
// 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.
void verify_class(TRAPS);
// Return status modes
char* exception_message() {
}
// Called when verify or class format errors are encountered.
// May throw an exception based upon the mode.
void class_format_error(const char* fmt, ...);
}
// Keep a list of temporary symbols created during verification because
// their reference counts need to be decrememented when the verifier object
// goes out of scope. Since these symbols escape the scope in which they're
// created, we can't use a TempNewSymbol.
};
switch (bt) {
case T_OBJECT:
case T_ARRAY:
{
// Create another symbol to save as signature stream unreferences
// this symbol.
return 1;
}
case T_LONG:
return 2;
case T_DOUBLE:
return 2;
case T_INT:
case T_BOOLEAN:
case T_BYTE:
case T_CHAR:
case T_SHORT:
return 1;
case T_FLOAT:
return 1;
default:
return 1;
}
}
#endif // SHARE_VM_CLASSFILE_VERIFIER_HPP