Commit Graph

3338 Commits (20046a08a7b172830df4220ab1fea8bb557b2b8f)

Author SHA1 Message Date
Joe Groff 78d23ce6a0 io: implement stream protocols on f
Fixes deployed applications that write to output-stream
2011-11-28 20:36:34 -08:00
Joe Groff 16e510bc76 namespaces: rework so a singleton isn't necessary
Make global foldable, and make the underlying global object a hashtable wrapper. Also, use a tuple instead of a generic array for the global box type.
2011-11-28 18:25:27 -08:00
Joe Groff a1b730e867 namespaces: make set-global/get-global foldable
Store the globals hashtable as an array of boxes so that the key-to-reference mapping is constant. Use a singleton and an unfoldable "box-at" word so that get-global and set-global optimize to direct operations on the associated box when the variable name is a compile-time constant. Fixes #200.
2011-11-28 18:25:27 -08:00
Doug Coleman 2b87eaa1b5 generalizations: Refactor stack-checker so that smart combinators can be used with curry and compose. 2011-11-27 20:25:22 -08:00
Joe Groff 7ac7adeb67 syntax: add note to #! docs 2011-11-27 15:03:40 -08:00
Joe Groff 2cf8b32bda lexer: skip #! as a single token at front of line
Fixes #370
2011-11-27 14:59:54 -08:00
Joe Groff 1d9838aa57 io.files: back out resource-path change
It's too brittle against varying current directories or the Factor directory being moved.
2011-11-27 12:37:58 -08:00
Joe Groff 88c9483343 io.files: use initialize to set resource-path
If a resource path is already set in the image, don't change it. Should make #364 work a bit more as expected, and let us set the resource path for deployed Mac OS X bundles.
2011-11-27 12:37:58 -08:00
Joe Groff 98fc1e28bd math.integers: make bignum/f round to even on tie
Fixes #372
2011-11-26 17:44:29 -08:00
Joe Groff 0f5b551790 math.integers: pass tests even if number-base set 2011-11-26 17:37:17 -08:00
Joe Groff 269fe9ea1a math.integers: test round-to-even-on-tie behavior 2011-11-26 16:03:43 -08:00
Joe Groff 90f34d092c math: neg? needs to be defined for all reals 2011-11-26 15:37:58 -08:00
Joe Groff a97a9ede15 math.parser: don't accept hex float without expt
Part of #372
2011-11-26 15:15:46 -08:00
Joe Groff e58afa8ab5 oops, radix prefixes shouldn't chain 2011-11-24 12:39:52 -08:00
Joe Groff fa979425f3 math.parser: test harder 2011-11-24 12:34:50 -08:00
Joe Groff 14efcc69ab math.parser: reject "0x" etc. without any digits 2011-11-24 12:27:40 -08:00
Joe Groff 0b45465722 parser: remove parse-base dead code 2011-11-23 22:33:31 -08:00
Joe Groff 07abeee9d9 syntax: remove BIN: HEX: OCT: 2011-11-23 20:07:33 -08:00
Joe Groff 4b6559849f math.parser: oops 2011-11-23 19:51:15 -08:00
Joe Groff 4e8a1d0bb4 math: add neg? word
Do the right thing with integers or floats
2011-11-23 19:51:05 -08:00
Joe Groff 72de75b881 let's pretend BIN: HEX: OCT: never happened 2011-11-23 19:22:37 -08:00
Joe Groff 943596575a use radix literals 2011-11-23 19:03:40 -08:00
Joe Groff e738c7206c math.parser: natively support 0b 0o 0x syntax
Closes #371
2011-11-23 18:30:22 -08:00
Doug Coleman 64bbd248d5 classes.maybe: Change the type of maybe's class slot. As a result, maybe: maybe: integer is valid now, so fix the unit tests and its prettyprinting. 2011-11-23 01:43:02 -08:00
Doug Coleman 0700dca792 classes.maybe: make maybe's slot type a classoid so you can do maybe: union{ }. Fix prettyprinting of anonymous-union/intersection. Fixes #427, fixes #428. 2011-11-23 01:19:09 -08:00
Doug Coleman f90bc5cdb6 classes: optimize instance? for classoids 2011-11-22 20:38:07 -08:00
Doug Coleman 82c5388f68 classes: add syntax for intersection{ and union{ anonymous classes. make classoid a mixin. 2011-11-22 18:49:42 -08:00
Doug Coleman cab0369fec classes: Make methods dispatch on maybes. Fix a couple bugs in the implementation of maybe. classoid? is now a dumb test if an object could be a well-formed classoid; valid-classoid? tests for well-formedness. Move maybe tests. Make pprint* work better on methods. 2011-11-22 15:12:20 -08:00
Doug Coleman fac17c10ba classes.maybe: move maybe definition from classes.union to classes.maybe 2011-11-22 02:46:36 -08:00
Doug Coleman 067f9830ef classes.union: Define a maybe: word that makes a tuple that acts as an anonymous union for a type and f. Updated all the places we define UNION: ?foo foo POSTPONE: f ;. Fixes #416 and lots of headaches. 2011-11-22 01:56:13 -08:00
Joe Groff 1d4660c7ec random: go faster
* Use int <ref> instead of 4 >le
* Inline sequences:push-all
* Types, hints, inlines
Re: #328
2011-11-15 20:45:16 -08:00
Joe Groff 34e77ec408 strings: inline >string and 1string
Fixes #340
2011-11-15 19:15:19 -08:00
Joe Groff 5a66b3b329 rearrange source-file-error error. to load earlier
Fixes #359
2011-11-15 18:26:35 -08:00
John Benediktsson 95d5daaa7d slots: fix initial value tests. 2011-11-14 10:26:08 -08:00
John Benediktsson 00280a52a4 assocs: 5-8% performance improvement to assoc>map. Fixes #69. 2011-11-12 17:02:33 -08:00
Slava Pestov 07ef058fb0 Fix bootstrap 2011-11-12 16:45:04 -08:00
Slava Pestov 29bc075bc7 hashtables: small cleanup 2011-11-12 15:35:51 -08:00
Slava Pestov 03d6665166 Fix ambiguity between 'initial: f' and no initial value in a slot spec. Fixes #382 2011-11-12 15:35:51 -08:00
Joe Groff e24400679f vm: more defense against multi-faulting
* Clear faulting_p from a safepoint rather than inside general_error, because jumping into unwind-native-frames could blow up.
* Handle multiple faults from fatal_error by breakpointing. Is there anything else we can safely do at that point?
* Verify memory protection faults in the top half of the signal handlers because signal dispatch could fault. Treat memory faults during gc or fep as fatal errors.
* Add a function factor_vm::abort() that restores the default SIGABRT handler and ::abort()s. Use it from fatal_error() so we get useful context from gdb and so the user gets feedback from the system crash reporter that Factor blew up and didn't just disappear.
* In factorbug(), don't proceed with .s .r .c if it would be unsafe to do so.
* Don't pile on signals if we've already called fatal_error().
2011-11-12 13:02:57 -08:00
Joe Groff 69f35b36aa math.parser: undo some inlining to shrink size
For #318.
2011-11-11 15:49:53 -08:00
John Benediktsson 7b28e60e0e hashtables: fix docs for new-key@, and note that quadratic probing is used now. 2011-11-10 16:20:59 -08:00
Joe Groff 3552ade9b1 bootstrap.primitives: remove counting "profiling" 2011-11-10 16:04:42 -08:00
Joe Groff c31530caec vm: strip out call-counting profiler
This makes the separate "code" and "entry_point" fields in word and quotation redundant, so also remove them to reclaim an additional cell per word and quotation object, which should help with #318.
2011-11-10 16:01:07 -08:00
John Benediktsson e29c4589c4 hashtables: allow re-using deleted tombstones. Fixes #381. 2011-11-10 13:05:51 -08:00
John Benediktsson 27b96452ee combinators: fix docs for case. 2011-11-10 11:20:28 -08:00
Joe Groff 47cedd8d3d slice boa -> <slice-unsafe>
If you didn't define it, don't boa it
2011-11-09 19:22:09 -08:00
Joe Groff 0cf0b91aad io: clean up some mess 2011-11-09 19:11:04 -08:00
Joe Groff b4947a62f6 io: fix each-block-slice typo 2011-11-09 18:06:58 -08:00
Joe Groff 4f4bbd3304 io: more hot-rodding for #376
* Change the interface of read-into to return a slice and an eof boolean separately so the compiler can optimize the slice.
* Add an each-stream-block-slice combinator that behaves like each-block but reuses a preallocated buffer for every iteration.
* Pull some strings in the stream-read-into implementation to further improve type propagation and bounds check elimination.
2011-11-09 17:22:01 -08:00
John Benediktsson 22e9109631 sequences: improve docs for map-sum. 2011-11-09 15:00:08 -08:00
Joe Groff 5a3537b90a io.files: add file-reader, file-writer mixins
This lets us do some trickery so that the stream-element-type propagates from <file-reader>/<file-writer>. For #376.
2011-11-09 14:43:39 -08:00
Joe Groff f31fb8a968 io:read: don't resize output buffer if unnecessary
Even with a short-circuit test in the VM primitives, resize still has an overly high runtime cost in tight loops. For #376.
2011-11-09 14:29:12 -08:00
Joe Groff ed24890dce io.backend.unix: init-signal-pipe function
Currently just reads off signal numbers and drops them.
2011-11-08 08:42:48 -08:00
Doug Coleman c731dc6edb Rename lookup to lookup-word. 2011-11-06 16:00:00 -08:00
Doug Coleman f6353e17cd Make the require-hook throw an error if the vocabulary does not exist in the dictionary or on disk. Move require docs to vocabs. Add unit tests for require. Fixes #339. 2011-11-03 11:39:34 -07:00
Joe Groff d28845a1ef vm: reserve some more special-objects
Need a jit-safepoint object to deal with #332, and ffi-signal-handler words for immediate signal handling during FFI calls
2011-11-02 22:16:08 -07:00
Doug Coleman 7699fb92b1 vocabs.loader: Fix spacing. Remove unit test. 2011-11-02 19:30:54 -07:00
Doug Coleman 1eed9203bb Rename (load-vocab) to (require), add tags.txt for "p" vocab loader test. Code formatting. 2011-11-02 18:07:22 -07:00
Joe Groff 8cf18d1a82 remove BSD,solaris,etc. misc platform support code 2011-11-02 17:13:51 -07:00
Doug Coleman a09a278981 Add a unit test vocabulary for vocabs.loadeer. 2011-11-02 16:47:53 -07:00
Doug Coleman fb44adef99 Clean up formatting, rename load-vocab-hook to require-hook. Add a unit test for vocabs.loader. 2011-11-02 16:31:42 -07:00
Joe Groff 6ac8478d80 sequences: relate max, min, supremum, infimum docs
Suggested by @yac. Closes #321.
2011-11-02 13:43:06 -07:00
Joe Groff 981862f35e Revert "syntax: make it so PRIMITIVE: verifies primitives"
This reverts commit 200ea70cffc4bdc74a97e4981442161f64cdbaa3.
2011-11-02 13:23:11 -07:00
Joe Groff a08ba5103a primitives: fix effect of (clear-samples) 2011-11-02 13:23:11 -07:00
Joe Groff 5b6fb25ffd add sampling profiler primitives for bootstrap 2011-11-02 13:23:10 -07:00
Joe Groff c0b26a2781 syntax: make it so PRIMITIVE: verifies primitives
It's a bit strange for disparate vocabs to reference words that get created out of thin air during bootstrap, so this lets there be some trace in the seeded vocab source that there was a word created there.
2011-11-02 13:23:09 -07:00
Joe Groff eac90675c0 move counting profiler to tools.profiler.counting 2011-11-02 13:23:09 -07:00
Joe Groff 33919b2919 tools.profiler: rename to tools.counting-profiler 2011-11-02 13:23:06 -07:00
Joe Groff 186bf65a00 constants for special object hardcoded literals 2011-11-02 12:54:50 -07:00
Doug Coleman 94db86a6db Make "foo.private" require load foo instead.
Move require from vocabs.loader to vocabs. Update everything.
Fixes #201.
2011-11-02 11:50:03 -07:00
Slava Pestov f827b74a11 Move definition of 't' from syntax to bootstrap/primitives to fix bootstrap, now that 't' really has to be a class early 2011-10-31 00:24:26 -07:00
Slava Pestov c14f0ef698 classes.union: unions of built-in types now have more efficient predicates. Fixes #292 2011-10-29 17:11:03 -07:00
Doug Coleman dc0a921866 Remove the lexer-factory because nothing uses it. Update usages. 2011-10-29 01:11:19 -07:00
Doug Coleman 53c6d08b54 Add a toggle word to namespaces and update docs, tests, and usages. Document with-global too. 2011-10-29 01:05:38 -07:00
Doug Coleman b43c069b81 Change prompt to something we can copy/paste back into the Factor repl. Add auto-use word. Fixes #301. 2011-10-29 01:05:38 -07:00
Doug Coleman aa7f22edc0 Cleanup vocab name validation. Vocab names and vocab prefixes are the same concept, and by disallowing slashes, spaces, and colon, we automatically check for absolute paths. Unit test this. 2011-10-29 01:05:37 -07:00
Joe Groff 1386212d23 vm: dispatch signal handlers through subprimitive
We also need to save C ABI volatile registers before calling the signal handler in order to be able to reliably resume. Add signal-handler and leaf-signal-handler subprimitives to preserve volatile registers before invoking the signal handler C function.
2011-10-27 21:18:18 -07:00
Doug Coleman 7b6f27eda6 Add a lint check for swap .. swap that can be replaced by dip. Clean up the cases it finds. 2011-10-26 13:01:04 -07:00
Doug Coleman 1882e3de3e Use dip instead of swap swap for making file streams 2011-10-26 11:48:26 -07:00
Doug Coleman 4ebe5218c7 Update Windows for word renames, fix lint errors 2011-10-24 21:50:02 -07:00
Doug Coleman 51c033a1f6 Fix all failures in the linux64 build email 2011-10-24 19:33:09 -07:00
Doug Coleman df64529fb5 Forget some classes after unit tests so that running "classes" test succeeds multiple times in a row 2011-10-24 16:59:46 -07:00
John Benediktsson ea4fe562c3 vocabs.loader: actually use the root cache. 2011-10-24 16:19:59 -07:00
Doug Coleman f9257959fd Rename class to class-of 2011-10-24 06:47:42 -05:00
Doug Coleman 26872ffe4d Rename vocab to lookup-vocab 2011-10-24 06:42:54 -05:00
Doug Coleman 3d65fbf1c7 Remove docs for removed word 2011-10-24 00:57:14 -05:00
Doug Coleman 2ecd513130 Factor out ``no-roots no-prefixes'' into its own word. Add load-root, load-from-root, vocabs-in-root and implement load in terms of load-from-root.
Add error checking for append-vocab-dir and (child-vocabs) in case someone tries to pass them the wrong parameters.
Rename: vocab-dir+ to append-vocab-dir
Document load-from-root and load-root
2011-10-23 19:59:01 -05:00
John Benediktsson 5a943b32c4 Remove stack effects from HELP: declarations. 2011-10-20 19:36:11 -07:00
John Benediktsson beb5b9bf64 hash-sets: separate <hash-set> and >hash-set to match other containers. Fixes #154. 2011-10-19 11:35:25 -07:00
John Benediktsson f4a6e10818 More cleanup of unused stuff. 2011-10-19 11:01:16 -07:00
John Benediktsson d1f5fefab0 Cleanup some uses of global [ ] bind. 2011-10-19 11:01:16 -07:00
Doug Coleman c5cca8a6c6 Forgot using in io.tests 2011-10-19 01:16:41 -07:00
Doug Coleman 0e46502f6e Add with-error>output word and test 2011-10-19 00:56:11 -07:00
John Benediktsson e648ce70bb system: fix stack effect for exit in docs. 2011-10-18 20:03:19 -07:00
Joe Groff 13b17fb84a io: input-stream and output-stream mixins 2011-10-18 16:25:09 -07:00
Joe Groff d61f335fee io: error stream combinators
* with-error-stream(*)
* with-output+error-stream(*) -- sets output and error stream to same stream
* with-output>error -- sets output stream to error stream for scope
* with-input-output+error-streams(*) -- like with-streams, but sets output and error to same stream
2011-10-18 15:13:33 -07:00
John Benediktsson 80e1c8e3f2 Eliminate duplicate syntax for stack effects "(" no longer drops and is identical to the old "((", which is now removed. 2011-10-18 13:19:39 -07:00
Joe Groff 4493d66282 io.encodings.utf16: auto-use strikes again 2011-10-17 21:46:08 -07:00
Joe Groff 67cccc63b3 formatting 2011-10-17 21:23:36 -07:00
Joe Groff 5443664df7 io.encodings.utf16: guess-*coded-length hints 2011-10-17 21:23:11 -07:00