Skip to content

Commit ce7cc02

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Don't store static entry, calculcate it
Summary: Storing this isn't really necessary, we can easily re-calculate it. Reviewed By: SonicField Differential Revision: D91923886 fbshipit-source-id: 98ed9b8f54d1016e8e3e41ca30beab61048e44bd
1 parent 5a31f15 commit ce7cc02

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

cinderx/Jit/compiled_function.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "cinderx/Jit/compiled_function.h"
44

5+
#include "cinderx/Common/extra-py-flags.h"
56
#include "cinderx/Common/log.h"
67
#include "cinderx/Jit/disassembler.h"
78
#include "cinderx/Jit/hir/printer.h"
@@ -67,4 +68,13 @@ void CompiledFunction::setHirFunc(std::unique_ptr<hir::Function>&& irfunc) {
6768
irfunc_ = std::move(irfunc);
6869
}
6970

71+
void* CompiledFunction::staticEntry() const {
72+
if (runtime_ == nullptr ||
73+
!(runtime_->frameState()->code()->co_flags & CI_CO_STATICALLY_COMPILED)) {
74+
return nullptr;
75+
}
76+
77+
return reinterpret_cast<void*>(JITRT_GET_STATIC_ENTRY(vectorcall_entry_));
78+
}
79+
7080
} // namespace jit

cinderx/Jit/compiled_function.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,13 @@ class CompiledFunction {
8686
CompiledFunction(
8787
std::span<const std::byte> code,
8888
vectorcallfunc vectorcall_entry,
89-
void* static_entry,
9089
int stack_size,
9190
int spill_stack_size,
9291
hir::Function::InlineFunctionStats inline_function_stats,
9392
const hir::OpcodeCounts& hir_opcode_counts,
9493
CodeRuntime* runtime)
9594
: code_(code),
9695
vectorcall_entry_(vectorcall_entry),
97-
static_entry_(static_entry),
9896
stack_size_(stack_size),
9997
spill_stack_size_(spill_stack_size),
10098
inline_function_stats_(std::move(inline_function_stats)),
@@ -113,9 +111,7 @@ class CompiledFunction {
113111
return vectorcall_entry_;
114112
}
115113

116-
void* staticEntry() const {
117-
return static_entry_;
118-
}
114+
void* staticEntry() const;
119115

120116
CodeRuntime* runtime() const {
121117
return runtime_;
@@ -161,7 +157,6 @@ class CompiledFunction {
161157

162158
const std::span<const std::byte> code_;
163159
vectorcallfunc const vectorcall_entry_;
164-
void* const static_entry_;
165160
const int stack_size_;
166161
const int spill_stack_size_;
167162
std::chrono::nanoseconds compile_time_;

cinderx/Jit/compiler.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,11 @@ std::unique_ptr<CompiledFunction> Compiler::Compile(
249249
hir::Function::InlineFunctionStats inline_stats =
250250
std::move(irfunc->inline_function_stats);
251251
std::span<const std::byte> code = ngen->getCodeBuffer();
252-
void* static_entry = ngen->getStaticEntry();
253252
auto code_runtime = ngen->codeRuntime();
254253

255254
auto compiled_func = std::make_unique<CompiledFunction>(
256255
code,
257256
entry,
258-
static_entry,
259257
stack_size,
260258
spill_stack_size,
261259
std::move(inline_stats),

cinderx/RuntimeTests/deopt_patcher_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class CodePatcherTest : public RuntimeTest {
2323
return std::make_unique<jit::CompiledFunction>(
2424
code,
2525
reinterpret_cast<vectorcallfunc>(entry),
26-
ngen.getStaticEntry(),
2726
stack_size,
2827
spill_stack_size,
2928
jit::hir::Function::InlineFunctionStats{},

0 commit comments

Comments
 (0)