mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-16 01:12:15 +03:00
rose: rework storage of extra lookaround information
- remove explicit lookaround table from bytecode - make the RoseInstr responsible for adding required info to blob
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include "ue2common.h"
|
||||
#include "util/alloc.h"
|
||||
#include "util/bytecode_ptr.h"
|
||||
#include "util/charreach.h"
|
||||
#include "util/container.h"
|
||||
#include "util/multibit_build.h"
|
||||
#include "util/noncopyable.h"
|
||||
@@ -45,6 +46,21 @@
|
||||
|
||||
namespace ue2 {
|
||||
|
||||
class RoseEngineBlob;
|
||||
|
||||
struct lookaround_info : noncopyable {
|
||||
u32 get_offset_of(const std::vector<std::vector<CharReach>> &look,
|
||||
RoseEngineBlob &blob);
|
||||
u32 get_offset_of(const std::vector<CharReach> &reach,
|
||||
RoseEngineBlob &blob);
|
||||
u32 get_offset_of(const std::vector<s8> &look, RoseEngineBlob &blob);
|
||||
|
||||
private:
|
||||
unordered_map<std::vector<std::vector<CharReach>>, u32> multi_cache;
|
||||
unordered_map<std::vector<s8>, u32> lcache;
|
||||
unordered_map<std::vector<CharReach>, u32> rcache;
|
||||
};
|
||||
|
||||
class RoseEngineBlob : noncopyable {
|
||||
public:
|
||||
/** \brief Base offset of engine_blob in the Rose engine bytecode. */
|
||||
@@ -133,6 +149,8 @@ public:
|
||||
copy_bytes((char *)engine + base_offset, blob);
|
||||
}
|
||||
|
||||
lookaround_info lookaround_cache;
|
||||
|
||||
private:
|
||||
void pad(size_t align) {
|
||||
assert(ISALIGNED_N(base_offset, align));
|
||||
|
||||
Reference in New Issue
Block a user