summaryrefslogtreecommitdiff
path: root/module/language/tree-il/primitives.scm
AgeCommit message (Collapse)AuthorFilesLines
2023-11-27Recognize append as a primcall and optimize itAndy Wingo1-2/+8
* module/language/tree-il/primitives.scm (*primitive-constructors*): (append): Recognize append and reduce it to only the two-operand form. * module/language/tree-il/peval.scm (peval): Add optimizations to append.
2023-11-23prompts avoid introducing throw; fixup peval testAndy Wingo1-6/+3
* test-suite/tests/peval.test ("partial evaluation"): Fix to expect raise-type-error from dynwind peval. Update prompt expectation similarly. * module/language/tree-il/primitives.scm (call-with-prompt): Use raise-type-error.
2023-11-15Allow string->utf8 to constant-foldAndy Wingo1-1/+52
* module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*primitive-accessors*): Add string->utf8, utf8->string, and string-utf8-length. (primitive-module): New public function, moved here from (language tree-il compile-bytecode). * module/language/tree-il/compile-bytecode.scm: Use primitive-module from (language tree-il primitives). * module/language/tree-il/peval.scm (peval): A bugfix: load primitives from their proper module. Allows bytevector primitives to fold. * module/language/cps/guile-vm/reify-primitives.scm: * module/language/cps/effects-analysis.scm: * module/language/cps/types.scm * module/language/tree-il/primitives.scm: * module/language/tree-il/cps-primitives.scm: * module/language/tree-il/effects.scm (make-effects-analyzer): Add string->utf8, utf8->string, and string-utf8-length. * module/language/tree-il/compile-cps.scm (string->utf8) (string-utf8-length, utf8->string): New custom lowerers, including type checks and an unboxed result for string-utf8-length. * module/system/vm/assembler.scm: * libguile/intrinsics.h: * libguile/intrinsics.c: Because string-utf8-length returns an unboxed value, we need an intrinsic for it; go ahead and add an intrinsic for string->utf8 and utf8->string too, as we will likely be able to use these in the future.
2023-09-18Better compilation for symbol->keyword, keyword->symbolAndy Wingo1-0/+2
* module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): Recognize keyword->symbol, symbol->keyword. * module/language/tree-il/cps-primitives.scm: Plumb through to CPS. (keyword->symbol): * module/language/cps/effects-analysis.scm: New prims have no effect. Fix effects for string->symbol. (annotation->memory-kind): Add keywords. * module/language/cps/guile-vm/lower-primcalls.scm (keyword->symbol): Lower to scm-ref/immediate. * module/language/cps/types.scm (annotation->type): Add case for keywords. * module/language/tree-il/compile-cps.scm: Add converters for new prims, with type guards.
2023-09-04Recognize `make-variable' as primitiveAndy Wingo1-3/+4
* module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*primitive-constructors*): (*effect+exception-free-primitives*): Add make-variable. * module/language/tree-il/cps-primitives.scm (make-variable): Lower as `box' primitive.
2023-08-28Better compilation of calls to `raise-exception`Andy Wingo1-1/+1
Recognize `raise-exception` in the same way we recognize `throw`, though it is a bit less optimized and the boot story is not as complicated. * doc/ref/vm.texi (Non-Local Control Flow Instructions): * libguile/jit.c (compile_unreachable): (compile_unreachable_slow): * libguile/vm-engine.c (VM_NAME): * module/language/cps/compile-bytecode.scm (compile-function): * module/system/vm/assembler.scm (emit-unreachable): Add new "unreachable" instruction, inserted after a call to non-continuable `raise-exception`. * module/language/tree-il/compile-cps.scm (raise-exception): * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Recognize raise-exception, and if it is called with just one argument, prune that branch of the control-flow graph.
2023-06-19Excise use of `record-case`Andy Wingo1-11/+12
This macro expands to field accessors, which in the case of tree-il-src will force an eager conversion of the source info to alists.
2023-01-16Do not expand 'make-vector' primcall with wrong number of arguments.Ludovic Courtès1-3/+3
Fixes <https://bugs.gnu.org/60522>. Reported by Sascha Ziemann <ceving@gmail.com>. * module/language/tree-il/primitives.scm (make-vector): Return #f when passed an incorrect number of arguments. * test-suite/tests/peval.test ("partial evaluation"): Add tests.
2022-12-01Fix order-of-side-effects bug in (eq? x y z) expansionAndy Wingo1-12/+34
* module/language/tree-il/primitives.scm (bind-lexicals): New helper. (expand-eq, expand-chained-comparisons): Ensure all arguments are eagerly evaluated. Previously an intermediate #f result would shortcut the evaluation. * test-suite/tests/compiler.test ("size effects in multi-arg eq / <"): Add test.
2021-05-18Add ‘expt’ to the list of effect-free primitives.Maxime Devos1-1/+2
I find myself writing code like (- (expt 2 32) 1) lately. Let's allow constant-folding that. * module/language/tree-il/primitives.scm (*interesting-primitive-names*, *effect-free-primitives*): Add 'expt'.
2021-02-03Optimize eof-object?Andy Wingo1-2/+9
* module/language/cps/types.scm (constant-type): Add case for EOF. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect+exception-free-primitives*): Add case for eof-object?. (eof-object?): Expand to eq? on the-eof-object.
2020-05-13More robust reduction of equal? and eqv?Andy Wingo1-35/+23
* module/language/tree-il/primitives.scm (expand-eq): Just expand out to binary comparisons. Also expand eq?, which was missing. Leave strength reduction to peval. (character-comparison-expander): Move down, as it depends on <, <=, and so on. * module/language/tree-il/peval.scm (peval): Robustly reduce equal? and eqv?. * test-suite/tests/peval.test ("partial evaluation"): Expect fixnum comparison to reduce to eq?. ("eqv?", "equal?"): A new battery of tests. * test-suite/tests/tree-il.test ("primitives"): Remove reduction tests.
2020-05-13Add with-lexicals helper; fix bug in (equal? #t (foo) #t)Andy Wingo1-48/+26
* module/language/tree-il.scm (with-lexicals): New public helper. * .dir-locals.el (with-lexicals): Add indentation rule. * module/language/tree-il/compile-bytecode.scm (canonicalize): Use with-lexicals. * module/language/tree-il/compile-cps.scm (canonicalize): Use with-lexicals from tree-il. * module/language/tree-il/primitives.scm (chained-comparison-expander): Remove duplicate expander definitions for <, <=, and so on. * module/language/tree-il/primitives.scm (maybe-simplify-to-eq): Avoid inadvertent code duplication by using with-lexicals. (expand-chained-comparisons): Likewise. (call-with-prompt): Simplify to use with-lexicals.
2020-05-04Ensure <prompt> handler is values handlerAndy Wingo1-1/+31
* module/language/tree-il/primitives.scm (call-with-prompt): Only pass "values handlers" as handler: lambdas with only req and rest args, and only one clause. * module/language/tree-il/compile-cps.scm (canonicalize): Remove eta-conversion pass here. * test-suite/tests/peval.test ("partial evaluation"): Adapt test.
2020-03-06Fix expansion of 'error' primitive with a non-constant argument.Ludovic Courtès1-2/+1
Fixes <https://bugs.gnu.org/39509>. Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>. * module/language/tree-il/primitives.scm (error): Remove extra "?" argument when the first argument is not a constant. * test-suite/tests/tree-il.test ("primitives")["error"]: New test prefix.
2019-09-01Optimize fixnum or s64 -> f64 conversionsAndy Wingo1-2/+2
* libguile/intrinsics.c (scm_bootstrap_intrinsics): * libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): Add "inexact" intrinsic. * libguile/jit.c (compile_s64_to_f64): New compiler. * libguile/vm-engine.c (s64->f64): New instruction. * module/language/cps/effects-analysis.scm (heap-numbers-equal?): * module/language/cps/reify-primitives.scm (compute-known-primitives): * module/language/cps/slot-allocation.scm (compute-var-representations): * module/language/cps/specialize-numbers.scm (fixnum->f64): (specialize-operations): * module/language/cps/type-fold.scm (scm->f64, inexact): * module/language/cps/types.scm (inexact, s64->f64): * module/language/tree-il/cps-primitives.scm (exact->inexact): * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): * module/system/vm/assembler.scm: Recognize exact->inexact as a primitive, and optimize it. Add compiler support for new "inexact" and "s64->f64" primcalls.
2019-08-24Unbox floor/ceiling and trigonometric functions where possibleAndy Wingo1-1/+6
* libguile/intrinsics.c (scm_atan1): New intrinsic, wrapping scm_atan. (scm_bootstrap_intrinsics): Add new intrinsics. * libguile/intrinsics.h (scm_t_f64_from_f64_f64_intrinsic): New intrinsic type. (SCM_FOR_ALL_VM_INTRINSICS): Add intrinsics for floor, ceiling, sin, cos, tan, asin, acos, atan, and their unboxed counterparts. * libguile/jit.c (sp_f64_operand): New helper. (compile_call_f64_from_f64, compile_call_f64_from_f64_f64): Call out to intrinsics. * libguile/vm-engine.c (call-f64<-f64-f64): New opcode. * module/language/cps/effects-analysis.scm: Add new intrinsics. * module/language/cps/reify-primitives.scm (compute-known-primitives): Add new intrinsics. * module/language/cps/slot-allocation.scm (compute-var-representations): Add 'f64 slot types for the new unboxed intrinsics. * module/language/cps/specialize-numbers.scm (specialize-operations): Support unboxing the new intrinsics. * module/language/cps/types.scm: Define type inferrers for the new intrinsics. * module/language/tree-il/cps-primitives.scm: Define CPS translations for the new intrinsics. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*, atan): Define primitive resolvers. * module/system/vm/assembler.scm: Export assemblers for the new intrinsics. (define-f64<-f64-f64-intrinsic): New helper.
2019-08-18Add primitive support for working with module variablesAndy Wingo1-0/+6
* module/language/tree-il/compile-cps.scm (%box-ref, %box-set!): New expanders. (box-ref, box-set!): Expand in terms of %box-ref, %box-set!. * module/language/tree-il/cps-primitives.scm (%variable-ref): (%variable-set!, module-ensure-local-variable!): New primitives. * module/language/tree-il/effects.scm (make-effects-analyzer): Understand effects of new primitives. * module/language/tree-il/primitives.scm (define!): (module-define!): Define expanders.
2019-08-18Simplify the define-primitive-expander macroAndy Wingo1-119/+91
* module/language/tree-il/primitives.scm (primitive-expander): (define-primitive-expander!): New helpers. (define-primitive-expander): Rewrite in terms of syntax-case. (error, make-vector, eqv?, equal?, call-with-prompt) (abort-to-prompt*, abort-to-prompt): Use new helper.
2018-01-22Lower "make-struct/simple" to CPSAndy Wingo1-2/+2
* module/language/tree-il/cps-primitives.scm (struct-init!): Add primitive, just used in internal translations. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*primitive-constructors*): Recognize "make-struct/simple" instead of allocate-struct. * module/language/tree-il/compile-cps.scm (ensure-vtable): New helper. (allocate-struct, struct-init!): New lowerers. (convert): Add struct-init! case. (canonicalize): Convert make-struct/simple like vector.
2018-01-05Improve compilation of make-vector without initAndy Wingo1-0/+11
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Add expansion for one-argument make-vector.
2018-01-05Allow peval to gnaw on string->symbol, symbol->stringAndy Wingo1-1/+4
* module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): Add string->symbol and symbol->string.
2017-11-24Add exact-integer? as interesting Tree-IL effect-free primitiveAndy Wingo1-0/+3
* module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*, *effect+exception-free-primitives*): Detect use of exact-integer?. * module/language/tree-il/compile-cps.scm (canonicalize): Compile exact-integer? to a fixnum?-or-bignum? check.
2017-11-05error, scm-error primcalls expand to `throw'Andy Wingo1-0/+37
* module/language/tree-il/primitives.scm (scm-error, error): Expand into `throw'. * module/language/tree-il/peval.scm (peval): Reify "throw" for dynwind error. * module/language/tree-il/compile-cps.scm (canonicalize): Reify "throw" for call-with-prompt error. * module/language/cps/prune-bailouts.scm (prune-bailouts): Don't expect "error" or "scm-error" here.
2017-09-20Use make-struct/no-tail instead of make-structAndy Wingo1-10/+3
* module/ice-9/boot-9.scm: * module/language/cps/effects-analysis.scm: * module/language/elisp/falias.scm: * module/language/tree-il.scm: * module/language/tree-il/primitives.scm: * module/rnrs/records/procedural.scm: * module/srfi/srfi-35.scm: * module/system/base/syntax.scm: Change uses of make-struct to make-struct/no-tail.
2016-12-05with-dynamic-state compiler and VM supportAndy Wingo1-1/+1
* libguile/dynstack.h (SCM_DYNSTACK_TYPE_DYNAMIC_STATE): * libguile/dynstack.c (DYNAMIC_STATE_WORDS, DYNAMIC_STATE_STATE_BOX): (scm_dynstack_push_dynamic_state): (scm_dynstack_unwind_dynamic_state): New definitions. (scm_dynstack_unwind_1, scm_dynstack_wind_1): Add with-dynamic-state cases. * libguile/memoize.c (push_dynamic_state, pop_dynamic_state) (do_push_dynamic_state, do_pop_dynamic_state): New definitions. (memoize, scm_init_memoize): Handle push-dynamic-state and pop-dynamic-state. * libguile/vm-engine.c (push-dynamic-state, pop-dynamic-state): New opcodes. * module/ice-9/boot-9.scm (with-dynamic-state): New definition in Scheme so that the push-dynamic-state and pop-dynamic-state always run in the VM. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm: * module/language/cps/types.scm: * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/peval.scm (peval): * module/language/tree-il/primitives.scm (*interesting-primitive-names*): * module/system/vm/assembler.scm: Add support for with-dynamic-state to the compiler. * test-suite/tests/fluids.test ("dynamic states"): Add basic tests. * doc/ref/vm.texi (Dynamic Environment Instructions): Update.
2016-10-23Move thread bindings to (ice-9 threads)Andy Wingo1-0/+1
* libguile/init.c (scm_i_init_guile): Don't call scm_init_thread_procs. * libguile/threads.c (scm_init_ice_9_threads): Rename from scm_init_thread_procs, make static. (scm_init_threads): Register scm_init_thread_procs extension. * libguile/threads.h (scm_init_thread_procs): Remove decl. * module/ice-9/boot-9.scm: Load (ice-9 threads), so that related side effects occur early. * module/ice-9/deprecated.scm (define-deprecated): Fix to allow deprecated bindings to appear in operator position. Export deprecated bindings. (define-deprecated/threads, define-deprecated/threads*): Trampoline thread bindings to (ice-9 threads). * module/ice-9/futures.scm: Use ice-9 threads. * module/ice-9/threads.scm: Load scm_init_ice_9_threads extension. Reorder definitions and imports so that the module circularity with (ice-9 futures) continues to work. * module/language/cps/intmap.scm: * module/language/cps/intset.scm: * module/language/tree-il/primitives.scm: Use (ice-9 threads). * module/language/cps/reify-primitives.scm: Reify current-thread in (ice-9 threads) module. * module/srfi/srfi-18.scm: Use ice-9 threads with a module prefix, and adapt all users. Use proper keywords in module definition form. * test-suite/tests/filesys.test (test-suite): * test-suite/tests/fluids.test (test-suite): * test-suite/tests/srfi-18.test: Use ice-9 threads. * NEWS: Add entry. * doc/ref/api-scheduling.texi (Threads): Update. * doc/ref/posix.texi (Processes): Move current-processor-count and total-processor-count docs to Threads.
2016-09-06Compiler support for atomicsAndy Wingo1-2/+2
* doc/ref/vm.texi (Inlined Atomic Instructions): New section. * libguile/vm-engine.c (VM_VALIDATE_ATOMIC_BOX, make-atomic-box) (atomic-box-ref, atomic-box-set!, atomic-box-swap!) (atomic-box-compare-and-swap!): New instructions. * libguile/vm.c: Include atomic and atomics-internal.h. (vm_error_not_a_atomic_box): New function. * module/ice-9/atomic.scm: Register primitives with the compiler. * module/language/cps/compile-bytecode.scm (compile-function): Add support for atomic ops. * module/language/cps/effects-analysis.scm: Add comment about why no effects analysis needed. * module/language/cps/reify-primitives.scm (primitive-module): Add case for (ice-9 atomic). * module/language/tree-il/primitives.scm (*effect-free-primitives*): (*effect+exception-free-primitives*): Add atomic-box?. * module/system/vm/assembler.scm: Add new instructions. * test-suite/tests/atomic.test: Test with compilation and interpretation.
2016-09-02Better char<? compilationAndy Wingo1-0/+18
* module/language/tree-il/primitives.scm (character-comparison-expander): Expand out char<? and friends to <, unboxing the char arguments. * module/language/cps/types.scm: * module/language/cps/effects-analysis.scm: Remove mention of char<? and friends as we won't see them any more. Also fixes #24318.
2016-06-21Fix (< 'foo) compilationAndy Wingo1-1/+6
* module/language/tree-il/primitives.scm (expand-chained-comparisons): Fix (< 'foo) compilation. * test-suite/tests/compiler.test ("regression tests"): Add test case.
2015-12-01Add current-thread VM opAndy Wingo1-1/+1
* libguile/vm-engine.c (current-thread): New op. * module/language/cps/effects-analysis.scm (&thread): New memory kind. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm (current-thread): * module/language/cps/types.scm (current-thread): * module/language/tree-il/primitives.scm (*interesting-primitive-names*): * module/system/vm/assembler.scm (emit-current-thread): Wire up the new op.
2015-12-01Remove add1 and sub1Andy Wingo1-22/+18
* libguile/vm-engine.c: Remove add1 and sub1 instructions. Will replace with add/immediate and sub/immediate. * module/language/tree-il/peval.scm (peval): If we reify a new <primcall>, expand it. Removes 1- and similar primcalls. * module/language/tree-il/primitives.scm: Don't specialize (+ x 1) to 1+. (expand-primcall): New export, does a single primcall expansion. (expand-primitives): Use the new helper. * module/language/cps/effects-analysis.scm: * module/language/cps/primitives.scm: * module/language/cps/types.scm: * module/system/vm/assembler.scm: Remove support for add1 and sub1 CPS primitives. * test-suite/tests/peval.test ("partial evaluation"): Adapt tests that expect 1+/1- to expect +/-.
2015-01-22Keywords have a tc7Andy Wingo1-1/+4
* libguile/tags.h (scm_tc7_keyword): Allocate a tc7, so that the VM can have cheap keyword? tests. * libguile/keywords.c: * libguile/keywords.h: Adapt. * libguile/goops.c (scm_class_of, scm_sys_goops_early_init): Capture <keyword>. * libguile/print.c (iprin1): Inline keyword printer. * libguile/evalext.c (scm_self_evaluating_p): Add keywords here. * libguile/deprecated.h: * libguile/deprecated.c (scm_tc16_keyword): Deprecate. * module/language/cps/compile-bytecode.scm (compile-fun): Add keyword? case, and bitvector? case while we're at it. * module/language/cps/effects-analysis.scm (define-primitive-effects): Add bytevector?, keyword?, and bitvector? cases. * module/language/cps/primitives.scm (*branching-primcall-arities*): Add keyword?. * module/language/cps/types.scm (bitvector?, keyword?, bytevector?): Add branch inferrers. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): (*effect+exception-free-primitives*): Add bytevector?, keyword?, and bitvector?. * module/oop/goops.scm (<keyword>): New class. * module/system/base/types.scm (%tc7-keyword, cell->object): Add cases. * module/system/vm/assembler.scm (br-if-keyword): New definition. * module/system/vm/disassembler.scm (code-annotation): Add br-if-tc7 case for keywords. * test-suite/tests/types.test ("clonable objects"): Update now that keywords are cloneable.
2014-07-03Optimizer support for logtest and logbit?Andy Wingo1-2/+2
* module/language/cps/effects-analysis.scm: Add entries for logtest and logbit?. * module/language/cps/types.scm (logtest, logbit?): New checkers and inferrers. * module/language/tree-il/peval.scm (peval): Convert (zero? (logand a b)) to (logtest a b), in anticipation of opcode support for logtest. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): Add logtest and logbit?.
2014-02-13bytevector-length is an interesting primitive.Andy Wingo1-1/+3
* module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): * module/language/cps/effects-analysis.scm: bytevector-length is an interesting primitive.
2014-02-13sqrt and abs are interesting primitivesAndy Wingo1-1/+2
* module/language/cps/effects-analysis.scm: * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): Add sqrt and abs.
2014-02-07Merge commit '58147d67806e1f54c447d7eabac35b1a5086c3a6'Andy Wingo1-0/+22
2014-02-07Merge commit 'ca5e0414e96886177d883a249edd957d2331db65'Andy Wingo1-3/+9
Conflicts: module/language/tree-il/primitives.scm
2014-02-01Compile numerical comparisons with more than 2 arguments to VM code.Mark H Weaver1-0/+23
* module/language/tree-il/primitives.scm (chained-comparison-expander): New procedure. (*primitive-expand-table*): Add primitive expanders for '<', '>', '<=', '>=', and '='.
2014-01-31Revert "Primitive expand numerical comparisons with more than 2 arguments."Mark H Weaver1-20/+0
This reverts commit 4dc4b86e858d391d20d0ea2551614a89fa3bd4d1.
2014-01-28Primitive expand numerical comparisons with more than 2 arguments.Mark H Weaver1-0/+20
* module/language/tree-il/primitives.scm (chained-comparison-expander): New procedure. (*primitive-expand-table*): Add primitive expanders for '<', '>', '<=', '>=', and '='.
2014-01-28Add 'positive?' and 'negative?' as primitives.Mark H Weaver1-3/+9
* module/language/tree-il/primitives.scm (*interesting-primitive-names*) (*effect-free-primitives*): Add 'positive?' and 'negative?'. (*primitive-expand-table*): Add primitive expanders for 'positive?' and 'negative?'.
2013-11-10Add specialize-primcalls pass; bump objcode version.Andy Wingo1-2/+3
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/objcodes.c (process_dynamic_segment): Expect the minor version to be present and, while we are still banging on the VM, exactly equal to SCM_OBJCODE_MINOR_VERSION. * libguile/vm-engine.c: Renumber ops. Remove the general make-vector. Rename constant-FOO to FOO/immediate. Remove struct-ref and struct-set!, replace with struct-ref/immediate and struct-set!/immediate. * module/Makefile.am: * module/language/cps/specialize-primcalls.scm: New pass, inlines FOO to FOO/immediate -- e.g. vector-ref to vector-ref/immediate. * module/language/cps/arities.scm: Remove struct-set! case, now that there is no struct-set! opcode. * module/language/cps/compile-rtl.scm (compile-fun): Remove dispatch to constant-FOO versus FOO here -- that decision is made by specialize-primcalls. (optimize): Add specialize-primcalls pass. * module/language/cps/dfg.scm (constant-needs-allocation?): Adapt to name changes. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*primitive-constructors*): Add allocate-struct. * module/system/vm/assembler.scm (*bytecode-major-version*): (*bytecode-minor-version*, link-dynamic-section): Write minor version into resulting image.
2013-11-10Effects analysis distinguishes between struct fieldsAndy Wingo1-3/+4
* module/language/tree-il/effects.scm (compile-time-cond): (define-effects): Make the effects analysis more precise, distinguishing between different kinds of mutable data. On 64-bit systems we take advantage of the additional bits to be even more precise. (make-effects-analyzer): Inline handlers for all "accessor" primitives and their corresponding mutators. * module/language/tree-il/peval.scm (peval): Reflow to remove use of the "accessor-primitive?" predicate. * module/language/tree-il/primitives.scm (accessor-primitive?): Remove.
2013-11-03"length" is an interesting primitiveAndy Wingo1-1/+3
* module/language/tree-il/primitives.scm (*effect-free-primitives*): (*interesting-primitive-names*): Add "length", so that we can constant-fold it.
2013-10-31define! is an interesting primitiveAndy Wingo1-1/+1
* module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add define!.
2013-10-26Mark current-module as an interesting primitiveAndy Wingo1-0/+2
* module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add current-module, to allow RTL compilation.
2013-10-26Add make-vector, constant-make-vector instructionsAndy Wingo1-2/+2
* libguile/vm-engine.c (rtl_vm_engine): Add make-vector and constant-make-vector instructions and renumber. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Emit constant-make-vector and make-vector as appropriate. * module/language/cps/dfg.scm (constant-needs-allocation?): In some cases, make-vector doesn't need to allocate its index. * module/language/tree-il/primitives.scm (*interesting-primitive-names*, *primitive-constructors*): Add make-vector.
2013-10-26Recognize tree-il variable? primitiveAndy Wingo1-3/+5
* module/language/tree-il/primitives.scm (*interesting-primitive-names*) (*effect-free-primitives*, *effect+exception-free-primitives*): Add variable?. Fix nil? spelling.
2013-10-23Always resolve-primitives in the root module.Andy Wingo1-8/+11
* module/language/tree-il/primitives.scm (resolve-primitives): If we are compiling in the root module, ignore local definitions.