summary refs log tree commit diff stats
path: root/compiler/ccgcalls.nim
Commit message (Collapse)AuthorAgeFilesLines
* Lineinfo fix (#10871)Arne Döring2019-03-211-0/+1
|
* Initial version of the hot-code reloading support for native targets (#10729)zah2019-02-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * squashed work by Zahary * squashing a ton of useful history... otherwise rebasing on top of upstream Nim after commit 82c009a2cbc5d07ab9a847f1c58228a20efaf219 would be impossible. * Code review changes; Working test suite (without code reloading enabled) * - documentation - implemented the HCR test - almost works... - fix the issue on Unix where for executable targets the source file for the main module of a project in nimcache was being overwritten with the binary itself (and thus the actual source code was lost) - fixing embedded paths to shared objects on unix (the "lib" prefix was being prepended to the entire path instead of just the filename) - other fixes - removing unnecessary includes since that file is already included in chcks.nim which is in turn included in system.nim (and previously was getting imported in chcks.nim but then system.nim improts something... and that breaks HCR (perhaps it could be fixed but it would be nice not to import anything in system)) * fix for clang & C++ - explicitly casting a function pointer to void* more stable mangling of parameter names when HCR is on the length of the static arrays in the DatInit functions is now part of the name of the variables, so when they get resized they get also recreated more stable mangling for inline functions - no longer depends on the module which first used them work on the new complicated HCR test - turned surprisingly complex - WIP test now successfully passes even when re-running `koch test` (previously when the nimcache wasn't cold that lead to errors) better documentation calling setStackBottomWith for PreMain passes over the HcrInit/DatInit/Init calls of all modules are now in the proper order (first all of one type, then all of the next). Also typeinfo globals are registered (created) in a single pass before the DatInit pass (because of the way generic instantiations are handled) Fix the test suite execution on macOs fix for being able to query the program arguments when using HCR on posix! other fixes * Bugfix: Fix a compilation error in C++ mode when a function pointer is converted to a raw pointer * basic documentation for the new hot code reloading semantics * Add change log entry * Don't re-execute the top-level statements while reloading JS code * fix a number of tests broken in a recent bugfix * Review changes * Added {.executeOnReload.} pragma that indicates top-level statements that should be executed on each reload. To make this work, I've modified the way the `if (hcr_init_) {...}` guards are produced in the init code. This still needs more work as the new guards seem to be inserted within the previously generated guards. This change also removes the need for `lastRegistedGlobal` in nimhcr. * Implemented the `signatureHash` magic and the `hasModuleChanged` API depending on it (the actual logic is not imlemented yet). * Add the "hcr" prefix to all HCR-related symbols in the system module. Added a new `hotcodereloading` module exporting the high-level API to the user. Besides being more hygienic, this was also required in order to make it possible to use macros in the high-level API. Without the split, `system` would have to import `macros`, which was going to produce the well-known init problems. * Attempted to solve the "GC markers problem". Crashes were expected with the previous code, because the GC markers were compiled as normal procs are registered in the GC. When their module is unloaded, dangling pointers will remain in the GC tables. To solve this issue, I don't register any GC markers when HCR is on, but I add them to the HCR globals metadata and I use a single marker registed in nimhcr during the initialization of the system module that will be responsible for marking all globals. * fix a compilation error * - implemented the hasModuleChanged functionality - tuples can be returned and broken into different vars in global scope - added comments for the closnig scopes of the if statements in the init proc - the new executeOnReload pragma works now! - other fixes * finally! fixing this hack in a proper way - declaring the destructor out of line (out of the class body) - we no longer need to forward-declare popCurrentExceptionEx * Force full module parsing This is a temporary hack that breaks some tests. I'll investigate later how these can be fixed. * tuples are now properly handled when global! * these comments mess up the codegen in debug mode when $n is not actually a new line (or something like that) - these labels are intended only for GOTO labels anyway... * "solved" the issue with the .pdb locks on windows when a binary is being debugged and hot code reloading is used at the same time * fixes after rebasing... * small fixes for the test * better handling of globals! no more compiler crashes for locals with the global pragma, also simplified code around loops in global scope which have local vars (actually globals) * we can now use the global pragma even for ... globals! * the right output * lets try those boehm GC tests * after the test is ran it will be at its starting state - no git modifications * clarification in the docs * removed unnecessary line directives for forward declarations of functions - they were causing trouble with hot code reloading when no semantic change propagates to the main module but a line directive got changed and thus the main module had to be recompiled since the .c code had changed * fixed bug! was inserting duplicate keys into the table and later was removing only 1 copy of all the duplicates (after a few reloads) * no longer breaking into DatInit code when not supposed to * fixes after rebasing * yet more fixes after rebasing * Update jssys.nim * Rework the HCR path-handling logic After reviewing the code more carefully, I've noticed that the old logic will be broken when the user overrides the '--out:f' compiler option. Besides fixing this issues, I took the opportunity to implement the missing '--outdir:d' option. Other changes: * ./koch test won't overwrite any HCR and RTL builds located in nim/lib * HCR and RTL are compiled with --threads:on by default * Clean up the globals registration logic * Handle non-flattened top-level stmtlists in JS as well * The HCR is not supported with the Boehm GC yet Also fixes some typos and the expected output of the HCR integration test * The GC marker procs are now properly used as trampolines * Fix the HCR integration test in release builds * Fix ./koch tools * this forward declaration doesn't seem to be necessary, and in fact breaks HCR because a 2nd function pointer is emitted for this externed/rtl func * the forward declaration I removed in the last commit was actually necessary * Attempt to make all tests green * Fix tgenscript * BAT file for running the HCR integration test on Windows [skip ci] * Fix the docgen tests * A final fix for Travis (hopefully)
* daily cruft removalJacek Sieka2018-12-081-20/+0
|
* Add `toOpenArray[T](ptr UncheckedArray[T])` for clarity. (#9316)c-blake2018-10-121-1/+1
| | | | | | | | | | | * Add `toOpenArray[T](ptr UncheckedArray[T])` for clarity. `ptr array[0,T]` for some unchecked type already works but A) `UncheckedArray` seems to be the intended future way for this kind of access, and B) essentially all use cases will have a `ptr` for that kind of array source and this call signature lets callers drop the trailing `[]` corresponding to that `ptr` deref. This PR relates to issue https://github.com/nim-lang/Nim/issues/9001 . * Add a test for toOpenArray() for UncheckedArray[T]s.
* make tests green againAraq2018-08-211-1/+1
|
* fixes merge conflictAndreas Rumpf2018-08-191-2/+2
|\
| * WIP: disallow 'nil' for strings and seqsAndreas Rumpf2018-08-131-2/+2
| |
* | more progress on destructor based stringsAndreas Rumpf2018-07-131-3/+7
|/
* codgen refactoring: prepare for alternative string/seq implementationsAndreas Rumpf2018-06-291-6/+6
|
* fixex merge conflictsAraq2018-06-081-3/+2
|\
| * check bounds instead of indexnitely2018-06-051-3/+2
| |
* | platform.nim doesn't use globals anymore; prepare msgs.nim for not using globalsAndreas Rumpf2018-05-181-15/+15
|/
* C code generator compiles againAndreas Rumpf2018-05-121-9/+9
|
* make tests greenAndreas Rumpf2018-04-281-1/+1
|
* string to cstring conversions produce the empty C string for nil; this will ↵Andreas Rumpf2018-04-281-4/+4
| | | | be consistent with alternative string implementations
* added toOpenArray builtin for zero-copy slices; syntax sugar yet to comeAraq2018-03-241-12/+24
|
* fixes #6960Andreas Rumpf2018-02-111-2/+2
|
* preparations for language extensions: 'sink' and 'lent' typesAndreas Rumpf2018-01-071-4/+4
|
* deprecated unary '<'Andreas Rumpf2017-10-291-3/+3
|
* fixes #6435Andreas Rumpf2017-09-251-1/+1
|
* refactoring: TLoc knows the node it originated from; it is planned to use ↵Andreas Rumpf2017-09-211-3/+3
| | | | this to produce better C code (move optimizations)
* minor codegen bugfix: don't use names for closures that are also mangled Nim ↵Araq2017-02-261-2/+2
| | | | names
* fixes a minor codegen issue where name mangling could produce an identifier ↵Araq2017-02-261-1/+1
| | | | used by the codegen; refs #5437
* Reset exprs before return by arg. Fixes #5098 (#5191)Brandon Pickering2017-01-111-2/+2
|
* removed tyArrayConstr completely from the compiler; introduced tyAlias ↵Araq2016-11-141-6/+6
| | | | instead in preparation for further bugfixes
* remove unused stuffJacek Sieka2016-08-091-2/+2
|
* remove keepAlive and friendsJacek Sieka2016-08-091-5/+0
|
* fixes #4371Andreas Rumpf2016-07-081-1/+1
|
* Return nil from genOtherArg after error.Matthew Baulch2016-07-051-1/+3
|
* Report wrong arg count when too many params and no varargs.Matthew Baulch2016-07-051-0/+2
|
* Merge branch 'devel' into new-llAndreas Rumpf2016-01-141-0/+8
|\
| * fixed #2240 and #3586andri lim2016-01-051-0/+8
| |
* | fixes #2659Andreas Rumpf2016-01-041-2/+2
|/
* fixes #3144Araq2015-07-261-19/+19
|
* importing of C++ nested generics like std::vector<T>::iterator, using the ↵Zahary Karadjov2015-04-131-10/+3
| | | | apostrophe operator
* Get rid of deprecation warningsdef2015-04-071-87/+87
|
* compiler_ropes: ropeToStr -> $Jacek Sieka2015-04-011-2/+2
|
* bugfixes for C++ codegenAraq2015-04-011-2/+28
|
* fixes #1717, fixes #2324Araq2015-03-221-1/+4
|
* fixes #2266Araq2015-03-221-1/+1
|
* fixes #2336Araq2015-03-161-1/+2
|
* bugfix: c++ pattern #@ could index out of boundsAraq2015-03-101-5/+6
|
* fixes #2199, fixes #2197Araq2015-02-241-1/+1
|
* fixes #2068Araq2015-02-121-9/+21
|
* fixes c++ codegen regressionAraq2015-02-071-1/+1
|
* lots of C++ codegen improvementsAraq2015-02-071-8/+16
|
* C++ support: codegen generates C++'s references and avoids copiesAraq2015-02-041-26/+50
|
* bugfixes for the new C++ patternsAraq2015-01-231-8/+7
|
* better C++ support wrt 'this'Araq2015-01-181-20/+90
|
* patterns for 'importcpp' (still undocumented)Araq2015-01-141-27/+91
|
0119066adf6a9a2e8d779d4955637c6dd99aba3'>^
fd522aa40 ^

4fa80956b ^





e25474154 ^







4fa80956b ^




e25474154 ^

4fa80956b ^
f46870fe1 ^
e25474154 ^


ff02ce2d5 ^
4fa80956b ^
72ceda98c ^
4fa80956b ^








ff02ce2d5 ^




e25474154 ^


dc669155e ^
e25474154 ^

















e25474154 ^
27d7e3a0a ^
e25474154 ^




93a140b90 ^


3e9dcc8be ^


93a140b90 ^
e25474154 ^



e25474154 ^


7063670a2 ^
e25474154 ^
03724c295 ^
7063670a2 ^







ff02ce2d5 ^




7063670a2 ^






ff02ce2d5 ^

7063670a2 ^

e25474154 ^

ff02ce2d5 ^






e25474154 ^
93a140b90 ^

e25474154 ^
e25474154 ^
ff02ce2d5 ^
e25474154 ^


03724c295 ^

ff02ce2d5 ^

93a140b90 ^

27d7e3a0a ^
e25474154 ^
abe9dfafe ^



ff02ce2d5 ^
93a140b90 ^
e25474154 ^


2f066395b ^
e25474154 ^
03724c295 ^
ff02ce2d5 ^



6850fb73c ^
ff02ce2d5 ^
e25474154 ^

0b197ade6 ^
27d7e3a0a ^
e25474154 ^
dc669155e ^
0b197ade6 ^
e25474154 ^
0b197ade6 ^
e25474154 ^




ff02ce2d5 ^
e25474154 ^




93a140b90 ^



e25474154 ^
93a140b90 ^

e25474154 ^





66cfc851a ^

66cfc851a ^

67a30d837 ^
e25474154 ^
67a30d837 ^

e25474154 ^
6781da521 ^



e25474154 ^
6781da521 ^
e25474154 ^
67a30d837 ^
6781da521 ^
e25474154 ^




6850fb73c ^
e25474154 ^





e25474154 ^
6781da521 ^
e25474154 ^

6781da521 ^
e25474154 ^
3260702a6 ^

e25474154 ^




6781da521 ^

e25474154 ^





ff02ce2d5 ^
0b197ade6 ^
e25474154 ^


fc0b66a7f ^
e25474154 ^

0b197ade6 ^
e25474154 ^

0b197ade6 ^
e25474154 ^

f530bbd63 ^
73c355176 ^

e25474154 ^
0b197ade6 ^
a58a2f382 ^
e25474154 ^


6850fb73c ^
abe9dfafe ^
6850fb73c ^
ade67f1ab ^
4fa80956b ^

e25474154 ^
ade67f1ab ^
6850fb73c ^
e25474154 ^



3091bc495 ^


0b197ade6 ^

3091bc495 ^

e25474154 ^
d871cadbb ^
e25474154 ^
ade67f1ab ^
3091bc495 ^
d871cadbb ^


abe9dfafe ^

d871cadbb ^



e25474154 ^










4fa80956b ^
e25474154 ^



72ceda98c ^
4fa80956b ^

e25474154 ^
4fa80956b ^
e25474154 ^

e25474154 ^






ade67f1ab ^
e25474154 ^










e00863083 ^
f530bbd63 ^
e00863083 ^
e25474154 ^

3260702a6 ^

f530bbd63 ^

d871cadbb ^

e25474154 ^





















c9e011e36 ^



e25474154 ^
c9e011e36 ^




e25474154 ^



c9e011e36 ^
e25474154 ^




e25474154 ^
c9e011e36 ^
6850fb73c ^

e25474154 ^

c9e011e36 ^



e25474154 ^
6850fb73c ^

e25474154 ^
c9e011e36 ^

e25474154 ^
c9e011e36 ^

e25474154 ^
c9e011e36 ^


e25474154 ^
c9e011e36 ^

ff02ce2d5 ^
e25474154 ^
03724c295 ^



e25474154 ^




f56816def ^
e25474154 ^





e25474154 ^




6781da521 ^


e25474154 ^
ff02ce2d5 ^
e25474154 ^

ff02ce2d5 ^
e25474154 ^
dce8d3d1a ^
67a30d837 ^

dce8d3d1a ^
e25474154 ^
a6f90d4cd ^






67a30d837 ^
6781da521 ^

e25474154 ^
a6f90d4cd ^







e25474154 ^
a6f90d4cd ^


e25474154 ^
dce8d3d1a ^
67a30d837 ^
a6f90d4cd ^
0b197ade6 ^
a6f90d4cd ^



e25474154 ^


a6f90d4cd ^

e25474154 ^
a6f90d4cd ^
4fa80956b ^
182ab85dc ^
a6f90d4cd ^



e25474154 ^



ade67f1ab ^

e25474154 ^




ade67f1ab ^
e25474154 ^


f265c3e86 ^

e25474154 ^

67a30d837 ^
e25474154 ^








f265c3e86 ^

7ebaf4489 ^
67a30d837 ^
e25474154 ^







dce8d3d1a ^


f530bbd63 ^

43eace163 ^
5b28d0820 ^
7ebaf4489 ^
dce8d3d1a ^
43eace163 ^

dce8d3d1a ^
43eace163 ^
e25474154 ^
e25474154 ^
e25474154 ^
5b28d0820 ^
f265c3e86 ^
e25474154 ^



f265c3e86 ^
e25474154 ^


f265c3e86 ^
6781da521 ^

e25474154 ^





43eace163 ^







182ab85dc ^







e25474154 ^
dce8d3d1a ^
f530bbd63 ^
43eace163 ^
43eace163 ^
182ab85dc ^






43eace163 ^





182ab85dc ^
7ebaf4489 ^
182ab85dc ^
43eace163 ^
dce8d3d1a ^

43eace163 ^


627d33da0 ^




e25474154 ^


e25474154 ^
5b28d0820 ^
f265c3e86 ^
e25474154 ^


7ebaf4489 ^
e25474154 ^
7ebaf4489 ^
182ab85dc ^

e25474154 ^

f265c3e86 ^
627d33da0 ^
f265c3e86 ^



e25474154 ^


7ebaf4489 ^
182ab85dc ^
e25474154 ^
182ab85dc ^


e25474154 ^
7ebaf4489 ^
e25474154 ^






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988