diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2016-02-05 16:51:53 +0000 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2016-02-05 17:11:54 +0000 |
commit | b331febbab8e916680faba722cc84b66b84218a3 (patch) | |
tree | 35f985b021e476914bfe91492da23fee218014a7 /runtime/arch/arm64 | |
parent | 586996afc905518ed926e4680aab67bedabec9b7 (diff) | |
download | art-b331febbab8e916680faba722cc84b66b84218a3.tar.gz art-b331febbab8e916680faba722cc84b66b84218a3.tar.bz2 art-b331febbab8e916680faba722cc84b66b84218a3.zip |
Revert "Revert "Implement on-stack replacement for arm/arm64/x86/x86_64.""
This reverts commit bd89a5c556324062b7d841843b039392e84cfaf4.
Change-Id: I08d190431520baa7fcec8fbdb444519f25ac8d44
Diffstat (limited to 'runtime/arch/arm64')
-rw-r--r-- | runtime/arch/arm64/quick_entrypoints_arm64.S | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/runtime/arch/arm64/quick_entrypoints_arm64.S b/runtime/arch/arm64/quick_entrypoints_arm64.S index 9ccabad1cc..e8480087a7 100644 --- a/runtime/arch/arm64/quick_entrypoints_arm64.S +++ b/runtime/arch/arm64/quick_entrypoints_arm64.S @@ -915,6 +915,105 @@ END art_quick_invoke_static_stub +/* extern"C" void art_quick_osr_stub(void** stack, x0 + * size_t stack_size_in_bytes, x1 + * const uin8_t* native_pc, x2 + * JValue *result, x3 + * char *shorty, x4 + * Thread *self) x5 + */ +ENTRY art_quick_osr_stub +SAVE_SIZE=15*8 // x3, x4, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, SP, LR, FP saved. + mov x9, sp // Save stack pointer. + .cfi_register sp,x9 + + sub x10, sp, # SAVE_SIZE + and x10, x10, # ~0xf // Enforce 16 byte stack alignment. + mov sp, x10 // Set new SP. + + str x28, [sp, #112] + stp x26, x27, [sp, #96] + stp x24, x25, [sp, #80] + stp x22, x23, [sp, #64] + stp x20, x21, [sp, #48] + stp x9, x19, [sp, #32] // Save old stack pointer and x19. + stp x3, x4, [sp, #16] // Save result and shorty addresses. + stp xFP, xLR, [sp] // Store LR & FP. + mov xSELF, x5 // Move thread pointer into SELF register. + + sub sp, sp, #16 + str xzr, [sp] // Store null for ArtMethod* slot + // Branch to stub. + bl .Losr_entry + add sp, sp, #16 + + // Restore return value address and shorty address. + ldp x3,x4, [sp, #16] + ldr x28, [sp, #112] + ldp x26, x27, [sp, #96] + ldp x24, x25, [sp, #80] + ldp x22, x23, [sp, #64] + ldp x20, x21, [sp, #48] + + // Store result (w0/x0/s0/d0) appropriately, depending on resultType. + ldrb w10, [x4] + + // Check the return type and store the correct register into the jvalue in memory. + + // Don't set anything for a void type. + cmp w10, #'V' + beq .Losr_exit + + // Is it a double? + cmp w10, #'D' + bne .Lno_double + str d0, [x3] + b .Losr_exit + +.Lno_double: // Is it a float? + cmp w10, #'F' + bne .Lno_float + str s0, [x3] + b .Losr_exit + +.Lno_float: // Just store x0. Doesn't matter if it is 64 or 32 bits. + str x0, [x3] + +.Losr_exit: // Finish up. + ldp x2, x19, [sp, #32] // Restore stack pointer and x19. + ldp xFP, xLR, [sp] // Restore old frame pointer and link register. + mov sp, x2 + ret + +.Losr_entry: + // Update stack pointer for the callee + sub sp, sp, x1 + + // Update link register slot expected by the callee. + sub w1, w1, #8 + str lr, [sp, x1] + + // Copy arguments into stack frame. + // Use simple copy routine for now. + // 4 bytes per slot. + // X0 - source address + // W1 - args length + // SP - destination address. + // W10 - temporary +.Losr_loop_entry: + cmp w1, #0 + beq .Losr_loop_exit + sub w1, w1, #4 + ldr w10, [x0, x1] + str w10, [sp, x1] + b .Losr_loop_entry + +.Losr_loop_exit: + // Branch to the OSR entry point. + br x2 + +END art_quick_osr_stub + /* * On entry x0 is uintptr_t* gprs_ and x1 is uint64_t* fprs_ */ |