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 


Log Message:


limit embryo scritps form being able to go into finitie or waay too long loops.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_embryo.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- edje_embryo.c       14 Oct 2004 04:29:16 -0000      1.32
+++ edje_embryo.c       19 Oct 2004 09:56:14 -0000      1.33
@@ -1331,12 +1331,26 @@
    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);
        embryo_program_data_set(ed->collection->script, ed);
-       if (!embryo_program_run(ed->collection->script, fn))
+       /* 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 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 */
+       /* 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);
+       ret = embryo_program_run(ed->collection->script, fn);
+       if (ret == EMBRYO_PROGRAM_FAIL)
          {
             printf("EDJE:        ERROR with embryo script.\n"
                    "ENTRY POINT: %s\n"
@@ -1344,6 +1358,14 @@
                    fname,
                    
embryo_error_string_get(embryo_program_error_get(ed->collection->script)));
          }
+       else if (ret == EMBRYO_PROGRAM_TOOLONG)
+         {
+            printf("EDJE:        ERROR with embryo script.\n"
+                   "ENTRY POINT: %s\n"
+                   "ERROR:       Script exceeded maximum allowed cycle count of %i\n",
+                   fname,
+                   embryo_program_max_cycle_run_get(ed->collection->script));
+         }
        embryo_program_data_set(ed->collection->script, pdata);
      }
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_message_queue.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- edje_message_queue.c        11 Sep 2004 02:59:23 -0000      1.10
+++ edje_message_queue.c        19 Oct 2004 09:56:14 -0000      1.11
@@ -61,16 +61,16 @@
        tmp_msgq = tmpq;
        tmpq = NULL;
      }
-
-       while (tmp_msgq)
-         {
-            Edje_Message *em;
-            
-            em = tmp_msgq->data;
-            tmp_msgq = evas_list_remove_list(tmp_msgq, tmp_msgq);
-            _edje_message_process(em);
-            _edje_message_free(em);
-         }
+   
+   while (tmp_msgq)
+     {
+       Edje_Message *em;
+       
+       em = tmp_msgq->data;
+       tmp_msgq = evas_list_remove_list(tmp_msgq, tmp_msgq);
+       _edje_message_process(em);
+       _edje_message_free(em);
+     }
 }
 
 void




-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to