Mercurial > hg > graal-compiler
diff src/share/vm/compiler/abstractCompiler.hpp @ 12880:469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
Summary: Ensure ensure correct initialization of compiler runtime
Reviewed-by: kvn, twisti
author | anoll |
---|---|
date | Thu, 10 Oct 2013 15:44:12 +0200 |
parents | 606eada1bf86 |
children | 096c224171c4 de6a9e811145 |
line wrap: on
line diff
--- a/src/share/vm/compiler/abstractCompiler.hpp Fri Oct 11 10:14:02 2013 -0700 +++ b/src/share/vm/compiler/abstractCompiler.hpp Thu Oct 10 15:44:12 2013 +0200 @@ -27,22 +27,25 @@ #include "ci/compilerInterface.hpp" -typedef void (*initializer)(void); - class AbstractCompiler : public CHeapObj<mtCompiler> { private: - bool _is_initialized; // Mark whether compiler object is initialized + volatile int _num_compiler_threads; protected: + volatile int _compiler_state; // Used for tracking global state of compiler runtime initialization - enum { uninitialized, initializing, initialized }; + enum { uninitialized, initializing, initialized, failed, shut_down }; - // 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), _num_compiler_threads(0) {} + + // This function determines the compiler thread that will perform the + // shutdown of the corresponding compiler runtime. + bool should_perform_shutdown(); // Name of this compiler virtual const char* name() = 0; @@ -74,17 +77,18 @@ #endif // TIERED // Customization - virtual bool needs_stubs () = 0; + virtual void initialize () = 0; - void mark_initialized() { _is_initialized = true; } - bool is_initialized() { return _is_initialized; } + void set_num_compiler_threads(int num) { _num_compiler_threads = num; } + int num_compiler_threads() { return _num_compiler_threads; } - virtual void initialize() = 0; - + // Get/set state of compiler objects + bool is_initialized() { return _compiler_state == initialized; } + bool is_failed () { return _compiler_state == failed;} + void set_state (int state); + void set_shut_down () { set_state(shut_down); } // 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(); }