lj_record.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. ** Trace recorder (bytecode -> SSA IR).
  3. ** Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
  4. */
  5. #ifndef _LJ_RECORD_H
  6. #define _LJ_RECORD_H
  7. #include "lj_obj.h"
  8. #include "lj_jit.h"
  9. #if LJ_HASJIT
  10. /* Context for recording an indexed load/store. */
  11. typedef struct RecordIndex {
  12. TValue tabv; /* Runtime value of table (or indexed object). */
  13. TValue keyv; /* Runtime value of key. */
  14. TValue valv; /* Runtime value of stored value. */
  15. TValue mobjv; /* Runtime value of metamethod object. */
  16. GCtab *mtv; /* Runtime value of metatable object. */
  17. cTValue *oldv; /* Runtime value of previously stored value. */
  18. TRef tab; /* Table (or indexed object) reference. */
  19. TRef key; /* Key reference. */
  20. TRef val; /* Value reference for a store or 0 for a load. */
  21. TRef mt; /* Metatable reference. */
  22. TRef mobj; /* Metamethod object reference. */
  23. int idxchain; /* Index indirections left or 0 for raw lookup. */
  24. } RecordIndex;
  25. LJ_FUNC int lj_record_objcmp(jit_State *J, TRef a, TRef b,
  26. cTValue *av, cTValue *bv);
  27. LJ_FUNC void lj_record_stop(jit_State *J, TraceLink linktype, TraceNo lnk);
  28. LJ_FUNC TRef lj_record_constify(jit_State *J, cTValue *o);
  29. LJ_FUNC TRef lj_record_vload(jit_State *J, TRef ref, MSize idx, IRType t);
  30. LJ_FUNC void lj_record_call(jit_State *J, BCReg func, ptrdiff_t nargs);
  31. LJ_FUNC void lj_record_tailcall(jit_State *J, BCReg func, ptrdiff_t nargs);
  32. LJ_FUNC void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults);
  33. LJ_FUNC int lj_record_mm_lookup(jit_State *J, RecordIndex *ix, MMS mm);
  34. LJ_FUNC TRef lj_record_idx(jit_State *J, RecordIndex *ix);
  35. LJ_FUNC int lj_record_next(jit_State *J, RecordIndex *ix);
  36. LJ_FUNC void lj_record_ins(jit_State *J);
  37. LJ_FUNC void lj_record_setup(jit_State *J);
  38. #endif
  39. #endif