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

squash closure #175

Closed
wants to merge 1 commit into from
Closed

squash closure #175

wants to merge 1 commit into from

Conversation

hhugo
Copy link
Member

@hhugo hhugo commented Jun 19, 2014

functors with more than one arguments are compiled with nested closures.

function F (MA){
  return function(MB) { ... } }

this PR converts this pattern into a single closure function F(MA,MB) { ... }

when applying such functor, the generated code change from call_gen_1(F(MA),MB) to F(MA,MB)
This allows to eliminate more deadcode
In the following example, M1 and M2 can be removed if not used.

module type T = sig
  type t
  val x : t
end
module Make(C : T)(D : T with type t = C.t) = struct
  let a = C.x
  let b = D.x
end

module M1 = Make
    (struct type t = int let x = 10 end)
    (struct type t = int let x = 10 end)

module M2 = Make
    (struct type t = float let x = 10. end)
    (struct type t = float let x = 10. end)

@hhugo
Copy link
Member Author

hhugo commented Jun 19, 2014

@vouillon, solving #56 could really improve deadcode elimination

@hhugo hhugo closed this Mar 18, 2015
@hhugo hhugo deleted the squashclosure branch March 20, 2015 23:09
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.

1 participant