Skip to content

Compiler improvement #22

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

Merged
merged 62 commits into from
Oct 4, 2013
Merged

Compiler improvement #22

merged 62 commits into from
Oct 4, 2013

Conversation

hhugo
Copy link
Member

@hhugo hhugo commented Sep 12, 2013

Do no merge, Review only.

  • example:
    • rm warning
  • compiler
    • parsing (javacript)
      • javascript parser from facebook/pfff ( successfully parsed jquery)
      • more coming ..
    • refactoring
    • cleanup
      • Primitive.mark_used
    • short variable names
      • delay var assignment
      • compute js variables liveness
      • use ocamlgraph to color the graph of js variables (Js_var.ml) (disabled by default)
    • fix
      • remove ouput_file in case of compilation failure
      • profile 3 (-opt 3) : missing deadcode elimination btw inline and flow
    • static evaluation of constant
    • improve parallel renaming by tracking deps.
    • sharing
      • javascript string
      • alias primitives
    • static evalution
    • detect caml_format_int "%d"

@hhugo
Copy link
Member Author

hhugo commented Sep 24, 2013

@vouillon, I've pushed a javascript parser (extracted from facebook/pfff).
I had to complete the js ast (with_statement & debugger are still missing).
Can you check printers/precedence in Js_ouput ?

I would like to use this parser during linking.

  • compute Requires and Provides (and functional purity ?)
  • check javascript files
  • better deadcode_elim/inlining
  • minify runtime

any suggestion ?

note: I fixed 2 missing semicolon in the runtime. (pushed on master). I don't know if the parser should handle those cases.

@vouillon
Copy link
Member

Semicolons are optional at line end, but it's considered good practice anyway.

You can go ahead with using a parser during linking. We should merge this branch first, though. I'm not sure we want to use it to compute Requires and Provides. In particular, how can you tell whether a function is part of the browser APIs or whether it corresponds to a requirement? On the other hand, the three other points make sense.

Also, you don't want to automatically infer functional purity: functions can be implemented in an imperative ways (loops, cached values, ...) while still appearing functional externally.

@vouillon
Copy link
Member

The precedences in Js_output seem correct.

@vouillon
Copy link
Member

This is an impressive amount of work. You need to fix the -pretty option to generate readable variable name again, and I would disable the variable naming optimization (in Js_var) for now. Otherwise, I'm eager to see this merged.

Thanks a lot!

@Drup
Copy link
Member

Drup commented Sep 30, 2013

By curiosity and interest, could we have a comprehensive Changelog of this ? The first post is a bit short on explanations from an outside point of view but there seems to be a lot of interesting new things.

@hhugo
Copy link
Member Author

hhugo commented Oct 3, 2013

  • variable renaming disabled by default
  • CHANGES updated

You may proceed to the merge ;)

@hhugo
Copy link
Member Author

hhugo commented Oct 3, 2013

CHANGES may need more entry

vouillon added a commit that referenced this pull request Oct 4, 2013
Huge number of compiler improvements contributed by Hugo
@vouillon vouillon merged commit e352743 into ocsigen:master Oct 4, 2013
@hhugo hhugo deleted the compiler branch October 4, 2013 16:57
@vouillon vouillon mentioned this pull request Sep 23, 2024
vouillon pushed a commit that referenced this pull request Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants