1 /*
2 * Copyright (c) 1997, 2018, 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 *
3571 }
3572
3573 #endif
3574
3575 // The Compile object keeps track of failure reasons separately from the ciEnv.
3576 // This is required because there is not quite a 1-1 relation between the
3577 // ciEnv and its compilation task and the Compile object. Note that one
3578 // ciEnv might use two Compile objects, if C2Compiler::compile_method decides
3579 // to backtrack and retry without subsuming loads. Other than this backtracking
3580 // behavior, the Compile's failure reason is quietly copied up to the ciEnv
3581 // by the logic in C2Compiler.
3582 void Compile::record_failure(const char* reason) {
3583 if (log() != NULL) {
3584 log()->elem("failure reason='%s' phase='compile'", reason);
3585 }
3586 if (_failure_reason == NULL) {
3587 // Record the first failure reason.
3588 _failure_reason = reason;
3589 }
3590
3591 EventCompilerFailure event;
3592 if (event.should_commit()) {
3593 event.set_compileID(Compile::compile_id());
3594 event.set_failure(reason);
3595 event.commit();
3596 }
3597
3598 if (!C->failure_reason_is(C2Compiler::retry_no_subsuming_loads())) {
3599 C->print_method(PHASE_FAILURE);
3600 }
3601 _root = NULL; // flush the graph, too
3602 }
3603
3604 Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator, bool dolog)
3605 : TraceTime(NULL, accumulator, false NOT_PRODUCT( || TimeCompiler ), false),
3606 _phase_name(name), _dolog(dolog)
3607 {
3608 if (dolog) {
3609 C = Compile::current();
3610 _log = C->log();
3611 } else {
3612 C = NULL;
3613 _log = NULL;
3614 }
|
1 /*
2 * Copyright (c) 1997, 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 *
3571 }
3572
3573 #endif
3574
3575 // The Compile object keeps track of failure reasons separately from the ciEnv.
3576 // This is required because there is not quite a 1-1 relation between the
3577 // ciEnv and its compilation task and the Compile object. Note that one
3578 // ciEnv might use two Compile objects, if C2Compiler::compile_method decides
3579 // to backtrack and retry without subsuming loads. Other than this backtracking
3580 // behavior, the Compile's failure reason is quietly copied up to the ciEnv
3581 // by the logic in C2Compiler.
3582 void Compile::record_failure(const char* reason) {
3583 if (log() != NULL) {
3584 log()->elem("failure reason='%s' phase='compile'", reason);
3585 }
3586 if (_failure_reason == NULL) {
3587 // Record the first failure reason.
3588 _failure_reason = reason;
3589 }
3590
3591 EventCompilationFailure event;
3592 if (event.should_commit()) {
3593 event.set_compileId(Compile::compile_id());
3594 event.set_failureMessage(reason);
3595 event.commit();
3596 }
3597
3598 if (!C->failure_reason_is(C2Compiler::retry_no_subsuming_loads())) {
3599 C->print_method(PHASE_FAILURE);
3600 }
3601 _root = NULL; // flush the graph, too
3602 }
3603
3604 Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator, bool dolog)
3605 : TraceTime(NULL, accumulator, false NOT_PRODUCT( || TimeCompiler ), false),
3606 _phase_name(name), _dolog(dolog)
3607 {
3608 if (dolog) {
3609 C = Compile::current();
3610 _log = C->log();
3611 } else {
3612 C = NULL;
3613 _log = NULL;
3614 }
|