comparison src/share/vm/compiler/abstractCompiler.hpp @ 7154:5d0bb7d52783

changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
author Doug Simon <doug.simon@oracle.com>
date Wed, 12 Dec 2012 21:36:40 +0100
parents 6a8b22829e36
children 140d4d4ab3b9
comparison
equal deleted inserted replaced
7153:c421c19b7bf8 7154:5d0bb7d52783
35 35
36 protected: 36 protected:
37 // Used for tracking global state of compiler runtime initialization 37 // Used for tracking global state of compiler runtime initialization
38 enum { uninitialized, initializing, initialized }; 38 enum { uninitialized, initializing, initialized };
39 39
40 // The (closed set) of concrete compiler classes. Using an tag like this
41 // avoids a confusing use of macros around the definition of the
42 // 'is_<compiler type>' methods.
43 enum Type { c1, c2, shark, graal };
44
40 // This method will call the initialization method "f" once (per compiler class/subclass) 45 // This method will call the initialization method "f" once (per compiler class/subclass)
41 // and do so without holding any locks 46 // and do so without holding any locks
42 void initialize_runtimes(initializer f, volatile int* state); 47 void initialize_runtimes(initializer f, volatile int* state);
43 48
49 private:
50 Type _type;
51
44 public: 52 public:
45 AbstractCompiler() : _is_initialized(false) {} 53 AbstractCompiler(Type type) : _is_initialized(false), _type(type) {}
46 54
47 // Name of this compiler 55 // Name of this compiler
48 virtual const char* name() = 0; 56 virtual const char* name() = 0;
49 57
50 // Should a native wrapper be generated by the runtime. This method 58 // Should a native wrapper be generated by the runtime. This method
51 // does *not* answer the question "can this compiler generate code for 59 // does *not* answer the question "can this compiler generate code for
52 // a native method". 60 // a native method".
53 virtual bool supports_native() { return true; } 61 virtual bool supports_native() { return true; }
54 62
55 virtual bool supports_osr () { return true; } 63 virtual bool supports_osr () { return true; }
56 #if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) && !defined(GRAAL)) 64 bool is_c1 () { return _type == c1; }
57 virtual bool is_c1 () { return false; } 65 bool is_c2 () { return _type == c2; }
58 virtual bool is_c2 () { return false; } 66 bool is_shark() { return _type == shark; }
59 virtual bool is_shark() { return false; } 67 bool is_graal() { return _type == graal; }
60 virtual bool is_graal() { return false; }
61 #else
62 #ifdef COMPILER1
63 bool is_c1 () { return true; }
64 bool is_c2 () { return false; }
65 bool is_shark() { return false; }
66 bool is_graal() { return false; }
67 #endif // COMPILER1
68 #ifdef COMPILER2
69 bool is_c1 () { return false; }
70 bool is_c2 () { return true; }
71 bool is_shark() { return false; }
72 bool is_graal() { return false; }
73 #endif // COMPILER2
74 #ifdef SHARK
75 bool is_c1 () { return false; }
76 bool is_c2 () { return false; }
77 bool is_shark() { return true; }
78 bool is_graal() { return false; }
79 #endif // SHARK
80 #ifdef GRAAL
81 bool is_c1 () { return false; }
82 bool is_c2 () { return false; }
83 bool is_shark() { return false; }
84 bool is_graal() { return true; }
85 #endif // GRAAL
86 #endif // TIERED
87 68
88 void mark_initialized() { _is_initialized = true; } 69 void mark_initialized() { _is_initialized = true; }
89 bool is_initialized() { return _is_initialized; } 70 bool is_initialized() { return _is_initialized; }
90 71
91 virtual void initialize() = 0; 72 virtual void initialize() = 0;