diff --git a/documentation/source/release-notes/2024.2.rst b/documentation/source/release-notes/2024.2.rst index 36b51d9073..22daa6abb2 100644 --- a/documentation/source/release-notes/2024.2.rst +++ b/documentation/source/release-notes/2024.2.rst @@ -60,6 +60,13 @@ Tools Library Updates =============== +IO +---- + +* The performance of several subclasses of :class:`` + has been improved by sealing the :func:`inner-stream` method for + each subclass. + System ------ diff --git a/sources/io/streams/indenting-streams.dylan b/sources/io/streams/indenting-streams.dylan index 24a3c12ded..de1ed61f6c 100644 --- a/sources/io/streams/indenting-streams.dylan +++ b/sources/io/streams/indenting-streams.dylan @@ -54,6 +54,7 @@ end; define sealed domain make(singleton()); define sealed domain initialize(); +define sealed domain inner-stream(); define constant $spaces :: = " "; // 64 diff --git a/sources/io/streams/wrapper-stream.dylan b/sources/io/streams/wrapper-stream.dylan index b55766e4b2..bea8f7964e 100644 --- a/sources/io/streams/wrapper-stream.dylan +++ b/sources/io/streams/wrapper-stream.dylan @@ -31,7 +31,7 @@ define sealed domain unlock-stream (); define open generic inner-stream (wrapper-stream :: ) => (stream :: ); -define method inner-stream +define inline method inner-stream (wrapper-stream :: ) => (stream :: ) wrapper-stream.%inner-stream; end method inner-stream; diff --git a/sources/lib/coloring-stream/coloring-stream.dylan b/sources/lib/coloring-stream/coloring-stream.dylan index 513931e2e2..1479598aa0 100644 --- a/sources/lib/coloring-stream/coloring-stream.dylan +++ b/sources/lib/coloring-stream/coloring-stream.dylan @@ -10,6 +10,7 @@ end class ; define sealed domain make(singleton()); define sealed domain initialize(); +define sealed domain inner-stream(); define sealed method make (class == , #rest initargs, diff --git a/sources/lib/llvm/bitcode.dylan b/sources/lib/llvm/bitcode.dylan index 5636b295de..67b4b28300 100644 --- a/sources/lib/llvm/bitcode.dylan +++ b/sources/lib/llvm/bitcode.dylan @@ -24,6 +24,8 @@ define class () slot bitcode-records :: = make(); end class; +define sealed domain inner-stream (); + define method bitcode-flush (stream :: ) => (); @@ -346,14 +348,15 @@ end bitcode-block; define method stream-record-id (stream :: , record :: ) => (id :: ) - let record-definition = element(stream.bitcode-records, record, default: #f); - if (~record-definition) + let record-definition :: false-or() + = element(stream.bitcode-records, record, default: #f); + if (record-definition) + record-definition.record-id + else error("record %= not defined for this block type", record); - end if; - record-definition.record-id + end if end method; - /// Abbreviations define class () @@ -491,7 +494,8 @@ end method; define method write-abbrev-record (stream :: , name :: , #rest operands) => (); - let definition = stream.bitcode-abbrev-definitions[name]; + let definition :: + = stream.bitcode-abbrev-definitions[name]; // Output the abbreviation id write-abbrev-id(stream, definition.abbrev-id); @@ -501,7 +505,7 @@ define method write-abbrev-record for (value in operands, op-index = 0 then begin - let op = ops[op-index]; + let op :: = ops[op-index]; select (op.op-kind) #"fixed" => write-fixed(stream, op.op-data, value); @@ -511,7 +515,7 @@ define method write-abbrev-record op-index + 1; #"array" => write-vbr(stream, 6, value.size); - let aop = ops[op-index + 1]; + let aop :: = ops[op-index + 1]; select (aop.op-kind) #"fixed" => do(curry(write-fixed, stream, aop.op-data), value); diff --git a/sources/lib/llvm/llvm-bitcode.dylan b/sources/lib/llvm/llvm-bitcode.dylan index a9a925fc33..0d7d9e1af2 100644 --- a/sources/lib/llvm/llvm-bitcode.dylan +++ b/sources/lib/llvm/llvm-bitcode.dylan @@ -2823,7 +2823,7 @@ define function write-module write-record(stream, #"GCNAME", gc-name); end if; end method; - for (global :: in m.llvm-module-functions) + for (global :: in m.llvm-module-functions) if (global.llvm-function-garbage-collector) do-gc(global.llvm-function-garbage-collector); end if; diff --git a/sources/lib/progress-stream/progress-stream.dylan b/sources/lib/progress-stream/progress-stream.dylan index 9e8faf94ca..a18bc79303 100644 --- a/sources/lib/progress-stream/progress-stream.dylan +++ b/sources/lib/progress-stream/progress-stream.dylan @@ -24,6 +24,8 @@ define sealed method make end if end method; +define sealed domain inner-stream (); + define class () end class;