1/*
2** Snapshot handling.
3** Copyright (C) 2005-2021 Mike Pall. See Copyright Notice in luajit.h
4*/
5
6#ifndef _LJ_SNAP_H
7#define _LJ_SNAP_H
8
9#include "lj_obj.h"
10#include "lj_jit.h"
11
12#if LJ_HASJIT
13LJ_FUNC void lj_snap_add(jit_State *J);
14LJ_FUNC void lj_snap_purge(jit_State *J);
15LJ_FUNC void lj_snap_shrink(jit_State *J);
16LJ_FUNC IRIns *lj_snap_regspmap(jit_State *J, GCtrace *T, SnapNo snapno,
17 IRIns *ir);
18LJ_FUNC void lj_snap_replay(jit_State *J, GCtrace *T);
19LJ_FUNC const BCIns *lj_snap_restore(jit_State *J, void *exptr);
20LJ_FUNC void lj_snap_grow_buf_(jit_State *J, MSize need);
21LJ_FUNC void lj_snap_grow_map_(jit_State *J, MSize need);
22
23static LJ_AINLINE void lj_snap_grow_buf(jit_State *J, MSize need)
24{
25 if (LJ_UNLIKELY(need > J->sizesnap)) lj_snap_grow_buf_(J, need);
26}
27
28static LJ_AINLINE void lj_snap_grow_map(jit_State *J, MSize need)
29{
30 if (LJ_UNLIKELY(need > J->sizesnapmap)) lj_snap_grow_map_(J, need);
31}
32
33#endif
34
35#endif
36