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

type inference runtime correctness (oldworld) #17057

Merged
merged 8 commits into from
Dec 23, 2016
Merged

type inference runtime correctness (oldworld) #17057

merged 8 commits into from
Dec 23, 2016

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Jun 21, 2016

This starts to implement[s] the runtime structures to track type-inference correctness of our statically computed type inference information. It handles ensuring that old (on stack) code won't see mutations to the method tables. Next step will be to [It now] tracks this information more carefully through inference to build and store all of the edges for invalidation to ensure that evaluating new code only sees the newest code.

TODO:

  • docs
  • get inference running in the correct world
  • teach inlineable to call inference for sv.world
  • correct handling of optimize=false flag to code_typed
  • review code for other critical TODOs
  • get staged functions running in the correct world
  • compute incremental precompile edges
  • scrub documentation. emphasize difference between methods and bindings, move @generated function example
  • get inference finish to add the backedge to the right MethodInstance even while resolving cycles
  • add default values of the extra arguments to _methods_by_ftype
  • investigate how to handle serialize/deserialize
  • incrementally forward deserialize the backedges
  • NEWs entry
  • change cfunction to capture the current world

Later followup work:

  • look for optimizations
  • dead world pruning
  • try to do some inference of unspecialized (esp. during compile-all)
  • make "rpc server" example better
  • devdocs quickly summarizing how/when the world counter is updated, how min/max ages are updated, and how to temporarily run in different worlds, and the meaning of backedge.

fix #265

@vtjnash vtjnash force-pushed the jn/world branch 2 times, most recently from d952dd4 to cb2ea2c Compare June 22, 2016 14:35
@@ -1,5 +1,5 @@
// This file is a part of Julia. License is MIT: http://julialang.org/license

;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@vtjnash vtjnash force-pushed the jn/world branch 2 times, most recently from 7a69201 to 6e6cc4e Compare August 26, 2016 18:43
@vtjnash vtjnash force-pushed the jn/world branch 3 times, most recently from 32bee7b to 90e700f Compare September 14, 2016 16:00
@vtjnash vtjnash force-pushed the jn/world branch 2 times, most recently from 416322b to 7529828 Compare September 22, 2016 22:03
@simonster simonster added compiler:inference Type inference compiler:codegen Generation of LLVM IR and native code labels Sep 22, 2016
@tkelman
Copy link
Contributor

tkelman commented Sep 23, 2016

when this is ready for a pkgeval run, let me know - should definitely evaluate the scale of what this is going to break

@@ -34,10 +34,18 @@ typealias VarTable Array{Any,1}
type VarState
typ
undef::Bool
function VarState(typ::ANY, undef::Bool)
if isa(typ, DataType) && isdefined(typ, :instance)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it would catch more cases to put this in abstract_eval instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, although that would miss the specific case I cared about (turning singleton arguments into Const values).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. In that case it would make more sense to do the transformation at the point where the arguments are received. VarState is wrapper-like, so it's confusing if it changes the thing you're wrapping in addition to wrapping it.

@vtjnash vtjnash force-pushed the jn/world branch 4 times, most recently from 4dcda90 to cb1b4b8 Compare September 28, 2016 17:26
vtjnash added a commit that referenced this pull request Oct 4, 2016
backport of changes in #17057 that don't require new worlds
@maleadt
Copy link
Member

maleadt commented Dec 23, 2016

Did inlining semantics change with this PR? For example:

@noinline child() = return nothing
parent() = child()
@code_llvm parent()

on f27c6f3:

define void @julia_parent_60601() #0 {
top:
  call void @julia_child_60602() #0
  ret void
}

on master (44d7677):

define void @julia_parent_61546() #0 {
top:
  ret void
}

Expected?

KristofferC referenced this pull request Dec 24, 2016
* Remove a type restriction in Base.QuadGK.Segment (#19626)

* Test compatibility of quadgk with unitful numbers / physical quantities.

* Pare down tests.

* More test refinements.
@yuyichao yuyichao added the breaking This change will break code label Dec 30, 2016
@tkelman
Copy link
Contributor

tkelman commented Dec 31, 2016

devdocs that explain what a backedge is / means would be good to add before too long

martinholters added a commit to HSU-ANT/ACME.jl that referenced this pull request Jan 3, 2017
Due to JuliaLang/julia#17057, method definitions happening inside an
`eval` are not immediataly visible outside the eval (which is still at
an older world age).
martinholters added a commit to HSU-ANT/ACME.jl that referenced this pull request Jan 3, 2017
Due to JuliaLang/julia#17057, method definitions happening inside an
`eval` are not immediataly visible outside the eval (which is still at
an older world age).
maleadt added a commit that referenced this pull request Feb 24, 2017
After #17057, building the system image seems to take significantly more stack space,
resulting in a StackOverflowError.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will break code compiler:codegen Generation of LLVM IR and native code compiler:inference Type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

automatic recompilation of dependent functions