< prev index next >

src/share/vm/classfile/classFileParser.hpp

Print this page
rev 7856 : 8073389: Remove the include of resourceArea.hpp from classFileParser.hpp


   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/typeArrayOop.hpp"

  31 #include "utilities/accessFlags.hpp"
  32 #include "classfile/symbolTable.hpp"
  33 

  34 class FieldAllocationCount;

  35 class FieldLayoutInfo;
  36 
  37 
  38 // Parser for for .class files
  39 //
  40 // The bytes describing the class file structure is read from a Stream object
  41 
  42 class ClassFileParser VALUE_OBJ_CLASS_SPEC {
  43  private:
  44   bool _need_verify;
  45   bool _relax_verify;
  46   u2   _major_version;
  47   u2   _minor_version;
  48   Symbol* _class_name;
  49   ClassLoaderData* _loader_data;
  50   KlassHandle _host_klass;
  51   GrowableArray<Handle>* _cp_patches; // overrides for CP entries
  52 
  53   // precomputed flags
  54   bool _has_finalizer;


 298   unsigned int compute_oop_map_count(instanceKlassHandle super,
 299                                      unsigned int nonstatic_oop_count,
 300                                      int first_nonstatic_oop_offset);
 301   void fill_oop_maps(instanceKlassHandle k,
 302                      unsigned int nonstatic_oop_map_count,
 303                      int* nonstatic_oop_offsets,
 304                      unsigned int* nonstatic_oop_counts);
 305   void set_precomputed_flags(instanceKlassHandle k);
 306   Array<Klass*>* compute_transitive_interfaces(instanceKlassHandle super,
 307                                                Array<Klass*>* local_ifs, TRAPS);
 308 
 309   // Format checker methods
 310   void classfile_parse_error(const char* msg, TRAPS);
 311   void classfile_parse_error(const char* msg, int index, TRAPS);
 312   void classfile_parse_error(const char* msg, const char *name, TRAPS);
 313   void classfile_parse_error(const char* msg, int index, const char *name, TRAPS);
 314   inline void guarantee_property(bool b, const char* msg, TRAPS) {
 315     if (!b) { classfile_parse_error(msg, CHECK); }
 316   }
 317 
 318 PRAGMA_DIAG_PUSH
 319 PRAGMA_FORMAT_NONLITERAL_IGNORED
 320 inline void assert_property(bool b, const char* msg, TRAPS) {

 321 #ifdef ASSERT
 322     if (!b) {
 323       ResourceMark rm(THREAD);
 324       fatal(err_msg(msg, _class_name->as_C_string()));
 325     }
 326 #endif
 327   }
 328 
 329   inline void assert_property(bool b, const char* msg, int index, TRAPS) {
 330 #ifdef ASSERT
 331     if (!b) {
 332       ResourceMark rm(THREAD);
 333       fatal(err_msg(msg, index, _class_name->as_C_string()));
 334     }
 335 #endif
 336   }
 337 PRAGMA_DIAG_POP
 338 
 339   inline void check_property(bool property, const char* msg, int index, TRAPS) {
 340     if (_need_verify) {
 341       guarantee_property(property, msg, index, CHECK);
 342     } else {
 343       assert_property(property, msg, index, CHECK);
 344     }
 345   }
 346 
 347   inline void check_property(bool property, const char* msg, TRAPS) {
 348     if (_need_verify) {
 349       guarantee_property(property, msg, CHECK);
 350     } else {
 351       assert_property(property, msg, CHECK);
 352     }
 353   }
 354 
 355   inline void guarantee_property(bool b, const char* msg, int index, TRAPS) {
 356     if (!b) { classfile_parse_error(msg, index, CHECK); }
 357   }




   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 "classfile/symbolTable.hpp"
  30 #include "oops/annotations.hpp"
  31 #include "oops/typeArrayOop.hpp"
  32 #include "oops/constantPool.hpp"
  33 #include "utilities/accessFlags.hpp"

  34 
  35 class CompressedLineNumberWriteStream;
  36 class FieldAllocationCount;
  37 class FieldInfo;
  38 class FieldLayoutInfo;
  39 
  40 
  41 // Parser for for .class files
  42 //
  43 // The bytes describing the class file structure is read from a Stream object
  44 
  45 class ClassFileParser VALUE_OBJ_CLASS_SPEC {
  46  private:
  47   bool _need_verify;
  48   bool _relax_verify;
  49   u2   _major_version;
  50   u2   _minor_version;
  51   Symbol* _class_name;
  52   ClassLoaderData* _loader_data;
  53   KlassHandle _host_klass;
  54   GrowableArray<Handle>* _cp_patches; // overrides for CP entries
  55 
  56   // precomputed flags
  57   bool _has_finalizer;


 301   unsigned int compute_oop_map_count(instanceKlassHandle super,
 302                                      unsigned int nonstatic_oop_count,
 303                                      int first_nonstatic_oop_offset);
 304   void fill_oop_maps(instanceKlassHandle k,
 305                      unsigned int nonstatic_oop_map_count,
 306                      int* nonstatic_oop_offsets,
 307                      unsigned int* nonstatic_oop_counts);
 308   void set_precomputed_flags(instanceKlassHandle k);
 309   Array<Klass*>* compute_transitive_interfaces(instanceKlassHandle super,
 310                                                Array<Klass*>* local_ifs, TRAPS);
 311 
 312   // Format checker methods
 313   void classfile_parse_error(const char* msg, TRAPS);
 314   void classfile_parse_error(const char* msg, int index, TRAPS);
 315   void classfile_parse_error(const char* msg, const char *name, TRAPS);
 316   void classfile_parse_error(const char* msg, int index, const char *name, TRAPS);
 317   inline void guarantee_property(bool b, const char* msg, TRAPS) {
 318     if (!b) { classfile_parse_error(msg, CHECK); }
 319   }
 320 
 321   void report_assert_property_failure(const char* msg, TRAPS);
 322   void report_assert_property_failure(const char* msg, int index, TRAPS);
 323 
 324   inline void assert_property(bool b, const char* msg, TRAPS) {
 325 #ifdef ASSERT
 326     if (!b) {
 327       report_assert_property_failure(msg, THREAD);

 328     }
 329 #endif
 330   }
 331 
 332   inline void assert_property(bool b, const char* msg, int index, TRAPS) {
 333 #ifdef ASSERT
 334     if (!b) {
 335       report_assert_property_failure(msg, index, THREAD);

 336     }
 337 #endif
 338   }

 339 
 340   inline void check_property(bool property, const char* msg, int index, TRAPS) {
 341     if (_need_verify) {
 342       guarantee_property(property, msg, index, CHECK);
 343     } else {
 344       assert_property(property, msg, index, CHECK);
 345     }
 346   }
 347 
 348   inline void check_property(bool property, const char* msg, TRAPS) {
 349     if (_need_verify) {
 350       guarantee_property(property, msg, CHECK);
 351     } else {
 352       assert_property(property, msg, CHECK);
 353     }
 354   }
 355 
 356   inline void guarantee_property(bool b, const char* msg, int index, TRAPS) {
 357     if (!b) { classfile_parse_error(msg, index, CHECK); }
 358   }


< prev index next >