Changeset 622 for branches/1.3
- Timestamp:
- 07/05/2009 10:18:06 AM (4 years ago)
- Location:
- branches/1.3
- Files:
-
- 14 modified
-
. (modified) (1 prop)
-
const_string.c (modified) (1 diff)
-
disassembler.c (modified) (1 diff)
-
processor/hashtable.m4 (modified) (1 diff)
-
processor/head.m4 (modified) (4 diffs)
-
processor/main.m4 (modified) (1 diff)
-
processor/processor.m4 (modified) (10 diffs)
-
processor/string.m4 (modified) (2 diffs)
-
utils.c (modified) (11 diffs)
-
utils.h (modified) (1 diff)
-
xcache-test.ini (modified) (1 diff)
-
xcache.c (modified) (12 diffs)
-
xcache.h (modified) (5 diffs)
-
xcache_globals.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3
-
branches/1.3/const_string.c
r618 r622 70 70 #elif defined(ZEND_ENGINE_2) 71 71 # include "const_string_opcodes_php5.0.h" 72 #else 73 # include "const_string_opcodes_php4.x.h" 72 74 #endif 73 75 -
branches/1.3/disassembler.c
r394 r622 66 66 } 67 67 } 68 add_u_assoc_zval_ex(list, BUCKET_KEY_TYPE(b), buf, b->nKeyLength, zv);68 add_u_assoc_zval_ex(list, BUCKET_KEY_TYPE(b), ZSTR(buf), b->nKeyLength, zv); 69 69 } 70 70 efree(buf); -
branches/1.3/processor/hashtable.m4
r394 r622 60 60 } 61 61 } 62 add_u_assoc_zval_ex(dst, BUCKET_KEY_TYPE(b), buf, keysize, zv);62 add_u_assoc_zval_ex(dst, BUCKET_KEY_TYPE(b), ZSTR(buf), keysize, zv); 63 63 } 64 64 ') -
branches/1.3/processor/head.m4
r494 r622 114 114 static inline int xc_zstrlen_uchar(zstr s) 115 115 { 116 int i; 117 UChar *p = ZSTR_U(s); 118 for (i = 0; *p; i ++, p++) { 119 /* empty */ 120 } 121 return i; 116 return u_strlen(ZSTR_U(s)); 122 117 } 123 118 /* }}} */ … … 215 210 #ifdef ZEND_ENGINE_2 216 211 /* fix method on store */ 217 static void xc_fix_method(xc_processor_t *processor, zend_op_array *dst ) /* {{{ */212 static void xc_fix_method(xc_processor_t *processor, zend_op_array *dst TSRMLS_DC) /* {{{ */ 218 213 { 219 214 zend_function *zf = (zend_function *) dst; 220 215 zend_class_entry *ce = processor->active_class_entry_dst; 216 const zend_class_entry *srcce = processor->active_class_entry_src; 221 217 222 218 /* Fixing up the default functions for objects here since … … 239 235 } 240 236 else { 241 dnl FIXME: handle common.function_name here 242 #define SET_IF_SAME_NAME(member) \ 243 do { \ 244 if (!strcasecmp(ZSTR_S(zf->common.function_name), #member)) { \ 245 ce->member = zf; \ 246 } \ 247 } \ 248 while(0) 249 /* if(ce->member && !strcmp(zf->common.function_name, ce->member->common.function_name)) { \ */ 250 237 pushdef(`SET_IF_SAME_NAMEs', ` 251 238 SET_IF_SAME_NAME(__get); 252 239 SET_IF_SAME_NAME(__set); … … 262 249 SET_IF_SAME_NAME(__tostring); 263 250 #endif 264 251 ') 252 #ifdef IS_UNICODE 253 if (UG(unicode)) { 254 #define SET_IF_SAME_NAME(member) \ 255 do { \ 256 if (srcce->member && u_strcmp(ZSTR_U(zf->common.function_name), ZSTR_U(srcce->member->common.function_name)) == 0) { \ 257 ce->member = zf; \ 258 } \ 259 } \ 260 while(0) 261 262 SET_IF_SAME_NAMEs() 265 263 #undef SET_IF_SAME_NAME 264 } 265 else 266 #endif 267 do { 268 #define SET_IF_SAME_NAME(member) \ 269 do { \ 270 if (srcce->member && strcmp(ZSTR_S(zf->common.function_name), ZSTR_S(srcce->member->common.function_name)) == 0) { \ 271 ce->member = zf; \ 272 } \ 273 } \ 274 while(0) 275 276 SET_IF_SAME_NAMEs() 277 #undef SET_IF_SAME_NAME 278 } while (0); 279 280 popdef(`SET_IF_SAME_NAMEs') 281 266 282 } 267 283 } -
branches/1.3/processor/main.m4
r593 r622 111 111 IFSTORE(`$1 = (zend_class_entry *) xc_get_class_num(processor, $2);') 112 112 IFRESTORE(`$1 = xc_get_class(processor, (zend_ulong) $2);') 113 IFDASM(`add_assoc_ stringl_ex(dst, ZEND_STRS("$3"), $2->name, strlen($2->name), 1);')113 IFDASM(`add_assoc_unicodel_ex(dst, ZEND_STRS("$3"), ZSTR_U($2->name), $2->name_length, 1);') 114 114 } 115 115 else { -
branches/1.3/processor/processor.m4
r621 r622 57 57 DEF_STRUCT_P_FUNC(`zend_brk_cont_element', , ` 58 58 #ifdef ZEND_ENGINE_2_2 59 #ifndef IS_UNICODE60 59 DISPATCH(int, start) 61 #endif62 60 #endif 63 61 DISPATCH(int, cont) … … 243 241 pushdef(`emalloc', `malloc($1)') 244 242 pushdef(`ecalloc', `calloc($1, $2)') 245 PROC_ZSTRING_ L(, name, name_len)243 PROC_ZSTRING_N(, name, name_len) 246 244 popdef(`ecalloc') 247 245 popdef(`emalloc') … … 283 281 #endif 284 282 dnl isnt in php6 yet 285 #if defined(ZEND_ENGINE_2_2) && !defined(IS_UNICODE)283 #if defined(ZEND_ENGINE_2_2) 286 284 PROC_CLASS_ENTRY_P(ce) 287 285 #endif … … 511 509 /* deep */ 512 510 STRUCT_P(HashTable, static_variables, HashTable_zval_ptr) 511 #ifdef ZEND_ENGINE_2 513 512 STRUCT_ARRAY_I(num_args, zend_arg_info, arg_info) 514 513 xc_gc_add_op_array(dst TSRMLS_CC); 514 #endif 515 515 define(`SKIPASSERT_ONCE') 516 516 } … … 646 646 && zend_u_hash_find(&(processor->active_class_entry_dst->parent->function_table), 647 647 UG(unicode) ? IS_UNICODE : IS_STRING, 648 src->function_name, xc_zstrlen(UG(unicode) , src->function_name) + 1,648 src->function_name, xc_zstrlen(UG(unicode) ? IS_UNICODE : IS_STRING, src->function_name) + 1, 649 649 (void **) &parent) == SUCCESS) { 650 650 /* see do_inherit_method_check() */ … … 670 670 #endif 671 671 672 IFRESTORE(` 673 #ifdef ZEND_ENGINE_2 672 #ifdef ZEND_ENGINE_2 673 PROC_CLASS_ENTRY_P(scope) 674 IFCOPY(` 674 675 if (src->scope) { 675 dst->scope = xc_get_class(processor, (zend_ulong) src->scope); 676 xc_fix_method(processor, dst); 677 } 678 DONE(scope) 679 #endif 680 ', ` 681 #ifdef ZEND_ENGINE_2 682 PROC_CLASS_ENTRY_P(scope) 683 #endif 684 ') 676 xc_fix_method(processor, dst TSRMLS_CC); 677 } 678 ') 679 #endif 685 680 686 681 IFRESTORE(` … … 701 696 PROC_ZSTRING_N(type, key, key_size) 702 697 ') 698 DISPATCH(ulong, h) 703 699 STRUCT(zend_constant, constant) 704 700 ') … … 713 709 PROC_ZSTRING_N(type, key, key_size) 714 710 ') 711 DISPATCH(ulong, h) 715 712 STRUCT(zend_function, func) 716 713 ') … … 724 721 PROC_ZSTRING_N(type, key, key_size) 725 722 ') 723 DISPATCH(ulong, h) 726 724 #ifdef ZEND_ENGINE_2 727 725 STRUCT_P(zend_class_entry, cest) … … 741 739 PROC_ZSTRING_L(type, key, key_len) 742 740 ') 741 DISPATCH(ulong, h) 743 742 ') 744 743 dnl }}} -
branches/1.3/processor/string.m4
r394 r622 39 39 40 40 INIT_ZVAL(zv); 41 ZVAL_UNICODEL(&zv, (UChar *)($2), $3 - 1, 1);41 ZVAL_UNICODEL(&zv, ZSTR_U($2), $3 - 1, 1); 42 42 zend_make_printable_zval(&zv, &reszv, &usecopy); 43 43 fprintf(stderr, "string:%s:\t\"", "$1"); … … 64 64 FIXPOINTER_EX(`PTRTYPE', DSTPTR) 65 65 IFDASM(` 66 ifelse(STRTYPE,zstr_uchar, ` 67 add_assoc_unicodel_ex(dst, ZEND_STRS("$4"), $2, $3-1, 1); 68 ', ` dnl else 69 add_assoc_stringl_ex(dst, ZEND_STRS("$4"), $2, $3-1, 1);') 66 ifelse(STRTYPE,zstr_uchar, ` 67 add_assoc_unicodel_ex(dst, ZEND_STRS("$4"), ZSTR_U($2), $3-1, 1); 68 ', ` dnl else 69 ifelse(STRTYPE,zstr_char, ` 70 add_assoc_stringl_ex(dst, ZEND_STRS("$4"), ZSTR_S($2), $3-1, 1); 71 ', ` 72 add_assoc_stringl_ex(dst, ZEND_STRS("$4"), $2, $3-1, 1); 70 73 ') 74 ') 75 ') 71 76 } 72 77 popdef(`DSTPTR') -
branches/1.3/utils.c
r617 r622 425 425 426 426 #ifdef HAVE_XCACHE_CONSTANT 427 void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, zstr key, uint len TSRMLS_DC) /* {{{ */427 void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */ 428 428 { 429 429 if (zend_u_hash_add(EG(zend_constants), type, key, len, … … 445 445 /* }}} */ 446 446 #endif 447 void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len TSRMLS_DC) /* {{{ */447 void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */ 448 448 { 449 449 zend_bool istmpkey; … … 475 475 } 476 476 /* }}} */ 477 ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, zstr key, uint len TSRMLS_DC) /* {{{ */477 ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */ 478 478 { 479 479 zend_bool istmpkey; … … 487 487 #endif 488 488 if (istmpkey) { 489 zend_u_hash_ update(CG(class_table), type, key, len,489 zend_u_hash_quick_update(CG(class_table), type, key, len, h, 490 490 cest, sizeof(xc_cest_t), 491 491 ZESW(&stored_ce_ptr, NULL) … … 495 495 } 496 496 } 497 else if (zend_u_hash_ add(CG(class_table), type, key, len,497 else if (zend_u_hash_quick_add(CG(class_table), type, key, len, h, 498 498 cest, sizeof(xc_cest_t), 499 499 ZESW(&stored_ce_ptr, NULL) … … 541 541 #endif 542 542 543 void xc_zend_class_add_ref(zend_class_entry ZESW(*ce, **ce))544 {545 #ifdef ZEND_ENGINE_2546 (*ce)->refcount++;547 #else548 (*ce->refcount)++;549 #endif550 }551 552 543 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC) /* {{{ */ 553 544 { … … 592 583 { 593 584 zend_function tmp_func; 594 zend_hash_copy(&TG(function_table), &XG(internal_function_table), (copy_ctor_func_t) function_add_ref, (void *) &tmp_func, sizeof(tmp_func));585 zend_hash_copy(&TG(function_table), &XG(internal_function_table), NULL, (void *) &tmp_func, sizeof(tmp_func)); 595 586 } 596 587 TG(internal_function_tail) = TG(function_table).pListTail; … … 601 592 { 602 593 xc_cest_t tmp_cest; 603 zend_hash_copy(&TG(class_table), &XG(internal_class_table), (copy_ctor_func_t) xc_zend_class_add_ref, (void *) &tmp_cest, sizeof(tmp_cest));594 zend_hash_copy(&TG(class_table), &XG(internal_class_table), NULL, (void *) &tmp_cest, sizeof(tmp_cest)); 604 595 } 605 596 #endif … … 645 636 zend_constant *c = (zend_constant*) b->pData; 646 637 xc_install_constant(sandbox->filename, c, 647 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength TSRMLS_CC);638 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength, b->h TSRMLS_CC); 648 639 b = b->pListNext; 649 640 } … … 655 646 zend_function *func = (zend_function*) b->pData; 656 647 xc_install_function(sandbox->filename, func, 657 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength TSRMLS_CC);648 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength, b->h TSRMLS_CC); 658 649 b = b->pListNext; 659 650 } … … 663 654 while (b != NULL) { 664 655 xc_install_class(sandbox->filename, (xc_cest_t*) b->pData, -1, 665 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength TSRMLS_CC);656 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength, b->h TSRMLS_CC); 666 657 b = b->pListNext; 667 658 } -
branches/1.3/utils.h
r600 r622 72 72 /* installer */ 73 73 #ifdef HAVE_XCACHE_CONSTANT 74 void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, zstr key, uint len TSRMLS_DC);74 void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC); 75 75 #endif 76 void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len TSRMLS_DC);77 ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, zstr key, uint len TSRMLS_DC);76 void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC); 77 ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC); 78 78 79 79 /* sandbox */ -
branches/1.3/xcache-test.ini
r234 r622 1 1 auto_globals_jit = Off 2 memory_limit = 256M 2 3 3 4 [xcache] -
branches/1.3/xcache.c
r620 r622 556 556 xc_constinfo_t *ci = &p->constinfos[i]; 557 557 xc_install_constant(xce->name.str.val, &ci->constant, 558 UNISW(0, ci->type), ci->key, ci->key_size TSRMLS_CC);558 UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC); 559 559 } 560 560 #endif … … 564 564 xc_funcinfo_t *fi = &p->funcinfos[i]; 565 565 xc_install_function(xce->name.str.val, &fi->func, 566 UNISW(0, fi->type), fi->key, fi->key_size TSRMLS_CC);566 UNISW(0, fi->type), fi->key, fi->key_size, fi->h TSRMLS_CC); 567 567 } 568 568 … … 581 581 #endif 582 582 xc_install_class(xce->name.str.val, &ci->cest, ci->oplineno, 583 UNISW(0, ci->type), ci->key, ci->key_size TSRMLS_CC);583 UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC); 584 584 } 585 585 … … 590 590 /* 591 591 zend_auto_global *auto_global; 592 if (zend_u_hash_ find(CG(auto_globals), aginfo->type, aginfo->key, aginfo->key_len+1, (void **) &auto_global)==SUCCESS) {592 if (zend_u_hash_quick_find(CG(auto_globals), aginfo->type, aginfo->key, aginfo->key_len+1, aginfo->h, (void **) &auto_global)==SUCCESS) { 593 593 if (auto_global->armed) { 594 594 auto_global->armed = auto_global->auto_global_callback(auto_global->name, auto_global->name_len TSRMLS_CC); … … 1064 1064 } \ 1065 1065 data->key_size = b->nKeyLength; \ 1066 data->h = b->h; \ 1066 1067 } \ 1067 1068 } while(0) … … 1096 1097 } 1097 1098 data->key_len = b->nKeyLength - 1; 1099 data->h = b->h; 1098 1100 } 1099 1101 } … … 1266 1268 /* }}} */ 1267 1269 1270 #ifdef ZEND_ENGINE_2 1268 1271 /* {{{ xc_gc_op_array_t */ 1269 1272 typedef struct { … … 1277 1280 gc_op_array.num_args = op_array->num_args; 1278 1281 gc_op_array.arg_info = op_array->arg_info; 1282 #ifdef ZEND_ENGINE_2 1279 1283 zend_hash_next_index_insert(&XG(gc_op_arrays), (void *) &gc_op_array, sizeof(gc_op_array), NULL); 1284 #endif 1280 1285 } 1281 1286 /* }}} */ … … 1295 1300 } 1296 1301 /* }}} */ 1302 #endif 1297 1303 1298 1304 /* module helper function */ … … 1501 1507 zend_hash_destroy(&XG(internal_class_table)); 1502 1508 1503 zend_hash_init_ex(&XG(internal_function_table), 100, NULL, CG(function_table)->pDestructor, 1, 0);1504 zend_hash_init_ex(&XG(internal_class_table), 10, NULL, CG(class_table)->pDestructor,1, 0);1505 1506 zend_hash_copy(&XG(internal_function_table), CG(function_table), (copy_ctor_func_t) function_add_ref, &tmp_func, sizeof(tmp_func));1507 zend_hash_copy(&XG(internal_class_table), CG(class_table), (copy_ctor_func_t) xc_zend_class_add_ref, &tmp_cest, sizeof(tmp_cest));1509 zend_hash_init_ex(&XG(internal_function_table), 100, NULL, NULL, 1, 0); 1510 zend_hash_init_ex(&XG(internal_class_table), 10, NULL, NULL, 1, 0); 1511 1512 zend_hash_copy(&XG(internal_function_table), CG(function_table), NULL, &tmp_func, sizeof(tmp_func)); 1513 zend_hash_copy(&XG(internal_class_table), CG(class_table), NULL, &tmp_cest, sizeof(tmp_cest)); 1508 1514 1509 1515 XG(internal_table_copied) = 1; … … 1523 1529 } 1524 1530 1531 #ifdef ZEND_ENGINE_2 1525 1532 zend_hash_init(&XG(gc_op_arrays), 32, NULL, xc_gc_op_array, 0); 1533 #endif 1526 1534 1527 1535 #if PHP_API_VERSION <= 20041225 … … 1539 1547 { 1540 1548 xc_entry_unholds(TSRMLS_C); 1549 #ifdef ZEND_ENGINE_2 1541 1550 zend_hash_destroy(&XG(gc_op_arrays)); 1551 #endif 1542 1552 xc_gc_expires_php(TSRMLS_C); 1543 1553 xc_gc_expires_var(TSRMLS_C); -
branches/1.3/xcache.h
r619 r622 141 141 zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest) 142 142 143 # define zend_u_hash_quick_add(ht, type, arKey, nKeyLength, h, pData, nDataSize, pDest) \ 144 zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) 145 143 146 # define zend_u_hash_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest) \ 144 147 zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) 148 149 # define zend_u_hash_quick_update(ht, type, arKey, nKeyLength, h, pData, nDataSize, pDest) \ 150 zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) 145 151 146 152 # define zend_u_hash_find(ht, type, arKey, nKeyLength, pData) \ … … 223 229 zstr key; 224 230 zend_uint key_size; 231 ulong h; 225 232 xc_cest_t cest; 226 233 int oplineno; … … 235 242 zstr key; 236 243 zend_uint key_size; 244 ulong h; 237 245 zend_constant constant; 238 246 } xc_constinfo_t; … … 246 254 zstr key; 247 255 zend_uint key_size; 256 ulong h; 248 257 zend_function func; 249 258 } xc_funcinfo_t; … … 257 266 zstr key; 258 267 zend_uint key_len; 268 ulong h; 259 269 } xc_autoglobal_t; 260 270 /* }}} */ -
branches/1.3/xcache_globals.h
r619 r622 18 18 zend_bool auth_enabled; 19 19 20 #ifdef ZEND_ENGINE_2 20 21 HashTable gc_op_arrays; 22 #endif 21 23 22 24 HashTable internal_function_table;

