mirror of https://github.com/rusefi/bldc.git
Squashed 'lispBM/lispBM/' changes from aba5cf5a..445930ec
445930ec lbm_wait_ctx waits for sleeepin contexts 70291809 Contexts that are sleeping considered as message passing receivers b99dd1df allowing 1.0e-2 d23fb19f removed unused data in eval_cps 96c45d4e added support for 1.0e3 notation git-subtree-dir: lispBM/lispBM git-subtree-split: 445930ec9307ad7d2863913145efd60f97a0315d
This commit is contained in:
parent
08c0898a0e
commit
e9123e197b
|
@ -1 +1,2 @@
|
|||
-I./include
|
||||
-I./include
|
||||
-I/usr/include
|
|
@ -134,7 +134,6 @@ static inline lbm_value cons_with_gc(lbm_value head, lbm_value tail, lbm_value r
|
|||
#define EVAL_CPS_WAIT_US 1536
|
||||
#define EVAL_CPS_MIN_SLEEP 200
|
||||
|
||||
|
||||
#define EVAL_STEPS_QUOTA 10
|
||||
static volatile uint32_t eval_steps_refill = EVAL_STEPS_QUOTA;
|
||||
static uint32_t eval_steps_quota = EVAL_STEPS_QUOTA;
|
||||
|
@ -144,8 +143,8 @@ void lbm_set_eval_step_quota(uint32_t quota) {
|
|||
}
|
||||
|
||||
static uint32_t eval_cps_run_state = EVAL_CPS_STATE_INIT;
|
||||
volatile uint32_t eval_cps_next_state = EVAL_CPS_STATE_INIT;
|
||||
volatile uint32_t eval_cps_next_state_arg = 0;
|
||||
static volatile uint32_t eval_cps_next_state = EVAL_CPS_STATE_INIT;
|
||||
static volatile uint32_t eval_cps_next_state_arg = 0;
|
||||
|
||||
/*
|
||||
On ChibiOs the CH_CFG_ST_FREQUENCY setting in chconf.h sets the
|
||||
|
@ -160,9 +159,7 @@ volatile uint32_t eval_cps_next_state_arg = 0;
|
|||
sleep duration possible is 2 * 100us = 200us.
|
||||
*/
|
||||
|
||||
static bool eval_running = false;
|
||||
static uint32_t next_ctx_id = 1;
|
||||
|
||||
static bool eval_running = false;
|
||||
static volatile bool blocking_extension = false;
|
||||
static bool is_atomic = false;
|
||||
|
||||
|
@ -534,6 +531,7 @@ bool lbm_wait_ctx(lbm_cid cid, lbm_uint timeout_ms) {
|
|||
exists = false;
|
||||
lbm_blocked_iterator(context_exists, &cid, &exists);
|
||||
lbm_running_iterator(context_exists, &cid, &exists);
|
||||
lbm_sleeping_iterator(context_exists, &cid, &exists);
|
||||
|
||||
if (ctx_running &&
|
||||
ctx_running->id == cid) {
|
||||
|
@ -733,6 +731,7 @@ void lbm_block_ctx_from_extension(void) {
|
|||
|
||||
lbm_value lbm_find_receiver_and_send(lbm_cid cid, lbm_value msg) {
|
||||
eval_context_t *found = NULL;
|
||||
bool found_sleeping = false;
|
||||
|
||||
found = lookup_ctx(&blocked, cid);
|
||||
|
||||
|
@ -740,6 +739,11 @@ lbm_value lbm_find_receiver_and_send(lbm_cid cid, lbm_value msg) {
|
|||
found = lookup_ctx(&queue, cid);
|
||||
}
|
||||
|
||||
if (found == NULL) {
|
||||
found = lookup_ctx(&sleeping, cid);
|
||||
found_sleeping = true;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
lbm_value new_mailbox = lbm_cons(msg, found->mailbox);
|
||||
|
||||
|
@ -749,10 +753,12 @@ lbm_value lbm_find_receiver_and_send(lbm_cid cid, lbm_value msg) {
|
|||
|
||||
found->mailbox = new_mailbox;
|
||||
|
||||
drop_ctx(&blocked,found);
|
||||
drop_ctx(&queue,found);
|
||||
if (!found_sleeping){
|
||||
drop_ctx(&blocked,found);
|
||||
drop_ctx(&queue,found);
|
||||
|
||||
enqueue_ctx(&queue,found);
|
||||
enqueue_ctx(&queue,found);
|
||||
}
|
||||
return ENC_SYM_TRUE;
|
||||
}
|
||||
|
||||
|
@ -2921,7 +2927,6 @@ void lbm_pause_eval_with_gc(uint32_t num_free) {
|
|||
eval_cps_next_state = EVAL_CPS_STATE_PAUSED;
|
||||
}
|
||||
|
||||
|
||||
void lbm_step_eval(void) {
|
||||
eval_cps_next_state_arg = 1;
|
||||
eval_cps_next_state = EVAL_CPS_STATE_STEP;
|
||||
|
@ -3040,7 +3045,6 @@ int lbm_eval_init() {
|
|||
done.first = NULL;
|
||||
done.last = NULL;
|
||||
ctx_running = NULL;
|
||||
next_ctx_id = 1;
|
||||
|
||||
eval_cps_run_state = EVAL_CPS_STATE_INIT;
|
||||
|
||||
|
|
18
src/tokpar.c
18
src/tokpar.c
|
@ -341,6 +341,7 @@ int tok_D(lbm_char_channel_t *chan, token_float *result) {
|
|||
fbuf[n] = c;
|
||||
n ++;
|
||||
}
|
||||
|
||||
else return TOKENIZER_NO_TOKEN;
|
||||
|
||||
res = lbm_channel_peek(chan,n, &c);
|
||||
|
@ -356,6 +357,23 @@ int tok_D(lbm_char_channel_t *chan, token_float *result) {
|
|||
if (res == CHANNEL_END) break;
|
||||
}
|
||||
|
||||
if (c == 'e') {
|
||||
fbuf[n] = c;
|
||||
n++;
|
||||
res = lbm_channel_peek(chan,n, &c);
|
||||
if (res == CHANNEL_MORE) return TOKENIZER_NEED_MORE;
|
||||
else if (res == CHANNEL_END) return TOKENIZER_NO_TOKEN;
|
||||
if (!((c >= '0' && c <= '9') || c == '-')) return TOKENIZER_NO_TOKEN;
|
||||
|
||||
while ((c >= '0' && c <= '9') || c == '-') {
|
||||
fbuf[n] = c;
|
||||
n++;
|
||||
res = lbm_channel_peek(chan, n, &c);
|
||||
if (res == CHANNEL_MORE) return TOKENIZER_NEED_MORE;
|
||||
if (res == CHANNEL_END) break;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t tok_res;
|
||||
int type_len = tok_match_fixed_size_tokens(chan, type_qual_table, n, NUM_TYPE_QUALIFIERS, &tok_res);
|
||||
|
||||
|
|
Loading…
Reference in New Issue