On 26-Jan-2021 07:02, Bram Moolenaar wrote:
Patch 8.2.2409
Problem: Vim9: profiling only works for one function.
Solution: Select the right instructions when calling and returning.
(closes #7743)
Files: src/vim9compile.c, src/vim9execute.c, src/vim9.h,
src/testdir/test_profile.vim
After this patch, mingw64 (gcc 10.2), spits out this if FEAT_PROFILE is
not defined:
<snip>
gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD vim9compile.c -o
gobjnative/vim9compile.o
In file included from
d:\users\john\documents\software\mingw\mingw64\x86_64-w64-mingw32\include\windef.h:9,
from
d:\users\john\documents\software\mingw\mingw64\x86_64-w64-mingw32\include\windows.h:69,
from os_win32.h:95,
from vim.h:262,
from vim9compile.c:15:
vim9compile.c: In function 'generate_CALL':
vim9.h:418:20: error: called object is not a function or function pointer
418 | # define PROFILING FALSE
| ^~~~~
vim9compile.c:1778:34: note: in expansion of macro 'PROFILING'
1778 | if (func_needs_compiling(ufunc, PROFILING(ufunc))
| ^~~~~~~~~
vim9.h:418:20: error: called object is not a function or function pointer
418 | # define PROFILING FALSE
| ^~~~~
vim9compile.c:1780:13: note: in expansion of macro 'PROFILING'
1780 | PROFILING(ufunc), NULL) == FAIL)
| ^~~~~~~~~
vim9compile.c: In function 'generate_funcref':
vim9.h:418:20: error: called object is not a function or function pointer
418 | # define PROFILING FALSE
| ^~~~~
vim9compile.c:2618:37: note: in expansion of macro 'PROFILING'
2618 | if (func_needs_compiling(ufunc, PROFILING(ufunc))
| ^~~~~~~~~
vim9.h:418:20: error: called object is not a function or function pointer
418 | # define PROFILING FALSE
| ^~~~~
vim9compile.c:2619:43: note: in expansion of macro 'PROFILING'
2619 | && compile_def_function(ufunc, TRUE, PROFILING(ufunc), NULL)
| ^~~~~~~~~
vim9compile.c: In function 'compile_lambda':
vim9.h:418:20: error: called object is not a function or function pointer
418 | # define PROFILING FALSE
| ^~~~~
vim9compile.c:3114:39: note: in expansion of macro 'PROFILING'
3114 | compile_def_function(ufunc, TRUE, PROFILING(ufunc), cctx);
| ^~~~~~~~~
vim9compile.c: In function 'compile_nested_function':
vim9.h:418:20: error: called object is not a function or function pointer
418 | # define PROFILING FALSE
| ^~~~~
vim9compile.c:5091:37: note: in expansion of macro 'PROFILING'
5091 | if (func_needs_compiling(ufunc, PROFILING(ufunc))
| ^~~~~~~~~
vim9.h:418:20: error: called object is not a function or function pointer
418 | # define PROFILING FALSE
| ^~~~~
vim9compile.c:5092:43: note: in expansion of macro 'PROFILING'
5092 | && compile_def_function(ufunc, TRUE, PROFILING(ufunc), cctx)
| ^~~~~~~~~
make: *** [Make_cyg_ming.mak:1145: gobjnative/vim9compile.o] Error 1
</snip>
and this:
<snip>
gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD vim9execute.c -o
gobjnative/vim9execute.o
In file included from
d:\users\john\documents\software\mingw\mingw64\x86_64-w64-mingw32\include\windef.h:9,
from
d:\users\john\documents\software\mingw\mingw64\x86_64-w64-mingw32\include\windows.h:69,
from os_win32.h:95,
from vim.h:262,
from vim9execute.c:15:
vim9execute.c: In function 'call_def_function':
vim9.h:418:20: error: called object is not a function or function pointer
418 | # define PROFILING FALSE
| ^~~~~
vim9execute.c:1161:38: note: in expansion of macro 'PROFILING'
1161 | || (func_needs_compiling(ufunc, PROFILING(ufunc))
| ^~~~~~~~~
vim9.h:418:20: error: called object is not a function or function pointer
418 | # define PROFILING FALSE
| ^~~~~
vim9execute.c:1162:41: note: in expansion of macro 'PROFILING'
1162 | && compile_def_function(ufunc, FALSE, PROFILING(ufunc), NULL)
| ^~~~~~~~~
make: *** [Make_cyg_ming.mak:1145: gobjnative/vim9execute.o] Error 1
</snip>
The attached patch tries to fix it.
Cheers
John
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/40572b77-75f5-73eb-b777-515846b62b9c%40internode.on.net.
--- vim9.h.orig 2021-01-26 07:02:47.997120300 +1100
+++ vim9.h 2021-01-26 07:49:08.883874500 +1100
@@ -415,6 +415,6 @@
((do_profiling == PROF_YES && (dfunc->df_ufunc)->uf_profiling) \
? (dfunc)->df_instr_prof : (dfunc)->df_instr)
#else
-# define PROFILING FALSE
+# define PROFILING(ufunc) FALSE
# define INSTRUCTIONS(dfunc) ((dfunc)->df_instr)
#endif