Skip to content

Commit

Permalink
Adding phalcon custom optimizers skeletons [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgutierrez committed Dec 27, 2013
1 parent 91144de commit 1143359
Show file tree
Hide file tree
Showing 41 changed files with 1,128 additions and 623 deletions.
48 changes: 47 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
{"static-type-inference":true,"static-type-inference-second-pass":true,"local-context-pass":true,"constant-folding":true,"static-constant-class-folding":true,"namespace":"phalcon","name":"","description":"","author":"Phalcon Team","optimizations":{"static-type-inference":true,"static-type-inference-second-pass":true,"local-context-pass":true,"constant-folding":true,"static-constant-class-folding":true},"constants-sources":["ext\/phalcon\/mvc\/model\/query\/scanner.h"],"globals":{"db.escape_identifiers":{"type":"bool","default":true},"orm.column_renaming":{"type":"bool","default":true},"orm.events":{"type":"bool","default":true},"orm.virtual_foreign_keys":{"type":"bool","default":true},"orm.not_null_validations":{"type":"bool","default":true},"orm.exception_on_failed_save":{"type":"bool","default":false}},"verbose":true}
{
"static-type-inference":true,
"static-type-inference-second-pass":true,
"local-context-pass":true,
"constant-folding":true,
"static-constant-class-folding":true,
"namespace":"phalcon",
"name":"",
"description":"",
"author":"Phalcon Team",
"optimizations":{
"static-type-inference":true,
"static-type-inference-second-pass":true,
"local-context-pass":true,
"constant-folding":true,
"static-constant-class-folding":true
},
"optimizer-dirs":["optimizers"],
"constants-sources":["ext\/phalcon\/mvc\/model\/query\/scanner.h"],
"globals":{
"db.escape_identifiers":{
"type":"bool",
"default":true
},
"orm.column_renaming":{
"type":"bool",
"default":true
},
"orm.events":{
"type":"bool",
"default":true
},
"orm.virtual_foreign_keys":{
"type":"bool",
"default":true
},
"orm.not_null_validations":{
"type":"bool",
"default":true
},
"orm.exception_on_failed_save":{
"type":"bool",
"default":false
}
},
"verbose":false
}
2 changes: 1 addition & 1 deletion ext/phalcon/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
*/
ZEPHIR_INIT_CLASS(Phalcon_Acl) {

ZEPHIR_REGISTER_CLASS(Phalcon, Acl, phalcon, acl, NULL, 0);
ZEPHIR_REGISTER_CLASS(Phalcon, Acl, phalcon, acl, NULL, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);

zend_declare_class_constant_long(phalcon_acl_ce, SL("ALLOW"), 1 TSRMLS_CC);
zend_declare_class_constant_long(phalcon_acl_ce, SL("DENY"), 0 TSRMLS_CC);
Expand Down
2 changes: 1 addition & 1 deletion ext/phalcon/annotations/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
*/
ZEPHIR_INIT_CLASS(Phalcon_Annotations_Adapter) {

ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Adapter, phalcon, annotations_adapter, phalcon_annotations_adapter_method_entry, 0);
ZEPHIR_REGISTER_CLASS(Phalcon\\Annotations, Adapter, phalcon, annotations_adapter, phalcon_annotations_adapter_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);

zend_declare_property_null(phalcon_annotations_adapter_ce, SL("_reader"), ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(phalcon_annotations_adapter_ce, SL("_annotations"), ZEND_ACC_PROTECTED TSRMLS_CC);
Expand Down
48 changes: 22 additions & 26 deletions ext/phalcon/annotations/reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ ZEPHIR_INIT_CLASS(Phalcon_Annotations_Reader) {
*/
PHP_METHOD(Phalcon_Annotations_Reader, parse) {

zend_function *_6 = NULL, *_7 = NULL, *_12 = NULL, *_13 = NULL, *_14 = NULL;
HashTable *_4, *_10;
HashPosition _3, _9;
zend_function *_6 = NULL, *_7 = NULL, *_13 = NULL, *_14 = NULL, *_15 = NULL;
HashTable *_4, *_11;
HashPosition _3, _10;
zend_class_entry *_0;
int line;
zval *className_param = NULL, *annotations, *reflection, *comment = NULL, *properties, *methods, *property = NULL, *method = NULL, *classAnnotations, *annotationsProperties, *propertyAnnotations = NULL, *annotationsMethods, *methodAnnotations = NULL, *_1 = NULL, *_2 = NULL, **_5, *_8 = NULL, **_11;
zval *className_param = NULL, *annotations, *reflection, *comment = NULL, *properties, *methods, *property = NULL, *method = NULL, *classAnnotations, *annotationsProperties, *propertyAnnotations = NULL, *annotationsMethods, *methodAnnotations = NULL, *_1 = NULL, *_2 = NULL, **_5, _8 = zval_used_for_init, *_9 = NULL, **_12;
zval *className = NULL;

ZEPHIR_MM_GROW();
Expand All @@ -82,12 +82,11 @@ PHP_METHOD(Phalcon_Annotations_Reader, parse) {
ZEPHIR_INIT_VAR(comment);
zephir_call_method(comment, reflection, "getdoccomment");
if ((Z_TYPE_P(comment) == IS_STRING)) {
ZEPHIR_INIT_VAR(classAnnotations);
ZEPHIR_INIT_VAR(_1);
zephir_call_method(_1, reflection, "getfilename");
ZEPHIR_INIT_VAR(_2);
zephir_call_method(_2, reflection, "getstartline");
ZEPHIR_INIT_VAR(classAnnotations);
zephir_call_func_p3(classAnnotations, "phannot_parse_annotations", comment, _1, _2);
if ((Z_TYPE_P(classAnnotations) == IS_ARRAY)) {
zephir_array_update_string(&annotations, SL("class"), &classAnnotations, PH_COPY | PH_SEPARATE);
}
Expand All @@ -107,16 +106,15 @@ PHP_METHOD(Phalcon_Annotations_Reader, parse) {
ZEPHIR_INIT_NVAR(comment);
zephir_call_method_cache(comment, property, "getdoccomment", &_6);
if ((Z_TYPE_P(comment) == IS_STRING)) {
ZEPHIR_INIT_NVAR(propertyAnnotations);
ZEPHIR_INIT_NVAR(_1);
zephir_call_method_cache(_1, reflection, "getfilename", &_7);
ZEPHIR_INIT_NVAR(_2);
ZVAL_LONG(_2, line);
ZEPHIR_INIT_NVAR(propertyAnnotations);
zephir_call_func_p3(propertyAnnotations, "phannot_parse_annotations", comment, _1, _2);
ZEPHIR_SINIT_NVAR(_8);
ZVAL_LONG(&_8, line);
if ((Z_TYPE_P(propertyAnnotations) == IS_ARRAY)) {
ZEPHIR_OBS_NVAR(_8);
zephir_read_property(&_8, property, SL("name"), PH_NOISY_CC);
zephir_array_update_zval(&annotationsProperties, _8, &propertyAnnotations, PH_COPY | PH_SEPARATE);
ZEPHIR_OBS_NVAR(_9);
zephir_read_property(&_9, property, SL("name"), PH_NOISY_CC);
zephir_array_update_zval(&annotationsProperties, _9, &propertyAnnotations, PH_COPY | PH_SEPARATE);
}
}
}
Expand All @@ -129,25 +127,24 @@ PHP_METHOD(Phalcon_Annotations_Reader, parse) {
if (zephir_fast_count_int(methods TSRMLS_CC)) {
ZEPHIR_INIT_VAR(annotationsMethods);
array_init(annotationsMethods);
zephir_is_iterable(methods, &_10, &_9, 0, 0);
zephir_is_iterable(methods, &_11, &_10, 0, 0);
for (
; zend_hash_get_current_data_ex(_10, (void**) &_11, &_9) == SUCCESS
; zend_hash_move_forward_ex(_10, &_9)
; zend_hash_get_current_data_ex(_11, (void**) &_12, &_10) == SUCCESS
; zend_hash_move_forward_ex(_11, &_10)
) {
ZEPHIR_GET_HVALUE(method, _11);
ZEPHIR_GET_HVALUE(method, _12);
ZEPHIR_INIT_NVAR(comment);
zephir_call_method_cache(comment, method, "getdoccomment", &_12);
zephir_call_method_cache(comment, method, "getdoccomment", &_13);
if ((Z_TYPE_P(comment) == IS_STRING)) {
ZEPHIR_INIT_NVAR(methodAnnotations);
ZEPHIR_INIT_NVAR(_1);
zephir_call_method_cache(_1, method, "getfilename", &_13);
zephir_call_method_cache(_1, method, "getfilename", &_14);
ZEPHIR_INIT_NVAR(_2);
zephir_call_method_cache(_2, method, "getstartline", &_14);
ZEPHIR_INIT_NVAR(methodAnnotations);
zephir_call_func_p3(methodAnnotations, "phannot_parse_annotations", comment, _1, _2);
zephir_call_method_cache(_2, method, "getstartline", &_15);
if ((Z_TYPE_P(methodAnnotations) == IS_ARRAY)) {
ZEPHIR_OBS_NVAR(_8);
zephir_read_property(&_8, method, SL("name"), PH_NOISY_CC);
zephir_array_update_zval(&annotationsMethods, _8, &methodAnnotations, PH_COPY | PH_SEPARATE);
ZEPHIR_OBS_NVAR(_9);
zephir_read_property(&_9, method, SL("name"), PH_NOISY_CC);
zephir_array_update_zval(&annotationsMethods, _9, &methodAnnotations, PH_COPY | PH_SEPARATE);
}
}
}
Expand Down Expand Up @@ -187,7 +184,6 @@ PHP_METHOD(Phalcon_Annotations_Reader, parseDocBlock) {
ZEPHIR_INIT_NVAR(file);
ZVAL_STRING(file, "eval code", 1);
}
zephir_call_func_p3(return_value, "phannot_parse_annotations", docBlock, file, line);
RETURN_MM();

}
Expand Down
3 changes: 1 addition & 2 deletions ext/phalcon/assets/filters/cssmin.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Zend/zend_interfaces.h>

#include "kernel/main.h"
#include "kernel/fcall.h"
#include "kernel/array.h"
#include "ext/spl/spl_exceptions.h"
#include "kernel/exception.h"
#include "kernel/memory.h"
Expand Down Expand Up @@ -74,7 +74,6 @@ PHP_METHOD(Phalcon_Assets_Filters_Cssmin, filter) {



zephir_call_func_p1(return_value, "phalcon_cssmin", content);
RETURN_MM();

}
Expand Down
3 changes: 1 addition & 2 deletions ext/phalcon/assets/filters/jsmin.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Zend/zend_interfaces.h>

#include "kernel/main.h"
#include "kernel/fcall.h"
#include "kernel/array.h"
#include "ext/spl/spl_exceptions.h"
#include "kernel/exception.h"
#include "kernel/memory.h"
Expand Down Expand Up @@ -74,7 +74,6 @@ PHP_METHOD(Phalcon_Assets_Filters_Jsmin, filter) {



zephir_call_func_p1(return_value, "phalcon_jsmin", content);
RETURN_MM();

}
Expand Down
2 changes: 1 addition & 1 deletion ext/phalcon/cache/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/
ZEPHIR_INIT_CLASS(Phalcon_Cache_Backend) {

ZEPHIR_REGISTER_CLASS(Phalcon\\Cache, Backend, phalcon, cache_backend, phalcon_cache_backend_method_entry, 0);
ZEPHIR_REGISTER_CLASS(Phalcon\\Cache, Backend, phalcon, cache_backend, phalcon_cache_backend_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);

zend_declare_property_null(phalcon_cache_backend_ce, SL("_frontend"), ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(phalcon_cache_backend_ce, SL("_options"), ZEND_ACC_PROTECTED TSRMLS_CC);
Expand Down
3 changes: 3 additions & 0 deletions ext/phalcon/cache/backend/apc.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ PHP_METHOD(Phalcon_Cache_Backend_Apc, queryKeys) {
_0 = zend_fetch_class(SL("APCIterator"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
object_init_ex(apc, _0);
ZEPHIR_INIT_VAR(_1);
ZVAL_STRING(_1, "user", 1);
zephir_call_method_p2_noret(apc, "__construct", _1, prefixPattern);
ZEPHIR_INIT_BNVAR(_1);
zephir_call_func_p1(_1, "iterator", apc);
zephir_is_iterable(_1, &_3, &_2, 0, 0);
for (
Expand Down
7 changes: 3 additions & 4 deletions ext/phalcon/cache/backend/libmemcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "kernel/exception.h"
#include "kernel/operators.h"
#include "kernel/concat.h"
#include "kernel/string.h"


/*
Expand Down Expand Up @@ -484,7 +485,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Libmemcached, queryKeys) {

HashTable *_1;
HashPosition _0;
zval *prefix = NULL, *memcache = NULL, *options, *keys, *specialKey, *key = NULL, **_2, *_3 = NULL;
zval *prefix = NULL, *memcache = NULL, *options, *keys, *specialKey, *key = NULL, **_2;

ZEPHIR_MM_GROW();
zephir_fetch_params(1, 0, 1, &prefix);
Expand Down Expand Up @@ -516,9 +517,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Libmemcached, queryKeys) {
; zend_hash_move_forward_ex(_1, &_0)
) {
ZEPHIR_GET_HVALUE(key, _2);
ZEPHIR_INIT_NVAR(_3);
zephir_call_func_p2(_3, "start_with", key, prefix);
if ((!zephir_is_true(prefix) || zephir_is_true(_3))) {
if ((!zephir_is_true(prefix) || zephir_start_with(key, prefix, 0))) {
RETURN_CCTOR(key);
}
}
Expand Down
7 changes: 3 additions & 4 deletions ext/phalcon/cache/backend/memcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "kernel/exception.h"
#include "kernel/operators.h"
#include "kernel/concat.h"
#include "kernel/string.h"


/*
Expand Down Expand Up @@ -366,7 +367,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Memcache, queryKeys) {

HashTable *_1;
HashPosition _0;
zval *prefix = NULL, *memcache = NULL, *options, *keys, *specialKey, *key = NULL, **_2, *_3 = NULL;
zval *prefix = NULL, *memcache = NULL, *options, *keys, *specialKey, *key = NULL, **_2;

ZEPHIR_MM_GROW();
zephir_fetch_params(1, 0, 1, &prefix);
Expand Down Expand Up @@ -398,9 +399,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Memcache, queryKeys) {
; zend_hash_move_forward_ex(_1, &_0)
) {
ZEPHIR_GET_HVALUE(key, _2);
ZEPHIR_INIT_NVAR(_3);
zephir_call_func_p2(_3, "start_with", key, prefix);
if ((!zephir_is_true(prefix) || zephir_is_true(_3))) {
if ((!zephir_is_true(prefix) || zephir_start_with(key, prefix, 0))) {
RETURN_CCTOR(key);
}
}
Expand Down
Loading

0 comments on commit 1143359

Please sign in to comment.