src/share/vm/prims/jvmtiClassFileReconstituter.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8039525 Sdiff src/share/vm/prims

src/share/vm/prims/jvmtiClassFileReconstituter.cpp

Print this page




 764 
 765 address JvmtiClassFileReconstituter::writeable_address(size_t size) {
 766   size_t used_size = _buffer_ptr - _buffer;
 767   if (size + used_size >= _buffer_size) {
 768     // compute the new buffer size: must be at least twice as big as before
 769     // plus whatever new is being used; then convert to nice clean block boundary
 770     size_t new_buffer_size = (size + _buffer_size*2 + 1) / initial_buffer_size
 771                                                          * initial_buffer_size;
 772 
 773     // VM goes belly-up if the memory isn't available, so cannot do OOM processing
 774     _buffer = REALLOC_RESOURCE_ARRAY(u1, _buffer, _buffer_size, new_buffer_size);
 775     _buffer_size = new_buffer_size;
 776     _buffer_ptr = _buffer + used_size;
 777   }
 778   u1* ret_ptr = _buffer_ptr;
 779   _buffer_ptr += size;
 780   return ret_ptr;
 781 }
 782 
 783 void JvmtiClassFileReconstituter::write_attribute_name_index(const char* name) {
 784   TempNewSymbol sym = SymbolTable::probe(name, (int)strlen(name));
 785   assert(sym != NULL, "attribute name symbol not found");
 786   u2 attr_name_index = symbol_to_cpool_index(sym);
 787   assert(attr_name_index != 0, "attribute name symbol not in constant pool");
 788   write_u2(attr_name_index);
 789 }
 790 
 791 void JvmtiClassFileReconstituter::write_u1(u1 x) {
 792   *writeable_address(1) = x;
 793 }
 794 
 795 void JvmtiClassFileReconstituter::write_u2(u2 x) {
 796   Bytes::put_Java_u2(writeable_address(2), x);
 797 }
 798 
 799 void JvmtiClassFileReconstituter::write_u4(u4 x) {
 800   Bytes::put_Java_u4(writeable_address(4), x);
 801 }
 802 
 803 void JvmtiClassFileReconstituter::write_u8(u8 x) {
 804   Bytes::put_Java_u8(writeable_address(8), x);




 764 
 765 address JvmtiClassFileReconstituter::writeable_address(size_t size) {
 766   size_t used_size = _buffer_ptr - _buffer;
 767   if (size + used_size >= _buffer_size) {
 768     // compute the new buffer size: must be at least twice as big as before
 769     // plus whatever new is being used; then convert to nice clean block boundary
 770     size_t new_buffer_size = (size + _buffer_size*2 + 1) / initial_buffer_size
 771                                                          * initial_buffer_size;
 772 
 773     // VM goes belly-up if the memory isn't available, so cannot do OOM processing
 774     _buffer = REALLOC_RESOURCE_ARRAY(u1, _buffer, _buffer_size, new_buffer_size);
 775     _buffer_size = new_buffer_size;
 776     _buffer_ptr = _buffer + used_size;
 777   }
 778   u1* ret_ptr = _buffer_ptr;
 779   _buffer_ptr += size;
 780   return ret_ptr;
 781 }
 782 
 783 void JvmtiClassFileReconstituter::write_attribute_name_index(const char* name) {
 784   TempNewSymbol sym = SymbolTable::lookup_and_ignore_hash(name, (int)strlen(name));
 785   assert(sym != NULL, "attribute name symbol not found");
 786   u2 attr_name_index = symbol_to_cpool_index(sym);
 787   assert(attr_name_index != 0, "attribute name symbol not in constant pool");
 788   write_u2(attr_name_index);
 789 }
 790 
 791 void JvmtiClassFileReconstituter::write_u1(u1 x) {
 792   *writeable_address(1) = x;
 793 }
 794 
 795 void JvmtiClassFileReconstituter::write_u2(u2 x) {
 796   Bytes::put_Java_u2(writeable_address(2), x);
 797 }
 798 
 799 void JvmtiClassFileReconstituter::write_u4(u4 x) {
 800   Bytes::put_Java_u4(writeable_address(4), x);
 801 }
 802 
 803 void JvmtiClassFileReconstituter::write_u8(u8 x) {
 804   Bytes::put_Java_u8(writeable_address(8), x);


src/share/vm/prims/jvmtiClassFileReconstituter.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File