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

Transparently introduce type-specialized opcode handlers. #1825

Closed
wants to merge 4 commits into from

Conversation

dstogov
Copy link
Member

@dstogov dstogov commented Mar 17, 2016

This affects only PHP VM, and doesn't change anything else.

Followup to #1824.

This affects only PHP VM, and doesn't change anything else.
@nikic
Copy link
Member

nikic commented Mar 17, 2016

I'm probably missing something obvious here, but how does this interact with the file cache? Won't it reassign the unoptimized handler?

@dstogov
Copy link
Member Author

dstogov commented Mar 17, 2016

You are right [&#X02639]


From: Nikita Popov notifications@github.com
Sent: Thursday, March 17, 2016 19:49
To: php/php-src
Cc: Dmitry Stogov
Subject: Re: [php-src] Transparently introduce type-specialized opcode handlers. (#1825)

I'm probably missing something obvious here, but how does this interact with the file cache? Won't it reassign the unoptimized handler?

You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHubhttps://github.com//pull/1825#issuecomment-197970051

ZEND_VM_NEXT_OPCODE();
}

ZEND_VM_TYPE_SPEC_HANDLER(ZEND_POST_INC, (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG), ZEND_POST_INC_LONG_NO_OVERFLOW, TMPVARCV, ANY)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct. If op1 == ZEND_LONG_MAX then result would be long, but the op1 increment would overflow into double. We should be (somehow) checking the type of op1_def here instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing that ZEND_POST_INC_LONG_NO_OVERFLOW here means this will never be used where it could overflow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. For PRE/POST_INC/DEC optimizer passes op1_def into result_info

@hikari-no-yume
Copy link
Contributor

Introducing special versions of opcodes that can only be used when Optimizer is enabled irks me somehow. Isn't Optimizer still not turned on by default and only built with OPcache, as a shared library?

end = opline + op_array->last;
while (opline < end) {
zend_vm_set_opcode_handler_ex(opline,
opline->op1_type == IS_UNDEF ? 0 : (OP1_INFO() & (MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_KEY_ANY)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be IS_UNUSED (and also a couple of times below).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for catching.

@dstogov
Copy link
Member Author

dstogov commented Mar 17, 2016

Now optimiser is independent from opcache and may be moved into Zend, but it won't make a lot of sense to use it without opcache anyway.


From: Andrea Faulds notifications@github.com
Sent: Thursday, March 17, 2016 21:10
To: php/php-src
Cc: Dmitry Stogov
Subject: Re: [php-src] Transparently introduce type-specialized opcode handlers. (#1825)

Introducing special versions of opcodes that can only be used when Optimizer is enabled irks me somehow. Isn't Optimizer still not turned on by default and only built with OPcache, as a shared library?

You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHubhttps://github.com//pull/1825#issuecomment-198008262

@hikari-no-yume
Copy link
Contributor

Yeah, it's true that using Optimizer without OPcache is probably a waste of time, given how it would just slow down your requests.

Anyway, I think moving Optimizer into Zend would make me happier, even if it's mostly just cosmetic. Perhaps we could move OPcache itself at some point, too.

@dstogov
Copy link
Member Author

dstogov commented Mar 17, 2016

Merged into master

@dstogov dstogov closed this Mar 17, 2016
@dstogov dstogov deleted the type_spec branch October 14, 2019 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants