[SR-Dev] git:master: core expr: optimizations fixes for $v op 0|1 -> $v

Andrei Pelinescu-Onciul andrei at iptel.org
Tue May 5 21:14:44 CEST 2009


Module: sip-router
Branch: master
Commit: 9c3327d5742b1f8280b159c7ea228b95bb2e8f35
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9c3327d5742b1f8280b159c7ea228b95bb2e8f35

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Tue May  5 16:15:01 2009 +0200

core expr:  optimizations fixes for $v op 0|1 -> $v

- fix missing cast for the  $v <op> c -> $v optimizations
  (e.g. $v - 0 -> $v, 1 * $v -> $v): instead of replacing
  $v <op> c with $v use (type_of(<op>)) $v.  $v without the cast
  to the type produced by the operator is used now only when
  type_of($v)==type_of(<op>).
  E.g.: 1 * $v -> (int)$v
        1 * ($v/$w) -> $v/$w  ($v/$w produces always an int, so no
                               need for the cast)
  Bug example:  1*"2"+3 was optimized to "2"+3 == "23" instead of
  (int)"2"+3 == 5.

- better debugging messages

---

 rvalue.c |  370 +++++++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 257 insertions(+), 113 deletions(-)

Diff:   http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=9c3327d5742b1f8280b159c7ea228b95bb2e8f35



More information about the sr-dev mailing list