Change GlobalVar to GlobalValue
This commit is contained in:
committed by
Dan Gohman
parent
49cc693d64
commit
5c320a0d30
@@ -159,7 +159,7 @@ impl<'dummy_environment> FuncEnvironment for DummyFuncEnvironment<'dummy_environ
|
||||
fn make_global(&mut self, func: &mut ir::Function, index: GlobalIndex) -> GlobalValue {
|
||||
// Just create a dummy `vmctx` global.
|
||||
let offset = ((index * 8) as i32 + 8).into();
|
||||
let gv = func.create_global_var(ir::GlobalVarData::VMContext { offset });
|
||||
let gv = func.create_global_value(ir::GlobalValueData::VMContext { offset });
|
||||
GlobalValue::Memory {
|
||||
gv,
|
||||
ty: self.mod_info.globals[index].entity.ty,
|
||||
@@ -168,10 +168,10 @@ impl<'dummy_environment> FuncEnvironment for DummyFuncEnvironment<'dummy_environ
|
||||
|
||||
fn make_heap(&mut self, func: &mut ir::Function, _index: MemoryIndex) -> ir::Heap {
|
||||
// Create a static heap whose base address is stored at `vmctx+0`.
|
||||
let gv = func.create_global_var(ir::GlobalVarData::VMContext { offset: 0.into() });
|
||||
let gv = func.create_global_value(ir::GlobalValueData::VMContext { offset: 0.into() });
|
||||
|
||||
func.create_heap(ir::HeapData {
|
||||
base: ir::HeapBase::GlobalVar(gv),
|
||||
base: ir::HeapBase::GlobalValue(gv),
|
||||
min_size: 0.into(),
|
||||
guard_size: 0x8000_0000.into(),
|
||||
style: ir::HeapStyle::Static {
|
||||
|
||||
@@ -9,17 +9,17 @@ use translation_utils::{FunctionIndex, Global, GlobalIndex, Memory, MemoryIndex,
|
||||
Table, TableIndex};
|
||||
use wasmparser::BinaryReaderError;
|
||||
|
||||
/// The value of a WebAssembly global variable.
|
||||
/// The value of a WebAssembly global valueiable.
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum GlobalValue {
|
||||
/// This is a constant global with a value known at compile time.
|
||||
Const(ir::Value),
|
||||
|
||||
/// This is a variable in memory that should be referenced as a `GlobalVar`.
|
||||
/// This is a variable in memory that should be referenced as a `GlobalValue`.
|
||||
Memory {
|
||||
/// Which global variable should be referenced.
|
||||
gv: ir::GlobalVar,
|
||||
/// The global variable's type.
|
||||
/// Which global valueiable should be referenced.
|
||||
gv: ir::GlobalValue,
|
||||
/// The global valueiable's type.
|
||||
ty: ir::Type,
|
||||
},
|
||||
}
|
||||
@@ -88,12 +88,12 @@ pub trait FuncEnvironment {
|
||||
ir::Type::int(u16::from(self.triple().pointer_width().unwrap().bits())).unwrap()
|
||||
}
|
||||
|
||||
/// Set up the necessary preamble definitions in `func` to access the global variable
|
||||
/// Set up the necessary preamble definitions in `func` to access the global valueiable
|
||||
/// identified by `index`.
|
||||
///
|
||||
/// The index space covers both imported globals and globals defined by the module.
|
||||
///
|
||||
/// Return the global variable reference that should be used to access the global and the
|
||||
/// Return the global valueiable reference that should be used to access the global and the
|
||||
/// WebAssembly type of the global.
|
||||
fn make_global(&mut self, func: &mut ir::Function, index: GlobalIndex) -> GlobalValue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user