{"action":"created","issue":{"url":"https://api.github.com/repos/cockroachdb/yacc/issues/7","labels_url":"https://api.github.com/repos/cockroachdb/yacc/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/cockroachdb/yacc/issues/7/comments","events_url":"https://api.github.com/repos/cockroachdb/yacc/issues/7/events","html_url":"https://github.com/cockroachdb/yacc/issues/7","id":115774892,"number":7,"title":"upstream changes","user":{"login":"tamird","id":1535036,"avatar_url":"https://avatars.githubusercontent.com/u/1535036?v=3","gravatar_id":"","url":"https://api.github.com/users/tamird","html_url":"https://github.com/tamird","followers_url":"https://api.github.com/users/tamird/followers","following_url":"https://api.github.com/users/tamird/following{/other_user}","gists_url":"https://api.github.com/users/tamird/gists{/gist_id}","starred_url":"https://api.github.com/users/tamird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamird/subscriptions","organizations_url":"https://api.github.com/users/tamird/orgs","repos_url":"https://api.github.com/users/tamird/repos","events_url":"https://api.github.com/users/tamird/events{/privacy}","received_events_url":"https://api.github.com/users/tamird/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"petermattis","id":6201335,"avatar_url":"https://avatars.githubusercontent.com/u/6201335?v=3","gravatar_id":"","url":"https://api.github.com/users/petermattis","html_url":"https://github.com/petermattis","followers_url":"https://api.github.com/users/petermattis/followers","following_url":"https://api.github.com/users/petermattis/following{/other_user}","gists_url":"https://api.github.com/users/petermattis/gists{/gist_id}","starred_url":"https://api.github.com/users/petermattis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petermattis/subscriptions","organizations_url":"https://api.github.com/users/petermattis/orgs","repos_url":"https://api.github.com/users/petermattis/repos","events_url":"https://api.github.com/users/petermattis/events{/privacy}","received_events_url":"https://api.github.com/users/petermattis/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-11-09T01:07:35Z","updated_at":"2015-11-09T15:33:41Z","closed_at":null,"body":"@petermattis I wanted to do this on your behalf, but I can't submit a CL with a commit that is authored by you (and I wanted to attribute the changes to you). I did discover that we no longer need the constant tweaks, though. How would you like to proceed? Here's the commit I was going to submit, FWIW:\r\n```diff\r\ncommit 85bc5925ecfab5246ba911332e24dcf5e841ea6a\r\nAuthor: Peter Mattis <peter@cockroachlabs.com>\r\nDate:   Sun Nov 8 20:00:58 2015 -0500\r\n\r\n    yacc: memory allocation improvements\r\n    \r\n    Places a fixed size initial stack and the lval inside the parser\r\n    struct so that they are allocated together. Places $$char inside the\r\n    parser struct to avoid allocating the closure used in Lookahead().\r\n    \r\n    Change-Id: I0de664a6d612279fdc3255633e2dff904030bc36\r\n\r\ndiff --git a/src/cmd/yacc/yacc.go b/src/cmd/yacc/yacc.go\r\nindex 32d2e5e..4f9d13c 100644\r\n--- a/src/cmd/yacc/yacc.go\r\n+++ b/src/cmd/yacc/yacc.go\r\n@@ -172,7 +172,7 @@ func init() {\r\n \tflag.BoolVar(&lflag, \"l\", false, \"disable line directives\")\r\n }\r\n \r\n-var stacksize = 200\r\n+var initialstacksize = 16\r\n \r\n // communication variables between various I/O routines\r\n var infile string  // input file name\r\n@@ -384,7 +384,7 @@ func setup() {\r\n \tif flag.NArg() != 1 {\r\n \t\tusage()\r\n \t}\r\n-\tif stacksize < 1 {\r\n+\tif initialstacksize < 1 {\r\n \t\t// never set so cannot happen\r\n \t\tfmt.Fprintf(stderr, \"yacc: stack size too small\\n\")\r\n \t\tusage()\r\n@@ -719,7 +719,7 @@ outer:\r\n \tftable.WriteRune('\\n')\r\n \tfmt.Fprintf(ftable, \"const %sEofCode = 1\\n\", prefix)\r\n \tfmt.Fprintf(ftable, \"const %sErrCode = 2\\n\", prefix)\r\n-\tfmt.Fprintf(ftable, \"const %sMaxDepth = %v\\n\", prefix, stacksize)\r\n+\tfmt.Fprintf(ftable, \"const %sInitialStackSize = %v\\n\", prefix, initialstacksize)\r\n \r\n \t//\r\n \t// copy any postfix code\r\n@@ -3332,18 +3332,17 @@ type $$Parser interface {\r\n }\r\n \r\n type $$ParserImpl struct {\r\n-\tlookahead func() int\r\n+\tlval  $$SymType\r\n+\tstack [$$InitialStackSize]$$SymType\r\n+\tchar  int\r\n }\r\n \r\n func (p *$$ParserImpl) Lookahead() int {\r\n-\treturn p.lookahead()\r\n+\treturn p.char\r\n }\r\n \r\n func $$NewParser() $$Parser {\r\n-\tp := &$$ParserImpl{\r\n-\t\tlookahead: func() int { return -1 },\r\n-\t}\r\n-\treturn p\r\n+\treturn &$$ParserImpl{}\r\n }\r\n \r\n const $$Flag = -1000\r\n@@ -3471,22 +3470,20 @@ func $$Parse($$lex $$Lexer) int {\r\n \r\n func ($$rcvr *$$ParserImpl) Parse($$lex $$Lexer) int {\r\n \tvar $$n int\r\n-\tvar $$lval $$SymType\r\n \tvar $$VAL $$SymType\r\n \tvar $$Dollar []$$SymType\r\n \t_ = $$Dollar // silence set and not used\r\n-\t$$S := make([]$$SymType, $$MaxDepth)\r\n+\t$$S := $$rcvr.stack[:]\r\n \r\n \tNerrs := 0   /* number of errors */\r\n \tErrflag := 0 /* error recovery flag */\r\n \t$$state := 0\r\n-\t$$char := -1\r\n-\t$$token := -1 // $$char translated into internal numbering\r\n-\t$$rcvr.lookahead = func() int { return $$char }\r\n+\t$$rcvr.char = -1\r\n+\t$$token := -1 // $$rcvr.char translated into internal numbering\r\n \tdefer func() {\r\n \t\t// Make sure we report no lookahead when not parsing.\r\n \t\t$$state = -1\r\n-\t\t$$char = -1\r\n+\t\t$$rcvr.char = -1\r\n \t\t$$token = -1\r\n \t}()\r\n \t$$p := -1\r\n@@ -3518,8 +3515,8 @@ $$newstate:\r\n \tif $$n <= $$Flag {\r\n \t\tgoto $$default /* simple state */\r\n \t}\r\n-\tif $$char < 0 {\r\n-\t\t$$char, $$token = $$lex1($$lex, &$$lval)\r\n+\tif $$rcvr.char < 0 {\r\n+\t\t$$rcvr.char, $$token = $$lex1($$lex, &$$rcvr.lval)\r\n \t}\r\n \t$$n += $$token\r\n \tif $$n < 0 || $$n >= $$Last {\r\n@@ -3527,9 +3524,9 @@ $$newstate:\r\n \t}\r\n \t$$n = $$Act[$$n]\r\n \tif $$Chk[$$n] == $$token { /* valid shift */\r\n-\t\t$$char = -1\r\n+\t\t$$rcvr.char = -1\r\n \t\t$$token = -1\r\n-\t\t$$VAL = $$lval\r\n+\t\t$$VAL = $$rcvr.lval\r\n \t\t$$state = $$n\r\n \t\tif Errflag > 0 {\r\n \t\t\tErrflag--\r\n@@ -3541,8 +3538,8 @@ $$default:\r\n \t/* default state action */\r\n \t$$n = $$Def[$$state]\r\n \tif $$n == -2 {\r\n-\t\tif $$char < 0 {\r\n-\t\t\t$$char, $$token = $$lex1($$lex, &$$lval)\r\n+\t\tif $$rcvr.char < 0 {\r\n+\t\t\t$$rcvr.char, $$token = $$lex1($$lex, &$$rcvr.lval)\r\n \t\t}\r\n \r\n \t\t/* look through exception table */\r\n@@ -3605,7 +3602,7 @@ $$default:\r\n \t\t\tif $$token == $$EofCode {\r\n \t\t\t\tgoto ret1\r\n \t\t\t}\r\n-\t\t\t$$char = -1\r\n+\t\t\t$$rcvr.char = -1\r\n \t\t\t$$token = -1\r\n \t\t\tgoto $$newstate /* try again in the same state */\r\n \t\t}\r\n```"},"comment":{"url":"https://api.github.com/repos/cockroachdb/yacc/issues/comments/155097400","html_url":"https://github.com/cockroachdb/yacc/issues/7#issuecomment-155097400","issue_url":"https://api.github.com/repos/cockroachdb/yacc/issues/7","id":155097400,"user":{"login":"tamird","id":1535036,"avatar_url":"https://avatars.githubusercontent.com/u/1535036?v=3","gravatar_id":"","url":"https://api.github.com/users/tamird","html_url":"https://github.com/tamird","followers_url":"https://api.github.com/users/tamird/followers","following_url":"https://api.github.com/users/tamird/following{/other_user}","gists_url":"https://api.github.com/users/tamird/gists{/gist_id}","starred_url":"https://api.github.com/users/tamird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamird/subscriptions","organizations_url":"https://api.github.com/users/tamird/orgs","repos_url":"https://api.github.com/users/tamird/repos","events_url":"https://api.github.com/users/tamird/events{/privacy}","received_events_url":"https://api.github.com/users/tamird/received_events","type":"User","site_admin":false},"created_at":"2015-11-09T15:33:41Z","updated_at":"2015-11-09T15:33:41Z","body":"> I'm fine with you trying to get this pushed upstream. That's enough work that I feel assuming authorship seems reasonable. Its not like this change was rocket science or anything.\r\n\r\nOK, will do.\r\n\r\n> Are you going to revert the constant changes in our fork?\r\n\r\nNah, not worth the churn. We'll just switch to upstream when they release it."}}