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

Olde ECL #36

Open
48 of 63 tasks
ExpHP opened this issue Apr 20, 2021 · 0 comments
Open
48 of 63 tasks

Olde ECL #36

ExpHP opened this issue Apr 20, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@ExpHP
Copy link
Owner

ExpHP commented Apr 20, 2021

Olde ECL Tracking issue

  • Timeline arg0 comp and decomp
  • EoSD args
  • split cmp/jmp
    • split intrinsic decompilation and compilation
    • offsetof and timeof compilation
    • offsetof and timeof decompilation
    • goto label @ timeof(label) should probably be allowed (does not parse currently)
  • broken if decompilation
  • add rest of intrinsics for EoSD
  • test register allocation in EoSD
  • compile AssignOp syntax
  • decompile AssignOp syntax?
  • find nicer difficulty flag syntax
  • difficulty switches
    • compile simple
    • compile complex
    • decide on semantics in abstract tree. Most importantly, are mismatched lengths allowed within an expression?
    • support difficulty in AST VM so that expr_compile tests can be written
    • write expr_compile tests
    • decompile
    • maybe find out what the four upper bits do in IN where it does funny things for familiars, idfk
      • from dai: bits 5 and 6 in the difficulty mask in IN are for focused/unfocused respectively. It's how Keine's attacks change depending whether you're focusing or unfocused
    • Look into behavior of unused flags:
      • ALL games use 0xFF for most instructions
      • EOSD, PCB use just 0x01 for easy, 0x02 for normal (unused flags get cleared)
      • IN onwards use 0xF1 for easy, 0xF2 for normal (unused flags stay active)
      • in TD, two more bits become "used" for extra and overdrive
  • fix the way that the first difficulty label in a difficulty switch tends to end up outside of a decompiled block
  • Bring back warning on blob len not divisible by 4 but be lenient to decompiled EoSD somehow, idfk
  • Fix the error when printing a null span from a core mapfile (cargo test --test=integration_suite -- --ignored)
  • fix lack of round-tripping $REG[-10009] = 240 / 6;
    • idea for capabilities: something like (10 & ($I2 + 3)) should produce an error with two spans, "$I2 is not const" and "const required because no instruction exists for &"
  • possibly want intrinsics for --x and ++x. (EoSD opcodes 18, 19)
  • call syntax :NotLikeAlice:
    • allow high-level Signatures to have params that expect const args
    • warn on footgunny usage of I0 and F0 inside a function body with a named parameter in EoSD
    • similar for ARG_ in PCB. Important because ARG_{A,B,R,S} may be modified by code that uses RAND_RANGE
  • PCB RAND variables behave differently for int and float so _f($RAND) compiling into %RAND is not cool
    • zero mentions variables only readable as a single type is similar
      image
  • EoSD doesn't cast. Add warnings on cast operators. There isn't much you can do about mismatched sigils though...? (they DO happen)
  • th07
    • calls
  • th08
  • th09
  • th095
  • benchmark!!!!! especially with all that intrinsic stuff
    • see below, intrinsic stuff needs work
  • loops are apparently semantically equivalent to if (--X > 0) goto label;
    • this has some serious implications for roundtrippability...
    • helpful error messages will be needed when using the wrong syntax for the current language
    • Finish local stash with tests. There's an unfortunate bit where a trick used to simplify alias analysis ends up ruining the suggestions.
  • if you decompile a sub number that's out of range it shouldn't add the Sub prefix. This goes in hand with the decision not to validate raw sub indices during compilation.
  • break
    • add to AST, probably by making ast::StmtGoto an enum
    • compilation
    • nested loops are dangerous!!
  • IN has no timeline arg0 and EoSD timelines have no difficulty
  • IN timeline signatures shouldn't error when there's no T(_)
  • IN Difficulty switches don't decompile due to contiguous flags check; instead, the default-enabled flags should be checked to match and they should be present on the pulled-out instruction
  • warn when using offsetof(label) in a time argument or vice versa. I've made this mistake numerous times myself...
  • --no-diff-switches
  • IN core signatures
  • conditional call syntax. Or not. Not is definitely an option.
  • Double check names of F and U difficulty flags by looking at things that depend on them
  • {"-F"} evaluating to having no ENHL flags seems like a bad footgun...
  • importing ANM files
  • might want syntax for different sub types

    Weird idea, but could it possibly make sense to split up the current concept of a "function"? It seems like a lot of the potential ECL sub jank is mutually exclusive depending on how the sub is used:

    • Only regular calls and new engine asyncs can have arguments.
    • Only regular calls and interrupts can use return without breaking horribly.
    • Only regular calls can return values.
    • Only callbacks and old engine asyncs can reuse the current context in a different sub.
    • Only subs used with enemy_create can inherit register values from a parent enemy.

    Because of how little overlap there is between the different types of sub, it seems like a good idea to error/warn if the types are mismatched in certain ways.

  • change timelines to use script and give them an SclScript enum

Bench results (OLD = 57e0528, NEW = d780f5d), 23.1GB free on SSD

./update-dumps.py --anm --game 095:18 --noverify

                OLD 1    OLD 2     NEW 1    NEW 2
anm-compile     72.209   72.112    73.333   73.357
anm-decompile  127.906  128.097   128.076  128.371

Not the best benchmark because it includes the time of copying uncompressed bitmaps (which often won't be the case for users), but the difference seems "measurable."

Original issue contents

image

.....yeah. I guess I've been putting ECL off for long enough, huh?

@ExpHP ExpHP added the enhancement New feature or request label Apr 21, 2021
@ExpHP ExpHP changed the title ECL Olde ECL Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant