mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
Clean up DynASM glue macros. Thanks to Josh Haberman.
This commit is contained in:
parent
32aef8aee4
commit
492efb7e7e
@ -14,17 +14,34 @@
|
|||||||
#define DASM_VERSION 10202 /* 1.2.2 */
|
#define DASM_VERSION 10202 /* 1.2.2 */
|
||||||
|
|
||||||
#ifndef Dst_DECL
|
#ifndef Dst_DECL
|
||||||
#define Dst_DECL dasm_State *Dst
|
#define Dst_DECL dasm_State **Dst
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Dst_GET
|
#ifndef Dst_REF
|
||||||
#define Dst_GET (Dst)
|
#define Dst_REF (*Dst)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DASM_FDEF
|
#ifndef DASM_FDEF
|
||||||
#define DASM_FDEF extern
|
#define DASM_FDEF extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DASM_M_GROW
|
||||||
|
#define DASM_M_GROW(ctx, 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 *)realloc((p), _sz); \
|
||||||
|
if ((p) == NULL) exit(1); \
|
||||||
|
(sz) = _sz; \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DASM_M_FREE
|
||||||
|
#define DASM_M_FREE(ctx, p, sz) free(p)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Internal DynASM encoder state. */
|
/* Internal DynASM encoder state. */
|
||||||
typedef struct dasm_State dasm_State;
|
typedef struct dasm_State dasm_State;
|
||||||
|
@ -42,20 +42,6 @@
|
|||||||
#include "../dynasm/dasm_proto.h"
|
#include "../dynasm/dasm_proto.h"
|
||||||
|
|
||||||
/* Glue macros for DynASM. */
|
/* Glue macros for DynASM. */
|
||||||
#define DASM_M_GROW(ctx, 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 *)realloc((p), _sz); \
|
|
||||||
if ((p) == NULL) exit(1); \
|
|
||||||
(sz) = _sz; \
|
|
||||||
} \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define DASM_M_FREE(ctx, p, sz) free(p)
|
|
||||||
|
|
||||||
static int collect_reloc(BuildCtx *ctx, uint8_t *addr, int idx, int type);
|
static int collect_reloc(BuildCtx *ctx, uint8_t *addr, int idx, int type);
|
||||||
|
|
||||||
#define DASM_EXTERN(ctx, addr, idx, type) \
|
#define DASM_EXTERN(ctx, addr, idx, type) \
|
||||||
|
Loading…
Reference in New Issue
Block a user