-
Notifications
You must be signed in to change notification settings - Fork 7.9k
JIT/AArch64: [macos][ZTS] Support fast path for tlv_get_addr #7042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,6 +184,14 @@ const char* zend_reg_name[] = { | |
|
||
#if ZTS | ||
static size_t tsrm_ls_cache_tcb_offset = 0; | ||
# ifdef __APPLE__ | ||
struct TLVDescriptor { | ||
void* (*thunk)(struct TLVDescriptor*); | ||
uint64_t key; | ||
uint64_t offset; | ||
}; | ||
typedef struct TLVDescriptor TLVDescriptor; | ||
# endif | ||
#endif | ||
|
||
/* By default avoid JITing inline handlers if it does not seem profitable due to lack of | ||
|
@@ -483,10 +491,27 @@ static int logical_immediate_p (uint64_t value, uint32_t reg_size) | |
|| } | ||
|.endmacro | ||
|
||
// Safe memory load/store with an unsigned 64-bit offset. | ||
|.macro SAFE_MEM_ACC_WITH_64_UOFFSET, ldr_str_ins, op, base_reg, offset, tmp_reg | ||
|| if (((uintptr_t)(offset)) > LDR_STR_PIMM64) { | ||
| LOAD_64BIT_VAL tmp_reg, offset | ||
| ldr_str_ins op, [base_reg, tmp_reg] | ||
|| } else { | ||
| ldr_str_ins op, [base_reg, #(offset)] | ||
|| } | ||
|.endmacro | ||
|
||
|.macro LOAD_TSRM_CACHE, reg | ||
||#ifdef __APPLE__ | ||
| .long 0xd53bd071 // TODO: hard-coded: mrs TMP3, tpidrro_el0 | ||
| and TMP3, TMP3, #0xfffffffffffffff8 | ||
| SAFE_MEM_ACC_WITH_64_UOFFSET ldr, TMP3, TMP3, (((TLVDescriptor*)tsrm_ls_cache_tcb_offset)->key << 3), TMP1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Slow path is avoided with the premise that tlv We have one concern that it would be a bit difficult for debugging if the premise is not satisfied with the software evolution in the future. @dstogov Do you think we should add one check here?
Impact:
Pros: In the future, if the premise is missing, it helps to debug. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think, everything fine now. There is no a big difference between debugging There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Recall that the value in |
||
| SAFE_MEM_ACC_WITH_64_UOFFSET ldr, reg, TMP3, (((TLVDescriptor*)tsrm_ls_cache_tcb_offset)->offset), TMP1 | ||
||#else | ||
| .long 0xd53bd051 // TODO: hard-coded: mrs TMP3, tpidr_el0 | ||
|| ZEND_ASSERT(tsrm_ls_cache_tcb_offset <= LDR_STR_PIMM64); | ||
| ldr reg, [TMP3, #tsrm_ls_cache_tcb_offset] | ||
||#endif | ||
|.endmacro | ||
|
||
|.macro LOAD_ADDR_ZTS, reg, struct, field | ||
|
Uh oh!
There was an error while loading. Please reload this page.