[Top][All Lists]

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

RE: [Dotgnu-libjit] How to check the value of a boolean variable.

Subject: RE: [Dotgnu-libjit] How to check the value of a boolean variable.
Date: Thu, 14 Aug 2008 09:55:51 +0200

Hi, Klaus.

> -----Original Message-----
> From: address@hidden [mailto:address@hidden  
> Did you ckeck with a jit_type_sbyte or jit_type_byte return type?

I've just changed my native function prototype to:

        static unsigned char EXP_STATIC_METHOD test_adaptor(void* stack_vp);

Where EXP_STATIC_METHOD is #defined as "__cdecl".

And the signature that I use when declaring the native function:

        jit_type_t ta_signature; // Signature for the test adaptor.
        jit_type_t ta_params[1];

        ta_params[0] = jit_type_void_ptr; // A pointer to the stack.
        ta_signature = jit_type_create_signature(jit_abi_cdecl, jit_type_ubyte, 
ta_params, 1, 1);

When debugging with MSVC, with a breakpoint at the native function, I can go up 
the stack and see this libjit-generated code (sorry for the C++ template spam):

        02250045  push        edi  
        02250046  call        
 >,1,0>::test_adaptor (4A3C70h) 
        0225004B  add         esp,1Ch 
        0225004E  or          eax,eax 
        02250050  je          02250078

So the behaviour is the same in this case.

It seems that either the call to jit_insn_convert() in jit_insn_branch_if_not() 
at jit-insn.c:3936 either doesn't receive the proper conversion destination 
type, or doesn't end performing the datatype extension...

> I don't know to which type jit_type_sys_bool is mapped.

>From the macros used in jit-type.c, I'd swear it to be ubyte:

        DECLARE_TAGGED(sys_bool, ubyte_def, JIT_TYPETAG_SYS_BOOL);

Best regards, and thanks in advance,

   Juan Jesús.

reply via email to

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