[Gambas-bugtracker] Bug #1715: Have varptr() return the pointer to the data of a variant, instead of constanly coping the data to a fixed datatype

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Sat Jan 18 16:51:30 CET 2020


http://gambaswiki.org/bugtracker/edit?object=BUG.1715&from=L21haW4-

Comment #4 by Brian G:

I just downloaded, the latest changes, they seem to work well except in the case where a variant is passed as a parameter to a function. I have attached a sample project to this comment I hope.

Benoit I am aware of how much effort you have and continue to put into this project. Thank you for you hard work.

This is the error
gb.jit: panic: unsupported VarPtr()


//////// Main

void jit_main_2(uchar n);
static void jit_main_2_();
void jit_main_3(uchar n);
static void jit_main_3_(GB_VARIANT p0);

// Main

void jit_main_2(uchar n)
{
  jit_main_2_();
}

static void jit_main_2_()
{
  const GB_STRING null_string = {GB_T_STRING};
  GB_STRING l0 = null_string;
  const GB_VARIANT null_variant = {GB_T_VARIANT,{GB_T_NULL}};
  GB_VARIANT l1 = null_variant;
  VALUE **psp = (VALUE **)0x55c279eff768;
  VALUE *sp = SP;
  ushort *pc = (ushort *)0x55c27b30639c;
  GB_VALUE_GOSUB *gp = 0;
  bool error = FALSE;
  char *rs;
  GB_VARIANT rv;

  VALUE *ssp = sp;
  TRY {

__L0:; // Main.Main.7
  if ((l0).type == GB_T_STRING) rs = (l0).value.addr; else rs = NULL;
  l0 = BORROW_s(CONSTANT_s(0x55c27b3064e5, 17));
  GB.FreeString(&rs);
__L3:; // Main.Main.8
  rv = (l1);
  l1 = BORROW_v(CONV(l0, s, v, GB_T_VARIANT));
  GB.ReleaseValue((GB_VALUE *)&rv);
__L6:; // Main.Main.11
  ({SP=sp;jit_main_3_(l1);});
__L11:; // Main.Main.14

__RETURN:;

  } CATCH {

  CP = (void *)0x55c27b304148;
  FP = (void *)0x55c27b3066d0;
  if (SP > sp) sp = SP; else SP = sp;
  LEAVE_SUPER();
  if (sp > ssp) { JIT.release_many(sp, sp - ssp); SP = sp = ssp; }
  error = TRUE;

  } END_TRY

__FINALLY:;
__RELEASE:;
  SP = sp;
  RELEASE_GOSUB();
  RELEASE_FAST_s(l0);
  RELEASE_FAST_v(l1);
  if (error) { GB.Propagate(); }
  return;
}

// testptr

void jit_main_3(uchar n)
{
  VALUE *sp = *((VALUE **)0x55c279eff768);
  jit_main_3_(PARAM_v(0));
}

static void jit_main_3_(GB_VARIANT p0)
{
  intptr_t l0 = 0;
  VALUE **psp = (VALUE **)0x55c279eff768;
  VALUE *sp = SP;
  ushort *pc = (ushort *)0x55c27b3063bc;
  GB_VALUE_GOSUB *gp = 0;
  bool error = FALSE;
  BORROW_v(p0);
  VALUE *ssp = sp;
  TRY {

__L0:; // Main.testptr.20




More information about the Bugtracker mailing list