Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* src/vm/mmu.hh: Hide instructions' access behind MMU.
* src/vm/cpu.hh, src/vm/cpu.cc, src/vm/virtual_machine.hh:
Use the MMU to access instructions.
2004-07-14 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: src/vm/cpu.hh
--- src/vm/cpu.hh (revision 109)
+++ src/vm/cpu.hh (working copy)
@@ -318,7 +318,7 @@
pipeline_[e_stage] = pipeline_[r_stage];
pipeline_[r_stage] = pipeline_[d_stage];
pipeline_[d_stage] = pipeline_[i_stage];
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
pipeline_[e_stage]->accept(*this);
pc_ = pc_ + 4;
Index: src/vm/virtual_machine.hh
--- src/vm/virtual_machine.hh (revision 113)
+++ src/vm/virtual_machine.hh (working copy)
@@ -99,13 +99,13 @@
/// Check if a label exists
bool has_label(const std::string& label) const
{
- return mmu_.inst().has_label(inst::Label(label));
+ return mmu_.inst_has_label(label);
}
/// Return the offset of a label
int get_offset(const std::string& label) const
{
- return mmu_.inst().get_offset(inst::Label(label));
+ return mmu_.inst_get_offset(label);
}
public:
Index: src/vm/cpu.cc
--- src/vm/cpu.cc (revision 113)
+++ src/vm/cpu.cc (working copy)
@@ -463,7 +463,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
void
Cpu::visit(const inst::Jr& jr)
@@ -477,7 +477,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
void
@@ -491,7 +491,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
// Assume it is a call
call();
@@ -507,7 +507,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
// Assume it is a call
call();
@@ -526,7 +526,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
@@ -540,7 +540,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
@@ -556,7 +556,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
@@ -575,7 +575,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
@@ -589,7 +589,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
@@ -605,7 +605,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
@@ -619,7 +619,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
@@ -638,7 +638,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
Index: src/vm/mmu.hh
--- src/vm/mmu.hh (revision 113)
+++ src/vm/mmu.hh (working copy)
@@ -85,14 +85,24 @@
/** \name Proxy for memory instruction access.
\{ */
public:
- const inst::TextSection& inst() const
- {
- return *text_section_;
- }
void inst_store(const inst::TextSection& text_section)
{
text_section_ = &text_section;
}
+
+ const inst::Inst & inst_load(int offset) const
+ {
+ return (*text_section_)[offset];
+ }
+
+ int inst_has_label(const std::string &label) const
+ {
+ return text_section_->has_label(inst::Label(label));
+ }
+ int inst_get_offset(const std::string &label) const
+ {
+ return text_section_->get_offset(inst::Label(label));
+ }
/** \} */
protected:
Show replies by date