Stream: t-compiler

Topic: mutating options during the compilation


nagisa (Oct 20 2018 at 18:12, on Zulip):

So, I’m done implementing optimize(size) and am now working on optimize(speed), however I’m stuck with a weird question: can I mutate session options (sess.opts)?

nagisa (Oct 20 2018 at 18:17, on Zulip):

namely, in typeck/collect.rs all the optimize(...) attributes are collected and if any of the attributes are optimize(speed), the crate must unconditionally be compiled with -Copt-level=1/2/3.

nagisa (Oct 20 2018 at 18:18, on Zulip):

Are there any possible complications with me just doing sess.opts.optimize = X; from typeck/collect.rs wrt incremental compilation or query system?

nikomatsakis (Oct 22 2018 at 16:28, on Zulip):

So, I’m done implementing optimize(size) and am now working on optimize(speed), however I’m stuck with a weird question: can I mutate session options (sess.opts)?

I don't think you can :)

nikomatsakis (Oct 22 2018 at 16:29, on Zulip):

Are there any possible complications with me just doing sess.opts.optimize = X; from typeck/collect.rs wrt incremental compilation or query system?

heck yes there is

nikomatsakis (Oct 22 2018 at 16:29, on Zulip):

in particular, we assume that the result of a given query is deterministic,

nikomatsakis (Oct 22 2018 at 16:29, on Zulip):

mutating accessible state like the options could mean that the query would change its result

nikomatsakis (Oct 22 2018 at 16:29, on Zulip):

without any of the other queries or inputs changing their output

nikomatsakis (Oct 22 2018 at 16:29, on Zulip):

that would basically mess everything up :)

nikomatsakis (Oct 22 2018 at 16:30, on Zulip):

in general, sess.opts is just bad (as is most of Session) and all of that should eventually become queries

nagisa (Oct 22 2018 at 19:02, on Zulip):

@nikomatsakis so the "actual" optimsation level (the one given to LLVM) would probably become a query itself, right?

nikomatsakis (Oct 22 2018 at 19:02, on Zulip):

yes, that would be ideal

Last update: Nov 20 2019 at 02:10UTC