mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-24 14:11:32 +00:00
Improve some TBAA label names, particular for memory.
Memory can't change between static and dynamic, so use that in the TBAA label name. Distinguish between local and imported memory, table and globals.
This commit is contained in:
@ -577,16 +577,16 @@ fn resolve_memory_ptr(
|
|||||||
tbaa_label(
|
tbaa_label(
|
||||||
module.clone(),
|
module.clone(),
|
||||||
intrinsics,
|
intrinsics,
|
||||||
"context_field_ptr_to_base",
|
"dynamic_memory_base",
|
||||||
base.as_instruction_value().unwrap(),
|
base.as_instruction_value().unwrap(),
|
||||||
None,
|
Some(0),
|
||||||
);
|
);
|
||||||
tbaa_label(
|
tbaa_label(
|
||||||
module.clone(),
|
module.clone(),
|
||||||
intrinsics,
|
intrinsics,
|
||||||
"context_field_ptr_to_bounds",
|
"dynamic_memory_bounds",
|
||||||
bounds.as_instruction_value().unwrap(),
|
bounds.as_instruction_value().unwrap(),
|
||||||
None,
|
Some(0),
|
||||||
);
|
);
|
||||||
(base, bounds)
|
(base, bounds)
|
||||||
}
|
}
|
||||||
|
@ -670,7 +670,8 @@ impl<'a> CtxType<'a> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
*cached_memories.entry(index).or_insert_with(|| {
|
*cached_memories.entry(index).or_insert_with(|| {
|
||||||
let (memory_array_ptr_ptr, index, memory_type) = match index.local_or_import(info) {
|
let (memory_array_ptr_ptr, index, memory_type, field_name) =
|
||||||
|
match index.local_or_import(info) {
|
||||||
LocalOrImport::Local(local_mem_index) => (
|
LocalOrImport::Local(local_mem_index) => (
|
||||||
unsafe {
|
unsafe {
|
||||||
cache_builder.build_struct_gep(
|
cache_builder.build_struct_gep(
|
||||||
@ -681,6 +682,7 @@ impl<'a> CtxType<'a> {
|
|||||||
},
|
},
|
||||||
local_mem_index.index() as u64,
|
local_mem_index.index() as u64,
|
||||||
info.memories[local_mem_index].memory_type(),
|
info.memories[local_mem_index].memory_type(),
|
||||||
|
"context_field_ptr_to_local_memory",
|
||||||
),
|
),
|
||||||
LocalOrImport::Import(import_mem_index) => (
|
LocalOrImport::Import(import_mem_index) => (
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -692,6 +694,7 @@ impl<'a> CtxType<'a> {
|
|||||||
},
|
},
|
||||||
import_mem_index.index() as u64,
|
import_mem_index.index() as u64,
|
||||||
info.imported_memories[import_mem_index].1.memory_type(),
|
info.imported_memories[import_mem_index].1.memory_type(),
|
||||||
|
"context_field_ptr_to_imported_memory",
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -701,7 +704,7 @@ impl<'a> CtxType<'a> {
|
|||||||
tbaa_label(
|
tbaa_label(
|
||||||
module.clone(),
|
module.clone(),
|
||||||
intrinsics,
|
intrinsics,
|
||||||
"memory_array",
|
field_name,
|
||||||
memory_array_ptr.as_instruction_value().unwrap(),
|
memory_array_ptr.as_instruction_value().unwrap(),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
@ -746,14 +749,14 @@ impl<'a> CtxType<'a> {
|
|||||||
tbaa_label(
|
tbaa_label(
|
||||||
module.clone(),
|
module.clone(),
|
||||||
intrinsics,
|
intrinsics,
|
||||||
"memory_base",
|
"static_memory_base",
|
||||||
base_ptr.as_instruction_value().unwrap(),
|
base_ptr.as_instruction_value().unwrap(),
|
||||||
Some(index as u32),
|
Some(index as u32),
|
||||||
);
|
);
|
||||||
tbaa_label(
|
tbaa_label(
|
||||||
module.clone(),
|
module.clone(),
|
||||||
intrinsics,
|
intrinsics,
|
||||||
"memory_bounds",
|
"static_memory_bounds",
|
||||||
bounds.as_instruction_value().unwrap(),
|
bounds.as_instruction_value().unwrap(),
|
||||||
Some(index as u32),
|
Some(index as u32),
|
||||||
);
|
);
|
||||||
@ -780,7 +783,7 @@ impl<'a> CtxType<'a> {
|
|||||||
ptr_to_base_ptr,
|
ptr_to_base_ptr,
|
||||||
ptr_to_bounds,
|
ptr_to_bounds,
|
||||||
} = *cached_tables.entry(index).or_insert_with(|| {
|
} = *cached_tables.entry(index).or_insert_with(|| {
|
||||||
let (table_array_ptr_ptr, index) = match index.local_or_import(info) {
|
let (table_array_ptr_ptr, index, field_name) = match index.local_or_import(info) {
|
||||||
LocalOrImport::Local(local_table_index) => (
|
LocalOrImport::Local(local_table_index) => (
|
||||||
unsafe {
|
unsafe {
|
||||||
cache_builder.build_struct_gep(
|
cache_builder.build_struct_gep(
|
||||||
@ -790,6 +793,7 @@ impl<'a> CtxType<'a> {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
local_table_index.index() as u64,
|
local_table_index.index() as u64,
|
||||||
|
"context_field_ptr_to_local_table",
|
||||||
),
|
),
|
||||||
LocalOrImport::Import(import_table_index) => (
|
LocalOrImport::Import(import_table_index) => (
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -800,6 +804,7 @@ impl<'a> CtxType<'a> {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
import_table_index.index() as u64,
|
import_table_index.index() as u64,
|
||||||
|
"context_field_ptr_to_import_table",
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -809,7 +814,7 @@ impl<'a> CtxType<'a> {
|
|||||||
tbaa_label(
|
tbaa_label(
|
||||||
module.clone(),
|
module.clone(),
|
||||||
intrinsics,
|
intrinsics,
|
||||||
"context_field_ptr_to_tables",
|
field_name,
|
||||||
table_array_ptr.as_instruction_value().unwrap(),
|
table_array_ptr.as_instruction_value().unwrap(),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
@ -971,7 +976,7 @@ impl<'a> CtxType<'a> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
*cached_globals.entry(index).or_insert_with(|| {
|
*cached_globals.entry(index).or_insert_with(|| {
|
||||||
let (globals_array_ptr_ptr, index, mutable, wasmer_ty) =
|
let (globals_array_ptr_ptr, index, mutable, wasmer_ty, field_name) =
|
||||||
match index.local_or_import(info) {
|
match index.local_or_import(info) {
|
||||||
LocalOrImport::Local(local_global_index) => {
|
LocalOrImport::Local(local_global_index) => {
|
||||||
let desc = info.globals[local_global_index].desc;
|
let desc = info.globals[local_global_index].desc;
|
||||||
@ -986,6 +991,7 @@ impl<'a> CtxType<'a> {
|
|||||||
local_global_index.index() as u64,
|
local_global_index.index() as u64,
|
||||||
desc.mutable,
|
desc.mutable,
|
||||||
desc.ty,
|
desc.ty,
|
||||||
|
"context_field_ptr_to_local_globals",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
LocalOrImport::Import(import_global_index) => {
|
LocalOrImport::Import(import_global_index) => {
|
||||||
@ -1001,6 +1007,7 @@ impl<'a> CtxType<'a> {
|
|||||||
import_global_index.index() as u64,
|
import_global_index.index() as u64,
|
||||||
desc.mutable,
|
desc.mutable,
|
||||||
desc.ty,
|
desc.ty,
|
||||||
|
"context_field_ptr_to_imported_globals",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1013,7 +1020,7 @@ impl<'a> CtxType<'a> {
|
|||||||
tbaa_label(
|
tbaa_label(
|
||||||
module.clone(),
|
module.clone(),
|
||||||
intrinsics,
|
intrinsics,
|
||||||
"context_field_ptr_to_globals",
|
field_name,
|
||||||
globals_array_ptr_ptr.as_instruction_value().unwrap(),
|
globals_array_ptr_ptr.as_instruction_value().unwrap(),
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user