riscv-collab / v8

Port of Google v8 engine to RISC-V.
https://github.com/v8-riscv/v8/wiki
Other
237 stars 31 forks source link

generic-wrapper test failed #703

Closed luyahan closed 2 years ago

luyahan commented 2 years ago

cmd

out/riscv32.release/d8 --test test/mjsunit/mjsunit.js test/mjsunit/wasm/generic-wrapper.js --random-seed=-1377632954 --nohard-abort --testing-d8-test-runner --wasm-generic-wrapper --expose-gc --allow-natives-syntax 

log:

test/mjsunit/mjsunit.js:371: Failure: expected <137> found <236223201417>

Stack: MjsUnitAssertionError
    at assertEquals                 test/mjsunit/mjsunit.js 442:7
    at testGenericWrapper13ParamMix test/mjsunit/wasm/generic-wrapper.js 625:3
    at                              test/mjsunit/wasm/generic-wrapper.js 627:3
    throw new MjsUnitAssertionError(
    ^
MjsUnitAssertionError
    at assertEquals                 test/mjsunit/mjsunit.js 442:7
    at testGenericWrapper13ParamMix test/mjsunit/wasm/generic-wrapper.js 625:3
    at                              test/mjsunit/wasm/generic-wrapper.js 627:3

add DebugPrint into js code:

  let x = 12;
  let y = 1.0;
  %DebugPrint(x);
  function import_func(parami1, parami2, paraml1, parami3, paramf1, paramf2,
    paramd1, paramd2, paraml2, paramf3, paramd3, paramf4, paramf5) {
    gc();
    x += parami1 + 2 * parami2 + 3 * Number(paraml1) + 4 * parami3
      + 5 * Number(paraml2); //12+5+2*6+3*7+4*8+5*11 
    y += paramf1 + 2 * paramf2 + 3 * paramd1 + 4 * paramd2 + 5 * paramf3
      + 6 * paramd3 + 7 * paramf4 + 8 * paramf5;
  }
  %DebugPrint(x);
  let instance = builder.instantiate({ mod: { func: import_func } });
  assertEquals(undefined, instance.exports.main(5, 6, 7n, 8, 1.5, 2.5, 3.5,
    4.5, 11n, 5.5, 6.5, 7.5, 8.5));
  %DebugPrint(x);
  assertEquals(137, x);

log:

-runner --wasm-generic-wrapper --expose-gc --allow-natives-syntax 
testGenericWrapper13ParamMix
DebugPrint: Smi: 0xc (12)

DebugPrint: Smi: 0xc (12)

DebugPrint: 236223201417.0
0x3342355: [Map] in ReadOnlySpace
 - type: HEAP_NUMBER_TYPE
 - instance size: 12
 - elements kind: HOLEY_ELEMENTS
 - unused property fields: 0
 - enum length: invalid
 - stable_map
 - back pointer: 0x03342339 <undefined>
 - prototype_validity cell: 0
 - instance descriptors (own) #0: 0x03342145 <Other heap object (STRONG_DESCRIPTOR_ARRAY_TYPE)>
 - prototype: 0x033421b9 <null>
 - constructor: 0x033421b9 <null>
 - dependent code: 0x03342139 <Other heap object (WEAK_ARRAY_LIST_TYPE)>
 - construction counter: 0

test/mjsunit/mjsunit.js:371: Failure: expected <137> found <236223201417>

Stack: MjsUnitAssertionError
    at assertEquals                 test/mjsunit/mjsunit.js 442:7
    at testGenericWrapper13ParamMix test/mjsunit/wasm/generic-wrapper.js 625:3
    at                              test/mjsunit/wasm/generic-wrapper.js 627:3
    throw new MjsUnitAssertionError(
    ^
MjsUnitAssertionError
    at assertEquals                 test/mjsunit/mjsunit.js 442:7
    at testGenericWrapper13ParamMix test/mjsunit/wasm/generic-wrapper.js 625:3
    at                              test/mjsunit/wasm/generic-wrapper.js 627:3

add args --no-liftoffonly

DebugPrint: Smi: 0xc (12)

DebugPrint: Smi: 0xc (12)

DebugPrint: Smi: 0x89 (137)
luyahan commented 2 years ago

fixed