Changeset 246
- Timestamp:
- 07/27/06 11:38:27 (4 years ago)
- Location:
- eaccelerator/trunk
- Files:
-
- 8 deleted
- 8 edited
-
ChangeLog (modified) (1 diff)
-
Makefile.in (modified) (1 diff)
-
README (modified) (1 diff)
-
config.m4 (modified) (2 diffs)
-
doc/php/encoder.php (deleted)
-
doc/php/loader.php (deleted)
-
eLoader (deleted)
-
ea_store.c (modified) (2 diffs)
-
eaccelerator.c (modified) (5 diffs)
-
eaccelerator.h (modified) (7 diffs)
-
encoder.c (deleted)
-
encoder.php (deleted)
-
loader.c (deleted)
-
optimize.c (modified) (1 diff)
-
win32/eLoader.dsp (deleted)
-
win32/eLoader.vcproj (deleted)
Legend:
- Unmodified
- Added
- Removed
-
eaccelerator/trunk/ChangeLog
r245 r246 3 3 * Branched 0.9.5, development for 0.9.6 will start in trunk 4 4 * Bumped up version to 0.9.6-dev 5 * Killing the very broken encoder. Once when eAccelerator is in full 6 shape an encoder may return. 5 7 6 8 2006-07-25 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> -
eaccelerator/trunk/Makefile.in
r237 r246 1 1 LTLIBRARY_NAME = libeaccelerator.la 2 LTLIBRARY_SOURCES = eaccelerator.c optimize.c encoder.c loader.copcodes.c content.c mm.c session.c shm.c debug.c cache.c ea_restore.c ea_store.c ea_info.c ea_dasm.c2 LTLIBRARY_SOURCES = eaccelerator.c optimize.c opcodes.c content.c mm.c session.c shm.c debug.c cache.c ea_restore.c ea_store.c ea_info.c ea_dasm.c 3 3 LTLIBRARY_SHARED_NAME = eaccelerator.la 4 4 -
eaccelerator/trunk/README
r211 r246 19 19 by several engines. Files that can't fit in shared memory are cached on disk 20 20 only. 21 22 eAccelerator contains a PHP encoder and loader. You can encode PHP scripts23 using encoder.php in order to distribute them without sources. Encoded files24 can be run on any site which runs PHP with eAccelerator. The sources of25 encoded scripts can't be restored because they are stored in a compiled form26 and the encoded version doesn't contain the source. Of course, some internals27 of the scripts can be restored with different reverse engineering tools28 (disassemblers, debuggers, etc), but it is not trivial.29 21 30 22 eAccelerator is compatible with Zend Optimizer's loader. Zend Optimizer must -
eaccelerator/trunk/config.m4
r207 r246 30 30 ]) 31 31 32 AC_ARG_WITH(eaccelerator-encoder,33 [ --without-eaccelerator-encoder Do not include eaccelerator encoder],[34 eaccelerator_encoder=$withval35 ],[36 eaccelerator_encoder=yes37 ])38 39 AC_ARG_WITH(eaccelerator-loader,40 [ --without-eaccelerator-loader Do not include eaccelerator loader],[41 eaccelerator_loader=$withval42 ],[43 eaccelerator_loader=yes44 ])45 46 32 AC_ARG_WITH(eaccelerator-shared-memory, 47 33 [ --with-eaccelerator-shared-memory Include eaccelerator shared memory functions],[ … … 114 100 if test "$eaccelerator_optimizer" = "yes"; then 115 101 AC_DEFINE(WITH_EACCELERATOR_OPTIMIZER, 1, [Define if you like to use peephole opcode optimization]) 116 fi117 if test "$eaccelerator_encoder" = "yes"; then118 AC_DEFINE(WITH_EACCELERATOR_ENCODER, 1, [Define if you like to use eAccelerator enoder])119 fi120 if test "$eaccelerator_loader" = "yes"; then121 AC_DEFINE(WITH_EACCELERATOR_LOADER, 1, [Define if you like to load files encoded by eAccelerator encoder])122 102 fi 123 103 if test "$eaccelerator_shm" = "yes"; then -
eaccelerator/trunk/ea_store.c
r231 r246 43 43 static void calc_string(char *str, int len TSRMLS_DC) 44 44 { 45 if (len > MAX_DUP_STR_LEN || zend_hash_add(&EAG(strings), str, len, 46 &str, sizeof(char *), 47 NULL) == SUCCESS) { 45 if (len > MAX_DUP_STR_LEN || 46 zend_hash_add(&EAG(strings), str, len, &str, sizeof(char *), NULL) == SUCCESS) { 48 47 EACCELERATOR_ALIGN(EAG(mem)); 49 48 EAG(mem) += len; … … 344 343 } 345 344 346 /** Functions to store a script **/347 345 static inline char *store_string(char *str, int len TSRMLS_DC) 348 346 { -
eaccelerator/trunk/eaccelerator.c
r237 r246 1409 1409 DBG(ea_debug_printf, (EA_TEST_PERFORMANCE, "\t[%d] compile_file: storing in cache (%ld)\n", getpid(), ea_debug_elapsed_time(&tv_start))); 1410 1410 DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] compile_file: storing in cache\n", getpid())); 1411 #ifdef WITH_EACCELERATOR_LOADER1412 if (t->last >= 3 &&1413 t->opcodes[0].opcode == ZEND_SEND_VAL &&1414 t->opcodes[1].opcode == ZEND_DO_FCALL &&1415 t->opcodes[2].opcode == ZEND_RETURN &&1416 t->opcodes[1].op1.op_type == IS_CONST &&1417 t->opcodes[1].op1.u.constant.type == IS_STRING &&1418 t->opcodes[1].op1.u.constant.value.str.len == sizeof("eaccelerator_load")-1 &&1419 (memcmp(t->opcodes[1].op1.u.constant.value.str.val, "eaccelerator_load", sizeof("eaccelerator_load")-1) == 0) &&1420 t->opcodes[0].op1.op_type == IS_CONST &&1421 t->opcodes[0].op1.u.constant.type == IS_STRING) {1422 zend_op_array* new_t = NULL;1423 zend_bool old_in_compilation = CG(in_compilation);1424 char* old_filename = CG(compiled_filename);1425 int old_lineno = CG(zend_lineno);1426 1427 CG(in_compilation) = 1;1428 zend_set_compiled_filename(t->filename TSRMLS_CC);1429 CG(zend_lineno) = t->opcodes[1].lineno;1430 1431 zend_try {1432 new_t = eaccelerator_load(1433 t->opcodes[0].op1.u.constant.value.str.val,1434 t->opcodes[0].op1.u.constant.value.str.len TSRMLS_CC);1435 } zend_catch {1436 CG(function_table) = orig_function_table;1437 CG(class_table) = orig_class_table;1438 ea_bailout = 1;1439 } zend_end_try();1440 if (ea_bailout) {1441 zend_bailout ();1442 }1443 CG(in_compilation) = old_in_compilation;1444 CG(compiled_filename) = old_filename;1445 CG(zend_lineno) = old_lineno;1446 if (new_t != NULL) {1447 #ifdef ZEND_ENGINE_21448 destroy_op_array(t TSRMLS_CC);1449 #else1450 destroy_op_array(t);1451 #endif1452 efree(t);1453 t = new_t;1454 }1455 }1456 #endif1457 1411 function_table_tail = function_table_tail?function_table_tail->pListNext:CG(function_table)->pListHead; 1458 1412 class_table_tail = class_table_tail?class_table_tail->pListNext:CG(class_table)->pListHead; … … 1909 1863 eaccelerator_globals->optimizer_enabled = 1; 1910 1864 eaccelerator_globals->compiler = 0; 1911 eaccelerator_globals->encoder = 0;1912 1865 eaccelerator_globals->cond_list = NULL; 1913 1866 eaccelerator_globals->content_headers = NULL; … … 1988 1941 } 1989 1942 #endif 1990 #ifdef WITH_EACCELERATOR_LOADER1991 if (zend_hash_exists(&module_registry, EACCELERATOR_LOADER_EXTENSION_NAME,1992 sizeof(EACCELERATOR_LOADER_EXTENSION_NAME))) {1993 zend_error(E_CORE_WARNING,"Extension \"%s\" is not need with \"%s\". Remove it from php.ini\n",1994 EACCELERATOR_LOADER_EXTENSION_NAME, EACCELERATOR_EXTENSION_NAME);1995 zend_hash_del(&module_registry, EACCELERATOR_LOADER_EXTENSION_NAME,1996 sizeof(EACCELERATOR_LOADER_EXTENSION_NAME));1997 }1998 #endif1999 1943 } 2000 1944 if (!eaccelerator_check_php_version(TSRMLS_C)) { … … 2115 2059 EAG(used_entries) = NULL; 2116 2060 EAG(compiler) = 0; 2117 EAG(encoder) = 0;2118 2061 EAG(refcount_helper) = 1; 2119 2062 EAG(compress_content) = 1; … … 2241 2184 PHP_FE(eaccelerator_removed_scripts, NULL) 2242 2185 PHP_FE(eaccelerator_list_keys, NULL) 2243 #endif2244 #ifdef WITH_EACCELERATOR_ENCODER2245 PHP_FE(eaccelerator_encode, eaccelerator_second_arg_force_ref)2246 #endif2247 #ifdef WITH_EACCELERATOR_LOADER2248 PHP_FE(eaccelerator_load, NULL)2249 PHP_FE(_eaccelerator_loader_file, NULL)2250 PHP_FE(_eaccelerator_loader_line, NULL)2251 2186 #endif 2252 2187 #ifdef WITH_EACCELERATOR_SESSIONS -
eaccelerator/trunk/eaccelerator.h
r237 r246 109 109 110 110 #ifdef HAVE_EACCELERATOR 111 #ifndef HAVE_EACCELERATOR_STANDALONE_LOADER112 111 113 112 #include "mm.h" … … 177 176 /******************************************************************************/ 178 177 179 #endif /* HAVE_EACCELERATOR_STANDALONE_LOADER */180 178 181 179 #ifndef offsetof … … 259 257 } mm_fc_entry; 260 258 261 #ifndef HAVE_EACCELERATOR_STANDALONE_LOADER262 259 263 260 /* … … 399 396 # endif 400 397 401 #ifdef WITH_EACCELERATOR_ENCODER402 PHP_FUNCTION (eaccelerator_encode);403 #endif404 #endif /* HAVE_EACCELERATOR_STANDALONE_LOADER */405 406 398 #ifdef ZTS 407 399 # define EAG(v) TSRMG(eaccelerator_globals_id, zend_eaccelerator_globals*, v) … … 419 411 struct _mm_cond_entry *next; 420 412 } mm_cond_entry; 421 422 #ifdef WITH_EACCELERATOR_LOADER423 zend_op_array *eaccelerator_load (char *src, int src_len TSRMLS_DC);424 PHP_FUNCTION (eaccelerator_load);425 PHP_FUNCTION (_eaccelerator_loader_file);426 PHP_FUNCTION (_eaccelerator_loader_line);427 #endif428 413 429 414 /* … … 437 422 zend_bool compression_enabled; 438 423 zend_bool compiler; 439 zend_bool encoder;440 424 zend_bool compress; 441 425 zend_bool compress_content; … … 484 468 485 469 #define EACCELERATOR_EXTENSION_NAME "eAccelerator" 486 #define EACCELERATOR_LOADER_EXTENSION_NAME "eLoader"487 470 488 471 #define EA_MAGIC "EACCELERATOR" 489 490 #define EA_ENCODER_VERSION 0x00000004491 #define EA_ENCODER_END 0x00492 #define EA_ENCODER_NAMESPACE 0x01493 #define EA_ENCODER_CLASS 0x02494 #define EA_ENCODER_FUNCTION 0x03495 472 496 473 #define EACCELERATOR_VERSION_GUID "PHPE8EDA1B6-806A-4851-B1C8-A6B4712F44FB" -
eaccelerator/trunk/optimize.c
r201 r246 1497 1497 1498 1498 static int opt_get_constant(const char* name, int name_len, zend_constant** result TSRMLS_DC) { 1499 if (!EAG(encoder) || 1500 (name_len == sizeof("false")-1 && strcmp(name,"false") == 0) || 1501 (name_len == sizeof("true")-1 && strcmp(name,"true") == 0)) { 1502 union { 1503 zend_constant *v; 1504 void *ptr; 1505 } c; 1506 int retval; 1507 char *lookup_name = do_alloca(name_len+1); 1508 memcpy(lookup_name, name, name_len); 1509 lookup_name[name_len] = '\0'; 1499 union { 1500 zend_constant *v; 1501 void *ptr; 1502 } c; 1503 int retval; 1504 char *lookup_name = do_alloca(name_len+1); 1505 memcpy(lookup_name, name, name_len); 1506 lookup_name[name_len] = '\0'; 1507 1508 if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, &c.ptr)==SUCCESS) { 1509 *result = c.v; 1510 retval=1; 1511 } else { 1512 zend_str_tolower(lookup_name, name_len); 1510 1513 1511 1514 if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, &c.ptr)==SUCCESS) { 1512 *result = c.v; 1513 retval=1; 1515 if ((c.v->flags & CONST_CS) && (memcmp(c.v->name, name, name_len)!=0)) { 1516 retval=0; 1517 } else { 1518 *result = c.v; 1519 retval=1; 1520 } 1514 1521 } else { 1515 zend_str_tolower(lookup_name, name_len); 1516 1517 if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, &c.ptr)==SUCCESS) { 1518 if ((c.v->flags & CONST_CS) && (memcmp(c.v->name, name, name_len)!=0)) { 1519 retval=0; 1520 } else { 1521 *result = c.v; 1522 retval=1; 1523 } 1524 } else { 1525 retval=0; 1526 } 1527 } 1528 free_alloca(lookup_name); 1529 return retval; 1530 } else { 1531 return 0; 1532 } 1522 retval=0; 1523 } 1524 } 1525 free_alloca(lookup_name); 1526 return retval; 1533 1527 } 1534 1528 1535 1529 static int opt_function_exists(const char* name, int name_len TSRMLS_DC) { 1536 if (!EAG(encoder)) { 1537 char *lcname; 1538 char *lcfname; 1539 Bucket *p; 1540 1541 lcname = estrndup(name,name_len+1); 1542 zend_str_tolower(lcname, name_len); 1543 p = module_registry.pListHead; 1544 while (p != NULL) { 1545 zend_module_entry *m = (zend_module_entry*)p->pData; 1546 if (m->type == MODULE_PERSISTENT) { 1547 zend_function_entry* f = m->functions; 1548 if (f != NULL) { 1549 while (f->fname) { 1550 lcfname = estrdup(f->fname); 1551 zend_str_tolower(lcfname, strlen(lcfname)); 1552 if (strcmp(lcname,lcfname) == 0) { 1553 efree(lcfname); 1554 efree(lcname); 1555 return 1; 1556 } 1557 efree(lcfname); 1558 f++; 1559 } 1560 } 1561 } 1562 p = p->pListNext; 1563 } 1564 efree(lcname); 1565 } 1530 char *lcname; 1531 char *lcfname; 1532 Bucket *p; 1533 1534 lcname = estrndup(name,name_len+1); 1535 zend_str_tolower(lcname, name_len); 1536 p = module_registry.pListHead; 1537 while (p != NULL) { 1538 zend_module_entry *m = (zend_module_entry*)p->pData; 1539 if (m->type == MODULE_PERSISTENT) { 1540 zend_function_entry* f = m->functions; 1541 if (f != NULL) { 1542 while (f->fname) { 1543 lcfname = estrdup(f->fname); 1544 zend_str_tolower(lcfname, strlen(lcfname)); 1545 if (strcmp(lcname,lcfname) == 0) { 1546 efree(lcfname); 1547 efree(lcname); 1548 return 1; 1549 } 1550 efree(lcfname); 1551 f++; 1552 } 1553 } 1554 } 1555 p = p->pListNext; 1556 } 1557 efree(lcname); 1566 1558 return 0; 1567 1559 } 1568 1560 1569 1561 static int opt_extension_loaded(const char* name, int name_len TSRMLS_DC) { 1570 if (!EAG(encoder)) { 1571 Bucket *p = module_registry.pListHead; 1572 while (p != NULL) { 1573 zend_module_entry *m = (zend_module_entry*)p->pData; 1574 if (m->type == MODULE_PERSISTENT && strcmp(m->name,name) == 0) { 1575 return 1; 1576 } 1577 p = p->pListNext; 1578 } 1579 } 1580 return 0; 1562 Bucket *p = module_registry.pListHead; 1563 while (p != NULL) { 1564 zend_module_entry *m = (zend_module_entry*)p->pData; 1565 if (m->type == MODULE_PERSISTENT && strcmp(m->name,name) == 0) { 1566 return 1; 1567 } 1568 p = p->pListNext; 1569 } 1581 1570 } 1582 1571
Note: See TracChangeset
for help on using the changeset viewer.