< prev index next >

src/hotspot/share/ci/ciReplay.cpp

Print this page




   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 "ci/ciMethodData.hpp"
  27 #include "ci/ciReplay.hpp"
  28 #include "ci/ciSymbol.hpp"
  29 #include "ci/ciKlass.hpp"
  30 #include "ci/ciUtilities.hpp"
  31 #include "compiler/compileBroker.hpp"
  32 #include "memory/allocation.inline.hpp"
  33 #include "memory/oopFactory.hpp"
  34 #include "memory/resourceArea.hpp"
  35 #include "oops/oop.inline.hpp"
  36 #include "prims/jvm.h"
  37 #include "utilities/copy.hpp"
  38 #include "utilities/macros.hpp"
  39 
  40 #ifndef PRODUCT
  41 
  42 // ciReplay
  43 
  44 typedef struct _ciMethodDataRecord {
  45   const char* _klass_name;
  46   const char* _method_name;
  47   const char* _signature;
  48 
  49   int _state;
  50   int _current_mileage;
  51 
  52   intptr_t* _data;
  53   char*     _orig_data;
  54   Klass**   _classes;
  55   Method**  _methods;
  56   int*      _classes_offsets;


 773         fd.has_initial_value()) {
 774       report_error(field_name);
 775       return;
 776     }
 777 
 778     oop java_mirror = k->java_mirror();
 779     if (field_signature[0] == '[') {
 780       int length = parse_int("array length");
 781       oop value = NULL;
 782 
 783       if (field_signature[1] == '[') {
 784         // multi dimensional array
 785         ArrayKlass* kelem = (ArrayKlass *)parse_klass(CHECK);
 786         if (kelem == NULL) {
 787           return;
 788         }
 789         int rank = 0;
 790         while (field_signature[rank] == '[') {
 791           rank++;
 792         }
 793         int* dims = NEW_RESOURCE_ARRAY(int, rank);
 794         dims[0] = length;
 795         for (int i = 1; i < rank; i++) {
 796           dims[i] = 1; // These aren't relevant to the compiler
 797         }
 798         value = kelem->multi_allocate(rank, dims, CHECK);
 799       } else {
 800         if (strcmp(field_signature, "[B") == 0) {
 801           value = oopFactory::new_byteArray(length, CHECK);
 802         } else if (strcmp(field_signature, "[Z") == 0) {
 803           value = oopFactory::new_boolArray(length, CHECK);
 804         } else if (strcmp(field_signature, "[C") == 0) {
 805           value = oopFactory::new_charArray(length, CHECK);
 806         } else if (strcmp(field_signature, "[S") == 0) {
 807           value = oopFactory::new_shortArray(length, CHECK);
 808         } else if (strcmp(field_signature, "[F") == 0) {
 809           value = oopFactory::new_singleArray(length, CHECK);
 810         } else if (strcmp(field_signature, "[D") == 0) {
 811           value = oopFactory::new_doubleArray(length, CHECK);
 812         } else if (strcmp(field_signature, "[I") == 0) {
 813           value = oopFactory::new_intArray(length, CHECK);




   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 "jvm.h"
  27 #include "ci/ciMethodData.hpp"
  28 #include "ci/ciReplay.hpp"
  29 #include "ci/ciSymbol.hpp"
  30 #include "ci/ciKlass.hpp"
  31 #include "ci/ciUtilities.hpp"
  32 #include "compiler/compileBroker.hpp"
  33 #include "memory/allocation.inline.hpp"
  34 #include "memory/oopFactory.hpp"
  35 #include "memory/resourceArea.hpp"
  36 #include "oops/oop.inline.hpp"

  37 #include "utilities/copy.hpp"
  38 #include "utilities/macros.hpp"
  39 
  40 #ifndef PRODUCT
  41 
  42 // ciReplay
  43 
  44 typedef struct _ciMethodDataRecord {
  45   const char* _klass_name;
  46   const char* _method_name;
  47   const char* _signature;
  48 
  49   int _state;
  50   int _current_mileage;
  51 
  52   intptr_t* _data;
  53   char*     _orig_data;
  54   Klass**   _classes;
  55   Method**  _methods;
  56   int*      _classes_offsets;


 773         fd.has_initial_value()) {
 774       report_error(field_name);
 775       return;
 776     }
 777 
 778     oop java_mirror = k->java_mirror();
 779     if (field_signature[0] == '[') {
 780       int length = parse_int("array length");
 781       oop value = NULL;
 782 
 783       if (field_signature[1] == '[') {
 784         // multi dimensional array
 785         ArrayKlass* kelem = (ArrayKlass *)parse_klass(CHECK);
 786         if (kelem == NULL) {
 787           return;
 788         }
 789         int rank = 0;
 790         while (field_signature[rank] == '[') {
 791           rank++;
 792         }
 793         jint* dims = NEW_RESOURCE_ARRAY(jint, rank);
 794         dims[0] = length;
 795         for (int i = 1; i < rank; i++) {
 796           dims[i] = 1; // These aren't relevant to the compiler
 797         }
 798         value = kelem->multi_allocate(rank, dims, CHECK);
 799       } else {
 800         if (strcmp(field_signature, "[B") == 0) {
 801           value = oopFactory::new_byteArray(length, CHECK);
 802         } else if (strcmp(field_signature, "[Z") == 0) {
 803           value = oopFactory::new_boolArray(length, CHECK);
 804         } else if (strcmp(field_signature, "[C") == 0) {
 805           value = oopFactory::new_charArray(length, CHECK);
 806         } else if (strcmp(field_signature, "[S") == 0) {
 807           value = oopFactory::new_shortArray(length, CHECK);
 808         } else if (strcmp(field_signature, "[F") == 0) {
 809           value = oopFactory::new_singleArray(length, CHECK);
 810         } else if (strcmp(field_signature, "[D") == 0) {
 811           value = oopFactory::new_doubleArray(length, CHECK);
 812         } else if (strcmp(field_signature, "[I") == 0) {
 813           value = oopFactory::new_intArray(length, CHECK);


< prev index next >