Changeset 726 in svn for branches/1.3/disassembler.c


Ignore:
Timestamp:
2011-04-09T12:59:31Z (4 years ago)
Author:
Xuefer
Message:

merge from trunk

Location:
branches/1.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

  • branches/1.3/disassembler.c

    r622 r726  
    66#define return_value dst
    77
     8/* sandbox {{{ */
     9#undef TG
     10#undef OG
     11#define TG(x) (sandbox->tmp_##x)
     12#define OG(x) (sandbox->orig_##x)
     13/* }}} */
     14
    815#ifndef HAVE_XCACHE_OPCODE_SPEC_DEF
    916#error disassembler cannot be built without xcache/opcode_spec_def.h
    1017#endif
    11 static void xc_dasm(zval *dst, zend_op_array *op_array TSRMLS_DC) /* {{{ */
     18static void xc_dasm(xc_sandbox_t *sandbox, zval *dst, zend_op_array *op_array TSRMLS_DC) /* {{{ */
    1219{
    1320    Bucket *b;
     
    1623    int bufsize = 2;
    1724    char *buf;
    18     int keysize;
    1925
    2026    xc_compile_result_init_cur(&cr, op_array TSRMLS_CC);
     
    3339    ALLOC_INIT_ZVAL(list);
    3440    array_init(list);
    35     xc_dasm_HashTable_zend_function(list, CG(function_table) TSRMLS_CC);
     41    b = TG(internal_function_tail) ? TG(internal_function_tail)->pListNext : TG(function_table).pListHead;
     42    for (; b; b = b->pListNext) {
     43        ALLOC_INIT_ZVAL(zv);
     44        array_init(zv);
     45        xc_dasm_zend_function(zv, b->pData TSRMLS_CC);
     46
     47        add_u_assoc_zval_ex(list, BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength, zv);
     48    }
    3649    add_assoc_zval_ex(dst, ZEND_STRS("function_table"), list);
    3750   
     
    3952    ALLOC_INIT_ZVAL(list);
    4053    array_init(list);
    41     for (b = CG(class_table)->pListHead; b; b = b->pListNext) {
     54    b = TG(internal_class_tail) ? TG(internal_class_tail)->pListNext : TG(class_table).pListHead;
     55    for (; b; b = b->pListNext) {
     56        int keysize, keyLength;
     57
    4258        ALLOC_INIT_ZVAL(zv);
    4359        array_init(zv);
     
    5369        memcpy(buf, BUCKET_KEY_S(b), keysize);
    5470        buf[keysize - 2] = buf[keysize - 1] = ""[0];
    55         keysize = b->nKeyLength;
     71        keyLength = b->nKeyLength;
    5672#ifdef IS_UNICODE
    5773        if (BUCKET_KEY_TYPE(b) == IS_UNICODE) {
    5874            if (buf[0] == ""[0] && buf[1] == ""[0]) {
    59                 keysize ++;
     75                keyLength ++;
    6076            }
    6177        } else
     
    6379        {
    6480            if (buf[0] == ""[0]) {
    65                 keysize ++;
     81                keyLength ++;
    6682            }
    6783        }
    68         add_u_assoc_zval_ex(list, BUCKET_KEY_TYPE(b), ZSTR(buf), b->nKeyLength, zv);
     84        add_u_assoc_zval_ex(list, BUCKET_KEY_TYPE(b), ZSTR(buf), keyLength, zv);
    6985    }
    7086    efree(buf);
     
    97113    }
    98114
    99     xc_dasm(dst, op_array TSRMLS_CC);
     115    xc_dasm(&sandbox, dst, op_array TSRMLS_CC);
    100116
    101117    /* free */
     
    142158    }
    143159
    144     xc_dasm(dst, op_array TSRMLS_CC);
     160    xc_dasm(&sandbox, dst, op_array TSRMLS_CC);
    145161
    146162    /* free */
Note: See TracChangeset for help on using the changeset viewer.