hotspot/src/share/vm/code/codeBlob.hpp
changeset 42040 70ec5a09a0d5
parent 38133 78b95467b9f1
child 42064 a530dbabe64f
--- a/hotspot/src/share/vm/code/codeBlob.hpp	Fri Oct 21 10:16:09 2016 -0700
+++ b/hotspot/src/share/vm/code/codeBlob.hpp	Fri Oct 21 20:12:47 2016 +0200
@@ -26,6 +26,7 @@
 #define SHARE_VM_CODE_CODEBLOB_HPP
 
 #include "asm/codeBuffer.hpp"
+#include "compiler/compilerDefinitions.hpp"
 #include "compiler/oopMap.hpp"
 #include "runtime/frame.hpp"
 #include "runtime/handles.hpp"
@@ -71,7 +72,8 @@
   friend class CodeCacheDumper;
 
 protected:
-  const char* _name;
+
+  const CompilerType _type;                      // CompilerType
   int        _size;                              // total size of CodeBlob in bytes
   int        _header_size;                       // size of header (depends on subclass)
   int        _frame_complete_offset;             // instruction offsets in [0.._frame_complete_offset) have
@@ -92,9 +94,10 @@
   ImmutableOopMapSet* _oop_maps;                 // OopMap for this CodeBlob
   bool                _caller_must_gc_arguments;
   CodeStrings         _strings;
+  const char*         _name;
 
-  CodeBlob(const char* name, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments);
-  CodeBlob(const char* name, const CodeBlobLayout& layout, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments);
+  CodeBlob(const char* name, CompilerType type, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments);
+  CodeBlob(const char* name, CompilerType type, const CodeBlobLayout& layout, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments);
 public:
   // Returns the space needed for CodeBlob
   static unsigned int allocation_size(CodeBuffer* cb, int header_size);
@@ -115,9 +118,11 @@
   virtual bool is_method_handles_adapter_blob() const { return false; }
   virtual bool is_compiled() const                    { return false; }
 
-  virtual bool is_compiled_by_c2() const         { return false; }
-  virtual bool is_compiled_by_c1() const         { return false; }
-  virtual bool is_compiled_by_jvmci() const      { return false; }
+  inline bool is_compiled_by_c1() const    { return _type == compiler_c1; };
+  inline bool is_compiled_by_c2() const    { return _type == compiler_c2; };
+  inline bool is_compiled_by_jvmci() const { return _type == compiler_jvmci; };
+  inline bool is_compiled_by_shark() const { return _type == compiler_shark; };
+  const char* compiler_name() const;
 
   // Casting
   nmethod* as_nmethod_or_null()                { return is_nmethod() ? (nmethod*) this : NULL; }