change raw_vec to raw_block to avoid clashes with liballoc package
This commit is contained in:
@@ -19,7 +19,7 @@ pub mod machine_errors;
|
||||
pub mod machine_indices;
|
||||
pub(super) mod machine_state;
|
||||
pub mod modules;
|
||||
mod raw_vec;
|
||||
mod raw_block;
|
||||
mod stack;
|
||||
pub(super) mod term_expansion;
|
||||
pub mod toplevel;
|
||||
|
||||
@@ -4,32 +4,32 @@ use std::alloc;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
pub(crate) trait RawVecTraits {
|
||||
pub(crate) trait RawBlockTraits {
|
||||
fn init_size() -> usize;
|
||||
fn align() -> usize;
|
||||
fn base_offset(base: *const u8) -> *const u8;
|
||||
}
|
||||
|
||||
pub(crate) struct RawVec<T: RawVecTraits> {
|
||||
pub(crate) struct RawBlock<T: RawBlockTraits> {
|
||||
pub(crate) size: usize,
|
||||
pub(crate) base: *const u8,
|
||||
pub(crate) top: *const u8,
|
||||
_marker: PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T: RawVecTraits> RawVec<T> {
|
||||
impl<T: RawBlockTraits> RawBlock<T> {
|
||||
pub(crate)
|
||||
fn new() -> Self {
|
||||
let mut vec = RawVec { size: 0,
|
||||
base: ptr::null(),
|
||||
top: ptr::null(),
|
||||
_marker: PhantomData };
|
||||
let mut block = RawBlock { size: 0,
|
||||
base: ptr::null(),
|
||||
top: ptr::null(),
|
||||
_marker: PhantomData };
|
||||
|
||||
unsafe {
|
||||
vec.grow();
|
||||
block.grow();
|
||||
}
|
||||
|
||||
vec
|
||||
block
|
||||
}
|
||||
|
||||
pub(crate)
|
||||
@@ -51,8 +51,8 @@ impl<T: RawVecTraits> RawVec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
fn empty_vec() -> Self {
|
||||
RawVec { size: 0,
|
||||
fn empty_block() -> Self {
|
||||
RawBlock { size: 0,
|
||||
base: ptr::null(),
|
||||
top: ptr::null(),
|
||||
_marker: PhantomData }
|
||||
@@ -61,7 +61,7 @@ impl<T: RawVecTraits> RawVec<T> {
|
||||
#[inline]
|
||||
pub(crate)
|
||||
fn take(&mut self) -> Self {
|
||||
mem::replace(self, Self::empty_vec())
|
||||
mem::replace(self, Self::empty_block())
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::prolog::machine::machine_indices::*;
|
||||
use crate::prolog::machine::raw_vec::*;
|
||||
use crate::prolog::machine::raw_block::*;
|
||||
|
||||
use core::marker::PhantomData;
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::ptr;
|
||||
|
||||
struct StackTraits {}
|
||||
|
||||
impl RawVecTraits for StackTraits {
|
||||
impl RawBlockTraits for StackTraits {
|
||||
#[inline]
|
||||
fn init_size() -> usize {
|
||||
10 * 1024 * 1024
|
||||
@@ -36,7 +36,7 @@ const fn prelude_size<Prelude>() -> usize {
|
||||
}
|
||||
|
||||
pub struct Stack {
|
||||
buf: RawVec<StackTraits>,
|
||||
buf: RawBlock<StackTraits>,
|
||||
_marker: PhantomData<Addr>,
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ impl OrFrame {
|
||||
|
||||
impl Stack {
|
||||
pub fn new() -> Self {
|
||||
Stack { buf: RawVec::new(), _marker: PhantomData }
|
||||
Stack { buf: RawBlock::new(), _marker: PhantomData }
|
||||
}
|
||||
|
||||
pub fn allocate_and_frame(&mut self, num_cells: usize) -> usize {
|
||||
@@ -215,7 +215,7 @@ impl Stack {
|
||||
|
||||
let e = self.buf.top as usize - self.buf.base as usize;
|
||||
self.buf.top = new_top;
|
||||
|
||||
|
||||
e
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user