runtime/kp_vm.h - ktap

Functions defined

Macros defined

Source code

  1. #ifndef __KTAP_VM_H__
  2. #define __KTAP_VM_H__

  3. #include "kp_obj.h"

  4. void kp_vm_call_proto(ktap_state_t *ks, ktap_proto_t *pt);
  5. void kp_vm_call(ktap_state_t *ks, StkId func, int nresults);
  6. int kp_vm_validate_code(ktap_state_t *ks, ktap_proto_t *pt, ktap_val_t *base);
  7. void kp_vm_exit(ktap_state_t *ks);
  8. ktap_state_t *kp_vm_new_state(ktap_option_t *parm, struct dentry *dir);
  9. void kp_optimize_code(ktap_state_t *ks, int level, ktap_proto_t *f);
  10. int kp_vm_register_lib(ktap_state_t *ks, const char *libname,
  11.                const ktap_libfunc_t *funcs);


  12. static __always_inline
  13. ktap_state_t *kp_vm_new_thread(ktap_state_t *mainthread, int rctx)
  14. {
  15.     ktap_state_t *ks;

  16.     ks = kp_this_cpu_state(mainthread, rctx);
  17.     ks->top = ks->stack;
  18.     return ks;
  19. }

  20. static __always_inline
  21. void kp_vm_exit_thread(ktap_state_t *ks)
  22. {
  23. }

  24. /*
  25. * This function only tell ktapvm this thread want to exit,
  26. * let mainthread handle real exit work later.
  27. */
  28. static __always_inline
  29. void kp_vm_try_to_exit(ktap_state_t *ks)
  30. {
  31.     G(ks)->mainthread->stop = 1;
  32.     G(ks)->state = KTAP_EXIT;
  33. }


  34. #endif /* __KTAP_VM_H__ */