GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:32 JST Leonard Ritter Leonard Ritter

    today i'm beginning translating Scopes' internal OOP based system to datalog/database/ECS layout, that is, all pointers become enum-typed indices and object attributes are mapped in arrays.

    to begin, i'm writing a small DSL in Scopes to describe the datamodel, and then auto-translate it to C++

    this is the type tree from which classes and enums will be generated:
    https://paste.sr.ht/~duangle/31522a60cf978fe7483cfdd32f1fca7293daaffc

    next, we need index attributes (aka struct fields), and auxiliary tables (options, maps)

    #devlog #scopes

    In conversation about 16 days ago from mastodon.gamedev.place permalink

    Attachments



    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:15 JST Leonard Ritter Leonard Ritter
      in reply to

      still refactoring prover.cpp. for every reported compiler error i see i fix all similar patterns in the file, and yet i am still at line 1703 of 4390 (38%). but through this method, progress should be exponential-- or wait, this pattern matches the one of the sieve of eratosthenes (https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes), so progress should follow the distribution of "new problems" in the file (each problem equivalent to a prime). it's interesting to think about

      #devlog #scopes

      In conversation about 16 days ago permalink

      Attachments

      1. Domain not in remote thumbnail source whitelist: upload.wikimedia.org
        Sieve of Eratosthenes
        In mathematics, the sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to any given limit. It does so by iteratively marking as composite (i.e., not prime) the multiples of each prime, starting with the first prime number, 2. The multiples of a given prime are generated as a sequence of numbers starting from that prime, with constant difference between them that is equal to that prime. This is the sieve's key distinction from using trial division to sequentially test each candidate number for divisibility by each prime. Once all the multiples of each discovered prime have been marked as composites, the remaining unmarked numbers are primes. The earliest known reference to the sieve (Ancient Greek: κόσκινον Ἐρατοσθένους, kóskinon Eratosthénous) is in Nicomachus of Gerasa's Introduction to Arithmetic, an early 2nd century CE book which attributes it to Eratosthenes of Cyrene, a 3rd century BCE Greek mathematician, though describing the sieving by odd numbers instead of by primes. One of a number of prime number sieves, it is one of the most efficient ways to find all of the smaller primes...
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:16 JST Leonard Ritter Leonard Ritter
      in reply to

      lists done, platform ABI done. now we get to prover.cpp which is the typechecker, and at 4500 lines a behemoth, compared to other files.

      i wrote down a few regexes i used for replacement here, which save me a lot busy work.

      #devlog #scopes

      In conversation about 16 days ago permalink

      Attachments


      1. https://cdn.masto.host/mastodongamedevplace/media_attachments/files/114/387/298/460/525/031/original/11cc1691e82873bd.png
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:17 JST Leonard Ritter Leonard Ritter
      in reply to

      getting to list.cpp. the existing implementation uses simple cons cells, and while i want to use something else in the future, i'll keep it as it is right now so we're going to get to working state sooner.

      what i would like to try in the next list impl is "wide cons cells", conceptually immutable arrays broken into multiple singly-linked pieces.

      #devlog #scopes

      In conversation about 16 days ago permalink
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:18 JST Leonard Ritter Leonard Ritter
      in reply to

      more refactoring. this is the mother of all refactorings. i will probably never get done.

      #devlog #scopes

      In conversation about 16 days ago permalink
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:19 JST Leonard Ritter Leonard Ritter
      in reply to

      wrote some great sugar for the boundary so there's virtually no sweat translating exceptions.

      first pic is old way, second pic is new way

      #devlog #scopes

      In conversation about 16 days ago permalink

      Attachments


      1. https://cdn.masto.host/mastodongamedevplace/media_attachments/files/114/377/211/390/296/002/original/db024bb34932d467.png

      2. https://cdn.masto.host/mastodongamedevplace/media_attachments/files/114/377/217/916/252/051/original/8645806b58ab807a.png
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:20 JST Leonard Ritter Leonard Ritter
      in reply to

      i'm going to remove all the internal "homebrew exception" stuff from our C++ codebase and use C++ exceptions instead, which drastically simplifies a lot of the error handling code. we're already converting exceptions at the boundaries, this would be no different.

      honestly i no longer understand why i was so reluctant to use this in the first place. i guess i was afraid C++ exception support would leak into the scopes API but those worries were unfounded.

      #devlog #scopes

      In conversation about 16 days ago permalink
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:21 JST Leonard Ritter Leonard Ritter
      in reply to

      refactoring is intensifying

      #devlog #scopes

      In conversation about 16 days ago permalink

      Attachments


      1. https://cdn.masto.host/mastodongamedevplace/media_attachments/files/114/375/532/508/239/498/original/9586b163f550a73b.png
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:22 JST Leonard Ritter Leonard Ritter
      in reply to

      and now it's time to eat my own dogfood

      #devlog #scopes

      In conversation about 16 days ago permalink

      Attachments


      1. https://cdn.masto.host/mastodongamedevplace/media_attachments/files/114/354/060/344/836/772/original/c1b19f403a2312ea.png
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:23 JST Leonard Ritter Leonard Ritter
      in reply to

      de-optimizing Scope objects to speed the refactor along (I have a much better optimization to apply later), and updating related API functions.

      #devlog #scopes

      In conversation about 16 days ago permalink
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:24 JST Leonard Ritter Leonard Ritter
      in reply to

      gen_llvm.cpp is updated, next is globals.cpp. this one implements the C API wrapper around the C++ parts of the compiler and also exports all API symbols to the client context, which looks like below.

      these 600+ lines of definitions are all manually maintained, but could be autogenerated from scopes.h alone, which i'll implement now.

      #devlog #scopes

      In conversation about 16 days ago permalink

      Attachments


      1. https://cdn.masto.host/mastodongamedevplace/media_attachments/files/114/331/078/916/002/310/original/597bfff8b078f07b.png
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:25 JST Leonard Ritter Leonard Ritter
      in reply to

      expander.cpp is the first big module to be fully updated, now i'm updating gen_llvm.cpp. it's the mother of all refactorings.

      #devlog #scopes

      In conversation about 16 days ago permalink
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:26 JST Leonard Ritter Leonard Ritter
      in reply to

      voting this the least helpful error message in C++ (it's a bit verbose because i use heavily templated types, and C++ doesn't know when to quit describing nesting structures).

      you get this when you use a type for STL hashmaps that's not supported by std::hash. it doesn't actually tell you where you made that mistake. it does in fact tell you nothing useful aside from the type used. you just have to know by experience.

      #devlog #scopes

      In conversation about 16 days ago permalink

      Attachments


      1. https://cdn.masto.host/mastodongamedevplace/media_attachments/files/114/285/429/455/666/781/original/a33811f6bf5ec425.png
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:27 JST Leonard Ritter Leonard Ritter
      in reply to

      lots of refactoring today. codebase is completely shot. changes everywhere. many deletions. into the rabbit hole i go.

      #devlog #scopes

      In conversation about 16 days ago permalink
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:28 JST Leonard Ritter Leonard Ritter
      in reply to

      in full refactoring flow now, as i replace explicit classes with generated types, turn methods into functions, figure out small extensions to the type generator, etc.

      as a result, codebase's getting smaller, which is always a good sign.

      #devlog #scopes

      In conversation about 16 days ago permalink

      Attachments

      1. No result found on File_thumbnail lookup.
        Parked at Loopia
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:29 JST Leonard Ritter Leonard Ritter
      in reply to

      we have generated some code. instead of generating plain C++ expressions i employ the same technique i did with the scopes² prototype: generate macro expressions and let the preprocessor translate.

      left is an impression of what the output looks like (header file). right is the file used to translate it to C definitions. most of it is stubs so the code compiles at all.

      #devlog #scopes

      In conversation about 16 days ago permalink

      Attachments


      1. https://cdn.masto.host/mastodongamedevplace/media_attachments/files/114/262/319/846/834/290/original/bf38bc51df656261.png

      2. https://cdn.masto.host/mastodongamedevplace/media_attachments/files/114/262/324/250/109/120/original/4627537e56be3321.png
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:30 JST Leonard Ritter Leonard Ritter
      in reply to

      the parser for Value.sx now fully parses the definition file in 455 lines.

      https://hg.sr.ht/~duangle/scopes/raw/lib/scopes/compiler/pilot/gencc.sc?rev=based

      now we need to generate some actual C++ code.

      #devlog #scopes

      In conversation about 16 days ago permalink
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:31 JST Leonard Ritter Leonard Ritter
      in reply to

      phew. five hours later, i've translated *all types* used by Scopes into this format, from which C++ definitions will be derived.

      what i like particularly here is that all sub-enums like ICmpKind or TypeKind, and even all error codes, are flattened into the main ValueKind one, but can still be their own enumerator types.

      many branch-dependent special cases are now unified this way.

      https://hg.sr.ht/~duangle/scopes/browse/src/Value.sx?rev=based

      #devlog #scopes

      In conversation about 16 days ago permalink
    • Embed this notice
      Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:40 JST Leonard Ritter Leonard Ritter
      in reply to

      hating myself right now for having written so much code.

      a lot of this was written with the assumption that "it's only bootstrapping, no need to be dilligent, all this will be replaced".

      well guess what, dipshit. it's 10 years later and this is still the state of the art implementation.

      in soviet russia, corner cuts you.

      #devlog #scopes

      In conversation about 16 days ago permalink

      Attachments

      1. No result found on File_thumbnail lookup.
        implementation.in - このウェブサイトは販売用です! - India Implementation リソースおよび情報
        このウェブサイトは販売用です! implementation.in は、あなたがお探しの情報の全ての最新かつ最適なソースです。一般トピックからここから検索できる内容は、implementation.inが全てとなります。あなたがお探しの内容が見つかることを願っています!

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.