Back to index

plt-scheme  4.2.1
core.h
Go to the documentation of this file.
00001 /******************************** -*- C -*- ****************************
00002  *
00003  *     Platform-independent layer (i386 version)
00004  *
00005  ***********************************************************************/
00006 
00007 
00008 /***********************************************************************
00009  *
00010  * Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
00011  * Written by Paolo Bonzini.
00012  *
00013  * This file is part of GNU lightning.
00014  *
00015  * GNU lightning is free software; you can redistribute it and/or modify it
00016  * under the terms of the GNU Lesser General Public License as published
00017  * by the Free Software Foundation; either version 2.1, or (at your option)
00018  * any later version.
00019  * 
00020  * GNU lightning is distributed in the hope that it will be useful, but 
00021  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00022  * or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00023  * License for more details.
00024  * 
00025  * You should have received a copy of the GNU Lesser General Public License
00026  * along with GNU lightning; see the file COPYING.LESSER; if not, write to the
00027  * Free Software Foundation, 59 Temple Place - Suite 330, Boston,
00028  * MA 02111-1307, USA.
00029  *
00030  ***********************************************************************/
00031 
00032 
00033 
00034 #ifndef __lightning_core_h
00035 #define __lightning_core_h
00036 
00037 #define JIT_FP                     _EBP
00038 #define JIT_SP                     _ESP
00039 #define JIT_RET                    _EAX
00040 
00041 #define JIT_R_NUM           3
00042 #define JIT_V_NUM           3
00043 #define JIT_R(i)            (_EAX + (i))
00044 #define JIT_V(i)            ((i) == 0 ? _EBX : _ESI + (i) - 1)
00045 
00046 struct jit_local_state {
00047 #ifdef JIT_X86_64
00048   int   long_jumps;
00049   int   nextarg_geti;
00050 #else
00051   int   tiny_jumps;
00052   int  framesize;
00053 #endif
00054   int  argssize;
00055 };
00056 
00057 /* 3-parameter operation */
00058 #define jit_opr_(d, s1, s2, op1d, op2d)                               \
00059        ( (s2 == d) ? op1d :                                    \
00060          (  ((s1 == d) ? (void)0 : (void)MOVLrr(s1, d)), op2d )       \
00061        )
00062 #define jit_qopr_(d, s1, s2, op1d, op2d)                       \
00063        ( (s2 == d) ? op1d :                                    \
00064          (  ((s1 == d) ? (void)0 : (void)MOVQrr(s1, d)), op2d )       \
00065        )
00066 
00067 /* 3-parameter operation, with immediate */
00068 #define jit_op_(d, s1, op2d)                            \
00069        ((s1 == d) ? op2d : (MOVLrr(s1, d), op2d))
00070 #define jit_qop_(d, s1, op2d)                           \
00071        ((s1 == d) ? op2d : (MOVQrr(s1, d), op2d))
00072 
00073 /* 3-parameter operation, optimizable */
00074 #define jit_opo_(d, s1, s2, op1d, op2d, op12d)          \
00075        ((s2 == d) ? op2d :                       \
00076        ((s1 == d) ? op1d : op12d))
00077 
00078 /* 3-parameter operation, optimizable, with immediate */
00079 #define jit_opi_(d, rs, opdi, opdri)                    \
00080        ((rs == d) ? opdi : opdri)
00081 
00082 /* An operand is forced into a register */
00083 #define jit_replace(rd, rs, forced, op)                               \
00084        ((rd == forced) ? JITSORRY("Register conflict for " # op) :    \
00085         (rs == forced) ? op : (PUSHLr(forced), MOVLrr(rs, forced), op, POPLr(forced)))
00086 
00087 /* For LT, LE, ... */
00088 #define jit_replace8(d, op)                                    \
00089        (jit_check8(d)                                                 \
00090          ? (MOVLir(0, d), op(d))                               \
00091          : (PUSHLr(_EAX), MOVLir(0, _EAX), op(_EAX), MOVLrr(_EAX, (d)), POPLr(_EAX)))
00092 
00093 #define jit_bool_r(d, s1, s2, op)                              \
00094        (CMPLrr(s2, s1), jit_replace8(d, op))
00095 
00096 #define jit_bool_i(d, rs, is, op)                              \
00097        (CMPLir(is, rs), jit_replace8(d, op))
00098 
00099 /* When CMP with 0 can be replaced with TEST */
00100 #define jit_bool_i0(d, rs, is, op, op0)                               \
00101        ((is) != 0                                              \
00102          ? (CMPLir(is, rs), jit_replace8(d, op))                      \
00103          : (TESTLrr(rs, rs), jit_replace8(d, op0)))
00104 
00105 /* For BLT, BLE, ... */
00106 #define jit_bra_r(s1, s2, op)             (CMPLrr(s2, s1), op, _jit.x.pc)
00107 #define jit_bra_qr(s1, s2, op)            (CMPQrr(s2, s1), op, _jit.x.pc)
00108 #define jit_bra_i(rs, is, op)             (CMPLir(is, rs), op, _jit.x.pc)
00109 #define _jit_bra_l(rs, is, op)            (CMPQir(is, rs), op, _jit.x.pc)
00110 
00111 #ifdef JIT_X86_64
00112 # define jit_bra_l(rs, is, op) (_s32P((long)(is)) \
00113                                 ? _jit_bra_l(rs, is, op) \
00114                                 : (MOVQir(is, JIT_REXTMP), jit_bra_qr(JIT_REXTMP, rs, op)))
00115 #else
00116 # define jit_bra_l(rs, is, op) _jit_bra_l(rs, is, op)
00117 #endif
00118 
00119 /* When CMP with 0 can be replaced with TEST */
00120 #define jit_bra_i0(rs, is, op, op0)                                   \
00121        ( (is) == 0 ? (TESTLrr(rs, rs), op0, _jit.x.pc) : (CMPLir(is, rs), op, _jit.x.pc))
00122 #define jit_bra_l0(rs, is, op, op0)                                   \
00123        ( (is) == 0 ? (TESTQrr(rs, rs), op0, _jit.x.pc) : jit_bra_l(rs, is, op))
00124 
00125 /* Used to implement ldc, stc, ... */
00126 #define jit_check8(rs)             ( (rs) <= _EBX )
00127 #define jit_reg8(rs)        ( ((rs) == _SI || (rs) == _DI) ? _AL : ((rs) & _BH) | _AL )
00128 #define jit_reg16(rs)              ( ((rs) & _BH) | _AX )
00129 
00130 /* In jit_replace below, _EBX is dummy */
00131 #define jit_movbrm(rs, dd, db, di, ds)                                                \
00132        (jit_check8(rs)                                                         \
00133                ? MOVBrm(jit_reg8(rs), dd, db, di, ds)                          \
00134                : jit_replace(_EBX, rs, _EAX, MOVBrm(_AL, dd, db, di, ds)))
00135 
00136 /* Reduce arguments of XOR/OR/TEST */
00137 #ifdef JIT_X86_64
00138 # define JIT_CAN_16 0
00139 #else
00140 # define JIT_CAN_16 1
00141 #endif
00142 #define jit_reduce_(op)     op
00143 #define jit_reduce(op, is, rs)                                               \
00144        (_u8P(is) && jit_check8(rs) ? jit_reduce_(op##Bir(is, jit_reg8(rs))) :       \
00145        (_u16P(is) && JIT_CAN_16 ? jit_reduce_(op##Wir(is, jit_reg16(rs))) :                \
00146        jit_reduce_(op##Lir(is, rs)) ))
00147 #define jit_reduceQ(op, is, rs)                                              \
00148        (_u8P(is) && jit_check8(rs) ? jit_reduce_(op##Bir(is, jit_reg8(rs))) :       \
00149        jit_reduce_(op##Qir(is, rs)) )
00150 
00151 /* Helper macros for MUL/DIV/IDIV */
00152 #define jit_might(d, s1, op)                                   \
00153        ((s1 == d) ? 0 : op)
00154 
00155 #define jit_mulr_ui_(s1, s2)       jit_opr_(_EAX, s1, s2, MULLr(s1),  MULLr(s2))
00156 #define jit_mulr_i_(s1, s2) jit_opr_(_EAX, s1, s2, IMULLr(s1), IMULLr(s2))
00157 
00158 
00159 #define jit_muli_i_(is, rs)                      \
00160        (MOVLir(is, rs == _EAX ? _EDX : _EAX),           \
00161         IMULLr(rs == _EAX ? _EDX : rs))
00162 
00163 #define jit_muli_ui_(is, rs)                            \
00164        (MOVLir(is, rs == _EAX ? _EDX : _EAX),           \
00165         IMULLr(rs == _EAX ? _EDX : rs))
00166 
00167 #define jit_divi_i_(result, d, rs, is)                  \
00168        (jit_might (d,    _EAX, PUSHLr(_EAX)),           \
00169        jit_might (d,    _ECX, PUSHLr(_ECX)),            \
00170        jit_might (d,    _EDX, PUSHLr(_EDX)),            \
00171        jit_might (rs,   _EAX, MOVLrr(rs, _EAX)), \
00172        jit_might (rs,   _EDX, MOVLrr(rs, _EDX)), \
00173        MOVLir(is, _ECX),                         \
00174        SARLir(31, _EDX),                         \
00175        IDIVLr(_ECX),                             \
00176        jit_might(d,    result, MOVLrr(result, d)),      \
00177        jit_might(d,     _EDX,  POPLr(_EDX)),            \
00178        jit_might(d,     _ECX,  POPLr(_ECX)),            \
00179        jit_might(d,     _EAX,  POPLr(_EAX)))
00180 
00181 #define jit_divr_i_(result, d, s1, s2)                  \
00182        (jit_might (d,    _EAX, PUSHLr(_EAX)),           \
00183        jit_might (d,    _ECX, PUSHLr(_ECX)),            \
00184        jit_might (d,    _EDX, PUSHLr(_EDX)),            \
00185        ((s1 == _ECX) ? PUSHLr(_ECX) : 0),        \
00186        jit_might (s2,   _ECX, MOVLrr(s2, _ECX)), \
00187        ((s1 == _ECX) ? POPLr(_EDX) :                    \
00188        jit_might (s1,   _EDX, MOVLrr(s1, _EDX))),       \
00189        MOVLrr(_EDX, _EAX),                       \
00190        SARLir(31, _EDX),                         \
00191        IDIVLr(_ECX),                             \
00192        jit_might(d,    result, MOVLrr(result, d)),      \
00193        jit_might(d,     _EDX,  POPLr(_EDX)),            \
00194        jit_might(d,     _ECX,  POPLr(_ECX)),            \
00195        jit_might(d,     _EAX,  POPLr(_EAX)))
00196 
00197 #define jit_divi_ui_(result, d, rs, is)                 \
00198        (jit_might (d,    _EAX, PUSHLr(_EAX)),           \
00199        jit_might (d,    _ECX, PUSHLr(_ECX)),            \
00200        jit_might (d,    _EDX, PUSHLr(_EDX)),            \
00201        jit_might (rs,   _EAX, MOVLrr(rs, _EAX)), \
00202        MOVLir(is, _ECX),                         \
00203        XORLrr(_EDX, _EDX),                       \
00204        DIVLr(_ECX),                              \
00205        jit_might(d,    result, MOVLrr(result, d)),      \
00206        jit_might(d,     _EDX,  POPLr(_EDX)),            \
00207        jit_might(d,     _ECX,  POPLr(_ECX)),            \
00208        jit_might(d,     _EAX,  POPLr(_EAX)))
00209 
00210 #define jit_divr_ui_(result, d, s1, s2)                 \
00211        (jit_might (d,    _EAX, PUSHLr(_EAX)),           \
00212        jit_might (d,    _ECX, PUSHLr(_ECX)),            \
00213        jit_might (d,    _EDX, PUSHLr(_EDX)),            \
00214        ((s1 == _ECX) ? PUSHLr(_ECX) : 0),        \
00215        jit_might (s2,   _ECX, MOVLrr(s2, _ECX)), \
00216        ((s1 == _ECX) ? POPLr(_EAX) :                    \
00217        jit_might (s1,   _EAX, MOVLrr(s1, _EAX))),       \
00218        XORLrr(_EDX, _EDX),                       \
00219        DIVLr(_ECX),                              \
00220        jit_might(d,    result, MOVLrr(result, d)),      \
00221        jit_might(d,     _EDX,  POPLr(_EDX)),            \
00222        jit_might(d,     _ECX,  POPLr(_ECX)),            \
00223        jit_might(d,     _EAX,  POPLr(_EAX)))
00224 
00225 
00226 /* ALU */
00227 #define jit_addi_i(d, rs, is)      jit_opi_((d), (rs),       ADDLir((is), (d)),                   LEALmr((is), (rs), 0, 0, (d))  )
00228 #define jit_addr_i(d, s1, s2)      jit_opo_((d), (s1), (s2), ADDLrr((s2), (d)), ADDLrr((s1), (d)), LEALmr(0, (s1), (s2), 1, (d))  )
00229 #define jit_addci_i(d, rs, is)     jit_op_ ((d), (rs),       ADDLir((is), (d))                    )
00230 #define jit_addcr_i(d, s1, s2)     jit_opr_((d), (s1), (s2), ADDLrr((s1), (d)), ADDLrr((s2), (d)) )
00231 #define jit_addxi_i(d, rs, is)     jit_op_ ((d), (rs),       ADCLir((is), (d))                    )
00232 #define jit_addxr_i(d, s1, s2)     jit_opr_((d), (s1), (s2), ADCLrr((s1), (d)), ADCLrr((s2), (d)) )
00233 #define jit_andi_i(d, rs, is)      jit_op_ ((d), (rs),       ANDLir((is), (d))                    )
00234 #define jit_andr_i(d, s1, s2)      jit_opr_((d), (s1), (s2), ANDLrr((s1), (d)), ANDLrr((s2), (d)) )
00235 #define jit_orr_i(d, s1, s2)       jit_opr_((d), (s1), (s2),  ORLrr((s1), (d)),  ORLrr((s2), (d)) )
00236 #define jit_subr_i(d, s1, s2)      jit_opr_((d), (s1), (s2), (SUBLrr((s1), (d)), NEGLr(d)),       SUBLrr((s2), (d))           )
00237 #define jit_subcr_i(d, s1, s2)     jit_subr_i((d), (s1), (s2))
00238 #define jit_subxr_i(d, s1, s2)     jit_opr_((d), (s1), (s2), SBBLrr((s1), (d)), SBBLrr((s2), (d)) )
00239 #define jit_subxi_i(d, rs, is)     jit_op_ ((d), (rs),       SBBLir((is), (d))                    )
00240 #define jit_xorr_i(d, s1, s2)      jit_opr_((d), (s1), (s2), XORLrr((s1), (d)), XORLrr((s2), (d)) )
00241 
00242 #define jit_addi_l(d, rs, is)      jit_opi_((d), (rs),       ADDQir((is), (d)),                   LEAQmr((is), (rs), 0, 0, (d))  )
00243 #define jit_addr_l(d, s1, s2)      jit_opo_((d), (s1), (s2), ADDQrr((s2), (d)), ADDQrr((s1), (d)), LEAQmr(0, (s1), (s2), 1, (d))  )
00244 #define jit_andi_l(d, rs, is)      jit_qop_ ((d), (rs),       ANDQir((is), (d))                   )
00245 #define jit_andr_l(d, s1, s2)      jit_qopr_((d), (s1), (s2), ANDQrr((s1), (d)), ANDQrr((s2), (d)) )
00246 #define jit_orr_l(d, s1, s2)       jit_qopr_((d), (s1), (s2),  ORQrr((s1), (d)),  ORQrr((s2), (d)) )
00247 #define jit_subr_l(d, s1, s2)      jit_qopr_((d), (s1), (s2), (SUBQrr((s1), (d)), NEGQr(d)),      SUBQrr((s2), (d))           )
00248 #define jit_xorr_l(d, s1, s2)      jit_qopr_((d), (s1), (s2), XORQrr((s1), (d)), XORQrr((s2), (d)) )
00249 
00250 /* These can sometimes use byte or word versions! */
00251 #define jit_ori_i(d, rs, is)       jit_op_ ((d), (rs),        jit_reduce(OR, (is), (d))           )
00252 #define jit_xori_i(d, rs, is)      jit_op_ ((d), (rs),        jit_reduce(XOR, (is), (d))          )
00253 #define jit_ori_l(d, rs, is)       jit_qop_ ((d), (rs),        jit_reduceQ(OR, (is), (d))         )
00254 #define jit_xori_l(d, rs, is)      jit_qop_ ((d), (rs),        jit_reduceQ(XOR, (is), (d))        )
00255 
00256 #define jit_muli_i(d, rs, is)      jit_op_ ((d), (rs),       IMULLir((is), (d))                   )
00257 #define jit_mulr_i(d, s1, s2)      jit_opr_((d), (s1), (s2), IMULLrr((s1), (d)), IMULLrr((s2), (d)) )
00258 
00259 /* As far as low bits are concerned, signed and unsigned multiplies are
00260    exactly the same. */
00261 #define jit_muli_ui(d, rs, is)     jit_op_ ((d), (rs),       IMULLir((is), (d))                   )
00262 #define jit_mulr_ui(d, s1, s2)     jit_opr_((d), (s1), (s2), IMULLrr((s1), (d)), IMULLrr((s2), (d)) )
00263 
00264 #define jit_hmuli_i(d, rs, is)                                                                                                \
00265        ((d) == _EDX ? (           PUSHLr(_EAX), jit_muli_i_((is), (rs)),                               POPLr(_EAX)            ) :    \
00266        ((d) == _EAX ? (PUSHLr(_EDX),                 jit_muli_i_((is), (rs)), MOVLrr(_EDX, _EAX),      POPLr(_EDX) ) : \
00267                       (PUSHLr(_EDX), PUSHLr(_EAX), jit_muli_i_((is), (rs)), MOVLrr(_EDX, (d)), POPLr(_EAX), POPLr(_EDX) )))
00268 
00269 #define jit_hmulr_i(d, s1, s2)                                                                                         \
00270        ((d) == _EDX ? (           PUSHLr(_EAX), jit_mulr_i_((s1), (s2)),                     POPLr(_EAX)            ) :       \
00271        ((d) == _EAX ? (PUSHLr(_EDX),                 jit_mulr_i_((s1), (s2)), MOVLrr(_EDX, _EAX),               POPLr(_EDX)  ) :     \
00272                      (PUSHLr(_EDX), PUSHLr(_EAX), jit_mulr_i_((s1), (s2)), MOVLrr(_EDX, (d)),   POPLr(_EAX), POPLr(_EDX)  )))
00273 
00274 #define jit_hmuli_ui(d, rs, is)                                                                                               \
00275        ((d) == _EDX ? (           PUSHLr(_EAX), jit_muli_ui_((is), (rs)),                               POPLr(_EAX)           ) :    \
00276        ((d) == _EAX ? (PUSHLr(_EDX),                 jit_muli_ui_((is), (rs)), MOVLrr(_EDX, _EAX),             POPLr(_EDX) ) :       \
00277                       (PUSHLr(_EDX), PUSHLr(_EAX), jit_muli_ui_((is), (rs)), MOVLrr(_EDX, (d)), POPLr(_EAX), POPLr(_EDX) )))
00278 
00279 #define jit_hmulr_ui(d, s1, s2)                                                                                        \
00280        ((d) == _EDX ? (           PUSHLr(_EAX), jit_mulr_ui_((s1), (s2)),                    POPLr(_EAX)            ) :       \
00281        ((d) == _EAX ? (PUSHLr(_EDX),                 jit_mulr_ui_((s1), (s2)), MOVLrr(_EDX, _EAX),              POPLr(_EDX)  ) :     \
00282                      (PUSHLr(_EDX), PUSHLr(_EAX), jit_mulr_ui_((s1), (s2)), MOVLrr(_EDX, (d)),  POPLr(_EAX), POPLr(_EDX)  )))
00283 
00284 #define jit_divi_i(d, rs, is)      jit_divi_i_(_EAX, (d), (rs), (is))
00285 #define jit_divi_ui(d, rs, is)     jit_divi_ui_(_EAX, (d), (rs), (is))
00286 #define jit_modi_i(d, rs, is)      jit_divi_i_(_EDX, (d), (rs), (is))
00287 #define jit_modi_ui(d, rs, is)     jit_divi_ui_(_EDX, (d), (rs), (is))
00288 #define jit_divr_i(d, s1, s2)      jit_divr_i_(_EAX, (d), (s1), (s2))
00289 #define jit_divr_ui(d, s1, s2)     jit_divr_ui_(_EAX, (d), (s1), (s2))
00290 #define jit_modr_i(d, s1, s2)      jit_divr_i_(_EDX, (d), (s1), (s2))
00291 #define jit_modr_ui(d, s1, s2)     jit_divr_ui_(_EDX, (d), (s1), (s2))
00292 
00293 
00294 /* Shifts */
00295 #define jit_lshi_i(d, rs, is)      ((is) <= 3 ?   LEALmr(0, 0, (rs), 1 << (is), (d))   :   jit_op_ ((d), (rs), SHLLir((is), (d)) ))
00296 #define jit_rshi_i(d, rs, is)                                                       jit_op_ ((d), (rs), SARLir((is), (d))  )
00297 #define jit_rshi_ui(d, rs, is)                                                      jit_op_ ((d), (rs), SHRLir((is), (d))  )
00298 #define jit_lshr_i(d, r1, r2)      jit_replace((r1), (r2), _ECX,                           jit_op_ ((d), (r1), SHLLrr(_CL,  (d)) ))
00299 #define jit_rshr_i(d, r1, r2)      jit_replace((r1), (r2), _ECX,                           jit_op_ ((d), (r1), SARLrr(_CL,  (d)) ))
00300 #define jit_rshr_ui(d, r1, r2)     jit_replace((r1), (r2), _ECX,                           jit_op_ ((d), (r1), SHRLrr(_CL,  (d)) ))
00301 
00302 #define jit_lshi_l(d, rs, is)      ((is) <= 3 ?   LEAQmr(0, 0, (rs), 1 << (is), (d))   :   jit_qop_ ((d), (rs), SHLQir((is), (d)) ))
00303 #define jit_rshi_l(d, rs, is)                                                       jit_qop_ ((d), (rs), SARQir((is), (d))  )
00304 #define jit_rshi_ul(d, rs, is)                                                      jit_qop_ ((d), (rs), SHRQir((is), (d))  )
00305 #define jit_lshr_l(d, r1, r2)      jit_replace((r1), (r2), _ECX,                           jit_qop_ ((d), (r1), SHLQrr(_CL,  (d)) ))
00306 #define jit_rshr_l(d, r1, r2)      jit_replace((r1), (r2), _ECX,                           jit_qop_ ((d), (r1), SARQrr(_CL,  (d)) ))
00307 #define jit_rshr_ul(d, r1, r2)     jit_replace((r1), (r2), _ECX,                           jit_qop_ ((d), (r1), SHRQrr(_CL,  (d)) ))
00308 
00309 /* Stack */
00310 #define jit_pushr_i(rs)            PUSHLr(rs)
00311 #define jit_popr_i(rs)             POPLr(rs)
00312 #define jit_pushr_l(rs) jit_pushr_i(rs)
00313 #define jit_popr_l(rs)  jit_popr_i(rs)
00314 
00315 #ifdef JIT_X86_64
00316 # define jit_base_prolog() (PUSHQr(_EBP), MOVQrr(_ESP, _EBP), PUSHQr(_EBX), PUSHQr(_R12), PUSHQr(_R13))
00317 # define jit_prolog(n) (_jitl.nextarg_geti = 0, jit_base_prolog())
00318 #else
00319 # define jit_base_prolog() (PUSHLr(_EBP), MOVLrr(_ESP, _EBP), PUSHLr(_EBX), PUSHLr(_ESI), PUSHLr(_EDI))
00320 # define jit_prolog(n) (_jitl.framesize = 8, jit_base_prolog())
00321 #endif
00322 
00323 /* The += allows for stack pollution */
00324 
00325 #ifdef JIT_X86_64
00326 /* Stack isn't used for arguments: */
00327 # define jit_prepare_i(ni)  (_jitl.argssize = 0)
00328 #else
00329 # ifdef _CALL_DARWIN
00330   /* Stack must stay 16-byte aligned: */
00331 #  define jit_prepare_i(ni) (((ni & 0x3) \
00332                                   ? SUBLir(4 * ((((ni) + 3) & ~(0x3)) - (ni)), JIT_SP) \
00333                                   : (void)0), \
00334                                  _jitl.argssize += (((ni) + 3) & ~(0x3)))
00335 # else
00336 #  define jit_prepare_i(ni) (_jitl.argssize += (ni))
00337 # endif
00338 #endif
00339 
00340 #define jit_prepare_f(nf)   (_jitl.argssize += (nf))
00341 #define jit_prepare_d(nd)   (_jitl.argssize += 2 * (nd))
00342 #ifdef JIT_X86_64
00343 # define jit_pusharg_i(rs)  (_jitl.argssize++, MOVQrr(rs, JIT_CALLTMPSTART + _jitl.argssize - 1))
00344 # define jit_finish(sub)        (jit_shift_args(), (void)jit_calli((sub)), jit_restore_locals())
00345 # define jit_reg_is_arg(reg) ((reg == _EDI) || (reg ==_ESI) || (reg == _EDX))
00346 # define jit_finishr(reg)   ((jit_reg_is_arg((reg)) ? MOVQrr(reg, JIT_REXTMP) : (void)0), \
00347                                  jit_shift_args(), \
00348                                  jit_reg_is_arg((reg)) ? CALQsr((JIT_REXTMP)) : jit_callr((reg)), \
00349                                  jit_restore_locals())
00350 /* R12 and R13 are callee-save, instead of EDI and ESI */
00351 # define jit_shift_args() \
00352    (MOVQrr(_ESI, _R12), MOVQrr(_EDI, _R13), \
00353    (_jitl.argssize--  \
00354     ? (MOVQrr(JIT_CALLTMPSTART + _jitl.argssize, jit_arg_reg_order[0]),  \
00355        (_jitl.argssize--  \
00356         ? (MOVQrr(JIT_CALLTMPSTART + _jitl.argssize, jit_arg_reg_order[1]),  \
00357            (_jitl.argssize--  \
00358             ? MOVQrr(JIT_CALLTMPSTART, jit_arg_reg_order[2])  \
00359             : (void)0)) \
00360         : (void)0)) \
00361     : (void)0))
00362 # define jit_restore_locals() \
00363     (MOVQrr(_R12, _ESI), MOVQrr(_R13, _EDI))
00364 #else
00365 # define jit_pusharg_i(rs)  PUSHLr(rs)
00366 # define jit_finish(sub)        ((void)jit_calli((sub)), ADDLir(sizeof(long) * _jitl.argssize, JIT_SP), _jitl.argssize = 0)
00367 # define jit_finishr(reg)   (jit_callr((reg)), ADDLir(sizeof(long) * _jitl.argssize, JIT_SP), _jitl.argssize = 0)
00368 #endif
00369 #define jit_pusharg_l(rs) jit_pusharg_i(rs)
00370 #define jit_retval_i(rd)    ((void)jit_movr_i ((rd), _EAX))
00371 #define jit_retval_l(rd)    ((void)jit_movr_l ((rd), _EAX))
00372 
00373 #ifdef JIT_X86_64
00374 #define       jit_arg_i()           (_jitl.nextarg_geti++)
00375 #define       jit_arg_l()           (_jitl.nextarg_geti++)
00376 #define       jit_arg_p()           (_jitl.nextarg_geti++)
00377 #define jit_arg_reg(p)          (jit_arg_reg_order[p])
00378 static int jit_arg_reg_order[] = { _EDI, _ESI, _EDX, _ECX };
00379 #else
00380 #define       jit_arg_c()          ((_jitl.framesize += sizeof(int)) - sizeof(int))
00381 #define       jit_arg_uc()         ((_jitl.framesize += sizeof(int)) - sizeof(int))
00382 #define       jit_arg_s()          ((_jitl.framesize += sizeof(int)) - sizeof(int))
00383 #define       jit_arg_us()         ((_jitl.framesize += sizeof(int)) - sizeof(int))
00384 #define       jit_arg_i()          ((_jitl.framesize += sizeof(int)) - sizeof(int))
00385 #define       jit_arg_ui()         ((_jitl.framesize += sizeof(int)) - sizeof(int))
00386 #define       jit_arg_l()          ((_jitl.framesize += sizeof(long)) - sizeof(long))
00387 #define       jit_arg_ul()         ((_jitl.framesize += sizeof(long)) - sizeof(long))
00388 #define       jit_arg_p()          ((_jitl.framesize += sizeof(long)) - sizeof(long))
00389 #endif
00390 
00391 #define       jit_arg_f()          ((_jitl.framesize += sizeof(float)) - sizeof(float))
00392 #define       jit_arg_d()          ((_jitl.framesize += sizeof(double)) - sizeof(double))
00393 
00394 /* Unary */
00395 #define jit_negr_i(d, rs)   jit_opi_((d), (rs), NEGLr(d), (XORLrr((d), (d)), SUBLrr((rs), (d))) )
00396 #define jit_negr_l(d, rs)   jit_opi_((d), (rs), NEGQr(d), (XORQrr((d), (d)), SUBQrr((rs), (d))) )
00397 
00398 #define jit_movr_i(d, rs)   ((void)((rs) == (d) ? 0 : MOVLrr((rs), (d))))
00399 #define jit_movi_i(d, is)   ((is) ? MOVLir((is), (d)) : XORLrr ((d), (d)) )
00400 #define jit_movr_l(d, rs)   ((void)((rs) == (d) ? 0 : MOVQrr((rs), (d))))
00401 #define jit_movi_l(d, is)   ((is) \
00402                                  ? (_u32P((long)(is)) \
00403                                     ? MOVLir((is), (d)) \
00404                                     : MOVQir((is), (d))) \
00405                                  : XORLrr ((d), (d)) )
00406 #define jit_movi_p(d, is)       jit_movi_l(d, ((long)(is)))
00407 #define jit_patchable_movi_p(d, is) (MOVQir((is), (d)), _jit.x.pc)
00408 #define jit_patch_movi(pa,pv)   (*_PSL((pa) - sizeof(long)) = _jit_SL((pv)))
00409 
00410 #define jit_ntoh_ui(d, rs)  jit_op_((d), (rs), BSWAPLr(d))
00411 #define jit_ntoh_us(d, rs)  jit_op_((d), (rs), RORWir(8, d))
00412 
00413 /* Boolean */
00414 #define jit_ltr_i(d, s1, s2)       jit_bool_r((d), (s1), (s2), SETLr  )
00415 #define jit_ler_i(d, s1, s2)       jit_bool_r((d), (s1), (s2), SETLEr )
00416 #define jit_gtr_i(d, s1, s2)       jit_bool_r((d), (s1), (s2), SETGr  )
00417 #define jit_ger_i(d, s1, s2)       jit_bool_r((d), (s1), (s2), SETGEr )
00418 #define jit_eqr_i(d, s1, s2)       jit_bool_r((d), (s1), (s2), SETEr  )
00419 #define jit_ner_i(d, s1, s2)       jit_bool_r((d), (s1), (s2), SETNEr )
00420 #define jit_ltr_ui(d, s1, s2)      jit_bool_r((d), (s1), (s2), SETBr  )
00421 #define jit_ler_ui(d, s1, s2)      jit_bool_r((d), (s1), (s2), SETBEr )
00422 #define jit_gtr_ui(d, s1, s2)      jit_bool_r((d), (s1), (s2), SETAr  )
00423 #define jit_ger_ui(d, s1, s2)      jit_bool_r((d), (s1), (s2), SETAEr )
00424 
00425 #define jit_lti_i(d, rs, is)       jit_bool_i0((d), (rs), (is), SETLr,  SETSr  )
00426 #define jit_lei_i(d, rs, is)       jit_bool_i ((d), (rs), (is), SETLEr           )
00427 #define jit_gti_i(d, rs, is)       jit_bool_i ((d), (rs), (is), SETGr            )
00428 #define jit_gei_i(d, rs, is)       jit_bool_i0((d), (rs), (is), SETGEr, SETNSr )
00429 #define jit_eqi_i(d, rs, is)       jit_bool_i0((d), (rs), (is), SETEr,  SETEr  )
00430 #define jit_nei_i(d, rs, is)       jit_bool_i0((d), (rs), (is), SETNEr, SETNEr )
00431 #define jit_lti_ui(d, rs, is)      jit_bool_i ((d), (rs), (is), SETBr     )
00432 #define jit_lei_ui(d, rs, is)      jit_bool_i0((d), (rs), (is), SETBEr, SETEr  )
00433 #define jit_gti_ui(d, rs, is)      jit_bool_i0((d), (rs), (is), SETAr,  SETNEr )
00434 #define jit_gei_ui(d, rs, is)      jit_bool_i0((d), (rs), (is), SETAEr, INCLr  )
00435 
00436 /* Jump */
00437 #define jit_bltr_i(label, s1, s2)  jit_bra_r((s1), (s2), JLm(label, 0,0,0) )
00438 #define jit_bler_i(label, s1, s2)  jit_bra_r((s1), (s2), JLEm(label,0,0,0) )
00439 #define jit_bgtr_i(label, s1, s2)  jit_bra_r((s1), (s2), JGm(label, 0,0,0) )
00440 #define jit_bger_i(label, s1, s2)  jit_bra_r((s1), (s2), JGEm(label,0,0,0) )
00441 #define jit_beqr_i(label, s1, s2)  jit_bra_r((s1), (s2), JEm(label, 0,0,0) )
00442 #define jit_bner_i(label, s1, s2)  jit_bra_r((s1), (s2), JNEm(label,0,0,0) )
00443 #define jit_bltr_ui(label, s1, s2) jit_bra_r((s1), (s2), JBm(label, 0,0,0) )
00444 #define jit_bler_ui(label, s1, s2) jit_bra_r((s1), (s2), JBEm(label,0,0,0) )
00445 #define jit_bgtr_ui(label, s1, s2) jit_bra_r((s1), (s2), JAm(label, 0,0,0) )
00446 #define jit_bger_ui(label, s1, s2) jit_bra_r((s1), (s2), JAEm(label,0,0,0) )
00447 #define jit_bmsr_i(label, s1, s2)  (TESTQrr((s1), (s2)), JNZm(label,0,0,0), _jit.x.pc)
00448 #define jit_bmcr_i(label, s1, s2)  (TESTQrr((s1), (s2)), JZm(label,0,0,0),  _jit.x.pc)
00449 #define jit_boaddr_i(label, s1, s2)       (ADDLrr((s2), (s1)), JOm(label,0,0,0), _jit.x.pc)
00450 #define jit_bosubr_i(label, s1, s2)       (SUBLrr((s2), (s1)), JOm(label,0,0,0), _jit.x.pc)
00451 #define jit_boaddr_ui(label, s1, s2)      (ADDLrr((s2), (s1)), JCm(label,0,0,0), _jit.x.pc)
00452 #define jit_bosubr_ui(label, s1, s2)      (SUBLrr((s2), (s1)), JCm(label,0,0,0), _jit.x.pc)
00453 
00454 #define jit_bltr_l(label, s1, s2)  jit_bra_qr((s1), (s2), JLm(label, 0,0,0) )
00455 #define jit_bler_l(label, s1, s2)  jit_bra_qr((s1), (s2), JLEm(label,0,0,0) )
00456 #define jit_bgtr_l(label, s1, s2)  jit_bra_qr((s1), (s2), JGm(label, 0,0,0) )
00457 #define jit_bger_l(label, s1, s2)  jit_bra_qr((s1), (s2), JGEm(label,0,0,0) )
00458 #define jit_beqr_l(label, s1, s2)  jit_bra_qr((s1), (s2), JEm(label, 0,0,0) )
00459 #define jit_bner_l(label, s1, s2)  jit_bra_qr((s1), (s2), JNEm(label,0,0,0) )
00460 #define jit_bltr_ul(label, s1, s2) jit_bra_qr((s1), (s2), JBm(label, 0,0,0) )
00461 #define jit_bler_ul(label, s1, s2) jit_bra_qr((s1), (s2), JBEm(label,0,0,0) )
00462 #define jit_bgtr_ul(label, s1, s2) jit_bra_qr((s1), (s2), JAm(label, 0,0,0) )
00463 #define jit_bger_ul(label, s1, s2) jit_bra_qr((s1), (s2), JAEm(label,0,0,0) )
00464 #define jit_bmsr_l(label, s1, s2)  (TESTQrr((s1), (s2)), JNZm(label,0,0,0), _jit.x.pc)
00465 #define jit_bmcr_l(label, s1, s2)  (TESTQrr((s1), (s2)), JZm(label,0,0,0),  _jit.x.pc)
00466 #define jit_boaddr_l(label, s1, s2)       (ADDQrr((s2), (s1)), JOm(label,0,0,0), _jit.x.pc)
00467 #define jit_bosubr_l(label, s1, s2)       (SUBQrr((s2), (s1)), JOm(label,0,0,0), _jit.x.pc)
00468 #define jit_boaddr_ul(label, s1, s2)      (ADDQrr((s2), (s1)), JCm(label,0,0,0), _jit.x.pc)
00469 #define jit_bosubr_ul(label, s1, s2)      (SUBQrr((s2), (s1)), JCm(label,0,0,0), _jit.x.pc)
00470 #define jit_bomulr_l(label, s1, s2)       (IMULQrr((s2), (s1)), JOm(label,0,0,0), _jit.x.pc)
00471 
00472 #define jit_blti_i(label, rs, is)  jit_bra_i0((rs), (is), JLm(label, 0,0,0), JSm(label, 0,0,0) )
00473 #define jit_blei_i(label, rs, is)  jit_bra_i ((rs), (is), JLEm(label,0,0,0)             )
00474 #define jit_bgti_i(label, rs, is)  jit_bra_i ((rs), (is), JGm(label, 0,0,0)             )
00475 #define jit_bgei_i(label, rs, is)  jit_bra_i0((rs), (is), JGEm(label,0,0,0), JNSm(label,0,0,0) )
00476 #define jit_beqi_i(label, rs, is)  jit_bra_i0((rs), (is), JEm(label, 0,0,0), JEm(label, 0,0,0) )
00477 #define jit_bnei_i(label, rs, is)  jit_bra_i0((rs), (is), JNEm(label,0,0,0), JNEm(label,0,0,0) )
00478 #define jit_blti_ui(label, rs, is) jit_bra_i ((rs), (is), JBm(label, 0,0,0)             )
00479 #define jit_blei_ui(label, rs, is) jit_bra_i0((rs), (is), JBEm(label,0,0,0), JEm(label, 0,0,0) )
00480 #define jit_bgti_ui(label, rs, is) jit_bra_i0((rs), (is), JAm(label, 0,0,0), JNEm(label,0,0,0) )
00481 #define jit_bgei_ui(label, rs, is) jit_bra_i ((rs), (is), JAEm(label,0,0,0)             )
00482 #define jit_boaddi_i(label, rs, is)       (ADDLir((is), (rs)), JOm(label,0,0,0), _jit.x.pc)
00483 #define jit_bosubi_i(label, rs, is)       (SUBLir((is), (rs)), JOm(label,0,0,0), _jit.x.pc)
00484 #define jit_boaddi_ui(label, rs, is)      (ADDLir((is), (rs)), JCm(label,0,0,0), _jit.x.pc)
00485 #define jit_bosubi_ui(label, rs, is)      (SUBLir((is), (rs)), JCm(label,0,0,0), _jit.x.pc)
00486 
00487 #define jit_blti_l(label, rs, is)  jit_bra_l0((rs), (is), JLm(label, 0,0,0), JSm(label, 0,0,0) )
00488 #define jit_blei_l(label, rs, is)  jit_bra_l ((rs), (is), JLEm(label,0,0,0)             )
00489 #define jit_bgti_l(label, rs, is)  jit_bra_l ((rs), (is), JGm(label, 0,0,0)             )
00490 #define jit_bgei_l(label, rs, is)  jit_bra_l0((rs), (is), JGEm(label,0,0,0), JNSm(label,0,0,0) )
00491 #define jit_beqi_l(label, rs, is)  jit_bra_l0((rs), (is), JEm(label, 0,0,0), JEm(label, 0,0,0) )
00492 #define jit_bnei_l(label, rs, is)  jit_bra_l0((rs), (is), JNEm(label,0,0,0), JNEm(label,0,0,0) )
00493 #define jit_blti_ul(label, rs, is) jit_bra_l ((rs), (is), JBm(label, 0,0,0)             )
00494 #define jit_blei_ul(label, rs, is) jit_bra_l0((rs), (is), JBEm(label,0,0,0), JEm(label, 0,0,0) )
00495 #define jit_bgti_ul(label, rs, is) jit_bra_l0((rs), (is), JAm(label, 0,0,0), JNEm(label,0,0,0) )
00496 #define jit_bgei_ul(label, rs, is) jit_bra_l ((rs), (is), JAEm(label,0,0,0)             )
00497 #define jit_boaddi_l(label, rs, is)       (ADDQir((is), (rs)), JOm(label,0,0,0), _jit.x.pc)
00498 #define jit_bosubi_l(label, rs, is)       (SUBQir((is), (rs)), JOm(label,0,0,0), _jit.x.pc)
00499 #define jit_boaddi_ul(label, rs, is)      (ADDQir((is), (rs)), JCm(label,0,0,0), _jit.x.pc)
00500 #define jit_bosubi_ul(label, rs, is)      (SUBQir((is), (rs)), JCm(label,0,0,0), _jit.x.pc)
00501 
00502 #define jit_bmsi_i(label, rs, is)  (jit_reduce(TEST, (is), (rs)), JNZm(label,0,0,0), _jit.x.pc)
00503 #define jit_bmci_i(label, rs, is)  (jit_reduce(TEST, (is), (rs)), JZm(label,0,0,0),  _jit.x.pc)
00504 
00505 #define jit_bmsi_l(label, rs, is) jit_bmsi_i(label, rs, is)
00506 #define jit_bmci_l(label, rs, is) jit_bmci_i(label, rs, is)
00507 
00508 #define jit_jmpi(label)            (JMPm( ((unsigned long) (label)),  0, 0, 0), _jit.x.pc)
00509 #define jit_calli(label)    (CALLm( ((unsigned long) (label)), 0, 0, 0), _jit.x.pc)
00510 #define jit_callr(reg)             (CALLsr(reg))
00511 #define jit_jmpr(reg)              JMPsr(reg)
00512 #ifdef JIT_X86_64
00513 #define jit_patch_long_at(jump_pc,v)  (*_PSL((jump_pc) - sizeof(long)) = _jit_SL((jit_insn *)(v)))
00514 # define jit_patch_short_at(jump_pc,v)  (*_PSI((jump_pc) - sizeof(int)) = _jit_SI((jit_insn *)(v) - (jump_pc)))
00515 # define jit_patch_branch_at(jump_pc,v) (_jitl.long_jumps ? jit_patch_long_at((jump_pc)-3, v) : jit_patch_short_at(jump_pc, v))
00516 # define jit_patch_ucbranch_at(jump_pc,v) (_jitl.long_jumps ? jit_patch_long_at((jump_pc)-3, v) : jit_patch_short_at(jump_pc, v))
00517 # define jit_ret() (POPQr(_R13), POPQr(_R12), POPQr(_EBX), POPQr(_EBP), RET_())
00518 #else
00519 #define jit_patch_long_at(jump_pc,v)  (_jitl.tiny_jumps \
00520                                        ? (*_PSC((jump_pc) - sizeof(char)) = _jit_SC((jit_insn *)(v) - (jump_pc))) \
00521                                        : (*_PSL((jump_pc) - sizeof(long)) = _jit_SL((jit_insn *)(v) - (jump_pc))))
00522 # define jit_patch_branch_at(jump_pc,v)  jit_patch_long_at(jump_pc, v)
00523 # define jit_patch_ucbranch_at(jump_pc,v)  jit_patch_long_at(jump_pc, v)
00524 # define jit_ret() (POPLr(_EDI), POPLr(_ESI), POPLr(_EBX), POPLr(_EBP), RET_())
00525 #endif
00526 
00527 /* Memory */
00528 #define jit_ldi_c(d, is)           MOVSBLmr((is), 0,    0,    0, (d))
00529 #define jit_ldr_c(d, rs)           MOVSBLmr(0,    (rs), 0,    0, (d))
00530 #define jit_ldxr_c(d, s1, s2)             MOVSBLmr(0,    (s1), (s2), 1, (d))
00531 #define jit_ldxi_c(d, rs, is)             MOVSBLmr((is), (rs), 0,    0, (d))
00532 
00533 #define jit_ldi_uc(d, is)          MOVZBLmr((is), 0,    0,    0, (d))
00534 #define jit_ldr_uc(d, rs)          MOVZBLmr(0,    (rs), 0,    0, (d))
00535 #define jit_ldxr_uc(d, s1, s2)            MOVZBLmr(0,    (s1), (s2), 1, (d))
00536 #define jit_ldxi_uc(d, rs, is)            MOVZBLmr((is), (rs), 0,    0, (d))
00537 
00538 #define jit_sti_c(id, rs)               jit_movbrm((rs), (id), 0,    0,    0)
00539 #define jit_str_c(rd, rs)               jit_movbrm((rs), 0,    (rd), 0,    0)
00540 #define jit_stxr_c(d1, d2, rs)          jit_movbrm((rs), 0,    (d1), (d2), 1)
00541 #define jit_stxi_c(id, rd, rs)          jit_movbrm((rs), (id), (rd), 0,    0)
00542 
00543 #define jit_ldi_s(d, is)           MOVSWLmr((is), 0,    0,    0, (d))
00544 #define jit_ldr_s(d, rs)           MOVSWLmr(0,    (rs), 0,    0, (d))
00545 #define jit_ldxr_s(d, s1, s2)             MOVSWLmr(0,    (s1), (s2), 1, (d))
00546 #define jit_ldxi_s(d, rs, is)             MOVSWLmr((is), (rs), 0,    0, (d))
00547 
00548 #define jit_ldi_us(d, is)          MOVZWLmr((is), 0,    0,    0,  (d))
00549 #define jit_ldr_us(d, rs)          MOVZWLmr(0,    (rs), 0,    0,  (d))
00550 #define jit_ldxr_us(d, s1, s2)            MOVZWLmr(0,    (s1), (s2), 1,  (d))
00551 #define jit_ldxi_us(d, rs, is)            MOVZWLmr((is), (rs), 0,    0,  (d))
00552 
00553 #define jit_sti_s(id, rs)          MOVWrm(jit_reg16(rs), (id), 0,    0,    0)
00554 #define jit_str_s(rd, rs)          MOVWrm(jit_reg16(rs), 0,    (rd), 0,    0)
00555 #define jit_stxr_s(d1, d2, rs)            MOVWrm(jit_reg16(rs), 0,    (d1), (d2), 1)
00556 #define jit_stxi_s(id, rd, rs)            MOVWrm(jit_reg16(rs), (id), (rd), 0,    0)
00557 
00558 #define jit_ldi_i(d, is)           MOVLmr((is), 0,    0,    0,  (d))
00559 #define jit_ldr_i(d, rs)           MOVLmr(0,    (rs), 0,    0,  (d))
00560 #define jit_ldxr_i(d, s1, s2)             MOVLmr(0,    (s1), (s2), 1,  (d))
00561 #define jit_ldxi_i(d, rs, is)             MOVLmr((is), (rs), 0,    0,  (d))
00562 
00563 #define jit_sti_i(id, rs)          MOVLrm((rs), (id), 0,    0,    0)
00564 #define jit_str_i(rd, rs)          MOVLrm((rs), 0,    (rd), 0,    0)
00565 #define jit_stxr_i(d1, d2, rs)            MOVLrm((rs), 0,    (d1), (d2), 1)
00566 #define jit_stxi_i(id, rd, rs)            MOVLrm((rs), (id), (rd), 0,    0)
00567 
00568 #define _jit_ldi_l(d, is)          MOVQmr((is), 0,    0,    0,  (d))
00569 #define jit_ldr_l(d, rs)           MOVQmr(0,    (rs), 0,    0,  (d))
00570 #define jit_ldxr_l(d, s1, s2)             MOVQmr(0,    (s1), (s2), 1,  (d))
00571 #define jit_ldxi_l(d, rs, is)             MOVQmr((is), (rs), 0,    0,  (d))
00572 
00573 #define _jit_sti_l(id, rs)         MOVQrm((rs), (id), 0,    0,    0)
00574 #define jit_str_l(rd, rs)          MOVQrm((rs), 0,    (rd), 0,    0)
00575 #define jit_stxr_l(d1, d2, rs)            MOVQrm((rs), 0,    (d1), (d2), 1)
00576 #define jit_stxi_l(id, rd, rs)            MOVQrm((rs), (id), (rd), 0,    0)
00577 
00578 #ifdef JIT_X86_64
00579 # define jit_ldi_l(d, is) (_u32P((long)(is)) ? _jit_ldi_l(d, is) : (jit_movi_l(d, is), jit_ldr_l(d, d)))
00580 # define jit_sti_l(id, rs) (_u32P((long)(id)) ? _jit_sti_l(id, rs) : (jit_movi_l(JIT_REXTMP, id), MOVQrQm(rs, 0, JIT_REXTMP, 0, 0)))
00581 #else
00582 # define jit_ldi_l(d, is) _jit_ldi_l(d, is)
00583 # define jit_sti_l(id, rs) _jit_sti_l(id, rs)
00584 #endif
00585 
00586 
00587 /* Extra */
00588 #define jit_nop()                  NOP_()
00589 
00590 #define _jit_alignment(pc, n)             (((pc ^ _MASK(4)) + 1) & _MASK(n))
00591 #define jit_align(n)                      NOPi(_jit_alignment(_jit_UL(_jit.x.pc), (n)))
00592 
00593 #endif /* __lightning_core_h */