1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00
Commit graph

105 commits

Author SHA1 Message Date
Andy Wingo
35d19661e3 Add primitive support for working with module variables
* 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-18 22:27:12 +02:00
Andy Wingo
79a40cf717 Add "mod" field to tree-il toplevel ref, set, define
Add "mod" field to <toplevel-ref>, <toplevel-set>, and
<toplevel-define>, indicating the expander's idea of what the current
module is when a toplevel variable is accessed or created.  This will
help in later optimizations.

* libguile/expand.c (TOPLEVEL_REF, TOPLEVEL_SET, TOPLEVEL_DEFINE)
  (expand, expand_define, expand_set_x, convert_assignment):
* libguile/expand.h (SCM_EXPANDED_TOPLEVEL_REF_FIELD_NAMES):
(SCM_MAKE_EXPANDED_TOPLEVEL_REF, SCM_EXPANDED_TOPLEVEL_SET_FIELD_NAMES):
(SCM_MAKE_EXPANDED_TOPLEVEL_SET, SCM_EXPANDED_TOPLEVEL_DEFINE_FIELD_NAMES):
(SCM_MAKE_EXPANDED_TOPLEVEL_DEFINE):
* module/ice-9/compile-psyntax.scm (translate-literal-syntax-objects):
* module/ice-9/psyntax-pp.scm:
* module/ice-9/psyntax.scm:
* module/language/tree-il.scm:
* module/language/tree-il.scm (parse-tree-il, make-tree-il-folder):
(pre-post-order):
* module/language/tree-il/analyze.scm (goops-toplevel-definition):
(macro-use-before-definition-analysis, proc-ref?, format-analysis):
* module/language/tree-il/compile-cps.scm (convert):
* module/language/tree-il/debug.scm (verify-tree-il):
* module/language/tree-il/effects.scm (make-effects-analyzer):
* module/language/tree-il/fix-letrec.scm (free-variables):
* module/language/tree-il/peval.scm (peval):
* test-suite/tests/tree-il.test: Adapt uses.
2019-08-18 22:27:12 +02:00
Ludovic Courtès
c6f70e4b04 Add -Wshadowed-toplevel.
* module/language/tree-il/analyze.scm (shadowed-toplevel-analysis): New
variable.
* module/language/tree-il/compile-cps.scm (%warning-passes): Add it.
* module/system/base/message.scm (%warning-types): Add it.
* test-suite/tests/tree-il.test ("warnings")["shadowed-toplevel"]: New
test prefix.
* module/ice-9/boot-9.scm (%auto-compilation-options): Add it.
* doc/ref/api-evaluation.texi (Compilation): Add 'shadowed-toplevel' and
'macro-use-before-definition'.
2018-08-07 12:34:32 +02:00
Andy Wingo
76eac85084 Use intrinsics for top-level refs outside captured scopes
* module/language/tree-il/compile-cps.scm (toplevel-box): Reify
  intrinsic calls for top-level references outside captured scopes.
* module/language/cps/reify-primitives.scm (compute-known-primitives):
  Update set of macro-instructions.
2018-05-14 16:25:50 +02:00
Andy Wingo
ceffb5e990 Compile "define!" via intrinsic
* libguile/intrinsics.c (scm_bootstrap_intrinsics):
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): Add new define!
  intrinsic.
* module/language/cps/compile-bytecode.scm (compile-function): Adapt
  compilation for define! to take two arguments.
* module/language/cps/effects-analysis.scm (current-module): Update
  define! for two arguments.
* module/language/tree-il/compile-cps.scm (convert): When reifying
  "define", grab the current module.
* module/system/vm/assembler.scm (define!): Define assembler as
  intrinsic.
2018-05-14 15:15:22 +02:00
Andy Wingo
dff85f6f9f Explode atomic box ops to new atomic instructions
* libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Add C8_S24
  word type.
* libguile/vm-engine.c (UNPACK_8_24): New helper.
  (atomic-scm-ref/immediate, atomic-scm-set!/immediate)
  (atomic-swap-scm!/immediate, atomic-scm-compare-and-swap!/immediate):
  New instructions.
  (make-atomic-box, atomic-box-ref, atomic-box-set!, atomic-box-swap!)
  (atomic-box-compare-and-swap!): Disable these ops.
* module/language/bytecode.scm (compute-instruction-arity): Add C8_S24
  support.
* module/system/vm/assembler.scm: Add C8_S24 support.  Export assemblers
  for new opcodes.
* module/system/vm/disassembler.scm (disassembler): Support C8_S24.
* module/language/cps/compile-bytecode.scm (compile-function): Replace
  old atomic-box assemblers with the new instructions.
* module/language/cps/effects-analysis.scm (annotation->memory-kind):
* module/language/cps/types.scm (annotation->type): Add cases for atomic
  boxes.  Mark as all memory kinds because atomic ops serialize memory
  accesses.
* module/language/tree-il/compile-cps.scm (make-atomic-box):
  (ensure-atomic-box, atomic-box-ref, atomic-box-set!):
  (atomic-box-swap!, atomic-box-compare-and-swap!): Explode these ops to
  more basic instructions.
* module/system/base/types/internal.scm (%tc7-atomic-box): Add forgotten
  export.
2018-04-13 10:09:56 +02:00
Andy Wingo
3047bcaefb Remove dead code in CPS converter
* module/language/tree-il/compile-cps.scm: Remove dead primcall
  expanders.
2018-04-10 14:10:03 +02:00
Andy Wingo
21d5897b4c Instruction explosion for char->integer
* module/language/cps/effects-analysis.scm:
* module/language/cps/slot-allocation.scm (compute-var-representations):
* module/language/cps/types.scm:
* module/language/cps/compile-bytecode.scm (compile-function): Remove
  char->integer cases.
* module/system/vm/assembler.scm: Remove emit-char->integer export.
* module/language/tree-il/compile-cps.scm (char->integer): Define
  instruction exploder.
2018-04-10 13:45:33 +02:00
Andy Wingo
880d68ea22 Instruction explosion for integer->char
* module/language/tree-il/compile-cps.scm (integer->char): Instruction
  explosion!
2018-04-10 13:22:59 +02:00
Andy Wingo
2964abad05 Explode "string-set!"
* module/language/cps/effects-analysis.scm (string-ref): Remove effects
  declaration, given that the primitive is exploded now.
* module/language/cps/reify-primitives.scm (compute-known-primitives):
  Add string-set!.
* libguile/vm-engine.c (string-set!): Disable opcode.
* module/language/cps/types.scm (string-ref, string-set!): Remove type
  checker and inferrers for string-ref and string-set!, as both are
  exploded.  In the case of string-set! there are still type-check
  effects in the intrinsic call but they can't be elided by the checker,
  as we don't track when strings are read-only.
* module/language/tree-il/compile-cps.scm (ensure-char): New helper.
  (string-set!): New primcall exploded converter.
2018-04-10 12:14:47 +02:00
Andy Wingo
7a109dddd7 Lower string-ref in CPS conversion
* module/language/cps/effects-analysis.scm (annotation->memory-kind):
* module/language/cps/types.scm (annotation->type): Hackily consider
  stringbuf memory to be string memory.
* module/language/tree-il/compile-cps.scm (string-ref): Add horrible
  lowering conversion for string-ref.
2018-04-09 10:13:09 +02:00
Andy Wingo
39fb7e540b CPS conversion lowers string-length
* module/language/cps/types.scm (annotation->type):
* module/language/cps/effects-analysis.scm (annotation->memory-kind):
  Add case for string memory kinds.  Remove special type and effect
  inferrers for string-length.
* module/language/cps/slot-allocation.scm (compute-var-representations):
  Remove string-length.
* module/language/tree-il/compile-cps.scm (ensure-string): New helper.
  (string-length): Add custom converter.
2018-04-08 10:27:52 +02:00
Andy Wingo
91bf9b1db3 Lower "make-struct/simple" to CPS
* 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-22 07:28:11 +01:00
Andy Wingo
557acdbbba Instruction explosion for struct-ref, struct-set!
* module/language/cps/effects-analysis.scm (&memory-kind-mask): Add
  &bitmask, for the bitmask in vtables.
  (annotation->memory-kind): Add 'bitmask case.
* module/language/tree-il/compile-cps.scm (ensure-struct-index-in-range):
  (prepare-struct-scm-access): New helpers.
  (struct-ref/immediate, struct-set!/immediate): New exploded lowering
  routines.
  (struct-ref, struct-set!): New lowering routines that just do a call.
  (canonicalize): Remove struct-ref hack; lowering procedures will
  handle it.
* module/language/tree-il/cps-primitives.scm (bytevector-length): Define
  struct-set! as returning a value.
2018-01-19 21:57:03 +01:00
Andy Wingo
42837e9108 Instruction explosion for bv-length
* module/language/tree-il/compile-cps.scm (ensure-vector):
  (prepare-bytevector-access): Add assumptions on lengths.
  (bv-length): New lowerer.
2018-01-16 16:43:10 +01:00
Andy Wingo
94fdc5cad9 Instruction explosion for bytevector setters
* module/language/cps/compile-bytecode.scm (compile-function): Fix
  emitters for u64-set! et al.
* module/language/tree-il/compile-cps.scm (bytevector-set-converter):
  New helper.  Lower bytevector setters to pointer ops.
2018-01-16 10:05:03 +01:00
Andy Wingo
1b955b01c3 Add f32-ref, f64-ref lowering procs
* module/language/tree-il/compile-cps.scm (bytevector-ref-converter):
  Take kind as tag, not boolean.  Support floats.  Adapt and add
  lowerers for float-ref procedures.
2018-01-15 20:51:00 +01:00
Andy Wingo
0270d235bd Instruction explosion for integer bytevector ref procedures
* module/language/cps/compile-bytecode.scm (compile-function): Fix
  emitters for u16-ref et al.
* module/language/tree-il/compile-cps.scm (bytevector-ref-converter):
  (define-bytevector-ref-converter, define-bytevector-ref-converters):
  New helpers.  Use to define lowerers for bv-s32-ref et al.
2018-01-15 20:25:53 +01:00
Andy Wingo
535d6fad80 Custom bv-u8-ref lowering procedure
* module/language/tree-il/compile-cps.scm (untag-bytevector-index):
  (ensure-bytevector, prepare-bytevector-access): New helpers.
  (bv-u8-ref): New lowerer.
* module/language/cps/types.scm (annotation->type):
* module/language/cps/effects-analysis.scm (annotation->memory-kind):
  Support bytevectors.
2018-01-14 14:38:35 +01:00
Andy Wingo
c7b3379a4c Instruction explosion for struct-vtable
* module/language/tree-il/compile-cps.scm (ensure-struct): New helper.xo
  (struct-vtable): New lowering procedure.
* module/language/cps/types.scm (annotation->type): Add struct.
  (scm-ref/tag, scm-set!/tag): Fix to get type from annotation.
* module/language/cps/effects-analysis.scm (annotation->memory-kind):
  Add struct.
2018-01-10 19:47:58 +01:00
Andy Wingo
24f998e4d2 Lower box, box-ref, box-set! primcalls
* module/language/tree-il/compile-cps.scm (box, ensure-box):
  (box-ref, box-set!): Lower box primcalls.
* module/language/cps/compile-bytecode.scm (compile-function):
* module/language/cps/cse.scm (compute-equivalent-subexpressions):
* module/language/cps/dce.scm (compute-live-code):
* module/language/cps/effects-analysis.scm:
* module/language/cps/types.scm: Remove special support for boxes.  What
  a pleasure!
2018-01-10 07:59:21 +01:00
Andy Wingo
55a8483435 Improve make-vector compilation for known big sizes
* module/language/tree-il/compile-cps.scm
  (emit-initializations-as-loop): New helper.
  (make-vector): Use new helper.
  (make-vector/immediate): Emit a loop if the number of words is greater
  than or equal to 32.  An arbitrary limit that could be adjusted later.
2018-01-07 23:07:12 +01:00
Andy Wingo
5e1109a97f Better compilation of vector constructors and initializers
* module/language/tree-il/cps-primitives.scm (allocate-vector)
  (vector-init!): Declare these primitives which later go away when
  lowering to CPS.
* module/language/tree-il/compile-cps.scm (vector-init!): New
  converter.
  (allocate-vector): New converter.
2018-01-07 22:51:17 +01:00
Andy Wingo
49fa4980bb Expand pair-related primcalls
* module/language/tree-il/compile-cps.scm (ensure-pair): New helper.
  (cons, car, cdr, set-car!, set-cdr!): New expanders.
* module/language/cps/closure-conversion.scm (convert-one):
* module/language/cps/contification.scm (apply-contification): Emit
  lower-level instructions for making pairs.
2018-01-07 18:44:48 +01:00
Andy Wingo
9a1d2d8ec8 Minor compile-cps refactor for cons
* module/language/tree-il/compile-cps.scm (build-list): Pass cons
  through an expander.
2018-01-07 17:57:45 +01:00
Andy Wingo
ee84af1311 Compiler frontend support for vector mutability checks
* module/language/tree-il/compile-cps.scm (ensure-vector):
  (prepare-vector-access, prepare-vector-access/immediate):
  (vector-length, vector-ref, vector-ref/immediate):
  (vector-set!, vector-set!/immediate): Use mutable-vector? predicate
  for write access.
2018-01-07 17:38:40 +01:00
Andy Wingo
f488bc53e7 Instruction explosion for /immediate variants of vector prims
* module/language/tree-il/compile-cps.scm
  (prepare-vector-access/immediate): New helper.
* module/language/tree-il/compile-cps.scm (vector-ref/immediate):
  (vector-set!/immediate, make-vector/immediate): New expanders.
2018-01-07 15:42:39 +01:00
Andy Wingo
c766a883d3 Instruction explosion for make-vector
* module/language/tree-il/compile-cps.scm (untag-fixnum-in-imm-range):
  New helper.
  (make-vector): New custom expander.  Gnarly; to refactor.
2018-01-07 15:42:39 +01:00
Andy Wingo
6fdbd3b17b Instruction explosion for vector-{length,ref,set!}
* module/language/tree-il/compile-cps.scm (ensure-vector)
  (untag-fixnum-index-in-range, compute-vector-access-pos)
  (prepare-vector-access): New helpers.
  (vector-length, vector-ref, vector-set!): New expanders.
2018-01-05 14:42:40 +01:00
Andy Wingo
ad55ee83c3 $throw is a new kind of CPS term
* module/language/cps.scm ($throw): New term type that doesn't have a
  continuation.  Adapt all callers.  Remove now-unneeded
  "prune-bailouts" pass.
2018-01-03 21:25:55 +01:00
Andy Wingo
ee15ca1455 $prompt is now its own kind of CPS term.
* module/language/cps.scm ($prompt): Rework to be its own term kind.
  Now $continue always continues to a single continuation.  Adapt
  callers.
2018-01-03 17:32:43 +01:00
Andy Wingo
afb0a92d50 $branch is now a distinct CPS term type
* module/language/cps.scm ($branch): Refactor to be its own CPS term
  type, not relying on $continue to specify a continuation (which before
  was only for the false case) or a source location.  Update allllllll
  callers.
2018-01-03 16:16:39 +01:00
Andy Wingo
bc5a599cad Unknown primcalls convert as calls
* module/language/cps/reify-primitives.scm (reify-primitives): Remove
  case where $prim could continue to $kreceive; this isn't possible.
  However when reifying an unknown primcall, always add a $kreceive, as
  the continuation has to be $kargs.
* module/language/tree-il/compile-cps.scm (convert): Unknown primcalls
  convert as calls.  With this change, all primcalls should continue to
  $kargs, with the exception of 'throw.
2017-12-27 15:46:31 +01:00
Andy Wingo
c9efff30de CPS conversion avoids residualizing unknown primcalls
* module/language/tree-il/compile-cps.scm: Avoid residualizing "apply"
  or "abort-to-prompt" primcalls; instead, these are just calls to
  $prim.
2017-12-27 15:46:31 +01:00
Andy Wingo
7f7cbe8b65 Inline "elide-values" optimization into CPS conversion
* module/language/tree-il/compile-cps.scm (adapt-arity, convert): Avoid
  reifying "values" primcalls unless necessary.  Effectively inlines the
  "elide-values" optimization into CPS conversion.
* module/language/cps/elide-values.scm: Remove, as it's now unneeded.
* module/language/cps/optimize.scm (optimize-higher-order-cps):
* module/Makefile.am:
* am/bootstrap.am: Remove elide-values references.
2017-12-27 15:46:31 +01:00
Andy Wingo
9111f8cdcd CPS conversion expands "list"
* module/language/tree-il/compile-cps.scm (build-list): New helper.
  (convert, canonicalize): Canonicalize "list" earlier.  Allow sinking
  of any initializer that can't capture the continuation, not just in
  cases where all initializers have this property.  Reify a cons chain
  internally as appropriate.
2017-12-27 15:46:31 +01:00
Andy Wingo
36e6a3daca Refactor lowering of Tree-IL primcalls to CPS
* module/language/tree-il/cps-primitives.scm: New file,
  replacing (language cps primitives).  Lists known primitives and their
  relation to Tree-IL explicitly, instead of assuming that any Tree-IL
  primcall that shares a name with a bytecode instruction is a CPS
  primcall.
* module/language/cps/verify.scm: Remove use of (language cps
  primitives) and primcall arity checking.  Would be nice to add this
  back at some point.
* module/language/tree-il/compile-cps.scm (convert): Refactor to use new
  tree-il-primitive->cps-primitive+nargs+nvalues helper.
* module/Makefile.am:
* am/bootstrap.am: Adapt.
2017-12-27 15:46:31 +01:00
Andy Wingo
8e7170a67a Refactor boxing/unboxing primcall args/results
This will allow individual primcall converters to define ad-hoc
conversion routines.

* module/language/tree-il/compile-cps.scm (convert-primcall/default)
  (convert-indexed-getter, convert-indexed-setter)
  (convert-indexed-getter/tag, convert-indexed-setter/untag)
  (convert-scm-u64->scm-primcall, convert-scm-u64-scm-primcall)
  (convert-scm-u64->f64-primcall, convert-scm-u64-f64-primcall)
  (convert-scm-u64->u64-primcall, convert-scm-u64-u64-primcall)
  (convert-scm-u64->s64-primcall, convert-scm-u64-s64-primcall)
  (convert-*->u64-primcall, convert-scm->u64-primcall)
  (convert-u64->scm-primcall): Define some primcall converter helpers.
  (*primcall-converters*, define-primcall-converter)
  (define-primcall-converters): Define converters for a number of
  primcalls.
  (convert-primcall*, convert-primcall): Interface to primcall
  converters.
  (convert): Pass most primcalls through convert-primcall, unless we
  know already that they don't need instruction explosion or
  boxing/unboxing.
2017-12-27 15:46:31 +01:00
Andy Wingo
eed4e09723 Assignment conversion uses unchecked memory accessors
* module/language/cps/effects-analysis.scm (annotation->memory-kind):
  Add box type annotation.
* module/language/cps/reify-primitives.scm (primitive-ref): Reify
  scm-ref/immediate instead of box-ref.
* module/language/cps/specialize-primcalls.scm (specialize-primcalls):
  Remove needless and unbound -> literal.
* module/language/cps/types.scm (annotation->type): Add box type.
* module/language/tree-il/compile-cps.scm (convert): Reify
  scm-ref/immediate / scm-set!/immediate instead of box-ref / box-set!.
2017-12-06 11:26:03 +01:00
Andy Wingo
f84474ef39 CPS conversion residualizes undefined? predicate
* module/language/tree-il/compile-cps.scm (init-default-value): Use
  undefined? predicate instead of reifying an unbound value in the CPS
  term.
* module/language/cps/compile-bytecode.scm (compile-function): Add cases
  for the special immediate predicates.  Evidently we aren't emitting
  these yet!
2017-12-06 11:13:31 +01:00
Andy Wingo
64acf24b40 Fix NaN handling in <= and >=
* module/language/cps/compile-bytecode.scm (compile-function): Add
  support for emitting <= via < and jge / jnge.
* module/language/cps/effects-analysis.scm: Declare effects for <= and
  f64-<=.
* module/language/cps/primitives.scm (*comparisons*): Add <=, f64-<=.
* module/language/cps/specialize-numbers.scm (specialize-operations):
  Specialize <= to < for integer comparisons.  Specialize to f64-<= for
  f64 ops.
* module/language/cps/type-fold.scm (<=): Add folder.
* module/language/cps/types.scm (infer-<=): Add inferrer.
* module/language/tree-il/compile-cps.scm (canonicalize): Canonicalize
  <= and >= to <=, so that nans are handled correctly.
2017-12-02 21:07:48 +01:00
Andy Wingo
0cbba8efe0 Avoid generating arity-adapting zero-value conts where possible
* module/language/tree-il/compile-cps.scm (adapt-arity, convert): Avoid
  generating arity-adapting continuations for nullary continuations.
2017-12-02 10:14:45 +01:00
Andy Wingo
4002849393 Avoid generating arity-adapting continuations if not needed
* module/language/tree-il/compile-cps.scm (adapt-arity): Allow k to be
  $kargs for the 1-valued case.
  (convert): For single-valued continuations where the definition is
  clearly single-valued, avoid making a needless $kreceive and extra
  "rest" binding that will just be filled with () and have to be
  eliminated later.
2017-12-02 10:14:25 +01:00
Andy Wingo
980de88902 Add exact-integer? as interesting Tree-IL effect-free primitive
* 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-24 10:37:50 +01:00
Andy Wingo
700ec791e7 Minor compile-cps refactor
* module/language/tree-il/compile-cps.scm (canonicalize): Refactor to
  make with-lexicals helper available to the whole function.
2017-11-24 10:30:28 +01:00
Andy Wingo
c22e61a7ff Fix u64/s64 typesafety around fixnum (un)tagging
* module/language/cps/type-fold.scm (u64->scm, scm->u64): Fix
  type-safety by adding casts.
* module/language/tree-il/compile-cps.scm (convert, canonicalize):
  Simplify rsh and lsh compilation by not trying to avoid scm->u64 in
  the early stages of the compiler.
2017-11-20 20:03:07 +01:00
Andy Wingo
b331ea3193 Convert "ash" to "lsh"/"rsh" when lowering to CPS
* module/language/cps/effects-analysis.scm: Remove case for "ash".
* module/language/cps/types.scm (ash): Remove.
* module/language/tree-il/compile-cps.scm (convert, canonicalize):
  Convert "ash" to "lsh"/"rsh" early on.
* module/system/base/target.scm (target-fixnum?): New procedure.
2017-11-11 22:08:14 +01:00
Andy Wingo
7a7f71de5c Canonicalize <=, >=, and > primcalls to <
* module/language/tree-il/compile-cps.scm (canonicalize): Convert <=,
  >=, and > primcalls to <.
* module/language/cps/primitives.scm (*comparisons*):
* module/language/cps/effects-analysis.scm: Remove superfluous
  primcalls.
* module/language/cps/specialize-numbers.scm
  (specialize-u64-scm-comparison): Only emit < primcalls for ordered
  comparisons.
  (specialize-scm-u64-comparison): New helper.
* module/language/cps/specialize-numbers.scm (specialize-operations):
  Remove support for >=, <=, and the like.
* module/language/cps/type-fold.scm: Remove folders for <= and so on.
* module/language/cps/types.scm (define-=-inferrer, define-<-inferrer):
  New helpers; use them for all = and < variants.  Remove checkers and
  inferrers for <= and the like.
* module/language/cps/compile-bytecode.scm (compile-function): Remove
  unnecessary cases.
2017-11-11 22:08:14 +01:00
Andy Wingo
f96a670332 Add new "throw" VM ops
* libguile/throw.h (scm_ithrow, scm_throw): Mark as SCM_NORETURN.
* libguile/throw.c (scm_throw, scm_ithrow): Adapt to not return.
* libguile/vm-engine.c (throw, throw/value, throw/value+data): New
  instructions.
* libguile/vm.c (vm_throw, vm_throw_with_value)
  (vm_throw_with_value_and_data): New helpers.
* module/language/cps/compile-bytecode.scm (compile-function): Add cases
  for new instructions.
* module/language/cps/prune-bailouts.scm (prune-bailouts): More simple,
  now that there are no $kreceives in play.
* module/language/cps/reify-primitives.scm (reify-clause): Update
  reification of no-clause functions to use new throw op.
* module/language/tree-il/compile-cps.scm (convert): Convert invocations
  of the variable-arity 'throw primitive from Tree-IL to the new
  fixed-arity CPS instructions.
* module/system/vm/assembler.scm (emit-throw/value*)
  (emit-throw/value+data*, emit-throw): Export new instructions.
* module/system/vm/disassembler.scm (code-annotation): Add annotation.
2017-11-05 15:00:16 +01:00
Andy Wingo
cf486700b7 error, scm-error primcalls expand to `throw'
* 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-11-05 15:00:16 +01:00