Exemple #1
0
  bool CompiledFile::execute(STATE) {
    Task* task = state->new_task();
    TypedRoot<CompiledMethod*> cm(state, as<CompiledMethod>(body(state)));

    Message msg(state);
    msg.setup(NULL, G(main), task->active(), 0, 0);
    msg.name = cm->name();
    msg.module = G(object);
    msg.method = cm.get();

    G(current_thread)->task(state, task);
    state->activate_task(task);

    cm.get()->scope(state, StaticScope::create(state));
    cm.get()->scope()->module(state, G(object));

    cm->execute(state, G(current_task), msg);
    try {
      state->run_and_monitor();
    } catch(Task::Halt &e) {
      return true;
    }

    // Task::execute contains the safe point, thus the above Task
    // and CompiledMethod pointers have likely been moved. DO NOT
    // USE THEM.

    return false;
  }