1
0
Fork 0

Merge branch 'aql2' into mmh

This commit is contained in:
Max Neunhoeffer 2014-09-10 11:16:44 +02:00
commit 7bca4da5dc
3 changed files with 57 additions and 48 deletions

View File

@ -910,6 +910,8 @@ namespace triagens {
virtual ExecutionNode* clone () const { virtual ExecutionNode* clone () const {
std::vector<std::vector<RangeInfo>> ranges; std::vector<std::vector<RangeInfo>> ranges;
for (size_t i = 0; i < _ranges.size(); i++){ for (size_t i = 0; i < _ranges.size(); i++){
ranges.push_back(std::vector<RangeInfo>());
for (auto x: _ranges.at(i)){ for (auto x: _ranges.at(i)){
ranges.at(i).push_back(x); ranges.at(i).push_back(x);
} }

View File

@ -124,7 +124,7 @@ int Optimizer::createPlans (ExecutionPlan* plan,
int level; int level;
auto p = _plans.pop_front(level); auto p = _plans.pop_front(level);
if (level == maxRuleLevel) { if (level >= maxRuleLevel) {
_newPlans.push_back(p, level); // nothing to do, just keep it _newPlans.push_back(p, level); // nothing to do, just keep it
} }
else { // find next rule else { // find next rule

View File

@ -156,7 +156,7 @@ static inline void* CONST_CAST (void const* ptr) {
/// @brief incrementing a uint64_t modulo a number with wraparound /// @brief incrementing a uint64_t modulo a number with wraparound
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static inline uint64_t TRI_IncModU64(uint64_t i, uint64_t len) { static inline uint64_t TRI_IncModU64 (uint64_t i, uint64_t len) {
// Note that the dummy variable gives the compiler a (good) chance to // Note that the dummy variable gives the compiler a (good) chance to
// use a conditional move instruction instead of a branch. This actually // use a conditional move instruction instead of a branch. This actually
// works on modern gcc. // works on modern gcc.
@ -165,7 +165,7 @@ static inline uint64_t TRI_IncModU64(uint64_t i, uint64_t len) {
return i < len ? i : dummy; return i < len ? i : dummy;
} }
static inline uint64_t TRI_DecModU64(uint64_t i, uint64_t len) { static inline uint64_t TRI_DecModU64 (uint64_t i, uint64_t len) {
if ((i--) != 0) { if ((i--) != 0) {
return i; return i;
} }
@ -203,12 +203,11 @@ static inline uint64_t TRI_DecModU64(uint64_t i, uint64_t len) {
#endif #endif
#endif #endif
static inline void _backtrace(void) static inline void _backtrace (void) {
{
#if HAVE_BACKTRACE #if HAVE_BACKTRACE
void *stack_frames[50]; void* stack_frames[50];
size_t size, i; size_t size, i;
char **strings; char** strings;
size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*)); size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
strings = backtrace_symbols(stack_frames, size); strings = backtrace_symbols(stack_frames, size);
@ -239,13 +238,15 @@ static inline void _backtrace(void)
*offset_end++ = '\0'; *offset_end++ = '\0';
int status = 0; int status = 0;
char * demangled_name = abi::__cxa_demangle(mangled_name, 0, 0, &status); char * demangled_name = abi::__cxa_demangle(mangled_name, 0, 0, &status);
if (demangled_name != nullptr) {
if (status == 0) { if (status == 0) {
fprintf(stderr, "%s() [%p] %s\n", strings[i], stack_frames[i], demangled_name); fprintf(stderr, "%s() [%p] %s\n", strings[i], stack_frames[i], demangled_name);
} }
else { else {
fprintf(stderr, "%s\n", strings[i]); fprintf(stderr, "%s\n", strings[i]);
} }
free(demangled_name); TRI_SystemFree(demangled_name);
}
} }
else else
#endif #endif
@ -253,22 +254,24 @@ static inline void _backtrace(void)
fprintf(stderr, "%s\n", strings[i]); fprintf(stderr, "%s\n", strings[i]);
} }
} }
else else {
fprintf(stderr, "[%p]\n", stack_frames[i]); fprintf(stderr, "[%p]\n", stack_frames[i]);
} }
free(strings); }
if (strings != NULL) {
TRI_SystemFree(strings);
}
#endif #endif
} }
#ifdef __cplusplus #ifdef __cplusplus
#include <string> #include <string>
#include <sstream> #include <sstream>
static inline void _getBacktrace(std::string &btstr) static inline void _getBacktrace (std::string& btstr) {
{
#if HAVE_BACKTRACE #if HAVE_BACKTRACE
void *stack_frames[50]; void* stack_frames[50];
size_t size, i; size_t size, i;
char **strings; char** strings;
size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*)); size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
strings = backtrace_symbols(stack_frames, size); strings = backtrace_symbols(stack_frames, size);
@ -300,6 +303,8 @@ static inline void _getBacktrace(std::string &btstr)
*offset_end++ = '\0'; *offset_end++ = '\0';
int status = 0; int status = 0;
char * demangled_name = abi::__cxa_demangle(mangled_name, 0, 0, &status); char * demangled_name = abi::__cxa_demangle(mangled_name, 0, 0, &status);
if (demangled_name != nullptr) {
if (status == 0) { if (status == 0) {
ss << stack_frames[i]; ss << stack_frames[i];
btstr += strings[i] + btstr += strings[i] +
@ -313,10 +318,10 @@ static inline void _getBacktrace(std::string &btstr)
btstr += strings[i] + btstr += strings[i] +
std::string("\n"); std::string("\n");
} }
free(demangled_name); TRI_SystemFree(demangled_name);
} }
else }
{ else {
btstr += strings[i] + btstr += strings[i] +
std::string("\n"); std::string("\n");
} }
@ -327,7 +332,9 @@ static inline void _getBacktrace(std::string &btstr)
std::string("\n"); std::string("\n");
} }
} }
free(strings); if (strings != NULL) {
TRI_SystemFree(strings);
}
#endif #endif
} }
#endif #endif