Skip to content
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

Add support for JIT-ing of spl_object_id() and ord() calls #5588

Closed
wants to merge 1 commit into from

Conversation

TysonAndre
Copy link
Contributor

@TysonAndre TysonAndre commented May 18, 2020

See Optimizing assembly for spl_object_id(), fdiv(), etc in the JIT?

Having an example for a few functions would be useful to build off of.

This PR is only supporting IS_CV (named PHP variables),
because garbage collection and exception handling are unnecessary.
This is also only supporting operands known to have the exact expected type.

I'm only proposing this optimization for the JIT.
Adding too many specialized opcodes to the regular PHP VM might harm performance
by making the VM too large, and would make writing optimizations harder.

Future scope:

  • There are a lot of simple functions in ext/standard/math.c
    such as fdiv(), sin(), cos(), tan(), abs(), etc.
  • Additionally, there's more complicated but frequently functions such as in_array(),
    strpos, get_class() etc. that may be useful to call directly to avoid the overhead of
    function calls and exception handling, when safe to do so
    (e.g. no notices or exceptions).

See [Optimizing assembly for spl_object_id(), fdiv(), etc in the JIT?](https://externals.io/message/109847)

Having an example for a few functions would be useful to build off of.

This PR is only supporting IS_CV (named PHP variables),
because garbage collection and exception handling are unnecessary.
This is also only supporting operands known to have the exact expected type.

I'm only proposing this optimization for the JIT.
Adding too many specialized opcodes to the regular PHP VM might harm performance
by making the VM too large, and would make writing optimizations harder.

Future scope:

- There are a lot of simple functions in ext/standard/math.c
  such as fdiv(), sin(), cos(), tan(), abs(), etc.
- Additionally, there's more complicated but frequently functions such as in_array(),
  strpos, etc. that may be useful to call directly to avoid the overhead of
  function calls and exception handling, when safe to do so
  (e.g. no notices or exceptions).
@dstogov
Copy link
Member

dstogov commented Oct 9, 2023

Sorry, I missed this PR.
It looks outdated and I'm closing it now.
If the idea is still relevant it should be applied to master with new IR based JIT.

@dstogov dstogov closed this Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants