Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 415b1c8aa3c1
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6584257f191b
Choose a head ref
  • 6 commits
  • 7 files changed
  • 1 contributor

Commits on Jun 5, 2016

  1. Copy the full SHA
    08252c0 View commit details
  2. Copy the full SHA
    bfa951d View commit details
  3. Copy the full SHA
    acc782f View commit details
  4. Copy the full SHA
    5fe293b View commit details
  5. Copy the full SHA
    658d94b View commit details
  6. Copy the full SHA
    6584257 View commit details
Showing with 44 additions and 13 deletions.
  1. +2 −5 machine/builtin/call_site.hpp
  2. +14 −3 machine/builtin/compiled_code.cpp
  3. +1 −0 machine/builtin/compiled_code.hpp
  4. +12 −0 machine/machine_code.cpp
  5. +2 −0 machine/machine_code.hpp
  6. +7 −4 machine/memory.hpp
  7. +6 −1 machine/memory/finalizer.cpp
7 changes: 2 additions & 5 deletions machine/builtin/call_site.hpp
Original file line number Diff line number Diff line change
@@ -171,8 +171,8 @@ namespace rubinius {
obj->caches(NULL);
}

static void finalize(STATE, CallSite* call_site) {
if(call_site->caches()) free(call_site->caches());
void finalize(STATE) {
if(caches()) free(caches());
}

static CallSite* create(STATE, Symbol* name, int ip) {
@@ -181,9 +181,6 @@ namespace rubinius {
cache->name(name);
cache->ip(ip);

state->memory()->native_finalizer(state, cache,
(memory::FinalizerFunction)&CallSite::finalize);

state->vm()->metrics().machine.call_site_count++;

return cache;
17 changes: 14 additions & 3 deletions machine/builtin/compiled_code.cpp
Original file line number Diff line number Diff line change
@@ -32,17 +32,28 @@ namespace rubinius {
state, G(executable), G(rubinius), "CompiledCode"));
}

void CompiledCode::finalize(STATE, CompiledCode* code) {
if(MachineCode* machine_code = code->machine_code()) {
machine_code->finalize(state);
}
}

CompiledCode* CompiledCode::create(STATE) {
return CompiledCode::allocate(state, G(compiled_code));
}

CompiledCode* CompiledCode::allocate(STATE, Object* self) {
return state->memory()->new_object<CompiledCode>(state, as<Class>(self));
CompiledCode* code =
state->memory()->new_object<CompiledCode>(state, as<Class>(self));

state->memory()->native_finalizer(state, code,
(memory::FinalizerFunction)&CompiledCode::finalize);

return code;
}

CompiledCode* CompiledCode::dup(STATE) {
CompiledCode* code =
state->memory()->new_object<CompiledCode>(state, G(compiled_code));
CompiledCode* code = allocate(state, G(compiled_code));

code->copy_object(state, this);
code->set_executor(CompiledCode::default_executor);
1 change: 1 addition & 0 deletions machine/builtin/compiled_code.hpp
Original file line number Diff line number Diff line change
@@ -56,6 +56,7 @@ namespace rubinius {
/* interface */

static void bootstrap(STATE);
static void finalize(STATE, CompiledCode* code);
static void initialize(STATE, CompiledCode* obj) {
Executable::initialize(state, obj, CompiledCode::default_executor);

12 changes: 12 additions & 0 deletions machine/machine_code.cpp
Original file line number Diff line number Diff line change
@@ -110,6 +110,18 @@ namespace rubinius {
if(description()) delete description();
}

void MachineCode::finalize(STATE) {
for(size_t i = 0; i < references_count(); i++) {
if(size_t ip = references()[i]) {
if(CallSite* call_site = try_as<CallSite>(
reinterpret_cast<Object*>(opcodes[ip])))
{
call_site->finalize(state);
}
}
}
}

int MachineCode::size() {
return sizeof(MachineCode) +
(total * sizeof(opcode)) + // opcodes
2 changes: 2 additions & 0 deletions machine/machine_code.hpp
Original file line number Diff line number Diff line change
@@ -141,6 +141,8 @@ namespace rubinius {
flags |= eNoInline;
}

void finalize(STATE);

CallSite* call_site(STATE, int ip);
ConstantCache* constant_cache(STATE, int ip);

11 changes: 7 additions & 4 deletions machine/memory.hpp
Original file line number Diff line number Diff line change
@@ -542,10 +542,13 @@ namespace rubinius {
ObjectPosition validate_object(Object* obj);

void collect(STATE) {
collect_young_flag_ = true;
collect_full_flag_ = true;
interrupt_flag_ = true;
collect_maybe(state);
if(can_gc()) {
collect_young_flag_ = true;
collect_full_flag_ = true;
interrupt_flag_ = true;
state->vm()->thread_nexus()->set_stop();
state->vm()->checkpoint(state);
}
}

void collect_maybe(STATE);
7 changes: 6 additions & 1 deletion machine/memory/finalizer.cpp
Original file line number Diff line number Diff line change
@@ -293,7 +293,12 @@ namespace rubinius {
}
}

add_finalizer(state, new ManagedFinalizer(state, obj, finalizer));
/* Rubinius specific API. If the finalizer is the object, we're going to
* send the object __finalize__. We mark that the user wants this by
* putting cTrue as the ruby_finalizer.
*/
add_finalizer(state, new ManagedFinalizer(state, obj,
obj == finalizer ? cTrue : finalizer));
}

void FinalizerThread::add_finalizer(STATE, FinalizerObject* obj) {