cdsspec-compiler.git
12 years agomalloc: override 'new' and 'delete' globally
Brian Norris [Thu, 5 Apr 2012 02:41:46 +0000 (19:41 -0700)]
malloc: override 'new' and 'delete' globally

Not sure if this is correct...

Q: do we also need to overload new[] and delete[]?

12 years agomalloc: add myMalloc() and myFree()
Brian Norris [Thu, 5 Apr 2012 02:35:41 +0000 (19:35 -0700)]
malloc: add myMalloc() and myFree()

12 years agocommon: rename "CONFIG" to "COMMON"
Brian Norris [Thu, 5 Apr 2012 02:12:19 +0000 (19:12 -0700)]
common: rename "CONFIG" to "COMMON"

12 years agoschedule: use STL 'queue' instead of 'list'
Brian Norris [Thu, 15 Mar 2012 18:12:44 +0000 (11:12 -0700)]
schedule: use STL 'queue' instead of 'list'

12 years agoremove unnecessary #includes
Brian Norris [Thu, 15 Mar 2012 06:01:27 +0000 (23:01 -0700)]
remove unnecessary #includes

12 years agoschedule: make 'current' a private member of the scheduler
Brian Norris [Thu, 15 Mar 2012 05:56:30 +0000 (22:56 -0700)]
schedule: make 'current' a private member of the scheduler

12 years agoschedule: use STL list class instead of custom queue
Brian Norris [Thu, 15 Mar 2012 05:52:42 +0000 (22:52 -0700)]
schedule: use STL list class instead of custom queue

12 years agorename other *.c to *.cc
Brian Norris [Wed, 14 Mar 2012 22:59:49 +0000 (15:59 -0700)]
rename other *.c to *.cc

userprog.c remains for now...

12 years agoschedule: move schedule.c --> schedule.cc
Brian Norris [Wed, 14 Mar 2012 22:56:56 +0000 (15:56 -0700)]
schedule: move schedule.c --> schedule.cc

12 years agoschedule: create 'class Scheduler' with implementation 'class DefaultScheduler'
Brian Norris [Wed, 14 Mar 2012 22:54:36 +0000 (15:54 -0700)]
schedule: create 'class Scheduler' with implementation 'class DefaultScheduler'

12 years agolibthreads: delete allocated object
Brian Norris [Wed, 14 Mar 2012 22:10:31 +0000 (15:10 -0700)]
libthreads: delete allocated object

12 years agomodel: use 'this' uniformly
Brian Norris [Wed, 14 Mar 2012 22:08:25 +0000 (15:08 -0700)]
model: use 'this' uniformly

12 years agomodel: move model.c --> model.cc
Brian Norris [Wed, 14 Mar 2012 22:07:04 +0000 (15:07 -0700)]
model: move model.c --> model.cc

12 years agomodel: change 'struct model_checker' to 'class ModelChecker'
Brian Norris [Wed, 14 Mar 2012 22:05:54 +0000 (15:05 -0700)]
model: change 'struct model_checker' to 'class ModelChecker'

12 years agoMakefile: switch to C++ builds
Brian Norris [Wed, 14 Mar 2012 22:00:46 +0000 (15:00 -0700)]
Makefile: switch to C++ builds

12 years agostricter typing of function pointers for makecontext()
Brian Norris [Tue, 13 Mar 2012 18:37:45 +0000 (11:37 -0700)]
stricter typing of function pointers for makecontext()

We need to use functions with no arguments (i.e., 'void (*)()') in order to
retain strict type-checking with makecontext(). Of course, we still circumvent
this type checking with casting, but we should straighten this out sometime...

12 years agoC++: don't use C++ keywords as names (this, new, etc.)
Brian Norris [Tue, 13 Mar 2012 18:35:55 +0000 (11:35 -0700)]
C++: don't use C++ keywords as names (this, new, etc.)

12 years agoC++: cast result of malloc
Brian Norris [Tue, 13 Mar 2012 18:35:09 +0000 (11:35 -0700)]
C++: cast result of malloc

12 years agoterminology - use 'thread id' instead of 'thread index'
Brian Norris [Tue, 13 Mar 2012 06:10:26 +0000 (23:10 -0700)]
terminology - use 'thread id' instead of 'thread index'

12 years agolibthreads: use model-checker's thread ID assignment
Brian Norris [Tue, 13 Mar 2012 06:08:12 +0000 (23:08 -0700)]
libthreads: use model-checker's thread ID assignment

12 years agomodel: add thread ID assignment function
Brian Norris [Tue, 13 Mar 2012 06:07:47 +0000 (23:07 -0700)]
model: add thread ID assignment function

12 years agolibthreads: separate private functions from user interface
Brian Norris [Tue, 13 Mar 2012 05:28:14 +0000 (22:28 -0700)]
libthreads: separate private functions from user interface

12 years agolibthreads: perform all scheduling/model-checking from master thread
Brian Norris [Tue, 13 Mar 2012 03:51:25 +0000 (20:51 -0700)]
libthreads: perform all scheduling/model-checking from master thread

To keep all user-space actions under control, we should perform all scheduling
and model-checking from the main system thread. This pushes some of the
thread_yield() logic to a system function (as desired).

12 years agolibthreads: add THREAD_* states
Brian Norris [Tue, 13 Mar 2012 03:38:18 +0000 (20:38 -0700)]
libthreads: add THREAD_* states

12 years agoschedule: exit if we run out of linked-list nodes
Brian Norris [Mon, 12 Mar 2012 23:52:04 +0000 (16:52 -0700)]
schedule: exit if we run out of linked-list nodes

12 years agomodel: move 'main_thread' to model_checker struct
Brian Norris [Mon, 12 Mar 2012 23:14:11 +0000 (16:14 -0700)]
model: move 'main_thread' to model_checker struct

12 years agomove 'current thread' details
Brian Norris [Mon, 12 Mar 2012 23:06:14 +0000 (16:06 -0700)]
move 'current thread' details

The low level details regarding the 'current thread' should be encapsulated in
the scheduler (i.e., 'get_current_thread()'). So we move the 'current' variable
to scheduler.c.

12 years agolibthreads: utilize new model_checker framework
Brian Norris [Mon, 12 Mar 2012 22:52:44 +0000 (15:52 -0700)]
libthreads: utilize new model_checker framework

Just a simple drop-in of the current FCFS scheduler (with the ability to
generically switch out schedulers).

12 years agomodel: add global model_checker initialization
Brian Norris [Mon, 12 Mar 2012 22:51:56 +0000 (15:51 -0700)]
model: add global model_checker initialization

12 years agoschedule: add replaceable scheduler struct
Brian Norris [Mon, 12 Mar 2012 22:49:59 +0000 (15:49 -0700)]
schedule: add replaceable scheduler struct

I may need to replace the scheduler in the future, so modularize it.

12 years agomodel: add stub model.[hc] files
Brian Norris [Sat, 10 Mar 2012 04:19:47 +0000 (20:19 -0800)]
model: add stub model.[hc] files

12 years agouserprog: separate test 'program' out to userprog.c
Brian Norris [Sat, 10 Mar 2012 03:18:43 +0000 (19:18 -0800)]
userprog: separate test 'program' out to userprog.c

12 years agolibatomic: add stub atomic lib header/source
Brian Norris [Sat, 10 Mar 2012 03:00:50 +0000 (19:00 -0800)]
libatomic: add stub atomic lib header/source

Stub implementations, for testing.

(Temporary: need to find a better generic atomic_int, atomic_long, etc.
implementation)

12 years agolibthreads: use 'void' in argument list
Brian Norris [Sat, 10 Mar 2012 03:06:31 +0000 (19:06 -0800)]
libthreads: use 'void' in argument list

12 years agolibthreads: export thread_yield()
Brian Norris [Sat, 10 Mar 2012 03:04:00 +0000 (19:04 -0800)]
libthreads: export thread_yield()

We export this for now. The function will need to change for long-term exported
use though.

12 years agoschedule: return next thread pointer directly
Brian Norris [Sat, 10 Mar 2012 02:22:50 +0000 (18:22 -0800)]
schedule: return next thread pointer directly

It's better to just return a pointer to the 'next' thread, rather than
sending it through the argument list.

12 years agoschedule: include libthreads.h
Brian Norris [Sat, 10 Mar 2012 02:22:11 +0000 (18:22 -0800)]
schedule: include libthreads.h

12 years agoMakefile: turn on all warnings
Brian Norris [Sat, 10 Mar 2012 02:21:12 +0000 (18:21 -0800)]
Makefile: turn on all warnings

(That's how I caught the previous error...)

12 years agolibthreads: include schedule.h (previous mistake...)
Brian Norris [Sat, 10 Mar 2012 02:20:39 +0000 (18:20 -0800)]
libthreads: include schedule.h (previous mistake...)

12 years agoMakefile: use ${CC} instead of hardcoding gcc
Brian Norris [Sat, 10 Mar 2012 01:46:46 +0000 (17:46 -0800)]
Makefile: use ${CC} instead of hardcoding gcc

12 years agocommon.h: move common code (non-user) to header
Brian Norris [Sat, 10 Mar 2012 01:37:05 +0000 (17:37 -0800)]
common.h: move common code (non-user) to header

Enable us to include libthreads.h in a "user program".

12 years agolibthreads: add thread_current() function
Brian Norris [Sat, 10 Mar 2012 01:28:15 +0000 (17:28 -0800)]
libthreads: add thread_current() function

Keeps along the lines of C11/C++11.

C11: thrd_t thrd_current(void);
C++11: namespace this_thread

12 years agolibthreads: remove unused codepath
Brian Norris [Sat, 10 Mar 2012 01:10:35 +0000 (17:10 -0800)]
libthreads: remove unused codepath

12 years agolibthreads: cleanup startup/exit functions
Brian Norris [Sat, 10 Mar 2012 01:08:21 +0000 (17:08 -0800)]
libthreads: cleanup startup/exit functions

Free the stacks
Push thread exit management into thread_wait_finish() function

12 years agomodify "user program"
Brian Norris [Sat, 10 Mar 2012 01:05:48 +0000 (17:05 -0800)]
modify "user program"

12 years agoschedule: set thread to NULL when there is no next thread
Brian Norris [Sat, 10 Mar 2012 00:49:03 +0000 (16:49 -0800)]
schedule: set thread to NULL when there is no next thread

12 years agoreformat DEBUG messages
Brian Norris [Fri, 9 Mar 2012 23:31:45 +0000 (15:31 -0800)]
reformat DEBUG messages

12 years agolibthreads: export thread_join() in header
Brian Norris [Fri, 9 Mar 2012 23:18:57 +0000 (15:18 -0800)]
libthreads: export thread_join() in header

12 years agolibthreads: merge thread_create() and thread_start()
Brian Norris [Fri, 9 Mar 2012 23:18:07 +0000 (15:18 -0800)]
libthreads: merge thread_create() and thread_start()

12 years agoschedule: add scheduler, thread_yield(), etc.
Brian Norris [Fri, 9 Mar 2012 07:36:48 +0000 (23:36 -0800)]
schedule: add scheduler, thread_yield(), etc.

Could use some cleanup still...

12 years agolibthreads: fixups
Brian Norris [Fri, 9 Mar 2012 07:36:20 +0000 (23:36 -0800)]
libthreads: fixups

12 years agolibthreads: cleanup main thread initialization
Brian Norris [Fri, 9 Mar 2012 00:12:01 +0000 (16:12 -0800)]
libthreads: cleanup main thread initialization

Create a "thread" for the primary context, rather than handling special logic
for a separate "cleanup" ucontext_t.

12 years agoadd "make tags" (using `ctags`)
Brian Norris [Fri, 9 Mar 2012 00:03:45 +0000 (16:03 -0800)]
add "make tags" (using `ctags`)

12 years agolibthreads: create header file
Brian Norris [Thu, 8 Mar 2012 23:41:34 +0000 (15:41 -0800)]
libthreads: create header file

12 years agolibthreads: remove superfluous code
Brian Norris [Thu, 8 Mar 2012 23:32:23 +0000 (15:32 -0800)]
libthreads: remove superfluous code

The thread.started field is unnecessary for now.

The initial getcontext() call is unecessary as well. swapcontext() is
better for most instances where we are not creating a new thread.

Remove question mark ('?') from last statement.

12 years agoadd .gitignore
Brian Norris [Thu, 8 Mar 2012 02:13:16 +0000 (18:13 -0800)]
add .gitignore

12 years agoinitial commit
Brian Norris [Thu, 8 Mar 2012 02:10:59 +0000 (18:10 -0800)]
initial commit

Basic working copy of "threads," which execute until completion as soon as
they are launched.