Skip to content

Commit 4cbb1e6

Browse files
authored
Reduce the number of C literal strings emitted for icalls etc. a bit. (#48150)
1 parent f4999ee commit 4cbb1e6

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/mono/mono/metadata/cominterop.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,14 @@ Code shared between the DISABLE_COM and !DISABLE_COM
9595
// The name of func must be linkable for AOT, for example g_free does not work (monoeg_g_free instead),
9696
// nor does the C++ overload fmod (mono_fmod instead). These functions therefore
9797
// must be extern "C".
98-
#define register_icall(func, sig, save) \
99-
(mono_register_jit_icall_info (&mono_get_jit_icall_info ()->func, func, #func, (sig), (save), #func))
98+
#ifndef DISABLE_JIT
99+
#define register_icall(func, sig, no_wrapper) \
100+
(mono_register_jit_icall_info (&mono_get_jit_icall_info ()->func, func, #func, (sig), (no_wrapper), #func))
101+
#else
102+
/* No need for the name/C symbol */
103+
#define register_icall(func, sig, no_wrapper) \
104+
(mono_register_jit_icall_info (&mono_get_jit_icall_info ()->func, func, NULL, (sig), (no_wrapper), NULL))
105+
#endif
100106

101107
mono_bstr
102108
mono_string_to_bstr_impl (MonoStringHandle s, MonoError *error)

src/mono/mono/metadata/marshal.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,14 @@ get_method_image (MonoMethod *method)
127127
// The name of func must be linkable for AOT, for example g_free does not work (monoeg_g_free instead),
128128
// nor does the C++ overload fmod (mono_fmod instead). These functions therefore
129129
// must be extern "C".
130+
#ifndef DISABLE_JIT
130131
#define register_icall(func, sig, no_wrapper) \
131132
(mono_register_jit_icall_info (&mono_get_jit_icall_info ()->func, func, #func, (sig), (no_wrapper), #func))
133+
#else
134+
/* No need for the name/C symbol */
135+
#define register_icall(func, sig, no_wrapper) \
136+
(mono_register_jit_icall_info (&mono_get_jit_icall_info ()->func, func, NULL, (sig), (no_wrapper), NULL))
137+
#endif
132138

133139
MonoMethodSignature*
134140
mono_signature_no_pinvoke (MonoMethod *method)

src/mono/mono/utils/mono-threads-api.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ typedef struct _MonoStackData {
2727
} MonoStackData;
2828

2929
// FIXME an ifdef to change __func__ to empty or further minimization.
30+
#ifndef DISABLE_LOGGING
3031
#define MONO_STACKDATA(x) MonoStackData x = { &x, __func__ }
32+
#else
33+
#define MONO_STACKDATA(x) MonoStackData x = { &x, NULL }
34+
#endif
3135

3236
static inline const char*
3337
mono_stackdata_get_function_name (const MonoStackData *stackdata)

0 commit comments

Comments
 (0)