Mercurial > hg > truffle
comparison src/share/vm/prims/jvmtiClassFileReconstituter.cpp @ 6152:958bb4b7be49
Merge
author | asaha |
---|---|
date | Tue, 10 Apr 2012 10:42:34 -0700 |
parents | f7c4174b33ba |
children | 04ade88d9712 8150fa46d2ed |
comparison
equal
deleted
inserted
replaced
6151:e778c29768e6 | 6152:958bb4b7be49 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
290 write_u2(generic_signature_index); | 290 write_u2(generic_signature_index); |
291 } | 291 } |
292 | 292 |
293 // Compute the number of entries in the InnerClasses attribute | 293 // Compute the number of entries in the InnerClasses attribute |
294 u2 JvmtiClassFileReconstituter::inner_classes_attribute_length() { | 294 u2 JvmtiClassFileReconstituter::inner_classes_attribute_length() { |
295 typeArrayOop inner_class_list = ikh()->inner_classes(); | 295 InnerClassesIterator iter(ikh()); |
296 return (inner_class_list == NULL) ? 0 : inner_class_list->length(); | 296 return iter.length(); |
297 } | 297 } |
298 | 298 |
299 // Write an annotation attribute. The VM stores them in raw form, so all we need | 299 // Write an annotation attribute. The VM stores them in raw form, so all we need |
300 // to do is add the attrubute name and fill in the length. | 300 // to do is add the attrubute name and fill in the length. |
301 // JSR202| *Annotations_attribute { | 301 // JSR202| *Annotations_attribute { |
322 // JVMSpec| u2 inner_name_index; | 322 // JVMSpec| u2 inner_name_index; |
323 // JVMSpec| u2 inner_class_access_flags; | 323 // JVMSpec| u2 inner_class_access_flags; |
324 // JVMSpec| } classes[number_of_classes]; | 324 // JVMSpec| } classes[number_of_classes]; |
325 // JVMSpec| } | 325 // JVMSpec| } |
326 void JvmtiClassFileReconstituter::write_inner_classes_attribute(int length) { | 326 void JvmtiClassFileReconstituter::write_inner_classes_attribute(int length) { |
327 typeArrayOop inner_class_list = ikh()->inner_classes(); | 327 InnerClassesIterator iter(ikh()); |
328 guarantee(inner_class_list != NULL && inner_class_list->length() == length, | 328 guarantee(iter.length() != 0 && iter.length() == length, |
329 "caller must check"); | 329 "caller must check"); |
330 typeArrayHandle inner_class_list_h(thread(), inner_class_list); | |
331 assert (length % instanceKlass::inner_class_next_offset == 0, "just checking"); | |
332 u2 entry_count = length / instanceKlass::inner_class_next_offset; | 330 u2 entry_count = length / instanceKlass::inner_class_next_offset; |
333 u4 size = 2 + entry_count * (2+2+2+2); | 331 u4 size = 2 + entry_count * (2+2+2+2); |
334 | 332 |
335 write_attribute_name_index("InnerClasses"); | 333 write_attribute_name_index("InnerClasses"); |
336 write_u4(size); | 334 write_u4(size); |
337 write_u2(entry_count); | 335 write_u2(entry_count); |
338 for (int i = 0; i < length; i += instanceKlass::inner_class_next_offset) { | 336 for (; !iter.done(); iter.next()) { |
339 write_u2(inner_class_list_h->ushort_at( | 337 write_u2(iter.inner_class_info_index()); |
340 i + instanceKlass::inner_class_inner_class_info_offset)); | 338 write_u2(iter.outer_class_info_index()); |
341 write_u2(inner_class_list_h->ushort_at( | 339 write_u2(iter.inner_name_index()); |
342 i + instanceKlass::inner_class_outer_class_info_offset)); | 340 write_u2(iter.inner_access_flags()); |
343 write_u2(inner_class_list_h->ushort_at( | |
344 i + instanceKlass::inner_class_inner_name_offset)); | |
345 write_u2(inner_class_list_h->ushort_at( | |
346 i + instanceKlass::inner_class_access_flags_offset)); | |
347 } | 341 } |
348 } | 342 } |
349 | 343 |
350 // Write Synthetic attribute | 344 // Write Synthetic attribute |
351 // JVMSpec| Synthetic_attribute { | 345 // JVMSpec| Synthetic_attribute { |
725 case Bytecodes::_invokevirtual : // fall through | 719 case Bytecodes::_invokevirtual : // fall through |
726 case Bytecodes::_invokespecial : // fall through | 720 case Bytecodes::_invokespecial : // fall through |
727 case Bytecodes::_invokestatic : // fall through | 721 case Bytecodes::_invokestatic : // fall through |
728 case Bytecodes::_invokedynamic : // fall through | 722 case Bytecodes::_invokedynamic : // fall through |
729 case Bytecodes::_invokeinterface : | 723 case Bytecodes::_invokeinterface : |
730 assert(len == 3 || (code == Bytecodes::_invokeinterface && len ==5), | 724 assert(len == 3 || |
725 (code == Bytecodes::_invokeinterface && len == 5) || | |
726 (code == Bytecodes::_invokedynamic && len == 5), | |
731 "sanity check"); | 727 "sanity check"); |
728 | |
732 int cpci = Bytes::get_native_u2(bcp+1); | 729 int cpci = Bytes::get_native_u2(bcp+1); |
733 bool is_invokedynamic = (EnableInvokeDynamic && code == Bytecodes::_invokedynamic); | 730 bool is_invokedynamic = (EnableInvokeDynamic && code == Bytecodes::_invokedynamic); |
734 if (is_invokedynamic) | 731 if (is_invokedynamic) |
735 cpci = Bytes::get_native_u4(bcp+1); | 732 cpci = Bytes::get_native_u4(bcp+1); |
736 // cache cannot be pre-fetched since some classes won't have it yet | 733 // cache cannot be pre-fetched since some classes won't have it yet |