Skip to content

Commit

Permalink
Reduce the number of C literal strings emitted for icalls etc. a bit. (
Browse files Browse the repository at this point in the history
  • Loading branch information
vargaz committed Feb 11, 2021
1 parent f4999ee commit 4cbb1e6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/mono/mono/metadata/cominterop.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,14 @@ Code shared between the DISABLE_COM and !DISABLE_COM
// The name of func must be linkable for AOT, for example g_free does not work (monoeg_g_free instead),
// nor does the C++ overload fmod (mono_fmod instead). These functions therefore
// must be extern "C".
#define register_icall(func, sig, save) \
(mono_register_jit_icall_info (&mono_get_jit_icall_info ()->func, func, #func, (sig), (save), #func))
#ifndef DISABLE_JIT
#define register_icall(func, sig, no_wrapper) \
(mono_register_jit_icall_info (&mono_get_jit_icall_info ()->func, func, #func, (sig), (no_wrapper), #func))
#else
/* No need for the name/C symbol */
#define register_icall(func, sig, no_wrapper) \
(mono_register_jit_icall_info (&mono_get_jit_icall_info ()->func, func, NULL, (sig), (no_wrapper), NULL))
#endif

mono_bstr
mono_string_to_bstr_impl (MonoStringHandle s, MonoError *error)
Expand Down
6 changes: 6 additions & 0 deletions src/mono/mono/metadata/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,14 @@ get_method_image (MonoMethod *method)
// The name of func must be linkable for AOT, for example g_free does not work (monoeg_g_free instead),
// nor does the C++ overload fmod (mono_fmod instead). These functions therefore
// must be extern "C".
#ifndef DISABLE_JIT
#define register_icall(func, sig, no_wrapper) \
(mono_register_jit_icall_info (&mono_get_jit_icall_info ()->func, func, #func, (sig), (no_wrapper), #func))
#else
/* No need for the name/C symbol */
#define register_icall(func, sig, no_wrapper) \
(mono_register_jit_icall_info (&mono_get_jit_icall_info ()->func, func, NULL, (sig), (no_wrapper), NULL))
#endif

MonoMethodSignature*
mono_signature_no_pinvoke (MonoMethod *method)
Expand Down
4 changes: 4 additions & 0 deletions src/mono/mono/utils/mono-threads-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ typedef struct _MonoStackData {
} MonoStackData;

// FIXME an ifdef to change __func__ to empty or further minimization.
#ifndef DISABLE_LOGGING
#define MONO_STACKDATA(x) MonoStackData x = { &x, __func__ }
#else
#define MONO_STACKDATA(x) MonoStackData x = { &x, NULL }
#endif

static inline const char*
mono_stackdata_get_function_name (const MonoStackData *stackdata)
Expand Down

0 comments on commit 4cbb1e6

Please sign in to comment.