mirror of https://github.com/rusefi/bldc.git
Squashed 'lispBM/lispBM/' changes from 9559204f..046eb52e
046eb52e Change the eval_state state machine to not go into pause mode (visible outside) until after gc if instructed to run GC git-subtree-dir: lispBM/lispBM git-subtree-split: 046eb52e068c6f8ec15c8f8e7bd7b0c348edde1c
This commit is contained in:
parent
0af11fc982
commit
d48a2e0f78
|
@ -169,7 +169,7 @@ lbm_value ext_print(lbm_value *args, lbm_uint argn) {
|
||||||
lbm_array_header_t *array = (lbm_array_header_t *)lbm_car(t);
|
lbm_array_header_t *array = (lbm_array_header_t *)lbm_car(t);
|
||||||
switch (array->elt_type){
|
switch (array->elt_type){
|
||||||
case LBM_VAL_TYPE_CHAR: {
|
case LBM_VAL_TYPE_CHAR: {
|
||||||
char *data = (char*)array + 8;
|
char *data = (char*)array->data;
|
||||||
printf("%s", data);
|
printf("%s", data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1919,24 +1919,24 @@ void lbm_run_eval(void){
|
||||||
|
|
||||||
while (eval_running) {
|
while (eval_running) {
|
||||||
|
|
||||||
uint32_t prev_state = eval_cps_run_state;
|
//uint32_t prev_state = eval_cps_run_state;
|
||||||
eval_cps_run_state = eval_cps_next_state;
|
//eval_cps_run_state = eval_cps_next_state;
|
||||||
|
|
||||||
switch (eval_cps_run_state) {
|
switch (eval_cps_next_state) {
|
||||||
case EVAL_CPS_STATE_INIT:
|
case EVAL_CPS_STATE_INIT:
|
||||||
eval_cps_next_state = EVAL_CPS_STATE_RUNNING;
|
eval_cps_run_state = EVAL_CPS_STATE_RUNNING;
|
||||||
break;
|
break;
|
||||||
case EVAL_CPS_STATE_STEP:
|
case EVAL_CPS_STATE_STEP:
|
||||||
eval_cps_next_state = EVAL_CPS_STATE_PAUSED;
|
eval_cps_run_state = EVAL_CPS_STATE_PAUSED;
|
||||||
break;
|
break;
|
||||||
case EVAL_CPS_STATE_PAUSED:
|
case EVAL_CPS_STATE_PAUSED:
|
||||||
if (prev_state != EVAL_CPS_STATE_PAUSED) {
|
if (eval_cps_run_state != EVAL_CPS_STATE_PAUSED) {
|
||||||
if (lbm_heap_num_free() < eval_cps_next_state_arg) {
|
if (lbm_heap_num_free() < eval_cps_next_state_arg) {
|
||||||
gc(NIL, NIL);
|
gc(NIL, NIL);
|
||||||
}
|
}
|
||||||
eval_cps_next_state_arg = 0;
|
eval_cps_next_state_arg = 0;
|
||||||
}
|
}
|
||||||
eval_cps_next_state = EVAL_CPS_STATE_PAUSED;
|
eval_cps_run_state = EVAL_CPS_STATE_PAUSED;
|
||||||
usleep_callback(EVAL_CPS_MIN_SLEEP);
|
usleep_callback(EVAL_CPS_MIN_SLEEP);
|
||||||
continue; /* jump back to start of eval_running loop */
|
continue; /* jump back to start of eval_running loop */
|
||||||
case EVAL_CPS_STATE_KILL:
|
case EVAL_CPS_STATE_KILL:
|
||||||
|
|
|
@ -168,7 +168,7 @@ int lbm_define(char *symbol, lbm_value value) {
|
||||||
if (lbm_get_eval_state() == EVAL_CPS_STATE_PAUSED) {
|
if (lbm_get_eval_state() == EVAL_CPS_STATE_PAUSED) {
|
||||||
|
|
||||||
if (!lbm_get_symbol_by_name(symbol, &sym_id)) {
|
if (!lbm_get_symbol_by_name(symbol, &sym_id)) {
|
||||||
if (!lbm_add_symbol(symbol, &sym_id)) {
|
if (!lbm_add_symbol_const(symbol, &sym_id)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue