summary refs log tree commit diff stats
path: root/compiler/vm.nim
Commit message (Collapse)AuthorAgeFilesLines
* remove nosinks hacks from compiler (#21469)ringabout2023-03-041-3/+3
|
* replaces implicit passes array registed at runtime with explicit function ↵ringabout2023-03-031-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | calls; simplify compilation pipeline (#21444) * abolish using passes in the compiler; simplify compilation pipeline * duplicate code * Really cool to have the same signature... * haul * unify other backends * refactor process * introduce PipelinePhase * refactor compiler * fixes passes * fixes nimsuggest * add a sentinel * enable docs checkj * activate doc testing * clean up * complete cleanups
* fixes #20139; hash types based on its path relative to its package path ↵ringabout2023-03-021-1/+1
| | | | | | | | | | | | | | | (#21274) [backport:1.6] * fixes #20139; hash types based on its path relative its project * add a test case * fixes procs * better implementation and test case --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #21326; fixes #7375; fixes #11986; fixes #9607; rework quote do; ↵ringabout2023-03-021-1/+4
| | | | | | | | | | | | | `getAst` uses type info to annotate the type of quoted variables; no more type erasures for quoted variables (#21433) * fixes #21326; getAst uses type info to annotateType quoted variables * simplify logics; sem types first * fixes important packages * add testcases * tiny
* fixes #19396; Nimdoc hide nonexported fields (#21305)ringabout2023-02-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * suppresses non-exported fields of types and adds command-line option to re-enable this if desired * corrected the doctest that produced a CI error * an embarrassingly bad error in reasoning * modified a nimdoc test to reflect updated behavior * needed another change to bring utils.html doctest in sync with update * add info * fix nimdoc * lint * render postfix * fixes a problem * fixes nimdoc * fix nimdoc --------- Co-authored-by: johnperry-math <john.perry@usm.edu> Co-authored-by: johnperry-math <devotus@yahoo.com>
* Implemented basic macro expand functionality (#20579)Ivan Yonchovski2023-01-271-0/+3
| | | | | | | | | | | | | | | | | | * Implemented level based macro expand functionality - it can handle single macro call or expand whole function/proc/etc and it - In addition, I have altered the parser to provide the endInfo for the node. The usefulness of the `endInfo` is not limited to the `expandMacro` functionality but also it is useful for `ideOutline` functionality and I have altered the ideOutline functionality to use `endInfo`. Note `endInfo` most of the time is lost during the AST transformation thus in `nimsuggest.nim` I am using freshly parsed tree to get the location information. * Make sure we stop expanding correctly * Test CI * Fix tv3_outline.nim
* fixes #14409; fixes #10674 VM callbacks switch to table-index seqs (#21297)ringabout2023-01-261-2/+2
| | | | | | | * fixes #14409; fixes#10674 VM callbacks switch to table-index seqs * fixes package name * reduce runtime cost
* remove dead code in VM (#21296)ringabout2023-01-251-6/+0
| | | remove deadcode in VM
* Force lambda lifting for getImplTransformed. Hacky. Fixes #19818 (#21031)Yuriy Glukhov2023-01-191-1/+1
|
* remove legacy code (#21134)ringabout2022-12-261-5/+0
| | | | | * remove legacy code * fixes
* Implement setLineInfo (#21153)Peter Munch-Ellingsen2022-12-221-2/+12
| | | | | * Implement setLineInfo * Add tests
* add more `{.cursor.}` to vm (#20796)ringabout2022-11-091-13/+13
|
* fixes regression #20746; remove string copies for ORC booted compiler (#20776)ringabout2022-11-071-1/+3
| | | | | | | | | | | | | * fixes #20746; remove string copies for ORC booted compiler * add a test case * use `cursor` thanks to @beef331 * for old compilers * change file extension * change test cases
* fix #20148 implicit compile time conversion int to ranged float cause… ↵Bung2022-10-291-1/+4
| | | | | (#20698) fix #20148 implicit compile time conversion int to ranged float causes compiler fatal error
* Added 'openArray[char]' overloads to 'std/parseutils' (#20527)Jason Beetham2022-10-241-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added 'openarray[char]' overloads to 'std/parseutils' * Removed redundant `start` and `last` params from slice using procs * Fixed type for parseIdent overload * fixed one by off with 'substr' * removed missed start parameters for procedures * Added 'openarray[char]' overloads to 'std/parseutils' * Removed redundant `start` and `last` params from slice using procs * Fixed type for parseIdent overload * fixed one by off with 'substr' * removed missed start parameters for procedures * Fixed VM op to work with new 'opcSlice' * Corrected captureBetween's logic to work with openarray * js sys's parsefloat logic now uses openarray Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* Implemented `mSlice` on the VM allowing `toOpenArray` to work at compile ↵Jason Beetham2022-10-201-16/+119
| | | | | | | | | | | | | | | | | | | | | | | | | time. (#20586) * Implemented opcSlice to make 'toOpenArray' work on the VM * Added nkOpenArray for VM to reduce bodgeness * Fixed range issues and erraneous comments * Range check correctly for openArrays in opcLdArr * Inverted logic for ldArr checking * vm now supports slicing strings * Added string tests * Removed usage of 'nkOpenArray' and redundant operations * Refactored vmSlice implementation, removing redundant and incorrect code * Made tuples go throw opcWrObj for field assignment * All strkinds should be considered for openarrays
* refactorings (#20536)Andreas Rumpf2022-10-101-1/+1
| | | | | | | * refactoring * refactoring: removed unused macroUsagesSection * enum instead of bool for better readability
* pragma for sfCallsite instead of name check + better semantics, test (#20464)metagn2022-10-031-1/+4
| | | | | | | | | | | * pragma for sfCallsite instead of name check at every template definition Not documented because it seems to be for internal use? Should also make it possible to make comparisons and setops imports, but this doesn't have to be done. I can reuse a name like `cursor` for the pragma as well, added a new name just to be safe. * make sfCallsite recursive, add tests
* move formatfloat out of system (#20195)ringabout2022-08-241-0/+3
| | | | | | | | | | | | | | | * move formatfloat out of system * fixes doc * Update changelog.md * careless * fixes * deprecate system/formatfloat * better handling
* remove shallowCopy for ARC/ORC (#20070)ringabout2022-07-261-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | * remove shallowCopy for ARC/ORC * use move * fix * more fixes * typo * Update lib/system.nim * follow * add nodestroy * move * copy string * add a changelog entry Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Change `styleCheck` to ignore foreign packages (#19822)quantimnot2022-07-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change `styleCheck` to ignore foreign packages * Symbols from foreign packages are now ignored. * Fixed `styleCheck` violations in `compiler` package. * Added symbol ownership to custom annotation pragmas. * Minor refactors to cleanup style check callsites. * Minor internal documentation of reasons why a symbol isn't checked. Style violations were fixed in the compiler after thet were exposed by the changes. The compiler wouldn't compile otherwise. Symbol ownership for custom pragma annotations is needed for checking the annotation's style. A NPE was raised otherwise. Fixes #10201 See also nim-lang/RFCs#456 * Fix a misunderstanding about excluding field style checks I had refactored the callsites of `styleCheckUse` to apply the DRY principle, but I misunderstood the field access handling in a template as a general case. This corrects it. * Fix some `styleCheck` violations in `compiler/evalffi` The violations were exposed in CI when the compiler was built with libffi. * Removed some uneeded transitionary code * Add changelog entry Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
* [vm]fixes #15974 #12551 #19464 #16020 #16780 #16613 #14553 #19909 #18641 ↵flywind2022-06-221-10/+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
* [cleanup] remove unnecessary procs in vm (#19888)flywind2022-06-131-1/+0
| | | remove unused procs
* [vm] remove unused opcSubstr opcode (#19834)flywind2022-05-301-8/+0
| | | remove unused opcSubstr
* register callback for marshal in VM (#19578)flywind2022-03-081-14/+3
| | | | | | | | | | | | | * register callback for marshal in VM * remove unrelated code * polish * more tests * more tests * add loadVM and toVM
* fixes #19404 by protecting the memory we borrow from. this replaces crashes ↵Andreas Rumpf2022-02-121-8/+13
| | | | | with minor memory leaks which seems to be acceptable. In the longer run we need a better VM that didn't grow hacks over a decade. (#19515) Co-authored-by: flywind <xzsflywind@gmail.com>
* fixes #19198 [backport:1.6] (#19209)Andreas Rumpf2021-12-041-2/+4
| | | | | * fixes #19198 [backport:1.6] * added a test case
* parseExpr/parseStmt accept filename, fixes #13540 (#19182)hlaaftana2021-11-241-5/+4
|
* Fix VM's sametype impl to work for generics/typedescs (#19073)Jason Beetham2021-11-021-1/+2
| | | | | | | * Fix vm's sametype implementation to properly handle generics and typedescs * actually fixed sametype + have test * added comments and removed unsafe code
* Added setGlobalValue to VM api (#19007)Jason Beetham2021-10-171-0/+5
|
* properly fix #10053 ; `FieldDefect` msg now shows discriminant value + ↵Timothee Cour2021-08-131-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lineinfo, in all backends (c,vm,js) (#11955) * fix #10053 FieldError for vm * fixup * FieldError now also shows runtime value of discriminant * fix field error reporting in vm * also report culprit line info in err msg * fix errors for newruntime 2 * fix for js * fixup * PRTEMP4 * works * works * works perfect * refactor * std/private/repr_impl * suppport --gc:arc * cleanup * refactor * simplify * simplify * simplify * fixup * move out compiler.vmgen.genCustom * fixup * fixup * add tests * revert compiler/debugutils.nim * simplify reprDiscriminant * fixup * lib/std/private/repr_impl.nim -> lib/system/repr_impl.nim * try to fix D20210812T165220 * honor --declaredlocs * control toFileLineCol via --declaredlocs
* refs #16613: check opcWrDeref for nil (#18613)Timothee Cour2021-07-301-5/+4
|
* enable VM tracing in user code via `{.define(nimVmTrace).}` (#18244)Timothee Cour2021-06-241-2/+5
| | | | | | | * enable VM tracing in user code via `{.define(nimVmTrace).}` * add vmutils.vmTrace * add vmTrace
* fix #18310 system.== in vm for NimNode (#18313)Timothee Cour2021-06-211-5/+6
| | | | | | | * fix #18310 == in vm * fixup * fixup
* ORC: progress (#18000)Andreas Rumpf2021-05-121-1/+1
| | | | | | | | | * ORC: progress * ORC: bugfix; don't follow acyclic data even if only at runtime the subtype is marked as acyclic * progress * minor style changes
* since we have now so many virtual registers, reduce memory consumption for ↵Andreas Rumpf2021-05-101-3/+3
| | | | the register allocator (#17985)
* fix #17836 (typed macro isNil for proc params) (#17841)Saem Ghani2021-04-251-2/+2
| | | thanks @alaviss for the test
* unit separator (#17730)Andreas Rumpf2021-04-201-5/+5
| | | | | * use the ASCII Unit Separator so that error messages can be handled precisely by the tooling * updated testament
* Introduce localErrorNode (#17785)Clyybber2021-04-191-4/+4
|
* cString => cSourceString; tyCString => tyCstring so that error msgs show ↵Timothee Cour2021-04-171-1/+1
| | | | cstring, not cString (#17744)
* fix #17572 (#17586)Timothee Cour2021-03-311-1/+2
|
* unify tuple expressions (#13793)Arne Döring2021-03-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * unify tuple expressions * fix test * fix test * apply feedback * Handle empty tuples * Fix rendering named unary tuple * Protect static NimNode against stripping * Slightly less hacky * Revert "Slightly less hacky" This reverts commit 170c5aec0addc029f637afbc948700ca006b7942. * Slightly less hacky * Cleanup * Fix test * Fix another test * Add condsym * Rebase fallout * changelog: Move from compiler changes to language changes * Add stricter tests * Add empty tuple example to doc/astspec * Fix test Co-authored-by: Clyybber <darkmine956@gmail.com>
* Typo in vm.nimClyybber2021-03-291-1/+1
|
* arc now bootstraps (#17342)Clyybber2021-03-121-8/+14
| | | ./koch boot --gc:arc works :D
* fix #16384 and #17144 (#17126) [backport]flywind2021-03-031-1/+2
|
* Fixes #17039 - ldObj checks node/nodeAddr access (#17123)Saem Ghani2021-02-231-1/+1
| | | | | | Checked field expressions, such as an object variant field access results in occasionally broken address analysis crashing the VM. This guard added here mimics guarded access in ldObjAddr as well. This is to prevent a crash, while a fix is devised.
* fixed dot operator recursive loop & macro suggest (#16922)Saem Ghani2021-02-151-2/+2
| | | | | | | | | | | | | | | | | | * basic stability improvements; refs nimsuggest * fixed dot operator recursive loop & macro suggest * hacky fix for run away dot operator sem check Committing this mostly to make the issue more clear. Perhaps get better feedback. * semExprWithType seems like a better place to check * fixed error messages const case expressions * Clean-up test * stopped the dot operator madness No longer get infinite recursion when seming broken code with a dot operator macro like in jsffi. Co-authored-by: Araq <rumpf_a@web.de>
* remove conditionals on nimHasUserErrors, nimNoNilSeqs2, nimNoNilSeqs (#16861)Timothee Cour2021-01-291-4/+0
| | | | | | | | | * cleanup docs for type(nil) | type(nil); simplify nimHasUserErrors * simplify nimNoNilSeqs2 * simplify nimNoNilSeqs * fixup
* fix #13517 (#16681)flywind2021-01-111-3/+3
|