Skip to content

Commit

Permalink
Added Rubinius.primitive :variable_scope_allocate.
Browse files Browse the repository at this point in the history
Fixes #2939.
  • Loading branch information
jemc committed Apr 30, 2015
1 parent d3bacd4 commit 546cef5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/bootstrap/variable_scope.rb
Expand Up @@ -10,6 +10,11 @@ def self.current
raise PrimitiveFailure, "Rubinius::VariableScope.current primitive failed"
end

def self.allocate
Rubinius.primitive :variable_scope_allocate
raise PrimitiveFailure, "Rubinius::VariableScope.allocate primitive failed"
end

def self.synthesize(method, module_, parent, self_, block, locals)
Rubinius.primitive :variable_scope_synthesize
raise PrimitiveFailure, "Rubinius::VariableScope.synthesize primitive failed"
Expand Down
13 changes: 13 additions & 0 deletions vm/builtin/variable_scope.cpp
Expand Up @@ -38,6 +38,19 @@ namespace rubinius {
return call_frame->promote_scope(state);
}

VariableScope* VariableScope::allocate(STATE)
{
VariableScope* scope = state->new_object<VariableScope>(G(variable_scope));

scope->number_of_locals_ = 0;
scope->isolated_ = 1;
scope->locals_ = 0;
scope->flags_ = 0;
scope->lock_.init();

return scope;
}

VariableScope* VariableScope::synthesize(STATE, CompiledCode* method,
Module* module, Object* parent,
Object* self, Object* block,
Expand Down
3 changes: 3 additions & 0 deletions vm/builtin/variable_scope.hpp
Expand Up @@ -100,6 +100,9 @@ namespace rubinius {
// Rubinius.primitive+ :variable_scope_current
static VariableScope* current(STATE, CallFrame* calling_environment);

// Rubinius.primitive :variable_scope_allocate
static VariableScope* allocate(STATE);

// Rubinius.primitive :variable_scope_synthesize
static VariableScope* synthesize(STATE, CompiledCode* method, Module* module, Object* parent, Object* self, Object* block, Tuple* locals);

Expand Down

0 comments on commit 546cef5

Please sign in to comment.