mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11534 from ethereum/fix-different-optimizer-settings-without-enabled-key-in-standard-json
Same optimizer settings with ``settings.optimizer.enabled`` missing and ``false``
This commit is contained in:
commit
e7bf1cc7e7
@ -8,7 +8,9 @@ Compiler Features:
|
|||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Control Flow Graph: Fix incorrectly reported unreachable code.
|
* Control Flow Graph: Fix incorrectly reported unreachable code.
|
||||||
* Solc-Js: Use the same optimizer settings as ``solc`` when the ``--optimize`` flag is not specified.
|
* Solc-Js: When running ``solcjs`` without the ``--optimize`` flag, use ``settings.optimizer.enabled=false`` in Standard JSON instead of omitting the key.
|
||||||
|
* Standard JSON: Omitting ``settings.optimizer.enabled`` was not equivalent to setting it to ``false``.
|
||||||
|
It meant disabling also the peephole optimizer and jumpdest remover which by default still run with ``enabled=false``.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -246,7 +246,10 @@ Input Description
|
|||||||
"remappings": [ ":g=/dir" ],
|
"remappings": [ ":g=/dir" ],
|
||||||
// Optional: Optimizer settings
|
// Optional: Optimizer settings
|
||||||
"optimizer": {
|
"optimizer": {
|
||||||
// disabled by default
|
// Disabled by default.
|
||||||
|
// NOTE: enabled=false still leaves some optimizations on. See comments below.
|
||||||
|
// WARNING: Before version 0.8.6 omitting the 'enabled' key was not equivalent to setting
|
||||||
|
// it to false and would actually disable all the optimizations.
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
// Optimize for how many times you intend to run the code.
|
// Optimize for how many times you intend to run the code.
|
||||||
// Lower values will optimize more for initial deployment cost, higher
|
// Lower values will optimize more for initial deployment cost, higher
|
||||||
|
@ -558,14 +558,15 @@ std::variant<OptimiserSettings, Json::Value> parseOptimizerSettings(Json::Value
|
|||||||
if (auto result = checkOptimizerKeys(_jsonInput))
|
if (auto result = checkOptimizerKeys(_jsonInput))
|
||||||
return *result;
|
return *result;
|
||||||
|
|
||||||
OptimiserSettings settings = OptimiserSettings::none();
|
OptimiserSettings settings = OptimiserSettings::minimal();
|
||||||
|
|
||||||
if (_jsonInput.isMember("enabled"))
|
if (_jsonInput.isMember("enabled"))
|
||||||
{
|
{
|
||||||
if (!_jsonInput["enabled"].isBool())
|
if (!_jsonInput["enabled"].isBool())
|
||||||
return formatFatalError("JSONError", "The \"enabled\" setting must be a Boolean.");
|
return formatFatalError("JSONError", "The \"enabled\" setting must be a Boolean.");
|
||||||
|
|
||||||
settings = _jsonInput["enabled"].asBool() ? OptimiserSettings::standard() : OptimiserSettings::minimal();
|
if (_jsonInput["enabled"].asBool())
|
||||||
|
settings = OptimiserSettings::standard();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_jsonInput.isMember("runs"))
|
if (_jsonInput.isMember("runs"))
|
||||||
|
Loading…
Reference in New Issue
Block a user