Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce stack usage of ocamllocaldef #48

Open
yoriyuki opened this issue Nov 11, 2017 · 6 comments
Open

Reduce stack usage of ocamllocaldef #48

yoriyuki opened this issue Nov 11, 2017 · 6 comments

Comments

@yoriyuki
Copy link
Owner

Probably AbsOrd's fault

@yoriyuki yoriyuki changed the title reduce stack usage of ocamllocaldef Reduce stack usage of ocamllocaldef Nov 11, 2017
@rgrinberg
Copy link
Collaborator

Is this in relation with #39? I actually wonder if some of these stack overflows are from my very liberal port of the camlp4 stream parsers. I know the original version was more tail recursive than my port, but I didn't think much of it because it worked well enough on my machine. I can revisit the port and add back more tail recursion.

I suppose I could also test this in bytecode mode where I can configure the stack size.

@rgrinberg
Copy link
Collaborator

Another option here is to simply make this preprocessing binary always be built in bytecode mode. Bytecode should always have a large stack on every platform so it should fix the problem. It's a bit hacky though.

@rgrinberg
Copy link
Collaborator

The final option which is the best and most time consuming one would be to rewrite the lexer using ocamllex. The Stream module in OCaml is essentially deprecated anyway. I'd do it myself, but I fear that my understanding of the format being parsed is incomplete.

@yoriyuki
Copy link
Owner Author

As you see in your experiment, stack overflow is not only caused by lexer but also parser. The parser is actually a main suspect, because it uses nested function calls during processing expressions.

But I wonder why stack overflow is suddenly reported recently. It worked fine several years.

@rgrinberg
Copy link
Collaborator

rgrinberg commented Nov 11, 2017 via email

@yoriyuki
Copy link
Owner Author

Looking #49 again, the error during processing ja.txt occurs after your lexer and inside of localdef function.

Of course this may not be related to reported failures, because they all occur during processing zh_PINYIN. We need to try this file first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants