summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/gdscript.h')
-rw-r--r--modules/gdscript/gdscript.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 9b99f5ca0b..7b0e2136ed 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -117,27 +117,28 @@ class GDScript : public Script {
HashMap<GDScriptFunction *, LambdaInfo> lambda_info;
- // List is used here because a ptr to elements are stored, so the memory locations need to be stable
- struct UpdatableFuncPtr {
- List<GDScriptFunction **> ptrs;
- Mutex mutex;
- bool initialized = false;
- };
- struct UpdatableFuncPtrElement {
- List<GDScriptFunction **>::Element *element = nullptr;
- Mutex *mutex = nullptr;
+public:
+ class UpdatableFuncPtr {
+ friend class GDScript;
+
+ GDScriptFunction *ptr = nullptr;
+ GDScript *script = nullptr;
+ List<UpdatableFuncPtr *>::Element *list_element = nullptr;
+
+ public:
+ GDScriptFunction *operator->() const { return ptr; }
+ operator GDScriptFunction *() const { return ptr; }
+
+ UpdatableFuncPtr(GDScriptFunction *p_function);
+ ~UpdatableFuncPtr();
};
- static thread_local UpdatableFuncPtr func_ptrs_to_update_thread_local;
- static thread_local LocalVector<List<UpdatableFuncPtr *>::Element> func_ptrs_to_update_entries_thread_local;
- static UpdatableFuncPtr *func_ptrs_to_update_main_thread;
+
+private:
+ // List is used here because a ptr to elements are stored, so the memory locations need to be stable
List<UpdatableFuncPtr *> func_ptrs_to_update;
- List<UpdatableFuncPtrElement> func_ptrs_to_update_elems;
Mutex func_ptrs_to_update_mutex;
- UpdatableFuncPtrElement *_add_func_ptr_to_update(GDScriptFunction **p_func_ptr_ptr);
- static void _remove_func_ptr_to_update(const UpdatableFuncPtrElement *p_func_ptr_element);
-
- static void _fixup_thread_function_bookkeeping();
+ void _recurse_replace_function_ptrs(const HashMap<GDScriptFunction *, GDScriptFunction *> &p_replacements) const;
#ifdef TOOLS_ENABLED
// For static data storage during hot-reloading.
@@ -252,7 +253,7 @@ public:
const Ref<GDScriptNativeClass> &get_native() const { return native; }
RBSet<GDScript *> get_dependencies();
- RBSet<GDScript *> get_inverted_dependencies();
+ HashMap<GDScript *, RBSet<GDScript *>> get_all_dependencies();
RBSet<GDScript *> get_must_clear_dependencies();
virtual bool has_script_signal(const StringName &p_signal) const override;
@@ -437,6 +438,7 @@ class GDScriptLanguage : public ScriptLanguage {
SelfList<GDScriptFunction>::List function_list;
bool profiling;
+ bool profile_native_calls;
uint64_t script_frame_time;
HashMap<String, ObjectID> orphan_subclasses;
@@ -538,7 +540,7 @@ public:
virtual void get_string_delimiters(List<String> *p_delimiters) const override;
virtual bool is_using_templates() override;
virtual Ref<Script> make_template(const String &p_template, const String &p_class_name, const String &p_base_class_name) const override;
- virtual Vector<ScriptTemplate> get_built_in_templates(StringName p_object) override;
+ virtual Vector<ScriptTemplate> get_built_in_templates(const StringName &p_object) override;
virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptLanguage::ScriptError> *r_errors = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, HashSet<int> *r_safe_lines = nullptr) const override;
virtual Script *create_script() const override;
#ifndef DISABLE_DEPRECATED
@@ -559,10 +561,6 @@ public:
virtual void add_named_global_constant(const StringName &p_name, const Variant &p_value) override;
virtual void remove_named_global_constant(const StringName &p_name) override;
- /* MULTITHREAD FUNCTIONS */
-
- virtual void thread_exit() override;
-
/* DEBUGGER FUNCTIONS */
virtual String debug_get_error() const override;
@@ -587,6 +585,8 @@ public:
virtual void profiling_start() override;
virtual void profiling_stop() override;
+ virtual void profiling_set_save_native_calls(bool p_enable) override;
+ void profiling_collate_native_call_data(bool p_accumulated);
virtual int profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) override;
virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) override;