Merge branch 'remove-ralloc' into 'master'

Remove ralloc

See merge request redox-os/relibc!449
This commit is contained in:
Jeremy Soller
2024-01-13 17:01:58 +00:00
8 changed files with 3 additions and 97 deletions
-3
View File
@@ -1,9 +1,6 @@
[submodule "openlibm"]
path = openlibm
url = https://gitlab.redox-os.org/redox-os/openlibm.git
[submodule "ralloc"]
path = ralloc
url = https://gitlab.redox-os.org/redox-os/ralloc.git
[submodule "posix-regex"]
path = posix-regex
url = https://gitlab.redox-os.org/redox-os/posix-regex.git
Generated
+2 -31
View File
@@ -133,22 +133,6 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "ralloc"
version = "1.0.0"
dependencies = [
"ralloc_shim",
"unborrow",
]
[[package]]
name = "ralloc_shim"
version = "0.1.1"
dependencies = [
"redox_syscall 0.1.57",
"sc",
]
[[package]]
name = "rand"
version = "0.7.3"
@@ -211,15 +195,9 @@ version = "0.1.0"
dependencies = [
"goblin",
"plain",
"redox_syscall 0.4.1",
"redox_syscall",
]
[[package]]
name = "redox_syscall"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]]
name = "redox_syscall"
version = "0.4.1"
@@ -242,12 +220,11 @@ dependencies = [
"memoffset",
"plain",
"posix-regex",
"ralloc",
"rand",
"rand_jitter",
"rand_xorshift",
"redox-exec",
"redox_syscall 0.4.1",
"redox_syscall",
"sc",
"unicode-width",
]
@@ -289,12 +266,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "unborrow"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e92e959f029e4f8ee25d70d15ab58d2b46f98a17bc238b9265ff0c26f6f3d67f"
[[package]]
name = "unicode-ident"
version = "1.0.12"
+1 -6
View File
@@ -10,7 +10,7 @@ crate-type = ["staticlib"]
[workspace]
members = ["src/crt0", "src/crti", "src/crtn", "src/ld_so", "src/platform/redox/redox-exec"]
exclude = ["ralloc", "tests", "dlmalloc-rs"]
exclude = ["tests", "dlmalloc-rs"]
[build-dependencies]
cc = "1"
@@ -36,11 +36,6 @@ version = "0.7"
default-features = false
features = ["elf32", "elf64", "endian_fd"]
[dependencies.ralloc]
path = "ralloc"
default-features = false
optional = true
[dependencies.dlmalloc]
path = "dlmalloc-rs"
default-features = false
Submodule ralloc deleted from f9b8c35fe8
-50
View File
@@ -1,50 +0,0 @@
extern crate ralloc;
pub use ralloc::Allocator;
pub const NEWALLOCATOR: Allocator = Allocator;
unsafe fn alloc_inner(size: usize, offset: usize, align: usize) -> *mut c_void {
let ptr = ralloc::alloc(size + offset, align);
if !ptr.is_null() {
*(ptr as *mut u64) = (size + offset) as u64;
*(ptr as *mut u64).offset(1) = align as u64;
ptr.offset(offset as isize) as *mut c_void
} else {
ptr as *mut c_void
}
}
pub unsafe fn alloc(size: usize) -> *mut c_void {
alloc_inner(size, 16, 8)
}
pub unsafe fn alloc_align(size: usize, alignment: usize) -> *mut c_void {
let mut align = 32;
while align <= alignment {
align *= 2;
}
alloc_inner(size, align / 2, align)
}
pub unsafe fn realloc(ptr: *mut c_void, size: size_t) -> *mut c_void {
let old_ptr = (ptr as *mut u8).offset(-16);
let old_size = *(old_ptr as *mut u64);
let align = *(old_ptr as *mut u64).offset(1);
let ptr = ralloc::realloc(old_ptr, old_size as usize, size + 16, align as usize);
if !ptr.is_null() {
*(ptr as *mut u64) = (size + 16) as u64;
*(ptr as *mut u64).offset(1) = align;
ptr.offset(16) as *mut c_void
} else {
ptr as *mut c_void
}
}
pub unsafe fn free(ptr: *mut c_void) {
let ptr = (ptr as *mut u8).offset(-16);
let size = *(ptr as *mut u64);
let _align = *(ptr as *mut u64).offset(1);
ralloc::free(ptr, size as usize);
}
-6
View File
@@ -4,12 +4,6 @@ use core::{fmt, ptr};
pub use self::allocator::*;
#[cfg(not(feature = "ralloc"))]
#[path = "allocator/dlmalloc/mod.rs"]
mod allocator;
#[cfg(feature = "ralloc")]
#[path = "allocator/ralloc.rs"]
mod allocator;
pub use self::pal::{Pal, PalEpoll, PalPtrace, PalSignal, PalSocket};