lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lightning] How to use jit_str


From: Vaso Peras-Likodric
Subject: [Lightning] How to use jit_str
Date: Thu, 1 Jan 2015 17:59:37 +0100

For one project I am force to use lightning lib. Can this library load/write data to memory

I try to use jit_str but it is not working:

#include <stdio.h>
#include <lightning.h>

typedef unsigned int Word;

static jit_state_t *_jit;

jit_state_t* jit_states[2];

typedef int (*pifii)(int, int);       /* Pointer to Int Function of Int */

int main(int argc, char *argv[])
{
  int i;
  pifii      f[2];
  jit_node_t *in1;               /* offset of the argument */
  jit_node_t *in2;               /* offset of the argument */


  Word memory[1];

  init_jit(argv[0]);

  jit_states[0] = _jit = jit_new_state();

  jit_prolog   ();
  in1 = jit_arg      ();
  in2 = jit_arg      ();
        jit_getarg   (JIT_R2, in1);
        jit_getarg   (JIT_R1, in2);
        jit_str      (JIT_R2, JIT_R2);
        jit_retr     (JIT_R2);

        f[0] = (pifii)jit_emit();
        jit_clear_state();
  f[0](memory, memory);
---
Best Regards,
Vaso Peras-Likodric

msn: address@hidden
skype:vaso.likodric
GSM: +381 63 494 158

reply via email to

[Prev in Thread] Current Thread [Next in Thread]