--- old/src/share/vm/compiler/abstractCompiler.hpp 2013-09-26 12:53:13.813847665 +0200 +++ new/src/share/vm/compiler/abstractCompiler.hpp 2013-09-26 12:53:13.761847667 +0200 @@ -27,22 +27,18 @@ #include "ci/compilerInterface.hpp" -typedef void (*initializer)(void); - class AbstractCompiler : public CHeapObj { - private: - bool _is_initialized; // Mark whether compiler object is initialized - protected: + volatile int _compiler_state; // Used for tracking global state of compiler runtime initialization - enum { uninitialized, initializing, initialized }; + enum { uninitialized, initializing, initialized, failed }; - // This method will call the initialization method "f" once (per compiler class/subclass) - // and do so without holding any locks - void initialize_runtimes(initializer f, volatile int* state); + // This method returns true for the first compiler thread that reaches that methods. + // This thread will initialize the compiler runtime. + bool should_perform_init(); public: - AbstractCompiler() : _is_initialized(false) {} + AbstractCompiler() : _compiler_state(uninitialized) {} // Name of this compiler virtual const char* name() = 0; @@ -74,17 +70,14 @@ #endif // TIERED // Customization - virtual bool needs_stubs () = 0; - - void mark_initialized() { _is_initialized = true; } - bool is_initialized() { return _is_initialized; } - - virtual void initialize() = 0; + virtual void initialize () = 0; + // Get/set state of compiler objects + bool is_initialized () { return _compiler_state == initialized; } + bool is_state_failed () { return _compiler_state == failed; } + void set_state (int state); // Compilation entry point for methods - virtual void compile_method(ciEnv* env, - ciMethod* target, - int entry_bci) { + virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci) { ShouldNotReachHere(); }