1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 21:10:27 +02:00
Commit graph

20154 commits

Author SHA1 Message Date
Andy Wingo
5577392738 Begin structure for template JIT compiler
* libguile/jit.c: Begin to wire up compilers for the VM opcodes.
  Currently all that's there is a parser for each opcode's operands.
2018-07-03 13:31:29 +02:00
Andy Wingo
a433620c38 Fix bad opcode in VM
* libguile/vm-engine.c (VM_NAME): Fix accidentally reused number 180.
  Both values were invalid opcodes though.
2018-07-03 13:30:32 +02:00
Andy Wingo
d6b8f6a658 Minor change to VM DSL
* libguile/instructions.c (DOP1, DOP2, DOP3, DOP4, DOP5): New parts of
  the DSL, equivalent to e.g. OP1(x) | OP_DST.  Will allow other
  definitions of OP* that use token pasting.
* libguile/vm-engine.c: Adapt to use new DOP descriptors.
2018-07-03 11:13:27 +02:00
Andy Wingo
5b68bd7778 Fix compile warnings in jit_print.c
* libguile/lightning/lib/jit_print.c (_jit_print_node): Fix a couple
  printf format warnings by adding casts.
2018-07-03 10:39:05 +02:00
Andy Wingo
07a787dc87 Remove -Wswitch-enum from compile flags
* configure.ac (POTENTIAL_GCC_CFLAGS): Remove -Wswitch-enum, which
  requires that switch statements mention all enumerated values, even if
  there is a default clause.  Note that -Wall enables -Wswitch, which is
  the same except it's silent if there's a default clause.  The reason
  is that lightning has a number of switches like this.
2018-07-03 10:32:24 +02:00
Andy Wingo
9338ef15c2 Wire up lightning into libguile build
* libguile/Makefile.am (AM_CPPFLAGS):
  (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): If ENABLE_JIT, build
  lightning.
  (EXTRA_DIST): Add lightning files.
* libguile/lightning/lightning.am (lightning_extra_files): Add COPYING
  and related files to the dist.
* libguile/jit.c:
* libguile/jit.h: New files.
2018-07-02 11:08:57 +02:00
Ludovic Courtès
cdb194c8b4 Update release docs.
* doc/release.org: Update web site instructions.
2018-07-02 10:58:22 +02:00
Andy Wingo
2d84803884 Wire JIT availability check into Guile configure
* acinclude.m4 (GUILE_ENABLE_JIT): Add missing AC_CANONICAL_TARGET.
* configure.ac: Add check if JIT is available.
2018-07-02 10:47:15 +02:00
Andy Wingo
0593a9aed7 Add GUILE_ENABLE_JIT macro
* acinclude.m4 (GUILE_ENABLE_JIT): New macro.
* libguile/lightning/configure.ac: Remove now-unused file.
2018-07-02 10:39:49 +02:00
Ludovic Courtès
791cae940a Bump version for Guile 2.2.4.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
(LIBGUILE_INTERFACE_REVISION): Increment.
2018-07-01 23:33:46 +02:00
Ludovic Courtès
d571009370 build: Really build srfi/srfi-71.scm.
Commit eb90831ce8 added it to the wrong
makefile.

* module/Makefile.am (SOURCES): Add srfi/srfi-71.scm.
* module/srfi/Makefile.am: Remove.  It's a leftover from the 2009 build
system rework in commit 3bb299b3f0.
2018-07-01 23:33:46 +02:00
Ludovic Courtès
fbbab31c8b Update NEWS.
* NEWS: Update.
2018-07-01 23:33:46 +02:00
Ludovic Courtès
be1e6e6ab0 Update copyright years in '--version' and the manual.
* module/ice-9/command-line.scm (version-etc): Change #:copyright-year
to 2018.
* doc/ref/guile.texi: Add 2017 and 2018 to the copyright years.
* configure.ac (GUILE_CONFIGURE_COPYRIGHT): Add 2018.
2018-07-01 23:33:26 +02:00
Andy Wingo
f8b8f5f5c8 Remove unused AM_CONDITIONAL statements from lightning configure
* libguile/lightning/configure.ac: Remove more unused definitions.
2018-07-01 21:13:02 +02:00
Andy Wingo
2412cfbbaa Remove unused configure-time checks for x87, thumb, and sof float
* libguile/lightning/configure.ac: Remove unused checks.
2018-07-01 21:11:48 +02:00
Andy Wingo
fdfbfccdd6 Remove lightning configure snippet related to libdl
* libguile/lightning/configure.ac: Remove checks for how to add libdl,
  as embedder will handle this.
2018-07-01 20:59:29 +02:00
Andy Wingo
92a75703b1 Always enable assertions in embedded lightning
* libguile/lightning/configure.ac: Remove --enable-assertions option;
  always enable assertions.
* libguile/lightning/lib/jit_memory.c:
* libguile/lightning/lib/jit_note.c:
* libguile/lightning/lib/jit_print.c:
* libguile/lightning/lib/jit_rewind.c:
* libguile/lightning/lib/jit_size.c:
* libguile/lightning/lib/lightning.c: Define DEBUG to 1.
2018-07-01 20:58:08 +02:00
Ludovic Courtès
533e3ff170 Serialize accesses to submodule hash tables.
Fixes <https://bugs.gnu.org/30602>.

Previously, when compiling files in parallel like Guix does, threads
would be concurrently inserting, rehashing, and reading the submodule
hash table of module ().  Thus, some threads would sometimes see an
inconsistent state, leading to errors such as:

  Module named (system repl debug) does not exist

* module/ice-9/boot-9.scm (call-with-module-autoload-lock): Move higher
in the file.
(module-name): Use it around call to 'nested-define-module!'.
(resolve-module): Wrap the whole thing in 'call-with-module-autoload-lock'.
2018-07-01 18:37:59 +02:00
Andy Wingo
0ce8e6969e Remove special cflags for obsolete Lightning targets
* libguile/lightning/configure.ac: Remove compiler flags specializations
  for ia64 on HPUX, MIPS on Irix, and Alpha on OSF.
2018-07-01 16:38:55 +02:00
Andy Wingo
0465c8834e Refactor deps for built libpath.h
* libguile/Makefile.am (BUILT_INCLUDES): Move libpath.h here, from
  BUILT_SOURCES, so that .x files depend on it.  Thanks to Dale Smith
  for the report.
2018-07-01 12:18:32 +02:00
Andy Wingo
2a8ebe87e3 Remove disassembler support from lightning
* libguile/lightning/configure.ac: Remove checks for libiberty, BFD, and
  so on.
* libguile/lightning/lib/jit_disasm.c: Remove.
* libguile/lightning/lib/lightning.c: Define DISASSEMBLER and
  DEVEL_DISASSEMBLER to 0.
  (init_jit, finish_jit): Delete calls into jit_disasm.
* libguile/lightning/lib/jit_memory.c:
* libguile/lightning/lib/jit_note.c:
* libguile/lightning/lib/jit_print.c:
* libguile/lightning/lib/jit_rewind.c:
* libguile/lightning/lib/jit_size.c: Define DISASSEMBLER to 0.
* libguile/lightning/lightning.am (lightning_c_files): Remove
  jit_disasm.c.
2018-07-01 10:46:56 +02:00
Andy Wingo
8316707594 Further lightning integration work
* libguile/lightning/configure.ac: Start trimming down for inclusion in
  configure.ac.  Remove check for getopt things; we don't include bits
  of lightning that use getopt. Remove check for stdint, as we will have
  it.
* libguile/lightning/include/lightning.h: Unconditionally include
  stdint.h.
2018-06-30 12:07:00 +02:00
Andy Wingo
fddd2069ed Remove some more of the lightning build machinery
* libguile/lightning/Makefile.am:
* libguile/lightning/lib/Makefile.am: Remove.
* libguile/lightning/lightning.am: Add all the C and H files here.
* libguile/lightning/configure.ac: Remove AC_OUTPUT clause.
2018-06-30 12:03:24 +02:00
Andy Wingo
2e489b3e5b Remove empty lightning m4 directory
* libguile/lightning/Makefile.am:
* libguile/lightning/configure.ac:
* libguile/lightning/m4/.gitkeep.
2018-06-30 12:03:24 +02:00
Andy Wingo
0e25ee5693 Remove lightning pkg-config file.
* libguile/lightning/lightning.pc.in: Remove.
* libguile/lightning/configure.ac:
* libguile/lightning/Makefile.am: Adapt.
2018-06-30 12:03:24 +02:00
Andy Wingo
f0891bed0b Beginnings of build integration of lightning and guile
* libguile/lightning/lightning.am: New file.  libguile will include
  this. Contents initially from include/Makefile.am and
  include/lightning/Makefile.am.
* libguile/lightning/include/Makefile.am:
* libguile/lightning/include/lightning/Makefile.am: Remove.
* libguile/lightning/configure.ac: Remove output of include Makefiles.
2018-06-30 12:03:12 +02:00
Andy Wingo
8810163627 Finish removing get-jit-size
* libguile/lightning/include/lightning/jit_private.h:
* libguile/lightning/lib/Makefile.am:
* libguile/lightning/lib/jit_ia64.c (_emit_code):
* libguile/lightning/lib/jit_size.c (jit_init_size, jit_finish_size):
* libguile/lightning/lib/lightning.c (_jit_regarg_set, _jit_regarg_clr):
  (_jit_realize, _jit_emit): Remove case where GET_JIT_SIZE is set.
2018-06-30 11:23:00 +02:00
Andy Wingo
0bdd27bdf6 Remove lightning unit tests
* libguile/lightning/configure.ac:
* libguile/lightning/Makefile.am:
* libguile/lightning/check: Remove unit tests.  If there is a problem
  with lightning on this target, users should check if the upstream tests
  pass.  Otherwise we will find errors via the Guile test suite.
2018-06-30 11:18:34 +02:00
Andy Wingo
7dec6cbb9e Remove documentation from embedded GNU lightning
* libguile/lightning/Makefile.am:
* libguile/lightning/configure.ac:
* libguile/lightning/doc: Remove documentation.  JIT hackers should use
  upstream's documentation.
2018-06-30 11:16:22 +02:00
Andy Wingo
25584ea4f9 Strip "get-jit-size" feature from lightning.
* libguile/lightning/Makefile.am:
* libguile/lightning/configure.ac:
* libguile/lightning/size.c: Remove devel-only "get-jit-size" feature.
2018-06-30 11:14:25 +02:00
Andy Wingo
40aafa5279 Merge GNU lightning to libguile/lightning
* libguile/lightning/: New directory, made by the following commands:

  git remote add lightning https://git.savannah.gnu.org/git/lightning.git
  git merge -s ours --no-commit --allow-unrelated-histories lightning/master
  git read-tree --prefix=libguile/lightning/ -u lightning/master

  In theory we will be able to update via:

  git merge -s subtree lightning/master
2018-06-30 10:54:39 +02:00
Ludovic Courtès
23af45e248 vm: Fix stack-marking bug in multi-threaded programs.
Fixes <https://bugs.gnu.org/28211>.

* libguile/vm-engine.c (call, call_label, handle_interrupts): Add
'new_fp' variable; set the dynamic link and return address of the frame
at NEW_FP before setting 'vp->fp'.  This fixes a bug whereby, in a
multi-threaded context, the stack-marking code could run after vp->fp
has been set but before its dynamic link has been set, leading the
stack-walking code in 'scm_i_vm_mark_stack' to exit early on.
2018-06-29 22:28:48 +02:00
Ludovic Courtès
b87068eee7 linker: Don't rely on out-of-range bv-ref exceptions.
* module/system/vm/linker.scm (find-shstrndx): Check whether NAME is
lower than the length of BV; remove 'false-if-exception' around
'string-table-ref' call.
2018-06-28 17:14:08 +02:00
Andy Wingo
b5dcdf2e25 Revert "Refactor hook dispatch in VM"
This reverts commit 593e2db1dd.  The goto
strategy works for hooks that run just before a "next"; it doesn't work
for ones that run at the beginning of opcodes.
2018-06-27 20:19:40 +02:00
Andy Wingo
593e2db1dd Refactor hook dispatch in VM
* libguile/vm-engine.c (GOTO_HOOK, HOOK_HANDLER): Split hooks that don't
  take args into a "goto" side and a "target" side.  The idea is to just
  reify the hook call at one place in the binary, since the VM
  continuation is fully in the registers.
  (APPLY_HOOK, PUSH_CONTINUATION_HOOK, NEXT_HOOK)
  (ABORT_CONTINUATION_HOOK): Reimplement in terms of goto hooks.
  (POP_CONTINUATION_HOOK): This one is still old-style.
  (CONTINUE): New helper definition.
  (call, call-label): Move the push-continuation hooks up a bit, so it's
  clear they don't depend on intermediate opcode state.
  (vm_engine): Reify hook handlers for apply, etc.
2018-06-27 19:56:55 +02:00
Andy Wingo
2a8d72f7e0 Microoptimizations to hook dispatch
* libguile/vm.c (vm_dispatch_hook): Add a check that we're in the debug
  engine and the trace level is positive.  Allows us to do cheaper
  checks for when to dispatch hooks.
  (scm_call_n): Just check if trace level is nonzero.
* libguile/vm-engine.c (RUN_HOOK): Likewise just check if trace level is
  nonzero.
2018-06-27 19:26:03 +02:00
Andy Wingo
19cff78bb5 Minor optimizations to debug hook dispatch
* libguile/vm.c (scm_call_n): Only call hooks if the engine supports
  it.
  (vm_dispatch_abort_hook, vm_dispatch_next_hook)
  (vm_dispatch_pop_continuation_hook, vm_dispatch_push_continuation_hook)
  (vm_dispatch_apply_hook, vm_dispatch_hook): Take a thread as arg
  instead of VM, because that will probably already be in a register in
  the VM.  Given that all values are taken relative to the SP, no
  need to pass that either.
* libguile/vm-engine.c (RUN_HOOK0, RUN_HOOK1): Update appropriately.
2018-06-27 19:16:38 +02:00
Andy Wingo
9c8c4060dd Remove "resume" arg from vm engine
* libguile/vm-engine.c (vm_engine): Remove "resume" argument; scm_call_n
  will handle the differences.
* libguile/vm.c (scm_call_n): Inline handling of what to do in normal
  and resume cases.  Remove resume argument to vm_engine.
2018-06-27 18:57:37 +02:00
Andy Wingo
64d114817a Intrinsics take registers from thread
* libguile/continuations.c (scm_i_make_continuation): Remove registers
  argument; instead get from thread.
* libguile/vm-engine.c (vm_engine): Adapt VM engine to not receive a
  registers argument, and thus to not pass it to intrinsics either.
* libguile/intrinsics.h:
* libguile/intrinsics.c (push_prompt):
* libguile/vm.c (capture_continuation, compose_continuation)
  (abort_to_prompt): Refactor these intrinsics to not take a registers
  argument; it's not necessary.
  (scm_call_n): Don't pass registers argument.
2018-06-27 18:42:21 +02:00
Andy Wingo
154a5de3d7 Minor scm_thread refactoring
* libguile/threads.h (scm_thread): Move stack base to be closer to
  related fields, and add a comment for why it's there.
2018-06-27 18:29:46 +02:00
Andy Wingo
18431e6e63 Refactor handling of active VM registers
* libguile/threads.h (scm_thread): Remove unused jmp_buf regs member.
* libguile/vm.h (struct scm_vm): Rename resumable_prompt_cookie to just
  "registers"; we know it's a jmp_buf pointer.
* libguile/vm.c (scm_call_n):
* libguile/throw.c (catch):
* libguile/eval.c (eval):
* libguile/control.c (scm_suspendable_continuation_p): Adapt to cookie
  renaming.
2018-06-27 18:21:04 +02:00
Andy Wingo
fd4eb14751 Use CALL_INTRINSICS helper in VM
* libguile/vm-engine.c (CALL_INTRINSIC): New helper macro.
  (ALLOC_FRAME, vm_engine): Use CALL_INTRINSIC when we need to call
  intrinsics.  GCC still doesn't allocate intrinsics to a register
  though!
2018-06-27 18:07:49 +02:00
Andy Wingo
7e11c992f3 bind-rest inst uses cons-rest intrinsic
* libguile/vm-engine.c (bind-rest): Use cons-rest intrinsic to build the
  rest list.
2018-06-27 17:40:46 +02:00
Andy Wingo
294e627c6b Intrinsic for "prompt"
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS):
* libguile/intrinsics.c (push_prompt, scm_bootstrap_intrinsics): New
  intrinsic.
* libguile/vm-engine.c (prompt): Use push-prompt intrinsic.
2018-06-27 15:29:49 +02:00
Andy Wingo
85ab5f0299 Remove dedicated current-module instruction.
* libguile/vm-engine.c (current-module): Remove instruction.
2018-06-27 15:06:40 +02:00
Andy Wingo
8918165c40 Compile current-module as intrinsic call
* libguile/fluids.c (scm_i_fluid_ref): New internal function.
  (scm_fluid_ref): Use scm_i_fluid_ref.
* libguile/intrinsics.h:
* libguile/intrinsics.c (current_module): New intrinsic.
* libguile/modules.c (scm_i_current_module): New internal function.
  (scm_current_module): Use new internal function.
* module/language/cps/reify-primitives.scm (compute-known-primitives):
  Add current-module as an intrinsic primitive.
* module/system/vm/assembler.scm (define-scm<-thread-intrinsic):
  (current-module): Arrange to compile to intrinsic call.
2018-06-27 14:57:51 +02:00
Andy Wingo
0faa4144d1 allocate-words intrinsic
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS):
* libguile/intrinsics.c (allocate_words, scm_bootstrap_intrinsics): New
  intrinsic.
* libguile/vm-engine.c (allocate-words, allocate-words/immediate): Use
  new intrinsic.
2018-06-27 14:56:39 +02:00
Andy Wingo
7883290d88 Inline handling of non-program apply
* libguile/vm.c (vm_apply_non_program_code): Remove, now unneeded.
* libguile/vm-engine.c (vm_engine, call, tail-call, tail-call/shuffle)
  (tail-apply, call/cc): Inline handling of non-programs, as will be the
  case with JIT code.
2018-06-27 13:54:45 +02:00
Andy Wingo
1735cc1fec Apply-non-program is an intrinsic
* libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): Add
  apply-non-program intrinsic.
* libguile/vm-engine.c (apply-non-program): Replace impl with call to
  intrinsic.
* libguile/vm.c (vm_error_wrong_type_apply): Inline into
  apply_non_program intrinsic.
  (apply_non_program): New intrinsic.
  (scm_bootstrap_vm): Wire it up.
2018-06-27 13:38:30 +02:00
Andy Wingo
adf8d9353e Remove mention of vm-error from test suite
* test-suite/test-suite/lib.scm (exception:vm-error): Remove.
* test-suite/tests/strings.test: Remove override of
  exception:wrong-type-arg; not needed since a while ago.
2018-06-27 09:52:10 +02:00