]> Repositorios git - scryer-prolog.git/commitdiff
change raw_vec to raw_block to avoid clashes with liballoc package
authorMark Thom <[email protected]>
Fri, 14 Feb 2020 03:05:46 +0000 (20:05 -0700)
committerMark Thom <[email protected]>
Fri, 14 Feb 2020 03:05:46 +0000 (20:05 -0700)
src/prolog/machine/mod.rs
src/prolog/machine/raw_block.rs [moved from src/prolog/machine/raw_vec.rs with 81% similarity]
src/prolog/machine/stack.rs

index 7eda2eea4f060295d2d2a36d6b0a566f559537eb..d2abfef242953906eed1b0d8e15c545f19bae254 100644 (file)
@@ -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;
similarity index 81%
rename from src/prolog/machine/raw_vec.rs
rename to src/prolog/machine/raw_block.rs
index f482dfa405c2fd1dae8b551b3abe03943064719a..3539425ff8e485226df399f98c26fbf5ac8ea786 100644 (file)
@@ -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())
     }
 
 
index 5dca3cee34260391fc7f020500f6b542d93584e2..2916b27b4e7d682c77c05ac4f2db93a21d5d180e 100644 (file)
@@ -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
         }
     }