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

fix #15730 cstring nil semantics in VM now work like in RT #16026

Closed

Conversation

timotheecour
Copy link
Member

@timotheecour timotheecour commented Nov 18, 2020

fix #15730

@timotheecour timotheecour marked this pull request as draft November 18, 2020 03:28
@@ -1035,7 +1035,13 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
regs[ra].intVal = not regs[rb].intVal
of opcEqStr:
decodeBC(rkInt)
regs[ra].intVal = ord(regs[rb].node.strVal == regs[rc].node.strVal)
var ret = false
Copy link
Member

@cooldome cooldome Nov 18, 2020

Choose a reason for hiding this comment

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

cstring and string share many magic functions implementations in vmgen: mAppendStrStr, mLengthStr, mSlice.
All these functions now need to handle null as a value.
It would be more efficient to generate different code in vmgen to avoid if statements in vm rawExecute which is important to be fast.

Copy link
Member

Choose a reason for hiding this comment

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

Likely it means that cstring and string need to get different op codes opcEqStr, opcEqCStr, opcLenStr and opcLenCStr and etc

@ringabout
Copy link
Member

We need this PR to make this issue work timotheecour#6 (comment)

The default value of cstring is not null.

@stale
Copy link

stale bot commented Feb 23, 2022

This pull request has been automatically marked as stale because it has not had recent activity. If you think it is still a valid PR, please rebase it on the latest devel; otherwise it will be closed. Thank you for your contributions.

@stale stale bot added the stale Staled PR/issues; remove the label after fixing them label Feb 23, 2022
@stale stale bot closed this Mar 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Staled PR/issues; remove the label after fixing them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cstring("") != nil fails at CT; isNil sometimes returns false for nil cstring
3 participants