You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by an...@apache.org on 2017/09/07 01:55:13 UTC
[19/30] incubator-trafodion git commit: TRAFODION-2731 CodeCleanup:
Remove obsolete, legacy and unused code
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/NAMemory.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/NAMemory.cpp b/core/sql/common/NAMemory.cpp
index 7b781f0..3dd5afd 100644
--- a/core/sql/common/NAMemory.cpp
+++ b/core/sql/common/NAMemory.cpp
@@ -54,25 +54,13 @@
#include <errno.h>
#include "seabed/fs.h"
-#ifndef __EID
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
-#endif
-#ifndef STAND_ALONE
#include "str.h"
#include "ComSpace.h"
-#else
-#define MEMALLOC_FAILURE 1
-#endif
-
-#ifdef __EID
-#include "ExeDp2.h"
-#endif
-
-
#include <unistd.h>
#include <sys/types.h>
@@ -83,12 +71,10 @@
#include <fstream>
#endif
-#ifndef STAND_ALONE
#include "NAError.h"
#include "HeapLog.h"
#include "Platform.h"
#include "NAAssert.h"
-#endif
#include "ComRtUtils.h"
#include "StmtCompilationMode.h"
@@ -155,7 +141,6 @@ THREAD_P DeallocTraceEntry (*deallocTraceArray)[deallocTraceEntries] = 0;
#include "Collections.h"
#endif // _DEBUG
-#if defined(NA_LINUX) && !defined(__EID)
class NAMutex
{
bool threadSafe_;
@@ -184,29 +169,21 @@ public:
}
}
};
-#endif
-#if !defined (NA_WINNT) && !defined(__EID)
#include "logmxevent.h"
-#endif //!defined (NA_WINNT) && !defined(__EID)
-
#define NO_MERGE 0x0
#define BACKWARD_MERGE 0x1
#define FORWARD_MERGE 0x2
-#if !defined (NA_WINNT) && !defined(__EID)
#include "logmxevent.h"
-#endif //!defined (NA_WINNT) && !defined(__EID)
-#if !defined(STAND_ALONE) && (defined(__TANDEM) || defined(NA_LINUX)) && !defined(__EID)
extern short getRTSSemaphore(); // Functions implemented in SqlStats.cpp
extern void releaseRTSSemaphore();
extern NABoolean checkIfRTSSemaphoreLocked();
extern void updateMemStats();
extern SB_Phandle_Type *getMySsmpPhandle();
-#endif
//CollHeap *CTXTHEAP__ = NULL; // a global, set by CmpContext ctor and used by
// Collections.cpp allocate method
@@ -214,16 +191,12 @@ const size_t DEFAULT_NT_HEAP_INIT_SIZE = 524288;
const size_t DEFAULT_NT_HEAP_MAX_SIZE = (size_t)-1; // by default, heaps have no max size
const size_t DEFAULT_NT_HEAP_INCR_SIZE = 524288;
-
-#ifdef HAVE_MMAP
// MIN_MMAP_ALLOC_SIZE defines the minimum user size that will be used to
// allocate a NABlock using mmap().
const size_t MIN_MMAP_ALLOC_SIZE = 524288;
-#endif
-
-// Ignore all HEAPLOG stuff if STAND_ALONE or MUSE
-#if defined(STAND_ALONE) || defined(MUSE)
+// Ignore all HEAPLOG stuff if MUSE
+#if defined(MUSE)
#undef HEAPLOG_ON
#undef HEAPLOG_OFF
#undef HEAPLOG_REINITIALIZE
@@ -234,7 +207,7 @@ const size_t MIN_MMAP_ALLOC_SIZE = 524288;
#define HEAPLOG_REINITIALIZE(a)
#define HEAPLOG_ADD_ENTRY(a, b, c, d)
#define HEAPLOG_DELETE_ENTRY(a, b)
-#endif // STAND_ALONE
+#endif
// ****************************************************************************
// Numeric constants that are local to this file
@@ -275,11 +248,7 @@ const size_t DEFAULT_MAX_INCREMENT = 4194304;
#define BLOCK_OVERHEAD (sizeof(NABlock) + 2 * sizeof(size_t))
-#ifdef NA_64BIT
#define MAX_REQUEST (0x7fffffffffffff - FRAG_ALIGN_MASK - FRAGMENT_OVERHEAD)
-#else
-#define MAX_REQUEST (0x7fffffff - FRAG_ALIGN_MASK - FRAGMENT_OVERHEAD)
-#endif // NA_64BIT
#define MIN_REQUEST (MIN_FRAGMENT_SIZE - FRAGMENT_OVERHEAD - 1)
#define SMALLBIN_SHIFT 3
#define TREEBIN_SHIFT 8
@@ -299,7 +268,7 @@ const size_t DEFAULT_MAX_INCREMENT = 4194304;
// addressing by index. See above about smallbin repositioning
-#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) ) && !defined(__EID)
+#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) )
#define RTCHECK(e) (e)
#define CORRUPTION_ERROR_ACTION assert(0)
#define USAGE_ERROR_ACTION assert(0)
@@ -325,7 +294,7 @@ const size_t DEFAULT_MAX_INCREMENT = 4194304;
#define checkTopFragment(P)
#define checkMallocedFragment(P,N)
#define checkMallocState()
-#endif // !( defined(_DEBUG) || defined(NSK_MEMDEBUG) ) && !defined(__EID)
+#endif // !( defined(_DEBUG) || defined(NSK_MEMDEBUG) )
// ****************************************************************************
#ifdef NA_YOS_SIMULATION
@@ -393,14 +362,12 @@ NABlock::isExternSegment()
return (sflags_ & EXTERN_BIT) != 0;
}
-#ifdef HAVE_MMAP
// Return whether this NABlock was allocated using mmap().
inline NABoolean
NABlock::isMMapped()
{
return (sflags_ & MMAP_BIT) != 0;
}
-#endif // HAVE_MMAP
// Return the offset of the first fragment in the block
inline size_t
@@ -682,7 +649,6 @@ NAHeapFragment::setFencePosts()
next->head_ = FENCEPOST_HEAD;
}
-#ifdef HAVE_MMAP
// Return whether the MMAPPED_BIT is set. This bit is only set when a
// NABlock contains a single large fragment and the NABlock was allocated
// using mmap().
@@ -701,7 +667,6 @@ NAHeapFragment::setSizeOfMMapFragment(size_t size)
((NAHeapFragment*)((char*)this + size))->head_ = FENCEPOST_HEAD;
((NAHeapFragment*)((char*)this + size + sizeof(size_t)))->head_ = FENCEPOST_HEAD;
}
-#endif
// mark free pages in this fragment as "non-dirty". Benefits are:
// 1) pages will become readily stealable if needed by the OS.
@@ -782,7 +747,6 @@ NATreeFragment::setFreedNSKMemory(short value)
freedNSKMemory_ = value;
}
-#if (defined(NA_LINUX) && !defined(__EID))
Lng32 NAMemory::getVmSize()
{
pid_t myPid;
@@ -835,9 +799,7 @@ NATreeFragment::setFreedNSKMemory(short value)
crowdedTotalSize_ = 0ll;
}
}
-#endif // (defined(NA_LINUX) && !defined(__EID))
-#ifdef HAVE_MMAP
NABlock*
NAMemory::allocateMMapBlock(size_t s)
{
@@ -846,15 +808,11 @@ NAMemory::allocateMMapBlock(size_t s)
(MAP_PRIVATE|MAP_ANONYMOUS), -1, 0);
if (blk == (NABlock*)-1)
{
-#ifndef __EID
mmapErrno_ = errno;
-#endif //__EID
return NULL;
}
-#ifndef __EID
else
allocationIncrement(s);
-#endif // __EID
// one more block allocated
blockCnt_++;
@@ -873,37 +831,22 @@ NAMemory::allocateMMapBlock(size_t s)
inline void
NAMemory::deallocateMMapBlock(NABlock *blk)
{
-#ifndef __EID
allocationDecrement(blk->size_);
-#endif // __EID
Int32 munmapRetVal;
munmapRetVal = munmap((void*)blk, blk->size_);
-#ifndef __EID
if (munmapRetVal == -1)
munmapErrno_ = errno;
-#endif // __EID
}
-#endif // HAVE_MMAP
-
// Either the correct call to free the memory used by a NABlock. This function
// prevents a lot of extra #ifdef code in later sections of code.
inline void
NAMemory::sysFreeBlock(NABlock *blk)
{
-#ifdef HAVE_MMAP
if (blk->isMMapped())
deallocateMMapBlock(blk);
else
free((void*)blk);
-#else
- {
-#if (defined(NA_LINUX) && !defined(__EID))
- allocationDecrement(blk->size_);
-#endif // NA_LINUX
- free((void*)blk);
- }
-#endif
}
#ifndef MUSE
@@ -929,7 +872,6 @@ NAMemory::NAMemory(const char * name)
exhaustedMem_(FALSE),
errorsMask_(0),
crowdedTotalSize_(0ll)
-#ifndef __EID
, allocationDelta_(0ll)
, procStatusFile_(NULL)
, mmapErrno_(0)
@@ -937,9 +879,8 @@ NAMemory::NAMemory(const char * name)
, lastVmSize_(0l)
, maxVmSize_(0l)
, sharedMemory_(FALSE)
-#endif // __EID
{
-#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) ) && !defined(__EID)
+#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) )
char * debugLevel = getenv("MEMDEBUG");
if (debugLevel)
debugLevel_ = (Lng32)atoi(debugLevel);
@@ -953,13 +894,11 @@ NAMemory::NAMemory(const char * name)
else
setName("Unnamed memory");
-#ifndef STAND_ALONE
// need to initialize an NAStringRef object "on top" of the array
// (don't touch this unless you know what you're doing!)
NAStringRef * tmp =
new ( (void*) (&nullNAStringRep_[3]) )
NAStringRef (NAStringRef::NULL_CTOR, this) ;
-#endif
}
NAMemory::NAMemory(const char * name, NAHeap * parent, size_t blockSize,
@@ -985,7 +924,6 @@ NAMemory::NAMemory(const char * name, NAHeap * parent, size_t blockSize,
exhaustedMem_(FALSE),
errorsMask_(0),
crowdedTotalSize_(0ll)
-#ifndef __EID
, allocationDelta_(0ll)
, procStatusFile_(NULL)
, mmapErrno_(0)
@@ -993,15 +931,12 @@ NAMemory::NAMemory(const char * name, NAHeap * parent, size_t blockSize,
, lastVmSize_(0l)
, maxVmSize_(0l)
, sharedMemory_(FALSE)
-#endif // __EID
{
-#ifndef __EID
if (parent_->getSharedMemory())
setSharedMemory();
-#endif
// a derived memory has to have a parent from which it is derived
assert(parent_);
-#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) ) && !defined(__EID)
+#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) )
char * debugLevel = getenv("MEMDEBUG");
if (debugLevel)
debugLevel_ = (Lng32)atoi(debugLevel);
@@ -1017,13 +952,11 @@ NAMemory::NAMemory(const char * name, NAHeap * parent, size_t blockSize,
blockSize = (Lng32)524288;
initialSize_ = incrementSize_ = blockSize;
-#ifndef STAND_ALONE
// need to initialize an NAStringRef object "on top" of the array
// (don't touch this unless you know what you're doing!)
NAStringRef * tmp =
new ( (void*) (&nullNAStringRep_[3]) )
NAStringRef (NAStringRef::NULL_CTOR, this) ;
-#endif
}
NAMemory::NAMemory(const char * name, NAMemoryType type, size_t blockSize,
@@ -1049,7 +982,6 @@ NAMemory::NAMemory(const char * name, NAMemoryType type, size_t blockSize,
exhaustedMem_(FALSE),
errorsMask_(0),
crowdedTotalSize_(0ll)
-#ifndef __EID
, allocationDelta_(0ll)
, procStatusFile_(NULL)
, mmapErrno_(0)
@@ -1057,11 +989,10 @@ NAMemory::NAMemory(const char * name, NAMemoryType type, size_t blockSize,
, lastVmSize_(0l)
, maxVmSize_(0l)
, sharedMemory_(FALSE)
-#endif // __EID
{
// call setType to initialize the values of all the sizes
setType(type_, blockSize);
-#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) ) && !defined(__EID)
+#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) )
char * debugLevel = getenv("MEMDEBUG");
if (debugLevel)
debugLevel_ = (Lng32)atoi(debugLevel);
@@ -1072,13 +1003,11 @@ NAMemory::NAMemory(const char * name, NAMemoryType type, size_t blockSize,
#endif
setName(name);
-#ifndef STAND_ALONE
// need to initialize an NAStringRef object "on top" of the array
// (don't touch this unless you know what you're doing!)
NAStringRef * tmp =
new ( (void*) (&nullNAStringRep_[3]) )
NAStringRef (NAStringRef::NULL_CTOR, this) ;
-#endif
}
NAMemory::NAMemory(const char * name,
@@ -1109,7 +1038,6 @@ NAMemory::NAMemory(const char * name,
exhaustedMem_(FALSE),
errorsMask_(0),
crowdedTotalSize_(0ll)
-#ifndef __EID
, allocationDelta_(0ll)
, procStatusFile_(NULL)
, mmapErrno_(0)
@@ -1117,7 +1045,6 @@ NAMemory::NAMemory(const char * name,
, lastVmSize_(0l)
, maxVmSize_(0l)
, sharedMemory_(FALSE)
-#endif // __EID
{
segGlobals_->setFirstSegInfo(extFirstSegId,
extFirstSegStart,
@@ -1129,7 +1056,7 @@ NAMemory::NAMemory(const char * name,
// call setType to initialize the values of all the sizes
setType(type_, 0);
-#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) ) && !defined(__EID)
+#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) )
char * debugLevel = getenv("MEMDEBUG");
if (debugLevel)
debugLevel_ = (Lng32)atoi(debugLevel);
@@ -1157,13 +1084,11 @@ NAMemory::NAMemory(const char * name,
}
}
-#ifndef STAND_ALONE
// need to initialize an NAStringRef object "on top" of the array
// (don't touch this unless you know what you're doing!)
NAStringRef * tmp =
new ( (void*) (&nullNAStringRep_[3]) )
NAStringRef (NAStringRef::NULL_CTOR, this) ;
-#endif
}
void NAMemory::reInitialize()
@@ -1179,16 +1104,6 @@ void NAMemory::reInitialize()
if (p != NULL) {
switch (type_) {
- case DP2_MEMORY:
-#ifdef __EID
- while (p) {
- NABlock *q = p->next_;
- DP2_EXECUTOR_DROP_MEMORY(p);
- p = q;
- }
-#endif
- break;
-#ifndef __EID
case EXECUTOR_MEMORY:
case SYSTEM_MEMORY:
case IPC_MEMORY:
@@ -1217,7 +1132,6 @@ void NAMemory::reInitialize()
assert(parent_);
HEAPLOG_OFF() // no recursive logging. (eric)
-#if !defined(STAND_ALONE) && (defined(__TANDEM) || defined(NA_LINUX)) && !defined(__EID)
// This code provides mutual exclusion for the runtime stats shared
// memory segment.
short semRetcode = 0;
@@ -1226,13 +1140,11 @@ void NAMemory::reInitialize()
parent_->getSegGlobals()->getFirstSegId() == getStatsSegmentId()) {
semRetcode = getRTSSemaphore();
}
-#endif
while (p) {
NABlock *q = p->next_;
parent_->deallocateHeapMemory((void*)p);
p = q;
}
-#if !defined(STAND_ALONE) && (defined(__TANDEM) || defined(NA_LINUX)) && !defined(__EID)
if (semRetcode == 1)
releaseRTSSemaphore();
if (parent_->type_ == NAMemory::EXECUTOR_MEMORY &&
@@ -1240,11 +1152,9 @@ void NAMemory::reInitialize()
{
updateMemStats();
}
-#endif
HEAPLOG_ON()
}
break;
-#endif // __EID
default:
assert(0);
} // switch(_type)
@@ -1287,7 +1197,6 @@ NAMemory::~NAMemory()
void NAMemory::setType(NAMemoryType type, Lng32 blockSize)
{
// upperLimit_ must be zero for EXECUTOR_MEMORY, IPC_MEMORY, SYSTEM_MEMORY,
- // DP2_MEMORY.
type_ = type;
@@ -1301,21 +1210,6 @@ void NAMemory::setType(NAMemoryType type, Lng32 blockSize)
// initialSize_ + n * incrementSize_ = maximumSize_
switch(type_) {
- case DP2_MEMORY:
- if (blockSize > 0)
- {
- initialSize_ = blockSize;
- incrementSize_ = blockSize * 2; // nothing special about *2 here.
- }
- else
- {
- initialSize_ = 100000;
- incrementSize_ = 100000;
- }
-
- maximumSize_ = (size_t)-1; // not used for this memory type
- break;
-
case EXECUTOR_MEMORY:
// input parameter blockSize is ignored
// this is an NAMemory using flat segments on NSK
@@ -1412,7 +1306,7 @@ void NAMemory::deallocateMemory(void* addr)
// dump() writes memory statistics to an output file that the caller must open.
// It is used as an aid for debugging memory problems and for saving memory
// statistics during certain tests.
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
void NAMemory::dump(ostream* outstream, Lng32 indent)
{
switch (derivedClass_)
@@ -1509,7 +1403,7 @@ NAHeap::idx2bit(bindex_t idx)
inline NAHeap::bindex_t
NAHeap::bit2idx(binmap_t x)
{
-#if defined(NA_LINUX) && defined(i386)
+#if defined(i386)
UInt32 ret;
__asm__("bsfl %1,%0\n\t" : "=r" (ret) : "rm" (x));
return (NAHeap::bindex_t)ret;
@@ -1605,7 +1499,7 @@ NAHeap::computeTreeIndex(size_t size)
return NTREEBINS - 1;
else {
UInt32 k;
-#if defined(NA_LINUX) && defined(i386)
+#if defined(i386)
__asm__("bsrl %1,%0\n\t" : "=r" (k) : "rm" (x));
#else
UInt32 y = (UInt32)x;
@@ -1973,7 +1867,6 @@ NAHeap::replaceDV(NAHeapFragment *p, size_t size)
}
// Resize the top fragment when a segment changes size.
-// LCOV_EXCL_START
inline void
NAHeap::resizeTop(size_t newsize)
{
@@ -1985,7 +1878,6 @@ NAHeap::resizeTop(size_t newsize)
NAHeapFragment *next = top_->nextFragment();
next->setFencePosts();
}
-// LCOV_EXCL_STOP
// Initialize the top fragment
inline void
@@ -2075,12 +1967,6 @@ NAHeap::deallocateFreeBlock(NAHeapFragment *p)
// Now release the memory to the operating system.
switch (type_)
{
- case DP2_MEMORY:
-#ifdef __EID
- DP2_EXECUTOR_DROP_MEMORY(curr);
-#endif
- break;
-#ifndef __EID
case EXECUTOR_MEMORY:
case SYSTEM_MEMORY:
case IPC_MEMORY:
@@ -2092,7 +1978,6 @@ NAHeap::deallocateFreeBlock(NAHeapFragment *p)
case DERIVED_MEMORY:
assert(parent_);
HEAPLOG_OFF() // no recursive logging.
-#if !defined(STAND_ALONE) && (defined(__TANDEM) || defined(NA_LINUX)) && !defined(__EID)
// This code provides mutual exclusion for the runtime stats shared
// memory segment.
if (parent_->getType() == EXECUTOR_MEMORY &&
@@ -2105,12 +1990,8 @@ NAHeap::deallocateFreeBlock(NAHeapFragment *p)
} else {
parent_->deallocateHeapMemory((void*)curr);
}
-#else
- parent_->deallocateHeapMemory((void*)curr);
-#endif
HEAPLOG_ON()
break;
-#endif // __EID
default:
assert(0); // Shouldn't happen
break;
@@ -2250,21 +2131,14 @@ Lng32 NAMemory::getAllocatedSpaceSize()
assert(type_ != NO_MEMORY_TYPE);
return allocSize_;
}
-// LCOV_EXCL_STOP
void NAMemory::setName(const char * name)
{
-#ifndef __EID
-#ifndef STAND_ALONE
Lng32 copyLen = str_len(name);
-#else
- Lng32 copyLen = strlen(name);
-#endif
if (copyLen > 20)
copyLen = 20;
memcpy(name_, name, copyLen);
name_[copyLen] = 0;
-#endif
}
void NAMemory::registerMemory(NAMemory * child)
@@ -2352,87 +2226,53 @@ NAHeap::allocateBlock(size_t size, NABoolean failureIsFatal)
NABlock *p = NULL; // Pointer to the returned block.
switch (type_) {
- case DP2_MEMORY: {
-#ifdef __EID
-
- short returnCode = DP2_EXECUTOR_ADD_MEMORY (blockSize, &addr);
-
- if (returnCode == FEOK) {
-#ifdef TRACE_DP2_MALLOCS
- extern ostream *TraceFile;
- *TraceFile << "DP2_EXECUTOR_ADD_MEMORY alloc'd " << size
- << " bytes at " << (void *) addr
- << " which the executor will use as an NAMemory block." << endl;
-#endif
-
- p = (NABlock*)addr;
- }
-
-#endif
- }
- break;
-
-#ifndef __EID
case EXECUTOR_MEMORY: {
// This could be either Global Executor Memory or Stats Globals
// Don't add a block if Stats Globals!
- // (segGlobals_->reachedMaxSegCnt which is used in the NA_NSK case
- // is obsolete)
if (getSegGlobals()->getFirstSegId() == getStatsSegmentId())
return NULL;
-#ifdef HAVE_MMAP
+
// Try to allocate the NABlock using mmap(). If it succeeds return the
// NABlock. Otherwise, fall through and try to allocate the normal way.
if (blockSize >= MIN_MMAP_ALLOC_SIZE &&
(p = allocateMMapBlock(blockSize)) != NULL)
return p;
-#endif
// allocate a block from the OS memory
p = (NABlock*)malloc(blockSize);
-#if (defined(NA_LINUX) && !defined(__EID))
if (p)
allocationIncrement(blockSize);
-#endif // NA_LINUX
}
break;
case SYSTEM_MEMORY:
case IPC_MEMORY:
{
-
-#ifdef HAVE_MMAP
// Try to allocate the NABlock using mmap(). If it succeeds return the
// NABlock. Otherwise, fall through and try to allocate the normal way.
if (blockSize >= MIN_MMAP_ALLOC_SIZE &&
(p = allocateMMapBlock(blockSize)) != NULL)
return p;
-#endif
// allocate a block from the OS memory
p = (NABlock*)malloc(blockSize);
-#if (defined(NA_LINUX) && !defined(__EID))
if (p)
allocationIncrement(blockSize);
-#endif // (defined(NA_LINUX) && !defined(__EID))
}
break;
case DERIVED_FROM_SYS_HEAP: {
// allocate a block from the OS memory
-#ifdef HAVE_MMAP
// Try to allocate the NABlock using mmap(). If it succeeds return the
// NABlock. Otherwise, fall through and try to allocate the normal way.
if (blockSize >= MIN_MMAP_ALLOC_SIZE &&
(p = allocateMMapBlock(blockSize)) != NULL)
return p;
-#endif
+
p = (NABlock*)malloc(blockSize);
-#if (defined(NA_LINUX) && !defined(__EID))
if (p)
allocationIncrement(blockSize);
-#endif // (defined(NA_LINUX) && !defined(__EID))
}
break;
@@ -2442,7 +2282,6 @@ NAHeap::allocateBlock(size_t size, NABoolean failureIsFatal)
// allocate a block from the parent
HEAPLOG_OFF() // no recursive logging. (eric)
-#if !defined(STAND_ALONE) && (defined(__TANDEM) || defined(NA_LINUX)) && !defined(__EID)
// This code provides mutual exclusion for the runtime stats shared
// memory segment.
// The IF condition below is not needed since we are checking if
@@ -2456,7 +2295,6 @@ NAHeap::allocateBlock(size_t size, NABoolean failureIsFatal)
p = (NABlock*)parent_->allocateHeapMemory(blockSize, FALSE);
if (p == NULL)
-//LCOV_EXCL_START
// Unit tested this code with the test case in QC 1387
// - 3/22/2012.
{
@@ -2487,40 +2325,29 @@ NAHeap::allocateBlock(size_t size, NABoolean failureIsFatal)
char coreFile[1024];
msg_mon_dump_process_name(NULL, ssmpName, coreFile);
}
-#ifdef SQ_PHANDLE_VERIFIER
Int32 ndRetcode = msg_mon_node_down2(nid,
"RMS shared segment is exhausted.");
-#else
- Int32 ndRetcode = msg_mon_node_down(nid);
-#endif
sleep(30);
NAExit(0); // already made a core.
}
else
assert(p != NULL);
-//LCOV_EXCL_STOP
}
if (retcode == 1)
releaseRTSSemaphore();
} else {
p = (NABlock*)parent_->allocateHeapMemory(blockSize, failureIsFatal);
-#ifndef __EID
if (parent_->type_ == NAMemory::EXECUTOR_MEMORY &&
parent_->parent_ == NULL)
{
updateMemStats();
}
-#endif
}
-#else
- p = (NABlock*)parent_->allocateHeapMemory(blockSize, failureIsFatal);
-#endif
segmentId = NABlock::DERIVED_SEGMENT_ID; // Add another check for muse
HEAPLOG_ON()
}
break;
-#endif // ifndef __EID
} // switch(type_)
// if the allocation was not sucessfull, we return a NULL
@@ -2541,7 +2368,6 @@ NAHeap::allocateBlock(size_t size, NABoolean failureIsFatal)
} // NAHeap::allocateBlock(size_t size, NABoolean failureIsFatal)
#endif // !MUSE
-#ifndef __EID
void NAMemory::showStats(ULng32 level)
{
char indent[100];
@@ -2555,9 +2381,6 @@ void NAMemory::showStats(ULng32 level)
case NO_MEMORY_TYPE:
cerr << "NO_MEMORY_TYPE";
break;
- case DP2_MEMORY:
- cerr << "DP2_MEMORY";
- break;
case EXECUTOR_MEMORY:
cerr << "EXECUTOR_MEMORY";
break;
@@ -2591,7 +2414,6 @@ void NAMemory::showStats(ULng32 level)
for (NAMemory * p = memoryList_; p != NULL; p = p->nextEntry_)
p->showStats(level + 1);
}
-#endif //__EID
// this method used to belong to CollHeap
#ifndef MUSE
@@ -2601,9 +2423,7 @@ NAMemory::handleExhaustedMemory()
exhaustedMem_ = TRUE;
if (heapJumpBuf_)
{
-#ifndef STAND_ALONE
ARKCMP_EXCEPTION_EPILOGUE("NAMemory");
-#endif
longjmp(*heapJumpBuf_, MEMALLOC_FAILURE);
}
}
@@ -2612,7 +2432,6 @@ NAMemory::handleExhaustedMemory()
void
NAMemory::logAllocateError(short error, SEG_ID segmentId, Lng32 blockSize, short errorDetail)
{
-#if !defined (NA_WINNT) && !defined(__EID)
char msg[128], msgErrorDetail[32];
if (error != 0 && error != 15)
{
@@ -2630,15 +2449,12 @@ NAMemory::logAllocateError(short error, SEG_ID segmentId, Lng32 blockSize, short
SQLMXLoggingArea::logExecRtInfo(__FILE__, __LINE__, msg, 0);
}
}
-#endif //!defined (NA_WINNT) && !defined(__EID)
}
void NAMemory::setJmpBuf( jmp_buf *newJmpBuf )
{
-#if defined(NA_LINUX) && !defined(__EID)
if (derivedClass_ == NAHEAP_CLASS)
assert(((NAHeap*)this)->getThreadSafe() == false);
-#endif
heapJumpBuf_ = newJmpBuf;
}
@@ -2698,7 +2514,6 @@ void NASegGlobals::setFirstSegInfo(SEG_ID firstSegId,
}
}
-// LCOV_EXCL_START
Int32 NASegGlobals::addSegId(short segId, void *start, size_t len)
{
if (addedSegCount_ == NA_MAX_SECONDARY_SEGS)
@@ -2813,7 +2628,6 @@ NABoolean NASegGlobals::overlaps(void *start, size_t len) const
}
return FALSE;
}
-// LCOV_EXCL_STOP
// ---------------------------------------------------------------------------
// NAHeap methods
@@ -2833,10 +2647,8 @@ NAHeap::NAHeap()
initBins();
derivedClass_ = NAHEAP_CLASS;
-#if defined(NA_LINUX) && !defined(__EID)
threadSafe_ = false;
memset(&mutex_, '\0', sizeof(mutex_));
-#endif
#ifdef _DEBUG
setAllocTrace();
@@ -2860,10 +2672,8 @@ NAHeap::NAHeap(const char * name,
initBins();
derivedClass_ = NAHEAP_CLASS;
-#if defined(NA_LINUX) && !defined(__EID)
threadSafe_ = false;
memset(&mutex_, '\0', sizeof(mutex_));
-#endif
if (parent != NULL)
{
NAMutex mutex(parent->threadSafe_, &parent->mutex_);
@@ -2892,10 +2702,8 @@ NAHeap::NAHeap(const char * name,
initBins();
derivedClass_ = NAHEAP_CLASS;
-#if defined(NA_LINUX) && !defined(__EID)
threadSafe_ = false;
memset(&mutex_, '\0', sizeof(mutex_));
-#endif
#ifdef _DEBUG
setAllocTrace();
@@ -2941,10 +2749,8 @@ NAHeap::NAHeap(const char * name,
}
}
-#if defined(NA_LINUX) && !defined(__EID)
threadSafe_ = false;
memset(&mutex_, '\0', sizeof(mutex_));
-#endif
#ifdef _DEBUG
setAllocTrace();
@@ -2958,7 +2764,6 @@ NAHeap::~NAHeap()
pthread_mutex_destroy(&mutex_);
}
-#if defined(NA_LINUX) && !defined(__EID)
void NAHeap::setThreadSafe()
{
assert(((NAMemory*)this)->getJmpBuf() == NULL);
@@ -2981,7 +2786,6 @@ void NAHeap::setThreadSafe()
heap = heap->parent_;
}
}
-#endif
// destroy() is called by the NAMemory destructor to perform the
// derived class destructor. It is part of the mechanism that
@@ -2989,10 +2793,8 @@ void NAHeap::setThreadSafe()
// runtime statistics.
void NAHeap::destroy()
{
-#if defined(NA_LINUX) && !defined(__EID)
if (parent_ != NULL)
NAMutex mutex(parent_->threadSafe_, &parent_->mutex_);
-#endif
#ifdef _DEBUG
if (la_)
@@ -3015,11 +2817,9 @@ void NAHeap::destroy()
// NAMemory reInitialize(), which may either be called directly or from a destructor.
void NAHeap::reInitializeHeap()
{
-#if defined(NA_LINUX) && !defined(__EID)
NAMutex mutex(threadSafe_, &mutex_);
-#endif
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
// Before freeing the NABlocks in reInitialize(), check to see whether any
// of the memory fragments in the blocks have overflowed
if (debugLevel_ == 2)
@@ -3122,10 +2922,7 @@ void * NAHeap::allocateAlignedHeapMemory(size_t userSize, size_t alignment, NABo
void * NAHeap::allocateHeapMemory(size_t userSize, NABoolean failureIsFatal)
{
-#if defined(NA_LINUX) && !defined(__EID)
NAMutex mutex(threadSafe_, &mutex_);
-#endif
-
assert(type_ != NO_MEMORY_TYPE);
@@ -3135,7 +2932,6 @@ void * NAHeap::allocateHeapMemory(size_t userSize, NABoolean failureIsFatal)
if (userSize == 0)
return NULL;
-#if !defined(STAND_ALONE) && (defined(__TANDEM) || defined(NA_LINUX)) && !defined(__EID)
// getSharedMemory() check alone is enough since it will return for both
// global and process stats heap. Leaving the rest of the condition here
//
@@ -3147,16 +2943,15 @@ void * NAHeap::allocateHeapMemory(size_t userSize, NABoolean failureIsFatal)
if (! checkIfRTSSemaphoreLocked())
NAExit(1);
}
-#endif
+
// Some additional bytes are added in debug mode, but the original userSize
// must be retained.
size_t additionalUserSize = userSize;
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID)
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
if (debugLevel_)
dynamicAllocs.addEntry(userSize);
-#ifndef STAND_ALONE
// Allocate some additional memory to help with memory debugging. At
// debug level 2 on Windows, there are 40 bytes allocated to store
// 10 program counters of 4 bytes each. There are 4 bytes to store
@@ -3172,8 +2967,7 @@ void * NAHeap::allocateHeapMemory(size_t userSize, NABoolean failureIsFatal)
const size_t additionalBytes[4] = { 12, 15, 14, 13 };
additionalUserSize += additionalBytes[userSize & 0x3];
}
-#endif // !STAND_ALONE
-#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID)
+#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG))
size_t nb;
NAHeapFragment *p;
@@ -3183,7 +2977,6 @@ void * NAHeap::allocateHeapMemory(size_t userSize, NABoolean failureIsFatal)
// checking logic to work.
NABoolean cleanUpPrevNext = debugLevel_== 0 ? TRUE : FALSE;
-#ifdef HAVE_MMAP
// If the user is allocating a large piece of memory from a non-derived
// heap that is also not the runtime statistics shared memory segment,
// then allocate a NABlock using mmap(). This prevents any changes
@@ -3222,7 +3015,6 @@ void * NAHeap::allocateHeapMemory(size_t userSize, NABoolean failureIsFatal)
}
// Fall through and try to allocate the regular way.
}
-#endif // HAVE_MMAP
if (additionalUserSize <= MAX_SMALL_REQUEST) {
@@ -3474,12 +3266,8 @@ void NAHeap::deallocateHeapMemory(void* addr)
assert(type_ != NO_MEMORY_TYPE);
-#if defined(NA_LINUX) && !defined(__EID)
NAMutex mutex(threadSafe_, &mutex_);
-#endif
-
-#if !defined(STAND_ALONE) && (defined(__TANDEM) || defined(NA_LINUX)) && !defined(__EID)
-
+
if (getSharedMemory() || (parent_ && parent_->getType() == EXECUTOR_MEMORY &&
parent_->getSegGlobals() != NULL &&
parent_->getSegGlobals()->getFirstSegId() == getStatsSegmentId()))
@@ -3488,7 +3276,6 @@ void NAHeap::deallocateHeapMemory(void* addr)
if (! checkIfRTSSemaphoreLocked())
NAExit(1);
}
-#endif
HEAPLOG_DELETE_ENTRY(addr, heapID_.heapNum)
@@ -3534,12 +3321,10 @@ void NAHeap::deallocateHeapMemory(void* addr)
deallocTraceIndex = i;
}
-#ifdef HAVE_MMAP
if (p->isMMapped()) {
deallocateFreeBlock(p);
return;
}
-#endif // HAVE_MMAP
// Get a pointer to the next fragment
NAHeapFragment *next = p->fragmentPlusOffset(psize);
@@ -3660,12 +3445,10 @@ void NAHeap::deallocateHeapMemory(void* addr)
#endif // !MUSE
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
void NAHeap::dumpHeapInfo(ostream* outstream, Lng32 indent)
{
-#if defined(NA_LINUX) && !defined(__EID)
NAMutex mutex(threadSafe_, &mutex_);
-#endif
char ind[100];
@@ -3696,7 +3479,6 @@ void NAHeap::dumpHeapInfo(ostream* outstream, Lng32 indent)
MemoryStats freeStats;
MemoryStats allocStats;
-#ifndef STAND_ALONE
NABlock * p = firstBlk_;
while (p) {
p->dump(outstream, debugLevel_, freeStats, allocStats, top_, indent);
@@ -3719,9 +3501,8 @@ void NAHeap::dumpHeapInfo(ostream* outstream, Lng32 indent)
derivedHeap->dump(outstream, indent + 2);
derivedHeap = derivedHeap->nextEntry_;
}
-#endif // !STAND_ALONE
}
-#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) ...
+#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG)) ...
//////////////////////////////////////////////////////////////////////////////
@@ -3729,7 +3510,7 @@ void NAHeap::dumpHeapInfo(ostream* outstream, Lng32 indent)
// NABlock methods
// ---------------------------------------------------------------------------
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
void NABlock::dump(ostream* outstream,
Lng32 debugLevel,
MemoryStats& freeStats,
@@ -3765,11 +3546,10 @@ void NABlock::dump(ostream* outstream,
q = q->nextFragment();
}
}
-#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) ...
+#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG)) ...
//////////////////////////////////////////////////////////////////////////////
-#ifndef __EID
MemoryStats::MemoryStats()
: count_(0),
sum_(0.0),
@@ -3797,7 +3577,7 @@ void MemoryStats::addEntry(size_t value)
histBuckets_[i]++;
}
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
void MemoryStats::dump(ostream* outstream, const char * name, Lng32 indent)
{
char ind[100];
@@ -3834,17 +3614,15 @@ void MemoryStats::dump(ostream* outstream, const char * name, Lng32 indent)
<< " : " << histBuckets_[17] << endl;
}
-#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
-#endif // #ifndef __EID
+#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG))
// -------------------- Debugging Support ---------------------------
-#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) ) && !defined(__EID)
+#if ( defined(_DEBUG) || defined(NSK_MEMDEBUG) )
// The below values are used for buffer overflow detection. Lookup
// tables are used so that the logic for checking the remaining
// bytes in a word can be very quick.
-#ifndef STAND_ALONE
const UInt32 buf_overflow_val = 0xF2F2F2F2;
#ifdef NA_LITTLE_ENDIAN
const UInt32 overflow_mask[4] = { 0, 0xFFFFFF00, 0xFFFF0000, 0xFF000000 };
@@ -3853,7 +3631,6 @@ const UInt32 overflow_val[4] = { 0, 0xF2F2F200, 0xF2F20000, 0xF2000000 };
const UInt32 overflow_mask[4] = { 0, 0xFFFFFF, 0xFFFF, 0xFF };
const UInt32 overflow_val[4] = { 0, 0xF2F2F2, 0xF2F2, 0xF2 };
#endif
-#endif // !STAND_ALONE
// doAllocDebugProcess() is called with debugLevel_ is set to at
// least 1. It resets newly allocated memory to a 0xfafafafa. On
@@ -3861,7 +3638,6 @@ const UInt32 overflow_val[4] = { 0, 0xF2F2F2, 0xF2F2, 0xF2 };
// information to indicate whether the end of the buffer has been
// overwritten and saves the last 10 levels of the stack frame.
-// LCOV_EXCL_START
void
NAHeap::doAllocDebugProcess(NAHeapFragment *p, size_t userSize)
{
@@ -3869,7 +3645,6 @@ NAHeap::doAllocDebugProcess(NAHeapFragment *p, size_t userSize)
// Disabled for now, see Todo 1)
// memset(p->getMemory(), 0xfa, userSize);
-#ifndef STAND_ALONE
if (debugLevel_ == 2 && p->fragmentSize() < INT_MAX) {
// Determine location that the user requested size is stored
@@ -3895,31 +3670,25 @@ NAHeap::doAllocDebugProcess(NAHeapFragment *p, size_t userSize)
*userSizePtr = (UInt32) userSize;
}
-#endif // !STAND_ALONE
}
-// LCOV_EXCL_STOP
// doDeallocDebugProcess() resets the deallocated memory to
// a 0xfdfdfdfd. This function is only called when debugLevel_ is
// at set to at least 1.
-// LCOV_EXCL_START
void
NAHeap::doDeallocDebugProcess(NAHeapFragment *p)
{
-#ifndef STAND_ALONE
if (debugLevel_ == 2 && p->fragmentSize() < INT_MAX) {
- // Check for buffer overflows (if not STAND_ALONE)
+ // Check for buffer overflows
p->checkBufferOverflow();
}
-#endif
// Reset the user memory to a 0xfdfdfdfd pattern.
// size_t userSize = p->fragmentSize() - sizeof(size_t);
// Disabled for now, see Todo 1)
// memset(p->getMemory(), 0xfd, userSize);
}
-// LCOV_EXCL_STOP
// Check properties of any fragment, whether free, inuse, etc.
void
@@ -4198,15 +3967,11 @@ NAHeap::traverseAndCheck()
if (s->isExternSegment()) {
assert(!q->getFirstFragmentBit());
} else {
-#ifdef HAVE_MMAP
if (s->isMMapped()) {
assert(q->getFirstFragmentBit() || q->isMMapped());
} else {
assert(q->getFirstFragmentBit());
}
-#else
- assert(q->getFirstFragmentBit());
-#endif
}
NAHeapFragment *lastq = NULL;
@@ -4229,9 +3994,7 @@ NAHeap::traverseAndCheck()
if (q->isFencePost())
break;
assert(!q->getFirstFragmentBit());
-#ifdef HAVE_MMAP
assert(!q->isMMapped());
-#endif // HAVE_MMAP
}
s = (NABlock*)s->next_;
}
@@ -4240,8 +4003,6 @@ NAHeap::traverseAndCheck()
return sum;
}
-#ifndef STAND_ALONE
-// LCOV_EXCL_START
void
NAHeapFragment::checkBufferOverflow()
{
@@ -4284,10 +4045,8 @@ NAHeap::checkForOverflow()
bp = bp->next_;
}
}
-// LCOV_EXCL_STOP
-#endif // !STAND_ALONE
-#endif // ( defined(_DEBUG) || defined(NSK_MEMDEBUG) ) && !defined(__EID)
+#endif // ( defined(_DEBUG) || defined(NSK_MEMDEBUG) )
#ifdef _DEBUG
void
@@ -4316,7 +4075,6 @@ NAHeap::setAllocTrace()
// methods for class DefaultIpcHeap
// -----------------------------------------------------------------------
-// LCOV_EXCL_START
// This object is allocated on either global or a passed-in heap.
// Its dstr (defined here) is never explicitly called.
DefaultIpcHeap::~DefaultIpcHeap()
@@ -4328,7 +4086,6 @@ void DefaultIpcHeap::destroy()
// This class can't delete anything because it doesn't keep track of
// any of its allocations.
}
-// LCOV_EXCL_STOP
void * DefaultIpcHeap::allocateIpcHeapMemory(size_t size, NABoolean failureIsFatal)
{
@@ -4352,14 +4109,12 @@ void DefaultIpcHeap::deallocateIpcHeapMemory(void * buffer)
::operator delete(buffer);
}
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
-// LCOV_EXCL_START
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
void DefaultIpcHeap::dumpIpcHeapInfo(ostream* outstream, Lng32 indent)
{
// This class doesn't keep track of anything so it can't dump anything
// useful.
}
-// LCOV_EXCL_STOP
#endif
// Release unused memory in the heap back to kernel. This will help
@@ -4373,7 +4128,6 @@ void NAHeapFragment::releaseFreePages(NAHeapFragment *prev,
SEG_ID gStatsSegmentId_ = -1;
#define RMS_SEGMENT_ID_OFFSET 0x10000000
-#if ((defined(NA_NSK) || defined (NA_LINUX)) && (!defined(__EID)))
SEG_ID getStatsSegmentId()
{
@@ -4387,4 +4141,3 @@ SEG_ID getStatsSegmentId()
}
return gStatsSegmentId_;
}
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/NAMemory.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NAMemory.h b/core/sql/common/NAMemory.h
index b2e1c4f..609e936 100644
--- a/core/sql/common/NAMemory.h
+++ b/core/sql/common/NAMemory.h
@@ -46,30 +46,16 @@
// for release and debug builds to prevent corruption
// of the shared memory segment used by runtime stats.
-#if (defined(NA_LINUX) && !defined(__EID))
#include <stdio.h>
-#endif
-#ifdef STAND_ALONE
-#define NA_EIDPROC
-#define TRUE 1
-#define NABoolean bool
-#endif
-
-#ifndef STAND_ALONE
#include "NABasicObject.h"
-#endif
-#ifndef STAND_ALONE
#include "Platform.h"
#include "NAStringDefGlobals.h"
-#endif
#include <stddef.h>
#include <setjmp.h>
-#ifndef STAND_ALONE
#include "NAError.h"
#include "HeapID.h"
-#endif
#ifdef _DEBUG
// forward declaration
@@ -77,21 +63,18 @@ template <class T> class NAList;
#define LIST(Type) NAList<Type>
#endif // _DEBUG
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID)
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
#ifdef NA_STD_NAMESPACE
#include <iosfwd>
using namespace std;
#else
class ostream;
#endif
-#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID)
+#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG))
#include <unistd.h>
#include <sys/types.h>
typedef uid_t SEG_ID;
-#if !defined(__EID) && (defined(NA_LINUX) || defined(NA_WINNT))
-#define HAVE_MMAP 1
-#endif
// contents of this file:
class NAMemory;
@@ -106,13 +89,12 @@ class SegmentStatus;
// MemoryStats is used for dynamically allocated statistics (when MEMDEBUG=1 or higher)
// and if NAHeap::dump() is called.
-#ifndef __EID
class MemoryStats {
public:
MemoryStats();
void addEntry(size_t value);
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
void dump(ostream* outstream, const char* name, Lng32 indent);
#endif
private:
@@ -127,7 +109,6 @@ private:
// 16 - all objects <= 2 MB
// 17 - all objects > 2 MB
};
-#endif
////////////////////////////////////////////////////////////////////////////
// One NASegGlobals object exists in the executor as a member variable
@@ -160,7 +141,6 @@ public:
return 0;
}
-NA_EIDPROC
short getSegInfo(Lng32 index, void **startAddr) const
{
*startAddr = startAddresses_[index];
@@ -234,29 +214,20 @@ public:
NABlock * next_; // next block in chain
UInt32 sflags_; // "extern" and future other flags
-NA_EIDPROC
NABoolean blockHolds(void *addr);
-NA_EIDPROC
static NABlock *blockHolding(NABlock *firstBlock, void *addr);
-NA_EIDPROC
NABoolean isExternSegment();
-#ifdef HAVE_MMAP
-NA_EIDPROC
NABoolean isMMapped();
-#endif // HAVE_MMAP
-NA_EIDPROC
size_t firstFragmentOffset();
-NA_EIDPROC
NAHeapFragment* alignAsFragment();
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
// LCOV_EXCL_START
-NA_EIDPROC
void dump(ostream* outstream,
Lng32 debugLevel,
MemoryStats& freeStats,
@@ -266,7 +237,6 @@ void dump(ostream* outstream,
// LCOV_EXCL_STOP
#endif
-NA_EIDPROC
NABlock();
private:
@@ -277,11 +247,7 @@ private:
// NAMemory is an abstract base class. NAHeap and Space/NASpace are derived
// from it.
////////////////////////////////////////////////////////////////////////////
-#ifndef STAND_ALONE
class NAMemory : public NABasicObject {
-#else
-class NAMemory {
-#endif
friend class NAHeap;
friend class ExMemStats; // Class used in muse
friend class ExHeapStats; // Class used in muse
@@ -292,7 +258,6 @@ public:
// memory type NT/UNIX NSK
// -----------------------------------------------------------------------
- // DP2_MEMORY regular memory memory maintained by DP2
// EXECUTOR_MEMORY regular memory selectable segment used in the
// master. This is a priv
// segment.
@@ -316,7 +281,6 @@ public:
// SYSTEM_MEMORY/IPC segment ids in the NASegGlobals object.
enum NAMemoryType {
NO_MEMORY_TYPE = 0,
- DP2_MEMORY = 1,
EXECUTOR_MEMORY = 2,
SYSTEM_MEMORY = 3,
DERIVED_MEMORY = 4,
@@ -340,19 +304,16 @@ public:
};
// default constructor. Initializes the memory to NO_MEMORY_TYPE.
-NA_EIDPROC
NAMemory(const char * name = NULL);
- // a basic (OS depended) memory. type is one of DP2_MEMORY,
- // or SYSTEM_MEMORY. DERIVED_MEMORY is not allowed as basic memory.
-NA_EIDPROC
+ // a basic (OS depended) memory. type is one of
+ // SYSTEM_MEMORY. DERIVED_MEMORY is not allowed as basic memory.
NAMemory(const char * name, NAMemoryType type, size_t blockSize,
size_t upperLimit);
// an NAMemory of type EXECUTOR_MEMORY that uses a first flat segment
// that is allocated by the caller (on NSK, uses malloc on NT and ignores
// the parameters after the first one)
-NA_EIDPROC
NAMemory(const char * name,
SEG_ID extFirstSegId,
void * extFirstSegStart,
@@ -363,154 +324,106 @@ NA_EIDPROC
Lng32 extMaxSecSegCount = NASegGlobals::NA_MAX_SECONDARY_SEGS);
// DERIVED_MEMORY
-NA_EIDPROC
NAMemory(const char * name, NAHeap * parent, size_t blockSize,
size_t upperLimit);
-NA_EIDPROC
~NAMemory();
-NA_EIDPROC
void reInitialize();
-NA_EIDPROC
void setType(NAMemoryType type,
Lng32 blockSize = 0);
-NA_EIDPROC
Lng32 getAllocatedSpaceSize();
// This method takes and returns the same arguments as an "operator new".
// It is used to allocate arrays(!!) of the collected object(type T).
-NA_EIDPROC
void * allocateMemory(size_t size, NABoolean failureIsFatal = TRUE);
// This method takes and returns the same arguments as an "operator delete".
// It is used to deallocate the above arrays.
-NA_EIDPROC
void deallocateMemory(void * addr);
// this method is used to set the upper limit - currently only used for testing
// setjmp and longjmp
-NA_EIDPROC
void setUpperLimit ( size_t newUpperLimit ) { upperLimit_ = newUpperLimit; };
// these four methods used to reside in class CollHeap
-NA_EIDPROC
void setJmpBuf( jmp_buf *newJmpBuf );
-NA_EIDPROC
inline jmp_buf * getJmpBuf() { return heapJumpBuf_; }
-NA_EIDPROC
inline NABoolean getWasMemoryExhausted() { return exhaustedMem_; }
-NA_EIDPROC
void logAllocateError(short error, SEG_ID segmentId, Lng32 blockSize, short errorDetail);
-NA_EIDPROC
void handleExhaustedMemory();
-#ifndef STAND_ALONE
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID)
-NA_EIDPROC
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
void dump(ostream* outstream, Lng32 indent);
#else
-NA_EIDPROC
inline void dump(void* outstream, Lng32 indent) {}
#endif
-#endif // !STAND_ALONE
-NA_EIDPROC
void incrementStats(size_t size);
-NA_EIDPROC
void decrementStats(size_t size);
-#ifndef __EID
- NA_EIDPROC
void showStats(ULng32 level = 0);
-#endif
-NA_EIDPROC
inline size_t getTotalSize() {return totalSize_;};
-NA_EIDPROC
inline size_t getIncrementSize() {return incrementSize_;};
-NA_EIDPROC
inline size_t getInitialSize() {return initialSize_;};
-NA_EIDPROC
inline NAHeap* getParent() {return parent_;};
-NA_EIDPROC
inline size_t getAllocSize() {return allocSize_;};
-NA_EIDPROC
inline size_t getAllocCnt() {return allocCnt_;};
-NA_EIDPROC
inline size_t getHighWaterMark() {return highWaterMark_;};
-NA_EIDPROC
inline size_t getIntervalWaterMark() {return intervalWaterMark_;};
-NA_EIDPROC
inline void resetIntervalWaterMark() { intervalWaterMark_ = allocSize_;};
-NA_EIDPROC
inline NASegGlobals * getSegGlobals() { return segGlobals_; }
-NA_EIDPROC
char *getName() { return name_; }
-NA_EIDPROC
NAMemoryType getType() { return type_; }
-NA_EIDPROC
NABoolean getUsage(size_t* lastSegSize, size_t* freeSize, size_t* totalSize);
// for debugging
-NA_EIDPROC
NABoolean containsAddress(void *addr)
{ return NABlock::blockHolding(firstBlk_, addr) != NULL; }
- // #ifdef NA_WINNT
-#ifndef __EID
NABoolean getSharedMemory() { return sharedMemory_; }
void setSharedMemory() { sharedMemory_ = TRUE; }
-#endif
NABoolean isComSpace(void) { return derivedClass_ == COMSPACE_CLASS; } ;
protected:
// set the name of this memory
-NA_EIDPROC
void setName(const char * name);
// put child on memoryList_
-NA_EIDPROC
void registerMemory(NAMemory * child);
// remove child from memoryList_
-NA_EIDPROC
void unRegisterMemory(NAMemory * child);
-NA_EIDPROC
void sysFreeBlock(NABlock *blk);
-#ifdef HAVE_MMAP
-NA_EIDPROC
NABlock* allocateMMapBlock(size_t size);
void deallocateMMapBlock(NABlock *blk);
-#endif // HAVE_MMAP
-#if (defined(NA_LINUX) && !defined(__EID))
Lng32 getVmSize();
void allocationIncrement(Lng32 size);
void allocationDecrement(Lng32 size);
-#endif // NA_LINUX
private:
// these ctors make no sense at all -- should never be used
NAMemory (const NAMemory &) ; // not written
@@ -566,11 +479,8 @@ protected:
jmp_buf *heapJumpBuf_; // Setjmp() buffer for handing memory failures
NABoolean exhaustedMem_; // Set to true if cannot satisfy memory request
unsigned short errorsMask_; // SEGMENT_ALLOCATE_ errors that have occurred
-#ifndef STAND_ALONE
HeapID heapID_; // For tracking leaks. (eric)
-#endif
Int64 crowdedTotalSize_; // Total size at which memory pressure seen
-#ifndef __EID
Int64 allocationDelta_; // Change in memory size since last check of VmSize
FILE* procStatusFile_; // FILE pointer for "reading" process status
Lng32 executorVmReserveSize_; // Size in MB of VM safety net
@@ -578,10 +488,8 @@ protected:
Int32 munmapErrno_;
Lng32 lastVmSize_;
Lng32 maxVmSize_;
-#endif // __EID
DerivedClass derivedClass_; // The derived class (removes virtual functions)
public:
-#ifndef STAND_ALONE
// ---------------------------------------------------------------------
// The following method and data member are needed for minimizing
// NAString's memory usage -- each heap needs to maintain a
@@ -591,26 +499,20 @@ public:
// See NAStringDef.h/.cpp for a complete explanation of why this
// dependence on NAString code is necessary.
// ---------------------------------------------------------------------
-NA_EIDPROC
NAStringRef * nullNAStringRef()
// NB: the fudge-factor ("3") below is probably no longer necessary ...
{ return (NAStringRef*) ( (&nullNAStringRep_[3]) ) ; }
protected:
Lng32 nullNAStringRep_[(sizeof(NAStringRef)+1)/sizeof(Lng32)+1+4] ; // +4 for good luck :-)
-#endif
-#ifndef __EID
NABoolean sharedMemory_;
-#endif
// ---------------------------------------------------------------------
private:
-#ifndef PRIV_SRL
// the PRIV SRL will add a vtbl pointer for NAMemory because it
// will see NABasicObject as an object without virtual functions.
// Add this filler for the non-priv code so NAMemory will have
// the same length for both PRIV and non-PRIV code.
Lng32 fillerForVtblPtr_;
-#endif
};
@@ -639,17 +541,13 @@ public:
// see the corresponding NAMemory constructors for an explanation
-NA_EIDPROC
NAHeap();
-NA_EIDPROC
NAHeap(const char * name,
NAHeap * parent,
Lng32 blockSize = 0,
Lng32 upperLimit =0);
-NA_EIDPROC
NAHeap(const char * name, NAMemoryType type = DERIVED_FROM_SYS_HEAP,
Lng32 blockSize = 0, Lng32 upperLimit = 0);
-NA_EIDPROC
NAHeap(const char * name,
SEG_ID extFirstSegId,
void * extFirstSegStart,
@@ -658,39 +556,29 @@ NA_EIDPROC
Lng32 extFirstSegMaxLen,
NASegGlobals *segGlobals,
Lng32 extMaxSecSegCount = NASegGlobals::NA_MAX_SECONDARY_SEGS);
-NA_EIDPROC
~NAHeap();
-NA_EIDPROC
void destroy();
-NA_EIDPROC
void reInitializeHeap();
-NA_EIDPROC
void * allocateHeapMemory(size_t userSize, NABoolean failureIsFatal = TRUE);
-NA_EIDPROC
void deallocateHeapMemory(void * addr);
-NA_EIDPROC
void * allocateAlignedHeapMemory(size_t userSize, size_t alignment, NABoolean failureIsFatal = TRUE);
-NA_EIDPROC
void setErrorCallback(void (*errCallback)(NAHeap*,size_t));
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
- NA_EIDPROC void dumpHeapInfo(ostream* outstream, Lng32 indent);
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
+ void dumpHeapInfo(ostream* outstream, Lng32 indent);
#endif
-#if defined(NA_LINUX) && !defined(__EID)
// setThreadSafe must be called by the thread that creates the heap
// before other threads use it
void setThreadSafe();
const inline bool getThreadSafe() { return threadSafe_; }
-#endif
#ifdef _DEBUG
LIST(TrafAddrStack *) *getSAL() { return la_; }
#endif // _DEBUG
private:
-NA_EIDPROC
NABlock* allocateBlock(size_t size, NABoolean failureIsFatal);
binmap_t smallmap_; // Bitmap of small bins
@@ -725,18 +613,15 @@ NA_EIDPROC
// are 2 equally spaced treebins for each power
// of two from TREE_SHIFT to TREE_SHIFT+16.
// The last bin holds anything larger.
-#ifndef __EID
+
MemoryStats dynamicAllocs; // Statistics about memory allocations
-#endif
void (*errCallback_)(NAHeap*, size_t); // Pointer to a function that
// will be called when an error occurs. The
// function can log the error or handle the
// error in an appropriate way.
-#if defined(NA_LINUX) && !defined(__EID)
bool threadSafe_; // Heao is thread safe
pthread_mutex_t mutex_; // Mutex to serialize thread safe access
-#endif
#ifdef _DEBUG
LIST(TrafAddrStack *) *la_; // List of back traces when centain size
@@ -745,94 +630,92 @@ NA_EIDPROC
public:
// Operations from Doug Lea's malloc implementation
- NA_EIDPROC static NABoolean isSmall(size_t size);
- NA_EIDPROC static bindex_t smallIndex(size_t size);
- NA_EIDPROC static size_t smallIndex2Size(bindex_t idx);
+ static NABoolean isSmall(size_t size);
+ static bindex_t smallIndex(size_t size);
+ static size_t smallIndex2Size(bindex_t idx);
- NA_EIDPROC static bindex_t computeTreeIndex(size_t size);
- NA_EIDPROC static size_t minsizeForTreeIndex(bindex_t idx);
+ static bindex_t computeTreeIndex(size_t size);
+ static size_t minsizeForTreeIndex(bindex_t idx);
- NA_EIDPROC void releaseFreePages(); // release deallocted pages to kernel
+ void releaseFreePages(); // release deallocted pages to kernel
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID)
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
// useful method for debugging buffer overruns; sprinkle your code
// with calls to this in order to narrow down where a buffer overrun
// is occurring
- NA_EIDPROC void doCheckMallocState();
-#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID)
+ void doCheckMallocState();
+#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG))
private:
- NA_EIDPROC static NABoolean isAligned(void *a);
- NA_EIDPROC static size_t granularityAlign(size_t size);
+ static NABoolean isAligned(void *a);
+ static size_t granularityAlign(size_t size);
- NA_EIDPROC NABoolean okAddress(void *addr);
- NA_EIDPROC static NABoolean okNext(NAHeapFragment *p, NAHeapFragment *n);
- NA_EIDPROC static NABoolean okCinuse(NAHeapFragment *p);
- NA_EIDPROC static NABoolean okPinuse(NAHeapFragment *p);
+ NABoolean okAddress(void *addr);
+ static NABoolean okNext(NAHeapFragment *p, NAHeapFragment *n);
+ static NABoolean okCinuse(NAHeapFragment *p);
+ static NABoolean okPinuse(NAHeapFragment *p);
- NA_EIDPROC static binmap_t idx2bit(bindex_t idx);
- NA_EIDPROC static bindex_t bit2idx(binmap_t x);
+ static binmap_t idx2bit(bindex_t idx);
+ static bindex_t bit2idx(binmap_t x);
- NA_EIDPROC void markSmallmap(bindex_t idx);
- NA_EIDPROC void clearSmallmap(bindex_t idx);
- NA_EIDPROC NABoolean smallmapIsMarked(bindex_t idx);
+ void markSmallmap(bindex_t idx);
+ void clearSmallmap(bindex_t idx);
+ NABoolean smallmapIsMarked(bindex_t idx);
- NA_EIDPROC void markTreemap(bindex_t idx);
- NA_EIDPROC void clearTreemap(bindex_t idx);
- NA_EIDPROC NABoolean treemapIsMarked(bindex_t idx);
+ void markTreemap(bindex_t idx);
+ void clearTreemap(bindex_t idx);
+ NABoolean treemapIsMarked(bindex_t idx);
- NA_EIDPROC static binmap_t leftBits(binmap_t bits);
- NA_EIDPROC static binmap_t leastBit(binmap_t bits);
+ static binmap_t leftBits(binmap_t bits);
+ static binmap_t leastBit(binmap_t bits);
- NA_EIDPROC static UInt32 leftshiftForTreeIndex(bindex_t idx);
+ static UInt32 leftshiftForTreeIndex(bindex_t idx);
- NA_EIDPROC NAHeapFragment* smallbinAt(bindex_t idx);
- NA_EIDPROC NATreeFragment** treebinAt(bindex_t idx);
+ NAHeapFragment* smallbinAt(bindex_t idx);
+ NATreeFragment** treebinAt(bindex_t idx);
- NA_EIDPROC void initBins();
+ void initBins();
- NA_EIDPROC void insertSmallFragment(NAHeapFragment *p, size_t size);
- NA_EIDPROC void unlinkSmallFragment(NAHeapFragment *p, size_t size);
- NA_EIDPROC void unlinkFirstSmallFragment(NAHeapFragment *b,
+ void insertSmallFragment(NAHeapFragment *p, size_t size);
+ void unlinkSmallFragment(NAHeapFragment *p, size_t size);
+ void unlinkFirstSmallFragment(NAHeapFragment *b,
NAHeapFragment *p, bindex_t idx);
- NA_EIDPROC void insertLargeFragment(NATreeFragment *p, size_t size);
- NA_EIDPROC void unlinkLargeFragment(NATreeFragment *p);
-
- NA_EIDPROC void insertFragment(NAHeapFragment *p, size_t size);
- NA_EIDPROC void unlinkFragment(NAHeapFragment *p, size_t size);
-
- NA_EIDPROC void replaceDV(NAHeapFragment *p, size_t size);
-
- NA_EIDPROC void resizeTop(size_t newsize);
- NA_EIDPROC void initTop(NABlock *block);
- NA_EIDPROC void addBlock(NABlock* newBlock);
-
- NA_EIDPROC NABoolean deallocateFreeBlock(NAHeapFragment *p);
-
- NA_EIDPROC NAHeapFragment *tmallocLarge(size_t nb);
- NA_EIDPROC NAHeapFragment *tmallocSmall(size_t nb);
-
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID)
- NA_EIDPROC void doAllocDebugProcess(NAHeapFragment *p, size_t userSize);
- NA_EIDPROC void doDeallocDebugProcess(NAHeapFragment *p);
- NA_EIDPROC void doCheckAnyFragment(NAHeapFragment *p);
- NA_EIDPROC void doCheckTopFragment(NAHeapFragment *p);
- NA_EIDPROC void doCheckInuseFragment(NAHeapFragment *p);
- NA_EIDPROC void doCheckFreeFragment(NAHeapFragment *p);
- NA_EIDPROC void doCheckMallocedFragment(NAHeapFragment *p, size_t s);
- NA_EIDPROC void doCheckTree(NATreeFragment *t);
- NA_EIDPROC void doCheckTreebin(bindex_t i);
- NA_EIDPROC void doCheckSmallbin(bindex_t i);
- NA_EIDPROC NABoolean binFind(NAHeapFragment *x);
- NA_EIDPROC size_t traverseAndCheck();
-#ifndef STAND_ALONE
- NA_EIDPROC void checkForOverflow();
-#endif // STAND_ALONE
-#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID)
+ void insertLargeFragment(NATreeFragment *p, size_t size);
+ void unlinkLargeFragment(NATreeFragment *p);
+
+ void insertFragment(NAHeapFragment *p, size_t size);
+ void unlinkFragment(NAHeapFragment *p, size_t size);
+
+ void replaceDV(NAHeapFragment *p, size_t size);
+
+ void resizeTop(size_t newsize);
+ void initTop(NABlock *block);
+ void addBlock(NABlock* newBlock);
+
+ NABoolean deallocateFreeBlock(NAHeapFragment *p);
+
+ NAHeapFragment *tmallocLarge(size_t nb);
+ NAHeapFragment *tmallocSmall(size_t nb);
+
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
+ void doAllocDebugProcess(NAHeapFragment *p, size_t userSize);
+ void doDeallocDebugProcess(NAHeapFragment *p);
+ void doCheckAnyFragment(NAHeapFragment *p);
+ void doCheckTopFragment(NAHeapFragment *p);
+ void doCheckInuseFragment(NAHeapFragment *p);
+ void doCheckFreeFragment(NAHeapFragment *p);
+ void doCheckMallocedFragment(NAHeapFragment *p, size_t s);
+ void doCheckTree(NATreeFragment *t);
+ void doCheckTreebin(bindex_t i);
+ void doCheckSmallbin(bindex_t i);
+ NABoolean binFind(NAHeapFragment *x);
+ size_t traverseAndCheck();
+ void checkForOverflow();
+#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG))
#ifdef _DEBUG
- NA_EIDPROC void setAllocTrace();
+ void setAllocTrace();
#endif // _DEBUG
};
@@ -972,56 +855,54 @@ private:
class NAHeapFragment {
public:
- NA_EIDPROC void *getMemory(NABoolean cleanUpPrevNext=FALSE);
- NA_EIDPROC static NAHeapFragment *memToFragment(void *mem);
-
- NA_EIDPROC NABoolean cinuse();
- NA_EIDPROC NABoolean pinuse();
- NA_EIDPROC NABoolean cpinuse();
- NA_EIDPROC size_t fragmentSize();
- NA_EIDPROC void clearCinuse();
- NA_EIDPROC void clearPinuse();
-
- NA_EIDPROC void initializeFirstFragment(size_t s);
- NA_EIDPROC size_t getFirstFragmentBit();
- NA_EIDPROC void setHeadBits(size_t bits);
- NA_EIDPROC NABoolean occupiesCompleteNABlock();
-
- NA_EIDPROC const size_t* getHeadAddr();
- NA_EIDPROC void setNext(NAHeapFragment *next);
- NA_EIDPROC void setPrev(NAHeapFragment *prev);
- NA_EIDPROC NAHeapFragment* getNext();
- NA_EIDPROC NAHeapFragment* getPrev();
- NA_EIDPROC size_t getPrevFoot();
- NA_EIDPROC void adjustBlockSize(Lng32 s);
- NA_EIDPROC NAHeapFragment *fragmentPlusOffset(size_t s);
- NA_EIDPROC NAHeapFragment *fragmentMinusOffset(size_t s);
- NA_EIDPROC NAHeapFragment *nextFragment();
- NA_EIDPROC NAHeapFragment *prevFragment();
- NA_EIDPROC NABoolean nextPinuse();
- NA_EIDPROC void setFoot(size_t s);
- NA_EIDPROC void setSizeAndPinuseOfFreeFragment(size_t s);
- NA_EIDPROC void setFreeWithPinuse(size_t s, NAHeapFragment *next);
- NA_EIDPROC void setInuseAndPinuse(size_t s);
- NA_EIDPROC void setSize(size_t s);
- NA_EIDPROC void setSizeAndPinuse(size_t s);
- NA_EIDPROC void setSizeAndPinuseOfInuseFragment(size_t s);
-
- NA_EIDPROC NABoolean isFencePost();
- NA_EIDPROC void setFencePosts();
-
-#ifdef HAVE_MMAP
- NA_EIDPROC NABoolean isMMapped();
- NA_EIDPROC void setSizeOfMMapFragment(size_t s);
-#endif
+ void *getMemory(NABoolean cleanUpPrevNext=FALSE);
+ static NAHeapFragment *memToFragment(void *mem);
+
+ NABoolean cinuse();
+ NABoolean pinuse();
+ NABoolean cpinuse();
+ size_t fragmentSize();
+ void clearCinuse();
+ void clearPinuse();
+
+ void initializeFirstFragment(size_t s);
+ size_t getFirstFragmentBit();
+ void setHeadBits(size_t bits);
+ NABoolean occupiesCompleteNABlock();
+
+ const size_t* getHeadAddr();
+ void setNext(NAHeapFragment *next);
+ void setPrev(NAHeapFragment *prev);
+ NAHeapFragment* getNext();
+ NAHeapFragment* getPrev();
+ size_t getPrevFoot();
+ void adjustBlockSize(Lng32 s);
+ NAHeapFragment *fragmentPlusOffset(size_t s);
+ NAHeapFragment *fragmentMinusOffset(size_t s);
+ NAHeapFragment *nextFragment();
+ NAHeapFragment *prevFragment();
+ NABoolean nextPinuse();
+ void setFoot(size_t s);
+ void setSizeAndPinuseOfFreeFragment(size_t s);
+ void setFreeWithPinuse(size_t s, NAHeapFragment *next);
+ void setInuseAndPinuse(size_t s);
+ void setSize(size_t s);
+ void setSizeAndPinuse(size_t s);
+ void setSizeAndPinuseOfInuseFragment(size_t s);
+
+ NABoolean isFencePost();
+ void setFencePosts();
+
+ NABoolean isMMapped();
+ void setSizeOfMMapFragment(size_t s);
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
- NA_EIDPROC void checkBufferOverflow();
-#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
+ void checkBufferOverflow();
+#endif // (defined(_DEBUG) || defined(NSK_MEMDEBUG))
- NA_EIDPROC void cleanFreePages(size_t fragSize); // mark free pages as "clean".
+ void cleanFreePages(size_t fragSize); // mark free pages as "clean".
// Release unused/free memory in the heap back to the kernel
- NA_EIDPROC void releaseFreePages(NAHeapFragment *prev,
+ void releaseFreePages(NAHeapFragment *prev,
NAHeapFragment *next,
Int32 mergeFlags);
@@ -1030,11 +911,7 @@ private:
PINUSE_BIT = 1, // Previous fragment is in use
CINUSE_BIT = 2, // Current fragment is in use
MMAPPED_BIT = 4, // This NABlock was allocated with MMAP and contains a single fragment.
-#ifdef NA_64BIT
FIRST_FRAGMENT_BIT = 0x8000000000000000, // First fragment in NABlock
-#else
- FIRST_FRAGMENT_BIT = 0x80000000, // First fragment in NABlock
-#endif
INUSE_BITS = (PINUSE_BIT|CINUSE_BIT),
FENCEPOST_HEAD = (INUSE_BITS|sizeof(size_t))
};
@@ -1118,19 +995,19 @@ private:
class NATreeFragment : public NAHeapFragment {
public:
- NA_EIDPROC NATreeFragment* getChild(UInt32 childNo);
- NA_EIDPROC NATreeFragment** getChildAddr(UInt32 childNo);
- NA_EIDPROC NATreeFragment* leftmostChild();
- NA_EIDPROC void setChild(Int32 childNo, NATreeFragment *p);
- NA_EIDPROC NATreeFragment* getParent();
- NA_EIDPROC void setParent(NATreeFragment *p);
- NA_EIDPROC NAHeap::bindex_t getIndex();
- NA_EIDPROC void setIndex(NAHeap::bindex_t idx);
- NA_EIDPROC short getFreedNSKMemory();
- NA_EIDPROC void setFreedNSKMemory(short value);
-
- NA_EIDPROC void recurseFreeMemory();
- NA_EIDPROC void releaseFreePages();
+ NATreeFragment* getChild(UInt32 childNo);
+ NATreeFragment** getChildAddr(UInt32 childNo);
+ NATreeFragment* leftmostChild();
+ void setChild(Int32 childNo, NATreeFragment *p);
+ NATreeFragment* getParent();
+ void setParent(NATreeFragment *p);
+ NAHeap::bindex_t getIndex();
+ void setIndex(NAHeap::bindex_t idx);
+ short getFreedNSKMemory();
+ void setFreedNSKMemory(short value);
+
+ void recurseFreeMemory();
+ void releaseFreePages();
private:
// The first four fields are in NAHeapFragment:
@@ -1152,26 +1029,18 @@ private:
class DefaultIpcHeap : public CollHeap
{
public:
-NA_EIDPROC
DefaultIpcHeap() { derivedClass_= DEFAULTIPCHEAP_CLASS; }
-NA_EIDPROC
void * allocateIpcHeapMemory(size_t size, NABoolean failureIsFatal = TRUE);
-NA_EIDPROC
void deallocateIpcHeapMemory(void * buffer);
-NA_EIDPROC
~DefaultIpcHeap();
-NA_EIDPROC
void destroy();
// bogus fn needed simply because of inheritance
-#if (defined(_DEBUG) || defined(NSK_MEMDEBUG)) && !defined(__EID) && !defined(STAND_ALONE)
-NA_EIDPROC
+#if (defined(_DEBUG) || defined(NSK_MEMDEBUG))
void dumpIpcHeapInfo(ostream* outstream, Lng32 indent);
#endif
};
-#if ((defined(NA_NSK) || defined (NA_LINUX)) && (!defined(__EID)))
SEG_ID getStatsSegmentId();
-#endif
extern SEG_ID gStatsSegmentId_;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/NAStdlib.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NAStdlib.h b/core/sql/common/NAStdlib.h
index 97c39fe..203f9d3 100644
--- a/core/sql/common/NAStdlib.h
+++ b/core/sql/common/NAStdlib.h
@@ -38,15 +38,6 @@
#include "Platform.h"
#include <string.h>
-// -----------------------------------------------------------------------
-// The purpose of this file is to define C RUNTIME stuff found in the
-// system library if NA_NO_C_RUNTIME is defined. Otherwise, the regular
-// headers are included.
-// -----------------------------------------------------------------------
-
-// -----------------------------------------------------------------------
-// NT or NSK with C runtime available, use the standard header files
-// -----------------------------------------------------------------------
#include <stdlib.h>
#include <memory.h>
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/NAString.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/NAString.cpp b/core/sql/common/NAString.cpp
index 7431bff..2eeaf1c 100644
--- a/core/sql/common/NAString.cpp
+++ b/core/sql/common/NAString.cpp
@@ -403,7 +403,7 @@ NABoolean IsCIdentifier(const char *id)
NABoolean /*NAString::*/setMPLoc()
{
- if (!SqlParser_Initialized() || SqlParser_NAMETYPE == DF_NSK)
+ if (!SqlParser_Initialized() )
return TRUE;
else
return FALSE;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/NAString2.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/NAString2.cpp b/core/sql/common/NAString2.cpp
index bb24a54..32e9fbd 100644
--- a/core/sql/common/NAString2.cpp
+++ b/core/sql/common/NAString2.cpp
@@ -43,25 +43,14 @@
#include "ComSizeDefs.h"
#include "NAWinNT.h"
-#ifndef CLI_PRIV_SRL
#include "NAString.h"
#include "nawstring.h"
-#else
-// ComGetNameInterfaceCharSet() is declared and defined in NAString.h
-#include "ComCharSetDefs.h"
-inline SQLCHARSET_CODE ComGetNameInterfaceCharSet()
-{
- return SQLCHARSETCODE_UTF8;
-}
-#endif
-#include "sqlcli.h"
+#include "sqlcli.h"
// move this method to NAString.h later.
NABoolean setMPLoc();
-
-
// -----------------------------------------------------------------------
static NABoolean NAString2_isUpper(unsigned char c,
SQLCHARSET_CODE isoMapCS)
@@ -263,7 +252,6 @@ void ToAnsiIdentifier3(const char * inputData, size_t inputLen,
} // ToAnsiIdentifier3
-#ifndef CLI_PRIV_SRL
// -----------------------------------------------------------------------
// Remove whitespace (spaces and tabs) from front or back or both
// -----------------------------------------------------------------------
@@ -330,5 +318,3 @@ void RemoveTrailingZeros(NAString &ns)
ns.remove(++i);
}
}
-
-#endif
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/NAStringDefGlobals.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NAStringDefGlobals.h b/core/sql/common/NAStringDefGlobals.h
index 2f4d5c9..edacbcd 100644
--- a/core/sql/common/NAStringDefGlobals.h
+++ b/core/sql/common/NAStringDefGlobals.h
@@ -51,7 +51,6 @@
// -----------------------------------------------------------------------
#include "Platform.h"
-#include "SqlExportDllDefines.h"
// #include "ComCharSetDefs.h" // includes definition of enum SQLCHARSET_CODE
// classes in this file:
@@ -71,7 +70,7 @@ class NAWString ;
// //
//////////////////////////////////////////////////////////////////////////
-class SQLEXPORT_LIB_FUNC NAReference
+class NAReference
{
protected:
UInt32 refs_; // (1 less than) number of references
@@ -103,7 +102,7 @@ public:
* There are no public member functions.
*/
-class SQLEXPORT_LIB_FUNC NAStringRef : public NAReference
+class NAStringRef : public NAReference
{
private: // not protected -- we don't expect anyone to ever inherit from NAStringRef
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/NAWinNT.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NAWinNT.h b/core/sql/common/NAWinNT.h
index 46887b4..08f4d33 100644
--- a/core/sql/common/NAWinNT.h
+++ b/core/sql/common/NAWinNT.h
@@ -42,12 +42,8 @@
#include <ctype.h>
-#ifdef ARKFS_OPEN
- typedef unsigned short NAWchar;
-#else
- // We generally use NAWchar as the C data type for wide characters.
- #define NAWchar wchar_t
-#endif
+// We generally use NAWchar as the C data type for wide characters.
+#define NAWchar wchar_t
#ifndef BYTES_PER_NAWCHAR
#define BYTES_PER_NAWCHAR 2
@@ -64,7 +60,7 @@
// We avoid sourcing in more header files into this simple header NAWinNT.h
// file due to the complexity of the build of the SQL Engine products.
//
-// NA_EIDPROC inline void wc_str_pad(NAWchar *str, Int32 length,
+// inline void wc_str_pad(NAWchar *str, Int32 length,
// NAWchar padchar = unicode_char_set::SPACE);
@@ -86,7 +82,6 @@
#define NAWwcstol na_wcstol
// inline wchar functions
-NA_EIDPROC
inline
UInt32 na_wcslen (const NAWchar * wstr)
{
@@ -95,18 +90,18 @@ UInt32 na_wcslen (const NAWchar * wstr)
return s - wstr;
}
-NA_EIDPROC inline
+inline
Int32 na_iswspace (NAWchar wc)
{
return ( wc == NAWCHR(' ') );
}
-NA_EIDPROC NAWchar * na_wcscat (NAWchar*, const NAWchar*);
-NA_EIDPROC Int32 na_wcscmp (const NAWchar *, const NAWchar *);
-NA_EIDPROC Int32 na_wcsicmp (const NAWchar *, const NAWchar *);
-NA_EIDPROC Int32 na_wcsncmp (const NAWchar *, const NAWchar *, UInt32);
-NA_EIDPROC Int32 na_wcsincmp (const NAWchar *, const NAWchar *, UInt32);
-NA_EIDPROC NAWchar * na_wcsncpy (NAWchar * dest, const NAWchar * src, UInt32 n);
+NAWchar * na_wcscat (NAWchar*, const NAWchar*);
+Int32 na_wcscmp (const NAWchar *, const NAWchar *);
+Int32 na_wcsicmp (const NAWchar *, const NAWchar *);
+Int32 na_wcsncmp (const NAWchar *, const NAWchar *, UInt32);
+Int32 na_wcsincmp (const NAWchar *, const NAWchar *, UInt32);
+NAWchar * na_wcsncpy (NAWchar * dest, const NAWchar * src, UInt32 n);
// We define these functions on Linux because we have chosen to use the
// short version of wchar_t (i.e., the 2-byte-size NAWchar data type)
@@ -115,15 +110,14 @@ NA_EIDPROC NAWchar * na_wcsncpy (NAWchar * dest, const NAWchar * src, UInt32 n)
// Functions na_wcstombs(), na_mbstowcs(), and na_wcswcs are defined in
// the source file w:/common/wstr.cpp.
//
-NA_EIDPROC size_t na_wcstombs(char *, const NAWchar*, size_t);
-NA_EIDPROC size_t na_mbstowcs(NAWchar*, const char*, size_t);
-NA_EIDPROC NAWchar * na_wcswcs(const NAWchar*, const NAWchar*);
+size_t na_wcstombs(char *, const NAWchar*, size_t);
+size_t na_mbstowcs(NAWchar*, const char*, size_t);
+NAWchar * na_wcswcs(const NAWchar*, const NAWchar*);
// This compares two strings that can have embedded nulls.
-NA_EIDPROC Int32 na_wcsnncmp (const NAWchar *wstr1, UInt32 len1,
+Int32 na_wcsnncmp (const NAWchar *wstr1, UInt32 len1,
const NAWchar *wstr2, UInt32 len2);
-NA_EIDPROC
inline
NAWchar *na_wcscpy (NAWchar * dest, const NAWchar * src)
{
@@ -134,7 +128,6 @@ NAWchar *na_wcscpy (NAWchar * dest, const NAWchar * src)
return dest;
}
-NA_EIDPROC
inline
Int32 na_wcs_has_only_ascii_chars (const NAWchar * src, size_t srcLenInNAWchars)
{
@@ -146,7 +139,6 @@ Int32 na_wcs_has_only_ascii_chars (const NAWchar * src, size_t srcLenInNAWchars)
}
/*
-NA_EIDPROC
inline
NAWchar *na_wcsncpy (NAWchar * dest, const NAWchar * src, unsigned int n)
{
@@ -168,7 +160,6 @@ NAWchar *na_wcsncpy (NAWchar * dest, const NAWchar * src, unsigned int n)
}
*/
-NA_EIDPROC
inline
NAWchar na_towupper (NAWchar wc)
{
@@ -180,7 +171,6 @@ NAWchar na_towupper (NAWchar wc)
return wc;
}
-NA_EIDPROC
inline
NAWchar na_towlower (NAWchar wc)
{
@@ -192,15 +182,15 @@ NAWchar na_towlower (NAWchar wc)
return wc;
}
-NA_EIDPROC Int64 na_wcstoll (const NAWchar *);
-NA_EIDPROC Lng32 na_wcstol (const NAWchar *);
-NA_EIDPROC NAWchar *na_wcschr (const NAWchar *, NAWchar);
-NA_EIDPROC NAWchar *na_wcsrchr (const NAWchar *, NAWchar);
-NA_EIDPROC Int32 na_wsprintf(NAWchar *buffer, const NAWchar *format, ... );
-NA_EIDPROC NAWchar *na_wmemchr(const NAWchar *ws, NAWchar wc, Int32 n); // used by swsprintf
+Int64 na_wcstoll (const NAWchar *);
+Lng32 na_wcstol (const NAWchar *);
+NAWchar *na_wcschr (const NAWchar *, NAWchar);
+NAWchar *na_wcsrchr (const NAWchar *, NAWchar);
+Int32 na_wsprintf(NAWchar *buffer, const NAWchar *format, ... );
+NAWchar *na_wmemchr(const NAWchar *ws, NAWchar wc, Int32 n); // used by swsprintf
-NA_EIDPROC Int32 na_swscanf(const NAWchar *buffer, const NAWchar *format, ... );
-NA_EIDPROC double na_wcstod (const NAWchar *, NAWchar **); // used by swscanf
+Int32 na_swscanf(const NAWchar *buffer, const NAWchar *format, ... );
+double na_wcstod (const NAWchar *, NAWchar **); // used by swscanf
#define T_TEXT(q) WIDE_(q) // q is "string"
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/NLSConversion.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NLSConversion.h b/core/sql/common/NLSConversion.h
index c809eed..289f4af 100644
--- a/core/sql/common/NLSConversion.h
+++ b/core/sql/common/NLSConversion.h
@@ -55,77 +55,62 @@
class NAString;
class NAWString;
-NA_EIDPROC
NAWcharBuf*
ISO88591ToUnicode(const charBuf& iso88591String, CollHeap *heap,
NAWcharBuf*& unicodeString, NABoolean addNullAtEnd = TRUE);
-NA_EIDPROC
charBuf*
unicodeToISO88591(const NAWcharBuf& unicodeString, CollHeap* heap,
charBuf*& iso88591String, NABoolean addNullAtEnd = TRUE,
NABoolean allowInvalidCodePoint = TRUE);
-NA_EIDPROC
NAWcharBuf*
csetToUnicode(const charBuf& csetString, CollHeap *heap,
NAWcharBuf*& unicodeString, Int32 cset, Int32 &errorcode,
NABoolean addNullAtEnd = TRUE, Int32 *charCount=NULL, Int32 *errorByteOff=NULL);
-NA_EIDPROC
charBuf*
unicodeTocset(const NAWcharBuf& unicodeString, CollHeap* heap,
charBuf*& csetString, Int32 cset, Int32 &errorcode, NABoolean addNullAtEnd = TRUE,
NABoolean allowInvalidCodePoint = TRUE, Int32 *charCount=NULL, Int32 *errorByteOff=NULL);
-NA_EIDPROC
NAWcharBuf*
sjisToUnicode(const charBuf& sjisString, CollHeap *heap,
NAWcharBuf*& unicodeString, NABoolean addNullAtEnd = TRUE);
-NA_EIDPROC
charBuf*
unicodeToSjis(const NAWcharBuf& unicodeString, CollHeap *heap,
charBuf*& sjisString, NABoolean addNullAtEnd = TRUE,
NABoolean allowInvalidCodePoint = TRUE);
-NA_EIDPROC
charBuf*
unicodeToUtf8(const NAWcharBuf& unicodeString, CollHeap *heap,
charBuf*& utf8String, NABoolean addNullAtEnd = TRUE,
NABoolean allowInvalidCodePoint = TRUE);
-NA_EIDPROC
NAWcharBuf*
ksc5601ToUnicode(const charBuf& ksc5601String, CollHeap *heap,
NAWcharBuf*& unicodeString, NABoolean addNullAtEnd = TRUE);
-NA_EIDPROC
charBuf*
unicodeToKsc5601(const NAWcharBuf& unicodeString, CollHeap *heap,
charBuf*& ksc5601String, NABoolean addNullAtEnd = TRUE,
NABoolean allowInvalidCodePoint = TRUE);
-NA_EIDPROC
Int32 unicodeToSjisChar(char *sjis, NAWchar wc);
-NA_EIDPROC
cnv_charset convertCharsetEnum (Int32/*i.e. enum CharInfo::CharSet*/ inset);
-NA_EIDPROC
const char* getCharsetAsString(Int32/*i.e. enum CharInfo::CharSet*/ charset);
-NA_EIDPROC
Lng32 UnicodeStringToLocale(Lng32/*i.e. enum CharInfo::CharSet*/ charset,
const NAWchar* wstr, Lng32 wstrLen, char* buf, Lng32 bufLen, NABoolean addNullAtEnd = TRUE,
NABoolean allowInvalidCodePoint = TRUE);
-NA_EIDPROC
Lng32 LocaleStringToUnicode(Lng32/*i.e. enum CharInfo::CharSet*/ charset,
const char* str, Lng32 strLen, NAWchar* wstrBuf, Lng32 wstrBufLen, NABoolean addNullAtEnd = TRUE);
-NA_EIDPROC
Int32 localeConvertToUTF8(char* source,
Lng32 sourceLen,
char* target,
@@ -135,7 +120,6 @@ Int32 localeConvertToUTF8(char* source,
Lng32 *charCount = NULL,
Lng32 *errorByteOff = NULL);
-NA_EIDPROC
Int32 UTF8ConvertToLocale(char* source,
Lng32 sourceLen,
char* target,
@@ -171,7 +155,6 @@ Int32 UTF8ConvertToLocale(char* source,
// Note that classes NAMemory and CollHeap are the same except for
// the names.
// -----------------------------------------------------------------------
-NA_EIDPROC
Int32 ComputeWidthInBytesOfMbsForDisplay ( const char * pp_cpMbs // in
, const Int32 pv_iMbsLenInBytes // in
, const Int32 pv_iMaxDisplayLenInBytes // in
@@ -191,7 +174,6 @@ Int32 ComputeWidthInBytesOfMbsForDisplay ( const char * pp_cpMbs
// Return an error code (a negative number) if encounters an error. The
// error code values are defined in w:/common/csconvert.h.
// -----------------------------------------------------------------------
-NA_EIDPROC
Int32 ComputeStrLenInNAWchars (const char * pStr,
const Int32 strLenInBytes,
const CharInfo::CharSet cs,
@@ -205,7 +187,6 @@ Int32 ComputeStrLenInNAWchars (const char * pStr,
// Return an error code (a negative number) if encounters an error. The
// error code values are defined in w:/common/csconvert.h.
// -----------------------------------------------------------------------
-NA_EIDPROC
Int32 ComputeStrLenInUCS4chars (const char * pStr,
const Int32 strLenInBytes,
const CharInfo::CharSet cs);
@@ -235,7 +216,6 @@ typedef char CollHeap;
#define NABoolean Int32
#define TRUE 1
#define FALSE 0
-#define NA_EIDPROC
#define NADELETEBASIC(buf_, heap_)
#define NADELETE(buf_, T_, heap_)
#include "stringBuf.h"
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/NumericType.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/NumericType.cpp b/core/sql/common/NumericType.cpp
index cce8b00..95612f3 100644
--- a/core/sql/common/NumericType.cpp
+++ b/core/sql/common/NumericType.cpp
@@ -1493,8 +1493,6 @@ SQLNumeric::SQLNumeric(NAMemory *heap, Lng32 length, Lng32 precision, Lng32 scal
} // SQLNumeric()
-// Note: DisAmbiguate arg added so Compiler can distinguish between
-// this constructor and the one above...for 64bit project.
SQLNumeric::SQLNumeric(NAMemory *heap, NABoolean allowNegValues, Lng32 precision, Lng32 scale,
const Int16 DisAmbiguate,
NABoolean allowSQLnull)
@@ -1776,12 +1774,7 @@ NAString* SQLNumeric::convertToString(double v, CollHeap* h) const
}
break;
-#ifdef NA_64BIT
- // dg64 - a bit of a guess
case sizeof(Int32):
-#else
- case sizeof(Lng32):
-#endif
{
Lng32 temp = (Lng32)v;
signedLongToAscii(temp, nameBuf);
@@ -1870,12 +1863,7 @@ double SQLNumeric::getMinValue() const
}
break;
-#ifdef NA_64BIT
- // dg64 - a bit of a guess
case sizeof(Int32):
-#else
- case sizeof(Lng32):
-#endif
{
Lng32 temp = 0;
Lng32 i=0;
@@ -1935,12 +1923,7 @@ double SQLNumeric::getMaxValue() const
}
break;
-#ifdef NA_64BIT
- // dg64 - a bit of a guess
case sizeof(Int32):
-#else
- case sizeof(Lng32):
-#endif
{
Lng32 temp = 0;
Lng32 i=0;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/OperTypeEnum.h
----------------------------------------------------------------------
diff --git a/core/sql/common/OperTypeEnum.h b/core/sql/common/OperTypeEnum.h
index a48f18e..b917f23 100644
--- a/core/sql/common/OperTypeEnum.h
+++ b/core/sql/common/OperTypeEnum.h
@@ -428,9 +428,6 @@ enum OperatorTypeEnum {
// returns operand2 if operand1 is null
ITM_NVL = 2150,
- // Functions for Utilities
- ITM_AUDIT_IMAGE = 2151,
-
// return NULL if 2 arguments match, else return 1st arg
ITM_NULLIF = 2152,
@@ -645,7 +642,6 @@ enum OperatorTypeEnum {
ITM_PAGROUP = 2370,
ITM_HASH2_DISTRIB = 2371,
ITM_IDENTITY = 2372,
- ITM_EXTRACT_COLUMNS = 2373,
ITM_QUERYID_EXTRACT = 2374,
ITM_HEADER = 2375,
ITM_RANGE_SPEC_FUNC = 2376,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/Platform.h
----------------------------------------------------------------------
diff --git a/core/sql/common/Platform.h b/core/sql/common/Platform.h
index 24ffa73..3b4933b 100644
--- a/core/sql/common/Platform.h
+++ b/core/sql/common/Platform.h
@@ -37,9 +37,6 @@
*/
#ifdef __gnu_linux__
-
-
-
#endif /* __gnu_linux__ */
@@ -70,7 +67,7 @@
// been set because some other target may have been defined. The following
// should set it correctly on Linux.
*/
-#if defined(NA_LINUX) && !defined(USE_EMBEDDED_SQL_DEFINITIONS)
+#if !defined(USE_EMBEDDED_SQL_DEFINITIONS)
#include <endian.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#undef NA_BIG_ENDIAN
@@ -120,15 +117,6 @@
#define NA_GUARDIAN_IPC
#endif
-#ifndef NA_NO_GUARDIAN_IPC /* allow override from dev environment*/
-#define NA_GUARDIAN_IPC
-#endif
-
-
-
-
-
-
#if defined( NA_C89 ) || defined( NA_MSVC )
/* ----------------------------------------------------------------------- */
/* C89 and MSVC perform template instantiation at compile time, */
@@ -161,9 +149,8 @@
#define NA_IEEE_FLOAT
#define NA_EIDPROC
-#define _resident
-
-
+#define SQLEXP_LIB_FUNC
+#define SQLEXPORT_LIB_FUNC
/* Use ANSI standard namespace for .NET and new GCC compilers. */
#if (_MSC_VER >= 1300) || (__GNUC__ >= 3)
@@ -183,14 +170,10 @@
#define NA_WIDE_CHARACTER
-
-
-
-#if !defined(NDEBUG) && !defined(NA_NO_C_RUNTIME)
+#if !defined(NDEBUG)
#define NA_DEBUG_C_RUNTIME
#endif
-
/* Linux with the gcc compiler */
typedef int TInt32;
typedef long long int TInt64;
@@ -268,7 +251,7 @@ typedef double Float64;
typedef long Int64;
typedef unsigned long UInt64;
-#elif (defined( NA_WINNT ) || defined(NA_LINUX)) && !defined(USE_EMBEDDED_SQL_DEFINITIONS ) /* NT_PORT SK 08/13/96 */
+#elif (defined( NA_WINNT )) && !defined(USE_EMBEDDED_SQL_DEFINITIONS ) /* NT_PORT SK 08/13/96 */
typedef _int64 Int64;
typedef unsigned __int64 UInt64;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/SMConnection.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/SMConnection.cpp b/core/sql/common/SMConnection.cpp
index 7af965d..ddf0218 100644
--- a/core/sql/common/SMConnection.cpp
+++ b/core/sql/common/SMConnection.cpp
@@ -1135,7 +1135,6 @@ bool SMConnection::getAckArrived()
void SMConnection::dumpAndStopOtherEnd(bool doDump, bool doStop) const
{
char coreFile[1024];
-#ifdef SQ_PHANDLE_VERIFIER
char processName[MS_MON_MAX_PROCESS_NAME+1];
char seqName[PhandleStringLen];
if (XZFIL_ERR_OK == msg_mon_get_process_name2(smTarget_.node,
@@ -1152,16 +1151,4 @@ void SMConnection::dumpAndStopOtherEnd(bool doDump, bool doStop) const
if (doStop)
msg_mon_stop_process_name(seqName);
}
-#else
- if (doDump)
- msg_mon_dump_process_id(NULL, smTarget_.node, smTarget_.pid,
- coreFile);
- if (doStop)
- {
- char pname[32];
- if (XZFIL_ERR_OK == msg_mon_get_process_name(smTarget_.node,
- smTarget_.pid, pname))
- msg_mon_stop_process(pname, smTarget_.node, smTarget_.pid);
- }
-#endif
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/SqlEventsDllDefines.h
----------------------------------------------------------------------
diff --git a/core/sql/common/SqlEventsDllDefines.h b/core/sql/common/SqlEventsDllDefines.h
index 8e95e17..0e509b5 100644
--- a/core/sql/common/SqlEventsDllDefines.h
+++ b/core/sql/common/SqlEventsDllDefines.h
@@ -25,21 +25,15 @@
#include "Platform.h"
#ifndef SQLEVENTS_LIB_FUNC
- #ifdef __EID
- #define SQLEVENTS_LIB_FUNC
- #else
#ifdef EVENTS_DLL
#define SQLEVENTS_LIB_FUNC __declspec( dllexport )
#else
#define SQLEVENTS_LIB_FUNC __declspec( dllimport )
#endif
- #endif // __EID
#endif // SQLEVENTS_LIB_FUNC
-#ifdef NA_64BIT
- // dg64 - get rid of __declspec
+
#undef SQLEVENTS_LIB_FUNC
#define SQLEVENTS_LIB_FUNC
-#endif
#endif // SQLEVENTS_DLL_DEFINES.h
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/SqlExpDllDefines.h
----------------------------------------------------------------------
diff --git a/core/sql/common/SqlExpDllDefines.h b/core/sql/common/SqlExpDllDefines.h
index 5172ab4..c5be5ac 100644
--- a/core/sql/common/SqlExpDllDefines.h
+++ b/core/sql/common/SqlExpDllDefines.h
@@ -21,30 +21,3 @@
// @@@ END COPYRIGHT @@@
**********************************************************************/
-#ifndef SQLEXPDLL_H
-#define SQLEXPDLL_H
-
-#include "Platform.h"
-
- #ifdef __EID
- #define SQLEXP_LIB_FUNC
- #else
- #ifdef EXP_DLL
- #define SQLEXP_LIB_FUNC __declspec( dllexport )
- #else
- #ifdef UDRSERV_BUILD
- #define SQLEXP_LIB_FUNC
- #else
- #define SQLEXP_LIB_FUNC __declspec( dllimport )
- #endif // UDRSERV_BUILD
- #endif // EXP_DLL
- #endif // __EID
-#ifdef NA_64BIT
- // dg64 - get rid of __declspec
- #undef SQLEXP_LIB_FUNC
- #define SQLEXP_LIB_FUNC
-#endif
-
-#endif // SQLEXPDLL_H
-
-
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/SqlExportDllDefines.h
----------------------------------------------------------------------
diff --git a/core/sql/common/SqlExportDllDefines.h b/core/sql/common/SqlExportDllDefines.h
index e8d1918..178ea35 100644
--- a/core/sql/common/SqlExportDllDefines.h
+++ b/core/sql/common/SqlExportDllDefines.h
@@ -18,27 +18,3 @@
// under the License.
//
// @@@ END COPYRIGHT @@@
-
-#ifndef SQLEXPORT_DLL_DEFINES_H
-#define SQLEXPORT_DLL_DEFINES_H
-
-#include "Platform.h"
-
- #ifndef SQLEXPORT_LIB_FUNC
- #ifdef __EID
- #define SQLEXPORT_LIB_FUNC
- #else
- #ifdef EXPORT_DLL
- #define SQLEXPORT_LIB_FUNC __declspec( dllexport )
- #else
- #define SQLEXPORT_LIB_FUNC __declspec( dllimport )
- #endif
- #endif // __EID
- #endif // SQLEXPORT_LIB_FUNC
-#ifdef NA_64BIT
- #undef SQLEXPORT_LIB_FUNC
- #define SQLEXPORT_LIB_FUNC
-#endif
-
-#endif // SQLEXPORT_DLL_DEFINES.h
-
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/SqlLmDllDefines.h
----------------------------------------------------------------------
diff --git a/core/sql/common/SqlLmDllDefines.h b/core/sql/common/SqlLmDllDefines.h
index b9e7cbb..bd29c8b 100644
--- a/core/sql/common/SqlLmDllDefines.h
+++ b/core/sql/common/SqlLmDllDefines.h
@@ -26,20 +26,14 @@
#include "Platform.h"
- #ifdef __EID
- #define SQLLM_LIB_FUNC
- #else
- #ifdef LM_DLL
- #define SQLLM_LIB_FUNC __declspec( dllexport )
- #else
- #define SQLLM_LIB_FUNC __declspec( dllimport )
- #endif
- #endif
-#ifdef NA_64BIT
- // dg64 - get rid of __declspec
- #undef SQLLIM_LIB_FUNC
- #define SQLLIM_LIB_FUNC
+#ifdef LM_DLL
+#define SQLLM_LIB_FUNC __declspec( dllexport )
+#else
+#define SQLLM_LIB_FUNC __declspec( dllimport )
#endif
+#undef SQLLIM_LIB_FUNC
+#define SQLLIM_LIB_FUNC
+
#endif
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1522c8cd/core/sql/common/arkcmp_proc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/common/arkcmp_proc.cpp b/core/sql/common/arkcmp_proc.cpp
index 0f0a8b9..0806178 100644
--- a/core/sql/common/arkcmp_proc.cpp
+++ b/core/sql/common/arkcmp_proc.cpp
@@ -53,8 +53,6 @@ extern void my_mpi_fclose();
DEFINE_DOVERS(tdm_arkcmp)
-#include "SqlExportDllDefines.h"
-
#include "CmpMessage.h"
#include "CmpConnection.h"
#include "CmpContext.h"