mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #5377 from ethereum/resetYulString
Reset yul string repository.
This commit is contained in:
		
						commit
						dffbeebf60
					
				| @ -47,6 +47,8 @@ | ||||
| 
 | ||||
| #include <libevmasm/Exceptions.h> | ||||
| 
 | ||||
| #include <libyul/YulString.h> | ||||
| 
 | ||||
| #include <libdevcore/SwarmHash.h> | ||||
| #include <libdevcore/JSON.h> | ||||
| 
 | ||||
| @ -104,6 +106,7 @@ void CompilerStack::reset(bool _keepSources) | ||||
| 		m_stackState = Empty; | ||||
| 		m_sources.clear(); | ||||
| 	} | ||||
| 	yul::YulStringRepository::instance().reset(); | ||||
| 	m_libraries.clear(); | ||||
| 	m_evmVersion = EVMVersion(); | ||||
| 	m_optimize = false; | ||||
|  | ||||
| @ -35,9 +35,9 @@ namespace yul | ||||
| class YulStringRepository: boost::noncopyable | ||||
| { | ||||
| public: | ||||
| 	YulStringRepository(): m_strings{std::make_shared<std::string>()} | ||||
| 	YulStringRepository() | ||||
| 	{ | ||||
| 		m_ids[std::string{}] = 0; | ||||
| 		reset(); | ||||
| 	} | ||||
| 	static YulStringRepository& instance() | ||||
| 	{ | ||||
| @ -61,6 +61,14 @@ public: | ||||
| 		return *m_strings.at(_id); | ||||
| 	} | ||||
| 
 | ||||
| 	void reset() | ||||
| 	{ | ||||
| 		m_strings.clear(); | ||||
| 		m_ids.clear(); | ||||
| 		m_strings.emplace_back(std::make_shared<std::string>()); | ||||
| 		m_ids[std::string{}] = 0; | ||||
| 	} | ||||
| 
 | ||||
| private: | ||||
| 	std::vector<std::shared_ptr<std::string>> m_strings; | ||||
| 	std::map<std::string, size_t> m_ids; | ||||
|  | ||||
| @ -90,6 +90,8 @@ YulOptimizerTest::YulOptimizerTest(string const& _filename) | ||||
| 
 | ||||
| bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted) | ||||
| { | ||||
| 	yul::YulStringRepository::instance().reset(); | ||||
| 
 | ||||
| 	assembly::AsmPrinter printer{m_yul}; | ||||
| 	shared_ptr<Block> ast; | ||||
| 	shared_ptr<assembly::AsmAnalysisInfo> analysisInfo; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user