@@ -3,7 +3,7 @@
|
||||
//! TODO: opportunities for better code generation:
|
||||
//!
|
||||
//! - Smarter use of addressing modes. Recognize a+SCALE*b patterns; recognize
|
||||
//! and incorporate sign/zero extension on indicies. Recognize pre/post-index
|
||||
//! and incorporate sign/zero extension on indices. Recognize pre/post-index
|
||||
//! opportunities.
|
||||
//!
|
||||
//! - Floating-point immediates (FIMM instruction).
|
||||
|
||||
@@ -39,7 +39,7 @@ struct Position {
|
||||
}
|
||||
|
||||
/// Mapping of continuous range of source location to its generated
|
||||
/// code. The positions are always in accending order for search.
|
||||
/// code. The positions are always in ascending order for search.
|
||||
#[derive(Debug)]
|
||||
struct Range {
|
||||
wasm_start: WasmAddress,
|
||||
@@ -226,7 +226,7 @@ fn build_function_addr_map(
|
||||
// The iterator returns generated addresses sorted by RangeIndex.
|
||||
struct TransformRangeStartIter<'a> {
|
||||
addr: WasmAddress,
|
||||
indicies: &'a [RangeIndex],
|
||||
indices: &'a [RangeIndex],
|
||||
ranges: &'a [Range],
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ impl<'a> TransformRangeStartIter<'a> {
|
||||
if let Some(range_indices) = found {
|
||||
TransformRangeStartIter {
|
||||
addr,
|
||||
indicies: range_indices,
|
||||
indices: range_indices,
|
||||
ranges: &func.lookup.ranges,
|
||||
}
|
||||
} else {
|
||||
@@ -261,10 +261,10 @@ impl<'a> TransformRangeStartIter<'a> {
|
||||
impl<'a> Iterator for TransformRangeStartIter<'a> {
|
||||
type Item = (GeneratedAddress, RangeIndex);
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
if let Some((first, tail)) = self.indicies.split_first() {
|
||||
if let Some((first, tail)) = self.indices.split_first() {
|
||||
let range_index = *first;
|
||||
let range = &self.ranges[range_index];
|
||||
self.indicies = tail;
|
||||
self.indices = tail;
|
||||
let address = match range
|
||||
.positions
|
||||
.binary_search_by(|a| a.wasm_pos.cmp(&self.addr))
|
||||
@@ -289,7 +289,7 @@ impl<'a> Iterator for TransformRangeStartIter<'a> {
|
||||
// The iterator returns generated addresses sorted by RangeIndex.
|
||||
struct TransformRangeEndIter<'a> {
|
||||
addr: WasmAddress,
|
||||
indicies: &'a [RangeIndex],
|
||||
indices: &'a [RangeIndex],
|
||||
ranges: &'a [Range],
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ impl<'a> TransformRangeEndIter<'a> {
|
||||
if let Some(range_indices) = found {
|
||||
TransformRangeEndIter {
|
||||
addr,
|
||||
indicies: range_indices,
|
||||
indices: range_indices,
|
||||
ranges: &func.lookup.ranges,
|
||||
}
|
||||
} else {
|
||||
@@ -324,10 +324,10 @@ impl<'a> TransformRangeEndIter<'a> {
|
||||
impl<'a> Iterator for TransformRangeEndIter<'a> {
|
||||
type Item = (GeneratedAddress, RangeIndex);
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
while let Some((first, tail)) = self.indicies.split_first() {
|
||||
while let Some((first, tail)) = self.indices.split_first() {
|
||||
let range_index = *first;
|
||||
let range = &self.ranges[range_index];
|
||||
self.indicies = tail;
|
||||
self.indices = tail;
|
||||
if range.wasm_start >= self.addr {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ impl ExecutableModule {
|
||||
) -> Result<T, ExecutionError> {
|
||||
let module = &self.module;
|
||||
|
||||
if func_idx as usize >= module.ctx.func_ty_indicies.len() {
|
||||
if func_idx as usize >= module.ctx.func_ty_indices.len() {
|
||||
return Err(ExecutionError::FuncIndexOutOfBounds);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ impl VmCtx {
|
||||
#[derive(Default, Debug)]
|
||||
pub struct SimpleContext {
|
||||
types: Vec<FuncType>,
|
||||
func_ty_indicies: Vec<u32>,
|
||||
func_ty_indices: Vec<u32>,
|
||||
}
|
||||
|
||||
pub const WASM_PAGE_SIZE: usize = 65_536;
|
||||
@@ -393,7 +393,7 @@ impl ModuleContext for SimpleContext {
|
||||
}
|
||||
|
||||
fn func_type_index(&self, func_idx: u32) -> u32 {
|
||||
self.func_ty_indicies[func_idx as usize]
|
||||
self.func_ty_indices[func_idx as usize]
|
||||
}
|
||||
|
||||
fn defined_global_index(&self, _index: u32) -> Option<u32> {
|
||||
@@ -539,7 +539,7 @@ pub fn translate_only(data: &[u8]) -> Result<TranslatedModule, Error> {
|
||||
|
||||
if let SectionCode::Function = section.code {
|
||||
let functions = section.get_function_section_reader()?;
|
||||
output.ctx.func_ty_indicies = translate_sections::function(functions)?;
|
||||
output.ctx.func_ty_indices = translate_sections::function(functions)?;
|
||||
|
||||
reader.skip_custom_sections()?;
|
||||
if reader.eof() {
|
||||
|
||||
@@ -22,7 +22,7 @@ pub fn layout_vmcontext(
|
||||
let out_len = ofs.size_of_vmctx() as usize;
|
||||
let mut out = vec![0; out_len];
|
||||
|
||||
// Assign unique indicies to unique signatures.
|
||||
// Assign unique indices to unique signatures.
|
||||
let mut signature_registry = HashMap::new();
|
||||
let mut signature_registry_len = signature_registry.len();
|
||||
for (index, sig) in module.local.signatures.iter() {
|
||||
|
||||
Reference in New Issue
Block a user