From 8df4d7e16b4fbb7e65b6899186d85068bf8a430a Mon Sep 17 00:00:00 2001 From: Mikhail Kornaukhov Date: Thu, 31 Oct 2024 18:10:52 +0300 Subject: [PATCH] internal interfaces methods are not inlined --- compiler/pipes/inline-simple-functions.cpp | 12 ++++++++++++ compiler/pipes/inline-simple-functions.h | 1 + 2 files changed, 13 insertions(+) diff --git a/compiler/pipes/inline-simple-functions.cpp b/compiler/pipes/inline-simple-functions.cpp index f6bbaefc8a..45fa97ca96 100644 --- a/compiler/pipes/inline-simple-functions.cpp +++ b/compiler/pipes/inline-simple-functions.cpp @@ -4,6 +4,7 @@ #include "compiler/pipes/inline-simple-functions.h" +#include "compiler/data/class-data.h" #include "compiler/data/src-file.h" #include "compiler/data/var-data.h" #include "compiler/inferring/public.h" @@ -107,6 +108,17 @@ bool InlineSimpleFunctions::check_function(FunctionPtr function) const { !function->kphp_lib_export; } + +void InlineSimpleFunctions::on_start() { + if (auto klass = current_function->class_id) { + if (klass->internal_interface) { + inline_is_possible_ = false; + } + } + return FunctionPassBase::on_start(); +} + + void InlineSimpleFunctions::on_finish() { if (inline_is_possible_) { current_function->is_inline = true; diff --git a/compiler/pipes/inline-simple-functions.h b/compiler/pipes/inline-simple-functions.h index da5aedc448..c5f88a9f55 100644 --- a/compiler/pipes/inline-simple-functions.h +++ b/compiler/pipes/inline-simple-functions.h @@ -21,5 +21,6 @@ class InlineSimpleFunctions final : public FunctionPassBase { VertexPtr on_exit_vertex(VertexPtr root) final; bool user_recursion(VertexPtr) final; bool check_function(FunctionPtr function) const final; + void on_start() final; void on_finish() final; };