Skip to content
Permalink
Browse files

Use better data structures (incomplete)

  • Loading branch information
dstogov committed Feb 10, 2014
1 parent 89a9ace commit f4cfaf36e23ca47da3e352e1c60909104c059647
Showing with 21,295 additions and 23,809 deletions.
  1. +105 −130 Zend/zend.c
  2. +80 −196 Zend/zend.h
  3. +799 −923 Zend/zend_API.c
  4. +92 −110 Zend/zend_API.h
  5. +3 −2 Zend/zend_alloc.c
  6. +4 −11 Zend/zend_alloc.h
  7. +7 −9 Zend/zend_ast.c
  8. +1 −1 Zend/zend_ast.h
  9. +371 −451 Zend/zend_builtin_functions.c
  10. +70 −87 Zend/zend_closures.c
  11. +668 −730 Zend/zend_compile.c
  12. +43 −57 Zend/zend_compile.h
  13. +109 −121 Zend/zend_constants.c
  14. +2 −4 Zend/zend_constants.h
  15. +125 −112 Zend/zend_exceptions.c
  16. +5 −5 Zend/zend_exceptions.h
  17. +414 −607 Zend/zend_execute.c
  18. +71 −108 Zend/zend_execute.h
  19. +278 −337 Zend/zend_execute_API.c
  20. +111 −76 Zend/zend_gc.c
  21. +28 −115 Zend/zend_gc.h
  22. +80 −91 Zend/zend_generators.c
  23. +4 −4 Zend/zend_generators.h
  24. +15 −23 Zend/zend_globals.h
  25. +890 −811 Zend/zend_hash.c
  26. +247 −178 Zend/zend_hash.h
  27. +2 −2 Zend/zend_highlight.c
  28. +1 −1 Zend/zend_indent.c
  29. +24 −20 Zend/zend_ini.c
  30. +3 −3 Zend/zend_ini.h
  31. +10 −20 Zend/zend_ini_parser.y
  32. +4,661 −4,663 Zend/zend_ini_scanner.c
  33. +3 −5 Zend/zend_ini_scanner.l
  34. +13 −13 Zend/zend_ini_scanner_defs.h
  35. +63 −68 Zend/zend_interfaces.c
  36. +4 −4 Zend/zend_interfaces.h
  37. +8 −4 Zend/zend_iterators.c
  38. +1 −1 Zend/zend_iterators.h
  39. +12 −12 Zend/zend_language_parser.y
  40. +408 −405 Zend/zend_language_scanner.c
  41. +1 −1 Zend/zend_language_scanner.h
  42. +60 −57 Zend/zend_language_scanner.l
  43. +1 −1 Zend/zend_language_scanner_defs.h
  44. +76 −127 Zend/zend_list.c
  45. +16 −20 Zend/zend_list.h
  46. +1 −1 Zend/zend_modules.h
  47. +490 −505 Zend/zend_object_handlers.c
  48. +17 −15 Zend/zend_object_handlers.h
  49. +50 −81 Zend/zend_objects.c
  50. +5 −6 Zend/zend_objects.h
  51. +90 −149 Zend/zend_objects_API.c
  52. +41 −38 Zend/zend_objects_API.h
  53. +19 −16 Zend/zend_opcode.c
  54. +174 −188 Zend/zend_operators.c
  55. +21 −74 Zend/zend_operators.h
  56. +21 −0 Zend/zend_stack.c
  57. +1 −0 Zend/zend_stack.h
  58. +111 −137 Zend/zend_string.c
  59. +187 −46 Zend/zend_string.h
  60. +34 −72 Zend/zend_ts_hash.c
  61. +23 −37 Zend/zend_ts_hash.h
  62. +414 −5 Zend/zend_types.h
  63. +72 −67 Zend/zend_variables.c
  64. +13 −13 Zend/zend_variables.h
  65. +856 −1,071 Zend/zend_vm_def.h
  66. +6,175 −7,678 Zend/zend_vm_execute.h
  67. +1 −1 Zend/zend_vm_execute.skl
  68. +11 −75 Zend/zend_vm_gen.php
  69. +3 −3 ext/com_dotnet/com_extension.c
  70. +372 −407 ext/date/php_date.c
  71. +4 −4 ext/dom/php_dom.c
  72. +1 −1 ext/dom/php_dom.h
  73. +56 −55 ext/ereg/ereg.c
  74. +2 −2 ext/intl/breakiterator/breakiterator_class.cpp
  75. +1 −1 ext/intl/breakiterator/breakiterator_iterators.cpp
  76. +1 −1 ext/intl/calendar/calendar_class.cpp
  77. +2 −2 ext/intl/collator/collator_sort.c
  78. +1 −1 ext/intl/intl_error.c
  79. +5 −4 ext/mysql/php_mysql.c
  80. +7 −6 ext/mysqli/mysqli.c
  81. +6 −4 ext/mysqlnd/mysqlnd_plugin.c
  82. +1 −1 ext/mysqlnd/mysqlnd_reverse_api.c
  83. +5 −5 ext/mysqlnd/php_mysqlnd.c
  84. +1 −0 ext/opcache/Optimizer/compact_literals.c
  85. +15 −12 ext/opcache/Optimizer/zend_optimizer.c
  86. +83 −87 ext/opcache/ZendAccelerator.c
  87. +1 −6 ext/opcache/ZendAccelerator.h
  88. +151 −173 ext/opcache/zend_accelerator_util_funcs.c
  89. +20 −66 ext/opcache/zend_persist.c
  90. +18 −20 ext/opcache/zend_persist_calc.c
  91. +122 −136 ext/pcre/php_pcre.c
  92. +4 −4 ext/pcre/php_pcre.h
  93. +1 −1 ext/pdo/pdo.c
  94. +5 −4 ext/pdo/pdo_dbh.c
  95. +5 −4 ext/pdo/pdo_stmt.c
  96. +5 −5 ext/phar/dirstream.c
  97. +12 −12 ext/phar/func_interceptors.c
  98. +14 −14 ext/phar/phar.c
  99. +5 −5 ext/phar/phar_object.c
  100. +3 −3 ext/phar/stream.c
  101. +3 −3 ext/phar/util.c
  102. +6 −6 ext/phar/zip.c
  103. +557 −587 ext/reflection/php_reflection.c
  104. +1 −1 ext/simplexml/sxe.c
  105. +2 −2 ext/snmp/snmp.c
  106. +5 −2 ext/soap/php_encoding.c
  107. +2 −1 ext/soap/soap.c
  108. +18 −6 ext/spl/php_spl.c
  109. +27 −19 ext/spl/spl_array.c
  110. +8 −3 ext/spl/spl_directory.c
  111. +1 −1 ext/spl/spl_functions.c
  112. +1 −0 ext/spl/spl_observer.c
  113. +180 −146 ext/standard/array.c
  114. +4 −2 ext/standard/base64.c
  115. +4 −1 ext/standard/browscap.c
  116. +4 −4 ext/standard/info.c
  117. +1 −0 ext/standard/url_scanner_ex.c
  118. +1 −0 ext/standard/url_scanner_ex.re
  119. +1 −1 ext/tidy/tidy.c
  120. +1 −1 ext/xsl/php_xsl.h
  121. +23 −23 main/SAPI.c
  122. +1 −1 main/SAPI.h
  123. +10 −5 main/fopen_wrappers.c
  124. +20 −25 main/main.c
  125. +4 −2 main/network.c
  126. +41 −42 main/output.c
  127. +1 −1 main/php_globals.h
  128. +32 −49 main/php_ini.c
  129. +1 −1 main/php_main.h
  130. +1 −1 main/php_output.h
  131. +5 −5 main/php_streams.h
  132. +123 −210 main/php_variables.c
  133. +13 −19 main/rfc1867.c
  134. +9 −10 main/streams/filter.c
  135. +14 −17 main/streams/memory.c
  136. +5 −5 main/streams/php_stream_context.h
  137. +1 −1 main/streams/php_stream_filter_api.h
  138. +76 −91 main/streams/streams.c
  139. +9 −9 main/streams/transports.c
  140. +310 −438 main/streams/userspace.c
  141. +5 −5 main/streams/xp_socket.c
  142. +1 −1 sapi/apache_hooks/php_apache.c
  143. +4 −4 sapi/cgi/cgi_main.c
  144. +7 −4 sapi/cli/php_cli.c
  145. +4 −4 sapi/fpm/fpm/fpm_main.c

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -1758,10 +1758,11 @@ static void zend_mm_safe_error(zend_mm_heap *heap,
uint error_lineno;
TSRMLS_FETCH();
if (zend_is_compiling(TSRMLS_C)) {
error_filename = zend_get_compiled_filename(TSRMLS_C);
zend_string *str = zend_get_compiled_filename(TSRMLS_C);
error_filename = str ? str->val : NULL;
error_lineno = zend_get_compiled_lineno(TSRMLS_C);
} else if (EG(in_execution)) {
error_filename = EG(active_op_array)?EG(active_op_array)->filename:NULL;
error_filename = EG(active_op_array)?EG(active_op_array)->filename->val:NULL;
error_lineno = EG(opline_ptr)?(*EG(opline_ptr))->lineno:0;
} else {
error_filename = NULL;
@@ -162,17 +162,10 @@ ZEND_API size_t zend_memory_peak_usage(int real_usage TSRMLS_DC);
END_EXTERN_C()

/* fast cache for zval's */
#define ALLOC_ZVAL(z) \
(z) = (zval *) emalloc(sizeof(zval))

#define FREE_ZVAL(z) \
efree_rel(z)

#define ALLOC_ZVAL_REL(z) \
(z) = (zval *) emalloc_rel(sizeof(zval))

#define FREE_ZVAL_REL(z) \
efree_rel(z)
//???#define ALLOC_ZVAL(z) (z) = (zval *) emalloc(sizeof(zval))
//???#define FREE_ZVAL(z) efree_rel(z)
//???#define ALLOC_ZVAL_REL(z) (z) = (zval *) emalloc_rel(sizeof(zval))
//???#define FREE_ZVAL_REL(z) efree_rel(z)

/* fast cache for HashTables */
#define ALLOC_HASHTABLE(ht) \
@@ -28,8 +28,7 @@ ZEND_API zend_ast *zend_ast_create_constant(zval *zv)
zend_ast *ast = emalloc(sizeof(zend_ast) + sizeof(zval));
ast->kind = ZEND_CONST;
ast->children = 0;
ast->u.val = (zval*)(ast + 1);
INIT_PZVAL_COPY(ast->u.val, zv);
ZVAL_COPY_VALUE(&ast->u.val, zv);
return ast;
}

@@ -68,7 +67,7 @@ ZEND_API int zend_ast_is_ct_constant(zend_ast *ast)
int i;

if (ast->kind == ZEND_CONST) {
return !IS_CONSTANT_TYPE(Z_TYPE_P(ast->u.val));
return !IS_CONSTANT_TYPE(Z_TYPE(ast->u.val));
} else {
for (i = 0; i < ast->children; i++) {
if ((&ast->u.child)[i]) {
@@ -223,10 +222,9 @@ ZEND_API void zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry *s
zval_dtor(&op2);
break;
case ZEND_CONST:
*result = *ast->u.val;
zval_copy_ctor(result);
ZVAL_DUP(result, &ast->u.val);
if (IS_CONSTANT_TYPE(Z_TYPE_P(result))) {
zval_update_constant_ex(&result, (void *) 1, scope TSRMLS_CC);
zval_update_constant_ex(result, (void *) 1, scope TSRMLS_CC);
}
break;
case ZEND_BOOL_AND:
@@ -287,8 +285,8 @@ ZEND_API zend_ast *zend_ast_copy(zend_ast *ast)
if (ast == NULL) {
return NULL;
} else if (ast->kind == ZEND_CONST) {
zend_ast *copy = zend_ast_create_constant(ast->u.val);
zval_copy_ctor(copy->u.val);
zend_ast *copy = zend_ast_create_constant(&ast->u.val);
zval_copy_ctor(&copy->u.val);
return copy;
} else {
switch (ast->children) {
@@ -317,7 +315,7 @@ ZEND_API void zend_ast_destroy(zend_ast *ast)
int i;

if (ast->kind == ZEND_CONST) {
zval_dtor(ast->u.val);
zval_dtor(&ast->u.val);
} else {
for (i = 0; i < ast->children; i++) {
if ((&ast->u.child)[i]) {
@@ -40,7 +40,7 @@ struct _zend_ast {
unsigned short kind;
unsigned short children;
union {
zval *val;
zval val;
zend_ast *child;
} u;
};

0 comments on commit f4cfaf3

Please sign in to comment.
You can’t perform that action at this time.