Skip to content

Commit

Permalink
Replace task_at primitive with task_current_context since that's its …
Browse files Browse the repository at this point in the history
…only use
  • Loading branch information
drbrain committed Aug 8, 2008
1 parent 7c10696 commit c0bbece
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 30 deletions.
12 changes: 2 additions & 10 deletions kernel/bootstrap/task.rb
Expand Up @@ -21,17 +21,9 @@ def dup
Kernel.raise PrimitiveFailure, "primitive failed"
end

def at(index)
Ruby.primitive :task_at
Kernel.raise PrimitiveFailure, "primitive failed"
end

def main
at(0)
end

def current_context
at(1)
Ruby.primitive :task_current_context
Kernel.raise PrimitiveFailure, 'task_current_context primitive failed'
end

def inspect
Expand Down
Binary file modified runtime/stable/bootstrap.rba
Binary file not shown.
Binary file modified runtime/stable/core.rba
Binary file not shown.
27 changes: 7 additions & 20 deletions shotgun/lib/primitives.rb
Expand Up @@ -2747,33 +2747,20 @@ def task_current
CODE
end

defprim :task_at
def task_at
defprim :task_current_context
def task_current_context
<<-CODE
ARITY(1);
ARITY(0);
struct cpu_task *task;
OBJECT t1, t2;
native_int k;
GUARD(TASK_P(msg->recv));
POP(t1, FIXNUM);
OBJECT t1;
task = (struct cpu_task*)BYTES_OF(msg->recv);
k = N2I(t1);
switch(k) {
case 0:
t2 = task->main;
break;
case 1:
t2 = task->active_context;
if(REFERENCE_P(t2)) methctx_reference(state, t2);
break;
default:
t2 = Qnil;
}
t1 = task->active_context;
if(REFERENCE_P(t1)) methctx_reference(state, t1);
RET(t2);
RET(t1);
CODE
end

Expand Down

0 comments on commit c0bbece

Please sign in to comment.