Skip to content

Conversation

bwoebi
Copy link
Member

@bwoebi bwoebi commented Dec 1, 2016

@php-pulls
Copy link

Comment on behalf of krakjoe at php.net:

labelling

zend_string_release(name);
}
return NULL;
}
Copy link
Member

Choose a reason for hiding this comment

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

indent

zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
if (varname_op_type != IS_CONST) {
zend_string_release(name);
}
Copy link
Member

Choose a reason for hiding this comment

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

This check looks redundant. polymorphic_cache_slot requires op1 to be const (this branch is also missing in the same code 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.

Uh, does it actually require it being const, or does it just happen that it's only used for when var_op_name is const? If it's the latter, that check anyway doesn't harm as it will be compiled out when inlining?

Copy link
Member

Choose a reason for hiding this comment

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

It requires it because cache slots are bound to CONST operands. In any case, I don't really care either way, as long as the two code blocks are the same.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's missing there because the condition of the whole block there already includes varname_op_type == IS_CONST

#if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
ZEND_VM_DISPATCH_TO_HELPER(zend_binary_assign_op_static_prop_helper, binary_op, binary_op);
#else
# if !defined(ZEND_VM_SPEC) || OP1_TYPE != IS_UNUSED
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be better to formulate all these conditions positively? (I.e., the same as the two above)

Copy link
Member Author

Choose a reason for hiding this comment

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

Dunno, that was already that way originally… And not sure whether it's better listing every single of the four individually?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, leave it. I just found it weird that part is implemented one way and part the other way.

@bwoebi bwoebi force-pushed the extra_static_prop_assign_ops branch 2 times, most recently from 6c66571 to 0bf02dc Compare December 5, 2016 10:06
}

ZEND_VM_INLINE_HELPER(zend_binary_assign_op_helper, VAR|UNUSED|THIS|CV, CONST|TMPVAR|UNUSED|NEXT|CV, SPEC(DIM_OBJ), binary_op_type binary_op)
ZEND_VM_INLINE_HELPER(zend_binary_assign_op_helper, CONST|TMP|VAR|UNUSED|THIS|CV, CONST|TMPVAR|UNUSED|NEXT|CV, SPEC(DIM_OBJ), binary_op_type binary_op)
Copy link
Member

Choose a reason for hiding this comment

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

How it's possible to assign to IS_CONST or IS_TMP_VAR?

Copy link
Member Author

@bwoebi bwoebi Dec 5, 2016

Choose a reason for hiding this comment

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

You cannot assign to these… It's just the syntax of ASSIGN_STATIC (ClassName::$foo - ClassName and foo are both CONST)

@krakjoe
Copy link
Member

krakjoe commented Jan 2, 2017

@bwoebi fix conflicts please :)

@dmitry @nikic can I know if this is okay to merge into master please ?

@dstogov
Copy link
Member

dstogov commented Jan 9, 2017

We discussed the patch with @bwoebi some time ago, but didn't come to consensus.
It optimizes some operations in cost of more frequently used opcodes and significant code size increase.
So it shows improvement on specific synthetic benchmark, but degradation on real-life.

But I understood, the main reason of the change - is a preparation for typed properties.

@krakjoe
Copy link
Member

krakjoe commented Jan 9, 2017

But I understood, the main reason of the change - is a preparation for typed properties.

That's why I'm interested in merging it, a complete impl of typed properties is difficult/impossible/impractical without it.

What kind of degradation are we talking about, is it the kind that is acceptable, or not ?

@krakjoe
Copy link
Member

krakjoe commented Jan 13, 2017

@dstogov comment above was aimed at you, forgot to ping :)

@dstogov
Copy link
Member

dstogov commented Jan 13, 2017 via email

@dstogov dstogov force-pushed the extra_static_prop_assign_ops branch from e3fb9a9 to 3d84aef Compare January 17, 2017 08:44
@staabm
Copy link
Contributor

staabm commented Jan 17, 2017

I guess it was merged via 3d84aef ?

@dstogov
Copy link
Member

dstogov commented Jan 17, 2017

no, only part of this

@nikic
Copy link
Member

nikic commented Sep 20, 2018

A variant of this change is part of typed properties in #3313, so closing this PR.

@nikic nikic closed this Sep 20, 2018
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.

6 participants