Commit Graph

328 Commits

Author SHA1 Message Date
Andreas Rumpf
c5358b0d4b An optimizer for ARC (#14962)
* WIP: an optimizer for ARC
* do not optimize away destructors in 'finally' if unstructured control flow is involved
* optimized the optimizer
* minor code cleanup
* first steps to .cursor inference
* cursor inference: big steps to a working solution
* baby steps
* better .cursor inference
* new feature: expandArc for easy inspection of the AST after ARC transformations
* added topt_cursor test
* adapt tests
* cleanups, make tests green
* optimize common traversal patterns
* moved test case
* fixes .cursor inference so that npeg compiles once again
* cursor inference: more bugfixes

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-07-15 23:00:06 +02:00
Ico Doornekamp
d7ccd82eac VM profiler (#14833)
* Crude VM profiler

* Added --profileVM flag, refactoring

* fixed FileLine hash

* Use TLineInfo instead of own FileLine, updated formatting

* Refactoring, moved PStackFrame to vmdefs for cleaner data structure

* Moved vmprofiler to separate file

* Simplified TLineInfo hash, use toFileLineCol for output

* Hash

* Moved profile data into Config, dump only once at end of run

* Changed profile output header to show '#instr' instead of 'count'

* Do not accumulate instrcount for non-top frames

Co-authored-by: Ico Doornekamp <git@zevv.nl>
2020-07-09 19:18:35 +02:00
Timothee Cour
dc5a40f3f3 {.deprecated: [existsFile: fileExists].} (#14735)
* {.deprecated: [existsFile: fileExists].}

* s/existsFile/fileExists/ except under deps

* workaround pending #14819

* fix test
2020-07-02 16:19:13 +02:00
Juan Carlos
74d1f25010 Clean out oldast (#14837)
* Clean out old Deprecated CLI switch
* Update to remove --oldast CLI option
2020-06-30 10:01:25 +02:00
Juan Carlos
28510a9da9 Deprecated laxStrings for mutating the internal zero terminator on strings and its Deprecated code cleaned out (#14766)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2020-06-23 13:20:53 +02:00
Timothee Cour
01f6e505c8 bug fixes with sfMainModule, hints, mainPackageNotes, mainPackageId, hintSuccessX (#14555)
* SuccessX `out` now works with --compileOnly and jsonscript; fix bugs in jsonscript
* several bug fixes; eg: `nim doc lib/system/io` now is sane
* dummy edit to force docs CI
2020-06-04 10:40:17 +02:00
Timothee Cour
4301a3da9d * honor --errorMax even for tools (eg drnim, nim doc) (#14546)
* fix a bug that prevented nim doc compiler/nim on windows
2020-06-02 18:54:33 +02:00
Timothee Cour
58282547f6 fix #6583, fix #14376, index+search now generated for all projects, many bug fixes with nim doc (#14324)
* refs #6583 fix nim doc output
* changelog
* change default for outDir when unspecified
* cleanups
* --project implies --index
2020-05-25 13:25:40 +02:00
Andreas Rumpf
ddee8a362a change the [Processing] messages into dots (#14418)
* change the [Processing] messages into dots

* better implementation

* maybe I should work on something else...
2020-05-21 22:36:34 +02:00
Timothee Cour
c777f2fb60 fix some issues with --backend (#14363)
* fix some issues with --backend
* fix https://github.com/timotheecour/Nim/issues/175; improve upon #14306
2020-05-16 13:09:18 +02:00
Timothee Cour
9502e39b63 nim doc --backend:js, nim doc --doccmd:-d:foo, nim r --backend:js, --doccmd:skip + other improvements (#14278)
* `nim doc --backend:js|cpp...`
`nim doc --doccmd:'-d:foo --threads:on'`
`nim r --backend:cpp...` (implies --run --usenimcache)
* --usenimcache works with all targets
* --docCmd:skip now skips compiling snippets; 50X speedup for doc/manual.rst
2020-05-11 12:01:18 +02:00
Andreas Rumpf
c64db68f0b added a new feature: --cc:env so that you can use any C compiler as long as it works like GCC 2020-05-06 18:41:24 +02:00
Andreas Rumpf
1b2b32169a cleanup the CC setting, only leave in there what is at least semi-officially supported 2020-05-06 18:41:24 +02:00
hlaaftana
76ffa4fa25 fixes #14112, tests for #12892, #12671, #11697 (#14125) 2020-04-26 10:12:16 +02:00
Timothee Cour
5c534b2943 new cmd: nim r main [args...] to compile & run, saving binary under $nimcache/main (#13382)
* implement `nim r main` to compile and run, saving binary to $nimcache
* remove outFileAbs for now
2020-04-23 10:02:18 +02:00
Araq
59f1462b95 remove the nilChecks switch; refs #11570 2020-04-20 14:44:54 +02:00
Timothee Cour
b2720317fa add --experimental:vmopsDanger; add generic conversion for vmops (#13813)
* add --experimental:vmopsDanger; vmops cleanups
2020-04-20 12:00:00 +02:00
Hessam Mehr
bff742cd8b Add support for zig cc as C compiler. (#13757) 2020-04-08 15:24:14 +02:00
Andreas Rumpf
9c46927fad new feature: ability to turn specific warnings to errors 2020-04-04 22:56:03 +02:00
Alexander Ivanov
920add5880 sourcemaps for the JS codegen (#7508) 2020-04-03 12:06:23 +02:00
Timothee Cour
19cab9fa51 stacktraces can now show custom runtime msgs per frame (#13351)
* stacktraces can now show custom runtime msgs
* improve tests/stdlib/tstackframes.nim
* fix test for --gc:arc
* test --stacktraceMsgs:on and --stacktraceMsgs:off
* --stacktracemsgs:off by default
2020-03-30 13:45:32 +02:00
Andreas Rumpf
2a278f6eba '.push raises: []' now also affects proc types (#13776)
* '.push raises: []' now also affects proc types

* fixes the regression

* less disruptive bugfix

* another attempt
2020-03-29 22:00:18 +02:00
Miran
e1e062197e bump copyright year to 2020 (#13753) 2020-03-25 21:28:16 +01:00
Andreas Rumpf
3f29911a94 new feature: --staticBoundChecks:on to enforce static array index checking (#10965) 2020-03-18 14:25:10 +01:00
Timothee Cour
6e0c06f50e fix #13218: avoid some irrelevant warnings for nim doc,rst2html,--app:lib, + other fixes (#13550)
* fix #13218: avoid some irrelevant warnings for nim doc,rst2html
* suppress warnRedefinitionOfLabel for nim doc
* lots of fixes for UnusedImport warnings
2020-03-13 20:42:41 +01:00
Andreas Rumpf
a6682de004 catchable defects (#13626)
* allow defects to be caught even for --exceptions:goto (WIP)
* implemented the new --panics:on|off switch; refs https://github.com/nim-lang/RFCs/issues/180
* new implementation for integer overflow checking
* produce a warning if a user-defined exception type inherits from Exception directly
* applied Timothee's suggestions; improved the documentation and replace the term 'checked runtime check' by 'panic'
* fixes #13627
* don't inherit from Exception directly
2020-03-12 23:44:33 +01:00
Andreas Rumpf
a0eca75182 sink parameter inference for types that have destructors (#13544)
* ensure capitalize doesn't take an inferred sink parameter

* sink parameter inference: first version, for now disabled. Changed that sink parameters can be consumed multiple times in order to adhere to our spec.

* sink inference can now be disabled with .nosinks; sometimes for proc type interop this is required

* fixes yet another critical DFA bug

* better implementation that also understands if expressions etc

* document sink parameter inference and allow for global disabling
2020-03-04 14:28:53 +01:00
Timothee Cour
1056f9ecff properly handle note override logic/verbosity/config/cmdline using modifiedyNotes, cmdlineNotes 2020-02-27 13:22:18 +01:00
Timothee Cour
c1cbf94e2d remove isCmdLine; use passCmd1 2020-02-27 13:22:18 +01:00
Timothee Cour
ce36fdc897 correctly honor cmdline --hint:conf:on/off ; correctly show Conf hints in order 2020-02-27 13:22:18 +01:00
Timothee Cour
bd90199a2f fix #8312 --hints:off and --warnings:off now honored everywhere (#13489) 2020-02-26 10:26:47 +01:00
Timothee Cour
7ec7731f82 fix #13150 nim doc --project now works reliably (#13223)
* fix #13150 `nim doc --project` works with duplicate names and with imports below main project file

* add to help; fixup after #13212 isRelativeTo got merged
* fix test tests/compilerapi/tcompilerapi.nim
* remove nimblePkg field; compute on the fly instead
* kochdocs: compiler docs now under compiler/
* --docRoot now has smart default: best among @pkg, @path
2020-02-06 11:17:00 +01:00
Andreas Rumpf
6efac70181 make goto based exceptions available for 'nim cpp' (#13244)
* make goto based exceptions available for 'nim cpp'
* optimize seq.add to be comparable to C++'s emplace_back
2020-01-25 20:00:13 +01:00
Timothee Cour
b462baed65 VM: allow overriding MaxLoopIterations without rebuilding nim (#13233) 2020-01-23 10:53:30 +01:00
Timothee Cour
1b54be7779 fixes #12998 nim doc regression (#13117) 2020-01-16 14:19:58 +01:00
Timothee Cour
d88b52c0bc successX now correctly shows html output for nim doc, nim jsondoc; fix #13121 (#13116)
* successX now correctly shows html output for nim doc
* fixes #13121
* fixup hintSuccessX to be less weird
2020-01-15 15:18:37 +01:00
Timothee Cour
15043d35b8 make SuccessX show project file + output file (#13043)
* make SuccessX show project file + output file
* address comments
* fix test and add `result.err = reNimcCrash` otherwise hard to see where reNimcCrash used
* address comments
2020-01-08 00:39:07 +01:00
Andreas Rumpf
c3344862b0 --exception:goto switch for deterministic exception handling (#12977)
This implements "deterministic" exception handling for Nim based on goto instead of setjmp. This means raising an exception is much cheaper than in C++'s table based implementations. Supports hard realtime systems. Default for --gc:arc and the C target because it's generally a good idea and arc is all about deterministic behavior.

Note: This implies that fatal runtime traps are not catchable anymore! This needs to be documented.
2020-01-01 10:01:49 +01:00
Timothee Cour
b081166685 fixes #12735 on osx, call dsymutil for debug builds (#12931)
* fix #12735 osx: dsymutil needs to be called for debug builds
* also write dsymutil command to extraCmds in json build file
2019-12-21 20:59:08 +01:00
Andreas Rumpf
83a736a34a ARC: cycle detector (#12823)
* first implementation of the =trace and =dispose hooks for the cycle collector
* a cycle collector for ARC: progress
* manual: the .acyclic pragma is a thing once again
* gcbench: adaptations for --gc:arc
* enable valgrind tests for the strutils tests
* testament: better valgrind support
* ARC refactoring: growable jumpstacks
* ARC cycle detector: non-recursive algorithm
* moved and renamed core/ files back to system/
* refactoring: --gc:arc vs --gc:orc since 'orc' is even more experimental and we want to ship --gc:arc soonish
2019-12-17 17:37:50 +01:00
genotrance
eed328856f Path substitution for --out and --outdir (#12796)
* Enable pathSubs for --out and --outDir
* Cleanup
2019-12-03 09:26:18 +01:00
genotrance
49db2a08ba Fixes #12767 (#12768) 2019-11-29 10:18:44 +01:00
Clyybber
7e747d11c6 Cosmetic compiler cleanup (#12718)
* Cleanup compiler code base

* Unify add calls

* Unify len invocations

* Unify range operators

* Fix oversight

* Remove {.procvar.} pragma

* initCandidate -> newCandidate where reasonable

* Unify safeLen calls
2019-11-28 17:13:04 +01:00
genotrance
010067f3cc Substitute $nimbleDir in --path flags (#12750) 2019-11-28 13:58:38 +01:00
Andreas Rumpf
64e8f050e1 implemented a new localPassc pragma (#12706) 2019-11-22 14:20:15 +01:00
Andreas Rumpf
f7ba7c711a added the --asm command line option for inspection of the produced assember code (#12699) 2019-11-21 22:53:51 +01:00
Andreas Rumpf
c98e0e22ad conversions to unsigned numbers are not checked anymore; implements /… (#12688) [backport]
* conversions to unsigned numbers are not checked anymore; implements / fixes https://github.com/nim-lang/RFCs/issues/175

* change the spec yet again to be less consistent but to make more sense; updated the changelog
2019-11-20 17:08:43 +01:00
Andy Davidoff
738c957e94 add --clearNimblePath; fixes #12601 (#12609) 2019-11-06 20:40:22 +01:00
Andreas Rumpf
62fc3db9d7 --os:ios needs to imply defined(macosx) [backport] (#12585) 2019-11-04 13:05:03 +01:00
Andreas Rumpf
1746da2d9e --gc:destructors now means Nim uses pure refcounting (#12557) 2019-10-30 16:15:17 +01:00