src/share/vm/runtime/sharedRuntime.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/runtime/sharedRuntime.cpp	Tue Apr 28 16:11:27 2009
--- new/src/share/vm/runtime/sharedRuntime.cpp	Tue Apr 28 16:11:27 2009

*** 1775,1784 **** --- 1775,1785 ---- const char* AdapterHandlerEntry::name = "I2C/C2I adapters"; GrowableArray<uint64_t>* AdapterHandlerLibrary::_fingerprints = NULL; GrowableArray<AdapterHandlerEntry* >* AdapterHandlerLibrary::_handlers = NULL; const int AdapterHandlerLibrary_size = 16*K; u_char AdapterHandlerLibrary::_buffer[AdapterHandlerLibrary_size + 32]; + BufferBlob* AdapterHandlerLibrary::_buffer_blob = NULL; void AdapterHandlerLibrary::initialize() { if (_fingerprints != NULL) return; _fingerprints = new(ResourceObj::C_HEAP)GrowableArray<uint64_t>(32, true); _handlers = new(ResourceObj::C_HEAP)GrowableArray<AdapterHandlerEntry*>(32, true);
*** 1980,2002 **** --- 1981,1995 ---- nm = method->code(); if (nm) { return nm; } // Improve alignment slightly u_char* buf = (u_char*)(((intptr_t)_buffer + CodeEntryAlignment-1) & ~(CodeEntryAlignment-1)); CodeBuffer buffer(buf, AdapterHandlerLibrary_size); // Need a few relocation entries double locs_buf[20]; buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); MacroAssembler _masm(&buffer); // Fill in the signature array, for the calling-convention call. int total_args_passed = method->size_of_parameters(); BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType,total_args_passed); ! VMRegPair * regs = NEW_RESOURCE_ARRAY(VMRegPair ,total_args_passed); ! VMRegPair* regs = NEW_RESOURCE_ARRAY(VMRegPair,total_args_passed); int i=0; if( !method->is_static() ) // Pass in receiver first sig_bt[i++] = T_OBJECT; SignatureStream ss(method->signature()); for( ; !ss.at_return_type(); ss.next()) {
*** 2009,2026 **** --- 2002,2029 ---- // Now get the compiled-Java layout as input arguments int comp_args_on_stack; comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, false); + if (_buffer_blob == NULL) // Initialize lazily + _buffer_blob = BufferBlob::create("Native wrapper/DTrace nmethod", AdapterHandlerLibrary_size); + + if (_buffer_blob != NULL) { + CodeBuffer buffer(_buffer_blob->instructions_begin(), _buffer_blob->instructions_size()); + double locs_buf[20]; + buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); + MacroAssembler _masm(&buffer); + // Generate the compiled-to-native wrapper code nm = SharedRuntime::generate_native_wrapper(&_masm, method, total_args_passed, comp_args_on_stack, sig_bt,regs, ret_type); } + } // Must unlock before calling set_code // Install the generated code. if (nm != NULL) { method->set_code(method, nm);
*** 2075,2097 **** --- 2078,2102 ---- nm = method->code(); if (nm) { return nm; } // Improve alignment slightly u_char* buf = (u_char*) (((intptr_t)_buffer + CodeEntryAlignment-1) & ~(CodeEntryAlignment-1)); CodeBuffer buffer(buf, AdapterHandlerLibrary_size); + if (_buffer_blob == NULL) // Initialize lazily + _buffer_blob = BufferBlob::create("Native wrapper/DTrace nmethod", AdapterHandlerLibrary_size); + + if (_buffer_blob != NULL) { + CodeBuffer buffer(_buffer_blob->instructions_begin(), _buffer_blob->instructions_size()); // Need a few relocation entries double locs_buf[20]; buffer.insts()->initialize_shared_locs( (relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); MacroAssembler _masm(&buffer); // Generate the compiled-to-native wrapper code nm = SharedRuntime::generate_dtrace_nmethod(&_masm, method); } + } return nm; } // the dtrace method needs to convert java lang string to utf8 string. void SharedRuntime::get_utf(oopDesc* src, address dst) {

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