Skip to content

Commit

Permalink
Add member functions for creating OptimizedCallSite
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Oct 4, 2013
1 parent 8df7c95 commit 36a1b0e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions vm/builtin/optimized_call_site.cpp
Expand Up @@ -8,6 +8,19 @@ namespace rubinius {
G(optimized_call_site)->set_object_type(state, OptimizedCallSiteType);
}

OptimizedCallSite* OptimizedCallSite::create(STATE, CallSite* unoptimized) {
OptimizedCallSite* call_site =
state->vm()->new_object_mature<OptimizedCallSite>(G(optimized_call_site));
call_site->name_ = unoptimized->name();
call_site->executable(state, unoptimized->executable());
call_site->ip_ = unoptimized->ip();
call_site->executor_ = empty_cache;
call_site->fallback_ = unoptimized->fallback_;
call_site->updater_ = empty_cache_updater;
call_site->fallback_call_site(state, unoptimized);
return call_site;
}

void OptimizedCallSite::Info::mark(Object* obj, ObjectMark& mark) {
auto_mark(obj, mark);
}
Expand Down
7 changes: 7 additions & 0 deletions vm/builtin/optimized_call_site.hpp
Expand Up @@ -8,6 +8,13 @@ namespace rubinius {
class OptimizedCallSite : public CallSite {
public:
const static object_type type = OptimizedCallSiteType;

private:
CallSite* fallback_call_site_; // slot

public:
attr_accessor(fallback_call_site, CallSite);

static void init(STATE);
static OptimizedCallSite* create(STATE, CallSite* call_site);

Expand Down

0 comments on commit 36a1b0e

Please sign in to comment.