mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-23 12:00:21 +02:00
Better aliased primcall compilation
* libguile/vm-engine.c (define!): Rename from define. * module/language/cps/arities.scm (fix-clause-arities): If a prim aliases an RTL instruction with a different name and we reify a primcall, reify the instruction name. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Update emit-define! for new name. * module/language/cps/primitives.scm (*rtl-instruction-aliases*): Add bytevector native accessors.
This commit is contained in:
parent
becce37b58
commit
6165d8120d
4 changed files with 29 additions and 6 deletions
|
@ -138,7 +138,11 @@
|
|||
,(match (prim-arity name)
|
||||
((out . in)
|
||||
(if (= in (length args))
|
||||
(adapt-exp out k exp)
|
||||
(adapt-exp out k
|
||||
(let ((inst (prim-rtl-instruction name)))
|
||||
(if (and inst (not (eq? inst name)))
|
||||
(build-cps-exp ($primcall inst args))
|
||||
exp)))
|
||||
(let-gensyms (k* p*)
|
||||
(build-cps-term
|
||||
($letk ((k* #f ($kargs ('prim) (p*)
|
||||
|
|
|
@ -280,7 +280,7 @@
|
|||
(($ $primcall 'set-cdr! (pair value))
|
||||
(emit-set-cdr! asm (slot pair) (slot value)))
|
||||
(($ $primcall 'define! (sym value))
|
||||
(emit-define asm (slot sym) (slot value)))
|
||||
(emit-define! asm (slot sym) (slot value)))
|
||||
(($ $primcall 'push-fluid (fluid val))
|
||||
(emit-push-fluid asm (slot fluid) (slot val)))
|
||||
(($ $primcall 'pop-fluid ())
|
||||
|
|
|
@ -38,9 +38,28 @@
|
|||
(* . mul) (/ . div)
|
||||
(quotient . quo) (remainder . rem)
|
||||
(modulo . mod)
|
||||
(define! . define)
|
||||
(variable-ref . box-ref)
|
||||
(variable-set! . box-set!)))
|
||||
(variable-set! . box-set!)
|
||||
(bytevector-u8-native-ref . bv-u8-ref)
|
||||
(bytevector-u16-native-ref . bv-u16-ref)
|
||||
(bytevector-u32-native-ref . bv-u32-ref)
|
||||
(bytevector-u64-native-ref . bv-u64-ref)
|
||||
(bytevector-s8-native-ref . bv-s8-ref)
|
||||
(bytevector-s16-native-ref . bv-s16-ref)
|
||||
(bytevector-s32-native-ref . bv-s32-ref)
|
||||
(bytevector-s64-native-ref . bv-s64-ref)
|
||||
(bytevector-f32-native-ref . bv-f32-ref)
|
||||
(bytevector-f64-native-ref . bv-f64-ref)
|
||||
(bytevector-u8-native-set! . bv-u8-set!)
|
||||
(bytevector-u16-native-set! . bv-u16-set!)
|
||||
(bytevector-u32-native-set! . bv-u32-set!)
|
||||
(bytevector-u64-native-set! . bv-u64-set!)
|
||||
(bytevector-s8-native-set! . bv-s8-set!)
|
||||
(bytevector-s16-native-set! . bv-s16-set!)
|
||||
(bytevector-s32-native-set! . bv-s32-set!)
|
||||
(bytevector-s64-native-set! . bv-s64-set!)
|
||||
(bytevector-f32-native-set! . bv-f32-set!)
|
||||
(bytevector-f64-native-set! . bv-f64-set!)))
|
||||
|
||||
(define *macro-instruction-arities*
|
||||
'((cache-current-module! . (0 . 2))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue