< prev index next >

src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp

Print this page




  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 #include "precompiled.hpp"
  26 #include "classfile/symbolTable.hpp"
  27 #include "interpreter/bytecodeStream.hpp"
  28 #include "oops/fieldStreams.hpp"
  29 #include "prims/jvmtiClassFileReconstituter.hpp"
  30 #include "runtime/signature.hpp"
  31 #include "utilities/bytes.hpp"
  32 
  33 // FIXME: add Deprecated attribute
  34 // FIXME: fix Synthetic attribute
  35 // FIXME: per Serguei, add error return handling for ConstantPool::copy_cpool_bytes()
  36 













  37 
  38 // Write the field information portion of ClassFile structure
  39 // JVMSpec|     u2 fields_count;
  40 // JVMSpec|     field_info fields[fields_count];
  41 void JvmtiClassFileReconstituter::write_field_infos() {
  42   HandleMark hm(thread());
  43   Array<AnnotationArray*>* fields_anno = ik()->fields_annotations();
  44   Array<AnnotationArray*>* fields_type_anno = ik()->fields_type_annotations();
  45 
  46   // Compute the real number of Java fields
  47   int java_fields = ik()->java_fields_count();
  48 
  49   write_u2(java_fields);
  50   for (JavaFieldStream fs(ik()); !fs.done(); fs.next()) {
  51     AccessFlags access_flags = fs.access_flags();
  52     int name_index = fs.name_index();
  53     int signature_index = fs.signature_index();
  54     int initial_value_index = fs.initval_index();
  55     guarantee(name_index != 0 && signature_index != 0, "bad constant pool index for field");
  56     // int offset = ik()->field_offset( index );




  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 #include "precompiled.hpp"
  26 #include "classfile/symbolTable.hpp"
  27 #include "interpreter/bytecodeStream.hpp"
  28 #include "oops/fieldStreams.hpp"
  29 #include "prims/jvmtiClassFileReconstituter.hpp"
  30 #include "runtime/signature.hpp"
  31 #include "utilities/bytes.hpp"
  32 
  33 // FIXME: add Deprecated attribute
  34 // FIXME: fix Synthetic attribute
  35 // FIXME: per Serguei, add error return handling for ConstantPool::copy_cpool_bytes()
  36 
  37 JvmtiConstantPoolReconstituter::JvmtiConstantPoolReconstituter(InstanceKlass* ik) {
  38   set_error(JVMTI_ERROR_NONE);
  39   _ik = ik;
  40   _cpool = constantPoolHandle(Thread::current(), ik->constants());
  41   _symmap = new SymbolHashMap();
  42   _classmap = new SymbolHashMap();
  43   _cpool_size = _cpool->hash_entries_to(_symmap, _classmap);
  44   if (_cpool_size == 0) {
  45     set_error(JVMTI_ERROR_OUT_OF_MEMORY);
  46   } else if (_cpool_size < 0) {
  47     set_error(JVMTI_ERROR_INTERNAL);
  48   }
  49 }
  50 
  51 // Write the field information portion of ClassFile structure
  52 // JVMSpec|     u2 fields_count;
  53 // JVMSpec|     field_info fields[fields_count];
  54 void JvmtiClassFileReconstituter::write_field_infos() {
  55   HandleMark hm(thread());
  56   Array<AnnotationArray*>* fields_anno = ik()->fields_annotations();
  57   Array<AnnotationArray*>* fields_type_anno = ik()->fields_type_annotations();
  58 
  59   // Compute the real number of Java fields
  60   int java_fields = ik()->java_fields_count();
  61 
  62   write_u2(java_fields);
  63   for (JavaFieldStream fs(ik()); !fs.done(); fs.next()) {
  64     AccessFlags access_flags = fs.access_flags();
  65     int name_index = fs.name_index();
  66     int signature_index = fs.signature_index();
  67     int initial_value_index = fs.initval_index();
  68     guarantee(name_index != 0 && signature_index != 0, "bad constant pool index for field");
  69     // int offset = ik()->field_offset( index );


< prev index next >