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

tests\compiler\relocatable test offsets for globals #891

Closed

Conversation

sampaioletti
Copy link

Instantiating the data segments to memory is working correctly for what I can tell, but need to add offset logic to the index values

for example from the relocatable.untouched.wat fixture that I updated

  ;;line 43
 (func $relocatable/main (; 5 ;) (type $FUNCSIG$v)
  (local $0 i32)
  i32.const 80 ;; offset from mem_base
  call $~lib/rt/stub/__retain

should be

  ;;line 43
 (func $relocatable/main (; 5 ;) (type $FUNCSIG$v)
  (local $0 i32)
  global.get $__memory_base
  i32.const 80
  i32.add
  call $~lib/rt/stub/__retain

I'll look into it...but may be above my paygrade (:

@sampaioletti
Copy link
Author

Sorry I guess it could be considered bad form to PR a known failing test...I thought it might be easier than just explaining it.

dcodeIO added a commit that referenced this pull request Oct 10, 2019
@sampaioletti
Copy link
Author

@dcodeIO just looked through your commit, i was going about it a little differntly i split out the i32 functions

//src/module.ts:528
//new func when a ptr is needed rather than just a val
  i32Ptr(value: i32): ExpressionRef{
    var out = this.lit;
    _BinaryenLiteralInt32(out, value);
    return this.relocMem(_BinaryenConst(this.ref, out));
  }
  i64Ptr(valueLow: i32, valueHigh: i32 = 0): ExpressionRef{
    var out = this.lit;
    _BinaryenLiteralInt64(out, valueLow, valueHigh);
    return this.relocMem(_BinaryenConst(this.ref, out));
  }
//old funcs
  i32(value: i32): ExpressionRef {
    var out = this.lit;
    _BinaryenLiteralInt32(out, value);
    return _BinaryenConst(this.ref, out);
  }

  i64(valueLow: i32, valueHigh: i32 = 0): ExpressionRef {
    var out = this.lit;
    _BinaryenLiteralInt64(out, valueLow, valueHigh);
    return _BinaryenConst(this.ref, out);
  }

and was going around and replacing it where i needed to.....but i'll start testing your new code with mine...thanks

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

Successfully merging this pull request may close these issues.

None yet

1 participant