| #ifndef _SAFEPOINT_H_ |
| #define _SAFEPOINT_H_ |
| |
| #include <stdint.h> |
| #include <stdio.h> |
| |
| namespace llvm { |
| class Module; |
| } |
| |
| namespace vmkit { |
| class CompilationUnit; |
| |
| class Safepoint { /* Warning: directly generated by safepoint.cc in the data sections */ |
| void* _addr; |
| CompilationUnit* _unit; |
| |
| uint32_t _nbLives; |
| uint32_t _inlineDepth; |
| |
| public: |
| void setUnit(CompilationUnit* unit) { _unit = unit; } |
| |
| CompilationUnit* unit() { return _unit; } |
| void* addr() { return _addr; } |
| uint32_t nbLives() { return _nbLives; } |
| uint32_t inlineDepth() { return _inlineDepth; } |
| |
| uint32_t liveAt(uint32_t i) { |
| return ((uint32_t*)(this + 1))[i]; |
| } |
| |
| const char* functionName(uint32_t i=0) { |
| return *(char**)((uintptr_t)this + sizeof(Safepoint) + _nbLives*sizeof(uint32_t) + i*(sizeof(const char*)+sizeof(uint32_t))); |
| } |
| |
| uint32_t sourceIndex(uint32_t i=0) { |
| return *(uint32_t*)((uintptr_t)this + sizeof(Safepoint) + _nbLives*sizeof(uint32_t) + |
| sizeof(const char*) + i*(sizeof(const char*)+sizeof(uint32_t))); |
| } |
| |
| Safepoint* getNext(); |
| void dump(); |
| |
| static Safepoint* get(CompilationUnit* unit, llvm::Module* module); |
| }; |
| } |
| |
| #endif |