@@ -285,7 +285,7 @@ std::string YulUtilFunctions::revertWithError(
285
285
errorArgumentTypes.push_back (arg->annotation ().type );
286
286
}
287
287
templ (" argumentVars" , joinHumanReadablePrefixed (errorArgumentVars));
288
- templ (" encode" , ABIFunctions (m_evmVersion, m_revertStrings, m_functionCollector).tupleEncoder (errorArgumentTypes, _parameterTypes));
288
+ templ (" encode" , ABIFunctions (m_evmVersion, m_eofVersion, m_revertStrings, m_functionCollector).tupleEncoder (errorArgumentTypes, _parameterTypes));
289
289
290
290
return templ.render ();
291
291
}
@@ -2592,7 +2592,7 @@ std::string YulUtilFunctions::copyArrayFromStorageToMemoryFunction(ArrayType con
2592
2592
if (_from.baseType ()->isValueType ())
2593
2593
{
2594
2594
solAssert (*_from.baseType () == *_to.baseType (), " " );
2595
- ABIFunctions abi (m_evmVersion, m_revertStrings, m_functionCollector);
2595
+ ABIFunctions abi (m_evmVersion, m_eofVersion, m_revertStrings, m_functionCollector);
2596
2596
return Whiskers (R"(
2597
2597
function <functionName>(slot) -> memPtr {
2598
2598
memPtr := <allocateUnbounded>()
@@ -2697,7 +2697,7 @@ std::string YulUtilFunctions::bytesOrStringConcatFunction(
2697
2697
templ (" finalizeAllocation" , finalizeAllocationFunction ());
2698
2698
templ (
2699
2699
" encodePacked" ,
2700
- ABIFunctions{m_evmVersion, m_revertStrings, m_functionCollector}.tupleEncoderPacked (
2700
+ ABIFunctions{m_evmVersion, m_eofVersion, m_revertStrings, m_functionCollector}.tupleEncoderPacked (
2701
2701
_argumentTypes,
2702
2702
targetTypes
2703
2703
)
@@ -3578,7 +3578,7 @@ std::string YulUtilFunctions::conversionFunction(Type const& _from, Type const&
3578
3578
)" )
3579
3579
(
3580
3580
" abiDecode" ,
3581
- ABIFunctions (m_evmVersion, m_revertStrings, m_functionCollector).abiDecodingFunctionStruct (
3581
+ ABIFunctions (m_evmVersion, m_eofVersion, m_revertStrings, m_functionCollector).abiDecodingFunctionStruct (
3582
3582
toStructType,
3583
3583
false
3584
3584
)
@@ -3907,6 +3907,7 @@ std::string YulUtilFunctions::arrayConversionFunction(ArrayType const& _from, Ar
3907
3907
_from.dataStoredIn (DataLocation::CallData) ?
3908
3908
ABIFunctions (
3909
3909
m_evmVersion,
3910
+ m_eofVersion,
3910
3911
m_revertStrings,
3911
3912
m_functionCollector
3912
3913
).abiDecodingFunctionArrayAvailableLength (_to, false ) :
@@ -4105,7 +4106,10 @@ std::string YulUtilFunctions::packedHashFunction(
4105
4106
templ (" variables" , suffixedVariableNameList (" var_" , 1 , 1 + sizeOnStack));
4106
4107
templ (" comma" , sizeOnStack > 0 ? " ," : " " );
4107
4108
templ (" allocateUnbounded" , allocateUnboundedFunction ());
4108
- templ (" packedEncode" , ABIFunctions (m_evmVersion, m_revertStrings, m_functionCollector).tupleEncoderPacked (_givenTypes, _targetTypes));
4109
+ templ (
4110
+ " packedEncode" ,
4111
+ ABIFunctions (m_evmVersion, m_eofVersion, m_revertStrings, m_functionCollector).tupleEncoderPacked (_givenTypes, _targetTypes)
4112
+ );
4109
4113
return templ.render ();
4110
4114
});
4111
4115
}
@@ -4726,15 +4730,21 @@ std::string YulUtilFunctions::copyConstructorArgumentsToMemoryFunction(
4726
4730
4727
4731
return m_functionCollector.createFunction (functionName, [&]() {
4728
4732
std::string returnParams = suffixedVariableNameList (" ret_param_" ,0 , CompilerUtils::sizeOnStack (_contract.constructor ()->parameters ()));
4729
- ABIFunctions abiFunctions (m_evmVersion, m_revertStrings, m_functionCollector);
4733
+ ABIFunctions abiFunctions (m_evmVersion, m_eofVersion, m_revertStrings, m_functionCollector);
4730
4734
4731
4735
return util::Whiskers (R"(
4732
4736
function <functionName>() -> <retParams> {
4733
- let programSize := datasize("<object>")
4734
- let argSize := sub(codesize(), programSize)
4735
-
4736
- let memoryDataOffset := <allocate>(argSize)
4737
- codecopy(memoryDataOffset, programSize, argSize)
4737
+ <?eof>
4738
+ let argSize := calldatasize()
4739
+ let memoryDataOffset := <allocate>(argSize)
4740
+ calldatacopy(memoryDataOffset, 0, argSize)
4741
+ <!eof>
4742
+ let programSize := datasize("<object>")
4743
+ let argSize := sub(codesize(), programSize)
4744
+
4745
+ let memoryDataOffset := <allocate>(argSize)
4746
+ codecopy(memoryDataOffset, programSize, argSize)
4747
+ </eof>
4738
4748
4739
4749
<retParams> := <abiDecode>(memoryDataOffset, add(memoryDataOffset, argSize))
4740
4750
}
@@ -4744,6 +4754,7 @@ std::string YulUtilFunctions::copyConstructorArgumentsToMemoryFunction(
4744
4754
(" object" , _creationObjectName)
4745
4755
(" allocate" , allocationFunction ())
4746
4756
(" abiDecode" , abiFunctions.tupleDecoder (FunctionType (*_contract.constructor ()).parameterTypes (), true ))
4757
+ (" eof" , m_eofVersion.has_value ())
4747
4758
.render ();
4748
4759
});
4749
4760
}
0 commit comments