1746 int AdapterHandlerLibrary::get_create_adapter_index(methodHandle method) { |
1746 int AdapterHandlerLibrary::get_create_adapter_index(methodHandle method) { |
1747 // Use customized signature handler. Need to lock around updates to the |
1747 // Use customized signature handler. Need to lock around updates to the |
1748 // _fingerprints array (it is not safe for concurrent readers and a single |
1748 // _fingerprints array (it is not safe for concurrent readers and a single |
1749 // writer: this can be fixed if it becomes a problem). |
1749 // writer: this can be fixed if it becomes a problem). |
1750 |
1750 |
1751 // Shouldn't be here if running -Xint |
|
1752 if (Arguments::mode() == Arguments::_int) { |
|
1753 ShouldNotReachHere(); |
|
1754 } |
|
1755 |
|
1756 // Get the address of the ic_miss handlers before we grab the |
1751 // Get the address of the ic_miss handlers before we grab the |
1757 // AdapterHandlerLibrary_lock. This fixes bug 6236259 which |
1752 // AdapterHandlerLibrary_lock. This fixes bug 6236259 which |
1758 // was caused by the initialization of the stubs happening |
1753 // was caused by the initialization of the stubs happening |
1759 // while we held the lock and then notifying jvmti while |
1754 // while we held the lock and then notifying jvmti while |
1760 // holding it. This just forces the initialization to be a little |
1755 // holding it. This just forces the initialization to be a little |
1994 AlwaysCompileLoopMethods = false; |
1989 AlwaysCompileLoopMethods = false; |
1995 } |
1990 } |
1996 } |
1991 } |
1997 return nm; |
1992 return nm; |
1998 } |
1993 } |
|
1994 |
|
1995 #ifdef HAVE_DTRACE_H |
|
1996 // Create a dtrace nmethod for this method. The wrapper converts the |
|
1997 // java compiled calling convention to the native convention, makes a dummy call |
|
1998 // (actually nops for the size of the call instruction, which become a trap if |
|
1999 // probe is enabled). The returns to the caller. Since this all looks like a |
|
2000 // leaf no thread transition is needed. |
|
2001 |
|
2002 nmethod *AdapterHandlerLibrary::create_dtrace_nmethod(methodHandle method) { |
|
2003 ResourceMark rm; |
|
2004 nmethod* nm = NULL; |
|
2005 |
|
2006 if (PrintCompilation) { |
|
2007 ttyLocker ttyl; |
|
2008 tty->print("--- n%s "); |
|
2009 method->print_short_name(tty); |
|
2010 if (method->is_static()) { |
|
2011 tty->print(" (static)"); |
|
2012 } |
|
2013 tty->cr(); |
|
2014 } |
|
2015 |
|
2016 { |
|
2017 // perform the work while holding the lock, but perform any printing |
|
2018 // outside the lock |
|
2019 MutexLocker mu(AdapterHandlerLibrary_lock); |
|
2020 // See if somebody beat us to it |
|
2021 nm = method->code(); |
|
2022 if (nm) { |
|
2023 return nm; |
|
2024 } |
|
2025 |
|
2026 // Improve alignment slightly |
|
2027 u_char* buf = (u_char*) |
|
2028 (((intptr_t)_buffer + CodeEntryAlignment-1) & ~(CodeEntryAlignment-1)); |
|
2029 CodeBuffer buffer(buf, AdapterHandlerLibrary_size); |
|
2030 // Need a few relocation entries |
|
2031 double locs_buf[20]; |
|
2032 buffer.insts()->initialize_shared_locs( |
|
2033 (relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); |
|
2034 MacroAssembler _masm(&buffer); |
|
2035 |
|
2036 // Generate the compiled-to-native wrapper code |
|
2037 nm = SharedRuntime::generate_dtrace_nmethod(&_masm, method); |
|
2038 } |
|
2039 return nm; |
|
2040 } |
|
2041 |
|
2042 // the dtrace method needs to convert java lang string to utf8 string. |
|
2043 void SharedRuntime::get_utf(oopDesc* src, address dst) { |
|
2044 typeArrayOop jlsValue = java_lang_String::value(src); |
|
2045 int jlsOffset = java_lang_String::offset(src); |
|
2046 int jlsLen = java_lang_String::length(src); |
|
2047 jchar* jlsPos = (jlsLen == 0) ? NULL : |
|
2048 jlsValue->char_at_addr(jlsOffset); |
|
2049 (void) UNICODE::as_utf8(jlsPos, jlsLen, (char *)dst, max_dtrace_string_size); |
|
2050 } |
|
2051 #endif // ndef HAVE_DTRACE_H |
1999 |
2052 |
2000 // ------------------------------------------------------------------------- |
2053 // ------------------------------------------------------------------------- |
2001 // Java-Java calling convention |
2054 // Java-Java calling convention |
2002 // (what you use when Java calls Java) |
2055 // (what you use when Java calls Java) |
2003 |
2056 |