summary refs log tree commit diff stats
path: root/compiler/vmgen.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes #16790; fixes #19075; put big arrays on the constant seqs; don't ↵ringabout2023-01-311-2/+5
| | | | | | | inline them in the VM; big performance boost (#21318) * don't inline arrays in VM * add a test for #19075
* fixes #14409; fixes #10674 VM callbacks switch to table-index seqs (#21297)ringabout2023-01-261-15/+19
| | | | | | | * 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-3/+0
| | | remove deadcode in VM
* Implement setLineInfo (#21153)Peter Munch-Ellingsen2022-12-221-1/+13
| | | | | * Implement setLineInfo * Add tests
* fixes regression #17121; adding doc comment in importc proc makes it ↵ringabout2022-11-061-1/+10
| | | | | | | | | silently noop at CT (#20766) * fixes regression #17121; adding doc comment in importc proc makes it silently noop at CT * Update compiler/vmgen.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #20740; fixes pre-existing field visibility issues and removes ↵ringabout2022-11-031-1/+3
| | | | | `efSkipFieldVisibilityCheck` (#20741) fixes #20740 pre-existing field visibility and refactoring
* fixes #19201; fixes sink causes crash in VM (#20658)ringabout2022-10-251-1/+1
|
* Added 'openArray[char]' overloads to 'std/parseutils' (#20527)Jason Beetham2022-10-241-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-14/+46
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* fixes #20572 (#20585)Andreas Rumpf2022-10-171-1/+1
| | | | | * fixes #20572 * added a test case
* refactorings (#20536)Andreas Rumpf2022-10-101-1/+1
| | | | | | | * refactoring * refactoring: removed unused macroUsagesSection * enum instead of bool for better readability
* add default field support for object in ARC/ORC (#20480)ringabout2022-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fresh start * add cpp target * add result support * add nimPreviewRangeDefault * reduce * use orc * refactor common parts * add tuple support * add testcase for tuple * cleanup; fixes nimsuggest tests * there is something wrong with cpp * remove * add support for seqs * fixes style * addd initial distinct support * remove links * typo * fixes tuple defaults * add rangedefault * add cpp support * fixes one more bugs * add more hasDefaults * fixes ordinal types * add testcase for #16744 * add testcase for #3608 * fixes docgen * small fix * recursive * fixes * cleanup and remove tuple support * fixes nimsuggest * fixes generics procs * refactor * increases timeout * refactor hasDefault * zero default; disable i386 * add tuples back * fixes bugs * fixes tuple * add more tests * fix one more bug regarding tuples * more tests and cleanup * remove messy distinct types which must be initialized by original types * add tests * fixes zero default * fixes grammar * fixes tests * fixes tests * fixes tests * fixes comments * fixes and add testcase * undo default values for results Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
* store full definition AST for consts, fix noRewrite (#20115)metagn2022-09-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * continue #9582 for consts, close #9331, fix #20114 also move extractPragma to ast to pave the way for things like {.strdefine: "abc".} etc * changelog correctly * fix jsgen * update tgetimpl * fix sighashes * fix #19766, add comment about postfix * fix noRewrite LOL refs #16620 * fix changelog * fix destructors
* Markdown code blocks part 6 (#20292)Andrey Makarov2022-08-311-5/+4
|
* top-down type inference, implements rfc 149 (#20091)metagn2022-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * micro implementation of rfc 149 refs https://github.com/nim-lang/RFCs/issues/149 * number/array/seq literals, more statements * try fix number literal alias issue * renew expectedType with if/case/try branch types * fix (nerf) index type handling and float typed int * use typeAllowed * tweaks + const test (tested locally) [skip ci] * fill out more of the checklist * more literals, change @ order, type conversions Not copying the full call tree before the typedesc call check in `semIndirectOp` is also a small performance improvement. * disable self-conversion warning * revert type conversions (maybe separate op later) * deal with CI for now (seems unrelated), try enums * workaround CI different way * proper fix * again * see sizes * lol * overload selection, simplify int literal -> float * range, new @ solution, try use fitNode for nil * use new magic * try fix ranges, new magic, deal with #20193 * add documentation, support templates Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* [vm]fixes #15974 #12551 #19464 #16020 #16780 #16613 #14553 #19909 #18641 ↵flywind2022-06-221-3/+0
| | | | | | | | | | | | | | | (#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
* [cleanup] remove unnecessary procs in vm (#19888)flywind2022-06-131-5/+2
| | | remove unused procs
* fix #19680; check if stderr is static (#19709)flywind2022-04-121-1/+1
|
* move assertions out of system (#19599)flywind2022-03-231-0/+3
|
* register callback for marshal in VM (#19578)flywind2022-03-081-27/+0
| | | | | | | | | | | | | * register callback for marshal in VM * remove unrelated code * polish * more tests * more tests * add loadVM and toVM
* fixes #19198 [backport:1.6] (#19209)Andreas Rumpf2021-12-041-12/+16
| | | | | * fixes #19198 [backport:1.6] * added a test case
* parseExpr/parseStmt accept filename, fixes #13540 (#19182)hlaaftana2021-11-241-2/+2
|
* correct effect tracking for .borrowed procs [backport] (#18882)Andreas Rumpf2021-09-231-1/+1
| | | | | | | | | | | * correct effect tracking for .borrowed procs [backport] * progress * fix error message in a test * correctly fix it Co-authored-by: narimiran <narimiran@disroot.org>
* allow building 1.4.0 from devel (#18708)Timothee Cour2021-08-181-1/+1
| | | | | * allow building 1.4.0 from devel * changelog
* properly fix #10053 ; `FieldDefect` msg now shows discriminant value + ↵Timothee Cour2021-08-131-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* fixes #18385 (#18571)Saem Ghani2021-07-251-2/+10
| | | | needs a more permanent fix by better incorporating IC, but fixes nimsuggest highlighting for now.
* make -d:nimFpRoundtrips work consistently in vm vs rt, fix #18400, etc (#18531)Timothee Cour2021-07-201-2/+1
| | | | | | * compiler/vmhooks: add getVar to allow vmops with var params * addFloat vmops with var param * cgen now renders float32 literals in c backend using roundtrip float to string
* ORC: support for custom =trace procs (#18459)Andreas Rumpf2021-07-091-1/+1
| | | | | | | | | | | * ORC: support custom =trace procs (WIP) * Update tests/arc/tcustomtrace.nim Co-authored-by: Clyybber <darkmine956@gmail.com> * =trace is now documented and seems to work * make test green Co-authored-by: Clyybber <darkmine956@gmail.com>
* Renamed `-d:nimCompilerStackraceHints` to `-d:nimCompilerStacktraceHints`. ↵Timothee Cour2021-06-171-2/+2
| | | | (#18283)
* followup #16400; use use -d:nimCompilerStackraceHints in more places (#18282)Timothee Cour2021-06-161-0/+5
|
* since we have now so many virtual registers, reduce memory consumption for ↵Andreas Rumpf2021-05-101-45/+44
| | | | the register allocator (#17985)
* CIs: attempt to use csources_v1 (#16282)Andreas Rumpf2021-04-211-1/+1
| | | | | | | | * CIs: attempt to use csources_v1 * also updated the BSDs * also updated azure pipelines * std modules should not itself use the 'std/' import dir... * compiler has to be careful with std/ for v1 booting
* cString => cSourceString; tyCString => tyCstring so that error msgs show ↵Timothee Cour2021-04-171-6/+6
| | | | cstring, not cString (#17744)
* IC: yet another embarrassing omission (#17743)Andreas Rumpf2021-04-171-8/+6
| | | | | * IC: yet another embarrassing omission * VM: fewer hacks that kept IC from working
* implement RFCs/294 ; disallow enum <=> enum conversion (#16351)Timothee Cour2021-04-031-2/+2
| | | | | | | | | | | * fix https://github.com/nim-lang/RFCs/issues/294 ; disallow enum <=> enum conversion * fix the runnableExamples that was the instigator of this RFC * legacy -d:nimLegacyConvEnumEnum * use -d:nimLegacyConvEnumEnum in important_package nimgame2 * add test for enum cast * improve changelog * add changelog: Changes affecting backward compatibility * cleanup changelog * fix changelog
* fix #14585, fix #17589: access to static param now works (#17590)Timothee Cour2021-03-311-1/+1
|
* fix #12282 distinct now does not create erroneous copy in VM (#17594)Timothee Cour2021-03-311-2/+12
|
* Fix #17199 (#17348)Clyybber2021-03-261-3/+4
| | | | | | | | | | | | | | | | | | | | | | * don't zero out in a move in the VM * Add testcases for #17199 * Update tests/arc/tarcmisc.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update tests/vm/tissues.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Fix test failures * Fix test * Fix tests Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* semLambda removed, semProcAux reworked (#17379)Saem Ghani2021-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * simplified proc-like name ident to symbol code * wip - reworking generic param sem * wip - closer to removing nkEmpty generic params * it's hacky but tests pass * slowly tweaking semProcAux to take on semLambda * fix pragma superset check proto vs current * Set the symbol owner earlier * partial progress reworking proto found bug where default values between forward and impl lead to overload resolution issues. * simplified pragma handling and callConv checks Co-authored-by: Clyybber <Clyybber@users.noreply.github.com> * partially working * cgexprs issue * It works! * comment clean-up * clean-up asserts, comments, and other bits * add isGenericParams, inline isGeneric queries * seeing if this is sufficiently consistent * can use this approach or continue it in a further PR * commentary about nullary generics and clean-ups * fixed a mistake in PNode isGenericRoutine * Some small cleanups * Small cleanup * for func lambdas ensure we use lambda pragmas * add some basic compileTime func tests * [ci skip] remove comments Co-authored-by: Clyybber <Clyybber@users.noreply.github.com> Co-authored-by: Clyybber <darkmine956@gmail.com>
* fixes #11225; generic sandwich problems; [backport:1.2] (#17255)Andreas Rumpf2021-03-091-1/+2
| | | | | * fixes #11225; generic sandwich problems; [backport:1.2] * progress * delegating these symbols must be done via 'bind'
* fix #17264 [backport:1.4] (#17266)flywind2021-03-051-1/+3
| | | | | * fix #17264 * fix vm * fix js and add tests
* fixed dot operator recursive loop & macro suggest (#16922)Saem Ghani2021-02-151-1/+4
| | | | | | | | | | | | | | | | | | * 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>
* fix #16555, fixes #16405: len, high honors '\0' for cstring in vm (#16610)Timothee Cour2021-01-111-5/+7
|
* IC: next steps (#16550)Andreas Rumpf2021-01-071-5/+8
| | | | | | | | | | | | | | | | | | * cleanups * ast.nim: cleanups * IC: no more sym.tab field, stored externally in the module graph * nimble compiles again * rodfiles: store bitwidth of integers and the endianness in the cookie because we serialize 'int' directly * rodfiles: added compilerproc and export sections * rodfiles: added all the missing sections * rodfiles: track the missing information * IC: architecture for lazy loading of proc bodies * make tests green again * completed the lazy loading of proc bodies * symbol lookup integration, part 1 * symbol lookup integration, part 2 * symbol lookup integration, part 3 * make tcompilerapi work again * rodfiles: fixed config change handling
* move asciitables to std/private/ (#16498)flywind2020-12-291-1/+1
| | | | | * move asciitables * minor
* fix #16469 vm float constants: do not conflate -0.0 and 0.0 (#16470)Timothee Cour2020-12-271-1/+6
| | | | | * fix #16469 vm float constants: do not conflate -0.0 and 0.0 * fix test for 32bit
* [backport => 1.0] fix #16428 vmops now works for generic procs (#16429)Timothee Cour2020-12-221-10/+2
| | | | | * fix #16428 vmops now works for generic procs * remove duplication
* [docs minor]space for code-block (#16266)flywind2020-12-061-1/+1
| | | | | | | | | * [docs minor]space for code-block * correct more errors * to runnableExamples * add newline
* fixes #15939, fixes #15464, fixes #16169, fixes #16226 VM now supports ↵Timothee Cour2020-12-031-4/+6
| | | | | | | | | `addr(mystring[ind])` (index + index assignment) (#15987) * fix #15939, fix #15464 VM now supports `addr(mystring[ind])` (index + index assignment), var char return etc * cleanups * cstring tests * add test for bug #15464 * improve test coverage
* combine PR#16009 and PR#16012 (#16024)flywind2020-11-181-0/+5
| | | | | | | | * fix #15623 * add testcase for #15623 * add testcase * combine #16009 * support casting nil to NilableTypes in VM