< prev index next >

src/hotspot/share/c1/c1_InstructionPrinter.cpp

Print this page

  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 "c1/c1_InstructionPrinter.hpp"
 26 #include "c1/c1_ValueStack.hpp"
 27 #include "ci/ciArray.hpp"

 28 #include "ci/ciInstance.hpp"
 29 #include "ci/ciObject.hpp"
 30 #include "classfile/vmSymbols.hpp"
 31 
 32 
 33 #ifndef PRODUCT
 34 
 35 const char* InstructionPrinter::basic_type_name(BasicType type) {
 36   const char* n = type2name(type);
 37   if (n == nullptr || type > T_VOID) {
 38     return "???";
 39   }
 40   return n;
 41 }
 42 
 43 
 44 const char* InstructionPrinter::cond_name(If::Condition cond) {
 45   switch (cond) {
 46     case If::eql: return "==";
 47     case If::neq: return "!=";

363 }
364 
365 
366 void InstructionPrinter::do_StoreField(StoreField* x) {
367   print_field(x);
368   output()->print(" := ");
369   print_value(x->value());
370   output()->print(" (%c)", type2char(x->field()->type()->basic_type()));
371   output()->print(" %s", x->field()->name()->as_utf8());
372 }
373 
374 
375 void InstructionPrinter::do_ArrayLength(ArrayLength* x) {
376   print_value(x->array());
377   output()->print(".length");
378 }
379 
380 
381 void InstructionPrinter::do_LoadIndexed(LoadIndexed* x) {
382   print_indexed(x);
383   output()->print(" (%c)", type2char(x->elt_type()));





384   if (x->check_flag(Instruction::NeedsRangeCheckFlag)) {
385     output()->print(" [rc]");
386   }
387 }
388 
389 
390 void InstructionPrinter::do_StoreIndexed(StoreIndexed* x) {
391   print_indexed(x);
392   output()->print(" := ");
393   print_value(x->value());
394   output()->print(" (%c)", type2char(x->elt_type()));
395   if (x->check_flag(Instruction::NeedsRangeCheckFlag)) {
396     output()->print(" [rc]");
397   }
398 }
399 
400 void InstructionPrinter::do_NegateOp(NegateOp* x) {
401   output()->put('-');
402   print_value(x->x());
403 }

828     output()->print(", ");
829     print_klass(x->known_holder());
830     output()->print(" ");
831   }
832   for (int i = 0; i < x->nb_profiled_args(); i++) {
833     if (i > 0) output()->print(", ");
834     print_value(x->profiled_arg_at(i));
835     if (x->arg_needs_null_check(i)) {
836       output()->print(" [NC]");
837     }
838   }
839   output()->put(')');
840 }
841 
842 void InstructionPrinter::do_ProfileReturnType(ProfileReturnType* x) {
843   output()->print("profile ret type ");
844   print_value(x->ret());
845   output()->print(" %s.%s", x->method()->holder()->name()->as_utf8(), x->method()->name()->as_utf8());
846   output()->put(')');
847 }

848 void InstructionPrinter::do_ProfileInvoke(ProfileInvoke* x) {
849   output()->print("profile_invoke ");
850   output()->print(" %s.%s", x->inlinee()->holder()->name()->as_utf8(), x->inlinee()->name()->as_utf8());
851   output()->put(')');
852 
853 }
854 







855 void InstructionPrinter::do_RuntimeCall(RuntimeCall* x) {
856   output()->print("call_rt %s(", x->entry_name());
857   for (int i = 0; i < x->number_of_arguments(); i++) {
858     if (i > 0) output()->print(", ");
859     print_value(x->argument_at(i));
860   }
861   output()->put(')');
862 }
863 
864 void InstructionPrinter::do_MemBar(MemBar* x) {
865   LIR_Code code = x->code();
866   switch (code) {
867   case lir_membar_acquire   : output()->print("membar_acquire"); break;
868   case lir_membar_release   : output()->print("membar_release"); break;
869   case lir_membar           : output()->print("membar"); break;
870   case lir_membar_loadload  : output()->print("membar_loadload"); break;
871   case lir_membar_storestore: output()->print("membar_storestore"); break;
872   case lir_membar_loadstore : output()->print("membar_loadstore"); break;
873   case lir_membar_storeload : output()->print("membar_storeload"); break;
874   default                   : ShouldNotReachHere(); break;

  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 "c1/c1_InstructionPrinter.hpp"
 26 #include "c1/c1_ValueStack.hpp"
 27 #include "ci/ciArray.hpp"
 28 #include "ci/ciInlineKlass.hpp"
 29 #include "ci/ciInstance.hpp"
 30 #include "ci/ciObject.hpp"
 31 #include "classfile/vmSymbols.hpp"
 32 
 33 
 34 #ifndef PRODUCT
 35 
 36 const char* InstructionPrinter::basic_type_name(BasicType type) {
 37   const char* n = type2name(type);
 38   if (n == nullptr || type > T_VOID) {
 39     return "???";
 40   }
 41   return n;
 42 }
 43 
 44 
 45 const char* InstructionPrinter::cond_name(If::Condition cond) {
 46   switch (cond) {
 47     case If::eql: return "==";
 48     case If::neq: return "!=";

364 }
365 
366 
367 void InstructionPrinter::do_StoreField(StoreField* x) {
368   print_field(x);
369   output()->print(" := ");
370   print_value(x->value());
371   output()->print(" (%c)", type2char(x->field()->type()->basic_type()));
372   output()->print(" %s", x->field()->name()->as_utf8());
373 }
374 
375 
376 void InstructionPrinter::do_ArrayLength(ArrayLength* x) {
377   print_value(x->array());
378   output()->print(".length");
379 }
380 
381 
382 void InstructionPrinter::do_LoadIndexed(LoadIndexed* x) {
383   print_indexed(x);
384   if (x->delayed() != nullptr) {
385     output()->print(" +%zu", x->delayed()->offset());
386     output()->print(" (%c)", type2char(x->delayed()->field()->type()->basic_type()));
387   } else {
388     output()->print(" (%c)", type2char(x->elt_type()));
389   }
390   if (x->check_flag(Instruction::NeedsRangeCheckFlag)) {
391     output()->print(" [rc]");
392   }
393 }
394 
395 
396 void InstructionPrinter::do_StoreIndexed(StoreIndexed* x) {
397   print_indexed(x);
398   output()->print(" := ");
399   print_value(x->value());
400   output()->print(" (%c)", type2char(x->elt_type()));
401   if (x->check_flag(Instruction::NeedsRangeCheckFlag)) {
402     output()->print(" [rc]");
403   }
404 }
405 
406 void InstructionPrinter::do_NegateOp(NegateOp* x) {
407   output()->put('-');
408   print_value(x->x());
409 }

834     output()->print(", ");
835     print_klass(x->known_holder());
836     output()->print(" ");
837   }
838   for (int i = 0; i < x->nb_profiled_args(); i++) {
839     if (i > 0) output()->print(", ");
840     print_value(x->profiled_arg_at(i));
841     if (x->arg_needs_null_check(i)) {
842       output()->print(" [NC]");
843     }
844   }
845   output()->put(')');
846 }
847 
848 void InstructionPrinter::do_ProfileReturnType(ProfileReturnType* x) {
849   output()->print("profile ret type ");
850   print_value(x->ret());
851   output()->print(" %s.%s", x->method()->holder()->name()->as_utf8(), x->method()->name()->as_utf8());
852   output()->put(')');
853 }
854 
855 void InstructionPrinter::do_ProfileInvoke(ProfileInvoke* x) {
856   output()->print("profile_invoke ");
857   output()->print(" %s.%s", x->inlinee()->holder()->name()->as_utf8(), x->inlinee()->name()->as_utf8());
858   output()->put(')');
859 
860 }
861 
862 void InstructionPrinter::do_ProfileACmpTypes(ProfileACmpTypes* x) {
863   output()->print("profile acmp types ");
864   print_value(x->left());
865   output()->print(", ");
866   print_value(x->right());
867 }
868 
869 void InstructionPrinter::do_RuntimeCall(RuntimeCall* x) {
870   output()->print("call_rt %s(", x->entry_name());
871   for (int i = 0; i < x->number_of_arguments(); i++) {
872     if (i > 0) output()->print(", ");
873     print_value(x->argument_at(i));
874   }
875   output()->put(')');
876 }
877 
878 void InstructionPrinter::do_MemBar(MemBar* x) {
879   LIR_Code code = x->code();
880   switch (code) {
881   case lir_membar_acquire   : output()->print("membar_acquire"); break;
882   case lir_membar_release   : output()->print("membar_release"); break;
883   case lir_membar           : output()->print("membar"); break;
884   case lir_membar_loadload  : output()->print("membar_loadload"); break;
885   case lir_membar_storestore: output()->print("membar_storestore"); break;
886   case lir_membar_loadstore : output()->print("membar_loadstore"); break;
887   case lir_membar_storeload : output()->print("membar_storeload"); break;
888   default                   : ShouldNotReachHere(); break;
< prev index next >