< prev index next >

src/share/vm/ci/ciReplay.cpp

Print this page


   1 /* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.

   2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "ci/ciMethodData.hpp"
  26 #include "ci/ciReplay.hpp"
  27 #include "ci/ciSymbol.hpp"
  28 #include "ci/ciKlass.hpp"
  29 #include "ci/ciUtilities.hpp"
  30 #include "compiler/compileBroker.hpp"

  31 #include "memory/allocation.inline.hpp"
  32 #include "memory/oopFactory.hpp"
  33 #include "memory/resourceArea.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "utilities/copy.hpp"
  36 #include "utilities/macros.hpp"
  37 
  38 #ifndef PRODUCT
  39 
  40 // ciReplay
  41 
  42 typedef struct _ciMethodDataRecord {
  43   const char* _klass_name;
  44   const char* _method_name;
  45   const char* _signature;
  46 
  47   int _state;
  48   int _current_mileage;
  49 
  50   intptr_t* _data;


 557 
 558   // ciMethod <klass> <name> <signature> <invocation_counter> <backedge_counter> <interpreter_invocation_count> <interpreter_throwout_count> <instructions_size>
 559   //
 560   //
 561   void process_ciMethod(TRAPS) {
 562     Method* method = parse_method(CHECK);
 563     if (had_error()) return;
 564     ciMethodRecord* rec = new_ciMethod(method);
 565     rec->_invocation_counter = parse_int("invocation_counter");
 566     rec->_backedge_counter = parse_int("backedge_counter");
 567     rec->_interpreter_invocation_count = parse_int("interpreter_invocation_count");
 568     rec->_interpreter_throwout_count = parse_int("interpreter_throwout_count");
 569     rec->_instructions_size = parse_int("instructions_size");
 570   }
 571 
 572   // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length> # ... methods <length>
 573   void process_ciMethodData(TRAPS) {
 574     Method* method = parse_method(CHECK);
 575     if (had_error()) return;
 576     /* just copied from Method, to build interpret data*/
 577     if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) {
 578       return;
 579     }
 580     // To be properly initialized, some profiling in the MDO needs the
 581     // method to be rewritten (number of arguments at a call for
 582     // instance)
 583     method->method_holder()->link_class(CHECK);
 584     // methodOopDesc::build_interpreter_method_data(method, CHECK);
 585     {
 586       // Grab a lock here to prevent multiple
 587       // MethodData*s from being created.
 588       MutexLocker ml(MethodData_lock, THREAD);
 589       if (method->method_data() == NULL) {
 590         ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
 591         MethodData* method_data = MethodData::allocate(loader_data, method, CHECK);
 592         method->set_method_data(method_data);
 593       }
 594     }
 595 
 596     // collect and record all the needed information for later
 597     ciMethodDataRecord* rec = new_ciMethodData(method);


   1 /*
   2  * Copyright (c) 2013, 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  *
  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 "gc/shared/referencePendingListLocker.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;


 559 
 560   // ciMethod <klass> <name> <signature> <invocation_counter> <backedge_counter> <interpreter_invocation_count> <interpreter_throwout_count> <instructions_size>
 561   //
 562   //
 563   void process_ciMethod(TRAPS) {
 564     Method* method = parse_method(CHECK);
 565     if (had_error()) return;
 566     ciMethodRecord* rec = new_ciMethod(method);
 567     rec->_invocation_counter = parse_int("invocation_counter");
 568     rec->_backedge_counter = parse_int("backedge_counter");
 569     rec->_interpreter_invocation_count = parse_int("interpreter_invocation_count");
 570     rec->_interpreter_throwout_count = parse_int("interpreter_throwout_count");
 571     rec->_instructions_size = parse_int("instructions_size");
 572   }
 573 
 574   // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length> # ... methods <length>
 575   void process_ciMethodData(TRAPS) {
 576     Method* method = parse_method(CHECK);
 577     if (had_error()) return;
 578     /* just copied from Method, to build interpret data*/
 579     if (ReferencePendingListLocker::is_locked_by_self()) {
 580       return;
 581     }
 582     // To be properly initialized, some profiling in the MDO needs the
 583     // method to be rewritten (number of arguments at a call for
 584     // instance)
 585     method->method_holder()->link_class(CHECK);
 586     // methodOopDesc::build_interpreter_method_data(method, CHECK);
 587     {
 588       // Grab a lock here to prevent multiple
 589       // MethodData*s from being created.
 590       MutexLocker ml(MethodData_lock, THREAD);
 591       if (method->method_data() == NULL) {
 592         ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
 593         MethodData* method_data = MethodData::allocate(loader_data, method, CHECK);
 594         method->set_method_data(method_data);
 595       }
 596     }
 597 
 598     // collect and record all the needed information for later
 599     ciMethodDataRecord* rec = new_ciMethodData(method);


< prev index next >