src/hotspot/share/jfr/writers/jfrWriterHost.inline.hpp
changeset 53897 0abec72a3ac2
parent 53244 9807daeb47c4
child 57360 5d043a159d5c
equal deleted inserted replaced
53896:b47fd614c75e 53897:0abec72a3ac2
   194   be_write(*(u4*)&(value));
   194   be_write(*(u4*)&(value));
   195 }
   195 }
   196 
   196 
   197 template <typename BE, typename IE, typename WriterPolicyImpl>
   197 template <typename BE, typename IE, typename WriterPolicyImpl>
   198 inline void WriterHost<BE, IE, WriterPolicyImpl>::write(double value) {
   198 inline void WriterHost<BE, IE, WriterPolicyImpl>::write(double value) {
   199   be_write(*(uintptr_t*)&(value));
   199   be_write(*(u8*)&(value));
   200 }
   200 }
   201 
   201 
   202 template <typename BE, typename IE, typename WriterPolicyImpl>
   202 template <typename BE, typename IE, typename WriterPolicyImpl>
   203 inline void WriterHost<BE, IE, WriterPolicyImpl>::write(const char* value) {
   203 inline void WriterHost<BE, IE, WriterPolicyImpl>::write(const char* value) {
   204   // UTF-8, max_jint len
   204   // UTF-8, max_jint len
   315     be_write(value, len);
   315     be_write(value, len);
   316   }
   316   }
   317 }
   317 }
   318 
   318 
   319 template <typename BE, typename IE, typename WriterPolicyImpl>
   319 template <typename BE, typename IE, typename WriterPolicyImpl>
   320 inline intptr_t WriterHost<BE, IE, WriterPolicyImpl>::reserve(size_t size) {
   320 inline int64_t WriterHost<BE, IE, WriterPolicyImpl>::reserve(size_t size) {
   321   if (ensure_size(size) != NULL) {
   321   if (ensure_size(size) != NULL) {
   322     intptr_t reserved_offset = this->current_offset();
   322     const int64_t reserved_offset = this->current_offset();
   323     this->set_current_pos(size);
   323     this->set_current_pos(size);
   324     return reserved_offset;
   324     return reserved_offset;
   325   }
   325   }
   326   this->cancel();
   326   this->cancel();
   327   return 0;
   327   return 0;
   328 }
   328 }
   329 
   329 
   330 template <typename BE, typename IE, typename WriterPolicyImpl>
   330 template <typename BE, typename IE, typename WriterPolicyImpl>
   331 template <typename T>
   331 template <typename T>
   332 inline void WriterHost<BE, IE, WriterPolicyImpl>::write_padded_at_offset(T value, intptr_t offset) {
   332 inline void WriterHost<BE, IE, WriterPolicyImpl>::write_padded_at_offset(T value, int64_t offset) {
   333   if (this->is_valid()) {
   333   if (this->is_valid()) {
   334     const intptr_t current = this->current_offset();
   334     const int64_t current = this->current_offset();
   335     this->seek(offset);
   335     this->seek(offset);
   336     write_padded(value);
   336     write_padded(value);
   337     this->seek(current); // restore
   337     this->seek(current); // restore
   338   }
   338   }
   339 }
   339 }
   340 
   340 
   341 template <typename BE, typename IE, typename WriterPolicyImpl>
   341 template <typename BE, typename IE, typename WriterPolicyImpl>
   342 template <typename T>
   342 template <typename T>
   343 inline void WriterHost<BE, IE, WriterPolicyImpl>::write_at_offset(T value, intptr_t offset) {
   343 inline void WriterHost<BE, IE, WriterPolicyImpl>::write_at_offset(T value, int64_t offset) {
   344   if (this->is_valid()) {
   344   if (this->is_valid()) {
   345     const intptr_t current = this->current_offset();
   345     const int64_t current = this->current_offset();
   346     this->seek(offset);
   346     this->seek(offset);
   347     write(value);
   347     write(value);
   348     this->seek(current); // restore
   348     this->seek(current); // restore
   349   }
   349   }
   350 }
   350 }
   351 
   351 
   352 template <typename BE, typename IE, typename WriterPolicyImpl>
   352 template <typename BE, typename IE, typename WriterPolicyImpl>
   353 template <typename T>
   353 template <typename T>
   354 inline void WriterHost<BE, IE, WriterPolicyImpl>::write_be_at_offset(T value, intptr_t offset) {
   354 inline void WriterHost<BE, IE, WriterPolicyImpl>::write_be_at_offset(T value, int64_t offset) {
   355   if (this->is_valid()) {
   355   if (this->is_valid()) {
   356     const intptr_t current = this->current_offset();
   356     const int64_t current = this->current_offset();
   357     this->seek(offset);
   357     this->seek(offset);
   358     be_write(value);
   358     be_write(value);
   359     this->seek(current); // restore
   359     this->seek(current); // restore
   360   }
   360   }
   361 }
   361 }