< prev index next > src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp
Print this page
*
*/
#include "precompiled.hpp"
#include "classfile/symbolTable.hpp"
+ #include "classfile/vmClasses.hpp"
#include "interpreter/bytecodeStream.hpp"
#include "memory/universe.hpp"
#include "oops/constantPool.inline.hpp"
#include "oops/fieldStreams.inline.hpp"
#include "oops/instanceKlass.inline.hpp"
// JVMSpec| u2 descriptor_index;
// JVMSpec| u2 attributes_count;
// JVMSpec| attribute_info attributes[attributes_count];
// JVMSpec| }
! write_u2(access_flags.get_flags() & JVM_RECOGNIZED_FIELD_MODIFIERS);
write_u2(name_index);
write_u2(signature_index);
u2 attr_count = 0;
if (initial_value_index != 0) {
++attr_count;
// JVMSpec| u2 descriptor_index;
// JVMSpec| u2 attributes_count;
// JVMSpec| attribute_info attributes[attributes_count];
// JVMSpec| }
! write_u2(access_flags.get_flags());
write_u2(name_index);
write_u2(signature_index);
u2 attr_count = 0;
if (initial_value_index != 0) {
++attr_count;
u2 class_cp_index = permitted_subclasses->at(i);
write_u2(class_cp_index);
}
}
+ // LoadableDescriptors {
+ // u2 attribute_name_index;
+ // u4 attribute_length;
+ // u2 number_of_descriptors;
+ // u2 descriptors[number_of_descriptors];
+ // }
+ void JvmtiClassFileReconstituter::write_loadable_descriptors_attribute() {
+ Array<u2>* loadable_descriptors = ik()->loadable_descriptors();
+ int number_of_descriptors = loadable_descriptors->length();
+ int length = sizeof(u2) * (1 + number_of_descriptors); // '1 +' is for number_of_descriptors field
+
+ write_attribute_name_index("LoadableDescriptors");
+ write_u4(length);
+ write_u2(checked_cast<u2>(number_of_descriptors));
+ for (int i = 0; i < number_of_descriptors; i++) {
+ u2 utf8_index = loadable_descriptors->at(i);
+ write_u2(utf8_index);
+ }
+ }
+
// Record {
// u2 attribute_name_index;
// u4 attribute_length;
// u2 components_count;
// component_info components[components_count];
++attr_count;
}
if (ik()->permitted_subclasses() != Universe::the_empty_short_array()) {
++attr_count;
}
+ if (ik()->loadable_descriptors() != Universe::the_empty_short_array()) {
+ ++attr_count;
+ }
if (ik()->record_components() != nullptr) {
++attr_count;
}
write_u2(attr_count);
write_nest_members_attribute();
}
if (ik()->permitted_subclasses() != Universe::the_empty_short_array()) {
write_permitted_subclasses_attribute();
}
+ if (ik()->loadable_descriptors() != Universe::the_empty_short_array()) {
+ write_loadable_descriptors_attribute();
+ }
if (ik()->record_components() != nullptr) {
write_record_attribute();
}
if (cpool()->operands() != nullptr) {
write_bootstrapmethod_attribute();
// JVMSpec| cp_info constant_pool[constant_pool_count-1];
write_u2(checked_cast<u2>(cpool()->length()));
copy_cpool_bytes(writeable_address(cpool_size()));
// JVMSpec| u2 access_flags;
! write_u2(ik()->access_flags().get_flags() & JVM_RECOGNIZED_CLASS_MODIFIERS);
-
// JVMSpec| u2 this_class;
// JVMSpec| u2 super_class;
write_u2(class_symbol_to_cpool_index(ik()->name()));
Klass* super_class = ik()->super();
write_u2(super_class == nullptr? 0 : // zero for java.lang.Object
// JVMSpec| cp_info constant_pool[constant_pool_count-1];
write_u2(checked_cast<u2>(cpool()->length()));
copy_cpool_bytes(writeable_address(cpool_size()));
// JVMSpec| u2 access_flags;
! write_u2(ik()->access_flags().get_flags() & (JVM_RECOGNIZED_CLASS_MODIFIERS));
// JVMSpec| u2 this_class;
// JVMSpec| u2 super_class;
write_u2(class_symbol_to_cpool_index(ik()->name()));
Klass* super_class = ik()->super();
write_u2(super_class == nullptr? 0 : // zero for java.lang.Object
bool is_wide = false;
switch (code) {
case Bytecodes::_getstatic : // fall through
case Bytecodes::_putstatic : // fall through
case Bytecodes::_getfield : // fall through
! case Bytecodes::_putfield : {
int field_index = Bytes::get_native_u2(bcp+1);
u2 pool_index = mh->constants()->resolved_field_entry_at(field_index)->constant_pool_index();
assert(pool_index < mh->constants()->length(), "sanity check");
Bytes::put_Java_u2((address)(p+1), pool_index); // java byte ordering
break;
bool is_wide = false;
switch (code) {
case Bytecodes::_getstatic : // fall through
case Bytecodes::_putstatic : // fall through
case Bytecodes::_getfield : // fall through
! case Bytecodes::_putfield : {
int field_index = Bytes::get_native_u2(bcp+1);
u2 pool_index = mh->constants()->resolved_field_entry_at(field_index)->constant_pool_index();
assert(pool_index < mh->constants()->length(), "sanity check");
Bytes::put_Java_u2((address)(p+1), pool_index); // java byte ordering
break;
< prev index next >