-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmodule_state.h
42 lines (29 loc) · 1.01 KB
/
module_state.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
#pragma once
#include <Python.h>
#include "cinderx/Jit/global_cache_iface.h"
#include <memory>
namespace cinderx {
class ModuleState {
public:
// Implements CPython's traverse functionality for tracing through to GC
// references
int traverse(visitproc visit, void* arg);
// Implements CPython's clear functionality for dropping GC references
int clear();
// CPython owns the lifetime of this object so we don't need to worry
// about deleting it, but we do need a way to cleanup any state it
// holds onto.
void shutdown();
jit::IGlobalCacheManager* cacheManager() const {
return cache_manager_.get();
}
void setCacheManager(jit::IGlobalCacheManager* cache_manager) {
cache_manager_ = std::unique_ptr<jit::IGlobalCacheManager>(cache_manager);
}
private:
std::unique_ptr<jit::IGlobalCacheManager> cache_manager_;
};
void setModuleState(ModuleState* state);
ModuleState* getModuleState();
} // namespace cinderx