Skip to content

Commit 449ca5d

Browse files
committed
Merge branch 'master' of https://github.com/php/php-src into typed-properties
2 parents 896a4a6 + 24f63b1 commit 449ca5d

17 files changed

+159
-129
lines changed

UPGRADING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ PHP 7.1 UPGRADE NOTES
7171
the $offset argument.
7272
- strpos(), stripos(), substr_count(), grapheme_strpos(), grapheme_stripos(),
7373
grapheme_extract(), iconv_strpos(), mb_strimwidth(), mb_ereg_search_setpos(),
74-
mb_strpos() and mb_stripos() now accept negative string offstes.
74+
mb_strpos() and mb_stripos() now accept negative string offsets.
7575
- substr_count() and mb_strimwidth() additionally also accept negative length.
7676
- file_get_contents() accepts a negative seek offset if the stream is seekable.
7777

Zend/zend_alloc.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ typedef struct _zend_mm_huge_list zend_mm_huge_list;
200200
# define PTR_FMT "0x%0.8lx"
201201
#endif
202202

203+
#ifdef MAP_HUGETLB
204+
int zend_mm_use_huge_pages = 1;
205+
#endif
206+
203207
/*
204208
* Memory is retrived from OS by chunks of fixed size 2MB.
205209
* Inside chunk it's managed by pages of fixed size 4096B.
@@ -462,7 +466,7 @@ static void *zend_mm_mmap(size_t size)
462466
void *ptr;
463467

464468
#ifdef MAP_HUGETLB
465-
if (size == ZEND_MM_CHUNK_SIZE) {
469+
if (zend_mm_use_huge_pages && size == ZEND_MM_CHUNK_SIZE) {
466470
ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_HUGETLB, -1, 0);
467471
if (ptr != MAP_FAILED) {
468472
return ptr;
@@ -2647,6 +2651,12 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
26472651
alloc_globals->mm_heap->custom_heap.std._realloc = realloc;
26482652
return;
26492653
}
2654+
#endif
2655+
#ifdef MAP_HUGETLB
2656+
tmp = getenv("USE_ZEND_ALLOC_HUGE_PAGES");
2657+
if (tmp && !zend_atoi(tmp, 0)) {
2658+
zend_mm_use_huge_pages = 0;
2659+
}
26502660
#endif
26512661
ZEND_TSRMLS_CACHE_UPDATE();
26522662
alloc_globals->mm_heap = zend_mm_init();

Zend/zend_compile.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -737,11 +737,7 @@ void zend_do_free(znode *op1) /* {{{ */
737737
}
738738
}
739739

740-
opline = get_next_op(CG(active_op_array));
741-
742-
opline->opcode = ZEND_FREE;
743-
SET_NODE(opline->op1, op1);
744-
SET_UNUSED(opline->op2);
740+
zend_emit_op(NULL, ZEND_FREE, op1, NULL);
745741
} else if (op1->op_type == IS_VAR) {
746742
zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
747743
while (opline->opcode == ZEND_END_SILENCE ||

Zend/zend_compile.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -834,26 +834,13 @@ ZEND_API void zend_assert_valid_class_name(const zend_string *const_name);
834834
#define ZEND_FETCH_CLASS_SILENT 0x0100
835835
#define ZEND_FETCH_CLASS_EXCEPTION 0x0200
836836

837-
/* variable parsing type (compile-time) */
838-
#define ZEND_PARSED_MEMBER (1<<0)
839-
#define ZEND_PARSED_METHOD_CALL (1<<1)
840-
#define ZEND_PARSED_STATIC_MEMBER (1<<2)
841-
#define ZEND_PARSED_FUNCTION_CALL (1<<3)
842-
#define ZEND_PARSED_VARIABLE (1<<4)
843-
#define ZEND_PARSED_REFERENCE_VARIABLE (1<<5)
844-
#define ZEND_PARSED_NEW (1<<6)
845-
#define ZEND_PARSED_LIST_EXPR (1<<7)
846-
847837
#define ZEND_PARAM_REF (1<<0)
848838
#define ZEND_PARAM_VARIADIC (1<<1)
849839

850840
#define ZEND_NAME_FQ 0
851841
#define ZEND_NAME_NOT_FQ 1
852842
#define ZEND_NAME_RELATIVE 2
853843

854-
/* unset types */
855-
#define ZEND_UNSET_REG 0
856-
857844
/* var status for backpatching */
858845
#define BP_VAR_R 0
859846
#define BP_VAR_W 1
@@ -906,8 +893,6 @@ ZEND_API void zend_assert_valid_class_name(const zend_string *const_name);
906893

907894
#define ZEND_FREE_ON_RETURN (1<<0)
908895

909-
#define ZEND_MEMBER_FUNC_CALL (1<<0)
910-
911896
#define ZEND_ARG_SEND_BY_REF (1<<0)
912897
#define ZEND_ARG_COMPILE_TIME_BOUND (1<<1)
913898
#define ZEND_ARG_SEND_FUNCTION (1<<2)

Zend/zend_execute.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,8 @@ static const zend_internal_function zend_pass_function = {
117117
zval_ptr_dtor_nogc(should_free); \
118118
}
119119

120-
/* End of zend_execute_locks.h */
121-
122120
#define CV_DEF_OF(i) (EX(func)->op_array.vars[i])
123121

124-
#define CTOR_CALL_BIT 0x1
125-
#define CTOR_USED_BIT 0x2
126-
127-
#define IS_CTOR_CALL(ce) (((zend_uintptr_t)(ce)) & CTOR_CALL_BIT)
128-
#define IS_CTOR_USED(ce) (((zend_uintptr_t)(ce)) & CTOR_USED_BIT)
129-
130-
#define ENCODE_CTOR(ce, used) \
131-
((zend_class_entry*)(((zend_uintptr_t)(ce)) | CTOR_CALL_BIT | ((used) ? CTOR_USED_BIT : 0)))
132-
#define DECODE_CTOR(ce) \
133-
((zend_class_entry*)(((zend_uintptr_t)(ce)) & ~(CTOR_CALL_BIT|CTOR_USED_BIT)))
134-
135122
#define ZEND_VM_MAIN_STACK_PAGE_SLOTS (16 * 1024) /* should be a power of 2 */
136123
#define ZEND_VM_GENERATOR_STACK_PAGE_SLOTS (256)
137124

Zend/zend_execute_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ void shutdown_executor(void) /* {{{ */
397397

398398
zend_shutdown_fpu();
399399

400-
#ifdef ZEND_DEBUG
400+
#if ZEND_DEBUG
401401
if (EG(ht_iterators_used) && !CG(unclean_shutdown)) {
402402
zend_error(E_WARNING, "Leaked %" PRIu32 " hashtable iterators", EG(ht_iterators_used));
403403
}

ext/opcache/Optimizer/dfa_pass.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
412412

413413
if (ssa->var_info) {
414414
int i;
415-
zend_op *opline, *end;
415+
zend_op *opline;
416416
zval tmp;
417417

418418
/* Convert LONG constants to DOUBLE */

ext/opcache/Optimizer/zend_optimizer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "zend_dump.h"
3434

3535
#ifndef HAVE_DFA_PASS
36-
# define HAVE_DFA_PASS 0
36+
# define HAVE_DFA_PASS 1
3737
#endif
3838

3939
static void zend_optimizer_zval_dtor_wrapper(zval *zvalue)

ext/pdo/pdo_stmt.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,16 +1541,16 @@ static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt,
15411541
{
15421542
struct pdo_bound_param_data param = {{{0}}};
15431543
zend_long param_type = PDO_PARAM_STR;
1544-
zval *parameter;
1544+
zval *parameter, *driver_params = NULL;
15451545

15461546
param.paramno = -1;
15471547

15481548
if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(),
15491549
"lz|llz!", &param.paramno, &parameter, &param_type, &param.max_value_len,
1550-
&param.driver_params)) {
1550+
&driver_params)) {
15511551
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|llz!", &param.name,
15521552
&parameter, &param_type, &param.max_value_len,
1553-
&param.driver_params)) {
1553+
&driver_params)) {
15541554
return 0;
15551555
}
15561556
}
@@ -1564,6 +1564,10 @@ static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt,
15641564
return 0;
15651565
}
15661566

1567+
if (driver_params) {
1568+
ZVAL_COPY(&param.driver_params, driver_params);
1569+
}
1570+
15671571
ZVAL_COPY(&param.parameter, parameter);
15681572
if (!really_register_bound_param(&param, stmt, is_param)) {
15691573
if (!Z_ISUNDEF(param.parameter)) {

ext/spl/php_spl.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha
307307
Default implementation for __autoload() */
308308
PHP_FUNCTION(spl_autoload)
309309
{
310-
int found = 0, pos_len, pos1_len;
310+
int pos_len, pos1_len;
311311
char *pos, *pos1;
312312
zend_string *class_name, *lc_name, *file_exts = SPL_G(autoload_extensions);
313313

@@ -333,32 +333,12 @@ PHP_FUNCTION(spl_autoload)
333333
pos1_len = pos_len;
334334
}
335335
if (spl_autoload(class_name, lc_name, pos, pos1_len)) {
336-
found = 1;
337336
break; /* loaded */
338337
}
339338
pos = pos1 ? pos1 + 1 : NULL;
340339
pos_len = pos1? pos_len - pos1_len - 1 : 0;
341340
}
342341
zend_string_free(lc_name);
343-
344-
if (!found && !SPL_G(autoload_running)) {
345-
/* For internal errors, we generate E_ERROR, for direct calls an exception is thrown.
346-
* The "scope" is determined by an opcode, if it is ZEND_FETCH_CLASS we know function was called indirectly by
347-
* the Zend engine.
348-
*/
349-
zend_execute_data *ex = EX(prev_execute_data);
350-
351-
while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
352-
ex = ex->prev_execute_data;
353-
}
354-
if (ex &&
355-
ex->opline->opcode != ZEND_FETCH_CLASS &&
356-
ex->opline->opcode != ZEND_NEW) {
357-
zend_throw_exception_ex(spl_ce_LogicException, 0, "Class %s could not be loaded", ZSTR_VAL(class_name));
358-
} else {
359-
php_error_docref(NULL, E_ERROR, "Class %s could not be loaded", ZSTR_VAL(class_name));
360-
}
361-
}
362342
} /* }}} */
363343

364344
/* {{{ proto string spl_autoload_extensions([string file_extensions])

0 commit comments

Comments
 (0)