mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Replace "pr" struct fields with "pw" fields
* libguile/struct.h (SCM_VTABLE_BASE_LAYOUT): Layout is a "pr" field. * module/ice-9/boot-9.scm (record-type-vtable): Record vtable fields are writable. (<parameter>): "pw" fields. * module/oop/goops.scm (<class>, %compute-layout): <read-only> fields are "pw" underneath. * module/rnrs/records/procedural.scm (record-type-vtable) (record-constructor-vtable, make-record-type-descriptor): Use "pw" fields in vtables. * module/srfi/srfi-35.scm (%condition-type-vtable) (struct-layout-for-condition): "pw" fields in vtables. * test-suite/tests/goops.test: * test-suite/tests/structs.test: Use "pw" fields only. * benchmark-suite/benchmarks/structs.bm: Update for make-struct/no-tail, to use pw fields, and also to remove useless tests that the compiler would optimize away. * doc/ref/api-data.texi (Vtables): Add a note about the now-vestigial permissions character and update documentation. (Structure Basics, Meta-Vtables): Update examples. * libguile/hash.c (scm_i_struct_hash): Remove code that would handle opaque/self fields. * libguile/print.h (SCM_PRINT_STATE_LAYOUT): Use "pw" fields. * libguile/struct.c (scm_struct_init): Simplify check for hidden fields. * libguile/values.c (scm_init_values): Field is "pw".
This commit is contained in:
parent
0f14a9e598
commit
5870188eb4
13 changed files with 83 additions and 112 deletions
|
@ -1,7 +1,7 @@
|
|||
;;; -*- mode: scheme; coding: iso-8859-1; -*-
|
||||
;;; Structs.
|
||||
;;;
|
||||
;;; Copyright 2009 Free Software Foundation, Inc.
|
||||
;;; Copyright 2009, 2017 Free Software Foundation, Inc.
|
||||
;;;
|
||||
;;; This program is free software; you can redistribute it and/or
|
||||
;;; modify it under the terms of the GNU Lesser General Public License
|
||||
|
@ -25,44 +25,27 @@
|
|||
(define iterations 2000000)
|
||||
|
||||
(define vtable2
|
||||
(make-vtable "prpr"))
|
||||
(make-vtable "pwpw"))
|
||||
|
||||
(define vtable7
|
||||
(make-vtable (string-concatenate (make-list 7 "pr"))))
|
||||
(make-vtable (string-concatenate (make-list 7 "pw"))))
|
||||
|
||||
|
||||
(with-benchmark-prefix "constructors"
|
||||
|
||||
(benchmark "make-struct2 (opcode)" iterations
|
||||
(make-struct vtable2 0 1 2))
|
||||
(benchmark "make-struct2" iterations
|
||||
(make-struct/no-tail vtable2 1 2))
|
||||
|
||||
(benchmark "make-struct2 (procedure)" iterations
|
||||
(let ((s make-struct))
|
||||
(s vtable2 0 1 2)))
|
||||
|
||||
(benchmark "make-struct7 (opcode)" iterations
|
||||
(make-struct vtable7 0 1 2 3 4 5 6 7))
|
||||
|
||||
(benchmark "make-struct7 (procedure)" iterations
|
||||
(let ((s make-struct))
|
||||
(s vtable7 0 1 2 3 4 5 6 7))))
|
||||
(benchmark "make-struct7" iterations
|
||||
(make-struct/no-tail vtable7 1 2 3 4 5 6 7)))
|
||||
|
||||
|
||||
(with-benchmark-prefix "pairs" ;; for comparison
|
||||
|
||||
(benchmark "cons (opcode)" iterations
|
||||
(benchmark "cons" iterations
|
||||
(cons 1 2))
|
||||
|
||||
(benchmark "cons (procedure)" iterations
|
||||
(let ((c cons))
|
||||
(c 1 2)))
|
||||
|
||||
(benchmark "list (opcode)" iterations
|
||||
(benchmark "list" iterations
|
||||
(list 1 2 3 4 5 6 7))
|
||||
|
||||
(benchmark "list (procedure)" iterations
|
||||
(let ((l list))
|
||||
(l 1 2 3 4 5 6 7)))
|
||||
|
||||
(benchmark "make-list" iterations
|
||||
(make-list 7)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue