From 5386754e025fc36728763a5276b3a890be3b8bda Mon Sep 17 00:00:00 2001 From: Sergey Andreenko Date: Sat, 2 Nov 2019 00:44:52 +0000 Subject: [PATCH] Clean up jitstd folder. (dotnet/coreclr#27542) * Delete solution files. They were referencing unexisting files. * Delete unused files with templates from jitstd. Many of them have build errors when you instantiate them. * fix ubuntu build breaks. The header files did not include the necessary dependencies. In the past it was ok because the compilation unit included jitstd.h that had #include "utility.h", #include "pair.h", and #include "type_traits.h" before #include "list.h". Commit migrated from https://github.com/dotnet/coreclr/commit/14b650f35ebeed83e666039a1d3cb2eb7801c666 --- src/coreclr/src/jit/jitstd.h | 7 +- src/coreclr/src/jit/jitstd/hash.h | 103 ---- src/coreclr/src/jit/jitstd/hashtable.h | 803 ----------------------------- src/coreclr/src/jit/jitstd/jitstd.cpp | 34 -- src/coreclr/src/jit/jitstd/jitstd.sln | 20 - src/coreclr/src/jit/jitstd/jitstd.vcxproj | 103 ---- src/coreclr/src/jit/jitstd/list.h | 1 + src/coreclr/src/jit/jitstd/stdafx.cpp | 14 - src/coreclr/src/jit/jitstd/stdafx.h | 20 - src/coreclr/src/jit/jitstd/targetver.h | 14 - src/coreclr/src/jit/jitstd/unordered_map.h | 179 ------- src/coreclr/src/jit/jitstd/unordered_set.h | 156 ------ src/coreclr/src/jit/jitstd/utility.h | 3 + 13 files changed, 8 insertions(+), 1449 deletions(-) delete mode 100644 src/coreclr/src/jit/jitstd/hash.h delete mode 100644 src/coreclr/src/jit/jitstd/hashtable.h delete mode 100644 src/coreclr/src/jit/jitstd/jitstd.cpp delete mode 100644 src/coreclr/src/jit/jitstd/jitstd.sln delete mode 100644 src/coreclr/src/jit/jitstd/jitstd.vcxproj delete mode 100644 src/coreclr/src/jit/jitstd/stdafx.cpp delete mode 100644 src/coreclr/src/jit/jitstd/stdafx.h delete mode 100644 src/coreclr/src/jit/jitstd/targetver.h delete mode 100644 src/coreclr/src/jit/jitstd/unordered_map.h delete mode 100644 src/coreclr/src/jit/jitstd/unordered_set.h diff --git a/src/coreclr/src/jit/jitstd.h b/src/coreclr/src/jit/jitstd.h index 6b42867..5d89694 100644 --- a/src/coreclr/src/jit/jitstd.h +++ b/src/coreclr/src/jit/jitstd.h @@ -3,8 +3,9 @@ // See the LICENSE file in the project root for more information. #include "allocator.h" -#include "type_traits.h" +#include "functional.h" +#include "list.h" #include "pair.h" +#include "type_traits.h" #include "utility.h" -#include "unordered_map.h" -#include "unordered_set.h" +#include "vector.h" diff --git a/src/coreclr/src/jit/jitstd/hash.h b/src/coreclr/src/jit/jitstd/hash.h deleted file mode 100644 index 18db74f..0000000 --- a/src/coreclr/src/jit/jitstd/hash.h +++ /dev/null @@ -1,103 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - - - -#pragma once - -#include "type_traits.h" -#include - -namespace jitstd -{ -template -class hash -{ -public: - size_t operator()(const Type& val) const - { - div_t qrem = ::div((int)(size_t) val, 127773); - qrem.rem = 16807 * qrem.rem - 2836 * qrem.quot; - if (qrem.rem < 0) - { - qrem.rem += 2147483647; - } - return ((size_t) qrem.rem); - } -}; - -template<> -class hash -{ -public: - size_t operator()(const int& val) const - { - return val; - } -}; - -template<> -class hash -{ -private: - typedef unsigned __int64 Type; - -public: - size_t operator()(const Type& val) const - { - return (hash()((int)(val & 0xffffffffUL)) ^ hash()((int)(val >> 32))); - } -}; - -template<> -class hash<__int64> -{ -private: - typedef __int64 Type; - -public: - size_t operator()(const Type& val) const - { - return (hash()((unsigned __int64) val)); - } -}; - -template -class hash -{ -private: - typedef typename conditional::type TInteger; -public: - size_t operator()(const Type* val) const - { - return (hash()((TInteger) val)); - } -}; - -template<> -class hash -{ -private: - typedef float Type; -public: - size_t operator()(const Type& val) const - { - unsigned long bits = *(unsigned long*) &val; - return (hash()(bits == 0x80000000 ? 0 : bits)); - } -}; - -template<> -class hash -{ -public: - typedef double Type; - size_t operator()(const Type& val) const - { - unsigned __int64 bits = *(unsigned __int64*)&val; - return (hash()((bits & (((unsigned __int64) -1) >> 1)) == 0 ? 0 : bits)); - } -}; - -} diff --git a/src/coreclr/src/jit/jitstd/hashtable.h b/src/coreclr/src/jit/jitstd/hashtable.h deleted file mode 100644 index 3a6232a..0000000 --- a/src/coreclr/src/jit/jitstd/hashtable.h +++ /dev/null @@ -1,803 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// ==++== -// - -// - -// -// ==--== - -/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XX XX -XX hashtable XX -XX XX -XX Implemented using a vector of list iterators begin and end whose range XX -XX is a single bucket. A chain of buckets is maintained in a linked list XX -XX (doubly) for holding the key-value pairs. XX -XX XX -XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -*/ - -#pragma once - -#include "hash.h" -#include "functional.h" -#include "allocator.h" -#include "vector.h" -#include "list.h" -#include "pair.h" - -namespace jitstd -{ - -static const float kflDefaultLoadFactor = 3.0f; - -template , - typename Pred = jitstd::equal_to, - typename Alloc = jitstd::allocator, - typename KeyOf = jitstd::identity> -class hashtable -{ -public: - typedef Key key_type; - typedef Value value_type; - typedef Hash hasher; - typedef Pred key_equal; - typedef Alloc allocator_type; - typedef typename allocator_type::pointer pointer; - typedef typename allocator_type::const_pointer const_pointer; - typedef typename allocator_type::reference reference; - typedef typename allocator_type::const_reference const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef typename list::iterator iterator; - typedef typename list::reverse_iterator reverse_iterator; - typedef typename list::const_iterator const_iterator; - typedef typename list::iterator local_iterator; - -protected: - hashtable(); - - typedef pair BucketEntry; - typedef vector::allocator> Buckets; - typedef list::allocator> Elements; - -protected: - explicit hashtable(size_type, - const allocator_type& a, - const KeyOf& keyOf = KeyOf()); - - hashtable(size_type n, - const hasher& hf, - const key_equal& eq, - const allocator_type& a, - const KeyOf& keyOf = KeyOf()); - - template - hashtable( - InputIterator f, InputIterator l, - size_type n, - const hasher& hf, - const key_equal& eq, - const allocator_type& a, - const KeyOf& keyOf = KeyOf()); - - explicit hashtable(const allocator_type& a, const KeyOf& keyOf = KeyOf()); - - hashtable(const hashtable& other); - - ~hashtable(); - -public: - hashtable& operator=(const hashtable& other); - - allocator_type get_allocator() const; - - bool empty() const; - - size_type size() const; - size_type max_size() const; - - iterator begin(); - iterator end(); - - // Even though we have an unordered set and there is no concept of forward and - // reverse, rbegin will just return the first element inserted. This is not in STL. - reverse_iterator rbegin(); - reverse_iterator rend(); - - const_iterator begin() const; - const_iterator end() const; - const_iterator cbegin() const; - const_iterator cend() const; - local_iterator begin(size_type size); - local_iterator end(size_type size); - - pair insert(const value_type& value); - iterator insert(const_iterator, const value_type& value); - template - void insert(InputIterator first, InputIterator last); - - iterator erase(iterator position); - size_type erase(const key_type& key); - iterator erase(iterator first, iterator last); - - void clear(); - void swap(hashtable& table); - - hasher hash_function() const; - key_equal key_eq() const; - - const_iterator find(const key_type& key) const; - iterator find(const key_type& key); - - size_type count(const key_type& key) const; - - size_type bucket_count() const; - size_type max_bucket_count() const; - - size_type bucket_size(size_type size) const; - size_type bucket(const key_type& key) const; - - float load_factor() const; - float max_load_factor() const; - void max_load_factor(float); - - void rehash(size_type); - -protected: - template - iterator find(const key_type&, const Compare& comp); - - // helpers - bool check_load(); - void copy_helper(const hashtable& other); - size_type hash_helper(const key_type& value, size_type buckets) const; - pair insert_helper(const value_type& value, Buckets& buckets, Elements& elements, bool fRehashing); - iterator erase_helper(const_iterator position); - void debug_check(); - -private: - - // member objects - Hash m_hasher; - Alloc m_allocator; - Pred m_pred; - - Buckets m_buckets; - Elements m_elements; - size_type m_nSize; - KeyOf m_keyOf; - - // metadata - float m_flMaxLoadFactor; -}; - -} // end of namespace jitstd - - -namespace jitstd -{ - -// We can't leave this permanently enabled -- it makes algorithms cubic, and causes tests to time out. -// Enable when/if you have reason to believe there's a problem in hashtable. -#define JITSTD_DO_HASHTABLE_DEBUGCHECK 0 - -template -void hashtable::debug_check() -{ -#if JITSTD_DO_HASHTABLE_DEBUGCHECK - for (iterator iter = m_elements.begin(); iter != m_elements.end(); ++iter) - { - size_type nHash = hash_helper(m_keyOf(*iter), m_buckets.size()); - BucketEntry& entry = m_buckets[nHash]; - iterator iter2 = entry.first; - bool present = false; - while (iter2 != entry.second) - { - if (iter2 == iter) - { - present = true; - } - iter2++; - } - if (!present) - { - present = false; - } - assert(present); - } -#endif -} - -template -template -typename hashtable::iterator -hashtable::find(const key_type& key, const Compare& comp) -{ - if (empty()) - { - return end(); - } - size_type nHash = hash_helper(key, m_buckets.size()); - BucketEntry& entry = m_buckets[nHash]; - for (iterator i = entry.first; i != entry.second; ++i) - { - if (comp(m_keyOf(*i), key)) - { - return i; - } - } - return end(); -} - -template -bool hashtable::check_load() -{ - float flLoadFactor = load_factor(); - if (flLoadFactor > m_flMaxLoadFactor) - { - rehash(m_buckets.size()); - return true; - } - return false; -} - -template -typename hashtable::iterator -hashtable::erase_helper(const_iterator position) -{ - const Key& key = m_keyOf(*position); - size_type nHash = hash_helper(key, m_buckets.size()); - BucketEntry& entry = m_buckets[nHash]; - iterator eraseNext = end(); - for (iterator first = entry.first; first != entry.second; ++first) - { - if (m_pred(m_keyOf(*first), key)) - { - if (first == entry.first) - { - if (first != m_elements.begin()) - { - iterator update = first; - update--; - size_type nUpdateHash = hash_helper(m_keyOf(*update), m_buckets.size()); - if (nUpdateHash != nHash) - { - BucketEntry& updateEntry = m_buckets[nUpdateHash]; - if (updateEntry.second == first) - { - updateEntry.second = first; - updateEntry.second++; - } - if (updateEntry.first == first) - { - updateEntry.first = first; - updateEntry.first++; - } - } - } - entry.first = m_elements.erase(first); - eraseNext = entry.first; - } - else - { - eraseNext = m_elements.erase(first); - } - - --m_nSize; -#ifdef DEBUG - debug_check(); -#endif - return eraseNext; - } - } - return end(); -} - -template -pair::iterator, bool> -hashtable::insert_helper( - const Value& value, Buckets& buckets, Elements& elements, bool fRehashing) -{ - const Key& key = m_keyOf(value); - size_t nHash = hash_helper(key, buckets.size()); - BucketEntry& entry = buckets[nHash]; - - iterator ret; - if (entry.first == entry.second) - { - entry.first = elements.insert(elements.begin(), value); - entry.second = entry.first; - entry.second++; // end iterator is one past always. - ret = entry.first; - } - else - { - for (iterator first = entry.first; first != entry.second; ++first) - { - if (m_pred(m_keyOf(*first), key)) - { - return pair(first, false); - } - } - iterator firstNext = entry.first; - firstNext++; - ret = elements.insert(firstNext, value); - if (entry.second == entry.first) - { - entry.second = firstNext; - } - } - bool fRehashed = false; - if (!fRehashing) - { - m_nSize += 1; - fRehashed = check_load(); - } - -#ifdef DEBUG - debug_check(); -#endif - - return pair(fRehashed ? find(key, m_pred) : ret, true); -} - -template -typename hashtable::size_type - hashtable::hash_helper( - const key_type& key, size_type buckets) const -{ - return m_hasher(key) % buckets; -} - -template -void hashtable::rehash(size_type n) -{ - size_type nCurBuckets = m_buckets.size(); - float flLoadFactor = load_factor(); - if (nCurBuckets >= n && flLoadFactor <= m_flMaxLoadFactor) - { - return; - } - - size_type nBuckets = max(nCurBuckets, 1); - if (flLoadFactor > m_flMaxLoadFactor) - { - nBuckets *= 2; - } - - if (nBuckets < n) - { - nBuckets = n; - } - - Buckets buckets(m_allocator); - Elements elements(m_allocator); - - buckets.resize(nBuckets, BucketEntry(m_elements.end(), m_elements.end())); // both equal means empty. - for (typename Elements::iterator iter = m_elements.begin(); iter != m_elements.end(); ++iter) - { - (void) insert_helper(*iter, buckets, elements, true); - } - m_buckets.swap(buckets); - m_elements.swap(elements); -} - -template -hashtable::hashtable( - size_type n, - allocator_type const& allocator, - const KeyOf& keyOf) - : m_allocator(allocator) - , m_buckets(Alloc::template rebind::allocator(allocator)) - , m_elements(allocator) - , m_flMaxLoadFactor(kflDefaultLoadFactor) - , m_nSize(0) - , m_keyOf(keyOf) -{ - rehash(n); -} - -template -hashtable::hashtable( - size_type n, - hasher const& hf, - key_equal const& eq, - allocator_type const& allocator, - const KeyOf& keyOf) - : m_hasher(hf) - , m_pred(eq) - , m_allocator(allocator) - , m_buckets(Alloc::template rebind::allocator(allocator)) - , m_elements(allocator) - , m_flMaxLoadFactor(kflDefaultLoadFactor) - , m_nSize(0) - , m_keyOf(keyOf) -{ - rehash(n); -} - -template -template -hashtable::hashtable( - InputIterator f, InputIterator l, - size_type n, - const hasher& hf, - const key_equal& eq, - const allocator_type& allocator, - const KeyOf& keyOf) - : m_hasher(hf) - , m_pred(eq) - , m_allocator(allocator) - , m_buckets(Alloc::template rebind::allocator(allocator)) - , m_elements(allocator) - , m_flMaxLoadFactor(kflDefaultLoadFactor) - , m_nSize(0) - , m_keyOf(keyOf) -{ - rehash(n); - insert(this->first, this->last); -} - -template -hashtable::hashtable(const allocator_type& allocator, const KeyOf& keyOf) - : m_allocator(allocator) - , m_buckets(Alloc::template rebind::allocator(allocator)) - , m_elements(allocator) - , m_flMaxLoadFactor(kflDefaultLoadFactor) - , m_nSize(0) - , m_keyOf(keyOf) -{ -} - -template -void hashtable::copy_helper(const hashtable& other) -{ - m_buckets.clear(); - m_elements.clear(); - m_nSize = 0; - - rehash(other.m_buckets.size()); - for (const_iterator i = other.m_elements.begin(); i != other.m_elements.end(); ++i) - { - insert_helper(*i, m_buckets, m_elements, false); - } - m_nSize = other.m_nSize; -} - -template -hashtable::hashtable(const hashtable& other) - : m_hasher(other.m_hasher) - , m_pred(other.m_pred) - , m_allocator(other.m_allocator) - , m_flMaxLoadFactor(other.m_flMaxLoadFactor) - , m_keyOf(other.m_keyOf) - , m_elements(other.m_allocator) - , m_buckets(other.m_allocator) -{ - copy_helper(other); -} - -template -hashtable::~hashtable() -{ -} - -template -hashtable& - hashtable::operator=(hashtable const& other) -{ - m_hasher = other.m_hasher; - m_pred = other.m_pred; - m_allocator = other.m_allocator; - m_flMaxLoadFactor = other.m_flMaxLoadFactor; - m_keyOf = other.m_keyOf; - copy_helper(other); - return *this; -} - -template -typename hashtable::allocator_type - hashtable::get_allocator() const -{ - return m_allocator; -} - -template -bool hashtable::empty() const -{ - return m_nSize == 0; -} - -template -typename hashtable::size_type - hashtable::size() const -{ - return m_nSize; -} - -template -typename hashtable::size_type - hashtable::max_size() const -{ - return ((size_type)(-1)) >> 1; -} - -template -typename hashtable::iterator -hashtable::begin() -{ - return m_elements.begin(); -} - -template -typename hashtable::reverse_iterator -hashtable::rbegin() -{ - return m_elements.rbegin(); -} - -template -typename hashtable::iterator -hashtable::end() -{ - return m_elements.end(); -} - -template -typename hashtable::reverse_iterator -hashtable::rend() -{ - return m_elements.rend(); -} - -template -typename hashtable::const_iterator -hashtable::begin() const -{ - return m_elements.begin(); -} - -template -typename hashtable::const_iterator -hashtable::end() const -{ - return m_elements.end(); -} - -template -typename hashtable::const_iterator -hashtable::cbegin() const -{ - return m_elements.begin(); -} - -template -typename hashtable::const_iterator -hashtable::cend() const -{ - return m_elements.end(); -} - -template -jitstd::pair::iterator, bool> - hashtable::insert(const Value& val) -{ - // Allocate some space first. - rehash(2); - return insert_helper(val, m_buckets, m_elements, false); -} - -template -typename hashtable::iterator - hashtable::insert(const_iterator position, const Value& value) -{ - // Allocate some space first. - rehash(2); - - // We will not use the hint here, we can consider doing this later. - return insert_helper(this->val, m_buckets, m_elements, false).first; -} - -template -template -void hashtable::insert(InputIterator first, InputIterator last) -{ - // Allocate some space first. - rehash(2); - while (first != last) - { - (void) insert_helper(*first, m_buckets, m_elements, false); - ++first; - } -} - -template -typename hashtable::iterator - hashtable::erase(iterator position) -{ - return erase_helper(position); -} - -template -typename hashtable::size_type - hashtable::erase(const key_type& key) -{ - iterator iter = erase_helper(find(key)); - return iter == end() ? 0 : 1; -} - -template -typename hashtable::iterator - hashtable::erase(iterator first, iterator last) -{ - iterator iter = end(); - while (first != last) - { - iter = erase_helper(find(m_keyOf(*first))); - ++first; - } - return iter; -} - -template -void hashtable::clear() -{ - m_buckets.clear(); - m_elements.clear(); -} - -template -void hashtable::swap(hashtable& set) -{ - std::swap(set.m_buckets, m_buckets); - std::swap(set.m_elements, m_elements); - std::swap(set.m_flLoadFactor, this->m_flLoadFactor); - std::swap(set.m_flMaxLoadFactor, this->m_flMaxLoadFactor); - std::swap(set.m_keyOf, this->m_keyOf); -} - - -template -typename hashtable::hasher - hashtable::hash_function() const -{ - return m_hasher; -} - -template -typename hashtable::key_equal - hashtable::key_eq() const -{ - return m_pred; -} - -template -typename hashtable::const_iterator - hashtable::find(const key_type& key) const -{ - if (empty()) - { - return end(); - } - size_type nHash = hash_helper(key, m_buckets.size()); - BucketEntry& entry = m_buckets[nHash]; - for (iterator i = entry.first; i != entry.second; ++i) - { - if (m_pred(m_keyOf(*i), key)) - { - return i; - } - } - return end(); -} - -template -typename hashtable::iterator - hashtable::find(const key_type& key) -{ - if (empty()) - { - return end(); - } - size_type nHash = hash_helper(key, m_buckets.size()); - BucketEntry& entry = m_buckets[nHash]; - for (iterator i = entry.first; i != entry.second; ++i) - { - if (m_pred(m_keyOf(*i), key)) - { - return i; - } - } - return end(); -} - - -template -typename hashtable::size_type - hashtable::count(const key_type& key) const -{ - size_type nCount = 0; - size_type nHash = hash_helper(key, m_buckets.size()); - BucketEntry& bucket = m_buckets[nHash]; - for (iterator i = bucket.first; i != bucket.second; ++i) - { - if (m_pred(m_keyOf(*i), key)) - { - ++nCount; - } - } - return nCount; -} - -template -typename hashtable::size_type -hashtable::bucket_count() const -{ - return m_buckets.size(); -} - -template -typename hashtable::size_type -hashtable::max_bucket_count() const -{ - return m_buckets.size(); -} - -template -typename hashtable::size_type -hashtable::bucket_size(size_type size) const -{ - rehash(size); - return bucket_count(); -} - -template -typename hashtable::size_type -hashtable::bucket(const key_type& key) const -{ - return hash_helper(key, m_buckets.size()); -} - -template -typename hashtable::local_iterator -hashtable::begin(size_type size) -{ - return m_buckets[size].first; -} - -template -typename hashtable::local_iterator -hashtable::end(size_type size) -{ - return m_buckets[size].second; -} - -template -float hashtable::load_factor() const -{ - return m_nSize ? (((float) m_nSize) / m_buckets.size()) : 0; -} - -template -float hashtable::max_load_factor() const -{ - return m_flMaxLoadFactor; -} - -template -void hashtable::max_load_factor(float flLoadFactor) -{ - m_flMaxLoadFactor = flLoadFactor; - rehash(m_buckets.size()); -} - -} // end of namespace jitstd. diff --git a/src/coreclr/src/jit/jitstd/jitstd.cpp b/src/coreclr/src/jit/jitstd/jitstd.cpp deleted file mode 100644 index 48d80e2..0000000 --- a/src/coreclr/src/jit/jitstd/jitstd.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// jitstd.cpp : Defines the entry point for the console application. -// - - -#include "stdafx.h" - -#include -#include -#include - -#include "iallocator.h" - -#include "algorithm.h" -#include "functional.h" -#include "hash.h" - -#include "unordered_map.h" -#include "unordered_set.h" -#include "hashtable.h" -#include "list.h" -#include "vector.h" -#include "pair.h" - -int _tmain(int argc, _TCHAR* argv[]) -{ - // return test1(); - return 0; -} - - diff --git a/src/coreclr/src/jit/jitstd/jitstd.sln b/src/coreclr/src/jit/jitstd/jitstd.sln deleted file mode 100644 index 6aa099c..0000000 --- a/src/coreclr/src/jit/jitstd/jitstd.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jitstd", "jitstd.vcxproj", "{A4576E91-78F0-4FD1-8323-8FA3BACE0581}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A4576E91-78F0-4FD1-8323-8FA3BACE0581}.Debug|Win32.ActiveCfg = Debug|Win32 - {A4576E91-78F0-4FD1-8323-8FA3BACE0581}.Debug|Win32.Build.0 = Debug|Win32 - {A4576E91-78F0-4FD1-8323-8FA3BACE0581}.Release|Win32.ActiveCfg = Release|Win32 - {A4576E91-78F0-4FD1-8323-8FA3BACE0581}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/coreclr/src/jit/jitstd/jitstd.vcxproj b/src/coreclr/src/jit/jitstd/jitstd.vcxproj deleted file mode 100644 index bed1b3a..0000000 --- a/src/coreclr/src/jit/jitstd/jitstd.vcxproj +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {A4576E91-78F0-4FD1-8323-8FA3BACE0581} - Win32Proj - jitstd - - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - true - - - false - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - - - - - - \ No newline at end of file diff --git a/src/coreclr/src/jit/jitstd/list.h b/src/coreclr/src/jit/jitstd/list.h index ed55888..265af70 100644 --- a/src/coreclr/src/jit/jitstd/list.h +++ b/src/coreclr/src/jit/jitstd/list.h @@ -23,6 +23,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX #include "iterator.h" #include "functional.h" +#include "utility.h" namespace jitstd { diff --git a/src/coreclr/src/jit/jitstd/stdafx.cpp b/src/coreclr/src/jit/jitstd/stdafx.cpp deleted file mode 100644 index 1012ef9..0000000 --- a/src/coreclr/src/jit/jitstd/stdafx.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// stdafx.cpp : source file that includes just the standard includes -// jitstd.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - - - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/src/coreclr/src/jit/jitstd/stdafx.h b/src/coreclr/src/jit/jitstd/stdafx.h deleted file mode 100644 index 6d2519d..0000000 --- a/src/coreclr/src/jit/jitstd/stdafx.h +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - - -#pragma once - -#include "targetver.h" - -#include -#include - - - -// TODO: reference additional headers your program requires here diff --git a/src/coreclr/src/jit/jitstd/targetver.h b/src/coreclr/src/jit/jitstd/targetver.h deleted file mode 100644 index 260ee4a..0000000 --- a/src/coreclr/src/jit/jitstd/targetver.h +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - - - -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/src/coreclr/src/jit/jitstd/unordered_map.h b/src/coreclr/src/jit/jitstd/unordered_map.h deleted file mode 100644 index ff1ad87..0000000 --- a/src/coreclr/src/jit/jitstd/unordered_map.h +++ /dev/null @@ -1,179 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// ==++== -// - -// - -// -// ==--== - -/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XX XX -XX unordered_map XX -XX Derives from hashtable for most implementation. Inserted elements are XX -XX value pairs and the hash key is provided by the helper method that XX -XX extracts the key from the key value pair XX -XX XX -XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -*/ - -#pragma once - -#include "hashtable.h" - -namespace jitstd -{ - -template -struct pair_key -{ - Key& operator()(const jitstd::pair& pair) const - { - return pair.first; - } -}; - -template, - typename Pred = jitstd::equal_to, - typename Alloc = jitstd::allocator > > -class unordered_map - : public hashtable, Hash, Pred, Alloc, pair_key> -{ -public: - - typedef Key key_type; - typedef Value mapped_type; - typedef jitstd::pair value_type; - typedef Hash hasher; - typedef Pred key_equal; - typedef Alloc allocator_type; - typedef typename allocator_type::pointer pointer; - typedef typename allocator_type::const_pointer const_pointer; - typedef typename allocator_type::reference reference; - typedef typename allocator_type::const_reference const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - - explicit unordered_map(size_type size, const hasher& hasher, const key_equal& pred, const allocator_type& allocator); - explicit unordered_map(size_type size, const allocator_type& allocator); - template - unordered_map(InputIterator, InputIterator, - size_type size, - const hasher& hasher, - const key_equal& pred, - const allocator_type& allocator); - - unordered_map(const unordered_map& map); - explicit unordered_map(const allocator_type& allocator); - unordered_map(const unordered_map& map, const allocator_type& allocator); - ~unordered_map(); - - unordered_map& operator=(unordered_map const&); - mapped_type& operator[](const Key& key); - mapped_type& operator[](key_type&& key); - - typename unordered_map::iterator insert(const key_type& key, const mapped_type& value); - -private: - typedef hashtable, Hash, Pred, Alloc, pair_key> base_type; -}; - -} - - -namespace jitstd -{ - -template -unordered_map::unordered_map(size_type size, const hasher& hasher, const key_equal& pred, const allocator_type& allocator) - : base_type(size, hasher, pred, allocator) -{ -} - -template -unordered_map::unordered_map(size_type size, const allocator_type& allocator) - : base_type(size, allocator) -{ -} - -template -template -unordered_map::unordered_map(InputIterator first, InputIterator last, - size_type size, - const hasher& hasher, - const key_equal& pred, - const allocator_type& allocator) - : base_type(first, last, size, hasher, pred, allocator) -{ -} - -template -unordered_map::unordered_map(const unordered_map& map) - : base_type(map) -{ -} - -template -unordered_map::unordered_map(const allocator_type& allocator) - : base_type(allocator) -{ -} - -template -unordered_map::unordered_map(const unordered_map& map, const allocator_type& allocator) - : base_type(map, allocator) -{ -} - -template -unordered_map::~unordered_map() -{ -} - -template -unordered_map& unordered_map::operator=(const unordered_map& map) -{ - base_type::operator=(map); - return *this; -} - -template -Value& unordered_map::operator[](const Key& key) -{ - typename unordered_map::iterator iter = base_type::find(key, this->key_eq()); - if (iter == this->end()) - { - iter = base_type::insert(jitstd::pair(key, mapped_type())).first; - } - return (*iter).second; -} - -template -Value& unordered_map::operator[](key_type&& key) -{ - typename unordered_map::iterator iter = base_type::find(key, this->key_eq()); - if (iter == this->end()) - { - iter = base_type::insert(jitstd::pair(key, mapped_type())).first; - } - return (*iter).second; -} - - -template -typename unordered_map::iterator -unordered_map::insert(const key_type& key, const mapped_type& value) -{ - typename unordered_map::iterator iter = base_type::find(key, this->key_eq()); - iter = base_type::insert(jitstd::pair(key, value)).first; - return iter; -} - -} diff --git a/src/coreclr/src/jit/jitstd/unordered_set.h b/src/coreclr/src/jit/jitstd/unordered_set.h deleted file mode 100644 index 388e724..0000000 --- a/src/coreclr/src/jit/jitstd/unordered_set.h +++ /dev/null @@ -1,156 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// ==++== -// - -// - -// -// ==--== - -/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XX XX -XX unordered_set XX -XX XX -XX Derives from hashtable for most implementation. The hash key is the XX -XX elements themselves XX -XX XX -XX XX -XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -*/ - -#pragma once - -#include "allocator.h" -#include "hashtable.h" - -namespace jitstd -{ - -template , - typename Pred = jitstd::equal_to, - typename Alloc = jitstd::allocator> -class unordered_set - : public hashtable -{ -public: - typedef Value key_type; - typedef Value value_type; - typedef Hash hasher; - typedef Pred key_equal; - typedef Alloc allocator_type; - typedef typename allocator_type::pointer pointer; - typedef typename allocator_type::const_pointer const_pointer; - typedef typename allocator_type::reference reference; - typedef typename allocator_type::const_reference const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef typename list::iterator iterator; - typedef typename list::const_iterator const_iterator; - typedef typename list::iterator local_iterator; - -private: - typedef hashtable base_type; - unordered_set(); - - typedef pair BucketEntry; - typedef vector::allocator> Buckets; - typedef list Elements; - -public: - explicit unordered_set(size_type, - const allocator_type& a); - - unordered_set(size_type n, - const hasher& hf, - const key_equal& eq, - const allocator_type&); - - template - unordered_set( - InputIterator f, InputIterator l, - size_type n, - const hasher& hf, - const key_equal& eq, - const allocator_type&); - - explicit unordered_set(const allocator_type&); - - unordered_set(const unordered_set& other); - - ~unordered_set(); - - unordered_set& operator=(unordered_set const&); -}; - -} // end of namespace jitstd - - -namespace jitstd -{ - -template -unordered_set::unordered_set( - size_type n, - allocator_type const& allocator) - : hashtable(n, allocator) -{ - this->rehash(n); -} - -template -unordered_set::unordered_set( - size_type n, - hasher const& hf, - key_equal const& eq, - allocator_type const& allocator) - : hashtable(n, hf, eq, allocator) -{ - this->rehash(n); -} - -template -template -unordered_set::unordered_set( - InputIterator f, InputIterator l, - size_type n, - const hasher& hf, - const key_equal& eq, - const allocator_type& allocator) - : hashtable(f, l, n, hf, eq, allocator) -{ - this->rehash(n); - insert(this->first, this->last); -} - -template -unordered_set::unordered_set(const allocator_type& allocator) -: hashtable(allocator) -{ -} - -template -unordered_set::unordered_set(const unordered_set& other) -: hashtable(other) -{ -} - -template -unordered_set::~unordered_set() -{ -} - -template -unordered_set& - unordered_set::operator=(unordered_set const& other) -{ - base_type::operator=(other); - return *this; -} - -} // end of namespace jitstd. diff --git a/src/coreclr/src/jit/jitstd/utility.h b/src/coreclr/src/jit/jitstd/utility.h index 1930be8..426059f 100644 --- a/src/coreclr/src/jit/jitstd/utility.h +++ b/src/coreclr/src/jit/jitstd/utility.h @@ -6,6 +6,9 @@ #pragma once +#include "pair.h" +#include "type_traits.h" + namespace jitstd { -- 2.7.4