Skip to content

Commit

Permalink
disable a test of source_path() which was invalidated by removing the…
Browse files Browse the repository at this point in the history
… Scheduler
  • Loading branch information
vtjnash committed Feb 5, 2014
1 parent d119faa commit f9dd0bb
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
# last::Task
# storage::Any
# consumers
# started::Bool
# done::Bool
# runnable::Bool
# end
Expand Down
4 changes: 2 additions & 2 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ include_string(txt::ByteString, fname::ByteString) =

include_string(txt::ByteString) = include_string(txt, "string")

macro __FILE__() source_path() end

function source_path(default::Union(String,Nothing)="")
t = current_task()
s = t.storage
Expand All @@ -100,8 +102,6 @@ function source_path(default::Union(String,Nothing)="")
return default
end

macro __FILE__() source_path() end

function include_from_node1(path::String)
prev = source_path(nothing)
path = (prev == nothing) ? abspath(path) : joinpath(dirname(prev),path)
Expand Down
2 changes: 1 addition & 1 deletion base/task.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ show(io::IO, t::Task) = print(io, "Task")

current_task() = ccall(:jl_get_current_task, Any, ())::Task
istaskdone(t::Task) = t.done
istaskstarted(t::Task) = isdefined(t,:current_module)
istaskstarted(t::Task) = t.started

# yield to a task, throwing an exception in it
function throwto(t::Task, exc)
Expand Down
1 change: 1 addition & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,7 @@ typedef struct _jl_task_t {
struct _jl_task_t *last;
jl_value_t *tls;
jl_value_t *consumers;
int8_t started;
int8_t done;
int8_t runnable;
jl_value_t *result;
Expand Down
21 changes: 10 additions & 11 deletions src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,8 @@ static void ctx_switch(jl_task_t *t, jl_jmp_buf *where)
jl_pgcstack = t->gcstack;
#endif
jl_current_task->current_module = jl_current_module;
jl_current_module = t->current_module;
t->last = jl_current_task;
// by default, parent is first task to switch to this one
if (t->current_module == NULL) { //TODO: jwn is pretty sure this isn't logical
t->current_module = jl_current_module;
}
else {
jl_current_module = t->current_module;
}
jl_current_task = t;

#ifdef COPY_STACKS
Expand Down Expand Up @@ -402,6 +396,8 @@ static void start_task(jl_task_t *t)
jl_value_t *arg = jl_task_arg_in_transit;
jl_value_t *res;
JL_GC_PUSH1(&arg);
assert(!t->started);
t->started = 1;

#ifdef COPY_STACKS
ptrint_t local_sp = (ptrint_t)jl_pgcstack;
Expand Down Expand Up @@ -777,10 +773,11 @@ jl_task_t *jl_new_task(jl_function_t *start, size_t ssize)
t->type = (jl_value_t*)jl_task_type;
ssize = LLT_ALIGN(ssize, pagesz);
t->ssize = ssize;
t->current_module = NULL;
t->current_module = jl_current_module;
t->last = jl_current_task;
t->tls = jl_nothing;
t->consumers = jl_nothing;
t->started = 0;
t->done = 0;
t->runnable = 1;
t->start = start;
Expand Down Expand Up @@ -878,21 +875,22 @@ void jl_init_tasks(void *stack, size_t ssize)
jl_task_type = jl_new_datatype(jl_symbol("Task"),
jl_any_type,
jl_null,
jl_tuple(10,
jl_tuple(11,
jl_symbol("current_module"),
jl_symbol("last"),
jl_symbol("storage"),
jl_symbol("consumers"),
jl_symbol("started"),
jl_symbol("done"),
jl_symbol("runnable"),
jl_symbol("result"),
jl_symbol("donenotify"),
jl_symbol("exception"),
jl_symbol("code")),
jl_tuple(10,
jl_tuple(11,
jl_any_type, jl_any_type,
jl_any_type, jl_any_type,
jl_bool_type, jl_bool_type,
jl_bool_type, jl_bool_type, jl_bool_type,
jl_any_type, jl_any_type,
jl_any_type, jl_function_type),
0, 1);
Expand All @@ -914,6 +912,7 @@ void jl_init_tasks(void *stack, size_t ssize)
jl_current_task->last = jl_current_task;
jl_current_task->tls = NULL;
jl_current_task->consumers = NULL;
jl_current_task->started = 1;
jl_current_task->done = 0;
jl_current_task->runnable = 1;
jl_current_task->start = NULL;
Expand Down
Binary file added test/ccalltest
Binary file not shown.
6 changes: 5 additions & 1 deletion test/test_sourcepath.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# source path in tasks
path = Base.source_path()
@test endswith(path, joinpath("test","test_sourcepath.jl"))
@test yieldto(@task Base.source_path()) == path
#@test yieldto(@task begin
# t = current_task().last
# t.result = Base.source_path()
# Base.enq_work(current_task().last)
# end) == path

0 comments on commit f9dd0bb

Please sign in to comment.