1 /*
2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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 "oops/fieldStreams.hpp"
29 #include "prims/jvmtiClassFileReconstituter.hpp"
30 #include "runtime/signature.hpp"
31 #ifdef TARGET_ARCH_x86
32 # include "bytes_x86.hpp"
33 #endif
34 #ifdef TARGET_ARCH_sparc
35 # include "bytes_sparc.hpp"
36 #endif
37 #ifdef TARGET_ARCH_zero
38 # include "bytes_zero.hpp"
39 #endif
40 #ifdef TARGET_ARCH_arm
41 # include "bytes_arm.hpp"
42 #endif
43 #ifdef TARGET_ARCH_ppc
44 # include "bytes_ppc.hpp"
45 #endif
46 // FIXME: add Deprecated attribute
47 // FIXME: fix Synthetic attribute
48 // FIXME: per Serguei, add error return handling for ConstantPool::copy_cpool_bytes()
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 = ikh()->fields_annotations();
57
58 // Compute the real number of Java fields
59 int java_fields = ikh()->java_fields_count();
60
61 write_u2(java_fields);
62 for (JavaFieldStream fs(ikh()); !fs.done(); fs.next()) {
63 AccessFlags access_flags = fs.access_flags();
64 int name_index = fs.name_index();
65 int signature_index = fs.signature_index();
|
1 /*
2 * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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 "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 = ikh()->fields_annotations();
44
45 // Compute the real number of Java fields
46 int java_fields = ikh()->java_fields_count();
47
48 write_u2(java_fields);
49 for (JavaFieldStream fs(ikh()); !fs.done(); fs.next()) {
50 AccessFlags access_flags = fs.access_flags();
51 int name_index = fs.name_index();
52 int signature_index = fs.signature_index();
|