Skip to content

Commit

Permalink
Cleanup green_threads/kill_threads merge, builds now
Browse files Browse the repository at this point in the history
  • Loading branch information
niner committed Sep 25, 2011
1 parent b4834a4 commit 856f3b2
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 255 deletions.
2 changes: 0 additions & 2 deletions include/parrot/extend.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
but that would be really annoying */
#if defined(PARROT_IN_CORE)

#include "parrot/threads.h"

#else

typedef Parrot_Int Parrot_Language;
Expand Down
6 changes: 4 additions & 2 deletions include/parrot/interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ typedef Parrot_Run_core_t Run_Cores;
#include "parrot/call.h"
#include "parrot/gc_api.h"

#include "parrot/thread.h"

typedef struct warnings_t {
Warnings_classes classes;
} *Warnings;
Expand Down Expand Up @@ -220,6 +218,7 @@ struct parrot_interp_t {

PMC *root_namespace; /* namespace hash */
PMC *scheduler; /* concurrency scheduler */
PMC *cur_task;

MMD_Cache *op_mmd_cache; /* MMD cache for builtins. */

Expand All @@ -237,6 +236,9 @@ struct parrot_interp_t {
int current_runloop_level; /* for reentering run loop */
int current_runloop_id;

UINTVAL last_alarm; /* has an alarm triggered? */
FLOATVAL quantum_done; /* expiration of current quantum */

UINTVAL recursion_limit; /* Sub call recursion limit */

/* during a call sequencer the caller fills these objects
Expand Down
187 changes: 0 additions & 187 deletions include/parrot/threads.h

This file was deleted.

1 change: 0 additions & 1 deletion src/embed.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ numbered. You probably want src/embed/api.c
#include "pmc/pmc_sub.h"
#include "pmc/pmc_callcontext.h"
#include "parrot/runcore_api.h"
#include "parrot/threads.h"
#include "parrot/oplib/core_ops.h"
#include "imcc/embed.h"

Expand Down
5 changes: 0 additions & 5 deletions src/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ Parrot_x_exit(PARROT_INTERP, int status)
*/
handler_node_t *node;

INTVAL tidx = Parrot_threads_current(interp);
if (tidx != 0) {
exit(status);
}

node = interp->exit_handler_list;

Parrot_block_GC_mark(interp);
Expand Down
3 changes: 1 addition & 2 deletions src/gc/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ implementation, and malloc wrappers for various purposes. These are unused.
#define GC_C_SOURCE
#include "parrot/parrot.h"
#include "parrot/gc_api.h"
#include "parrot/threads.h"
#include "gc_private.h"
#include "fixed_allocator.h"

Expand Down Expand Up @@ -188,7 +187,7 @@ Parrot_gc_initialize(PARROT_INTERP, ARGIN(Parrot_GC_Init_Args *args))
{
ASSERT_ARGS(Parrot_gc_initialize)

interp->thread_table->threads[0].lo_var_ptr = args->stacktop;
interp->lo_var_ptr = args->stacktop;

interp->gc_sys->sys_type = PARROT_GC_DEFAULT_TYPE;

Expand Down
1 change: 0 additions & 1 deletion src/gc/mark_sweep.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ mark_interp(PARROT_INTERP)

/* mark the concurrency scheduler and tasks */
Parrot_gc_mark_PMC_alive(interp, interp->scheduler);
Parrot_threads_gc_mark(interp);

/* mark caches and freelists */
mark_object_cache(interp);
Expand Down
25 changes: 4 additions & 21 deletions src/gc/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ TT #273: This file needs to be cleaned up significantly.
*/

#include "parrot/parrot.h"
#include "parrot/threads.h"
#include "gc_private.h"

/* HEADERIZER HFILE: src/gc/gc_private.h */
Expand Down Expand Up @@ -237,27 +236,11 @@ trace_system_stack(PARROT_INTERP, ARGIN_NULLOK(const Memory_Pools *mem_pools))
"top" of the stack. A value stored in interp->lo_var_ptr represents
the "bottom" of the stack. We must trace the entire area between the
top and bottom. */
const Thread_table *tbl = interp->thread_table;
int i, cur_idx;

/* We need to trace the stack in one running thread (this thread) as
well as the stack in each other active thread.
*/
cur_idx = Parrot_threads_current(interp);

for (i = 0; i < tbl->count; ++i) {
void *lo = tbl->threads[i].lo_var_ptr;

if (i == cur_idx) {
void *hi = &i;
trace_mem_block(interp, mem_pools, (size_t)lo, (size_t)hi);
}
else if (THREAD_STATE_TEST(interp, i, SCAN_STACK)) {
void *hi = tbl->threads[i].hi_var_ptr;
trace_mem_block(interp, mem_pools, (size_t)lo, (size_t)hi);
}
}
const size_t lo_var_ptr = (size_t)interp->lo_var_ptr;
PARROT_ASSERT(lo_var_ptr);

trace_mem_block(interp, mem_pools, (size_t)lo_var_ptr,
(size_t)&lo_var_ptr);
}

/*
Expand Down
3 changes: 0 additions & 3 deletions src/interp/inter_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,6 @@ initialize_interpreter(PARROT_INTERP, ARGIN(Parrot_GC_Init_Args *args))
{
ASSERT_ARGS(initialize_interpreter)

/* Need threads table to init gc */
Parrot_threads_init(interp);

/* Set up the memory allocation system */
Parrot_gc_initialize(interp, args);
Parrot_block_GC_mark(interp);
Expand Down
4 changes: 2 additions & 2 deletions src/ops/core_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -13336,7 +13336,7 @@ Parrot_load_language_sc(opcode_t *cur_opcode, PARROT_INTERP) {
opcode_t *
Parrot_branch_i(opcode_t *cur_opcode, PARROT_INTERP) {
if ((Parrot_cx_check_scheduler(interp, (cur_opcode + IREG(1))) == 0)) {
(return0);
return 0;
}

return (opcode_t *)cur_opcode + IREG(1);
Expand All @@ -13345,7 +13345,7 @@ Parrot_branch_i(opcode_t *cur_opcode, PARROT_INTERP) {
opcode_t *
Parrot_branch_ic(opcode_t *cur_opcode, PARROT_INTERP) {
if ((Parrot_cx_check_scheduler(interp, (cur_opcode + ICONST(1))) == 0)) {
(return0);
return 0;
}

return (opcode_t *)cur_opcode + ICONST(1);
Expand Down
2 changes: 1 addition & 1 deletion src/pmc/scheduler.pmc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Retrieves the number of pending tasks in the scheduler's task list.

VTABLE INTVAL get_integer() {
Parrot_Scheduler_attributes * core_struct = PARROT_SCHEDULER(SELF);
return VTABLE_elements(INTERP, core_struct->task_index);
return VTABLE_elements(INTERP, core_struct->task_queue);
}


Expand Down
8 changes: 0 additions & 8 deletions src/pmc/task.pmc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pmclass Task provides invokable auto_attrs {
ATTR PMC *code; /* An (optional) code for the task */
ATTR PMC *data; /* Additional data for the task */
ATTR INTVAL killed; /* Dead tasks don't get run */
ATTR INTVAL tidx; /* Which thread to signal if killed */
ATTR PMC *mailbox; /* List of incoming messages */
ATTR PMC *waiters; /* Tasks waiting on this one */
ATTR Parrot_jump_buff abort_jump; /* Jump buffer to abort task */
Expand Down Expand Up @@ -59,7 +58,6 @@ Initialize a concurrency task object.
core_struct->data = PMCNULL;
core_struct->interp = INTERP;
core_struct->killed = 0;
core_struct->tidx = -1;
core_struct->mailbox = Parrot_pmc_new(interp, enum_class_PMCList);
core_struct->waiters = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);

Expand Down Expand Up @@ -161,14 +159,12 @@ code as the first argument.
TASK_active_SET(SELF);

/* Actually run the task */
task->tidx = Parrot_threads_current(interp);
if (PMC_IS_NULL(task->data)) {
Parrot_ext_call(interp, task->code, "->");
}
else {
Parrot_ext_call(interp, task->code, "P->", task->data);
}
task->tidx = -1;
}

if (task->killed || !TASK_in_preempt_TEST(SELF)) {
Expand Down Expand Up @@ -403,10 +399,6 @@ Kill this task.
METHOD kill() {
Parrot_Task_attributes *tdata = PARROT_TASK(SELF);
tdata->killed = 1;

if (tdata->tidx >= 0) {
Parrot_threads_task_killed(interp, tdata->tidx);
}
}
}

Expand Down
Loading

0 comments on commit 856f3b2

Please sign in to comment.