src/share/vm/classfile/classFileParser.hpp

Print this page
rev 145 : 6711908: JVM needs direct access to some annotations
Summary: Provide hook to scan annotations in the class file parser, before the instanceKlass is created.
Reviewed-by: ?

@@ -36,10 +36,20 @@
 
   bool _has_finalizer;
   bool _has_empty_finalizer;
   bool _has_vanilla_constructor;
 
+  // class attributes parsed before the instance klass is created:
+  u2              _em_class_index, _em_method_index; //for enclosing method
+  bool            _synthetic_flag;
+  symbolHandle    _retention_policy;
+  symbolHandle    _sourcefile;
+  symbolHandle    _generic_signature;
+  symbolHandle    _sde_symbol;
+  typeArrayHandle _inner_classes;
+  typeArrayHandle _annotations;
+
   enum { fixed_buffer_size = 128 };
   u_char linenumbertable_buffer[fixed_buffer_size];
 
   ClassFileStream* _stream;              // Actual input stream
 

@@ -106,24 +116,30 @@
   void parse_type_array(u2 array_length, u4 code_length, u4* u1_index, u4* u2_index,
                         u1* u1_array, u2* u2_array, constantPoolHandle cp, TRAPS);
   typeArrayOop parse_stackmap_table(u4 code_attribute_length, TRAPS);
 
   // Classfile attribute parsing
-  void parse_classfile_sourcefile_attribute(constantPoolHandle cp, instanceKlassHandle k, TRAPS);
-  void parse_classfile_source_debug_extension_attribute(constantPoolHandle cp,
-                                                instanceKlassHandle k, int length, TRAPS);
-  u2   parse_classfile_inner_classes_attribute(constantPoolHandle cp,
-                                               instanceKlassHandle k, TRAPS);
-  void parse_classfile_attributes(constantPoolHandle cp, instanceKlassHandle k, TRAPS);
-  void parse_classfile_synthetic_attribute(constantPoolHandle cp, instanceKlassHandle k, TRAPS);
-  void parse_classfile_signature_attribute(constantPoolHandle cp, instanceKlassHandle k, TRAPS);
+  void parse_classfile_sourcefile_attribute(constantPoolHandle cp, symbolHandle* sourcefile, TRAPS);
+  void parse_classfile_source_debug_extension_attribute(constantPoolHandle cp, int length,
+                                                        symbolHandle* sde_symbol_ret,
+                                                        TRAPS);
+  u2   parse_classfile_inner_classes_attribute(constantPoolHandle cp, typeArrayHandle* inner_classes, TRAPS);
+  void parse_classfile_attributes(constantPoolHandle cp, TRAPS);
+  void parse_classfile_synthetic_attribute(constantPoolHandle cp, bool* synthetic_flag, TRAPS);
+  void parse_classfile_signature_attribute(constantPoolHandle cp, symbolHandle* signature, TRAPS);
 
   // Annotations handling
   typeArrayHandle assemble_annotations(u1* runtime_visible_annotations,
                                        int runtime_visible_annotations_length,
                                        u1* runtime_invisible_annotations,
                                        int runtime_invisible_annotations_length, TRAPS);
+  int skip_annotation(u1* buffer, int limit, int index);
+  int skip_annotation_value(u1* buffer, int limit, int index);
+  void parse_class_annotations(u1* buffer, int limit, constantPoolHandle cp,
+                               /* Results: */
+                               symbolHandle* retention_policy,
+                               TRAPS);
 
   // Final setup
   int  compute_oop_map_size(instanceKlassHandle super, int nonstatic_oop_count,
                             int first_nonstatic_oop_offset);
   void fill_oop_maps(instanceKlassHandle k, int nonstatic_oop_map_count,