Skip to content

Conversation

@withinboredom
Copy link
Member

This deletes some code that appears to be a bug. I think it was intended to be CACHED_PTR(opline->result.num + 1);? I'm not sure why we are incrementing an integer by the sizeof a pointer.

There are a couple other instances of this in this file, but I wanted to bring it up first, to understand why it is here.

} else if (OP1_TYPE != IS_CONST &&
OP2_TYPE == IS_CONST &&
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
Copy link
Member

Choose a reason for hiding this comment

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

If you look at the implementation of CACHED_PTR:

#define CACHED_PTR(num) \
	((void**)((char*)EX(run_time_cache) + (num)))[0]

As you can see, num is used as an byte offset into EX(run_time_cache). That's why we add sizeof(void*) instead of 1, we want to load the next pointer after the one pointed to by opline->result.num.

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.

2 participants