Skip to content

Commit 57ce245

Browse files
authored
Reduce code bloat in arginfo by using specialised string releases (#20016)
* Reduce code bloat in arginfo by using specialised string releases Comparing this patch to master (c7da728), with a plain configure command without any options: ``` text data bss dec hex filename 20683738 1592400 137712 22413850 156021a sapi/cli/php 20688522 1592400 137712 22418634 15614ca sapi/cli/php_old ``` We see a minor reduction of 0.023% in code size. * Also use true for the other initialization line * Also use specialized code for consts
1 parent 418c755 commit 57ce245

File tree

59 files changed

+3796
-3796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3796
-3796
lines changed

Zend/zend_attributes_arginfo.h

Lines changed: 36 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Zend/zend_builtin_functions_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/gen_stub.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,7 +2801,7 @@ private function getClassConstDeclaration(EvaluatedValue $value, array $allConst
28012801

28022802
$code = "\n" . $zvalCode;
28032803

2804-
$code .= "\tzend_string *const_{$constName}_name = zend_string_init_interned(\"$constName\", sizeof(\"$constName\") - 1, 1);\n";
2804+
$code .= "\tzend_string *const_{$constName}_name = zend_string_init_interned(\"$constName\", sizeof(\"$constName\") - 1, true);\n";
28052805
$nameCode = "const_{$constName}_name";
28062806

28072807
if ($this->exposedDocComment) {
@@ -2855,7 +2855,7 @@ private function getClassConstDeclaration(EvaluatedValue $value, array $allConst
28552855
$code .= "#endif\n";
28562856
}
28572857

2858-
$code .= "\tzend_string_release(const_{$constName}_name);\n";
2858+
$code .= "\tzend_string_release_ex(const_{$constName}_name, true);\n";
28592859

28602860
return $code;
28612861
}
@@ -3058,13 +3058,13 @@ public static function getString(
30583058
// Generally strings will not be known
30593059
$initFn = $interned ? 'zend_string_init_interned' : 'zend_string_init';
30603060
$result = [
3061-
"\tzend_string *$varName = $initFn(\"$content\", sizeof(\"$content\") - 1, 1);\n",
3061+
"\tzend_string *$varName = $initFn(\"$content\", sizeof(\"$content\") - 1, true);\n",
30623062
$varName,
3063-
"\tzend_string_release($varName);\n"
3063+
"\tzend_string_release_ex($varName, true);\n"
30643064
];
30653065
// For attribute values that are not freed
30663066
if ($varName === '') {
3067-
$result[0] = "$initFn(\"$content\", sizeof(\"$content\") - 1, 1);\n";
3067+
$result[0] = "$initFn(\"$content\", sizeof(\"$content\") - 1, true);\n";
30683068
}
30693069
// If not set, use the current latest version
30703070
$allVersions = ALL_PHP_VERSION_IDS;

ext/bcmath/bcmath_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/curl/curl_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)