mirror of
https://github.com/janet-lang/janet
synced 2025-07-08 13:02:55 +00:00
Format.
This commit is contained in:
parent
3cbdf26aa2
commit
c9305a0a42
@ -1087,8 +1087,7 @@ static int check_const_valid(JanetSysIR *sysir, Janet constant, uint32_t t) {
|
|||||||
switch (janet_type(constant)) {
|
switch (janet_type(constant)) {
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
case JANET_TUPLE:
|
case JANET_TUPLE: {
|
||||||
{
|
|
||||||
const Janet *elements = janet_unwrap_tuple(constant);
|
const Janet *elements = janet_unwrap_tuple(constant);
|
||||||
int32_t len = janet_tuple_length(elements);
|
int32_t len = janet_tuple_length(elements);
|
||||||
if (p != JANET_PRIM_ARRAY) return 0;
|
if (p != JANET_PRIM_ARRAY) return 0;
|
||||||
@ -1104,8 +1103,7 @@ static int check_const_valid(JanetSysIR *sysir, Janet constant, uint32_t t) {
|
|||||||
case JANET_SYMBOL:
|
case JANET_SYMBOL:
|
||||||
case JANET_POINTER:
|
case JANET_POINTER:
|
||||||
return p == JANET_PRIM_POINTER;
|
return p == JANET_PRIM_POINTER;
|
||||||
case JANET_NUMBER:
|
case JANET_NUMBER: {
|
||||||
{
|
|
||||||
double x = janet_unwrap_number(constant);
|
double x = janet_unwrap_number(constant);
|
||||||
if (p == JANET_PRIM_F64) return 1;
|
if (p == JANET_PRIM_F64) return 1;
|
||||||
if (p == JANET_PRIM_F32) return 1;
|
if (p == JANET_PRIM_F32) return 1;
|
||||||
@ -1120,8 +1118,7 @@ static int check_const_valid(JanetSysIR *sysir, Janet constant, uint32_t t) {
|
|||||||
if (p == JANET_PRIM_S64 && (x >= INT64_MIN && x <= INT64_MAX)) return 1;
|
if (p == JANET_PRIM_S64 && (x >= INT64_MIN && x <= INT64_MAX)) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case JANET_ABSTRACT:
|
case JANET_ABSTRACT: {
|
||||||
{
|
|
||||||
void *point = janet_unwrap_abstract(constant);
|
void *point = janet_unwrap_abstract(constant);
|
||||||
const JanetAbstractType *at = janet_abstract_type(point);
|
const JanetAbstractType *at = janet_abstract_type(point);
|
||||||
if (at == &janet_s64_type && p == JANET_PRIM_S64) return 1;
|
if (at == &janet_s64_type && p == JANET_PRIM_S64) return 1;
|
||||||
|
@ -363,12 +363,14 @@ static void e_mov_to_reg(JanetSysx64Context *ctx, x64Reg d, x64Reg s, MoveMode m
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mm == MOV_LOAD || s.storage != JANET_SYSREG_REGISTER) {
|
if (mm == MOV_LOAD || s.storage != JANET_SYSREG_REGISTER) {
|
||||||
x64Reg t = d; d = s; s = t; /* swap */
|
x64Reg t = d;
|
||||||
|
d = s;
|
||||||
|
s = t; /* swap */
|
||||||
flip = 1;
|
flip = 1;
|
||||||
}
|
}
|
||||||
assert(s.storage == JANET_SYSREG_REGISTER);
|
assert(s.storage == JANET_SYSREG_REGISTER);
|
||||||
opcode = 0x88;
|
opcode = 0x88;
|
||||||
mod_rm |= (uint8_t) (s.index & 7) << 3;
|
mod_rm |= (uint8_t)(s.index & 7) << 3;
|
||||||
if (s.index >= 8) rex |= REX_R;
|
if (s.index >= 8) rex |= REX_R;
|
||||||
if (s.kind >= JANET_SYSREG_64) rex |= REX_W;
|
if (s.kind >= JANET_SYSREG_64) rex |= REX_W;
|
||||||
if (d.storage == JANET_SYSREG_REGISTER) {
|
if (d.storage == JANET_SYSREG_REGISTER) {
|
||||||
@ -376,7 +378,7 @@ static void e_mov_to_reg(JanetSysx64Context *ctx, x64Reg d, x64Reg s, MoveMode m
|
|||||||
if (mm == MOV_FLAT) {
|
if (mm == MOV_FLAT) {
|
||||||
mod_rm |= 0xC0u; /* mod = b11, reg, reg mode */
|
mod_rm |= 0xC0u; /* mod = b11, reg, reg mode */
|
||||||
}
|
}
|
||||||
mod_rm |= (uint8_t) (d.index & 7);
|
mod_rm |= (uint8_t)(d.index & 7);
|
||||||
} else {
|
} else {
|
||||||
assert(mm == MOV_FLAT);
|
assert(mm == MOV_FLAT);
|
||||||
/* d is memory */
|
/* d is memory */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user