blob: a5c5f869724662e8cf428bc0f4865411ed0c8126 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#pragma once
#include "BeginPrivate.h"
struct AdjustorPool;
/* N.B. the adjustor assembler snippets rely on the layout of this structure
*/
struct AdjustorContext {
StgStablePtr hptr;
StgFunPtr wptr;
};
typedef void (*mk_adjustor_code_fn)(uint8_t *exec_code, const void *context, void *user_data);
struct AdjustorPool *new_adjustor_pool(size_t context_sz, size_t code_sz, mk_adjustor_code_fn make_code, void *user_data);
void *alloc_adjustor(struct AdjustorPool *pool, void *context);
void free_adjustor(void *adjustor, void *context);
/* High-level interface: Adjustors from code template */
struct AdjustorTemplate {
uint8_t *code_start;
uint8_t *code_end;
const struct AdjustorContext **context_ptr;
};
struct AdjustorPool *new_adjustor_pool_from_template(const struct AdjustorTemplate *tmpl);
#include "EndPrivate.h"
|