-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
change semantics of @memcpy
and @memset
#15278
Commits on Apr 25, 2023
-
change semantics of
@memcpy
and@memset
Now they use slices or array pointers with any element type instead of requiring byte pointers. This is a breaking enhancement to the language. The safety check for overlapping pointers will be implemented in a future commit. closes #14040
Configuration menu - View commit details
-
Copy full SHA for a5c910a - Browse repository at this point
Copy the full SHA a5c910aView commit details -
update
@memcpy
to require equal src and dest lens* Sema: upgrade operands to array pointers if possible when emitting AIR. * Implement safety checks for length mismatch and aliasing. * AIR: make ptrtoint support slice operands. Implement in LLVM backend. * C backend: implement new `@memset` semantics. `@memcpy` is not done yet.
Configuration menu - View commit details
-
Copy full SHA for edb5e49 - Browse repository at this point
Copy the full SHA edb5e49View commit details -
Configuration menu - View commit details
-
Copy full SHA for 92186b8 - Browse repository at this point
Copy the full SHA 92186b8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 76e340c - Browse repository at this point
Copy the full SHA 76e340cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 25d1128 - Browse repository at this point
Copy the full SHA 25d1128View commit details -
LLVM backend: support non-byte-sized memset
Also introduce memset_safe AIR tag and support it in C backend and LLVM backend.
Configuration menu - View commit details
-
Copy full SHA for 057c950 - Browse repository at this point
Copy the full SHA 057c950View commit details -
C backend: fix memset for loop lowering
Previously, this code casted the array pointer to u8 pointer, but I removed that in a different commit. This commit restores the cast, but instead of hard-coding u8, it uses the destination element pointer, since memset now supports arbitrary element types.
Configuration menu - View commit details
-
Copy full SHA for 0f65cc9 - Browse repository at this point
Copy the full SHA 0f65cc9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 83a7303 - Browse repository at this point
Copy the full SHA 83a7303View commit details -
Configuration menu - View commit details
-
Copy full SHA for 482a0f6 - Browse repository at this point
Copy the full SHA 482a0f6View commit details -
add behavior test for
@memset
on slicesand avoid new language feature in std.ArrayList for now, until x86_64 self-hosted backend can implement it.
Configuration menu - View commit details
-
Copy full SHA for 7c56145 - Browse repository at this point
Copy the full SHA 7c56145View commit details -
x86_64 backend: implement
@memset
for element ABI size > 1* make memset and memset_safe guarantee that if the length is comptime-known then it will be nonzero.
Configuration menu - View commit details
-
Copy full SHA for 881e931 - Browse repository at this point
Copy the full SHA 881e931View commit details -
Configuration menu - View commit details
-
Copy full SHA for 58fabbc - Browse repository at this point
Copy the full SHA 58fabbcView commit details -
Configuration menu - View commit details
-
Copy full SHA for bd6f01c - Browse repository at this point
Copy the full SHA bd6f01cView commit details -
Needed due to the compiler depending on standard library APIs such as ArrayList that contain `@memset` and `@memcpy` calls in them. The number of parameters changed, so this is necessary for the compiler to build.
Configuration menu - View commit details
-
Copy full SHA for a8de15f - Browse repository at this point
Copy the full SHA a8de15fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 747f583 - Browse repository at this point
Copy the full SHA 747f583View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1ba72bc - Browse repository at this point
Copy the full SHA 1ba72bcView commit details -
C backend: use ++ instead of += for airMemset
It does the same thing but has fewer bytes in the output.
Configuration menu - View commit details
-
Copy full SHA for d604553 - Browse repository at this point
Copy the full SHA d604553View commit details -
stage2: introduce store_safe AIR instruction
store: The value to store may be undefined, in which case the destination memory region has undefined bytes after this instruction is evaluated. In such case ignoring this instruction is legal lowering. store_safe: Same as `store`, except if the value to store is undefined, the memory region should be filled with 0xaa bytes, and any other safety metadata such as Valgrind integrations should be notified of this memory region being undefined.
Configuration menu - View commit details
-
Copy full SHA for 5378fdf - Browse repository at this point
Copy the full SHA 5378fdfView commit details -
Sema: fix memcpy alias safety incorrect math
Previously it was not multiplying by the element ABI size. Now, it uses ptr_add instructions which do math based on the element type.
Configuration menu - View commit details
-
Copy full SHA for 792bbfa - Browse repository at this point
Copy the full SHA 792bbfaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 401b7f6 - Browse repository at this point
Copy the full SHA 401b7f6View commit details -
C backend: fix lowering comparison when array ptr meets ptr
Pointer comparisons were triggering `-Wcompare-distinct-pointer-types` before this fix, which adds `(void*)` casts if the lhs type and rhs type do not match pointer sizeness.
Configuration menu - View commit details
-
Copy full SHA for badad16 - Browse repository at this point
Copy the full SHA badad16View commit details