JIT for ARM

Includes switch from LGPL 2.1 to LGPL 3, since the ARM port
of GNU lightining is licensed under LGPL 3.
This commit is contained in:
Matthew Flatt 2013-04-02 14:32:52 -06:00
parent bc5c89cbf0
commit d5ede87ae8
42 changed files with 12232 additions and 960 deletions

2
README
View File

@ -36,4 +36,4 @@ applications, provided you follow the rules stated in the LGPL. You can
also modify Racket; if you distribute a modified version, you must also modify Racket; if you distribute a modified version, you must
distribute it under the terms of the LGPL, which in particular means distribute it under the terms of the LGPL, which in particular means
that you must release the source code for the modified software. See that you must release the source code for the modified software. See
doc/release-notes/COPYING.txt for more information. doc/release-notes/COPYING_LESSER.txt for more information.

View File

@ -70,7 +70,7 @@ On some platforms, bytecode is further compiled to native code via a
compiler substantially speeds programs that execute tight loops, compiler substantially speeds programs that execute tight loops,
arithmetic on small integers, and arithmetic on inexact real arithmetic on small integers, and arithmetic on inexact real
numbers. Currently, @tech{JIT} compilation is supported for x86, numbers. Currently, @tech{JIT} compilation is supported for x86,
x86_64 (a.k.a. AMD64), and 32-bit PowerPC processors. The @tech{JIT} x86_64 (a.k.a. AMD64), ARM, and 32-bit PowerPC processors. The @tech{JIT}
compiler can be disabled via the @racket[eval-jit-enabled] parameter compiler can be disabled via the @racket[eval-jit-enabled] parameter
or the @DFlag{no-jit}/@Flag{j} command-line flag for @exec{racket}. or the @DFlag{no-jit}/@Flag{j} command-line flag for @exec{racket}.

View File

@ -21,7 +21,7 @@ General Public License (LGPL). This means
] ]
See @filepath{doc/release-notes/COPYING.txt} in your Racket installation See @filepath{doc/release-notes/COPYING_LESSER.txt} in your Racket installation
for more information. for more information.
@copyright{ @copyright{
@ -88,7 +88,7 @@ Racket software includes or extends the following copyrighted material:
@copyright{ @copyright{
GNU lightning GNU lightning
Copyright (c) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Copyright (c) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2011
Free Software Foundation, Inc. Free Software Foundation, Inc.
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,6 @@
Version 5.3.4.1
Changed JIT to support ARM
Version 5.3.3.9 Version 5.3.3.9
racket/udp: added multicast support: udp-multicast-join-group!, racket/udp: added multicast support: udp-multicast-join-group!,
udp-multicast-leave-group!, udp-multicast-interface, udp-multicast-leave-group!, udp-multicast-interface,

2
src/configure vendored
View File

@ -8806,7 +8806,7 @@ fi
############## drop optimization flags ################ ############## drop optimization flags ################
if test "${enable_noopt}" = "yes" ; then if test "${enable_noopt}" = "yes" ; then
AWKPRG='BEGIN { FS = "(^| )-O(0|1|2|3|4|5|6|7|8|9|())( |$)" } /.*/ { for (i = 1; i < NF; i++) printf "%s ", $i; print $NF }' AWKPRG='BEGIN { FS = "(^| )-O(0|1|2|3|4|5|6|7|8|9)?( |$)" } /.*/ { for (i = 1; i < NF; i++) printf "%s ", $i; print $NF }'
CFLAGS=`echo "$CFLAGS" | awk "$AWKPRG"` CFLAGS=`echo "$CFLAGS" | awk "$AWKPRG"`
fi fi

View File

@ -1796,6 +1796,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(Tsint8)); delta += (sizeof(intptr_t)-sizeof(Tsint8));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(Tsint8)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (!(get_byte_val(val,&(((Tsint8*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_int8", val);; if (!(get_byte_val(val,&(((Tsint8*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_int8", val);;
return NULL; return NULL;
case FOREIGN_uint8: case FOREIGN_uint8:
@ -1805,6 +1810,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(Tuint8)); delta += (sizeof(intptr_t)-sizeof(Tuint8));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(Tuint8)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (!(get_ubyte_val(val,&(((Tuint8*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_uint8", val);; if (!(get_ubyte_val(val,&(((Tuint8*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_uint8", val);;
return NULL; return NULL;
case FOREIGN_int16: case FOREIGN_int16:
@ -1814,6 +1824,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(Tsint16)); delta += (sizeof(intptr_t)-sizeof(Tsint16));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(Tsint16)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (!(get_short_val(val,&(((Tsint16*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_int16", val);; if (!(get_short_val(val,&(((Tsint16*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_int16", val);;
return NULL; return NULL;
case FOREIGN_uint16: case FOREIGN_uint16:
@ -1823,6 +1838,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(Tuint16)); delta += (sizeof(intptr_t)-sizeof(Tuint16));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(Tuint16)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (!(get_ushort_val(val,&(((Tuint16*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_uint16", val);; if (!(get_ushort_val(val,&(((Tuint16*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_uint16", val);;
return NULL; return NULL;
case FOREIGN_int32: case FOREIGN_int32:
@ -1832,6 +1852,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(Tsint32)); delta += (sizeof(intptr_t)-sizeof(Tsint32));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(Tsint32)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (!(scheme_get_realint_val(val,&(((Tsint32*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_int32", val);; if (!(scheme_get_realint_val(val,&(((Tsint32*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_int32", val);;
return NULL; return NULL;
case FOREIGN_uint32: case FOREIGN_uint32:
@ -1841,6 +1866,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(Tuint32)); delta += (sizeof(intptr_t)-sizeof(Tuint32));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(Tuint32)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (!(scheme_get_unsigned_realint_val(val,&(((Tuint32*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_uint32", val);; if (!(scheme_get_unsigned_realint_val(val,&(((Tuint32*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_uint32", val);;
return NULL; return NULL;
case FOREIGN_int64: case FOREIGN_int64:
@ -1850,6 +1880,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(Tsint64)); delta += (sizeof(intptr_t)-sizeof(Tsint64));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(Tsint64)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (!(scheme_get_long_long_val(val,&(((Tsint64*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_int64", val);; if (!(scheme_get_long_long_val(val,&(((Tsint64*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_int64", val);;
return NULL; return NULL;
case FOREIGN_uint64: case FOREIGN_uint64:
@ -1859,6 +1894,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(Tuint64)); delta += (sizeof(intptr_t)-sizeof(Tuint64));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(Tuint64)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (!(scheme_get_unsigned_long_long_val(val,&(((Tuint64*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_uint64", val);; if (!(scheme_get_unsigned_long_long_val(val,&(((Tuint64*)W_OFFSET(dst,delta))[0])))) wrong_value(who, "_uint64", val);;
return NULL; return NULL;
case FOREIGN_fixint: case FOREIGN_fixint:
@ -1868,6 +1908,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(Tsint32)); delta += (sizeof(intptr_t)-sizeof(Tsint32));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(Tsint32)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_INTP(val)) { if (SCHEME_INTP(val)) {
Tsint32 tmp; Tsint32 tmp;
tmp = MZ_TYPE_CAST(Tsint32, SCHEME_INT_VAL(val)); tmp = MZ_TYPE_CAST(Tsint32, SCHEME_INT_VAL(val));
@ -1883,6 +1928,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(Tuint32)); delta += (sizeof(intptr_t)-sizeof(Tuint32));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(Tuint32)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_INTP(val)) { if (SCHEME_INTP(val)) {
Tuint32 tmp; Tuint32 tmp;
tmp = MZ_TYPE_CAST(Tuint32, SCHEME_UINT_VAL(val)); tmp = MZ_TYPE_CAST(Tuint32, SCHEME_UINT_VAL(val));
@ -1898,6 +1948,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(intptr_t)); delta += (sizeof(intptr_t)-sizeof(intptr_t));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(intptr_t)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_INTP(val)) { if (SCHEME_INTP(val)) {
intptr_t tmp; intptr_t tmp;
tmp = MZ_TYPE_CAST(intptr_t, SCHEME_INT_VAL(val)); tmp = MZ_TYPE_CAST(intptr_t, SCHEME_INT_VAL(val));
@ -1913,6 +1968,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(uintptr_t)); delta += (sizeof(intptr_t)-sizeof(uintptr_t));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(uintptr_t)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_INTP(val)) { if (SCHEME_INTP(val)) {
uintptr_t tmp; uintptr_t tmp;
tmp = MZ_TYPE_CAST(uintptr_t, SCHEME_UINT_VAL(val)); tmp = MZ_TYPE_CAST(uintptr_t, SCHEME_UINT_VAL(val));
@ -1928,6 +1988,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(float)); delta += (sizeof(intptr_t)-sizeof(float));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(float)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_FLOATP(val)) { if (SCHEME_FLOATP(val)) {
float tmp; float tmp;
tmp = MZ_TYPE_CAST(float, SCHEME_FLOAT_VAL(val)); tmp = MZ_TYPE_CAST(float, SCHEME_FLOAT_VAL(val));
@ -1943,6 +2008,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(double)); delta += (sizeof(intptr_t)-sizeof(double));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(double)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_FLOATP(val)) { if (SCHEME_FLOATP(val)) {
double tmp; double tmp;
tmp = MZ_TYPE_CAST(double, SCHEME_FLOAT_VAL(val)); tmp = MZ_TYPE_CAST(double, SCHEME_FLOAT_VAL(val));
@ -1958,6 +2028,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(mz_long_double)); delta += (sizeof(intptr_t)-sizeof(mz_long_double));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(mz_long_double)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_LONG_DBLP(val)) { if (SCHEME_LONG_DBLP(val)) {
mz_long_double tmp; mz_long_double tmp;
tmp = MZ_NO_TYPE_CAST(mz_long_double, SCHEME_MAYBE_LONG_DBL_VAL(val)); tmp = MZ_NO_TYPE_CAST(mz_long_double, SCHEME_MAYBE_LONG_DBL_VAL(val));
@ -1973,6 +2048,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(double)); delta += (sizeof(intptr_t)-sizeof(double));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(double)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_REALP(val)) { if (SCHEME_REALP(val)) {
double tmp; double tmp;
tmp = MZ_TYPE_CAST(double, scheme_real_to_double(val)); tmp = MZ_TYPE_CAST(double, scheme_real_to_double(val));
@ -1988,6 +2068,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(int)); delta += (sizeof(intptr_t)-sizeof(int));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(int)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (1) { if (1) {
int tmp; int tmp;
tmp = MZ_TYPE_CAST(int, SCHEME_TRUEP(val)); tmp = MZ_TYPE_CAST(int, SCHEME_TRUEP(val));
@ -2003,6 +2088,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(mzchar*)); delta += (sizeof(intptr_t)-sizeof(mzchar*));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(mzchar*)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_FALSEP_OR_CHAR_STRINGP(val)) { if (SCHEME_FALSEP_OR_CHAR_STRINGP(val)) {
mzchar* tmp; mzchar* tmp;
tmp = MZ_TYPE_CAST(mzchar*, ucs4_string_or_null_to_ucs4_pointer(val)); tmp = MZ_TYPE_CAST(mzchar*, ucs4_string_or_null_to_ucs4_pointer(val));
@ -2024,6 +2114,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(unsigned short*)); delta += (sizeof(intptr_t)-sizeof(unsigned short*));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(unsigned short*)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_FALSEP_OR_CHAR_STRINGP(val)) { if (SCHEME_FALSEP_OR_CHAR_STRINGP(val)) {
unsigned short* tmp; unsigned short* tmp;
tmp = MZ_TYPE_CAST(unsigned short*, ucs4_string_or_null_to_utf16_pointer(val)); tmp = MZ_TYPE_CAST(unsigned short*, ucs4_string_or_null_to_utf16_pointer(val));
@ -2045,6 +2140,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(char*)); delta += (sizeof(intptr_t)-sizeof(char*));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(char*)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_FALSEP(val)||SCHEME_BYTE_STRINGP(val)) { if (SCHEME_FALSEP(val)||SCHEME_BYTE_STRINGP(val)) {
char* tmp; char* tmp;
tmp = MZ_TYPE_CAST(char*, SCHEME_FALSEP(val)?NULL:SCHEME_BYTE_STR_VAL(val)); tmp = MZ_TYPE_CAST(char*, SCHEME_FALSEP(val)?NULL:SCHEME_BYTE_STR_VAL(val));
@ -2066,6 +2166,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(char*)); delta += (sizeof(intptr_t)-sizeof(char*));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(char*)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_FALSEP(val)||SCHEME_PATH_STRINGP(val)) { if (SCHEME_FALSEP(val)||SCHEME_PATH_STRINGP(val)) {
char* tmp; char* tmp;
tmp = MZ_TYPE_CAST(char*, SCHEME_FALSEP(val)?NULL:SCHEME_PATH_VAL(TO_PATH(val))); tmp = MZ_TYPE_CAST(char*, SCHEME_FALSEP(val)?NULL:SCHEME_PATH_VAL(TO_PATH(val)));
@ -2087,6 +2192,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(char*)); delta += (sizeof(intptr_t)-sizeof(char*));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(char*)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_SYMBOLP(val)) { if (SCHEME_SYMBOLP(val)) {
char* tmp; char* tmp;
tmp = MZ_TYPE_CAST(char*, SCHEME_SYM_VAL(val)); tmp = MZ_TYPE_CAST(char*, SCHEME_SYM_VAL(val));
@ -2108,6 +2218,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(void*)); delta += (sizeof(intptr_t)-sizeof(void*));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(void*)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_FFIANYPTRP(val)) { if (SCHEME_FFIANYPTRP(val)) {
void* tmp; intptr_t toff; void* tmp; intptr_t toff;
tmp = MZ_TYPE_CAST(void*, SCHEME_FFIANYPTR_VAL(val)); tmp = MZ_TYPE_CAST(void*, SCHEME_FFIANYPTR_VAL(val));
@ -2133,6 +2248,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(void*)); delta += (sizeof(intptr_t)-sizeof(void*));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(void*)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (SCHEME_FFIANYPTRP(val)) { if (SCHEME_FFIANYPTRP(val)) {
void* tmp; intptr_t toff; void* tmp; intptr_t toff;
tmp = MZ_TYPE_CAST(void*, SCHEME_FFIANYPTR_VAL(val)); tmp = MZ_TYPE_CAST(void*, SCHEME_FFIANYPTR_VAL(val));
@ -2158,6 +2278,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(Scheme_Object*)); delta += (sizeof(intptr_t)-sizeof(Scheme_Object*));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(Scheme_Object*)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (1) { if (1) {
Scheme_Object* tmp; Scheme_Object* tmp;
tmp = MZ_TYPE_CAST(Scheme_Object*, val); tmp = MZ_TYPE_CAST(Scheme_Object*, val);
@ -2179,6 +2304,11 @@ static void* SCHEME2C(const char *who,
delta += (sizeof(intptr_t)-sizeof(void*)); delta += (sizeof(intptr_t)-sizeof(void*));
} }
# endif /* SCHEME_BIG_ENDIAN */ # endif /* SCHEME_BIG_ENDIAN */
# ifdef FFI_CALLBACK_NEED_INT_CLEAR
if (sizeof(void*)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
# endif /* FFI_CALLBACK_NEED_INT_CLEAR */
if (!(ret_loc)) wrong_value(who, "_fpointer", val);; if (!(ret_loc)) wrong_value(who, "_fpointer", val);;
break; break;
case FOREIGN_struct: case FOREIGN_struct:

View File

@ -1553,6 +1553,11 @@ static void* SCHEME2C(const char *who,
((int*)W_OFFSET(dst,delta))[0] = 0; ((int*)W_OFFSET(dst,delta))[0] = 0;
delta += (sizeof(intptr_t)-sizeof(@ctype)); delta += (sizeof(intptr_t)-sizeof(@ctype));
}} }}
@@IFDEF{FFI_CALLBACK_NEED_INT_CLEAR}{
if (sizeof(@ctype)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
}
if (!(@(if ptr? "ret_loc" (pred "val" x)))) @; if (!(@(if ptr? "ret_loc" (pred "val" x)))) @;
@wrong-type["val" stype]; @wrong-type["val" stype];
@(if ptr? "break" "return NULL");}] @(if ptr? "break" "return NULL");}]
@ -1563,6 +1568,11 @@ static void* SCHEME2C(const char *who,
((int*)W_OFFSET(dst,delta))[0] = 0; ((int*)W_OFFSET(dst,delta))[0] = 0;
delta += (sizeof(intptr_t)-sizeof(@ctype)); delta += (sizeof(intptr_t)-sizeof(@ctype));
}} }}
@@IFDEF{FFI_CALLBACK_NEED_INT_CLEAR}{
if (sizeof(@ctype)<sizeof(intptr_t) && ret_loc) {
((int*)W_OFFSET(dst,delta))[0] = 0;
}
}
if (@f[pred]) { if (@f[pred]) {
@ctype tmp@";"@and[offset]{ intptr_t toff@";"} @ctype tmp@";"@and[offset]{ intptr_t toff@";"}
tmp = @cast(@ctype, @f[s->c]); tmp = @cast(@ctype, @f[s->c]);

View File

@ -1,38 +1,31 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright 1992-2013 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
timestamp='2009-11-07' timestamp='2013-02-12'
# This file is (in principle) common to ALL GNU software. # This file is free software; you can redistribute it and/or modify it
# The presence of a machine in this file suggests that SOME GNU software # under the terms of the GNU General Public License as published by
# can handle that machine. It does not imply ALL GNU software can. # the Free Software Foundation; either version 3 of the License, or
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful, but
# but WITHOUT ANY WARRANTY; without even the implied warranty of # WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# GNU General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# #
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under # configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to <config-patches@gnu.org>. Submit a context # Please send patches with a ChangeLog entry to config-patches@gnu.org.
# diff and a properly formatted GNU ChangeLog entry.
# #
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
@ -75,8 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, Copyright 1992-2013 Free Software Foundation, Inc.
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -123,13 +115,18 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations. # Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \ kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*) storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;; ;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*) *)
basic_machine=`echo $1 | sed 's/-[^-]*$//'` basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ] if [ $basic_machine != $1 ]
@ -152,12 +149,12 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray | -microblaze) -apple | -axis | -knuth | -cray | -microblaze*)
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
-bluegene*) -bluegene*)
os=-cnk os=-cnk
;; ;;
-sim | -cisco | -oki | -wec | -winbond) -sim | -cisco | -oki | -wec | -winbond)
os= os=
@ -173,10 +170,10 @@ case $os in
os=-chorusos os=-chorusos
basic_machine=$1 basic_machine=$1
;; ;;
-chorusrdb) -chorusrdb)
os=-chorusrdb os=-chorusrdb
basic_machine=$1 basic_machine=$1
;; ;;
-hiux*) -hiux*)
os=-hiuxwe2 os=-hiuxwe2
;; ;;
@ -221,6 +218,12 @@ case $os in
-isc*) -isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;; ;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*) -lynx*)
os=-lynxos os=-lynxos
;; ;;
@ -245,20 +248,27 @@ case $basic_machine in
# Some are omitted here because they have special meanings below. # Some are omitted here because they have special meanings below.
1750a | 580 \ 1750a | 580 \
| a29k \ | a29k \
| aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | arc \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| be32 | be64 \
| bfin \ | bfin \
| c4x | clipper \ | c4x | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \ | fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \ | ip2k | iq2000 \
| le32 | le64 \
| lm32 \ | lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \ | m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep | metag \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \ | mips16 \
| mips64 | mips64el \ | mips64 | mips64el \
@ -276,34 +286,45 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \ | mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \ | mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \ | mipstx39 | mipstx39el \
| mn10200 | mn10300 \ | mn10200 | mn10300 \
| moxie \ | moxie \
| mt \ | mt \
| msp430 \ | msp430 \
| nios | nios2 \ | nds32 | nds32le | nds32be \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \ | ns16k | ns32k \
| or32 \ | open8 \
| or1k | or32 \
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \ | pyramid \
| rx \ | rl78 | rx \
| score \ | score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \ | sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \ | spu \
| tahoe | thumb | tic4x | tic80 | tron \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \ | ubicom32 \
| v850 | v850e \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| we32k \ | we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | x86 | xc16x | xstormy16 | xtensa \
| z8k | z80) | z8k | z80)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
;; ;;
m6811 | m68hc11 | m6812 | m68hc12 | picochip) c54x)
# Motorola 68HC11/12. basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
os=-none os=-none
;; ;;
@ -313,6 +334,21 @@ case $basic_machine in
basic_machine=mt-unknown basic_machine=mt-unknown
;; ;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xgate)
basic_machine=$basic_machine-unknown
os=-none
;;
xscaleeb)
basic_machine=armeb-unknown
;;
xscaleel)
basic_machine=armel-unknown
;;
# We use `pc' rather than `unknown' # We use `pc' rather than `unknown'
# because (1) that's what they normally are, and # because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users. # (2) the word "unknown" tends to confuse beginning users.
@ -327,25 +363,30 @@ case $basic_machine in
# Recognize the basic CPU types with company name. # Recognize the basic CPU types with company name.
580-* \ 580-* \
| a29k-* \ | a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \ | avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| elxsi-* \ | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \ | h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \ | i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \ | ip2k-* | iq2000-* \
| le32-* | le64-* \
| lm32-* \ | lm32-* \
| m32c-* | m32r-* | m32rle-* \ | m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \ | mips16-* \
| mips64-* | mips64el-* \ | mips64-* | mips64el-* \
@ -363,29 +404,34 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \ | mipstx39-* | mipstx39el-* \
| mmix-* \ | mmix-* \
| mt-* \ | mt-* \
| msp430-* \ | msp430-* \
| nios-* | nios2-* \ | nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \ | none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \ | orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \ | pyramid-* \
| romp-* | rs6000-* | rx-* \ | rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \ | tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
| tron-* \ | tron-* \
| ubicom32-* \ | ubicom32-* \
| v850-* | v850e-* | vax-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \ | xstormy16-* | xtensa*-* \
| ymp-* \ | ymp-* \
| z8k-* | z80-*) | z8k-* | z80-*)
@ -410,7 +456,7 @@ case $basic_machine in
basic_machine=a29k-amd basic_machine=a29k-amd
os=-udi os=-udi
;; ;;
abacus) abacus)
basic_machine=abacus-unknown basic_machine=abacus-unknown
;; ;;
adobe68k) adobe68k)
@ -480,11 +526,20 @@ case $basic_machine in
basic_machine=powerpc-ibm basic_machine=powerpc-ibm
os=-cnk os=-cnk
;; ;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90) c90)
basic_machine=c90-cray basic_machine=c90-cray
os=-unicos os=-unicos
;; ;;
cegcc) cegcc)
basic_machine=arm-unknown basic_machine=arm-unknown
os=-cegcc os=-cegcc
;; ;;
@ -516,7 +571,7 @@ case $basic_machine in
basic_machine=craynv-cray basic_machine=craynv-cray
os=-unicosmp os=-unicosmp
;; ;;
cr16) cr16 | cr16-*)
basic_machine=cr16-unknown basic_machine=cr16-unknown
os=-elf os=-elf
;; ;;
@ -674,7 +729,6 @@ case $basic_machine in
i370-ibm* | ibm*) i370-ibm* | ibm*)
basic_machine=i370-ibm basic_machine=i370-ibm
;; ;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32) i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32 os=-sysv32
@ -732,9 +786,13 @@ case $basic_machine in
basic_machine=ns32k-utek basic_machine=ns32k-utek
os=-sysv os=-sysv
;; ;;
microblaze) microblaze*)
basic_machine=microblaze-xilinx basic_machine=microblaze-xilinx
;; ;;
mingw64)
basic_machine=x86_64-pc
os=-mingw64
;;
mingw32) mingw32)
basic_machine=i386-pc basic_machine=i386-pc
os=-mingw32 os=-mingw32
@ -771,10 +829,18 @@ case $basic_machine in
ms1-*) ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;; ;;
msys)
basic_machine=i386-pc
os=-msys
;;
mvs) mvs)
basic_machine=i370-ibm basic_machine=i370-ibm
os=-mvs os=-mvs
;; ;;
nacl)
basic_machine=le32-unknown
os=-nacl
;;
ncr3000) ncr3000)
basic_machine=i486-ncr basic_machine=i486-ncr
os=-sysv4 os=-sysv4
@ -839,6 +905,12 @@ case $basic_machine in
np1) np1)
basic_machine=np1-gould basic_machine=np1-gould
;; ;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem) nsr-tandem)
basic_machine=nsr-tandem basic_machine=nsr-tandem
;; ;;
@ -921,9 +993,10 @@ case $basic_machine in
;; ;;
power) basic_machine=power-ibm power) basic_machine=power-ibm
;; ;;
ppc) basic_machine=powerpc-unknown ppc | ppcbe) basic_machine=powerpc-unknown
;; ;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppcle | powerpclittle | ppc-le | powerpc-little) ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown basic_machine=powerpcle-unknown
@ -948,7 +1021,11 @@ case $basic_machine in
basic_machine=i586-unknown basic_machine=i586-unknown
os=-pw32 os=-pw32
;; ;;
rdos) rdos | rdos64)
basic_machine=x86_64-pc
os=-rdos
;;
rdos32)
basic_machine=i386-pc basic_machine=i386-pc
os=-rdos os=-rdos
;; ;;
@ -1017,6 +1094,9 @@ case $basic_machine in
basic_machine=i860-stratus basic_machine=i860-stratus
os=-sysv4 os=-sysv4
;; ;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
sun2) sun2)
basic_machine=m68000-sun basic_machine=m68000-sun
;; ;;
@ -1073,20 +1153,8 @@ case $basic_machine in
basic_machine=t90-cray basic_machine=t90-cray
os=-unicos os=-unicos
;; ;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
tic55x | c55x*)
basic_machine=tic55x-unknown
os=-coff
;;
tic6x | c6x*)
basic_machine=tic6x-unknown
os=-coff
;;
tile*) tile*)
basic_machine=tile-unknown basic_machine=$basic_machine-unknown
os=-linux-gnu os=-linux-gnu
;; ;;
tx39) tx39)
@ -1156,6 +1224,9 @@ case $basic_machine in
xps | xps100) xps | xps100)
basic_machine=xps100-honeywell basic_machine=xps100-honeywell
;; ;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
;;
ymp) ymp)
basic_machine=ymp-cray basic_machine=ymp-cray
os=-unicos os=-unicos
@ -1253,9 +1324,12 @@ esac
if [ x"$os" != x"" ] if [ x"$os" != x"" ]
then then
case $os in case $os in
# First match some system type aliases # First match some system type aliases
# that might get confused with valid system types. # that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception. # -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*) -solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'` os=`echo $os | sed -e 's|solaris1|sunos4|'`
;; ;;
@ -1277,21 +1351,22 @@ case $os in
# -sysv* is not here because it comes later, after sysvr4. # -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -kopensolaris* \ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \ | -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \ | -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \ | -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \ | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@ -1338,7 +1413,7 @@ case $os in
-opened*) -opened*)
os=-openedition os=-openedition
;; ;;
-os400*) -os400*)
os=-os400 os=-os400
;; ;;
-wince*) -wince*)
@ -1387,7 +1462,7 @@ case $os in
-sinix*) -sinix*)
os=-sysv4 os=-sysv4
;; ;;
-tpf*) -tpf*)
os=-tpf os=-tpf
;; ;;
-triton*) -triton*)
@ -1423,15 +1498,14 @@ case $os in
-aros*) -aros*)
os=-aros os=-aros
;; ;;
-kaos*)
os=-kaos
;;
-zvmoe) -zvmoe)
os=-zvmoe os=-zvmoe
;; ;;
-dicos*) -dicos*)
os=-dicos os=-dicos
;; ;;
-nacl*)
;;
-none) -none)
;; ;;
*) *)
@ -1454,10 +1528,10 @@ else
# system, and we'll never get to this point. # system, and we'll never get to this point.
case $basic_machine in case $basic_machine in
score-*) score-*)
os=-elf os=-elf
;; ;;
spu-*) spu-*)
os=-elf os=-elf
;; ;;
*-acorn) *-acorn)
@ -1469,8 +1543,20 @@ case $basic_machine in
arm*-semi) arm*-semi)
os=-aout os=-aout
;; ;;
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=-coff os=-coff
;;
hexagon-*)
os=-elf
;;
tic54x-*)
os=-coff
;;
tic55x-*)
os=-coff
;;
tic6x-*)
os=-coff
;; ;;
# This must come before the *-dec entry. # This must come before the *-dec entry.
pdp10-*) pdp10-*)
@ -1490,14 +1576,11 @@ case $basic_machine in
;; ;;
m68000-sun) m68000-sun)
os=-sunos3 os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;; ;;
m68*-cisco) m68*-cisco)
os=-aout os=-aout
;; ;;
mep-*) mep-*)
os=-elf os=-elf
;; ;;
mips*-cisco) mips*-cisco)
@ -1506,6 +1589,9 @@ case $basic_machine in
mips*-*) mips*-*)
os=-elf os=-elf
;; ;;
or1k-*)
os=-elf
;;
or32-*) or32-*)
os=-coff os=-coff
;; ;;
@ -1524,7 +1610,7 @@ case $basic_machine in
*-ibm) *-ibm)
os=-aix os=-aix
;; ;;
*-knuth) *-knuth)
os=-mmixware os=-mmixware
;; ;;
*-wec) *-wec)

362
src/lt/config.sub vendored
View File

@ -1,44 +1,40 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright 1992-2013 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
timestamp='2007-04-29' timestamp='2013-02-12'
# This file is (in principle) common to ALL GNU software. # This file is free software; you can redistribute it and/or modify it
# The presence of a machine in this file suggests that SOME GNU software # under the terms of the GNU General Public License as published by
# can handle that machine. It does not imply ALL GNU software can. # the Free Software Foundation; either version 3 of the License, or
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful, but
# but WITHOUT ANY WARRANTY; without even the implied warranty of # WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# GNU General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# #
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under # configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to <config-patches@gnu.org>. Submit a context # Please send patches with a ChangeLog entry to config-patches@gnu.org.
# diff and a properly formatted ChangeLog entry.
# #
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1. # If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed. # Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# This file is supposed to be the same for all GNU packages # This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases # and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software. # that are meaningful with *any* GNU software.
@ -72,8 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Copyright 1992-2013 Free Software Foundation, Inc.
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -120,12 +115,18 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations. # Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*) storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;; ;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*) *)
basic_machine=`echo $1 | sed 's/-[^-]*$//'` basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ] if [ $basic_machine != $1 ]
@ -148,10 +149,13 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray) -apple | -axis | -knuth | -cray | -microblaze*)
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond) -sim | -cisco | -oki | -wec | -winbond)
os= os=
basic_machine=$1 basic_machine=$1
@ -166,10 +170,10 @@ case $os in
os=-chorusos os=-chorusos
basic_machine=$1 basic_machine=$1
;; ;;
-chorusrdb) -chorusrdb)
os=-chorusrdb os=-chorusrdb
basic_machine=$1 basic_machine=$1
;; ;;
-hiux*) -hiux*)
os=-hiuxwe2 os=-hiuxwe2
;; ;;
@ -214,6 +218,12 @@ case $os in
-isc*) -isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;; ;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*) -lynx*)
os=-lynxos os=-lynxos
;; ;;
@ -238,24 +248,34 @@ case $basic_machine in
# Some are omitted here because they have special meanings below. # Some are omitted here because they have special meanings below.
1750a | 580 \ 1750a | 580 \
| a29k \ | a29k \
| aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | arc \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| be32 | be64 \
| bfin \ | bfin \
| c4x | clipper \ | c4x | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \ | fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \ | ip2k | iq2000 \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \ | m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \ | mips16 \
| mips64 | mips64el \ | mips64 | mips64el \
| mips64vr | mips64vrel \ | mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \ | mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \ | mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \ | mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \ | mips64vr5000 | mips64vr5000el \
@ -266,31 +286,45 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \ | mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \ | mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \ | mipstx39 | mipstx39el \
| mn10200 | mn10300 \ | mn10200 | mn10300 \
| moxie \
| mt \ | mt \
| msp430 \ | msp430 \
| nios | nios2 \ | nds32 | nds32le | nds32be \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \ | ns16k | ns32k \
| or32 \ | open8 \
| or1k | or32 \
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \ | pyramid \
| rl78 | rx \
| score \ | score \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \ | sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \ | spu \
| tahoe | thumb | tic4x | tic80 | tron \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| v850 | v850e \ | ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| we32k \ | we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | x86 | xc16x | xstormy16 | xtensa \
| z8k) | z8k | z80)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
;; ;;
m6811 | m68hc11 | m6812 | m68hc12) c54x)
# Motorola 68HC11/12. basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
os=-none os=-none
;; ;;
@ -300,6 +334,21 @@ case $basic_machine in
basic_machine=mt-unknown basic_machine=mt-unknown
;; ;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xgate)
basic_machine=$basic_machine-unknown
os=-none
;;
xscaleeb)
basic_machine=armeb-unknown
;;
xscaleel)
basic_machine=armel-unknown
;;
# We use `pc' rather than `unknown' # We use `pc' rather than `unknown'
# because (1) that's what they normally are, and # because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users. # (2) the word "unknown" tends to confuse beginning users.
@ -314,29 +363,37 @@ case $basic_machine in
# Recognize the basic CPU types with company name. # Recognize the basic CPU types with company name.
580-* \ 580-* \
| a29k-* \ | a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \ | avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| elxsi-* \ | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \ | h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \ | i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \ | ip2k-* | iq2000-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \ | m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \ | mips16-* \
| mips64-* | mips64el-* \ | mips64-* | mips64el-* \
| mips64vr-* | mips64vrel-* \ | mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \ | mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \ | mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \ | mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \ | mips64vr5000-* | mips64vr5000el-* \
@ -347,31 +404,41 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \ | mipstx39-* | mipstx39el-* \
| mmix-* \ | mmix-* \
| mt-* \ | mt-* \
| msp430-* \ | msp430-* \
| nios-* | nios2-* \ | nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \ | none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \ | orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \ | pyramid-* \
| romp-* | rs6000-* \ | rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \ | tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
| tron-* \ | tron-* \
| v850-* | v850e-* | vax-* \ | ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa-* \ | xstormy16-* | xtensa*-* \
| ymp-* \ | ymp-* \
| z8k-*) | z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;; ;;
# Recognize the various machine names and aliases which stand # Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS. # for a CPU type and a company and sometimes even an OS.
@ -389,7 +456,7 @@ case $basic_machine in
basic_machine=a29k-amd basic_machine=a29k-amd
os=-udi os=-udi
;; ;;
abacus) abacus)
basic_machine=abacus-unknown basic_machine=abacus-unknown
;; ;;
adobe68k) adobe68k)
@ -435,6 +502,10 @@ case $basic_machine in
basic_machine=m68k-apollo basic_machine=m68k-apollo
os=-bsd os=-bsd
;; ;;
aros)
basic_machine=i386-pc
os=-aros
;;
aux) aux)
basic_machine=m68k-apple basic_machine=m68k-apple
os=-aux os=-aux
@ -443,10 +514,35 @@ case $basic_machine in
basic_machine=ns32k-sequent basic_machine=ns32k-sequent
os=-dynix os=-dynix
;; ;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90) c90)
basic_machine=c90-cray basic_machine=c90-cray
os=-unicos os=-unicos
;; ;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1) convex-c1)
basic_machine=c1-convex basic_machine=c1-convex
os=-bsd os=-bsd
@ -475,8 +571,8 @@ case $basic_machine in
basic_machine=craynv-cray basic_machine=craynv-cray
os=-unicosmp os=-unicosmp
;; ;;
cr16c) cr16 | cr16-*)
basic_machine=cr16c-unknown basic_machine=cr16-unknown
os=-elf os=-elf
;; ;;
crds | unos) crds | unos)
@ -514,6 +610,10 @@ case $basic_machine in
basic_machine=m88k-motorola basic_machine=m88k-motorola
os=-sysv3 os=-sysv3
;; ;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp) djgpp)
basic_machine=i586-pc basic_machine=i586-pc
os=-msdosdjgpp os=-msdosdjgpp
@ -629,7 +729,6 @@ case $basic_machine in
i370-ibm* | ibm*) i370-ibm* | ibm*)
basic_machine=i370-ibm basic_machine=i370-ibm
;; ;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32) i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32 os=-sysv32
@ -668,6 +767,14 @@ case $basic_machine in
basic_machine=m68k-isi basic_machine=m68k-isi
os=-sysv os=-sysv
;; ;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*) m88k-omron*)
basic_machine=m88k-omron basic_machine=m88k-omron
;; ;;
@ -679,6 +786,13 @@ case $basic_machine in
basic_machine=ns32k-utek basic_machine=ns32k-utek
os=-sysv os=-sysv
;; ;;
microblaze*)
basic_machine=microblaze-xilinx
;;
mingw64)
basic_machine=x86_64-pc
os=-mingw64
;;
mingw32) mingw32)
basic_machine=i386-pc basic_machine=i386-pc
os=-mingw32 os=-mingw32
@ -715,10 +829,18 @@ case $basic_machine in
ms1-*) ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;; ;;
msys)
basic_machine=i386-pc
os=-msys
;;
mvs) mvs)
basic_machine=i370-ibm basic_machine=i370-ibm
os=-mvs os=-mvs
;; ;;
nacl)
basic_machine=le32-unknown
os=-nacl
;;
ncr3000) ncr3000)
basic_machine=i486-ncr basic_machine=i486-ncr
os=-sysv4 os=-sysv4
@ -783,6 +905,12 @@ case $basic_machine in
np1) np1)
basic_machine=np1-gould basic_machine=np1-gould
;; ;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem) nsr-tandem)
basic_machine=nsr-tandem basic_machine=nsr-tandem
;; ;;
@ -813,6 +941,14 @@ case $basic_machine in
basic_machine=i860-intel basic_machine=i860-intel
os=-osf os=-osf
;; ;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd) pbd)
basic_machine=sparc-tti basic_machine=sparc-tti
;; ;;
@ -857,9 +993,10 @@ case $basic_machine in
;; ;;
power) basic_machine=power-ibm power) basic_machine=power-ibm
;; ;;
ppc) basic_machine=powerpc-unknown ppc | ppcbe) basic_machine=powerpc-unknown
;; ;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppcle | powerpclittle | ppc-le | powerpc-little) ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown basic_machine=powerpcle-unknown
@ -884,7 +1021,11 @@ case $basic_machine in
basic_machine=i586-unknown basic_machine=i586-unknown
os=-pw32 os=-pw32
;; ;;
rdos) rdos | rdos64)
basic_machine=x86_64-pc
os=-rdos
;;
rdos32)
basic_machine=i386-pc basic_machine=i386-pc
os=-rdos os=-rdos
;; ;;
@ -953,6 +1094,9 @@ case $basic_machine in
basic_machine=i860-stratus basic_machine=i860-stratus
os=-sysv4 os=-sysv4
;; ;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
sun2) sun2)
basic_machine=m68000-sun basic_machine=m68000-sun
;; ;;
@ -1009,17 +1153,9 @@ case $basic_machine in
basic_machine=t90-cray basic_machine=t90-cray
os=-unicos os=-unicos
;; ;;
tic54x | c54x*) tile*)
basic_machine=tic54x-unknown basic_machine=$basic_machine-unknown
os=-coff os=-linux-gnu
;;
tic55x | c55x*)
basic_machine=tic55x-unknown
os=-coff
;;
tic6x | c6x*)
basic_machine=tic6x-unknown
os=-coff
;; ;;
tx39) tx39)
basic_machine=mipstx39-unknown basic_machine=mipstx39-unknown
@ -1088,6 +1224,9 @@ case $basic_machine in
xps | xps100) xps | xps100)
basic_machine=xps100-honeywell basic_machine=xps100-honeywell
;; ;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
;;
ymp) ymp)
basic_machine=ymp-cray basic_machine=ymp-cray
os=-unicos os=-unicos
@ -1096,6 +1235,10 @@ case $basic_machine in
basic_machine=z8k-unknown basic_machine=z8k-unknown
os=-sim os=-sim
;; ;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none) none)
basic_machine=none-none basic_machine=none-none
os=-none os=-none
@ -1134,7 +1277,7 @@ case $basic_machine in
we32k) we32k)
basic_machine=we32k-att basic_machine=we32k-att
;; ;;
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown basic_machine=sh-unknown
;; ;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@ -1181,9 +1324,12 @@ esac
if [ x"$os" != x"" ] if [ x"$os" != x"" ]
then then
case $os in case $os in
# First match some system type aliases # First match some system type aliases
# that might get confused with valid system types. # that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception. # -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*) -solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'` os=`echo $os | sed -e 's|solaris1|sunos4|'`
;; ;;
@ -1204,21 +1350,23 @@ case $os in
# Each alternative MUST END IN A *, to match a version number. # Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4. # -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \ | -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \ | -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \ | -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \ | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@ -1226,7 +1374,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*) | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
@ -1265,7 +1413,7 @@ case $os in
-opened*) -opened*)
os=-openedition os=-openedition
;; ;;
-os400*) -os400*)
os=-os400 os=-os400
;; ;;
-wince*) -wince*)
@ -1314,7 +1462,7 @@ case $os in
-sinix*) -sinix*)
os=-sysv4 os=-sysv4
;; ;;
-tpf*) -tpf*)
os=-tpf os=-tpf
;; ;;
-triton*) -triton*)
@ -1350,12 +1498,14 @@ case $os in
-aros*) -aros*)
os=-aros os=-aros
;; ;;
-kaos*)
os=-kaos
;;
-zvmoe) -zvmoe)
os=-zvmoe os=-zvmoe
;; ;;
-dicos*)
os=-dicos
;;
-nacl*)
;;
-none) -none)
;; ;;
*) *)
@ -1378,10 +1528,10 @@ else
# system, and we'll never get to this point. # system, and we'll never get to this point.
case $basic_machine in case $basic_machine in
score-*) score-*)
os=-elf os=-elf
;; ;;
spu-*) spu-*)
os=-elf os=-elf
;; ;;
*-acorn) *-acorn)
@ -1393,8 +1543,20 @@ case $basic_machine in
arm*-semi) arm*-semi)
os=-aout os=-aout
;; ;;
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=-coff os=-coff
;;
hexagon-*)
os=-elf
;;
tic54x-*)
os=-coff
;;
tic55x-*)
os=-coff
;;
tic6x-*)
os=-coff
;; ;;
# This must come before the *-dec entry. # This must come before the *-dec entry.
pdp10-*) pdp10-*)
@ -1414,14 +1576,11 @@ case $basic_machine in
;; ;;
m68000-sun) m68000-sun)
os=-sunos3 os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;; ;;
m68*-cisco) m68*-cisco)
os=-aout os=-aout
;; ;;
mep-*) mep-*)
os=-elf os=-elf
;; ;;
mips*-cisco) mips*-cisco)
@ -1430,6 +1589,9 @@ case $basic_machine in
mips*-*) mips*-*)
os=-elf os=-elf
;; ;;
or1k-*)
os=-elf
;;
or32-*) or32-*)
os=-coff os=-coff
;; ;;
@ -1448,7 +1610,7 @@ case $basic_machine in
*-ibm) *-ibm)
os=-aix os=-aix
;; ;;
*-knuth) *-knuth)
os=-mmixware os=-mmixware
;; ;;
*-wec) *-wec)
@ -1553,7 +1715,7 @@ case $basic_machine in
-sunos*) -sunos*)
vendor=sun vendor=sun
;; ;;
-aix*) -cnk*|-aix*)
vendor=ibm vendor=ibm
;; ;;
-beos*) -beos*)

View File

@ -1242,7 +1242,7 @@ fi
############## drop optimization flags ################ ############## drop optimization flags ################
if test "${enable_noopt}" = "yes" ; then if test "${enable_noopt}" = "yes" ; then
AWKPRG='BEGIN { FS = "(^| )-O(0|1|2|3|4|5|6|7|8|9|())( |$)" } /.*/ { for (i = 1; i < NF; i++) printf "%s ", $i; print $NF }' AWKPRG='BEGIN { FS = "(^| )-O(0|1|2|3|4|5|6|7|8|9)?( |$)" } /.*/ { for (i = 1; i < NF; i++) printf "%s ", $i; print $NF }'
CFLAGS=`echo "$CFLAGS" | awk "$AWKPRG"` CFLAGS=`echo "$CFLAGS" | awk "$AWKPRG"`
fi fi

View File

@ -207,7 +207,7 @@ typedef struct FSSpec mzFSSpec;
#endif #endif
#ifndef MZ_DONT_USE_JIT #ifndef MZ_DONT_USE_JIT
# if defined(MZ_USE_JIT_PPC) || defined(MZ_USE_JIT_I386) || defined(MZ_USE_JIT_X86_64) # if defined(MZ_USE_JIT_PPC) || defined(MZ_USE_JIT_I386) || defined(MZ_USE_JIT_X86_64) || defined(MZ_USE_JIT_ARM)
# define MZ_USE_JIT # define MZ_USE_JIT
# endif # endif
#endif #endif

View File

@ -156,39 +156,49 @@
#if defined(linux) #if defined(linux)
# ifdef __ANDROID__
# define SPLS_LINUX "android"
# else
# define SPLS_LINUX "linux"
# endif
# if defined(i386) # if defined(i386)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-linux" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-" SPLS_LINUX
# define REGISTER_POOR_MACHINE # define REGISTER_POOR_MACHINE
# define MZ_TRY_EXTFLONUMS # define MZ_TRY_EXTFLONUMS
# define ASM_DBLPREC_CONTROL_87 # define ASM_DBLPREC_CONTROL_87
# endif # endif
# if defined(powerpc) # if defined(powerpc)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "ppc-linux" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "ppc-" SPLS_LINUX
# endif # endif
# if defined(__mc68000__) # if defined(__mc68000__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "m68k-linux" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "m68k-" SPLS_LINUX
# endif # endif
# if defined(mips) # if defined(mips)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "mips-linux" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "mips-" SPLS_LINUX
# endif # endif
# if defined(__alpha__) # if defined(__alpha__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "alpha-linux" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "alpha-" SPLS_LINUX
# endif # endif
# if defined(__hppa__) # if defined(__hppa__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "hppa-linux" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "hppa-" SPLS_LINUX
# endif # endif
# if defined(__sparc__) # if defined(__sparc__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "sparc-linux" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "sparc-" SPLS_LINUX
# define FLUSH_SPARC_REGISTER_WINDOWS # define FLUSH_SPARC_REGISTER_WINDOWS
# endif # endif
# if defined(__arm__) || defined(__thumb__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "arm-" SPLS_LINUX
# define FFI_CALLBACK_NEED_INT_CLEAR
# endif
# if defined(__x86_64__) # if defined(__x86_64__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "x86_64-linux" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "x86_64-" SPLS_LINUX
# define REGISTER_POOR_MACHINE # define REGISTER_POOR_MACHINE
# define ASM_DBLPREC_CONTROL_87 # define ASM_DBLPREC_CONTROL_87
# define MZ_TRY_EXTFLONUMS # define MZ_TRY_EXTFLONUMS
# endif # endif
# ifndef SCHEME_PLATFORM_LIBRARY_SUBPATH # ifndef SCHEME_PLATFORM_LIBRARY_SUBPATH
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "unknown-linux" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "unknown-" SPLS_LINUX
# endif # endif
# include "uconfig.h" # include "uconfig.h"
@ -215,6 +225,10 @@
# define MZ_TCP_LISTEN_IPV6_ONLY_SOCKOPT # define MZ_TCP_LISTEN_IPV6_ONLY_SOCKOPT
# ifdef __ANDROID__
# define USE_FCNTL_O_NONBLOCK
# endif
# define FLAGS_ALREADY_SET # define FLAGS_ALREADY_SET
#if defined(i386) #if defined(i386)
@ -229,6 +243,10 @@
#if defined(powerpc) #if defined(powerpc)
# define MZ_USE_JIT_PPC # define MZ_USE_JIT_PPC
#endif #endif
# if defined(__arm__)
# define MZ_USE_JIT_ARM
# define MZ_USE_DWARF_LIBUNWIND
#endif
#endif #endif
@ -1655,6 +1673,10 @@
/* WIN32S_HACK uses a special hack to implement threads under Win32s /* WIN32S_HACK uses a special hack to implement threads under Win32s
with some compilers. Obsolete. */ with some compilers. Obsolete. */
/* FFI_CALLBACK_NEED_INT_CLEAR indiates thet libffi callback results
that are smaller than an `int' should clear `int'-sized space
in the result area. */
#endif /* FLAGS_ALREADY_SET */ #endif /* FLAGS_ALREADY_SET */
/****** (END CONFIGURATION FLAG DESCRPTIONS AND DEFAULTS) *******/ /****** (END CONFIGURATION FLAG DESCRPTIONS AND DEFAULTS) *******/

View File

@ -305,6 +305,11 @@ JIT_HEADERS = $(srcdir)/jit.h $(srcdir)/jitfpu.h $(srcdir)/stypes.h \
$(srcdir)/lightning/ppc/asm.h $(srcdir)/lightning/ppc/asm-common.h \ $(srcdir)/lightning/ppc/asm.h $(srcdir)/lightning/ppc/asm-common.h \
$(srcdir)/lightning/ppc/funcs.h $(srcdir)/lightning/ppc/funcs-common.h \ $(srcdir)/lightning/ppc/funcs.h $(srcdir)/lightning/ppc/funcs-common.h \
$(srcdir)/lightning/ppc/fp.h $(srcdir)/lightning/ppc/fp-common.h \ $(srcdir)/lightning/ppc/fp.h $(srcdir)/lightning/ppc/fp-common.h \
$(srcdir)/lightning/arm/core.h $(srcdir)/lightning/arm/core-common.h \
$(srcdir)/lightning/arm/asm.h $(srcdir)/lightning/arm/asm-common.h \
$(srcdir)/lightning/arm/funcs.h $(srcdir)/lightning/arm/funcs-common.h \
$(srcdir)/lightning/arm/fp.h $(srcdir)/lightning/arm/fp-common.h \
$(srcdir)/lightning/arm/fp-vfp.h $(srcdir)/lightning/arm/fp-swf.h \
$(srcdir)/future.h $(srcdir)/jit_ts.c $(srcdir)/jit_ts_protos.h $(srcdir)/future.h $(srcdir)/jit_ts.c $(srcdir)/jit_ts_protos.h
salloc.@LTO@: $(COMMON_HEADERS) \ salloc.@LTO@: $(COMMON_HEADERS) \

View File

@ -933,7 +933,7 @@ static void patch_branch_addr(mz_jit_state *jitter, Branch_Info_Addr *addr, int
} else if (addr[i].kind == BRANCH_ADDR_UCBRANCH) { } else if (addr[i].kind == BRANCH_ADDR_UCBRANCH) {
mz_patch_ucbranch(addr[i].addr); mz_patch_ucbranch(addr[i].addr);
} else { } else {
jit_patch_movi(addr[i].addr, (_jit.x.pc)); jit_patch_movi(addr[i].addr, jit_get_ip());
} }
} }
@ -972,7 +972,7 @@ void scheme_add_or_patch_branch_true_movi(mz_jit_state *jitter, Branch_Info *for
if (for_branch->true_needs_jump) { if (for_branch->true_needs_jump) {
add_branch(for_branch, ref, BRANCH_ADDR_TRUE, BRANCH_ADDR_MOVI); add_branch(for_branch, ref, BRANCH_ADDR_TRUE, BRANCH_ADDR_MOVI);
} else { } else {
jit_patch_movi(ref, (_jit.x.pc)); jit_patch_movi(ref, jit_get_ip());
} }
} }
@ -2353,7 +2353,7 @@ int scheme_generate(Scheme_Object *obj, mz_jit_state *jitter, int is_tail, int w
CHECK_RUNSTACK_OVERFLOW(); CHECK_RUNSTACK_OVERFLOW();
/* Copy args: */ /* Copy args: */
jit_ldxi_l(JIT_R1, JIT_R1, &((Scheme_Thread *)0x0)->ku.multiple.array); jit_ldxi_l(JIT_R1, JIT_R1, &((Scheme_Thread *)0x0)->ku.multiple.array);
refloop = _jit.x.pc; refloop = jit_get_ip();
ref3 = jit_blei_l(jit_forward(), JIT_R2, 0); ref3 = jit_blei_l(jit_forward(), JIT_R2, 0);
jit_subi_l(JIT_R2, JIT_R2, JIT_WORD_SIZE); jit_subi_l(JIT_R2, JIT_R2, JIT_WORD_SIZE);
jit_ldxr_p(JIT_R0, JIT_R1, JIT_R2); jit_ldxr_p(JIT_R0, JIT_R1, JIT_R2);
@ -2983,6 +2983,8 @@ int scheme_generate(Scheme_Object *obj, mz_jit_state *jitter, int is_tail, int w
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
} }
CHECK_LIMIT();
/* Key and value are (still) on runstack */ /* Key and value are (still) on runstack */
if (!wcm_may_replace) { if (!wcm_may_replace) {
(void)jit_calli(sjc.wcm_nontail_code); (void)jit_calli(sjc.wcm_nontail_code);
@ -3020,8 +3022,8 @@ int scheme_generate(Scheme_Object *obj, mz_jit_state *jitter, int is_tail, int w
mz_rs_sync(); mz_rs_sync();
jit_movi_i(JIT_R0, WORDS_TO_BYTES(c)); jit_movi_i(JIT_R0, WORDS_TO_BYTES(c));
jit_movi_i(JIT_R1, &(((Scheme_Prefix *)0x0)->a[i + p + 1])); jit_movi_i(JIT_R1, (int)&(((Scheme_Prefix *)0x0)->a[i + p + 1]));
jit_movi_i(JIT_R2, &(((Scheme_Prefix *)0x0)->a[p])); jit_movi_i(JIT_R2, (int)&(((Scheme_Prefix *)0x0)->a[p]));
(void)jit_calli(sjc.quote_syntax_code); (void)jit_calli(sjc.quote_syntax_code);
CHECK_LIMIT(); CHECK_LIMIT();
@ -3232,6 +3234,9 @@ typedef struct {
Scheme_Native_Closure *nc; Scheme_Native_Closure *nc;
int argc, argv_delta; int argc, argv_delta;
Scheme_Object **argv; Scheme_Object **argv;
#ifdef NEED_RETAIN_CODE_POINTERS
void *retain_code;
#endif
} Generate_Closure_Data; } Generate_Closure_Data;
static int do_generate_closure(mz_jit_state *jitter, void *_data) static int do_generate_closure(mz_jit_state *jitter, void *_data)
@ -3239,10 +3244,13 @@ static int do_generate_closure(mz_jit_state *jitter, void *_data)
Generate_Closure_Data *gdata = (Generate_Closure_Data *)_data; Generate_Closure_Data *gdata = (Generate_Closure_Data *)_data;
Scheme_Closure_Data *data = gdata->data; Scheme_Closure_Data *data = gdata->data;
void *start_code, *tail_code, *code_end, *arity_code; void *start_code, *tail_code, *code_end, *arity_code;
#ifdef NEED_RETAIN_CODE_POINTERS
void *retain_code = NULL;
#endif
int i, r, cnt, has_rest, is_method, num_params, to_args, argc, argv_delta; int i, r, cnt, has_rest, is_method, num_params, to_args, argc, argv_delta;
Scheme_Object **argv; Scheme_Object **argv;
start_code = jit_get_ip().ptr; start_code = jit_get_ip();
jitter->nc = gdata->nc; jitter->nc = gdata->nc;
@ -3278,23 +3286,30 @@ static int do_generate_closure(mz_jit_state *jitter, void *_data)
shared_arity_code = sjc.shared_arity_check[num_params][has_rest][is_method]; shared_arity_code = sjc.shared_arity_check[num_params][has_rest][is_method];
if (!shared_arity_code) { if (!shared_arity_code) {
shared_arity_code = generate_lambda_simple_arity_check(num_params, has_rest, is_method, 1); shared_arity_code = generate_lambda_simple_arity_check(num_params, has_rest, is_method, 1);
shared_arity_code = jit_adjust_ip(shared_arity_code);
sjc.shared_arity_check[num_params][has_rest][is_method] = shared_arity_code; sjc.shared_arity_check[num_params][has_rest][is_method] = shared_arity_code;
} }
arity_code = jit_get_ip().ptr; arity_code = jit_get_ip();
if (!has_rest) if (!has_rest)
(void)jit_bnei_i(shared_arity_code, JIT_R1, num_params); (void)jit_bnei_i(shared_arity_code, JIT_R1, num_params);
else else
(void)jit_blti_i(shared_arity_code, JIT_R1, num_params); (void)jit_blti_i(shared_arity_code, JIT_R1, num_params);
} else } else {
arity_code = generate_lambda_simple_arity_check(num_params, has_rest, is_method, 0); arity_code = generate_lambda_simple_arity_check(num_params, has_rest, is_method, 0);
#ifdef NEED_RETAIN_CODE_POINTERS
retain_code = MALLOC_N(void*,2);
((void **)retain_code)[1] = arity_code;
#endif
arity_code = jit_adjust_ip(arity_code);
}
/* A tail call starts here. Caller must ensure that the stack is big /* A tail call starts here. Caller must ensure that the stack is big
enough, right number of arguments (at start of runstack), closure enough, right number of arguments (at start of runstack), closure
is in R0. If the closure has a rest arg, also ensure argc in R1 is in R0. If the closure has a rest arg, also ensure argc in R1
and argv in R2. */ and argv in R2. */
tail_code = jit_get_ip().ptr; tail_code = jit_get_ip();
/* 0 params and has_rest => (lambda args E) where args is not in E, /* 0 params and has_rest => (lambda args E) where args is not in E,
so accept any number of arguments and just clear them (for space so accept any number of arguments and just clear them (for space
@ -3558,7 +3573,7 @@ static int do_generate_closure(mz_jit_state *jitter, void *_data)
jitter->self_data = data; jitter->self_data = data;
jitter->self_restart_code = jit_get_ip().ptr; jitter->self_restart_code = jit_get_ip();
jitter->self_restart_space = jitter->flostack_space; jitter->self_restart_space = jitter->flostack_space;
jitter->self_restart_offset = jitter->flostack_offset; jitter->self_restart_offset = jitter->flostack_offset;
if (!has_rest) if (!has_rest)
@ -3586,7 +3601,7 @@ static int do_generate_closure(mz_jit_state *jitter, void *_data)
jit_ret(); jit_ret();
} }
code_end = jit_get_ip().ptr; code_end = jit_get_ip();
if (jitter->retain_start) { if (jitter->retain_start) {
gdata->arity_code = arity_code; gdata->arity_code = arity_code;
@ -3597,6 +3612,13 @@ static int do_generate_closure(mz_jit_state *jitter, void *_data)
gdata->max_tail_depth = jitter->max_tail_depth; gdata->max_tail_depth = jitter->max_tail_depth;
gdata->code_end = code_end; gdata->code_end = code_end;
gdata->patch_depth = jitter->patch_depth; gdata->patch_depth = jitter->patch_depth;
#ifdef NEED_RETAIN_CODE_POINTERS
if (retain_code)
((void **)retain_code)[0] = jit_unadjust_ip(start_code);
else
retain_code = jit_unadjust_ip(start_code);
gdata->retain_code = retain_code;
#endif
} }
return 1; return 1;
@ -3644,10 +3666,14 @@ static void on_demand_generate_lambda(Scheme_Native_Closure *nc, int argc, Schem
tail_code = gdata.tail_code; tail_code = gdata.tail_code;
if (data->name) { if (data->name) {
scheme_jit_add_symbol((uintptr_t)start_code, (uintptr_t)gdata.code_end - 1, data->name, 1); scheme_jit_add_symbol((uintptr_t)jit_unadjust_ip(start_code),
(uintptr_t)jit_unadjust_ip(gdata.code_end) - 1,
data->name, 1);
} else { } else {
#ifdef MZ_USE_DWARF_LIBUNWIND #ifdef MZ_USE_DWARF_LIBUNWIND
scheme_jit_add_symbol((uintptr_t)start_code, (uintptr_t)gdata.code_end - 1, scheme_null, 1); scheme_jit_add_symbol((uintptr_t)jit_unadjust_ip(start_code),
(uintptr_t)jit_unadjust_ip(gdata.code_end) - 1,
scheme_null, 1);
#endif #endif
} }
@ -3682,6 +3708,9 @@ static void on_demand_generate_lambda(Scheme_Native_Closure *nc, int argc, Schem
ndata->u2.name = data->name; ndata->u2.name = data->name;
/* Let-depth is in bytes instead of words: */ /* Let-depth is in bytes instead of words: */
ndata->max_let_depth = max_depth; ndata->max_let_depth = max_depth;
#ifdef NEED_RETAIN_CODE_POINTERS
ndata->retain_code = gdata.retain_code;
#endif
} }
void scheme_on_demand_generate_lambda(Scheme_Native_Closure *nc, int argc, Scheme_Object **argv, int argv_delta) void scheme_on_demand_generate_lambda(Scheme_Native_Closure *nc, int argc, Scheme_Object **argv, int argv_delta)
@ -3948,17 +3977,20 @@ static int do_generate_case_lambda_dispatch(mz_jit_state *jitter, void *_data)
Generate_Case_Dispatch_Data *data = (Generate_Case_Dispatch_Data *)_data; Generate_Case_Dispatch_Data *data = (Generate_Case_Dispatch_Data *)_data;
void *start_code, *arity_code; void *start_code, *arity_code;
start_code = jit_get_ip().ptr; start_code = jit_get_ip();
generate_function_prolog(jitter, start_code, data->ndata->max_let_depth); generate_function_prolog(jitter, start_code, data->ndata->max_let_depth);
CHECK_LIMIT(); CHECK_LIMIT();
if (generate_case_lambda_dispatch(jitter, data->c, data->ndata, 1)) { if (generate_case_lambda_dispatch(jitter, data->c, data->ndata, 1)) {
arity_code = jit_get_ip().ptr; arity_code = jit_get_ip();
if (generate_case_lambda_dispatch(jitter, data->c, data->ndata, 0)) { if (generate_case_lambda_dispatch(jitter, data->c, data->ndata, 0)) {
data->ndata->start_code = start_code; data->ndata->start_code = start_code;
data->ndata->arity_code = arity_code; data->ndata->arity_code = arity_code;
#ifdef NEED_RETAIN_CODE_POINTERS
data->ndata->retain_code = jit_unadjust_ip(start_code);
#endif
return 1; return 1;
} }
} }

View File

@ -67,9 +67,6 @@ END_XFORM_ARITH;
#endif #endif
#ifdef MZ_USE_JIT_PPC #ifdef MZ_USE_JIT_PPC
# ifndef DEFINE_LIGHTNING_FUNCS
# define SUPPRESS_LIGHTNING_FUNCS
# endif
# define DEFINE_LIGHTNING_FUNCS_STATIC /* empty */ # define DEFINE_LIGHTNING_FUNCS_STATIC /* empty */
# define jit_notify_freed_code scheme_jit_notify_freed_code # define jit_notify_freed_code scheme_jit_notify_freed_code
# define jit_flush_code scheme_jit_flush_code # define jit_flush_code scheme_jit_flush_code
@ -77,8 +74,13 @@ END_XFORM_ARITH;
# define _jit_epilog scheme_jit_epilog # define _jit_epilog scheme_jit_epilog
#endif #endif
#ifndef DEFINE_LIGHTNING_FUNCS
# define SUPPRESS_LIGHTNING_FUNCS
#endif
#include "lightning/lightning.h" #include "lightning/lightning.h"
#define _jit (jitter->js) #define _jit (jitter->js)
#define _jitp (&_jit)
#ifdef MZ_USE_JIT_X86_64 #ifdef MZ_USE_JIT_X86_64
# define JIT_LOG_WORD_SIZE 3 # define JIT_LOG_WORD_SIZE 3
@ -128,20 +130,25 @@ END_XFORM_ARITH;
#if defined(MZ_USE_JIT_I386) && !defined(MZ_USE_JIT_X86_64) #if defined(MZ_USE_JIT_I386) && !defined(MZ_USE_JIT_X86_64)
# define USE_TINY_JUMPS # define USE_TINY_JUMPS
#endif #endif
#if defined(MZ_USE_JIT_ARM)
/* For ARM, long jumps are needed for jumps longer than 2^23: */
# define NEED_LONG_JUMPS
# define LONG_JUMPS_DEFAULT(x) 1
#endif
#if defined(MZ_PRECISE_GC) && defined(MZ_USE_JIT_I386) #if defined(MZ_PRECISE_GC)
# define USE_FLONUM_UNBOXING # if defined(MZ_USE_JIT_I386)
# define USE_FLONUM_UNBOXING
# endif
# if defined(MZ_USE_JIT_ARM) && defined(__ARM_PCS_VFP)
# define USE_FLONUM_UNBOXING
# endif
#endif #endif
#ifdef MZ_USE_FUTURES #ifdef MZ_USE_FUTURES
# define MZ_USE_LWC # define MZ_USE_LWC
#endif #endif
#define JIT_NOT_RET JIT_R1
#if JIT_NOT_RET == JIT_RET
Fix me! See use.
#endif
#ifdef MZ_USE_SINGLE_FLOATS #ifdef MZ_USE_SINGLE_FLOATS
# define SCHEME_FLOAT_TYPE scheme_float_type # define SCHEME_FLOAT_TYPE scheme_float_type
#else #else
@ -177,12 +184,12 @@ static void assert_failure(int where) { printf("JIT assert failed %d\n", where);
extern int jit_sizes[NUM_CATEGORIES]; extern int jit_sizes[NUM_CATEGORIES];
extern int jit_counts[NUM_CATEGORIES]; extern int jit_counts[NUM_CATEGORIES];
extern int jit_code_size; extern int jit_code_size;
# define START_JIT_DATA() void *__pos = jit_get_ip().ptr; uintptr_t __total = 0 # define START_JIT_DATA() void *__pos = jit_get_ip(); uintptr_t __total = 0
# define END_JIT_DATA(where) if (jitter->retain_start) { \ # define END_JIT_DATA(where) if (jitter->retain_start) { \
jit_sizes[where] += __total + ((uintptr_t)jit_get_ip().ptr - (uintptr_t)__pos); \ jit_sizes[where] += __total + ((uintptr_t)jit_get_ip() - (uintptr_t)__pos); \
jit_counts[where]++; } jit_counts[where]++; }
# define PAUSE_JIT_DATA() __total += ((uintptr_t)jit_get_ip().ptr - (uintptr_t)__pos) # define PAUSE_JIT_DATA() __total += ((uintptr_t)jit_get_ip() - (uintptr_t)__pos)
# define RESUME_JIT_DATA() __pos = jit_get_ip().ptr # define RESUME_JIT_DATA() __pos = jit_get_ip()
# define RECORD_CODE_SIZE(s) jit_code_size += s # define RECORD_CODE_SIZE(s) jit_code_size += s
#else #else
# define START_JIT_DATA() /* empty */ # define START_JIT_DATA() /* empty */
@ -555,8 +562,8 @@ void *scheme_jit_get_threadlocal_table();
# define tl_scheme_jit_save_extfp (&scheme_jit_save_extfp) # define tl_scheme_jit_save_extfp (&scheme_jit_save_extfp)
# define tl_scheme_jit_save_extfp2 (&scheme_jit_save_extfp2) # define tl_scheme_jit_save_extfp2 (&scheme_jit_save_extfp2)
# endif # endif
# define tl_scheme_fuel_counter (&scheme_fuel_counter) # define tl_scheme_fuel_counter ((void *)&scheme_fuel_counter)
# define tl_scheme_jit_stack_boundary (&scheme_jit_stack_boundary) # define tl_scheme_jit_stack_boundary ((void *)&scheme_jit_stack_boundary)
#endif #endif
/*========================================================================*/ /*========================================================================*/
@ -709,6 +716,8 @@ int check_location;
is one word past alignment. Push 1 to realign (but is one word past alignment. Push 1 to realign (but
mz_push_locals() pushes 3, because we need at least mz_push_locals() pushes 3, because we need at least
two locals). two locals).
- On ARM, the stack should be 8-byte aligned, and
jit_prolog() leaves the stack in an aligned state.
*/ */
/* LOCAL1 is used to save the value current_cont_mark_stack, /* LOCAL1 is used to save the value current_cont_mark_stack,
@ -740,7 +749,7 @@ int check_location;
* On some platforms, a lightweight function created with * On some platforms, a lightweight function created with
mz_prolog() and mz_epilog() uses LOCAL2 to save the return mz_prolog() and mz_epilog() uses LOCAL2 to save the return
address. On those platforms, though, LOCAL3 is dufferent from address. On those platforms, though, LOCAL3 is different from
LOCAL2. So, LOCAL3 can always be used for temporary storage in LOCAL2. So, LOCAL3 can always be used for temporary storage in
such functions (assuming that they're called from a function that such functions (assuming that they're called from a function that
pushes locals, and that nothing else is using LOCAL2). pushes locals, and that nothing else is using LOCAL2).
@ -773,7 +782,8 @@ int check_location;
#define mz_set_local_p(x, l) mz_set_local_p_x(x, l, JIT_FP) #define mz_set_local_p(x, l) mz_set_local_p_x(x, l, JIT_FP)
#define mz_get_local_p(x, l) mz_get_local_p_x(x, l, JIT_FP) #define mz_get_local_p(x, l) mz_get_local_p_x(x, l, JIT_FP)
#ifdef MZ_USE_JIT_PPC /* --- PPC --- */
#if defined(MZ_USE_JIT_PPC)
/* JIT_LOCAL1, JIT_LOCAL2, and JIT_LOCAL3 are offsets in the stack frame. */ /* JIT_LOCAL1, JIT_LOCAL2, and JIT_LOCAL3 are offsets in the stack frame. */
# define JIT_LOCAL1 56 # define JIT_LOCAL1 56
# define JIT_LOCAL2 60 # define JIT_LOCAL2 60
@ -821,7 +831,40 @@ void scheme_jit_prolog_again(mz_jit_state *jitter, int n, int ret_addr_reg)
} }
# endif # endif
# define _jit_prolog_again scheme_jit_prolog_again # define _jit_prolog_again scheme_jit_prolog_again
#else #endif
/* --- ARM --- */
#ifdef MZ_USE_JIT_ARM
# define JIT_LOCAL1 JIT_FRAME_EXTRA_SPACE_OFFSET
# define JIT_LOCAL2 (JIT_FRAME_EXTRA_SPACE_OFFSET+4)
# define JIT_LOCAL3 (JIT_FRAME_EXTRA_SPACE_OFFSET+8)
# define JIT_LOCAL4 (JIT_FRAME_EXTRA_SPACE_OFFSET+12)
# define JIT_FRAME_FLOSTACK_OFFSET JIT_FRAME_EXTRA_SPACE_OFFSET
# define mz_set_local_p_x(x, l, FP) jit_stxi_p(l, FP, x)
# define mz_get_local_p_x(x, l, FP) jit_ldxi_p(x, FP, l)
# define mz_patch_branch_at(a, v) jit_patch_at(a, v)
# define mz_patch_ucbranch_at(a, v) jit_patch_at(a, v)
# define mz_prolog(x) (mz_set_local_p(JIT_LR, JIT_LOCAL2))
# define mz_epilog(x) (mz_get_local_p(x, JIT_LOCAL2), jit_jmpr(x))
# define mz_epilog_without_jmp() /* empty */
# define jit_shuffle_saved_regs() /* empty */
# define jit_unshuffle_saved_regs() /* empty */
# define mz_push_locals() /* empty */
# define mz_pop_locals() /* empty */
# ifdef SUPPRESS_LIGHTNING_FUNCS
void scheme_jit_prolog_again(mz_jit_state *jitter, int n, int ret_addr_reg);
# else
void scheme_jit_prolog_again(mz_jit_state *jitter, int n, int ret_addr_reg)
{
jit_movr_p(JIT_LR, ret_addr_reg);
arm_prolog(_jitp, n);
}
# endif
# define _jit_prolog_again scheme_jit_prolog_again
#endif
/* --- x86[_64] --- */
#if defined(JIT_X86_64) || defined(JIT_X86_PLAIN)
/* From frame pointer, -1 is saved frame pointer, -2 is saved ESI/R12, /* From frame pointer, -1 is saved frame pointer, -2 is saved ESI/R12,
and -3 is saved EDI/R13. On entry to a procedure, prolog pushes 4 and -3 is saved EDI/R13. On entry to a procedure, prolog pushes 4
since the call (which also pushed), so if the stack was 16-bytes since the call (which also pushed), so if the stack was 16-bytes
@ -934,8 +977,8 @@ static jit_insn *fp_tmpr;
# define mz_st_fppop_x(i, r, FP, extfl) (check_fp_depth(i, FP), (void)jit_FPSEL_stxi_xd_fppop(extfl, (JIT_FRAME_FLOSTACK_OFFSET - (i)), FP, r)) # define mz_st_fppop_x(i, r, FP, extfl) (check_fp_depth(i, FP), (void)jit_FPSEL_stxi_xd_fppop(extfl, (JIT_FRAME_FLOSTACK_OFFSET - (i)), FP, r))
# define mz_st_fppop(i, r, extfl) mz_st_fppop_x(i, r, JIT_FP, extfl) # define mz_st_fppop(i, r, extfl) mz_st_fppop_x(i, r, JIT_FP, extfl)
#define mz_patch_branch(a) mz_patch_branch_at(a, (_jit.x.pc)) #define mz_patch_branch(a) mz_patch_branch_at(a, jit_get_ip())
#define mz_patch_ucbranch(a) mz_patch_ucbranch_at(a, (_jit.x.pc)) #define mz_patch_ucbranch(a) mz_patch_ucbranch_at(a, jit_get_ip())
#ifdef NEED_LONG_JUMPS #ifdef NEED_LONG_JUMPS
# define __START_SHORT_JUMPS__(cond) if (cond) { _jitl.long_jumps = 0; } # define __START_SHORT_JUMPS__(cond) if (cond) { _jitl.long_jumps = 0; }
@ -1233,14 +1276,14 @@ static void emit_indentation(mz_jit_state *jitter)
# define JIT_BUFFER_PAD_SIZE 100 # define JIT_BUFFER_PAD_SIZE 100
#endif #endif
#define PAST_LIMIT() ((uintptr_t)jit_get_ip().ptr > (uintptr_t)jitter->limit) #define PAST_LIMIT() ((uintptr_t)jit_get_raw_ip() > (uintptr_t)jitter->limit)
#define CHECK_LIMIT() if (PAST_LIMIT()) return past_limit(jitter, __FILE__, __LINE__); #define CHECK_LIMIT() if (PAST_LIMIT()) return past_limit(jitter, __FILE__, __LINE__);
#if 1 #if 1
# define past_limit(j, f, l) 0 # define past_limit(j, f, l) 0
#else #else
static int past_limit(mz_jit_state *jitter, const char *file, int line) static int past_limit(mz_jit_state *jitter, const char *file, int line)
{ {
if (((uintptr_t)jit_get_ip().ptr > (uintptr_t)jitter->limit + JIT_BUFFER_PAD_SIZE) if (((uintptr_t)jit_get_raw_ip() > (uintptr_t)jitter->limit + JIT_BUFFER_PAD_SIZE)
|| (jitter->retain_start)) { || (jitter->retain_start)) {
printf("way past %s %d\n", file, line); abort(); printf("way past %s %d\n", file, line); abort();
} }

View File

@ -132,7 +132,7 @@ int scheme_inline_alloc(mz_jit_state *jitter, int amt, Scheme_Type ty, int flags
algn = GC_alloc_alignment(); algn = GC_alloc_alignment();
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
reffail = _jit.x.pc; reffail = jit_get_ip();
mz_tl_ldi_p(JIT_V1, tl_GC_gen0_alloc_page_ptr); mz_tl_ldi_p(JIT_V1, tl_GC_gen0_alloc_page_ptr);
jit_subi_l(JIT_R2, JIT_V1, 1); jit_subi_l(JIT_R2, JIT_V1, 1);
jit_andi_l(JIT_R2, JIT_R2, (algn - 1)); jit_andi_l(JIT_R2, JIT_R2, (algn - 1));
@ -141,21 +141,30 @@ int scheme_inline_alloc(mz_jit_state *jitter, int amt, Scheme_Type ty, int flags
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
/* Failure handling */ /* Failure handling */
if (keep_r0_r1) { if (inline_retry) {
if (inline_retry) { int mode;
scheme_generate_alloc_retry(jitter, 1); if (keep_r0_r1)
CHECK_LIMIT(); mode = 1;
} else { else if (keep_fpr1)
(void)jit_calli(sjc.retry_alloc_code_keep_r0_r1); mode = 2;
} else if (keep_extfpr1)
} else if (keep_fpr1) { mode = 3;
(void)jit_calli(sjc.retry_alloc_code_keep_fpr1); else
#ifdef MZ_LONG_DOUBLE mode = 0;
} else if (keep_extfpr1) { scheme_generate_alloc_retry(jitter, mode);
(void)jit_calli(sjc.retry_alloc_code_keep_extfpr1); CHECK_LIMIT();
#endif
} else { } else {
(void)jit_calli(sjc.retry_alloc_code); if (keep_r0_r1) {
(void)jit_calli(sjc.retry_alloc_code_keep_r0_r1);
} else if (keep_fpr1) {
(void)jit_calli(sjc.retry_alloc_code_keep_fpr1);
#ifdef MZ_LONG_DOUBLE
} else if (keep_extfpr1) {
(void)jit_calli(sjc.retry_alloc_code_keep_extfpr1);
#endif
} else {
(void)jit_calli(sjc.retry_alloc_code);
}
} }
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
(void)jit_jmpi(reffail); (void)jit_jmpi(reffail);

View File

@ -364,7 +364,7 @@ static jit_insn *generate_arith_slow_path(mz_jit_state *jitter, Scheme_Object *r
{ {
GC_CAN_IGNORE jit_insn *ref, *ref4, *refslow; GC_CAN_IGNORE jit_insn *ref, *ref4, *refslow;
refslow = _jit.x.pc; refslow = jit_get_ip();
(void)jit_movi_p(JIT_R2, ((Scheme_Primitive_Proc *)rator)->prim_val); (void)jit_movi_p(JIT_R2, ((Scheme_Primitive_Proc *)rator)->prim_val);
if (for_branch) { if (for_branch) {
@ -417,7 +417,7 @@ static jit_insn *generate_arith_slow_path(mz_jit_state *jitter, Scheme_Object *r
if (arith == ARITH_LSH) { if (arith == ARITH_LSH) {
/* Add tag back to first arg, just in case. See arithmetic-shift branch to refslow. */ /* Add tag back to first arg, just in case. See arithmetic-shift branch to refslow. */
ref = _jit.x.pc; ref = jit_get_ip();
if (reversed || use_v) { if (reversed || use_v) {
jit_ori_l(JIT_R0, JIT_R0, 0x1); jit_ori_l(JIT_R0, JIT_R0, 0x1);
@ -700,6 +700,8 @@ static int generate_float_point_arith(mz_jit_state *jitter, Scheme_Object *rator
} }
#endif #endif
CHECK_LIMIT();
if (arith) { if (arith) {
#if defined(MZ_LONG_DOUBLE) && defined(MZ_NEED_SET_EXTFL_MODE) #if defined(MZ_LONG_DOUBLE) && defined(MZ_NEED_SET_EXTFL_MODE)
int need_control_reset = 0; int need_control_reset = 0;
@ -766,6 +768,7 @@ static int generate_float_point_arith(mz_jit_state *jitter, Scheme_Object *rator
refc = jit_FPSEL_bger_xd_fppop(extfl, jit_forward(), fpr0, fpr1); refc = jit_FPSEL_bger_xd_fppop(extfl, jit_forward(), fpr0, fpr1);
} }
} }
CHECK_LIMIT();
if (unboxed) { if (unboxed) {
jit_FPSEL_movr_xd_rel(extfl, fpr0, fpr1); jit_FPSEL_movr_xd_rel(extfl, fpr0, fpr1);
need_post_pop = 1; need_post_pop = 1;
@ -800,8 +803,10 @@ static int generate_float_point_arith(mz_jit_state *jitter, Scheme_Object *rator
/* to check whether it fits in a fixnum, we /* to check whether it fits in a fixnum, we
need to convert back and check whether it need to convert back and check whether it
is the same */ is the same */
if (unboxed) if (unboxed) {
jit_FPSEL_movr_xd_fppush(extfl, fpr1+1, fpr1); /* for slow path */ JIT_ASSERT(jitter->unbox_depth == 0);
jit_FPSEL_movr_xd_fppush(extfl, JIT_FPR2, fpr1); /* for slow path */
}
jit_FPSEL_extr_l_xd_fppush(extfl, fpr0, JIT_R1); jit_FPSEL_extr_l_xd_fppush(extfl, fpr0, JIT_R1);
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
refs = jit_FPSEL_bantieqr_xd_fppop(extfl, jit_forward(), fpr0, fpr1); refs = jit_FPSEL_bantieqr_xd_fppop(extfl, jit_forward(), fpr0, fpr1);
@ -814,7 +819,7 @@ static int generate_float_point_arith(mz_jit_state *jitter, Scheme_Object *rator
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
#if !defined(DIRECT_FPR_ACCESS) || defined(MZ_LONG_DOUBLE) #if !defined(DIRECT_FPR_ACCESS) || defined(MZ_LONG_DOUBLE)
if (unboxed && !USES_DIRECT_FPR_ACCESS) if (unboxed && !USES_DIRECT_FPR_ACCESS)
jit_FPSEL_roundr_xd_l_fppop(extfl, JIT_R1, fpr1+1); /* slow path won't be needed */ jit_FPSEL_roundr_xd_l_fppop(extfl, JIT_R1, JIT_FPR2); /* slow path won't be needed */
#endif #endif
} }
jit_fixnum_l(dest, JIT_R1); jit_fixnum_l(dest, JIT_R1);
@ -1037,7 +1042,7 @@ static int check_float_type_result(mz_jit_state *jitter, int reg, void *fail_cod
ref = jit_bmci_l(jit_forward(), reg, 0x1); ref = jit_bmci_l(jit_forward(), reg, 0x1);
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
reffail = _jit.x.pc; reffail = jit_get_ip();
(void)jit_movi_p(JIT_V1, ((Scheme_Primitive_Proc *)rator)->prim_val); (void)jit_movi_p(JIT_V1, ((Scheme_Primitive_Proc *)rator)->prim_val);
(void)jit_calli(fail_code); (void)jit_calli(fail_code);
@ -1645,7 +1650,7 @@ int scheme_generate_arith_for(mz_jit_state *jitter, Scheme_Object *rator, Scheme
if (!unsafe_fx || overflow_refslow) { if (!unsafe_fx || overflow_refslow) {
GC_CAN_IGNORE jit_insn *refx; GC_CAN_IGNORE jit_insn *refx;
__START_INNER_TINY__(branch_short); __START_INNER_TINY__(branch_short);
refx = jit_bnei_l(jit_forward(), JIT_R0, (void *)(((intptr_t)1 << ((8 * JIT_WORD_SIZE) - 2)))); refx = jit_bnei_p(jit_forward(), JIT_R0, (void *)(((intptr_t)1 << ((8 * JIT_WORD_SIZE) - 2))));
__END_INNER_TINY__(branch_short); __END_INNER_TINY__(branch_short);
/* first argument must have been most negative fixnum, /* first argument must have been most negative fixnum,
second argument must have been -1: */ second argument must have been -1: */
@ -1688,11 +1693,11 @@ int scheme_generate_arith_for(mz_jit_state *jitter, Scheme_Object *rator, Scheme
if (!unsafe_fx || overflow_refslow) { if (!unsafe_fx || overflow_refslow) {
/* check for a small enough shift */ /* check for a small enough shift */
if (arith == ARITH_RSH) { if (arith == ARITH_RSH) {
(void)jit_blti_l(refslow, v2, scheme_make_integer(0)); (void)jit_blti_p(refslow, v2, scheme_make_integer(0));
(void)jit_bgti_l(refslow, v2, scheme_make_integer(MAX_TRY_SHIFT)); (void)jit_bgti_p(refslow, v2, scheme_make_integer(MAX_TRY_SHIFT));
jit_rshi_l(JIT_V1, v2, 0x1); jit_rshi_l(JIT_V1, v2, 0x1);
} else { } else {
(void)jit_blti_l(refslow, v2, scheme_make_integer(-MAX_TRY_SHIFT)); (void)jit_blti_p(refslow, v2, scheme_make_integer(-MAX_TRY_SHIFT));
jit_notr_l(JIT_V1, v2); jit_notr_l(JIT_V1, v2);
jit_rshi_l(JIT_V1, JIT_V1, 0x1); jit_rshi_l(JIT_V1, JIT_V1, 0x1);
jit_addi_l(JIT_V1, JIT_V1, 0x1); jit_addi_l(JIT_V1, JIT_V1, 0x1);
@ -2228,7 +2233,7 @@ int scheme_generate_nary_arith(mz_jit_state *jitter, Scheme_App_Rec *app,
mz_patch_branch(reffx); mz_patch_branch(reffx);
} }
refslow = _jit.x.pc; refslow = jit_get_ip();
/* slow path */ /* slow path */
if (alt_args) { if (alt_args) {
/* get all args on runstack */ /* get all args on runstack */
@ -2251,7 +2256,7 @@ int scheme_generate_nary_arith(mz_jit_state *jitter, Scheme_App_Rec *app,
} }
refdone = jit_jmpi(jit_forward()); refdone = jit_jmpi(jit_forward());
if (!arith) { if (!arith) {
reffalse = _jit.x.pc; reffalse = jit_get_ip();
(void)jit_movi_p(JIT_R0, scheme_false); (void)jit_movi_p(JIT_R0, scheme_false);
refdone3 = jit_jmpi(jit_forward()); refdone3 = jit_jmpi(jit_forward());
} else { } else {

View File

@ -355,7 +355,7 @@ int scheme_generate_tail_call(mz_jit_state *jitter, int num_rands, int direct_na
ref = ref2 = NULL; ref = ref2 = NULL;
} }
refagain = _jit.x.pc; refagain = jit_get_ip();
/* Right kind of function. Extract data and check stack depth: */ /* Right kind of function. Extract data and check stack depth: */
if (!direct_to_code) { if (!direct_to_code) {
@ -644,7 +644,7 @@ static int generate_retry_call(mz_jit_state *jitter, int num_rands, int multi_ok
jit_ldxi_p(JIT_V1, JIT_R1, &((Scheme_Thread *)0x0)->ku.apply.tail_rands); jit_ldxi_p(JIT_V1, JIT_R1, &((Scheme_Thread *)0x0)->ku.apply.tail_rands);
jit_lshi_l(JIT_R2, JIT_R2, JIT_LOG_WORD_SIZE); jit_lshi_l(JIT_R2, JIT_R2, JIT_LOG_WORD_SIZE);
CHECK_LIMIT(); CHECK_LIMIT();
refloop = _jit.x.pc; refloop = jit_get_ip();
ref2 = jit_blei_l(jit_forward(), JIT_R2, 0); ref2 = jit_blei_l(jit_forward(), JIT_R2, 0);
jit_subi_l(JIT_R2, JIT_R2, JIT_WORD_SIZE); jit_subi_l(JIT_R2, JIT_R2, JIT_WORD_SIZE);
jit_ldxr_p(JIT_R0, JIT_V1, JIT_R2); jit_ldxr_p(JIT_R0, JIT_V1, JIT_R2);
@ -667,7 +667,7 @@ static int generate_retry_call(mz_jit_state *jitter, int num_rands, int multi_ok
/* Slow path; restore R0 to SCHEME_TAIL_CALL_WAITING */ /* Slow path; restore R0 to SCHEME_TAIL_CALL_WAITING */
mz_patch_branch(ref); mz_patch_branch(ref);
jit_movi_l(JIT_R0, SCHEME_TAIL_CALL_WAITING); jit_movi_p(JIT_R0, SCHEME_TAIL_CALL_WAITING);
return 1; return 1;
} }
@ -741,7 +741,7 @@ int scheme_generate_non_tail_call(mz_jit_state *jitter, int num_rands, int direc
if (num_rands != -1) { if (num_rands != -1) {
mz_prolog(JIT_R1); mz_prolog(JIT_R1);
} else { } else {
reftop = _jit.x.pc; reftop = jit_get_ip();
} }
} }
@ -756,7 +756,7 @@ int scheme_generate_non_tail_call(mz_jit_state *jitter, int num_rands, int direc
ref = ref2 = NULL; ref = ref2 = NULL;
} }
refagain = _jit.x.pc; refagain = jit_get_ip();
/* Before inlined native, check max let depth */ /* Before inlined native, check max let depth */
if (!nontail_self) { if (!nontail_self) {
@ -801,7 +801,7 @@ int scheme_generate_non_tail_call(mz_jit_state *jitter, int num_rands, int direc
/* keep call & ret paired by jumping to where we really /* keep call & ret paired by jumping to where we really
want to return,then back here: */ want to return,then back here: */
refr = jit_jmpi(jit_forward()); refr = jit_jmpi(jit_forward());
refxr = _jit.x.pc; refxr = jit_get_ip();
jit_base_prolog(); jit_base_prolog();
#else #else
refr = jit_patchable_movi_p(JIT_R1, jit_forward()); refr = jit_patchable_movi_p(JIT_R1, jit_forward());
@ -837,7 +837,7 @@ int scheme_generate_non_tail_call(mz_jit_state *jitter, int num_rands, int direc
GC_CAN_IGNORE jit_insn *refrr; GC_CAN_IGNORE jit_insn *refrr;
refrr = jit_patchable_movi_p(JIT_R1, jit_forward()); refrr = jit_patchable_movi_p(JIT_R1, jit_forward());
jit_jmpr(JIT_V1); jit_jmpr(JIT_V1);
jit_patch_movi(refrr, _jit.x.pc); jit_patch_movi(refrr, jit_get_ip());
jit_movi_i(JIT_R1, num_rands); /* argc */ jit_movi_i(JIT_R1, num_rands); /* argc */
jit_movr_p(JIT_R2, JIT_RUNSTACK); /* argv */ jit_movr_p(JIT_R2, JIT_RUNSTACK); /* argv */
} }
@ -861,7 +861,7 @@ int scheme_generate_non_tail_call(mz_jit_state *jitter, int num_rands, int direc
mz_patch_ucbranch(refr); mz_patch_ucbranch(refr);
(void)jit_short_calli(refxr); (void)jit_short_calli(refxr);
#else #else
jit_patch_movi(refr, (_jit.x.pc)); jit_patch_movi(refr, jit_get_ip());
#endif #endif
jit_unshuffle_saved_regs(); /* maybe uncopies V registers */ jit_unshuffle_saved_regs(); /* maybe uncopies V registers */
/* If num_rands < 0, then V1 has argc */ /* If num_rands < 0, then V1 has argc */
@ -1093,7 +1093,7 @@ static int generate_self_tail_call(Scheme_Object *rator, mz_jit_state *jitter, i
__START_TINY_OR_SHORT_JUMPS__(jmp_tiny, jmp_short); __START_TINY_OR_SHORT_JUMPS__(jmp_tiny, jmp_short);
refagain = _jit.x.pc; refagain = jit_get_ip();
/* Check for thread swap: */ /* Check for thread swap: */
(void)mz_tl_ldi_i(JIT_R2, tl_scheme_fuel_counter); (void)mz_tl_ldi_i(JIT_R2, tl_scheme_fuel_counter);
@ -1210,7 +1210,7 @@ static int generate_self_tail_call(Scheme_Object *rator, mz_jit_state *jitter, i
iref = NULL; iref = NULL;
jit_movi_l(JIT_R0, aoffset); jit_movi_l(JIT_R0, aoffset);
mz_rs_sync(); mz_rs_sync();
MZ_FPUSEL_STMT(extfl, MZ_FPUSEL_STMT(extfl,
(void)jit_calli(sjc.box_extflonum_from_stack_code), (void)jit_calli(sjc.box_extflonum_from_stack_code),
(void)jit_calli(sjc.box_flonum_from_stack_code)); (void)jit_calli(sjc.box_flonum_from_stack_code));
if (i != num_rands - 1) if (i != num_rands - 1)
@ -1313,9 +1313,11 @@ void scheme_jit_register_sub_func(mz_jit_state *jitter, void *code, Scheme_Objec
{ {
void *code_end; void *code_end;
code_end = jit_get_ip().ptr; code_end = jit_get_ip();
if (jitter->retain_start) if (jitter->retain_start)
scheme_jit_add_symbol((uintptr_t)code, (uintptr_t)code_end - 1, protocol, 0); scheme_jit_add_symbol((uintptr_t)jit_unadjust_ip(code),
(uintptr_t)jit_unadjust_ip(code_end) - 1,
protocol, 0);
} }
void scheme_jit_register_helper_func(mz_jit_state *jitter, void *code) void scheme_jit_register_helper_func(mz_jit_state *jitter, void *code)
@ -1339,7 +1341,7 @@ static int do_generate_shared_call(mz_jit_state *jitter, void *_data)
int ok; int ok;
void *code; void *code;
code = jit_get_ip().ptr; code = jit_get_ip();
if (data->direct_prim) if (data->direct_prim)
ok = generate_direct_prim_tail_call(jitter, data->num_rands); ok = generate_direct_prim_tail_call(jitter, data->num_rands);
@ -1354,7 +1356,7 @@ static int do_generate_shared_call(mz_jit_state *jitter, void *_data)
int ok; int ok;
void *code; void *code;
code = jit_get_ip().ptr; code = jit_get_ip();
if (data->direct_prim) if (data->direct_prim)
ok = generate_direct_prim_non_tail_call(jitter, data->num_rands, data->multi_ok, 1); ok = generate_direct_prim_non_tail_call(jitter, data->num_rands, data->multi_ok, 1);
@ -1374,6 +1376,7 @@ void *scheme_generate_shared_call(int num_rands, mz_jit_state *old_jitter, int m
int unboxed_args) int unboxed_args)
{ {
Generate_Call_Data data; Generate_Call_Data data;
void *ip;
data.num_rands = num_rands; data.num_rands = num_rands;
data.old_jitter = old_jitter; data.old_jitter = old_jitter;
@ -1385,7 +1388,8 @@ void *scheme_generate_shared_call(int num_rands, mz_jit_state *old_jitter, int m
data.nontail_self = nontail_self; data.nontail_self = nontail_self;
data.unboxed_args = unboxed_args; data.unboxed_args = unboxed_args;
return scheme_generate_one(old_jitter, do_generate_shared_call, &data, 0, NULL, NULL); ip = scheme_generate_one(old_jitter, do_generate_shared_call, &data, 0, NULL, NULL);
return jit_adjust_ip(ip);
} }
void scheme_ensure_retry_available(mz_jit_state *jitter, int multi_ok, int result_ignored) void scheme_ensure_retry_available(mz_jit_state *jitter, int multi_ok, int result_ignored)
@ -1566,7 +1570,7 @@ static int generate_call_path_with_unboxes(mz_jit_state *jitter, int direct_flos
int i, k, offset; int i, k, offset;
refgo = jit_jmpi(jit_forward()); refgo = jit_jmpi(jit_forward());
refcopy = _jit.x.pc; refcopy = jit_get_ip();
/* Callback code to copy unboxed arguments. /* Callback code to copy unboxed arguments.
R1 has the return address, R2 holds the old FP */ R1 has the return address, R2 holds the old FP */

View File

@ -103,7 +103,7 @@ static Scheme_Object *vector_check_chaperone_of(Scheme_Object *o, Scheme_Object
static int save_struct_temp(mz_jit_state *jitter, int reg) static int save_struct_temp(mz_jit_state *jitter, int reg)
{ {
#ifdef MZ_USE_JIT_PPC #if defined(MZ_USE_JIT_PPC) || defined(MZ_USE_JIT_ARM)
jit_movr_p(JIT_V(3), reg); jit_movr_p(JIT_V(3), reg);
#endif #endif
#ifdef MZ_USE_JIT_I386 #ifdef MZ_USE_JIT_I386
@ -122,7 +122,7 @@ int scheme_save_struct_temp(mz_jit_state *jitter, int reg) {
static int restore_struct_temp(mz_jit_state *jitter, int reg) static int restore_struct_temp(mz_jit_state *jitter, int reg)
{ {
#ifdef MZ_USE_JIT_PPC #if defined(MZ_USE_JIT_PPC) || defined(MZ_USE_JIT_ARM)
jit_movr_p(reg, JIT_V(3)); jit_movr_p(reg, JIT_V(3));
#endif #endif
#ifdef MZ_USE_JIT_I386 #ifdef MZ_USE_JIT_I386
@ -204,7 +204,7 @@ static int common0(mz_jit_state *jitter, void *_data)
/* *** check_arity_code *** */ /* *** check_arity_code *** */
/* Called as a function: */ /* Called as a function: */
sjc.check_arity_code = (Native_Check_Arity_Proc)jit_get_ip().ptr; sjc.check_arity_code = (Native_Check_Arity_Proc)jit_get_ip();
jit_prolog(NATIVE_ARG_COUNT); /* only need 2 arguments, but return path overlaps with proc conventions */ jit_prolog(NATIVE_ARG_COUNT); /* only need 2 arguments, but return path overlaps with proc conventions */
mz_push_threadlocal_early(); mz_push_threadlocal_early();
in = jit_arg_p(); in = jit_arg_p();
@ -223,7 +223,7 @@ static int common0(mz_jit_state *jitter, void *_data)
/* *** get_arity_code *** */ /* *** get_arity_code *** */
/* Called as a function: */ /* Called as a function: */
sjc.get_arity_code = (Native_Get_Arity_Proc)jit_get_ip().ptr; sjc.get_arity_code = (Native_Get_Arity_Proc)jit_get_ip();
jit_prolog(NATIVE_ARG_COUNT); /* only need 1 argument, but return path overlaps with proc conventions */ jit_prolog(NATIVE_ARG_COUNT); /* only need 1 argument, but return path overlaps with proc conventions */
mz_push_threadlocal_early(); mz_push_threadlocal_early();
in = jit_arg_p(); in = jit_arg_p();
@ -243,7 +243,7 @@ static int common0(mz_jit_state *jitter, void *_data)
/* *** bad_result_arity_code *** */ /* *** bad_result_arity_code *** */
/* Jumped-to from non-tail contexts */ /* Jumped-to from non-tail contexts */
sjc.bad_result_arity_code = (Native_Get_Arity_Proc)jit_get_ip().ptr; sjc.bad_result_arity_code = (Native_Get_Arity_Proc)jit_get_ip();
mz_tl_ldi_p(JIT_R2, tl_scheme_current_thread); mz_tl_ldi_p(JIT_R2, tl_scheme_current_thread);
jit_ldxi_l(JIT_R1, JIT_R2, &((Scheme_Thread *)0x0)->ku.multiple.count); jit_ldxi_l(JIT_R1, JIT_R2, &((Scheme_Thread *)0x0)->ku.multiple.count);
jit_ldxi_p(JIT_R2, JIT_R2, &((Scheme_Thread *)0x0)->ku.multiple.array); jit_ldxi_p(JIT_R2, JIT_R2, &((Scheme_Thread *)0x0)->ku.multiple.array);
@ -258,7 +258,7 @@ static int common0(mz_jit_state *jitter, void *_data)
CHECK_LIMIT(); CHECK_LIMIT();
/* *** unbound_global_code *** */ /* *** unbound_global_code *** */
sjc.unbound_global_code = jit_get_ip().ptr; sjc.unbound_global_code = jit_get_ip();
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
mz_prepare(1); mz_prepare(1);
jit_pusharg_p(JIT_R2); jit_pusharg_p(JIT_R2);
@ -267,7 +267,7 @@ static int common0(mz_jit_state *jitter, void *_data)
/* *** quote_syntax_code *** */ /* *** quote_syntax_code *** */
/* R0 is WORDS_TO_BYTES(c), R1 is &0->a[i+p+1], R2 is &0->a[p] */ /* R0 is WORDS_TO_BYTES(c), R1 is &0->a[i+p+1], R2 is &0->a[p] */
sjc.quote_syntax_code = jit_get_ip().ptr; sjc.quote_syntax_code = jit_get_ip();
mz_prolog(JIT_V1); mz_prolog(JIT_V1);
__START_SHORT_JUMPS__(1); __START_SHORT_JUMPS__(1);
/* Load global array: */ /* Load global array: */
@ -328,7 +328,7 @@ static int common1(mz_jit_state *jitter, void *_data)
for (i = 0; i < 13; i++) { for (i = 0; i < 13; i++) {
void *code; void *code;
code = jit_get_ip().ptr; code = jit_get_ip();
switch (i) { switch (i) {
case 0: case 0:
sjc.bad_car_code = code; sjc.bad_car_code = code;
@ -460,7 +460,7 @@ static int common1b(mz_jit_state *jitter, void *_data)
/* Bad argument is in R0, other is in R1 */ /* Bad argument is in R0, other is in R1 */
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
void *code; void *code;
code = jit_get_ip().ptr; code = jit_get_ip();
switch (i) { switch (i) {
case 0: case 0:
sjc.bad_set_mcar_code = code; sjc.bad_set_mcar_code = code;
@ -509,7 +509,7 @@ static int common1b(mz_jit_state *jitter, void *_data)
/* *** unbox_code *** */ /* *** unbox_code *** */
/* R0 is argument */ /* R0 is argument */
sjc.unbox_code = jit_get_ip().ptr; sjc.unbox_code = jit_get_ip();
mz_prolog(JIT_R1); mz_prolog(JIT_R1);
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
jit_prepare(1); jit_prepare(1);
@ -522,7 +522,7 @@ static int common1b(mz_jit_state *jitter, void *_data)
/* *** set_box_code *** */ /* *** set_box_code *** */
/* R0 is box, R1 is value */ /* R0 is box, R1 is value */
sjc.set_box_code = jit_get_ip().ptr; sjc.set_box_code = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
jit_prepare(2); jit_prepare(2);
@ -539,7 +539,7 @@ static int common1b(mz_jit_state *jitter, void *_data)
/* call scheme_box_cas to raise the exception, /* call scheme_box_cas to raise the exception,
we use mz_finish_lwe because it will capture the stack, we use mz_finish_lwe because it will capture the stack,
and the ts_ version because we may be in a future */ and the ts_ version because we may be in a future */
sjc.box_cas_fail_code = jit_get_ip().ptr; sjc.box_cas_fail_code = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
JIT_UPDATE_THREAD_RSPTR_IF_NEEDED(); JIT_UPDATE_THREAD_RSPTR_IF_NEEDED();
jit_movi_l(JIT_R0, 3); jit_movi_l(JIT_R0, 3);
@ -552,7 +552,7 @@ static int common1b(mz_jit_state *jitter, void *_data)
/* *** bad_vector_length_code *** */ /* *** bad_vector_length_code *** */
/* R0 is argument */ /* R0 is argument */
sjc.bad_vector_length_code = jit_get_ip().ptr; sjc.bad_vector_length_code = jit_get_ip();
mz_prolog(JIT_R1); mz_prolog(JIT_R1);
/* Check for chaperone: */ /* Check for chaperone: */
@ -572,7 +572,7 @@ static int common1b(mz_jit_state *jitter, void *_data)
/* *** bad_flvector_length_code *** */ /* *** bad_flvector_length_code *** */
/* R0 is argument */ /* R0 is argument */
sjc.bad_flvector_length_code = jit_get_ip().ptr; sjc.bad_flvector_length_code = jit_get_ip();
mz_prolog(JIT_R1); mz_prolog(JIT_R1);
jit_prepare(1); jit_prepare(1);
jit_pusharg_p(JIT_R0); jit_pusharg_p(JIT_R0);
@ -583,7 +583,7 @@ static int common1b(mz_jit_state *jitter, void *_data)
#ifdef MZ_LONG_DOUBLE #ifdef MZ_LONG_DOUBLE
/* *** bad_extflvector_length_code *** */ /* *** bad_extflvector_length_code *** */
/* R0 is argument */ /* R0 is argument */
sjc.bad_extflvector_length_code = jit_get_ip().ptr; sjc.bad_extflvector_length_code = jit_get_ip();
mz_prolog(JIT_R1); mz_prolog(JIT_R1);
jit_prepare(1); jit_prepare(1);
jit_pusharg_p(JIT_R0); jit_pusharg_p(JIT_R0);
@ -594,7 +594,7 @@ static int common1b(mz_jit_state *jitter, void *_data)
/* *** bad_fxvector_length_code *** */ /* *** bad_fxvector_length_code *** */
/* R0 is argument */ /* R0 is argument */
sjc.bad_fxvector_length_code = jit_get_ip().ptr; sjc.bad_fxvector_length_code = jit_get_ip();
mz_prolog(JIT_R1); mz_prolog(JIT_R1);
jit_prepare(1); jit_prepare(1);
jit_pusharg_p(JIT_R0); jit_pusharg_p(JIT_R0);
@ -619,7 +619,7 @@ static int common2(mz_jit_state *jitter, void *_data)
void *code; void *code;
for (j = 0; j < 2; j++) { for (j = 0; j < 2; j++) {
CHECK_LIMIT(); CHECK_LIMIT();
code = jit_get_ip().ptr; code = jit_get_ip();
if (!i) { if (!i) {
if (!j) if (!j)
sjc.call_original_unary_arith_code = code; sjc.call_original_unary_arith_code = code;
@ -693,7 +693,7 @@ static int common2(mz_jit_state *jitter, void *_data)
{ {
void *code; void *code;
code = jit_get_ip().ptr; code = jit_get_ip();
sjc.call_original_nary_arith_code = code; sjc.call_original_nary_arith_code = code;
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
@ -718,7 +718,7 @@ static int common2(mz_jit_state *jitter, void *_data)
/* Used as the code stub for a closure whose /* Used as the code stub for a closure whose
code is not yet compiled. See generate_function_prolog code is not yet compiled. See generate_function_prolog
for the state of registers on entry */ for the state of registers on entry */
scheme_on_demand_jit_code = jit_get_ip().ptr; scheme_on_demand_jit_code = jit_get_ip();
jit_prolog(NATIVE_ARG_COUNT); jit_prolog(NATIVE_ARG_COUNT);
mz_push_threadlocal_early(); mz_push_threadlocal_early();
in = jit_arg_p(); in = jit_arg_p();
@ -731,7 +731,7 @@ static int common2(mz_jit_state *jitter, void *_data)
mz_push_locals(); mz_push_locals();
mz_push_threadlocal(in); mz_push_threadlocal(in);
mz_tl_ldi_p(JIT_RUNSTACK, tl_MZ_RUNSTACK); mz_tl_ldi_p(JIT_RUNSTACK, tl_MZ_RUNSTACK);
sjc.on_demand_jit_arity_code = jit_get_ip().ptr; /* <<<- arity variant starts here */ sjc.on_demand_jit_arity_code = jit_get_ip(); /* <<<- arity variant starts here */
jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(2)); jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(2));
CHECK_RUNSTACK_OVERFLOW(); CHECK_RUNSTACK_OVERFLOW();
jit_str_p(JIT_RUNSTACK, JIT_R0); jit_str_p(JIT_RUNSTACK, JIT_R0);
@ -794,13 +794,13 @@ static int common2(mz_jit_state *jitter, void *_data)
/* Used for the state of a function that is being JITted /* Used for the state of a function that is being JITted
(for a kind of cycle detection) without breaking concurrent (for a kind of cycle detection) without breaking concurrent
future threads that might try to call the function. */ future threads that might try to call the function. */
sjc.in_progress_on_demand_jit_arity_code = jit_get_ip().ptr; sjc.in_progress_on_demand_jit_arity_code = jit_get_ip();
(void)jit_jmpi(sjc.on_demand_jit_arity_code); (void)jit_jmpi(sjc.on_demand_jit_arity_code);
/* *** app_values_tail_slow_code *** */ /* *** app_values_tail_slow_code *** */
/* RELIES ON jit_prolog(NATIVE_ARG_COUNT) FROM ABOVE */ /* RELIES ON jit_prolog(NATIVE_ARG_COUNT) FROM ABOVE */
/* Rator in V1, arguments are in thread's multiple-values cells. */ /* Rator in V1, arguments are in thread's multiple-values cells. */
sjc.app_values_tail_slow_code = jit_get_ip().ptr; sjc.app_values_tail_slow_code = jit_get_ip();
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
mz_prepare(1); mz_prepare(1);
jit_pusharg_p(JIT_V1); jit_pusharg_p(JIT_V1);
@ -815,17 +815,17 @@ static int common2(mz_jit_state *jitter, void *_data)
/* *** finish_tail_call_[fixup_]code *** */ /* *** finish_tail_call_[fixup_]code *** */
/* RELIES ON jit_prolog(NATIVE_ARG_COUNT) FROM ABOVE */ /* RELIES ON jit_prolog(NATIVE_ARG_COUNT) FROM ABOVE */
sjc.finish_tail_call_code = jit_get_ip().ptr; sjc.finish_tail_call_code = jit_get_ip();
scheme_generate_finish_tail_call(jitter, 0); scheme_generate_finish_tail_call(jitter, 0);
CHECK_LIMIT(); CHECK_LIMIT();
scheme_jit_register_helper_func(jitter, sjc.finish_tail_call_code); scheme_jit_register_helper_func(jitter, sjc.finish_tail_call_code);
sjc.finish_tail_call_fixup_code = jit_get_ip().ptr; sjc.finish_tail_call_fixup_code = jit_get_ip();
scheme_generate_finish_tail_call(jitter, 2); scheme_generate_finish_tail_call(jitter, 2);
CHECK_LIMIT(); CHECK_LIMIT();
scheme_jit_register_helper_func(jitter, sjc.finish_tail_call_fixup_code); scheme_jit_register_helper_func(jitter, sjc.finish_tail_call_fixup_code);
/* *** get_stack_pointer_code *** */ /* *** get_stack_pointer_code *** */
sjc.get_stack_pointer_code = jit_get_ip().ptr; sjc.get_stack_pointer_code = jit_get_ip();
jit_leaf(0); jit_leaf(0);
jit_movr_p(JIT_R0, JIT_FP); jit_movr_p(JIT_R0, JIT_FP);
/* Get frame pointer of caller... */ /* Get frame pointer of caller... */
@ -834,6 +834,9 @@ static int common2(mz_jit_state *jitter, void *_data)
#endif #endif
#ifdef MZ_USE_JIT_I386 #ifdef MZ_USE_JIT_I386
jit_ldr_p(JIT_R0, JIT_R0); jit_ldr_p(JIT_R0, JIT_R0);
#endif
#ifdef MZ_USE_JIT_ARM
jit_ldxi_p(JIT_R0, JIT_R0, JIT_NEXT_FP_OFFSET);
#endif #endif
jit_movr_p(JIT_RET, JIT_R0); jit_movr_p(JIT_RET, JIT_R0);
jit_ret(); jit_ret();
@ -844,7 +847,7 @@ static int common2(mz_jit_state *jitter, void *_data)
any registers that a function call would normally save any registers that a function call would normally save
and restore. JIT_AUX, which is used by things like jit_ldi, and restore. JIT_AUX, which is used by things like jit_ldi,
is such a register for PPC. */ is such a register for PPC. */
sjc.stack_cache_pop_code = jit_get_ip().ptr; sjc.stack_cache_pop_code = jit_get_ip();
jit_movr_p(JIT_R0, JIT_RET); jit_movr_p(JIT_R0, JIT_RET);
#ifdef MZ_USE_JIT_PPC #ifdef MZ_USE_JIT_PPC
jit_subi_p(JIT_SP, JIT_SP, 48); /* includes space maybe used by callee */ jit_subi_p(JIT_SP, JIT_SP, 48); /* includes space maybe used by callee */
@ -875,7 +878,7 @@ static int common2(mz_jit_state *jitter, void *_data)
/* *** bad_app_vals_target *** */ /* *** bad_app_vals_target *** */
/* Non-proc is in R0 */ /* Non-proc is in R0 */
sjc.bad_app_vals_target = jit_get_ip().ptr; sjc.bad_app_vals_target = jit_get_ip();
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
mz_prepare(1); mz_prepare(1);
jit_pusharg_p(JIT_R0); jit_pusharg_p(JIT_R0);
@ -887,9 +890,9 @@ static int common2(mz_jit_state *jitter, void *_data)
/* Rator in V1, arguments are in thread's multiple-values cells. */ /* Rator in V1, arguments are in thread's multiple-values cells. */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
if (i) if (i)
sjc.app_values_multi_slow_code = jit_get_ip().ptr; sjc.app_values_multi_slow_code = jit_get_ip();
else else
sjc.app_values_slow_code = jit_get_ip().ptr; sjc.app_values_slow_code = jit_get_ip();
mz_prolog(JIT_R1); mz_prolog(JIT_R1);
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
mz_prepare(1); mz_prepare(1);
@ -910,7 +913,7 @@ static int common2(mz_jit_state *jitter, void *_data)
{ {
GC_CAN_IGNORE jit_insn *refslow, *ref1, *refloop, *ref2; GC_CAN_IGNORE jit_insn *refslow, *ref1, *refloop, *ref2;
sjc.values_code = jit_get_ip().ptr; sjc.values_code = jit_get_ip();
mz_prolog(JIT_R1); mz_prolog(JIT_R1);
mz_tl_ldi_p(JIT_R2, tl_scheme_current_thread); mz_tl_ldi_p(JIT_R2, tl_scheme_current_thread);
jit_ldxi_p(JIT_R1, JIT_R2, &((Scheme_Thread *)0x0)->values_buffer); jit_ldxi_p(JIT_R1, JIT_R2, &((Scheme_Thread *)0x0)->values_buffer);
@ -918,7 +921,7 @@ static int common2(mz_jit_state *jitter, void *_data)
CHECK_LIMIT(); CHECK_LIMIT();
/* Allocate new array: */ /* Allocate new array: */
refslow = _jit.x.pc; refslow = jit_get_ip();
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
mz_prepare(2); mz_prepare(2);
jit_pusharg_p(JIT_R2); jit_pusharg_p(JIT_R2);
@ -942,7 +945,7 @@ static int common2(mz_jit_state *jitter, void *_data)
/* Copy values over: */ /* Copy values over: */
jit_movr_p(JIT_R0, JIT_RUNSTACK); jit_movr_p(JIT_R0, JIT_RUNSTACK);
refloop = _jit.x.pc; refloop = jit_get_ip();
jit_ldr_p(JIT_R2, JIT_R0); jit_ldr_p(JIT_R2, JIT_R0);
jit_str_p(JIT_R1, JIT_R2); jit_str_p(JIT_R1, JIT_R2);
jit_subi_l(JIT_V1, JIT_V1, 1); jit_subi_l(JIT_V1, JIT_V1, 1);
@ -1055,7 +1058,7 @@ static int common3(mz_jit_state *jitter, void *_data)
int offset, count_offset, log_elem_size; int offset, count_offset, log_elem_size;
void *code; void *code;
code = jit_get_ip().ptr; code = jit_get_ip();
switch (ii) { switch (ii) {
case -1: case -1:
@ -1173,7 +1176,7 @@ static int common3(mz_jit_state *jitter, void *_data)
CHECK_LIMIT(); CHECK_LIMIT();
/* Slow path: */ /* Slow path: */
reffail = _jit.x.pc; reffail = jit_get_ip();
if (ii != -1) { if (ii != -1) {
/* in chaperone mode, we already saved original and index on runstack */ /* in chaperone mode, we already saved original and index on runstack */
if (!i) { if (!i) {
@ -1470,7 +1473,7 @@ int scheme_generate_struct_op(mz_jit_state *jitter, int kind, int for_branch,
/* Check argument: */ /* Check argument: */
if (kind == 1) { if (kind == 1) {
bref1 = jit_bmsi_ul(jit_forward(), JIT_R1, 0x1); bref1 = jit_bmsi_ul(jit_forward(), JIT_R1, 0x1);
refretry = _jit.x.pc; refretry = jit_get_ip();
jit_ldxi_s(JIT_R2, JIT_R1, &((Scheme_Object *)0x0)->type); jit_ldxi_s(JIT_R2, JIT_R1, &((Scheme_Object *)0x0)->type);
__START_INNER_TINY__(1); __START_INNER_TINY__(1);
ref2 = jit_beqi_i(jit_forward(), JIT_R2, scheme_structure_type); ref2 = jit_beqi_i(jit_forward(), JIT_R2, scheme_structure_type);
@ -1674,7 +1677,7 @@ static int common4(mz_jit_state *jitter, void *_data)
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
void *code; void *code;
code = jit_get_ip().ptr; code = jit_get_ip();
if (!i) { if (!i) {
sjc.flvector_ref_check_index_code[iii] = code; sjc.flvector_ref_check_index_code[iii] = code;
@ -1731,7 +1734,7 @@ static int common4(mz_jit_state *jitter, void *_data)
for (iii = 0; iii < 2; iii++) { /* ref, set */ for (iii = 0; iii < 2; iii++) { /* ref, set */
void *code; void *code;
code = jit_get_ip().ptr; code = jit_get_ip();
if (!iii) { if (!iii) {
sjc.struct_raw_ref_code = code; sjc.struct_raw_ref_code = code;
@ -1767,13 +1770,13 @@ static int common4(mz_jit_state *jitter, void *_data)
/* R0 is (potential) syntax object */ /* R0 is (potential) syntax object */
{ {
GC_CAN_IGNORE jit_insn *ref, *reffail, *refrts; GC_CAN_IGNORE jit_insn *ref, *reffail, *refrts;
sjc.syntax_e_code = jit_get_ip().ptr; sjc.syntax_e_code = jit_get_ip();
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1);
reffail = _jit.x.pc; reffail = jit_get_ip();
jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(1)); jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(1));
CHECK_RUNSTACK_OVERFLOW(); CHECK_RUNSTACK_OVERFLOW();
jit_str_p(JIT_RUNSTACK, JIT_R0); jit_str_p(JIT_RUNSTACK, JIT_R0);
@ -1829,41 +1832,41 @@ static int common4(mz_jit_state *jitter, void *_data)
if ((ii == 1) && (i == 1)) continue; /* no multi variant of pred branch */ if ((ii == 1) && (i == 1)) continue; /* no multi variant of pred branch */
if ((ii == 2) && (i == 1)) continue; /* no tail variant of pred branch */ if ((ii == 2) && (i == 1)) continue; /* no tail variant of pred branch */
code = jit_get_ip().ptr; code = jit_get_ip();
if (!i) { if (!i) {
kind = 1; kind = 1;
for_branch = 0; for_branch = 0;
if (ii == 2) if (ii == 2)
sjc.struct_pred_tail_code = jit_get_ip().ptr; sjc.struct_pred_tail_code = jit_get_ip();
else if (ii == 1) else if (ii == 1)
sjc.struct_pred_multi_code = jit_get_ip().ptr; sjc.struct_pred_multi_code = jit_get_ip();
else else
sjc.struct_pred_code = jit_get_ip().ptr; sjc.struct_pred_code = jit_get_ip();
} else if (i == 1) { } else if (i == 1) {
kind = 1; kind = 1;
for_branch = 1; for_branch = 1;
sjc.struct_pred_branch_code = jit_get_ip().ptr; sjc.struct_pred_branch_code = jit_get_ip();
/* Save target address for false branch: */ /* Save target address for false branch: */
save_struct_temp(jitter, JIT_V1); save_struct_temp(jitter, JIT_V1);
} else if (i == 2) { } else if (i == 2) {
kind = 2; kind = 2;
for_branch = 0; for_branch = 0;
if (ii == 2) if (ii == 2)
sjc.struct_get_tail_code = jit_get_ip().ptr; sjc.struct_get_tail_code = jit_get_ip();
else if (ii == 1) else if (ii == 1)
sjc.struct_get_multi_code = jit_get_ip().ptr; sjc.struct_get_multi_code = jit_get_ip();
else else
sjc.struct_get_code = jit_get_ip().ptr; sjc.struct_get_code = jit_get_ip();
} else { } else {
kind = 3; kind = 3;
for_branch = 0; for_branch = 0;
if (ii == 2) if (ii == 2)
sjc.struct_set_tail_code = jit_get_ip().ptr; sjc.struct_set_tail_code = jit_get_ip();
else if (ii == 1) else if (ii == 1)
sjc.struct_set_multi_code = jit_get_ip().ptr; sjc.struct_set_multi_code = jit_get_ip();
else else
sjc.struct_set_code = jit_get_ip().ptr; sjc.struct_set_code = jit_get_ip();
/* Save value to install: */ /* Save value to install: */
save_struct_temp(jitter, JIT_V1); save_struct_temp(jitter, JIT_V1);
} }
@ -1876,13 +1879,13 @@ static int common4(mz_jit_state *jitter, void *_data)
CHECK_LIMIT(); CHECK_LIMIT();
/* Slow path: non-struct proc. */ /* Slow path: non-struct proc. */
refslow = _jit.x.pc; refslow = jit_get_ip();
gen_struct_slow(jitter, kind, 0, for_branch, ii == 2, ii == 1, &bref5, &bref6); gen_struct_slow(jitter, kind, 0, for_branch, ii == 2, ii == 1, &bref5, &bref6);
CHECK_LIMIT(); CHECK_LIMIT();
if ((kind == 2) || (kind == 3)) { if ((kind == 2) || (kind == 3)) {
/* Slow path: argument type is bad for a getter/setter. */ /* Slow path: argument type is bad for a getter/setter. */
refslow2 = _jit.x.pc; refslow2 = jit_get_ip();
gen_struct_slow(jitter, kind, 1, 0, 0, 0, NULL, NULL); gen_struct_slow(jitter, kind, 1, 0, 0, 0, NULL, NULL);
CHECK_LIMIT(); CHECK_LIMIT();
} else } else
@ -1916,7 +1919,7 @@ static int common4b(mz_jit_state *jitter, void *_data)
void *code; void *code;
GC_CAN_IGNORE jit_insn *ref, *ref2, *ref3, *refno, *refslow, *refloop; GC_CAN_IGNORE jit_insn *ref, *ref2, *ref3, *refno, *refslow, *refloop;
code = jit_get_ip().ptr; code = jit_get_ip();
if (i == 0) { if (i == 0) {
if (ii == 2) if (ii == 2)
@ -1957,7 +1960,7 @@ static int common4b(mz_jit_state *jitter, void *_data)
/* Slow path: non-struct-prop proc, or argument type is /* Slow path: non-struct-prop proc, or argument type is
bad for a getter. */ bad for a getter. */
refslow = _jit.x.pc; refslow = jit_get_ip();
jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(1)); jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(1));
CHECK_RUNSTACK_OVERFLOW(); CHECK_RUNSTACK_OVERFLOW();
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
@ -1987,7 +1990,7 @@ static int common4b(mz_jit_state *jitter, void *_data)
mz_epilog(JIT_V1); mz_epilog(JIT_V1);
CHECK_LIMIT(); CHECK_LIMIT();
if (i == 2) { if (i == 2) {
refno = _jit.x.pc; refno = jit_get_ip();
(void)jit_movi_p(JIT_R0, scheme_false); (void)jit_movi_p(JIT_R0, scheme_false);
mz_epilog(JIT_V1); mz_epilog(JIT_V1);
CHECK_LIMIT(); CHECK_LIMIT();
@ -2028,7 +2031,7 @@ static int common4b(mz_jit_state *jitter, void *_data)
if (i == 2) { if (i == 2) {
(void)jit_blei_i(refslow, JIT_V1, 0); (void)jit_blei_i(refslow, JIT_V1, 0);
} }
refloop = _jit.x.pc; refloop = jit_get_ip();
(void)jit_blei_i(refno, JIT_V1, 0); (void)jit_blei_i(refno, JIT_V1, 0);
jit_subi_i(JIT_V1, JIT_V1, 1); jit_subi_i(JIT_V1, JIT_V1, 1);
mz_set_local_p(JIT_V1, JIT_LOCAL3); mz_set_local_p(JIT_V1, JIT_LOCAL3);
@ -2097,7 +2100,7 @@ static int common4c(mz_jit_state *jitter, void *_data)
void *code; void *code;
int num_args; int num_args;
code = jit_get_ip().ptr; code = jit_get_ip();
if (i == 0) { if (i == 0) {
if (ii == 2) if (ii == 2)
@ -2151,14 +2154,14 @@ static int common5(mz_jit_state *jitter, void *_data)
/* *** retry_alloc_code[{_keep_r0_r1,_keep_fpr1}] *** */ /* *** retry_alloc_code[{_keep_r0_r1,_keep_fpr1}] *** */
for (i = 0; i < END_OF_I; i++) { for (i = 0; i < END_OF_I; i++) {
if (!i) if (!i)
sjc.retry_alloc_code = jit_get_ip().ptr; sjc.retry_alloc_code = jit_get_ip();
else if (i == 1) else if (i == 1)
sjc.retry_alloc_code_keep_r0_r1 = jit_get_ip().ptr; sjc.retry_alloc_code_keep_r0_r1 = jit_get_ip();
else if (i == 2) else if (i == 2)
sjc.retry_alloc_code_keep_fpr1 = jit_get_ip().ptr; sjc.retry_alloc_code_keep_fpr1 = jit_get_ip();
#ifdef MZ_LONG_DOUBLE #ifdef MZ_LONG_DOUBLE
else if (i == 3) else if (i == 3)
sjc.retry_alloc_code_keep_extfpr1 = jit_get_ip().ptr; sjc.retry_alloc_code_keep_extfpr1 = jit_get_ip();
#endif #endif
mz_prolog(JIT_V1); mz_prolog(JIT_V1);
@ -2176,9 +2179,9 @@ static int common5(mz_jit_state *jitter, void *_data)
GC_CAN_IGNORE jit_insn *ref, *refnext; GC_CAN_IGNORE jit_insn *ref, *refnext;
if (i == 0) if (i == 0)
sjc.make_list_code = jit_get_ip().ptr; sjc.make_list_code = jit_get_ip();
else else
sjc.make_list_star_code = jit_get_ip().ptr; sjc.make_list_star_code = jit_get_ip();
mz_prolog(JIT_R1); mz_prolog(JIT_R1);
jit_lshi_l(JIT_R2, JIT_R2, JIT_LOG_WORD_SIZE); jit_lshi_l(JIT_R2, JIT_R2, JIT_LOG_WORD_SIZE);
if (i == 0) if (i == 0)
@ -2190,7 +2193,7 @@ static int common5(mz_jit_state *jitter, void *_data)
__START_SHORT_JUMPS__(1); __START_SHORT_JUMPS__(1);
ref = jit_beqi_l(jit_forward(), JIT_R2, 0); ref = jit_beqi_l(jit_forward(), JIT_R2, 0);
refnext = _jit.x.pc; refnext = jit_get_ip();
__END_SHORT_JUMPS__(1); __END_SHORT_JUMPS__(1);
CHECK_LIMIT(); CHECK_LIMIT();
@ -2215,7 +2218,7 @@ static int common5(mz_jit_state *jitter, void *_data)
/* *** box_flonum_from_stack_code *** */ /* *** box_flonum_from_stack_code *** */
/* R0 has offset from frame pointer to double on stack */ /* R0 has offset from frame pointer to double on stack */
{ {
sjc.box_flonum_from_stack_code = jit_get_ip().ptr; sjc.box_flonum_from_stack_code = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
@ -2232,7 +2235,7 @@ static int common5(mz_jit_state *jitter, void *_data)
/* *** box_flonum_from_reg_code *** */ /* *** box_flonum_from_reg_code *** */
/* JIT_FPR2 (reg-based) or JIT_FPR0 (stack-based) has value */ /* JIT_FPR2 (reg-based) or JIT_FPR0 (stack-based) has value */
{ {
sjc.box_flonum_from_reg_code = jit_get_ip().ptr; sjc.box_flonum_from_reg_code = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
@ -2252,7 +2255,7 @@ static int common5(mz_jit_state *jitter, void *_data)
/* *** box_extflonum_from_stack_code *** */ /* *** box_extflonum_from_stack_code *** */
/* R0 has offset from frame pointer to long double on stack */ /* R0 has offset from frame pointer to long double on stack */
{ {
sjc.box_extflonum_from_stack_code = jit_get_ip().ptr; sjc.box_extflonum_from_stack_code = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
@ -2269,7 +2272,7 @@ static int common5(mz_jit_state *jitter, void *_data)
/* *** box_extflonum_from_reg_code *** */ /* *** box_extflonum_from_reg_code *** */
/* JIT_FPU_FPR2 (reg-based) or JIT_FPU_FPR0 (stack-based) has value */ /* JIT_FPU_FPR2 (reg-based) or JIT_FPU_FPR0 (stack-based) has value */
{ {
sjc.box_extflonum_from_reg_code = jit_get_ip().ptr; sjc.box_extflonum_from_reg_code = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
@ -2285,7 +2288,7 @@ static int common5(mz_jit_state *jitter, void *_data)
/* *** fl1_fail_code *** */ /* *** fl1_fail_code *** */
/* R0 has argument, V1 has primitive proc */ /* R0 has argument, V1 has primitive proc */
for (iii = 0; iii < JIT_NUM_FL_KINDS; iii++) { for (iii = 0; iii < JIT_NUM_FL_KINDS; iii++) {
sjc.fl1_fail_code[iii] = jit_get_ip().ptr; sjc.fl1_fail_code[iii] = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
@ -2316,7 +2319,7 @@ static int common5(mz_jit_state *jitter, void *_data)
void *code; void *code;
int a0, a1; int a0, a1;
code = jit_get_ip().ptr; code = jit_get_ip();
switch (i) { switch (i) {
case 0: case 0:
sjc.fl2rr_fail_code[ii][iii] = code; sjc.fl2rr_fail_code[ii][iii] = code;
@ -2388,14 +2391,14 @@ static int common6(mz_jit_state *jitter, void *_data)
{ {
GC_CAN_IGNORE jit_insn *refloop, *ref, *ref2, *ref3, *ref4, *ref5, *ref7, *ref8; GC_CAN_IGNORE jit_insn *refloop, *ref, *ref2, *ref3, *ref4, *ref5, *ref7, *ref8;
sjc.wcm_code = jit_get_ip().ptr; sjc.wcm_code = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
(void)mz_tl_ldi_p(JIT_R2, tl_scheme_current_cont_mark_stack); (void)mz_tl_ldi_p(JIT_R2, tl_scheme_current_cont_mark_stack);
/* R2 has counter for search */ /* R2 has counter for search */
refloop = _jit.x.pc; refloop = jit_get_ip();
(void)mz_tl_ldi_p(JIT_R1, tl_scheme_current_thread); (void)mz_tl_ldi_p(JIT_R1, tl_scheme_current_thread);
jit_ldxi_l(JIT_R0, JIT_R1, &((Scheme_Thread *)0x0)->cont_mark_stack_bottom); jit_ldxi_l(JIT_R0, JIT_R1, &((Scheme_Thread *)0x0)->cont_mark_stack_bottom);
ref = jit_bler_i(jit_forward(), JIT_R2, JIT_R0); /* => double-check meta-continuation */ ref = jit_bler_i(jit_forward(), JIT_R2, JIT_R0); /* => double-check meta-continuation */
@ -2439,14 +2442,14 @@ static int common6(mz_jit_state *jitter, void *_data)
jit_subi_l(JIT_R2, JIT_R2, 2); jit_subi_l(JIT_R2, JIT_R2, 2);
ref = jit_bner_i(jit_forward(), JIT_R2, JIT_R0); /* => try to allocate new slot */ ref = jit_bner_i(jit_forward(), JIT_R2, JIT_R0); /* => try to allocate new slot */
jit_ldxi_p(JIT_R1, JIT_R1, &((Scheme_Thread *)0x0)->meta_continuation); jit_ldxi_p(JIT_R1, JIT_R1, &((Scheme_Thread *)0x0)->meta_continuation);
ref7 = jit_beqi_l(jit_forward(), JIT_R1, NULL); /* => try to allocate new slot */ ref7 = jit_beqi_p(jit_forward(), JIT_R1, NULL); /* => try to allocate new slot */
/* we need to check a meta-continuation... take the slow path. */ /* we need to check a meta-continuation... take the slow path. */
ref8 = jit_jmpi(jit_forward()); ref8 = jit_jmpi(jit_forward());
CHECK_LIMIT(); CHECK_LIMIT();
/* Entry point when we know we're not in non-tail position with respect /* Entry point when we know we're not in non-tail position with respect
to any enclosing wcm: */ to any enclosing wcm: */
sjc.wcm_nontail_code = jit_get_ip().ptr; sjc.wcm_nontail_code = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
/* Try to allocate new slot: */ /* Try to allocate new slot: */
@ -2491,7 +2494,7 @@ static int common6(mz_jit_state *jitter, void *_data)
CHECK_LIMIT(); CHECK_LIMIT();
/* return: */ /* return: */
ref5 = _jit.x.pc; ref5 = jit_get_ip();
mz_epilog(JIT_R2); mz_epilog(JIT_R2);
/* slow path: */ /* slow path: */
@ -2519,7 +2522,7 @@ static int common6(mz_jit_state *jitter, void *_data)
/* key and value are on runstack and are updated there */ /* key and value are on runstack and are updated there */
{ {
GC_CAN_IGNORE jit_insn *ref2; GC_CAN_IGNORE jit_insn *ref2;
sjc.wcm_chaperone = jit_get_ip().ptr; sjc.wcm_chaperone = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
@ -2545,7 +2548,7 @@ static int common7(mz_jit_state *jitter, void *_data)
GC_CAN_IGNORE jit_insn *refloop, *ref1, *ref2, *ref3, *ref4; GC_CAN_IGNORE jit_insn *refloop, *ref1, *ref2, *ref3, *ref4;
GC_CAN_IGNORE jit_insn *ref5, *ref6, *ref7, *ref8; GC_CAN_IGNORE jit_insn *ref5, *ref6, *ref7, *ref8;
code = jit_get_ip().ptr; code = jit_get_ip();
if (!i) if (!i)
sjc.list_p_code = code; sjc.list_p_code = code;
else else
@ -2562,7 +2565,7 @@ static int common7(mz_jit_state *jitter, void *_data)
/* Note: there's no fuel check in this loop, just like there isn't in /* Note: there's no fuel check in this loop, just like there isn't in
scheme_is_list(). */ scheme_is_list(). */
refloop = _jit.x.pc; refloop = jit_get_ip();
jit_ldxi_s(JIT_R2, JIT_R0, &MZ_OPT_HASH_KEY(&((Scheme_Stx *)0x0)->iso)); jit_ldxi_s(JIT_R2, JIT_R0, &MZ_OPT_HASH_KEY(&((Scheme_Stx *)0x0)->iso));
ref1 = jit_bmsi_ul(jit_forward(), JIT_R2, PAIR_FLAG_MASK); ref1 = jit_bmsi_ul(jit_forward(), JIT_R2, PAIR_FLAG_MASK);
@ -2673,7 +2676,7 @@ static int common8(mz_jit_state *jitter, void *_data)
void *code; void *code;
GC_CAN_IGNORE jit_insn *refloop, *ref1, *ref2, *ref3, *ref4, *ref5; GC_CAN_IGNORE jit_insn *refloop, *ref1, *ref2, *ref3, *ref4, *ref5;
code = jit_get_ip().ptr; code = jit_get_ip();
sjc.list_length_code = code; sjc.list_length_code = code;
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
@ -2689,7 +2692,7 @@ static int common8(mz_jit_state *jitter, void *_data)
/* R0 has argument, R1 has counter */ /* R0 has argument, R1 has counter */
jit_movi_l(JIT_R1, 0); jit_movi_l(JIT_R1, 0);
refloop = _jit.x.pc; refloop = jit_get_ip();
ref2 = jit_beqi_p(jit_forward(), JIT_R0, scheme_null); ref2 = jit_beqi_p(jit_forward(), JIT_R0, scheme_null);
ref3 = jit_bmsi_l(jit_forward(), JIT_R0, 0x1); ref3 = jit_bmsi_l(jit_forward(), JIT_R0, 0x1);
@ -2710,7 +2713,7 @@ static int common8(mz_jit_state *jitter, void *_data)
mz_patch_branch(ref2); mz_patch_branch(ref2);
__END_SHORT_JUMPS__(1); __END_SHORT_JUMPS__(1);
jit_fixnum_l(JIT_R0, JIT_R1); jit_fixnum_l(JIT_R0, JIT_R1);
ref1 = _jit.x.pc; ref1 = jit_get_ip();
mz_epilog(JIT_R2); mz_epilog(JIT_R2);
__START_SHORT_JUMPS__(1); __START_SHORT_JUMPS__(1);
@ -2747,7 +2750,7 @@ static int common8_5(mz_jit_state *jitter, void *_data)
GC_CAN_IGNORE jit_insn *refslow, *refloop, *refdone, *ref, *refr; GC_CAN_IGNORE jit_insn *refslow, *refloop, *refdone, *ref, *refr;
GC_CAN_IGNORE jit_insn *refmaybedone, *refresume; GC_CAN_IGNORE jit_insn *refmaybedone, *refresume;
code = jit_get_ip().ptr; code = jit_get_ip();
if (i == 0) if (i == 0)
sjc.list_tail_code = code; sjc.list_tail_code = code;
else else
@ -2763,7 +2766,7 @@ static int common8_5(mz_jit_state *jitter, void *_data)
ref = jit_bmsi_l(jit_forward(), JIT_R1, 0x1); ref = jit_bmsi_l(jit_forward(), JIT_R1, 0x1);
refslow = _jit.x.pc; refslow = jit_get_ip();
jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(2)); jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(2));
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
@ -2794,10 +2797,10 @@ static int common8_5(mz_jit_state *jitter, void *_data)
jit_rshi_l(JIT_R1, JIT_R1, 1); jit_rshi_l(JIT_R1, JIT_R1, 1);
(void)jit_blti_l(refslow, JIT_R1, 0); (void)jit_blti_l(refslow, JIT_R1, 0);
refloop = _jit.x.pc; refloop = jit_get_ip();
if (i == 0) { if (i == 0) {
refmaybedone = jit_bmci_l(jit_forward(), JIT_R1, 0xFFF); refmaybedone = jit_bmci_l(jit_forward(), JIT_R1, 0xFFF);
refresume = _jit.x.pc; refresume = jit_get_ip();
} else { } else {
refmaybedone = NULL; refmaybedone = NULL;
refresume = NULL; refresume = NULL;
@ -2806,7 +2809,7 @@ static int common8_5(mz_jit_state *jitter, void *_data)
(void)mz_bnei_t(refslow, JIT_R0, scheme_pair_type, JIT_R2); (void)mz_bnei_t(refslow, JIT_R0, scheme_pair_type, JIT_R2);
if (i == 1) { if (i == 1) {
refmaybedone = jit_bmci_l(jit_forward(), JIT_R1, 0xFFF); refmaybedone = jit_bmci_l(jit_forward(), JIT_R1, 0xFFF);
refresume = _jit.x.pc; refresume = jit_get_ip();
} }
jit_subi_l(JIT_R1, JIT_R1, 1); jit_subi_l(JIT_R1, JIT_R1, 1);
jit_ldxi_p(JIT_R0, JIT_R0, (intptr_t)&SCHEME_CDR(0x0)); jit_ldxi_p(JIT_R0, JIT_R0, (intptr_t)&SCHEME_CDR(0x0));
@ -2848,7 +2851,7 @@ static int common9(mz_jit_state *jitter, void *_data)
void *code; void *code;
GC_CAN_IGNORE jit_insn *ref; GC_CAN_IGNORE jit_insn *ref;
code = jit_get_ip().ptr; code = jit_get_ip();
if (i == 0) if (i == 0)
sjc.eqv_code = code; sjc.eqv_code = code;
else else
@ -2902,7 +2905,7 @@ static int common10(mz_jit_state *jitter, void *_data)
{ {
GC_CAN_IGNORE jit_insn *ref, *refslow, *refr ,*ref_nc, *ref_prim, *refno; GC_CAN_IGNORE jit_insn *ref, *refslow, *refr ,*ref_nc, *ref_prim, *refno;
sjc.proc_arity_includes_code = jit_get_ip().ptr; sjc.proc_arity_includes_code = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
@ -2910,7 +2913,7 @@ static int common10(mz_jit_state *jitter, void *_data)
ref = jit_bmsi_l(jit_forward(), JIT_R1, 0x1); ref = jit_bmsi_l(jit_forward(), JIT_R1, 0x1);
refslow = _jit.x.pc; refslow = jit_get_ip();
jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(2)); jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(2));
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
@ -2931,7 +2934,7 @@ static int common10(mz_jit_state *jitter, void *_data)
mz_epilog(JIT_R2); mz_epilog(JIT_R2);
refno = _jit.x.pc; refno = jit_get_ip();
(void)jit_movi_p(JIT_R0, scheme_false); (void)jit_movi_p(JIT_R0, scheme_false);
mz_epilog(JIT_R2); mz_epilog(JIT_R2);
@ -3018,7 +3021,7 @@ static int common11(mz_jit_state *jitter, void *_data)
{ {
GC_CAN_IGNORE jit_insn *refr; GC_CAN_IGNORE jit_insn *refr;
sjc.bad_char_to_integer_code = jit_get_ip().ptr; sjc.bad_char_to_integer_code = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
@ -3043,7 +3046,7 @@ static int common11(mz_jit_state *jitter, void *_data)
{ {
GC_CAN_IGNORE jit_insn *refr; GC_CAN_IGNORE jit_insn *refr;
sjc.slow_integer_to_char_code = jit_get_ip().ptr; sjc.slow_integer_to_char_code = jit_get_ip();
mz_prolog(JIT_R2); mz_prolog(JIT_R2);
@ -3097,7 +3100,7 @@ static int more_common0(mz_jit_state *jitter, void *_data)
{ {
GC_CAN_IGNORE jit_insn *ref, *ref2, *ref3, *refslow, *refrts; GC_CAN_IGNORE jit_insn *ref, *ref2, *ref3, *refslow, *refrts;
sjc.struct_proc_extract_code = jit_get_ip().ptr; sjc.struct_proc_extract_code = jit_get_ip();
mz_prolog(JIT_V1); mz_prolog(JIT_V1);
__START_SHORT_JUMPS__(1); __START_SHORT_JUMPS__(1);
@ -3107,7 +3110,7 @@ static int more_common0(mz_jit_state *jitter, void *_data)
CHECK_LIMIT(); CHECK_LIMIT();
/* Slow path: call C implementation */ /* Slow path: call C implementation */
refslow = _jit.x.pc; refslow = jit_get_ip();
JIT_UPDATE_THREAD_RSPTR(); JIT_UPDATE_THREAD_RSPTR();
jit_movi_i(JIT_V1, 5); jit_movi_i(JIT_V1, 5);
jit_prepare(2); jit_prepare(2);
@ -3204,7 +3207,7 @@ static int more_common0(mz_jit_state *jitter, void *_data)
{ {
int in; int in;
sjc.module_run_start_code = jit_get_ip().ptr; sjc.module_run_start_code = jit_get_ip();
jit_prolog(3); jit_prolog(3);
in = jit_arg_p(); in = jit_arg_p();
jit_getarg_p(JIT_R0, in); /* menv */ jit_getarg_p(JIT_R0, in); /* menv */
@ -3235,7 +3238,7 @@ static int more_common0(mz_jit_state *jitter, void *_data)
{ {
int in; int in;
sjc.module_exprun_start_code = jit_get_ip().ptr; sjc.module_exprun_start_code = jit_get_ip();
jit_prolog(3); jit_prolog(3);
in = jit_arg_p(); in = jit_arg_p();
jit_getarg_p(JIT_R0, in); /* menv */ jit_getarg_p(JIT_R0, in); /* menv */
@ -3266,7 +3269,7 @@ static int more_common0(mz_jit_state *jitter, void *_data)
{ {
int in; int in;
sjc.module_start_start_code = jit_get_ip().ptr; sjc.module_start_start_code = jit_get_ip();
jit_prolog(2); jit_prolog(2);
in = jit_arg_p(); in = jit_arg_p();
jit_getarg_p(JIT_R0, in); /* a */ jit_getarg_p(JIT_R0, in); /* a */
@ -3299,7 +3302,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
{ {
GC_CAN_IGNORE jit_insn *ref1, *ref2, *ref3, *ref4, *ref5, *ref6, *refloop; GC_CAN_IGNORE jit_insn *ref1, *ref2, *ref3, *ref4, *ref5, *ref6, *refloop;
sjc.apply_to_list_tail_code = jit_get_ip().ptr; sjc.apply_to_list_tail_code = jit_get_ip();
__START_SHORT_JUMPS__(1); __START_SHORT_JUMPS__(1);
@ -3311,7 +3314,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
CHECK_LIMIT(); CHECK_LIMIT();
/* check that it's a list and get the length */ /* check that it's a list and get the length */
refloop = _jit.x.pc; refloop = jit_get_ip();
__START_INNER_TINY__(1); __START_INNER_TINY__(1);
ref2 = jit_beqi_p(jit_forward(), JIT_R0, scheme_null); ref2 = jit_beqi_p(jit_forward(), JIT_R0, scheme_null);
__END_INNER_TINY__(1); __END_INNER_TINY__(1);
@ -3365,7 +3368,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
jit_addr_l(JIT_R2, JIT_R2, JIT_R0); /* move R2 and RUNSTACK pointers to end instead of start */ jit_addr_l(JIT_R2, JIT_R2, JIT_R0); /* move R2 and RUNSTACK pointers to end instead of start */
jit_addr_l(JIT_RUNSTACK, JIT_RUNSTACK, JIT_R0); jit_addr_l(JIT_RUNSTACK, JIT_RUNSTACK, JIT_R0);
jit_negr_l(JIT_R0, JIT_R0); /* negate counter */ jit_negr_l(JIT_R0, JIT_R0); /* negate counter */
refloop = _jit.x.pc; refloop = jit_get_ip();
jit_ldxr_p(JIT_R1, JIT_RUNSTACK, JIT_R0); jit_ldxr_p(JIT_R1, JIT_RUNSTACK, JIT_R0);
jit_stxr_p(JIT_R0, JIT_R2, JIT_R1); jit_stxr_p(JIT_R0, JIT_R2, JIT_R1);
jit_addi_l(JIT_R0, JIT_R0, JIT_WORD_SIZE); jit_addi_l(JIT_R0, JIT_R0, JIT_WORD_SIZE);
@ -3383,7 +3386,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
mz_patch_branch(ref6); mz_patch_branch(ref6);
jit_subi_l(JIT_R0, JIT_V1, 1); /* drop last arg */ jit_subi_l(JIT_R0, JIT_V1, 1); /* drop last arg */
jit_lshi_ul(JIT_R0, JIT_R0, JIT_LOG_WORD_SIZE); jit_lshi_ul(JIT_R0, JIT_R0, JIT_LOG_WORD_SIZE);
refloop = _jit.x.pc; refloop = jit_get_ip();
jit_subi_l(JIT_R0, JIT_R0, JIT_WORD_SIZE); jit_subi_l(JIT_R0, JIT_R0, JIT_WORD_SIZE);
jit_ldxr_p(JIT_R1, JIT_RUNSTACK, JIT_R0); jit_ldxr_p(JIT_R1, JIT_RUNSTACK, JIT_R0);
jit_stxr_p(JIT_R0, JIT_R2, JIT_R1); jit_stxr_p(JIT_R0, JIT_R2, JIT_R1);
@ -3400,7 +3403,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
mz_get_local_p(JIT_R0, JIT_LOCAL2); /* list in R0 */ mz_get_local_p(JIT_R0, JIT_LOCAL2); /* list in R0 */
jit_subi_l(JIT_R1, JIT_V1, 1); /* drop last original arg */ jit_subi_l(JIT_R1, JIT_V1, 1); /* drop last original arg */
jit_lshi_ul(JIT_R1, JIT_R1, JIT_LOG_WORD_SIZE); jit_lshi_ul(JIT_R1, JIT_R1, JIT_LOG_WORD_SIZE);
refloop = _jit.x.pc; refloop = jit_get_ip();
__START_INNER_TINY__(1); __START_INNER_TINY__(1);
ref6 = jit_beqi_p(jit_forward(), JIT_R0, scheme_null); ref6 = jit_beqi_p(jit_forward(), JIT_R0, scheme_null);
__END_INNER_TINY__(1); __END_INNER_TINY__(1);
@ -3437,7 +3440,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
mz_ld_runstack_base_alt(JIT_R2); mz_ld_runstack_base_alt(JIT_R2);
jit_lshi_ul(JIT_R0, JIT_V1, JIT_LOG_WORD_SIZE); jit_lshi_ul(JIT_R0, JIT_V1, JIT_LOG_WORD_SIZE);
jit_subr_p(JIT_R2, JIT_RUNSTACK_BASE_OR_ALT(JIT_R2), JIT_R0); jit_subr_p(JIT_R2, JIT_RUNSTACK_BASE_OR_ALT(JIT_R2), JIT_R0);
refloop = _jit.x.pc; refloop = jit_get_ip();
jit_subi_l(JIT_R0, JIT_R0, JIT_WORD_SIZE); jit_subi_l(JIT_R0, JIT_R0, JIT_WORD_SIZE);
jit_ldxr_p(JIT_R1, JIT_RUNSTACK, JIT_R0); jit_ldxr_p(JIT_R1, JIT_RUNSTACK, JIT_R0);
jit_stxr_p(JIT_R0, JIT_R2, JIT_R1); jit_stxr_p(JIT_R0, JIT_R2, JIT_R1);
@ -3468,7 +3471,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
void *code; void *code;
for (multi_ok = 0; multi_ok < 2; multi_ok++) { for (multi_ok = 0; multi_ok < 2; multi_ok++) {
code = jit_get_ip().ptr; code = jit_get_ip();
if (multi_ok) if (multi_ok)
sjc.apply_to_list_multi_ok_code = code; sjc.apply_to_list_multi_ok_code = code;
else else
@ -3487,7 +3490,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
/* check that it's a list and get the length */ /* check that it's a list and get the length */
refloop = _jit.x.pc; refloop = jit_get_ip();
__START_INNER_TINY__(1); __START_INNER_TINY__(1);
ref2 = jit_beqi_p(jit_forward(), JIT_R0, scheme_null); ref2 = jit_beqi_p(jit_forward(), JIT_R0, scheme_null);
__END_INNER_TINY__(1); __END_INNER_TINY__(1);
@ -3523,7 +3526,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
jit_subi_l(JIT_R0, JIT_V1, 2); /* drop first and last arg */ jit_subi_l(JIT_R0, JIT_V1, 2); /* drop first and last arg */
jit_lshi_ul(JIT_R0, JIT_R0, JIT_LOG_WORD_SIZE); jit_lshi_ul(JIT_R0, JIT_R0, JIT_LOG_WORD_SIZE);
jit_addi_p(JIT_RUNSTACK, JIT_RUNSTACK, JIT_WORD_SIZE); /* skip first arg */ jit_addi_p(JIT_RUNSTACK, JIT_RUNSTACK, JIT_WORD_SIZE); /* skip first arg */
refloop = _jit.x.pc; refloop = jit_get_ip();
jit_subi_l(JIT_R0, JIT_R0, JIT_WORD_SIZE); jit_subi_l(JIT_R0, JIT_R0, JIT_WORD_SIZE);
jit_ldxr_p(JIT_R1, JIT_RUNSTACK, JIT_R0); jit_ldxr_p(JIT_R1, JIT_RUNSTACK, JIT_R0);
jit_stxr_p(JIT_R0, JIT_R2, JIT_R1); jit_stxr_p(JIT_R0, JIT_R2, JIT_R1);
@ -3546,7 +3549,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
jit_subi_l(JIT_R1, JIT_V1, 2); /* drop first and last original arg */ jit_subi_l(JIT_R1, JIT_V1, 2); /* drop first and last original arg */
jit_lshi_ul(JIT_R1, JIT_R1, JIT_LOG_WORD_SIZE); jit_lshi_ul(JIT_R1, JIT_R1, JIT_LOG_WORD_SIZE);
refloop = _jit.x.pc; refloop = jit_get_ip();
__START_INNER_TINY__(1); __START_INNER_TINY__(1);
ref6 = jit_beqi_p(jit_forward(), JIT_R0, scheme_null); ref6 = jit_beqi_p(jit_forward(), JIT_R0, scheme_null);
__END_INNER_TINY__(1); __END_INNER_TINY__(1);
@ -3582,7 +3585,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
wants to pop N arguments. */ wants to pop N arguments. */
jit_lshi_ul(JIT_R0, JIT_V1, JIT_LOG_WORD_SIZE); jit_lshi_ul(JIT_R0, JIT_V1, JIT_LOG_WORD_SIZE);
jit_subr_p(JIT_R2, JIT_RUNSTACK, JIT_R0); jit_subr_p(JIT_R2, JIT_RUNSTACK, JIT_R0);
refloop = _jit.x.pc; refloop = jit_get_ip();
jit_subi_l(JIT_R0, JIT_R0, JIT_WORD_SIZE); jit_subi_l(JIT_R0, JIT_R0, JIT_WORD_SIZE);
jit_ldxr_p(JIT_R1, JIT_RUNSTACK, JIT_R0); jit_ldxr_p(JIT_R1, JIT_RUNSTACK, JIT_R0);
jit_stxr_p(JIT_R0, JIT_R2, JIT_R1); jit_stxr_p(JIT_R0, JIT_R2, JIT_R1);
@ -3610,7 +3613,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
#ifdef MZ_USE_LWC #ifdef MZ_USE_LWC
/* native_starter_code */ /* native_starter_code */
{ {
sjc.native_starter_code = (LWC_Native_Starter)jit_get_ip().ptr; sjc.native_starter_code = (LWC_Native_Starter)jit_get_ip();
/* store stack pointer in address given by 5th argument, then jump to /* store stack pointer in address given by 5th argument, then jump to
the address given by the 4th argument */ the address given by the 4th argument */
@ -3626,7 +3629,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
{ {
int in; int in;
sjc.continuation_apply_indirect_code = (Continuation_Apply_Indirect)jit_get_ip().ptr; sjc.continuation_apply_indirect_code = (Continuation_Apply_Indirect)jit_get_ip();
/* install stack pointer into first argument before doing anything */ /* install stack pointer into first argument before doing anything */
jit_getprearg__p(JIT_PREARG); jit_getprearg__p(JIT_PREARG);
@ -3667,7 +3670,7 @@ static int more_common1(mz_jit_state *jitter, void *_data)
{ {
int in; int in;
sjc.continuation_apply_finish_code = (Continuation_Apply_Finish)jit_get_ip().ptr; sjc.continuation_apply_finish_code = (Continuation_Apply_Finish)jit_get_ip();
jit_prolog(2); jit_prolog(2);
in = jit_arg_p(); in = jit_arg_p();

View File

@ -412,7 +412,7 @@ static int generate_inlined_struct_op(int kind, mz_jit_state *jitter,
if (inline_rator && (kind != INLINE_STRUCT_PROC_PRED)) { if (inline_rator && (kind != INLINE_STRUCT_PROC_PRED)) {
__START_SHORT_JUMPS__(1); __START_SHORT_JUMPS__(1);
ref = jit_bmci_ul(jit_forward(), JIT_R1, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R1, 0x1);
refslow = _jit.x.pc; refslow = jit_get_ip();
if (kind == INLINE_STRUCT_PROC_SET) if (kind == INLINE_STRUCT_PROC_SET)
scheme_restore_struct_temp(jitter, JIT_V1); scheme_restore_struct_temp(jitter, JIT_V1);
__END_SHORT_JUMPS__(1); __END_SHORT_JUMPS__(1);
@ -662,7 +662,7 @@ int scheme_generate_struct_alloc(mz_jit_state *jitter, int num_args,
/* Slow path: non-struct-prop proc, or argument type is /* Slow path: non-struct-prop proc, or argument type is
bad for a getter. */ bad for a getter. */
refslow = _jit.x.pc; refslow = jit_get_ip();
if (inline_slow) { if (inline_slow) {
if (num_args == 1) { if (num_args == 1) {
jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(1)); jit_subi_p(JIT_RUNSTACK, JIT_RUNSTACK, WORDS_TO_BYTES(1));
@ -1224,7 +1224,7 @@ int scheme_generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in
if (!sjc.skip_checks) { if (!sjc.skip_checks) {
if (!i) { if (!i) {
ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1);
reffail = _jit.x.pc; reffail = jit_get_ip();
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
if (steps == 1) { if (steps == 1) {
if (name[1] == 'a') { if (name[1] == 'a') {
@ -1289,7 +1289,7 @@ int scheme_generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1);
reffail = _jit.x.pc; reffail = jit_get_ip();
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
if (name[2] == 'a') { if (name[2] == 'a') {
(void)jit_calli(sjc.bad_mcar_code); (void)jit_calli(sjc.bad_mcar_code);
@ -1398,7 +1398,7 @@ int scheme_generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in
ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1);
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
reffail = _jit.x.pc; reffail = jit_get_ip();
if (for_fl) { if (for_fl) {
MZ_FPUSEL_STMT(extfl, MZ_FPUSEL_STMT(extfl,
(void)jit_calli(sjc.bad_extflvector_length_code), (void)jit_calli(sjc.bad_extflvector_length_code),
@ -1477,7 +1477,7 @@ int scheme_generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in
ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1);
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
reffail = _jit.x.pc; reffail = jit_get_ip();
(void)jit_calli(sjc.unbox_code); (void)jit_calli(sjc.unbox_code);
jit_movr_p(dest, JIT_R0); jit_movr_p(dest, JIT_R0);
@ -1580,7 +1580,7 @@ int scheme_generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1);
reffail = _jit.x.pc; reffail = jit_get_ip();
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
if (name[0] == 'i') { if (name[0] == 'i') {
(void)jit_calli(sjc.imag_part_code); (void)jit_calli(sjc.imag_part_code);
@ -1842,7 +1842,7 @@ int scheme_generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1);
reffail = _jit.x.pc; reffail = jit_get_ip();
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
(void)jit_calli(sjc.bad_char_to_integer_code); (void)jit_calli(sjc.bad_char_to_integer_code);
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
@ -1869,14 +1869,14 @@ int scheme_generate_inlined_unary(mz_jit_state *jitter, Scheme_App2_Rec *app, in
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
ref = jit_bmsi_ul(jit_forward(), JIT_R0, 0x1); ref = jit_bmsi_ul(jit_forward(), JIT_R0, 0x1);
refslow = _jit.x.pc; refslow = jit_get_ip();
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
(void)jit_calli(sjc.slow_integer_to_char_code); (void)jit_calli(sjc.slow_integer_to_char_code);
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
refdone = jit_jmpi(jit_forward()); refdone = jit_jmpi(jit_forward());
mz_patch_branch(ref); mz_patch_branch(ref);
(void)jit_blti_l(refslow, JIT_R0, scheme_make_integer(0)); (void)jit_blti_p(refslow, JIT_R0, scheme_make_integer(0));
(void)jit_bgti_l(refslow, JIT_R0, scheme_make_integer(255)); (void)jit_bgti_p(refslow, JIT_R0, scheme_make_integer(255));
jit_rshi_l(JIT_R0, JIT_R0, 1); jit_rshi_l(JIT_R0, JIT_R0, 1);
jit_lshi_l(JIT_R2, JIT_R0, JIT_LOG_WORD_SIZE); jit_lshi_l(JIT_R2, JIT_R0, JIT_LOG_WORD_SIZE);
@ -2077,7 +2077,7 @@ static int generate_binary_char(mz_jit_state *jitter, Scheme_App3_Rec *app,
if (!SCHEME_CHARP(r1)) { if (!SCHEME_CHARP(r1)) {
GC_CAN_IGNORE jit_insn *pref; GC_CAN_IGNORE jit_insn *pref;
pref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); pref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1);
reffail = _jit.x.pc; reffail = jit_get_ip();
(void)jit_movi_p(JIT_R2, ((Scheme_Primitive_Proc *)rator)->prim_val); (void)jit_movi_p(JIT_R2, ((Scheme_Primitive_Proc *)rator)->prim_val);
__END_SHORT_JUMPS__(branch_short); __END_SHORT_JUMPS__(branch_short);
if (direction > 0) { if (direction > 0) {
@ -2097,7 +2097,7 @@ static int generate_binary_char(mz_jit_state *jitter, Scheme_App3_Rec *app,
if (!reffail) { if (!reffail) {
GC_CAN_IGNORE jit_insn *pref; GC_CAN_IGNORE jit_insn *pref;
pref = jit_bmci_ul(jit_forward(), JIT_R1, 0x1); pref = jit_bmci_ul(jit_forward(), JIT_R1, 0x1);
reffail = _jit.x.pc; reffail = jit_get_ip();
(void)jit_movi_p(JIT_R2, ((Scheme_Primitive_Proc *)rator)->prim_val); (void)jit_movi_p(JIT_R2, ((Scheme_Primitive_Proc *)rator)->prim_val);
__END_SHORT_JUMPS__(branch_short); __END_SHORT_JUMPS__(branch_short);
if (direction > 0) { if (direction > 0) {
@ -2174,7 +2174,7 @@ static int generate_vector_op(mz_jit_state *jitter, int set, int int_ready, int
} }
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
reffail = _jit.x.pc; reffail = jit_get_ip();
if (int_ready) { if (int_ready) {
jit_fixnum_l(JIT_R1, JIT_R1); jit_fixnum_l(JIT_R1, JIT_R1);
} }
@ -3024,7 +3024,7 @@ int scheme_generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i
offset = SCHEME_INT_VAL(app->rand2); offset = SCHEME_INT_VAL(app->rand2);
if (!unsafe || can_chaperone) if (!unsafe || can_chaperone)
(void)jit_movi_p(JIT_R1, offset); (void)jit_movi_l(JIT_R1, offset);
if (!which) if (!which)
offset = base_offset + WORDS_TO_BYTES(offset); offset = base_offset + WORDS_TO_BYTES(offset);
else if (which == 3) else if (which == 3)
@ -3208,7 +3208,7 @@ int scheme_generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1);
reffail = _jit.x.pc; reffail = jit_get_ip();
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
if (set_mcar) if (set_mcar)
(void)jit_calli(sjc.bad_set_mcar_code); (void)jit_calli(sjc.bad_set_mcar_code);
@ -3268,7 +3268,7 @@ int scheme_generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i
ref = mz_beqi_t(jit_forward(), JIT_R0, scheme_box_type, JIT_R2); ref = mz_beqi_t(jit_forward(), JIT_R0, scheme_box_type, JIT_R2);
if (ref3) if (ref3)
mz_patch_branch(ref3); mz_patch_branch(ref3);
reffail = _jit.x.pc; reffail = jit_get_ip();
(void)jit_calli(sjc.set_box_code); (void)jit_calli(sjc.set_box_code);
ref2 = jit_jmpi(jit_forward()); ref2 = jit_jmpi(jit_forward());
mz_patch_branch(ref); mz_patch_branch(ref);
@ -3395,7 +3395,7 @@ int scheme_generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i
jit_ldxi_s(JIT_R2, JIT_R0, &((Scheme_Object *)0x0)->type); jit_ldxi_s(JIT_R2, JIT_R0, &((Scheme_Object *)0x0)->type);
ref2 = jit_bgei_i(jit_forward(), JIT_R2, scheme_bignum_type); ref2 = jit_bgei_i(jit_forward(), JIT_R2, scheme_bignum_type);
/* (slow path) */ /* (slow path) */
refslow = _jit.x.pc; refslow = jit_get_ip();
(void)jit_calli(sjc.make_rectangular_code); (void)jit_calli(sjc.make_rectangular_code);
jit_retval(dest); jit_retval(dest);
CHECK_LIMIT(); CHECK_LIMIT();
@ -3446,7 +3446,7 @@ int scheme_generate_inlined_binary(mz_jit_state *jitter, Scheme_App3_Rec *app, i
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R0, 0x1);
refslow = _jit.x.pc; refslow = jit_get_ip();
(void)jit_calli(sjc.bad_make_flrectangular_code); (void)jit_calli(sjc.bad_make_flrectangular_code);
mz_patch_branch(ref); mz_patch_branch(ref);
(void)mz_bnei_t(refslow, JIT_R0, scheme_double_type, JIT_R2); (void)mz_bnei_t(refslow, JIT_R0, scheme_double_type, JIT_R2);
@ -3604,7 +3604,7 @@ int scheme_generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int
__START_TINY_JUMPS__(1); __START_TINY_JUMPS__(1);
/* Fail if this isn't a pointer (0x1 is the integer tag) */ /* Fail if this isn't a pointer (0x1 is the integer tag) */
ref = jit_bmci_ul(jit_forward(), JIT_R1, 0x1); ref = jit_bmci_ul(jit_forward(), JIT_R1, 0x1);
reffail = _jit.x.pc; reffail = jit_get_ip();
__END_TINY_JUMPS__(1); __END_TINY_JUMPS__(1);
(void)jit_calli(sjc.box_cas_fail_code); (void)jit_calli(sjc.box_cas_fail_code);
@ -3643,7 +3643,7 @@ int scheme_generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int
#ifdef MZ_USE_FUTURES #ifdef MZ_USE_FUTURES
if (scheme_is_multithreaded(0)) { if (scheme_is_multithreaded(0)) {
jit_lock_cmpxchgr_l(JIT_R1, JIT_V1); /* implicitly uses JIT_R0 */ jit_lock_cmpxchgr_l(JIT_R1, JIT_V1); /* implicitly uses JIT_R0 */
reffalse = (JNEm(jit_forward(), 0,0,0), _jit.x.pc); reffalse = (JNEm(jit_forward(), 0,0,0), jit_get_ip());
} else } else
#endif #endif
{ {
@ -3941,7 +3941,7 @@ int scheme_generate_inlined_nary(mz_jit_state *jitter, Scheme_App_Rec *app, int
} else { } else {
intptr_t offset; intptr_t offset;
offset = SCHEME_INT_VAL(app->args[2]); offset = SCHEME_INT_VAL(app->args[2]);
(void)jit_movi_p(JIT_R1, offset); (void)jit_movi_l(JIT_R1, offset);
if (!which) if (!which)
offset = base_offset + WORDS_TO_BYTES(offset); offset = base_offset + WORDS_TO_BYTES(offset);
else if (which == 3) else if (which == 3)

View File

@ -58,6 +58,7 @@ void scheme_register_stack_cache_stack(void)
typedef void *(*Get_Stack_Proc)(); typedef void *(*Get_Stack_Proc)();
#ifdef MZ_USE_JIT_PPC #ifdef MZ_USE_JIT_PPC
# define NEXT_FRAME_OFFSET 0
# ifdef _CALL_DARWIN # ifdef _CALL_DARWIN
# define RETURN_ADDRESS_OFFSET 2 # define RETURN_ADDRESS_OFFSET 2
# else # else
@ -65,8 +66,13 @@ typedef void *(*Get_Stack_Proc)();
# endif # endif
#endif #endif
#ifdef MZ_USE_JIT_I386 #ifdef MZ_USE_JIT_I386
# define NEXT_FRAME_OFFSET 0
# define RETURN_ADDRESS_OFFSET 1 # define RETURN_ADDRESS_OFFSET 1
#endif #endif
#ifdef MZ_USE_JIT_ARM
# define NEXT_FRAME_OFFSET JIT_NEXT_FP_OFFSET
# define RETURN_ADDRESS_OFFSET (JIT_NEXT_FP_OFFSET+1)
#endif
#define CACHE_STACK_MIN_TRIGGER 128 #define CACHE_STACK_MIN_TRIGGER 128
@ -109,7 +115,7 @@ static void check_stack(void)
} }
} }
q = *(void **)p; q = ((void **)p)[NEXT_FRAME_OFFSET];
if (STK_COMP((uintptr_t)q, (uintptr_t)p)) if (STK_COMP((uintptr_t)q, (uintptr_t)p))
break; break;
p = q; p = q;
@ -330,23 +336,31 @@ Scheme_Object *scheme_native_stack_trace(void)
name = find_symbol((uintptr_t)q); name = find_symbol((uintptr_t)q);
#ifdef MZ_USE_DWARF_LIBUNWIND #ifdef MZ_USE_DWARF_LIBUNWIND
if (name) manual_unw = 1; if (name && !manual_unw) {
manual_unw = 1;
# ifdef MZ_USE_JIT_ARM
use_unw = 0;
p = (void *)unw_get_frame_pointer(&c);
if (!(STK_COMP((uintptr_t)p, stack_end)
&& STK_COMP(stack_start, (uintptr_t)p)))
break;
# endif
}
#endif #endif
if (SCHEME_FALSEP(name) || SCHEME_VOIDP(name)) { if (SCHEME_FALSEP(name) || SCHEME_VOIDP(name)) {
/* Code uses special calling convention */ /* Code uses special calling convention */
#ifdef MZ_USE_JIT_PPC #if defined(MZ_USE_JIT_PPC) || defined(MZ_USE_JIT_ARM)
/* JIT_LOCAL2 has the next return address */ /* JIT_LOCAL2 has the next return address */
q = ((void **)p)[JIT_LOCAL2 >> JIT_LOG_WORD_SIZE]; q = ((void **)p)[JIT_LOCAL2 >> JIT_LOG_WORD_SIZE];
#endif #endif
#ifdef MZ_USE_JIT_I386 #ifdef MZ_USE_JIT_I386
# ifdef MZ_USE_DWARF_LIBUNWIND # ifdef MZ_USE_DWARF_LIBUNWIND
if (use_unw) { if (use_unw) {
q = (void *)unw_get_frame_pointer(&c); q = (void *)unw_get_frame_pointer(&c);
} else } else
# endif # endif
q = *(void **)p; q = ((void **)p)[NEXT_FRAME_OFFSET];
/* q is now the frame pointer for the former q, /* q is now the frame pointer for the former q,
so we can find the actual q */ so we can find the actual q */
@ -368,7 +382,7 @@ Scheme_Object *scheme_native_stack_trace(void)
} else if (SCHEME_EOFP(name)) { } else if (SCHEME_EOFP(name)) {
/* Stub (to mark start of running a module body, for example) */ /* Stub (to mark start of running a module body, for example) */
/* JIT_LOCAL2 has the name to use */ /* JIT_LOCAL2 has the name to use */
#ifdef MZ_USE_JIT_PPC #if defined(MZ_USE_JIT_PPC) || defined(MZ_USE_JIT_ARM)
name = *(Scheme_Object **)((void **)p)[JIT_LOCAL2 >> JIT_LOG_WORD_SIZE]; name = *(Scheme_Object **)((void **)p)[JIT_LOCAL2 >> JIT_LOG_WORD_SIZE];
#endif #endif
#ifdef MZ_USE_JIT_I386 #ifdef MZ_USE_JIT_I386
@ -450,7 +464,7 @@ Scheme_Object *scheme_native_stack_trace(void)
#endif #endif
if (!use_unw) { if (!use_unw) {
q = *(void **)p; q = ((void **)p)[NEXT_FRAME_OFFSET];
if (STK_COMP((uintptr_t)q, (uintptr_t)p)) if (STK_COMP((uintptr_t)q, (uintptr_t)p))
break; break;
p = q; p = q;

View File

@ -49,7 +49,7 @@ static volatile uintptr_t code_low, code_high;
static void *get_end_pointer(mz_jit_state *jitter) static void *get_end_pointer(mz_jit_state *jitter)
{ {
return jit_get_ip().ptr; return jit_unadjust_ip(jit_get_ip());
} }
int scheme_mz_retain_it(mz_jit_state *jitter, void *v) int scheme_mz_retain_it(mz_jit_state *jitter, void *v)
@ -204,6 +204,10 @@ void *scheme_generate_one(mz_jit_state *old_jitter,
#endif #endif
} }
#ifdef MZ_USE_JIT_ARM
jit_get_cpu();
#endif
while (1) { while (1) {
memset(jitter, 0, sizeof(_jitter)); memset(jitter, 0, sizeof(_jitter));
#ifdef SET_DEFAULT_LONG_JUMPS #ifdef SET_DEFAULT_LONG_JUMPS
@ -282,7 +286,7 @@ void *scheme_generate_one(mz_jit_state *old_jitter,
} }
#endif #endif
(void)jit_set_ip(buffer).ptr; (void)jit_set_ip(buffer);
jitter->limit = (char *)buffer + size_pre_retained_double - padding; jitter->limit = (char *)buffer + size_pre_retained_double - padding;
if (known_size) { if (known_size) {
jitter->retain_double_start = (double *)jitter->limit; jitter->retain_double_start = (double *)jitter->limit;
@ -348,7 +352,7 @@ void *scheme_generate_one(mz_jit_state *old_jitter,
if (PAST_LIMIT() || (jitter->retain_start if (PAST_LIMIT() || (jitter->retain_start
&& (jitter->retained > num_retained))) { && (jitter->retained > num_retained))) {
scheme_console_printf("JIT buffer overflow: %p [%p,%p] (%d)!!\n", scheme_console_printf("JIT buffer overflow: %p [%p,%p] (%d)!!\n",
jit_get_ip().ptr, jit_get_ip(),
buffer, jitter->limit, buffer, jitter->limit,
!!jitter->retain_start); !!jitter->retain_start);
abort(); abort();
@ -366,11 +370,11 @@ void *scheme_generate_one(mz_jit_state *old_jitter,
scheme_signal_error("internal error: ended with unbox_extflonum"); scheme_signal_error("internal error: ended with unbox_extflonum");
if (known_size) { if (known_size) {
/* That was in the permanent area, so return: */ /* That was in the permanent area, so return: */
jit_flush_code(buffer, jit_get_ip().ptr); jit_flush_code(buffer, jit_get_raw_ip());
return buffer; return buffer;
} else { } else {
/* Allocate permanent area and jit again: */ /* Allocate permanent area and jit again: */
known_size = ((uintptr_t)jit_get_ip().ptr) - (uintptr_t)buffer; known_size = ((uintptr_t)jit_get_raw_ip()) - (uintptr_t)buffer;
/* Make sure room for pointers is aligned: */ /* Make sure room for pointers is aligned: */
if (known_size & (JIT_WORD_SIZE - 1)) { if (known_size & (JIT_WORD_SIZE - 1)) {
known_size += (JIT_WORD_SIZE - (known_size & (JIT_WORD_SIZE - 1))); known_size += (JIT_WORD_SIZE - (known_size & (JIT_WORD_SIZE - 1)));

View File

@ -0,0 +1,269 @@
/******************************** -*- C -*- ****************************
*
* Dynamic assembler support
*
***********************************************************************/
/***********************************************************************
*
* Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
* Written by Paolo Bonzini.
*
* This file is part of GNU lightning.
*
* GNU lightning is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU lightning is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with GNU lightning; see the file COPYING.LESSER; if not, write to the
* Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
***********************************************************************/
#ifndef __lightning_asm_common_h
#define __lightning_asm_common_h_
#if 1
# include <assert.h>
# define jit_assert(x) assert(x)
#else
# define jit_assert(x) /* empty */
#endif
#define __WORDSIZE 32
#define __jit_constructor /* empty */
#define __jit_inline XFORM_NONGCING MZ_INLINE static
typedef unsigned int _ui;
typedef signed char _sc;
typedef unsigned char _uc, jit_insn;
typedef unsigned short _us;
typedef unsigned int _ui;
typedef long _sl;
typedef unsigned long _ul;
typedef struct jit_local_state jit_local_state;
typedef struct jit_state jit_state;
struct jit_local_state {
int long_jumps;
int nextarg_get;
int nextarg_put;
int nextarg_getf;
jit_insn *thumb;
};
struct {
_ui version : 4;
_ui extend : 1;
/* only generate thumb instructions for thumb2 */
_ui thumb : 1;
_ui vfp : 3;
_ui neon : 1;
_ui abi : 2;
} jit_cpu;
struct {
/* prevent using thumb instructions that set flags? */
_ui no_set_flags : 1;
} jit_flags;
typedef struct jit_state {
union {
jit_insn *pc;
_uc *uc_pc;
_us *us_pc;
_ui *ui_pc;
_ul *ul_pc;
} x;
struct jit_fp *fp;
jit_local_state jitl;
} jit_state_t[1];
#ifndef _ASM_SAFETY
#define JITFAIL(MSG) 0
#else
#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || (defined __GNUC__ && (__GNUC__ == 3 ? __GNUC_MINOR__ >= 2 : __GNUC__ > 3))
#define JITFAIL(MSG) jit_fail(MSG, __FILE__, __LINE__, __func__)
#elif defined __GNUC__
#define JITFAIL(MSG) jit_fail(MSG, __FILE__, __LINE__, __FUNCTION__)
#else
#define JITFAIL(MSG) jit_fail(MSG, __FILE__, __LINE__, "(unknown)")
#endif
#endif
#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || (defined __GNUC__ && (__GNUC__ == 3 ? __GNUC_MINOR__ >= 2 : __GNUC__ > 3))
#define JITSORRY(MSG) jit_fail("sorry, unimplemented: " MSG, __FILE__, __LINE__, __func__)
#elif defined __GNUC__
#define JITSORRY(MSG) jit_fail("sorry, unimplemented: " MSG, __FILE__, __LINE__, __FUNCTION__)
#else
#define JITSORRY(MSG) jit_fail("sorry, unimplemented: " MSG, __FILE__, __LINE__, "(unknown)")
#endif
#ifdef __GNUC__
#define JIT_UNUSED __attribute__((__unused__))
#else
#define JIT_UNUSED
#endif
static int jit_fail(const char *, const char*, int, const char *) JIT_UNUSED;
/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
does not implement __extension__. But that compiler doesn't define
__GNUC_MINOR__. */
#ifdef __GNUC__
#if __GNUC__ < 2 || (defined(__NeXT__) && !__GNUC_MINOR__)
#define __extension__
#endif
#define _TEMPD(type, var)
#define _TEMP(type, var, val, body) __extension__ ({ \
register struct { type var } _jitl; _jitl.var = val; \
body; \
})
#else
/* Between loading a global and calling a subroutine, we choose the lesser
* evil. */
#define _TEMPD(type, var) static type var;
#define _TEMP(type, var, val, body) ((var = val), body)
#endif
#define _jit_UC(X) ((_uc )(X))
#define _jit_US(X) ((_us )(X))
#define _jit_UI(X) ((_ui )(X))
#define _jit_SI(X) ((int )(X))
#define _jit_SL(X) ((_sl )(X))
#define _jit_UL(X) ((_ul )(X))
# define _PUC(X) ((_uc *)(X))
# define _PUS(X) ((_us *)(X))
# define _PUI(X) ((_ui *)(X))
# define _PSI(X) ((int *)(X))
# define _PSL(X) ((_sl *)(X))
# define _PUL(X) ((_ul *)(X))
#define _jit_B(B) _jit_UL(((*_jitp->x.uc_pc++)= _jit_UC((B)& 0xff)))
#define _jit_W(W) _jit_UL(((*_jitp->x.us_pc++)= _jit_US((W)&0xffff)))
#define _jit_I(I) _jit_UL(((*_jitp->x.ui_pc++)= _jit_UI((I) )))
#define _jit_L(L) _jit_UL(((*_jitp->x.ul_pc++)= _jit_UL((L) )))
#define _jit_I_noinc(I) _jit_UL(((*_jitp->x.ui_pc)= _jit_UI((I) )))
#define _MASK(N) ((unsigned long)((1L<<(N)))-1L)
#define _siP(N,I) (!((((unsigned long)(I))^(((unsigned long)(I))<<1))&~_MASK(N)))
#define _uiP(N,I) (!(((unsigned long)(I))&~_MASK(N)))
#define _suiP(N,I) (_siP(N,I) | _uiP(N,I))
#ifndef _ASM_SAFETY
#define _ck_s(W,I) (_jit_UL(I) & _MASK(W))
#define _ck_u(W,I) (_jit_UL(I) & _MASK(W))
#define _ck_su(W,I) (_jit_UL(I) & _MASK(W))
#define _ck_d(W,I) (_jit_UL(I) & _MASK(W))
#else
#define _ck_s(W,I) (_siP(W,I) ? (_jit_UL(I) & _MASK(W)) : JITFAIL( "signed integer `"#I"' too large for "#W"-bit field"))
#define _ck_u(W,I) (_uiP(W,I) ? (_jit_UL(I) & _MASK(W)) : JITFAIL("unsigned integer `"#I"' too large for "#W"-bit field"))
#define _ck_su(W,I) (_suiP(W,I) ? (_jit_UL(I) & _MASK(W)) : JITFAIL( "integer `"#I"' too large for "#W"-bit field"))
#define _ck_d(W,I) (_siP(W,I) ? (_jit_UL(I) & _MASK(W)) : JITFAIL( "displacement `"#I"' too large for "#W"-bit field"))
#endif
#define _s0P(I) ((I)==0)
#define _s8P(I) _siP(8,I)
#define _s16P(I) _siP(16,I)
#define _s20P(I) _siP(20,I)
#define _s24P(I) _siP(24,I)
#define _s32P(I) _siP(32,I)
#define _u8P(I) _uiP(8,I)
#define _u16P(I) _uiP(16,I)
#define _u32P(I) _uiP(32,I)
#define _su8(I) _ck_su(8,I)
#define _su16(I) _ck_su(16,I)
#define _s1(I) _ck_s( 1,I)
#define _s2(I) _ck_s( 2,I)
#define _s3(I) _ck_s( 3,I)
#define _s4(I) _ck_s( 4,I)
#define _s5(I) _ck_s( 5,I)
#define _s6(I) _ck_s( 6,I)
#define _s7(I) _ck_s( 7,I)
#define _s8(I) _ck_s( 8,I)
#define _s9(I) _ck_s( 9,I)
#define _s10(I) _ck_s(10,I)
#define _s11(I) _ck_s(11,I)
#define _s12(I) _ck_s(12,I)
#define _s13(I) _ck_s(13,I)
#define _s14(I) _ck_s(14,I)
#define _s15(I) _ck_s(15,I)
#define _s16(I) _ck_s(16,I)
#define _s17(I) _ck_s(17,I)
#define _s18(I) _ck_s(18,I)
#define _s19(I) _ck_s(19,I)
#define _s20(I) _ck_s(20,I)
#define _s21(I) _ck_s(21,I)
#define _s22(I) _ck_s(22,I)
#define _s23(I) _ck_s(23,I)
#define _s24(I) _ck_s(24,I)
#define _s25(I) _ck_s(25,I)
#define _s26(I) _ck_s(26,I)
#define _s27(I) _ck_s(27,I)
#define _s28(I) _ck_s(28,I)
#define _s29(I) _ck_s(29,I)
#define _s30(I) _ck_s(30,I)
#define _s31(I) _ck_s(31,I)
#if __WORDSIZE == 32
# define _s32(I) (I)
#else
# define _s32(I) _ck_s(32,I)
#endif
#define _u1(I) _ck_u( 1,I)
#define _u2(I) _ck_u( 2,I)
#define _u3(I) _ck_u( 3,I)
#define _u4(I) _ck_u( 4,I)
#define _u5(I) _ck_u( 5,I)
#define _u6(I) _ck_u( 6,I)
#define _u7(I) _ck_u( 7,I)
#define _u8(I) _ck_u( 8,I)
#define _u9(I) _ck_u( 9,I)
#define _u10(I) _ck_u(10,I)
#define _u11(I) _ck_u(11,I)
#define _u12(I) _ck_u(12,I)
#define _u13(I) _ck_u(13,I)
#define _u14(I) _ck_u(14,I)
#define _u15(I) _ck_u(15,I)
#define _u16(I) _ck_u(16,I)
#define _u17(I) _ck_u(17,I)
#define _u18(I) _ck_u(18,I)
#define _u19(I) _ck_u(19,I)
#define _u20(I) _ck_u(20,I)
#define _u21(I) _ck_u(21,I)
#define _u22(I) _ck_u(22,I)
#define _u23(I) _ck_u(23,I)
#define _u24(I) _ck_u(24,I)
#define _u25(I) _ck_u(25,I)
#define _u26(I) _ck_u(26,I)
#define _u27(I) _ck_u(27,I)
#define _u28(I) _ck_u(28,I)
#define _u29(I) _ck_u(29,I)
#define _u30(I) _ck_u(30,I)
#define _u31(I) _ck_u(31,I)
#if __WORDSIZE == 32
# define _u32(I) (I)
#else
# define _u32(I) _ck_u(32,I)
#endif
#endif /* __lightning_asm_common_h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,695 @@
/******************************** -*- C -*- ****************************
*
* Platform-independent layer support
*
***********************************************************************/
/***********************************************************************
*
* Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
* Written by Paolo Bonzini.
*
* This file is part of GNU lightning.
*
* GNU lightning is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU lightning is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with GNU lightning; see the file COPYING.LESSER; if not, write to the
* Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
***********************************************************************/
#ifndef __lightning_core_common_h
#define __lightning_core_common_h_
#define JIT_NOREG (-1)
#define jit_get_raw_ip() _jitp->x.pc
#define jit_get_ip() jit_adjust_ip(_jitp->x.pc)
#define jit_set_ip(ptr) (_jitp->x.pc = (ptr), jit_get_ip ())
#define jit_get_label() jit_get_ip()
#define jit_forward() jit_get_ip()
#define jit_adjust_ip(x) ((jit_insn *)(((char *)(x)) + jit_cpu.thumb))
#define jit_unadjust_ip(x) ((jit_insn *)(((char *)(x)) - jit_cpu.thumb))
#define jit_field(struc, f) ( ((long) (&((struc *) 8)->f) ) - 8)
#define jit_ptr_field(struc_p, f) ( ((long) (&((struc_p) 8)->f) ) - 8)
/* realignment via N-byte no-ops */
#ifndef jit_align
#define jit_align(n)
#endif
/* jit_code: union of many possible function pointer types. Returned
* by jit_get_ip().
*/
typedef union jit_code {
char *ptr;
void (*vptr)(void);
char (*cptr)(void);
unsigned char (*ucptr)(void);
short (*sptr)(void);
unsigned short (*usptr)(void);
int (*iptr)(void);
unsigned int (*uiptr)(void);
long (*lptr)(void);
unsigned long (*ulptr)(void);
void * (*pptr)(void);
float (*fptr)(void);
double (*dptr)(void);
} jit_code;
#ifndef jit_fill_delay_after
#define jit_fill_delay_after(branch) (branch)
#endif
#define jit_delay(insn, branch) ((insn), jit_fill_delay_after(branch))
/* ALU synonyms */
#if !defined(jit_addci_ui)
# if !defined(jit_addci_i)
/* need add/sub that sets carry for all operands */
# if _ASM_SAFETY
# warning Assuming jit_{add,sub}{r,i}_{i,ui} always sets carry
# endif
# define jit_addci_ui(d, rs, is) jit_addi_ui((d), (rs), (is))
# define jit_addcr_ui(d, s1, s2) jit_addr_ui((d), (s1), (s2))
# define jit_subci_ui(d, rs, is) jit_subi_ui((d), (rs), (is))
# define jit_subcr_ui(d, s1, s2) jit_subr_ui((d), (s1), (s2))
# elif defined(jit_addci_i)
/* allow logically reversed definitions */
# define jit_addci_ui(d, rs, is) jit_addci_i((d), (rs), (is))
# define jit_addcr_ui(d, s1, s2) jit_addcr_i((d), (s1), (s2))
# define jit_subci_ui(d, rs, is) jit_subci_i((d), (rs), (is))
# define jit_subcr_ui(d, s1, s2) jit_subcr_i((d), (s1), (s2))
# endif
#endif
#if !defined(jit_addci_i) && defined(jit_addci_ui)
/* provide compatibility logically wrong definitions */
# define jit_addci_i(d, rs, is) jit_addci_ui((d), (rs), (is))
# define jit_addcr_i(d, s1, s2) jit_addcr_ui((d), (s1), (s2))
# define jit_subci_i(d, rs, is) jit_subci_ui((d), (rs), (is))
# define jit_subcr_i(d, s1, s2) jit_subcr_ui((d), (s1), (s2))
#endif
#if !defined(jit_addxi_ui) && defined(jit_addxi_i)
/* allow logically reversed definitions */
# define jit_addxi_ui(d, rs, is) jit_addxi_i((d), (rs), (is))
# define jit_addxr_ui(d, s1, s2) jit_addxr_i((d), (s1), (s2))
# define jit_subxi_ui(d, rs, is) jit_subxi_i((d), (rs), (is))
# define jit_subxr_ui(d, s1, s2) jit_subxr_i((d), (s1), (s2))
#endif
#if !defined(jit_addxi_i) && defined(jit_addxi_ui)
/* provide compatibility logically wrong definitions */
# define jit_addxi_i(d, rs, is) jit_addxi_ui((d), (rs), (is))
# define jit_addxr_i(d, s1, s2) jit_addxr_ui((d), (s1), (s2))
# define jit_subxi_i(d, rs, is) jit_subxi_ui((d), (rs), (is))
# define jit_subxr_i(d, s1, s2) jit_subxr_ui((d), (s1), (s2))
#endif
#define jit_addi_ui(d, rs, is) jit_addi_i((d), (rs), (is))
#define jit_addr_ui(d, s1, s2) jit_addr_i((d), (s1), (s2))
#define jit_andi_ui(d, rs, is) jit_andi_i((d), (rs), (is))
#define jit_andr_ui(d, s1, s2) jit_andr_i((d), (s1), (s2))
#define jit_lshi_ui(d, rs, is) jit_lshi_i((d), (rs), (is))
#define jit_lshr_ui(d, s1, s2) jit_lshr_i((d), (s1), (s2))
#ifndef jit_movi_ui
# define jit_movi_ui(d, rs) jit_movi_i((d), (rs))
#endif
#define jit_movr_ui(d, rs) jit_movr_i((d), (rs))
#define jit_ori_ui(d, rs, is) jit_ori_i((d), (rs), (is))
#define jit_orr_ui(d, s1, s2) jit_orr_i((d), (s1), (s2))
#define jit_rsbi_ui(d, rs, is) jit_rsbi_i((d), (rs), (is))
#define jit_rsbr_ui(d, s1, s2) jit_rsbr_i((d), (s1), (s2))
#define jit_subi_ui(d, rs, is) jit_subi_i((d), (rs), (is))
#define jit_subr_ui(d, s1, s2) jit_subr_i((d), (s1), (s2))
#define jit_xori_ui(d, rs, is) jit_xori_i((d), (rs), (is))
#define jit_xorr_ui(d, s1, s2) jit_xorr_i((d), (s1), (s2))
#if __WORDSIZE == 32
/* common definitions when sizeof(long) == sizeof(int) */
# if !defined(jit_addci_ul) && defined(jit_addci_ui)
# define jit_addci_ul(d, rs, is) jit_addci_ui((d), (rs), (is))
# define jit_addcr_ul(d, s1, s2) jit_addcr_ui((d), (s1), (s2))
# define jit_subci_ul(d, rs, is) jit_subci_ui((d), (rs), (is))
# define jit_subcr_ul(d, s1, s2) jit_subcr_ui((d), (s1), (s2))
# endif
# if !defined(jit_addxi_ul) && defined(jit_addxi_ui)
# define jit_addxi_ul(d, rs, is) jit_addxi_ui((d), (rs), (is))
# define jit_addxr_ul(d, s1, s2) jit_addxr_ui((d), (s1), (s2))
# define jit_subxi_ul(d, rs, is) jit_subxi_ui((d), (rs), (is))
# define jit_subxr_ul(d, s1, s2) jit_subxr_ui((d), (s1), (s2))
# endif
#endif
#if !defined(jit_addci_ul)
# if !defined(jit_addci_l)
/* need add/sub that sets carry for all operands */
# if _ASM_SAFETY
# warning Assuming jit_{add,sub}{r,i}_{l,ul} always sets carry
# endif
# define jit_addci_ul(d, rs, is) jit_addi_ul((d), (rs), (is))
# define jit_addcr_ul(d, s1, s2) jit_addr_ul((d), (s1), (s2))
# define jit_subci_ul(d, rs, is) jit_subi_ul((d), (rs), (is))
# define jit_subcr_ul(d, s1, s2) jit_subr_ul((d), (s1), (s2))
# elif defined(jit_addci_l)
/* allow logically reversed definitions */
# define jit_addci_ul(d, rs, is) jit_addci_l((d), (rs), (is))
# define jit_addcr_ul(d, s1, s2) jit_addcr_l((d), (s1), (s2))
# define jit_subci_ul(d, rs, is) jit_subci_l((d), (rs), (is))
# define jit_subcr_ul(d, s1, s2) jit_subcr_l((d), (s1), (s2))
# endif
#endif
#if !defined(jit_addci_l) && defined(jit_addci_ul)
/* provide compatibility logically wrong definitions */
# define jit_addci_l(d, rs, is) jit_addci_ul((d), (rs), (is))
# define jit_addcr_l(d, s1, s2) jit_addcr_ul((d), (s1), (s2))
# define jit_subci_l(d, rs, is) jit_subci_ul((d), (rs), (is))
# define jit_subcr_l(d, s1, s2) jit_subcr_ul((d), (s1), (s2))
#endif
#if !defined(jit_addxi_ul) && defined(jit_addxi_l)
/* allow logically reversed definitions */
# define jit_addxi_ul(d, rs, is) jit_addxi_l((d), (rs), (is))
# define jit_addxr_ul(d, s1, s2) jit_addxr_l((d), (s1), (s2))
# define jit_subxi_ul(d, rs, is) jit_subxi_l((d), (rs), (is))
# define jit_subxr_ul(d, s1, s2) jit_subxr_l((d), (s1), (s2))
#endif
#if !defined(jit_addxi_l) && defined(jit_addxi_ul)
/* provide compatibility logically wrong definitions */
# define jit_addxi_l(d, rs, is) jit_addxi_ul((d), (rs), (is))
# define jit_addxr_l(d, s1, s2) jit_addxr_ul((d), (s1), (s2))
# define jit_subxi_l(d, rs, is) jit_subxi_ul((d), (rs), (is))
# define jit_subxr_l(d, s1, s2) jit_subxr_ul((d), (s1), (s2))
#endif
#define jit_addi_ul(d, rs, is) jit_addi_l((d), (rs), (is))
#define jit_addr_ul(d, s1, s2) jit_addr_l((d), (s1), (s2))
#define jit_andi_ul(d, rs, is) jit_andi_l((d), (rs), (is))
#define jit_andr_ul(d, s1, s2) jit_andr_l((d), (s1), (s2))
#define jit_lshi_ul(d, rs, is) jit_lshi_l((d), (rs), (is))
#define jit_lshr_ul(d, s1, s2) jit_lshr_l((d), (s1), (s2))
#ifndef jit_movi_ul
# define jit_movi_ul(d, rs) jit_movi_l((d), (rs))
#endif
#ifndef jit_movr_ul
# define jit_movr_ul(d, rs) jit_movr_l((d), (rs))
#endif
#define jit_ori_ul(d, rs, is) jit_ori_l((d), (rs), (is))
#define jit_orr_ul(d, s1, s2) jit_orr_l((d), (s1), (s2))
#define jit_rsbi_ul(d, rs, is) jit_rsbi_l((d), (rs), (is))
#define jit_rsbr_ul(d, s1, s2) jit_rsbr_l((d), (s1), (s2))
#define jit_subi_ul(d, rs, is) jit_subi_l((d), (rs), (is))
#define jit_subr_ul(d, s1, s2) jit_subr_l((d), (s1), (s2))
#define jit_xori_ul(d, rs, is) jit_xori_l((d), (rs), (is))
#define jit_xorr_ul(d, s1, s2) jit_xorr_l((d), (s1), (s2))
#define jit_addr_p(d, s1, s2) jit_addr_ul((d), (s1), (s2))
#define jit_addi_p(d, rs, is) jit_addi_ul((d), (rs), (long) (is))
#ifndef jit_movr_p
# define jit_movr_p(d, rs) jit_movr_ul((d), (rs))
#endif
#define jit_subr_p(d, s1, s2) jit_subr_ul((d), (s1), (s2))
#define jit_subi_p(d, rs, is) jit_subi_ul((d), (rs), (long) (is))
#define jit_rsbi_p(d, rs, is) jit_rsbi_ul((d), (rs), (long) (is))
#ifndef jit_movi_p
#define jit_movi_p(d, is) (jit_movi_ul((d), (long) (is)), jit_get_ip())
#endif
#define jit_patch(pv) jit_patch_at ((pv), jit_get_ip())
/* NEG is not mandatory -- pick an appropriate implementation */
#ifndef jit_negr_i
# ifdef JIT_RZERO
# define jit_negr_i(d, rs) jit_subr_i((d), JIT_RZERO, (rs))
# if __WORDSIZE == 64
# define jit_negr_l(d, rs) jit_subr_l((d), JIT_RZERO, (rs))
# endif
# else /* !JIT_RZERO */
# ifndef jit_rsbi_i
# define jit_negr_i(d, rs) (jit_xori_i((d), (rs), -1), jit_addi_l((d), (d), 1))
# define jit_negr_l(d, rs) (jit_xori_l((d), (rs), -1), jit_addi_l((d), (d), 1))
# else /* jit_rsbi_i */
# define jit_negr_i(d, rs) jit_rsbi_i((d), (rs), 0)
# define jit_negr_l(d, rs) jit_rsbi_l((d), (rs), 0)
# endif /* jit_rsbi_i */
# endif /* !JIT_RZERO */
#endif /* !jit_negr_i */
/* Common 'shortcut' implementations */
#ifndef jit_subi_i
# define jit_subi_i(d, rs, is) jit_addi_i((d), (rs), -(is))
#endif
#ifndef jit_subi_l
# define jit_subi_l(d, rs, is) jit_subi_i((d), (rs), (is))
#endif
#define jit_rsbr_f(d, s1, s2) jit_subr_f((d), (s2), (s1))
#define jit_rsbr_d(d, s1, s2) jit_subr_d((d), (s2), (s1))
#ifndef jit_rsbr_i
# define jit_rsbr_i(d, s1, s2) jit_subr_i((d), (s2), (s1))
#endif
#define jit_rsbr_l(d, s1, s2) jit_subr_l((d), (s2), (s1))
#define jit_rsbr_p(d, s1, s2) jit_subr_p((d), (s2), (s1))
/* Unary */
#ifndef jit_notr_i
# define jit_notr_i(d, rs) jit_xori_i((d), (rs), ~0)
#endif
#ifndef jit_notr_l
# define jit_notr_l(d, rs) jit_xori_l((d), (rs), ~0L)
#endif
#ifndef jit_notr_c
# define jit_notr_c(d, rs) jit_notr_i((d), (rs))
# define jit_notr_uc(d, rs) jit_notr_i((d), (rs))
# define jit_notr_s(d, rs) jit_notr_i((d), (rs))
# define jit_notr_us(d, rs) jit_notr_i((d), (rs))
#endif
#ifndef jit_notr_ui
# define jit_notr_ui(d, rs) jit_notr_i((d), (rs))
#endif
#ifndef jit_notr_ul
# define jit_notr_ul(d, rs) jit_notr_l((d), (rs))
#endif
#ifndef jit_extr_c_ui
# define jit_extr_c_ui(d, rs) jit_andi_ui((d), (rs), 0xFF)
#endif
#ifndef jit_extr_s_ui
# define jit_extr_s_ui(d, rs) jit_andi_ui((d), (rs), 0xFFFF)
#endif
#ifndef jit_extr_c_i
# define jit_extr_c_i(d, rs) (jit_lshi_i((d), (rs), 24), jit_rshi_i((d), (d), 24))
#endif
#ifndef jit_extr_s_i
# define jit_extr_s_i(d, rs) (jit_lshi_i((d), (rs), 16), jit_rshi_i((d), (d), 16))
#endif
#if __WORDSIZE == 64
# ifndef jit_extr_c_l
# define jit_extr_c_l(d, rs) (jit_lshi_l((d), (rs), 56), jit_rshi_l((d), (d), 56))
# endif
# ifndef jit_extr_s_l
# define jit_extr_s_l(d, rs) (jit_lshi_l((d), (rs), 48), jit_rshi_l((d), (d), 48))
# endif
# ifndef jit_extr_i_l
# define jit_extr_i_l(d, rs) (jit_lshi_l((d), (rs), 32), jit_rshi_l((d), (d), 32))
# endif
# ifndef jit_extr_c_ul
# define jit_extr_c_ul(d, rs) jit_andi_l((d), (rs), 0xFF)
# endif
# ifndef jit_extr_s_ul
# define jit_extr_s_ul(d, rs) jit_andi_l((d), (rs), 0xFFFF)
# endif
# ifndef jit_extr_i_ul
# define jit_extr_i_ul(d, rs) jit_andi_l((d), (rs), 0xFFFFFFFFUL)
# endif
#endif /* __WORDSIZE == 64 */
#define jit_extr_c_s(d, rs) jit_extr_c_i((d), (rs))
#define jit_extr_c_us(d, rs) jit_extr_c_ui((d), (rs))
#define jit_extr_uc_s(d, rs) jit_extr_uc_i((d), (rs))
#define jit_extr_uc_us(d, rs) jit_extr_uc_ui((d), (rs))
#define jit_extr_uc_i(d, rs) jit_extr_c_ui((d), (rs))
#define jit_extr_uc_ui(d, rs) jit_extr_c_ui((d), (rs))
#define jit_extr_us_i(d, rs) jit_extr_s_ui((d), (rs))
#define jit_extr_us_ui(d, rs) jit_extr_s_ui((d), (rs))
#define jit_extr_uc_l(d, rs) jit_extr_c_ul((d), (rs))
#define jit_extr_uc_ul(d, rs) jit_extr_c_ul((d), (rs))
#define jit_extr_us_l(d, rs) jit_extr_s_ul((d), (rs))
#define jit_extr_us_ul(d, rs) jit_extr_s_ul((d), (rs))
#define jit_extr_ui_l(d, rs) jit_extr_i_ul((d), (rs))
#define jit_extr_ui_ul(d, rs) jit_extr_i_ul((d), (rs))
/* NTOH/HTON is not mandatory for big endian architectures */
#ifndef jit_ntoh_ui /* big endian */
#define jit_ntoh_ui(d, rs) ((d) == (rs) ? (void)0 : jit_movr_i((d), (rs)))
#define jit_ntoh_us(d, rs) ((d) == (rs) ? (void)0 : jit_movr_i((d), (rs)))
#endif /* big endian */
/* hton is a synonym for ntoh */
#define jit_hton_ui(d, rs) jit_ntoh_ui((d), (rs))
#define jit_hton_us(d, rs) jit_ntoh_us((d), (rs))
/* Stack synonyms */
#define jit_pushr_ui(rs) jit_pushr_i(rs)
#define jit_popr_ui(rs) jit_popr_i(rs)
#define jit_pushr_ul(rs) jit_pushr_l(rs)
#define jit_popr_ul(rs) jit_popr_l(rs)
#define jit_pushr_p(rs) jit_pushr_ul(rs)
#define jit_popr_p(rs) jit_popr_ul(rs)
#define jit_prepare(nint) jit_prepare_i((nint))
#define jit_pusharg_c(rs) jit_pusharg_i(rs)
#define jit_pusharg_s(rs) jit_pusharg_i(rs)
#define jit_pusharg_uc(rs) jit_pusharg_i(rs)
#define jit_pusharg_us(rs) jit_pusharg_i(rs)
#define jit_pusharg_ui(rs) jit_pusharg_i(rs)
#define jit_pusharg_ul(rs) jit_pusharg_l(rs)
#define jit_pusharg_p(rs) jit_pusharg_ul(rs)
#define jit_normal_pushonlyarg_p(r0) jit_normal_pushonlyarg_i(r0)
/* Memory synonyms */
#ifdef JIT_RZERO
#ifndef jit_ldi_c
#define jit_ldi_c(rd, is) jit_ldxi_c((rd), JIT_RZERO, (is))
#define jit_sti_c(id, rs) jit_stxi_c((id), JIT_RZERO, (rs))
#define jit_ldi_s(rd, is) jit_ldxi_s((rd), JIT_RZERO, (is))
#define jit_sti_s(id, rs) jit_stxi_s((id), JIT_RZERO, (rs))
#define jit_ldi_i(rd, is) jit_ldxi_i((rd), JIT_RZERO, (is))
#define jit_sti_i(id, rs) jit_stxi_i((id), JIT_RZERO, (rs))
#define jit_ldi_l(rd, is) jit_ldxi_l((rd), JIT_RZERO, (is))
#define jit_sti_l(id, rs) jit_stxi_l((id), JIT_RZERO, (rs))
#define jit_ldi_uc(rd, is) jit_ldxi_uc((rd), JIT_RZERO, (is))
#define jit_ldi_us(rd, is) jit_ldxi_us((rd), JIT_RZERO, (is))
#define jit_ldi_ui(rd, is) jit_ldxi_ui((rd), JIT_RZERO, (is))
# if __WORDSIZE == 64
# define jit_ldi_ul(rd, is) jit_ldxi_ul((rd), JIT_RZERO, (is))
# endif
#endif
#ifndef jit_ldr_c
#define jit_ldr_c(rd, rs) jit_ldxr_c((rd), JIT_RZERO, (rs))
#define jit_str_c(rd, rs) jit_stxr_c(JIT_RZERO, (rd), (rs))
#define jit_ldr_s(rd, rs) jit_ldxr_s((rd), JIT_RZERO, (rs))
#define jit_str_s(rd, rs) jit_stxr_s(JIT_RZERO, (rd), (rs))
#define jit_ldr_i(rd, rs) jit_ldxr_i((rd), JIT_RZERO, (rs))
#define jit_str_i(rd, rs) jit_stxr_i(JIT_RZERO, (rd), (rs))
#define jit_ldr_l(rd, rs) jit_ldxr_l((rd), JIT_RZERO, (rs))
#define jit_str_l(rd, rs) jit_stxr_l(JIT_RZERO, (rd), (rs))
#define jit_ldr_uc(rd, rs) jit_ldxr_uc((rd), JIT_RZERO, (rs))
#define jit_ldr_us(rd, rs) jit_ldxr_us((rd), JIT_RZERO, (rs))
#define jit_ldr_ui(rd, rs) jit_ldxr_ui((rd), JIT_RZERO, (rs))
# if __WORDSIZE == 64
# define jit_ldr_ul(rd, rs) jit_ldxr_ul((rd), JIT_RZERO, (rs))
# endif
#endif
#endif
#define jit_str_uc(rd, rs) jit_str_c((rd), (rs))
#define jit_sti_uc(id, rs) jit_sti_c((id), (rs))
#define jit_stxr_uc(d1, d2, rs) jit_stxr_c((d1), (d2), (rs))
#define jit_stxi_uc(id, rd, is) jit_stxi_c((id), (rd), (is))
#define jit_str_us(rd, rs) jit_str_s((rd), (rs))
#define jit_sti_us(id, rs) jit_sti_s((id), (rs))
#define jit_stxr_us(d1, d2, rs) jit_stxr_s((d1), (d2), (rs))
#define jit_stxi_us(id, rd, is) jit_stxi_s((id), (rd), (is))
#define jit_str_ui(rd, rs) jit_str_i((rd), (rs))
#define jit_sti_ui(id, rs) jit_sti_i((id), (rs))
#define jit_stxr_ui(d1, d2, rs) jit_stxr_i((d1), (d2), (rs))
#define jit_stxi_ui(id, rd, is) jit_stxi_i((id), (rd), (is))
#define jit_str_ul(rd, rs) jit_str_l((rd), (rs))
#define jit_sti_ul(id, rs) jit_sti_l((id), (rs))
#define jit_stxr_ul(d1, d2, rs) jit_stxr_l((d1), (d2), (rs))
#define jit_stxi_ul(id, rd, is) jit_stxi_l((id), (rd), (is))
#define jit_str_p(rd, rs) jit_str_l((rd), (rs))
#define jit_sti_p(id, rs) jit_sti_l((id), (rs))
#define jit_stxr_p(d1, d2, rs) jit_stxr_l((d1), (d2), (rs))
#define jit_stxi_p(id, rd, is) jit_stxi_l((id), (rd), (is))
#define jit_ldr_p(rd, rs) jit_ldr_l((rd), (rs))
#define jit_ldi_p(rd, is) jit_ldi_l((rd), (is))
#define jit_ldxr_p(rd, s1, s2) jit_ldxr_l((rd), (s1), (s2))
#ifndef jit_ldxi_p
# define jit_ldxi_p(rd, rs, is) jit_ldxi_l((rd), (rs), (is))
#endif
#define jit_ldr_ul(d, rs) jit_ldr_l((d), (rs))
#define jit_ldi_ul(d, is) jit_ldi_l((d), (is))
#define jit_ldxr_ul(d, s1, s2) jit_ldxr_l((d), (s1), (s2))
#ifndef jit_ldxi_ul
# define jit_ldxi_ul(d, rs, is) jit_ldxi_l((d), (rs), (is))
#endif
/* Boolean & branch synonyms */
#define jit_eqr_ui(d, s1, s2) jit_eqr_i((d), (s1), (s2))
#define jit_eqi_ui(d, rs, is) jit_eqi_i((d), (rs), (is))
#define jit_ner_ui(d, s1, s2) jit_ner_i((d), (s1), (s2))
#define jit_nei_ui(d, rs, is) jit_nei_i((d), (rs), (is))
#define jit_eqr_ul(d, s1, s2) jit_eqr_l((d), (s1), (s2))
#define jit_eqi_ul(d, rs, is) jit_eqi_l((d), (rs), (is))
#define jit_ner_ul(d, s1, s2) jit_ner_l((d), (s1), (s2))
#define jit_nei_ul(d, rs, is) jit_nei_l((d), (rs), (is))
#define jit_beqr_ui(label, s1, s2) jit_beqr_i((label), (s1), (s2))
#define jit_beqi_ui(label, rs, is) jit_beqi_i((label), (rs), (is))
#define jit_bner_ui(label, s1, s2) jit_bner_i((label), (s1), (s2))
#define jit_bnei_ui(label, rs, is) jit_bnei_i((label), (rs), (is))
#define jit_bmcr_ui(label, s1, s2) jit_bmcr_i((label), (s1), (s2))
#define jit_bmci_ui(label, rs, is) jit_bmci_i((label), (rs), (is))
#define jit_bmsr_ui(label, s1, s2) jit_bmsr_i((label), (s1), (s2))
#define jit_bmsi_ui(label, rs, is) jit_bmsi_i((label), (rs), (is))
#define jit_beqr_ul(label, s1, s2) jit_beqr_l((label), (s1), (s2))
#define jit_beqi_ul(label, rs, is) jit_beqi_l((label), (rs), (is))
#define jit_bner_ul(label, s1, s2) jit_bner_l((label), (s1), (s2))
#define jit_bnei_ul(label, rs, is) jit_bnei_l((label), (rs), (is))
#define jit_bmcr_ul(label, s1, s2) jit_bmcr_l((label), (s1), (s2))
#define jit_bmci_ul(label, rs, is) jit_bmci_l((label), (rs), (is))
#define jit_bmsr_ul(label, s1, s2) jit_bmsr_l((label), (s1), (s2))
#define jit_bmsi_ul(label, rs, is) jit_bmsi_l((label), (rs), (is))
#define jit_ltr_p(d, s1, s2) jit_ltr_ul((d), (s1), (s2))
#define jit_lti_p(d, rs, is) jit_lti_ul((d), (rs), (long)(is))
#define jit_ler_p(d, s1, s2) jit_ler_ul((d), (s1), (s2))
#define jit_lei_p(d, rs, is) jit_lei_ul((d), (rs), (long)(is))
#define jit_gtr_p(d, s1, s2) jit_gtr_ul((d), (s1), (s2))
#define jit_gti_p(d, rs, is) jit_gti_ul((d), (rs), (long)(is))
#define jit_ger_p(d, s1, s2) jit_ger_ul((d), (s1), (s2))
#define jit_gei_p(d, rs, is) jit_gei_ul((d), (rs), (long)(is))
#define jit_eqr_p(d, s1, s2) jit_eqr_ul((d), (s1), (s2))
#define jit_eqi_p(d, rs, is) jit_eqi_ul((d), (rs), (long)(is))
#define jit_ner_p(d, s1, s2) jit_ner_ul((d), (s1), (s2))
#define jit_nei_p(d, rs, is) jit_nei_ul((d), (rs), (long)(is))
#define jit_bltr_p(label, s1, s2) jit_bltr_ul((label), (s1), (s2))
#define jit_blti_p(label, rs, is) jit_blti_ul((label), (rs), (long)(is))
#define jit_bler_p(label, s1, s2) jit_bler_ul((label), (s1), (s2))
#define jit_blei_p(label, rs, is) jit_blei_ul((label), (rs), (long)(is))
#define jit_bgtr_p(label, s1, s2) jit_bgtr_ul((label), (s1), (s2))
#define jit_bgti_p(label, rs, is) jit_bgti_ul((label), (rs), (long)(is))
#define jit_bger_p(label, s1, s2) jit_bger_ul((label), (s1), (s2))
#define jit_bgei_p(label, rs, is) jit_bgei_ul((label), (rs), (long)(is))
#define jit_beqr_p(label, s1, s2) jit_beqr_ul((label), (s1), (s2))
#define jit_beqi_p(label, rs, is) jit_beqi_ul((label), (rs), (long)(is))
#define jit_bner_p(label, s1, s2) jit_bner_ul((label), (s1), (s2))
#define jit_bnei_p(label, rs, is) jit_bnei_ul((label), (rs), (long)(is))
#define jit_retval_ui(rd) jit_retval_i((rd))
#define jit_retval_uc(rd) jit_retval_i((rd))
#define jit_retval_us(rd) jit_retval_i((rd))
#define jit_retval_ul(rd) jit_retval_l((rd))
#define jit_retval_p(rd) jit_retval_ul((rd))
#define jit_retval_c(rd) jit_retval_i((rd))
#define jit_retval_s(rd) jit_retval_i((rd))
/* This was a bug, but we keep it. */
#define jit_retval(rd) jit_retval_i ((rd))
#ifndef jit_finish
#define jit_finish(sub) jit_calli(sub)
#endif
#ifndef jit_finishr
#define jit_finishr(reg) jit_callr(reg)
#endif
#ifndef jit_prolog
#define jit_prolog(numargs)
#endif
#ifndef jit_leaf
#define jit_leaf(numargs) jit_prolog(numargs)
#endif
#ifndef jit_getarg_c
#ifndef JIT_AP
#define jit_getarg_c(reg, ofs) jit_extr_c_l ((reg), (ofs))
#define jit_getarg_i(reg, ofs) jit_extr_i_l ((reg), (ofs))
#define jit_getarg_l(reg, ofs) jit_movr_l ((reg), (ofs))
#define jit_getarg_p(reg, ofs) jit_movr_p ((reg), (ofs))
#define jit_getarg_s(reg, ofs) jit_extr_s_l ((reg), (ofs))
#define jit_getarg_uc(reg, ofs) jit_extr_uc_ul((reg), (ofs))
#define jit_getarg_ui(reg, ofs) jit_extr_ui_ul((reg), (ofs))
#define jit_getarg_ul(reg, ofs) jit_movr_ul ((reg), (ofs))
#define jit_getarg_us(reg, ofs) jit_extr_us_ul((reg), (ofs))
#else
#define jit_getarg_c(reg, ofs) jit_ldxi_c((reg), JIT_AP, (ofs));
#define jit_getarg_uc(reg, ofs) jit_ldxi_uc((reg), JIT_AP, (ofs));
#define jit_getarg_s(reg, ofs) jit_ldxi_s((reg), JIT_AP, (ofs));
#define jit_getarg_us(reg, ofs) jit_ldxi_us((reg), JIT_AP, (ofs));
#define jit_getarg_i(reg, ofs) jit_ldxi_i((reg), JIT_AP, (ofs));
#define jit_getarg_ui(reg, ofs) jit_ldxi_ui((reg), JIT_AP, (ofs));
#define jit_getarg_l(reg, ofs) jit_ldxi_l((reg), JIT_AP, (ofs));
#define jit_getarg_ul(reg, ofs) jit_ldxi_ul((reg), JIT_AP, (ofs));
#define jit_getarg_p(reg, ofs) jit_ldxi_p((reg), JIT_AP, (ofs));
#endif
#endif
/* Common definitions when sizeof(long) = sizeof(int) */
#if __WORDSIZE == 32
/* ALU */
# define jit_addi_l(d, rs, is) jit_addi_i((d), (rs), (is))
# define jit_addr_l(d, s1, s2) jit_addr_i((d), (s1), (s2))
# define jit_andi_l(d, rs, is) jit_andi_i((d), (rs), (is))
# define jit_andr_l(d, s1, s2) jit_andr_i((d), (s1), (s2))
# define jit_divi_l(d, rs, is) jit_divi_i((d), (rs), (is))
# define jit_divr_l(d, s1, s2) jit_divr_i((d), (s1), (s2))
# define jit_hmuli_l(d, rs, is) jit_hmuli_i((d), (rs), (is))
# define jit_hmulr_l(d, s1, s2) jit_hmulr_i((d), (s1), (s2))
# define jit_lshi_l(d, rs, is) jit_lshi_i((d), (rs), (is))
# define jit_lshr_l(d, s1, s2) jit_lshr_i((d), (s1), (s2))
# define jit_modi_l(d, rs, is) jit_modi_i((d), (rs), (is))
# define jit_modr_l(d, s1, s2) jit_modr_i((d), (s1), (s2))
# define jit_muli_l(d, rs, is) jit_muli_i((d), (rs), (is))
# define jit_mulr_l(d, s1, s2) jit_mulr_i((d), (s1), (s2))
# ifndef jit_negr_l
# define jit_negr_l(d, s1) jit_negr_i((d), (s1))
# endif
# define jit_ori_l(d, rs, is) jit_ori_i((d), (rs), (is))
# define jit_orr_l(d, s1, s2) jit_orr_i((d), (s1), (s2))
# define jit_rshi_l(d, rs, is) jit_rshi_i((d), (rs), (is))
# define jit_rshr_l(d, s1, s2) jit_rshr_i((d), (s1), (s2))
# define jit_subr_l(d, s1, s2) jit_subr_i((d), (s1), (s2))
# define jit_xori_l(d, rs, is) jit_xori_i((d), (rs), (is))
# define jit_xorr_l(d, s1, s2) jit_xorr_i((d), (s1), (s2))
# define jit_rsbi_l(d, rs, is) jit_rsbi_i((d), (rs), (is))
# define jit_divi_ul(d, rs, is) jit_divi_ui((d), (rs), (is))
# define jit_divr_ul(d, s1, s2) jit_divr_ui((d), (s1), (s2))
# define jit_hmuli_ul(d, rs, is) jit_hmuli_ui((d), (rs), (is))
# define jit_hmulr_ul(d, s1, s2) jit_hmulr_ui((d), (s1), (s2))
# define jit_modi_ul(d, rs, is) jit_modi_ui((d), (rs), (is))
# define jit_modr_ul(d, s1, s2) jit_modr_ui((d), (s1), (s2))
# define jit_muli_ul(d, rs, is) jit_muli_ui((d), (rs), (is))
# define jit_mulr_ul(d, s1, s2) jit_mulr_ui((d), (s1), (s2))
# define jit_rshi_ul(d, rs, is) jit_rshi_ui((d), (rs), (is))
# define jit_rshr_ul(d, s1, s2) jit_rshr_ui((d), (s1), (s2))
# define jit_bomulr_l(d, s1, s2) jit_bomulr_i((d), (s1), (s2))
/* Sign/Zero extension */
# define jit_extr_c_l(d, rs) jit_extr_c_i(d, rs)
# define jit_extr_c_ul(d, rs) jit_extr_c_ui(d, rs)
# define jit_extr_s_l(d, rs) jit_extr_s_i(d, rs)
# define jit_extr_s_ul(d, rs) jit_extr_s_ui(d, rs)
# define jit_extr_i_l(d, rs) jit_movr_i(d, rs)
# define jit_extr_i_ul(d, rs) jit_movr_i(d, rs)
/* Unary */
# define jit_movi_l(d, rs) jit_movi_i((d), (rs))
# define jit_movr_l(d, rs) jit_movr_i((d), (rs))
/* Stack */
# define jit_pushr_l(rs) jit_pushr_i(rs)
# define jit_popr_l(rs) jit_popr_i(rs)
# define jit_pusharg_l(rs) jit_pusharg_i(rs)
/* Memory */
# ifndef JIT_RZERO
# define jit_ldr_l(d, rs) jit_ldr_i((d), (rs))
# define jit_ldi_l(d, is) jit_ldi_i((d), (is))
# define jit_str_l(d, rs) jit_str_i((d), (rs))
# define jit_sti_l(d, is) jit_sti_i((d), (is))
# define jit_ldr_ui(d, rs) jit_ldr_i((d), (rs))
# define jit_ldi_ui(d, is) jit_ldi_i((d), (is))
# endif
# define jit_ldxr_l(d, s1, s2) jit_ldxr_i((d), (s1), (s2))
# define jit_ldxi_l(d, rs, is) jit_ldxi_i((d), (rs), (is))
# define jit_stxr_l(d, s1, s2) jit_stxr_i((d), (s1), (s2))
# define jit_stxi_l(d, rs, is) jit_stxi_i((d), (rs), (is))
# if !defined (jit_ldxr_ui)
# define jit_ldxr_ui(d, s1, s2) jit_ldxr_i((d), (s1), (s2))
# endif
# if !defined (jit_ldxi_ui)
# define jit_ldxi_ui(d, rs, is) jit_ldxi_i((d), (rs), (is))
# endif
/* Boolean */
# define jit_ltr_l(d, s1, s2) jit_ltr_i((d), (s1), (s2))
# define jit_lti_l(d, rs, is) jit_lti_i((d), (rs), (is))
# define jit_ler_l(d, s1, s2) jit_ler_i((d), (s1), (s2))
# define jit_lei_l(d, rs, is) jit_lei_i((d), (rs), (is))
# define jit_gtr_l(d, s1, s2) jit_gtr_i((d), (s1), (s2))
# define jit_gti_l(d, rs, is) jit_gti_i((d), (rs), (is))
# define jit_ger_l(d, s1, s2) jit_ger_i((d), (s1), (s2))
# define jit_gei_l(d, rs, is) jit_gei_i((d), (rs), (is))
# define jit_eqr_l(d, s1, s2) jit_eqr_i((d), (s1), (s2))
# define jit_eqi_l(d, rs, is) jit_eqi_i((d), (rs), (is))
# define jit_ner_l(d, s1, s2) jit_ner_i((d), (s1), (s2))
# define jit_nei_l(d, rs, is) jit_nei_i((d), (rs), (is))
# define jit_ltr_ul(d, s1, s2) jit_ltr_ui((d), (s1), (s2))
# define jit_lti_ul(d, rs, is) jit_lti_ui((d), (rs), (is))
# define jit_ler_ul(d, s1, s2) jit_ler_ui((d), (s1), (s2))
# define jit_lei_ul(d, rs, is) jit_lei_ui((d), (rs), (is))
# define jit_gtr_ul(d, s1, s2) jit_gtr_ui((d), (s1), (s2))
# define jit_gti_ul(d, rs, is) jit_gti_ui((d), (rs), (is))
# define jit_ger_ul(d, s1, s2) jit_ger_ui((d), (s1), (s2))
# define jit_gei_ul(d, rs, is) jit_gei_ui((d), (rs), (is))
/* Branches */
# define jit_bltr_l(label, s1, s2) jit_bltr_i((label), (s1), (s2))
# define jit_blti_l(label, rs, is) jit_blti_i((label), (rs), (is))
# define jit_bler_l(label, s1, s2) jit_bler_i((label), (s1), (s2))
# define jit_blei_l(label, rs, is) jit_blei_i((label), (rs), (is))
# define jit_bgtr_l(label, s1, s2) jit_bgtr_i((label), (s1), (s2))
# define jit_bgti_l(label, rs, is) jit_bgti_i((label), (rs), (is))
# define jit_bger_l(label, s1, s2) jit_bger_i((label), (s1), (s2))
# define jit_bgei_l(label, rs, is) jit_bgei_i((label), (rs), (is))
# define jit_beqr_l(label, s1, s2) jit_beqr_i((label), (s1), (s2))
# define jit_beqi_l(label, rs, is) jit_beqi_i((label), (rs), (is))
# define jit_bner_l(label, s1, s2) jit_bner_i((label), (s1), (s2))
# define jit_bnei_l(label, rs, is) jit_bnei_i((label), (rs), (is))
# define jit_bmcr_l(label, s1, s2) jit_bmcr_i((label), (s1), (s2))
# define jit_bmci_l(label, rs, is) jit_bmci_i((label), (rs), (is))
# define jit_bmsr_l(label, s1, s2) jit_bmsr_i((label), (s1), (s2))
# define jit_bmsi_l(label, rs, is) jit_bmsi_i((label), (rs), (is))
# define jit_boaddr_l(label, s1, s2) jit_boaddr_i((label), (s1), (s2))
# define jit_boaddi_l(label, rs, is) jit_boaddi_i((label), (rs), (is))
# define jit_bosubr_l(label, s1, s2) jit_bosubr_i((label), (s1), (s2))
# define jit_bosubi_l(label, rs, is) jit_bosubi_i((label), (rs), (is))
# define jit_bltr_ul(label, s1, s2) jit_bltr_ui((label), (s1), (s2))
# define jit_blti_ul(label, rs, is) jit_blti_ui((label), (rs), (is))
# define jit_bler_ul(label, s1, s2) jit_bler_ui((label), (s1), (s2))
# define jit_blei_ul(label, rs, is) jit_blei_ui((label), (rs), (is))
# define jit_bgtr_ul(label, s1, s2) jit_bgtr_ui((label), (s1), (s2))
# define jit_bgti_ul(label, rs, is) jit_bgti_ui((label), (rs), (is))
# define jit_bger_ul(label, s1, s2) jit_bger_ui((label), (s1), (s2))
# define jit_bgei_ul(label, rs, is) jit_bgei_ui((label), (rs), (is))
# define jit_boaddr_ul(label, s1, s2) jit_boaddr_ui((label), (s1), (s2))
# define jit_boaddi_ul(label, rs, is) jit_boaddi_ui((label), (rs), (is))
# define jit_bosubr_ul(label, s1, s2) jit_bosubr_ui((label), (s1), (s2))
# define jit_bosubi_ul(label, rs, is) jit_bosubi_ui((label), (rs), (is))
# define jit_retval_l(rd) jit_retval_i((rd))
#endif /* __WORDSIZE == 32 */
/* RSB is not mandatory */
#ifndef jit_rsbi_i
# define jit_rsbi_i(d, rs, is) (jit_subi_i((d), (rs), (is)), jit_negr_i((d), (d)))
# ifndef jit_rsbi_l
# define jit_rsbi_l(d, rs, is) (jit_subi_l((d), (rs), (is)), jit_negr_l((d), (d)))
# endif
#endif
#endif /* __lightning_core_common_h_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,188 @@
/******************************** -*- C -*- ****************************
*
* Platform-independent layer floating-point interface
*
***********************************************************************/
/***********************************************************************
*
* Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
* Written by Paolo Bonzini.
*
* This file is part of GNU lightning.
*
* GNU lightning is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU lightning is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with GNU lightning; see the file COPYING.LESSER; if not, write to the
* Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
***********************************************************************/
#define JIT_FPR0 JIT_FPR(0)
#define JIT_FPR1 JIT_FPR(1)
#define JIT_FPR2 JIT_FPR(2)
#define JIT_FPR3 JIT_FPR(3)
#define JIT_FPR4 JIT_FPR(4)
#define JIT_FPR5 JIT_FPR(5)
#ifdef JIT_RZERO
#ifndef jit_ldi_f
#define jit_ldi_f(rd, is) jit_ldxi_f((rd), JIT_RZERO, (is))
#define jit_sti_f(id, rs) jit_stxi_f((id), JIT_RZERO, (rs))
#define jit_ldi_d(rd, is) jit_ldxi_d((rd), JIT_RZERO, (is))
#define jit_sti_d(id, rs) jit_stxi_d((id), JIT_RZERO, (rs))
#endif
#ifndef jit_ldr_f
#define jit_ldr_f(rd, rs) jit_ldxr_f((rd), JIT_RZERO, (rs))
#define jit_str_f(rd, rs) jit_stxr_f((rd), JIT_RZERO, (rs))
#define jit_ldr_d(rd, rs) jit_ldxr_d((rd), JIT_RZERO, (rs))
#define jit_str_d(rd, rs) jit_stxr_d((rd), JIT_RZERO, (rs))
#endif
#endif
#ifndef jit_addr_f
#define jit_addr_f(rd,s1,s2) jit_addr_d(rd,s1,s2)
#define jit_subr_f(rd,s1,s2) jit_subr_d(rd,s1,s2)
#define jit_mulr_f(rd,s1,s2) jit_mulr_d(rd,s1,s2)
#define jit_divr_f(rd,s1,s2) jit_divr_d(rd,s1,s2)
#define jit_movr_f(rd,rs) jit_movr_d(rd,rs)
#endif
#if !defined(jit_absr_f)
#define jit_absr_f(rd,rs) jit_absr_d(rd,rs)
#define jit_negr_f(rd,rs) jit_negr_d(rd,rs)
#define jit_sqrtr_f(rd,rs) jit_sqrtr_d(rd,rs)
#endif
#if !defined(jit_extr_i_f)
# define jit_extr_i_f(rd, rs) jit_extr_i_d(rd, rs)
#endif
#if !defined(jit_rintr_d_i)
# define jit_rintr_d_i(rd, rs) jit_truncr_d_i(rd, rs)
#endif
#if !defined(jit_rintr_f_i)
# define jit_rintr_f_i(rd, rs) jit_rintr_d_i(rd, rs)
#endif
#if !defined(jit_roundr_f_i)
# define jit_roundr_f_i(rd, rs) jit_roundr_d_i(rd, rs)
# define jit_floorr_f_i(rd, rs) jit_floorr_d_i(rd, rs)
# define jit_ceilr_f_i(rd, rs) jit_ceilr_d_i(rd, rs)
# define jit_truncr_f_i(rd, rs) jit_truncr_d_i(rd, rs)
#endif
#if !defined(jit_eqr_f)
#define jit_eqr_f(rd, s0, s1) jit_eqr_d(rd, s0, s1)
#define jit_ner_f(rd, s0, s1) jit_ner_d(rd, s0, s1)
#define jit_gtr_f(rd, s0, s1) jit_gtr_d(rd, s0, s1)
#define jit_ger_f(rd, s0, s1) jit_ger_d(rd, s0, s1)
#define jit_ltr_f(rd, s0, s1) jit_ltr_d(rd, s0, s1)
#define jit_ler_f(rd, s0, s1) jit_ler_d(rd, s0, s1)
#define jit_uneqr_f(rd, s0, s1) jit_uneqr_d(rd, s0, s1)
#define jit_ltgtr_f(rd, s0, s1) jit_ltgtr_d(rd, s0, s1)
#define jit_ungtr_f(rd, s0, s1) jit_ungtr_d(rd, s0, s1)
#define jit_unger_f(rd, s0, s1) jit_unger_d(rd, s0, s1)
#define jit_unltr_f(rd, s0, s1) jit_unltr_d(rd, s0, s1)
#define jit_unler_f(rd, s0, s1) jit_unler_d(rd, s0, s1)
#define jit_ordr_f(rd, s0, s1) jit_ordr_d(rd, s0, s1)
#define jit_unordr_f(rd, s0, s1) jit_unordr_d(rd, s0, s1)
#endif
#if !defined(jit_retval_f)
#define jit_retval_f(rs) jit_retval_d(rs)
#endif
#ifndef jit_extr_f_d
# define jit_extr_f_d(rd, rs) jit_movr_d(rd, rs)
#endif
#ifndef jit_extr_d_f
# define jit_extr_d_f(rd, rs) jit_movr_d(rd, rs)
#endif
#if !defined(__WORDSIZE) || __WORDSIZE == 32
# if !defined(jit_extr_l_f)
# define jit_extr_l_f(rd, rs) jit_extr_i_f(rd, rs)
# endif
# if !defined(jit_extr_l_d)
# define jit_extr_l_d(rd, rs) jit_extr_i_d(rd, rs)
# endif
# if !defined(jit_roundr_f_l)
# if defined(jit_rintr_f_i)
# define jit_rintr_f_l(rd, rs) jit_rintr_f_i(rd, rs)
# endif
# define jit_roundr_f_l(rd, rs) jit_roundr_f_i(rd, rs)
# define jit_truncr_f_l(rd, rs) jit_truncr_f_i(rd, rs)
# define jit_floorr_f_l(rd, rs) jit_floorr_f_i(rd, rs)
# define jit_ceilr_f_l(rd, rs) jit_ceilr_f_i(rd, rs)
# endif
# if !defined(jit_roundr_d_l)
# if defined(jit_rintr_d_i)
# define jit_rintr_d_l(rd, rs) jit_rintr_d_i(rd, rs)
# endif
# define jit_roundr_d_l(rd, rs) jit_roundr_d_i(rd, rs)
# define jit_truncr_d_l(rd, rs) jit_truncr_d_i(rd, rs)
# define jit_floorr_d_l(rd, rs) jit_floorr_d_i(rd, rs)
# define jit_ceilr_d_l(rd, rs) jit_ceilr_d_i(rd, rs)
# endif
#endif
#ifndef jit_beqr_f
#define jit_beqr_f(lab, a, b) jit_beqr_d(lab, a, b)
#define jit_bner_f(lab, a, b) jit_bner_d(lab, a, b)
#define jit_bgtr_f(lab, a, b) jit_bgtr_d(lab, a, b)
#define jit_bger_f(lab, a, b) jit_bger_d(lab, a, b)
#define jit_bltr_f(lab, a, b) jit_bltr_d(lab, a, b)
#define jit_bler_f(lab, a, b) jit_bler_d(lab, a, b)
#define jit_buneqr_f(lab, a, b) jit_buneqr_d(lab, a, b)
#define jit_bltgtr_f(lab, a, b) jit_bltgtr_d(lab, a, b)
#define jit_bungtr_f(lab, a, b) jit_bungtr_d(lab, a, b)
#define jit_bunger_f(lab, a, b) jit_bunger_d(lab, a, b)
#define jit_bunltr_f(lab, a, b) jit_bunltr_d(lab, a, b)
#define jit_bunler_f(lab, a, b) jit_bunler_d(lab, a, b)
#define jit_bordr_f(lab, a, b) jit_bordr_d(lab, a, b)
#define jit_bunordr_f(lab, a, b) jit_bunordr_d(lab, a, b)
#endif
#ifndef jit_retval_f
#define jit_retval_f(op1) jit_movr_f((op1), JIT_FPRET)
#endif
#ifndef jit_retval_d
#define jit_retval_d(op1) jit_movr_d((op1), JIT_FPRET)
#endif
#ifndef jit_prolog_d
#define jit_prolog_f(numargs)
#define jit_prolog_d(numargs)
#endif
#ifndef jit_leaf_d
#define jit_leaf_f(numargs) jit_prolog_f(numargs)
#define jit_leaf_d(numargs) jit_prolog_d(numargs)
#endif
#ifndef jit_getarg_f
#ifndef JIT_AP
#define jit_getarg_f(reg, ofs) jit_movr_f ((reg), (ofs))
#define jit_getarg_d(reg, ofs) jit_movr_d ((reg), (ofs))
#else
#define jit_getarg_f(reg, ofs) jit_ldxi_f((reg), JIT_AP, (ofs));
#define jit_getarg_d(reg, ofs) jit_ldxi_d((reg), JIT_AP, (ofs));
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,47 @@
/******************************** -*- C -*- ****************************
*
* Platform-independent layer inline functions (common part)
*
***********************************************************************/
/***********************************************************************
*
* Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
* Written by Paolo Bonzini.
*
* This file is part of GNU lightning.
*
* GNU lightning is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU lightning is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with GNU lightning; see the file COPYING.LESSER; if not, write to the
* Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
***********************************************************************/
#ifndef __lightning_funcs_common_h
#define __lightning_funcs_common_h
#include <stdio.h>
#include <stdlib.h>
int
jit_fail(const char *msg, const char *file, int line, const char *function)
{
fprintf(stderr, "%s: In function `%s':\n", file, function);
fprintf(stderr, "%s:%d: %s\n", file, line, msg);
abort();
}
#endif /* __lightning_funcs_common_h */

View File

@ -0,0 +1,136 @@
/******************************** -*- C -*- ****************************
*
* Run-time assembler for the arm
*
***********************************************************************/
/***********************************************************************
*
* Copyright 2011 Free Software Foundation
*
* This file is part of GNU lightning.
*
* GNU lightning is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU lightning is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with GNU lightning; see the file COPYING.LESSER; if not, write to the
* Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
* Authors:
* Paulo Cesar Pereira de Andrade
***********************************************************************/
#ifndef __lightning_funcs_h
#define __lightning_funcs_h
#if defined(__linux__)
# include <stdio.h>
# include <string.h>
#endif
#include <stdlib.h>
#include <unistd.h>
#define jit_notify_freed_code() /* empty */
extern void __clear_cache(void*, void*);
__jit_inline void
jit_flush_code(void *start, void *end)
{
/* Flush via __clear_cache() --- which seems to work only for ranges
that fall within a page, so call it once for each page in the
range `start' to `end'. */
while (start < end) {
void *e;
e = (void *)(((uintptr_t)start + 4096) & ~4095);
if (e < end) {
__clear_cache(start, e);
start = e;
} else {
__clear_cache(start, end);
break;
}
}
}
#define jit_get_cpu jit_get_cpu
__jit_constructor __jit_inline void
jit_get_cpu(void)
{
static int initialized;
if (initialized)
return;
initialized = 1;
#if defined(__linux__)
{
FILE *fp;
char *ptr;
char buf[128];
if ((fp = fopen("/proc/cpuinfo", "r")) == NULL)
return;
while (fgets(buf, sizeof(buf), fp)) {
if (strncmp(buf, "CPU architecture:", 17) == 0) {
jit_cpu.version = strtol(buf + 17, &ptr, 10);
while (*ptr) {
if (*ptr == 'T' || *ptr == 't') {
++ptr;
jit_cpu.thumb = 1;
}
else if (*ptr == 'E' || *ptr == 'e') {
jit_cpu.extend = 1;
++ptr;
}
else
++ptr;
}
}
else if (strncmp(buf, "Features\t:", 10) == 0) {
if ((ptr = strstr(buf + 10, "vfpv")))
jit_cpu.vfp = strtol(ptr + 4, NULL, 0);
if ((ptr = strstr(buf + 10, "neon")))
jit_cpu.neon = 1;
if ((ptr = strstr(buf + 10, "thumb")))
jit_cpu.thumb = 1;
}
}
fclose(fp);
}
#endif
#if defined(__ARM_PCS_VFP)
if (!jit_cpu.vfp)
jit_cpu.vfp = 3;
if (!jit_cpu.version)
jit_cpu.version = 7;
jit_cpu.abi = 1;
#endif
#ifdef __VFP_FP__
if (!jit_cpu.vfp)
jit_cpu.vfp = 1;
#endif
/* armv6t2 todo (software float and thumb2) */
if (!jit_cpu.vfp && jit_cpu.thumb)
jit_cpu.thumb = 0;
/* Note that software float works only when the ABI does not use
VFP for floating-point arguments. VFP, in contrast, works
whether or not a VFP ABI is in use (since we avoid passing
floating-point arguments or receiving floating-point results in
that mode). */
}
#endif /* __lightning_funcs_h */

View File

@ -72,11 +72,15 @@ static jit_state _jit;
#define _jitl _jit.jitl #define _jitl _jit.jitl
#define jit_get_ip() (_jit.x.code) #define jit_get_ip() (_jit.x.pc)
#define jit_get_raw_ip() jit_get_ip()
#define jit_set_ip(ptr) (_jit.x.pc = (ptr), jit_get_ip ()) #define jit_set_ip(ptr) (_jit.x.pc = (ptr), jit_get_ip ())
#define jit_get_label() (_jit.x.pc) #define jit_get_label() (_jit.x.pc)
#define jit_forward() (_jit.x.pc) #define jit_forward() (_jit.x.pc)
#define jit_adjust_ip(x) x
#define jit_unadjust_ip(x) x
#define jit_field(struc, f) ( ((intptr_t) (&((struc *) 8)->f) ) - 8) #define jit_field(struc, f) ( ((intptr_t) (&((struc *) 8)->f) ) - 8)
#define jit_ptr_field(struc_p, f) ( ((intptr_t) (&((struc_p) 8)->f) ) - 8) #define jit_ptr_field(struc_p, f) ( ((intptr_t) (&((struc_p) 8)->f) ) - 8)

View File

@ -64,6 +64,19 @@ extern "C" {
#endif #endif
#ifdef MZ_USE_JIT_ARM
#include "arm/asm-common.h"
#include "arm/asm.h"
#include "arm/funcs.h"
#include "arm/funcs-common.h"
#include "arm/core.h"
#include "arm/core-common.h"
#include "arm/fp.h"
#include "arm/fp-common.h"
#endif
#ifndef JIT_R0 #ifndef JIT_R0
#error GNU lightning does not support the current target #error GNU lightning does not support the current target
#endif #endif

View File

@ -83,11 +83,15 @@ static jit_state _jit;
#define _jitl _jit.jitl #define _jitl _jit.jitl
#define jit_get_ip() (_jit.x.code) #define jit_get_ip() (_jit.x.pc)
#define jit_get_raw_ip() jit_get_ip()
#define jit_set_ip(ptr) (_jit.x.pc = (ptr), jit_get_ip ()) #define jit_set_ip(ptr) (_jit.x.pc = (ptr), jit_get_ip ())
#define jit_get_label() (_jit.x.pc) #define jit_get_label() (_jit.x.pc)
#define jit_forward() (_jit.x.pc) #define jit_forward() (_jit.x.pc)
#define jit_adjust_ip(x) x
#define jit_unadjust_ip(x) x
#define jit_field(struc, f) ( ((long) (&((struc *) 8)->f) ) - 8) #define jit_field(struc, f) ( ((long) (&((struc *) 8)->f) ) - 8)
#define jit_ptr_field(struc_p, f) ( ((long) (&((struc_p) 8)->f) ) - 8) #define jit_ptr_field(struc_p, f) ( ((long) (&((struc_p) 8)->f) ) - 8)

View File

@ -319,8 +319,6 @@ Scheme_Object *scheme_place(int argc, Scheme_Object *args[]) {
place_data->parent_gc = parent_gc; place_data->parent_gc = parent_gc;
{ {
Scheme_Object *so;
in_arg = args[2]; in_arg = args[2];
out_arg = args[3]; out_arg = args[3];
err_arg = args[4]; err_arg = args[4];

View File

@ -2572,6 +2572,11 @@ typedef struct Scheme_Native_Closure_Data {
#ifdef MZ_PRECISE_GC #ifdef MZ_PRECISE_GC
void **retained; /* inside code */ void **retained; /* inside code */
#endif #endif
#if defined(MZ_USE_JIT_ARM) && !defined(MZ_PRECISE_GC)
# define NEED_RETAIN_CODE_POINTERS
/* Thumb code is off by one, need real start for GC */
void *retain_code;
#endif
} Scheme_Native_Closure_Data; } Scheme_Native_Closure_Data;
#define SCHEME_NATIVE_CLOSURE_DATA_FLAGS(obj) MZ_OPT_HASH_KEY(&(obj)->iso) #define SCHEME_NATIVE_CLOSURE_DATA_FLAGS(obj) MZ_OPT_HASH_KEY(&(obj)->iso)
@ -3840,7 +3845,7 @@ intptr_t scheme_port_closed_p (Scheme_Object *port);
#define CURRENT_OUTPUT_PORT(config) scheme_get_param(config, MZCONFIG_OUTPUT_PORT) #define CURRENT_OUTPUT_PORT(config) scheme_get_param(config, MZCONFIG_OUTPUT_PORT)
#define CHECK_PORT_CLOSED(who, kind, port, closed) if (closed) scheme_raise_exn(MZEXN_FAIL, "%s: " kind " port is closed", who); #define CHECK_PORT_CLOSED(who, kind, port, closed) if (closed) scheme_raise_exn(MZEXN_FAIL, "%s: " kind " port is closed", who);
#ifdef USE_FCNTL_O_NONBLOCK #if defined(USE_FCNTL_O_NONBLOCK)
# define MZ_NONBLOCKING O_NONBLOCK # define MZ_NONBLOCKING O_NONBLOCK
#else #else
# define MZ_NONBLOCKING FNDELAY # define MZ_NONBLOCKING FNDELAY

File diff suppressed because it is too large Load Diff

View File

@ -32,11 +32,23 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#if defined(i386) #if defined(i386)
# define PLAIN_X86 # define PLAIN_X86
#endif #endif
#if defined(__x86_64__)
# define UNW_X86_64
#endif
#if defined(__arm__)
# define UNW_ARM
#endif
#ifdef PLAIN_X86 #if defined(PLAIN_X86)
# define UNW_IP UNW_X86_EIP # define UNW_IP UNW_X86_EIP
#else #elif defined(UNW_X86_64)
# define UNW_IP UNW_X86_64_RIP # define UNW_IP UNW_X86_64_RIP
#elif defined(UNW_ARM)
# define UNW_IP UNW_ARM_RIP
#endif
#ifdef UNW_ARM
# define CONFIG_DEBUG_FRAME
#endif #endif
#if defined(__cplusplus) || defined(c_plusplus) #if defined(__cplusplus) || defined(c_plusplus)
@ -44,10 +56,12 @@ extern "C" {
#endif #endif
#include <inttypes.h> #include <inttypes.h>
#define _XOPEN_SOURCE /* needed for Mac OS X */ #ifndef UNW_ARM
#define __USE_GNU # define _XOPEN_SOURCE /* needed for Mac OS X */
#include <ucontext.h> # define __USE_GNU
#undef __USE_GNU # include <ucontext.h>
# undef __USE_GNU
#endif
/* XXXXXXXXXXXXXXXXXXXX x86 Target XXXXXXXXXXXXXXXXXXXX */ /* XXXXXXXXXXXXXXXXXXXX x86 Target XXXXXXXXXXXXXXXXXXXX */
@ -157,13 +171,17 @@ typedef enum
} }
x86_regnum_t; x86_regnum_t;
/* On x86, we can directly use ucontext_t as the unwind context. */
typedef ucontext_t unw_tdep_context_t;
#define unw_tdep_getcontext(uc) (getcontext (uc), 0)
#endif #endif
/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
/* XXXXXXXXXXXXXXXXXXXX x86_64 Target XXXXXXXXXXXXXXXXXXXX */ /* XXXXXXXXXXXXXXXXXXXX x86_64 Target XXXXXXXXXXXXXXXXXXXX */
#ifndef PLAIN_X86 #ifdef UNW_X86_64
#define UNW_TARGET x86_64 #define UNW_TARGET x86_64
#define UNW_TARGET_X86_64 1 #define UNW_TARGET_X86_64 1
@ -216,6 +234,94 @@ typedef enum
} }
x86_64_regnum_t; x86_64_regnum_t;
/* On x86, we can directly use ucontext_t as the unwind context. */
typedef ucontext_t unw_tdep_context_t;
#define unw_tdep_getcontext(uc) (getcontext (uc), 0)
#endif
/* XXXXXXXXXXXXXXXXXXXX ARM Target XXXXXXXXXXXXXXXXXXXX */
#ifdef UNW_ARM
#define UNW_TARGET ARM
#define UNW_TARGET_ARM 1
#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
/* This needs to be big enough to accommodate "struct cursor", while
leaving some slack for future expansion. Changing this value will
require recompiling all users of this library. Stack allocation is
relatively cheap and unwind-state copying is relatively rare, so we
want to err on making it rather too big than too small. */
#define UNW_TDEP_CURSOR_LEN 127
typedef uint32_t unw_word_t;
typedef int32_t unw_sword_t;
typedef double unw_tdep_fpreg_t;
typedef enum
{
UNW_ARM_R0,
UNW_ARM_R1,
UNW_ARM_R2,
UNW_ARM_R3,
UNW_ARM_R4,
UNW_ARM_R5,
UNW_ARM_R6,
UNW_ARM_R7,
UNW_ARM_R8,
UNW_ARM_R9,
UNW_ARM_R10,
UNW_ARM_R11,
UNW_ARM_R12,
UNW_ARM_R13,
UNW_ARM_RSP = UNW_ARM_R13,
UNW_ARM_R14,
UNW_ARM_R15,
UNW_ARM_RIP = UNW_ARM_R15,
UNW_TDEP_LAST_REG = UNW_ARM_R15,
UNW_TDEP_IP = UNW_ARM_RIP,
UNW_TDEP_SP = UNW_ARM_RSP,
UNW_TDEP_EH = UNW_ARM_R0
}
arm_regnum_t;
typedef struct {
unsigned long regs[16];
} unw_tdep_context_t;
/* There is no getcontext() on ARM. Use a stub version which only saves GP
registers. FIXME: Not ideal, may not be sufficient for all libunwind
use cases. Stores pc+8, which is only approximately correct, really. */
#ifndef __thumb__
#define unw_tdep_getcontext(uc) (({ \
unw_tdep_context_t *unw_ctx = (uc); \
register unsigned long *unw_base asm ("r0") = unw_ctx; \
__asm__ __volatile__ ( \
"stmia %[base], {r0-r15}" \
: : [base] "r" (unw_base) : "memory"); \
}), 0)
#else /* __thumb__ */
#define unw_tdep_getcontext(uc) (({ \
unw_tdep_context_t *unw_ctx = (uc); \
register unsigned long *unw_base asm ("r0") = unw_ctx; \
__asm__ __volatile__ ( \
".align 2\nbx pc\nnop\n.code 32\n" \
"stmia %[base], {r0-r15}\n" \
"orr %[base], pc, #1\nbx %[base]" \
: [base] "+r" (unw_base) : : "memory", "cc"); \
}), 0)
#endif
#ifndef PT_GNU_EH_FRAME
# define PT_GNU_EH_FRAME -1
#endif
#endif #endif
/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */ /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
@ -228,15 +334,6 @@ typedef struct unw_tdep_save_loc
} }
unw_tdep_save_loc_t; unw_tdep_save_loc_t;
/* On x86, we can directly use ucontext_t as the unwind context. */
typedef ucontext_t unw_tdep_context_t;
/* XXX this is not ideal: an application should not be prevented from
using the "getcontext" name just because it's using libunwind. We
can't just use __getcontext() either, because that isn't exported
by glibc... */
#define unw_tdep_getcontext(uc) (getcontext (uc), 0)
typedef struct unw_dyn_remote_table_info typedef struct unw_dyn_remote_table_info
{ {

View File

@ -530,6 +530,7 @@ typedef struct dwarf_reg_state
unsigned short lru_chain; /* used for least-recently-used chain */ unsigned short lru_chain; /* used for least-recently-used chain */
unsigned short coll_chain; /* used for hash collisions */ unsigned short coll_chain; /* used for hash collisions */
unsigned short hint; /* hint for next rs to try (or -1) */ unsigned short hint; /* hint for next rs to try (or -1) */
char valid, signal_frame;
} }
dwarf_reg_state_t; dwarf_reg_state_t;
@ -549,6 +550,7 @@ typedef struct dwarf_cie_info
uint8_t lsda_encoding; uint8_t lsda_encoding;
unsigned int sized_augmentation : 1; unsigned int sized_augmentation : 1;
unsigned int have_abi_marker : 1; unsigned int have_abi_marker : 1;
unsigned int signal_frame : 1;
} }
dwarf_cie_info_t; dwarf_cie_info_t;
@ -581,6 +583,8 @@ typedef struct dwarf_cursor
short hint; /* faster lookup of the rs cache */ short hint; /* faster lookup of the rs cache */
short prev_rs; short prev_rs;
int use_prev_instr;
} }
dwarf_cursor_t; dwarf_cursor_t;
@ -637,6 +641,7 @@ HIDDEN int dwarf_extract_proc_info_from_fde (unw_addr_space_t as,
unw_word_t *fde_addr, unw_word_t *fde_addr,
unw_proc_info_t *pi, unw_proc_info_t *pi,
int need_unwind_info, int need_unwind_info,
unw_word_t base,
void *arg); void *arg);
HIDDEN int dwarf_find_save_locs (struct dwarf_cursor *c); HIDDEN int dwarf_find_save_locs (struct dwarf_cursor *c);
HIDDEN int dwarf_read_encoded_pointer (unw_addr_space_t as, HIDDEN int dwarf_read_encoded_pointer (unw_addr_space_t as,
@ -649,6 +654,23 @@ HIDDEN int dwarf_step (struct dwarf_cursor *c);
/*XXXXXXXXXXXXXXXXXXXXXXXXX End dwarf.h XXXXXXXXXXXXXXXXXXXXXXXXXX*/ /*XXXXXXXXXXXXXXXXXXXXXXXXX End dwarf.h XXXXXXXXXXXXXXXXXXXXXXXXXX*/
#ifdef CONFIG_DEBUG_FRAME
struct unw_debug_frame_list
{
/* The start (inclusive) and end (exclusive) of the described region. */
unw_word_t start;
unw_word_t end;
/* The debug frame itself. */
char *debug_frame;
size_t debug_frame_size;
/* Index (for binary search). */
struct table_entry *index;
size_t index_size;
/* Pointer to next descriptor. */
struct unw_debug_frame_list *next;
};
#endif
struct unw_addr_space struct unw_addr_space
{ {
void *mem_pool; void *mem_pool;
@ -660,6 +682,9 @@ struct unw_addr_space
uint32_t cache_generation; uint32_t cache_generation;
#endif #endif
struct dwarf_rs_cache global_cache; struct dwarf_rs_cache global_cache;
#ifdef CONFIG_DEBUG_FRAME
struct unw_debug_frame_list *debug_frames;
#endif
}; };
struct cursor struct cursor
@ -672,7 +697,8 @@ struct cursor
{ {
X86_SCF_NONE, /* no signal frame encountered */ X86_SCF_NONE, /* no signal frame encountered */
X86_SCF_LINUX_SIGFRAME, /* classic x86 sigcontext */ X86_SCF_LINUX_SIGFRAME, /* classic x86 sigcontext */
X86_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */ X86_SCF_LINUX_RT_SIGFRAME, /* POSIX ucontext_t */
ARM_SCF_NONE
} }
sigcontext_format; sigcontext_format;
unw_word_t sigcontext_addr; unw_word_t sigcontext_addr;
@ -756,7 +782,7 @@ extern void tdep_init (void);
extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip,
unw_dyn_info_t *di, unw_proc_info_t *pi, unw_dyn_info_t *di, unw_proc_info_t *pi,
int need_unwind_info, void *arg); int need_unwind_info, void *arg);
extern void *tdep_uc_addr (ucontext_t *uc, int reg); extern void *tdep_uc_addr (unw_context_t *uc, int reg);
extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
unsigned long *segbase, unsigned long *mapoff); unsigned long *segbase, unsigned long *mapoff);
extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg,

View File

@ -0,0 +1,297 @@
/* libunwind - a platform-independent unwind library
Copyright (C) 2003-2004 Hewlett-Packard Co
Copyright (C) 2007 David Mosberger-Tang
Contributed by David Mosberger-Tang <dmosberger@gmail.com>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef os_linux_h
#define os_linux_h
struct map_iterator
{
off_t offset;
int fd;
size_t buf_size;
char *buf;
char *buf_end;
char *path;
};
static inline char *
ltoa (char *buf, long val)
{
char *cp = buf, tmp;
ssize_t i, len;
do
{
*cp++ = '0' + (val % 10);
val /= 10;
}
while (val);
/* reverse the order of the digits: */
len = cp - buf;
--cp;
for (i = 0; i < len / 2; ++i)
{
tmp = buf[i];
buf[i] = cp[-i];
cp[-i] = tmp;
}
return buf + len;
}
static inline int
maps_init (struct map_iterator *mi, pid_t pid)
{
char path[sizeof ("/proc/0123456789/maps")], *cp;
memcpy (path, "/proc/", 6);
cp = ltoa (path + 6, pid);
assert (cp + 6 < path + sizeof (path));
memcpy (cp, "/maps", 6);
mi->fd = open (path, O_RDONLY);
if (mi->fd >= 0)
{
/* Try to allocate a page-sized buffer. */
mi->buf_size = getpagesize ();
cp = mmap (NULL, mi->buf_size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (cp == MAP_FAILED)
{
close(mi->fd);
mi->fd = -1;
return -1;
}
else
{
mi->offset = 0;
mi->buf = mi->buf_end = cp + mi->buf_size;
return 0;
}
}
return -1;
}
static inline char *
skip_whitespace (char *cp)
{
if (!cp)
return NULL;
while (*cp == ' ' || *cp == '\t')
++cp;
return cp;
}
static inline char *
scan_hex (char *cp, unsigned long *valp)
{
unsigned long num_digits = 0, digit, val = 0;
cp = skip_whitespace (cp);
if (!cp)
return NULL;
while (1)
{
digit = *cp;
if ((digit - '0') <= 9)
digit -= '0';
else if ((digit - 'a') < 6)
digit -= 'a' - 10;
else if ((digit - 'A') < 6)
digit -= 'A' - 10;
else
break;
val = (val << 4) | digit;
++num_digits;
++cp;
}
if (!num_digits)
return NULL;
*valp = val;
return cp;
}
static inline char *
scan_dec (char *cp, unsigned long *valp)
{
unsigned long num_digits = 0, digit, val = 0;
if (!(cp = skip_whitespace (cp)))
return NULL;
while (1)
{
digit = *cp;
if ((digit - '0') <= 9)
{
digit -= '0';
++cp;
}
else
break;
val = (10 * val) + digit;
++num_digits;
}
if (!num_digits)
return NULL;
*valp = val;
return cp;
}
static inline char *
scan_char (char *cp, char *valp)
{
if (!cp)
return NULL;
*valp = *cp;
/* don't step over NUL terminator */
if (*cp)
++cp;
return cp;
}
/* Scan a string delimited by white-space. Fails on empty string or
if string is doesn't fit in the specified buffer. */
static inline char *
scan_string (char *cp, char *valp, size_t buf_size)
{
size_t i = 0;
if (!(cp = skip_whitespace (cp)))
return NULL;
while (*cp != ' ' && *cp != '\t' && *cp != '\0')
{
if ((valp != NULL) && (i < buf_size - 1))
valp[i++] = *cp;
++cp;
}
if (i == 0 || i >= buf_size)
return NULL;
valp[i] = '\0';
return cp;
}
static inline int
maps_next (struct map_iterator *mi,
unsigned long *low, unsigned long *high, unsigned long *offset)
{
char perm[16], dash = 0, colon = 0, *cp;
unsigned long major, minor, inum;
ssize_t i, nread;
if (mi->fd < 0)
return 0;
while (1)
{
ssize_t bytes_left = mi->buf_end - mi->buf;
char *eol = NULL;
for (i = 0; i < bytes_left; ++i)
{
if (mi->buf[i] == '\n')
{
eol = mi->buf + i;
break;
}
else if (mi->buf[i] == '\0')
break;
}
if (!eol)
{
/* copy down the remaining bytes, if any */
if (bytes_left > 0)
memmove (mi->buf_end - mi->buf_size, mi->buf, bytes_left);
mi->buf = mi->buf_end - mi->buf_size;
nread = read (mi->fd, mi->buf + bytes_left,
mi->buf_size - bytes_left);
if (nread <= 0)
return 0;
else if ((size_t) (nread + bytes_left) < mi->buf_size)
{
/* Move contents to the end of the buffer so we
maintain the invariant that all bytes between
mi->buf and mi->buf_end are valid. */
memmove (mi->buf_end - nread - bytes_left, mi->buf,
nread + bytes_left);
mi->buf = mi->buf_end - nread - bytes_left;
}
eol = mi->buf + bytes_left + nread - 1;
for (i = bytes_left; i < bytes_left + nread; ++i)
if (mi->buf[i] == '\n')
{
eol = mi->buf + i;
break;
}
}
cp = mi->buf;
mi->buf = eol + 1;
*eol = '\0';
/* scan: "LOW-HIGH PERM OFFSET MAJOR:MINOR INUM PATH" */
cp = scan_hex (cp, low);
cp = scan_char (cp, &dash);
cp = scan_hex (cp, high);
cp = scan_string (cp, perm, sizeof (perm));
cp = scan_hex (cp, offset);
cp = scan_hex (cp, &major);
cp = scan_char (cp, &colon);
cp = scan_hex (cp, &minor);
cp = scan_dec (cp, &inum);
cp = mi->path = skip_whitespace (cp);
if (!cp)
continue;
cp = scan_string (cp, NULL, 0);
if (dash != '-' || colon != ':')
continue; /* skip line with unknown or bad format */
return 1;
}
return 0;
}
static inline void
maps_close (struct map_iterator *mi)
{
if (mi->fd < 0)
return;
close (mi->fd);
mi->fd = -1;
if (mi->buf)
{
munmap (mi->buf_end - mi->buf_size, mi->buf_size);
mi->buf = mi->buf_end = NULL;
}
}
#endif /* os_linux_h */