From 317df964a492c2e5e24cc7d790cabaf41587775f Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 25 Apr 2018 23:21:44 -0700 Subject: [PATCH] Rename hash-table-entry-type:key{/,&}datum-weak. This makes it consistent with the ephemeron naming. --- src/runtime/hash-table.scm | 38 +++++++++++++++---------------- src/runtime/runtime.pkg | 5 ++-- tests/runtime/test-hash-table.scm | 2 +- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/runtime/hash-table.scm b/src/runtime/hash-table.scm index caa07094e..8c4e73ac4 100644 --- a/src/runtime/hash-table.scm +++ b/src/runtime/hash-table.scm @@ -500,44 +500,44 @@ USA. ;;; Key-or-datum-weak -- if either is GC'd, the entry is dropped. -(define-integrable (make-key/datum-weak-entry key datum) +(define-integrable (make-key&datum-weak-entry key datum) (maybe-weak-cons key (maybe-weak-cons datum '()))) -(define-integrable (key/datum-weak-entry-valid? entry) +(define-integrable (key&datum-weak-entry-valid? entry) (and (system-pair-car entry) (system-pair-car (system-pair-cdr entry)))) -(define-integrable key/datum-weak-entry-key system-pair-car) -(define-integrable (key/datum-weak-entry-datum entry) +(define-integrable key&datum-weak-entry-key system-pair-car) +(define-integrable (key&datum-weak-entry-datum entry) (system-pair-car (system-pair-cdr entry))) -(define-integrable (set-key/datum-weak-entry-datum! entry object) +(define-integrable (set-key&datum-weak-entry-datum! entry object) (system-pair-set-car! (system-pair-cdr entry) object)) -(define-integrable (call-with-key/datum-weak-entry-key entry if-valid if-not) - (call-with-key/datum-weak-entry-key&datum entry +(define-integrable (call-with-key&datum-weak-entry-key entry if-valid if-not) + (call-with-key&datum-weak-entry-key&datum entry (lambda (k d barrier) d (if-valid k barrier)) if-not)) -(define-integrable (call-with-key/datum-weak-entry-key&datum entry +(define-integrable (call-with-key&datum-weak-entry-key&datum entry if-valid if-not) - (let ((k (key/datum-weak-entry-key entry)) - (d (key/datum-weak-entry-datum entry))) + (let ((k (key&datum-weak-entry-key entry)) + (d (key&datum-weak-entry-datum entry))) (if (and (or (pair? entry) k) (or (pair? (system-pair-cdr entry)) d)) (if-valid k d (lambda () (reference-barrier k) (reference-barrier d))) (if-not)))) -(declare (integrate-operator hash-table-entry-type:key/datum-weak)) -(define hash-table-entry-type:key/datum-weak - (make-entry-type make-key/datum-weak-entry - key/datum-weak-entry-valid? - call-with-key/datum-weak-entry-key - call-with-key/datum-weak-entry-key&datum - set-key/datum-weak-entry-datum!)) -(register-entry-type! 'key/datum-weak hash-table-entry-type:key/datum-weak) +(declare (integrate-operator hash-table-entry-type:key&datum-weak)) +(define hash-table-entry-type:key&datum-weak + (make-entry-type make-key&datum-weak-entry + key&datum-weak-entry-valid? + call-with-key&datum-weak-entry-key + call-with-key&datum-weak-entry-key&datum + set-key&datum-weak-entry-datum!)) +(register-entry-type! 'key&datum-weak hash-table-entry-type:key&datum-weak) ;;; Key-ephemeral -- if the key is GC'd, the entry is dropped. @@ -1288,7 +1288,7 @@ USA. (open-type-constructor! hash-table-entry-type:strong) (open-type-constructor! hash-table-entry-type:key-weak) (open-type-constructor! hash-table-entry-type:datum-weak) - (open-type-constructor! hash-table-entry-type:key/datum-weak) + (open-type-constructor! hash-table-entry-type:key&datum-weak) (open-type-constructor! hash-table-entry-type:key-ephemeral) (open-type-constructor! hash-table-entry-type:datum-ephemeral) (open-type-constructor! hash-table-entry-type:key&datum-ephemeral) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 1f779e62f..7c30660b2 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -2378,8 +2378,9 @@ USA. (import (runtime population) add-to-population!/unsafe) (export () deprecated:hash-table - (hash-table/clear! hash-table-clear!) + (hash-table-entry-type:key/datum-weak hash-table-entry-type:key&datum-weak) (hash-table/clean! hash-table-clean!) + (hash-table/clear! hash-table-clear!) (hash-table/count hash-table-size) (hash-table/datum-list hash-table-values) (hash-table/for-each hash-table-walk) @@ -2439,7 +2440,7 @@ USA. hash-table-entry-type:key&datum-ephemeral hash-table-entry-type:key-ephemeral hash-table-entry-type:key-weak - hash-table-entry-type:key/datum-weak + hash-table-entry-type:key&datum-weak hash-table-entry-type:strong hash-table-equivalence-function ;SRFI-69 hash-table-exists? ;SRFI-69 diff --git a/tests/runtime/test-hash-table.scm b/tests/runtime/test-hash-table.scm index 2d1c35ed2..b6d6e8195 100644 --- a/tests/runtime/test-hash-table.scm +++ b/tests/runtime/test-hash-table.scm @@ -201,7 +201,7 @@ USA. (list (list 'strong hash-table-entry-type:strong) (list 'key-weak hash-table-entry-type:key-weak) (list 'datum-weak hash-table-entry-type:datum-weak) - (list 'key/datum-weak hash-table-entry-type:key/datum-weak) + (list 'key&datum-weak hash-table-entry-type:key&datum-weak) (list 'key-ephemeral hash-table-entry-type:key-ephemeral) (list 'datum-ephemeral hash-table-entry-type:datum-ephemeral) (list 'key&datum-ephemeral -- 2.25.1