/* *Jnidlsymlookupstubfor@CriticalNative.
*/
DEFINE_FUNCTION art_jni_dlsym_lookup_critical_stub
// The hidden arg holding the tagged method (bit 0set means GenericJNI) is RAX.
// For Generic JNI we already have a managed frame, so we reuse the art_jni_dlsym_lookup_stub.
testq LITERAL(1), %rax
jnz art_jni_dlsym_lookup_stub
// Save GPR args and method.
PUSH_ARG r9
PUSH_ARG r8
PUSH_ARG rdi
PUSH_ARG rsi
PUSH_ARG rdx
PUSH_ARG rcx
PUSH_ARG rax
// Create space for FPR args.
INCREASE_FRAME 8 * 8
// Save FPRs.
movq %xmm0, 0(%rsp)
movq %xmm1, 8(%rsp)
movq %xmm2, 16(%rsp)
movq %xmm3, 24(%rsp)
movq %xmm4, 32(%rsp)
movq %xmm5, 40(%rsp)
movq %xmm6, 48(%rsp)
movq %xmm7, 56(%rsp)
// Note: It's the caller's responsibility to preserve xmm12-xmm15 as the tail call
// to native shall always risk clobbering those.
// Load caller PC to R11 and redefine return PC for CFI.
movq (%rsp), %r11
CFI_REGISTER(%rip, %r11)
// Reserve space for a SaveRefsAndArgs managed frame, either for the actual runtime
// method or for a GenericJNI frame which is similar but has a native method and a tag.
INCREASE_FRAME FRAME_SIZE_SAVE_REFS_AND_ARGS - __SIZEOF_POINTER__
// Calculate the number of QWORDs to move.
shrq LITERAL(3), %rax
jz .Lcritical_skip_copy_args
// Save RDI, RSI, RCX so that we can use them for moving stack args.
PUSH_ARG rdi
PUSH_ARG rsi
PUSH_ARG rcx
.Lcritical_skip_copy_args:
// Calculate the base address of the managed frame.
leaq (%rsp, %rax, 8), %rax
// Spill registers for the SaveRefsAndArgs frame above the stack args.
// Note that the runtime shall not examine the args here, otherwise we would have to
// move them in registers and stack to account for the difference between managed and
// native ABIs. Do not update CFI while we hold the frame address in RAX and the values
// in registers are unchanged.
movq %r15, 192(%rax)
movq %r14, 184(%rax)
movq %r13, 176(%rax)
movq %r12, 168(%rax)
movq %r9, 160(%rax)
movq %r8, 152(%rax)
movq %rsi, 144(%rax)
movq %rbp, 136(%rax)
movq %rbx, 128(%rax)
movq %rdx, 120(%rax)
movq %rcx, 112(%rax)
movq %xmm0, 16(%rax)
movq %xmm1, 24(%rax)
movq %xmm2, 32(%rax)
movq %xmm3, 40(%rax)
movq %xmm4, 48(%rax)
movq %xmm5, 56(%rax)
movq %xmm6, 64(%rax)
movq %xmm7, 72(%rax)
// Skip managed ABI callee-saves xmm12-xmm15.
leaq 1(%rbp), %rax // Prepare managed SP tagged for a GenericJNI frame.
testl LITERAL(ACCESS_FLAGS_METHOD_IS_NATIVE), ART_METHOD_ACCESS_FLAGS_OFFSET(%r10)
jnz .Lcritical_skip_prepare_runtime_method
// Save the return PC for managed stack walk.
// (When coming from a compiled stub, the correct return PC is already there.)
movq %r11, FRAME_SIZE_SAVE_REFS_AND_ARGS - __SIZEOF_POINTER__(%rbp)
// Replace the target method with the SaveRefsAndArgs runtime method.
LOAD_RUNTIME_INSTANCE r10
movq RUNTIME_SAVE_REFS_AND_ARGS_METHOD_OFFSET(%r10), %r10
movq %rbp, %rax // Prepare untagged managed SP for the runtime method.
.Lcritical_skip_prepare_runtime_method:
// Store the method on the bottom of the managed frame.
movq %r10, (%rbp)
// Place (maybe tagged) managed SP in Thread::Current()->top_quick_frame.
movq %rax, %gs:THREAD_TOP_QUICK_FRAME_OFFSET
// Save our return PC in the padding.
movq %r11, __SIZEOF_POINTER__(%rbp)
CFI_EXPRESSION_BREG CFI_REG(rip), CFI_REG(rbp), __SIZEOF_POINTER__
// Preserve the native arg register RDI in callee-save register RBX which was saved above.
movq %rdi, %rbx
/* *EntryfromJNIstubthatcalls`artJniUnlockObject()`.Notethatfailureto *unlockisfatal,sowedonotneedtocheckforexceptions. *Customcallingconvention: *RBXholdsthenon-nullobjecttounlock. *Callee-saveregistershavebeensavedandcanbeusedastemporaries(exceptRBX). *ReturnregistersRAXandmmx0needtobepreserved.
*/
// This is also the slow path for art_jni_unlock_object.
JNI_SAVE_RETURN_VALUE_TRAMPOLINE \
art_jni_unlock_object_no_inline, artJniUnlockObject, rbx, gs:THREAD_SELF_OFFSET
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.