src/share/vm/compiler/abstractCompiler.hpp

Thu, 10 Oct 2013 15:44:12 +0200

author
anoll
date
Thu, 10 Oct 2013 15:44:12 +0200
changeset 5919
469216acdb28
parent 4444
606eada1bf86
child 6198
55fb97c4c58d
permissions
-rw-r--r--

8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
Summary: Ensure ensure correct initialization of compiler runtime
Reviewed-by: kvn, twisti

duke@435 1 /*
mikael@4153 2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP
stefank@2314 26 #define SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP
stefank@2314 27
stefank@2314 28 #include "ci/compilerInterface.hpp"
stefank@2314 29
zgu@3900 30 class AbstractCompiler : public CHeapObj<mtCompiler> {
duke@435 31 private:
anoll@5919 32 volatile int _num_compiler_threads;
duke@435 33
duke@435 34 protected:
anoll@5919 35 volatile int _compiler_state;
duke@435 36 // Used for tracking global state of compiler runtime initialization
anoll@5919 37 enum { uninitialized, initializing, initialized, failed, shut_down };
duke@435 38
anoll@5919 39 // This method returns true for the first compiler thread that reaches that methods.
anoll@5919 40 // This thread will initialize the compiler runtime.
anoll@5919 41 bool should_perform_init();
duke@435 42
duke@435 43 public:
anoll@5919 44 AbstractCompiler() : _compiler_state(uninitialized), _num_compiler_threads(0) {}
anoll@5919 45
anoll@5919 46 // This function determines the compiler thread that will perform the
anoll@5919 47 // shutdown of the corresponding compiler runtime.
anoll@5919 48 bool should_perform_shutdown();
duke@435 49
duke@435 50 // Name of this compiler
duke@435 51 virtual const char* name() = 0;
duke@435 52
duke@435 53 // Missing feature tests
duke@435 54 virtual bool supports_native() { return true; }
duke@435 55 virtual bool supports_osr () { return true; }
twisti@4444 56 virtual bool can_compile_method(methodHandle method) { return true; }
twisti@2047 57 #if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK))
duke@435 58 virtual bool is_c1 () { return false; }
duke@435 59 virtual bool is_c2 () { return false; }
twisti@2047 60 virtual bool is_shark() { return false; }
duke@435 61 #else
duke@435 62 #ifdef COMPILER1
duke@435 63 bool is_c1 () { return true; }
duke@435 64 bool is_c2 () { return false; }
twisti@2047 65 bool is_shark() { return false; }
duke@435 66 #endif // COMPILER1
duke@435 67 #ifdef COMPILER2
duke@435 68 bool is_c1 () { return false; }
duke@435 69 bool is_c2 () { return true; }
twisti@2047 70 bool is_shark() { return false; }
duke@435 71 #endif // COMPILER2
twisti@2047 72 #ifdef SHARK
twisti@2047 73 bool is_c1 () { return false; }
twisti@2047 74 bool is_c2 () { return false; }
twisti@2047 75 bool is_shark() { return true; }
twisti@2047 76 #endif // SHARK
duke@435 77 #endif // TIERED
duke@435 78
duke@435 79 // Customization
anoll@5919 80 virtual void initialize () = 0;
duke@435 81
anoll@5919 82 void set_num_compiler_threads(int num) { _num_compiler_threads = num; }
anoll@5919 83 int num_compiler_threads() { return _num_compiler_threads; }
duke@435 84
anoll@5919 85 // Get/set state of compiler objects
anoll@5919 86 bool is_initialized() { return _compiler_state == initialized; }
anoll@5919 87 bool is_failed () { return _compiler_state == failed;}
anoll@5919 88 void set_state (int state);
anoll@5919 89 void set_shut_down () { set_state(shut_down); }
duke@435 90 // Compilation entry point for methods
anoll@5919 91 virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
duke@435 92 ShouldNotReachHere();
duke@435 93 }
duke@435 94
duke@435 95
duke@435 96 // Print compilation timers and statistics
duke@435 97 virtual void print_timers() {
duke@435 98 ShouldNotReachHere();
duke@435 99 }
duke@435 100 };
stefank@2314 101
stefank@2314 102 #endif // SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP

mercurial