Skip to content

Commit

Permalink
fix runtime issues (#1034)
Browse files Browse the repository at this point in the history
  • Loading branch information
astrophysik authored Jul 2, 2024
1 parent 49a1bf4 commit 5597a00
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ endif ()

install(DIRECTORY ${COMMON_DIR}
${BASE_DIR}/runtime
${BASE_DIR}/runtime-core
${BASE_DIR}/server
${BASE_DIR}/third-party
COMPONENT KPHP
Expand Down
5 changes: 3 additions & 2 deletions runtime-core/core-types/decl/string_buffer_decl.inl
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ public:
friend inline bool operator!=(const string_buffer &lhs, const string_buffer &rhs);
};


struct string_buffer_lib_context {
string::size_type MIN_BUFFER_LEN;
string::size_type MAX_BUFFER_LEN;
string::size_type MIN_BUFFER_LEN = 266175;
string::size_type MAX_BUFFER_LEN = (1 << 24);
int error_flag = 0;
};
8 changes: 7 additions & 1 deletion runtime-core/runtime-core-context.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ struct RuntimeAllocator {
};

struct KphpCoreContext {

/**
* KphpCoreContext is used in
* @see init_php_scripts_once_in_master for runtime or
* @see vk_k2_create_image_state for runtime light
*
* before the init() function is called, so its default parameters should be as follows
**/
static KphpCoreContext& current() noexcept;

void init();
Expand Down
4 changes: 2 additions & 2 deletions runtime/memory_usage.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ inline int64_t f$memory_get_static_usage() {
return static_cast<int64_t>(dl::get_heap_memory_used());
}

inline int64_t f$memory_get_peak_usage(bool real_usage) {
inline int64_t f$memory_get_peak_usage(bool real_usage = false) {
if (real_usage) {
return static_cast<int64_t>(dl::get_script_memory_stats().max_real_memory_used);
} else {
return static_cast<int64_t>(dl::get_script_memory_stats().max_memory_used);
}
}

inline int64_t f$memory_get_usage(bool real_usage __attribute__((unused))) {
inline int64_t f$memory_get_usage(bool real_usage __attribute__((unused)) = false) {
return static_cast<int64_t>(dl::get_script_memory_stats().memory_used);
}

Expand Down
5 changes: 5 additions & 0 deletions runtime/runtime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ file(GLOB_RECURSE KPHP_RUNTIME_ALL_HEADERS
RELATIVE ${BASE_DIR}
CONFIGURE_DEPENDS
"${BASE_DIR}/runtime/*.h")
file(GLOB_RECURSE KPHP_RUNTIME_CORE_ALL_HEADERS
RELATIVE ${BASE_DIR}
CONFIGURE_DEPENDS
"${BASE_DIR}/runtime-core/*.h")
list(APPEND KPHP_RUNTIME_ALL_HEADERS ${KPHP_RUNTIME_CORE_ALL_HEADERS})
list(TRANSFORM KPHP_RUNTIME_ALL_HEADERS REPLACE "^(.+)$" [[#include "\1"]])
list(JOIN KPHP_RUNTIME_ALL_HEADERS "\n" MERGED_RUNTIME_HEADERS)
file(WRITE ${AUTO_DIR}/runtime/runtime-headers.h "\
Expand Down

0 comments on commit 5597a00

Please sign in to comment.