Skip to content

Commit dfcd893

Browse files
committed
Delete unimplemented TASK! stub
TASK! was an unfinished feature of R3-Alpha. The basic idea was that one would be able to do something like a MAKE OBJECT! in which the object's context variables would be isolated to itself... and it would run on an independent thread. Rebol's performance story depended on reuse of several large preallocated global buffers. So the plan had been to use thread-local storage (a feature not standardized until the 2011 C and C++ specs) to mark these global buffers as being instantiated one per thread. So if one of these temporary buffers was used in one thread, it would not trip up another. That work alone was nowhere near the amount of work required to tell a coherent multithreading story. Even at the lowest levels of memory allocation there was no thread safety. If two threads tried to do a memory allocation from the memory pools, they could trip each other up on the internal pointers used for bookkeeping. That's to say nothing of the higher level issues of series management. Regardless of what the long-term multithreading story is for Rebol (and Red), it does not seem fitting to expose users to things like mutexes and semaphores--with the penalty of getting it wrong being a crashing program. Hence there is no acceptable path forward for the stub implementation that was beginning. The practical way to do what TASK! was doing would be to launch independent Rebol processes and exchange information between them (perhaps through something like a ZeroMQ binding). Because modern operating systems only load one copy of the code pages when multiple copies of the same executable are loaded, this would have basically the same overhead as a working TASK! implementation would have had. What is *really* needed to help Rebol in the thread department is to have what the V8 JavaScript engine calls "isolates". This means getting rid of the thread-local-storage concept and instead allowing a single process to hold independent sessions that don't interact with each other directly. This is important in order to have a REPL and debugger that is implemented in Rebol; so that independent interpreter stacks can be running without interfering with each other. The other thing that would be a priority would be to stylize the code in such a way that a garbage collector thread could run concurrently with the evaluator. This is a completely different problem. The tentative strategy for it would lean heavily on C++; hence the pure C build would only be able to use "stop the world" garbage collection.
1 parent dc06920 commit dfcd893

File tree

15 files changed

+4
-280
lines changed

15 files changed

+4
-280
lines changed

make/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ set (CORE_SOURCE
273273
${CORE_DIR}/c-path.c
274274
${CORE_DIR}/c-port.c
275275
${CORE_DIR}/c-signal.c
276-
${CORE_DIR}/c-task.c
277276
${CORE_DIR}/c-word.c
278277
${CORE_DIR}/c-value.c
279278
${CORE_DIR}/d-break.c

src/boot/types.r

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ object context * f* * * context
110110
frame context * f* * * context
111111
module context * f* * * context
112112
error context + f+ * * context
113-
task context + + * * context
114113
port port context context context * context
115114

116115
gob gob * * * * -

src/boot/typespec.r

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ set-word ["definition of a word's value" word]
5757
string ["string series of characters" string]
5858
struct ["native structure definition" block]
5959
tag ["markup string (HTML or XML)" string]
60-
task ["evaluation environment" context]
6160
time ["time of day or duration" scalar]
6261
tuple ["sequence of small integers (colors, versions, IP)" scalar]
6362
typeset ["set of datatypes" opt-object]

src/core/c-task.c

Lines changed: 0 additions & 108 deletions
This file was deleted.

src/core/e-func-symbols.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ const void *rebol_symbols [] = {
129129
SYM_FUNC(Init_Ports), // c-port.c
130130
SYM_FUNC(Shutdown_Ports), // c-port.c
131131
SYM_FUNC(Do_Signals_Throws), // c-signal.c
132-
SYM_FUNC(Do_Task), // c-task.c
133132
#if defined(__cplusplus) && !defined(NDEBUG)
134133
SYM_FUNC(Assert_Cell_Writable), // c-value.c
135134
#endif

src/core/m-gc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,6 @@ void Queue_Mark_Value_Deep(const RELVAL *val)
754754
Queue_Mark_Array_Deep(VAL_TYPE_SPEC(val));
755755
break;
756756

757-
case REB_TASK: // not yet implemented
758-
fail (Error(RE_MISC));
759-
760757
case REB_OBJECT:
761758
case REB_MODULE:
762759
case REB_PORT:

src/core/n-control.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,13 +1089,10 @@ REBNATIVE(do)
10891089

10901090
f->varlist = CTX_VARLIST(VAL_CONTEXT(value)); // need w/NULL def
10911091

1092-
return Apply_Frame_Core(f, Canon(SYM___ANONYMOUS__), NULL);
1093-
}
1092+
return Apply_Frame_Core(f, Canon(SYM___ANONYMOUS__), NULL); }
10941093

1095-
case REB_TASK:
1096-
Do_Task(value);
1097-
*D_OUT = *value;
1098-
return R_OUT;
1094+
default:
1095+
break;
10991096
}
11001097

11011098
// Note: it is not possible to write a wrapper function in Rebol

src/core/s-crc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ REBCNT Hash_Value(const RELVAL *v, REBCTX *specifier)
353353
ret = cast(REBCNT, cast(REBUPT, VAL_MAP(v)) >> 4);
354354
break;
355355

356-
case REB_TASK:
357356
case REB_GOB:
358357
case REB_EVENT:
359358
case REB_HANDLE:

src/core/s-mold.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,10 +1433,6 @@ void Mold_Value(REB_MOLD *mold, const RELVAL *value, REBOOL molded)
14331433
else Mold_Object(const_KNOWN(value), mold);
14341434
break;
14351435

1436-
case REB_TASK:
1437-
Mold_Object(const_KNOWN(value), mold);
1438-
break;
1439-
14401436
case REB_ERROR:
14411437
Mold_Error(const_KNOWN(value), mold, molded);
14421438
break;

src/include/sys-core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ enum {
342342

343343
#define TS_NOT_COPIED \
344344
(FLAGIT_KIND(REB_IMAGE) | FLAGIT_KIND(REB_VECTOR) \
345-
| FLAGIT_KIND(REB_TASK) | FLAGIT_KIND(REB_PORT))
345+
| FLAGIT_KIND(REB_PORT))
346346

347347
#define TS_STD_SERIES (TS_SERIES & ~TS_NOT_COPIED)
348348
#define TS_SERIES_OBJ ((TS_SERIES | TS_CONTEXT) & ~TS_NOT_COPIED)

0 commit comments

Comments
 (0)