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

Inlining & direct function application optimisation #4918

Closed
vicuna opened this Issue Nov 13, 2009 · 1 comment

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Nov 13, 2009

Original bug ID: 4918
Reporter: viktorva
Assigned to: @mshinwell
Status: resolved (set by @mshinwell on 2016-12-06T21:50:59Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 4.03.0
Category: ~DO NOT USE (was: OCaml general)
Monitored by: ronan.lehy@gmail.com "Julien Signoles" @hcarty

Bug description

ocamlopt does not recognise direct function applications which arise from inlining even trivial functions. For example,

let id f = f
let rec f n = if n <= 0 then 0 else n * f (n - 1)

let _ = f 10
let _ = id f 20

generates:

...
mov eax, 21
call _camlTest__f_60 % Direct call for f 10
L105:
mov ebx, DWORD PTR _camlTest+4
mov eax, 41
mov ecx, DWORD PTR [ebx]
call ecx % Indirect call to f 20
L106:

The call to id is correctly inlined, but then the direct call is not recognised.

See: ocaml/asmcomp/closure.ml

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Dec 6, 2016

Comment author: @mshinwell

This deficiency should be fixed by Flambda, which can re-examine the results of inlining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.