From f36a5a98c02ba38d05d345104b1a6d0c0c1af29b Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Wed, 29 Sep 2021 16:11:50 -0400 Subject: style: line break before "else" --- yjit_asm.c | 12 ++++++++---- yjit_codegen.c | 51 ++++++++++++++++++++++++++++++++++----------------- yjit_core.c | 36 ++++++++++++++++++++++++------------ 3 files changed, 66 insertions(+), 33 deletions(-) diff --git a/yjit_asm.c b/yjit_asm.c index e589ca1703..fa26ce0908 100644 --- a/yjit_asm.c +++ b/yjit_asm.c @@ -1544,9 +1544,11 @@ void pop(codeblock_t *cb, x86opnd_t opnd) if (rex_needed(opnd)) cb_write_rex(cb, false, 0, 0, opnd.as.reg.reg_no); cb_write_opcode(cb, 0x58, opnd); - } else if (opnd.type == OPND_MEM) { + } + else if (opnd.type == OPND_MEM) { cb_write_rm(cb, false, false, NO_OPND, opnd, 0, 1, 0x8F); - } else { + } + else { assert(false && "unexpected operand type"); } } @@ -1571,9 +1573,11 @@ void push(codeblock_t *cb, x86opnd_t opnd) if (rex_needed(opnd)) cb_write_rex(cb, false, 0, 0, opnd.as.reg.reg_no); cb_write_opcode(cb, 0x50, opnd); - } else if (opnd.type == OPND_MEM) { + } + else if (opnd.type == OPND_MEM) { cb_write_rm(cb, false, false, NO_OPND, opnd, 6, 1, 0xFF); - } else { + } + else { assert(false && "unexpected operand type"); } } diff --git a/yjit_codegen.c b/yjit_codegen.c index 97ad8d818c..887784a83d 100644 --- a/yjit_codegen.c +++ b/yjit_codegen.c @@ -1087,7 +1087,8 @@ gen_newhash(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) mov(cb, stack_ret, RAX); return YJIT_KEEP_COMPILING; - } else { + } + else { return YJIT_CANT_COMPILE; } } @@ -1199,7 +1200,8 @@ gen_putspecialobject(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) jit_mov_gc_ptr(jit, cb, REG0, rb_mRubyVMFrozenCore); mov(cb, stack_top, REG0); return YJIT_KEEP_COMPILING; - } else { + } + else { // TODO: implement for VM_SPECIAL_OBJECT_CBASE and // VM_SPECIAL_OBJECT_CONST_BASE return YJIT_CANT_COMPILE; @@ -1793,7 +1795,8 @@ gen_checktype(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) stack_ret = ctx_stack_push(ctx, TYPE_TRUE); mov(cb, stack_ret, imm_opnd(Qtrue)); return YJIT_KEEP_COMPILING; - } else if (val_type.is_imm || val_type.type != ETYPE_UNKNOWN) { + } + else if (val_type.is_imm || val_type.type != ETYPE_UNKNOWN) { // guaranteed not to match T_STRING/T_ARRAY/T_HASH stack_ret = ctx_stack_push(ctx, TYPE_FALSE); mov(cb, stack_ret, imm_opnd(Qfalse)); @@ -1828,7 +1831,8 @@ gen_checktype(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) cb_link_labels(cb); return YJIT_KEEP_COMPILING; - } else { + } + else { return YJIT_CANT_COMPILE; } } @@ -1946,7 +1950,8 @@ gen_fixnum_cmp(jitstate_t *jit, ctx_t *ctx, cmov_fn cmov_op) mov(cb, dst, REG0); return YJIT_KEEP_COMPILING; - } else { + } + else { return gen_opt_send_without_block(jit, ctx, cb); } } @@ -2007,7 +2012,8 @@ gen_equality_specialized(jitstate_t *jit, ctx_t *ctx, uint8_t *side_exit) mov(cb, dst, REG0); return true; - } else if (CLASS_OF(comptime_a) == rb_cString && + } + else if (CLASS_OF(comptime_a) == rb_cString && CLASS_OF(comptime_b) == rb_cString) { if (!assume_bop_not_redefined(jit->block, STRING_REDEFINED_OP_FLAG, BOP_EQ)) { // if overridden, emit the generic version @@ -2047,7 +2053,8 @@ gen_equality_specialized(jitstate_t *jit, ctx_t *ctx, uint8_t *side_exit) cb_link_labels(cb); return true; - } else { + } + else { return false; } } @@ -2067,7 +2074,8 @@ gen_opt_eq(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) if (gen_equality_specialized(jit, ctx, side_exit)) { jit_jump_to_next_insn(jit, ctx); return YJIT_END_BLOCK; - } else { + } + else { return gen_opt_send_without_block(jit, ctx, cb); } } @@ -2247,7 +2255,8 @@ gen_opt_aset(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) jit_jump_to_next_insn(jit, ctx); return YJIT_END_BLOCK; - } else if (CLASS_OF(comptime_recv) == rb_cHash) { + } + else if (CLASS_OF(comptime_recv) == rb_cHash) { uint8_t *side_exit = yjit_side_exit(jit, ctx); // Guard receiver is a Hash @@ -2271,7 +2280,8 @@ gen_opt_aset(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) jit_jump_to_next_insn(jit, ctx); return YJIT_END_BLOCK; - } else { + } + else { return gen_opt_send_without_block(jit, ctx, cb); } } @@ -2313,7 +2323,8 @@ gen_opt_and(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) mov(cb, dst, REG0); return YJIT_KEEP_COMPILING; - } else { + } + else { // Delegate to send, call the method on the recv return gen_opt_send_without_block(jit, ctx, cb); } @@ -2356,7 +2367,8 @@ gen_opt_or(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) mov(cb, dst, REG0); return YJIT_KEEP_COMPILING; - } else { + } + else { // Delegate to send, call the method on the recv return gen_opt_send_without_block(jit, ctx, cb); } @@ -2401,7 +2413,8 @@ gen_opt_minus(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) mov(cb, dst, REG0); return YJIT_KEEP_COMPILING; - } else { + } + else { // Delegate to send, call the method on the recv return gen_opt_send_without_block(jit, ctx, cb); } @@ -2446,7 +2459,8 @@ gen_opt_plus(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) mov(cb, dst, REG0); return YJIT_KEEP_COMPILING; - } else { + } + else { // Delegate to send, call the method on the recv return gen_opt_send_without_block(jit, ctx, cb); } @@ -3696,7 +3710,8 @@ gen_send_general(jitstate_t *jit, ctx_t *ctx, struct rb_call_data *cd, rb_iseq_t if (argc != 1 || !RB_TYPE_P(comptime_recv, T_OBJECT)) { GEN_COUNTER_INC(cb, send_ivar_set_method); return YJIT_CANT_COMPILE; - } else { + } + else { ID ivar_name = cme->def->body.attr.id; return gen_set_ivar(jit, ctx, comptime_recv, comptime_recv_klass, ivar_name); } @@ -4035,7 +4050,8 @@ gen_getspecial(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) if (type == 0) { // not yet implemented return YJIT_CANT_COMPILE; - } else if (type & 0x01) { + } + else if (type & 0x01) { // Fetch a "special" backref based on a char encoded by shifting by 1 // Can raise if matchdata uninitialized @@ -4071,7 +4087,8 @@ gen_getspecial(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb) mov(cb, stack_ret, RAX); return YJIT_KEEP_COMPILING; - } else { + } + else { // Fetch the N-th match from the last backref based on type shifted by 1 // Can raise if matchdata uninitialized diff --git a/yjit_core.c b/yjit_core.c index f07e990363..2edf386d9a 100644 --- a/yjit_core.c +++ b/yjit_core.c @@ -224,7 +224,8 @@ ctx_get_opnd_mapping(const ctx_t *ctx, insn_opnd_t opnd) if (stack_idx < MAX_TEMP_TYPES) { type_mapping.mapping = ctx->temp_mapping[stack_idx]; - } else { + } + else { // We can't know the source of this stack operand, so we assume it is // a stack-only temporary. type will be UNKNOWN RUBY_ASSERT(type_mapping.type.type == ETYPE_UNKNOWN); @@ -302,21 +303,28 @@ yjit_type_of_value(VALUE val) if (SPECIAL_CONST_P(val)) { if (FIXNUM_P(val)) { return TYPE_FIXNUM; - } else if (NIL_P(val)) { + } + else if (NIL_P(val)) { return TYPE_NIL; - } else if (val == Qtrue) { + } + else if (val == Qtrue) { return TYPE_TRUE; - } else if (val == Qfalse) { + } + else if (val == Qfalse) { return TYPE_FALSE; - } else if (STATIC_SYM_P(val)) { + } + else if (STATIC_SYM_P(val)) { return TYPE_STATIC_SYMBOL; - } else if (FLONUM_P(val)) { + } + else if (FLONUM_P(val)) { return TYPE_FLONUM; - } else { + } + else { RUBY_ASSERT(false); UNREACHABLE_RETURN(TYPE_IMM); } - } else { + } + else { switch (BUILTIN_TYPE(val)) { case T_ARRAY: return TYPE_ARRAY; @@ -341,9 +349,11 @@ yjit_type_name(val_type_t type) case ETYPE_UNKNOWN: if (type.is_imm) { return "unknown immediate"; - } else if (type.is_heap) { + } + else if (type.is_heap) { return "unknown heap"; - } else { + } + else { return "unknown"; } case ETYPE_NIL: @@ -462,10 +472,12 @@ int ctx_diff(const ctx_t *src, const ctx_t *dst) // We can safely drop information about the source of the temp // stack operand. diff += 1; - } else { + } + else { return INT_MAX; } - } else if (m_dst.mapping.idx != m_src.mapping.idx) { + } + else if (m_dst.mapping.idx != m_src.mapping.idx) { return INT_MAX; } -- cgit v1.2.3