Skip to content

Commit 3d8fc6b

Browse files
authored
Merge pull request #12760 from ethereum/viaIRNonExperimental
Mark viaIR code generation as non-experimental.
2 parents 9ef590c + 0172f61 commit 3d8fc6b

File tree

99 files changed

+79
-503
lines changed

Some content is hidden

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

99 files changed

+79
-503
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Language Features:
66

77

88
Compiler Features:
9+
* Commandline Interface: Allow the use of ``--via-ir`` in place of ``--experimental-via-ir``.
10+
* Compilation via Yul IR is no longer marked as experimental.
911
* JSON-AST: Added selector field for errors and events.
1012
* LSP: Implements goto-definition.
1113
* Peephole Optimizer: Optimize comparisons in front of conditional jumps and conditional jumps across a single unconditional jump.

docs/internals/layout_in_storage.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ by checking if the lowest bit is set: short (not set) and long (set).
140140

141141
.. note::
142142
Handling invalidly encoded slots is currently not supported but may be added in the future.
143-
If you are compiling via the experimental IR-based compiler pipeline, reading an invalidly encoded
144-
slot results in a ``Panic(0x22)`` error.
143+
If you are compiling via IR, reading an invalidly encoded slot results in a ``Panic(0x22)`` error.
145144

146145
JSON Output
147146
===========

docs/internals/optimizer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ call completely.
2323
Currently, the parameter ``--optimize`` activates the opcode-based optimizer for the
2424
generated bytecode and the Yul optimizer for the Yul code generated internally, for example for ABI coder v2.
2525
One can use ``solc --ir-optimized --optimize`` to produce an
26-
optimized experimental Yul IR for a Solidity source. Similarly, one can use ``solc --strict-assembly --optimize``
26+
optimized Yul IR for a Solidity source. Similarly, one can use ``solc --strict-assembly --optimize``
2727
for a stand-alone Yul mode.
2828

2929
You can find more details on both optimizer modules and their optimization steps below.

docs/ir-breaking-changes.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ The IR-based code generator was introduced with an aim to not only allow
1515
code generation to be more transparent and auditable but also
1616
to enable more powerful optimization passes that span across functions.
1717

18-
Currently, the IR-based code generator is still marked experimental,
19-
but it supports all language features and has received a lot of testing,
20-
so we consider it almost ready for production use.
21-
22-
You can enable it on the command line using ``--experimental-via-ir``
18+
You can enable it on the command line using ``--via-ir``
2319
or with the option ``{"viaIR": true}`` in standard-json and we
2420
encourage everyone to try it out!
2521

docs/using-the-compiler.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ Input Description
298298
// tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul or berlin
299299
"evmVersion": "byzantium",
300300
// Optional: Change compilation pipeline to go through the Yul intermediate representation.
301-
// This is a highly EXPERIMENTAL feature, not to be used for production. This is false by default.
301+
// This is false by default.
302302
"viaIR": true,
303303
// Optional: Debugging settings
304304
"debug": {

libsolidity/codegen/ir/IRGenerator.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pair<string, string> IRGenerator::run(
9393
map<ContractDefinition const*, string_view const> const& _otherYulSources
9494
)
9595
{
96-
string const ir = yul::reindent(generate(_contract, _cborMetadata, _otherYulSources));
96+
string ir = yul::reindent(generate(_contract, _cborMetadata, _otherYulSources));
9797

9898
yul::AssemblyStack asmStack(
9999
m_evmVersion,
@@ -113,15 +113,7 @@ pair<string, string> IRGenerator::run(
113113
}
114114
asmStack.optimize();
115115

116-
string warning =
117-
"/*=====================================================*\n"
118-
" * WARNING *\n"
119-
" * Solidity to Yul compilation is still EXPERIMENTAL *\n"
120-
" * It can result in LOSS OF FUNDS or worse *\n"
121-
" * !USE AT YOUR OWN RISK! *\n"
122-
" *=====================================================*/\n\n";
123-
124-
return {warning + ir, warning + asmStack.print(m_context.soliditySourceProvider())};
116+
return {move(ir), asmStack.print(m_context.soliditySourceProvider())};
125117
}
126118

127119
string IRGenerator::generate(

libsolidity/interface/CompilerStack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ bytes CompilerStack::createCBORMetadata(Contract const& _contract, bool _forIR)
16771677
else
16781678
solAssert(m_metadataHash == MetadataHash::None, "Invalid metadata hash");
16791679

1680-
if (experimentalMode || _forIR)
1680+
if (experimentalMode)
16811681
encoder.pushBool("experimental", true);
16821682
if (m_metadataFormat == MetadataFormat::WithReleaseVersionTag)
16831683
encoder.pushBytes("solc", VersionCompactBytes);

libsolidity/interface/CompilerStack.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class CompilerStack: public langutil::CharStreamProvider
189189
/// Enable EVM Bytecode generation. This is enabled by default.
190190
void enableEvmBytecodeGeneration(bool _enable = true) { m_generateEvmBytecode = _enable; }
191191

192-
/// Enable experimental generation of Yul IR code.
192+
/// Enable generation of Yul IR code.
193193
void enableIRGeneration(bool _enable = true) { m_generateIR = _enable; }
194194

195195
/// Enable experimental generation of Ewasm code. If enabled, IR is also generated.
@@ -373,8 +373,8 @@ class CompilerStack: public langutil::CharStreamProvider
373373
std::shared_ptr<evmasm::Assembly> evmRuntimeAssembly;
374374
evmasm::LinkerObject object; ///< Deployment object (includes the runtime sub-object).
375375
evmasm::LinkerObject runtimeObject; ///< Runtime object.
376-
std::string yulIR; ///< Experimental Yul IR code.
377-
std::string yulIROptimized; ///< Optimized experimental Yul IR code.
376+
std::string yulIR; ///< Yul IR code.
377+
std::string yulIROptimized; ///< Optimized Yul IR code.
378378
std::string ewasm; ///< Experimental Ewasm text representation
379379
evmasm::LinkerObject ewasmObject; ///< Experimental Ewasm code
380380
util::LazyInit<std::string const> metadata; ///< The metadata json that will be hashed into the chain.
@@ -447,8 +447,7 @@ class CompilerStack: public langutil::CharStreamProvider
447447
/// Can only be called after state is SourcesSet.
448448
Source const& source(std::string const& _sourceName) const;
449449

450-
/// @param _forIR If true, include a flag that indicates that the bytecode comes from the
451-
/// experimental IR codegen.
450+
/// @param _forIR If true, include a flag that indicates that the bytecode comes from IR codegen.
452451
/// @returns the metadata JSON as a compact string for the given contract.
453452
std::string createMetadata(Contract const& _contract, bool _forIR) const;
454453

libsolidity/interface/StandardCompiler.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,10 +1448,6 @@ Json::Value StandardCompiler::compileYul(InputsAndSettings _inputsAndSettings)
14481448
return output;
14491449
}
14501450

1451-
// TODO: move this warning to AssemblyStack
1452-
output["errors"] = Json::arrayValue;
1453-
output["errors"].append(formatError(Error::Severity::Warning, "Warning", "general", "Yul is still experimental. Please use the output with care."));
1454-
14551451
string contractName = stack.parserResult()->name.str();
14561452

14571453
bool const wildcardMatchesExperimental = true;

scripts/common_cmdline.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ function compileFull
6969
local exit_code=$?
7070
local errors; errors=$(grep -v -E \
7171
-e 'Warning: This is a pre-release compiler version|Warning: Experimental features are turned on|pragma experimental ABIEncoderV2|^ +--> |^ +\||^[0-9]+ +\| ' \
72-
-e 'Warning: Yul is still experimental. Please use the output with care.' \
7372
-e '^No text representation found.$' < "$stderr_path"
7473
)
7574

0 commit comments

Comments
 (0)