dotgnu-libjit
[Top][All Lists]
Advanced

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

[Dotgnu-libjit] 64bit integers operations on x86


From: jan
Subject: [Dotgnu-libjit] 64bit integers operations on x86
Date: Thu, 12 Feb 2009 15:47:21 +0100 (CET)

The program shown below works on x86_64 but it crashes on x86. If I
comment out the two lines between "#if 1" and "#endif", it does not
crash. Can anybody help me with this?

#include <jit/jit.h>
#include <iostream>

using namespace std;

int main(void)
{
   jit_context_t context = jit_context_create();
   jit_context_build_start( context );
   jit_type_t params[1];
   params[0] = jit_type_void_ptr;
   jit_type_t signature =
     jit_type_create_signature( jit_abi_cdecl, jit_type_void,
                                params, 1, 1 );
   jit_function_t function = jit_function_create( context, signature );
   jit_value_t p = jit_value_get_param( function, 0 );
   jit_constant_t constant; constant.type = jit_type_int;
   constant.un.int_value = 0;
   jit_value_t val = jit_value_create_constant( function, &constant );
   jit_value_t q = jit_insn_add( function, p, val );
   jit_value_t a = jit_insn_load_relative( function, q,  0,
jit_type_long );
#if 1
   jit_value_t b = jit_insn_load_relative( function, q,  0,
jit_type_long );
   jit_insn_store_relative( function, q,  0, b );
#endif
   jit_insn_store_relative( function, q,  0, a );
   jit_insn_default_return( function );
   jit_function_compile( function );
   jit_context_build_end( context );

   long buffer[4];
   void *args[1];
   jit_ptr arg1 = &buffer[0];
   args[0] = &arg1;
   jit_function_apply( function, args, (void *)0 );
   jit_context_destroy( context );
   return 0;
}

/-----------------------( Jan Wedekind )------------------------\
|address   : .... Flat 7, 228-232 Langsett Rd, Sheffield S6 2UE |
|office    : ..... City Campus, Howard Street, Sheffield S1 1WB |
|o.-phone  : ............................... +44 (0)114 2253277 |
|email/www : ......... address@hidden / http://www.wedesoft.de |
|gnupg     : ECC3 3E3D AD98 4F0D 3B5B  B251 9B91 F1E7 96F1 E973 |
\---------------------------------------------------------------/





reply via email to

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