1. 02 Jul, 2020 6 commits
    • Eric Myhre's avatar
      Most of union type-level read implemented, for both style of memory layouts. · 0ddeba4d
      Eric Myhre authored
      Outline for keyed representation, but only enough to get some more
      things compilable and start getting all the templates exercised.
      
      Still can't really e2e test the things we've got without getting
      the rest of it and its builders finished.  It's coming along pretty
      reasonably, though, it seems.
      0ddeba4d
    • Eric Myhre's avatar
      More steps in union codegen. · a9b5a196
      Eric Myhre authored
      Generates the type structure itself, and a marker interface.
      Not much else yet.
      
      Wired test harnesses and plugged out one example.
      
      It's a bummer we don't really have a great way to poke part of it into
      running until the whole thing satisfies the generator interface.
      But it'll come soon enough.
      a9b5a196
    • Eric Myhre's avatar
      I just needed the top object again. Make helper. · 390d3feb
      Eric Myhre authored
      Golang templates are mostly pretty smooth to get started with,
      but this particular issue is really a bizarre tripwire, imo.
      
      Will clean up the existing "range modifies dot unhelpfully" messes
      sometime over the rainbow; I just refuse to make more of them today.
      390d3feb
    • Eric Myhre's avatar
      Notes while thinking ahead on codec%union performance. · df853075
      Eric Myhre authored
      It's kind of dark.  I've been leaving remarks strewn around github
      for a while now to the general effect of "please please please
      prefer keyed unions whenever you can; the others can be Not Fast".
      But it's even more nasty in terms of details like error handling
      than I think I had yet realized.  Sigh.
      
      Oh well.  Remember: we exist to describe data that people *have made*,
      not just the data that we want to encourage them to make in the future.
      df853075
    • Eric Myhre's avatar
      Outline of union gen type and first thoughts. · a667b68d
      Eric Myhre authored
      Expect this to evolve slowly over and the course of *many* commits.
      Unions are exceptionally tricky, and their various representations
      are by far the most complicated parts of IPLD Schemas.
      
      In particular, the fact that how to interpret data *inside* a union
      may vary, whilst some representations may not actually tell us which
      union member we have until later in the stream... is going to produce
      a lot of absolutely fabulous complexity.  Look forward to it.
      a667b68d
    • Eric Myhre's avatar
      036a0a15
  2. 29 Jun, 2020 2 commits
  3. 26 Jun, 2020 2 commits
  4. 15 Jun, 2020 3 commits
    • Eric Myhre's avatar
      Fix some out of date docs. · befa4986
      Eric Myhre authored
      befa4986
    • Eric Myhre's avatar
      Clean out remaining wip documents. · 87794f5c
      Eric Myhre authored
      ... almost.  In attempting to put the sections about absent value
      handling into place, I realized there's a decently sizable bug there
      already.  I'm going to document this for now, move on, and come back
      to it later... so it will continue to take up space in a "wip" doc.
      The description of the situation is at least cleaned up now.
      87794f5c
    • Eric Myhre's avatar
      More goals statements for codegen. · ec24732e
      Eric Myhre authored
      I spent some time poking around at other applications that I'd want to
      be able to use some of this stuff on, and the lines about "minimalist"
      come from that.  I suspect that in ideal outcomes, I'd like to be able
      to sometimes be able to generate the type structures and native/typed
      APIs for a Schema definition... but perhaps not generate all the stuff
      necessary for the interface monomorphization, because perhaps I just
      want an enum purely for internal program purposes; surely we should be
      able to just do that.  We'll see though.  Maybe that's scope creep
      as much as anything else.
      ec24732e
  5. 08 Jun, 2020 1 commit
  6. 03 Jun, 2020 2 commits
    • Eric Myhre's avatar
      Move files to use genparts prefix consistently. · 9d4171a8
      Eric Myhre authored
      All "genparts*" files are reusable bits of template;
      all other "gen[A-Z](.*)" files are per kind.
      9d4171a8
    • Eric Myhre's avatar
      Clean up docs on how/why codegen "maybe"s work. · 9f0968cc
      Eric Myhre authored
      Includes one code fix, as well: generated maps now return 'nil' for
      the value of lookups when returning an error for not-found.
      (I waffled on this for a while, because it's arguable that `ipld.Undef`
      is a perfectly reasonable sentinel value for this, and it's *arguable*
      that any sentinel value is better than nil.  However... no.
      A much, much clearer rule is "if a method returns an error, the value
      is nil", and that the contrapositive is also true: and that's what
      we're now going with and sticking with.)
      9f0968cc
  7. 25 May, 2020 1 commit
  8. 22 May, 2020 9 commits
    • Eric Myhre's avatar
      Clean up minima. · f1f9308f
      Eric Myhre authored
      Less comments emitted in gen result.
      
      Touch up the 'do not edit' comment.
      f1f9308f
    • Eric Myhre's avatar
      Refresh HACKME documents. · a7e8b2f2
      Eric Myhre authored
      Some of them still lived over the "gendemo" package, and those are now
      moved over here to the proper gen package.
      
      Linked to more of the other documents from the main HACKME doc.
      a7e8b2f2
    • Eric Myhre's avatar
      Feature table in readme! · e198e322
      Eric Myhre authored
      A fair amount of stuff is finished.
      
      A fair amount of stuff isn't.
      
      These are all the type kinds and representation strategies outlined in
      https://specs.ipld.io/schemas/representations.html .
      e198e322
    • Eric Myhre's avatar
      Map representations now work and correctly stay in representation mode when they recurse. · e9bb7415
      Eric Myhre authored
      This is pretty similar to the extractions that made it fly for lists.
      
      I've added a few more comments to the "genparts*" files, because on
      further reflection, a lot of those methods are... less reusable than
      the name might seem to claim.  We'll see how those evolve.
      
      Altered TestMapsContainingMaps quite a bit to now also test that
      representation mode is tracked correctly across both read and creation
      recursions, in a similar way to how TestListsContainingLists does
      (e.g., uses some structs towards the leaf nodes, so it can use the
      rename directives to create visible differences).
      e9bb7415
    • Eric Myhre's avatar
      comment typo fix · 6916052a
      Eric Myhre authored
      6916052a
    • Eric Myhre's avatar
      Maps now correctly stay in representation mode when read. · 3d4cd439
      Eric Myhre authored
      Correct representational creation mode still coming up, as you can
      see in the fixme comment.
      
      Tests will come in the next commit along with the creation mode.
      3d4cd439
    • Eric Myhre's avatar
      Test for lists-of-lists and that representation-mode recursion works for both... · 6c65fd6a
      Eric Myhre authored
      Test for lists-of-lists and that representation-mode recursion works for both assembly and traversal.
      
      It does.
      6c65fd6a
    • Eric Myhre's avatar
      Fix missing zeroing of wip pointer during nullable children in recursives. · 160062b4
      Eric Myhre authored
      Would cause the same memory to get reused inappropriately; need the nil
      value there to kick the child assembler to do the new allocation on the
      next round.
      160062b4
    • Eric Myhre's avatar
      Finish list repr list gen. · 9cae922e
      Eric Myhre authored
      A lot of the coments in earlier commit messages about choosing a path
      and cutting through it roughly and leaving DRY for latter still
      applies (see f1eeeafb).
      
      The hardest part of writing this was giving up on having shared code
      in the output.  It just can't be done along the current edges without
      giving up some performance at runtime, and that's generally not a trade
      we want to make.  Maybe there's different cuts for function boundaries
      that would do better -- but we'll leave that for later fun work.
      
      I did at least get a bunch of templates to be textually shared.
      
      Comments abound in the diff for future possibilities, as well as what's
      not possible to go further on without making undesired trades.
      9cae922e
  9. 08 May, 2020 4 commits
  10. 28 Apr, 2020 1 commit
    • Eric Myhre's avatar
      Comments contemplating options to DRY list repr. · f1eeeafb
      Eric Myhre authored
      This is a really tricky thing, because we're balancing three concerns:
      
      - minimizing our gen&template code size (and maximizing legibility)
        (okay, *four* concerns!)
      - minimizing our generated output lines of code ("gsloc")
      - minimizing our binary output size
      - maximizing our optimizations and fine runtime speed
        (okay, *five* concerns!)
      
      So, in addition to being the darned Spanish Inquisition about counting
      the concerns here...
      
      They're wildly divergent concerns.  And minimizing one tends to push
      up the numbers for the others.  Or simply make it harder to see and
      iterate on ways to manage the others.
      
      It's likely that at some point I'm going to give up and write something
      that works and seems simple as a first draft, and just roll with it.
      It's important to get something more widely usable to simply be
      finished enough that we can start gathering experiences on it;
      the rest of this is optimization problems we can iterate and improve on
      over time.
      
      We may also need to invest in some tooling to measure things like
      gsloc and binary output size, and possibly testing what's inlinable
      (though simply measuring performance with regular benchmarks may remain
      a decent substitute for that, even though it's limited to working on
      finished systems and thus not very helpful to use in design planning).
      Right now I'm running off vague intuitions from prior experiences, and
      occasionally going on splunks through the disassembler, but this is a
      high cost action to perform manually so I'm not doing it often and it's
      not producing feedback frequently enough.  Tooling could both make it
      easier to gather this feedback, and make it more maintainable over time
      and available to other maintainers, which would be... capital-G Good.
      f1eeeafb
  11. 26 Apr, 2020 9 commits
    • Eric Myhre's avatar
      All the other scalars. · 2f7df511
      Eric Myhre authored
      It's possible these could be dedup'd... a lot, honestly.  I'm wondering
      if they actually need a discrete type per kind at all, anymore; it's
      seeming much more tractable to try to turn that into a "no" after all
      the other successful work this morning abstracting things.
      
      But I have some other things I want to ship and do demos and prototypes
      of that's a lot more interesting than shaving more lines off today.
      So just gonna roll with the existing convention and stamp these out.
      Might deserve a revisit in the future.  Might not.  Time will tell.
      2f7df511
    • Eric Myhre's avatar
      More extraction and DRY'ing. · 7754ce08
      Eric Myhre authored
      Int is now basically all common stuff.  Now I'm really gonna quit.
      
      Interestingly, the total line count isn't going down very fast.
      108 insertions, 165 deletions, according to the git diff stat.
      Evidentally the overhead of things opting into this is darn near
      the amount of lines saved in many cases.
      7754ce08
    • Eric Myhre's avatar
      Basically everything for scalar assemblers DRY. · 7cdaa71e
      Eric Myhre authored
      This'll probably be the end of my cleanup quest for the day, but it's
      a pretty pleasing result.  More cleaned up more easily than I expected.
      7cdaa71e
    • Eric Myhre's avatar
      AssignNull method now also DRY across reprs :D · 3c03a6d3
      Eric Myhre authored
      Decided a basic bool property for this is probably fine after all.
      (For quite a while I'd been wondering if we'd end up with an enum
      of variants that are more or less semantic siblings of Repr, but it
      still hasn't happened, and thus it's now seeming quite unlikely.)
      3c03a6d3
    • Eric Myhre's avatar
      Extract and DRY AssignNull method for most types. · ef17e649
      Eric Myhre authored
      This one turns out to be different betweens scalars and recursives,
      if in a small (and fortunately consistent) way.
      ef17e649
    • Eric Myhre's avatar
      Comment typo fix. · 9737070b
      Eric Myhre authored
      9737070b
    • Eric Myhre's avatar
      The string of kinds should really be lowercase. · 680f1386
      Eric Myhre authored
      Yes, even though in practice in most of codegen we'll just turn around
      and title-case it again for symbol export reasons.
      
      The keywords everywhere throughout the schema language are lower-case,
      and kinds are such a keyword.  They should therefore be consistently
      handled and shown as lowercase.
      
      This has bugged me for a while but it's time to fix it before any more
      code starts passing by the area (and it's about to).
      680f1386
    • Eric Myhre's avatar
      More DRY'ing efforts in codegen. · f6cbe842
      Eric Myhre authored
      Some are easier than others.
      
      I'm starting to evolve a (still ad-hoc) naming convention for the
      extracted functions in order to provide some cues for how common you can
      expect the thing to be.  Scalars have a lot more commonizable stuff
      than non-scalars, for example.
      f6cbe842
    • Eric Myhre's avatar
      Typo fix in error messages in generated ints. · 8d848edd
      Eric Myhre authored
      8d848edd