[Mono-devel-list] mcs patch for precise location handling

Atsushi Eno atsushi at ximian.com
Mon Jun 27 11:54:41 EDT 2005


Hello,

I once posted a patch but it seems waiting for approval and
Miguel still could not see, so am reposting the message without
patch. The patch itself is here:
http://monkey.workarea.jp/tmp/20050627/precise-location-20050627.diff

----

Here is the latest mcs patch for precise location handling. With
this patch mcs reports
	- the column number as well as line number, and
	- the line number which is not shifted to next token
	  (you would have seen mcs reporting "next line" to the
	   actual related line number).

As long as I tested it does not fail under mcs/tests and mcs/errors.

This patch sadly has a bad side effect that it increases memory
consumption than before. Here are the profile results for
building sys.xml (I ran "make BOOTSTRAP_MCS="mono ../../mcs/mcs.exe"):
http://monkey.workarea.jp/tmp/20050627/perf-old.txt
http://monkey.workarea.jp/tmp/20050627/perf-new2.txt

For summary, total memory consumption became 77765 KB from 74023 KB.

For the change details (will form ChangeLog):

	- I added Column support in location.cs that is originally
	  suggested by Ben (checkpoints) last year, and added
	  Location to MemberName to store location for identifiers.
	- I changed tokenizer to return Location for keywords, and
	  new "LocatedToken" for IDENTIFIERS, unary operators and
	  some symbols such as SEMICOLON. And modified cs-parser.jay
	  to cast correct types (especially for IDENTIFIERS).
	- I replaced most of "lexer.Location" with
	  corresponding locations. I also removed "_mark_" hack in
	  cs-parser.jay and shifted some item numbers in the rules.

(Ben and Miguel: there are some changes since the last patch you
guys might have seen: unary operators return Location in tokenizer,
and I removed _mark_ in cs-parser.jay.)

There are still a few things I cannot remove lexer.Location and thus
for them it still reports "shifted" location (but with column).

I'll clarify more if any of them are not clear.

Atsushi Eno



More information about the Mono-devel-list mailing list