-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[clrinterp] Add support for ldc.r4, ldc.r8, ldc.i8 and ldstr #114201
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
Conversation
There was a problem hiding this 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 adds support for new IL instructions (ldc.r4, ldc.r8, ldc.i8, and ldstr) by updating the interpreter and compiler as well as extending test coverage.
- Implements new opcode cases in the interpreter and compiler for handling floating point and 64‐bit integers.
- Adds enum values for new instruction types.
- Introduces a new test (TestFloat) to verify the correct handling of floating point operations.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/tests/JIT/interpreter/Interpreter.cs | Adds a new TestFloat to check floating point operation accuracy |
src/coreclr/vm/interpexec.cpp | Implements new IL opcode cases for ldc.i8, ldc.r4, and ldc.r8 |
src/coreclr/interpreter/intops.h | Updates opcode enum with new values for long int, float, and double |
src/coreclr/interpreter/compiler.cpp | Handles code generation for new ldc instructions and updates PrintInsData |
Files not reviewed (1)
- src/coreclr/interpreter/intops.def: Language not supported
Comments suppressed due to low confidence (1)
src/coreclr/interpreter/compiler.cpp:3112
- Replace the pointer cast with memcpy to copy the bits from i64 into a double variable for safe type punning when printing.
printf(" %g", *(double*)&i64);
|
||
float sum = f1 + f2; | ||
|
||
if ((sum - 27098.3) > 0.001 || (sum - 27098.3) < -0.001) |
Copilot
AI
Apr 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using an absolute difference check (e.g., if (fabs(sum - 27098.3) > 0.001)) for clearer and more robust floating point comparisons.
if ((sum - 27098.3) > 0.001 || (sum - 27098.3) < -0.001) | |
if (Math.Abs(sum - 27098.3) > 0.001) |
Copilot uses AI. Check for mistakes.
a9427f3
to
fa39117
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
No description provided.