提交 5386754e 编写于 作者: S Sergey Andreenko 提交者: Jan Kotas

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
上级 47ee9353
......@@ -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"
// 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 <stdio.h>
namespace jitstd
{
template<typename Type>
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<int>
{
public:
size_t operator()(const int& val) const
{
return val;
}
};
template<>
class hash<unsigned __int64>
{
private:
typedef unsigned __int64 Type;
public:
size_t operator()(const Type& val) const
{
return (hash<int>()((int)(val & 0xffffffffUL)) ^ hash<int>()((int)(val >> 32)));
}
};
template<>
class hash<__int64>
{
private:
typedef __int64 Type;
public:
size_t operator()(const Type& val) const
{
return (hash<unsigned __int64>()((unsigned __int64) val));
}
};
template<typename Type>
class hash<Type*>
{
private:
typedef typename conditional<sizeof (Type*) <= sizeof (int), int, __int64>::type TInteger;
public:
size_t operator()(const Type* val) const
{
return (hash<TInteger>()((TInteger) val));
}
};
template<>
class hash<float>
{
private:
typedef float Type;
public:
size_t operator()(const Type& val) const
{
unsigned long bits = *(unsigned long*) &val;
return (hash<unsigned long>()(bits == 0x80000000 ? 0 : bits));
}
};
template<>
class hash<double>
{
public:
typedef double Type;
size_t operator()(const Type& val) const
{
unsigned __int64 bits = *(unsigned __int64*)&val;
return (hash<unsigned __int64>()((bits & (((unsigned __int64) -1) >> 1)) == 0 ? 0 : bits));
}
};
}
此差异已折叠。
// 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 <iostream>
#include <windows.h>
#include <string>
#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;
}

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
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A4576E91-78F0-4FD1-8323-8FA3BACE0581}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>jitstd</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="algorithm.h" />
<ClInclude Include="allocator.h" />
<ClInclude Include="functional.h" />
<ClInclude Include="hash.h" />
<ClInclude Include="hashtable.h" />
<ClInclude Include="iterator.h" />
<ClInclude Include="list.h" />
<ClInclude Include="pair.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="type_traits.h" />
<ClInclude Include="unordered_map.h" />
<ClInclude Include="unordered_set.h" />
<ClInclude Include="vector.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="jitstd.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
......@@ -23,6 +23,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include "iterator.h"
#include "functional.h"
#include "utility.h"
namespace jitstd
{
......
// 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
// 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 <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here
// 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 <sdkddkver.h>
// 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<K,V,H,P,A> 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 <typename Key, typename Value>
struct pair_key
{
Key& operator()(const jitstd::pair<Key, Value>& pair) const
{
return pair.first;
}
};
template<typename Key,
typename Value,
typename Hash = jitstd::hash<Key>,
typename Pred = jitstd::equal_to<Key>,
typename Alloc = jitstd::allocator<jitstd::pair<const Key, Value> > >
class unordered_map
: public hashtable<Key, pair<const Key, Value>, Hash, Pred, Alloc, pair_key<const Key, Value>>
{
public:
typedef Key key_type;
typedef Value mapped_type;
typedef jitstd::pair<const Key, 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;
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<typename InputIterator>
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<Key, Value, Hash, Pred, Alloc>::iterator insert(const key_type& key, const mapped_type& value);
private:
typedef hashtable<Key, pair<const Key, Value>, Hash, Pred, Alloc, pair_key<const Key, Value>> base_type;
};
}
namespace jitstd
{
template<typename Key, typename Value, typename Hash, typename Pred, typename Alloc>
unordered_map<Key, Value, Hash, Pred, Alloc>::unordered_map(size_type size, const hasher& hasher, const key_equal& pred, const allocator_type& allocator)
: base_type(size, hasher, pred, allocator)
{
}
template<typename Key, typename Value, typename Hash, typename Pred, typename Alloc>
unordered_map<Key, Value, Hash, Pred, Alloc>::unordered_map(size_type size, const allocator_type& allocator)
: base_type(size, allocator)
{
}
template<typename Key, typename Value, typename Hash, typename Pred, typename Alloc>
template<typename InputIterator>
unordered_map<Key, Value, Hash, Pred, Alloc>::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<typename Key, typename Value, typename Hash, typename Pred, typename Alloc>
unordered_map<Key, Value, Hash, Pred, Alloc>::unordered_map(const unordered_map& map)
: base_type(map)
{
}
template<typename Key, typename Value, typename Hash, typename Pred, typename Alloc>
unordered_map<Key, Value, Hash, Pred, Alloc>::unordered_map(const allocator_type& allocator)
: base_type(allocator)
{
}
template<typename Key, typename Value, typename Hash, typename Pred, typename Alloc>
unordered_map<Key, Value, Hash, Pred, Alloc>::unordered_map(const unordered_map& map, const allocator_type& allocator)
: base_type(map, allocator)
{
}
template<typename Key, typename Value, typename Hash, typename Pred, typename Alloc>
unordered_map<Key, Value, Hash, Pred, Alloc>::~unordered_map()
{
}
template<typename Key, typename Value, typename Hash, typename Pred, typename Alloc>
unordered_map<Key, Value, Hash, Pred, Alloc>& unordered_map<Key, Value, Hash, Pred, Alloc>::operator=(const unordered_map& map)
{
base_type::operator=(map);
return *this;
}
template<typename Key, typename Value, typename Hash, typename Pred, typename Alloc>
Value& unordered_map<Key, Value, Hash, Pred, Alloc>::operator[](const Key& key)
{
typename unordered_map<Key, Value, Hash, Pred, Alloc>::iterator iter = base_type::find(key, this->key_eq());
if (iter == this->end())
{
iter = base_type::insert(jitstd::pair<const Key, mapped_type>(key, mapped_type())).first;
}
return (*iter).second;
}
template<typename Key, typename Value, typename Hash, typename Pred, typename Alloc>
Value& unordered_map<Key, Value, Hash, Pred, Alloc>::operator[](key_type&& key)
{
typename unordered_map<Key, Value, Hash, Pred, Alloc>::iterator iter = base_type::find(key, this->key_eq());
if (iter == this->end())
{
iter = base_type::insert(jitstd::pair<const Key, mapped_type>(key, mapped_type())).first;
}
return (*iter).second;
}
template<typename Key, typename Value, typename Hash, typename Pred, typename Alloc>
typename unordered_map<Key, Value, Hash, Pred, Alloc>::iterator
unordered_map<Key, Value, Hash, Pred, Alloc>::insert(const key_type& key, const mapped_type& value)
{
typename unordered_map<Key, Value, Hash, Pred, Alloc>::iterator iter = base_type::find(key, this->key_eq());
iter = base_type::insert(jitstd::pair<const Key, mapped_type>(key, value)).first;
return iter;
}
}
// 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<V,H,P,A> 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 Value,
typename Hash = jitstd::hash<Value>,
typename Pred = jitstd::equal_to<Value>,
typename Alloc = jitstd::allocator<Value>>
class unordered_set
: public hashtable<Value, Value, Hash, Pred, Alloc>
{
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<Value, Alloc>::iterator iterator;
typedef typename list<Value, Alloc>::const_iterator const_iterator;
typedef typename list<Value, Alloc>::iterator local_iterator;
private:
typedef hashtable<Value, Value, Hash, Pred, Alloc> base_type;
unordered_set();
typedef pair<iterator, iterator> BucketEntry;
typedef vector<BucketEntry, typename Alloc::template rebind<BucketEntry>::allocator> Buckets;
typedef list<Value, Alloc> 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<typename InputIterator>
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 <typename Value, typename Hash, typename Pred, typename Alloc>
unordered_set<Value, Hash, Pred, Alloc>::unordered_set(
size_type n,
allocator_type const& allocator)
: hashtable<Value>(n, allocator)
{
this->rehash(n);
}
template <typename Value, typename Hash, typename Pred, typename Alloc>
unordered_set<Value, Hash, Pred, Alloc>::unordered_set(
size_type n,
hasher const& hf,
key_equal const& eq,
allocator_type const& allocator)
: hashtable<Value>(n, hf, eq, allocator)
{
this->rehash(n);
}
template <typename Value, typename Hash, typename Pred, typename Alloc>
template<typename InputIterator>
unordered_set<Value, Hash, Pred, Alloc>::unordered_set(
InputIterator f, InputIterator l,
size_type n,
const hasher& hf,
const key_equal& eq,
const allocator_type& allocator)
: hashtable<Value>(f, l, n, hf, eq, allocator)
{
this->rehash(n);
insert(this->first, this->last);
}
template <typename Value, typename Hash, typename Pred, typename Alloc>
unordered_set<Value, Hash, Pred, Alloc>::unordered_set(const allocator_type& allocator)
: hashtable<Value>(allocator)
{
}
template <typename Value, typename Hash, typename Pred, typename Alloc>
unordered_set<Value, Hash, Pred, Alloc>::unordered_set(const unordered_set& other)
: hashtable<Value>(other)
{
}
template <typename Value, typename Hash, typename Pred, typename Alloc>
unordered_set<Value, Hash, Pred, Alloc>::~unordered_set()
{
}
template <typename Value, typename Hash, typename Pred, typename Alloc>
unordered_set<Value, Hash, Pred, Alloc>&
unordered_set<Value, Hash, Pred, Alloc>::operator=(unordered_set const& other)
{
base_type::operator=(other);
return *this;
}
} // end of namespace jitstd.
......@@ -6,6 +6,9 @@
#pragma once
#include "pair.h"
#include "type_traits.h"
namespace jitstd
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册