summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-23 10:26:33 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-23 10:26:33 +0200
commit95e610d89a635027886849dc460d1ad3d6d9c50b (patch)
tree36e80eeef1f784a1c31bc83fc408f27c9ee35bd4
parent007efb5f05e33dee024da658077fe3e4977993bc (diff)
eo: call stack remove stack->dropcount
stack->shrink_frame does the same but more efficiently change the value of EO_CALL_STACK_SHRINK_DROP if needed
-rw-r--r--src/lib/eo/eo.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 3ab323f..3957e8f 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -281,7 +281,6 @@ typedef struct _Eo_Call_Stack {
281 Eo_Stack_Frame *last_frame; 281 Eo_Stack_Frame *last_frame;
282 Eo_Stack_Frame *shrink_frame; 282 Eo_Stack_Frame *shrink_frame;
283 size_t max_size; 283 size_t max_size;
284 int dropcount;
285} Eo_Call_Stack; 284} Eo_Call_Stack;
286 285
287#define MEM_PAGE_SIZE 4096 286#define MEM_PAGE_SIZE 4096
@@ -427,23 +426,9 @@ _eo_call_stack_resize(Eo_Call_Stack *stack, Eina_Bool grow)
427 426
428 sz = stack->last_frame - stack->frames + 1; 427 sz = stack->last_frame - stack->frames + 1;
429 if (grow) 428 if (grow)
430 { 429 next_sz = sz * 2;
431 next_sz = sz * 2;
432 // reset drop counter to avoid dropping stack for up to 2 ^ 18
433 // requests/tries
434 stack->dropcount = 1 << 18;
435 }
436 else 430 else
437 { 431 next_sz = sz / 2;
438 // if we want to drop - delay if dropcounter still > 0 and drop it
439 if (stack->dropcount > 0)
440 {
441 stack->dropcount--;
442 return;
443 }
444 // actually drop
445 next_sz = sz / 2;
446 }
447 frame_offset = stack->frame_ptr - stack->frames; 432 frame_offset = stack->frame_ptr - stack->frames;
448 433
449 DBG("resize from %lu to %lu", (long unsigned int)sz, (long unsigned int)next_sz); 434 DBG("resize from %lu to %lu", (long unsigned int)sz, (long unsigned int)next_sz);
@@ -568,7 +553,7 @@ _eo_do_end(const Eo **eo_id EINA_UNUSED)
568 553
569 stack->frame_ptr--; 554 stack->frame_ptr--;
570 555
571 if (fptr <= stack->shrink_frame) 556 if (fptr == stack->shrink_frame)
572 _eo_call_stack_resize(stack, EINA_FALSE); 557 _eo_call_stack_resize(stack, EINA_FALSE);
573} 558}
574 559