Rename GlobalVarData::VmCtx for consistency with ArgumentPurpose::VMContext.

This commit is contained in:
Dan Gohman
2018-04-17 09:29:45 -07:00
parent 85662fbca9
commit 635d14c251
4 changed files with 6 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ use std::fmt;
pub enum GlobalVarData { pub enum GlobalVarData {
/// Variable is part of the VM context struct, it's address is a constant offset from the VM /// Variable is part of the VM context struct, it's address is a constant offset from the VM
/// context pointer. /// context pointer.
VmCtx { VMContext {
/// Offset from the `vmctx` pointer to this global. /// Offset from the `vmctx` pointer to this global.
offset: Offset32, offset: Offset32,
}, },
@@ -54,7 +54,7 @@ impl GlobalVarData {
impl fmt::Display for GlobalVarData { impl fmt::Display for GlobalVarData {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self { match *self {
GlobalVarData::VmCtx { offset } => write!(f, "vmctx{}", offset), GlobalVarData::VMContext { offset } => write!(f, "vmctx{}", offset),
GlobalVarData::Deref { base, offset } => write!(f, "deref({}){}", base, offset), GlobalVarData::Deref { base, offset } => write!(f, "deref({}){}", base, offset),
GlobalVarData::Sym { GlobalVarData::Sym {
ref name, ref name,

View File

@@ -25,7 +25,7 @@ pub fn expand_global_addr(
}; };
match func.global_vars[gv] { match func.global_vars[gv] {
ir::GlobalVarData::VmCtx { offset } => vmctx_addr(inst, func, offset.into()), ir::GlobalVarData::VMContext { offset } => vmctx_addr(inst, func, offset.into()),
ir::GlobalVarData::Deref { base, offset } => deref_addr(inst, func, base, offset.into()), ir::GlobalVarData::Deref { base, offset } => deref_addr(inst, func, base, offset.into()),
ir::GlobalVarData::Sym { .. } => globalsym(inst, func, gv), ir::GlobalVarData::Sym { .. } => globalsym(inst, func, gv),
} }

View File

@@ -1100,7 +1100,7 @@ impl<'a> Parser<'a> {
let data = match self.match_any_identifier("expected global variable kind")? { let data = match self.match_any_identifier("expected global variable kind")? {
"vmctx" => { "vmctx" => {
let offset = self.optional_offset32()?; let offset = self.optional_offset32()?;
GlobalVarData::VmCtx { offset } GlobalVarData::VMContext { offset }
} }
"deref" => { "deref" => {
self.match_token( self.match_token(

View File

@@ -151,7 +151,7 @@ impl<'dummy_environment> FuncEnvironment for DummyFuncEnvironment<'dummy_environ
fn make_global(&mut self, func: &mut ir::Function, index: GlobalIndex) -> GlobalValue { fn make_global(&mut self, func: &mut ir::Function, index: GlobalIndex) -> GlobalValue {
// Just create a dummy `vmctx` global. // Just create a dummy `vmctx` global.
let offset = ((index * 8) as i32 + 8).into(); let offset = ((index * 8) as i32 + 8).into();
let gv = func.create_global_var(ir::GlobalVarData::VmCtx { offset }); let gv = func.create_global_var(ir::GlobalVarData::VMContext { offset });
GlobalValue::Memory { GlobalValue::Memory {
gv, gv,
ty: self.mod_info.globals[index].entity.ty, ty: self.mod_info.globals[index].entity.ty,
@@ -160,7 +160,7 @@ impl<'dummy_environment> FuncEnvironment for DummyFuncEnvironment<'dummy_environ
fn make_heap(&mut self, func: &mut ir::Function, _index: MemoryIndex) -> ir::Heap { 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`. // Create a static heap whose base address is stored at `vmctx+0`.
let gv = func.create_global_var(ir::GlobalVarData::VmCtx { offset: 0.into() }); let gv = func.create_global_var(ir::GlobalVarData::VMContext { offset: 0.into() });
func.create_heap(ir::HeapData { func.create_heap(ir::HeapData {
base: ir::HeapBase::GlobalVar(gv), base: ir::HeapBase::GlobalVar(gv),