Changeset 485


Ignore:
Timestamp:
2007-12-28T11:16:12+01:00 (7 years ago)
Author:
moo
Message:

5.3 support

Location:
trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/const_string.c

    r393 r485  
    8989/* {{{ xc_get_opcode */
    9090#if PHP_MAJOR_VERSION >= 6
    91 #   include     "const_string_opcodes_php6.x.h"
    92 #else
    93 #   ifdef ZEND_ENGINE_2_1
    94 #       include     "const_string_opcodes_php5.1.h"
    95 #   else
    96 #       ifdef ZEND_ENGINE_2
    97 #           include "const_string_opcodes_php5.0.h"
    98 #       else
    99 #           include "const_string_opcodes_php4.x.h"
    100 #       endif
    101 #   endif
     91#   include "const_string_opcodes_php6.x.h"
     92#elif defined(ZEND_ENGINE_2_3)
     93#   include "const_string_opcodes_php5.3.h"
     94#elif defined(ZEND_ENGINE_2_1)
     95#   include "const_string_opcodes_php5.1.h"
     96#elif defined(ZEND_ENGINE_2)
     97#   include "const_string_opcodes_php5.0.h"
    10298#endif
    10399
  • trunk/coverager.c

    r462 r485  
    3636    char *fullpath;
    3737    struct stat st;
     38    ALLOCA_FLAG(use_heap)
    3839
    3940    TRACE("mkdirs %s %d %s %d", root, rootlen, path, pathlen);
    40     fullpath = do_alloca(rootlen + pathlen + 1);
     41    fullpath = my_do_alloca(rootlen + pathlen + 1, use_heap);
    4142    memcpy(fullpath, root, rootlen);
    4243    memcpy(fullpath + rootlen, path, pathlen);
     
    5960#endif
    6061    }
    61     free_alloca(fullpath);
     62    my_free_alloca(fullpath, use_heap);
    6263}
    6364/* }}} */
  • trunk/optimizer.c

    r477 r485  
    151151    case ZEND_JMPZ_EX:
    152152    case ZEND_JMPNZ_EX:
     153#ifdef ZEND_JMP_SET
     154    case ZEND_JMP_SET:
     155#endif
    153156#ifdef ZEND_JMP_NO_CTOR
    154157    case ZEND_JMP_NO_CTOR:
     
    347350    op_flowinfo_t fi;
    348351    zend_op *opline;
    349     bbid_t *bbids          = do_alloca(count * sizeof(bbid_t));
    350     bbid_t *catchbbids     = do_alloca(count * sizeof(bbid_t));
    351     zend_bool *markbbhead  = do_alloca(count * sizeof(zend_bool));
     352    ALLOCA_FLAG(use_heap_bbids)
     353    ALLOCA_FLAG(use_heap_catchbbids)
     354    ALLOCA_FLAG(use_heap_markbbhead)
     355    bbid_t *bbids          = my_do_alloca(count * sizeof(bbid_t),    use_heap_bbids);
     356    bbid_t *catchbbids     = my_do_alloca(count * sizeof(bbid_t),    use_heap_catchbbids);
     357    zend_bool *markbbhead  = my_do_alloca(count * sizeof(zend_bool), use_heap_markbbhead);
    352358
    353359    /* {{{ mark jmpin/jumpout */
     
    450456    /* }}} */
    451457
    452     free_alloca(catchbbids);
    453     free_alloca(bbids);
    454     free_alloca(markbbhead);
     458    my_free_alloca(markbbhead, use_heap_markbbhead);
     459    my_free_alloca(catchbbids, use_heap_catchbbids);
     460    my_free_alloca(bbids,      use_heap_bbids);
    455461    return SUCCESS;
    456462}
  • trunk/prepare.devel

    r52 r485  
    2828    make_const_string_opcodes_php5.0.h
    2929    make_const_string_opcodes_php5.1.h
     30    make_const_string_opcodes_php5.3.h
    3031    make_const_string_opcodes_php6.x.h
    3132}
     
    4647make_const_string_opcodes_php5.1.h() {
    4748    precheck const_string_opcodes_php5.1.h "${PHP5_1_DIR}/Zend/zend_vm_def.h"  && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
     49}
     50
     51make_const_string_opcodes_php5.3.h() {
     52    precheck const_string_opcodes_php5.3.h "${PHP5_3_DIR}/Zend/zend_vm_def.h"  && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
    4853}
    4954
  • trunk/prepare.devel.inc.example

    r327 r485  
    33PHP5_0_DIR=
    44PHP5_1_DIR=
     5PHP5_3_DIR=
    56PHP6_x_DIR=
    67
  • trunk/processor/processor.m4

    r484 r485  
    8181        ZVAL_REFCOUNT(dst) = 1;
    8282        DONE(value)
     83        DONE(type)
     84#ifdef ZEND_ENGINE_2_3
     85        DONE(is_ref__gc)
     86        DONE(refcount__gc)
     87#else
     88        DONE(is_ref)
    8389        DONE(refcount)
    84         DONE(type)
    85         DONE(is_ref)
    86 #ifdef ZEND_ENGINE_2_3
    87         COPY(idx_type)
    8890#endif
    8991    } while(0);
     
    149151        DONE(value)
    150152        DISPATCH(zval_data_type, type)
     153#ifdef ZEND_ENGINE_2_3
     154        DISPATCH(zend_uchar, is_ref__gc)
     155#else
    151156        DISPATCH(zend_uchar, is_ref)
    152 #ifdef ZEND_ENGINE_2
     157#endif
     158
     159#ifdef ZEND_ENGINE_2_3
     160        DISPATCH(zend_uint, refcount__gc)
     161#elif defined(ZEND_ENGINE_2)
    153162        DISPATCH(zend_uint, refcount)
    154163#else
    155164        DISPATCH(zend_ushort, refcount)
    156 #endif
    157 #ifdef ZEND_ENGINE_2_3
    158         DISPATCH(zend_uchar, idx_type)
    159165#endif
    160166    ')dnl IFDASM
     
    479485            case ZEND_JMPZ_EX:
    480486            case ZEND_JMPNZ_EX:
     487#ifdef ZEND_JMP_SET
     488            case ZEND_JMP_SET:
     489#endif
    481490                dst->op2.u.jmp_addr = processor->active_opcodes_dst + (src->op2.u.jmp_addr - processor->active_opcodes_src);
    482491                break;
  • trunk/utils.c

    r434 r485  
    2020
    2121#define OP_ZVAL_DTOR(op) do { \
    22     (op).u.constant.is_ref = 0; \
     22    Z_UNSET_ISREF((op).u.constant); \
    2323    zval_dtor(&(op).u.constant); \
    2424} while(0)
     
    152152            case ZEND_JMPZ_EX:
    153153            case ZEND_JMPNZ_EX:
     154#ifdef ZEND_JMP_SET
     155            case ZEND_JMP_SET:
     156#endif
    154157                opline->op2.u.opline_num = opline->op2.u.jmp_addr - op_array->opcodes;
    155158                assert(opline->op2.u.opline_num < op_array->last);
     
    181184    while (opline < end) {
    182185        if (opline->op1.op_type == IS_CONST) {
    183             opline->op1.u.constant.is_ref = 1;
    184             opline->op1.u.constant.refcount = 2; /* Make sure is_ref won't be reset */
     186            Z_SET_ISREF(opline->op1.u.constant);
     187            Z_SET_REFCOUNT(opline->op1.u.constant, 2); /* Make sure is_ref won't be reset */
     188
    185189        }
    186190        if (opline->op2.op_type == IS_CONST) {
    187             opline->op2.u.constant.is_ref = 1;
    188             opline->op2.u.constant.refcount = 2;
     191            Z_SET_ISREF(opline->op2.u.constant);
     192            Z_SET_REFCOUNT(opline->op2.u.constant, 2);
    189193        }
    190194#ifdef ZEND_ENGINE_2_1
     
    198202            case ZEND_JMPZ_EX:
    199203            case ZEND_JMPNZ_EX:
     204#ifdef ZEND_JMP_SET
     205            case ZEND_JMP_SET:
     206#endif
    200207                assert(opline->op2.u.opline_num < op_array->last);
    201208                opline->op2.u.jmp_addr = op_array->opcodes + opline->op2.u.opline_num;
     
    299306            case ZEND_JMPZ_EX:
    300307            case ZEND_JMPNZ_EX:
     308#ifdef ZEND_JMP_SET
     309            case ZEND_JMP_SET:
     310#endif
    301311                next = begin + opline->op2.u.opline_num;
    302312                break;
  • trunk/xcache.c

    r477 r485  
    609609    xc_entry_data_php_t *p = xce->data.php;
    610610    zend_op_array *old_active_op_array = CG(active_op_array);
     611    ALLOCA_FLAG(use_heap)
     612
    611613#ifndef ZEND_ENGINE_2
    612614    /* new ptr which is stored inside CG(class_table) */
    613     xc_cest_t **new_cest_ptrs = (xc_cest_t **)do_alloca(sizeof(xc_cest_t*) * p->classinfo_cnt);
     615    xc_cest_t **new_cest_ptrs = (xc_cest_t **)my_do_alloca(sizeof(xc_cest_t*) * p->classinfo_cnt, use_heap);
    614616#endif
    615617
     
    672674
    673675#ifndef ZEND_ENGINE_2
    674     free_alloca(new_cest_ptrs);
     676    my_free_alloca(new_cest_ptrs, use_heap);
    675677#endif
    676678    CG(active_op_array) = old_active_op_array;
     
    716718    int size = strlen(include_path) + 1;
    717719    char tokens[] = { DEFAULT_DIR_SEPARATOR, '\0' };
    718 
    719     paths = (char *)do_alloca(size);
     720    ALLOCA_FLAG(use_heap)
     721
     722    paths = (char *)my_do_alloca(size, use_heap);
    720723    memcpy(paths, include_path, size);
    721724
     
    725728        }
    726729        if (VCWD_STAT(filepath, pbuf) == 0) {
    727             free_alloca(paths);
     730            my_free_alloca(paths, use_heap);
    728731            return SUCCESS;
    729732        }
    730733    }
    731734
    732     free_alloca(paths);
     735    my_free_alloca(paths, use_heap);
    733736
    734737    return FAILURE;
     
    888891    php_stream     *stream;
    889892    xc_hash_value_t hv;
     893    ulong           old_rsid = EG(regular_list).nNextFreeElement;
    890894
    891895    stream = php_stream_open_wrapper(xce->name.str.val, "rb", USE_PATH | REPORT_ERRORS | ENFORCE_SAFE_MODE | STREAM_DISABLE_OPEN_BASEDIR, NULL);
     
    901905
    902906    php_stream_close(stream);
     907    if (EG(regular_list).nNextFreeElement = old_rsid + 1) {
     908        EG(regular_list).nNextFreeElement = old_rsid;
     909    }
    903910
    904911    if (n < 0) {
  • trunk/xcache.h

    r480 r485  
    1010#include <zend_compile.h>
    1111#include <zend_API.h>
     12#include <zend.h>
    1213#include "php_ini.h"
    1314#include "zend_hash.h"
     
    3637#else
    3738#   define ZESW(v1, v2) v2
     39#endif
     40
     41#ifdef ALLOCA_FLAG
     42#   define my_do_alloca(size, use_heap) do_alloca(size, use_heap)
     43#   define my_free_alloca(size, use_heap) free_alloca(size, use_heap)
     44#else
     45#   define my_do_alloca(size, use_heap) do_alloca(size)
     46#   define my_free_alloca(size, use_heap) free_alloca(size)
     47#   define ALLOCA_FLAG(x)
     48#endif
     49#ifndef Z_SET_ISREF
     50#   define Z_SET_ISREF(z) (z).is_ref = 1;
     51#endif
     52#ifndef Z_UNSET_ISREF
     53#   define Z_UNSET_ISREF(z) (z).is_ref = 0;
     54#endif
     55#ifndef Z_SET_REFCOUNT
     56#   define Z_SET_REFCOUNT(z, rc) (z).refcount = rc;
    3857#endif
    3958
Note: See TracChangeset for help on using the changeset viewer.