Skip to content

Commit

Permalink
Merge pull request #1600 from phalcon/development
Browse files Browse the repository at this point in the history
0.10.5
  • Loading branch information
sergeyklay authored Nov 10, 2017
2 parents 11e3984 + d10b3c1 commit 04eb328
Show file tree
Hide file tree
Showing 28 changed files with 319 additions and 130 deletions.
89 changes: 68 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
language: php

dist: trusty
# Change to `true' to enable debug mode
sudo: false

php:
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2

git:
depth: 1
Expand All @@ -20,75 +24,118 @@ env:
- LIBRARY_PATH="$TRAVIS_BUILD_DIR/build/lib":$LIBRARY_PATH
- C_INCLUDE_PATH="$TRAVIS_BUILD_DIR/build/include"
- CFLAGS="-g3 -O0 -Wall -fvisibility=hidden"
- ZEPHIR_PARSER_VERSION="v1.1.0"
- REPORT_EXIT_STATUS=1
- PATH="${HOME}/bin:${PATH}"
matrix:
- CC="ccache gcc"
- CC="clang"
- CC="gcc" ZEPHIR_PARSER_VERSION="development"
- CC="gcc" RE2C_VERSION="0.13.6" ZEPHIR_PARSER_VERSION="v1.1.1"
- CC="clang" RE2C_VERSION="0.13.6" ZEPHIR_PARSER_VERSION="v1.1.1"
- CC="gcc" RE2C_VERSION="0.13.6" ZEPHIR_PARSER_VERSION="development"
- CC="clang" RE2C_VERSION="0.13.6" ZEPHIR_PARSER_VERSION="development"
- CC="gcc" RE2C_VERSION="1.0.3" ZEPHIR_PARSER_VERSION="v1.1.1"
- CC="clang" RE2C_VERSION="1.0.3" ZEPHIR_PARSER_VERSION="v1.1.1"
- CC="gcc" RE2C_VERSION="1.0.3" ZEPHIR_PARSER_VERSION="development"
- CC="clang" RE2C_VERSION="1.0.3" ZEPHIR_PARSER_VERSION="development"

matrix:
fast_finish: true
allow_failures:
- php: nightly
- php: 7.2
exclude:
- env: CC="gcc"
compiler: clang
- env: CC="clang"
compiler: gcc
include:
- env: CC="ccache gcc"
- env: CC="gcc" RE2C_VERSION="0.13.6" ZEPHIR_PARSER_VERSION="v1.1.1"
php: nightly
compiler: gcc
- env: CC="clang"
- env: CC="gcc" RE2C_VERSION="1.0.3" ZEPHIR_PARSER_VERSION="v1.1.1"
php: nightly
compiler: clang
- env: CC="gcc" ZEPHIR_PARSER_VERSION="development"
compiler: gcc
- env: CC="gcc" RE2C_VERSION="0.13.6" ZEPHIR_PARSER_VERSION="development"
php: nightly
compiler: gcc
- env: CC="gcc" RE2C_VERSION="1.0.3" ZEPHIR_PARSER_VERSION="development"
php: nightly
compiler: gcc
- env: CC="clang" RE2C_VERSION="0.13.6" ZEPHIR_PARSER_VERSION="v1.1.1"
php: nightly
compiler: clang
- env: CC="clang" RE2C_VERSION="1.0.3" ZEPHIR_PARSER_VERSION="v1.1.1"
php: nightly
compiler: clang
- env: CC="clang" RE2C_VERSION="0.13.6" ZEPHIR_PARSER_VERSION="development"
php: nightly
compiler: clang
- env: CC="clang" RE2C_VERSION="1.0.3" ZEPHIR_PARSER_VERSION="development"
php: nightly
compiler: clang

cache:
apt: true
ccache: true
timeout: 691200
timeout: 604800
directories:
- vendor
- $HOME/.ccache
- $HOME/.composer/cache
- $HOME/.local/opt/re2c
- $HOME/.cache/re2c

before_install:
- if [[ ! -z "${GH_TOKEN}" ]]; then composer config github-oauth.github.com ${GH_TOKEN}; echo "Configured Github token"; fi;

install:
- composer --prefer-source install
- bash unit-tests/ci/install_zephir_parser.sh
- bash ./unit-tests/ci/install-re2c $RE2C_VERSION
- bash ./unit-tests/ci/install_zephir_parser.sh
- ./install

before_script:
#- $CC --version
- $(phpenv which php) compiler.php help
- $(phpenv which php) compiler.php generate
- $(phpenv which php) compiler.php stubs
- $(phpenv which php) compiler.php api
- (cd ext; $(phpenv which phpize) && ./configure --silent --with-php-config=$(phpenv which php-config) --enable-test && make -j"$(getconf _NPROCESSORS_ONLN)" && make --silent install && phpenv config-add ../unit-tests/ci/test.ini)
#- ls -1 `$(phpenv which php-config) --extension-dir`
#- $(phpenv which php) -m
#- phpenv versions
- ulimit -c unlimited || true
- $CC --version
# Uncomment to setting core dump
#- echo '/tmp/core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern &> /dev/null
- sudo chmod +s $(which gdb)

script:
- echo 'variables_order=EGPCS' >> "$(phpenv root)/versions/$(phpenv version-name)/etc/php.ini"
- vendor/bin/phpcs --standard=PSR2 --report=emacs --extensions=php --warning-severity=0 Library/ unit-tests/Extension/ unit-tests/Zephir/
- valgrind --read-var-info=yes --error-exitcode=1 --fullpath-after= --track-origins=yes --leak-check=full ./unit-tests/phpunit --not-exit -c phpunit.xml.dist --debug unit-tests/
- |
valgrind \
--read-var-info=yes \
--error-exitcode=1 \
--fullpath-after= \
--track-origins=yes \
--leak-check=full \
--run-libc-freeres=no \
./unit-tests/phpunit \
--not-exit \
-c phpunit.xml.dist \
--debug \
unit-tests/
- $(phpenv which php) unit-tests/microbench.php

after_success:
- if [[ ! -z "${CODECOV_TOKEN}" ]]; then bash <(curl -s https://codecov.io/bash); fi;

after_failure:
- ./unit-tests/ci/after_failure.sh

notifications:
email:
recipients:
- [email protected]
on_success: change
on_failure: always
# Uncomment to debug core dump
# - ./unit-tests/ci/after_failure.sh
- $(phpenv which php) -m
- $(phpenv which php) -i

addons:
apt:
packages:
- re2c
- valgrind
- gdb
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Copyright (c) 2013-present Zephir Team
https://zephir-lang.com

MIT License

Copyright (c) 2013-present Zephir Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down
2 changes: 1 addition & 1 deletion Library/Backends/ZendEngine3/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ public function resolveValue($value, CompilationContext $context, $usePointer =
if ($value == 'null' || $value == 'true' || $value == 'false') {
$varName = '__$' . $value;
if (!$context->symbolTable->hasVariable($varName)) {
$tempVariable = new Variable('variable', $varName, $context->currentBranch);
$tempVariable = new Variable('variable', $varName, $context->branchManager->getCurrentBranch());
$context->symbolTable->addRawVariable($tempVariable);
}
$tempVariable = $context->symbolTable->getVariableForWrite($varName, $context);
Expand Down
9 changes: 7 additions & 2 deletions Library/BranchManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
*/
class BranchManager
{
/** @var Branch|null */
protected $currentBranch;

protected $level = 0;

protected $uniqueId = 1;

protected $rootBranch = null;
/** @var Branch|null */
protected $rootBranch;

/**
* Sets the current active branch in the manager
Expand Down Expand Up @@ -68,7 +70,7 @@ public function removeBranch(Branch $branch)
/**
* Returns the active branch in the manager
*
* @return Branch
* @return null|Branch
*/
public function getCurrentBranch()
{
Expand All @@ -85,6 +87,9 @@ public function setRootBranch(Branch $branch)
$this->rootBranch = $branch;
}

/**
* @return null|Branch
*/
public function getRootBranch()
{
return $this->rootBranch;
Expand Down
2 changes: 1 addition & 1 deletion Library/Call.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ public function getReadOnlyResolvedParams($parameters, CompilationContext $compi
public function addCallStatusFlag(CompilationContext $compilationContext)
{
if (!$compilationContext->symbolTable->hasVariable('ZEPHIR_LAST_CALL_STATUS')) {
$callStatus = new Variable('int', 'ZEPHIR_LAST_CALL_STATUS', $compilationContext->currentBranch);
$callStatus = new Variable('int', 'ZEPHIR_LAST_CALL_STATUS', $compilationContext->branchManager->getCurrentBranch());
$callStatus->setIsInitialized(true, $compilationContext);
$callStatus->increaseUses();
$callStatus->setReadOnly(true);
Expand Down
27 changes: 14 additions & 13 deletions Library/ClassMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,20 @@ public function compile(CompilationContext $compilationContext)
$typeInference = $this->typeInference;
$callGathererPass = $this->callGathererPass;

/**
* Initialization of parameters happens in a fictitious external branch
*/
$branch = new Branch();
$branch->setType(Branch::TYPE_EXTERNAL);

/**
* BranchManager helps to create graphs of conditional/loop/root/jump branches
*/
$branchManager = new BranchManager();
$branchManager->addBranch($branch);

$compilationContext->branchManager = $branchManager;

/**
* Every method has its own symbol table
*/
Expand All @@ -1531,25 +1545,12 @@ public function compile(CompilationContext $compilationContext)
}
}

/**
* Initialization of parameters happens in a fictitious external branch
*/
$branch = new Branch();
$branch->setType(Branch::TYPE_EXTERNAL);

/**
* BranchManager helps to create graphs of conditional/loop/root/jump branches
*/
$branchManager = new BranchManager();
$branchManager->addBranch($branch);

/**
* Cache Manager manages function calls, method calls and class entries caches
*/
$cacheManager = new CacheManager();
$cacheManager->setGatherer($callGathererPass);

$compilationContext->branchManager = $branchManager;
$compilationContext->cacheManager = $cacheManager;
$compilationContext->typeInference = $typeInference;
$compilationContext->symbolTable = $symbolTable;
Expand Down
Empty file modified Library/Commands/CommandAbstract.php
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion Library/Commands/CommandBuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getUsage()
Description:
The options are as follows:
--backend=ZendEngine2|ZendEngine3 The extension namespace.
--backend=ZendEngine2|ZendEngine3 Used backend to build extension.
EOL;

return sprintf($template, $this->getCommand());
Expand Down
2 changes: 1 addition & 1 deletion Library/Commands/CommandBuildDev.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getUsage()
Description:
The options are as follows:
--backend=ZendEngine2|ZendEngine3 The extension namespace.
--backend=ZendEngine2|ZendEngine3 Used backend to build extension.
EOL;

return sprintf($template, $this->getCommand());
Expand Down
2 changes: 1 addition & 1 deletion Library/Commands/CommandCompile.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getUsage()
Description:
The options are as follows:
--backend=ZendEngine2|ZendEngine3 The extension namespace.
--backend=ZendEngine2|ZendEngine3 Used backend to compile extension.
EOL;

return sprintf($template, $this->getCommand());
Expand Down
2 changes: 1 addition & 1 deletion Library/Commands/CommandGenerate.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getUsage()
Description:
The options are as follows:
--backend=ZendEngine2|ZendEngine3 The extension namespace.
--backend=ZendEngine2|ZendEngine3 Used backend to generate extension.
EOL;

return sprintf($template, $this->getCommand());
Expand Down
3 changes: 2 additions & 1 deletion Library/Commands/CommandInitialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public function getUsage()
Description:
The options are as follows:
namespace The extension namespace.
namespace The extension namespace.
--backend=ZendEngine2|ZendEngine3 Used backend to create extension.
EOL;

return sprintf($template, $this->getCommand());
Expand Down
2 changes: 1 addition & 1 deletion Library/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
class Compiler
{
const VERSION = '0.10.4';
const VERSION = '0.10.5';

public $parserCompiled = false;

Expand Down
5 changes: 4 additions & 1 deletion Library/Expression/StaticPropertyAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ class StaticPropertyAccess

protected $_readOnly = false;

/**
* @var Variable|null
*/
protected $_expectingVariable;

/**
* Sets if the variable must be resolved into a direct variable symbol
* create a temporary value or ignore the return value
*
* @param boolean $expecting
* @param Variable $expectingVariable
* @param Variable|null $expectingVariable
*/
public function setExpectReturn($expecting, Variable $expectingVariable = null)
{
Expand Down
Empty file modified Library/Operators/BaseOperator.php
100755 → 100644
Empty file.
Empty file modified Library/Optimizers/MathOptimizer.php
100755 → 100644
Empty file.
Empty file modified Library/Optimizers/OptimizerAbstract.php
100755 → 100644
Empty file.
Loading

0 comments on commit 04eb328

Please sign in to comment.