00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef DEFS_HPP
00011 #define DEFS_HPP
00012
00013 namespace ClassEncoder
00014 {
00015
00016 static const long JVM_MAGIC = 0xCAFEBABEu;
00017 static const int JVM_MINOR_VER = 3;
00018 static const int JVM_MAJOR_VER = 45;
00019
00020
00021 typedef unsigned char u1;
00022 typedef unsigned short u2;
00023 typedef unsigned int u4;
00024
00026
00029 enum _constant_tags {
00030 CONSTANT_Utf8 = 1,
00031
00032 CONSTANT_Integer = 3,
00033 CONSTANT_Float,
00034 CONSTANT_Long,
00035 CONSTANT_Double,
00036 CONSTANT_Class,
00037 CONSTANT_String,
00038 CONSTANT_Fieldref,
00039 CONSTANT_Methodref,
00040 CONSTANT_InterfaceMethodref,
00041 CONSTANT_NameAndType
00042 };
00043
00045 enum _basic_data_types {
00046 T_BOOLEAN = 4,
00047 T_CHAR,
00048 T_FLOAT,
00049 T_DOUBLE,
00050 T_BYTE,
00051 T_SHORT,
00052 T_INT,
00053 T_LONG
00054 };
00055
00057
00060 enum _opcode {
00061 jvm_nop = 0x0,
00062 jvm_aconst_null,
00063 jvm_iconst_m1,
00064 jvm_iconst_0,
00065 jvm_iconst_1,
00066 jvm_iconst_2,
00067 jvm_iconst_3,
00068 jvm_iconst_4,
00069 jvm_iconst_5,
00070 jvm_lconst_0,
00071 jvm_lconst_1,
00072 jvm_fconst_0,
00073 jvm_fconst_1,
00074 jvm_fconst_2,
00075 jvm_dconst_0,
00076 jvm_dconst_1,
00077 jvm_bipush,
00078 jvm_sipush,
00079 jvm_ldc,
00080 jvm_ldc_w,
00081 jvm_ldc2_w,
00082 jvm_iload,
00083 jvm_lload,
00084 jvm_fload,
00085 jvm_dload,
00086 jvm_aload,
00087 jvm_iload_0,
00088 jvm_iload_1,
00089 jvm_iload_2,
00090 jvm_iload_3,
00091 jvm_lload_0,
00092 jvm_lload_1,
00093 jvm_lload_2,
00094 jvm_lload_3,
00095 jvm_fload_0,
00096 jvm_fload_1,
00097 jvm_fload_2,
00098 jvm_fload_3,
00099 jvm_dload_0,
00100 jvm_dload_1,
00101 jvm_dload_2,
00102 jvm_dload_3,
00103 jvm_aload_0,
00104 jvm_aload_1,
00105 jvm_aload_2,
00106 jvm_aload_3,
00107 jvm_iaload,
00108 jvm_laload,
00109 jvm_faload,
00110 jvm_daload,
00111 jvm_aaload,
00112 jvm_baload,
00113 jvm_caload,
00114 jvm_saload,
00115 jvm_istore,
00116 jvm_lstore,
00117 jvm_fstore,
00118 jvm_dstore,
00119 jvm_astore,
00120 jvm_istore_0,
00121 jvm_istore_1,
00122 jvm_istore_2,
00123 jvm_istore_3,
00124 jvm_lstore_0,
00125 jvm_lstore_1,
00126 jvm_lstore_2,
00127 jvm_lstore_3,
00128 jvm_fstore_0,
00129 jvm_fstore_1,
00130 jvm_fstore_2,
00131 jvm_fstore_3,
00132 jvm_dstore_0,
00133 jvm_dstore_1,
00134 jvm_dstore_2,
00135 jvm_dstore_3,
00136 jvm_astore_0,
00137 jvm_astore_1,
00138 jvm_astore_2,
00139 jvm_astore_3,
00140 jvm_iastore,
00141 jvm_lastore,
00142 jvm_fastore,
00143 jvm_dastore,
00144 jvm_aastore,
00145 jvm_bastore,
00146 jvm_castore,
00147 jvm_sastore,
00148 jvm_pop,
00149 jvm_pop2,
00150 jvm_dup,
00151 jvm_dup_x1,
00152 jvm_dup_x2,
00153 jvm_dup2,
00154 jvm_dup2_x1,
00155 jvm_dup2_x2,
00156 jvm_swap,
00157 jvm_iadd,
00158 jvm_ladd,
00159 jvm_fadd,
00160 jvm_dadd,
00161 jvm_isub,
00162 jvm_lsub,
00163 jvm_fsub,
00164 jvm_dsub,
00165 jvm_imul,
00166 jvm_lmul,
00167 jvm_fmul,
00168 jvm_dmul,
00169 jvm_idiv,
00170 jvm_ldiv,
00171 jvm_fdiv,
00172 jvm_ddiv,
00173 jvm_irem,
00174 jvm_lrem,
00175 jvm_frem,
00176 jvm_drem,
00177 jvm_ineg,
00178 jvm_lneg,
00179 jvm_fneg,
00180 jvm_dneg,
00181 jvm_ishl,
00182 jvm_lshl,
00183 jvm_ishr,
00184 jvm_lshr,
00185 jvm_iushr,
00186 jvm_lushr,
00187 jvm_iand,
00188 jvm_land,
00189 jvm_ior,
00190 jvm_lor,
00191 jvm_ixor,
00192 jvm_lxor,
00193 jvm_iinc,
00194 jvm_i2l,
00195 jvm_i2f,
00196 jvm_i2d,
00197 jvm_l2i,
00198 jvm_l2f,
00199 jvm_l2d,
00200 jvm_f2i,
00201 jvm_f2l,
00202 jvm_f2d,
00203 jvm_d2i,
00204 jvm_d2l,
00205 jvm_d2f,
00206 jvm_i2b,
00207 jvm_i2c,
00208 jvm_i2s,
00209 jvm_lcmp,
00210 jvm_fcmpl,
00211 jvm_fcmpg,
00212 jvm_dcmpl,
00213 jvm_dcmpg,
00214 jvm_ifeq,
00215 jvm_ifne,
00216 jvm_iflt,
00217 jvm_ifge,
00218 jvm_ifgt,
00219 jvm_ifle,
00220 jvm_if_icmpeq,
00221 jvm_if_icmpne,
00222 jvm_if_icmplt,
00223 jvm_if_icmpge,
00224 jvm_if_icmpgt,
00225 jvm_if_icmple,
00226 jvm_if_acmpeq,
00227 jvm_if_acmpne,
00228 jvm_goto,
00229 jvm_jsr,
00230 jvm_ret,
00231 jvm_tableswitch,
00232 jvm_lookupswitch,
00233 jvm_ireturn,
00234 jvm_lreturn,
00235 jvm_freturn,
00236 jvm_dreturn,
00237 jvm_areturn,
00238 jvm_return,
00239 jvm_getstatic,
00240 jvm_putstatic,
00241 jvm_getfield,
00242 jvm_putfield,
00243 jvm_invokevirtual,
00244 jvm_invokespecial,
00245 jvm_invokestatic,
00246 jvm_invokeinterface,
00247 jvm_xxxunusedxxx,
00248 jvm_new,
00249 jvm_newarray,
00250 jvm_anewarray,
00251 jvm_arraylength,
00252 jvm_athrow,
00253 jvm_checkcast,
00254 jvm_instanceof,
00255 jvm_monitorenter,
00256 jvm_monitorexit,
00257 jvm_wide,
00258 jvm_multianewarray,
00259 jvm_ifnull,
00260 jvm_ifnonnull,
00261 jvm_goto_w,
00262 jvm_jsr_w,
00263 jvm_breakpoint,
00264
00265 jvm_impdep1 = 254,
00266 jvm_impdep2
00267 };
00268
00269
00270 static const int ACC_PUBLIC = 0x0001;
00271 static const int ACC_PRIVATE = 0x0002;
00272 static const int ACC_PROTECTED = 0x0004;
00273 static const int ACC_STATIC = 0x0008;
00274 static const int ACC_FINAL = 0x0010;
00275 static const int ACC_SYNCHRONIZED = 0x0020;
00276 static const int ACC_SUPER = 0x0020;
00277 static const int ACC_NATIVE = 0x0100;
00278 static const int ACC_INTERFACE = 0x0200;
00279 static const int ACC_ABSTRACT = 0x0400;
00280 static const int ACC_STRICT = 0x0800;
00281
00282 }
00283 #endif // DEFS_HPP