Compare commits

...

530 Commits

Author SHA1 Message Date
John Benediktsson cbdd559a75 misc/vim: some minor fixes.
- fix word definition to have dashes and other printables
- fix private to properly highlight and close the region
2020-09-29 10:04:43 -07:00
John Benediktsson ff6b75d030 misc/vim: remove TH{ syntax. 2020-09-28 16:32:33 -07:00
John Benediktsson 8fd437d877 Revert "core: Add TH{ for making assoc tuples."
This reverts commit e93d8f82bc.
2020-09-28 16:29:43 -07:00
John Benediktsson 36b2ac97ef sequences.extras: fix stack effect for filter-all-subseqs. 2020-09-28 12:30:15 -07:00
John Benediktsson f2a40f88dc bootstrap: rename layouts/layouts.factor to layouts.factor. 2020-09-26 21:29:52 -07:00
John Benediktsson fed5fd7c50 classes.tuple: speed up slots>tuple a bit.
Only get the initial values that are needed to supplement provided values.
2020-09-26 12:22:02 -07:00
John Benediktsson dc3a11bfc4 talks.tc-lisp-talk: fix typo. 2020-09-26 11:58:03 -07:00
John Benediktsson ae1890e0d7 vm: remove -console option, seems not necessary. 2020-09-26 11:46:56 -07:00
John Benediktsson 7bd1adb1c3 command-line: cleanup some documentation, change terminology slightly.
Refer to "options" instead of "VM args" or "Factor arguments".
2020-09-26 10:52:32 -07:00
John Benediktsson 5a71d98d29 compiler.tree.propagation.transforms: document not{ } as well. 2020-09-26 10:29:42 -07:00
John Benediktsson 09829bd506 compiler.tree.propagation.known-words: fix type in comment. 2020-09-26 10:29:25 -07:00
John Benediktsson 840159710e classes: update with quotation stack effects. 2020-09-26 10:28:35 -07:00
John Benediktsson dbdf4540bc hints: switch to using instance?. 2020-09-25 11:11:52 -07:00
John Benediktsson 96d7da0169 classes.builtin: remove bootstrap-type>class.
Not currently used, if adding more builtins maybe useful.
2020-09-23 19:49:35 -07:00
John Benediktsson 7789bbc79c classes.union: speed up instance? on unions of tuple-classes. 2020-09-23 19:32:15 -07:00
John Benediktsson 9f8a791a3b tools.completion: re-add chars-matching, not sure how i removed it. 2020-09-22 13:23:06 -07:00
John Benediktsson 16b144eaf5 fonts: simplify reverse-video-font 2020-09-22 13:05:17 -07:00
John Benediktsson 11f060719a benchmark.completion: fix use of name-completions. 2020-09-22 11:32:52 -07:00
John Benediktsson c200cfb8ca tools.completion: merge qualified and unqualified word completions. 2020-09-22 11:30:43 -07:00
John Benediktsson cc08ad38a4 tools.completion: allow fuzzy vocab name in qualified-matching. 2020-09-22 11:24:04 -07:00
John Benediktsson 03e62f3bc5 tools.completion: support qualified word completions. 2020-09-22 11:12:52 -07:00
John Benediktsson 979c13e156 math.complex: update test using. 2020-09-15 16:57:29 -07:00
John Benediktsson bc0789ca91 math.complex: move malformed-complex and parse-complex to math.complex.
They were incorrectly defined in syntax vocabulary.
2020-09-15 13:24:17 -07:00
John Benediktsson 115b7b62df basis: removing unnecessary method stack effects. 2020-09-09 15:00:54 -07:00
John Benediktsson f2deb82829 core: removing unnecessary method stack effects. 2020-09-09 15:00:53 -07:00
Doug Coleman f3ae869536 editors.visual-studio-code: Prefer code-insiders on macOS. 2020-09-02 19:08:56 -05:00
Doug Coleman 946bbd1597 vscode: Prefer code-insiders version if installed. 2020-09-02 17:47:08 -05:00
John Benediktsson 0b5cb42d95 cuda.libraries: remove duplicate definition of ?delete-at. 2020-09-01 13:20:49 -07:00
John Benediktsson c7959f2cb2 README: minor style tweak. 2020-08-30 16:58:41 -07:00
Doug Coleman 46be019527 assocs.extras: better implementation of rekey-new-assoc 2020-08-29 19:06:48 -05:00
Doug Coleman ce3049decd assocs.extra: Add a word to keep only certain keys in an assoc to the same assoc or to a new one. 2020-08-29 19:05:41 -05:00
Doug Coleman 87cce0ba6a build.sh: Warn if boot image url is nonexistent when falling back to master. 2020-08-29 18:22:38 -05:00
Doug Coleman 13b366e88b Revert "build.sh: Fix boot image download to current branch."
This reverts commit ec490587e7.

I didn't read the code, but the odds of a random branch working with master boot image are pretty low.
2020-08-29 18:04:19 -05:00
Doug Coleman 97d828a7f5 build.sh: recognize arm64 linux 2020-08-27 16:47:14 -05:00
Doug Coleman ec490587e7 build.sh: Fix boot image download to current branch. 2020-08-27 16:43:38 -05:00
Doug Coleman 3eb6e55ae4 db: Fix using list for walker. 2020-08-27 10:28:12 -05:00
John Benediktsson a861c4c732 assocs: improve stack effect for delete-at* and ?delete-at. 2020-08-23 13:04:48 -07:00
Alexander Iljin 00fc565111 sodium: add the "bindings" tag 2020-08-20 18:04:42 +00:00
John Benediktsson 3fdb0325ca misc: update vim syntax for ?change-at. 2020-08-17 10:14:13 -07:00
John Benediktsson 1ac7e08f59 assocs: adding ?change-at. 2020-08-17 10:08:41 -07:00
John Benediktsson 699ebc960b colors.hex: adding an invalid-hex-color error. 2020-08-17 08:04:04 -07:00
John Benediktsson ce871f99dd compiler.tree.escape-analysis.branches: no need for sift. 2020-08-14 13:43:02 -07:00
John Benediktsson 60dd083bcb misc/vim: highlight predicate classes. 2020-08-14 13:28:48 -07:00
John Benediktsson 5176b270d2 misc: more syntax tests. 2020-08-14 13:22:34 -07:00
John Benediktsson d535b62f50 vocabs.parser: faster name lookup. 2020-08-14 11:58:50 -07:00
John Benediktsson 8cc090950a tools.profiler.sampling: fixing missed rename. 2020-08-14 11:57:27 -07:00
John Benediktsson 997aaf005e Revert "Revert "vm: Allow larger 32bit code heaps.""
This reverts commit 0c0647f12c.
2020-08-14 10:47:18 -07:00
John Benediktsson 6e83e00d22 vm: rename primitive_sampling_profiler to primitive_set_profiling.
also rename the private primitives words in tools.profiler.sampling.
2020-08-14 10:40:54 -07:00
John Benediktsson e1085ffef4 vm: add some allocates memory comments. 2020-08-14 10:27:54 -07:00
John Benediktsson f21deee3df vm: change some bools from cell to bool. 2020-08-14 10:27:18 -07:00
John Benediktsson 0c0647f12c Revert "vm: Allow larger 32bit code heaps."
This reverts commit 723e0e2c1a.
2020-08-14 10:14:18 -07:00
John Benediktsson 8eb78b9212 Revert "checksums.multi: make multi-checksum an instance of checksum"
This reverts commit fbeb409979.
2020-08-13 16:09:31 -07:00
John Benediktsson 995d717277 tools.profiler.sampling: assert that profile-data is created. 2020-08-13 14:50:52 -07:00
John Benediktsson 5eaaaf06d6 xml.tests: fix USING. 2020-08-13 09:57:29 -07:00
John Benediktsson bb827a1565 furnace: require chloe-tags when loading furnace framework. 2020-08-13 09:17:43 -07:00
John Benediktsson 6bfc54b15c xml.tests: require 8-bit encodings. 2020-08-13 09:17:20 -07:00
John Benediktsson 24e1080362 alien.libraries.finder.macosx: fix test USING. 2020-08-12 15:01:51 -07:00
John Benediktsson 126f3acf63 math.bitwise: remove duplicate logic in bitfield. 2020-08-05 15:57:27 -07:00
John Benediktsson 70687a0eb3 alien.libraries.finder.linux: return fully-qualified path. 2020-08-05 10:59:01 -07:00
John Benediktsson 40aedcb346 alien.libraries.finder: cleanup, add windows tests. 2020-08-05 10:58:43 -07:00
John Benediktsson 564720281d command-line.startup: print default values for parameters. 2020-08-04 13:30:00 -07:00
Alexander Iljin 53d741a6ef L-system: rename some words to new conventions
Move the angle brackets from tuple names to their <constructors>.
2020-08-04 19:57:23 +00:00
Alexander Iljin 42855b4c44 L-system: reformat for brevity 2020-08-04 19:57:23 +00:00
Alexander Iljin 0bee527143 L-system: use named color constants 2020-08-04 19:57:23 +00:00
Alexander Iljin bfe2140148 L-system: fix compilation 2020-08-04 19:57:23 +00:00
Alexander Iljin 28bdbf8a2c L-system: resurrect from unmaintained to extra 2020-08-04 19:57:23 +00:00
Alexander Iljin 8a3d7a9d7f syntax-docs: add description of the vocab:word syntax 2020-08-01 22:32:55 +00:00
Alexander Iljin 21a1a6e7a1 syntax-docs: fix a typo 2020-08-01 22:32:55 +00:00
Alexander Iljin c496feb256 syntax-docs: remove mention of a nonexistent error 2020-08-01 22:32:55 +00:00
Alexander Iljin 5d0827ed4e totp[-docs]: accept TOTP keys in Base 32 encoding
Base 32 is the encoding, in which keys are given to Google Authenticator.
2020-07-29 17:44:07 +00:00
Alexander Iljin 92b7c32e19 totp[-docs]: change default totp-hash value to SHA-1
SHA-1 is the hash used by the Google Authenticator application, which this
vocab wanted to imitate in the first place.
2020-07-29 17:44:07 +00:00
Alexander Iljin 27d38225f4 checksums: inherit checksum-state from disposable
This allows the inherited tuples, including block-checksum-state, to be
treated like the normal disposable tuples, instead of imitating only part
of the interface.
2020-07-29 17:42:02 +00:00
Alexander Iljin fbeb409979 checksums.multi: make multi-checksum an instance of checksum
Previously it was declared to be an instance of block-checksum, which is
not necessarily the case, since the participating checksums don't have to
be block-checksums.
2020-07-29 17:42:02 +00:00
John Benediktsson 9c60c202e9 sequences.extras: move some words to assocs.extras. 2020-07-19 20:18:15 -07:00
Doug Coleman 2c488736e4 sequences.extras: Add {filter,reject}-{keys,values} 2020-07-19 10:41:51 -05:00
Alexander Iljin d1782a23cc io.pathnames-docs: fix a copy-paste error 2020-07-19 14:24:11 +00:00
Alexander Iljin 671aa228f3 math-docs: fix `times` documentation
The word `each` used to loop over integers in the past, but it does not
anymore.
2020-07-19 14:24:11 +00:00
Doug Coleman 5c3efc5cee build.sh: Fix update-boot-image help 2020-07-03 14:16:45 -05:00
Doug Coleman 464bd705f4 unix: Add more posix_spawnp and rename fork-process to call-fork.
- spawn-process will call posix_spawn()
- fork-process will call fork()

The environment variable should be used or else apps like VSCode won't open because the display isn't set.
2020-06-30 21:12:51 -05:00
John Benediktsson 3a091577ae vocabs.hierarchy: use ensure-vocab-root/prefix. 2020-06-26 20:19:24 -07:00
John Benediktsson d8f7bd067d vocabs.hierarchy: fix (disk-vocabs) on subvocabs. 2020-06-26 20:13:13 -07:00
Doug Coleman 35719d11b6 vocabs.hierarchy: Fix typo.
Closes #2314.
2020-06-26 19:17:11 -05:00
Doug Coleman 87022ea3b9 unix.linux.proc: Add cpuinfo flag "vmx flags".
Fixes #2315.

I'm not sure how this would have stopped a vocabulary from loading.

cpuinfo flags are in linux kernel repo:
 arch/x86/kernel/cpu/proc.c
2020-06-26 19:16:18 -05:00
Doug Coleman be6d8cae27 tools.dns.public: Add cloudflare dns 2020-06-23 18:20:39 -05:00
Doug Coleman b6373caa4f system-info.macosx: 11.0 2020-06-22 13:49:48 -05:00
Doug Coleman 8aa76be5ed system-info.macosx: Big Sur 2020-06-22 13:11:06 -05:00
Doug Coleman 6c02569916 build.sh: Recognize arm64 ipad/appletv. 2020-06-15 17:10:07 -05:00
John Benediktsson 0b7122350e Revert "ui.gadgets.borders: don't convert border-loc to fixnum."
This reverts commit eb7aad96c0.
2020-06-15 07:36:52 -07:00
Doug Coleman d88ed6ce63 help.cookbook: Fix typo.
Fixes #2307.
2020-06-13 08:48:00 -05:00
Doug Coleman e9ab963df9 math.bitwise: Fix example for bitfield* 2020-06-12 19:40:47 -05:00
Doug Coleman a7b058bed1 math.bitwise: I can't implement ``bitfield*`` as ``reverse bitfield``
I don't really know why. Add some tests in the docs and document bitfield*
2020-06-12 19:24:02 -05:00
Doug Coleman c87811f611 ui.backend.cocoa: fix bootstrap -- vocab does not exist. 2020-06-12 18:43:01 -05:00
Doug Coleman 8efe213273 vocabs: On use-vocab we should throw an error if the vocabulary does not exist.
Also ui.pixel-formats.private does not exist so remove that.

Fixes #2298.
2020-06-12 18:23:45 -05:00
Doug Coleman 8bc4a3f2b8 build.sh: Add OS detection for Haiku. 2020-06-10 17:05:47 +00:00
Dusk a67f2a4a05 vim/syntax: Even more fixups.
|:syn-priority| is respected now, :syn-skip & :syn-keepend are used
when appropriate, newlines don't jank stuff up, comments don't extend
match regions, numbers are much more reliable, and stack effect error
highlights return.

A feature request has even been sent to Bram.
https://github.com/vim/vim/issues/872#issuecomment-641025231
2020-06-10 03:12:30 +00:00
John Benediktsson d59cb0a672 misc/vim: change stack effects to not highlight when required
This is due to optional requirement in some forms, for example M:.
2020-06-08 12:03:54 -07:00
John Benediktsson c6f634d6a6 ui.tools.listener: re-order emacs keybinding docs. 2020-06-08 11:39:41 -07:00
John Benediktsson 0dd87cc282 misc/vim: fix NAN: highlighting, and private generic definitions. 2020-06-08 11:38:30 -07:00
John Benediktsson 17e862b801 misc: add private definitions to syntax-test file. 2020-06-08 11:21:09 -07:00
John Benediktsson f3bd6dd183 misc/vim/syntax: fix private word highlights. 2020-06-08 11:21:09 -07:00
John Benediktsson 440b56a9f0 misc/vim: dos2unix factor-docs.vim. 2020-06-08 11:21:09 -07:00
John Benediktsson d9210f738d editors.vim.generate-syntax: merge in factor.vim.fgen. 2020-06-08 11:21:09 -07:00
Doug Coleman b0b5c31821 build.sh: Change WORD size detection to use preprocessor. 2020-06-07 11:43:39 -05:00
Dusk 70cf73b032 fixup! [misc] vim/syntax: Fixups
(Thanks, @mrjbq7!) Now:
+ `CHAR:` literals highlight the whole next token.
+ `0b...` binary literals don't require invalid `+=0b` or `-=0b` syntax.
+ Float literals can't start with a `,` separator.
+ Float literals can have exponents with `,` separators.
+ `foo: ...` stack effects function as intended in general.
+ Syntax clusters might be a bit cleaner with `g:factor_syn_no_error`.
+ Error match priority should be cleaned up.
2020-06-07 05:35:13 +00:00
Dusk f70ce01b51 editors.vim.generate-syntax: Match new generation
Also update the vim/syntax README.
2020-06-06 20:32:17 -07:00
Dusk 35b8621306 [misc] vim/syntax: Fixups
(Thanks, @mrjbq7!) Now:
+ `CHAR:` literals highlight the whole next token.
+ `0b...` binary literals don't require invalid `+=0b` or `-=0b` syntax.
+ Float literals can't start with a `,` separator.
+ Float literals can have exponents with `,` separators.
+ `foo: ...` stack effects function as intended in general.
+ Syntax clusters might be a bit cleaner with `g:factor_syn_no_error`.
2020-06-06 20:31:59 -07:00
John Benediktsson 0a8cb5f2c1 misc: adding a syntax-test file. 2020-06-06 19:04:21 -07:00
John Benediktsson 61635500f2 vim: missed a char in 0b fix. 2020-06-06 19:02:21 -07:00
John Benediktsson ddf498d5ad vim: fix syntax highlighting of CHAR:, 0b, NAN:. 2020-06-06 19:00:41 -07:00
Dusk 14b1418f6a [misc] vim/syntax: Overhaul syntax highlighting
Also fixes comments in a lot more places than a few commits ago.

Syntax like the following is proper, and the comment highlighting fixes
from last commit make the incorrect highlighting here really stand out:

```factor
USE: ! only this line highlights
  kernel
```
2020-06-07 00:10:18 +00:00
Dusk 35799f8d2d [misc] vim/syntax: Avoid extra group captures 2020-06-07 00:10:18 +00:00
Dusk 686f707078 [misc] vim/syntax: Very magic patterns
From Vim's |pattern.txt|, |/\v| |/\V|:
> Use of "\v" means that after it, all ASCII characters except
> '0'-'9', 'a'-'z', 'A'-'Z' and '_' have special meaning: "very magic"

This mostly makes some upcoming syntax pattern refactoring cleaner,
though most patterns still get shorter here.
2020-06-07 00:10:18 +00:00
Dusk 11757d87fb [misc] vim/syntax: Proper comment precedence
Now comments, a lexer level feature, won't get beat out by rather normal
syntactic parser constructs like `STRUCT:`.
2020-06-07 00:10:18 +00:00
Dusk 710b54869a [misc] vim: Hygenic text width highlights
This lets Factor's overly long line highlighting avoid bleeding over
into documentation source buffers, or buffers of other non-Factor file
types entirely. Also, by taking `:2match` instead of `:match`,
clobbering of most user matches (or vice versa) can be avoided.

Unfortunately, the highlighting effects all windows in a multi-buffer
split setup, but since we can't reasonably make this a `:syntax match`
group, it'll have to do. (And this behavior isn't new.)
2020-06-07 00:10:18 +00:00
John Benediktsson 35681032d9 ui.tools.listener: change previous/next line to multiline-editor. 2020-06-06 16:47:30 -07:00
John Benediktsson 02386eebcc ui.tools.listener: document emacs-style keybindings for now. 2020-06-06 16:28:40 -07:00
John Benediktsson 4f51adf8bf Revert "ui: better support for Emacs-style key bindings."
This reverts commit 928b4c6abc.
2020-06-06 16:20:21 -07:00
John Benediktsson e446f34280 Revert "ui.gadgets.editors: adding Ctrl-u support."
This reverts commit 046d128c97.
2020-06-06 16:19:51 -07:00
John Benediktsson 5c04baf757 Revert "ui.gadgets.editors: make Ctrl-A select-all if at column 0."
This reverts commit 9287b05d57.
2020-06-06 16:19:50 -07:00
John Benediktsson 43c2ffead2 Revert "ui.tools: change Alt- to Ctrl-Shift- for tools."
This reverts commit 9c3908e003.
2020-06-06 16:19:43 -07:00
John Benediktsson a9ad206edc ui.backend.gtk: don't let input-methods steal key-presses. 2020-06-06 16:09:15 -07:00
John Benediktsson 9c3908e003 ui.tools: change Alt- to Ctrl-Shift- for tools. 2020-05-29 14:59:45 -07:00
John Benediktsson 9287b05d57 ui.gadgets.editors: make Ctrl-A select-all if at column 0. 2020-05-29 14:56:58 -07:00
John Benediktsson 09c867f747 images.pbm: use not. 2020-05-28 09:13:51 -07:00
John Benediktsson 6e23222187 logic: use not. 2020-05-28 09:13:44 -07:00
John Benediktsson 046d128c97 ui.gadgets.editors: adding Ctrl-u support. 2020-05-27 20:01:33 -07:00
John Benediktsson 928b4c6abc ui: better support for Emacs-style key bindings.
This changes a bunch of things like Ctrl-E for edit becomes Alt-E
(Cmd-E on macOS).  I think that's overall nicer, but let's play with it.
2020-05-27 19:49:30 -07:00
John Benediktsson 32fa577368 ui.gadgets.editors: can just use preedit-start>> as boolean. 2020-05-27 12:52:45 -07:00
John Benediktsson 258d7e05d6 models: cleanup docs for $slots. 2020-05-27 12:51:31 -07:00
John Benediktsson 82a34fe4b8 ui.gadgets.editors: fix off-by-one. 2020-05-27 11:50:04 -07:00
John Benediktsson c781933d6b ui.gadgets.editors: fix page-up/page-down behavior. 2020-05-27 11:43:29 -07:00
John Benediktsson f2189a32f4 ui.gadgets.editors: cleanup docs for $slots. 2020-05-27 11:43:12 -07:00
John Benediktsson c8afb239a0 ui.gestures: clean docs for $slots. 2020-05-27 11:18:20 -07:00
John Benediktsson d0a694a7fe ui.gadgets.tables: change hook>> to be called on all row-actions.
Not just when a selected-row was available and action>> was called.
Also, call the hook after the action, not before.
2020-05-27 09:59:42 -07:00
John Benediktsson 75d5a8a8f9 ui.gadgets.tables: cleanup docs for $slots. 2020-05-27 09:59:42 -07:00
John Benediktsson 3ee93ee68d lexer: cleanup docs for $slots. 2020-05-27 09:59:42 -07:00
John Benediktsson 10e19a3944 threads: cleanup docs for $slots. 2020-05-27 09:59:42 -07:00
Doug Coleman 0fb44180c0 db.sqlite.ffi: Update the sqlite3 bindings a bit. 2020-05-26 21:16:11 -05:00
John Benediktsson 130c1d8dd6 ui.gadgets.editors: fix page-up/page-down with one line. 2020-05-26 10:53:16 -07:00
John Benediktsson 8f3ce6f49a punycode: adding basic support for Punycode (RFC 3492). 2020-05-26 10:05:43 -07:00
Doug Coleman b1f29dc497 ui.backend.x11.keys: Enable numpad navigation keys for when numlock is off.
I recently got a Model F keyboard and the arrow keys weren't mapped.

To see the keycodes on Linux:

```
IN: ui.backend.x11.keys
: code>sym ( code -- name/code/f action? )
    dup . flush
    dup codes at* [ nip dup t and ] when ;
```

Also try ``USE: gesture-logger``
2020-05-22 18:18:31 -05:00
Doug Coleman 131c91b786 gesture-logger: Add as a demo! 2020-05-22 18:18:31 -05:00
John Benediktsson 02dd86a37d help.html: better tests, don't just drop the result. 2020-05-22 16:01:25 -07:00
John Benediktsson 0db8b2d012 help: some test fixes for recent behavior changes. 2020-05-22 14:41:00 -07:00
John Benediktsson ad1e4dcd11 help: change the "help" word-prop to store the actual documentation.
Change word-help to massage the $inputs and $outputs when requested.

Revert the help.lint.coverage checks to still look for $values.
2020-05-22 10:48:34 -07:00
John Benediktsson 409ce057f3 Revert "help.lint.coverage: change $values to $inputs and $outputs."
This reverts commit 61102548f4.
2020-05-22 10:47:27 -07:00
John Benediktsson 150c6a6554 help.html: adding back the link to factorcode.org.
It should probably be a cool logo or something...
2020-05-22 10:14:55 -07:00
timor 655f54af19 shell.nix: supply `wrapFactor` helper to make standalone factor binary
This adds the shell function `wrapFactor`.  This function is intended to wrap
the result of calling `build.sh` in the shell environment so it can be executed
outside of the nix shell.

Example:

```
$ nix-shell
[nix-shell] $ ./build.sh bootstrap
...build factor vm and image...
[nix-shell] $ wrapFactor .
exit
$ ./factor
```

`wrapFactor` takes the path to the factor root dir as argument, and expects the
binary `factor` and the image file `factor.image` there and uses Nixpkgs'
`makeWrapper` to wrap the `factor` executable in-place with the correct
`LD_LIBRARY_PATH`.  Afterwards, the factor executable can be called outside of
the nix-shell environment.
2020-05-22 17:11:26 +00:00
John Benediktsson 802bb073b0 help.html: better navbar on iPhone. 2020-05-22 10:03:39 -07:00
John Benediktsson e2fa0a6392 ui.backend.cocoa.views: fix jittery resize.
This could still be improved since this current approach pauses Factor
execution when the window is being resized, and it could instead
maybe detect inLiveResize or something and be smoother.
2020-05-22 08:23:20 -07:00
John Benediktsson 61102548f4 help.lint.coverage: change $values to $inputs and $outputs. 2020-05-22 08:06:36 -07:00
John Benediktsson eded28cc74 help: splitting $values into $inputs and $outputs.
This is an automatic conversion, so we can keep writing docs the way we
have been.
2020-05-21 19:47:28 -07:00
John Benediktsson 27215982e6 help.html: copy image resources to output directory.
This helps avoid needing so many different static responders in
webapps.help, and makes the documentation more self-contained.
2020-05-21 19:17:56 -07:00
John Benediktsson da8a378b38 ui.tools.error-list: changing icons from tiff to png. 2020-05-21 17:31:41 -07:00
John Benediktsson 4e498ad3b7 webapps.help: whoops. 2020-05-21 17:25:03 -07:00
John Benediktsson 2e2f1d673a help.html: support ui/tools/error-list/icons also. 2020-05-21 17:23:47 -07:00
John Benediktsson 868d970784 html.streams: move icon src mapping to help.html. 2020-05-21 17:19:36 -07:00
John Benediktsson d2114e913c syntax: allow anonymous MAIN:. 2020-05-21 14:19:43 -07:00
John Benediktsson 551e079da8 webbrowser: adding MAIN. 2020-05-20 20:26:02 -07:00
John Benediktsson 15b0f07b37 metar: add a main. 2020-05-20 19:47:47 -07:00
John Benediktsson 918436af7e websites.factorcode: update macos screenshot. 2020-05-20 11:11:57 -07:00
John Benediktsson 721cb84d2a definitions.icons: lighter open-vocab/unopen-vocab. 2020-05-20 10:46:34 -07:00
John Benediktsson e3fb39e3fe definitions.icons: prefer more isometric vocab icons. 2020-05-20 09:33:54 -07:00
John Benediktsson b277d96065 definitions.icons: fix unopen-vocab.png. 2020-05-19 21:46:46 -07:00
John Benediktsson ba80c1b6d6 definitions.icons: fix some 1x images. 2020-05-19 21:45:26 -07:00
John Benediktsson e28bcd400b help.html: use @2x images. 2020-05-19 20:53:08 -07:00
John Benediktsson 149cc270ff ui.images: fix for gl-scale-factor not being set. 2020-05-19 19:10:51 -07:00
John Benediktsson 27c9792108 ui.images: load 1x or 2x graphics. 2020-05-19 19:00:25 -07:00
timor 01a389cb68 compiler.tree.propagation.slots: remove unused word
The last use of `length-accessor?` has been removed in
8e227bc874, which obsoleted the `length` slot.
2020-05-19 10:18:15 -07:00
John Benediktsson e065e5b315 ui.theme: fix help-path-border-color to match toolbar-background. 2020-05-19 10:15:50 -07:00
John Benediktsson 1b007dd7fc Revert "ui.pens.image: allow float math."
This reverts commit 2d71fd9e22.
2020-05-19 10:00:05 -07:00
John Benediktsson fd4ddf588f ui: update more icons, including ui.tools.error-list. 2020-05-19 09:46:43 -07:00
John Benediktsson 1a3d061954 definitions.icons: minor tweak. 2020-05-19 08:25:49 -07:00
John Benediktsson 466f599d11 definitions.icons: minor tweaks. 2020-05-19 08:08:12 -07:00
John Benediktsson dc584bb671 unix.signals: bump time on tests. 2020-05-19 07:49:56 -07:00
John Benediktsson cc823e7db1 tools.profiler.sampling: bump runtime. 2020-05-19 07:46:25 -07:00
John Benediktsson 221b222f86 Revert "ui.baseline-alignment: allow floats in alignment."
This reverts commit c37e9551ad.
2020-05-19 07:41:06 -07:00
John Benediktsson 1ee94a168b ui.theme.images: minor scroll arrow fixes. 2020-05-18 21:20:10 -07:00
John Benediktsson 44003d802f ui.theme.images: minor cleanup. 2020-05-18 21:09:37 -07:00
John Benediktsson 2d71fd9e22 ui.pens.image: allow float math. 2020-05-18 20:57:03 -07:00
John Benediktsson cf5bc20b1b ui.gadgets.icons: draw icon on top of selected background. 2020-05-18 20:56:25 -07:00
John Benediktsson c37e9551ad ui.baseline-alignment: allow floats in alignment. 2020-05-18 20:53:14 -07:00
John Benediktsson c0ab4beb0c help.html: set the sizes of 2x definition icons. 2020-05-18 20:46:27 -07:00
John Benediktsson 65a3f0b6f4 ui.images: load all UI images as 2x for retina displays. 2020-05-18 20:45:58 -07:00
John Benediktsson 9635596b0b ui.gadgets.labels: only ceiling the height for now.
This might align to every other pixel on a 2x display but it fixes some
rendering artifacts with borders on subpixel boundaries.
2020-05-18 08:06:08 -07:00
John Benediktsson 06ff539b17 Revert "ui.gadgets.labels: make labels integer larger than text."
This reverts commit 0b294c5d50.
2020-05-18 08:02:06 -07:00
John Benediktsson 5d4a0b4f00 ui.gadgets.tracks: don't convert dims to floats in track-pref-dims-2. 2020-05-17 20:47:22 -07:00
John Benediktsson eb7aad96c0 ui.gadgets.borders: don't convert border-loc to fixnum. 2020-05-17 20:45:49 -07:00
John Benediktsson 0b294c5d50 ui.gadgets.labels: make labels integer larger than text. 2020-05-17 20:44:21 -07:00
John Benediktsson 65d7e3fad1 build.sh: make_boot_image can just use -run=bootstrap.image. 2020-05-17 19:55:59 -07:00
John Benediktsson d85d3e861c bootstrap.image: allow making other images in main. 2020-05-17 19:54:33 -07:00
Doug Coleman 160d1b4415 build.sh: Add self-bootstrap option. 2020-05-16 14:52:02 -05:00
Doug Coleman 75d8607643 build.sh: Only pull into current branch so we don't end up merging 2020-05-16 14:51:53 -05:00
John Benediktsson abb1755311 logic.examples.money: use lnth and leach. 2020-05-16 11:26:16 -07:00
John Benediktsson 457485dae7 ui.gadgets.labels: allow sub-pixel baseline and cap-height. 2020-05-16 11:18:11 -07:00
John Benediktsson 5f89facf9e basis/extra: replace "/ >integer" with "/i" in a few places. 2020-05-16 11:17:42 -07:00
John Benediktsson 68f6eeb3ad ui.gadgets.packs: change pack-layout not to round. 2020-05-16 11:10:18 -07:00
John Benediktsson 7b023ad59d brainfuck: inline (?) because it's not a language command. 2020-05-16 10:13:10 -07:00
John Benediktsson b3412e8930 ui.gadgets: formatting. 2020-05-16 10:07:35 -07:00
John Benediktsson 33e72abff9 ui.baseline-alignment: better stack effects. 2020-05-16 10:05:11 -07:00
John Benediktsson 824e239915 core-text: change metrics>dim not to ceiling. 2020-05-16 09:58:42 -07:00
Sergii Fesenko 4353b05cf1 io.standard-paths: fix standard-login-paths for fish shell
Fish shell automatically split variables whose name ends in "PATH" into lists,
and uses space as separator for output
Colons force fish to use standard $PATH representation
2020-05-16 07:03:23 -07:00
John Benediktsson 413cc49d3b urls: adding redacted-url to mask the password of a URL.
This is particularly useful for logging to avoid accidentally printing
passwords in web server logs.
2020-05-15 12:13:00 -07:00
Silvio Mayolo 454f192562 Added imenu tags to factor-mode for Emacs 2020-05-14 15:16:55 +00:00
Alexander Iljin 484d564b5d sodium.ffi: add the scrypt functions 2020-05-10 18:31:37 -05:00
Alexander Iljin 882050600e sodium: update copyright years in the header 2020-05-10 18:31:37 -05:00
Alexander Iljin 39ab923224 sodium: add sodium-bin>base64 2020-05-10 18:31:37 -05:00
Alexander Iljin cefb0c6e9e sodium: add sodium-base64>bin 2020-05-10 18:31:37 -05:00
John Benediktsson 05796cb497 math.bitwise: some docs cleanup. 2020-05-02 07:43:39 -07:00
Doug Coleman 94c6c8e5db math.bitwise: Add some more docs to find bits form >signed. 2020-05-01 22:49:14 -05:00
Doug Coleman c21608b0a0 math.bitwise: Add an in-order bitfield word called bitfield*. 2020-05-01 22:48:48 -05:00
John Benediktsson d27c259928 tensors: updated with the latest tensors vocab.
rebased and merged #2283
2020-04-27 20:15:33 -07:00
John Benediktsson 298bbddeb1 visionect: change http-backend to use CRLF. 2020-04-23 11:23:58 -07:00
John Benediktsson 2f8e96a6b6 visionect: handle non-post-data in visionect-post. 2020-04-21 21:18:42 -07:00
John Benediktsson eef4e17727 visionect: fix get-tclv and set-tclv. 2020-04-21 12:33:55 -07:00
John Benediktsson ecf9352a25 visionect: get http-backend working properly. 2020-04-21 12:25:37 -07:00
Steve Ayerhart e04a6e39f3 added srv parsing 2020-04-21 18:00:17 +00:00
Steve Ayerhart b9469a4acc incorrect SRV enum 2020-04-21 18:00:17 +00:00
John Benediktsson 34640fe559 bootstrap.image.upload: remove os hook from scp-name. 2020-04-21 07:05:19 -07:00
Doug Coleman bb1dbc887b bootstrap.image.upload: scp is included with windows git now.
pscp is not necessary anymore and in fact is a more effort to set up.
2020-04-21 01:18:38 -05:00
John Benediktsson 75d82c2a93 visionect: new vocab for Visionect Server Management API. 2020-04-20 14:58:51 -07:00
Doug Coleman e6b546c358 math.bitwise: Fix shift "right" to shift "left" for bitfield.
This word was really hard to understand so I reworked the docs and added another example.
2020-04-18 19:46:29 -05:00
John Benediktsson 8d4f0be202 io.files.trash: use normalize-path. 2020-04-18 09:58:40 -07:00
John Benediktsson 4cb4308a11 io.files.trash: add tags.txt for now. 2020-04-18 09:48:22 -07:00
John Benediktsson 8cf877a1cd websites.concatenative: rename cgi to gitweb. 2020-04-17 22:11:25 -07:00
Alexander Iljin a06e9cc3b2 io.files.trash.windows: convert input path to absolute in send-to-trash
The input path must be absolute, but normalize-path can't be used, because
that returns UNC path, and SHFileOperation fails on any path prefixed with
"\\?", see https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-shfileopstructa
Use absolute-path instead. The mixture of slashes and backslashes in the
path is tolerated, at least on Windows 10.

Add a simple unit-test.
2020-04-17 02:55:24 +00:00
Alexander Iljin 595cf81eb8 io.files.trash.windows: fix SHFILEOPSTRUCTW struct
Fix the incorrect field alignment. SHFileOperationW crashed with a memory
protection error while trying to dereference only part of the string
pointer.
2020-04-17 02:55:24 +00:00
Alexander Iljin d486e39255 ui.gadgets.charts: delete some obsolete implementation comments 2020-04-14 10:41:33 -07:00
Alexander Iljin d2b79e7185 images.viewer-docs: remove some extra spaces 2020-04-14 10:41:27 -07:00
Alexander Iljin 894571c484 compiler.tree.propagation.constraints: fix a harmless typo 2020-04-14 10:41:22 -07:00
Alexander Iljin a2978c8cb9 alien.data-docs: fix wording and punctuation in cast-array help 2020-04-14 10:41:18 -07:00
Alexander Iljin bcaba7b7c6 ui.gestures-docs: add code example to file-drop gesture documentation 2020-04-14 10:41:12 -07:00
Alexander Iljin 8af54ff2fa io.timeouts-docs: fix an example formatting
The help system highlights only the last line as the code "output", so in
this case it displayed only half of the text that way.
2020-04-14 10:41:04 -07:00
Doug Coleman 723e0e2c1a vm: Allow larger 32bit code heaps.
Code heap is artificially restricted on 32bit because PPC only had relative
jump instructions of a certain width and we punted on implementing
larger jumps.
2020-04-13 15:50:58 -07:00
John Benediktsson 5d818ccc71 mason.child: change windows code-heap from 200 to 100. 2020-04-13 13:36:10 -07:00
John Benediktsson a89474786e drive-strings: really move this time. 2020-04-13 12:53:13 -07:00
John Benediktsson 1e81dbdf17 drive-strings: move to windows.drive-strings. 2020-04-13 12:43:25 -07:00
Alexander Iljin 0b1a080bb0 sodium.secure-memory: fix a stack effect and add documentation 2020-04-13 19:33:42 +00:00
Alexander Iljin 7cda5f7e53 literals-docs: fix a copy-paste error 2020-04-13 19:33:42 +00:00
Alexander Iljin 97b07d9972 drive-strings: add a demo vocab for GetLogicalDriveStrings to extra 2020-04-13 19:33:42 +00:00
Alexander Iljin c98b49aaf4 windows.kernel32: add GetLogicalDriveStrings 2020-04-13 19:33:42 +00:00
Alexander Iljin 24eff67e60 windows.version: new vocab 2020-04-13 19:33:42 +00:00
Alexander Iljin 56ca2c3cb0 alien.data-docs: fix a typo 2020-04-13 19:33:42 +00:00
Alexander Iljin e14cd169e1 io.files.windows: rename a stack effect to make it more readable 2020-04-13 19:33:42 +00:00
John Benediktsson 61ae19d7e4 sodium: fix help-lint warnings. 2020-04-13 11:16:18 -07:00
John Benediktsson 799912b953 sodium.secure-memory: fix return type of secure-memory=. 2020-04-13 11:13:20 -07:00
John Benediktsson dc78ea1ac8 mirrors: make failures check error type. 2020-04-13 10:53:22 -07:00
Cat Stevens 90fcf7cfd5 mirrors: useless using 2020-04-13 17:52:09 +00:00
Cat Stevens 175a42bd49 mirrors: delete-at and clear-assoc are an error, fix #1757
M\ mirror delete-at and M\ mirror clear-assoc
	have been made to throw a new
	mirror-slot-removal error, because
	it doesn't make sense to remove a
	tuple slot, and this behaviour should
	not have been relied on.
2020-04-13 17:52:09 +00:00
John Benediktsson c56dd706ce io.directories: use factor for touch-file. 2020-04-13 10:28:16 -07:00
John Benediktsson f0013a8815 sodium.secure-memory: apply @AlexIljin patch for secure-memory=. 2020-04-13 09:53:39 -07:00
Alexander Iljin 87d7908063 sodium.secure-memory: new vocab 2020-04-13 15:32:00 +00:00
Alexander Iljin 7d87d1ee8a sodium.ffi: add 2020 to the copyright years 2020-04-13 15:32:00 +00:00
Alexander Iljin a2bb9f117b sodium.ffi: fix the pointer declaration syntax 2020-04-13 15:32:00 +00:00
Alexander Iljin 7a7b69c73d sodium.ffi: add the Argon2i header definitions 2020-04-13 15:32:00 +00:00
Alexander Iljin 2ba1db0362 sodium.ffi: fix the array parameters in the function declarations
Add a couple of necessary constants.
2020-04-13 15:32:00 +00:00
Alexander Iljin 142d02ce43 sodium.ffi: add some SHA hash and HMAC headers 2020-04-13 15:32:00 +00:00
Doug Coleman 1870c11c0b io.directories: The only truly cross-platform binary is Factor. 2020-04-12 13:25:24 -05:00
Doug Coleman 899c388ca7 benchmark.regex-dna: We have to read the input and output files with \n
line endings.
2020-04-12 11:23:38 -07:00
Doug Coleman 4a48297387 io: Really fix the tests. 2020-04-12 11:04:50 -05:00
Doug Coleman 32410ebca7 Windows: Handle three places where Windows line endings break the tests.
Usually we check out with Unix line endings, but if you don't set this
option, then get adds extra newlines to text files. Since there are
only three places, let's just fix them.

Fixes #2276
2020-04-12 00:05:44 -05:00
Doug Coleman 2b85b27c17 io.directories: Maybe echo is a good cross-platform test?
4a6bd57977 (commitcomment-38433000)
2020-04-11 12:48:08 -05:00
Doug Coleman 723072726e Revert "io.directories: Don't use ``touch`` because it's not default on Windows."
This reverts commit 4a6bd57977.

We don't test anything without try-process.
2020-04-11 12:39:22 -05:00
Doug Coleman 4a6bd57977 io.directories: Don't use ``touch`` because it's not default on Windows. 2020-04-10 21:44:38 -07:00
Doug Coleman cff2fde9f9 mason.child: Up the codeheap size on Windows mason tests. 2020-04-10 21:31:56 -07:00
John Benediktsson ce7cad8bd3 webbrowser: disable some tests that open windows. 2020-04-09 13:35:28 -07:00
Doug Coleman 0e5a3e2f6a openssl.libssl: Add functions to set options on SSL_CTX.
With these functions we can disable TLS1.0 and TLS1.1 someday.

Related to #2273.
2020-04-07 22:34:43 +00:00
John Benediktsson e219aad7e5 vm: lost a character somehow. 2020-04-07 11:40:04 -07:00
John Benediktsson 5c98ba78cb vm: quick fix for compilation warning. 2020-04-07 11:38:48 -07:00
Doug Coleman f5d0b8bfb0 sodium: Less stack shuffling in test. 2020-04-07 00:52:29 -05:00
John Benediktsson 2c014197c7 mason.test: change mason to load roots in order.
This will allow us to know when core depends on basis, or basis on
extra, because they should get load errors.
2020-04-03 09:44:45 -07:00
John Benediktsson 2c378da929 furnace.actions: better using. 2020-04-02 20:00:56 -07:00
John Benediktsson c4d179643b furnace.actions: cleanup using. 2020-04-02 17:31:41 -07:00
John Benediktsson a785e279d5 windows.iphlpapi: use follow, it's simpler. 2020-04-02 17:30:13 -07:00
John Benediktsson 94d97a20f5 basis/extra: move tools. 2020-04-02 17:06:50 -07:00
John Benediktsson 7deab681c6 io.encodings.utf7: skip over first char when searching. 2020-04-02 12:32:05 -07:00
John Benediktsson 605dad2406 io.encodings.utf7: revert last patch, fixed and faster. 2020-04-02 10:54:51 -07:00
John Benediktsson 3b1464630c cli.git: revert process-contents patch. 2020-04-02 09:53:56 -07:00
John Benediktsson de3b74d1c6 basis/extra: move fewer things. 2020-04-01 21:37:28 -07:00
John Benediktsson 42cf41e616 Revert "basis: Move any vocabularies required by basis into basis."
This reverts commit 59c2956570.
2020-04-01 21:37:28 -07:00
John Benediktsson 33eb8a7837 Revert "basis: Move more extra to basis."
This reverts commit 2d85dafa98.
2020-04-01 21:37:28 -07:00
Alexander Iljin 7e4c854714 rosetta-code.multisplit: reduce memory usage
Avoid creating a filtered sequence when all we need is its first element.
2020-04-02 01:50:01 +00:00
Alexander Iljin 9b143a826d rosetta-code.multisplit: new vocab 2020-04-01 23:21:52 +00:00
Doug Coleman 0f9959a15b build.sh: Only find the mingw compiler on Windows.
Fixes #2269
2020-03-30 20:37:38 -05:00
Doug Coleman 905e2cfb6b build.sh: Support MINGW64 as 64bit Windows.
This is for msys2 64bit mode.
2020-03-30 17:31:35 -05:00
Doug Coleman 45d090738d build.sh: Only support 32/64bit word sizes. 2020-03-30 17:28:02 -05:00
Doug Coleman 2d85dafa98 basis: Move more extra to basis.
I missed these because they were already loaded in my saved image.
2020-03-28 10:39:06 -05:00
Doug Coleman 59c2956570 basis: Move any vocabularies required by basis into basis. 2020-03-28 09:30:37 -05:00
John Benediktsson 497d6491e6 formatting: simplify using assoc>map instead of unzip map map zip. 2020-03-24 11:13:55 -07:00
John Benediktsson 5525313757 formatting: support other sequences in printf. 2020-03-24 11:11:15 -07:00
Doug Coleman 5cc97a4d1b unix.process: Add posix_spawn stub.
I couldn't get this to work in all cases to replace spawn-process yet.

```
! works
{ "/bin/ls" "-al" } posix-spawn-args-with-path

! Broken on Linux64 for some reason
{
    "/usr/bin/code"
    "-g"
    "-r"
    "/home/erg/factor-master/basis/io/launcher/launcher.factor"
} posix-spawn-args-with-path
```
2020-03-15 17:23:21 -05:00
Doug Coleman 8c97ea20de build.sh: Tab snuck into my commit... 2020-03-15 13:46:42 -05:00
Doug Coleman c23230ed82 windows: Move types to ole32 2020-03-15 13:31:46 -05:00
Doug Coleman 1abde46c79 windows: Move IStream to windows.com to fix bootstrap. 2020-03-15 13:21:38 -05:00
Doug Coleman 172649f667 factor: Update all repos to point to github.com.
factorcode.org repo can get behind the github one due to #1862 and low RAM on the new factorcode.org server

Change strategy for calling git fetch to not include the branch name if we are on a detached HEAD
2020-03-15 13:06:02 -05:00
Cat Stevens 426d8f09b2 fix various typos; cleanup and fully document boyer-moore 2020-03-15 14:58:43 +00:00
kusumotonorio d8f813a531 Reduced stack waste, added LOGIC-RED: and LOGIC-VAR:, a little speed up. 2020-03-15 03:22:57 +00:00
John Benediktsson ee4e977fbb ui.text.core-text: apply @kusumotonorio patch. 2020-03-11 20:59:20 -07:00
Doug Coleman 85d15e865a windows: Add more COM code. 2020-03-10 18:34:24 -05:00
John Benediktsson 717dce055a images.loader: fix tests. 2020-03-10 10:20:21 -07:00
Doug Coleman d98f0134ab images.loader: fix using and kick the tires 2020-03-10 09:57:47 -05:00
Doug Coleman 39f8abc764 images.loader: Disable saving a bmp on win32.
This is probably fixable with enough auditing of the gdiplus flat
interface.
2020-03-10 03:53:14 -05:00
Doug Coleman fcc225466f vm/allot.hpp: Print more room info when allot() fails.
This is to help debug win64.

Some interesting observations:

fails without any error:
factor.com -codeheap=74000

fails with VirtualAlloc error:
factor.com -codeheap=80000
2020-03-10 03:33:20 -05:00
Doug Coleman 96d3482475 windows: Fix user32/shcore DPI functions. 2020-03-09 21:59:10 -05:00
Doug Coleman 67d5e633f1 nmake: Fix caching on Windows when compiling without a manifest. 2020-03-09 17:30:24 -05:00
Doug Coleman 37871d87f4 windows: Add a bunch of HighDPI functions. 2020-03-07 13:26:25 -06:00
Doug Coleman fe83a4a164 vm: Add AS_UTF and use it to print wchar_t in Windows terminal.
There may be more places to add AS_UTF8 calls--anywhere that prints a
wchar_t string in the Windows vm.

Fixes #992.
2020-03-06 23:57:57 -06:00
Doug Coleman 34029cf1e4 Nmakefile: Add default flags and add command to add the manifest to .exe
The manifest is disabled for now, but once we fix the resolution we
should enable it.

to test:
nmake /f Nmakefile factor.exe.manifest

Right now the UI looks tiny if you compile for the factor.exe and
include the manifest.

Lastly, sorry for the WIP but it seems pretty harmless and has been
sitting in a branch for almost three years.
2020-03-06 23:33:26 -06:00
Benjamin Pollack bafb101b7a windows; add functions to determine DPI scaling 2020-03-06 23:21:02 -06:00
Niklas Larsson 8df1d1fbe6 cache: Don't use in-place filter
This solves a UI corruption problem by not reusing the hashtable when
purging the cache. The root cause of why the hashtable gets corrupted
when filtering in place hasn't been found.

Fixes #1978.
2020-03-06 23:14:44 -06:00
nomennescio d1be15c28d Added instructions on fetching replace objects for source history 2020-03-06 23:03:42 -06:00
Doug Coleman 96b891f5d8 images.loader: Windows can save bmp files.
If there is a crasher, we can debug it.
2020-03-06 22:59:30 -06:00
Doug Coleman 9bb9afd5cc ui.render.test: Replace reference image with an uncorrupted one.
To generate a rendering image:

USE: ui.render.test
"ui-render-test" run
render-output get-global "resource:reference.bmp" save-graphic-image

Fixes #2210.
2020-03-06 19:37:02 -06:00
Doug Coleman d188bcf592 images.loader.gdiplus: Allow writing .bmp and do a better lookup. 2020-03-06 19:35:16 -06:00
Doug Coleman 97532d020a ui.gadgets: Stale gestures can lose the associated gadget.
The gesture queue can send messages where the
focusable-child has disappeared.

Handle ``M: f focusable-child*`` by doing nothing.

Fixes #2117.
2020-03-06 19:05:27 -06:00
Doug Coleman 8da5c2fc91 windows.ole32: Add more LONG: constants. 2020-03-06 19:05:07 -06:00
Doug Coleman 92cb20163f windows.ole32: Add more error constants as long.
These are -2B..2B instead of positive integers because long is s32 on
Windows.
2020-03-06 17:53:38 -06:00
John Benediktsson 7eee21ab94 vocabs.metadata: cleanup a couple uses of metadata paths. 2020-03-05 09:33:41 -08:00
John Benediktsson d94b135087 vocabs.metadata: cleanup paths to be fully specified. 2020-03-05 08:59:36 -08:00
John Benediktsson 3efe23cc71 ui.gadgets.panes: fix tests under dark-theme. 2020-03-03 15:23:18 -08:00
John Benediktsson 0be0c69ea5 pdf: heuristic for dealing with table wrapping. 2020-03-03 11:31:00 -08:00
John Benediktsson 9d16162371 pdf.values: fix names for some fonts. 2020-03-03 11:09:11 -08:00
John Benediktsson 5a1b773899 help.pdf: use 1.25 line-height on pdf. 2020-03-03 09:46:45 -08:00
John Benediktsson b23fc52850 pdf.canvas: add concept of line-height multiplier. 2020-03-03 09:46:32 -08:00
John Benediktsson ab81a957c9 logic.examples: cleanup, make hanoi tests assert output. 2020-03-03 08:09:52 -08:00
kusumotonorio 4ecc1110c8 logic.factor: [ quot call( -- ) ] --> quot 2020-03-03 15:59:07 +00:00
kusumotonorio 14ac76fc2c factlog vocab ==> logic vocab 2020-03-03 15:59:07 +00:00
kusumotonorio a37cb9857a Rename directory, files. 2020-03-03 15:59:07 +00:00
kusumotonorio 431282afcf catb0t's PR: add a Prolog-like %! ... multiline comment #6 2020-03-03 15:59:07 +00:00
kusumotonorio c760a5aa8f factlog 2020-03-03 15:59:07 +00:00
John Benediktsson a462587833 html.templates.chloe: adding missing tests. 2020-03-02 19:01:01 -08:00
John Benediktsson 8fd4552b45 webapps.planet: use factor color. 2020-03-02 17:07:30 -08:00
John Benediktsson c57580b06a webapps.wiki: remove footer border-top. 2020-03-02 17:03:25 -08:00
John Benediktsson 711297690b websites.concatenative: navbar background. 2020-03-02 17:01:01 -08:00
John Benediktsson 36553b34fb webapps.wiki: better spacing on article list. 2020-03-02 16:07:09 -08:00
John Benediktsson 290d0ed7d2 html.templates: adding meta tag and some chloe tests. 2020-03-02 15:57:19 -08:00
John Benediktsson 3b18827044 tools.errors: fix to match current behavior: "show". 2020-03-02 15:40:37 -08:00
John Benediktsson ab9eca2454 bootstrap.image: add make-my-image to docs. 2020-03-02 15:40:22 -08:00
John Benediktsson b9bd328f2e webapps: remove floating factorcode.org links. 2020-03-02 15:39:53 -08:00
John Benediktsson 9abc2ae873 webapps.help: matching style for navbar. 2020-03-02 08:48:25 -08:00
John Benediktsson 5acf0512b9 websites.concatenative: make navbar use line-height. 2020-03-02 08:44:17 -08:00
John Benediktsson 52d371320f webapps.wiki: 24px hamburger instead of 32px. 2020-03-02 08:40:23 -08:00
John Benediktsson 1c1d23fd99 webapps.help: responsive search. 2020-03-02 07:03:55 -08:00
John Benediktsson a8d35345c4 extra: moving hash-sets.numbers, hashtables.numbers to basis. 2020-03-01 20:50:58 -08:00
John Benediktsson 50bd41d82f help.html: move pre-wrap to css style fixup. 2020-03-01 18:32:47 -08:00
John Benediktsson 2c43df72ea html.streams: fix tests. 2020-03-01 18:32:35 -08:00
John Benediktsson 522bc97e87 webapps.planet: a bit more style. 2020-03-01 14:41:03 -08:00
John Benediktsson 70fba55732 webapps.planet: more responsive css. 2020-03-01 14:35:04 -08:00
John Benediktsson 77fd680475 webapps.planet: use div to style post body. 2020-03-01 13:49:06 -08:00
John Benediktsson b6853b8c6a webapps.pastebin: more padding. 2020-03-01 13:46:41 -08:00
John Benediktsson a07af0b593 webapps.wiki: style the header. 2020-03-01 13:46:27 -08:00
John Benediktsson 670f5a77a7 webapps.wiki: tweak line-height to fix issue with title. 2020-03-01 13:31:08 -08:00
John Benediktsson d326e8f788 webapps.wiki: simplify and fix resize issue on mobile. 2020-03-01 12:20:32 -08:00
John Benediktsson 9336cd6efc webapps.wiki: some responsive css (and JS for hamburger menu). 2020-03-01 12:12:08 -08:00
John Benediktsson 18a1d07d05 websites.concatenative: write script (if any) from children. 2020-03-01 12:11:31 -08:00
John Benediktsson 5967033fe5 html.templates: adding t:script and t:write-script. 2020-03-01 12:05:59 -08:00
John Benediktsson c64d9032b5 help.html: more responsive help docs. 2020-03-01 10:27:22 -08:00
John Benediktsson e07abedafe html.streams: monospace uses pre-wrap, wrap-margin sets width. 2020-03-01 10:27:22 -08:00
Cat Stevens 573e4ed198 math.matrices: fix/rename mnorm, update all norms
closes #2244

- `mnorm` has been renamed to `normalize-matrix`
	to reflect what it actually does, which
	is normalize a matrix, not find a norm
	of a matrix.

- `mnorm` is no longer a word defined here.

- bugfix: previously, `normalize-matrix` found
	the supremum of a matrix (`mmax`),
	before taking the supremum's absolute
	value (`abs`) and dividing the matrix
	by it (`m/n`).
	for matrices containing only negative
	values and 0, the supremum is 0, and
	a `div-by-zero` error was thrown.

	`normalize-matrix` has been fixed to
	first `abs` all the matrix elements,
	and then find the supremum and divide,

	it also receieved a zero-matrix? guard
	for optimization and preventing
	`div-by-zero`.

- new alias: `hilbert-schmidt-norm` for
	`frobenius-norm`,  to go along with
	`math.matrices.extras.<hilbert-matrix>`
	and improve searchability by physicists.

- new word: `matrix-p-norm`, written as an
	analogue of `math.vectors.p-norm`.

- new word: `matrix-p-q-norm`, which generalizes
	entrywise matrix norm over the L^p,q
	vector space.

- new word: `matrix-p-norm-entrywise`:
	`matrix-p-norm`'s fallback
	for p =/= 1, 2, inf; analogue of
	`math.vectors.p-norm-default`.

- all norm words have gotten new docs,
	`zero-matrix?` guards as an optimisation,
	and most have gotten new tests.
2020-03-01 03:31:28 +00:00
John Benediktsson 2511fa72de websites.concatenative: fix for xhtml. 2020-02-29 08:25:52 -08:00
John Benediktsson f169051860 websites.concatenative: device viewport css. 2020-02-29 08:25:16 -08:00
John Benediktsson 50f0d241b7 websites.factorcode: some downloads style. 2020-02-29 08:21:41 -08:00
John Benediktsson 24b85d774f websites.factorcode: give logo a width also. 2020-02-29 08:14:10 -08:00
John Benediktsson 5c758c7018 websites.factorcode: better mobile responsive css. 2020-02-29 08:06:59 -08:00
John Benediktsson 6599869f73 prettyprint.backend: make +nil+ render as L{ }. 2020-02-29 07:16:46 -08:00
John Benediktsson 0139e0d081 websites.factorcode: tinypng the logo. 2020-02-28 14:25:35 -08:00
John Benediktsson 835a83d311 websites.factorcode: more examples. 2020-02-28 13:16:58 -08:00
John Benediktsson 9237a4f289 websites.factorcode: more examples. 2020-02-28 13:04:46 -08:00
John Benediktsson ed3cdf7ec7 websites.factorcode: smaller fonts in downloads table. 2020-02-28 12:03:07 -08:00
John Benediktsson dc8e6e6799 ui.gadgets.paragraphs: need to merge height/metrics.
Sometimes cap-height is false and we handle that differently.
2020-02-27 21:53:39 -08:00
John Benediktsson 086269ba34 help.html: default font size should be 12pt, less line-height for pre. 2020-02-27 21:44:32 -08:00
John Benediktsson 2379d27950 ui.gadgets.paragraphs: faster pref-dim.
Now computing gadget-metrics once, before called (measure-metrics) twice,
the first time adding the result, the second time dropping the top of stack.
2020-02-27 18:10:37 -08:00
John Benediktsson 12079725ac webapps: pre tag line-height. 2020-02-27 17:25:20 -08:00
John Benediktsson 741d9e2dd6 webapps.wiki: moving class description to wiki.css. 2020-02-27 17:21:33 -08:00
John Benediktsson ba09d70b8b help.html: raise line-height to 150%. 2020-02-27 16:49:48 -08:00
John Benediktsson d3337d566e Revert "webapps.help: just include the original css instead of duplicating."
This reverts commit 77b0c45a13.
2020-02-27 16:41:20 -08:00
John Benediktsson 77b0c45a13 webapps.help: just include the original css instead of duplicating. 2020-02-27 16:27:15 -08:00
John Benediktsson 490c66ef5d webapps.help: sync with help.html. 2020-02-27 16:09:03 -08:00
John Benediktsson d732e87cfa help.html: less css reset. 2020-02-27 16:08:33 -08:00
John Benediktsson db1069a6dd websites.concatenative: move container div to page.xml. 2020-02-27 15:11:55 -08:00
John Benediktsson c719b096a5 webapps.planet: minor fixes. 2020-02-27 14:44:19 -08:00
John Benediktsson 4241854f94 webapps.pastebin: updated css style. 2020-02-27 14:44:05 -08:00
John Benediktsson e329d3d9c2 webapps.planet: use protocol agnostic link. 2020-02-27 14:41:13 -08:00
John Benediktsson 7ec954ec05 help.html: use protocol agnostic link. 2020-02-27 14:40:50 -08:00
John Benediktsson d2eb77e849 webapps.planet: some css cleanup. 2020-02-27 14:28:51 -08:00
John Benediktsson 83f47eb209 help.html: make these match new wiki css. 2020-02-27 13:15:53 -08:00
John Benediktsson de6d2e2ccd webapps.wiki: forgot this file. 2020-02-27 12:49:46 -08:00
John Benediktsson 79f1b8e409 websites.concatenative: cleanup css a bit. 2020-02-27 12:49:22 -08:00
Doug Coleman b546d88e83 extra: Finish renaming a couple words 2020-02-27 01:04:52 +00:00
John Benediktsson b1a70d47a4 websites.factorcode: a couple more examples. 2020-02-26 17:00:07 -08:00
John Benediktsson 391e3734ee websites.factorcode: first pass cleanup of website. 2020-02-26 16:46:05 -08:00
John Benediktsson 43b82b03ad math.vectors: rename "h." to "hdot" 2020-02-26 13:06:52 -08:00
John Benediktsson da5d010c5b math.vectors.simd: fix typo in simd vdot intrinsic. 2020-02-26 12:56:52 -08:00
John Benediktsson 07a5912afa math.matrices: rename m./m.v/v.m to mdot/mdotv/vdotm. 2020-02-26 12:51:04 -08:00
John Benediktsson 1c5d417100 math.vectors: rename "v." to "vdot" 2020-02-26 12:40:16 -08:00
John Benediktsson 29054e53e8 help.markup: make sure lists wrap wider. 2020-02-26 12:02:20 -08:00
John Benediktsson 95b695d664 fjsc: remove unnecessary stack effects on generic words. 2020-02-26 11:34:23 -08:00
John Benediktsson 385c5edf1a calendar: remove unnecessary effects on generics. 2020-02-26 11:34:02 -08:00
John Benediktsson 6ee821e061 prettyprint.stylesheet: s/stack-effect-style/base-effect/style/. 2020-02-26 11:18:18 -08:00
John Benediktsson 049271d04e help.markup: cleanup using. 2020-02-26 11:08:13 -08:00
John Benediktsson 59ddb844e9 prettyprint.stylesheet: change stack effects to not be green. 2020-02-26 11:07:46 -08:00
John Benediktsson 2cbcacad88 core/basis/extra: update some tags.txt. 2020-02-26 10:57:08 -08:00
John Benediktsson 522f30e520 xml.writer: remove M\ number write-xml.
This is likely an artifact from when numbers were treated as sequences,
which isn't needed anymore.
2020-02-26 10:24:23 -08:00
John Benediktsson 994ecb655b help.html: assume even padding started out odd. 2020-02-26 10:03:35 -08:00
John Benediktsson 6796daab79 help.html: clone attrs in css-styles-to-classes and double padding. 2020-02-26 09:44:14 -08:00
John Benediktsson 15d6762449 help.markup: change $breadcrumbs to unicode. 2020-02-26 09:40:27 -08:00
John Benediktsson 6aa7d52473 ui.tools.browser: use unicode next/prev arrows. 2020-02-26 09:22:48 -08:00
John Benediktsson c03a7b5ec2 ui.gadgets.panes: simplify <styled-label>. 2020-02-25 12:33:01 -08:00
John Benediktsson 94fcf3f2b6 html.streams: allow div-css-style to use span-css-style. 2020-02-25 12:30:51 -08:00
John Benediktsson 404aa1bc92 Revert "html.streams: use style-stream."
This reverts commit 6f9a7dcc9e.
2020-02-25 12:10:42 -08:00
John Benediktsson 0d6096df0a vm: use FILE_READ_ATTRIBUTES to make exists? faster. 2020-02-25 11:05:17 -08:00
John Benediktsson 08dd854b15 lists: check for errors like L{ . 3 }. 2020-02-24 09:11:46 -08:00
John Benediktsson 20f0b8aa28 lists: make multiple dots a syntax error. 2020-02-23 07:29:02 -08:00
John Benediktsson 79add00e24 help.html: don't use sprintf. 2020-02-22 20:40:11 -08:00
John Benediktsson 83e46eb030 lists: simplify parse-list-literal to fix bootstrap issue. 2020-02-22 20:37:10 -08:00
kusumotonorio 0f6ec42e3e lists.factor: rest: --> . 2020-02-22 19:58:55 -08:00
kusumotonorio 384f976deb lists.factor: Added some vocab 2020-02-22 19:58:55 -08:00
kusumotonorio a38b3dfd83 Supports dotted pair notation 2020-02-22 19:58:55 -08:00
John Benediktsson 189b54998d Revert "help.markup: separate examples using newlines."
This reverts commit 76fcbdc690.
2020-02-22 19:49:41 -08:00
John Benediktsson 2ee8635f1e help.stylesheet: make some fonts bigger. 2020-02-19 21:55:29 -08:00
John Benediktsson b73b3e04f9 help: simplify navigation-table. 2020-02-19 21:47:01 -08:00
John Benediktsson 76fcbdc690 help.markup: separate examples using newlines. 2020-02-19 21:47:01 -08:00
John Benediktsson e0e58a62c5 ui.tools.browser: change $navigation to not use title-style. 2020-02-19 21:47:01 -08:00
John Benediktsson 1a84cede3b ui.gadgets.panes: change approach to nested-pane-stream. 2020-02-19 21:47:01 -08:00
John Benediktsson a7682c9854 io.styles: change style-stream to inherit all styles by default. 2020-02-19 21:47:01 -08:00
John Benediktsson fa31902975 ui.tools.error-list: adding table header emphasis. 2020-02-19 21:47:01 -08:00
Doug Coleman a91fbb54b0 syndication: Property can be present but f, handle this.
Test case:
    "http://www.spreaker.com/show/2952221/episodes/feed" http-get nip parse-feed
2020-02-18 18:43:49 -06:00
Doug Coleman 02445393c8 factorcode: Friendship ended with RACKSPACE. Now DIGITALOCEAN is my best friend 2020-02-18 14:18:53 -06:00
John Benediktsson 3aa71bcb84 help.html: cleanup stylesheet a bit. 2020-02-17 14:50:48 -08:00
John Benediktsson ff35f79f3e help.html: change fixed font-size to relative. 2020-02-17 14:50:30 -08:00
John Benediktsson c8e4d9fa69 Revert "io.streams.ansi: use call-next-method."
This reverts commit dbb83b7100.
2020-02-17 07:09:12 -08:00
John Benediktsson abbfedc53d Revert "io.streams.256color: use call-next-method."
This reverts commit 4af73340d2.
2020-02-17 07:08:56 -08:00
John Benediktsson 2e5cec428a help.markup: adding a $slots word to document slots, use it. 2020-02-16 22:36:19 -08:00
John Benediktsson 7de25b9f20 ui.gadgets.panes: make it clear that pane/pack/paragraph are not streams. 2020-02-16 19:23:29 -08:00
John Benediktsson f651c8fd9a ui.gadgets.pane: rename pane-clear to clear-pane. 2020-02-16 19:17:29 -08:00
John Benediktsson 8976014697 help.html: support style/class replacement in more tags. 2020-02-15 10:27:22 -08:00
John Benediktsson dbb83b7100 io.streams.ansi: use call-next-method. 2020-02-15 09:36:06 -08:00
John Benediktsson 4af73340d2 io.streams.256color: use call-next-method. 2020-02-15 09:35:57 -08:00
John Benediktsson 7b0f6efe7f ui.gadgets.panes: use style-stream. 2020-02-15 09:35:09 -08:00
John Benediktsson 6f9a7dcc9e html.streams: use style-stream. 2020-02-15 09:33:55 -08:00
John Benediktsson 4a05a845bc io.styles: rename do-nested-style, make private. 2020-02-15 09:22:41 -08:00
John Benediktsson 1e8b405307 io.streams.256color: use filter-writer. 2020-02-15 08:57:18 -08:00
John Benediktsson e822e78afd io.streams.ansi: use filter-writer. 2020-02-15 08:57:09 -08:00
John Benediktsson d0a44d665e io.styles: only allow character styles to inherit. 2020-02-15 08:42:06 -08:00
John Benediktsson 70c8b35f62 slides: unify default-style and code-style. 2020-02-15 08:40:44 -08:00
John Benediktsson be746c1f6d help: unify code-char-style and code-style. 2020-02-15 08:40:21 -08:00
John Benediktsson 647a477d68 help.html: vertical-align images. 2020-02-14 22:31:12 -08:00
John Benediktsson 75db2b0d4a help.markup: change default-style to use with-nesting. 2020-02-14 22:18:38 -08:00
John Benediktsson 1da20adc63 help: change $title to only use with-nesting. 2020-02-14 22:17:41 -08:00
John Benediktsson 6adabbdf2d io.styles: simplify style-stream by depending on style words. 2020-02-14 21:28:05 -08:00
John Benediktsson 3b08633604 help.html: whoops, need to remove the extra links. 2020-02-13 21:52:43 -08:00
John Benediktsson ba81ca3fa6 help.html: tweak the navbar a bit. 2020-02-13 21:43:24 -08:00
John Benediktsson d890f410bf help.html: use max-width for content. 2020-02-13 21:07:25 -08:00
John Benediktsson de294563d1 help.html: wrap contents in a div, update style a little. 2020-02-13 21:01:47 -08:00
John Benediktsson a3730c329a help: change $title to nest then style.
This changnes the HTML we produce to look like:

    <div><span>...</span></div>

Instead of:

    <span><div>...</div></span>
2020-02-13 21:01:03 -08:00
John Benediktsson 02ec3531c3 help.markup: more bold table headings. 2020-02-13 15:20:17 -08:00
John Benediktsson 38bfcd4bf1 help: add more bold table headings. 2020-02-13 15:18:43 -08:00
John Benediktsson dc0a5ba216 help: add some bold table headings. 2020-02-13 15:07:15 -08:00
John Benediktsson b94d9662f9 bootstrap.image: define MAIN: to make-my-image. 2020-02-13 14:56:35 -08:00
John Benediktsson c850d38e6c generic.math: some minor cleanup. 2020-02-13 14:54:46 -08:00
John Benediktsson bcecb3b088 markov-chains: initial implementation. 2020-02-13 14:26:40 -08:00
Doug Coleman 5cb26d546f windows.gdiplus: flags{ } is in literals, fix using 2020-02-13 06:25:21 +03:00
John Benediktsson 0ce27a4507 gpu.framebuffers: simplify bitor. 2020-02-12 17:00:34 -08:00
John Benediktsson e4aae0871c opencl: use flags{ }. 2020-02-12 17:00:19 -08:00
John Benediktsson ec0326fee9 io.files.trash.windows: using flags{ }. 2020-02-12 14:33:30 -08:00
John Benediktsson 42e49f432c vocabs.loader: fix alignment of last patch. 2020-02-12 13:54:11 -08:00
John Benediktsson 38eab40848 vocabs.loader: prevent create-vocab if check-vocab fails. 2020-02-12 08:42:56 -08:00
John Benediktsson 6c06054ed6 tetris.game: fix tests. 2020-02-12 08:38:41 -08:00
John Benediktsson bd0369e4e1 x11.xim: fix use of flags. 2020-02-12 08:37:13 -08:00
John Benediktsson 2e644a2c7b tetris: some cleanup, simplify. 2020-02-11 13:57:19 -08:00
John Benediktsson d2ab01a5d9 core/basis/extra: use flags{ } in places. 2020-02-11 13:27:42 -08:00
John Benediktsson fe929be0f4 io.directories.windows: don't need to wrap. 2020-02-11 13:25:44 -08:00
John Benediktsson 4e91f55f1e vocabs.hierarchy: change sorting to sort visible-dirs. 2020-02-09 10:00:18 -08:00
John Benediktsson 1a1ee4b4a8 vocabs.hierarchy: faster all-disk-vocabs-recursive.
The old technique caused a high amount of redundant ``exists?`` checks,
even though we are traversing the directory tree.  That happens to be a
little slow on Windows, for some pathological reason, the first time
it's run. This should make it better while we also investigate why
``windows_stat`` is slower in that case.
2020-02-09 09:04:14 -08:00
John Benediktsson b430f8e0a7 io.files.windows: make win32-file-attributes a little faster. 2020-02-07 14:11:43 -08:00
John Benediktsson dfc4901857 math.statistics: adding interquartile-range, midhinge, and fivenum. 2020-02-06 11:40:53 -08:00
John Benediktsson 67bf39f0fb tensors: cleanup using, and make a few float math operations faster. 2020-01-30 13:39:27 -08:00
John Benediktsson 2200468755 gobject-introspection: support more number type constants. 2020-01-30 08:23:13 -08:00
Chris Double 487141d440 Fix linux find-so failure if no old ld entries exist
If '/etc/ld.so.cache' does not contain any old entries
using the 'HeaderOld' struct then it fails with a bad-magic
error before looking for the HeaderNew entries.

My Ubuntu 19.10 system doesn't have any old entries so always
fails here when using 'load-all', which results in the
'extra/llvm' vocab failing due to using 'find-so'.

The fix implemented here is to catch the error and recover from
it by seeking back to the start of the header before looking for
the new header entries.
2020-01-29 06:17:37 -08:00
John Benediktsson dfdbde9f33 math.matrices: use any? and all? directly in tests. 2020-01-28 20:44:19 -08:00
John Benediktsson 464f0a11ef math.matrices: update using on tests. 2020-01-28 20:38:43 -08:00
John Benediktsson 2300311641 bittorrent: fix check-bitfield, add a test. 2020-01-28 16:25:19 -08:00
John Benediktsson 6aa8f640c8 persistent.hashtables: cleanup. 2020-01-28 16:22:33 -08:00
John Benediktsson 548109bf4b math: use sorted-histogram values in a few places. 2020-01-28 16:21:33 -08:00
John Benediktsson 94cbe2b479 ui.gadgets.panes: fix for big strings on windows and linux.
Using 3639 grapheme length, which is win32 limit. Maybe cairo supports
4681 graphemes, but use the lower limit for now.
2020-01-28 16:16:09 -08:00
John Benediktsson a62ea78d73 ui.backend.cocoa.views: some formatting cleanup. 2020-01-24 14:47:42 -08:00
kusumotonorio fb3928f807 Tests for System V AMD64 ABI (#2233)
* Adds Tests for System V AMD64 ABI

* Remove TABs, etc.

* Adds a test

* Some Cleanup

* Add Callback Tests

* Add More Tests
2020-01-24 21:54:33 +00:00
John Benediktsson 4e17fb13cb
Merge pull request #2235 from kusumotonorio/system-v-amd64-abi
Improved System V AMD64 ABI compliance
2020-01-24 21:52:40 +00:00
John Benediktsson eb4c6cf711 bittorrent: initial commit of message parsing. 2020-01-24 13:47:20 -08:00
Doug Coleman d992e87cd6 LICENSE.txt: Update the copyright year! 2020-01-23 19:44:03 -06:00
kusumotonorio 1eaa895c8a unix.factor: Bug fix etc., boxing.factor: Improves record/unrecord-reps 2020-01-23 20:02:03 +09:00
kusumotonorio 95519b0130 boxing.factor: Swap first and second positions 2020-01-20 20:47:16 +09:00
kusumotonorio 7349f9d953 boxing.factor: Use count 2020-01-20 20:38:43 +09:00
kusumotonorio aba3d66849 unix.factor: Use count 2020-01-20 18:53:26 +09:00
kusumotonorio 56c6e3058b put alien.factor, ffi_test.* back 2020-01-19 22:30:48 +09:00
kusumotonorio e6726acd02 put alien.factor back 2020-01-19 22:27:17 +09:00
kusumotonorio c258a4e2f4 Add Callback Tests 2020-01-19 21:57:05 +09:00
kusumotonorio 2ee51f50e2 Stop inc-not-f and dec-not-f, etc 2020-01-19 14:30:38 +09:00
Doug Coleman ada064d9c3 byte-arrays: Add a byte-sequence protocol for byte-{array,vector}
Allow hexdumping strings as utf8 for convenience.
2020-01-16 18:18:46 -06:00
kusumotonorio bb7777e0cf boxing.factor: Change Stack Effects 2020-01-16 23:34:24 +09:00
kusumotonorio d581322225 Remove an extra space 2020-01-16 21:06:22 +09:00
kusumotonorio 5bee1ba3a1 Improve System V AMD64 ABI compliance 2020-01-16 20:57:13 +09:00
John Benediktsson d593d3d953 tuple-arrays: final-class wasn't a predicate class. 2020-01-15 13:54:40 -08:00
John Benediktsson 8c5e9a7df4 classes: fix a couple of check-instance uses. 2020-01-15 13:33:50 -08:00
John Benediktsson 19c8d482fb continuations: more use of check-instance. 2020-01-15 10:52:34 -08:00
John Benediktsson 77cd3aaede classes: use check-instance in a few places, to remove duplication. 2020-01-15 10:34:47 -08:00
John Benediktsson cd75a7eb4e classes: adding a check-instance for checking type of things.
This will replace a bunch of not-a-thingy errors that we have in a few
places.  Those should probably go away anyway, in favor of better type
propagation or runtime JIT compilation.
2020-01-15 10:29:06 -08:00
John Benediktsson b3582dd323 urls.encoding: support byte-array values for encoding. 2020-01-09 14:17:01 -08:00
John Benediktsson c2270fbe6a bencode: support decoding byte-arrays. 2020-01-09 11:57:20 -08:00
John Benediktsson 7565b372e7 bencode: alloe bencode of byte-arrays. 2020-01-08 17:33:11 -08:00
Doug Coleman 4acb08d905 tools.deploy: Up the deploy sizes for mac32.
Looks like upgrading to unicode 12 caused the sizes to grow. These are mostly graphics demos which should not depend on unicode, but the tools can't detect this easily, so punt for now.

Here's a command to show the last clean deploy to where it broke.

git log -p 4201c2149b66d5ce45a9e45be95459256486a7ea..8eb7621b549a7956665affc9e53a48e8e8b29ea3
2020-01-08 19:23:37 -06:00
John Benediktsson 73b01704a2 bencode: use linked-assocs to preserve ordering, fix byte-strings.
the byte-string was being "decoded" with replacement characters, messing
up binary data.
2020-01-08 11:45:42 -08:00
John Benediktsson d7c0dfcb2b llvm.ffi: ... 2020-01-08 11:44:45 -08:00
John Benediktsson d0fd75b208 tensors.tensor-slice: make step-slice not extend slice.
This caused a small regression in compiler.tree.cleanup on this test:

{ t } [
    [ { array } declare 2 <groups> [ . . ] assoc-each ]
    \ nth-unsafe inlined?
] unit-test

I'm not entirely sure why it wasn't able to infer the slice that was created
for iteration stays a slice, and never becomes a step-slice, so perhaps there
is some improvement to be made in type inference here.
2020-01-08 09:05:06 -08:00
John Benediktsson 655262af9a llvm.ffi: need to fix stack effect for the false case. 2020-01-08 08:51:41 -08:00
John Benediktsson ca1612cc57 io: fix for win32-error not throwing on zero. 2020-01-06 14:20:15 -08:00
John Benediktsson 1eb7dbe6d2 io.files: quot effects in change-file-lines and change-file-contents. 2020-01-06 13:26:19 -08:00
John Benediktsson b2dc630bd0 game.loop: last-tick-percent-offset counts down to zero, need to subtract from 1. 2020-01-06 13:20:12 -08:00
Alexander Iljin c77cc4c205 windows.errors: fix a compilation error 2020-01-06 13:18:53 -08:00
Alexander Iljin 049356574a windows.errors: streamline error handling and throwing 2020-01-06 13:18:33 -08:00
Alexander Iljin 3733b13daf Replace "win32-error-string throw" with windows-error instance throwing
Remove win32-error-string, because there was only one place it was used in.
2020-01-06 13:18:33 -08:00
Alexander Iljin 563a3b1a47 Replace "n>win32-error-string throw" with windows-error instance throwing 2020-01-06 13:18:33 -08:00
Alexander Iljin 135390968b Delete throw-win32-error, replace with win32-error calls 2020-01-06 13:18:33 -08:00
Alexander Iljin 407c7bc216 io.files.windows: replace "-1 <alien>" with INVALID_HANDLE_VALUE 2020-01-06 13:18:33 -08:00
Alexander Iljin 294be2cca3 Replace inline INVALID_HANDLE_VALUE checks with check-invalid-handle calls
On error find-first-file will now throw a windows-error instance instead of
a string.
2020-01-06 13:18:33 -08:00
Alexander Iljin 77db1b1df3 windows.errors: make check-invalid-handle throw windows-error instances
There are two consequences:
- the thrown object is now a windows-error, previously it was a string;
- if GetLastError returns zero, nothing is thrown. Previously the string
"The operation completed successfully." was thrown in that case.
2020-01-06 13:18:33 -08:00
John Benediktsson 249b916636 game.loop: using timer's next-nanos, which is in the future.
Also, use clamp to make sure tick offset is always [0,1].
2020-01-06 13:14:59 -08:00
John Benediktsson d3b9974bed llvm.ffi: fix cond. 2020-01-05 19:14:22 -08:00
Doug Coleman 86a35088de gpu.demos.bunny: use while* instead of each-morsel 2020-01-05 13:42:31 -06:00
Doug Coleman f9c90583d0 io.files.info: Fix linux file-system-info recursion 2020-01-05 13:27:22 -06:00
988 changed files with 14178 additions and 4674 deletions

1
.gitattributes vendored
View File

@ -1,2 +1,3 @@
*.factor text eol=lf
*.html text eol=lf
misc/vim/*/*/generated.vim linguist-generated

View File

@ -1,4 +1,4 @@
Copyright (c) 2019, Slava Pestov, et al.
Copyright (c) 2020, Slava Pestov, et al.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -58,6 +58,13 @@ CL_FLAGS = $(CL_FLAGS) $(CL_FLAGS_VISTA)
PLAF_DLL_OBJS = vm\os-windows-x86.64.obj vm\cpu-x86.obj
SUBSYSTEM_COM_FLAGS = console
SUBSYSTEM_EXE_FLAGS = windows
!ELSE
CL_FLAGS = $(CL_FLAGS) $(CL_FLAGS_VISTA)
PLAF_DLL_OBJS = vm\os-windows-x86.64.obj vm\cpu-x86.obj
SUBSYSTEM_COM_FLAGS = console
SUBSYSTEM_EXE_FLAGS = windows
!ENDIF
!IF DEFINED(DEBUG)
@ -143,6 +150,16 @@ factor.com: $(EXE_OBJS) $(DLL_OBJS)
factor.exe: $(EXE_OBJS) $(DLL_OBJS)
link $(LINK_FLAGS) /out:factor.exe /SUBSYSTEM:$(SUBSYSTEM_EXE_FLAGS) $(EXE_OBJS) $(DLL_OBJS)
# If we compile factor.exe, run mt.exe, and run factor.exe,
# then Windows caches the manifest. Even on a recompile without applying
# the mt.exe tool, if the factor.exe.manifest file is present, the manifest
# is applied. To avoid this, we delete the .manifest file on clean
# and copy it from a reference file on compilation and mt.exe.
#
factor.exe.manifest: factor.exe
copy factor.exe.manifest.in factor.exe.manifest
mt -manifest factor.exe.manifest -outputresource:"factor.exe;#1"
all: factor.com factor.exe factor.dll.lib libfactor-ffi-test.dll
!ENDIF
@ -174,12 +191,15 @@ clean:
if exist factor.lib del factor.lib
if exist factor.com del factor.com
if exist factor.exe del factor.exe
if exist factor.exe.manifest del factor.exe.manifest
if exist factor.exp del factor.exp
if exist factor.dll del factor.dll
if exist factor.dll.lib del factor.dll.lib
if exist factor.dll.exp del factor.dll.exp
if exist libfactor-ffi-test.dll del libfactor-ffi-test.dll
if exist libfactor-ffi-test.exp del libfactor-ffi-test.exp
if exist libfactor-ffi-test.lib del libfactor-ffi-test.lib
.PHONY: all default x86-32 x86-64 x86-32-vista x86-64-vista clean
.PHONY: all default x86-32 x86-64 x86-32-vista x86-64-vista clean factor.exe.manifest
.SUFFIXES: .rs

View File

@ -28,7 +28,7 @@ a boot image stored on factorcode.org.
To check out Factor:
* `git clone git://factorcode.org/git/factor.git`
* `git clone git://github.com/factor/factor.git`
* `cd factor`
To build the latest complete Factor system from git, either use the
@ -38,7 +38,7 @@ build script:
* Windows: `build.cmd`
or download the correct boot image for your system from
http://downloads.factorcode.org/images/master/, put it in the factor
http://downloads.factorcode.org/images/master/, put it in the `factor`
directory and run:
* Unix: `make` and then `./factor -i=boot.unix-x86.64.image`
@ -127,6 +127,25 @@ The Factor source tree is organized as follows:
* `misc/` - editor modes, icons, etc
* `unmaintained/` - now at [factor-unmaintained](https://github.com/factor/factor-unmaintained)
## Source History
During Factor's lifetime, sourcecode has lived in many repositories. Unfortunately, the first import in Git did not keep history. History has been partially recreated from what could be salvaged. Due to the nature of Git, it's only possible to add history without disturbing upstream work, by using replace objects. These need to be manually fetched, or need to be explicitly added to your git remote configuration.
Use:
`git fetch origin 'refs/replace/*:refs/replace/*'`
or add the following line to your configuration file
```
[remote "origin"]
url = ...
fetch = +refs/heads/*:refs/remotes/origin/*
...
fetch = +refs/replace/*:refs/replace/*
```
Then subsequent fetches will automatically update any replace objects.
## Community
Factor developers meet in the `#concatenative` channel on

View File

@ -105,7 +105,7 @@ $nl
ARTICLE: "c-types.primitives" "Primitive C types"
"The following numerical types are defined in the " { $vocab-link "alien.c-types" } " vocabulary; a " { $snippet "u" } " prefix denotes an unsigned type:"
{ $table
{ "C type" "Notes" }
{ { $strong "C type" } { $strong "Notes" } }
{ { $link char } "always 1 byte" }
{ { $link uchar } { } }
{ { $link short } "always 2 bytes" }

View File

@ -41,8 +41,8 @@ HELP: memory>byte-array
HELP: cast-array
{ $values { "byte-array" byte-array } { "c-type" "a C type" } { "array" "a specialized array" } }
{ $description "Converts a byte array into a specialized array by interpreting the bytes in as machine-specific values. Code which uses this word is unportable." }
{ $notes "The appropriate specialized array vocabulary must be loaded; otherwise, an error will be thrown. See the " { $vocab-link "specialized-arrays" } " vocabulary for details on the underlying sequence type constructed." }
{ $description "Converts a " { $link byte-array } " into a specialized array by interpreting the bytes in it as machine-specific values. Code using this word is unportable." }
{ $notes "The appropriate specialized array vocabulary must be loaded, otherwise an error will be thrown. See the " { $vocab-link "specialized-arrays" } " vocabulary for details on the underlying sequence type constructed." }
{ $errors "Throws an error if the type does not exist, the necessary specialized array vocabulary is not loaded, or the requested size is negative." } ;
HELP: malloc-array
@ -257,4 +257,4 @@ ARTICLE: "c-out-params" "Output parameters in C"
{ $code
"1234 { c-string } [ do_frob ] with-out-parameters"
}
"which would put the functions return value and error string on the stack." ;
"which would put the function's return value and error string on the stack." ;

View File

@ -1,5 +1,4 @@
USING: alien.libraries.finder sequences tools.test ;
IN: alien.libraries.finder.linux.tests
{ t } [ "libm.so" "m" find-library subseq? ] unit-test
{ t } [ "libc.so" "c" find-library subseq? ] unit-test

View File

@ -44,4 +44,4 @@ PRIVATE>
M: linux find-library*
"lib" prepend load-ldconfig-cache
[ ldconfig-matches? ] with find nip ?first ;
[ ldconfig-matches? ] with find nip ?last ;

View File

@ -1,9 +1,6 @@
USING: alien.libraries.finder
USING: alien.libraries.finder alien.libraries.finder.macosx
alien.libraries.finder.macosx.private sequences tools.test ;
IN: alien.libraries.finder.macosx
{
{
f

View File

@ -0,0 +1,3 @@
USING: alien.libraries.finder sequences tools.test ;
{ t } [ "kernel32.dll" "kernel32" find-library subseq? ] unit-test

View File

@ -1,8 +1,9 @@
USING: alien.libraries io.pathnames system windows.errors ;
USING: alien.libraries io.pathnames system windows.errors
windows.kernel32 ;
IN: alien.libraries.windows
M: windows >deployed-library-path
file-name ;
M: windows dlerror ( -- message )
win32-error-string ;
GetLastError n>win32-error-string ;

View File

@ -1 +1,2 @@
algorithms
collections

View File

@ -166,10 +166,10 @@ ERROR: not-enough-bits n bit-reader ;
bs bytes>> subseq endian> execute( seq -- x )
n bs subseq-endian execute( bignum n bs -- bits ) ;
M: lsb0-bit-reader peek ( n bs -- bits )
M: lsb0-bit-reader peek
\ le> \ subseq>bits-le (peek) ;
M: msb0-bit-reader peek ( n bs -- bits )
M: msb0-bit-reader peek
\ be> \ subseq>bits-be (peek) ;
:: bit-writer-bytes ( writer -- bytes )

View File

@ -46,7 +46,7 @@ HELP: sub-primitives
ARTICLE: "bootstrap.image" "Bootstrapping new images"
"A new image can be built from source; this is known as " { $emphasis "bootstrap" } ". Bootstrap is a two-step process. The first stage is the creation of a bootstrap image from a running Factor instance:"
{ $subsections make-image }
{ $subsections make-image make-my-image }
"The second bootstrapping stage is initiated by running the resulting bootstrap image:"
{ $code "./factor -i=boot.x86.32.image" }
"This stage loads additional code, compiles all words, and creates a final " { $snippet "factor.image" } "."

View File

@ -1,15 +1,15 @@
! Copyright (C) 2004, 2011 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs byte-arrays classes classes.builtin
classes.private classes.tuple classes.tuple.private combinators
combinators.short-circuit combinators.smart
compiler.codegen.relocation compiler.units fry generic
generic.single.private grouping hashtables hashtables.private io
io.binary io.encodings.binary io.files io.pathnames kernel
kernel.private layouts locals make math math.order namespaces
namespaces.private parser parser.notes prettyprint quotations
sequences sequences.private source-files strings system vectors
vocabs words ;
USING: accessors arrays assocs byte-arrays classes
classes.builtin classes.private classes.tuple
classes.tuple.private combinators combinators.short-circuit
combinators.smart command-line compiler.codegen.relocation
compiler.units fry generic generic.single.private grouping
hashtables hashtables.private io io.binary io.encodings.binary
io.files io.pathnames kernel kernel.private layouts locals make
math math.order namespaces namespaces.private parser
parser.notes prettyprint quotations sequences sequences.private
source-files strings system vectors vocabs words ;
IN: bootstrap.image
: arch-name ( os cpu -- arch )
@ -540,3 +540,8 @@ PRIVATE>
: make-my-image ( -- )
my-arch-name make-image ;
: make-image-main ( -- )
command-line get [ make-my-image ] [ [ make-image ] each ] if-empty ;
MAIN: make-image-main

View File

@ -778,8 +778,8 @@ CONSTANT: all-primitives {
{
"tools.profiler.sampling.private"
{
{ "profiling" ( n -- ) "sampling_profiler" { object } { } f }
{ "(get-samples)" ( -- samples/f ) "get_samples" { } { object } f }
{ "set-profiling" ( n -- ) "set_profiling" { object } { } f }
{ "get-samples" ( -- samples/f ) "get_samples" { } { object } f }
}
}
{

View File

@ -1,10 +1,10 @@
! Copyright (C) 2008 Slava Pestov.
! Copyright (C) 2015 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: bootstrap.image checksums checksums.openssl cli.git fry
io io.directories io.encodings.ascii io.encodings.utf8 io.files
USING: bootstrap.image checksums checksums.openssl fry io
io.directories io.encodings.ascii io.encodings.utf8 io.files
io.files.temp io.files.unique io.launcher io.pathnames kernel
make math.parser namespaces sequences splitting system ;
make math.parser namespaces sequences splitting system unicode ;
IN: bootstrap.image.upload
SYMBOL: upload-images-destination
@ -21,7 +21,11 @@ SYMBOL: build-images-destination
or ;
: factor-git-branch ( -- name )
image-path parent-directory git-current-branch ;
image-path parent-directory [
{ "git" "rev-parse" "--abbrev-ref" "HEAD" }
utf8 <process-reader> stream-contents
[ blank? ] trim-tail
] with-directory ;
: git-branch-destination ( -- dest )
build-images-destination get
@ -43,14 +47,7 @@ SYMBOL: build-images-destination
] each
] with-file-writer ;
! Windows scp doesn't like pathnames with colons, it treats them as hostnames.
! Workaround for uploading checksums.txt created with temp-file.
! e.g. C:\Users\\Doug\\AppData\\Local\\Temp/factorcode.org\\Factor/checksums.txt
! ssh: Could not resolve hostname c: no address associated with name
HOOK: scp-name os ( -- path )
M: object scp-name "scp" ;
M: windows scp-name "pscp" ;
: scp-name ( -- path ) "scp" ;
: upload-images ( -- )
[

View File

@ -38,9 +38,9 @@ M: cache-assoc dispose* clear-assoc ;
PRIVATE>
: purge-cache ( cache -- )
[ assoc>> ] [ max-age>> ] bi V{ } clone [
dup [ assoc>> ] [ max-age>> ] bi V{ } clone [
'[
nip dup age>> 1 + [ >>age ] keep
_ < [ drop t ] [ _ dispose-to f ] if
] assoc-filter! drop
] assoc-filter >>assoc drop
] keep [ last rethrow ] unless-empty ;

View File

@ -40,10 +40,10 @@ CONSTANT: day-counts { 0 31 28 31 30 31 30 31 31 30 31 30 31 }
GENERIC: leap-year? ( obj -- ? )
M: integer leap-year? ( year -- ? )
M: integer leap-year?
dup 100 divisor? 400 4 ? divisor? ;
M: timestamp leap-year? ( timestamp -- ? )
M: timestamp leap-year?
year>> leap-year? ;
: (days-in-month) ( year month -- n )
@ -121,10 +121,10 @@ GENERIC: easter ( obj -- obj' )
h l + 7 m * - 114 + 31 /mod 1 + ;
M: integer easter ( year -- timestamp )
M: integer easter
dup easter-month-day <date> ;
M: timestamp easter ( timestamp -- timestamp )
M: timestamp easter
clone
dup year>> easter-month-day
swapd >>day swap >>month ;
@ -167,52 +167,52 @@ GENERIC: +second ( timestamp x -- timestamp )
{ [ day>> 29 = ] [ month>> 2 = ] [ leap-year? not ] } 1&&
[ 3 >>month 1 >>day ] when ;
M: integer +year ( timestamp n -- timestamp )
M: integer +year
[ + ] curry change-year adjust-leap-year ;
M: real +year ( timestamp n -- timestamp )
M: real +year
[ float>whole-part swapd days-per-year * +day swap +year ] unless-zero ;
: months/years ( n -- months years )
12 /rem [ 1 - 12 ] when-zero swap ; inline
M: integer +month ( timestamp n -- timestamp )
M: integer +month
[ over month>> + months/years [ >>month ] dip +year ] unless-zero ;
M: real +month ( timestamp n -- timestamp )
M: real +month
[ float>whole-part swapd average-month * +day swap +month ] unless-zero ;
M: integer +day ( timestamp n -- timestamp )
M: integer +day
[
over >date< julian-day-number + julian-day-number>date
[ >>year ] [ >>month ] [ >>day ] tri*
] unless-zero ;
M: real +day ( timestamp n -- timestamp )
M: real +day
[ float>whole-part swapd 24 * +hour swap +day ] unless-zero ;
: hours/days ( n -- hours days )
24 /rem swap ;
M: integer +hour ( timestamp n -- timestamp )
M: integer +hour
[ over hour>> + hours/days [ >>hour ] dip +day ] unless-zero ;
M: real +hour ( timestamp n -- timestamp )
M: real +hour
float>whole-part swapd 60 * +minute swap +hour ;
: minutes/hours ( n -- minutes hours )
60 /rem swap ;
M: integer +minute ( timestamp n -- timestamp )
M: integer +minute
[ over minute>> + minutes/hours [ >>minute ] dip +hour ] unless-zero ;
M: real +minute ( timestamp n -- timestamp )
M: real +minute
[ float>whole-part swapd 60 * +second swap +minute ] unless-zero ;
: seconds/minutes ( n -- seconds minutes )
60 /rem swap >integer ;
M: number +second ( timestamp n -- timestamp )
M: number +second
[ over second>> + seconds/minutes [ >>second ] dip +minute ] unless-zero ;
: (time+) ( timestamp duration -- timestamp' duration )
@ -291,8 +291,7 @@ GENERIC: time- ( time1 time2 -- time3 )
[ neg +year 0 ] change-year drop
] if ;
M: timestamp <=> ( ts1 ts2 -- n )
[ >gmt tuple-slots ] compare ;
M: timestamp <=> [ >gmt tuple-slots ] compare ;
: same-day? ( ts1 ts2 -- ? )
[ >gmt >date< <date> ] same? ;
@ -376,8 +375,9 @@ M: duration time-
GENERIC: days-in-year ( obj -- n )
M: integer days-in-year ( year -- n ) leap-year? 366 365 ? ;
M: timestamp days-in-year ( timestamp -- n ) year>> days-in-year ;
M: integer days-in-year leap-year? 366 365 ? ;
M: timestamp days-in-year year>> days-in-year ;
: days-in-month ( timestamp -- n )
>date< drop (days-in-month) ;

View File

@ -52,15 +52,15 @@ MACRO: formatted ( spec -- quot )
GENERIC: day. ( obj -- )
M: integer day. ( n -- )
M: integer day.
number>string dup length 2 < [ bl ] when write ;
M: timestamp day. ( timestamp -- )
M: timestamp day.
day>> day. ;
GENERIC: month. ( obj -- )
M: array month. ( pair -- )
M: array month.
first2
[ month-name write bl number>string print ]
[ 1 zeller-congruence ]
@ -71,15 +71,15 @@ M: array month. ( pair -- )
1 + + 7 mod zero? [ nl ] [ bl ] if
] with each-integer nl ;
M: timestamp month. ( timestamp -- )
M: timestamp month.
[ year>> ] [ month>> ] bi 2array month. ;
GENERIC: year. ( obj -- )
M: integer year. ( n -- )
M: integer year.
12 [ 1 + 2array month. nl ] with each-integer ;
M: timestamp year. ( timestamp -- )
M: timestamp year.
year>> year. ;
: timestamp>mdtm ( timestamp -- str )

View File

@ -0,0 +1 @@
time

View File

@ -31,7 +31,7 @@ IN: calendar.unix
: timezone-name ( -- string )
get-time zone>> ;
M: unix gmt-offset ( -- hours minutes seconds )
M: unix gmt-offset
get-time gmtoff>> 3600 /mod 60 /mod ;
: current-timeval ( -- timeval )

View File

@ -28,10 +28,10 @@ IN: calendar.windows
[ [ wSecond>> ] [ wMilliseconds>> 1000 / ] bi + ]
} cleave instant <timestamp> ;
M: windows gmt-offset ( -- hours minutes seconds )
M: windows gmt-offset
TIME_ZONE_INFORMATION <struct>
dup GetTimeZoneInformation {
{ TIME_ZONE_ID_INVALID [ win32-error-string throw ] }
{ TIME_ZONE_ID_INVALID [ win32-error ] }
{ TIME_ZONE_ID_UNKNOWN [ Bias>> ] }
{ TIME_ZONE_ID_STANDARD [ Bias>> ] }
{ TIME_ZONE_ID_DAYLIGHT [ [ Bias>> ] [ DaylightBias>> ] bi + ] }

View File

@ -31,11 +31,11 @@ GENERIC: from ( channel -- value )
PRIVATE>
M: channel to ( value channel -- )
M: channel to
dup receivers>>
[ dup wait to ] [ nip (to) ] if-empty ;
M: channel from ( channel -- value )
M: channel from
[ self ] dip
notify senders>>
[ (from) ] unless-empty

View File

@ -60,10 +60,10 @@ C: <remote-channel> remote-channel
PRIVATE>
M: remote-channel to ( value remote-channel -- )
M: remote-channel to
[ id>> swap to-message boa ] keep send-message drop ;
M: remote-channel from ( remote-channel -- value )
M: remote-channel from
[ id>> from-message boa ] keep send-message ;
[

View File

@ -8,10 +8,10 @@ SINGLETON: adler-32
CONSTANT: adler-32-modulus 65521
M: adler-32 checksum-bytes ( bytes checksum -- value )
M: adler-32 checksum-bytes
drop
[ sum 1 + ]
[ [ dup length [1,b] <reversed> v. ] [ length ] bi + ] bi
[ [ dup length [1,b] <reversed> vdot ] [ length ] bi + ] bi
[ adler-32-modulus mod ] bi@ 16 shift bitor ;
INSTANCE: adler-32 checksum

View File

@ -5,7 +5,7 @@ IN: checksums.bsd
SINGLETON: bsd
M: bsd checksum-bytes ( bytes checksum -- value )
M: bsd checksum-bytes
drop 0 [
[ [ -1 shift ] [ 1 bitand 15 shift ] bi + ] dip
+ 0xffff bitand

View File

@ -38,67 +38,67 @@ CONSTANT: fnv1-256-basis 0xdd268dbcaac550362d98c384c4e576ccc8b1536847b6bbb31023b
CONSTANT: fnv1-512-basis 0xb86db0b1171f4416dca1e50f309990acac87d059c90000000000000000000d21e948f68a34c192f62ea79bc942dbe7ce182036415f56e34bac982aac4afe9fd9
CONSTANT: fnv1-1024-basis 0x5f7a76758ecc4d32e56d5a591028b74b29fc4223fdada16c3bf34eda3674da9a21d9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004c6d7eb6e73802734510a555f256cc005ae556bde8cc9c6a93b21aff4b16c71ee90b3
M: fnv1-32 checksum-bytes ( bytes checksum -- value )
M: fnv1-32 checksum-bytes
drop
fnv1-32-basis swap
[ swap fnv1-32-prime * bitxor fnv1-32-mod bitand ] each ;
M: fnv1a-32 checksum-bytes ( bytes checksum -- value )
M: fnv1a-32 checksum-bytes
drop
fnv1-32-basis swap
[ bitxor fnv1-32-prime * fnv1-32-mod bitand ] each ;
M: fnv1-64 checksum-bytes ( bytes checksum -- value )
M: fnv1-64 checksum-bytes
drop
fnv1-64-basis swap
[ swap fnv1-64-prime * bitxor fnv1-64-mod bitand ] each ;
M: fnv1a-64 checksum-bytes ( bytes checksum -- value )
M: fnv1a-64 checksum-bytes
drop
fnv1-64-basis swap
[ bitxor fnv1-64-prime * fnv1-64-mod bitand ] each ;
M: fnv1-128 checksum-bytes ( bytes checksum -- value )
M: fnv1-128 checksum-bytes
drop
fnv1-128-basis swap
[ swap fnv1-128-prime * bitxor fnv1-128-mod bitand ] each ;
M: fnv1a-128 checksum-bytes ( bytes checksum -- value )
M: fnv1a-128 checksum-bytes
drop
fnv1-128-basis swap
[ bitxor fnv1-128-prime * fnv1-128-mod bitand ] each ;
M: fnv1-256 checksum-bytes ( bytes checksum -- value )
M: fnv1-256 checksum-bytes
drop
fnv1-256-basis swap
[ swap fnv1-256-prime * bitxor fnv1-256-mod bitand ] each ;
M: fnv1a-256 checksum-bytes ( bytes checksum -- value )
M: fnv1a-256 checksum-bytes
drop
fnv1-256-basis swap
[ bitxor fnv1-256-prime * fnv1-256-mod bitand ] each ;
M: fnv1-512 checksum-bytes ( bytes checksum -- value )
M: fnv1-512 checksum-bytes
drop
fnv1-512-basis swap
[ swap fnv1-512-prime * bitxor fnv1-512-mod bitand ] each ;
M: fnv1a-512 checksum-bytes ( bytes checksum -- value )
M: fnv1a-512 checksum-bytes
drop
fnv1-512-basis swap
[ bitxor fnv1-512-prime * fnv1-512-mod bitand ] each ;
M: fnv1-1024 checksum-bytes ( bytes checksum -- value )
M: fnv1-1024 checksum-bytes
drop
fnv1-1024-basis swap
[ swap fnv1-1024-prime * bitxor fnv1-1024-mod bitand ] each ;
M: fnv1a-1024 checksum-bytes ( bytes checksum -- value )
M: fnv1a-1024 checksum-bytes
drop
fnv1-1024-basis swap
[ bitxor fnv1-1024-prime * fnv1-1024-mod bitand ] each ;

View File

@ -47,7 +47,7 @@ CONSTANT: n 0xe6546b64
PRIVATE>
M: murmur3-32 checksum-bytes ( bytes checksum -- value )
M: murmur3-32 checksum-bytes
seed>> 32 bits main-loop end-case avalanche ;
INSTANCE: murmur3-32 checksum

View File

@ -38,13 +38,13 @@ M: evp-md-context dispose*
: set-digest ( name ctx -- )
handle>> swap digest-named f EVP_DigestInit_ex ssl-error ;
M: openssl-checksum initialize-checksum-state ( checksum -- evp-md-context )
M: openssl-checksum initialize-checksum-state
maybe-init-ssl name>> <evp-md-context> [ set-digest ] keep ;
M: evp-md-context add-checksum-bytes ( ctx bytes -- ctx' )
M: evp-md-context add-checksum-bytes
[ dup handle>> ] dip dup length EVP_DigestUpdate ssl-error ;
M: evp-md-context get-checksum ( ctx -- value )
M: evp-md-context get-checksum
handle>>
{ { int EVP_MAX_MD_SIZE } int }
[ EVP_DigestFinal_ex ssl-error ] with-out-parameters

View File

@ -116,7 +116,7 @@ M: struct-mirror delete-at
M: struct-mirror clear-assoc
object>> reset-struct-slots ;
M: struct-mirror >alist ( mirror -- alist )
M: struct-mirror >alist
object>> [
[ drop "underlying" ] [ >c-ptr ] bi 2array 1array
] [

View File

@ -0,0 +1 @@
colors

View File

@ -0,0 +1 @@
colors

View File

@ -7,7 +7,7 @@ TUPLE: gray < color { gray read-only } { alpha read-only } ;
C: <gray> gray
M: gray >rgba ( gray -- rgba )
M: gray >rgba
[ gray>> dup dup ] [ alpha>> ] bi <rgba> ; inline
M: gray red>> gray>> ;

View File

@ -0,0 +1 @@
colors

View File

@ -6,12 +6,15 @@ lexer math math.parser sequences ;
IN: colors.hex
ERROR: invalid-hex-color hex ;
: hex>rgba ( hex -- rgba )
dup length {
{ 6 [ 2 group [ hex> 255 /f ] map first3 1.0 ] }
{ 8 [ 2 group [ hex> 255 /f ] map first4 ] }
{ 3 [ [ digit> 15 /f ] { } map-as first3 1.0 ] }
{ 4 [ [ digit> 15 /f ] { } map-as first4 ] }
[ drop invalid-hex-color ]
} case <rgba> ;
: rgba>hex ( rgba -- hex )

View File

@ -0,0 +1 @@
colors

View File

@ -0,0 +1 @@
colors

View File

@ -29,7 +29,7 @@ C: <hsva> hsva
PRIVATE>
M: hsva >rgba ( hsva -- rgba )
M: hsva >rgba
[
dup Hi
{

View File

@ -0,0 +1 @@
colors

View File

@ -0,0 +1 @@
colors

View File

@ -0,0 +1 @@
colors

View File

@ -0,0 +1 @@
colors

View File

@ -0,0 +1 @@
colors

View File

@ -61,7 +61,7 @@ C: <ryba> ryba
PRIVATE>
M: ryba >rgba ( ryba -- rgba )
M: ryba >rgba
[
[ red>> ] [ yellow>> ] [ blue>> ] tri
[ ryb>rgb ] normalized

View File

@ -0,0 +1 @@
colors

1
basis/colors/tags.txt Normal file
View File

@ -0,0 +1 @@
colors

View File

@ -0,0 +1 @@
colors

View File

@ -0,0 +1 @@
colors

View File

@ -0,0 +1 @@
colors

View File

@ -0,0 +1 @@
colors

View File

@ -1,11 +1,11 @@
USING: help.markup help.syntax strings system vocabs vocabs.loader ;
USING: help.markup help.syntax io.pathnames strings system vocabs vocabs.loader ;
IN: command-line
HELP: run-bootstrap-init
{ $description "Runs the bootstrap initialization file in the user's home directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-boot-rc" } "." } ;
{ $description "Runs the bootstrap initialization file in the user's " { $link home } " directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-boot-rc" } "." } ;
HELP: run-user-init
{ $description "Runs the startup initialization file in the user's home directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-rc" } "." } ;
{ $description "Runs the startup initialization file in the user's " { $link home } " directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-rc" } "." } ;
HELP: load-vocab-roots
{ $description "Loads the newline-separated list of additional vocabulary roots from the file named " { $snippet ".factor-roots" } "." } ;
@ -117,7 +117,7 @@ $nl
{ $subsections load-vocab-roots } ;
ARTICLE: "rc-files" "Running code on startup"
"Factor looks for three optional files in your home directory."
"Factor looks for three optional files in the user's " { $link home } " directory."
{ $subsections
".factor-boot-rc"
".factor-rc"
@ -125,12 +125,6 @@ ARTICLE: "rc-files" "Running code on startup"
}
"The " { $snippet "-no-user-init" } " command line switch will inhibit loading running of these files."
$nl
"If you are unsure where the files should be located, evaluate the following code:"
{ $code
"USE: command-line"
"\".factor-rc\" rc-path print"
"\".factor-boot-rc\" rc-path print"
}
"Here is an example " { $snippet ".factor-boot-rc" } " which sets up your developer name:"
{ $code
"USING: tools.scaffold namespaces ;"
@ -139,8 +133,8 @@ $nl
ARTICLE: "command-line" "Command line arguments"
"Factor command line usage:"
{ $code "factor [VM args...] [script] [args...]" }
"Zero or more VM arguments can be passed in, followed by an optional script file name. If the script file is specified, it will be run on startup using " { $link run-script } ". Any arguments after the script file are stored in the following variable, with no further processing by Factor itself:"
{ $code "factor [options] [script] [arguments]" }
"Zero or more options can be passed in, followed by an optional script file name. If the script file is specified, it will be run on startup using " { $link run-script } ". Any arguments after the script file are stored in the following variable, with no further processing by Factor itself:"
{ $subsections command-line }
"Instead of running a script, it is also possible to run a vocabulary; this invokes the vocabulary's " { $link POSTPONE: MAIN: } " word:"
{ $code "factor [system switches...] -run=<vocab name>" }

View File

@ -24,9 +24,6 @@ SYMBOL: command-line
: (command-line) ( -- args )
OBJ-ARGS special-object sift [ alien>native-string ] map ;
: rc-path ( name -- path )
home prepend-path ;
: try-user-init ( file -- )
"user-init" get swap '[
_ [ ?run-file ] [
@ -37,14 +34,14 @@ SYMBOL: command-line
] when ;
: run-bootstrap-init ( -- )
".factor-boot-rc" rc-path try-user-init ;
"~/.factor-boot-rc" try-user-init ;
: run-user-init ( -- )
".factor-rc" rc-path try-user-init ;
"~/.factor-rc" try-user-init ;
: load-vocab-roots ( -- )
"user-init" get [
".factor-roots" rc-path dup exists? [
"~/.factor-roots" dup exists? [
utf8 file-lines harvest [ add-vocab-root ] each
] [ drop ] if
"roots" get [

View File

@ -1,7 +1,7 @@
! Copyright (C) 2011 Joe Groff.
! See http://factorcode.org/license.txt for BSD license.
USING: combinators command-line eval io io.pathnames kernel
namespaces system vocabs.loader ;
layouts math math.parser namespaces system vocabs.loader ;
IN: command-line.startup
: help? ( -- ? )
@ -9,35 +9,33 @@ IN: command-line.startup
os windows? [ script get "/?" = or ] when ;
: help. ( -- )
"Usage: " write vm-path file-name write " [Factor arguments] [script] [script arguments]
"Usage: " write vm-path file-name write " [options] [script] [arguments]
Factor arguments:
Options:
-help print this message and exit
-version print the Factor version and exit
-i=<image> load Factor image file <image> (default " write vm-path file-stem write ".image)
-i=<image> load Factor image file <image> [" write vm-path file-stem write ".image]
-run=<vocab> run the MAIN: entry point of <vocab>
-run=listener run terminal listener
-run=ui.tools run Factor development UI
-e=<code> evaluate <code>
-no-user-init suppress loading of .factor-rc
-datastack=<int> datastack size in KiB
-retainstack=<int> retainstack size in KiB
-callstack=<int> callstack size in KiB
-callbacks=<int> callback heap size in KiB
-young=<int> young gc generation 0 size in MiB
-aging=<int> aging gc generation 1 size in MiB
-tenured=<int> tenured gc generation 2 size in MiB
-codeheap=<int> codeheap size in MiB
-pic=<int> max pic size
-datastack=<int> datastack size in KiB [" write cell 32 * number>string write "]
-retainstack=<int> retainstack size in KiB [" write cell 32 * number>string write "]
-callstack=<int> callstack size in KiB [" write cell cpu ppc? 256 128 ? * number>string write "]
-callbacks=<int> callback heap size in KiB [256]
-young=<int> young gc generation 0 size in MiB [" write cell 4 / number>string write "]
-aging=<int> aging gc generation 1 size in MiB [" write cell 2 / number>string write "]
-tenured=<int> tenured gc generation 2 size in MiB [" write cell 24 * number>string write "]
-codeheap=<int> codeheap size in MiB [64]
-pic=<int> max pic size [3]
-fep enter fep mode immediately
-no-signals turn off OS signal handling
-console open console if possible
-roots=<paths> a list of \"" write os windows? ";" ":" ? write "\"-delimited extra vocab roots
-roots=<paths> '" write os windows? ";" ":" ? write "'-separated list of extra vocab root directories
Enter
\"command-line\" help
from within Factor for more information.
" write ;
: version? ( -- ? ) "version" get ;

View File

@ -15,6 +15,8 @@ IN: compiler.cfg.builder.alien
0 stack-params set
V{ } clone reg-values set
V{ } clone stack-values set
0 int-reg-reps set
0 float-reg-reps set
@
reg-values get
stack-values get
@ -93,7 +95,7 @@ IN: compiler.cfg.builder.alien
[ stack-params get [ caller-stack-cleanup ] keep ]
} cleave ;
M: #alien-invoke emit-node ( block node -- block' )
M: #alien-invoke emit-node
params>>
[
[ params>alien-insn-params ]
@ -102,7 +104,7 @@ M: #alien-invoke emit-node ( block node -- block' )
]
[ caller-return ] bi ;
M: #alien-indirect emit-node ( block node -- block' )
M: #alien-indirect emit-node
params>>
[
[ ds-pop ^^unbox-any-c-ptr ] dip
@ -111,7 +113,7 @@ M: #alien-indirect emit-node ( block node -- block' )
]
[ caller-return ] bi ;
M: #alien-assembly emit-node ( block node -- block' )
M: #alien-assembly emit-node
params>>
[
[ params>alien-insn-params ]
@ -165,7 +167,7 @@ M: #alien-assembly emit-node ( block node -- block' )
: emit-callback-outputs ( block params -- )
[ emit-callback-return ] keep callback-stack-cleanup ;
M: #alien-callback emit-node ( block node -- block' )
M: #alien-callback emit-node
dup params>> xt>> dup
[
t cfg get frame-pointer?<<

View File

@ -10,19 +10,30 @@ IN: compiler.cfg.builder.alien.boxing
SYMBOL: struct-return-area
SYMBOLS: int-reg-reps float-reg-reps ;
: reg-reps ( reps -- int-reps float-reps )
[ second ] reject [ [ first int-rep? ] count ] [ length over - ] bi ;
: record-reg-reps ( reps -- reps )
dup reg-reps [ int-reg-reps +@ ] [ float-reg-reps +@ ] bi* ;
: unrecord-reg-reps ( reps -- reps )
dup reg-reps [ neg int-reg-reps +@ ] [ neg float-reg-reps +@ ] bi* ;
GENERIC: flatten-c-type ( c-type -- pairs )
M: c-type flatten-c-type
rep>> f f 3array 1array ;
rep>> f f 3array 1array record-reg-reps ;
M: long-long-type flatten-c-type
drop 2 [ int-rep long-long-on-stack? f 3array ] replicate ;
drop 2 [ int-rep long-long-on-stack? f 3array ] replicate record-reg-reps ;
HOOK: flatten-struct-type cpu ( type -- pairs )
HOOK: flatten-struct-type-return cpu ( type -- pairs )
M: object flatten-struct-type
heap-size cell align cell /i { int-rep f f } <array> ;
heap-size cell align cell /i { int-rep f f } <array> record-reg-reps ;
M: struct-c-type flatten-c-type
flatten-struct-type ;
@ -70,14 +81,14 @@ M: c-type unbox
[ swap ^^unbox ]
} case 1array
]
[ drop f f 3array 1array ] 2bi ;
[ drop f f 3array 1array ] 2bi record-reg-reps ;
M: long-long-type unbox
[ next-vreg next-vreg 2dup ] 2dip unboxer>> ##unbox-long-long, 2array
int-rep long-long-on-stack? long-long-odd-register? 3array
int-rep long-long-on-stack? f 3array 2array ;
int-rep long-long-on-stack? f 3array 2array record-reg-reps ;
M: struct-c-type unbox ( src c-type -- vregs reps )
M: struct-c-type unbox
[ ^^unbox-any-c-ptr ] dip explode-struct ;
: frob-struct ( c-type -- c-type )

View File

@ -8,11 +8,11 @@ SYMBOL: stack-params
GENERIC: alloc-stack-param ( rep -- n )
M: object alloc-stack-param ( rep -- n )
M: object alloc-stack-param
stack-params get
[ rep-size cell align stack-params +@ ] dip ;
M: float-rep alloc-stack-param ( rep -- n )
M: float-rep alloc-stack-param
stack-params get swap rep-size
[ cell align stack-params +@ ] keep
float-right-align-on-stack? [ + ] [ drop ] if ;

View File

@ -71,7 +71,7 @@ GENERIC: emit-node ( block node -- block' )
##branch, [ begin-basic-block ] dip
[ label>> id>> loops get set-at ] [ child>> emit-nodes ] 2bi ;
M: #recursive emit-node ( block node -- block' )
M: #recursive emit-node
dup label>> loop?>> [ emit-loop ] [ emit-recursive ] if ;
! #if
@ -109,28 +109,28 @@ M: #recursive emit-node ( block node -- block' )
! loc>vreg sync
ds-pop any-rep ^^copy f cc/= ##compare-imm-branch, emit-if ;
M: #if emit-node ( block node -- block' )
M: #if emit-node
{
{ [ dup trivial-if? ] [ drop emit-trivial-if ] }
{ [ dup trivial-not-if? ] [ drop emit-trivial-not-if ] }
[ emit-actual-if ]
} cond ;
M: #dispatch emit-node ( block node -- block' )
M: #dispatch emit-node
! Inputs to the final instruction need to be copied because of
! loc>vreg sync. ^^offset>slot always returns a fresh vreg,
! though.
ds-pop ^^offset>slot next-vreg ##dispatch, emit-if ;
M: #call emit-node ( block node -- block' )
M: #call emit-node
dup word>> dup "intrinsic" word-prop [
nip call( block #call -- block' )
] [ swap call-height emit-call ] if* ;
M: #call-recursive emit-node ( block node -- block' )
M: #call-recursive emit-node
[ label>> id>> ] [ call-height ] bi emit-call ;
M: #push emit-node ( block node -- block )
M: #push emit-node
literal>> ^^load-literal ds-push ;
! #shuffle
@ -157,7 +157,7 @@ M: #push emit-node ( block node -- block )
[ make-input-map ] [ mapping>> ] [ extract-outputs ] tri
[ [ of of peek-loc ] 2with map ] 2with map ;
M: #shuffle emit-node ( block node -- block )
M: #shuffle emit-node
[ out-vregs/stack ] keep store-height-changes
first2 [ ds-loc store-vregs ] [ rs-loc store-vregs ] bi* ;
@ -167,14 +167,14 @@ M: #shuffle emit-node ( block node -- block )
t >>kill-block?
##safepoint, ##epilogue, ##return, ;
M: #return emit-node ( block node -- block' )
M: #return emit-node
drop end-word ;
M: #return-recursive emit-node ( block node -- block' )
M: #return-recursive emit-node
label>> id>> loops get key? [ ] [ end-word ] if ;
! #terminate
M: #terminate emit-node ( block node -- block' )
M: #terminate emit-node
drop ##no-tco, end-basic-block f ;
! No-op nodes

View File

@ -7,41 +7,41 @@ IN: compiler.cfg
HELP: basic-block
{ $class-description
"Factors representation of a basic block in the Call Flow Graph (CFG). A basic block is a sequence of instructions that always are executed sequentially and doesn't contain any internal branching. It has the following slots:"
{ $table
{ $slots
{
{ $slot "number" }
"number"
{ "The blocks sequence number. Generated by calling " { $link number-blocks } "." }
}
{
{ $slot "successors" }
"successors"
{ "A " { $link vector } " of basic blocks that may be executed directly after this block. Most blocks only have one successor but a block that checks where an if-condition should branch to would have two for example." }
}
{
{ $slot "predecessors" }
"predecessors"
{ "The opposite of successors -- a " { $link vector } " of basic blocks from which the execution may have arrived into this block." }
}
{
{ $slot "instructions" }
"instructions"
{ "A " { $link vector } " of " { $link insn } " tuples which form the instructions of the basic block." }
}
{
{ $slot "kill-block?" }
"kill-block?"
{ "The first and the last block in a cfg and all blocks containing " { $link ##call } " instructions are kill blocks. Kill blocks can't be optimized so they are omitted from certain optimization steps." }
}
{
{ $slot "height" }
"height"
"Block's height as a " { $link height-state } ". What the heights of the block was at entry and how much they were increased in the block."
}
{
{ $slot "replaces" }
"replaces"
{ "Used by " { $vocab-link "compiler.cfg.stacks.local" } " for local stack analysis." }
}
{
{ $slot "peeks" }
"peeks"
{ "Used by " { $vocab-link "compiler.cfg.stacks.local" } " for local stack analysis." }
}
{
{ $slot "kills" }
"kills"
{ "Used by " { $vocab-link "compiler.cfg.stacks.local" } " for local stack analysis." }
}
}
@ -60,12 +60,12 @@ HELP: <cfg>
HELP: cfg
{ $class-description
"Call flow graph. It has the following slots:"
{ $table
{ { $slot "entry" } { "Root " { $link basic-block } " of the graph." } }
{ { $slot "word" } { "The " { $link word } " the cfg is produced from." } }
{ { $slot "post-order" } { "The blocks of the cfg in a post order traversal " { $link sequence } "." } }
{ { $slot "stack-frame" } { { $link stack-frame } " of the cfg." } }
{ { $slot "frame-pointer?" } { "Whether the cfg needs a frame pointer. Only cfgs generated for " { $link #alien-callback } " nodes does need it. If the slot is " { $link t } ", then the frame pointer register (" { $link RBP } " on x86.64 archs) will not be clobbered by register allocation. See " { $vocab-link "compiler.cfg.linear-scan" } " for details." } }
{ $slots
{ "entry" { "Root " { $link basic-block } " of the graph." } }
{ "word" { "The " { $link word } " the cfg is produced from." } }
{ "post-order" { "The blocks of the cfg in a post order traversal " { $link sequence } "." } }
{ "stack-frame" { { $link stack-frame } " of the cfg." } }
{ "frame-pointer?" { "Whether the cfg needs a frame pointer. Only cfgs generated for " { $link #alien-callback } " nodes does need it. If the slot is " { $link t } ", then the frame pointer register (" { $link RBP } " on x86.64 archs) will not be clobbered by register allocation. See " { $vocab-link "compiler.cfg.linear-scan" } " for details." } }
}
}
{ $see-also <cfg> post-order } ;

View File

@ -9,27 +9,27 @@ IN: compiler.cfg.instructions
HELP: ##alien-invoke
{ $class-description
"An instruction for calling a function in a dynamically linked library. It has the following slots:"
{ $table
{ $slots
{
{ $slot "dead-outputs" }
"dead-outputs"
{ "A sequence of return values from the function that the compiler.cfg.dce pass has figured out are not used." }
}
{
{ $slot "reg-inputs" }
"reg-inputs"
{ "Registers to use for the arguments to the function call. Each sequence item is a 3-tuple consisting of a " { $link spill-slot } ", register representation and a register. When the function is called, the parameter is copied from the spill slot to the given register." }
}
{
{ $slot "stack-inputs" }
"stack-inputs"
{ "Stack slots used for the arguments to the function call." }
}
{
{ $slot "reg-outputs" }
"reg-outputs"
{ "If the called function returns a value, then this slot is a one-element sequence containing a 3-tuple describing which register is used for the return value." }
}
{ { $slot "symbols" } { "Name of the function to call." } }
{ { $slot "dll" } { "A dll handle or " { $link f } "." } }
{ "symbols" { "Name of the function to call." } }
{ "dll" { "A dll handle or " { $link f } "." } }
{
{ $slot "gc-map" }
"gc-map"
{
"If the invoked C function calls Factor code which triggers a GC, then a "
{ $link gc-map }
@ -44,9 +44,9 @@ HELP: ##alien-invoke
HELP: ##alien-indirect
{ $class-description
"An instruction representing an indirect alien call. The first item on the datastack is a pointer to the function to call and the parameters follows. It has the following slots:"
{ $table
{ { $slot "src" } { "Spill slot containing the function pointer." } }
{ { $slot "reg-outputs" } { "Sequence of output values passed in registers." } }
{ $slots
{ "src" { "Spill slot containing the function pointer." } }
{ "reg-outputs" { "Sequence of output values passed in registers." } }
}
}
{ $see-also alien-indirect %alien-indirect } ;
@ -54,11 +54,11 @@ HELP: ##alien-indirect
HELP: ##allot
{ $class-description
"An instruction for allocating memory in the nursery. Usually the instruction is preceded by " { $link ##check-nursery-branch } " which checks that there is enough room in the nursery to allocate. It has the following slots:"
{ $table
{ { $slot "dst" } { "Register to put the pointer to the memory in." } }
{ { $slot "size" } { "Number of bytes to allocate." } }
{ { $slot "class-of" } { "Class of object to allocate, e.g " { $link tuple } " or " { $link array } "." } }
{ { $slot "temp" } { "Temporary register to clobber." } }
{ $slots
{ "dst" { "Register to put the pointer to the memory in." } }
{ "size" { "Number of bytes to allocate." } }
{ "class-of" { "Class of object to allocate, e.g " { $link tuple } " or " { $link array } "." } }
{ "temp" { "Temporary register to clobber." } }
}
} ;
@ -79,8 +79,8 @@ HELP: ##box-alien
HELP: ##call
{ $class-description
"An instruction for calling a Factor word."
{ $table
{ { $slot "word" } { "The word called." } }
{ $slots
{ "word" { "The word called." } }
}
} ;
@ -89,11 +89,11 @@ HELP: ##check-nursery-branch
"Instruction that inserts a conditional branch to a " { $link basic-block } " that garbage collects the nursery. The " { $vocab-link "compiler.cfg.gc-checks" } " vocab goes through each block in the " { $link cfg } " and checks if it allocates memory. If it does, then this instruction is inserted in the cfg before that block and checks if there is enough available space in the nursery. If it isn't, then a basic block containing code for garbage collecting the nursery is executed."
$nl
"It has the following slots:"
{ $table
{ { $slot "size" } { "Number of bytes the next block in the cfg will allocate." } }
{ { $slot "cc" } { "A comparison symbol." } }
{ { $slot "temp1" } { "First register that will be clobbered." } }
{ { $slot "temp2" } { "Second register that will be clobbered." } }
{ $slots
{ "size" { "Number of bytes the next block in the cfg will allocate." } }
{ "cc" { "A comparison symbol." } }
{ "temp1" { "First register that will be clobbered." } }
{ "temp2" { "Second register that will be clobbered." } }
}
}
{ $see-also %check-nursery-branch } ;
@ -101,8 +101,8 @@ HELP: ##check-nursery-branch
HELP: ##compare-float-ordered-branch
{ $class-description
"It has the following slots:"
{ $table
{ { $slot "cc" } { "Comparison symbol." } }
{ $slots
{ "cc" { "Comparison symbol." } }
}
} ;
@ -119,8 +119,8 @@ HELP: ##compare-integer
HELP: ##copy
{ $class-description "Instruction that copies a value from one register to another of the same type. For example, you can copy between two gprs or two simd registers but not across. It has the following slots:"
{ $table
{ { $slot "rep" } { "Value representation. Both the source and destination register must have the same representation." } }
{ $slots
{ "rep" { "Value representation. Both the source and destination register must have the same representation." } }
}
} ;
@ -139,8 +139,8 @@ HELP: ##inc
HELP: ##jump
{ $class-description
"An uncondiation jump instruction. It has the following slots:"
{ $table
{ { $slot "word" } { "Word whose address the instruction is jumping to." } }
{ $slots
{ "word" { "Word whose address the instruction is jumping to." } }
}
"Note that the optimizer is sometimes able to optimize away a " { $link ##call } " and " { $link ##return } " pair into one ##jump instruction."
} ;
@ -156,9 +156,9 @@ HELP: ##load-memory-imm
HELP: ##load-reference
{ $class-description
"An instruction for loading a pointer to an object into a register. It has the following slots:"
{ $table
{ { $slot "dst" } { "Register to load the pointer into." } }
{ { $slot "obj" } { "A Factor object." } }
{ $slots
{ "dst" { "Register to load the pointer into." } }
{ "obj" { "A Factor object." } }
}
} ;
@ -174,10 +174,10 @@ HELP: ##load-vector
HELP: ##local-allot
{ $class-description
"An instruction for allocating memory in the words own stack frame. It's mostly used for receiving data from alien calls. It has the following slots:"
{ $table
{ { $slot "dst" } { "Register into which a pointer to the stack allocated memory is put." } }
{ { $slot "size" } { "Number of bytes to allocate." } }
{ { $slot "offset" } { } }
{ $slots
{ "dst" { "Register into which a pointer to the stack allocated memory is put." } }
{ "size" { "Number of bytes to allocate." } }
{ "offset" { } }
}
}
{ $see-also ##allot } ;
@ -191,8 +191,8 @@ HELP: ##no-tco
HELP: ##parallel-copy
{ $class-description "An instruction for performing multiple copies. It allows for optimizations or (or prunings) if more than one source or destination vreg is the same. They are transformed into " { $link ##copy } " instructions in " { $link destruct-ssa } ". It has the following slots:"
{ $table
{ { $slot "values" } { "An assoc mapping source vregs to destinations." } }
{ $slots
{ "values" { "An assoc mapping source vregs to destinations." } }
}
} ;
@ -205,9 +205,9 @@ HELP: ##peek
HELP: ##phi
{ $class-description
"A special kind of instruction used to mark control flow. It is inserted by the " { $vocab-link "compiler.cfg.ssa.construction" } " vocab. It has the following slots:"
{ $table
{ { $slot "inputs" } { "An assoc containing as keys the blocks/block numbers where the vreg was defined and as values the vreg. Why care about the blocks?" } }
{ { $slot "dst" } { "A merged vreg for the value." } }
{ $slots
{ "inputs" { "An assoc containing as keys the blocks/block numbers where the vreg was defined and as values the vreg. Why care about the blocks?" } }
{ "dst" { "A merged vreg for the value." } }
}
} ;
@ -241,22 +241,22 @@ HELP: ##save-context
HELP: ##set-slot
{ $class-description
"An instruction for the non-primitive, non-immediate variant of " { $link set-slot } ". It has the following slots:"
{ $table
{ { $slot "src" } { "Object to put in the slot." } }
{ { $slot "obj" } { "Object to set the slot on." } }
{ { $slot "slot" } { "Slot index." } }
{ { $slot "tag" } { "Type tag for obj." } }
{ $slots
{ "src" { "Object to put in the slot." } }
{ "obj" { "Object to set the slot on." } }
{ "slot" { "Slot index." } }
{ "tag" { "Type tag for obj." } }
}
} ;
HELP: ##set-slot-imm
{ $class-description
"An instruction for what? It has the following slots:"
{ $table
{ { $slot "src" } { "Register containing the value to put in the slot." } }
{ { $slot "obj" } { "Register containing the object to set the slot on.." } }
{ { $slot "slot" } { "Slot index." } }
{ { $slot "tag" } { "Type tag for obj." } }
{ $slots
{ "src" { "Register containing the value to put in the slot." } }
{ "obj" { "Register containing the object to set the slot on.." } }
{ "slot" { "Slot index." } }
{ "tag" { "Type tag for obj." } }
}
}
{ $see-also ##set-slot %set-slot-imm } ;
@ -268,10 +268,10 @@ HELP: ##single>double-float
HELP: ##shuffle-vector-imm
{ $class-description "Shuffles the vector in a SSE register according to the given shuffle pattern. It is used to extract a given element of the vector."
{ $table
{ { $slot "dst" } { "Destination register to shuffle the vector to." } }
{ { $slot "src" } { "Source register." } }
{ { $slot "shuffle" } { "Shuffling pattern." } }
{ $slots
{ "dst" { "Destination register to shuffle the vector to." } }
{ "src" { "Source register." } }
{ "shuffle" { "Shuffling pattern." } }
}
}
{ $see-also %shuffle-vector-imm } ;
@ -279,31 +279,31 @@ HELP: ##shuffle-vector-imm
HELP: ##slot-imm
{ $class-description
"Instruction for reading a slot with a given index from an object."
{ $table
{ { $slot "dst" } { "Register to read the slot value into." } }
{ { $slot "obj" } { "Register containing the object with the slot." } }
{ { $slot "slot" } { "Slot index." } }
{ { $slot "tag" } { "Type tag for obj." } }
{ $slots
{ "dst" { "Register to read the slot value into." } }
{ "obj" { "Register containing the object with the slot." } }
{ "slot" { "Slot index." } }
{ "tag" { "Type tag for obj." } }
}
} { $see-also %slot-imm } ;
HELP: ##spill
{ $class-description "Instruction that copies a value from a register to a " { $link spill-slot } "."
{ $table
{ { $slot "rep" } { "Register representation which is necessary when spilling SIMD registers." } }
{ $slots
{ "rep" { "Register representation which is necessary when spilling SIMD registers." } }
}
} { $see-also ##reload } ;
HELP: ##store-memory-imm
{ $class-description "Instruction that copies an 8 byte value from a XMM register to a memory location addressed by a normal register. This instruction is often turned into a cheaper " { $link ##store-memory } " instruction in the " { $link value-numbering } " pass."
{ $table
{ { $slot "base" } { "Vreg that contains the base address." } }
{ $slots
{ "base" { "Vreg that contains the base address." } }
{
{ $slot "offset" }
"offset"
{ "Offset in bytes from the address to where the data should be written." }
}
{ { $slot "rep" } { "Value representation in the vector register." } }
{ { $slot "src" } { "Vreg that contains the item to set." } }
{ "rep" { "Value representation in the vector register." } }
{ "src" { "Vreg that contains the item to set." } }
}
}
{ $see-also %store-memory-imm } ;
@ -314,9 +314,9 @@ HELP: ##test-branch
HELP: ##unbox-any-c-ptr
{ $class-description "Instruction that unboxes a pointer in a register so that it can be fed to a C FFI function. For example, if 'src' points to a " { $link byte-array } ", then in 'dst' will be put a pointer to the first byte of that byte array."
{ $table
{ { $slot "dst" } { "Destination register." } }
{ { $slot "src" } { "Source register." } }
{ $slots
{ "dst" { "Destination register." } }
{ "src" { "Source register." } }
}
}
{ $see-also %unbox-any-c-ptr } ;
@ -327,10 +327,10 @@ HELP: ##unbox-long-long
HELP: ##vector>scalar
{ $class-description
"This instruction is very similar to " { $link ##copy } "."
{ $table
{ { $slot "dst" } { "destination vreg" } }
{ { $slot "src" } { "source vreg" } }
{ { $slot "rep" } { "representation for the source vreg" } }
{ $slots
{ "dst" { "destination vreg" } }
{ "src" { "source vreg" } }
{ "rep" { "representation for the source vreg" } }
}
}
{ $notes "The two vregs must not necessarily share the same representation." }
@ -338,9 +338,9 @@ HELP: ##vector>scalar
HELP: ##vm-field
{ $class-description "Instruction for loading a pointer to a vm field."
{ $table
{ { $slot "dst" } { "Register to load the field into." } }
{ { $slot "offset" } { "Offset of the field relative to the vm address." } }
{ $slots
{ "dst" { "Register to load the field into." } }
{ "offset" { "Offset of the field relative to the vm address." } }
}
}
{ $see-also %vm-field } ;
@ -348,13 +348,13 @@ HELP: ##vm-field
HELP: ##write-barrier
{ $class-description
"An instruction for inserting a write barrier. This instruction is almost always inserted after a " { $link ##set-slot } " instruction. If the container object is in an older generation than the item inserted, this instruction guarantees that the item will not be garbage collected. It has the following slots:"
{ $table
{ { $slot "src" } { "Object to which the writer barrier refers." } }
{ { $slot "slot" } { "Slot index of the object." } }
{ { $slot "scale" } { "No idea." } }
{ { $slot "tag" } { "Type tag for obj." } }
{ { $slot "temp1" } { "First temporary register to clobber." } }
{ { $slot "temp2" } { "Second temporary register to clobber." } }
{ $slots
{ "src" { "Object to which the writer barrier refers." } }
{ "slot" { "Slot index of the object." } }
{ "scale" { "No idea." } }
{ "tag" { "Type tag for obj." } }
{ "temp1" { "First temporary register to clobber." } }
{ "temp2" { "Second temporary register to clobber." } }
}
} ;
@ -396,13 +396,13 @@ HELP: gc-map-insn
HELP: gc-map
{ $class-description "A tuple that holds info necessary for a gc cycle to figure out where the gc root pointers are. It has the following slots:"
{ $table
{ $slots
{
{ $slot "gc-roots" }
"gc-roots"
{ { $link sequence } " of vregs or spill-slots" }
}
{
{ $slot "derived-roots" }
"derived-roots"
{ "An " { $link assoc } " of pairs of vregs or spill slots." } }
}
"The 'gc-roots' and 'derived-roots' slots are initially vreg integers referencing objects that are live during the gc call and needs to be spilled so that they can be traced. In the " { $link emit-gc-map-insn } " word in " { $vocab-link "compiler.cfg.linear-scan.assignment" } " they are converted to spill slots which the collector is able to trace."

View File

@ -238,13 +238,13 @@ M: horizontal-cpu %horizontal-add-vector-reps signed-reps ;
M: horizontal-cpu %unpack-vector-head-reps signed-reps ;
M: horizontal-cpu %unpack-vector-tail-reps signed-reps ;
! v.
! vdot
{ { ##dot-vector } }
[ dot-cpu float-4-rep [ emit-simd-v. ] test-emit ]
[ dot-cpu float-4-rep [ emit-simd-vdot ] test-emit ]
unit-test
{ { ##mul-vector ##horizontal-add-vector ##horizontal-add-vector ##vector>scalar } }
[ horizontal-cpu float-4-rep [ emit-simd-v. ] test-emit ]
[ horizontal-cpu float-4-rep [ emit-simd-vdot ] test-emit ]
unit-test
{ {
@ -253,7 +253,7 @@ unit-test
##merge-vector-head ##merge-vector-tail ##add-vector
##vector>scalar
} }
[ simple-ops-cpu float-4-rep [ emit-simd-v. ] test-emit ]
[ simple-ops-cpu float-4-rep [ emit-simd-vdot ] test-emit ]
unit-test
! vsqrt

View File

@ -417,7 +417,7 @@ PREDICATE: fixnum-vector-rep < int-vector-rep
] }
} emit-vv-vector-op ;
: emit-simd-v. ( node -- )
: emit-simd-vdot ( node -- )
{
[ ^^dot-vector ]
{ float-vector-rep [ [ ^^mul-vector ] [ ^sum-vector ] bi ] }
@ -667,7 +667,7 @@ PREDICATE: fixnum-vector-rep < int-vector-rep
{ (simd-vmin) [ emit-simd-vmin ] }
{ (simd-vmax) [ emit-simd-vmax ] }
{ (simd-vavg) [ emit-simd-vavg ] }
{ (simd-v.) [ emit-simd-v. ] }
{ (simd-vdot) [ emit-simd-vdot ] }
{ (simd-vsad) [ emit-simd-vsad ] }
{ (simd-vsqrt) [ emit-simd-vsqrt ] }
{ (simd-sum) [ emit-simd-sum ] }

View File

@ -76,26 +76,27 @@ HELP: last-use?
HELP: live-interval-state
{ $class-description "A class encoding the \"liveness\" of a virtual register. It has the following slots:"
{ $table
{ { $slot "vreg" } { "The vreg this live interval state is bound to." } }
{ $slots
{ "vreg" { "The vreg this live interval state is bound to." } }
{
{ $slot "reg" }
"reg"
{ "The allocated register, set in the " { $link allocate-registers } " step." }
}
{
{ $slot "spill-rep" }
"spill-rep"
{ { $link representation } " the vreg will have when it is spilled." }
}
{
{ $slot "spill-to" }
"spill-to"
{ { $link spill-slot } " to use for spilling, if it needs to be spilled." }
}
{
{ $slot "ranges" }
"ranges"
{ "Inclusive ranges where the live interval is live. This is because the [start,end] interval can have gaps." }
}
{
{ $slot "uses" } { "sequence of insn# numbers which reference insructions that use the register in the live interval." }
"uses"
{ "sequence of insn# numbers which reference insructions that use the register in the live interval." }
}
}
}
@ -118,9 +119,9 @@ HELP: record-temp
HELP: sync-point
{ $class-description "A location where all live registers have to be spilled. For example when garbage collection is run or an alien ffi call is invoked. Figuring out where in the " { $link cfg } " the sync points are is done in the " { $link compute-live-intervals } " step. The tuple has the following slots:"
{ $table
{ { $slot "n" } { "Set from an instructions sequence number." } }
{ { $slot "keep-dst?" } { "Boolean that determines whether registers are spilled around this sync point." } }
{ $slots
{ "n" { "Set from an instructions sequence number." } }
{ "keep-dst?" { "Boolean that determines whether registers are spilled around this sync point." } }
}
}
{ $see-also cfg>sync-points clobber-insn hairy-clobber-insn insn } ;

View File

@ -35,7 +35,7 @@ GENERIC: visit-insn ( live-set insn -- )
: gen-uses ( live-set insn -- )
uses-vregs [ swap conjoin ] with each ; inline
M: vreg-insn visit-insn ( live-set insn -- )
M: vreg-insn visit-insn
[ kill-defs ] [ gen-uses ] 2bi ;
DEFER: lookup-base-pointer
@ -98,7 +98,7 @@ M: vreg-insn lookup-base-pointer* 2drop f ;
: fill-gc-map ( live-set gc-map -- )
[ gc-roots ] dip [ gc-roots<< ] [ derived-roots<< ] bi ;
M: gc-map-insn visit-insn ( live-set insn -- )
M: gc-map-insn visit-insn
[ kill-defs ] [ gc-map>> fill-gc-map ] [ gen-uses ] 2tri ;
M: ##phi visit-insn kill-defs ;

View File

@ -8,9 +8,9 @@ HELP: sets-interfere?
HELP: vreg-info
{ $class-description
"Slots:"
{ $table
{ { $slot "vreg" } { "The vreg the vreg-info is the info for." } }
{ { $slot "bb" } { "The " { $link basic-block } " in which the vreg is defined." } }
{ $slots
{ "vreg" { "The vreg the vreg-info is the info for." } }
{ "bb" { "The " { $link basic-block } " in which the vreg is defined." } }
}
} ;

View File

@ -11,15 +11,15 @@ HELP: stack-frame
{ "One final " { $link cell } " of padding." }
}
"The stack frame is also aligned to a 16 byte boundary. It has the following slots:"
{ $table
{ { $slot "total-size" } { "Total size of the stack frame." } }
{ { $slot "params" } { "Reserved parameter space." } }
{ { $slot "allot-area-base" } { "Base offset of the allocation area." } }
{ { $slot "allot-area-size" } { "Number of bytes requires for the allocation area." } }
{ { $slot "allot-area-align" } { "This slot is always at least " { $link cell } " bytes." } }
{ { $slot "spill-area-base" } { "Base offset for the spill area." } }
{ { $slot "spill-area-size" } { "Number of bytes requires for all spill slots." } }
{ { $slot "spill-area-align" } { "This slot is always at least " { $link cell } " bytes." } }
{ $slots
{ "total-size" { "Total size of the stack frame." } }
{ "params" { "Reserved parameter space." } }
{ "allot-area-base" { "Base offset of the allocation area." } }
{ "allot-area-size" { "Number of bytes requires for the allocation area." } }
{ "allot-area-align" { "This slot is always at least " { $link cell } " bytes." } }
{ "spill-area-base" { "Base offset for the spill area." } }
{ "spill-area-size" { "Number of bytes requires for all spill slots." } }
{ "spill-area-align" { "This slot is always at least " { $link cell } " bytes." } }
}
}
{ $see-also align-stack } ;

View File

@ -29,21 +29,21 @@ HELP: global-loc>local
HELP: height-state
{ $description "A tuple which keeps track of the stacks heights and increments of a " { $link basic-block } " during local analysis. The idea is that if the stack change instructions are tracked, then multiple changes can be folded into one. It has the following slots:"
{ $table
{ $slots
{
{ $slot "ds-begin" }
"ds-begin"
"Datastack height at the beginning of the block."
}
{
{ $slot "rs-begin" }
"rs-begin"
"Retainstack height at the beginning of the block."
}
{
{ $slot "ds-inc" }
"ds-inc"
"Datastack change during the block."
}
{
{ $slot "rs-inc" }
"rs-inc"
"Retainstack change during the block."
}
}
@ -103,10 +103,10 @@ HELP: replaces
ARTICLE: "compiler.cfg.stacks.local" "Local stack analysis"
"For each " { $link basic-block } " in the " { $link cfg } ", local stack analysis is performed. The analysis is started right after the block is created with " { $link begin-local-analysis } " and finished with " { $link end-local-analysis } ", when the construction of the block is complete. During the analysis, three sets containing stack locations are built:"
{ $list
{ { $slot "peeks" } " all stack locations that the block reads before writing" }
{ { $slot "replaces" } " all stack locations that the block writes" }
{ { $slot "kills" } " all stack locations which become unavailable after the block ends because of the stack height being decremented. For example, if the block contains " { $link drop } ", then D: 0 will be contained in kills because that stack location will not be live anymore." }
{ $slots
{ "peeks" { " all stack locations that the block reads before writing" } }
{ "replaces" { " all stack locations that the block writes" } }
{ "kills" { " all stack locations which become unavailable after the block ends because of the stack height being decremented. For example, if the block contains " { $link drop } ", then D: 0 will be contained in kills because that stack location will not be live anymore." } }
}
"This is done while constructing the CFG. These sets are then used by the " { $link end-stack-analysis } " word to emit optimal sequences of " { $link ##peek } " and " { $link ##replace } " instructions to the cfg."
$nl

View File

@ -33,7 +33,7 @@ T{ error-type-holder
{ type +compiler-error+ }
{ word ":errors" }
{ plural "compiler errors" }
{ icon "vocab:ui/tools/error-list/icons/compiler-error.tiff" }
{ icon "vocab:ui/tools/error-list/icons/compiler-error.png" }
{ quot [ compiler-errors get values ] }
{ forget-quot [ compiler-errors get delete-at ] }
} define-error-type
@ -51,7 +51,7 @@ T{ error-type-holder
{ type +linkage-error+ }
{ word ":linkage" }
{ plural "linkage errors" }
{ icon "vocab:ui/tools/error-list/icons/linkage-error.tiff" }
{ icon "vocab:ui/tools/error-list/icons/linkage-error.png" }
{ quot [ linkage-errors get values ] }
{ forget-quot [ linkage-errors get delete-at ] }
{ fatal? f }
@ -77,7 +77,7 @@ T{ error-type-holder
{ type +user-init-error+ }
{ word ":user-init-errors" }
{ plural "rc file errors" }
{ icon "vocab:ui/tools/error-list/icons/user-init-error.tiff" }
{ icon "vocab:ui/tools/error-list/icons/user-init-error.png" }
{ quot [ user-init-errors get-global values ] }
{ forget-quot [ user-init-errors get-global delete-at ] }
} define-error-type

View File

@ -2,7 +2,7 @@ USING: accessors alien alien.c-types alien.complex alien.data alien.libraries
alien.syntax arrays byte-arrays classes classes.struct combinators
combinators.extras compiler compiler.test concurrency.promises continuations
destructors effects generalizations io io.backend io.pathnames
io.streams.string kernel kernel.private libc layouts math math.bitwise
io.streams.string kernel kernel.private libc layouts locals math math.bitwise
math.private memory namespaces namespaces.private random parser quotations
sequences slots.private specialized-arrays stack-checker stack-checker.errors
system threads tools.test words ;
@ -963,3 +963,117 @@ FUNCTION: void* bug1021_test_3 ( c-string a )
{ } [
10000 [ 0 doit 33 assert= ] times
] unit-test
! Tests for System V AMD64 ABI
STRUCT: test_struct_66 { mem1 ulong } { mem2 ulong } ;
STRUCT: test_struct_68 { mem1 ulong } { mem2 ulong } { mem3 ulong } ;
STRUCT: test_struct_69 { mem1 float } { mem2 ulong } { mem3 ulong } ;
FUNCTION: ulong ffi_test_66 ( ulong a, ulong b, ulong c, test_struct_66 d, test_struct_66 e )
FUNCTION: ulong ffi_test_67 ( ulong a, ulong b, ulong c, test_struct_66 d, test_struct_66 e ulong _f )
FUNCTION: ulong ffi_test_68 ( ulong a, ulong b, ulong c, test_struct_66 d, test_struct_68 e test_struct_66 _f )
FUNCTION: ulong ffi_test_69 ( ulong a, ulong b, ulong c, test_struct_66 d, test_struct_69 e test_struct_66 _f )
FUNCTION: ulong ffi_test_70 ( test_struct_68 a test_struct_68 b, test_struct_66 c )
{ 28 } [ 1 2 3 S{ test_struct_66 f 4 5 } S{ test_struct_66 f 6 7 } ffi_test_66 ] unit-test
: callback-14 ( -- callback )
ulong { ulong ulong ulong test_struct_66 test_struct_66 } cdecl
[| a b c d e |
a b + c +
d [ mem1>> + ] [ mem2>> + ] bi
e [ mem1>> + ] [ mem2>> + ] bi
] alien-callback ;
: callback-14-test ( a b c d e callback -- result )
ulong { ulong ulong ulong test_struct_66 test_struct_66 } cdecl alien-indirect ;
{ 28 } [
1 2 3 S{ test_struct_66 f 4 5 } S{ test_struct_66 f 6 7 } callback-14 [
callback-14-test
] with-callback
] unit-test
{ 44 } [ 1 2 3 S{ test_struct_66 f 4 5 } S{ test_struct_66 f 6 7 } 8 ffi_test_67 ] unit-test
: callback-15 ( -- callback )
ulong { ulong ulong ulong test_struct_66 test_struct_66 ulong } cdecl
[| a b c d e _f |
a b + c +
d [ mem1>> + ] [ mem2>> + ] bi
e [ mem1>> + ] [ mem2>> + ] bi
_f 2 * +
] alien-callback ;
: callback-15-test ( a b c d e _f callback -- result )
ulong { ulong ulong ulong test_struct_66 test_struct_66 ulong } cdecl alien-indirect ;
{ 44 } [
1 2 3 S{ test_struct_66 f 4 5 } S{ test_struct_66 f 6 7 } 8 callback-15 [
callback-15-test
] with-callback
] unit-test
{ 55 } [
1 2 3 S{ test_struct_66 f 4 5 } S{ test_struct_68 f 6 7 8 } S{ test_struct_66 f 9 10 } ffi_test_68
] unit-test
: callback-16 ( -- callback )
ulong { ulong ulong ulong test_struct_66 test_struct_68 test_struct_66 } cdecl
[| a b c d e _f |
a b + c +
d [ mem1>> + ] [ mem2>> + ] bi
e [ mem1>> + ] [ mem2>> + ] [ mem3>> + ] tri
_f [ mem1>> + ] [ mem2>> + ] bi
] alien-callback ;
: callback-16-test ( a b c d e _f callback -- result )
ulong { ulong ulong ulong test_struct_66 test_struct_68 test_struct_66 } cdecl alien-indirect ;
{ 55 } [
1 2 3 S{ test_struct_66 f 4 5 } S{ test_struct_68 f 6 7 8 } S{ test_struct_66 f 9 10 } callback-16 [
callback-16-test
] with-callback
] unit-test
{ 55 } [
1 2 3 S{ test_struct_66 f 4 5 } S{ test_struct_69 f 6.0 7 8 } S{ test_struct_66 f 9 10 } ffi_test_69
] unit-test
: callback-17 ( -- callback )
ulong { ulong ulong ulong test_struct_66 test_struct_69 test_struct_66 } cdecl
[| a b c d e _f |
a b + c +
d [ mem1>> + ] [ mem2>> + ] bi
e [ mem1>> >integer + ] [ mem2>> + ] [ mem3>> + ] tri
_f [ mem1>> + ] [ mem2>> + ] bi
] alien-callback ;
: callback-17-test ( a b c d e _f callback -- result )
ulong { ulong ulong ulong test_struct_66 test_struct_69 test_struct_66 } cdecl alien-indirect ;
{ 55 } [
1 2 3 S{ test_struct_66 f 4 5 } S{ test_struct_69 f 6.0 7 8 } S{ test_struct_66 f 9 10 } callback-17 [
callback-17-test
] with-callback
] unit-test
{ 36 } [
S{ test_struct_68 f 1 2 3 } S{ test_struct_68 f 4 5 6 } S{ test_struct_66 f 7 8 } ffi_test_70
] unit-test
: callback-18 ( -- callback )
ulong { test_struct_68 test_struct_68 test_struct_66 } cdecl
[| a b c |
a [ mem1>> ] [ mem2>> + ] [ mem3>> + ] tri
b [ mem1>> + ] [ mem2>> + ] [ mem3>> + ] tri
c [ mem1>> + ] [ mem2>> + ] bi
] alien-callback ;
: callback-18-test ( a b c callback -- result )
ulong { test_struct_68 test_struct_68 test_struct_66 } cdecl alien-indirect ;
{ 36 } [
S{ test_struct_68 f 1 2 3 } S{ test_struct_68 f 4 5 6 } S{ test_struct_66 f 7 8 } callback-18 [
callback-18-test
] with-callback
] unit-test

View File

@ -9,7 +9,7 @@ IN: compiler.tree.escape-analysis.branches
M: #branch escape-analysis*
[ in-d>> add-escaping-values ]
[ live-children sift [ (escape-analysis) ] each ]
[ live-children [ [ (escape-analysis) ] when* ] each ]
bi ;
: (merge-allocations) ( values -- allocation )

View File

@ -34,7 +34,7 @@ M: true-constraint satisfied?
TUPLE: false-constraint value ;
: =f ( value -- constriant ) resolve-copy false-constraint boa ;
: =f ( value -- constraint ) resolve-copy false-constraint boa ;
M: false-constraint assume*
[ \ f <class-info> swap value>> refine-value-info ]

View File

@ -28,17 +28,17 @@ HELP: value-info
{ $description "Gets the value info for the given SSA value. If none is found then a null empty interval is returned." } ;
HELP: value-info<=
{ $values { "info1" value-info } { "info2" value-info } { "?" boolean } }
{ $values { "info1" value-info-state } { "info2" value-info-state } { "?" boolean } }
{ $description "Checks if the first value info is equal to, or smaller than the second one." } ;
HELP: value-info-state
{ $class-description "Represents constraints the compiler knows about the input and output variables to an SSA tree node. It has the following slots:"
{ $table
{ { $slot "class" } { "Class of values the variable can take." } }
{ { $slot "interval" } { "Range of values the variable can take." } }
{ { $slot "literal" } { "Literal value, if present." } }
{ { $slot "literal?" } { "Whether the value of the variable is known at compile-time or not." } }
{ { $slot "slots" } { "If the value is a literal tuple or fixed length type, then slots is a " { $link sequence } " of " { $link value-info-state } " encoding what is known about its slots at compile-time." } }
{ $slots
{ "class" { "Class of values the variable can take." } }
{ "interval" { "Range of values the variable can take." } }
{ "literal" { "Literal value, if present." } }
{ "literal?" { "Whether the value of the variable is known at compile-time or not." } }
{ "slots" { "If the value is a literal tuple or fixed length type, then slots is a " { $link sequence } " of " { $link value-info-state } " encoding what is known about its slots at compile-time." } }
}
"Don't mutate value infos you receive, always construct new ones. We don't declare the slots read-only to allow cloning followed by writing, and to simplify constructors."
} ;

View File

@ -358,7 +358,7 @@ generic-comparison-ops [
\ instance? [
! We need to force the caller word to recompile when the class
! is redefined, since now we're making assumptions but the
! is redefined, since now we're making assumptions about the
! class definition itself.
dup literal>> classoid?
[

View File

@ -64,7 +64,7 @@ CONSTANT: vector>vector-intrinsics
CONSTANT: vector-other-intrinsics
{
(simd-v.)
(simd-vdot)
(simd-vsad)
(simd-sum)
(simd-vany?)
@ -96,7 +96,7 @@ vector>vector-intrinsics [ { byte-array } "default-output-classes" set-word-prop
\ (simd-sum) [ nip scalar-output-class ] "outputs" set-word-prop
\ (simd-v.) [ 2nip scalar-output-class ] "outputs" set-word-prop
\ (simd-vdot) [ 2nip scalar-output-class ] "outputs" set-word-prop
{
(simd-vany?)

View File

@ -47,9 +47,6 @@ IN: compiler.tree.propagation.slots
[ swap slot <literal-info> ]
} 2&& ;
: length-accessor? ( slot info -- ? )
[ 1 = ] [ length>> ] bi* and ;
: value-info-slot ( slot info -- info' )
{
{ [ over 0 = ] [ 2drop fixnum <class-info> ] }

View File

@ -196,7 +196,8 @@ ERROR: bad-partial-eval quot word ;
dup classoid?
[
predicate-def
! union{ and intersection{ have useless expansions, and recurse infinitely
! union{ and intersection{ and not{ have useless
! expansions, and recurse infinitely
dup { [ length 2 >= ] [ second \ instance? = ] } 1&& [
drop f
] when

View File

@ -18,13 +18,13 @@ HELP: #alien-callback
HELP: #call
{ $class-description "SSA tree node that calls a word. It has the following slots:"
{ $table
{ { $slot "word" } { "The " { $link word } " to call." } }
{ { $slot "in-d" } { "Sequence of input variables to the call. The items are ordered from top to bottom of the stack." } }
{ { $slot "out-d" } { "Output values of the call." } }
{ { $slot "method" } { "If the called word is generic and inlined here, then 'method' contains the inlined " { $link quotation } "." } }
{ { $slot "body" } { "If the called word is generic and inlined, then 'body' is a sequence of SSA nodes built from the inlined method." } }
{ { $slot "info" } { "If the called word is generic and inlined, then the info slot contains an assoc of value infos for the body of the inlined generic. It is set during the propagation pass of the optimizer." } }
{ $slots
{ "word" { "The " { $link word } " to call." } }
{ "in-d" { "Sequence of input variables to the call. The items are ordered from top to bottom of the stack." } }
{ "out-d" { "Output values of the call." } }
{ "method" { "If the called word is generic and inlined here, then 'method' contains the inlined " { $link quotation } "." } }
{ "body" { "If the called word is generic and inlined, then 'body' is a sequence of SSA nodes built from the inlined method." } }
{ "info" { "If the called word is generic and inlined, then the info slot contains an assoc of value infos for the body of the inlined generic. It is set during the propagation pass of the optimizer." } }
}
} ;
@ -34,8 +34,8 @@ HELP: #call-recursive
HELP: #declare
{ $class-description "SSA tree node emitted when " { $link declare } " declarations are encountered. It has the following slots:"
{ $table
{ { $slot "declaration" } { { $link assoc } " that maps values to the types they are declared as." } }
{ $slots
{ "declaration" { { $link assoc } " that maps values to the types they are declared as." } }
}
} ;
@ -45,8 +45,8 @@ HELP: #enter-recursive
HELP: #if
{ $class-description "SSA tree node that implements conditional branching. It has the following slots:"
{ $table
{ { $slot "children" }
{ $slots
{ "children"
{ "A two item " { $link sequence } ". The first item holds the instructions executed if the condition is true and the second those that are executed if it is not true." }
}
}
@ -54,8 +54,8 @@ HELP: #if
HELP: #introduce
{ $class-description "SSA tree node that puts an input value from the \"outside\" on the stack. It is used to \"introduce\" data stack parameter whenever they are needed. It has the following slots:"
{ $table
{ { $slot "out-d" } { "Array of values of the parameters being introduced." } }
{ $slots
{ "out-d" { "Array of values of the parameters being introduced." } }
}
} ;
@ -64,25 +64,25 @@ HELP: #phi
HELP: #push
{ $class-description "SSA tree node that puts a literal value on the stack. It has the following slots:"
{ $table
{ { $slot "out-d" } { "A one item array containing the " { $link <value> } " of the literal being pushed." } }
{ $slots
{ "out-d" { "A one item array containing the " { $link <value> } " of the literal being pushed." } }
}
}
{ $notes "A " { $link quotation } " is also a literal." } ;
HELP: #recursive
{ $class-description "Instruction which encodes a loop. It has the following slots:"
{ $table
{ { $slot "child" } { "A sequence of nodes representing the body of the loop." } }
{ { $slot "loop?" } { "If " { $link t } ", the recursion is implemented using a jump, otherwise as a call back to the word." } }
{ $slots
{ "child" { "A sequence of nodes representing the body of the loop." } }
{ "loop?" { "If " { $link t } ", the recursion is implemented using a jump, otherwise as a call back to the word." } }
}
}
{ $see-also inline-recursive-word } ;
HELP: #shuffle
{ $class-description "SSA tree node that represents a stack shuffling operation such as " { $link swap } ". It has the following slots:"
{ $table
{ { $slot "mapping" } { "An " { $link assoc } " that shows how the shuffle output values (the keys) correspond to their inputs (the values)." } }
{ $slots
{ "mapping" { "An " { $link assoc } " that shows how the shuffle output values (the keys) correspond to their inputs (the values)." } }
}
} ;

View File

@ -68,11 +68,11 @@ C: <connection> connection
: send-to-connection ( message connection -- )
stream>> [ serialize flush ] with-stream* ;
M: remote-thread send ( message thread -- )
M: remote-thread send
[ id>> 2array ] [ node>> ] [ thread-connections at ] tri
[ nip send-to-connection ] [ send-remote-message ] if* ;
M: thread (serialize) ( obj -- )
M: thread (serialize)
id>> [ local-node get insecure>> ] dip <remote-thread> (serialize) ;
: stop-node ( -- )

View File

@ -13,7 +13,7 @@ M: thread mailbox-of
[ { mailbox } declare ]
[ <mailbox> [ >>mailbox drop ] keep ] ?if ; inline
M: thread send ( message thread -- )
M: thread send
mailbox-of mailbox-put ;
: my-mailbox ( -- mailbox ) self mailbox-of ; inline

View File

@ -1,7 +1,7 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.data alien.syntax arrays
assocs cache colors combinators core-foundation
assocs cache classes colors combinators core-foundation
core-foundation.attributed-strings core-foundation.strings
core-graphics core-graphics.types core-text.fonts destructors
fonts init kernel locals make math math.functions math.order
@ -34,8 +34,6 @@ FUNCTION: CGRect CTLineGetImageBounds ( CTLineRef line, CGContextRef context )
SYMBOL: retina?
ERROR: not-a-string object ;
MEMO: make-attributes ( open-font color -- hashtable )
[
kCTForegroundColorAttributeName ,,
@ -46,7 +44,7 @@ MEMO: make-attributes ( open-font color -- hashtable )
[
[
dup selection? [ string>> ] when
dup string? [ not-a-string ] unless
string check-instance
] 2dip
make-attributes <CFAttributedString> &CFRelease
CTLineCreateWithAttributedString
@ -79,9 +77,7 @@ render-loc render-dim ;
compute-height ;
: metrics>dim ( bounds -- dim )
[ width>> ] [ [ ascent>> ] [ descent>> ] bi + ] bi
[ ceiling >integer ]
bi@ 2array ;
[ width>> ] [ [ ascent>> ] [ descent>> ] bi + ] bi 2array ;
: fill-background ( context font dim -- )
[ background>> >rgba-components CGContextSetRGBFillColor ]
@ -90,7 +86,7 @@ render-loc render-dim ;
: selection-rect ( dim line selection -- rect )
[let [ start>> ] [ end>> ] [ string>> ] tri :> ( start end string )
start end [ 0 swap string subseq utf16n encode length 2 / >integer ] bi@
start end [ 0 swap string subseq utf16n encode length 2 /i ] bi@
]
[ f CTLineGetOffsetForStringIndex round ] bi-curry@ bi
[ drop nip 0 ] [ swap - swap second ] 3bi <CGRect> ;

View File

@ -18,7 +18,7 @@ SYMBOL: couch
TUPLE: couchdb-error { data assoc } ;
C: <couchdb-error> couchdb-error
M: couchdb-error error. ( error -- )
M: couchdb-error error.
"CouchDB Error: " write data>>
"error" over at [ print ] when*
"reason" of [ print ] when* ;

View File

@ -524,7 +524,7 @@ HOOK: immediate-bitwise? cpu ( n -- ? )
HOOK: immediate-comparand? cpu ( n -- ? )
HOOK: immediate-store? cpu ( n -- ? )
M: object immediate-comparand? ( n -- ? )
M: object immediate-comparand?
{
{ [ dup fixnum? ] [ tag-fixnum immediate-arithmetic? ] }
{ [ dup not ] [ drop t ] }

View File

@ -5,13 +5,13 @@ compiler.cfg.builder.alien.boxing sequences arrays
alien.c-types cpu.architecture cpu.ppc alien.complex ;
IN: cpu.ppc.32.linux
M: linux lr-save ( -- n ) 1 cells ;
M: linux lr-save 1 cells ;
M: linux has-toc ( -- ? ) f ;
M: linux has-toc f ;
M: linux reserved-area-size ( -- n ) 2 cells ;
M: linux reserved-area-size 2 cells ;
M: linux allows-null-dereference ( -- ? ) f ;
M: linux allows-null-dereference f ;
M: ppc param-regs
drop {
@ -35,7 +35,7 @@ M: ppc long-long-odd-register? t ;
M: ppc float-right-align-on-stack? f ;
M: ppc flatten-struct-type ( type -- seq )
M: ppc flatten-struct-type
{
{ [ dup lookup-c-type complex-double lookup-c-type = ]
[ drop { { int-rep f f } { int-rep f f }

View File

@ -7,11 +7,11 @@ IN: cpu.ppc.64.linux
M: linux lr-save 2 cells ;
M: linux has-toc ( -- ? ) t ;
M: linux has-toc t ;
M: linux reserved-area-size ( -- n ) 6 cells ;
M: linux reserved-area-size 6 cells ;
M: linux allows-null-dereference ( -- ? ) f ;
M: linux allows-null-dereference f ;
M: ppc param-regs
drop {
@ -33,7 +33,7 @@ M: ppc long-long-odd-register? f ;
M: ppc float-right-align-on-stack? t ;
M: ppc flatten-struct-type ( type -- seq )
M: ppc flatten-struct-type
{
{ [ dup lookup-c-type complex-double lookup-c-type = ]
[ drop { { double-rep f f } { double-rep f f } } ] }
@ -42,7 +42,7 @@ M: ppc flatten-struct-type ( type -- seq )
[ heap-size cell align cell /i { int-rep f f } <repetition> ]
} cond ;
M: ppc flatten-struct-type-return ( type -- seq )
M: ppc flatten-struct-type-return
{
{ [ dup lookup-c-type complex-double lookup-c-type = ]
[ drop { { double-rep f f } { double-rep f f } } ] }

View File

@ -115,16 +115,16 @@ IN: cpu.ppc.assembler
! 2.4 Branch Instructions
GENERIC: B ( target_addr/label -- )
M: integer B ( target_addr -- ) -2 shift 0 0 18 i-insn ;
M: integer B -2 shift 0 0 18 i-insn ;
GENERIC: BL ( target_addr/label -- )
M: integer BL ( target_addr -- ) -2 shift 0 1 18 i-insn ;
M: integer BL -2 shift 0 1 18 i-insn ;
: BA ( target_addr -- ) -2 shift 1 0 18 i-insn ;
: BLA ( target_addr -- ) -2 shift 1 1 18 i-insn ;
GENERIC: BC ( bo bi target_addr/label -- )
M: integer BC ( bo bi target_addr -- ) -2 shift 0 0 16 b-insn ;
M: integer BC -2 shift 0 0 16 b-insn ;
: BCA ( bo bi target_addr -- ) -2 shift 1 0 16 b-insn ;
: BCL ( bo bi target_addr -- ) -2 shift 0 1 16 b-insn ;

View File

@ -34,9 +34,9 @@ HOOK: has-toc os ( -- ? )
HOOK: reserved-area-size os ( -- n )
HOOK: allows-null-dereference os ( -- ? )
M: label B ( label -- ) [ 0 B ] dip rc-relative-ppc-3-pc label-fixup ;
M: label BL ( label -- ) [ 0 BL ] dip rc-relative-ppc-3-pc label-fixup ;
M: label BC ( bo bi label -- ) [ 0 BC ] dip rc-relative-ppc-2-pc label-fixup ;
M: label B [ 0 B ] dip rc-relative-ppc-3-pc label-fixup ;
M: label BL [ 0 BL ] dip rc-relative-ppc-3-pc label-fixup ;
M: label BC [ 0 BC ] dip rc-relative-ppc-2-pc label-fixup ;
CONSTANT: scratch-reg 30
CONSTANT: fp-scratch-reg 30
@ -44,16 +44,16 @@ CONSTANT: ds-reg 14
CONSTANT: rs-reg 15
CONSTANT: vm-reg 16
M: ppc machine-registers ( -- assoc )
M: ppc machine-registers
{
{ int-regs $[ 3 12 [a,b] 17 29 [a,b] append ] }
{ float-regs $[ 0 29 [a,b] ] }
} ;
M: ppc frame-reg ( -- reg ) 31 ;
M: ppc.32 vm-stack-space ( -- n ) 16 ;
M: ppc.64 vm-stack-space ( -- n ) 32 ;
M: ppc complex-addressing? ( -- ? ) f ;
M: ppc frame-reg 31 ;
M: ppc.32 vm-stack-space 16 ;
M: ppc.64 vm-stack-space 32 ;
M: ppc complex-addressing? f ;
! PW1-PW8 parameter save slots
: param-save-size ( -- n ) 8 cells ; foldable
@ -67,7 +67,7 @@ M: ppc complex-addressing? ( -- ? ) f ;
: param@ ( n -- offset )
reserved-area-size + ;
M: ppc gc-root-offset ( spill-slot -- n )
M: ppc gc-root-offset
n>> spill@ cell /i ;
: LOAD32 ( r n -- )
@ -129,12 +129,12 @@ HOOK: %load-cell-imm-rc cpu ( -- rel-class )
M: ppc.32 %load-cell-imm-rc rc-absolute-ppc-2/2 ;
M: ppc.64 %load-cell-imm-rc rc-absolute-ppc-2/2/2/2 ;
M: ppc.32 %load-immediate ( reg val -- )
M: ppc.32 %load-immediate
dup -0x8000 0x7fff between? [ LI ] [ LOAD32 ] if ;
M: ppc.64 %load-immediate ( reg val -- )
M: ppc.64 %load-immediate
dup -0x8000 0x7fff between? [ LI ] [ LOAD64 ] if ;
M: ppc %load-reference ( reg obj -- )
M: ppc %load-reference
[ [ 0 %load-cell-imm ] [ %load-cell-imm-rc rel-literal ] bi* ]
[ \ f type-number LI ]
if* ;
@ -156,11 +156,11 @@ M: ds-loc loc-reg drop ds-reg ;
M: rs-loc loc-reg drop rs-reg ;
! Load value at stack location loc into vreg.
M: ppc %peek ( vreg loc -- )
M: ppc %peek
[ loc-reg ] [ n>> cells neg ] bi %load-cell ;
! Replace value at stack location loc with value in vreg.
M: ppc %replace ( vreg loc -- )
M: ppc %replace
[ loc-reg ] [ n>> cells neg ] bi %store-cell ;
! Replace value at stack location with an immediate value.
@ -176,45 +176,45 @@ M:: ppc %replace-imm ( src loc -- )
} cond
scratch-reg reg offset %store-cell ;
M: ppc %clear ( loc -- )
M: ppc %clear
297 swap %replace-imm ;
! Increment stack pointer by n cells.
M: ppc %inc ( loc -- )
M: ppc %inc
[ ds-loc? [ ds-reg ds-reg ] [ rs-reg rs-reg ] if ] [ n>> ] bi cells ADDI ;
M: ppc stack-frame-size ( stack-frame -- i )
M: ppc stack-frame-size
(stack-frame-size)
reserved-area-size +
param-save-size +
factor-area-size +
16 align ;
M: ppc %call ( word -- )
M: ppc %call
0 BL rc-relative-ppc-3-pc rel-word-pic ;
: instrs ( n -- b ) 4 * ; inline
M: ppc %jump ( word -- )
M: ppc %jump
6 0 %load-cell-imm 1 instrs %load-cell-imm-rc rel-here
0 B rc-relative-ppc-3-pc rel-word-pic-tail ;
M: ppc %dispatch ( src temp -- )
M: ppc %dispatch
[ nip 0 %load-cell-imm 3 instrs %load-cell-imm-rc rel-here ]
[ swap dupd %load-cell-x ]
[ nip MTCTR ] 2tri BCTR ;
M: ppc %slot ( dst obj slot scale tag -- )
M: ppc %slot
[ 0 assert= ] bi@ %load-cell-x ;
M: ppc %slot-imm ( dst obj slot tag -- )
M: ppc %slot-imm
slot-offset scratch-reg swap LI
scratch-reg %load-cell-x ;
M: ppc %set-slot ( src obj slot scale tag -- )
M: ppc %set-slot
[ 0 assert= ] bi@ %store-cell-x ;
M: ppc %set-slot-imm ( src obj slot tag -- )
M: ppc %set-slot-imm
slot-offset [ scratch-reg ] dip LI scratch-reg %store-cell-x ;
M: ppc %jump-label B ;
@ -255,7 +255,7 @@ M: ppc.64 %log2 [ CNTLZD ] [ drop dup NEG ] [ drop dup 63 ADDI ] 2tri ;
M: ppc.32 %bit-count POPCNTW ;
M: ppc.64 %bit-count POPCNTD ;
M: ppc %copy ( dst src rep -- )
M: ppc %copy
2over eq? [ 3drop ] [
{
{ tagged-rep [ MR ] }
@ -276,15 +276,15 @@ M: ppc %copy ( dst src rep -- )
{ cc/o [ 0 label BNS ] }
} case ; inline
M: ppc %fixnum-add ( label dst src1 src2 cc -- )
M: ppc %fixnum-add
[ ADDO. ] overflow-template ;
M: ppc %fixnum-sub ( label dst src1 src2 cc -- )
M: ppc %fixnum-sub
[ SUBFO. ] overflow-template ;
M: ppc.32 %fixnum-mul ( label dst src1 src2 cc -- )
M: ppc.32 %fixnum-mul
[ MULLWO. ] overflow-template ;
M: ppc.64 %fixnum-mul ( label dst src1 src2 cc -- )
M: ppc.64 %fixnum-mul
[ MULLDO. ] overflow-template ;
M: ppc %add-float FADD ;
@ -292,11 +292,11 @@ M: ppc %sub-float FSUB ;
M: ppc %mul-float FMUL ;
M: ppc %div-float FDIV ;
M: ppc %min-float ( dst src1 src2 -- )
M: ppc %min-float
2dup [ scratch-reg ] 2dip FSUB
[ scratch-reg ] 2dip FSEL ;
M: ppc %max-float ( dst src1 src2 -- )
M: ppc %max-float
2dup [ scratch-reg ] 2dip FSUB
[ scratch-reg ] 2dip FSEL ;
@ -343,26 +343,26 @@ M:: ppc.64 %float>integer ( dst src -- )
} ;
! Return values of this class go here
M: ppc return-regs ( -- regs )
M: ppc return-regs
{
{ int-regs { 3 4 5 6 } }
{ float-regs { 1 2 3 4 } }
} ;
! Is this structure small enough to be returned in registers?
M: ppc return-struct-in-registers? ( c-type -- ? )
M: ppc return-struct-in-registers?
lookup-c-type return-in-registers?>> ;
! If t, the struct return pointer is never passed in a param reg
M: ppc struct-return-on-stack? ( -- ? ) f ;
M: ppc struct-return-on-stack? f ;
GENERIC: load-param ( reg src -- )
M: integer load-param ( reg src -- ) int-rep %copy ;
M: spill-slot load-param ( reg src -- ) [ 1 ] dip n>> spill@ %load-cell ;
M: integer load-param int-rep %copy ;
M: spill-slot load-param [ 1 ] dip n>> spill@ %load-cell ;
GENERIC: store-param ( reg dst -- )
M: integer store-param ( reg dst -- ) swap int-rep %copy ;
M: spill-slot store-param ( reg dst -- ) [ 1 ] dip n>> spill@ %store-cell ;
M: integer store-param swap int-rep %copy ;
M: spill-slot store-param [ 1 ] dip n>> spill@ %store-cell ;
M:: ppc %unbox ( dst src func rep -- )
3 src load-param
@ -459,10 +459,7 @@ M:: ppc %c-invoke ( name dll gc-map -- )
dead-outputs [ first2 discard-reg-param ] each
; inline
M: ppc %alien-invoke ( varargs? reg-inputs stack-inputs
reg-outputs dead-outputs
cleanup stack-size
symbols dll gc-map -- )
M: ppc %alien-invoke
'[ _ _ _ %c-invoke ] emit-alien-insn ;
M:: ppc %alien-indirect ( src
@ -483,36 +480,33 @@ M:: ppc %alien-indirect ( src
gc-map gc-map-here
] emit-alien-insn ;
M: ppc %alien-assembly ( varargs? reg-inputs stack-inputs
reg-outputs dead-outputs
cleanup stack-size
quot -- )
M: ppc %alien-assembly
'[ _ call( -- ) ] emit-alien-insn ;
M: ppc %callback-inputs ( reg-outputs stack-outputs -- )
M: ppc %callback-inputs
[ [ first3 load-reg-param ] each ]
[ [ first3 load-stack-param ] each ] bi*
3 vm-reg MR
4 0 LI
"begin_callback" f f %c-invoke ;
M: ppc %callback-outputs ( reg-inputs -- )
M: ppc %callback-outputs
3 vm-reg MR
"end_callback" f f %c-invoke
[ first3 store-reg-param ] each ;
M: ppc stack-cleanup ( stack-size return abi -- n )
M: ppc stack-cleanup
3drop 0 ;
M: ppc fused-unboxing? f ;
M: ppc %alien-global ( register symbol dll -- )
M: ppc %alien-global
[ 0 %load-cell-imm ] 2dip %load-cell-imm-rc rel-dlsym ;
M: ppc %vm-field ( dst field -- ) [ vm-reg ] dip %load-cell ;
M: ppc %set-vm-field ( src field -- ) [ vm-reg ] dip %store-cell ;
M: ppc %vm-field [ vm-reg ] dip %load-cell ;
M: ppc %set-vm-field [ vm-reg ] dip %store-cell ;
M: ppc %unbox-alien ( dst src -- )
M: ppc %unbox-alien
scratch-reg alien-offset LI scratch-reg %load-cell-x ;
! Convert a c-ptr object to a raw C pointer.
@ -706,7 +700,7 @@ M:: ppc.64 %convert-integer ( dst src c-type -- )
{ c:ulonglong [ ] }
} case ;
M: ppc.32 %load-memory-imm ( dst base offset rep c-type -- )
M: ppc.32 %load-memory-imm
[
pick %trap-null
{
@ -725,7 +719,7 @@ M: ppc.32 %load-memory-imm ( dst base offset rep c-type -- )
} case
] ?if ;
M: ppc.64 %load-memory-imm ( dst base offset rep c-type -- )
M: ppc.64 %load-memory-imm
[
pick %trap-null
{
@ -747,7 +741,7 @@ M: ppc.64 %load-memory-imm ( dst base offset rep c-type -- )
] ?if ;
M: ppc.32 %load-memory ( dst base displacement scale offset rep c-type -- )
M: ppc.32 %load-memory
[ [ 0 assert= ] bi@ ] 2dip
[
pick %trap-null
@ -767,7 +761,7 @@ M: ppc.32 %load-memory ( dst base displacement scale offset rep c-type -- )
} case
] ?if ;
M: ppc.64 %load-memory ( dst base displacement scale offset rep c-type -- )
M: ppc.64 %load-memory
[ [ 0 assert= ] bi@ ] 2dip
[
pick %trap-null
@ -790,7 +784,7 @@ M: ppc.64 %load-memory ( dst base displacement scale offset rep c-type -- )
] ?if ;
M: ppc.32 %store-memory-imm ( src base offset rep c-type -- )
M: ppc.32 %store-memory-imm
[
{
{ c:char [ STB ] }
@ -808,7 +802,7 @@ M: ppc.32 %store-memory-imm ( src base offset rep c-type -- )
} case
] ?if ;
M: ppc.64 %store-memory-imm ( src base offset rep c-type -- )
M: ppc.64 %store-memory-imm
[
{
{ c:char [ STB ] }
@ -828,7 +822,7 @@ M: ppc.64 %store-memory-imm ( src base offset rep c-type -- )
} case
] ?if ;
M: ppc.32 %store-memory ( src base displacement scale offset rep c-type -- )
M: ppc.32 %store-memory
[ [ 0 assert= ] bi@ ] 2dip
[
{
@ -847,7 +841,7 @@ M: ppc.32 %store-memory ( src base displacement scale offset rep c-type -- )
} case
] ?if ;
M: ppc.64 %store-memory ( src base displacement scale offset rep c-type -- )
M: ppc.64 %store-memory
[ [ 0 assert= ] bi@ ] 2dip
[
{
@ -914,7 +908,7 @@ M:: ppc %check-nursery-branch ( label size cc temp1 temp2 -- )
{ cc/<= [ 0 label BGT ] }
} case ;
M: ppc %call-gc ( gc-map -- )
M: ppc %call-gc
\ minor-gc %call gc-map-here ;
M:: ppc %prologue ( stack-size -- )
@ -1033,7 +1027,7 @@ M:: ppc %compare-float-unordered-branch ( label src1 src2 cc -- )
src1 src2 cc \ (%compare-float-unordered) (%compare-float) :> ( branch1 branch2 )
label branch1 branch2 (%branch) ;
M: ppc %spill ( src rep dst -- )
M: ppc %spill
n>> spill@ swap {
{ int-rep [ [ 1 ] dip %store-cell ] }
{ tagged-rep [ [ 1 ] dip %store-cell ] }
@ -1043,7 +1037,7 @@ M: ppc %spill ( src rep dst -- )
{ scalar-rep [ scratch-reg swap LI 1 scratch-reg STVX ] }
} case ;
M: ppc %reload ( dst rep src -- )
M: ppc %reload
n>> spill@ swap {
{ int-rep [ [ 1 ] dip %load-cell ] }
{ tagged-rep [ [ 1 ] dip %load-cell ] }
@ -1053,11 +1047,11 @@ M: ppc %reload ( dst rep src -- )
{ scalar-rep [ scratch-reg swap LI 1 scratch-reg LVX ] }
} case ;
M: ppc immediate-arithmetic? ( n -- ? ) -32768 32767 between? ;
M: ppc immediate-bitwise? ( n -- ? ) 0 65535 between? ;
M: ppc immediate-store? ( n -- ? ) immediate-comparand? ;
M: ppc immediate-arithmetic? -32768 32767 between? ;
M: ppc immediate-bitwise? 0 65535 between? ;
M: ppc immediate-store? immediate-comparand? ;
M: ppc enable-cpu-features ( -- )
M: ppc enable-cpu-features
enable-float-intrinsics ;
USE: vocabs

View File

@ -26,18 +26,18 @@ M: x86.32 rs-reg EDI ;
M: x86.32 stack-reg ESP ;
M: x86.32 frame-reg EBP ;
M: x86.32 immediate-comparand? ( obj -- ? ) drop t ;
M: x86.32 immediate-comparand? drop t ;
M:: x86.32 %load-vector ( dst val rep -- )
dst 0 [] rep copy-memory* val rc-absolute rel-binary-literal ;
M: x86.32 %vm-field ( dst field -- )
M: x86.32 %vm-field
[ 0 [] MOV ] dip rc-absolute-cell rel-vm ;
M: x86.32 %set-vm-field ( dst field -- )
M: x86.32 %set-vm-field
[ 0 [] swap MOV ] dip rc-absolute-cell rel-vm ;
M: x86.32 %vm-field-ptr ( dst field -- )
M: x86.32 %vm-field-ptr
[ 0 MOV ] dip rc-absolute-cell rel-vm ;
M: x86.32 %mark-card
@ -61,7 +61,7 @@ M: x86.32 vm-stack-space 16 ;
: save-vm-ptr ( n -- )
stack@ 0 MOV 0 rc-absolute-cell rel-vm ;
M: x86.32 return-struct-in-registers? ( c-type -- ? )
M: x86.32 return-struct-in-registers?
lookup-c-type
[ return-in-registers?>> ]
[ heap-size { 1 2 4 8 } member? ] bi
@ -87,7 +87,7 @@ M: x86.32 return-regs
M: x86.32 %prepare-jump
pic-tail-reg 0 MOV xt-tail-pic-offset rc-absolute-cell rel-here ;
M: x86.32 %load-stack-param ( dst rep n -- )
M: x86.32 %load-stack-param
next-stack@ swap pick register? [ %copy ] [
{
{ int-rep [ [ EAX ] dip MOV ?spill-slot EAX MOV ] }
@ -96,7 +96,7 @@ M: x86.32 %load-stack-param ( dst rep n -- )
} case
] if ;
M: x86.32 %store-stack-param ( src rep n -- )
M: x86.32 %store-stack-param
stack@ swap pick register? [ swapd %copy ] [
{
{ int-rep [ [ [ EAX ] dip ?spill-slot MOV ] [ EAX MOV ] bi* ] }
@ -115,7 +115,7 @@ M: x86.32 %store-stack-param ( src rep n -- )
dst ?spill-slot x87-insn execute
] if ; inline
M: x86.32 %load-reg-param ( vreg rep reg -- )
M: x86.32 %load-reg-param
swap {
{ int-rep [ int-rep %copy ] }
{ float-rep [ drop \ FSTPS float-rep load-float-return ] }
@ -132,14 +132,14 @@ M: x86.32 %load-reg-param ( vreg rep reg -- )
src ?spill-slot x87-insn execute
] if ; inline
M: x86.32 %store-reg-param ( vreg rep reg -- )
M: x86.32 %store-reg-param
swap {
{ int-rep [ swap int-rep %copy ] }
{ float-rep [ drop \ FLDS float-rep store-float-return ] }
{ double-rep [ drop \ FLDL double-rep store-float-return ] }
} case ;
M: x86.32 %discard-reg-param ( rep reg -- )
M: x86.32 %discard-reg-param
drop {
{ int-rep [ ] }
{ float-rep [ ST0 FSTP ] }
@ -179,12 +179,12 @@ M:: x86.32 %box-long-long ( dst src1 src2 func gc-map -- )
M: x86.32 %c-invoke
[ 0 CALL rc-relative rel-dlsym ] dip gc-map-here ;
M: x86.32 %begin-callback ( -- )
M: x86.32 %begin-callback
0 save-vm-ptr
4 stack@ 0 MOV
"begin_callback" f f %c-invoke ;
M: x86.32 %end-callback ( -- )
M: x86.32 %end-callback
0 save-vm-ptr
"end_callback" f f %c-invoke ;
@ -192,7 +192,7 @@ M: x86.32 %end-callback ( -- )
! MINGW ABI incompatibility disaster
[ large-struct? ] [ mingw eq? os windows? not or ] bi* and ;
M: x86.32 %prepare-var-args ( reg-inputs -- ) drop ;
M: x86.32 %prepare-var-args drop ;
M:: x86.32 stack-cleanup ( stack-size return abi -- n )
! a) Functions which are stdcall/fastcall/thiscall have to
@ -205,7 +205,7 @@ M:: x86.32 stack-cleanup ( stack-size return abi -- n )
[ 0 ]
} cond ;
M: x86.32 %cleanup ( n -- )
M: x86.32 %cleanup
[ ESP swap SUB ] unless-zero ;
M: x86.32 %safepoint
@ -224,7 +224,7 @@ M: x86.32 flatten-struct-type
M: x86.32 struct-return-on-stack? os linux? not ;
M: x86.32 (cpuid) ( eax ecx regs -- )
M: x86.32 (cpuid)
void { uint uint void* } cdecl [
! Save ds-reg, rs-reg
EDI PUSH

View File

@ -40,16 +40,16 @@ M: x86.64 machine-registers
: vm-reg ( -- reg ) R13 ; inline
: nv-reg ( -- reg ) RBX ; inline
M: x86.64 %vm-field ( dst offset -- )
M: x86.64 %vm-field
[ vm-reg ] dip [+] MOV ;
M:: x86.64 %load-vector ( dst val rep -- )
dst 0 [RIP+] rep copy-memory* val rc-relative rel-binary-literal ;
M: x86.64 %set-vm-field ( src offset -- )
M: x86.64 %set-vm-field
[ vm-reg ] dip [+] swap MOV ;
M: x86.64 %vm-field-ptr ( dst offset -- )
M: x86.64 %vm-field-ptr
[ vm-reg ] dip [+] LEA ;
M: x86.64 %prepare-jump
@ -83,7 +83,7 @@ M:: x86.64 %load-reg-param ( vreg rep reg -- )
M:: x86.64 %store-reg-param ( vreg rep reg -- )
reg vreg rep %copy ;
M: x86.64 %discard-reg-param ( rep reg -- )
M: x86.64 %discard-reg-param
2drop ;
M:: x86.64 %unbox ( dst src func rep -- )
@ -102,12 +102,12 @@ M: x86.64 %c-invoke
[ R11 0 MOV rc-absolute-cell rel-dlsym R11 CALL ] dip
gc-map-here ;
M: x86.64 %begin-callback ( -- )
M: x86.64 %begin-callback
param-reg-0 vm-reg MOV
param-reg-1 0 MOV
"begin_callback" f f %c-invoke ;
M: x86.64 %end-callback ( -- )
M: x86.64 %end-callback
param-reg-0 vm-reg MOV
"end_callback" f f %c-invoke ;
@ -122,7 +122,7 @@ M: x86.64 long-long-on-stack? f ;
M: x86.64 struct-return-on-stack? f ;
M: x86.64 (cpuid) ( rax rcx regs -- )
M: x86.64 (cpuid)
void { uint uint void* } cdecl [
RAX param-reg-0 MOV
RCX param-reg-1 MOV

View File

@ -2,8 +2,8 @@
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types arrays assocs
compiler.cfg.builder.alien.boxing cpu.architecture cpu.x86
cpu.x86.assembler cpu.x86.assembler.operands kernel layouts make math
math.order sequences splitting system ;
cpu.x86.assembler cpu.x86.assembler.operands kernel layouts locals
make math math.order namespaces sequences splitting system ;
IN: cpu.x86.64.unix
M: x86.64 param-regs
@ -24,18 +24,28 @@ M: x86.64 reserved-stack-space 0 ;
[ 8 mod zero? [ t , ] when , ] assoc-each
] { } make { t } split harvest ;
: flatten-small-struct ( c-type -- seq )
struct-types&offset split-struct [
:: flatten-small-struct ( c-type -- seq )
c-type struct-types&offset split-struct [
[ lookup-c-type c-type-rep reg-class-of ] map
int-regs swap member? int-rep double-rep ?
f f 3array
] map ;
] map :> reps
int-reg-reps get float-reg-reps get and [
reps reg-reps :> ( int-mems float-mems )
int-reg-reps get int-mems + 6 >
float-reg-reps get float-mems + 8 > or [
reps [ first t f 3array ] map
] [ reps ] if
] [ reps ] if ;
M: x86.64 flatten-struct-type ( c-type -- seq )
M: x86.64 flatten-struct-type
dup heap-size 16 <=
[ flatten-small-struct ] [ call-next-method [ first t f 3array ] map ] if ;
[ flatten-small-struct record-reg-reps ] [
call-next-method unrecord-reg-reps
[ first t f 3array ] map
] if ;
M: x86.64 return-struct-in-registers? ( c-type -- ? )
M: x86.64 return-struct-in-registers?
heap-size 2 cells <= ;
M: x86.64 dummy-stack-params? f ;
@ -44,6 +54,6 @@ M: x86.64 dummy-int-params? f ;
M: x86.64 dummy-fp-params? f ;
M: x86.64 %prepare-var-args ( reg-inputs -- )
M: x86.64 %prepare-var-args
[ second reg-class-of float-regs? ] count 8 min
[ EAX EAX XOR ] [ <byte> AL swap MOV ] if-zero ;

View File

@ -13,7 +13,7 @@ M: x86.64 param-regs
M: x86.64 reserved-stack-space 4 cells ;
M: x86.64 return-struct-in-registers? ( c-type -- ? )
M: x86.64 return-struct-in-registers?
heap-size { 1 2 4 8 } member? ;
M: x86.64 value-struct? heap-size { 1 2 4 8 } member? ;
@ -24,5 +24,4 @@ M: x86.64 dummy-int-params? t ;
M: x86.64 dummy-fp-params? t ;
M: x86.64 %prepare-var-args ( reg-inputs -- )
drop ;
M: x86.64 %prepare-var-args drop ;

View File

@ -338,7 +338,7 @@ M: immediate SBB { 0b011 t 0x80 } immediate-1/4 ;
M: operand SBB 0o030 2-operand ;
GENERIC: AND ( dst src -- )
M: immediate AND ( dst src -- )
M: immediate AND
maybe-zero-extend { 0b100 t 0x80 } immediate-1/4 ;
M: operand AND 0o040 2-operand ;
@ -357,13 +357,11 @@ M: immediate XOR { 0b110 t 0x80 } immediate-1/4 ;
M: operand XOR 0o060 2-operand ;
GENERIC: CMP ( dst src -- )
M: immediate CMP ( dst src -- )
{ 0b111 t 0x80 } immediate-1/4 ;
M: immediate CMP { 0b111 t 0x80 } immediate-1/4 ;
M: operand CMP 0o070 2-operand ;
GENERIC: TEST ( dst src -- )
M: immediate TEST ( dst src -- )
maybe-zero-extend { 0b0 t 0xf7 } immediate-4 ;
M: immediate TEST maybe-zero-extend { 0b0 t 0xf7 } immediate-4 ;
M: operand TEST 0o204 2-operand ;
: XCHG ( dst src -- ) 0o207 2-operand ;
@ -371,20 +369,20 @@ M: operand TEST 0o204 2-operand ;
: BSR ( dst src -- ) { 0x0f 0xbd } (2-operand) ;
GENERIC: BT ( value n -- )
M: immediate BT ( value n -- ) { 0b100 t { 0x0f 0xba } } immediate-1* ;
M: operand BT ( value n -- ) swap { 0x0f 0xa3 } (2-operand) ;
M: immediate BT { 0b100 t { 0x0f 0xba } } immediate-1* ;
M: operand BT swap { 0x0f 0xa3 } (2-operand) ;
GENERIC: BTC ( value n -- )
M: immediate BTC ( value n -- ) { 0b111 t { 0x0f 0xba } } immediate-1* ;
M: operand BTC ( value n -- ) swap { 0x0f 0xbb } (2-operand) ;
M: immediate BTC { 0b111 t { 0x0f 0xba } } immediate-1* ;
M: operand BTC swap { 0x0f 0xbb } (2-operand) ;
GENERIC: BTR ( value n -- )
M: immediate BTR ( value n -- ) { 0b110 t { 0x0f 0xba } } immediate-1* ;
M: operand BTR ( value n -- ) swap { 0x0f 0xb3 } (2-operand) ;
M: immediate BTR { 0b110 t { 0x0f 0xba } } immediate-1* ;
M: operand BTR swap { 0x0f 0xb3 } (2-operand) ;
GENERIC: BTS ( value n -- )
M: immediate BTS ( value n -- ) { 0b101 t { 0x0f 0xba } } immediate-1* ;
M: operand BTS ( value n -- ) swap { 0x0f 0xab } (2-operand) ;
M: immediate BTS { 0b101 t { 0x0f 0xba } } immediate-1* ;
M: operand BTS swap { 0x0f 0xab } (2-operand) ;
: NOT ( dst -- ) { 0b010 t 0xf7 } 1-operand ;
: NEG ( dst -- ) { 0b011 t 0xf7 } 1-operand ;

View File

@ -3,9 +3,9 @@ IN: cpu.x86.assembler.operands
HELP: indirect
{ $class-description "Tuple that represents an indirect addressing operand. It has the following slots:"
{ $table
{ { $slot "index" } { "Register for the index value. It must not be " { $link ESP } " or " { $link RSP } "." } }
{ { $slot "displacement" } { "An integer offset." } }
{ $slots
{ "index" { "Register for the index value. It must not be " { $link ESP } " or " { $link RSP } "." } }
{ "displacement" { "An integer offset." } }
}
} ;

View File

@ -35,16 +35,16 @@ M: x86 integer-float-needs-stack-frame? f ;
M: x86 %integer>float [ drop dup XORPS ] [ CVTSI2SD ] 2bi ;
M: x86 %float>integer CVTTSD2SI ;
M: x86 %compare-float-ordered ( dst src1 src2 cc temp -- )
M: x86 %compare-float-ordered
[ COMISD ] (%compare-float) ;
M: x86 %compare-float-unordered ( dst src1 src2 cc temp -- )
M: x86 %compare-float-unordered
[ UCOMISD ] (%compare-float) ;
M: x86 %compare-float-ordered-branch ( label src1 src2 cc -- )
M: x86 %compare-float-ordered-branch
[ COMISD ] (%compare-float-branch) ;
M: x86 %compare-float-unordered-branch ( label src1 src2 cc -- )
M: x86 %compare-float-unordered-branch
[ UCOMISD ] (%compare-float-branch) ;
! SIMD
@ -262,7 +262,7 @@ M: x86 %shuffle-vector-halves-imm-reps
{ sse2? { double-2-rep } }
} available-reps ;
M: x86 %shuffle-vector ( dst src shuffle rep -- )
M: x86 %shuffle-vector
two-operand PSHUFB ;
M: x86 %shuffle-vector-reps
@ -331,14 +331,14 @@ M: x86 %unsigned-pack-vector-reps
{ sse4.1? { int-4-rep } }
} available-reps ;
M: x86 %tail>head-vector ( dst src rep -- )
M: x86 %tail>head-vector
dup {
{ float-4-rep [ drop UNPCKHPD ] }
{ double-2-rep [ drop UNPCKHPD ] }
[ drop [ %copy ] [ drop PUNPCKHQDQ ] 3bi ]
} case ;
M: x86 %unpack-vector-head ( dst src rep -- )
M: x86 %unpack-vector-head
{
{ char-16-rep [ PMOVSXBW ] }
{ uchar-16-rep [ PMOVZXBW ] }
@ -349,13 +349,13 @@ M: x86 %unpack-vector-head ( dst src rep -- )
{ float-4-rep [ CVTPS2PD ] }
} case ;
M: x86 %unpack-vector-head-reps ( -- reps )
M: x86 %unpack-vector-head-reps
{
{ sse2? { float-4-rep } }
{ sse4.1? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep } }
} available-reps ;
M: x86 %integer>float-vector ( dst src rep -- )
M: x86 %integer>float-vector
{
{ int-4-rep [ CVTDQ2PS ] }
} case ;
@ -365,7 +365,7 @@ M: x86 %integer>float-vector-reps
{ sse2? { int-4-rep } }
} available-reps ;
M: x86 %float>integer-vector ( dst src rep -- )
M: x86 %float>integer-vector
{
{ float-4-rep [ CVTTPS2DQ ] }
} case ;
@ -405,7 +405,7 @@ M: x86 %float>integer-vector-reps
{ cc> [ [ PCMPGTQ ] [ PCMPGTD ] [ PCMPGTW ] [ PCMPGTB ] (%compare-int-vector) ] }
} case ;
M: x86 %compare-vector ( dst src1 src2 rep cc -- )
M: x86 %compare-vector
[ [ two-operand ] keep ] dip
over float-vector-rep?
[ %compare-float-vector ]
@ -481,7 +481,7 @@ M: x86 %compare-vector-ccs
[ drop PMOVMSKB 0xffff ]
} case ;
M: x86 %move-vector-mask ( dst src rep -- )
M: x86 %move-vector-mask
(%move-vector-mask) drop ;
M: x86 %move-vector-mask-reps
@ -512,7 +512,7 @@ M: x86 %test-vector-reps
{ sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
} available-reps ;
M: x86 %add-vector ( dst src1 src2 rep -- )
M: x86 %add-vector
[ two-operand ] keep
{
{ float-4-rep [ ADDPS ] }
@ -533,7 +533,7 @@ M: x86 %add-vector-reps
{ sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
} available-reps ;
M: x86 %saturated-add-vector ( dst src1 src2 rep -- )
M: x86 %saturated-add-vector
[ two-operand ] keep
{
{ char-16-rep [ PADDSB ] }
@ -547,7 +547,7 @@ M: x86 %saturated-add-vector-reps
{ sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep } }
} available-reps ;
M: x86 %add-sub-vector ( dst src1 src2 rep -- )
M: x86 %add-sub-vector
[ two-operand ] keep
{
{ float-4-rep [ ADDSUBPS ] }
@ -559,7 +559,7 @@ M: x86 %add-sub-vector-reps
{ sse3? { float-4-rep double-2-rep } }
} available-reps ;
M: x86 %sub-vector ( dst src1 src2 rep -- )
M: x86 %sub-vector
[ two-operand ] keep
{
{ float-4-rep [ SUBPS ] }
@ -580,7 +580,7 @@ M: x86 %sub-vector-reps
{ sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
} available-reps ;
M: x86 %saturated-sub-vector ( dst src1 src2 rep -- )
M: x86 %saturated-sub-vector
[ two-operand ] keep
{
{ char-16-rep [ PSUBSB ] }
@ -594,7 +594,7 @@ M: x86 %saturated-sub-vector-reps
{ sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep } }
} available-reps ;
M: x86 %mul-vector ( dst src1 src2 rep -- )
M: x86 %mul-vector
[ two-operand ] keep
{
{ float-4-rep [ MULPS ] }
@ -612,7 +612,7 @@ M: x86 %mul-vector-reps
{ sse4.1? { int-4-rep uint-4-rep } }
} available-reps ;
M: x86 %mul-high-vector ( dst src1 src2 rep -- )
M: x86 %mul-high-vector
[ two-operand ] keep
{
{ short-8-rep [ PMULHW ] }
@ -624,7 +624,7 @@ M: x86 %mul-high-vector-reps
{ sse2? { short-8-rep ushort-8-rep } }
} available-reps ;
M: x86 %mul-horizontal-add-vector ( dst src1 src2 rep -- )
M: x86 %mul-horizontal-add-vector
[ two-operand ] keep
{
{ char-16-rep [ PMADDUBSW ] }
@ -638,7 +638,7 @@ M: x86 %mul-horizontal-add-vector-reps
{ ssse3? { char-16-rep uchar-16-rep } }
} available-reps ;
M: x86 %div-vector ( dst src1 src2 rep -- )
M: x86 %div-vector
[ two-operand ] keep
{
{ float-4-rep [ DIVPS ] }
@ -651,7 +651,7 @@ M: x86 %div-vector-reps
{ sse2? { double-2-rep } }
} available-reps ;
M: x86 %min-vector ( dst src1 src2 rep -- )
M: x86 %min-vector
[ two-operand ] keep
{
{ char-16-rep [ PMINSB ] }
@ -671,7 +671,7 @@ M: x86 %min-vector-reps
{ sse4.1? { char-16-rep ushort-8-rep int-4-rep uint-4-rep } }
} available-reps ;
M: x86 %max-vector ( dst src1 src2 rep -- )
M: x86 %max-vector
[ two-operand ] keep
{
{ char-16-rep [ PMAXSB ] }
@ -691,7 +691,7 @@ M: x86 %max-vector-reps
{ sse4.1? { char-16-rep ushort-8-rep int-4-rep uint-4-rep } }
} available-reps ;
M: x86 %avg-vector ( dst src1 src2 rep -- )
M: x86 %avg-vector
[ two-operand ] keep
{
{ uchar-16-rep [ PAVGB ] }
@ -726,7 +726,7 @@ M: x86 %sad-vector-reps
{ sse2? { uchar-16-rep } }
} available-reps ;
M: x86 %horizontal-add-vector ( dst src1 src2 rep -- )
M: x86 %horizontal-add-vector
[ two-operand ] keep
signed-rep {
{ float-4-rep [ HADDPS ] }
@ -741,7 +741,7 @@ M: x86 %horizontal-add-vector-reps
{ ssse3? { int-4-rep uint-4-rep short-8-rep ushort-8-rep } }
} available-reps ;
M: x86 %horizontal-shl-vector-imm ( dst src1 src2 rep -- )
M: x86 %horizontal-shl-vector-imm
two-operand PSLLDQ ;
M: x86 %horizontal-shl-vector-imm-reps
@ -749,7 +749,7 @@ M: x86 %horizontal-shl-vector-imm-reps
{ sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep float-4-rep double-2-rep } }
} available-reps ;
M: x86 %horizontal-shr-vector-imm ( dst src1 src2 rep -- )
M: x86 %horizontal-shr-vector-imm
two-operand PSRLDQ ;
M: x86 %horizontal-shr-vector-imm-reps
@ -757,7 +757,7 @@ M: x86 %horizontal-shr-vector-imm-reps
{ sse2? { char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep float-4-rep double-2-rep } }
} available-reps ;
M: x86 %abs-vector ( dst src rep -- )
M: x86 %abs-vector
{
{ char-16-rep [ PABSB ] }
{ short-8-rep [ PABSW ] }
@ -769,7 +769,7 @@ M: x86 %abs-vector-reps
{ ssse3? { char-16-rep short-8-rep int-4-rep } }
} available-reps ;
M: x86 %sqrt-vector ( dst src rep -- )
M: x86 %sqrt-vector
{
{ float-4-rep [ SQRTPS ] }
{ double-2-rep [ SQRTPD ] }
@ -781,7 +781,7 @@ M: x86 %sqrt-vector-reps
{ sse2? { double-2-rep } }
} available-reps ;
M: x86 %and-vector ( dst src1 src2 rep -- )
M: x86 %and-vector
[ two-operand ] keep
{
{ float-4-rep [ ANDPS ] }
@ -795,7 +795,7 @@ M: x86 %and-vector-reps
{ sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
} available-reps ;
M: x86 %andn-vector ( dst src1 src2 rep -- )
M: x86 %andn-vector
[ two-operand ] keep
{
{ float-4-rep [ ANDNPS ] }
@ -809,7 +809,7 @@ M: x86 %andn-vector-reps
{ sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
} available-reps ;
M: x86 %or-vector ( dst src1 src2 rep -- )
M: x86 %or-vector
[ two-operand ] keep
{
{ float-4-rep [ ORPS ] }
@ -823,7 +823,7 @@ M: x86 %or-vector-reps
{ sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
} available-reps ;
M: x86 %xor-vector ( dst src1 src2 rep -- )
M: x86 %xor-vector
[ two-operand ] keep
{
{ float-4-rep [ XORPS ] }
@ -837,7 +837,7 @@ M: x86 %xor-vector-reps
{ sse2? { double-2-rep char-16-rep uchar-16-rep short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
} available-reps ;
M: x86 %shl-vector ( dst src1 src2 rep -- )
M: x86 %shl-vector
[ two-operand ] keep
{
{ short-8-rep [ PSLLW ] }
@ -853,7 +853,7 @@ M: x86 %shl-vector-reps
{ sse2? { short-8-rep ushort-8-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } }
} available-reps ;
M: x86 %shr-vector ( dst src1 src2 rep -- )
M: x86 %shr-vector
[ two-operand ] keep
{
{ short-8-rep [ PSRAW ] }
@ -911,9 +911,9 @@ M: x86 %integer>scalar drop MOVD ;
] }
} case ;
M: x86.32 %scalar>integer ( dst src rep -- ) %scalar>integer-32 ;
M: x86.32 %scalar>integer %scalar>integer-32 ;
M: x86.64 %scalar>integer ( dst src rep -- )
M: x86.64 %scalar>integer
{
{ longlong-scalar-rep [ MOVD ] }
{ ulonglong-scalar-rep [ MOVD ] }

View File

@ -46,7 +46,7 @@ HOOK: pic-tail-reg cpu ( -- reg )
: align-stack ( n -- n' ) 16 align ;
M: x86 stack-frame-size ( stack-frame -- i )
M: x86 stack-frame-size
(stack-frame-size)
reserved-stack-space +
cell +
@ -60,7 +60,7 @@ M: x86 test-instruction? t ;
M: x86 immediate-store? immediate-comparand? ;
M: x86 %load-immediate ( reg val -- )
M: x86 %load-immediate
{ fixnum } declare [ 32-bit-version-of dup XOR ] [ MOV ] if-zero ;
M: x86 %load-reference
@ -90,13 +90,13 @@ M: x86 %replace-imm
[ [ 0 MOV ] dip rc-absolute rel-literal ]
} cond ;
M: x86 %clear ( loc -- )
M: x86 %clear
297 swap %replace-imm ;
M: x86 %inc ( loc -- )
M: x86 %inc
[ n>> ] [ ds-loc? ds-reg rs-reg ? ] bi (%inc) ;
M: x86 %call ( word -- ) 0 CALL rc-relative rel-word-pic ;
M: x86 %call 0 CALL rc-relative rel-word-pic ;
: xt-tail-pic-offset ( -- n )
! See the comment in vm/cpu-x86.hpp
@ -104,21 +104,21 @@ M: x86 %call ( word -- ) 0 CALL rc-relative rel-word-pic ;
HOOK: %prepare-jump cpu ( -- )
M: x86 %jump ( word -- )
M: x86 %jump
%prepare-jump
0 JMP rc-relative rel-word-pic-tail ;
M: x86 %jump-label ( label -- ) 0 JMP rc-relative label-fixup ;
M: x86 %jump-label 0 JMP rc-relative label-fixup ;
M: x86 %return ( -- ) 0 RET ;
M: x86 %return 0 RET ;
: (%slot) ( obj slot scale tag -- op ) neg <indirect> ; inline
: (%slot-imm) ( obj slot tag -- op ) slot-offset [+] ; inline
M: x86 %slot ( dst obj slot scale tag -- ) (%slot) MOV ;
M: x86 %slot-imm ( dst obj slot tag -- ) (%slot-imm) MOV ;
M: x86 %set-slot ( src obj slot scale tag -- ) (%slot) swap MOV ;
M: x86 %set-slot-imm ( src obj slot tag -- ) (%slot-imm) swap MOV ;
M: x86 %slot (%slot) MOV ;
M: x86 %slot-imm (%slot-imm) MOV ;
M: x86 %set-slot (%slot) swap MOV ;
M: x86 %set-slot-imm (%slot-imm) swap MOV ;
:: two-operand ( dst src1 src2 rep -- dst src )
dst src2 eq? dst src1 eq? not and [ "Cannot handle this case" throw ] when
@ -130,13 +130,13 @@ M: x86 %set-slot-imm ( src obj slot tag -- ) (%slot-imm) swap MOV ;
dst ; inline
M: x86 %add 2over eq? [ nip ADD ] [ [+] LEA ] if ;
M: x86 %add-imm ( dst src1 src2 -- )
M: x86 %add-imm
2over eq? [
nip { { 1 [ INC ] } { -1 [ DEC ] } [ ADD ] } case
] [ [+] LEA ] if ;
M: x86 %sub int-rep two-operand SUB ;
M: x86 %sub-imm ( dst src1 src2 -- )
M: x86 %sub-imm
2over eq? [
nip { { 1 [ DEC ] } { -1 [ INC ] } [ SUB ] } case
] [ neg [+] LEA ] if ;
@ -173,7 +173,7 @@ M: object copy-memory* copy-register* ;
: ?spill-slot ( obj -- obj ) dup spill-slot? [ n>> spill@ ] when ;
M: x86 %copy ( dst src rep -- )
M: x86 %copy
2over eq? [ 3drop ] [
[ [ ?spill-slot ] bi@ ] dip
2over [ register? ] both? [ copy-register* ] [ copy-memory* ] if
@ -186,16 +186,16 @@ M: x86 %copy ( dst src rep -- )
{ cc/o [ JNO ] }
} case ; inline
M: x86 %fixnum-add ( label dst src1 src2 cc -- )
M: x86 %fixnum-add
[ ADD ] fixnum-overflow ;
M: x86 %fixnum-sub ( label dst src1 src2 cc -- )
M: x86 %fixnum-sub
[ SUB ] fixnum-overflow ;
M: x86 %fixnum-mul ( label dst src1 src2 cc -- )
M: x86 %fixnum-mul
[ IMUL2 ] fixnum-overflow ;
M: x86 %unbox-alien ( dst src -- )
M: x86 %unbox-alien
alien-offset [+] MOV ;
M:: x86 %unbox-any-c-ptr ( dst src -- )
@ -364,7 +364,7 @@ M: x86.64 has-small-reg? 2drop t ;
: %sign-extend ( dst src bits -- )
[ MOVSX ] (%convert-integer) ; inline
M: x86 %convert-integer ( dst src c-type -- )
M: x86 %convert-integer
{
{ c:char [ 8 %sign-extend ] }
{ c:uchar [ 8 %zero-extend ] }
@ -411,10 +411,10 @@ M: x86 %convert-integer ( dst src c-type -- )
} case
] [ nipd %copy ] ?if ;
M: x86 %load-memory ( dst base displacement scale offset rep c-type -- )
M: x86 %load-memory
(%memory) (%load-memory) ;
M: x86 %load-memory-imm ( dst base offset rep c-type -- )
M: x86 %load-memory-imm
(%memory-imm) (%load-memory) ;
: (%store-memory) ( src exclude address rep c-type -- )
@ -429,10 +429,10 @@ M: x86 %load-memory-imm ( dst base offset rep c-type -- )
} case
] [ [ nip swap ] dip %copy ] ?if ;
M: x86 %store-memory ( src base displacement scale offset rep c-type -- )
M: x86 %store-memory
(%memory) (%store-memory) ;
M: x86 %store-memory-imm ( src base offset rep c-type -- )
M: x86 %store-memory-imm
(%memory-imm) (%store-memory) ;
: shift-count? ( reg -- ? ) { ECX RCX } member-eq? ;
@ -510,16 +510,16 @@ M:: x86 %check-nursery-branch ( label size cc temp1 temp2 -- )
M: x86 gc-root-offset
n>> spill-offset special-offset cell + cell /i ;
M: x86 %call-gc ( gc-map -- )
M: x86 %call-gc
\ minor-gc %call
gc-map-here ;
M: x86 %alien-global ( dst symbol library -- )
M: x86 %alien-global
[ 0 MOV ] 2dip rc-absolute-cell rel-dlsym ;
M: x86 %prologue ( n -- ) cell - decr-stack-reg ;
M: x86 %prologue cell - decr-stack-reg ;
M: x86 %epilogue ( n -- ) cell - incr-stack-reg ;
M: x86 %epilogue cell - incr-stack-reg ;
:: (%boolean) ( dst temp insn -- )
dst \ f type-number MOV
@ -610,10 +610,10 @@ M:: x86 %dispatch ( src temp -- )
[ (align-code) ]
bi ;
M: x86 %spill ( src rep dst -- )
M: x86 %spill
-rot %copy ;
M: x86 %reload ( dst rep src -- )
M: x86 %reload
swap %copy ;
M:: x86 %local-allot ( dst size align offset -- )
@ -661,10 +661,7 @@ M:: x86 %alien-assembly ( varargs? reg-inputs stack-inputs
reg-outputs [ first3 %load-reg-param ] each
dead-outputs [ first2 %discard-reg-param ] each ;
M: x86 %alien-invoke ( varargs? reg-inputs stack-inputs
reg-outputs dead-outputs
cleanup stack-size
symbols dll gc-map -- )
M: x86 %alien-invoke
'[ _ _ _ %c-invoke ] %alien-assembly ;
M:: x86 %alien-indirect ( src
@ -681,14 +678,14 @@ M:: x86 %alien-indirect ( src
HOOK: %begin-callback cpu ( -- )
M: x86 %callback-inputs ( reg-outputs stack-outputs -- )
M: x86 %callback-inputs
[ [ first3 %load-reg-param ] each ]
[ [ first3 %load-stack-param ] each ] bi*
%begin-callback ;
HOOK: %end-callback cpu ( -- )
M: x86 %callback-outputs ( reg-inputs -- )
M: x86 %callback-outputs
%end-callback
[ first3 %store-reg-param ] each ;
@ -708,10 +705,10 @@ M: x86 long-long-odd-register? f ;
M: x86 float-right-align-on-stack? f ;
M: x86 immediate-arithmetic? ( n -- ? )
M: x86 immediate-arithmetic?
-0x80000000 0x7fffffff between? ;
M: x86 immediate-bitwise? ( n -- ? )
M: x86 immediate-bitwise?
-0x80000000 0x7fffffff between? ;
:: %cmov-float= ( dst src -- )
@ -778,7 +775,7 @@ M:: x86 %bit-test ( dst src1 src2 temp -- )
src1 src2 BT
dst temp \ CMOVB (%boolean) ;
M: x86 enable-cpu-features ( -- )
M: x86 enable-cpu-features
enable-min/max
enable-log2
enable-bit-test

View File

@ -86,14 +86,14 @@ M:: x86 %float>integer ( dst src -- )
src2 shuffle-down quot call
ST0 FSTP ; inline
M: x86 %compare-float-ordered ( dst src1 src2 cc temp -- )
M: x86 %compare-float-ordered
[ [ FCOMI ] compare-op ] (%compare-float) ;
M: x86 %compare-float-unordered ( dst src1 src2 cc temp -- )
M: x86 %compare-float-unordered
[ [ FUCOMI ] compare-op ] (%compare-float) ;
M: x86 %compare-float-ordered-branch ( label src1 src2 cc -- )
M: x86 %compare-float-ordered-branch
[ [ FCOMI ] compare-op ] (%compare-float-branch) ;
M: x86 %compare-float-unordered-branch ( label src1 src2 cc -- )
M: x86 %compare-float-unordered-branch
[ [ FUCOMI ] compare-op ] (%compare-float-branch) ;

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: classes kernel help.markup help.syntax sequences
alien assocs strings math quotations db.private ;
USING: alien assocs classes db.private help.markup help.syntax
kernel math quotations sequences strings ;
IN: db
HELP: db-connection

View File

@ -1,8 +1,7 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays assocs classes continuations destructors kernel math
namespaces sequences classes.tuple words strings
tools.walker accessors combinators fry db.errors ;
USING: accessors assocs continuations destructors fry kernel
namespaces sequences strings ;
IN: db
TUPLE: db-connection
@ -27,7 +26,7 @@ HOOK: parse-db-error db-connection ( error -- error' )
: dispose-statements ( assoc -- ) values dispose-each ;
M: db-connection dispose ( db-connection -- )
M: db-connection dispose
dup db-connection [
[ dispose-statements H{ } clone ] change-insert-statements
[ dispose-statements H{ } clone ] change-update-statements
@ -77,7 +76,7 @@ GENERIC: bind-tuple ( tuple statement -- )
GENERIC: execute-statement* ( statement type -- )
M: object execute-statement* ( statement type -- )
M: object execute-statement*
'[
_ _ drop query-results dispose
] [
@ -139,9 +138,9 @@ HOOK: begin-transaction db-connection ( -- )
HOOK: commit-transaction db-connection ( -- )
HOOK: rollback-transaction db-connection ( -- )
M: db-connection begin-transaction ( -- ) "BEGIN" sql-command ;
M: db-connection commit-transaction ( -- ) "COMMIT" sql-command ;
M: db-connection rollback-transaction ( -- ) "ROLLBACK" sql-command ;
M: db-connection begin-transaction "BEGIN" sql-command ;
M: db-connection commit-transaction "COMMIT" sql-command ;
M: db-connection rollback-transaction "ROLLBACK" sql-command ;
: in-transaction? ( -- ? ) in-transaction get ;

Some files were not shown because too many files have changed in this diff Show More