diff --git a/fix/parser/src/lib.rs b/fix/parser/src/lib.rs index f0993939..8bd263f8 100644 --- a/fix/parser/src/lib.rs +++ b/fix/parser/src/lib.rs @@ -16,8 +16,8 @@ use parser::Parser; num_memories!(48); num_tables!(24); -#[fix_entrypoint] -pub fn _fixpoint_apply(combination: RustHandle<'static>) -> Result, FixError> { +#[procedure_entrypoint] +pub fn _fixpoint_apply(combination: RustHandle<'static>) -> Result, Error> { let arguments = combination.to_entries()?; let source_handle = arguments.get(1).expect("expected source"); diff --git a/fix/parser/src/parser.rs b/fix/parser/src/parser.rs index 22df22ed..14fb50d5 100644 --- a/fix/parser/src/parser.rs +++ b/fix/parser/src/parser.rs @@ -14,7 +14,7 @@ impl Parser { pub fn new( tokens: Vec, environment_handle: &RustHandle<'static>, - ) -> Result { + ) -> Result { let mut environment = BTreeMap::new(); for entry in environment_handle.to_entries()? { let entry = entry.to_entries()?; @@ -34,13 +34,13 @@ impl Parser { }) } - pub fn parse_program(&mut self) -> Result, FixError> { + pub fn parse_program(&mut self) -> Result, Error> { let handle = self.parse_expr()?; self.expect(&Token::Eof, "expected end of program"); Ok(handle) } - fn parse_expr(&mut self) -> Result, FixError> { + fn parse_expr(&mut self) -> Result, Error> { Ok(match self.advance() { Token::String(string) => RustHandle::from_bytes(string.as_bytes())?, Token::Bytes(bytes) => RustHandle::from_bytes(&bytes)?, @@ -68,7 +68,7 @@ impl Parser { }) } - fn parse_handles(&mut self, close: &Token) -> Result>, FixError> { + fn parse_handles(&mut self, close: &Token) -> Result>, Error> { let mut handles = Vec::new(); while !self.matches(close) { handles.push(self.parse_expr()?); @@ -76,7 +76,7 @@ impl Parser { Ok(handles) } - fn parse_let(&mut self) -> Result, FixError> { + fn parse_let(&mut self) -> Result, Error> { self.expect(&Token::LParen, "expected '(' for let bindings"); let outer_context = self.context.clone(); while self.matches(&Token::LParen) { diff --git a/fix/postprocessor/src/lib.rs b/fix/postprocessor/src/lib.rs index 26e26765..54b02581 100644 --- a/fix/postprocessor/src/lib.rs +++ b/fix/postprocessor/src/lib.rs @@ -19,7 +19,7 @@ pub fn process(wasm: &[u8]) -> Result> { RoundtripReencoder.parse_memory_section(&mut memories, section)?; memory_section = Some(memories); } - Payload::CustomSection(section) if section.name() == "num_fix_memories" => { + Payload::CustomSection(section) if section.name() == "wasm_num_memories" => { num_memories = u32::from_le_bytes(section.data().try_into()?); } // Don't change other sections diff --git a/fix/utils/build.rs b/fix/utils/build.rs index 2576ac6d..db5a77aa 100644 --- a/fix/utils/build.rs +++ b/fix/utils/build.rs @@ -1,11 +1,11 @@ fn main() { - println!("cargo::rerun-if-changed=src/fixpoint.h"); - println!("cargo::rerun-if-changed=src/fixpoint.c"); + println!("cargo::rerun-if-changed=src/utils.h"); + println!("cargo::rerun-if-changed=src/utils.c"); cc::Build::new() - .file("src/fixpoint.c") + .file("src/utils.c") .include("src") .flag("-mreference-types") .opt_level(2) - .compile("fixpoint"); + .compile("fixutils"); } diff --git a/fix/utils/src/lib.rs b/fix/utils/src/lib.rs index a26ec2c9..8621e602 100644 --- a/fix/utils/src/lib.rs +++ b/fix/utils/src/lib.rs @@ -11,7 +11,7 @@ use core::marker::PhantomData; use fixhandle::{ BitPack, Blob, BlobName, Encode, Handle, Object, RawName, Ref, Thunk, Tree, TreeName, }; -pub use macros::{fix_entrypoint, num_memories, num_tables}; +pub use macros::{num_memories, num_tables, procedure_entrypoint}; pub mod memory; pub mod table; @@ -20,9 +20,9 @@ pub use memory::*; pub use table::*; #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum FixError { - AllOcuppied, // All memories/tables occupied - Unavailable, // Resource unavilable +pub enum Error { + AllOccupied, // All memories/tables occupied + Unavailable, // Resource unavailable GrowFailed, // Memory/Table growth failed OutOfBounds, // Memory/Table access out of bounds } @@ -70,26 +70,26 @@ impl<'a> RustHandle<'a> { } pub fn len(&self) -> usize { - unsafe { fix_len(&self.raw_handle) } + unsafe { util_len(&self.raw_handle) } } pub fn is_empty(&self) -> bool { self.len() == 0 } - pub fn from_bytes(bytes: &[u8]) -> Result { + pub fn from_bytes(bytes: &[u8]) -> Result { Memory::from_bytes(bytes)?.to_blob(bytes.len()) } - pub fn from_entries(entries: &[RustHandle<'_>]) -> Result { + pub fn from_entries(entries: &[RustHandle<'_>]) -> Result { Table::from_entries(entries)?.to_tree(entries.len()) } - pub fn to_bytes(&self) -> Result, FixError> { + pub fn to_bytes(&self) -> Result, Error> { Memory::from_blob(*self)?.to_bytes(self.len()) } - pub fn to_entries(&self) -> Result>, FixError> { + pub fn to_entries(&self) -> Result>, Error> { Table::from_tree(*self)?.to_entries(self.len()) } } @@ -130,16 +130,17 @@ pub fn create_shallow_encode<'a>(handle: RustHandle<'a>) -> RustHandle<'a> { } unsafe extern "C" { - pub fn fix_memory_read(memory_index: u32, destination: u32, length: usize); - pub fn fix_memory_write(memory_index: u32, source: u32, length: usize); - pub fn fix_memory_size(memory_index: u32) -> usize; - pub fn fix_memory_grow(memory_index: u32, num_pages: usize) -> usize; - - pub fn fix_table_size(table_index: u32) -> usize; - pub fn fix_table_grow(table_index: u32, entries: usize) -> usize; - - pub fn fix_attach_blob(memory_index: u32, handle: *const [u8; 32]); - pub fn fix_attach_tree(table_index: u32, handle: *const [u8; 32]); - pub fn fix_len(handle: *const [u8; 32]) -> usize; - pub fn fix_table_set(table_index: u32, entry_index: usize, handle: *const [u8; 32]); + // Defined with inline assembly + pub fn wasm_memory_read(memory_index: u32, destination: u32, length: usize); + pub fn wasm_memory_write(memory_index: u32, source: u32, length: usize); + pub fn wasm_memory_size(memory_index: u32) -> usize; + pub fn wasm_memory_grow(memory_index: u32, num_pages: usize) -> usize; + + pub fn wasm_table_size(table_index: u32) -> usize; + pub fn wasm_table_grow(table_index: u32, entries: usize) -> usize; + + pub fn util_attach_blob(memory_index: u32, handle: *const [u8; 32]); + pub fn util_attach_tree(table_index: u32, handle: *const [u8; 32]); + pub fn util_len(handle: *const [u8; 32]) -> usize; + pub fn util_table_set(table_index: u32, entry_index: usize, handle: *const [u8; 32]); } diff --git a/fix/utils/src/memory.rs b/fix/utils/src/memory.rs index a672e337..a803458d 100644 --- a/fix/utils/src/memory.rs +++ b/fix/utils/src/memory.rs @@ -1,24 +1,12 @@ use crate::*; unsafe extern "C" { - fn fix_allocate_memory(index: u16) -> *mut Memory; - static FIX_NUM_MEMORIES: u16; + fn util_allocate_memory(index: u16) -> *mut Memory; + static UTIL_NUM_MEMORIES: u16; } static mut POSITION: u16 = 0; const PAGE_SIZE: usize = 65536; -pub fn fix_next_memory() -> Result<&'static mut Memory, FixError> { - unsafe { - while POSITION < FIX_NUM_MEMORIES { - POSITION += 1; - if let Ok(memory) = Memory::new(POSITION) { - return Ok(memory); - } - } - } - Err(FixError::AllOcuppied) -} - #[repr(transparent)] pub struct Memory(u16); @@ -26,16 +14,28 @@ impl Memory { #[doc(hidden)] pub const EMPTY: Self = Self(0); - pub fn new(index: u16) -> Result<&'static mut Self, FixError> { - let slot = unsafe { fix_allocate_memory(index) }; + pub fn new(index: u16) -> Result<&'static mut Self, Error> { + let slot = unsafe { util_allocate_memory(index) }; if slot.is_null() { - return Err(FixError::Unavailable); + return Err(Error::Unavailable); } let memory = unsafe { &mut *slot }; memory.0 = index; Ok(memory) } + pub fn next() -> Result<&'static mut Self, Error> { + unsafe { + while POSITION < UTIL_NUM_MEMORIES { + POSITION += 1; + if let Ok(memory) = Memory::new(POSITION) { + return Ok(memory); + } + } + } + Err(Error::AllOccupied) + } + /// Calls the fixshell's create_blob function when resolved. /// Borrows the memory until the handle is consumed. /// @@ -55,7 +55,7 @@ impl Memory { /// The `destination` slice's length must be <= size() * PAGE_SIZE pub unsafe fn read(&self, destination: &mut [u8]) { unsafe { - fix_memory_read( + wasm_memory_read( self.0 as u32, destination.as_mut_ptr() as u32, destination.len(), @@ -69,7 +69,7 @@ impl Memory { /// /// The `source` slice's length must be <= size() * PAGE_SIZE pub unsafe fn write(&mut self, source: &[u8]) { - unsafe { fix_memory_write(self.0 as u32, source.as_ptr() as u32, source.len()) } + unsafe { wasm_memory_write(self.0 as u32, source.as_ptr() as u32, source.len()) } } /// Calls the fixshell's attach_blob after resolving the provided `handle` @@ -78,51 +78,51 @@ impl Memory { /// /// `handle` must refer to a blob pub unsafe fn attach_blob(&mut self, handle: RustHandle<'_>) { - unsafe { fix_attach_blob(self.0 as u32, &handle.raw_handle) } + unsafe { util_attach_blob(self.0 as u32, &handle.raw_handle) } } pub fn size(&self) -> usize { - unsafe { fix_memory_size(self.0 as u32) } + unsafe { wasm_memory_size(self.0 as u32) } } pub fn grow(&mut self, num_pages: usize) -> usize { - unsafe { fix_memory_grow(self.0 as u32, num_pages) } + unsafe { wasm_memory_grow(self.0 as u32, num_pages) } } - pub fn from_bytes(bytes: &[u8]) -> Result<&'static mut Self, FixError> { - let memory = fix_next_memory()?; + pub fn from_bytes(bytes: &[u8]) -> Result<&'static mut Self, Error> { + let memory = Memory::next()?; let mapped = memory.size(); let required = bytes.len().div_ceil(PAGE_SIZE); if required > mapped && memory.grow(required - mapped) == usize::MAX { - return Err(FixError::GrowFailed); + return Err(Error::GrowFailed); } unsafe { memory.write(bytes) }; Ok(memory) } - pub fn from_blob(handle: RustHandle<'_>) -> Result<&'static mut Self, FixError> { - let memory = fix_next_memory()?; + pub fn from_blob(handle: RustHandle<'_>) -> Result<&'static mut Self, Error> { + let memory = Memory::next()?; let mapped = memory.size(); let required = handle.len().div_ceil(PAGE_SIZE); if required > mapped && memory.grow(required - mapped) == usize::MAX { - return Err(FixError::GrowFailed); + return Err(Error::GrowFailed); } unsafe { memory.attach_blob(handle) }; Ok(memory) } - pub fn to_bytes(&self, length: usize) -> Result, FixError> { + pub fn to_bytes(&self, length: usize) -> Result, Error> { if length > self.size() * PAGE_SIZE { - return Err(FixError::OutOfBounds); + return Err(Error::OutOfBounds); } let mut bytes = alloc::vec![0; length]; unsafe { self.read(&mut bytes) }; Ok(bytes) } - pub fn to_blob(&self, length: usize) -> Result, FixError> { + pub fn to_blob(&self, length: usize) -> Result, Error> { if length > self.size() * PAGE_SIZE { - return Err(FixError::OutOfBounds); + return Err(Error::OutOfBounds); } Ok(unsafe { self.create_blob(length) }) } diff --git a/fix/utils/src/table.rs b/fix/utils/src/table.rs index 61bb7e6b..04e7f7ee 100644 --- a/fix/utils/src/table.rs +++ b/fix/utils/src/table.rs @@ -1,23 +1,11 @@ use crate::*; unsafe extern "C" { - fn fix_allocate_table(index: u16) -> *mut Table; - static FIX_NUM_TABLES: u16; + fn util_allocate_table(index: u16) -> *mut Table; + static UTIL_NUM_TABLES: u16; } static mut POSITION: u16 = 0; -pub fn fix_next_table() -> Result<&'static mut Table, FixError> { - unsafe { - while POSITION < FIX_NUM_TABLES { - POSITION += 1; - if let Ok(table) = Table::new(POSITION) { - return Ok(table); - } - } - } - Err(FixError::AllOcuppied) -} - #[repr(transparent)] pub struct Table(u16); @@ -25,16 +13,28 @@ impl Table { #[doc(hidden)] pub const EMPTY: Self = Self(0); - pub fn new(index: u16) -> Result<&'static mut Self, FixError> { - let slot = unsafe { fix_allocate_table(index) }; + pub fn new(index: u16) -> Result<&'static mut Self, Error> { + let slot = unsafe { util_allocate_table(index) }; if slot.is_null() { - return Err(FixError::Unavailable); + return Err(Error::Unavailable); } let table = unsafe { &mut *slot }; table.0 = index; Ok(table) } + pub fn next() -> Result<&'static mut Self, Error> { + unsafe { + while POSITION < UTIL_NUM_TABLES { + POSITION += 1; + if let Ok(table) = Table::new(POSITION) { + return Ok(table); + } + } + } + Err(Error::AllOccupied) + } + /// Calls the fixshell's create_tree function when resolved. /// Borrows the table until the handle is consumed /// @@ -64,7 +64,7 @@ impl Table { /// /// `entry` must be < size() pub unsafe fn set(&mut self, entry: usize, handle: RustHandle<'_>) { - unsafe { fix_table_set(self.0 as u32, entry, &handle.raw_handle) } + unsafe { util_table_set(self.0 as u32, entry, &handle.raw_handle) } } /// Calls the fixshell's attach_tree after resolving the provided `handle` @@ -73,23 +73,23 @@ impl Table { /// /// `handle` must refer to a tree pub unsafe fn attach_tree(&mut self, handle: RustHandle<'_>) { - unsafe { fix_attach_tree(self.0 as u32, &handle.raw_handle) } + unsafe { util_attach_tree(self.0 as u32, &handle.raw_handle) } } pub fn size(&self) -> usize { - unsafe { fix_table_size(self.0 as u32) } + unsafe { wasm_table_size(self.0 as u32) } } pub fn grow(&mut self, entries: usize) -> usize { - unsafe { fix_table_grow(self.0 as u32, entries) } + unsafe { wasm_table_grow(self.0 as u32, entries) } } - pub fn from_entries(entries: &[RustHandle<'_>]) -> Result<&'static mut Self, FixError> { - let table = fix_next_table()?; + pub fn from_entries(entries: &[RustHandle<'_>]) -> Result<&'static mut Self, Error> { + let table = Table::next()?; let mapped = table.size(); let required = entries.len(); if required > mapped && table.grow(required - mapped) == usize::MAX { - return Err(FixError::GrowFailed); + return Err(Error::GrowFailed); } for (entry, handle) in entries.iter().enumerate() { unsafe { table.set(entry, *handle) }; @@ -97,20 +97,20 @@ impl Table { Ok(table) } - pub fn from_tree(handle: RustHandle<'_>) -> Result<&'static mut Self, FixError> { - let table = fix_next_table()?; + pub fn from_tree(handle: RustHandle<'_>) -> Result<&'static mut Self, Error> { + let table = Table::next()?; let mapped = table.size(); let required = handle.len(); if required > mapped && table.grow(required - mapped) == usize::MAX { - return Err(FixError::GrowFailed); + return Err(Error::GrowFailed); } unsafe { table.attach_tree(handle) }; Ok(table) } - pub fn to_entries(&self, length: usize) -> Result>, FixError> { + pub fn to_entries(&self, length: usize) -> Result>, Error> { if self.size() < length { - return Err(FixError::OutOfBounds); + return Err(Error::OutOfBounds); } let mut entries = Vec::with_capacity(length); for entry in 0..length { @@ -119,9 +119,9 @@ impl Table { Ok(entries) } - pub fn to_tree(&self, length: usize) -> Result, FixError> { + pub fn to_tree(&self, length: usize) -> Result, Error> { if self.size() < length { - return Err(FixError::OutOfBounds); + return Err(Error::OutOfBounds); } Ok(unsafe { self.create_tree(length) }) } diff --git a/fix/utils/src/fixpoint.c b/fix/utils/src/utils.c similarity index 80% rename from fix/utils/src/fixpoint.c rename to fix/utils/src/utils.c index 97467274..344bc84c 100644 --- a/fix/utils/src/fixpoint.c +++ b/fix/utils/src/utils.c @@ -1,4 +1,4 @@ -#include "fixpoint.h" +#include "utils.h" static externref __attribute__((address_space(1))) combination_global; @@ -24,7 +24,7 @@ static externref resolve(const struct RustHandle* handle) { switch (PRODUCER_TAG(handle->meta)) { case COMBINATION: value = combination_global; break; - case TABLE_GET: value = fixpoint_table_get(handle->index, handle->entry); break; + case TABLE_GET: value = wasm_table_get(handle->index, handle->entry); break; case CREATE_BLOB: value = fixpoint_create_blob(handle->index, handle->entry); break; case CREATE_TREE: value = fixpoint_create_tree(handle->index, handle->entry); break; default: __builtin_unreachable(); @@ -39,20 +39,20 @@ static externref resolve(const struct RustHandle* handle) { } } -void fix_attach_blob(uint32_t memory_index, const struct RustHandle* handle) { +void util_attach_blob(uint32_t memory_index, const struct RustHandle* handle) { fixpoint_attach_blob(memory_index, resolve(handle)); } -void fix_attach_tree(uint32_t table_index, const struct RustHandle* handle) { +void util_attach_tree(uint32_t table_index, const struct RustHandle* handle) { fixpoint_attach_tree(table_index, resolve(handle)); } -uint32_t fix_len(const struct RustHandle* handle) { +uint32_t util_len(const struct RustHandle* handle) { return fixpoint_len(resolve(handle)); } -void fix_table_set(uint32_t table_index, uint32_t entry_index, const struct RustHandle* handle) { - fixpoint_table_set(table_index, entry_index, resolve(handle)); +void util_table_set(uint32_t table_index, uint32_t entry_index, const struct RustHandle* handle) { + wasm_table_set(table_index, entry_index, resolve(handle)); } static const struct RustHandle combination = { diff --git a/fix/utils/src/fixpoint.h b/fix/utils/src/utils.h similarity index 89% rename from fix/utils/src/fixpoint.h rename to fix/utils/src/utils.h index b96f0374..f3b924b9 100644 --- a/fix/utils/src/fixpoint.h +++ b/fix/utils/src/utils.h @@ -1,5 +1,5 @@ -#ifndef FIX_UTILS -#define FIX_UTILS +#ifndef FIXUTILS_H +#define FIXUTILS_H #include typedef __externref_t externref; @@ -32,6 +32,7 @@ enum encode { #define ENCODE_TAG(meta) (((meta) >> 9) & 0x1) #define THUNK_TAG(meta) (((meta) >> 7) & 0x3) +// Shares the shape of RawName from fixhandle. Todo: parameterize out 24 byte name field struct RustHandle { uint8_t name[24]; union { @@ -77,8 +78,8 @@ extern void fixpoint_attach_tree(uint32_t table_index, externref handle); __attribute__((import_module("fixpoint"), import_name("len"))) extern uint32_t fixpoint_len(externref handle); -extern externref fixpoint_table_get(uint32_t table_index, uint32_t entry_index); -extern void fixpoint_table_set(uint32_t table_index, uint32_t entry_index, externref value); +extern externref wasm_table_get(uint32_t table_index, uint32_t entry_index); +extern void wasm_table_set(uint32_t table_index, uint32_t entry_index, externref value); extern struct RustHandle _fixpoint_apply_inner(struct RustHandle combination); -#endif \ No newline at end of file +#endif diff --git a/macros/src/fix_utils.rs b/macros/src/fixutils.rs similarity index 81% rename from macros/src/fix_utils.rs rename to macros/src/fixutils.rs index d4e75189..805e0234 100644 --- a/macros/src/fix_utils.rs +++ b/macros/src/fixutils.rs @@ -20,18 +20,18 @@ fn memory_asm(count: usize) -> String { let mut asm = String::new(); for (name, signature, body) in [ ( - "fix_memory_read", + "wasm_memory_read", "(i32, i32, i32) -> ()", "local.get 1\ni32.const 0\nlocal.get 2\nmemory.copy 0, {}", ), ( - "fix_memory_write", + "wasm_memory_write", "(i32, i32, i32) -> ()", "i32.const 0\nlocal.get 1\nlocal.get 2\nmemory.copy {}, 0", ), - ("fix_memory_size", "(i32) -> (i32)", "memory.size {}"), + ("wasm_memory_size", "(i32) -> (i32)", "memory.size {}"), ( - "fix_memory_grow", + "wasm_memory_grow", "(i32, i32) -> (i32)", "local.get 1\nmemory.grow {}", ), @@ -47,7 +47,7 @@ fn memory_asm(count: usize) -> String { asm += "unreachable\nend_function\n"; } // Number of memories encoded in custom section - asm + &format!(".section .custom_section.num_fix_memories,\"\",@\n.int32 {count}\n") + asm + &format!(".section .custom_section.wasm_num_memories,\"\",@\n.int32 {count}\n") } fn table_asm(count: usize) -> String { @@ -55,29 +55,29 @@ fn table_asm(count: usize) -> String { // Tables for index in 1..=count { asm += &format!( - ".section .text.fix_table_{index},\"\",@\n.globl fix_table_{index}\n.tabletype fix_table_{index}, externref\nfix_table_{index}:\n" + ".section .text.wasm_table_{index},\"\",@\n.globl wasm_table_{index}\n.tabletype wasm_table_{index}, externref\nwasm_table_{index}:\n" ); } for (name, signature, body) in [ ( - "fixpoint_table_get", + "wasm_table_get", "(i32, i32) -> (externref)", - "local.get 1\ntable.get fix_table_{}", + "local.get 1\ntable.get wasm_table_{}", ), ( - "fixpoint_table_set", + "wasm_table_set", "(i32, i32, externref) -> ()", - "local.get 1\nlocal.get 2\ntable.set fix_table_{}", + "local.get 1\nlocal.get 2\ntable.set wasm_table_{}", ), ( - "fix_table_size", + "wasm_table_size", "(i32) -> (i32)", - "table.size fix_table_{}", + "table.size wasm_table_{}", ), ( - "fix_table_grow", + "wasm_table_grow", "(i32, i32) -> (i32)", - "ref.null_extern\nlocal.get 1\ntable.grow fix_table_{}", + "ref.null_extern\nlocal.get 1\ntable.grow wasm_table_{}", ), ] { asm += &format!( @@ -102,11 +102,11 @@ pub fn num_memories(input: TokenStream) -> TokenStream { quote! { #[doc(hidden)] #[unsafe(no_mangle)] - pub static FIX_NUM_MEMORIES: u16 = #count as u16; + pub static UTIL_NUM_MEMORIES: u16 = #count as u16; #[doc(hidden)] #[unsafe(no_mangle)] - pub extern "C" fn fix_allocate_memory(index: u16) -> *mut ::fixutils::Memory { + pub extern "C" fn util_allocate_memory(index: u16) -> *mut ::fixutils::Memory { use ::core::sync::atomic::{AtomicBool, Ordering}; const COUNT: usize = #count; @@ -135,11 +135,11 @@ pub fn num_tables(input: TokenStream) -> TokenStream { quote! { #[doc(hidden)] #[unsafe(no_mangle)] - pub static FIX_NUM_TABLES: u16 = #count as u16; + pub static UTIL_NUM_TABLES: u16 = #count as u16; #[doc(hidden)] #[unsafe(no_mangle)] - pub extern "C" fn fix_allocate_table(index: u16) -> *mut ::fixutils::Table { + pub extern "C" fn util_allocate_table(index: u16) -> *mut ::fixutils::Table { use ::core::sync::atomic::{AtomicBool, Ordering}; const COUNT: usize = #count; diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 9e458edc..f6315fa5 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -2,7 +2,7 @@ use proc_macro::TokenStream; mod bitpack; mod core_local; -mod fix_utils; +mod fixutils; mod testing; mod util; @@ -42,16 +42,16 @@ pub fn bitpack(input: TokenStream) -> TokenStream { } #[proc_macro_attribute] -pub fn fix_entrypoint(attr: TokenStream, item: TokenStream) -> TokenStream { - fix_utils::entrypoint(attr, item) +pub fn procedure_entrypoint(attr: TokenStream, item: TokenStream) -> TokenStream { + fixutils::entrypoint(attr, item) } #[proc_macro] pub fn num_memories(input: TokenStream) -> TokenStream { - fix_utils::num_memories(input) + fixutils::num_memories(input) } #[proc_macro] pub fn num_tables(input: TokenStream) -> TokenStream { - fix_utils::num_tables(input) + fixutils::num_tables(input) }