Skip to content

Commit

Permalink
3.06.00 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rparolin committed Nov 8, 2017
1 parent f92de00 commit d269f2b
Show file tree
Hide file tree
Showing 24 changed files with 1,093 additions and 659 deletions.
1 change: 0 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ version: 1.0.{build}

image:
- Visual Studio 2017

platform:
- MinGW_x86
- MinGW_x64
Expand Down
2 changes: 0 additions & 2 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ include_directories(../test/source)
set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/../scripts/CMake")
include(CommonCppFlags)

#-------------------------------------------------------------------------------------------
# Libstdc++ calls new internally, since DLLs have no weak symbols, runtime symbol resolution fails and EASTL's new is not called.
# Linking against static libstdc++ fixes this.
# See https://github.com/electronicarts/EASTL/issues/40 for more info.
#-------------------------------------------------------------------------------------------
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND MINGW)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -static-libstdc++")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -static-libstdc++")
Expand Down
93 changes: 93 additions & 0 deletions doc/CMake/EASTL_Project_Integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
## Using EASTL in your own projects

This page describes the steps needed to use EASTL in your own projects

## Setting up your project

### Using CMake

Add to your CMakeLists.txt:

```cmake
set(EASTL_ROOT_DIR C:/EASTL)
include_directories (${EASTL_ROOT_DIR}/include)
include_directories (${EASTL_ROOT_DIR}/test/packages/EAAssert/include)
include_directories (${EASTL_ROOT_DIR}/test/packages/EABase/include/Common)
include_directories (${EASTL_ROOT_DIR}/test/packages/EAMain/include)
include_directories (${EASTL_ROOT_DIR}/test/packages/EAStdC/include)
include_directories (${EASTL_ROOT_DIR}/test/packages/EATest/include)
include_directories (${EASTL_ROOT_DIR}/test/packages/EAThread/include)
set(EASTL_LIBRARY debug ${EASTL_ROOT_DIR}/build/Debug/EASTL.lib optimized ${EASTL_ROOT_DIR}/build/Release/EASTL.lib)
add_custom_target(NatVis SOURCES ${EASTL_ROOT_DIR}/doc/EASTL.natvis)
```

And then add the library into the linker

```
target_link_libraries(... ${EASTL_LIBRARY})
```

### Using Visual Studio

Using Visual Studio projecs directly you will need do the following steps:
- Add the include paths
- Add the library path
- Add the library dependency
- Add natvis (optional)

> Note that in the examples below ${EASTL_ROOT_DIR} is the folder in which you stored EASTL. You could create an environment variable for this.
#### Add the include paths

Add the following paths to your C/C++ -> General -> Additional include directories:
```
${EASTL_ROOT_DIR}/include
${EASTL_ROOT_DIR}/test/packages/EAAssert/include
${EASTL_ROOT_DIR}/test/packages/EABase/include/Common
${EASTL_ROOT_DIR}/test/packages/EAMain/include)
${EASTL_ROOT_DIR}/test/packages/EAStdC/include)
${EASTL_ROOT_DIR}/test/packages/EATest/include)
${EASTL_ROOT_DIR}/test/packages/EAThread/include)
```

#### Add the library path

Add the following library path to your Linker -> General -> Additional Library Directories:
```
${EASTL_ROOT_DIR}/build/$(Configuration)
```

#### Add the library dependency

Either add the following library to your Linker -> Input -> Additional Dependencies
```
EASTL.lib
```
Or in code use the following:
```
#pragma comment(lib, "EASTL.lib")
```

#### Add natvis (optional)

> Adding the natvis file to your project allows the debugger to use custom visualizers for the eastl data types. This greatly enhances the debugging experience.
Add the natvis file anywhere in your solution:

```
Right-click your project: Add -> Existing item and then add the following file:
${EASTL_ROOT_DIR}/doc/EASTL.natvis
```

## Setting up your code

### Overloading operator new[]

EASTL requires you to have an overload for the operator new[], here is an example that just forwards to global new[]:

```c
void* __cdecl operator new[](size_t size, const char* name, int flags, unsigned debugFlags, const char* file, int line)
{
return new uint8_t[size];
}
```
38 changes: 25 additions & 13 deletions doc/EASTL.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,32 @@
</Type>

<Type Name="eastl::basic_string&lt;char,*&gt;">
<DisplayString>{mPair.mFirst.mpBegin,s}</DisplayString>
<DisplayString>{mPair.mFirst.heap.mpBegin,s}</DisplayString>
<Expand>
<Item Name="length">mPair.mFirst.mpEnd-mPair.mFirst.mpBegin</Item>
<Item Name="capacity">mPair.mFirst.mpCapacity-mPair.mFirst.mpBegin</Item>
<Item Name="value">mPair.mFirst.mpBegin,sb</Item>
<Item Name="length" Condition="mPair.mFirst.sso.mpBegin != mPair.mFirst.sso.mBuffer">mPair.mFirst.heap.mpEnd - mPair.mFirst.heap.mpBegin</Item>
<Item Name="capacity" Condition="mPair.mFirst.sso.mpBegin != mPair.mFirst.sso.mBuffer">mPair.mFirst.heap.mpCapacity - mPair.mFirst.heap.mpBegin</Item>
<Item Name="value" Condition="mPair.mFirst.sso.mpBegin != mPair.mFirst.sso.mBuffer">mPair.mFirst.heap.mpBegin,sb</Item>

<Item Name="length" Condition="mPair.mFirst.sso.mpBegin == mPair.mFirst.sso.mBuffer">mPair.mFirst.sso.mnSize</Item>
<Item Name="capacity" Condition="mPair.mFirst.sso.mpBegin == mPair.mFirst.sso.mBuffer">SSOLayout::SSO_SIZE_IN_BYTES-0</Item>
<Item Name="value" Condition="mPair.mFirst.sso.mpBegin == mPair.mFirst.sso.mBuffer">mPair.mFirst.sso.mpBegin,sb</Item>

<Item Name="uses heap">mPair.mFirst.sso.mpBegin != mPair.mFirst.sso.mBuffer</Item>
</Expand>
</Type>

<Type Name="eastl::basic_string&lt;wchar_t,*&gt;">
<DisplayString>{mPair.mFirst.mpBegin,su}</DisplayString>
<DisplayString>{mPair.mFirst.heap.mpBegin,su}</DisplayString>
<Expand>
<Item Name="length">mPair.mFirst.mpEnd-mPair.mFirst.mpBegin</Item>
<Item Name="capacity">mPair.mFirst.mpCapacity-mPair.mFirst.mpBegin</Item>
<Item Name="value">mPair.mFirst.mpBegin,sub</Item>
<Item Name="length" Condition="mPair.mFirst.sso.mpBegin != mPair.mFirst.sso.mBuffer">mPair.mFirst.heap.mpEnd - mPair.mFirst.heap.mpBegin</Item>
<Item Name="capacity" Condition="mPair.mFirst.sso.mpBegin != mPair.mFirst.sso.mBuffer">mPair.mFirst.heap.mpCapacity - mPair.mFirst.heap.mpBegin</Item>
<Item Name="value" Condition="mPair.mFirst.sso.mpBegin != mPair.mFirst.sso.mBuffer">mPair.mFirst.heap.mpBegin,sub</Item>

<Item Name="length" Condition="mPair.mFirst.sso.mpBegin == mPair.mFirst.sso.mBuffer">mPair.mFirst.sso.mnSize</Item>
<Item Name="capacity" Condition="mPair.mFirst.sso.mpBegin == mPair.mFirst.sso.mBuffer">SSOLayout::SSO_SIZE_IN_BYTES-0</Item>
<Item Name="value" Condition="mPair.mFirst.sso.mpBegin == mPair.mFirst.sso.mBuffer">mPair.mFirst.sso.mpBegin,sub</Item>

<Item Name="uses heap">mPair.mFirst.sso.mpBegin != mPair.mFirst.sso.mBuffer</Item>
</Expand>
</Type>

Expand Down Expand Up @@ -314,13 +326,13 @@
<DisplayString Condition="mnSize == 1">
[1]
{{
{((eastl::rbtree_node&lt;$T1&gt;*)mAnchor.mpNodeLeft)-&gt;mValue}
{((eastl::rbtree_node&lt;$T2&gt;*)mAnchor.mpNodeLeft)-&gt;mValue}
}}
</DisplayString>
<DisplayString Condition="mnSize &gt; 1">
[{mnSize}]
{{
{((eastl::rbtree_node&lt;$T1&gt;*)mAnchor.mpNodeLeft)-&gt;mValue},
{((eastl::rbtree_node&lt;$T2&gt;*)mAnchor.mpNodeLeft)-&gt;mValue},
...
}}
</DisplayString>
Expand All @@ -343,9 +355,9 @@
<Synthetic Name="NOTE!">
<DisplayString>It is possible to expand parents that do not exist.</DisplayString>
</Synthetic>
<Item Name="Parent">*(eastl::rbtree_node&lt;$T1&gt;*)(mpNodeParent.value &amp; (~uintptr_t(1)))</Item>
<Item Name="Left">*(eastl::rbtree_node&lt;$T1&gt;*)mpNodeLeft</Item>
<Item Name="Right">*(eastl::rbtree_node&lt;$T1&gt;*)mpNodeRight</Item>
<Item Name="Parent">*(eastl::rbtree_node&lt;$T2&gt;*)(mpNodeParent.value &amp; (~uintptr_t(1)))</Item>
<Item Name="Left">*(eastl::rbtree_node&lt;$T2&gt;*)mpNodeLeft</Item>
<Item Name="Right">*(eastl::rbtree_node&lt;$T2&gt;*)mpNodeRight</Item>
</Expand>
</Type>

Expand Down
13 changes: 12 additions & 1 deletion include/EASTL/fixed_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,18 @@ namespace eastl
mpHead = mpHead->mpNext;
}
else
p = mOverflowAllocator.allocate(mnNodeSize);
{
// If there's no free node in the free list, just
// allocate another from the reserved memory area

if (mpNext != mpCapacity)
{
p = mpNext;
mpNext = reinterpret_cast<Link*>(reinterpret_cast<char8_t*>(mpNext) + mnNodeSize);
}
else
p = mOverflowAllocator.allocate(mnNodeSize);
}

#if EASTL_FIXED_SIZE_TRACKING_ENABLED
if(p && (++mnCurrentSize > mnPeakSize))
Expand Down
Loading

0 comments on commit d269f2b

Please sign in to comment.