In-progress work: refactoring PAL not to be instanced.

This removes a lot of useless passing around of the PAL object.
This commit is contained in:
Ben Vanik
2013-03-29 05:07:32 -07:00
parent c46093266e
commit 85bdbd24d1
45 changed files with 444 additions and 189 deletions

View File

@@ -28,7 +28,6 @@ KernelState::KernelState(Runtime* runtime) :
runtime_(runtime),
executable_module_(NULL),
next_handle_(0) {
pal_ = runtime->pal();
memory_ = runtime->memory();
processor_ = runtime->processor();
filesystem_ = runtime->filesystem();
@@ -69,17 +68,12 @@ KernelState::~KernelState() {
filesystem_.reset();
processor_.reset();
xe_memory_release(memory_);
xe_pal_release(pal_);
}
Runtime* KernelState::runtime() {
return runtime_;
}
xe_pal_ref KernelState::pal() {
return pal_;
}
xe_memory_ref KernelState::memory() {
return memory_;
}

View File

@@ -35,7 +35,6 @@ public:
~KernelState();
Runtime* runtime();
xe_pal_ref pal();
xe_memory_ref memory();
cpu::Processor* processor();
fs::FileSystem* filesystem();
@@ -51,7 +50,6 @@ private:
void RemoveObject(XObject* obj);
Runtime* runtime_;
xe_pal_ref pal_;
xe_memory_ref memory_;
shared_ptr<cpu::Processor> processor_;
shared_ptr<fs::FileSystem> filesystem_;

View File

@@ -92,8 +92,7 @@ X_STATUS XModule::LoadFromMemory(const void* addr, const size_t length) {
XEEXPECTNOTNULL(xex_);
// Prepare the module for execution.
XEEXPECTZERO(kernel_state()->processor()->PrepareModule(
name_, path_, xex_, runtime()->export_resolver()));
XEEXPECTZERO(kernel_state()->processor()->LoadXexModule(name_, path_, xex_));
return X_STATUS_SUCCESS;