Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .teamcity/Windows/Project.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object Project : Project({
})


class CarbonBuildWindows(buildName: String, configType: String, preset: String) : BuildType({
class CarbonBuildWindows(buildName: String, configType: String, preset: String, vsDevBatSwitches: String = "-arch=x64 -vcvars_ver=14.51") : BuildType({
id(buildName.toId())
this.name = buildName

Expand All @@ -46,8 +46,7 @@ class CarbonBuildWindows(buildName: String, configType: String, preset: String)
param("env.GIT_TAG_HASH_OVERRIDE", "")
param("github_checkout_folder", "github")
param("env.CTEST_JUNIT_OUTPUT_FILE", "ctest_results.xml")
select("env.VISUAL_STUDIO_PLATFORM_TOOLSET", "v141", label = "Visual Studio Platform Toolset", description = "Specify the toolset for the build. e.g. v141 or v143.",
options = listOf("v141 (2017)" to "v141", "v143 (2022)" to "v143"))
param("VS_DEV_BAT_SWITCHES", vsDevBatSwitches)
param("env.CMAKE_BUILD_TARGETS", "all")
param("project", "eve-frontier")
param("env.CMAKE_INSTALL_PREFIX", ".build-artifact")
Expand Down Expand Up @@ -90,7 +89,7 @@ class CarbonBuildWindows(buildName: String, configType: String, preset: String)
scriptContent = """
REM unfortunately ninja does not find the VS environment otherwise
REM NB: the exported PATH also contains the location where we installed sentry-cli, e.g. teamcity.agent.work.dir
call "%%ProgramFiles(x86)%%\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\vsdevcmd.bat" -arch=x64
call "%env.VSDEV_BAT_PATH%" %VS_DEV_BAT_SWITCHES%
echo ##teamcity[setParameter name='env.INCLUDE' value='%%INCLUDE%%']
echo ##teamcity[setParameter name='env.LIB' value='%%LIB%%']
echo ##teamcity[setParameter name='env.LIBPATH' value='%%LIBPATH%%']
Expand Down
2 changes: 1 addition & 1 deletion BlockAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class StlPoolAllocator :

template <class T2>
struct rebind {
typedef StlPoolAllocator<T2> other;
using other = StlPoolAllocator<T2>;
};

T* allocate(size_t _Count, const void *hint) {
Expand Down
20 changes: 10 additions & 10 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/vendor/github.com/carbonengine/vcpkg-registry/triplets"
},
"environment": {
"VCPKG_ROOT": "${sourceDir}/vendor/github.com/microsoft/vcpkg"
"PATH_TO_VCPKG_ROOT": "${sourceDir}/vendor/github.com/microsoft/vcpkg"
},
"hidden": true
},
Expand All @@ -33,7 +33,7 @@
"name": "x64-windows",
"inherits": "windows",
"cacheVariables": {
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/vendor/github.com/carbonengine/vcpkg-registry/toolchains/x64-windows-carbon.cmake"
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/vendor/github.com/carbonengine/vcpkg-registry/toolchains/x64-windows-145-carbon.cmake"
},
"hidden": true
},
Expand All @@ -42,35 +42,35 @@
"inherits": "x64-windows",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Internal",
"VCPKG_TARGET_TRIPLET": "x64-windows-internal",
"VCPKG_HOST_TRIPLET": "x64-windows-internal"
"VCPKG_TARGET_TRIPLET": "x64-windows-145-internal",
"VCPKG_HOST_TRIPLET": "x64-windows-145-internal"
}
},
{
"name": "x64-windows-release",
"inherits": "x64-windows",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"VCPKG_TARGET_TRIPLET": "x64-windows-release",
"VCPKG_HOST_TRIPLET": "x64-windows-release"
"VCPKG_TARGET_TRIPLET": "x64-windows-145-release",
"VCPKG_HOST_TRIPLET": "x64-windows-145-release"
}
},
{
"name": "x64-windows-debug",
"inherits": "x64-windows",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"VCPKG_TARGET_TRIPLET": "x64-windows-debug",
"VCPKG_HOST_TRIPLET": "x64-windows-debug"
"VCPKG_TARGET_TRIPLET": "x64-windows-145-debug",
"VCPKG_HOST_TRIPLET": "x64-windows-145-debug"
}
},
{
"name": "x64-windows-trinitydev",
"inherits": "x64-windows",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "TrinityDev",
"VCPKG_TARGET_TRIPLET": "x64-windows-trinitydev",
"VCPKG_HOST_TRIPLET": "x64-windows-trinitydev"
"VCPKG_TARGET_TRIPLET": "x64-windows-145-trinitydev",
"VCPKG_HOST_TRIPLET": "x64-windows-145-trinitydev"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion NSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ PyObject *NSession::Execute(PyObject *args)

if (noblock && !mAllowSync)
//this is a tasklet that cannot block, so execution might as well be done on this thread
return PyErr_SetString(PyExc_RuntimeError, "This tasklet cannot block, and synchronous calls are not allowed"), 0;
return PyErr_SetString(PyExc_RuntimeError, "This tasklet cannot block, and synchronous calls are not allowed"), nullptr;

BluePy result;
if (noblock) {
Expand Down
2 changes: 1 addition & 1 deletion SqlCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,5 +743,5 @@ PyObject* SQLCommand::Raise(const char *msg, HRESULT hr, const CDBErrorInfo *err
sql?sql:(wchar_t*)L"", paramErrors, columnErrors));
if (!errorArgs)
return 0;
return PyErr_SetObject(Utilities::ErrorClass(hr), errorArgs), 0;
return PyErr_SetObject(Utilities::ErrorClass(hr), errorArgs), nullptr;
}
83 changes: 57 additions & 26 deletions StringStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#ifndef STRINGSTORE_H
#define STRINGSTORE_H

#include <hash_set>
#include <unordered_set>
#include "DelayedException.h"
#include "BlockAllocator.h"

Expand All @@ -45,7 +45,7 @@ class InternalStoreElement : public StoreElementBase
mPython = false;
mData = data;
mElements = elems;
mHash = Hash();
mHash = hash();
}

InternalStoreElement(const InternalStoreElement& o)
Expand Down Expand Up @@ -120,7 +120,7 @@ class InternalStoreElement : public StoreElementBase
}
memcpy( tmp, mData, mElements * elen );
mData = tmp;
return 0;
return nullptr;
}

PyObject* GetPython() override
Expand All @@ -133,21 +133,23 @@ class InternalStoreElement : public StoreElementBase
return mObject;
}

size_t hash() const
{
// hash range of elements
size_t hash = 2166136261U;
const size_t maxHash = 64;
DataType* begin = mData;
DataType* end = mData + min(mElements, maxHash);
while (begin != end)
hash = 16777619U * hash ^ (size_t)*begin++;

return hash;
}


private:
bool ToPython();

size_t Hash() const
{
// hash range of elements
size_t hash = 2166136261U;
const size_t maxHash = 64;
DataType* begin = mData;
DataType* end = mData + min(mElements, maxHash);
while (begin != end)
hash = 16777619U * hash ^ (size_t)*begin++;

return hash;
}

// raw data and python object are stored in a mutually exclusive manner for memory efficiency
union
Expand All @@ -168,17 +170,45 @@ class InternalStoreElement : public StoreElementBase



typedef InternalStoreElement<char, true> StringStoreElement; // utf-8 storage element
typedef InternalStoreElement<char, false> ByteStoreElement; // byte storage element
typedef InternalStoreElement<wchar_t, true> WStringStoreElement; // unicode storage element
using StringStoreElement = InternalStoreElement<char, true>; // utf-8 storage element
using ByteStoreElement = InternalStoreElement<char, false>; // byte storage element
using WStringStoreElement = InternalStoreElement<wchar_t, true>; // unicode storage element

template<>
struct std::hash<StringStoreElement>
{
std::size_t operator()(const StringStoreElement& s) const noexcept
{
return s.hash();
}
};

template<>
struct std::hash<ByteStoreElement>
{
std::size_t operator()(const ByteStoreElement& s) const noexcept
{
return s.hash();
}
};

template<>
struct std::hash<WStringStoreElement>
{
std::size_t operator()(const WStringStoreElement& s) const noexcept
{
return s.hash();
}
};


template <typename ElementType, typename DataType>
class InternalStore
{
public:
explicit InternalStore(SimplePoolAllocator& allocator) :
mAllocator( allocator ),
mSet( traits_t(), allocator_t( allocator ) )
m_stlAllocator(allocator),
mSet( m_stlAllocator )
{
mMemSaved = 0;
}
Expand All @@ -203,7 +233,7 @@ class InternalStore
res = 0;
if(r.second)
{
DelayedException* e = el.Claim( mAllocator );
DelayedException* e = el.Claim( m_stlAllocator.mA );
if(e)
{
return e;
Expand All @@ -220,13 +250,14 @@ class InternalStore
size_t GetMemSaved() const { return mMemSaved; }

private:
typedef stdext::hash_compare<ElementType> traits_t;
typedef StlPoolAllocator<ElementType> allocator_t;
using traits_t = std::hash<ElementType>;
using keyEqual = std::equal_to<ElementType>;
using allocator_t = StlPoolAllocator<ElementType>;

SimplePoolAllocator& mAllocator;
typedef stdext::hash_set<ElementType, traits_t, allocator_t> InternalStoreSet_t;
typedef typename InternalStoreSet_t::iterator InternalStoreSet_iterator;
using InternalStoreSet_t = std::unordered_set<ElementType, traits_t, keyEqual, allocator_t>;
using InternalStoreSet_iterator = typename InternalStoreSet_t::iterator;

allocator_t m_stlAllocator;
InternalStoreSet_t mSet;
size_t mMemSaved; // how much memory (without overhead) saved by the reuse
};
Expand Down
2 changes: 1 addition & 1 deletion tests/TestTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ PyObject* TestTools::TestParameter( int db_type, PyObject* value )
return nullptr;
BluePy getMem = BluePy( PyImport_Import( BluePyStr( "sys" ) ) );
if( !getMem )
return false;
return nullptr;
getMem = BluePy( PyObject_GetAttrString( getMem, "getpymalloced" ) );
if( !getMem )
PyErr_Clear(); // not supported, continue
Expand Down
4 changes: 0 additions & 4 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
{
"name": "openssl",
"version": "1.1.1k#8"
},
{
"name": "protobuf",
"version": "3.6.0.1"
}
]
}
2 changes: 1 addition & 1 deletion vendor/github.com/carbonengine/vcpkg-registry
Submodule vcpkg-registry updated 269 files
2 changes: 1 addition & 1 deletion vendor/github.com/microsoft/vcpkg
Submodule vcpkg updated 8468 files