Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatch improvements #1620

Merged
merged 4 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions documentation/source/release-notes/2024.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ Tools
Library Updates
===============

IO
----

* The performance of several subclasses of :class:`<wrapper-stream>`
has been improved by sealing the :func:`inner-stream` method for
each subclass.

System
------

Expand Down
1 change: 1 addition & 0 deletions sources/io/streams/indenting-streams.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ end;

define sealed domain make(singleton(<indenting-stream>));
define sealed domain initialize(<indenting-stream>);
define sealed domain inner-stream(<indenting-stream>);

define constant $spaces :: <byte-string>
= " "; // 64
Expand Down
2 changes: 1 addition & 1 deletion sources/io/streams/wrapper-stream.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ define sealed domain unlock-stream (<simple-wrapper-stream>);
define open generic inner-stream
(wrapper-stream :: <wrapper-stream>) => (stream :: <stream>);

define method inner-stream
define inline method inner-stream
(wrapper-stream :: <wrapper-stream>) => (stream :: <stream>)
wrapper-stream.%inner-stream;
end method inner-stream;
Expand Down
1 change: 1 addition & 0 deletions sources/lib/coloring-stream/coloring-stream.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ end class <coloring-stream>;

define sealed domain make(singleton(<coloring-stream>));
define sealed domain initialize(<coloring-stream>);
define sealed domain inner-stream(<coloring-stream>);

define sealed method make
(class == <coloring-stream>, #rest initargs,
Expand Down
20 changes: 12 additions & 8 deletions sources/lib/llvm/bitcode.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ define class <bitcode-stream> (<wrapper-stream>)
slot bitcode-records :: <object-table> = make(<object-table>);
end class;

define sealed domain inner-stream (<bitcode-stream>);

define method bitcode-flush
(stream :: <bitcode-stream>)
=> ();
Expand Down Expand Up @@ -346,14 +348,15 @@ end bitcode-block;
define method stream-record-id
(stream :: <bitcode-stream>, record :: <symbol>)
=> (id :: <integer>)
let record-definition = element(stream.bitcode-records, record, default: #f);
if (~record-definition)
let record-definition :: false-or(<bitcode-record-definition>)
= 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 <abbrev-op> (<object>)
Expand Down Expand Up @@ -491,7 +494,8 @@ end method;
define method write-abbrev-record
(stream :: <bitcode-stream>, name :: <symbol>, #rest operands)
=> ();
let definition = stream.bitcode-abbrev-definitions[name];
let definition :: <bitcode-abbrev-definition>
= stream.bitcode-abbrev-definitions[name];

// Output the abbreviation id
write-abbrev-id(stream, definition.abbrev-id);
Expand All @@ -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 :: <abbrev-op> = ops[op-index];
select (op.op-kind)
#"fixed" =>
write-fixed(stream, op.op-data, value);
Expand All @@ -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 :: <abbrev-op> = ops[op-index + 1];
select (aop.op-kind)
#"fixed" =>
do(curry(write-fixed, stream, aop.op-data), value);
Expand Down
2 changes: 1 addition & 1 deletion sources/lib/llvm/llvm-bitcode.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -2823,7 +2823,7 @@ define function write-module
write-record(stream, #"GCNAME", gc-name);
end if;
end method;
for (global :: <llvm-global-value> in m.llvm-module-functions)
for (global :: <llvm-function> in m.llvm-module-functions)
if (global.llvm-function-garbage-collector)
do-gc(global.llvm-function-garbage-collector);
end if;
Expand Down
2 changes: 2 additions & 0 deletions sources/lib/progress-stream/progress-stream.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ define sealed method make
end if
end method;

define sealed domain inner-stream (<progress-stream>);

define class <dummy-progress-stream> (<progress-stream>)
end class;

Expand Down
Loading