On Apr 2, 2015, at 9:17 AM, Vladimir Ivanov <vladimir.x.iva...@oracle.com> wrote: > >> >> I recommend putting CONTEXT_OFFSET into CallSite, not the nested class. >> For one thing, your getDeclaredField call will fail (I think) with a >> security manager installed. >> You can load it up where TARGET_OFFSET is initialized. > Since I removed DependencyContext, I moved CONTEXT_OFFSET to CallSite. > > BTW why do you think security manager was the problem? (1) > Class.getDeclaredField() is caller-sensitive; and (2) DependencyContext was > eagerly initialized with CallSite (see UNSAFE.ensureClassInitialized() in > original version).
CallSite$DependencyContext and CallSite are distinct classes. At the JVM level they cannot access each others' private members. So if DependencyContext wants to reflect a private field from CallSite, there will be extra security checks. These sometimes fail, as in: https://bugs.openjdk.java.net/browse/JDK-7050328 — John