Reduce instruction size

This commit is contained in:
take-cheeze
2018-10-29 19:17:05 +09:00
parent eebb56713e
commit 3248de83b6
5 changed files with 130 additions and 55 deletions
+11 -11
View File
@@ -70,17 +70,17 @@ OPCODE(RETURN, B) /* return R(a) (normal) */
OPCODE(RETURN_BLK, B) /* return R(a) (in-block return) */
OPCODE(BREAK, B) /* break R(a) */
OPCODE(BLKPUSH, BS) /* R(a) = block (16=m5:r1:m5:d1:lv4) */
OPCODE(ADD, BB) /* R(a) = R(a)+R(a+1) (Syms[b]=:+) */
OPCODE(ADDI, BBB) /* R(a) = R(a)+mrb_int(c) (Syms[b]=:+) */
OPCODE(SUB, BB) /* R(a) = R(a)-R(a+1) (Syms[b]=:-) */
OPCODE(SUBI, BBB) /* R(a) = R(a)-C (Syms[b]=:-) */
OPCODE(MUL, BB) /* R(a) = R(a)*R(a+1) (Syms[b]=:*) */
OPCODE(DIV, BB) /* R(a) = R(a)/R(a+1) (Syms[b]=:/) */
OPCODE(EQ, BB) /* R(a) = R(a)==R(a+1) (Syms[b]=:==) */
OPCODE(LT, BB) /* R(a) = R(a)<R(a+1) (Syms[b]=:<) */
OPCODE(LE, BB) /* R(a) = R(a)<=R(a+1) (Syms[b]=:<=) */
OPCODE(GT, BB) /* R(a) = R(a)>R(a+1) (Syms[b]=:>) */
OPCODE(GE, BB) /* R(a) = R(a)>=R(a+1) (Syms[b]=:>=) */
OPCODE(ADD, B) /* R(a) = R(a)+R(a+1) */
OPCODE(ADDI, BB) /* R(a) = R(a)+mrb_int(c) */
OPCODE(SUB, B) /* R(a) = R(a)-R(a+1) */
OPCODE(SUBI, BB) /* R(a) = R(a)-C */
OPCODE(MUL, B) /* R(a) = R(a)*R(a+1) */
OPCODE(DIV, B) /* R(a) = R(a)/R(a+1) */
OPCODE(EQ, B) /* R(a) = R(a)==R(a+1) */
OPCODE(LT, B) /* R(a) = R(a)<R(a+1) */
OPCODE(LE, B) /* R(a) = R(a)<=R(a+1) */
OPCODE(GT, B) /* R(a) = R(a)>R(a+1) */
OPCODE(GE, B) /* R(a) = R(a)>=R(a+1) */
OPCODE(ARRAY, BB) /* R(a) = ary_new(R(a),R(a+1)..R(a+b)) */
OPCODE(ARRAY2, BBB) /* R(a) = ary_new(R(b),R(b+1)..R(b+c)) */
OPCODE(ARYCAT, B) /* ary_cat(R(a),R(a+1)) */
+32
View File
@@ -0,0 +1,32 @@
/*
** mruby/symbol.h - symbol utilities
**
** See Copyright Notice in mruby.h
*/
#ifndef MRUBY_SYMBOL_H
#define MRUBY_SYMBOL_H
#include "common.h"
/**
* Symbol utilities
*/
MRB_BEGIN_DECL
typedef enum mrb_reserved_symbol {
mrb_sym_add = 1, // +
mrb_sym_sub = 2, // -
mrb_sym_mul = 3, // *
mrb_sym_div = 4, // /
mrb_sym_eq = 5, // ==
mrb_sym_lt = 6, // <
mrb_sym_le = 7, // <=
mrb_sym_gt = 8, // >
mrb_sym_ge = 9, // >=
mrb_sym_method_missing = 10, // method_missing
} mrb_reserved_symbol;
MRB_END_DECL
#endif /* MRUBY_SYMBOL_H */