8183001: Various inlining improvements
authorredestad
Thu, 29 Jun 2017 14:22:42 +0200
changeset 46600 fdde0f192cde
parent 46589 f1c04490ded1
child 46601 08d85966596b
8183001: Various inlining improvements Reviewed-by: iklam, mikael, ehelin, stefank
hotspot/src/share/vm/code/compressedStream.cpp
hotspot/src/share/vm/code/compressedStream.hpp
hotspot/src/share/vm/memory/metaspaceShared.cpp
hotspot/src/share/vm/memory/metaspaceShared.hpp
hotspot/src/share/vm/runtime/frame.cpp
hotspot/src/share/vm/runtime/frame.hpp
hotspot/src/share/vm/runtime/frame.inline.hpp
--- a/hotspot/src/share/vm/code/compressedStream.cpp	Wed Jun 28 19:12:58 2017 -0400
+++ b/hotspot/src/share/vm/code/compressedStream.cpp	Thu Jun 29 14:22:42 2017 +0200
@@ -127,41 +127,6 @@
 bool test_compressed_stream_enabled = false;
 #endif
 
-// This encoding, called UNSIGNED5, is taken from J2SE Pack200.
-// It assumes that most values have lots of leading zeroes.
-// Very small values, in the range [0..191], code in one byte.
-// Any 32-bit value (including negatives) can be coded, in
-// up to five bytes.  The grammar is:
-//    low_byte  = [0..191]
-//    high_byte = [192..255]
-//    any_byte  = low_byte | high_byte
-//    coding = low_byte
-//           | high_byte low_byte
-//           | high_byte high_byte low_byte
-//           | high_byte high_byte high_byte low_byte
-//           | high_byte high_byte high_byte high_byte any_byte
-// Each high_byte contributes six bits of payload.
-// The encoding is one-to-one (except for integer overflow)
-// and easy to parse and unparse.
-
-jint CompressedReadStream::read_int_mb(jint b0) {
-  int     pos = position() - 1;
-  u_char* buf = buffer() + pos;
-  assert(buf[0] == b0 && b0 >= L, "correctly called");
-  jint    sum = b0;
-  // must collect more bytes:  b[1]...b[4]
-  int lg_H_i = lg_H;
-  for (int i = 0; ; ) {
-    jint b_i = buf[++i]; // b_i = read(); ++i;
-    sum += b_i << lg_H_i;  // sum += b[i]*(64**i)
-    if (b_i < L || i == MAX_i) {
-      set_position(pos+i+1);
-      return sum;
-    }
-    lg_H_i += lg_H;
-  }
-}
-
 void CompressedWriteStream::write_int_mb(jint value) {
   debug_only(int pos1 = position());
   juint sum = value;
--- a/hotspot/src/share/vm/code/compressedStream.hpp	Wed Jun 28 19:12:58 2017 -0400
+++ b/hotspot/src/share/vm/code/compressedStream.hpp	Thu Jun 29 14:22:42 2017 +0200
@@ -66,7 +66,40 @@
  private:
   inline u_char read()                 { return _buffer[_position++]; }
 
-  jint     read_int_mb(jint b0);  // UNSIGNED5 coding, 2-5 byte cases
+  // This encoding, called UNSIGNED5, is taken from J2SE Pack200.
+  // It assumes that most values have lots of leading zeroes.
+  // Very small values, in the range [0..191], code in one byte.
+  // Any 32-bit value (including negatives) can be coded, in
+  // up to five bytes.  The grammar is:
+  //    low_byte  = [0..191]
+  //    high_byte = [192..255]
+  //    any_byte  = low_byte | high_byte
+  //    coding = low_byte
+  //           | high_byte low_byte
+  //           | high_byte high_byte low_byte
+  //           | high_byte high_byte high_byte low_byte
+  //           | high_byte high_byte high_byte high_byte any_byte
+  // Each high_byte contributes six bits of payload.
+  // The encoding is one-to-one (except for integer overflow)
+  // and easy to parse and unparse.
+
+  jint read_int_mb(jint b0) {
+    int     pos = position() - 1;
+    u_char* buf = buffer() + pos;
+    assert(buf[0] == b0 && b0 >= L, "correctly called");
+    jint    sum = b0;
+    // must collect more bytes:  b[1]...b[4]
+    int lg_H_i = lg_H;
+    for (int i = 0; ; ) {
+      jint b_i = buf[++i]; // b_i = read(); ++i;
+      sum += b_i << lg_H_i;  // sum += b[i]*(64**i)
+      if (b_i < L || i == MAX_i) {
+        set_position(pos+i+1);
+        return sum;
+      }
+      lg_H_i += lg_H;
+    }
+  }
 
  public:
   CompressedReadStream(u_char* buffer, int position = 0)
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Wed Jun 28 19:12:58 2017 -0400
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Thu Jun 29 14:22:42 2017 +0200
@@ -1219,11 +1219,6 @@
   return UseSharedSpaces && FileMapInfo::current_info()->is_in_shared_region(p, idx);
 }
 
-bool MetaspaceShared::is_string_region(int idx) {
-  return (idx >= MetaspaceShared::first_string &&
-          idx < MetaspaceShared::first_string + MetaspaceShared::max_strings);
-}
-
 void MetaspaceShared::print_shared_spaces() {
   if (UseSharedSpaces) {
     FileMapInfo::current_info()->print_shared_spaces();
--- a/hotspot/src/share/vm/memory/metaspaceShared.hpp	Wed Jun 28 19:12:58 2017 -0400
+++ b/hotspot/src/share/vm/memory/metaspaceShared.hpp	Thu Jun 29 14:22:42 2017 +0200
@@ -172,7 +172,10 @@
   // Return true if given address is in the shared region corresponding to the idx
   static bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false);
 
-  static bool is_string_region(int idx) NOT_CDS_RETURN_(false);
+  static bool is_string_region(int idx) {
+      CDS_ONLY(return (idx >= first_string && idx < first_string + max_strings));
+      NOT_CDS(return false);
+  }
 
   static intptr_t* allocate_cpp_vtable_clones(intptr_t* top, intptr_t* end);
   static intptr_t* clone_cpp_vtables(intptr_t* p);
--- a/hotspot/src/share/vm/runtime/frame.cpp	Wed Jun 28 19:12:58 2017 -0400
+++ b/hotspot/src/share/vm/runtime/frame.cpp	Thu Jun 29 14:22:42 2017 +0200
@@ -1074,16 +1074,6 @@
 }
 
 
-oop* frame::oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const {
-  if(reg->is_reg()) {
-    // If it is passed in a register, it got spilled in the stub frame.
-    return (oop *)reg_map->location(reg);
-  } else {
-    int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size;
-    return (oop*)(((address)unextended_sp()) + sp_offset_in_bytes);
-  }
-}
-
 BasicLock* frame::get_native_monitor() {
   nmethod* nm = (nmethod*)_cb;
   assert(_cb != NULL && _cb->is_nmethod() && nm->method()->is_native(),
--- a/hotspot/src/share/vm/runtime/frame.hpp	Wed Jun 28 19:12:58 2017 -0400
+++ b/hotspot/src/share/vm/runtime/frame.hpp	Thu Jun 29 14:22:42 2017 +0200
@@ -387,8 +387,8 @@
   // Add annotated descriptions of memory locations belonging to this frame to values
   void describe(FrameValues& values, int frame_no);
 
-  // Conversion from an VMReg to physical stack location
-  oop* oopmapreg_to_location(VMReg reg, const RegisterMap* regmap) const;
+  // Conversion from a VMReg to physical stack location
+  oop* oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const;
 
   // Oops-do's
   void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f);
--- a/hotspot/src/share/vm/runtime/frame.inline.hpp	Wed Jun 28 19:12:58 2017 -0400
+++ b/hotspot/src/share/vm/runtime/frame.inline.hpp	Thu Jun 29 14:22:42 2017 +0200
@@ -53,4 +53,14 @@
   return is_entry_frame() && entry_frame_is_first();
 }
 
+inline oop* frame::oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const {
+  if(reg->is_reg()) {
+    // If it is passed in a register, it got spilled in the stub frame.
+    return (oop *)reg_map->location(reg);
+  } else {
+    int sp_offset_in_bytes = reg->reg2stack() * VMRegImpl::stack_slot_size;
+    return (oop*)(((address)unextended_sp()) + sp_offset_in_bytes);
+  }
+}
+
 #endif // SHARE_VM_RUNTIME_FRAME_INLINE_HPP