< prev index next >

src/hotspot/share/runtime/sharedRuntime.cpp

Print this page

2792 
2793 void AdapterHandlerEntry::relocate(address new_base) {
2794   address old_base = base_address();
2795   assert(old_base != NULL, "");
2796   ptrdiff_t delta = new_base - old_base;
2797   if (_i2c_entry != NULL)
2798     _i2c_entry += delta;
2799   if (_c2i_entry != NULL)
2800     _c2i_entry += delta;
2801   if (_c2i_unverified_entry != NULL)
2802     _c2i_unverified_entry += delta;
2803   if (_c2i_no_clinit_check_entry != NULL)
2804     _c2i_no_clinit_check_entry += delta;
2805   assert(base_address() == new_base, "");
2806 }
2807 
2808 
2809 void AdapterHandlerEntry::deallocate() {
2810   delete _fingerprint;
2811 #ifdef ASSERT
2812   if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code);
2813 #endif
2814 }
2815 
2816 
2817 #ifdef ASSERT
2818 // Capture the code before relocation so that it can be compared
2819 // against other versions.  If the code is captured after relocation
2820 // then relative instructions won't be equivalent.
2821 void AdapterHandlerEntry::save_code(unsigned char* buffer, int length) {
2822   _saved_code = NEW_C_HEAP_ARRAY(unsigned char, length, mtCode);
2823   _saved_code_length = length;
2824   memcpy(_saved_code, buffer, length);
2825 }
2826 
2827 
2828 bool AdapterHandlerEntry::compare_code(unsigned char* buffer, int length) {
2829   if (length != _saved_code_length) {
2830     return false;
2831   }
2832 

2792 
2793 void AdapterHandlerEntry::relocate(address new_base) {
2794   address old_base = base_address();
2795   assert(old_base != NULL, "");
2796   ptrdiff_t delta = new_base - old_base;
2797   if (_i2c_entry != NULL)
2798     _i2c_entry += delta;
2799   if (_c2i_entry != NULL)
2800     _c2i_entry += delta;
2801   if (_c2i_unverified_entry != NULL)
2802     _c2i_unverified_entry += delta;
2803   if (_c2i_no_clinit_check_entry != NULL)
2804     _c2i_no_clinit_check_entry += delta;
2805   assert(base_address() == new_base, "");
2806 }
2807 
2808 
2809 void AdapterHandlerEntry::deallocate() {
2810   delete _fingerprint;
2811 #ifdef ASSERT
2812   FREE_C_HEAP_ARRAY(unsigned char, _saved_code);
2813 #endif
2814 }
2815 
2816 
2817 #ifdef ASSERT
2818 // Capture the code before relocation so that it can be compared
2819 // against other versions.  If the code is captured after relocation
2820 // then relative instructions won't be equivalent.
2821 void AdapterHandlerEntry::save_code(unsigned char* buffer, int length) {
2822   _saved_code = NEW_C_HEAP_ARRAY(unsigned char, length, mtCode);
2823   _saved_code_length = length;
2824   memcpy(_saved_code, buffer, length);
2825 }
2826 
2827 
2828 bool AdapterHandlerEntry::compare_code(unsigned char* buffer, int length) {
2829   if (length != _saved_code_length) {
2830     return false;
2831   }
2832 
< prev index next >