aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/LuaJIT-1.1.7/src/ljit_dasm.c
blob: c2d44eed5d5f7cb9d2d1c5c5ed0a15827b4ee93a (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
30
31
32
33
34
35
36
37
38
/*
** Wrapper for architecture-specific DynASM encoder.
** Copyright (C) 2005-2011 Mike Pall. See Copyright Notice in luajit.h
*/

#define ljit_dasm_c
#define LUA_CORE


#include "lua.h"

#include "ljit.h"
#include "ljit_dasm.h"
#include "lmem.h"


/* Glue macros for DynASM memory allocation. */
#define DASM_M_GROW(J, t, p, sz, need) \
  do { \
    size_t _sz = (sz), _need = (need); \
    if (_sz < _need) { \
      if (_sz < 16) _sz = 16; \
      while (_sz < _need) _sz += _sz; \
      (p) = (t *)luaM_realloc_(J->L, (p), (sz), _sz); \
      (sz) = _sz; \
    } \
  } while(0)

#define DASM_M_FREE(J, p, sz)	luaM_freemem(J->L, p, sz)

/* Embed architecture-specific DynASM encoder. */
#if defined(__i386) || defined(__i386__) || defined(_M_IX86)
#include "dasm_x86.h"
#else
#error "No support for this architecture (yet)"
#endif