Coder Social home page Coder Social logo

Comments (14)

kgdev avatar kgdev commented on May 13, 2024 2

image

Both "local.get $1" would be replaced to a slot, saying 40. So slot 40 is referenced twice. When deallocating slot 40, we need to keep a count instead of just 1 or 0. Otherwise, I would get a Assertion failed: (o->m3Slots [i_slotIndex]), function DeallocateSlot.

Also the implementation of PreserveArgsAndLocals could be made more efficient. Instead of number of locals (n) x number of references (m), we could just use O(m) time.

from wasm3.

vshymanskyy avatar vshymanskyy commented on May 13, 2024

@soundandform I think I have hit this a few times already, when working on self-hosting.

from wasm3.

kgdev avatar kgdev commented on May 13, 2024

Anyway I can help on this?

from wasm3.

soundandform avatar soundandform commented on May 13, 2024

I can fix. I had been waiting for this case to come up in an actual .wasm file.

from wasm3.

kgdev avatar kgdev commented on May 13, 2024
(module
  (type (func))
  (func (type 0)
    (local i32)
    local.get 0
    block
      i32.const 0
      local.set 0
    end
    drop
  )
  (memory 1)
)

from wasm3.

soundandform avatar soundandform commented on May 13, 2024

Hah. Thanks. Yeah, a contrived wasm file was the runner up option :)

from wasm3.

kgdev avatar kgdev commented on May 13, 2024

The sample actually comes from a real wasm of a game :)

from wasm3.

kgdev avatar kgdev commented on May 13, 2024

It seems that we have to insert the "preserve" local operation before the previous block. What's the best way to do that?

from wasm3.

kgdev avatar kgdev commented on May 13, 2024

Or just preserve all locals just before a block?

from wasm3.

kgdev avatar kgdev commented on May 13, 2024

#42

from wasm3.

kgdev avatar kgdev commented on May 13, 2024

@soundandform 4783048 doesn't seem to be right. For a "if" branch, the SetLocal could run or just not. In the latter case, replacing the local index in the stack would be wrong.

from wasm3.

soundandform avatar soundandform commented on May 13, 2024

@kgdev I haven't addressed loop and if yet which is why I said it was "partial."

from wasm3.

vshymanskyy avatar vshymanskyy commented on May 13, 2024

I believe this is fixed now. @kgdev please verify

from wasm3.

vshymanskyy avatar vshymanskyy commented on May 13, 2024

Should be OK now. Please report it still have problems with this

from wasm3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.