mirror of https://github.com/rusefi/bldc.git
Squashed 'lispBM/lispBM/' changes from 2d281d94..1eceb43f
1eceb43f sdlrepl 1M lbm memory d1803070 removing the done queue that is nolonger used for anything 84820a1d fix bug in recv bb4c5f40 tweaks to SDL repl. Compiles again git-subtree-dir: lispBM/lispBM git-subtree-split: 1eceb43f0fa3acc88f4b79a9e0a9e5517f9e991d
This commit is contained in:
parent
d5c3736ba7
commit
196bb2e812
|
@ -204,13 +204,6 @@ void lbm_blocked_iterator(ctx_fun f, void*, void*);
|
|||
* \param arg1 Pointer argument that can be used to convey information back to user.
|
||||
* \param arg2 Same as above
|
||||
*/
|
||||
void lbm_done_iterator(ctx_fun f, void*, void*);
|
||||
/** Iterate over all sleeping contexts and apply function on each context.
|
||||
*
|
||||
* \param f Function to apply to each context.
|
||||
* \param arg1 Pointer argument that can be used to convey information back to user.
|
||||
* \param arg2 Same as above.
|
||||
*/
|
||||
void lbm_sleeping_iterator(ctx_fun f, void *, void *);
|
||||
/** toggle verbosity level of error messages
|
||||
*/
|
||||
|
|
13
repl/repl.c
13
repl/repl.c
|
@ -679,24 +679,12 @@ int main(int argc, char **argv) {
|
|||
lbm_blocked_iterator(print_ctx_info, NULL, NULL);
|
||||
printf("****** Sleeping contexts *****\n");
|
||||
lbm_sleeping_iterator(print_ctx_info, NULL, NULL);
|
||||
printf("****** Done contexts ******\n");
|
||||
lbm_done_iterator(print_ctx_info, NULL, NULL);
|
||||
free(str);
|
||||
} else if (strncmp(str, ":unblock", 8) == 0) {
|
||||
int id = atoi(str + 8);
|
||||
printf("Unblocking: %d\n", id);
|
||||
lbm_unblock_ctx(id, lbm_enc_i(42));
|
||||
free(str);
|
||||
} else if (strncmp(str, ":wait", 5) == 0) {
|
||||
int id = atoi(str + 5);
|
||||
bool exists = false;
|
||||
lbm_done_iterator(ctx_exists, (void*)&id, (void*)&exists);
|
||||
if (exists) {
|
||||
if (!lbm_wait_ctx((lbm_cid)id, WAIT_TIMEOUT)) {
|
||||
printf("Timout while waiting for context %d\n", id);
|
||||
}
|
||||
}
|
||||
free(str);
|
||||
} else if (n >= 5 && strncmp(str, ":quit", 5) == 0) {
|
||||
free(str);
|
||||
break;
|
||||
|
@ -828,7 +816,6 @@ int main(int argc, char **argv) {
|
|||
if (lbm_get_symbol_by_name(sym, &sym_id)) {
|
||||
lbm_running_iterator(lookup_local, (void*)lbm_enc_sym(sym_id), (void*)sym);
|
||||
lbm_blocked_iterator(lookup_local, (void*)lbm_enc_sym(sym_id), (void*)sym);
|
||||
lbm_done_iterator(lookup_local, (void*)lbm_enc_sym(sym_id), (void*)sym);
|
||||
} else {
|
||||
printf("symbol does not exist\n");
|
||||
}
|
||||
|
|
|
@ -479,8 +479,8 @@ void sym_it(const char *str) {
|
|||
printf("%s\n", str);
|
||||
}
|
||||
|
||||
static lbm_uint memory[LBM_MEMORY_SIZE_8K];
|
||||
static lbm_uint bitmap[LBM_MEMORY_BITMAP_SIZE_8K];
|
||||
static lbm_uint memory[LBM_MEMORY_SIZE_1M];
|
||||
static lbm_uint bitmap[LBM_MEMORY_BITMAP_SIZE_1M];
|
||||
|
||||
char char_array[1024];
|
||||
lbm_uint word_array[1024];
|
||||
|
@ -512,8 +512,8 @@ int main(int argc, char **argv) {
|
|||
|
||||
if (!lbm_init(heap_storage, heap_size,
|
||||
gc_stack_storage, GC_STACK_SIZE,
|
||||
memory, LBM_MEMORY_SIZE_8K,
|
||||
bitmap, LBM_MEMORY_BITMAP_SIZE_8K,
|
||||
memory, LBM_MEMORY_SIZE_1M,
|
||||
bitmap, LBM_MEMORY_BITMAP_SIZE_1M,
|
||||
print_stack_storage, PRINT_STACK_SIZE,
|
||||
extension_storage, EXTENSION_STORAGE_SIZE)) {
|
||||
printf("Failed to initialize LispBM\n");
|
||||
|
@ -559,12 +559,6 @@ int main(int argc, char **argv) {
|
|||
else
|
||||
printf("Error adding extension.\n");
|
||||
|
||||
res = lbm_add_extension("range", ext_range);
|
||||
if (res)
|
||||
printf("Extension added.\n");
|
||||
else
|
||||
printf("Error adding extension.\n");
|
||||
|
||||
res = lbm_add_extension("custom", ext_custom);
|
||||
if (res)
|
||||
printf("Extension added.\n");
|
||||
|
@ -677,24 +671,12 @@ int main(int argc, char **argv) {
|
|||
lbm_running_iterator(print_ctx_info, NULL, NULL);
|
||||
printf("****** Blocked contexts ******\n");
|
||||
lbm_blocked_iterator(print_ctx_info, NULL, NULL);
|
||||
printf("****** Done contexts ******\n");
|
||||
lbm_done_iterator(print_ctx_info, NULL, NULL);
|
||||
free(str);
|
||||
} else if (strncmp(str, ":unblock", 8) == 0) {
|
||||
int id = atoi(str + 8);
|
||||
printf("Unblocking: %d\n", id);
|
||||
lbm_unblock_ctx(id, lbm_enc_i(42));
|
||||
free(str);
|
||||
} else if (strncmp(str, ":wait", 5) == 0) {
|
||||
int id = atoi(str + 5);
|
||||
bool exists = false;
|
||||
lbm_done_iterator(ctx_exists, (void*)&id, (void*)&exists);
|
||||
if (exists) {
|
||||
if (!lbm_wait_ctx((lbm_cid)id, WAIT_TIMEOUT)) {
|
||||
printf("Timout while waiting for context %d\n", id);
|
||||
}
|
||||
}
|
||||
free(str);
|
||||
} else if (n >= 5 && strncmp(str, ":quit", 5) == 0) {
|
||||
free(str);
|
||||
break;
|
||||
|
@ -716,8 +698,8 @@ int main(int argc, char **argv) {
|
|||
|
||||
lbm_init(heap_storage, heap_size,
|
||||
gc_stack_storage, GC_STACK_SIZE,
|
||||
memory, LBM_MEMORY_SIZE_8K,
|
||||
bitmap, LBM_MEMORY_BITMAP_SIZE_8K,
|
||||
memory, LBM_MEMORY_SIZE_1M,
|
||||
bitmap, LBM_MEMORY_BITMAP_SIZE_1M,
|
||||
print_stack_storage, PRINT_STACK_SIZE,
|
||||
extension_storage, EXTENSION_STORAGE_SIZE);
|
||||
|
||||
|
@ -758,8 +740,8 @@ int main(int argc, char **argv) {
|
|||
|
||||
lbm_init(heap_storage, heap_size,
|
||||
gc_stack_storage, GC_STACK_SIZE,
|
||||
memory, LBM_MEMORY_SIZE_8K,
|
||||
bitmap, LBM_MEMORY_BITMAP_SIZE_8K,
|
||||
memory, LBM_MEMORY_SIZE_1M,
|
||||
bitmap, LBM_MEMORY_BITMAP_SIZE_1M,
|
||||
print_stack_storage, PRINT_STACK_SIZE,
|
||||
extension_storage, EXTENSION_STORAGE_SIZE);
|
||||
|
||||
|
@ -815,12 +797,6 @@ int main(int argc, char **argv) {
|
|||
} else if (strncmp(str, ":continue", 9) == 0) {
|
||||
lbm_continue_eval();
|
||||
free(str);
|
||||
} else if (strncmp(str, ":step", 5) == 0) {
|
||||
|
||||
int num = atoi(str + 5);
|
||||
|
||||
lbm_step_n_eval((uint32_t)num);
|
||||
free(str);
|
||||
} else if (strncmp(str, ":undef", 6) == 0) {
|
||||
lbm_pause_eval();
|
||||
while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) {
|
||||
|
|
|
@ -191,7 +191,6 @@ typedef struct {
|
|||
static eval_context_queue_t blocked = {NULL, NULL};
|
||||
static eval_context_queue_t sleeping = {NULL, NULL};
|
||||
static eval_context_queue_t queue = {NULL, NULL};
|
||||
static eval_context_queue_t done = {NULL, NULL};
|
||||
|
||||
/* one mutex for all queue operations */
|
||||
mutex_t qmutex;
|
||||
|
@ -412,10 +411,6 @@ void lbm_blocked_iterator(ctx_fun f, void *arg1, void *arg2){
|
|||
queue_iterator(&blocked, f, arg1, arg2);
|
||||
}
|
||||
|
||||
void lbm_done_iterator(ctx_fun f, void *arg1, void *arg2){
|
||||
queue_iterator(&done, f, arg1, arg2);
|
||||
}
|
||||
|
||||
void lbm_sleeping_iterator(ctx_fun f, void *arg1, void *arg2){
|
||||
queue_iterator(&sleeping, f, arg1, arg2);
|
||||
}
|
||||
|
@ -1467,6 +1462,7 @@ static void eval_receive(eval_context_t *ctx) {
|
|||
int n = find_match(lbm_cdr(pats), msgs, num, &e, &new_env);
|
||||
if (n == FM_NEED_GC) {
|
||||
gc();
|
||||
new_env = ctx->curr_env;
|
||||
n = find_match(lbm_cdr(pats), msgs, num, &e, &new_env);
|
||||
if (n == FM_NEED_GC) {
|
||||
ctx_running->done = true;
|
||||
|
@ -3215,8 +3211,6 @@ int lbm_eval_init() {
|
|||
sleeping.last = NULL;
|
||||
queue.first = NULL;
|
||||
queue.last = NULL;
|
||||
done.first = NULL;
|
||||
done.last = NULL;
|
||||
ctx_running = NULL;
|
||||
|
||||
eval_cps_run_state = EVAL_CPS_STATE_RUNNING;
|
||||
|
|
Loading…
Reference in New Issue