< prev index next >

hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp

Print this page
rev 10453 : imported patch update dates
   1 /*
   2  * Copyright (c) 2005, 2015, 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  *


 676 void JvmtiClassFileReconstituter::write_method_infos() {
 677   HandleMark hm(thread());
 678   Array<Method*>* methods = ikh()->methods();
 679   int num_methods = methods->length();
 680   int num_overpass = 0;
 681 
 682   // count the generated default interface methods
 683   // these will not be re-created by write_method_info
 684   // and should not be included in the total count
 685   for (int index = 0; index < num_methods; index++) {
 686     Method* method = methods->at(index);
 687     if (method->is_overpass()) {
 688       num_overpass++;
 689     }
 690   }
 691 
 692   write_u2(num_methods - num_overpass);
 693   if (JvmtiExport::can_maintain_original_method_order()) {
 694     int index;
 695     int original_index;
 696     intArray method_order(num_methods, 0);
 697 
 698     // invert the method order mapping
 699     for (index = 0; index < num_methods; index++) {
 700       original_index = ikh()->method_ordering()->at(index);
 701       assert(original_index >= 0 && original_index < num_methods,
 702              "invalid original method index");
 703       method_order.at_put(original_index, index);
 704     }
 705 
 706     // write in original order
 707     for (original_index = 0; original_index < num_methods; original_index++) {
 708       index = method_order.at(original_index);
 709       methodHandle method(thread(), methods->at(index));
 710       write_method_info(method);
 711     }
 712   } else {
 713     // method order not preserved just dump the method infos
 714     for (int index = 0; index < num_methods; index++) {
 715       methodHandle method(thread(), methods->at(index));
 716       write_method_info(method);


   1 /*
   2  * Copyright (c) 2005, 2016, 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  *


 676 void JvmtiClassFileReconstituter::write_method_infos() {
 677   HandleMark hm(thread());
 678   Array<Method*>* methods = ikh()->methods();
 679   int num_methods = methods->length();
 680   int num_overpass = 0;
 681 
 682   // count the generated default interface methods
 683   // these will not be re-created by write_method_info
 684   // and should not be included in the total count
 685   for (int index = 0; index < num_methods; index++) {
 686     Method* method = methods->at(index);
 687     if (method->is_overpass()) {
 688       num_overpass++;
 689     }
 690   }
 691 
 692   write_u2(num_methods - num_overpass);
 693   if (JvmtiExport::can_maintain_original_method_order()) {
 694     int index;
 695     int original_index;
 696     intArray method_order(num_methods, num_methods, 0);
 697 
 698     // invert the method order mapping
 699     for (index = 0; index < num_methods; index++) {
 700       original_index = ikh()->method_ordering()->at(index);
 701       assert(original_index >= 0 && original_index < num_methods,
 702              "invalid original method index");
 703       method_order.at_put(original_index, index);
 704     }
 705 
 706     // write in original order
 707     for (original_index = 0; original_index < num_methods; original_index++) {
 708       index = method_order.at(original_index);
 709       methodHandle method(thread(), methods->at(index));
 710       write_method_info(method);
 711     }
 712   } else {
 713     // method order not preserved just dump the method infos
 714     for (int index = 0; index < num_methods; index++) {
 715       methodHandle method(thread(), methods->at(index));
 716       write_method_info(method);


< prev index next >