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

9310 commits

Author SHA1 Message Date
Andy Wingo
926b72f5ac Rework program->ip mapping in VM to always call intrinsic
* libguile/intrinsics.h:
* libguile/vm.c (get_callee_vcode): Rename from apply_non_program, and
  instead return the IP for the callee of a frame.
  (scm_call_n, scm_bootstrap_vm): Adapt to get_callee_vcode change.
* libguile/vm-engine.c (call, tail-call, call/cc): Use
  get_callee_vcode unconditionally.  JIT will do this to avoid so much
  code generation for calls.
2018-08-08 15:22:28 +02:00
Andy Wingo
b7dbc7251f Minor optimization in RESET_FRAME
* libguile/vm-engine.c (RESET_FRAME): Remove update of sp_min_since_gc.
2018-08-08 14:48:32 +02:00
Andy Wingo
0d00164f8a Add missing include to adapt to recent merge from master
* libguile/r6rs-ports.c: Add syscalls.h include for scm_from_off_t.
2018-08-07 12:57:30 +02:00
Andy Wingo
41100f7786 Merge branch 'master' into lightning
This includes a manual cherry-pick of relevant stable-2.2 commits up to
4c91de3e45.
2018-08-07 12:43:25 +02:00
Ludovic Courtès
04aa6d1fb7 r6rs-ports: 'put-bytevector' accepts 64-bit integers.
* libguile/r6rs-ports.c (scm_put_bytevector): Use 'size_t' for c_start,
c_count, and c_len.
2018-08-07 12:34:27 +02:00
Ludovic Courtès
0075b7f4dc r6rs-ports: Accept 'port-position' values greater than 2^32.
Reported by Ricardo Wurmus <rekado@elephly.net>.
Fixes <https://bugs.gnu.org/32161>.

* libguile/r6rs-ports.c (custom_binary_port_seek): Use 'scm_to_off_t'
instead of 'scm_to_int'.
* test-suite/tests/r6rs-ports.test ("8.2.7 Input Ports")["custom binary
input port position, long offset"]: New test.
2018-08-07 12:33:47 +02:00
Ludovic Courtès
8840ee5a3c 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-08-07 12:31:11 +02:00
Ludovic Courtès
6a95c8e77a GDB support: Add 'guile-backtrace' command.
* libguile/libguile-2.2-gdb.scm <top level>: Add 'register-command!' call.
2018-08-07 12:14:05 +02:00
Ludovic Courtès
90fe975188 GDB support: Add note about (gdb frame-filters).
* libguile/libguile-2.2-gdb.scm <top level>: Add comment.
2018-08-07 12:13:58 +02:00
Ludovic Courtès
6e57d0d56e GDB support: Fix 'display-vm-frames'.
Previously 'vm-frame-older' would fail to traverse the chain of frames.

* libguile/libguile-2.2-gdb.scm (uint-type): New variable
(vm-frame): Fix "saved ip" and "saved fp" computation.  The latter had
been broken roughly since commit
72353de77d.
(vm-frame-older): Return #f when IP is zero, not when FP is zero.
(vm-frame-function-name): Wrap 'vm-frame-program-debug-info' in
'false-if-exception'
2018-08-07 12:13:52 +02:00
Ludovic Courtès
ffc1b9f3ac vm: Fix another typo.
Fix typo introduced in efc33cd149.

* libguile/vm.c (return_unused_stack_to_os): Remove extra 'while'.
2018-08-07 12:13:35 +02:00
Ludovic Courtès
25c719b412 Add 'scm_to_stringn' shortcut when converting to UTF-8.
* libguile/strings.c (scm_to_stringn): Call 'scm_to_utf8_stringn' when
ENCODING == "UTF-8".
2018-08-07 12:10:32 +02:00
Ludovic Courtès
edc80bd595 Module import obarrays are accessed in a critical section.
Fixes <https://bugs.gnu.org/31879>.

* libguile/modules.c (import_obarray_mutex): New variable.
(resolve_duplicate_binding, module_imported_variable): Acquire it before
accessing an obarray.
2018-08-07 12:10:05 +02:00
Jan Smydke
4853ca3e6d get-bytevector-n and get-bytevector-n! can now read more than 4 GB
* libguile/r6rs-ports.c (scm_get_bytevector_n, scm_get_bytevector_n_x):
Turn 'c_count' and related variables into a 'size_t', and use
'scm_to_size_t' instead of 'scm_to_uint'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2018-08-07 12:09:25 +02:00
Ludovic Courtès
4611ba2fcf vm: Fix typo when checking for 'madvise' error code.
* libguile/vm.c (return_unused_stack_to_os): Check for EAGAIN, not -EAGAIN.
2018-08-07 12:09:19 +02:00
Mark H Weaver
a44c2a679f Fix error reporting in 'load-thunk-from-memory'.
Previously 'load-thunk-from-memory' would often throw to 'system-error'
based on a stale value in 'errno', leading to incorrect error messages.

* libguile/loader.c (load_thunk_from_memory): Set 'errno' to 0 before
jumping to cleanup in the ABORT preprocessor macro, and also in the case
when 'process_dynamic_segment' reports an error.
2018-08-07 12:06:19 +02:00
Mark H Weaver
5f7213e12c Fix typo in comment within numbers.c 2018-08-07 11:41:20 +02:00
Ludovic Courtès
08041d216f build: Use 'sed' invocation compatible with BSD sed.
Fixes <https://bugs.gnu.org/30011>.
Reported by ilove zfs <ilovezfs@icloud.com>.

* libguile/Makefile.am (INSTANTIATE): Move '-i' first.
2018-08-07 11:39:35 +02:00
Ludovic Courtès
666f12c871 'select' returns empty sets upon EINTR and EAGAIN.
Fixes <https://bugs.gnu.org/30368>.

* libguile/filesys.c (scm_select): Clear READ_SET, WRITE_SET, and
EXCEPT_SET when RV < 0.
2018-08-07 11:39:11 +02:00
Ludovic Courtès
2245c67c37 Revert "Honor '%fresh-auto-compile'."
This reverts commit 83d4c4d622,
which came from a misunderstanding.
2018-08-07 11:37:11 +02:00
Ludovic Courtès
921364df27 Make sure the return value of 'scm_crypt' is always initialized.
* libguile/posix.c (scm_crypt): Always initialize 'ret'; error out even
when ERR is zero.
2018-08-07 11:36:10 +02:00
Ludovic Courtès
c5e1d6eaf4 'load-thunk-from-memory' reports the correct error.
Previously 'load-thunk-from-memory' would often throw to 'system-error'
when passed an incorrect ELF file, leading to incorrect error messages.

* libguile/loader.c (load_thunk_from_memory): Reset 'errno' when
'check_elf_header' returns non-NULL.
* test-suite/tests/vm.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add it.
2018-08-07 11:34:35 +02:00
Ludovic Courtès
a4c4deb5b0 Fix 'crypt' deadlock upon error.
* libguile/posix.c (scm_crypt): Take 'scm_i_misc_mutex' right before
calling 'crypt'.  Move 'SCM_SYSERROR' call after 'scm_dynwind_end'.
* test-suite/tests/posix.test ("crypt"): New test prefix.
2018-08-07 11:34:02 +02:00
Andy Wingo
0a01963d07 VM hooks take no values
* libguile/vm-engine.c (RUN_HOOK0, RUN_HOOK1): Remove.
  (RUN_HOOK): Take hook name.
  (APPLY_HOOK, RETURN_HOOK, NEXT_HOOK, ABORT_CONTINUATION_HOOK): Use
  RUN_HOOK.
* libguile/vm.c (vm_dispatch_hook): Remove value count arg; hooks no
  longer receive values (e.g. the return hook now uses
  frame-return-values).
  (vm_dispatch_abort_hook): Remove value count, which was bogus because
  the active frame was the continuation which might contain other
  locals, potentially unboxed, not the implicit return-values frame.  In
  the future we could push on an implicit return-values frame instead.
* module/system/vm/traps.scm (trap-in-procedure, trap-frame-finish):
  (trap-in-dynamic-extent, trap-calls-to-procedure): Adapt abort hooks
  to not take values.  They weren't being used anyway!
2018-08-07 11:05:56 +02:00
Andy Wingo
f4c50447dd Remove push continuation hook; return hook runs before FP pop
* libguile/frames.c (scm_frame_return_values): New function, for use
  when a frame is at "return-values".
  (scm_init_frames_builtins): Register frame-return-values.
* libguile/vm-engine.c (RETURN_HOOK): Rename from POP_CONTINUATION_HOOK.
  (call, call-label): Remove PUSH_CONTINUATION_HOOK; it's unneeded, as
  you can always check the FP from an apply hook.
  (return-values): Run return hook before popping frame.
* libguile/vm.c (vm_dispatch_return_hook): Rename from
  vm_dispatch_pop_continuation_hook.  Remove push continuation hook.
  (scm_vm_return_hook):
* libguile/vm.h (SCM_VM_PUSH_CONTINUATION_HOOK): Remove.
  (SCM_VM_RETURN_HOOK): Rename from SCM_VM_POP_CONTINUATION_HOOK.
* module/system/vm/frame.scm (frame-return-values): Export.
* module/system/vm/trace.scm (print-return, trace-calls-to-procedure)
  (trace-calls-in-procedure): Adapt to not receiving values as
  arguments.
* module/system/vm/traps.scm (trap-in-procedure, trap-frame-finish):
  Adapt to return hook coming from returning frame.
  (program-sources-by-line): Update to use match instead of pmatch.
* module/system/vm/traps.scm (trap-in-dynamic-extent)
  (trap-calls-to-procedure): Adapt to return hook not receiving values.
* module/system/vm/vm.scm: Remove push continuation hook and rename
  return hook.
2018-08-06 17:00:45 +02:00
Andy Wingo
dedf73d370 Consolidate apply hook to instrument-entry instruction
* libguile/vm.c (scm_call_n):
* libguile/vm-engine.c: Move apply hook to "instrument-entry"
  instruction.
2018-08-06 15:07:26 +02:00
Andy Wingo
8f25f75bf1 Add instrument-entry to continuations
* libguile/continuations.c (goto_continuation_code):
* libguile/control.c (compose_continuation_code): Add JIT
  instrumentation.  Unlike foreign or subr routines, we leave these as
  closures; it doesn't make sense to JIT for any particular
  continuation.
2018-08-06 14:59:48 +02:00
Andy Wingo
14539d3986 Alloc foreign procedures using primitive mechanism
* libguile/foreign.c (get_foreign_stub_code): Use
  scm_i_alloc_primitive_code_with_instrumentation.  This will allow FFI
  procedures to be JITted, and allow us to move the apply hook to
  instrument-entry.
2018-08-06 13:35:41 +02:00
Andy Wingo
455015d8e9 Fix bugs with primitive code allocator; expose internally
* lib/Makefile.am: Explicitly add flexmember.  Already included though.
* libguile/gsubr.c (alloc_subr_idx, record_subr_name): Factor out an
  "expected subr count" variable.
  (alloc_chunk, alloc): Rework so that when the arena grows, old code is
  still recognized as primitive.
  (scm_i_alloc_primitive_code_with_instrumentation): Fix bug whereby the
  JIT function data was initialized at a bogus address, because we were
  adding to a uint32_t* instead of a char*.  Make internally public.
  (is_primitive_code): Recognize all allocated code as primitive.
  (alloc_subr_code): Adapt to
  scm_i_alloc_primitive_code_with_instrumentation rename.
  (primitive_subr_idx): If the call IP isn't a subr-call, return a
  sentinel value.
  (scm_i_primitive_name, scm_subr_function): Allow for primitives that
  aren't subrs.
* libguile/gsubr.h: Decalre
  scm_i_alloc_primitive_code_with_instrumentation.
2018-08-06 13:30:50 +02:00
Andy Wingo
5ebe58419e Revert "Add support for reading ELF symbol table from C"
This reverts commit e95f15c932.  It's no
longer needed given the current JIT strategy.
2018-07-29 16:11:38 +02:00
Andy Wingo
b8a9a666f1 Rewrite subr implementation
* libguile/gsubr.c: Reimplement to store subr names and procedures in a
  side table, and to allocate fresh vcode for each subr.  This allows
  JIT of subrs, moves to a uniform all-code-starts-with-instrument-entry
  regime, and also allows statprof to distinguish between subrs based on
  IP.
* libguile/gsubr.h (SCM_SUBRF, SCM_SUBR_NAME): Call out to functions,
  now that these are in a side table.
  (scm_subr_function, scm_subr_name): New exports.
  (scm_i_primitive_name): New internal function, for looking up a
  primitive name based on IP.
  (scm_apply_subr): Take the subr index.
* libguile/vm-engine.c (subr-call):
* libguile/jit.c (compile_subr_call): Adapt to take index as arg.
* module/statprof.scm (sample-stack-procs, count-call):
  (stack-samples->procedure-data): Update to always record IP in stack
  samples and call counts.
* module/system/vm/frame.scm (frame-procedure-name): Simplify.
  (frame-instruction-pointer-or-primitive-procedure-name): Removed.
* libguile/programs.h:
* libguile/programs.c (scm_primitive_code_name): New function.
* module/system/vm/program.scm (primitive-code-name): New export.
2018-07-29 15:47:07 +02:00
Andy Wingo
5077e67371 Fix function bound offsets of JIT data to be signed
* libguile/jit.h (struct scm_jit_function_data): Start and end offsets
  are signed.
2018-07-29 15:47:07 +02:00
Andy Wingo
5c2e155fd7 Emit instrument-entry before programs
* module/system/vm/assembler.scm (<jit-data>, <meta>): Rework to have
  <meta> create the <jit-data> in the end-program, so that jit-data
  isn't mutable.  Record start and end PC values relative to '.rtl-text
  so that we don't need any more linker symbols.
  (emit-instrument-entry*, emit-instrument-loop*, begin-program):
  (end-program): Adapt.
  (begin-kw-arity): Include the initial instrument-entry in the first
  arity.
  (link-data, link-constants): Write the init routine before interning
  constants so that we correctly emit the jit-data for the init
  routine.
* libguile/programs.c (try_parse_arity): Skip over a
  scm_op_instrument_entry, if any.
2018-07-29 15:47:07 +02:00
Andy Wingo
a6b5049aa8 Emit instrument-loop in loops.
* am/bootstrap.am (SOURCES):
* module/Makefile.am (SOURCES): Handle renamve of handle-interrupts.scm
  to loop-instrumentation.scm.
* libguile/jit.h (SCM_JIT_COUNTER_ENTRY_INCREMENT): Rename from
  SCM_JIT_COUNTER_CALL_INCREMENT.
* libguile/vm-engine.c (instrument-entry): Rename from instrument-call.
* module/language/cps/compile-bytecode.scm (compile-function): Add
  handle-interrupts code before calls and returns.  Compile the
  "instrument-loop" primcall to an "instrument-loop" instruction and a
  "handle-interrupts" instruction.
  (lower-cps): Adapt to add-loop-instrumentation name change.
* module/language/cps/loop-instrumentation.scm: Rename from
  handle-interrupts.scm and just add "instrument-loop" primcalls in
  loops.  The compiler will add handle-interrupts primcalls as
  appropriate.
* module/system/vm/assembler.scm (<jit-data>): New data type, for
  emitting embedded JIT data.
  (<meta>): Add field for current JIT data.
  (make-meta): Initialize current JIT data.
  (emit-instrument-entry*, emit-instrument-loop*): New instruction
  emitters that reference the current JIT data.
  (end-program): Now that all labels are known, arrange to serialize the
  JIT data.
  (link-data): Reserve space for JIT data, and add relocs to initialize
  the "start" / "end" fields.
2018-07-29 15:47:07 +02:00
Andy Wingo
87da1c8d20 Add instrument-call, instrument-loop VM instructions
* libguile/jit.h (struct scm_jit_function_data)
  (enum scm_jit_counter_value): New data types.
* libguile/jit.c (scm_jit_compute_mcode, scm_jit_enter_mcode): New
  function stubs.  Adapt label/offset compilers to take pointers.
* libguile/vm-engine.c (instrument-call, instrument-loop): New
  instructions.
* libguile/vm.c: Add jit.h include.
* module/system/vm/assembler.scm (emit-instrument-call)
  (emit-instrument-loop): New exports.
2018-07-29 15:47:03 +02:00
Andy Wingo
4b7af0b7fd Update frames.h comments.
* libguile/frames.h: Update to match reality.
2018-07-23 11:23:18 +02:00
Ludovic Courtès
741c45458d r6rs-ports: 'put-bytevector' accepts 64-bit integers.
* libguile/r6rs-ports.c (scm_put_bytevector): Use 'size_t' for c_start,
c_count, and c_len.
2018-07-20 11:43:27 +02:00
Andy Wingo
950a762dc2 Multiple-value returns now start from slot 0, not slot 1
This should reduce frame sizes.

* libguile/vm-engine.c (halt): Adapt to multiple-values change.  Also
  adapt to not having the boot closure on the stack.
  (receive, receive-values, subr-call, foreign-call): Adapt to expect
  values one slot down.
  (prompt): Capture one less word for the values return.
* libguile/vm.c (vm_dispatch_pop_continuation_hook):
  (vm_dispatch_abort_hook): Adapt for where to expect values.
  (vm_builtin_values_code): Add a call to shuffle-down before
  returning.  This is more overhead than what existed before, but the
  hope is that the savings elsewhere pay off.
  (vm_builtin_values_code): Adapt to different values location.
  (reinstate_continuation_x, compose_continuation): Adapt to place
  resume args at right position.
  (capture_delimited_continuation): Remove unused sp and ip arguments.
  (abort_to_prompt): Adapt to capture_delimited_continuation change.
  (scm_call_n): Adapt to not reserve space for the boot closure.
* module/language/cps/compile-bytecode.scm (compile-function): When
  returning values, adapt reset-frame call for return calling convention
  change.  Adapt truncating or rest returns to expect values in the
  right place.
* module/language/cps/slot-allocation.scm (compute-shuffles):
  (allocate-lazy-vars, allocate-slots): Allocate values from the "proc
  slot", not proc-slot + 1.
* module/system/vm/assembler.scm (emit-init-constants): Reset the frame
  before returning so that the return value is in the right place.
* test-suite/tests/rtl.test: Update for return convention change.
* libguile/foreign.c (get_foreign_stub_code): Update for return calling
  convention change.
2018-07-20 11:42:30 +02:00
Andy Wingo
9b70129504 Fix stale stack frame clearing for frame size change
* libguile/vm-engine.c (return-values): Clear all 3 stack slots.  Not
  sure this is necessary though!
2018-07-20 11:42:30 +02:00
Andy Wingo
c2a8224a63 Rework VM approach to shuffling unknown numbers of args
* libguile/vm-engine.c (shuffle-down, expand-apply-argument): New
  instructions.
  (tail-call, tail-call-label, return-values): Don't reset the frame.
  The compiler should reset the frame appropriately.
  (tail-call/shuffle, tail-apply): Remove unused instructions.
* libguile/vm.c (vm_builtin_apply_code): Use new shuffle-down and
  expand-apply-argument opcodes.
  (vm_builtin_call_with_values_code): Replace tail-call/shuffle with
  shuffle-down then tail-call.
* libguile/jit.c (compile_shuffle_down, compile_expand_apply_argument):
  Add compiler stubs
  (COMPILE_X8_F12_F12): New definition.
  (compile_tail_call_shuffle, compile_tail_apply): Remove unused
  compilers.
* module/language/cps/compile-bytecode.scm (compile-function): Emit
  reset-frame before tail calls and returns.
* module/system/vm/assembler.scm (system): Remove unbound "emit-return"
  export.
* module/system/vm/disassembler.scm (code-annotation)
  (instruction-has-fallthrough?, define-stack-effect-parser): Adapt for
  opcode changes.
2018-07-20 11:42:30 +02:00
Andy Wingo
043432fd57 Reserve frame word for machine return address
* libguile/frames.h: Add machine return address to diagram.
  (SCM_FRAME_MACHINE_RETURN_ADDRESS):
  (SCM_FRAME_SET_MACHINE_RETURN_ADDRESS): New macros.
  (SCM_FRAME_PREVIOUS_SP):
  (SCM_FRAME_DYNAMIC_LINK):
  (SCM_FRAME_SET_DYNAMIC_LINK): Adapt for new frame size.
* libguile/vm-engine.c (halt): Set frame size to 3.
  (call, call-label): Set mRA to 0.
* libguile/vm.c (push_interrupt_frame, reinstate_continuation_x):
  (scm_call_n): Set frame size to 3.  In push_interrupt_frame, init the
  mRA of the frame.
  (vm_builtin_call_with_values_code, vm_handle_interrupt_code): Allocate
  larger frames.
* module/language/cps/slot-allocation.scm (allocate-slots): Frame size
  is 3.
* module/system/vm/disassembler.scm (define-clobber-parser): Bump frame
  size.
2018-07-20 11:42:30 +02:00
Andy Wingo
b1705bd0f0 Prepare for frames having separate virtual and machine return addrs
* libguile/frames.c (scm_frame_return_address): Use
  SCM_FRAME_VIRTUAL_RETURN_ADDRESS.
  (scm_c_frame_previous): Likewise.
* libguile/frames.h: Update diagram for new names.
  (union scm_vm_stack_element): Rename "as_ip" to "as_vcode", and
  add "as_mcode" for machine code pointers.
  (SCM_FRAME_VIRTUAL_RETURN_ADDRESS)
  (SCM_FRAME_SET_VIRTUAL_RETURN_ADDRESS): Rename to these, from
  SCM_FRAME_RETURN_ADDRESS and SCM_FRAME_SET_RETURN_ADDRESS.
* libguile/vm-engine.c (halt, call, call-label, return-values)
  (return-from-interrupt): Adapt to renamings.  Make "halt" have frame
  size as a parameter.
* libguile/vm.c (scm_i_vm_mark_stack): Adapt to renaming.
  (push_interrupt_frame): Take mRA as additional argument.  In future we
  will set it as frame mRA.
  (capture_continuation): Adapt to renaming.
  (scm_call_n): Adapt to renaming and make frame size adjustable.
  (push_interrupt_frame, reinstate_continuation_x): Make frame size
  adjustable.
* module/language/cps/slot-allocation.scm (allocate-slots): Make frame
  size adjustable.
* libguile/intrinsics.h (scm_t_thread_mra_intrinsic): New type; use for
  push_interrupt_frame.
  (scm_t_thread_u8_scm_sp_vra_intrinsic): Rename from the same but was
  "ra" instead of "vra", and change type to uint32_t*.
* module/system/vm/disassembler.scm (define-clobber-parser):
  Parameterize clobber set for calls by frame size.
2018-07-20 11:42:30 +02:00
Andy Wingo
e95f15c932 Add support for reading ELF symbol table from C
* libguile/loader.c (scm_i_program_address_range): New function.
  Currently unused, will wire up once we correct the compiler to emit
  symbols whose values are relative to the base addr.  Will be used by
  JIT so it needs to be fast.
  (register_elf): Rework to be less verbose, and record symtab/strtab.
  (struct mapped_elf_image): Add symtab and strtab members.
  (load_thunk_from_memory, process_dynamic_segment): Parse out DT_SYMTAB
  and DT_STRTAB.
  (Elf_Sym): New definition.
2018-07-20 11:42:13 +02:00
Andy Wingo
80ba0e2cb1 Make JIT compiler skeleton more terse
* libguile/jit.c (scm_jit_state): Add "ip" member so we don't have to be
  passing it around all the time.  Rename use variables to "j" from
  "state".
2018-07-20 11:42:13 +02:00
Andy Wingo
9fc5282ca5 Merge 'master' into 'lightning' 2018-07-20 11:41:54 +02:00
Ludovic Courtès
d677aca5c5 r6rs-ports: Accept 'port-position' values greater than 2^32.
Reported by Ricardo Wurmus <rekado@elephly.net>.
Fixes <https://bugs.gnu.org/32161>.

* libguile/r6rs-ports.c (custom_binary_port_seek): Use 'scm_to_off_t'
instead of 'scm_to_int'.
* test-suite/tests/r6rs-ports.test ("8.2.7 Input Ports")["custom binary
input port position, long offset"]: New test.
2018-07-19 18:00:19 +02:00
Andy Wingo
e6461cf1b2 Fix errors introduced when giving multiple-values objects a tc7
* libguile/values.c (scm_c_value_ref): Fix a case in which a request for
  the 0th value of a zero-valued object would return the object instead
  of erroring.
* libguile/vm-engine.c (halt): Fix construction of a multiple-valued
  return (off-by-one error).  Fixes a crash introduced in
  4a2d78b4d4.
2018-07-16 12:16:58 +02:00
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