mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-14 23:50:19 +02:00
Compile some generic arithmetic to intrinsic calls
* libguile/intrinsics.h: Rename intrinsic types added in previous commit. * libguile/vm-engine.c (call-scm<-scm-scm, call-scm<-scm-uimm): New instructions. * libguile/vm.c: Include intrinsics.h. * module/language/bytecode.scm * module/language/bytecode.scm (*intrinsic-codes*, *intrinsic-names*): New internal definitions. (intrinsic-name->index, intrinsic-index->name): New exported definitions. * module/system/vm/assembler.scm (encode-X8_S8_S8_S8-C32<-/shuffle): (encode-X8_S8_S8_C8-C32<-/shuffle): New shuffling encoders. (shuffling-encoder-name): Add case for new shuffling encoders. (define-scm<-scm-scm-intrinsic, define-scm<-scm-uimm-intrinsic): New helpers. Define encoders for "add", etc.
This commit is contained in:
parent
4d530a94bb
commit
1f6f282f16
5 changed files with 130 additions and 30 deletions
|
@ -1,6 +1,6 @@
|
|||
;;; Bytecode
|
||||
|
||||
;; Copyright (C) 2013, 2017 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2013, 2017, 2018 Free Software Foundation, Inc.
|
||||
|
||||
;;;; This library is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -24,12 +24,16 @@
|
|||
#:export (instruction-list
|
||||
instruction-arity
|
||||
builtin-name->index
|
||||
builtin-index->name))
|
||||
builtin-index->name
|
||||
intrinsic-name->index
|
||||
intrinsic-index->name))
|
||||
|
||||
(load-extension (string-append "libguile-" (effective-version))
|
||||
"scm_init_instructions")
|
||||
(load-extension (string-append "libguile-" (effective-version))
|
||||
"scm_init_vm_builtins")
|
||||
(load-extension (string-append "libguile-" (effective-version))
|
||||
"scm_init_intrinsics")
|
||||
|
||||
(define (compute-instruction-arity name args)
|
||||
(define (first-word-arity word)
|
||||
|
@ -104,3 +108,22 @@
|
|||
|
||||
(define (instruction-arity name)
|
||||
(hashq-ref (force *instruction-arities*) name))
|
||||
|
||||
(define *intrinsic-codes*
|
||||
(delay (let ((tab (make-hash-table)))
|
||||
(for-each (lambda (pair)
|
||||
(hashv-set! tab (car pair) (cdr pair)))
|
||||
(intrinsic-list))
|
||||
tab)))
|
||||
|
||||
(define *intrinsic-names*
|
||||
(delay (let ((tab (make-hash-table)))
|
||||
(hash-for-each (lambda (k v) (hashq-set! tab v k))
|
||||
(force *intrinsic-codes*))
|
||||
tab)))
|
||||
|
||||
(define (intrinsic-name->index name)
|
||||
(hashq-ref (force *intrinsic-codes*) name))
|
||||
|
||||
(define (intrinsic-index->name index)
|
||||
(hashv-ref (force *intrinsic-names*) index))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue