size_t size = fdrSize(fdrTable0.get());
- auto fdrTable = aligned_zmalloc_unique<FDR>(size);
+ auto fdrTable = make_bytecode_ptr<FDR>(size, 64);
EXPECT_NE(nullptr, fdrTable);
memcpy(fdrTable.get(), fdrTable0.get(), size);
/*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
#include "gtest/gtest.h"
#include "fdr/fdr_loadval.h"
-#include "util/alloc.h"
+#include "util/bytecode_ptr.h"
using namespace std;
using namespace testing;
TYPED_TEST(FDR_Loadval, Normal) {
// We should be able to do a normal load at any alignment.
const size_t len = sizeof(TypeParam);
- aligned_unique_ptr<u8> mem_p = aligned_zmalloc_unique<u8>(len + 15);
+ auto mem_p = make_bytecode_ptr<u8>(len + 15, 16);
u8 * mem = mem_p.get();
ASSERT_TRUE(ISALIGNED_16(mem));
fillWithBytes(mem, len + 15);
// the 'lo' ptr or after the 'hi' ptr.
const size_t len = sizeof(TypeParam);
- aligned_unique_ptr<u8> mem_p = aligned_zmalloc_unique<u8>(len + 1);
+ auto mem_p = make_bytecode_ptr<u8>(len + 1, 16);
u8 *mem = mem_p.get() + 1; // force unaligned
fillWithBytes(mem, len);
#include "config.h"
#include "gtest/gtest.h"
-#include "util/target_info.h"
-#include "util/charreach.h"
+#include "grey.h"
+#include "hs_compile.h" /* for controlling ssse3 usage */
+#include "compiler/compiler.h"
#include "nfa/lbr.h"
#include "nfa/nfa_api.h"
-#include "nfa/nfa_internal.h"
#include "nfa/nfa_api_util.h"
+#include "nfa/nfa_internal.h"
+#include "nfagraph/ng.h"
#include "nfagraph/ng_lbr.h"
#include "nfagraph/ng_util.h"
-#include "util/alloc.h"
+#include "util/bytecode_ptr.h"
+#include "util/charreach.h"
#include "util/compile_context.h"
-#include "grey.h"
-#include "nfagraph/ng.h"
-#include "compiler/compiler.h"
-#include "hs_compile.h" /* for controlling ssse3 usage */
+#include "util/target_info.h"
#include <ostream>
nfa = constructLBR(*g, triggers, cc, rm);
ASSERT_TRUE(nfa != nullptr);
- full_state = aligned_zmalloc_unique<char>(nfa->scratchStateSize);
- stream_state = aligned_zmalloc_unique<char>(nfa->streamStateSize);
+ full_state = make_bytecode_ptr<char>(nfa->scratchStateSize, 64);
+ stream_state = make_bytecode_ptr<char>(nfa->streamStateSize);
}
virtual void initQueue() {
// Compiled NFA structure.
bytecode_ptr<NFA> nfa;
- // Space for full state.
- aligned_unique_ptr<char> full_state;
+ // Aligned space for full state.
+ bytecode_ptr<char> full_state;
// Space for stream state.
- aligned_unique_ptr<char> stream_state;
+ bytecode_ptr<char> stream_state;
// Queue structure.
struct mq q;
#include "nfagraph/ng.h"
#include "nfagraph/ng_limex.h"
#include "nfagraph/ng_util.h"
-#include "util/alloc.h"
+#include "util/bytecode_ptr.h"
#include "util/target_info.h"
using namespace std;
type, cc);
ASSERT_TRUE(nfa != nullptr);
- full_state = aligned_zmalloc_unique<char>(nfa->scratchStateSize);
- stream_state = aligned_zmalloc_unique<char>(nfa->streamStateSize);
+ full_state = make_bytecode_ptr<char>(nfa->scratchStateSize, 64);
+ stream_state = make_bytecode_ptr<char>(nfa->streamStateSize);
}
virtual void initQueue() {
bytecode_ptr<NFA> nfa;
// Space for full state.
- aligned_unique_ptr<char> full_state;
+ bytecode_ptr<char> full_state;
// Space for stream state.
- aligned_unique_ptr<char> stream_state;
+ bytecode_ptr<char> stream_state;
// Queue structure.
struct mq q;
// Expand state into a new copy and check that it matches the original
// uncompressed state.
- auto state_copy = aligned_zmalloc_unique<char>(nfa->scratchStateSize);
+ auto state_copy = make_bytecode_ptr<char>(nfa->scratchStateSize, 64);
char *dest = state_copy.get();
memset(dest, 0xff, nfa->scratchStateSize);
nfaExpandState(nfa.get(), dest, q.streamState, q.offset,
type, cc);
ASSERT_TRUE(nfa != nullptr);
- full_state = aligned_zmalloc_unique<char>(nfa->scratchStateSize);
- stream_state = aligned_zmalloc_unique<char>(nfa->streamStateSize);
+ full_state = make_bytecode_ptr<char>(nfa->scratchStateSize, 64);
+ stream_state = make_bytecode_ptr<char>(nfa->streamStateSize);
}
virtual void initQueue() {
bytecode_ptr<NFA> nfa;
// Space for full state.
- aligned_unique_ptr<char> full_state;
+ bytecode_ptr<char> full_state;
// Space for stream state.
- aligned_unique_ptr<char> stream_state;
+ bytecode_ptr<char> stream_state;
// Queue structure.
struct mq q;
#include "config.h"
#include "gtest/gtest.h"
-#include "util/alloc.h"
#include "util/arch.h"
+#include "util/bytecode_ptr.h"
#include "util/make_unique.h"
#include "util/simd_utils.h"
a.bytes[i] = (char)(i % 256);
}
- aligned_unique_ptr<char> mem_ptr = aligned_zmalloc_unique<char>(sizeof(a));
+ auto mem_ptr = make_bytecode_ptr<char>(sizeof(a), alignof(TypeParam));
char *mem = mem_ptr.get();
ASSERT_EQ(0, (size_t)mem % 16U);