Enlightenment CVS committal Author : raster Project : e17 Module : libs/edje
Dir : e17/libs/edje/src/lib Modified Files: edje_embryo.c edje_message_queue.c edje_private.h edje_var.c Log Message: push/pop vm on the fly - saves a chunk of ram. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_embryo.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -3 -r1.46 -r1.47 --- edje_embryo.c 9 Oct 2005 09:49:53 -0000 1.46 +++ edje_embryo.c 24 Nov 2005 03:23:01 -0000 1.47 @@ -208,8 +208,6 @@ if ((___cptr = (int *)embryo_data_address_get(ep, (par)))) { \ *___cptr = (int)val;}} -static void _edje_embryo_globals_init(Edje *ed); - /* get_int(id) */ static Embryo_Cell _edje_embryo_fn_get_int(Embryo_Program *ep, Embryo_Cell *params) @@ -1815,9 +1813,9 @@ embryo_program_native_call_add(ep, "custom_state", _edje_embryo_fn_custom_state); embryo_program_native_call_add(ep, "set_state_val", _edje_embryo_fn_set_state_val); embryo_program_native_call_add(ep, "get_state_val", _edje_embryo_fn_get_state_val); - - embryo_program_vm_push(ep); /* need a new vm to run in */ - _edje_embryo_globals_init(ed); + +// embryo_program_vm_push(ed->collection->script); +// _edje_embryo_globals_init(ed); } void @@ -1827,7 +1825,7 @@ if (!ed->collection) return; if (!ed->collection->script) return; if (embryo_program_recursion_get(ed->collection->script) > 0) return; - embryo_program_vm_pop(ed->collection->script); +// embryo_program_vm_pop(ed->collection->script); embryo_program_free(ed->collection->script); ed->collection->script = NULL; } @@ -1848,17 +1846,20 @@ _edje_embryo_test_run(Edje *ed, char *fname, char *sig, char *src) { Embryo_Function fn; - + if (!ed) return; if (!ed->collection) return; if (!ed->collection->script) return; - _edje_embryo_script_reset(ed); + embryo_program_vm_push(ed->collection->script); + _edje_embryo_globals_init(ed); + + // _edje_embryo_script_reset(ed); fn = embryo_program_function_find(ed->collection->script, fname); if (fn != EMBRYO_FUNCTION_NONE) { void *pdata; int ret; - + embryo_parameter_string_push(ed->collection->script, sig); embryo_parameter_string_push(ed->collection->script, src); pdata = embryo_program_data_get(ed->collection->script); @@ -1866,12 +1867,12 @@ /* 5 million instructions is an arbitary number. on my p4-2.6 here */ /* IF embryo is ONLY runing embryo stuff and NO native calls thats */ /* about 0.016 seconds, and longer on slower cpu's. if a simple */ - /* embryo scritp snippet hasn't managed to do its work in 5 MILLION */ + /* embryo script snippet hasn't managed to do its work in 5 MILLION */ /* embryo virtual machine instructions - something is wrong, or */ /* embryo is simply being mis-used. Embryo is meant to be minimal */ /* logic enhancment - not entire applications. this cycle count */ /* does NOT include time spent in native function calls, that the */ - /* scritp may call to do the REAL work, so in terms of time this */ + /* script may call to do the REAL work, so in terms of time this */ /* will likely end up being much longer than 0.016 seconds - more */ /* like 0.03 - 0.05 seconds or even more */ embryo_program_max_cycle_run_set(ed->collection->script, 5000000); @@ -1894,9 +1895,10 @@ } embryo_program_data_set(ed->collection->script, pdata); } + embryo_program_vm_pop(ed->collection->script); } -static void +void _edje_embryo_globals_init(Edje *ed) { int n, i; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_message_queue.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- edje_message_queue.c 23 Nov 2005 12:56:05 -0000 1.19 +++ edje_message_queue.c 24 Nov 2005 03:23:01 -0000 1.20 @@ -557,10 +557,14 @@ default: break; } + embryo_program_vm_push(em->edje->collection->script); + _edje_embryo_globals_init(em->edje); pdata = embryo_program_data_get(em->edje->collection->script); embryo_program_data_set(em->edje->collection->script, em->edje); + embryo_program_max_cycle_run_set(em->edje->collection->script, 5000000); embryo_program_run(em->edje->collection->script, fn); embryo_program_data_set(em->edje->collection->script, pdata); + embryo_program_vm_pop(em->edje->collection->script); } void =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_private.h,v retrieving revision 1.97 retrieving revision 1.98 diff -u -3 -r1.97 -r1.98 --- edje_private.h 6 Nov 2005 03:32:01 -0000 1.97 +++ edje_private.h 24 Nov 2005 03:23:01 -0000 1.98 @@ -925,4 +925,6 @@ void _edje_cache_coll_unref(Edje_File *edf, Edje_Part_Collection *edc); void _edje_cache_file_unref(Edje_File *edf); +void _edje_embryo_globals_init(Edje *ed); + #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_var.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- edje_var.c 7 Oct 2005 11:24:07 -0000 1.16 +++ edje_var.c 24 Nov 2005 03:23:01 -0000 1.17 @@ -21,7 +21,9 @@ et = data; if (!et) return 0; ed = et->edje; - _edje_embryo_script_reset(ed); +// _edje_embryo_script_reset(ed); + embryo_program_vm_push(ed->collection->script); + _edje_embryo_globals_init(ed); embryo_parameter_cell_push(ed->collection->script, (Embryo_Cell)et->val); ed->var_pool->timers = evas_list_remove(ed->var_pool->timers, et); fn = et->func; @@ -31,9 +33,11 @@ pdata = embryo_program_data_get(ed->collection->script); embryo_program_data_set(ed->collection->script, ed); + embryo_program_max_cycle_run_set(ed->collection->script, 5000000); embryo_program_run(ed->collection->script, fn); embryo_program_data_set(ed->collection->script, pdata); - _edje_recalc(ed); + embryo_program_vm_pop(ed->collection->script); + _edje_recalc(ed); } return 0; } @@ -76,7 +80,9 @@ v = (t - ea->start) / ea->len; if (v > 1.0) v= 1.0; - _edje_embryo_script_reset(ed); +// _edje_embryo_script_reset(ed); + embryo_program_vm_push(ed->collection->script); + _edje_embryo_globals_init(ed); embryo_parameter_cell_push(ed->collection->script, (Embryo_Cell)ea->val); embryo_parameter_cell_push(ed->collection->script, EMBRYO_FLOAT_TO_CELL(v)); fn = ea->func; @@ -85,8 +91,10 @@ pdata = embryo_program_data_get(ed->collection->script); embryo_program_data_set(ed->collection->script, ed); + embryo_program_max_cycle_run_set(ed->collection->script, 5000000); embryo_program_run(ed->collection->script, fn); embryo_program_data_set(ed->collection->script, pdata); + embryo_program_vm_pop(ed->collection->script); _edje_recalc(ed); } if (v == 1.0) ea->delete_me = 1; ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs