3814 }
3815 }
3816
3817 void Compile::print_inlining_update_delayed(CallGenerator* cg) {
3818 if (print_inlining()) {
3819 assert(_print_inlining_stream->size() > 0, "missing inlining msg");
3820 assert(print_inlining_current().cg() == cg, "wrong entry");
3821 // replace message with new message
3822 _print_inlining_list->at_put(_print_inlining_idx, PrintInliningBuffer());
3823 print_inlining_commit();
3824 print_inlining_current().set_cg(cg);
3825 }
3826 }
3827
3828 void Compile::print_inlining_assert_ready() {
3829 assert(!_print_inlining || _print_inlining_stream->size() == 0, "loosing data");
3830 }
3831
3832 void Compile::dump_inlining() {
3833 bool do_print_inlining = print_inlining() || print_intrinsics();
3834 if (do_print_inlining) {
3835 // Print inlining message for candidates that we couldn't inline
3836 // for lack of space
3837 for (int i = 0; i < _late_inlines.length(); i++) {
3838 CallGenerator* cg = _late_inlines.at(i);
3839 if (!cg->is_mh_late_inline()) {
3840 const char* msg = "live nodes > LiveNodeCountInliningCutoff";
3841 if (do_print_inlining) {
3842 cg->print_inlining_late(msg);
3843 }
3844 }
3845 }
3846 }
3847 if (do_print_inlining) {
3848 for (int i = 0; i < _print_inlining_list->length(); i++) {
3849 tty->print(_print_inlining_list->adr_at(i)->ss()->as_string());
3850 }
3851 }
3852 }
3853
3854 // Dump inlining replay data to the stream.
3855 // Don't change thread state and acquire any locks.
3856 void Compile::dump_inline_data(outputStream* out) {
3857 InlineTree* inl_tree = ilt();
3858 if (inl_tree != NULL) {
3859 out->print(" inline %d", inl_tree->count());
3860 inl_tree->dump_replay_data(out);
3861 }
3862 }
3863
3864 int Compile::cmp_expensive_nodes(Node* n1, Node* n2) {
3865 if (n1->Opcode() < n2->Opcode()) return -1;
3866 else if (n1->Opcode() > n2->Opcode()) return 1;
3867
3868 assert(n1->req() == n2->req(), err_msg_res("can't compare %s nodes: n1->req() = %d, n2->req() = %d", NodeClassNames[n1->Opcode()], n1->req(), n2->req()));
3869 for (uint i = 1; i < n1->req(); i++) {
3870 if (n1->in(i) < n2->in(i)) return -1;
3871 else if (n1->in(i) > n2->in(i)) return 1;
3872 }
|
3814 }
3815 }
3816
3817 void Compile::print_inlining_update_delayed(CallGenerator* cg) {
3818 if (print_inlining()) {
3819 assert(_print_inlining_stream->size() > 0, "missing inlining msg");
3820 assert(print_inlining_current().cg() == cg, "wrong entry");
3821 // replace message with new message
3822 _print_inlining_list->at_put(_print_inlining_idx, PrintInliningBuffer());
3823 print_inlining_commit();
3824 print_inlining_current().set_cg(cg);
3825 }
3826 }
3827
3828 void Compile::print_inlining_assert_ready() {
3829 assert(!_print_inlining || _print_inlining_stream->size() == 0, "loosing data");
3830 }
3831
3832 void Compile::dump_inlining() {
3833 bool do_print_inlining = print_inlining() || print_intrinsics();
3834 if (do_print_inlining || log() != NULL) {
3835 // Print inlining message for candidates that we couldn't inline
3836 // for lack of space
3837 for (int i = 0; i < _late_inlines.length(); i++) {
3838 CallGenerator* cg = _late_inlines.at(i);
3839 if (!cg->is_mh_late_inline()) {
3840 const char* msg = "live nodes > LiveNodeCountInliningCutoff";
3841 if (do_print_inlining) {
3842 cg->print_inlining_late(msg);
3843 }
3844 log_late_inline_failure(cg, msg);
3845 }
3846 }
3847 }
3848 if (do_print_inlining) {
3849 for (int i = 0; i < _print_inlining_list->length(); i++) {
3850 tty->print(_print_inlining_list->adr_at(i)->ss()->as_string());
3851 }
3852 }
3853 }
3854
3855 void Compile::log_late_inline(CallGenerator* cg) {
3856 if (log() != NULL) {
3857 log()->head("late_inline method='%d' inline_id='" JLONG_FORMAT "'", log()->identify(cg->method()),
3858 (jlong)cg);
3859 JVMState* p = cg->call_node()->jvms();
3860 while (p != NULL) {
3861 log()->elem("jvms bci='%d' method='%d'", p->bci(), log()->identify(p->method()));
3862 p = p->caller();
3863 }
3864 log()->tail("late_inline");
3865 }
3866 }
3867
3868 void Compile::log_late_inline_failure(CallGenerator* cg, const char* msg) {
3869 log_late_inline(cg);
3870 if (log() != NULL) {
3871 log()->inline_fail(msg);
3872 }
3873 }
3874
3875 void Compile::log_inline_id(jlong id) {
3876 if (log() != NULL) {
3877 // The LogCompilation tool needs a unique way to identify late
3878 // inline call sites.
3879 log()->elem("inline_id id='" JLONG_FORMAT "'", id);
3880 }
3881 }
3882
3883 void Compile::log_inline_failure(const char* msg) {
3884 if (C->log() != NULL) {
3885 C->log()->inline_fail(msg);
3886 }
3887 }
3888
3889
3890 // Dump inlining replay data to the stream.
3891 // Don't change thread state and acquire any locks.
3892 void Compile::dump_inline_data(outputStream* out) {
3893 InlineTree* inl_tree = ilt();
3894 if (inl_tree != NULL) {
3895 out->print(" inline %d", inl_tree->count());
3896 inl_tree->dump_replay_data(out);
3897 }
3898 }
3899
3900 int Compile::cmp_expensive_nodes(Node* n1, Node* n2) {
3901 if (n1->Opcode() < n2->Opcode()) return -1;
3902 else if (n1->Opcode() > n2->Opcode()) return 1;
3903
3904 assert(n1->req() == n2->req(), err_msg_res("can't compare %s nodes: n1->req() = %d, n2->req() = %d", NodeClassNames[n1->Opcode()], n1->req(), n2->req()));
3905 for (uint i = 1; i < n1->req(); i++) {
3906 if (n1->in(i) < n2->in(i)) return -1;
3907 else if (n1->in(i) > n2->in(i)) return 1;
3908 }
|