Skip to content

Implement CORINFO_FIELD_INTRINSIC_ZERO and _ISLITTLEENDIAN #116853

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

Merged
merged 3 commits into from
Jun 23, 2025

Conversation

janvorli
Copy link
Member

These has shown up on the runtime startup path

These has shown up on the runtime startup path
@janvorli janvorli added this to the 10.0.0 milestone Jun 20, 2025
@janvorli janvorli requested a review from kotlarmilos June 20, 2025 11:23
@janvorli janvorli self-assigned this Jun 20, 2025
@Copilot Copilot AI review requested due to automatic review settings June 20, 2025 11:23
@janvorli janvorli requested review from BrzVlad and kg as code owners June 20, 2025 11:23
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements two new CORINFO field intrinsics to support runtime startup behavior. Key updates include:

  • Adding a switch-case in EmitStaticFieldAccess for CORINFO_FIELD_INTRINSIC_ZERO, which pushes a null reference.
  • Adding logic for CORINFO_FIELD_INTRINSIC_ISLITTLEENDIAN to push a constant reflecting the system’s endianness.

Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @janvorli, @kg
See info in area-owners.md if you want to be subscribed.

#else
m_pLastNewIns->data[0] = 1;
#endif
PushInterpType(InterpTypeI1, NULL);
Copy link
Member

Choose a reason for hiding this comment

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

Should it be extended to InterpTypeI4 on the eval stack even though it is a bool?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is actually one thing I am not sure about, maybe @BrzVlad could provide a guidance here.

Copy link
Member

Choose a reason for hiding this comment

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

We only support pushing I4,I8,R4,R8 or VT on the stack. When pushing on the stack from IL locals/args we will sign extend. In this particular example, whether you push InterpTypeI1 or InterpTypeI4, you will still end up pushing an I4 var so there is not really a difference in practice. Overall I suggest pushing the I4 explicitly. In the future we will probably get rid of the StackType* so we will have to push the actual type anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you, I'll change it that way then.

Also add tests for the new intrinsic field accessors
@janvorli janvorli merged commit 915080d into dotnet:main Jun 23, 2025
98 of 100 checks passed
@janvorli janvorli deleted the interpreter-two-static-accessors branch June 23, 2025 22:28
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.

5 participants