< prev index next >

src/hotspot/share/c1/c1_InstructionPrinter.cpp

Print this page

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

 30 #include "ci/ciInstance.hpp"
 31 #include "ci/ciObject.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 == NULL || 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 "!=";
 49     case If::lss: 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   output()->print(" (%c)", type2char(x->elt_type()));





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

478   fill_to(instr_pos);
479   output()->print("%s.%s%s",
480              x->target()->holder()->name()->as_utf8(),
481              x->target()->name()->as_utf8(),
482              x->target()->signature()->as_symbol()->as_utf8());
483 }
484 
485 
486 void InstructionPrinter::do_NewInstance(NewInstance* x) {
487   output()->print("new instance ");
488   print_klass(x->klass());
489 }
490 
491 
492 void InstructionPrinter::do_NewTypeArray(NewTypeArray* x) {
493   output()->print("new %s array [", basic_type_name(x->elt_type()));
494   print_value(x->length());
495   output()->put(']');
496 }
497 




498 
499 void InstructionPrinter::do_NewObjectArray(NewObjectArray* x) {
500   output()->print("new object array [");
501   print_value(x->length());
502   output()->print("] ");
503   print_klass(x->klass());
504 }
505 
506 
507 void InstructionPrinter::do_NewMultiArray(NewMultiArray* x) {
508   output()->print("new multi array [");
509   Values* dims = x->dims();
510   for (int i = 0; i < dims->length(); i++) {
511     if (i > 0) output()->print(", ");
512     print_value(dims->at(i));
513   }
514   output()->print("] ");
515   print_klass(x->klass());
516 }
517 





518 
519 void InstructionPrinter::do_MonitorEnter(MonitorEnter* x) {
520   output()->print("enter ");
521   print_monitor(x);
522 }
523 
524 
525 void InstructionPrinter::do_MonitorExit(MonitorExit* x) {
526   output()->print("exit ");
527   print_monitor(x);
528 }
529 
530 
531 void InstructionPrinter::do_Intrinsic(Intrinsic* x) {
532   const char* name = vmIntrinsics::name_at(x->id());
533   if (name[0] == '_')  name++;  // strip leading bug from _hashCode, etc.
534   const char* kname = vmSymbols::name_for(vmIntrinsics::class_for(x->id()));
535   if (strchr(name, '_') == NULL) {
536     kname = NULL;
537   } else {

842     output()->print(", ");
843     print_klass(x->known_holder());
844     output()->print(" ");
845   }
846   for (int i = 0; i < x->nb_profiled_args(); i++) {
847     if (i > 0) output()->print(", ");
848     print_value(x->profiled_arg_at(i));
849     if (x->arg_needs_null_check(i)) {
850       output()->print(" [NC]");
851     }
852   }
853   output()->put(')');
854 }
855 
856 void InstructionPrinter::do_ProfileReturnType(ProfileReturnType* x) {
857   output()->print("profile ret type ");
858   print_value(x->ret());
859   output()->print(" %s.%s", x->method()->holder()->name()->as_utf8(), x->method()->name()->as_utf8());
860   output()->put(')');
861 }

862 void InstructionPrinter::do_ProfileInvoke(ProfileInvoke* x) {
863   output()->print("profile_invoke ");
864   output()->print(" %s.%s", x->inlinee()->holder()->name()->as_utf8(), x->inlinee()->name()->as_utf8());
865   output()->put(')');
866 
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;

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

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

484   fill_to(instr_pos);
485   output()->print("%s.%s%s",
486              x->target()->holder()->name()->as_utf8(),
487              x->target()->name()->as_utf8(),
488              x->target()->signature()->as_symbol()->as_utf8());
489 }
490 
491 
492 void InstructionPrinter::do_NewInstance(NewInstance* x) {
493   output()->print("new instance ");
494   print_klass(x->klass());
495 }
496 
497 
498 void InstructionPrinter::do_NewTypeArray(NewTypeArray* x) {
499   output()->print("new %s array [", basic_type_name(x->elt_type()));
500   print_value(x->length());
501   output()->put(']');
502 }
503 
504 void InstructionPrinter::do_NewInlineTypeInstance(NewInlineTypeInstance* x) {
505   output()->print("new inline type instance ");
506   print_klass(x->klass());
507 }
508 
509 void InstructionPrinter::do_NewObjectArray(NewObjectArray* x) {
510   output()->print("new object array [");
511   print_value(x->length());
512   output()->print("] ");
513   print_klass(x->klass());
514 }
515 
516 
517 void InstructionPrinter::do_NewMultiArray(NewMultiArray* x) {
518   output()->print("new multi array [");
519   Values* dims = x->dims();
520   for (int i = 0; i < dims->length(); i++) {
521     if (i > 0) output()->print(", ");
522     print_value(dims->at(i));
523   }
524   output()->print("] ");
525   print_klass(x->klass());
526 }
527 
528 void InstructionPrinter::do_Deoptimize(Deoptimize* x) {
529   output()->print("deoptimize [unloaded=");
530   print_klass(x->klass());
531   output()->print("] ");
532 }
533 
534 void InstructionPrinter::do_MonitorEnter(MonitorEnter* x) {
535   output()->print("enter ");
536   print_monitor(x);
537 }
538 
539 
540 void InstructionPrinter::do_MonitorExit(MonitorExit* x) {
541   output()->print("exit ");
542   print_monitor(x);
543 }
544 
545 
546 void InstructionPrinter::do_Intrinsic(Intrinsic* x) {
547   const char* name = vmIntrinsics::name_at(x->id());
548   if (name[0] == '_')  name++;  // strip leading bug from _hashCode, etc.
549   const char* kname = vmSymbols::name_for(vmIntrinsics::class_for(x->id()));
550   if (strchr(name, '_') == NULL) {
551     kname = NULL;
552   } else {

857     output()->print(", ");
858     print_klass(x->known_holder());
859     output()->print(" ");
860   }
861   for (int i = 0; i < x->nb_profiled_args(); i++) {
862     if (i > 0) output()->print(", ");
863     print_value(x->profiled_arg_at(i));
864     if (x->arg_needs_null_check(i)) {
865       output()->print(" [NC]");
866     }
867   }
868   output()->put(')');
869 }
870 
871 void InstructionPrinter::do_ProfileReturnType(ProfileReturnType* x) {
872   output()->print("profile ret type ");
873   print_value(x->ret());
874   output()->print(" %s.%s", x->method()->holder()->name()->as_utf8(), x->method()->name()->as_utf8());
875   output()->put(')');
876 }
877 
878 void InstructionPrinter::do_ProfileInvoke(ProfileInvoke* x) {
879   output()->print("profile_invoke ");
880   output()->print(" %s.%s", x->inlinee()->holder()->name()->as_utf8(), x->inlinee()->name()->as_utf8());
881   output()->put(')');
882 
883 }
884 
885 void InstructionPrinter::do_ProfileACmpTypes(ProfileACmpTypes* x) {
886   output()->print("profile acmp types ");
887   print_value(x->left());
888   output()->print(", ");
889   print_value(x->right());
890 }
891 
892 void InstructionPrinter::do_RuntimeCall(RuntimeCall* x) {
893   output()->print("call_rt %s(", x->entry_name());
894   for (int i = 0; i < x->number_of_arguments(); i++) {
895     if (i > 0) output()->print(", ");
896     print_value(x->argument_at(i));
897   }
898   output()->put(')');
899 }
900 
901 void InstructionPrinter::do_MemBar(MemBar* x) {
902   LIR_Code code = x->code();
903   switch (code) {
904   case lir_membar_acquire   : output()->print("membar_acquire"); break;
905   case lir_membar_release   : output()->print("membar_release"); break;
906   case lir_membar           : output()->print("membar"); break;
907   case lir_membar_loadload  : output()->print("membar_loadload"); break;
908   case lir_membar_storestore: output()->print("membar_storestore"); break;
909   case lir_membar_loadstore : output()->print("membar_loadstore"); break;
910   case lir_membar_storeload : output()->print("membar_storeload"); break;
911   default                   : ShouldNotReachHere(); break;
< prev index next >