function with many arguments

24 views
Skip to first unread message

Palo Marton

unread,
Jan 9, 2014, 5:12:24 AM1/9/14
to asmji...@googlegroups.com
It seems that AsmJit can not call function with many arguments.

I have a function that has 6 arguments and returns value. All of them are integers or pointers (32bit).

During ECall::translate() it fails to find register for temporaryGpReg.

Palo Marton

unread,
Jan 10, 2014, 9:50:28 AM1/10/14
to asmjit-dev
From the souce code of asmjit it seems that this is simply not supported at all:

  // If failed to get temporary register then we need just to pick one.
  if (temporaryGpReg == INVALID_VALUE)
  {
    // TODO.
  }

I have tried to fix this by manually spilling some variables prior to function call with c.spill(), but after that I encountered some other (probably) unrelated bug - asmjit allocates 2 variables to the same register... :( :( :(


--
 
---
You received this message because you are subscribed to the Google Groups "asmjit-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to asmjit-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Petr Kobalíček

unread,
Jan 13, 2014, 8:26:13 AM1/13/14
to asmjit-dev
Hi Palo,

I will check this out and see what I can do, I was busy with the new version that will have these fixed.

Talk to you soon.

Cheers,
Petr

Palo Marton

unread,
Jan 13, 2014, 9:05:25 AM1/13/14
to asmjit-dev
Thank for your help. From my point, please focus on the new version, instead of patching the old one. We are trying to use AsmJit in a commercial application with big user base. Our target release date is somewhere in march/april. Do you think that this next version will be ready before our release?

It seems that so far I was able to fix bugs (or find workarounds) by myself.
I have also patched this problem with 2 variables in one regsiter. Problem was that varData->state got out of sync with varData->registerIndex. Sometimes varData->registerIndex is filled, but state of variable was not VARIABLE_STATE_REGISTER. The bug was here:

void CompilerContext::_assignState(StateData* state) ASMJIT_NOTHROW
...
  if (vdata)
  {
    do {
      vdata->state = VARIABLE_STATE_UNUSED;
  vdata->registerIndex = INVALID_VALUE; <-- THIS ROW WAS MISSING
      vdata = vdata->nextActive;
    } while (vdata != _active);
  }

This caused fails in compiler because sometimes it checked whether variable is in register by simple statements like this:

      if (vdata->registerIndex != INVALID_VALUE)


I have already added several other patches to compiler. If you want, I can send you my patched version. But it is tested only in 32 bit mode and using only GP variables.

bests,
Palo

Petr Kobalíček

unread,
Jan 14, 2014, 3:15:36 AM1/14/14
to asmjit-dev

Hi Palo,

March is definitely fine; I need only few days to finalize the missing parts. I would send you a prerelease, but since I'm working on function call support that you need fixed I will release a public alpha when ready.

Patches for current version are fine, however I'm not sure when they will be integrated. I would be nice if the new version will completely replace the old one.

Cheers,
Petr

Reply all
Reply to author
Forward
0 new messages