#define DEBUG_BLOCKPASS 0
-/* Checks if a constant (like "true") may be relaced by its value */
+/* Checks if a constant (like "true") may be replaced by its value */
static int zend_get_persistent_constant(char *name, uint name_len, zval *result, int copy TSRMLS_DC ELS_DC)
{
zend_constant *c;
blocks[op_array->try_catch_array[i].try_op].protected = 1;
}
}
- /* Currentrly, we don't optimize op_arrays with BRK/CONT/GOTO opcodes,
+ /* Currently, we don't optimize op_arrays with BRK/CONT/GOTO opcodes,
* but, we have to keep brk_cont_array to avoid memory leaks during
* exception handling */
if (op_array->last_brk_cont) {
/* move block to new location */
memmove(new_to, to->start_opline, sizeof(zend_op)*to->len);
}
- /* join blocks' lengthes */
+ /* join blocks' lengths */
from_block->len += to->len;
/* move 'to'`s references to 'from' */
to->start_opline = NULL;
zend_code_block *start = find_start? NULL : blocks;
zend_code_block *b;
- /* Mark all blocks as unaccessable and destroy back references */
+ /* Mark all blocks as unaccessible and destroy back references */
b = blocks;
while (b != NULL) {
zend_block_source *cs;
b = b->next;
}
- /* Walk thorough all pathes */
+ /* Walk thorough all paths */
zend_access_path(start);
- /* Add brk/cont pathes */
+ /* Add brk/cont paths */
if (op_array->last_brk_cont) {
int i;
for (i=0; i< op_array->last_brk_cont; i++) {
}
}
- /* Add exception pathes */
+ /* Add exception paths */
if (op_array->last_try_catch) {
int i;
for (i=0; i< op_array->last_try_catch; i++) {
VAR_SOURCE(opline->op1) &&
VAR_SOURCE(opline->op1)->opcode == ZEND_INIT_STRING) {
/* convert T = INIT_STRING(), T = ADD_STRING(T, X) to T = QM_ASSIGN(X) */
- /* CHECKME: Remove ZEND_ADD_VAR optimizsation, since some conversions -
+ /* CHECKME: Remove ZEND_ADD_VAR optimization, since some conversions -
namely, BOOL(false)->string - don't allocate memory but use empty_string
and ADD_CHAR fails */
zend_op *src = VAR_SOURCE(opline->op1);
opline->extended_value = NUM_VAR(map_T[currT]);
}
- /* Allocate OP_DATA->op2 after "opernds", but before "result" */
+ /* Allocate OP_DATA->op2 after "operands", but before "result" */
if (opline->opcode == ZEND_ASSIGN_DIM &&
(opline + 1)->opcode == ZEND_OP_DATA &&
ZEND_OP2_TYPE(opline + 1) & (IS_VAR | IS_TMP_VAR)) {
next_op++;
}
if (!((ZEND_OPTIMIZER_PASS_5|ZEND_OPTIMIZER_PASS_10) & OPTIMIZATION_LEVEL)) {
- /* NOP removel is disabled => insert JMP over NOPs */
+ /* NOP removal is disabled => insert JMP over NOPs */
if (last_op-opline >= 3) { /* If we have more than 2 NOPS then JMP over them */
(opline + 1)->opcode = ZEND_JMP;
ZEND_OP1(opline + 1).opline_num = last_op - op_array->opcodes; /* that's OK even for ZE2, since opline_num's are resolved in pass 2 later */
case ZEND_JMPZ_EX:
case ZEND_JMPNZ_EX:
/* convert Ti = JMPZ_EX(Ti, L) to JMPZ(Ti, L) */
- if (0 && /* FIXME: temorary disable unsafe pattern */
+ if (0 && /* FIXME: temporary disable unsafe pattern */
ZEND_OP1_TYPE(opline) == IS_TMP_VAR &&
ZEND_RESULT_TYPE(opline) == IS_TMP_VAR &&
ZEND_OP1(opline).var == ZEND_RESULT(opline).var) {
#include "zend_compile.h"\r
\r
#define ZEND_OPTIMIZER_PASS_1 (1<<0) /* CSE, STRING construction */\r
-#define ZEND_OPTIMIZER_PASS_2 (1<<1) /* Constant conversion and jums */\r
+#define ZEND_OPTIMIZER_PASS_2 (1<<1) /* Constant conversion and jumps */\r
#define ZEND_OPTIMIZER_PASS_3 (1<<2) /* ++, +=, series of jumps */\r
#define ZEND_OPTIMIZER_PASS_4 (1<<3)\r
#define ZEND_OPTIMIZER_PASS_5 (1<<4) /* CFG based optimization */\r
}
}
-/* O+ traks changes of "include_path" directive. It stores all the requested
+/* O+ tracks changes of "include_path" directive. It stores all the requested
* values in ZCG(include_paths) shared hash table, current value in
* ZCG(include_path)/ZCG(include_path_len) and one letter "path key" in
* ZCG(include_path_key).
efree(op_array); /* we have valid persistent_script, so it's safe to free op_array */
/* Fill in the ping_auto_globals_mask for the new script. If jit for auto globals is enabled we
- will have to ping the used auto global varaibles before execution */
+ will have to ping the used auto global variables before execution */
#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO
if (PG(auto_globals_jit)) {
#else
if (!ZCG(key_len)) {
return accelerator_orig_compile_file(file_handle, type TSRMLS_CC);
}
- /* persistent script was already found by overrifen open() or
+ /* persistent script was already found by overridden open() or
* resolve_path() callbacks */
persistent_script = ZCG(cache_persistent_script);
key = ZCG(key);
handle->free_filename = 0;
handle->opened_path = NULL;
- /* Check if requestd file already cached (by full name) */
+ /* Check if requested file already cached (by full name) */
if (IS_ABSOLUTE_PATH(filename, filename_len) &&
(persistent_script = zend_accel_hash_find(&ZCSG(hash), (char*)filename, filename_len + 1)) != NULL &&
!persistent_script->corrupted) {
return SUCCESS;
}
- /* Check if requestd file already cached (by key) */
+ /* Check if requested file already cached (by key) */
key = accel_make_persistent_key_ex(handle, filename_len, &key_length TSRMLS_CC);
if (!ZCG(accel_directives).revalidate_path &&
key &&
/* find the full real path */
resolved_path = accel_php_resolve_path(filename, filename_len, ZCG(include_path) TSRMLS_CC);
- /* Check if requestd file already cached (by real name) */
+ /* Check if requested file already cached (by real name) */
if (resolved_path &&
(bucket = zend_accel_hash_find_entry(&ZCSG(hash), resolved_path, strlen(resolved_path) + 1)) != NULL) {
zend_accel_hash_entry *bucket;
zend_persistent_script *persistent_script;
- /* Check if requestd file already cached (by full name) */
+ /* Check if requested file already cached (by full name) */
if ((IS_ABSOLUTE_PATH(filename, filename_len) ||
is_stream_path(filename)) &&
(bucket = zend_accel_hash_find_entry(&ZCSG(hash), (char*)filename, filename_len + 1)) != NULL) {
}
}
- /* Check if requestd file already cached (by key) */
+ /* Check if requested file already cached (by key) */
handle.filename = (char*)filename;
handle.free_filename = 0;
handle.opened_path = NULL;
/* find the full real path */
resolved_path = accelerator_orig_zend_resolve_path(filename, filename_len TSRMLS_CC);
- /* Check if requestd file already cached (by real path) */
+ /* Check if requested file already cached (by real path) */
if (resolved_path &&
(bucket = zend_accel_hash_find_entry(&ZCSG(hash), resolved_path, strlen(resolved_path) + 1)) != NULL) {
persistent_script = (zend_persistent_script *)bucket->data;
return FAILURE;
}
- /* no supported SAPI found - disable acceleration and stop initalization */
+ /* no supported SAPI found - disable acceleration and stop initialization */
if (accel_find_sapi(TSRMLS_C) == FAILURE) {
accel_startup_ok = 0;
if (!ZCG(accel_directives).enable_cli &&
/* ensures it is OK to read SHM
if it's not OK (restart in progress) returns FAILURE
if OK returns SUCCESS
- MUST call accelerator_shm_read_unlock after done lock operationss
+ MUST call accelerator_shm_read_unlock after done lock operations
*/
int accelerator_shm_read_lock(TSRMLS_D)
{
/* 4 - works with the new Optimizer, that supports the file format with licenses */
/* 5 - API 4 didn't really work with the license-enabled file format. v5 does. */
/* 6 - Monitor was removed from ZendPlatform.so, to a module of its own */
-/* 7 - Optimizer was embeded into Accelerator */
+/* 7 - Optimizer was embedded into Accelerator */
/* 8 - Standalone Open Source OptimizerPlus */
#define ACCELERATOR_API_NO 8
} zend_accel_directives;
typedef struct _zend_accel_globals {
- /* copy of CG(function_table) used for compilation scripts into cashe */
- /* imitially it contains only internal functions */
+ /* copy of CG(function_table) used for compilation scripts into cache */
+ /* initially it contains only internal functions */
HashTable function_table;
int internal_functions_count;
- int counted; /* the process uses shatred memory */
+ int counted; /* the process uses shared memory */
zend_bool enabled;
zend_bool locked; /* thread obtained exclusive lock */
HashTable bind_hash; /* prototype and zval lookup table */
zend_accel_directives accel_directives;
char *cwd; /* current working directory or NULL */
- int cwd_len; /* "cwd" string lenght */
+ int cwd_len; /* "cwd" string length */
char *include_path_key; /* one letter key of current "include_path" */
- char *include_path; /* current settion of "include_path" directive */
- int include_path_len; /* "include_path" string lenght */
+ char *include_path; /* current section of "include_path" directive */
+ int include_path_len; /* "include_path" string length */
int include_path_check;
time_t request_time;
/* preallocated shared-memory block to save current script */
however, entries are still taken from the same 'hash_entries' array.
'key' and 'data' passed to zend_accel_hash_update() must be already
allocated in shared memory. Few keys may be resolved to the same data.
- using 'indirect' emtries, that point to other entries ('data' is actually
+ using 'indirect' entries, that point to other entries ('data' is actually
a pointer to another zend_accel_hash_entry).
zend_accel_hash_update() requires exclusive lock, however,
zend_accel_hash_find() does not.
memsize = 8;
zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.memory_consumption is set below the required 8MB.\n");
- zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use the minimal 8MB cofiguration.\n");
+ zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use the minimal 8MB configuration.\n");
if (zend_hash_find(EG(ini_directives),
"zend_optimizerplus.memory_consumption",
size = MIN_ACCEL_FILES;
new_new_value = TOKENTOSTR(MIN_ACCEL_FILES);
zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.max_accelerated_files is set below the required minimum (%d).\n", MIN_ACCEL_FILES);
- zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use the minimal cofiguration.\n");
+ zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use the minimal configuration.\n");
}
if (size > MAX_ACCEL_FILES) {
size = MAX_ACCEL_FILES;
new_new_value = TOKENTOSTR(MAX_ACCEL_FILES);
zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.max_accelerated_files is set above the limit (%d).\n", MAX_ACCEL_FILES);
- zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use the maximal cofiguration.\n");
+ zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use the maximal configuration.\n");
}
if (zend_hash_find(EG(ini_directives),
"zend_optimizerplus.max_accelerated_files",
zend_ini_entry *ini_entry;
percentage = 5;
- zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.max_wasted_percentage must be ser netweeb 1 and 50.\n");
+ zend_accel_error(ACCEL_LOG_WARNING, "zend_optimizerplus.max_wasted_percentage must be set between 1 and 50.\n");
zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use 5%.\n");
if (zend_hash_find(EG(ini_directives),
"zend_optimizerplus.max_wasted_percentage",
add_assoc_double(statistics, "accelerator_hit_rate", reqs?(((double) ZCSG(hits))/reqs)*100.0:0);
add_assoc_zval(return_value, "accelerator_statistics", statistics);
- /* acceleratred scripts */
+ /* accelerated scripts */
scripts = accelerator_get_scripts(TSRMLS_C);
if (scripts) {
add_assoc_zval(return_value, "scripts", scripts);
+----------------------------------------------------------------------+
*/
-#ifndef ZEND_ACCELERAROR_MODULE_H
+#ifndef ZEND_ACCELERATOR_MODULE_H
#define ZEND_ACCELERATOR_MODULE_H
int start_accel_module(void);
memset(persistent_script, 0, sizeof(zend_persistent_script));
zend_hash_init(&persistent_script->function_table, 100, NULL, (dtor_func_t) zend_accel_destroy_zend_function, 0);
- /* class_table is usualy destroyed by free_persistent_script() that
+ /* class_table is usually destroyed by free_persistent_script() that
* overrides destructor. ZEND_CLASS_DTOR may be used by standard
* PHP compiler
*/
#else /* if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO */
if (ZEND_DONE_PASS_TWO(op_array)) {
- /* fix jmps to point to new array */
+ /* fix jumps to point to new array */
switch (opline->opcode) {
case ZEND_JMP:
case ZEND_GOTO: