Skip to content

Commit

Permalink
[RUNTIME][REFACTOR] Use object protocol to support runtime::Module (a…
Browse files Browse the repository at this point in the history
…pache#4289)

Previously runtime::Module was supported using shared_ptr.
This PR refactors the codebase to use the Object protocol.

It will open doors to allow easier interpolation between
Object containers and module in the future.
  • Loading branch information
tqchen authored Nov 11, 2019
1 parent 2ad49d2 commit 834ddf1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/dpi/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class DPIModule final : public DPIModuleNode {

PackedFunc GetFunction(
const std::string& name,
const std::shared_ptr<ModuleNode>& sptr_to_self) final {
const ObjectPtr<Object>& sptr_to_self) final {
if (name == "WriteReg") {
return TypedPackedFunc<void(int, int)>(
[this](int addr, int value){
Expand Down Expand Up @@ -413,8 +413,7 @@ class DPIModule final : public DPIModuleNode {
};

Module DPIModuleNode::Load(std::string dll_name) {
std::shared_ptr<DPIModule> n =
std::make_shared<DPIModule>();
auto n = make_object<DPIModule>();
n->Init(dll_name);
return Module(n);
}
Expand Down

0 comments on commit 834ddf1

Please sign in to comment.