src/share/vm/classfile/verifier.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File bug_8050485_5 Sdiff src/share/vm/classfile

src/share/vm/classfile/verifier.hpp

Print this page




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CLASSFILE_VERIFIER_HPP
  26 #define SHARE_VM_CLASSFILE_VERIFIER_HPP
  27 
  28 #include "classfile/verificationType.hpp"
  29 #include "memory/gcLocker.hpp"
  30 #include "oops/klass.hpp"
  31 #include "oops/method.hpp"
  32 #include "runtime/handles.hpp"

  33 #include "utilities/exceptions.hpp"
  34 
  35 // The verifier class
  36 class Verifier : AllStatic {
  37  public:
  38   enum {
  39     STRICTER_ACCESS_CTRL_CHECK_VERSION  = 49,
  40     STACKMAP_ATTRIBUTE_MAJOR_VERSION    = 50,
  41     INVOKEDYNAMIC_MAJOR_VERSION         = 51,
  42     NO_RELAX_ACCESS_CTRL_CHECK_VERSION  = 52
  43   };
  44   typedef enum { ThrowException, NoException } Mode;
  45 
  46   /**
  47    * Verify the bytecodes for a class.  If 'throw_exception' is true
  48    * then the appropriate VerifyError or ClassFormatError will be thrown.
  49    * Otherwise, no exception is thrown and the return indicates the
  50    * error.
  51    */
  52   static bool verify(instanceKlassHandle klass, Mode mode, bool should_verify_class, TRAPS);


 286     u2 bci, bool this_uninit, StackMapFrame* current_frame,
 287     StackMapTable* stackmap_table, TRAPS);
 288 
 289   void verify_ldc(
 290     int opcode, u2 index, StackMapFrame *current_frame,
 291     constantPoolHandle cp, u2 bci, TRAPS);
 292 
 293   void verify_switch(
 294     RawBytecodeStream* bcs, u4 code_length, char* code_data,
 295     StackMapFrame* current_frame, StackMapTable* stackmap_table, TRAPS);
 296 
 297   void verify_field_instructions(
 298     RawBytecodeStream* bcs, StackMapFrame* current_frame,
 299     constantPoolHandle cp, TRAPS);
 300 
 301   void verify_invoke_init(
 302     RawBytecodeStream* bcs, u2 ref_index, VerificationType ref_class_type,
 303     StackMapFrame* current_frame, u4 code_length, bool* this_uninit,
 304     constantPoolHandle cp, TRAPS);
 305 










 306   void verify_invoke_instructions(
 307     RawBytecodeStream* bcs, u4 code_length, StackMapFrame* current_frame,
 308     bool* this_uninit, VerificationType return_type,
 309     constantPoolHandle cp, TRAPS);
 310 
 311   VerificationType get_newarray_type(u2 index, u2 bci, TRAPS);
 312   void verify_anewarray(u2 bci, u2 index, constantPoolHandle cp,
 313       StackMapFrame* current_frame, TRAPS);
 314   void verify_return_value(
 315       VerificationType return_type, VerificationType type, u2 offset,
 316       StackMapFrame* current_frame, TRAPS);
 317 
 318   void verify_iload (u2 index, StackMapFrame* current_frame, TRAPS);
 319   void verify_lload (u2 index, StackMapFrame* current_frame, TRAPS);
 320   void verify_fload (u2 index, StackMapFrame* current_frame, TRAPS);
 321   void verify_dload (u2 index, StackMapFrame* current_frame, TRAPS);
 322   void verify_aload (u2 index, StackMapFrame* current_frame, TRAPS);
 323   void verify_istore(u2 index, StackMapFrame* current_frame, TRAPS);
 324   void verify_lstore(u2 index, StackMapFrame* current_frame, TRAPS);
 325   void verify_fstore(u2 index, StackMapFrame* current_frame, TRAPS);




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CLASSFILE_VERIFIER_HPP
  26 #define SHARE_VM_CLASSFILE_VERIFIER_HPP
  27 
  28 #include "classfile/verificationType.hpp"
  29 #include "memory/gcLocker.hpp"
  30 #include "oops/klass.hpp"
  31 #include "oops/method.hpp"
  32 #include "runtime/handles.hpp"
  33 #include "utilities/growableArray.hpp"
  34 #include "utilities/exceptions.hpp"
  35 
  36 // The verifier class
  37 class Verifier : AllStatic {
  38  public:
  39   enum {
  40     STRICTER_ACCESS_CTRL_CHECK_VERSION  = 49,
  41     STACKMAP_ATTRIBUTE_MAJOR_VERSION    = 50,
  42     INVOKEDYNAMIC_MAJOR_VERSION         = 51,
  43     NO_RELAX_ACCESS_CTRL_CHECK_VERSION  = 52
  44   };
  45   typedef enum { ThrowException, NoException } Mode;
  46 
  47   /**
  48    * Verify the bytecodes for a class.  If 'throw_exception' is true
  49    * then the appropriate VerifyError or ClassFormatError will be thrown.
  50    * Otherwise, no exception is thrown and the return indicates the
  51    * error.
  52    */
  53   static bool verify(instanceKlassHandle klass, Mode mode, bool should_verify_class, TRAPS);


 287     u2 bci, bool this_uninit, StackMapFrame* current_frame,
 288     StackMapTable* stackmap_table, TRAPS);
 289 
 290   void verify_ldc(
 291     int opcode, u2 index, StackMapFrame *current_frame,
 292     constantPoolHandle cp, u2 bci, TRAPS);
 293 
 294   void verify_switch(
 295     RawBytecodeStream* bcs, u4 code_length, char* code_data,
 296     StackMapFrame* current_frame, StackMapTable* stackmap_table, TRAPS);
 297 
 298   void verify_field_instructions(
 299     RawBytecodeStream* bcs, StackMapFrame* current_frame,
 300     constantPoolHandle cp, TRAPS);
 301 
 302   void verify_invoke_init(
 303     RawBytecodeStream* bcs, u2 ref_index, VerificationType ref_class_type,
 304     StackMapFrame* current_frame, u4 code_length, bool* this_uninit,
 305     constantPoolHandle cp, TRAPS);
 306 
 307   // Used by ends_in_athrow() to push all handlers that contain bci onto
 308   // the handler_stack, if the handler is not already on the stack.
 309   void push_handlers(ExceptionTable* exhandlers,
 310                      GrowableArray<u4>* handler_stack,
 311                      u4 bci);
 312 
 313   // Returns true if all paths starting with start_bc_offset end in athrow
 314   // bytecode or loop.
 315   bool ends_in_athrow(u4 start_bc_offset);
 316 
 317   void verify_invoke_instructions(
 318     RawBytecodeStream* bcs, u4 code_length, StackMapFrame* current_frame,
 319     bool* this_uninit, VerificationType return_type,
 320     constantPoolHandle cp, TRAPS);
 321 
 322   VerificationType get_newarray_type(u2 index, u2 bci, TRAPS);
 323   void verify_anewarray(u2 bci, u2 index, constantPoolHandle cp,
 324       StackMapFrame* current_frame, TRAPS);
 325   void verify_return_value(
 326       VerificationType return_type, VerificationType type, u2 offset,
 327       StackMapFrame* current_frame, TRAPS);
 328 
 329   void verify_iload (u2 index, StackMapFrame* current_frame, TRAPS);
 330   void verify_lload (u2 index, StackMapFrame* current_frame, TRAPS);
 331   void verify_fload (u2 index, StackMapFrame* current_frame, TRAPS);
 332   void verify_dload (u2 index, StackMapFrame* current_frame, TRAPS);
 333   void verify_aload (u2 index, StackMapFrame* current_frame, TRAPS);
 334   void verify_istore(u2 index, StackMapFrame* current_frame, TRAPS);
 335   void verify_lstore(u2 index, StackMapFrame* current_frame, TRAPS);
 336   void verify_fstore(u2 index, StackMapFrame* current_frame, TRAPS);


src/share/vm/classfile/verifier.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File