[m-rev.] for review: Reduce memory requirement to build compiler in profdeep grade.

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed May 12 21:08:38 AEST 2021


2021-05-12 17:31 GMT+10:00 "Peter Wang" <novalazy at gmail.com>:
>> Does anyone know why in some cases, when the result of a binop
>> needs to be cast, we output
>> 
>>    (cast-to-type) (operand1 op operand2)
>> 
>> while in other cases we output
>> 
>>   ((cast-to-type) (operand1 op operand2))
>> 
>> In other words, why we put parentheses around the whole thing
>> in some cases but not in others?
> 
> I wouldn't trust my knowledge of operator precedences (and even if I did),
> I could see myself writing the latter just in case. Maybe whoever wrote
> it was thinking the same thing.

That would make sense, but there are several places that look like

( if ... then
  emit version without the outer parentheses
else
  emit version with the outer parentheses
)

If the then-part ever generates code, and the Java/C# compiler
accepts it, then the outer parentheses should *never* be needed.

> A comment about what Mask does would prevent questions about why it
> isn't needed for left shifts. It converts a signed byte or short value
> into a positive int value, thus preventing shifting in 1s from the left
> when right shifting.

I have followed all your suggestions, but you may want to read the
comment I wrote for this after I check this in (after a final bootcheck).

Zoltan.


More information about the reviews mailing list