copying optimize.c into apc, just for fun :)

Xuefer
2004-06-30
2004-06-30
  • Xuefer
    Xuefer
    2004-06-30

    cvs di config.m4 Makefile.in
    Index: config.m4
    ===================================================================
    RCS file: /repository/pecl/apc/config.m4,v
    retrieving revision 3.9
    diff -u -r3.9 config.m4
    --- config.m4   4 Aug 2003 19:02:47 -0000       3.9
    +++ config.m4   30 Jun 2004 07:09:21 -0000
    @@ -28,6 +28,20 @@
      fi
    fi

    +AC_MSG_CHECKING(whether to enable mmcache optimizer)
    +AC_ARG_ENABLE(mmcache-optimizer,
    +[  --enable-mmcache-optimizer Enable mmcache optimizer],[
    +  if test "$enableval" = "yes" ; then
    +    AC_DEFINE(WITH_MMCACHE_OPTIMIZER, 1, [ ])
    +    AC_MSG_RESULT(yes)
    +  else
    +    AC_MSG_RESULT(no)
    +  fi
    +],[
    +  AC_DEFINE(WITH_MMCACHE_OPTIMIZER, 1, [ ])
    +  AC_MSG_RESULT(yes)
    +])
    +
    AC_MSG_CHECKING(whether to enable mmap support instead of IPC shm)
    AC_ARG_ENABLE(mmap,
    [  --enable-mmap  Enable mmap support instead of IPC shm],[
    Index: Makefile.in
    ===================================================================
    RCS file: /repository/pecl/apc/Makefile.in,v
    retrieving revision 3.9
    diff -u -r3.9 Makefile.in
    --- Makefile.in 27 Jun 2003 19:11:41 -0000      3.9
    +++ Makefile.in 30 Jun 2004 07:09:21 -0000
    @@ -16,6 +16,7 @@
                            apc_zend.c \                         apc_mmap.c \                         apc_optimizer.c \ +                       mmcache_optimize.c \                         apc_pair.c \                         apc_debug.c \                         php_apc.c

    and in apc_cache.c:
        op_array->last = compress_ops(op_array, jumps);
        destroy_jump_array(jumps, jump_array_size);

    +#ifdef WITH_MMCACHE_OPTIMIZER
    +    mmcache_optimize(op_array);
    +#endif

        return op_array;

    copy ../turck-mmcahe/mmcache.h ./
    copy ../turck-mmcahe/optimize.c ./mmcache_optimize.c

    now run phpize or ./buildconf
    and
    ./configure --with-mmcache-optimizer && make && make install
    :)

    btw: current optimize in apc(not the one of mmcahe) is unstable, need to patch, see: http://pecl.php.net/bugs/search.php?cmd=display&bug_type\[]=APC&status=Open

     
    • Xuefer
      Xuefer
      2004-06-30

      fix some mistake
      Index: config.m4
      ===================================================================
      RCS file: /repository/pecl/apc/config.m4,v
      retrieving revision 3.9
      diff -u -r3.9 config.m4
      --- config.m4   4 Aug 2003 19:02:47 -0000       3.9
      +++ config.m4   30 Jun 2004 09:11:03 -0000
      @@ -28,6 +28,20 @@
        fi
      fi

      +AC_MSG_CHECKING(whether to enable mmcache optimizer)
      +AC_ARG_ENABLE(mmcache-optimizer,
      +[  --enable-mmcache-optimizer Enable mmcache optimizer],[
      +  if test "$enableval" = "yes" ; then
      +    AC_DEFINE(HAVE_MMCACHE, 1, [ ])
      +    AC_DEFINE(WITH_MMCACHE_OPTIMIZER, 1, [ ])
      +    AC_MSG_RESULT(yes)
      +  else
      +    AC_MSG_RESULT(no)
      +  fi
      +],[
      +  AC_MSG_RESULT(no)
      +])
      +
      AC_MSG_CHECKING(whether to enable mmap support instead of IPC shm)
      AC_ARG_ENABLE(mmap,
      [  --enable-mmap  Enable mmap support instead of IPC shm],[

       
    • Gabriel Ricard
      Gabriel Ricard
      2004-06-30

      I've been wondering about the licensing legality of linking Turck MMCache and PHP. Turck itself is licensed under the GPL, but the PHP License is not GPL compatible. I don't expect anyone to make a big fuss about this, but it is rather odd.

       
      • Xuefer
        Xuefer
        2004-06-30

        well.
        i do that because someone short discuss about "merging turck mmcache into apc" (in sf.net)
        that make me haven't noticed its license is GPL

        maybe OK for just testing purpose?

        btw: the above "fun" is still broken. more modify need to be done to "merge" it. but it isn't that difficult.

        i made apc+mmcache optimizer run some small script
        but crash with scripts which have constant-folding
        lol~ may be the problem of apc itself