src/share/vm/prims/jvmtiClassFileReconstituter.cpp

Print this page




   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 # include "incls/_precompiled.incl"
  25 # include "incls/_jvmtiClassFileReconstituter.cpp.incl"
  26 














  27 // FIXME: add Deprecated, LVT, LVTT attributes
  28 // FIXME: fix Synthetic attribute
  29 // FIXME: per Serguei, add error return handling for constantPoolOopDesc::copy_cpool_bytes()
  30 
  31 
  32 // Write the field information portion of ClassFile structure
  33 // JVMSpec|     u2 fields_count;
  34 // JVMSpec|     field_info fields[fields_count];
  35 void JvmtiClassFileReconstituter::write_field_infos() {
  36   HandleMark hm(thread());
  37   typeArrayHandle fields(thread(), ikh()->fields());
  38   int fields_length = fields->length();
  39   int num_fields = fields_length / instanceKlass::next_offset;
  40   objArrayHandle fields_anno(thread(), ikh()->fields_annotations());
  41 
  42   write_u2(num_fields);
  43   for (int index = 0; index < fields_length; index += instanceKlass::next_offset) {
  44     AccessFlags access_flags;
  45     int flags = fields->ushort_at(index + instanceKlass::access_flags_offset);
  46     access_flags.set_flags(flags);




   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 #include "precompiled.hpp"
  26 #include "classfile/symbolTable.hpp"
  27 #include "interpreter/bytecodeStream.hpp"
  28 #include "prims/jvmtiClassFileReconstituter.hpp"
  29 #include "runtime/signature.hpp"
  30 #ifdef TARGET_ARCH_x86
  31 # include "bytes_x86.hpp"
  32 #endif
  33 #ifdef TARGET_ARCH_sparc
  34 # include "bytes_sparc.hpp"
  35 #endif
  36 #ifdef TARGET_ARCH_zero
  37 # include "bytes_zero.hpp"
  38 #endif
  39 // FIXME: add Deprecated, LVT, LVTT attributes
  40 // FIXME: fix Synthetic attribute
  41 // FIXME: per Serguei, add error return handling for constantPoolOopDesc::copy_cpool_bytes()
  42 
  43 
  44 // Write the field information portion of ClassFile structure
  45 // JVMSpec|     u2 fields_count;
  46 // JVMSpec|     field_info fields[fields_count];
  47 void JvmtiClassFileReconstituter::write_field_infos() {
  48   HandleMark hm(thread());
  49   typeArrayHandle fields(thread(), ikh()->fields());
  50   int fields_length = fields->length();
  51   int num_fields = fields_length / instanceKlass::next_offset;
  52   objArrayHandle fields_anno(thread(), ikh()->fields_annotations());
  53 
  54   write_u2(num_fields);
  55   for (int index = 0; index < fields_length; index += instanceKlass::next_offset) {
  56     AccessFlags access_flags;
  57     int flags = fields->ushort_at(index + instanceKlass::access_flags_offset);
  58     access_flags.set_flags(flags);