< prev index next >

src/hotspot/share/c1/c1_InstructionPrinter.cpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2017, 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 "c1/c1_InstructionPrinter.hpp"
  27 #include "c1/c1_ValueStack.hpp"
  28 #include "ci/ciArray.hpp"
  29 #include "ci/ciInstance.hpp"
  30 #include "ci/ciObject.hpp"

  31 
  32 
  33 #ifndef PRODUCT
  34 
  35 const char* InstructionPrinter::basic_type_name(BasicType type) {
  36   switch (type) {
  37     case T_BOOLEAN: return "boolean";
  38     case T_BYTE   : return "byte";
  39     case T_CHAR   : return "char";
  40     case T_SHORT  : return "short";
  41     case T_INT    : return "int";
  42     case T_LONG   : return "long";
  43     case T_FLOAT  : return "float";
  44     case T_DOUBLE : return "double";
  45     case T_ARRAY  : return "array";
  46     case T_OBJECT : return "object";

  47     default       : return "???";
  48   }
  49 }
  50 
  51 
  52 const char* InstructionPrinter::cond_name(If::Condition cond) {
  53   switch (cond) {
  54     case If::eql: return "==";
  55     case If::neq: return "!=";
  56     case If::lss: return "<";
  57     case If::leq: return "<=";
  58     case If::gtr: return ">";
  59     case If::geq: return ">=";
  60     case If::aeq: return "|>=|";
  61     case If::beq: return "|<=|";
  62     default:
  63       ShouldNotReachHere();
  64       return NULL;
  65   }
  66 }


 499   fill_to(instr_pos);
 500   output()->print("%s.%s%s",
 501              x->target()->holder()->name()->as_utf8(),
 502              x->target()->name()->as_utf8(),
 503              x->target()->signature()->as_symbol()->as_utf8());
 504 }
 505 
 506 
 507 void InstructionPrinter::do_NewInstance(NewInstance* x) {
 508   output()->print("new instance ");
 509   print_klass(x->klass());
 510 }
 511 
 512 
 513 void InstructionPrinter::do_NewTypeArray(NewTypeArray* x) {
 514   output()->print("new %s array [", basic_type_name(x->elt_type()));
 515   print_value(x->length());
 516   output()->put(']');
 517 }
 518 







 519 
 520 void InstructionPrinter::do_NewObjectArray(NewObjectArray* x) {
 521   output()->print("new object array [");
 522   print_value(x->length());
 523   output()->print("] ");
 524   print_klass(x->klass());
 525 }
 526 
 527 
 528 void InstructionPrinter::do_NewMultiArray(NewMultiArray* x) {
 529   output()->print("new multi array [");
 530   Values* dims = x->dims();
 531   for (int i = 0; i < dims->length(); i++) {
 532     if (i > 0) output()->print(", ");
 533     print_value(dims->at(i));
 534   }
 535   output()->print("] ");
 536   print_klass(x->klass());








 537 }
 538 
 539 
 540 void InstructionPrinter::do_MonitorEnter(MonitorEnter* x) {
 541   output()->print("enter ");
 542   print_monitor(x);
 543 }
 544 
 545 
 546 void InstructionPrinter::do_MonitorExit(MonitorExit* x) {
 547   output()->print("exit ");
 548   print_monitor(x);
 549 }
 550 
 551 
 552 void InstructionPrinter::do_Intrinsic(Intrinsic* x) {
 553   const char* name = vmIntrinsics::name_at(x->id());
 554   if (name[0] == '_')  name++;  // strip leading bug from _hashCode, etc.
 555   const char* kname = vmSymbols::name_for(vmIntrinsics::class_for(x->id()));
 556   if (strchr(name, '_') == NULL) {


   1 /*
   2  * Copyright (c) 1999, 2019, 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 "c1/c1_InstructionPrinter.hpp"
  27 #include "c1/c1_ValueStack.hpp"
  28 #include "ci/ciArray.hpp"
  29 #include "ci/ciInstance.hpp"
  30 #include "ci/ciObject.hpp"
  31 #include "ci/ciValueKlass.hpp"
  32 
  33 
  34 #ifndef PRODUCT
  35 
  36 const char* InstructionPrinter::basic_type_name(BasicType type) {
  37   switch (type) {
  38     case T_BOOLEAN: return "boolean";
  39     case T_BYTE   : return "byte";
  40     case T_CHAR   : return "char";
  41     case T_SHORT  : return "short";
  42     case T_INT    : return "int";
  43     case T_LONG   : return "long";
  44     case T_FLOAT  : return "float";
  45     case T_DOUBLE : return "double";
  46     case T_ARRAY  : return "array";
  47     case T_OBJECT : return "object";
  48     case T_VALUETYPE : return "value type";
  49     default       : return "???";
  50   }
  51 }
  52 
  53 
  54 const char* InstructionPrinter::cond_name(If::Condition cond) {
  55   switch (cond) {
  56     case If::eql: return "==";
  57     case If::neq: return "!=";
  58     case If::lss: return "<";
  59     case If::leq: return "<=";
  60     case If::gtr: return ">";
  61     case If::geq: return ">=";
  62     case If::aeq: return "|>=|";
  63     case If::beq: return "|<=|";
  64     default:
  65       ShouldNotReachHere();
  66       return NULL;
  67   }
  68 }


 501   fill_to(instr_pos);
 502   output()->print("%s.%s%s",
 503              x->target()->holder()->name()->as_utf8(),
 504              x->target()->name()->as_utf8(),
 505              x->target()->signature()->as_symbol()->as_utf8());
 506 }
 507 
 508 
 509 void InstructionPrinter::do_NewInstance(NewInstance* x) {
 510   output()->print("new instance ");
 511   print_klass(x->klass());
 512 }
 513 
 514 
 515 void InstructionPrinter::do_NewTypeArray(NewTypeArray* x) {
 516   output()->print("new %s array [", basic_type_name(x->elt_type()));
 517   print_value(x->length());
 518   output()->put(']');
 519 }
 520 
 521 void InstructionPrinter::do_NewValueTypeInstance(NewValueTypeInstance* x) {
 522   output()->print("new value type instance ");
 523   if (x->is_optimizable_for_withfield()) {
 524     output()->print("(optimizable) ");
 525   }
 526   print_klass(x->klass());
 527 }
 528 
 529 void InstructionPrinter::do_NewObjectArray(NewObjectArray* x) {
 530   output()->print("new object array [");
 531   print_value(x->length());
 532   output()->print("] ");
 533   print_klass(x->klass());
 534 }
 535 
 536 
 537 void InstructionPrinter::do_NewMultiArray(NewMultiArray* x) {
 538   output()->print("new multi array [");
 539   Values* dims = x->dims();
 540   for (int i = 0; i < dims->length(); i++) {
 541     if (i > 0) output()->print(", ");
 542     print_value(dims->at(i));
 543   }
 544   output()->print("] ");
 545   print_klass(x->klass());
 546 }
 547 
 548 void InstructionPrinter::do_WithField(WithField* x) {
 549   output()->print("withfield");
 550 }
 551 
 552 void InstructionPrinter::do_DefaultValue(DefaultValue* x) {
 553   output()->print("defaultvalue");
 554 }
 555 
 556 
 557 void InstructionPrinter::do_MonitorEnter(MonitorEnter* x) {
 558   output()->print("enter ");
 559   print_monitor(x);
 560 }
 561 
 562 
 563 void InstructionPrinter::do_MonitorExit(MonitorExit* x) {
 564   output()->print("exit ");
 565   print_monitor(x);
 566 }
 567 
 568 
 569 void InstructionPrinter::do_Intrinsic(Intrinsic* x) {
 570   const char* name = vmIntrinsics::name_at(x->id());
 571   if (name[0] == '_')  name++;  // strip leading bug from _hashCode, etc.
 572   const char* kname = vmSymbols::name_for(vmIntrinsics::class_for(x->id()));
 573   if (strchr(name, '_') == NULL) {


< prev index next >