fujitsu / xbyak_aarch64

Apache License 2.0
186 stars 39 forks source link

simplify jump generation in auto-grow mode #101

Closed neumannt closed 2 months ago

neumannt commented 2 months ago

All jumps are performed relative to the current position, and the encoding is computed based upon jmpAddr - codeOffset. Which means that the encoding is unaffected by the absolute position of the code in memory. Thus, it is not necessary to treat the auto-grow mode differently, the encoding can always be computed eagerly.

herumi commented 2 months ago

Thank you for the patch. It looks good for me. AUTO_GROW mode is a remnant of x64 and is unused. @kawakami-k, what do you think about this?

kawakami-k commented 2 months ago

@herumi I agree to remove AUTO_GROW support from Xbyak_aarch64. How about waiting a couple of weeks for this patch to be merged to make sure no one will have a problem with this patch?

neumannt commented 2 months ago

I think we still need the AUTO_GROW functionality in itself in the sense that the code array has to grow as needed. But the generated code is unaffected by that, we can emit branch instructions immediately.

herumi commented 2 months ago

@neumannt Yes, we can retain the AUTO_GROW functionality and maintain backward compatibility. However, nowadays, the DontSetProtectRWE flag is typically set in the CodeGenerator constructor for security reasons, so the AUTO_GROW feature is likely no longer in use.

kawakami-k commented 2 months ago

@neumannt Thank you for the contribution!