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 prototype based on static analysis #92

Open
wants to merge 105 commits into
base: develop
Choose a base branch
from

Commits on Jun 18, 2016

  1. Adds BranchNode for easy operation on branches

    Also branch optimization technique is proposed,
    however it is currently lead to a malformed graph
    
    Issue: #32
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    cd3ffe7 View commit details
    Browse the repository at this point in the history
  2. Fixes branch node visualization

    Issue: #32
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    0e68d06 View commit details
    Browse the repository at this point in the history
  3. Fixes type.txt

    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    113bed0 View commit details
    Browse the repository at this point in the history
  4. Adds stub for TauLinker

    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    1688a7d View commit details
    Browse the repository at this point in the history
  5. Refactors GraphWalker to use node colors

    This allows us to classify graph edges during graph walk.
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    90b42b2 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    1dba10d View commit details
    Browse the repository at this point in the history
  7. Minor fixes in GraphLinker

    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    b77dd54 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    c91b043 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    8dcb48f View commit details
    Browse the repository at this point in the history
  10. Adds logic to render tau nodes

    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    d4a7be7 View commit details
    Browse the repository at this point in the history
  11. Fixes tau optimizer by handling nodes by pairs

    Previous version of optimizer merged taus incorrectly.
    Method which produced error was Interval>>do:
    
    Producer1 \
               { Aggregator <- Consumer } x 3
              /
    Producer2
              \
               { Aggregator <- Consumer } x 3
    Producer3 /
    
    Correct solution should be
    
    Producer1 \           / Consumer1
               Aggregator - Consumer2
              /           \ Consumer3
    Producer2
              \           / Consumer4
               Aggregator - Consumer5
    Producer3 /           \ Consumer6
    
    but due to incorrect handling of pending nodes
    lists algorithm yielded the following result:
    
    Producer1 \
    Producer2 - Aggregator <- Consumer x 6
    Producer3 /
    
    So there was a single aggregator node that was
    referred by all six consumers.
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    119c38f View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    6c9105b View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    0b67873 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    2fcf67e View commit details
    Browse the repository at this point in the history
  15. Fixes graph linker in case of assign node first in the domain

    AssignX instructions leave their argument on the stack.
    That was causing problems during processing of argument requests.
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    7e70c0d View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    61a2543 View commit details
    Browse the repository at this point in the history
  17. Minor fixes in graph api

    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    ec1644c View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    5b3a637 View commit details
    Browse the repository at this point in the history
  19. Adds Type::toString()

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    44a1370 View commit details
    Browse the repository at this point in the history
  20. Adds CallContext::operator[index]

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    3ac8c0a View commit details
    Browse the repository at this point in the history
  21. Adds const cast for BranchNode

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    97ea0cb View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    d6db564 View commit details
    Browse the repository at this point in the history
  23. Adds order, comparison and composition operators to the Type

    It allows to compare any two types, store them in STL
    container such as std::set, use them as a key in std::map
    and use composition operators during type inference procedure.
    
    Operator | is a disjunction-like operator used to get sum of
    several possible types within a type.
    
    For example:
        2 | 2 -> 2
        2 | 3 -> (2, 3)
        2 | * -> (2, *)
        (Object) | (SmallInt) -> ((Object), (SmallInt))
    
    This operator may be used to aggregate possible types within
    a linear sequence where several type outcomes are possible:
        x <- y isNil ifTrue: [ nil ] ifFalse: [ 42 ].
    
    In this case x will have composite type (nil, 42).
    
    On the other hand, when dealing with loops we need some
    kind of a reduction operator that will act as a conjunction:
    
        2 & 2 -> 2
        2 & 3 -> (SmallInt)
        2 & (SmallInt) -> (SmallInt)
    
        <any type> & * -> *
        (SmallInt) & (Object) -> *
    
    This operator is used during induction run of the type analyzer
    to prove that variable does not leave it's local type domain,
    i.e it's type is not reduced to a *.
    
    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    3a66f0c View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    1cc3e65 View commit details
    Browse the repository at this point in the history
  25. Adds meta information to control graph

    Meta info is very useful during type analysis.
    It helps to make decisions based on graph structure.
    
    In future, more flags will be added.
    
    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    12d5460 View commit details
    Browse the repository at this point in the history
  26. Adds core inference logic to TypeAnalyzer

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    6c8a069 View commit details
    Browse the repository at this point in the history
  27. Fixes asserts

    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    3adc4dc View commit details
    Browse the repository at this point in the history
  28. Adds more inference logic

    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    4a921d9 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    d53e50d View commit details
    Browse the repository at this point in the history
  30. Adds temporary solution for several SmallInt primitives

    This code need to be refactored properly.
    In case if both operands are literal, then
    result may be defined as literal too.
    
    Otherwise primitive should "fail" by allowing
    control flow to pass further.
    
    For literal calculation it is best to use existing
    code for software VM.
    
    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    998d38a View commit details
    Browse the repository at this point in the history
  31. Adds function to print block type

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    752e88e View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    4e40ce8 View commit details
    Browse the repository at this point in the history
  33. Removes findCallContext()

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    f83fa6a View commit details
    Browse the repository at this point in the history
  34. Adds stub for block inference

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    8c9cf68 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    ed3415a View commit details
    Browse the repository at this point in the history
  36. Adds inference for block invocation arguments

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    d92e33f View commit details
    Browse the repository at this point in the history
  37. Fixes subtypes in array context

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    a5bc8c5 View commit details
    Browse the repository at this point in the history
  38. Disambiguates subtype fill functions

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    b3953db View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    ec073fd View commit details
    Browse the repository at this point in the history
  40. Collects graph meta info during graph construction

    This information is very useful during type inference.
    It may be gathered on-demand, but that would require
    additional pass.
    
    It is very cheap to collect meta info on the fly, so why not?
    
    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    cae2904 View commit details
    Browse the repository at this point in the history
  41. Fixes prototype of TypeSystem::inferBlock()

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    c7036a5 View commit details
    Browse the repository at this point in the history
  42. Refactors graph metainfo

    std::set here is an overkill. Index arrays are
    at most 10 entries big, unique vector is ok here.
    
    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    92cf908 View commit details
    Browse the repository at this point in the history
  43. Adds graph back edges set to metainfo

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    cc62ba0 View commit details
    Browse the repository at this point in the history
  44. Configuration menu
    Copy the full SHA
    37677b7 View commit details
    Browse the repository at this point in the history
  45. Adds inference of the captured context

    This logic provides a way to propagate captured context
    to the block across the call stack and collect types
    of the temporary variables that may be assigned in the
    closure block.
    
    This information will be used to update the method's
    control flow graph and introduce nontrivial tau nodes.
    
    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    c6003e6 View commit details
    Browse the repository at this point in the history
  46. Extracts TauLinker into separate file

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    5a8c692 View commit details
    Browse the repository at this point in the history
  47. Configuration menu
    Copy the full SHA
    c0f7a53 View commit details
    Browse the repository at this point in the history
  48. Configuration menu
    Copy the full SHA
    bc2eb8e View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    d2e3ada View commit details
    Browse the repository at this point in the history
  50. Configuration menu
    Copy the full SHA
    8536cb3 View commit details
    Browse the repository at this point in the history
  51. Adds visualization of closure taus

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    2ca6f8d View commit details
    Browse the repository at this point in the history
  52. Fixes asserts

    Issue: #17
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    4b13dbb View commit details
    Browse the repository at this point in the history
  53. Adds handling of (Smallint) in arithmetic primitives

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    ed47820 View commit details
    Browse the repository at this point in the history
  54. Fixes block invoke primitive

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 18, 2016
    Configuration menu
    Copy the full SHA
    f78ba24 View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2016

  1. Adds inference of the special::sendToSuper instruction

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 19, 2016
    Configuration menu
    Copy the full SHA
    a612201 View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2016

  1. Fixes ControlGraph::eraseTauNodes()

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 20, 2016
    Configuration menu
    Copy the full SHA
    d3d9262 View commit details
    Browse the repository at this point in the history
  2. Fixes TauLinker

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 20, 2016
    Configuration menu
    Copy the full SHA
    197197b View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2016

  1. Fixes inference of the recurring contexts

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 23, 2016
    Configuration menu
    Copy the full SHA
    9b79157 View commit details
    Browse the repository at this point in the history
  2. Adds TRecursionKind to the InferContext

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 23, 2016
    Configuration menu
    Copy the full SHA
    649ebe7 View commit details
    Browse the repository at this point in the history
  3. Adds TypeSystem::dumpAllContexts()

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 23, 2016
    Configuration menu
    Copy the full SHA
    6a0b389 View commit details
    Browse the repository at this point in the history
  4. Adds TypeAnalyzer::dumpTypes()

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 23, 2016
    Configuration menu
    Copy the full SHA
    5fd6a7d View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2016

  1. Fixes Type::operator |= and TypeAnalyzer::processPhi()

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 24, 2016
    Configuration menu
    Copy the full SHA
    aa90705 View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2016

  1. Configuration menu
    Copy the full SHA
    881c62b View commit details
    Browse the repository at this point in the history
  2. Adds more primitives to TypeAnalyzer::doPrimitive()

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 26, 2016
    Configuration menu
    Copy the full SHA
    c08afa6 View commit details
    Browse the repository at this point in the history
  3. Fixes TypeAnalyzer::processPhi()

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 26, 2016
    Configuration menu
    Copy the full SHA
    663dd9c View commit details
    Browse the repository at this point in the history
  4. Adds InferContext::getSingleReturnType()

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 26, 2016
    Configuration menu
    Copy the full SHA
    93142ef View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2016

  1. Fixes Type's comparison operator

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 28, 2016
    Configuration menu
    Copy the full SHA
    06b52e4 View commit details
    Browse the repository at this point in the history
  2. Adds cross-context references

    This information may be used to analyze context relations
    as well as perform call graph walk-through.
    
    Issue: #17
    Issue: #92
    0x7CFE committed Jun 28, 2016
    Configuration menu
    Copy the full SHA
    0f311b1 View commit details
    Browse the repository at this point in the history
  3. Adds cacheing for block contexts and for send-to-super

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 28, 2016
    Configuration menu
    Copy the full SHA
    c856ee5 View commit details
    Browse the repository at this point in the history
  4. Adds call graph visualizer

    Issue: #17
    Issue: #92
    0x7CFE committed Jun 28, 2016
    Configuration menu
    Copy the full SHA
    ecfb6a2 View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2016

  1. Configuration menu
    Copy the full SHA
    3f85065 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0bf6f42 View commit details
    Browse the repository at this point in the history
  3. Adds breadth-first graph traversing strategy

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 1, 2016
    Configuration menu
    Copy the full SHA
    15d4d04 View commit details
    Browse the repository at this point in the history
  4. Uses breadth-first node walking in TypeAnalyzer::basicRun()

    For correct inference of the parallel paths in a graph
    it is critical to perform traverse breadth-first.
    
    Otherwise, phi nodes may have their incomings undefined.
    
    Issue: #17
    Issue: #92
    0x7CFE committed Jul 1, 2016
    Configuration menu
    Copy the full SHA
    5b7bcb5 View commit details
    Browse the repository at this point in the history
  5. Adds special handling of messages that do not return normally

    Some methods like Object>>error: do not return a value in a usual way.
    In that case control flow is interrupted and all call chain aborts.
    
    Type analyzer uses an empty composite type () to mark such special case.
    Please note that () is not equal to * or ? types that still return a value.
    
    Issue: #17
    Issue: #92
    0x7CFE committed Jul 1, 2016
    Configuration menu
    Copy the full SHA
    8290467 View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2016

  1. Adds Type::fold(), refactors getSingleReturnType()

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 2, 2016
    Configuration menu
    Copy the full SHA
    ce9f0b7 View commit details
    Browse the repository at this point in the history

Commits on Jul 5, 2016

  1. Configuration menu
    Copy the full SHA
    d74c752 View commit details
    Browse the repository at this point in the history
  2. Folds arguments of SmallInt primitives

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 5, 2016
    Configuration menu
    Copy the full SHA
    31ff87f View commit details
    Browse the repository at this point in the history

Commits on Jul 9, 2016

  1. Configuration menu
    Copy the full SHA
    63aacb2 View commit details
    Browse the repository at this point in the history
  2. Refactors inference.h by namespaces by adding explicit st:: prefix

    Previously if one includes inference.h and uses namespace type,
    then it will result in a name collision if LLVM is in scope.
    
    Issue: #17
    Issue: #92
    0x7CFE committed Jul 9, 2016
    Configuration menu
    Copy the full SHA
    eb8eeb9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    40eb706 View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2016

  1. Configuration menu
    Copy the full SHA
    c6385ad View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3fc7659 View commit details
    Browse the repository at this point in the history

Commits on Jul 17, 2016

  1. Configuration menu
    Copy the full SHA
    cc2e736 View commit details
    Browse the repository at this point in the history
  2. Adds Type::isBlock()

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 17, 2016
    Configuration menu
    Copy the full SHA
    f2c78e3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    cf7d822 View commit details
    Browse the repository at this point in the history
  4. Adds support for direct calls of inferred blocks

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 17, 2016
    Configuration menu
    Copy the full SHA
    9d39182 View commit details
    Browse the repository at this point in the history
  5. Adds nounwind specifier to core helper functions

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 17, 2016
    Configuration menu
    Copy the full SHA
    5263fe0 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c9af814 View commit details
    Browse the repository at this point in the history
  7. Fixes Type::toString()

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 17, 2016
    Configuration menu
    Copy the full SHA
    15a7e2a View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3daecdb View commit details
    Browse the repository at this point in the history

Commits on Jul 21, 2016

  1. Configuration menu
    Copy the full SHA
    f17ef79 View commit details
    Browse the repository at this point in the history
  2. Adds special handling of dynamically inferred blocks

    Unlike statically inferred block, dynamic ones
    need to create and carry their closure environment.
    
    Two blocks with the same set of argument types may have
    different closure types even if their closure context
    is the same.
    
    We add closure types to a dynamic block's cache key and
    to block function name to disambiguate calls.
    
    Issue: #17
    Issue: #92
    0x7CFE committed Jul 21, 2016
    Configuration menu
    Copy the full SHA
    ee7d469 View commit details
    Browse the repository at this point in the history
  3. Adds TypeSystem::findBlockContext()

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 21, 2016
    Configuration menu
    Copy the full SHA
    a532ac0 View commit details
    Browse the repository at this point in the history
  4. Fixes sendToSuper

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 21, 2016
    Configuration menu
    Copy the full SHA
    9741b46 View commit details
    Browse the repository at this point in the history
  5. Refactors JITRuntime::printStat()

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 21, 2016
    Configuration menu
    Copy the full SHA
    206db1c View commit details
    Browse the repository at this point in the history

Commits on Jul 25, 2016

  1. Folds argument types of SendBinary instruction

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 25, 2016
    Configuration menu
    Copy the full SHA
    33f4452 View commit details
    Browse the repository at this point in the history
  2. Fixes primitives inference

    Issue: #17
    Issue: #92
    0x7CFE committed Jul 25, 2016
    Configuration menu
    Copy the full SHA
    fc6d1dd View commit details
    Browse the repository at this point in the history

Commits on Aug 2, 2016

  1. Fixes PushBlock in nested block context

    Issue: #17
    Issue: #92
    0x7CFE committed Aug 2, 2016
    Configuration menu
    Copy the full SHA
    878db08 View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2016

  1. Configuration menu
    Copy the full SHA
    6a1167e View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2016

  1. Fixes H_VMImage to test VM primitives

    Issue: #92
    kpp committed Aug 12, 2016
    Configuration menu
    Copy the full SHA
    aefcc90 View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2016

  1. Frees mem in TypeSystem

    Issue: #92
    kpp committed Aug 13, 2016
    Configuration menu
    Copy the full SHA
    63f134e View commit details
    Browse the repository at this point in the history
  2. Fixes case 2 & (SmallInt) -> (SmallInt)

    Issue: #92
    kpp committed Aug 13, 2016
    Configuration menu
    Copy the full SHA
    62019e7 View commit details
    Browse the repository at this point in the history
  3. Fixes automkdir for graphviz

    Issue: #92
    kpp committed Aug 13, 2016
    Configuration menu
    Copy the full SHA
    033a3e8 View commit details
    Browse the repository at this point in the history
  4. Adds basic tests and patterns for type inference

    Issue: #92
    kpp committed Aug 13, 2016
    Configuration menu
    Copy the full SHA
    34c1048 View commit details
    Browse the repository at this point in the history