src/share/vm/runtime/sharedRuntime.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 80060074 Sdiff src/share/vm/runtime

src/share/vm/runtime/sharedRuntime.cpp

Print this page




2067       ptr = _value._fingerprint;
2068     }
2069 
2070     // Now pack the BasicTypes with 8 per int
2071     int sig_index = 0;
2072     for (int index = 0; index < len; index++) {
2073       int value = 0;
2074       for (int byte = 0; byte < _basic_types_per_int; byte++) {
2075         int bt = ((sig_index < total_args_passed)
2076                   ? adapter_encoding(sig_bt[sig_index++])
2077                   : 0);
2078         assert((bt & _basic_type_mask) == bt, "must fit in 4 bits");
2079         value = (value << _basic_type_bits) | bt;
2080       }
2081       ptr[index] = value;
2082     }
2083   }
2084 
2085   ~AdapterFingerPrint() {
2086     if (_length > 0) {
2087       FREE_C_HEAP_ARRAY(int, _value._fingerprint, mtCode);
2088     }
2089   }
2090 
2091   int value(int index) {
2092     if (_length < 0) {
2093       return _value._compact[index];
2094     }
2095     return _value._fingerprint[index];
2096   }
2097   int length() {
2098     if (_length < 0) return -_length;
2099     return _length;
2100   }
2101 
2102   bool is_compact() {
2103     return _length <= 0;
2104   }
2105 
2106   unsigned int compute_hash() {
2107     int hash = 0;


2474   return base;
2475 }
2476 
2477 void AdapterHandlerEntry::relocate(address new_base) {
2478   address old_base = base_address();
2479   assert(old_base != NULL, "");
2480   ptrdiff_t delta = new_base - old_base;
2481   if (_i2c_entry != NULL)
2482     _i2c_entry += delta;
2483   if (_c2i_entry != NULL)
2484     _c2i_entry += delta;
2485   if (_c2i_unverified_entry != NULL)
2486     _c2i_unverified_entry += delta;
2487   assert(base_address() == new_base, "");
2488 }
2489 
2490 
2491 void AdapterHandlerEntry::deallocate() {
2492   delete _fingerprint;
2493 #ifdef ASSERT
2494   if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code, mtCode);
2495 #endif
2496 }
2497 
2498 
2499 #ifdef ASSERT
2500 // Capture the code before relocation so that it can be compared
2501 // against other versions.  If the code is captured after relocation
2502 // then relative instructions won't be equivalent.
2503 void AdapterHandlerEntry::save_code(unsigned char* buffer, int length) {
2504   _saved_code = NEW_C_HEAP_ARRAY(unsigned char, length, mtCode);
2505   _saved_code_length = length;
2506   memcpy(_saved_code, buffer, length);
2507 }
2508 
2509 
2510 bool AdapterHandlerEntry::compare_code(unsigned char* buffer, int length) {
2511   if (length != _saved_code_length) {
2512     return false;
2513   }
2514 


2885   int i = max_locals;
2886   for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
2887        kptr2 < fr.interpreter_frame_monitor_begin();
2888        kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
2889     if (kptr2->obj() != NULL) {         // Avoid 'holes' in the monitor array
2890       BasicLock *lock = kptr2->lock();
2891       // Inflate so the displaced header becomes position-independent
2892       if (lock->displaced_header()->is_unlocked())
2893         ObjectSynchronizer::inflate_helper(kptr2->obj());
2894       // Now the displaced header is free to move
2895       buf[i++] = (intptr_t)lock->displaced_header();
2896       buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
2897     }
2898   }
2899   assert(i - max_locals == active_monitor_count*2, "found the expected number of monitors");
2900 
2901   return buf;
2902 JRT_END
2903 
2904 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
2905   FREE_C_HEAP_ARRAY(intptr_t, buf, mtCode);
2906 JRT_END
2907 
2908 bool AdapterHandlerLibrary::contains(CodeBlob* b) {
2909   AdapterHandlerTableIterator iter(_adapters);
2910   while (iter.has_next()) {
2911     AdapterHandlerEntry* a = iter.next();
2912     if (b == CodeCache::find_blob(a->get_i2c_entry())) return true;
2913   }
2914   return false;
2915 }
2916 
2917 void AdapterHandlerLibrary::print_handler_on(outputStream* st, CodeBlob* b) {
2918   AdapterHandlerTableIterator iter(_adapters);
2919   while (iter.has_next()) {
2920     AdapterHandlerEntry* a = iter.next();
2921     if (b == CodeCache::find_blob(a->get_i2c_entry())) {
2922       st->print("Adapter for signature: ");
2923       a->print_adapter_on(tty);
2924       return;
2925     }


2067       ptr = _value._fingerprint;
2068     }
2069 
2070     // Now pack the BasicTypes with 8 per int
2071     int sig_index = 0;
2072     for (int index = 0; index < len; index++) {
2073       int value = 0;
2074       for (int byte = 0; byte < _basic_types_per_int; byte++) {
2075         int bt = ((sig_index < total_args_passed)
2076                   ? adapter_encoding(sig_bt[sig_index++])
2077                   : 0);
2078         assert((bt & _basic_type_mask) == bt, "must fit in 4 bits");
2079         value = (value << _basic_type_bits) | bt;
2080       }
2081       ptr[index] = value;
2082     }
2083   }
2084 
2085   ~AdapterFingerPrint() {
2086     if (_length > 0) {
2087       FREE_C_HEAP_ARRAY(int, _value._fingerprint);
2088     }
2089   }
2090 
2091   int value(int index) {
2092     if (_length < 0) {
2093       return _value._compact[index];
2094     }
2095     return _value._fingerprint[index];
2096   }
2097   int length() {
2098     if (_length < 0) return -_length;
2099     return _length;
2100   }
2101 
2102   bool is_compact() {
2103     return _length <= 0;
2104   }
2105 
2106   unsigned int compute_hash() {
2107     int hash = 0;


2474   return base;
2475 }
2476 
2477 void AdapterHandlerEntry::relocate(address new_base) {
2478   address old_base = base_address();
2479   assert(old_base != NULL, "");
2480   ptrdiff_t delta = new_base - old_base;
2481   if (_i2c_entry != NULL)
2482     _i2c_entry += delta;
2483   if (_c2i_entry != NULL)
2484     _c2i_entry += delta;
2485   if (_c2i_unverified_entry != NULL)
2486     _c2i_unverified_entry += delta;
2487   assert(base_address() == new_base, "");
2488 }
2489 
2490 
2491 void AdapterHandlerEntry::deallocate() {
2492   delete _fingerprint;
2493 #ifdef ASSERT
2494   if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code);
2495 #endif
2496 }
2497 
2498 
2499 #ifdef ASSERT
2500 // Capture the code before relocation so that it can be compared
2501 // against other versions.  If the code is captured after relocation
2502 // then relative instructions won't be equivalent.
2503 void AdapterHandlerEntry::save_code(unsigned char* buffer, int length) {
2504   _saved_code = NEW_C_HEAP_ARRAY(unsigned char, length, mtCode);
2505   _saved_code_length = length;
2506   memcpy(_saved_code, buffer, length);
2507 }
2508 
2509 
2510 bool AdapterHandlerEntry::compare_code(unsigned char* buffer, int length) {
2511   if (length != _saved_code_length) {
2512     return false;
2513   }
2514 


2885   int i = max_locals;
2886   for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
2887        kptr2 < fr.interpreter_frame_monitor_begin();
2888        kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
2889     if (kptr2->obj() != NULL) {         // Avoid 'holes' in the monitor array
2890       BasicLock *lock = kptr2->lock();
2891       // Inflate so the displaced header becomes position-independent
2892       if (lock->displaced_header()->is_unlocked())
2893         ObjectSynchronizer::inflate_helper(kptr2->obj());
2894       // Now the displaced header is free to move
2895       buf[i++] = (intptr_t)lock->displaced_header();
2896       buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
2897     }
2898   }
2899   assert(i - max_locals == active_monitor_count*2, "found the expected number of monitors");
2900 
2901   return buf;
2902 JRT_END
2903 
2904 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
2905   FREE_C_HEAP_ARRAY(intptr_t, buf);
2906 JRT_END
2907 
2908 bool AdapterHandlerLibrary::contains(CodeBlob* b) {
2909   AdapterHandlerTableIterator iter(_adapters);
2910   while (iter.has_next()) {
2911     AdapterHandlerEntry* a = iter.next();
2912     if (b == CodeCache::find_blob(a->get_i2c_entry())) return true;
2913   }
2914   return false;
2915 }
2916 
2917 void AdapterHandlerLibrary::print_handler_on(outputStream* st, CodeBlob* b) {
2918   AdapterHandlerTableIterator iter(_adapters);
2919   while (iter.has_next()) {
2920     AdapterHandlerEntry* a = iter.next();
2921     if (b == CodeCache::find_blob(a->get_i2c_entry())) {
2922       st->print("Adapter for signature: ");
2923       a->print_adapter_on(tty);
2924       return;
2925     }
src/share/vm/runtime/sharedRuntime.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File