forked from rubinius/rubinius
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added LazyExecutable for deferred CompiledMethod loading.
- Loading branch information
Brian Ford
committed
Apr 22, 2011
1 parent
7b9ed03
commit 6fbce5a
Showing
9 changed files
with
93 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Rubinius | ||
class LazyExecutable | ||
attr_accessor :path | ||
attr_accessor :name | ||
|
||
def self.new(path, name, index) | ||
Ruby.primitive :lazy_executable_create | ||
raise PrimitiveFailure, "Rubinius::LazyExecutable.new failed" | ||
end | ||
|
||
def inspect | ||
"<Rubinius::LazyExecutable #{@path.inspect}, #{@name.inspect}>" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "builtin/lazy_executable.hpp" | ||
#include "builtin/class.hpp" | ||
#include "builtin/lookuptable.hpp" | ||
#include "builtin/symbol.hpp" | ||
#include "builtin/fixnum.hpp" | ||
|
||
#include "dispatch.hpp" | ||
#include "call_frame.hpp" | ||
#include "arguments.hpp" | ||
|
||
#include "object_utils.hpp" | ||
|
||
namespace rubinius { | ||
void LazyExecutable::init(STATE) { | ||
GO(lmethod).set(state->new_class("LazyExecutable", G(executable), G(rubinius))); | ||
G(lmethod)->set_object_type(state, LazyExecutableType); | ||
G(lmethod)->name(state, state->symbol("Rubinius::LazyExecutable")); | ||
G(lmethod)->set_const(state, "Index", LookupTable::create(state)); | ||
} | ||
|
||
LazyExecutable* LazyExecutable::create(STATE, Symbol* path, Symbol* name) { | ||
LazyExecutable* le = state->new_object<LazyExecutable>(G(lmethod)); | ||
le->path(state, path); | ||
le->name(state, name); | ||
|
||
le->execute = lazy_executor; | ||
return le; | ||
} | ||
|
||
Object* LazyExecutable::lazy_executor(STATE, CallFrame* call_frame, Executable* exec, | ||
Module* mod, Arguments& args) | ||
{ | ||
return Qnil; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "builtin/executable.hpp" | ||
|
||
namespace rubinius { | ||
struct CallFrame; | ||
class Dispatch; | ||
class Arguments; | ||
class Symbol; | ||
class Fixnum; | ||
|
||
class LazyExecutable : public Executable { | ||
public: | ||
const static object_type type = LazyExecutableType; | ||
|
||
private: | ||
Symbol* path_; // slot | ||
Symbol* name_; // slot | ||
|
||
public: | ||
attr_accessor(path, Symbol); | ||
attr_accessor(name, Symbol); | ||
|
||
static void init(STATE); | ||
|
||
// Ruby.primitive :lazy_executable_create | ||
static LazyExecutable* create(STATE, Symbol* path, Symbol* name); | ||
|
||
static Object* lazy_executor(STATE, CallFrame* call_frame, | ||
Executable* exec, Module* mod, Arguments& args); | ||
|
||
class Info : public Executable::Info { | ||
public: | ||
BASIC_TYPEINFO(Executable::Info) | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters