src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp
changeset 50714 2230bb152a9f
parent 50429 83aec1d357d4
child 54964 ec7d6d8effc7
child 57360 5d043a159d5c
equal deleted inserted replaced
50713:9894c4d30168 50714:2230bb152a9f
   149   size_t _strings_processed;
   149   size_t _strings_processed;
   150  public:
   150  public:
   151   StringPoolWriteOp(JfrChunkWriter& writer, Thread* thread) : _writer(writer), _thread(thread), _strings_processed(0) {}
   151   StringPoolWriteOp(JfrChunkWriter& writer, Thread* thread) : _writer(writer), _thread(thread), _strings_processed(0) {}
   152   bool write(Type* buffer, const u1* data, size_t size) {
   152   bool write(Type* buffer, const u1* data, size_t size) {
   153     buffer->acquire(_thread); // blocking
   153     buffer->acquire(_thread); // blocking
   154     const u4 nof_strings_used = (const u4)buffer->string_count();
   154     const uint64_t nof_strings_used = buffer->string_count();
   155     assert(nof_strings_used > 0, "invariant");
   155     assert(nof_strings_used > 0, "invariant");
   156     buffer->set_string_top(buffer->string_top() + nof_strings_used);
   156     buffer->set_string_top(buffer->string_top() + nof_strings_used);
   157     // "size processed" for string pool buffers is the number of processed string elements
   157     // "size processed" for string pool buffers is the number of processed string elements
   158     _strings_processed += nof_strings_used;
   158     _strings_processed += nof_strings_used;
   159     const bool ret = _writer.write(buffer, data, size);
   159     const bool ret = _writer.write(buffer, data, size);
   206       assert(buffer->string_count() == 0, "invariant");
   206       assert(buffer->string_count() == 0, "invariant");
   207       buffer->release();
   207       buffer->release();
   208       return true;
   208       return true;
   209     }
   209     }
   210     buffer->set_top(current_top + unflushed_size);
   210     buffer->set_top(current_top + unflushed_size);
   211     const u4 nof_strings_used = buffer->string_count();
   211     const uint64_t nof_strings_used = buffer->string_count();
   212     buffer->set_string_top(buffer->string_top() + nof_strings_used);
   212     buffer->set_string_top(buffer->string_top() + nof_strings_used);
   213     // "size processed" for string pool buffers is the number of string elements
   213     // "size processed" for string pool buffers is the number of string elements
   214     _processed += nof_strings_used;
   214     _processed += (size_t)nof_strings_used;
   215     buffer->release();
   215     buffer->release();
   216     return true;
   216     return true;
   217   }
   217   }
   218   size_t processed() const { return _processed; }
   218   size_t processed() const { return _processed; }
   219 };
   219 };