Skip to content

Commit

Permalink
cpu: jit_generator - enable AutoGrow mode by default
Browse files Browse the repository at this point in the history
  • Loading branch information
nshustrov authored and akharito committed Mar 3, 2020
1 parent 43d17ef commit ed0be61
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/cpu/jit_generator.hpp
Expand Up @@ -54,6 +54,10 @@ typedef enum {
PAGE_2M = 2097152,
} cpu_page_size_t;

typedef enum {
MAX_CODE_SIZE = 256 * 1024,
} max_code_size_t;

// TODO: move this somewhere else? Although this is only used by jit kernels
// (Roma)
static inline int float2int(float x) {
Expand Down Expand Up @@ -843,19 +847,19 @@ class jit_generator : public Xbyak::CodeGenerator
}

public:
jit_generator(
void *code_ptr = nullptr,
size_t code_size = 256 * 1024
) : Xbyak::CodeGenerator(code_size, code_ptr)
{
}
jit_generator(void *code_ptr = nullptr, size_t code_size = MAX_CODE_SIZE,
bool use_autogrow = true)
: Xbyak::CodeGenerator(code_size,
(code_ptr == nullptr && use_autogrow) ? Xbyak::AutoGrow
: code_ptr) {}
virtual ~jit_generator() {}

virtual const char *name() const = 0;
virtual const char *source_file() const = 0;

// XXX: use normal_case name and update all callees (?)
const Xbyak::uint8 *getCode() {
this->ready();
const Xbyak::uint8 *code = CodeGenerator::getCode();
register_code(code);

Expand Down

0 comments on commit ed0be61

Please sign in to comment.