Mark viaIR code generation as non-experimental.

This commit is contained in:
Daniel Kirchner 2022-03-09 16:02:31 +01:00
parent 3f6beaa0ad
commit e58c0b561d
48 changed files with 63 additions and 407 deletions

View File

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

View File

@ -140,8 +140,7 @@ by checking if the lowest bit is set: short (not set) and long (set).
.. note::
Handling invalidly encoded slots is currently not supported but may be added in the future.
If you are compiling via the experimental IR-based compiler pipeline, reading an invalidly encoded
slot results in a ``Panic(0x22)`` error.
If you are compiling via IR, reading an invalidly encoded slot results in a ``Panic(0x22)`` error.
JSON Output
===========

View File

@ -23,7 +23,7 @@ call completely.
Currently, the parameter ``--optimize`` activates the opcode-based optimizer for the
generated bytecode and the Yul optimizer for the Yul code generated internally, for example for ABI coder v2.
One can use ``solc --ir-optimized --optimize`` to produce an
optimized experimental Yul IR for a Solidity source. Similarly, one can use ``solc --strict-assembly --optimize``
optimized Yul IR for a Solidity source. Similarly, one can use ``solc --strict-assembly --optimize``
for a stand-alone Yul mode.
You can find more details on both optimizer modules and their optimization steps below.

View File

@ -15,11 +15,7 @@ The IR-based code generator was introduced with an aim to not only allow
code generation to be more transparent and auditable but also
to enable more powerful optimization passes that span across functions.
Currently, the IR-based code generator is still marked experimental,
but it supports all language features and has received a lot of testing,
so we consider it almost ready for production use.
You can enable it on the command line using ``--experimental-via-ir``
You can enable it on the command line using ``--via-ir``
or with the option ``{"viaIR": true}`` in standard-json and we
encourage everyone to try it out!

View File

@ -298,7 +298,7 @@ Input Description
// tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul or berlin
"evmVersion": "byzantium",
// Optional: Change compilation pipeline to go through the Yul intermediate representation.
// This is a highly EXPERIMENTAL feature, not to be used for production. This is false by default.
// This is false by default.
"viaIR": true,
// Optional: Debugging settings
"debug": {

View File

@ -93,7 +93,7 @@ pair<string, string> IRGenerator::run(
map<ContractDefinition const*, string_view const> const& _otherYulSources
)
{
string const ir = yul::reindent(generate(_contract, _cborMetadata, _otherYulSources));
string ir = yul::reindent(generate(_contract, _cborMetadata, _otherYulSources));
yul::AssemblyStack asmStack(
m_evmVersion,
@ -113,15 +113,7 @@ pair<string, string> IRGenerator::run(
}
asmStack.optimize();
string warning =
"/*=====================================================*\n"
" * WARNING *\n"
" * Solidity to Yul compilation is still EXPERIMENTAL *\n"
" * It can result in LOSS OF FUNDS or worse *\n"
" * !USE AT YOUR OWN RISK! *\n"
" *=====================================================*/\n\n";
return {warning + ir, warning + asmStack.print(m_context.soliditySourceProvider())};
return {move(ir), asmStack.print(m_context.soliditySourceProvider())};
}
string IRGenerator::generate(

View File

@ -1677,7 +1677,7 @@ bytes CompilerStack::createCBORMetadata(Contract const& _contract, bool _forIR)
else
solAssert(m_metadataHash == MetadataHash::None, "Invalid metadata hash");
if (experimentalMode || _forIR)
if (experimentalMode)
encoder.pushBool("experimental", true);
if (m_metadataFormat == MetadataFormat::WithReleaseVersionTag)
encoder.pushBytes("solc", VersionCompactBytes);

View File

@ -189,7 +189,7 @@ public:
/// Enable EVM Bytecode generation. This is enabled by default.
void enableEvmBytecodeGeneration(bool _enable = true) { m_generateEvmBytecode = _enable; }
/// Enable experimental generation of Yul IR code.
/// Enable generation of Yul IR code.
void enableIRGeneration(bool _enable = true) { m_generateIR = _enable; }
/// Enable experimental generation of Ewasm code. If enabled, IR is also generated.
@ -373,8 +373,8 @@ private:
std::shared_ptr<evmasm::Assembly> evmRuntimeAssembly;
evmasm::LinkerObject object; ///< Deployment object (includes the runtime sub-object).
evmasm::LinkerObject runtimeObject; ///< Runtime object.
std::string yulIR; ///< Experimental Yul IR code.
std::string yulIROptimized; ///< Optimized experimental Yul IR code.
std::string yulIR; ///< Yul IR code.
std::string yulIROptimized; ///< Optimized Yul IR code.
std::string ewasm; ///< Experimental Ewasm text representation
evmasm::LinkerObject ewasmObject; ///< Experimental Ewasm code
util::LazyInit<std::string const> metadata; ///< The metadata json that will be hashed into the chain.
@ -447,8 +447,7 @@ private:
/// Can only be called after state is SourcesSet.
Source const& source(std::string const& _sourceName) const;
/// @param _forIR If true, include a flag that indicates that the bytecode comes from the
/// experimental IR codegen.
/// @param _forIR If true, include a flag that indicates that the bytecode comes from IR codegen.
/// @returns the metadata JSON as a compact string for the given contract.
std::string createMetadata(Contract const& _contract, bool _forIR) const;

View File

@ -693,7 +693,7 @@ void CommandLineInterface::compile()
m_compiler->setModelCheckerSettings(m_options.modelChecker.settings);
m_compiler->setRemappings(m_options.input.remappings);
m_compiler->setLibraries(m_options.linker.libraries);
m_compiler->setViaIR(m_options.output.experimentalViaIR);
m_compiler->setViaIR(m_options.output.viaIR);
m_compiler->setEVMVersion(m_options.output.evmVersion);
m_compiler->setRevertStringBehaviour(m_options.output.revertStrings);
if (m_options.output.debugInfoSelection.has_value())

View File

@ -47,6 +47,7 @@ static string const g_strErrorRecovery = "error-recovery";
static string const g_strEVM = "evm";
static string const g_strEVMVersion = "evm-version";
static string const g_strEwasm = "ewasm";
static string const g_strViaIR = "via-ir";
static string const g_strExperimentalViaIR = "experimental-via-ir";
static string const g_strGas = "gas";
static string const g_strHelp = "help";
@ -225,7 +226,7 @@ bool CommandLineOptions::operator==(CommandLineOptions const& _other) const noex
output.dir == _other.output.dir &&
output.overwriteFiles == _other.output.overwriteFiles &&
output.evmVersion == _other.output.evmVersion &&
output.experimentalViaIR == _other.output.experimentalViaIR &&
output.viaIR == _other.output.viaIR &&
output.revertStrings == _other.output.revertStrings &&
output.debugInfoSelection == _other.output.debugInfoSelection &&
output.stopAfter == _other.output.stopAfter &&
@ -578,7 +579,11 @@ General Information)").c_str(),
)
(
g_strExperimentalViaIR.c_str(),
"Turn on experimental compilation mode via the IR (EXPERIMENTAL)."
"Deprecated synonym of --via-ir."
)
(
g_strViaIR.c_str(),
"Turn on compilation mode via the IR."
)
(
g_strRevertStrings.c_str(),
@ -706,8 +711,8 @@ General Information)").c_str(),
(CompilerOutputs::componentName(&CompilerOutputs::binary).c_str(), "Binary of the contracts in hex.")
(CompilerOutputs::componentName(&CompilerOutputs::binaryRuntime).c_str(), "Binary of the runtime part of the contracts in hex.")
(CompilerOutputs::componentName(&CompilerOutputs::abi).c_str(), "ABI specification of the contracts.")
(CompilerOutputs::componentName(&CompilerOutputs::ir).c_str(), "Intermediate Representation (IR) of all contracts (EXPERIMENTAL).")
(CompilerOutputs::componentName(&CompilerOutputs::irOptimized).c_str(), "Optimized intermediate Representation (IR) of all contracts (EXPERIMENTAL).")
(CompilerOutputs::componentName(&CompilerOutputs::ir).c_str(), "Intermediate Representation (IR) of all contracts.")
(CompilerOutputs::componentName(&CompilerOutputs::irOptimized).c_str(), "Optimized intermediate Representation (IR) of all contracts.")
(CompilerOutputs::componentName(&CompilerOutputs::ewasm).c_str(), "Ewasm text representation of all contracts (EXPERIMENTAL).")
(CompilerOutputs::componentName(&CompilerOutputs::ewasmIR).c_str(), "Intermediate representation (IR) converted to a form that can be translated directly into Ewasm text representation (EXPERIMENTAL).")
(CompilerOutputs::componentName(&CompilerOutputs::signatureHashes).c_str(), "Function signature hashes of the contracts.")
@ -906,6 +911,7 @@ void CommandLineParser::processArgs()
// TODO: This should eventually contain all options.
{g_strErrorRecovery, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
{g_strExperimentalViaIR, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
{g_strViaIR, {InputMode::Compiler, InputMode::CompilerWithASTImport}}
};
vector<string> invalidOptionsForCurrentInputMode;
for (auto const& [optionName, inputModes]: validOptionInputModeCombinations)
@ -1256,7 +1262,7 @@ void CommandLineParser::processArgs()
m_args.count(g_strModelCheckerSolvers) ||
m_args.count(g_strModelCheckerTargets) ||
m_args.count(g_strModelCheckerTimeout);
m_options.output.experimentalViaIR = (m_args.count(g_strExperimentalViaIR) > 0);
m_options.output.viaIR = (m_args.count(g_strExperimentalViaIR) > 0 || m_args.count(g_strViaIR) > 0);
if (m_options.input.mode == InputMode::Compiler)
m_options.input.errorRecovery = (m_args.count(g_strErrorRecovery) > 0);

View File

@ -182,7 +182,7 @@ struct CommandLineOptions
boost::filesystem::path dir;
bool overwriteFiles = false;
langutil::EVMVersion evmVersion;
bool experimentalViaIR = false;
bool viaIR = false;
RevertStrings revertStrings = RevertStrings::Default;
std::optional<langutil::DebugInfoSelection> debugInfoSelection;
CompilerStack::State stopAfter = CompilerStack::State::CompilationSuccessful;

View File

@ -339,7 +339,7 @@ function test_via_ir_equivalence()
)
asm_output_via_ir=$(
echo "$solidity_code" |
msg_on_error --no-stderr "$SOLC" - --experimental-via-ir --asm --debug-info location "${optimizer_flags[@]}" |
msg_on_error --no-stderr "$SOLC" - --via-ir --asm --debug-info location "${optimizer_flags[@]}" |
sed '/^======= <stdin>/d' |
sed '/^EVM assembly:$/d'
)
@ -355,7 +355,7 @@ function test_via_ir_equivalence()
)
bin_output_via_ir=$(
echo "$solidity_code" |
msg_on_error --no-stderr "$SOLC" - --experimental-via-ir --bin "${optimizer_flags[@]}" |
msg_on_error --no-stderr "$SOLC" - --via-ir --bin "${optimizer_flags[@]}" |
sed '/^======= <stdin>/d' |
sed '/^Binary:$/d'
)
@ -588,7 +588,7 @@ printTask "Testing assemble, yul, strict-assembly and optimize..."
test_solc_assembly_output "{ let x := 0 }" "{ { } }" "--strict-assembly --optimize"
)
printTask "Testing the eqivalence of --experimental-via-ir and a two-stage compilation..."
printTask "Testing the eqivalence of --via-ir and a two-stage compilation..."
(
printTask " - Smoke test"
test_via_ir_equivalence "contract C {}"

View File

@ -1,11 +1,4 @@
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"constant_optimizer_yul/input.sol"
object "C_12" {
code {

View File

@ -54,13 +54,6 @@ sub_0: assembly {
}
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_all/input.sol"
object "C_6" {
@ -176,13 +169,6 @@ object "C_6" {
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_all/input.sol"
object "C_6" {
code {

View File

@ -54,13 +54,6 @@ sub_0: assembly {
}
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_location_only/input.sol"
object "C_6" {
@ -175,13 +168,6 @@ object "C_6" {
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_location_only/input.sol"
object "C_6" {
code {

View File

@ -51,13 +51,6 @@ sub_0: assembly {
}
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_none/input.sol"
object "C_6" {
@ -166,13 +159,6 @@ object "C_6" {
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_none/input.sol"
object "C_6" {
code {

View File

@ -1,11 +1,4 @@
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
object "C_2" {
@ -70,13 +63,6 @@ object "C_2" {
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
object "C_2" {
code {
@ -103,13 +89,6 @@ object "C_2" {
}
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
object "D_27" {
@ -367,12 +346,6 @@ object "D_27" {
/// @src 0:279:599 "contract D /** @src 0:96:165 \"contract D {...\" *\/ {..."
}
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
object "C_2" {
@ -442,13 +415,6 @@ object "D_27" {
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_snippet_escaping/input.sol"
object "D_27" {
code {

View File

@ -1,11 +1,4 @@
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"exp_base_literal/input.sol"
object "C_81" {

View File

@ -1 +1 @@
--experimental-via-ir --optimize --combined-json function-debug,function-debug-runtime --pretty-json
--via-ir --optimize --combined-json function-debug,function-debug-runtime --pretty-json

View File

@ -1 +1 @@
--experimental-via-ir --combined-json function-debug-runtime --pretty-json --json-indent 4
--via-ir --combined-json function-debug-runtime --pretty-json --json-indent 4

View File

@ -1,11 +1,4 @@
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"ir_compiler_inheritance_nosubobjects/input.sol"
object "C_7" {
code {
@ -32,13 +25,6 @@ object "C_7" {
}
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"ir_compiler_inheritance_nosubobjects/input.sol"
object "D_10" {
code {

View File

@ -1,11 +1,4 @@
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"ir_compiler_subobjects/input.sol"
object "C_3" {
code {
@ -32,13 +25,6 @@ object "C_3" {
}
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"ir_compiler_subobjects/input.sol"
object "D_16" {
code {

View File

@ -1,11 +1,4 @@
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"ir_with_assembly_no_memoryguard_creation/input.sol"
object "D_12" {
code {

View File

@ -1,11 +1,4 @@
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"ir_with_assembly_no_memoryguard_runtime/input.sol"
object "D_8" {
code {

View File

@ -1,11 +1,4 @@
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"keccak_optimization_deploy_code/input.sol"
object "C_12" {
code {

View File

@ -1,11 +1,4 @@
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"keccak_optimization_low_runs/input.sol"
object "C_7" {
code {

View File

@ -1,11 +1,4 @@
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"name_simplifier/input.sol"
object "C_59" {
code {

View File

@ -1,11 +1,4 @@
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"optimizer_array_sload/input.sol"
object "Arraysum_34" {
code {

View File

@ -1,11 +1,4 @@
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"revert_strings/input.sol"
object "C_15" {

View File

@ -60,14 +60,7 @@ sub_0: assembly {
}
"
},
"ir": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
"ir": "
/// @use-src 0:\"C\"
object \"C_6\" {
code {
@ -181,14 +174,7 @@ object \"C_6\" {
}
",
"irOptimized": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
"irOptimized": "/// @use-src 0:\"C\"
object \"C_6\" {
code {
{

View File

@ -60,14 +60,7 @@ sub_0: assembly {
}
"
},
"ir": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
"ir": "
/// @use-src 0:\"C\"
object \"C_6\" {
code {
@ -180,14 +173,7 @@ object \"C_6\" {
}
",
"irOptimized": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
"irOptimized": "/// @use-src 0:\"C\"
object \"C_6\" {
code {
{

View File

@ -57,14 +57,7 @@ sub_0: assembly {
}
"
},
"ir": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
"ir": "
/// @use-src 0:\"C\"
object \"C_6\" {
code {
@ -171,14 +164,7 @@ object \"C_6\" {
}
",
"irOptimized": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
"irOptimized": "/// @use-src 0:\"C\"
object \"C_6\" {
code {
{

View File

@ -1,11 +1,4 @@
{"contracts":{"C":{"C":{"ir":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
{"contracts":{"C":{"C":{"ir":"
/// @use-src 0:\"C\"
object \"C_54\" {
code {
@ -609,14 +602,7 @@ object \"C_54\" {
}
","irOptimized":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
","irOptimized":"/// @use-src 0:\"C\"
object \"C_54\" {
code {
{
@ -776,14 +762,7 @@ object \"C_54\" {
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
"}},"D":{"D":{"ir":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
"}},"D":{"D":{"ir":"
/// @use-src 0:\"C\", 1:\"D\"
object \"D_72\" {
code {
@ -1455,14 +1434,7 @@ object \"D_72\" {
}
","irOptimized":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\", 1:\"D\"
","irOptimized":"/// @use-src 0:\"C\", 1:\"D\"
object \"D_72\" {
code {
{

View File

@ -1,11 +1,4 @@
{"contracts":{"A":{"C":{"irOptimized":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"A\"
{"contracts":{"A":{"C":{"irOptimized":"/// @use-src 0:\"A\"
object \"C_7\" {
code {
/// @src 0:79:121 \"contract C { function f() public pure {} }\"

View File

@ -1,11 +1,4 @@
{"contracts":{"A":{"C":{"ir":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
{"contracts":{"A":{"C":{"ir":"
/// @use-src 0:\"A\"
object \"C_7\" {
code {

View File

@ -1,11 +1,4 @@
{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"object":"<BYTECODE REMOVED>"},"deployedBytecode":{"object":"<BYTECODE REMOVED>"}},"ir":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"object":"<BYTECODE REMOVED>"},"deployedBytecode":{"object":"<BYTECODE REMOVED>"}},"ir":"
/// @use-src 0:\"A\"
object \"C_3\" {
code {
@ -67,14 +60,7 @@ object \"C_3\" {
}
"},"D":{"evm":{"bytecode":{"generatedSources":[],"object":"<BYTECODE REMOVED>"},"deployedBytecode":{"object":"<BYTECODE REMOVED>"}},"ir":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
"},"D":{"evm":{"bytecode":{"generatedSources":[],"object":"<BYTECODE REMOVED>"},"deployedBytecode":{"object":"<BYTECODE REMOVED>"}},"ir":"
/// @use-src 0:\"A\"
object \"D_16\" {
code {
@ -207,12 +193,6 @@ object \"D_16\" {
/// @src 0:93:146 \"contract D { function f() public { C c = new C(); } }\"
}
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"A\"
object \"C_3\" {

View File

@ -1,11 +1,4 @@
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"viair_abicoder_v1/input.sol"
object "test_11" {

View File

@ -1 +1 @@
--ir-optimized --experimental-via-ir --optimize --bin --bin-runtime
--ir-optimized --via-ir --optimize --bin --bin-runtime

View File

@ -5,13 +5,6 @@ Binary:
Binary of the runtime part:
<BYTECODE REMOVED>
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"viair_subobjects/input.sol"
object "C_3" {
code {
@ -44,13 +37,6 @@ Binary:
Binary of the runtime part:
<BYTECODE REMOVED>
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"viair_subobjects/input.sol"
object "D_16" {
code {

View File

@ -1,11 +1,4 @@
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"yul_optimizer_steps/input.sol"
object "C_7" {
code {

View File

@ -1,11 +1,4 @@
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"yul_optimizer_steps_nested_brackets/input.sol"
object "C_6" {
code {

View File

@ -1,11 +1,4 @@
{"contracts":{"A":{"C":{"ir":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
{"contracts":{"A":{"C":{"ir":"
/// @use-src 0:\"A\"
object \"C_11\" {
code {

View File

@ -1,11 +1,4 @@
{"contracts":{"A":{"C":{"ir":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
{"contracts":{"A":{"C":{"ir":"
/// @use-src 0:\"A\"
object \"C_11\" {
code {

View File

@ -1,11 +1,4 @@
{"contracts":{"A":{"C":{"ir":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
{"contracts":{"A":{"C":{"ir":"
/// @use-src 0:\"A\"
object \"C_11\" {
code {

View File

@ -1,11 +1,4 @@
{"contracts":{"A":{"C":{"ir":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
{"contracts":{"A":{"C":{"ir":"
/// @use-src 0:\"A\"
object \"C_11\" {
code {

View File

@ -1,11 +1,4 @@
{"contracts":{"A":{"C":{"ir":"/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
{"contracts":{"A":{"C":{"ir":"
/// @use-src 0:\"A\"
object \"C_11\" {
code {

View File

@ -373,13 +373,7 @@ BOOST_AUTO_TEST_CASE(metadata_viair)
CompilerStack::MetadataFormat::WithReleaseVersionTag
);
if (_viaIR)
{
BOOST_CHECK(parsedCBORMetadata.count("experimental") == 1);
BOOST_CHECK(parsedCBORMetadata.at("experimental") == "true");
}
else
BOOST_CHECK(parsedCBORMetadata.count("experimental") == 0);
BOOST_CHECK(parsedCBORMetadata.count("experimental") == 0);
};
check(sourceCode, true);

View File

@ -120,6 +120,7 @@ BOOST_AUTO_TEST_CASE(cli_mode_options)
"--output-dir=/tmp/out",
"--overwrite",
"--evm-version=spuriousDragon",
"--via-ir",
"--experimental-via-ir",
"--revert-strings=strip",
"--debug-info=location",
@ -175,7 +176,7 @@ BOOST_AUTO_TEST_CASE(cli_mode_options)
expectedOptions.output.dir = "/tmp/out";
expectedOptions.output.overwriteFiles = true;
expectedOptions.output.evmVersion = EVMVersion::spuriousDragon();
expectedOptions.output.experimentalViaIR = true;
expectedOptions.output.viaIR = true;
expectedOptions.output.revertStrings = RevertStrings::Strip;
expectedOptions.output.debugInfoSelection = DebugInfoSelection::fromString("location");
expectedOptions.formatting.json = JsonFormat{JsonFormat::Pretty, 7};
@ -223,6 +224,13 @@ BOOST_AUTO_TEST_CASE(cli_mode_options)
}
}
BOOST_AUTO_TEST_CASE(via_ir_options)
{
BOOST_TEST(!parseCommandLine({"solc", "contract.sol"}).output.viaIR);
for (string viaIrOption: {"--via-ir", "--experimental-via-ir"})
BOOST_TEST(parseCommandLine({"solc", viaIrOption, "contract.sol"}).output.viaIR);
}
BOOST_AUTO_TEST_CASE(assembly_mode_options)
{
static vector<tuple<vector<string>, AssemblyStack::Machine, AssemblyStack::Language>> const allowedCombinations = {
@ -415,7 +423,8 @@ BOOST_AUTO_TEST_CASE(invalid_options_input_modes_combinations)
map<string, vector<string>> invalidOptionInputModeCombinations = {
// TODO: This should eventually contain all options.
{"--error-recovery", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}},
{"--experimental-via-ir", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}}
{"--experimental-via-ir", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}},
{"--via-ir", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}}
};
for (auto const& [optionName, inputModes]: invalidOptionInputModeCombinations)