remove all definitions of roc_memcpy

This commit is contained in:
Brendan Hansknecht 2023-06-01 23:04:38 -07:00
parent ebc6bd3f45
commit 75a035e12d
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
53 changed files with 32 additions and 284 deletions

View file

@ -49,7 +49,6 @@ comptime {
@export(testing_roc_realloc, .{ .name = "roc_realloc", .linkage = .Strong });
@export(testing_roc_dealloc, .{ .name = "roc_dealloc", .linkage = .Strong });
@export(testing_roc_panic, .{ .name = "roc_panic", .linkage = .Strong });
@export(testing_roc_memcpy, .{ .name = "roc_memcpy", .linkage = .Strong });
if (builtin.os.tag == .macos or builtin.os.tag == .linux) {
@export(testing_roc_getppid, .{ .name = "roc_getppid", .linkage = .Strong });
@ -83,14 +82,6 @@ fn testing_roc_panic(c_ptr: *anyopaque, tag_id: u32) callconv(.C) void {
@panic("Roc panicked");
}
fn testing_roc_memcpy(dest: *anyopaque, src: *anyopaque, bytes: usize) callconv(.C) ?*anyopaque {
const zig_dest = @ptrCast([*]u8, dest);
const zig_src = @ptrCast([*]u8, src);
@memcpy(zig_dest, zig_src, bytes);
return dest;
}
pub fn alloc(size: usize, alignment: u32) ?[*]u8 {
return @ptrCast(?[*]u8, roc_alloc(size, alignment));
}
@ -103,10 +94,6 @@ pub fn dealloc(c_ptr: [*]u8, alignment: u32) void {
return roc_dealloc(c_ptr, alignment);
}
pub fn memcpy(dst: [*]u8, src: [*]u8, size: usize) void {
roc_memcpy(dst, src, size);
}
// indirection because otherwise zig creates an alias to the panic function which our LLVM code
// does not know how to deal with
pub fn test_panic(c_ptr: *anyopaque, crash_tag: u32) callconv(.C) void {

View file

@ -289,11 +289,6 @@ mod dummy_platform_functions {
unimplemented!("It is not valid to call roc panic from within the compiler. Please use the \"platform\" feature if this is a platform.")
}
#[no_mangle]
pub fn roc_memcpy(_dst: *mut c_void, _src: *mut c_void, _n: usize) -> *mut c_void {
unimplemented!("It is not valid to call roc memcpy from within the compiler. Please use the \"platform\" feature if this is a platform.")
}
#[no_mangle]
pub fn roc_memset(_dst: *mut c_void, _c: i32, _n: usize) -> *mut c_void {
unimplemented!("It is not valid to call roc memset from within the compiler. Please use the \"platform\" feature if this is a platform.")

View file

@ -7,13 +7,6 @@ pub unsafe fn roc_alloc(size: usize, _alignment: u32) -> *mut c_void {
libc::malloc(size)
}
/// # Safety
/// The Roc application needs this.
#[no_mangle]
pub unsafe fn roc_memcpy(dest: *mut c_void, src: *const c_void, bytes: usize) -> *mut c_void {
libc::memcpy(dest, src, bytes)
}
/// # Safety
/// The Roc application needs this.
#[no_mangle]

View file

@ -134,13 +134,6 @@ void roc_panic(void* msg, unsigned int tag_id)
//--------------------------
void roc_memcpy(void *dest, const void *src, size_t n)
{
memcpy(dest, src, n);
}
//--------------------------
void *roc_memset(void *str, int c, size_t n)
{
return memset(str, c, n);