summary refs log tree commit diff stats
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* once C++, always C++ [backport] (#19938)Jacek Sieka2022-06-301-10/+16
| | | | | | | | | | | * once C++, always C++ When using `{.compile: "file.cc".}` in a nim module, even when compiling with `nim c` the C++ compiler should be used - once any C++ file has been compiled, the C++ linker also needs to be used. * more strict C++ check * simplify code
* dec inLoop after exiting the while scope in computeLiveRanges [backport] ↵flywind2022-06-291-1/+1
| | | | | | | (#19918) * dec inLoop after exiting the while scope in computeLiveRanges * add testcase
* ref #19830; multiple definition of in Nim generated static libraries (#19934)flywind2022-06-271-18/+18
| | | | | * ref #19830; multiple definition of in Nim generated static libraries * fix compile errors
* [vm]fixes #15974 #12551 #19464 #16020 #16780 #16613 #14553 #19909 #18641 ↵flywind2022-06-222-13/+18
| | | | | | | | | | | | | | | (#19902) [backport] * revert #12217 since the root problem seems to have been fixed; fix #15974;fix #12551; fix #19464 * fix #16020; fix #16780 * fix tests and #16613 * fix #14553 * fix #19909; skip skipRegisterAddr * fix #18641
* [Tiny] correct comment opcDeref => opcLdDeref (#19908)flywind2022-06-211-1/+1
| | | correct comment opcDeref => opcLdDeref
* [vm] refactor `stdlib.marshal.load` (#19905)flywind2022-06-191-17/+1
| | | refactor stdlib.marshal.load
* Better range error messages (#19867)Tanguy2022-06-151-3/+3
| | | | | | | * Better range error messages * Revert to old behavior for arrays * Small corrections
* Fixes #19883 so genscript works with vcc (#19893)Don-Duong Quach2022-06-151-2/+8
|
* Initial implementation of nimsuggest v3 (#19826)Ivan Yonchovski2022-06-134-21/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial implementation of nimsuggest v3 Rework `nimsuggest` to use caching to make usage of ide commands more efficient. Previously, all commands no matter what the state of the process is were causing clean build. In the context of Language Server Protocol(LSP) and lsp clients this was causing perf issues and overall instability. Overall, the goal of v3 is to fit to LSP Server needs - added two new commands: - `recompile` to do clean compilation - `changed` which can be used by the IDEs to notify that a particular file has been changed. The later can be utilized when using LSP file watches. - `globalSymbols` - searching global references - added `segfaults` dependency to allow fallback to clean build when incremental fails. I wish the error to be propagated to the client so we can work on fixing the incremental build failures (typically hitting pointer) - more efficient rebuild flow. ATM incremental rebuild is triggered when the command needs that(i. e. it is global) while the commands that work on the current source rebuild only it Things missing in this PR: - Documentation - Extensive unit testing. Although functional I still see this more as a POC that this approach can work. Next steps: - Implement `sug` request. - Rework/extend the protocol to allow better client/server communication. Ideally we will need push events, diagnostics should be restructored to allow per file notifications, etc. - implement v3 test suite. - better logging * Add tests for v3 and implement ideSug * Remove typeInstCache/procInstCache cleanup * Add ideChkFile command * Avoid contains call when adding symbol info * Remove log * Remove segfaults
* [semfold] fix #19199; properly fold uint to float conversion (#19890) [backport]flywind2022-06-131-1/+1
| | | fix #19199; properly fold float conversion
* [cleanup] remove unnecessary procs in vm (#19888)flywind2022-06-132-6/+2
| | | remove unused procs
* Friendlier error message with solution (#19880)Carlo Capocasa2022-06-111-1/+2
| | | | | | | | | | | | | * Add helpful suggestion, should always apply * mention var param limitation in async docs * Update compiler/lambdalifting.nim whoops thanks Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com> Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
* Extend and document compiler debugging utilities (#19841)quantimnot2022-06-101-0/+16
| | | | | | | | | * Add two debugutils procs that native debuggers can break on use to execute commands when code of interest is being compiled. * Add GDB and LLDB programs to disable and enable breakpoints and watchpoints when code of interest is being compiled. * Extend the `intern.rst` docs regarding debugging the compiler. Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
* remove noop option `gc:v2` (#19810)flywind2022-06-104-6/+3
| | | | | * remove noop option gc:v2 * changelog
* not generate initStackBottomWith in arc/orc [backport] (#19875)flywind2022-06-101-1/+1
| | | not generate initStackBottomWith in arc/orc
* give a better error message for some template expansions (#19871)Andreas Rumpf2022-06-091-2/+4
|
* RST: improve simple tables (#19859)Andrey Makarov2022-06-042-0/+3
| | | | | | | * RST: improve simple tables * nim 1.0 gotchas * Still allow legacy boundaries like `----`
* Stop type aliases from inheriting sfUsed (#19861)quantimnot2022-06-041-1/+1
| | | | | Fixes #18201 Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
* Refactor and doc package handling, module name mangling (#19821)quantimnot2022-05-3015-243/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor and doc package handling, module name mangling * Consolidate, de-duplicate and extend package handling * Alter how duplicate module names of a package are handled * Alter how module names are mangled * Fix crash when another package is named 'stdlib' (test case added) * Doc what defines a package in the manual Modules with duplicate names within a package used to be given 'fake' packages to resolve conflicts. That prevented the ability to discern if a module belonged to the current project package or a foreign package. They now have the proper package owner and the names are mangled in a consistent manner to prevent codegen clashes. All module names are now mangled the same. Stdlib was treated special before, but now it is same as any other package. This fixes a crash when a foreign package is named 'stdlib'. Module mangling is altered for both file paths and symbols used by the backends. Removed an unused module name to package mapping that may have been intended for IC. The mapping was removed because it wasn't being used and was complicating the issue of package modules with duplicate names not having the proper package owner assigned. * Fix some tests * Refactor `packagehandling` * Remove `packagehandling.withPackageName` and its uses * Move module path mangling from `packagehandling` to `modulepaths` * Move `options.toRodFile` to `ic` to break import cycle * Changed import style to match preferred style Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
* [vm] remove unused opcSubstr opcode (#19834)flywind2022-05-302-10/+2
| | | remove unused opcSubstr
* Fix global destructor injection for JS backend (#19797)quantimnot2022-05-231-5/+25
| | | | | | | | | | | | | | * Fix global destructor injection for JS backend * Moved global destructors injection before the final call to transform and generate JS code. It had previously been after and thus not no JS was generated for them. * Added some internal documentation of `jsgen`. * Enable a current destructor test to cover the JS backend as well. * Fixes the JS aspect of #17237. * Fixed global destructor injection order for JS backend Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
* Add 'usages' option to the --stylechecks error msg (#19759)Zoom2022-05-041-2/+2
|
* Fix fixAbstractType for user defined typeclasses, fixes #19730 & #18409 (#19732)nc-x2022-04-301-1/+1
|
* Make sure that field usage preserves the original line info (#19751)Ivan Yonchovski2022-04-291-0/+2
| | | | Currently `struct.field` will generate a node with `info` that points to the symbol definition instead of having the actual node location.
* fixes #18612; apply cache and memcmp for methods in arc/orc (#19749)flywind2022-04-261-2/+5
| | | | | | | | | | | | | | | | | * try using endsWith * use memcmp * add cache * cleanup * better * minor * fix * improve test coverage for methods with ARC
* use signed comparisons for the index checking in the hope it improves the ↵Andreas Rumpf2022-04-261-7/+7
| | | | code generation (#19712)
* fixes #19662; Indent level errored for first line (#19718)flywind2022-04-253-1/+6
|
* fix NimNode comment repr() regression [backport: 1.2] (#19726)flywind2022-04-251-0/+2
|
* add warnings for gc:option (#19722)flywind2022-04-251-42/+49
|
* fix #19435; don't create TypeBoundOps for tyOpenArray, tyVarargs [backport: ↵flywind2022-04-251-1/+1
| | | | | | | | | 1.6] (#19723) * fix #19435; openArray wronyly registers typebounds * add testcase * don't create TypeBoundOps for tyOpenArray, tyVarargs
* Move common Latex code into class nimdoc.cls (#19734)Andrey Makarov2022-04-212-1/+7
|
* fix #19680; check if stderr is static (#19709)flywind2022-04-121-1/+1
|
* fix #17286 nim check -b:js works (#19704)flywind2022-04-091-0/+2
| | | | | * fix #17286 nim check -b:js works * fix
* fix stylecheck bug with nre (#19356)flywind2022-04-081-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref #19319 * prefer importCompilerProc * fix stylecheck error with asyncdispatch it is a partial regression since #12842 * add tests * don't use echo in tests * fix stylecheck bug with nre * Update compiler/linter.nim * no need to check dotexpr again * neither did let/var/const
* [nimsuggest] return the type when on symbol in let/var (#19639)Ivan Yonchovski2022-04-071-3/+6
| | | - make sure `suggestSym` is called after `PSym.typ` is set.
* fix #18986; Import/except doesn't work on devel [backport: 1.6] (#19687)flywind2022-04-061-1/+1
| | | | | * fix #18986; Import/except doesn't work on devel [backport: 1.6] * add testcase
* Fix bug in freshVarForClosureIter. Fixes #18474 (#19675) [backport]flywind2022-04-043-21/+17
| | | | | | | | | | * Fix bug in freshVarForClosureIter. Fixes #18474. freshVarForClosureIter was returning non-fresh symbols sometimes. Fixed by making addField return the generated PSym. * remove discardable Co-authored-by: Nick Smallbone <nick@smallbone.se>
* fixes #14318 (#14335)Andreas Rumpf2022-03-261-1/+1
|
* fix #8219; nim check/dump shouldn't run single nimscript project [backport: ↵flywind2022-03-261-1/+2
| | | | | | 1.6] (#19641) * fix #8219; nim check/dump shouldn't run single nimscript project [backport: 1.6]
* remove tmpFramePtr when optStackTrace is absent (#19649)flywind2022-03-261-4/+0
|
* fixes #19603; some pragmas were really only supported as top level ↵Andreas Rumpf2022-03-262-7/+16
| | | | statements. Now this is enforced properly. (#19646)
* mitigates #19364 [backport]; we make this bug more unlikely to appear by ↵Andreas Rumpf2022-03-261-6/+12
| | | | producing better code to begin with; real fix will come later (#19647)
* remove unnecessary framePtr code (#19645)flywind2022-03-251-3/+6
|
* fix nim check nimscript [backport: 1.6] (#19444)flywind2022-03-232-1/+7
| | | | fix #19440; fix #3858
* output byref types into --header file [backport: 1.6] (#19505)flywind2022-03-231-2/+7
| | | | | | | | | * output byref types into --header file fix #19445 * fix comments * set targets
* move assertions out of system (#19599)flywind2022-03-2379-1/+251
|
* fixes #19615; emit better code for integer divisions when the divisor… ↵Andreas Rumpf2022-03-221-6/+16
| | | | | | | (#19626) * fixes #19615; emit better code for integer divisions when the divisor is known at compile-time * proper bugfix: unsigned numbers cannot be -1
* fixes #19631 (#19618)Andreas Rumpf2022-03-201-3/+8
| | | Aliasing is hard and we have to watch out not to compile 'x = f(x.a)' into 'f(x.a, addr x)'
* compiler: Handle nkCheckedFieldExpr better in dfa (#19616)Clyybber2022-03-181-4/+2
| | | | | | | Simply recurse into their first child, which is always a nkDotExpr instead of treating them seperately. This fixes the rhs sym of a nkCheckedFieldExpr being checked twice in aliases. This double checking didn't cause any issues, but was unintentional and redundant.
* support useVersion:1.6 (#19601)flywind2022-03-102-0/+5
|