summary refs log tree commit diff stats
path: root/compiler/vmops.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes #12125 (#12131)Andreas Rumpf2019-09-061-1/+9
| | | | * fixes #12125
* hashes: implement murmur3 (#12022)Miran2019-09-011-0/+29
| | | | | | | | * hashes: implement murmur3 * refactoring; there is only one murmurHash and it works at compile-time via VM hooks * fixes JS tests * makes toOpenArrayByte work with C++ * make it bootstrap in C++ mode for 0.20
* Implement isExported for symbols in macros (#11963)nc-x2019-08-181-1/+10
| | | | | | | | * Implement isExported for macros * Reimplement isExported using VM callback mechanism * VM does not support exceptions, use stacktrace() instead.
* VM exception fixes (#11868)Oscar Nihlgård2019-08-021-0/+4
|
* Compiler plugin for implementing incremental computation in user space (#10819)cooldome2019-04-111-3/+21
| | | | | | | | | | This plugin provides essential building block for implementing incremental computations in your programs. The idea behind incremental computations is that if you do the same calculation multiple times but with slightly different inputs you don't have to recompute everything from scratch. Also you don't want to adopt special algorithms either, you would like to write your code in standard from scratch manner and get incrementality for free when it is possible. The plugin computes the digest of the proc bodies, recursively hashing all called procs as well . Such digest with the digest of the argument values gives a good "name" for the result. Terminology loosely follows paper "Incremental Computation with Names" link below. It works well if you have no side effects in your computations. If you have global state in your computations then you will need problem specific workarounds to represent global state in set of "names" . SideEffect tracking in Nim also useful in this topic. Classical examples: Dashboard with ticking data. New data arrives non stop and you would like to update the dashboard recomputing only changed outputs. Excel spreadsheet where user changes one cell and you would like to recompute all cells that are affected by the change, but do not want to recompute every cell in the spreadsheet.
* fixes #10585Araq2019-02-071-2/+5
|
* add `getCurrentCompilerExe` to vmops (eg allows to get nim compiler at CT); ↵Timothee Cour2018-12-181-1/+4
| | | | add tests for vmops (#9925)
* Don't use deprecated fmod in VMdata-man2018-12-011-2/+1
|
* Fixes #9671 (#9750)Randy Smith2018-11-191-3/+0
|
* deprecated ospaths (#9665)Andreas Rumpf2018-11-091-3/+3
|
* make `mod` on floats available in the VM (#9591)skilchen2018-11-051-1/+5
| | | | | | * make `mod` on floats available in the VM * add testcase * removed no longer needed imports
* compiler refactoring; use typesafe path handing; docgen: render symbols ↵Andreas Rumpf2018-09-071-1/+1
| | | | between modules
* compiler API: final cleanups; improve security by diabling 'gorge' and friendsAndreas Rumpf2018-05-291-11/+12
|
* more modules compile againAndreas Rumpf2018-05-121-9/+7
|
* introduce nkTupleConstr AST node for unary tuple construction; breaking changeAndreas Rumpf2018-04-131-2/+2
|
* Added a few useful os calls to VM (#7440)genotrance2018-04-121-19/+29
|
* getEnv now supports a 'default' parameter; refs #6019Andreas Rumpf2017-10-301-1/+6
|
* Fixes #6336 (#6337)Yuriy Glukhov2017-09-061-2/+10
|
* added system.gorgeEx that includes the exitCode; refs #4874; fixes #1994Araq2017-01-071-0/+6
|
* stdlib and compiler don't use .immediate anymoreAndreas Rumpf2016-07-291-8/+8
|
* Add ``readFile`` implementation for nimvmAnatoly Galiulin2016-04-131-31/+37
|
* os.walkDir is available at compile timeAraq2015-11-101-1/+9
|
* VM produces objects.Yuriy Glukhov2015-09-051-1/+1
|
* system.locals is now a plugin for educationAraq2015-04-241-1/+1
|
* Happy new year!Guillaume Gelin2015-01-061-1/+1
|
* fixes #1473Araq2014-11-121-0/+5
|
* system.writeFile works at compile-timeAraq2014-10-021-0/+9
|
* VM supports math and a few os procsAraq2014-08-301-0/+66
ss="p">(let* ((seen-file (gethash filename (git-related--graph-files graph))) (file-found (not (null seen-file))) (file (or seen-file (make-git-related--file :name filename)))) (cl-pushnew commit (git-related--file-commits file)) (cl-pushnew file (git-related--commit-files commit)) (unless file-found (setf (gethash filename (git-related--graph-files graph)) file)))) (setf (gethash sha (git-related--graph-commits graph)) commit))) (defun git-related--replay (&optional graph) "Replay git commit history into optional GRAPH." (let ((graph (or graph (git-related--new-graph)))) (with-temp-buffer (process-file vc-git-program nil t nil "log" "--name-only" "--format=%x00%H") (let* ((commits (split-string (buffer-string) "\0" t)) (replay-count 0) (progress-reporter (make-progress-reporter "Building commit-file graph..." 0 (length commits)))) (dolist (commit commits) (let* ((sha-and-paths (split-string commit "\n\n" t (rx whitespace))) (sha (car sha-and-paths)) (paths (when (cadr sha-and-paths) (split-string (cadr sha-and-paths) "\n" t (rx whitespace))))) (git-related--record-commit graph sha paths) (progress-reporter-update progress-reporter (cl-incf replay-count)))) (progress-reporter-done progress-reporter))) graph)) (defun git-related--similar-files (graph filename) "Return files in GRAPH that are similar to FILENAME." (unless (git-related--graph-p graph) (user-error "You need to index this project first")) (let ((file (gethash filename (git-related--graph-files graph)))) (when file (let ((file-sqrt (sqrt (length (git-related--file-commits file)))) (neighbor-sqrts (make-hash-table :test 'equal :size 100)) (hits (make-hash-table :test 'equal :size 100))) (dolist (commit (git-related--file-commits file)) (dolist (neighbor (remove file (git-related--commit-files commit))) (let ((count (cl-incf (gethash (git-related--file-name neighbor) hits 0)))) (when (= count 1) (setf (gethash (git-related--file-name neighbor) neighbor-sqrts) (sqrt (length (git-related--file-commits neighbor)))))))) (let (ranked-neighbors) (maphash (lambda (neighbor-name neighbor-sqrt) (let ((axb (* file-sqrt neighbor-sqrt)) (n (gethash neighbor-name hits))) (push (list (if (cl-plusp axb) (/ n axb) 0.0) neighbor-name) ranked-neighbors))) neighbor-sqrts) (cl-sort (cl-remove-if-not #'git-related--file-exists-p ranked-neighbors :key #'cadr) #'> :key #'car)))))) (defun git-related--file-exists-p (relative-filename) "Determine if RELATIVE-FILENAME currently exists." (file-exists-p (expand-file-name relative-filename (project-root (project-current))))) (defun git-related--propertize (hit) "Given the cons HIT return a rendered representation for completion." (propertize (concat (propertize (format "%2.2f" (car hit)) 'face 'git-related-score) " ---> " (propertize (cadr hit) 'face 'git-related-file)) 'path (cadr hit))) ;;;###autoload (defun git-related-update () "Update graph for the current project." (interactive) (let* ((default-directory (project-root (project-current))) (project-symbol (intern (project-name (project-current)))) (graph (cl-getf git-related--graphs project-symbol))) (setf (cl-getf git-related--graphs project-symbol) (git-related--replay graph)))) ;;;###autoload (defun git-related-find-file () "Find files related through commit history." (interactive) (if (buffer-file-name) (let ((default-directory (project-root (project-current)))) (find-file (let* ((selection (completing-read "Related files: " (mapcar #'git-related--propertize (git-related--similar-files (cl-getf git-related--graphs (intern (project-name (project-current)))) (file-relative-name (buffer-file-name) (project-root (project-current))))) nil t))) (when selection (let ((filename (get-text-property 0 'path selection))) (find-file filename)))))) (message "Current buffer has no file"))) (provide 'git-related) ;;; git-related.el ends here