src/share/vm/classfile/classFileParser.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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 // Parser for for .class files
  26 //
  27 // The bytes describing the class file structure is read from a Stream object
  28 
  29 class ClassFileParser VALUE_OBJ_CLASS_SPEC {
  30  private:
  31   bool _need_verify;
  32   bool _relax_verify;
  33   u2   _major_version;
  34   u2   _minor_version;
  35   symbolHandle _class_name;
  36   KlassHandle _host_klass;
  37   GrowableArray<Handle>* _cp_patches; // overrides for CP entries
  38 
  39   bool _has_finalizer;
  40   bool _has_empty_finalizer;
  41   bool _has_vanilla_constructor;
  42 
  43   enum { fixed_buffer_size = 128 };
  44   u_char linenumbertable_buffer[fixed_buffer_size];


 266                                      bool verify,
 267                                      TRAPS) {
 268     KlassHandle no_host_klass;
 269     return parseClassFile(name, class_loader, protection_domain, no_host_klass, NULL, parsed_name, verify, THREAD);
 270   }
 271   instanceKlassHandle parseClassFile(symbolHandle name,
 272                                      Handle class_loader,
 273                                      Handle protection_domain,
 274                                      KlassHandle host_klass,
 275                                      GrowableArray<Handle>* cp_patches,
 276                                      symbolHandle& parsed_name,
 277                                      bool verify,
 278                                      TRAPS);
 279 
 280   // Verifier checks
 281   static void check_super_class_access(instanceKlassHandle this_klass, TRAPS);
 282   static void check_super_interface_access(instanceKlassHandle this_klass, TRAPS);
 283   static void check_final_method_override(instanceKlassHandle this_klass, TRAPS);
 284   static void check_illegal_static_method(instanceKlassHandle this_klass, TRAPS);
 285 };


   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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_CLASSFILEPARSER_HPP
  26 #define SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP
  27 
  28 #include "classfile/classFileStream.hpp"
  29 #include "memory/resourceArea.hpp"
  30 #include "oops/oop.inline.hpp"
  31 #include "oops/typeArrayOop.hpp"
  32 #include "runtime/handles.inline.hpp"
  33 #include "utilities/accessFlags.hpp"
  34 
  35 // Parser for for .class files
  36 //
  37 // The bytes describing the class file structure is read from a Stream object
  38 
  39 class ClassFileParser VALUE_OBJ_CLASS_SPEC {
  40  private:
  41   bool _need_verify;
  42   bool _relax_verify;
  43   u2   _major_version;
  44   u2   _minor_version;
  45   symbolHandle _class_name;
  46   KlassHandle _host_klass;
  47   GrowableArray<Handle>* _cp_patches; // overrides for CP entries
  48 
  49   bool _has_finalizer;
  50   bool _has_empty_finalizer;
  51   bool _has_vanilla_constructor;
  52 
  53   enum { fixed_buffer_size = 128 };
  54   u_char linenumbertable_buffer[fixed_buffer_size];


 276                                      bool verify,
 277                                      TRAPS) {
 278     KlassHandle no_host_klass;
 279     return parseClassFile(name, class_loader, protection_domain, no_host_klass, NULL, parsed_name, verify, THREAD);
 280   }
 281   instanceKlassHandle parseClassFile(symbolHandle name,
 282                                      Handle class_loader,
 283                                      Handle protection_domain,
 284                                      KlassHandle host_klass,
 285                                      GrowableArray<Handle>* cp_patches,
 286                                      symbolHandle& parsed_name,
 287                                      bool verify,
 288                                      TRAPS);
 289 
 290   // Verifier checks
 291   static void check_super_class_access(instanceKlassHandle this_klass, TRAPS);
 292   static void check_super_interface_access(instanceKlassHandle this_klass, TRAPS);
 293   static void check_final_method_override(instanceKlassHandle this_klass, TRAPS);
 294   static void check_illegal_static_method(instanceKlassHandle this_klass, TRAPS);
 295 };
 296 
 297 #endif // SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP