Skip to content

Commit

Permalink
Merge pull request dotnet#932 from swaroop-sridhar/GcLib
Browse files Browse the repository at this point in the history
GcInfo: Add support for Standalone build
  • Loading branch information
swaroop-sridhar committed May 5, 2015
2 parents 0d481c5 + b503f15 commit 5aff148
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/.nuget/Microsoft.DotNet.CoreCLR.Debug.Development.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<file src="..\inc\corinfo.h" target="inc\corinfo.h" />
<file src="..\inc\corjit.h" target="inc\corjit.h" />
<file src="..\inc\opcode.def" target="inc\opcode.def" />
<file src="..\inc\openum.h" target="inc\openum.h" />
<file src="..\inc\openum.h" target="inc\openum.h" />
<file src="..\inc\gcinfoencoder.h" target="inc\gcinfoencoder.h" />
<file src="..\inc\gcinfotypes.h" target="inc\gcinfotypes.h" />
<file src="..\gcinfo\gcinfoencoder.cpp" target="gcinfo\gcinfoencoder.cpp" />
</files>
</package>
3 changes: 3 additions & 0 deletions src/.nuget/Microsoft.DotNet.CoreCLR.Development.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@
<file src="..\inc\corjit.h" target="inc\corjit.h" />
<file src="..\inc\opcode.def" target="inc\opcode.def" />
<file src="..\inc\openum.h" target="inc\openum.h" />
<file src="..\inc\gcinfoencoder.h" target="inc\gcinfoencoder.h" />
<file src="..\inc\gcinfotypes.h" target="inc\gcinfotypes.h" />
<file src="..\.\gcinfo\gcinfoencoder.cpp" target="gcinfo\gcinfoencoder.cpp" />
</files>
</package>
3 changes: 3 additions & 0 deletions src/gcinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ endif(CLR_CMAKE_PLATFORM_UNIX)

add_subdirectory(lib)
add_subdirectory(crossgen)

install (FILES gcinfoencoder.cpp
DESTINATION gcinfo)
6 changes: 5 additions & 1 deletion src/gcinfo/gcinfoencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
#define LOGGING
#endif
#endif

#ifndef STANDALONE_BUILD
#include "log.h"
#include "simplerhash.h"
#endif

#ifdef MDIL
#define MUST_CALL_JITALLOCATOR_FREE 1
Expand Down Expand Up @@ -84,7 +87,7 @@ void GcInfoSize::Log(DWORD level, const char * header)

#endif


#ifndef DISABLE_EH_VECTORS
inline BOOL IsEssential(EE_ILEXCEPTION_CLAUSE *pClause)
{
_ASSERTE(pClause->TryEndPC >= pClause->TryStartPC);
Expand All @@ -93,6 +96,7 @@ inline BOOL IsEssential(EE_ILEXCEPTION_CLAUSE *pClause)

return TRUE;
}
#endif

GcInfoEncoder::GcInfoEncoder(
ICorJitInfo* pCorJitInfo,
Expand Down
2 changes: 2 additions & 0 deletions src/inc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,6 @@ install (FILES cor.h
corjit.h
opcode.def
openum.h
gcinfoencoder.h
gcinfotypes.h
DESTINATION inc)
36 changes: 31 additions & 5 deletions src/inc/gcinfoencoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,54 @@
7. Chunk pointers
8. Chunk encodings
STANDALONE_BUILD
The STANDALONE_BUILD switch can be used to build the GcInfoEncoder library
independently by clients outside the CoreClr tree.
The GcInfo library uses some custom data-structures (ex: ArrayList, SimplerHashTable)
and includes some utility libraries (ex: UtilCode) which pull in several other
headers with considerable unrelated content. Rather than porting all the
utility code to suite other clients, the STANDALONE_BUILD switch can be used
to include only the minimal set of headers specific to GcInfo encodings.
Clients of STANDALONE_BUILD will likely use standard library
implementations of data-structures like ArrayList, HashMap etc., in place
of the custom implementation currently used by GcInfoEncoder.
Rather than spew the GcInfoEnoder code with
#ifdef STANDALONE_BUILD ... #else .. #endif blocks, we include a special
header GcInfoUtil.h in STANDALONE_BUILD mode. GcInfoUtil.h is expected to
supply the interface/implementation for the data-structures and utilities
used by GcInfoEncoder. This header should be provided by the clients doing
the standalone build in their source tree.
*****************************************************************/


#ifndef __GCINFOENCODER_H__
#define __GCINFOENCODER_H__


#ifdef STANDALONE_BUILD
#include <wchar.h>
#include <stdio.h>
#include "GcInfoUtil.h"
#include "corjit.h"
#else
#include <windows.h>

#include <wchar.h>
#include <stdio.h>

#include "utilcode.h"
#include "corjit.h"
#include "slist.h" // for SList
#include "arraylist.h"
#include "iallocator.h"

#include "stdmacros.h"
#include "gcinfotypes.h"
#include "eexcp.h"
#endif

#include "gcinfotypes.h"

#ifdef VERIFY_GCINFO
#include "dbggcinfoencoder.h"
Expand Down
1 change: 0 additions & 1 deletion src/inc/gcinfotypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
//--------------------------------------------------------------------------------
__forceinline size_t SAFE_SHIFT_LEFT(size_t x, size_t count)
{
LIMITED_METHOD_DAC_CONTRACT;
_ASSERTE(count <= BITS_PER_SIZE_T);
return (x << 1) << (count-1);
}
Expand Down

0 comments on commit 5aff148

Please sign in to comment.