sourcepawn/jit/jit_function.h
author David Anderson <dvander@alliedmods.net>
Wed Aug 14 23:54:25 2013 -0700 (2013-08-14)
changeset 4013 6201c1180e0e
parent 2226 d10b38524be3
child 4031 852cf4415d12
permissions -rw-r--r--
Implement a watchdog timer for scripts that take too long to execute (bug 5837, r=fyren).
     1 // vim: set ts=8 sts=2 sw=2 tw=99 et:
     2 #ifndef _INCLUDE_SOURCEPAWN_JIT2_FUNCTION_H_
     3 #define _INCLUDE_SOURCEPAWN_JIT2_FUNCTION_H_
     4 
     5 #include <sp_vm_types.h>
     6 #include <ke_vector.h>
     7 
     8 struct LoopEdge
     9 {
    10   uint32_t offset;
    11   int32_t disp32;
    12 };
    13 
    14 class JitFunction
    15 {
    16  public:
    17   JitFunction(void *entry_addr, cell_t pcode_offs, LoopEdge *edges, uint32_t nedges);
    18   ~JitFunction();
    19 
    20  public:
    21   void *GetEntryAddress() const;
    22   cell_t GetPCodeAddress() const;
    23   uint32_t NumLoopEdges() const {
    24     return nedges_;
    25   }
    26   const LoopEdge &GetLoopEdge(size_t i) const {
    27     assert(i < nedges_);
    28     return edges_[i];
    29   }
    30 
    31  private:
    32   void *m_pEntryAddr;
    33   cell_t m_PcodeOffs;
    34   LoopEdge *edges_;
    35   uint32_t nedges_;
    36 };
    37 
    38 #endif //_INCLUDE_SOURCEPAWN_JIT2_FUNCTION_H_