Author serhiy.storchaka
Recipients benjamin.peterson, brett.cannon, georg.brandl, methane, ncoghlan, serhiy.storchaka, vstinner, yselivanov
Date 2017-07-03.14:26:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1499092005.15.0.217690455837.issue29469@psf.upfronthosting.co.za>
In-reply-to
Content
In general the patch LGTM. I haven't found bugs.

I think that at this stage we can asdl_ct.py and ast_opt.ct and use just their result, ast_opt.c (maybe rename to optimize.c?) The grammar is not often changed, and in that case it would be not hard to modify the code manually. In any case compile.c should be modified manually. After removing no-op functions like astfold_operator() and inlining simple functions like astfold_arg() the code should be clearer.

Instead of converting all kinds of constants to Constant_kind, you could use is_const() and get_const_value() from compile.c.

I suggest to remove the parts of the peepholer that are superseeded by the AST optimizer.

As for preventing expensive calculations, there is a patch for the peepholer that does this. I wait on implementing the AST-level constant folding for adapting that patch for it.
History
Date User Action Args
2017-07-03 14:26:45serhiy.storchakasetrecipients: + serhiy.storchaka, brett.cannon, georg.brandl, ncoghlan, vstinner, benjamin.peterson, methane, yselivanov
2017-07-03 14:26:45serhiy.storchakasetmessageid: <1499092005.15.0.217690455837.issue29469@psf.upfronthosting.co.za>
2017-07-03 14:26:45serhiy.storchakalinkissue29469 messages
2017-07-03 14:26:44serhiy.storchakacreate