hotspot/src/share/vm/oops/annotations.hpp
changeset 15437 eabd4555d072
parent 15097 9db149412e0e
child 15601 df8faef6efaf
equal deleted inserted replaced
15431:570c5062ab8a 15437:eabd4555d072
     1 /*
     1 /*
     2  * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    32 #include "utilities/globalDefinitions.hpp"
    32 #include "utilities/globalDefinitions.hpp"
    33 
    33 
    34 
    34 
    35 class ClassLoaderData;
    35 class ClassLoaderData;
    36 class outputStream;
    36 class outputStream;
       
    37 class KlassSizeStats;
    37 
    38 
    38 typedef Array<u1> AnnotationArray;
    39 typedef Array<u1> AnnotationArray;
    39 
    40 
    40 // Class to hold the various types of annotations. The only metadata that points
    41 // Class to hold the various types of annotations. The only metadata that points
    41 // to this is InstanceKlass, or another Annotations instance if this is a
    42 // to this is InstanceKlass, or another Annotations instance if this is a
    80                                Array<AnnotationArray*>* ma,
    81                                Array<AnnotationArray*>* ma,
    81                                Array<AnnotationArray*>* mpa,
    82                                Array<AnnotationArray*>* mpa,
    82                                Array<AnnotationArray*>* mda, TRAPS);
    83                                Array<AnnotationArray*>* mda, TRAPS);
    83   void deallocate_contents(ClassLoaderData* loader_data);
    84   void deallocate_contents(ClassLoaderData* loader_data);
    84   DEBUG_ONLY(bool on_stack() { return false; })  // for template
    85   DEBUG_ONLY(bool on_stack() { return false; })  // for template
       
    86 
       
    87   // Sizing (in words)
    85   static int size()    { return sizeof(Annotations) / wordSize; }
    88   static int size()    { return sizeof(Annotations) / wordSize; }
       
    89 #if INCLUDE_SERVICES
       
    90   void collect_statistics(KlassSizeStats *sz) const;
       
    91 #endif
    86 
    92 
    87   // Constructor to initialize to null
    93   // Constructor to initialize to null
    88   Annotations() : _class_annotations(NULL),
    94   Annotations() : _class_annotations(NULL),
    89                   _fields_annotations(NULL),
    95                   _fields_annotations(NULL),
    90                   _methods_annotations(NULL),
    96                   _methods_annotations(NULL),
   140   bool is_klass() const { return false; }
   146   bool is_klass() const { return false; }
   141  private:
   147  private:
   142   void set_methods_annotations_of(instanceKlassHandle ik,
   148   void set_methods_annotations_of(instanceKlassHandle ik,
   143                                   int idnum, AnnotationArray* anno,
   149                                   int idnum, AnnotationArray* anno,
   144                                   Array<AnnotationArray*>** md_p, TRAPS);
   150                                   Array<AnnotationArray*>** md_p, TRAPS);
   145 
   151   static julong count_bytes(Array<AnnotationArray*>* p);
   146  public:
   152  public:
   147   const char* internal_name() const { return "{constant pool}"; }
   153   const char* internal_name() const { return "{constant pool}"; }
   148 #ifndef PRODUCT
   154 #ifndef PRODUCT
   149   void print_on(outputStream* st) const;
   155   void print_on(outputStream* st) const;
   150 #endif
   156 #endif