From 28f10f4783bd4365654191740069a7112be03d92 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 28 Apr 2017 13:09:48 +0200 Subject: Remove error label / invalid jump label. --- libsolidity/codegen/CompilerUtils.cpp | 19 ------------------- libsolidity/codegen/CompilerUtils.h | 4 ---- libsolidity/inlineasm/AsmCodeGen.cpp | 2 -- libsolidity/inlineasm/AsmScope.h | 1 - libsolidity/inlineasm/AsmScopeFiller.cpp | 4 ---- 5 files changed, 30 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index dc0b340c..4ae9a09a 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -299,25 +299,6 @@ void CompilerUtils::zeroInitialiseMemoryArray(ArrayType const& _type) m_context << Instruction::SWAP1 << Instruction::POP; } -void CompilerUtils::memoryCopyPrecompile() -{ - // Stack here: size target source - - m_context.appendInlineAssembly(R"( - { - let words := div(add(len, 31), 32) - let cost := add(15, mul(3, words)) - jumpi(invalidJumpLabel, iszero(call(cost, $identityContractAddress, 0, src, len, dst, len))) - } - )", - { "len", "dst", "src" }, - map { - { "$identityContractAddress", toString(identityContractAddress) } - } - ); - m_context << Instruction::POP << Instruction::POP << Instruction::POP; -} - void CompilerUtils::memoryCopy32() { // Stack here: size target source diff --git a/libsolidity/codegen/CompilerUtils.h b/libsolidity/codegen/CompilerUtils.h index b9ed6757..4140ce8b 100644 --- a/libsolidity/codegen/CompilerUtils.h +++ b/libsolidity/codegen/CompilerUtils.h @@ -109,10 +109,6 @@ public: /// Stack post: void zeroInitialiseMemoryArray(ArrayType const& _type); - /// Uses a CALL to the identity contract to perform a memory-to-memory copy. - /// Stack pre: - /// Stack post: - void memoryCopyPrecompile(); /// Copies full 32 byte words in memory (regions cannot overlap), i.e. may copy more than length. /// Stack pre: /// Stack post: diff --git a/libsolidity/inlineasm/AsmCodeGen.cpp b/libsolidity/inlineasm/AsmCodeGen.cpp index 9ef3e6e7..c19667b4 100644 --- a/libsolidity/inlineasm/AsmCodeGen.cpp +++ b/libsolidity/inlineasm/AsmCodeGen.cpp @@ -278,8 +278,6 @@ private: { if (_label.id == Scope::Label::unassignedLabelId) _label.id = m_state.newLabelId(); - else if (_label.id == Scope::Label::errorLabelId) - _label.id = size_t(m_state.assembly.errorTag().data()); } diff --git a/libsolidity/inlineasm/AsmScope.h b/libsolidity/inlineasm/AsmScope.h index 37e0f0b8..b70bee67 100644 --- a/libsolidity/inlineasm/AsmScope.h +++ b/libsolidity/inlineasm/AsmScope.h @@ -73,7 +73,6 @@ struct Scope struct Label { size_t id = unassignedLabelId; - static const size_t errorLabelId = -1; static const size_t unassignedLabelId = 0; }; diff --git a/libsolidity/inlineasm/AsmScopeFiller.cpp b/libsolidity/inlineasm/AsmScopeFiller.cpp index de6fbdaa..4a651388 100644 --- a/libsolidity/inlineasm/AsmScopeFiller.cpp +++ b/libsolidity/inlineasm/AsmScopeFiller.cpp @@ -39,10 +39,6 @@ using namespace dev::solidity::assembly; ScopeFiller::ScopeFiller(ScopeFiller::Scopes& _scopes, ErrorList& _errors): m_scopes(_scopes), m_errors(_errors) { - // Make the Solidity ErrorTag available to inline assembly - Scope::Label errorLabel; - errorLabel.id = Scope::Label::errorLabelId; - scope(nullptr).identifiers["invalidJumpLabel"] = errorLabel; m_currentScope = &scope(nullptr); } -- cgit v1.2.3 From d61f9c4d4ee99cf0d540e3a7b6c7f250bab5f7b6 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 1 May 2017 17:40:37 +0100 Subject: Disable labels in Julia --- libsolidity/inlineasm/AsmParser.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libsolidity') diff --git a/libsolidity/inlineasm/AsmParser.cpp b/libsolidity/inlineasm/AsmParser.cpp index d7f78958..8d54d47a 100644 --- a/libsolidity/inlineasm/AsmParser.cpp +++ b/libsolidity/inlineasm/AsmParser.cpp @@ -84,6 +84,7 @@ assembly::Statement Parser::parseStatement() } case Token::Return: // opcode case Token::Byte: // opcode + case Token::Address: // opcode default: break; } @@ -119,6 +120,8 @@ assembly::Statement Parser::parseStatement() else { // label + if (m_julia) + fatalParserError("Labels are not supported."); Label label = createWithLocation