about summary refs log tree commit diff
path: root/src/rt/rust_kernel.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-29 16:46:32 -0700
committerbors <bors@rust-lang.org>2013-06-29 16:46:32 -0700
commitdf39932090887086c2d7ce6aa8d30827ab458fd1 (patch)
treef9fb7d5101731c4d7f8088e1c3277ee2aef19329 /src/rt/rust_kernel.cpp
parent439b13f071a4a884ea8645670df83162ffcf129f (diff)
parent765a2901d58625f5995c9cf4a32c85b6573e12b0 (diff)
downloadrust-df39932090887086c2d7ce6aa8d30827ab458fd1.tar.gz
rust-df39932090887086c2d7ce6aa8d30827ab458fd1.zip
auto merge of #7452 : dotdash/rust/self_indirection, r=cmr
Currently we pass all "self" arguments by reference, for the pointer
variants this means that we end up with double indirection which causes
a unnecessary performance hit.

The fix itself is pretty straight-forward and just means that "self"
needs to be handled like any other argument, except for by-value "self"
which still needs to be passed by reference. This is because
non-pointer types can't just be stuffed into the environment slot which
is used to pass "self".

What made things tricky is that there was also a bug in the typechecker
where the method map entries are created. For type impls, that stored
the base type instead of the actual self-type in the method map, e.g.
Foo instead of &Foo for &self. That worked with pass-by-reference, but
fails with pass-by-value which needs the real type.

Code that makes use of methods seems to be about 10% faster with this
change. Also, build times are reduced by about 4%.

Fixes #4355, #4402, #5280, #4406 and #7285
Diffstat (limited to 'src/rt/rust_kernel.cpp')
0 files changed, 0 insertions, 0 deletions