8214056: Allow the GC to attach context information to CompiledMethod
authoreosterlund
Thu, 22 Nov 2018 09:55:44 +0100
changeset 52660 9cb53c505acd
parent 52659 8b26bd8b1832
child 52661 4f45c682eab0
8214056: Allow the GC to attach context information to CompiledMethod Reviewed-by: shade, kvn, adinn
src/hotspot/share/code/compiledMethod.cpp
src/hotspot/share/code/compiledMethod.hpp
--- a/src/hotspot/share/code/compiledMethod.cpp	Thu Nov 22 09:46:24 2018 +0100
+++ b/src/hotspot/share/code/compiledMethod.cpp	Thu Nov 22 09:55:44 2018 +0100
@@ -44,7 +44,8 @@
                                bool caller_must_gc_arguments)
   : CodeBlob(name, type, layout, frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments),
     _mark_for_deoptimization_status(not_marked),
-    _method(method)
+    _method(method),
+    _gc_data(NULL)
 {
   init_defaults();
 }
@@ -55,7 +56,8 @@
   : CodeBlob(name, type, CodeBlobLayout((address) this, size, header_size, cb), cb,
              frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments),
     _mark_for_deoptimization_status(not_marked),
-    _method(method)
+    _method(method),
+    _gc_data(NULL)
 {
   init_defaults();
 }
--- a/src/hotspot/share/code/compiledMethod.hpp	Thu Nov 22 09:46:24 2018 +0100
+++ b/src/hotspot/share/code/compiledMethod.hpp	Thu Nov 22 09:55:44 2018 +0100
@@ -169,6 +169,8 @@
   PcDescContainer _pc_desc_container;
   ExceptionCache * volatile _exception_cache;
 
+  void* _gc_data;
+
   virtual void flush() = 0;
 protected:
   CompiledMethod(Method* method, const char* name, CompilerType type, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments);
@@ -177,6 +179,11 @@
 public:
   virtual bool is_compiled() const                { return true; }
 
+  template<typename T>
+  T* gc_data() const                              { return reinterpret_cast<T*>(_gc_data); }
+  template<typename T>
+  void set_gc_data(T* gc_data)                    { _gc_data = reinterpret_cast<void*>(gc_data); }
+
   bool  has_unsafe_access() const                 { return _has_unsafe_access; }
   void  set_has_unsafe_access(bool z)             { _has_unsafe_access = z; }