diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-04-26 00:32:51 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-04-26 00:32:51 +0400 |
commit | f9927a6c97208c60d922f9a4e98feb8079c57d1f (patch) | |
tree | 35815b69d1bf7d47fb41e857ff8d2b024ddac153 /win32/build/confutils.js | |
parent | 4e7cbf3f5842abe6688c11ce3cc11d2eabf0695f (diff) | |
parent | b82d077f988606580e5c06a9da18fe4f60ddb7cb (diff) | |
download | php-git-f9927a6c97208c60d922f9a4e98feb8079c57d1f.tar.gz |
Merge mainstream 'master' branch into refactoring
During merge I had to revert:
Nikita's patch for php_splice() (it probably needs to be applyed again)
Bob Weinand's patches related to constant expression handling (we need to review them carefully)
I also reverted all our attempts to support sapi/phpdbg (we didn't test it anyway)
Conflicts:
Zend/zend.h
Zend/zend_API.c
Zend/zend_ast.c
Zend/zend_compile.c
Zend/zend_compile.h
Zend/zend_constants.c
Zend/zend_exceptions.c
Zend/zend_execute.c
Zend/zend_execute.h
Zend/zend_execute_API.c
Zend/zend_hash.c
Zend/zend_highlight.c
Zend/zend_language_parser.y
Zend/zend_language_scanner.c
Zend/zend_language_scanner_defs.h
Zend/zend_variables.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/date/php_date.c
ext/dom/documenttype.c
ext/hash/hash.c
ext/iconv/iconv.c
ext/mbstring/tests/zend_multibyte-10.phpt
ext/mbstring/tests/zend_multibyte-11.phpt
ext/mbstring/tests/zend_multibyte-12.phpt
ext/mysql/php_mysql.c
ext/mysqli/mysqli.c
ext/mysqlnd/mysqlnd_reverse_api.c
ext/mysqlnd/php_mysqlnd.c
ext/opcache/ZendAccelerator.c
ext/opcache/zend_accelerator_util_funcs.c
ext/opcache/zend_persist.c
ext/opcache/zend_persist_calc.c
ext/pcre/php_pcre.c
ext/pdo/pdo_dbh.c
ext/pdo/pdo_stmt.c
ext/pdo_pgsql/pgsql_driver.c
ext/pgsql/pgsql.c
ext/reflection/php_reflection.c
ext/session/session.c
ext/spl/spl_array.c
ext/spl/spl_observer.c
ext/standard/array.c
ext/standard/basic_functions.c
ext/standard/html.c
ext/standard/mail.c
ext/standard/php_array.h
ext/standard/proc_open.c
ext/standard/streamsfuncs.c
ext/standard/user_filters.c
ext/standard/var_unserializer.c
ext/standard/var_unserializer.re
main/php_variables.c
sapi/phpdbg/phpdbg.c
sapi/phpdbg/phpdbg_bp.c
sapi/phpdbg/phpdbg_frame.c
sapi/phpdbg/phpdbg_help.c
sapi/phpdbg/phpdbg_list.c
sapi/phpdbg/phpdbg_print.c
sapi/phpdbg/phpdbg_prompt.c
Diffstat (limited to 'win32/build/confutils.js')
-rw-r--r-- | win32/build/confutils.js | 75 |
1 files changed, 73 insertions, 2 deletions
diff --git a/win32/build/confutils.js b/win32/build/confutils.js index e0df4f621b..1dbc75b280 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -26,6 +26,8 @@ var FSO = WScript.CreateObject("Scripting.FileSystemObject"); var MFO = null;
var SYSTEM_DRIVE = WshShell.Environment("Process").Item("SystemDrive");
var PROGRAM_FILES = WshShell.Environment("Process").Item("ProgramFiles");
+var PROGRAM_FILESx86 = WshShell.Environment("Process").Item("ProgramFiles(x86)");
+var VCINSTALLDIR = WshShell.Environment("Process").Item("VCINSTALLDIR");
var DSP_FLAGS = new Array();
var PHP_SRC_DIR=FSO.GetParentFolderName(WScript.ScriptFullName);
@@ -1015,6 +1017,21 @@ function generate_version_info_resource(makefiletarget, basename, creditspath, s return resname;
}
+/* Check if PGO is enabled for given module. To disable PGO for a particular module,
+define a global variable by the following name scheme before SAPI() or EXTENSION() call
+ var PHP_MYMODULE_PGO = false; */
+function is_pgo_desired(mod)
+{
+ var varname = "PHP_" + mod.toUpperCase() + "_PGO";
+
+ /* don't disable if there's no mention of the varname */
+ if (eval("typeof " + varname + " == 'undefined'")) {
+ return true;
+ }
+
+ return eval("!!" + varname);
+}
+
function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
{
var SAPI = sapiname.toUpperCase();
@@ -1066,7 +1083,17 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir) manifest = "-@$(_VC_MANIFEST_EMBED_EXE)";
}
- if(PHP_PGI == "yes" || PHP_PGO != "no") {
+ if(is_pgo_desired(sapiname) && (PHP_PGI == "yes" || PHP_PGO != "no")) {
+ // Add compiler and link flags if PGO options are selected
+ if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
+ ADD_FLAG('CFLAGS_' + SAPI, "/GL /O2");
+ ADD_FLAG('LDFLAGS_' + SAPI, "/LTCG:PGINSTRUMENT");
+ }
+ else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
+ ADD_FLAG('CFLAGS_' + SAPI, "/GL /O2");
+ ADD_FLAG('LDFLAGS_' + SAPI, "/LTCG:PGUPDATE");
+ }
+
ldflags += " /PGD:$(PGOPGD_DIR)\\" + makefiletarget.substring(0, makefiletarget.indexOf(".")) + ".pgd";
}
@@ -1203,6 +1230,8 @@ function ADD_EXTENSION_DEP(extname, dependson, optional) return true;
}
+var static_pgo_enabled = false;
+
function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
{
var objs = null;
@@ -1252,7 +1281,17 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) var ld = "@$(CC)";
ldflags = "";
- if (PHP_PGI == "yes" || PHP_PGO != "no") {
+ if (is_pgo_desired(extname) && (PHP_PGI == "yes" || PHP_PGO != "no")) {
+ // Add compiler and link flags if PGO options are selected
+ if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
+ ADD_FLAG('LDFLAGS_' + EXT, "/LTCG:PGINSTRUMENT");
+ }
+ else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
+ ADD_FLAG('LDFLAGS_' + EXT, "/LTCG:PGUPDATE");
+ }
+
+ ADD_FLAG('CFLAGS_' + EXT, "/GL /O2");
+
ldflags = " /PGD:$(PGOPGD_DIR)\\" + dllname.substring(0, dllname.indexOf(".")) + ".pgd";
}
@@ -1283,6 +1322,19 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) ADD_FLAG("STATIC_EXT_LIBS", "$(LIBS_" + EXT + ")");
ADD_FLAG("STATIC_EXT_LDFLAGS", "$(LDFLAGS_" + EXT + ")");
ADD_FLAG("STATIC_EXT_CFLAGS", "$(CFLAGS_" + EXT + ")");
+ if (is_pgo_desired(extname) && (PHP_PGI == "yes" || PHP_PGO != "no")) {
+ if (!static_pgo_enabled) {
+ if (PHP_DEBUG != "yes" && PHP_PGI == "yes") {
+ ADD_FLAG('STATIC_EXT_LDFLAGS', "/LTCG:PGINSTRUMENT");
+ }
+ else if (PHP_DEBUG != "yes" && PHP_PGO != "no") {
+ ADD_FLAG('STATIC_EXT_LDFLAGS', "/LTCG:PGUPDATE");
+ }
+
+ ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2");
+ static_pgo_enabled = true;
+ }
+ }
/* find the header that declares the module pointer,
* so we can include it in internal_functions.c */
@@ -1388,6 +1440,11 @@ function ADD_SOURCES(dir, file_list, target, obj_dir) }
} else {
MFO.WriteLine(sub_build + obj + ": " + dir + "\\" + src);
+
+ if (PHP_ANALYZER == "pvs") {
+ MFO.WriteLine("\t@\"$(PVS_STUDIO)\" --cl-params $(" + flags + ") $(CFLAGS) $(" + bd_flags_name + ") /c " + dir + "\\" + src + " --source-file " + dir + "\\" + src
+ + " --cfg PVS-Studio.conf --errors-off \"V122 V117 V111\" ");
+ }
MFO.WriteLine("\t@$(CC) $(" + flags + ") $(CFLAGS) $(" + bd_flags_name + ") /c " + dir + "\\" + src + " /Fo" + sub_build + obj);
}
}
@@ -1548,6 +1605,20 @@ function write_summary() ar[1] = ['Thread Safety', PHP_ZTS == "yes" ? "Yes" : "No"];
ar[2] = ['Compiler', VC_VERSIONS[VCVERS]];
ar[3] = ['Architecture', X64 ? 'x64' : 'x86'];
+ if (PHP_PGO == "yes") {
+ ar[4] = ['Optimization', "PGO"];
+ } else if (PHP_PGI == "yes") {
+ ar[4] = ['Optimization', "PGI"];
+ } else {
+ ar[4] = ['Optimization', PHP_DEBUG == "yes" ? "disabled" : "PGO disabled"];
+ }
+ if (PHP_ANALYZER == "vs") {
+ ar[5] = ['Static analyzer', 'Visual Studio'];
+ } else if (PHP_ANALYZER == "pvs") {
+ ar[5] = ['Static analyzer', 'PVS-Studio'];
+ } else {
+ ar[5] = ['Static analyzer', 'disabled'];
+ }
output_as_table(["",""], ar);
STDOUT.WriteBlankLines(2);
|