1. 22 Jan, 2020 1 commit
    • Yorick Peterse's avatar
      Don't use shared Windows runners · d30f885c
      Yorick Peterse authored
      With the release of shared Windows runners on GitLab.com, using runners
      with _just_ the "windows" tag results in CI using these shared runners.
      The shared runners don't have the right software installed, and are
      still in beta. To prevent using these, we now also require the runners
      to specify the "inko" tag.
      d30f885c
  2. 11 Jan, 2020 1 commit
    • Yorick Peterse's avatar
      Remove support for constant receivers · f46694ef
      Yorick Peterse authored
      This removes support for syntax such as `A::B` where `A` and `B` are
      constants. Inko has not allowed defining nested types or constants in
      types for a while, and this syntax was only used in a few places to
      bootstrap the runtime. Removing support for this syntax simplifies both
      the parser and compiler quite a bit.
      f46694ef
  3. 07 Jan, 2020 1 commit
  4. 05 Jan, 2020 2 commits
  5. 04 Jan, 2020 1 commit
    • Yorick Peterse's avatar
      Add Array.reverse_iter · f6bf5de0
      Yorick Peterse authored
      The method Array.reverse_iter returns an Iterator that iterates over the
      values in an Array in reverse order.
      f6bf5de0
  6. 02 Jan, 2020 4 commits
    • Yorick Peterse's avatar
      Remove support for extending traits · 4af9354f
      Yorick Peterse authored
      Now that the Ruby compiler defines types using multiple passes, there no
      longer is a need for forward declaring and extending traits. Extending
      traits could also lead to odd behaviour when adding default methods. For
      example:
      
          trait A {}
      
          object Foo {}
      
          impl A for Foo {}
      
          trait A {
            def thing -> Integer {
              10
            }
          }
      
      Here type "Foo" would not have access to method "thing", because it is
      added after "A" is implemented for "Foo".
      
      Removing support for this entirely solves this problem, and we no longer
      need it anyway.
      4af9354f
    • Yorick Peterse's avatar
      Remove forward trait declaration from std::net::ip · 9f152024
      Yorick Peterse authored
      This is no longer needed now that the Ruby compiler defines types in
      multiple passes.
      9f152024
    • Yorick Peterse's avatar
      Rename a few AST nodes to use the pattern DefineX · 679ccf7b
      Yorick Peterse authored
      This ensures all these nodes use the same naming pattern
      (DefineAttribute, DefineMethod, etc), instead of sometimes being called
      DefineX while other times being called XDefinition.
      679ccf7b
    • Yorick Peterse's avatar
      Support circular types in the Ruby compiler · 81a8fd1e
      Yorick Peterse authored
      This adds very basic (and super hacky) support for circular types to the
      Ruby compiler, which should be _just_ enough to allow us to continue
      work on the self-hosting compiler. Circular types can arise as follows:
      
          object TypeParameter {
            @required_traits: Array!(TraitType)
          }
      
          object TraitType {
            @type_parameters: Array!(TypeParameter)
          }
      
      Without support for circular types code like this won't compile.
      
      The changes needed to make this work are a total hack, and in some cases
      will lead to some duplicate work being done (with the results being
      discarded). Since this code will only stick around briefly, this is fine
      for now.
      81a8fd1e
  7. 01 Jan, 2020 1 commit
    • Yorick Peterse's avatar
      Allow hashing of any object · def89e1f
      Yorick Peterse authored
      This was technically already supported, but would trigger a panic for
      non-permanent objects. By allowing the hashing of any object we simplify
      the API, and make it easier to hash complex objects without having to
      manually implement the Hash trait for such structures.
      def89e1f
  8. 30 Dec, 2019 2 commits
  9. 27 Dec, 2019 2 commits
    • Yorick Peterse's avatar
      Revert Boolean and Nil cleanup · 22328acc
      Yorick Peterse authored
      I thought this would make the self-hosting compiler easier to implement,
      but it turns out this may not be the case. If we use two objects per
      type (one for the "class" and one for the instance), then yes it will
      clean things up. But this two object approach complicates the compiler
      in various other places. Balancing the two, I prefer being able to
      refine random objects as this means fewer VM changes are needed for for
      example Boolean and Nil.
      22328acc
    • Yorick Peterse's avatar
      Split Nil into Nil and NilType · 8f9109a4
      Yorick Peterse authored
      Nil is still the singleton instance, but its prototype is set to NilType
      instead of Object. By splitting Nil this way we no longer refine
      instances of ad-hoc instances, instead only refining objects defined
      directly using the `object` keyword.
      8f9109a4
  10. 26 Dec, 2019 1 commit
    • Yorick Peterse's avatar
      Clean up Boolean using an "if" instruction · ecd11a07
      Yorick Peterse authored
      By introducing the virtual "if" instruction we can clean up Boolean so
      that we no longer have to refine the True and False instances. If we
      also clean up Nil in a similar way it becomes easier to rewrite the
      compiler in Inko, as it no longer needs to support the refining of
      random objects.
      ecd11a07
  11. 22 Dec, 2019 3 commits
  12. 20 Dec, 2019 5 commits
  13. 19 Dec, 2019 1 commit
    • Yorick Peterse's avatar
      Add String.slice_bytes() and String.split() · a65c52d0
      Yorick Peterse authored
      String.slice_bytes() can be used to slice a String into a ByteArray,
      similar to String.slice():
      
          'foo'.slice_bytes(start: 0, length: 2).to_string # => 'fo'
      
      String.split() can be used to split a string into an Array of
      substrings:
      
          'foo/bar/baz'.split('/') # => Array.new('foo', 'bar', 'baz')
      a65c52d0
  14. 18 Dec, 2019 1 commit
    • Yorick Peterse's avatar
      Change Process.identifier to return an Integer · 510e6d0c
      Yorick Peterse authored
      Ever since Integer.format has been introduced there no longer is a
      reason to have the VM format the identifier as a string. Using an
      integer also saves a heap allocation for cases where we don't need/want
      a string.
      510e6d0c
  15. 17 Dec, 2019 1 commit
    • Yorick Peterse's avatar
      Refactor std::mirror · d3841771
      Yorick Peterse authored
      This is a pretty big refactor of std::mirror to make it entirely
      optional. As part of this std::format has been refactored as well, and
      all implementations of the Inspect trait (now called Format) have been
      moved into std::mirror.
      
      Formatting objects is now part of std::mirror as that's where it
      belongs, since the output is often based on the internal representation
      of an object. The new API for pretty printing objects is a bit more
      verbose, but not that much:
      
          import std::mirror
      
          10.mirror.inspect # => '10'
      
      All of this means that the only module currently using std::module is
      std::test::assert, which needs std::mirror to produce useful test
      failures. Other code that previously used "inspect" has been refactored
      to no longer depend on it.
      d3841771
  16. 16 Dec, 2019 1 commit
    • Yorick Peterse's avatar
      Remove CallFrame.to_string · b59f2f72
      Yorick Peterse authored
      The desired string format for a CallFrame may differ between
      applications using it. Inko itself does not use CallFrame.to_string
      either, so let's just get rid of it.
      b59f2f72
  17. 11 Dec, 2019 1 commit
    • Yorick Peterse's avatar
      Add ByteArray to the prelude · e10bee15
      Yorick Peterse authored
      The compiler needs support for circular types (e.g. A depending on B and
      B depending on A). The way ByteArray was set up in std::byte_array meant
      this could not be done with multiple passes, as the assignment of the
      `ByteArray` constant would require full type-inference too early in the
      compilation process. Moving ByteArray to the prelude and setting it up
      while bootstrapping simplifies this, and makes it easier for the user to
      use byte arrays.
      e10bee15
  18. 07 Dec, 2019 1 commit
    • Yorick Peterse's avatar
      Rename Void to Never · 7a990558
      Yorick Peterse authored
      Void is confusing as in C it's used for void* pointers, which are more
      akin to dynamically typed pointers. The name Never more clearly
      indicates that something (e.g. returning) will never happen.
      7a990558
  19. 03 Dec, 2019 2 commits
  20. 02 Dec, 2019 1 commit
    • Yorick Peterse's avatar
      Lower collection thresholds from 8/16 to 2/4 · 6c4ec92a
      Yorick Peterse authored
      When Immix block sizes were reduced from 32 KB to 8 KB, the amount of
      objects needed to trigger a collection increased. The young generation
      was using a threshold of 8 MB, and the mature generation a threshold of
      16 MB. At 32 KB per block this translates to roughly one collection
      every 256 new Immix blocks, while at 8 KB a collection would happen
      every 1024 new Immix blocks.
      
      Reducing the young threshold to 2 MB and the mature threshold to 4 MB
      means we once again collect after 256 new Immix blocks in the young
      generation, and 512 new Immix blocks in the mature generation.
      6c4ec92a
  21. 30 Nov, 2019 2 commits
  22. 29 Nov, 2019 1 commit
    • Yorick Peterse's avatar
      Add Array.join for joining Array values · 1a65f83f
      Yorick Peterse authored
      The method Array.join can be used to join values in an Array together
      using a separator. This method is only available if the values in an
      Array implement the ToString trait.
      1a65f83f
  23. 28 Nov, 2019 3 commits
    • Yorick Peterse's avatar
      Remove left-over prefetch code · a64f2e70
      Yorick Peterse authored
      This code is no longer needed now that we no longer use prefetching in
      the garbage collector.
      a64f2e70
    • Yorick Peterse's avatar
      Use bit flags for tracking a process' status · 725dd097
      Yorick Peterse authored
      Using the bits in a single byte allows us to track different flags of a
      process (e.g. the blocking or main flag) in a single byte. This also
      allows us to track the termination status of a process, without needing
      extra memory.
      
      The use of this new status field also allows us to stop sending messages
      to a process that has terminated.
      
      This fixes #186
      725dd097
    • Yorick Peterse's avatar
      Stop using underscores for "private" methods · 9be61a04
      Yorick Peterse authored
      Until a decision [1] is made about how to (and if) support private
      methods, we should not start doing this ad-hoc. This way we keep the
      codebase consistent, instead of different modules using different
      approaches.
      
      [1]: #162
      9be61a04
  24. 24 Nov, 2019 1 commit
    • Yorick Peterse's avatar
      Simplify tracing code to improve performance · e0a458d4
      Yorick Peterse authored
      In commit 347ade20 a new approach to
      tracing objects was introduced, improving performance in the process.
      This implementation used a "busy" counter to terminate tracer threads
      when all work was complete.
      
      While the approach was correct, it was not efficient. When there is
      little work to do, threads would spin for much longer than needed, as
      all threads observing "busy" to be 0 could take a while based on timings
      and bad luck. In various cases this meant tracing would take 20-30
      milliseconds, even though all work was done in less than 5 milliseconds.
      
      In this commit we greatly simplify the tracing approach by just letting
      threads terminate when they run out of work, regardless of the number of
      busy workers. In some rare cases this may result in threads terminating
      prematurely, but for all tests we ran so far this has not proven to be a
      problem. In fact, the current approach drastically cuts down garbage
      collection timings, and makes the tracing code much simpler.
      e0a458d4