Skip to content

a failed test case(tribonacci) #52

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conversation

butterunderflow
Copy link
Contributor

No description provided.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@butterunderflow butterunderflow changed the title a failed test case a failed test case(tribonacci) Oct 9, 2024
@ahuoguo
Copy link
Contributor

ahuoguo commented Oct 9, 2024

Thanks!

First, can you use the following wat file instead? You removed the data segment so any wasm runtimes return 0 after running the function.

(module
  (type (;0;) (func (param i32) (result i32)))
  (type (;1;) (func (result i32)))
  (func (;0;) (type 0) (param i32) (result i32)
    (local i32 i32)
    local.get 0
    i32.const 2
    i32.shl
    i32.const 1048576
    i32.add
    local.set 1
    i32.const 0
    local.set 2
    local.get 0
    local.set 0
    loop (result i32)  ;; label = @1
      local.get 2
      local.set 2
      local.get 1
      local.set 1
      block  ;; label = @2
        local.get 0
        local.tee 0
        i32.const 2
        i32.gt_u
        br_if 0 (;@2;)
        local.get 1
        i32.load
        ;; unreachable
        local.get 2
        i32.add
        return
      end
      local.get 1
      i32.const -12
      i32.add
      local.set 1
      local.get 0
      i32.const -1
      i32.add
      call 0
      local.get 0
      i32.const -2
      i32.add
      call 0
      i32.add
      local.get 2
      i32.add
      local.set 2
      local.get 0
      i32.const -3
      i32.add
      local.set 0
      br 0 (;@1;)
    end)
  (func (;1;) (type 1) (result i32)
    i32.const 3
    call 0)
  (start 1)
  (table (;0;) 1 1 funcref)
  (memory (;0;) 17)
  (global (;0;) (mut i32) (i32.const 1048576))
  (global (;1;) i32 (i32.const 1048588))
  (global (;2;) i32 (i32.const 1048592))
  (export "memory" (memory 0))
  (export "tribonacci" (func 0))
  (export "main" (func 1))
  (export "__data_end" (global 1))
  (export "__heap_base" (global 2))
  (data $.rodata (i32.const 1048576) "\00\00\00\00\01\00\00\00\01\00\00\00")
)

I think the problem is we did not implement (data ...). So we can't get the value for the base case

@Kraks
Copy link
Member

Kraks commented Oct 9, 2024

I updated the benchmark in this branch https://github.com/Generative-Program-Analysis/GenSym/blob/debug_ret/benchmarks/wasm/tribonacci.wat. Our interpreter correctly works (both with ret+1 and 0).

@butterunderflow you can directly make a new branch and PR in this repo, so it's easier that others can directly push to this PR.

@butterunderflow
Copy link
Contributor Author

I'm closing this PR. Prefer #55

@Kraks
Copy link
Member

Kraks commented Oct 10, 2024

Thanks @butterunderflow! Can you also push tribonacci.wat (maybe using a different name) to #55? once data seg is supported (#54) we still want to make sure this version of tribonacci.wat works.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants