/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This file is part of SableVM. * * See the file "LICENSE" for Copyright information and the * * terms and conditions for copying, distribution and * * modification of SableVM. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* ---------------------------------------------------------------------- m4svm_instruction_head ---------------------------------------------------------------------- */ /* m4svm_comment_define([:m4svm_instruction_head:], * [:m4svm_instruction_1(:]) */ /* ---------------------------------------------------------------------- m4svm_instruction_tail ---------------------------------------------------------------------- */ /* m4svm_comment_define([:m4svm_instruction_tail:], * [:))m4_dnl:]) */ /* ---------------------------------------------------------------------- m4svm_instruction_1 ---------------------------------------------------------------------- */ /* m4svm_comment_define([:m4svm_instruction_1:], * [:m4svm_instruction_2$1:]) */ /* ---------------------------------------------------------------------- m4svm_instruction_2 ---------------------------------------------------------------------- */ /* m4svm_comment_define([:m4svm_instruction_2:], * [:m4svm_instruction($1, $2, $3,m4_dnl:]) */ /* ---------------------------------------------------------------------- m4svm_instruction ---------------------------------------------------------------------- */ /* m4_ifdef([:m4svm_inlined_threaded:], [:m4_define([:m4svm_instruction:], [:m4svm_instruction_inlined_threaded([:$1:], [:$2:], [:$3:],[:$4:]):]):]) m4_ifdef([:m4svm_direct_threaded:], [:m4_define([:m4svm_instruction:], [:m4svm_instruction_direct_threaded([:$1:], [:$2:], [:$3:],[:$4:]):]):]) m4_ifdef([:m4svm_switch_threaded:], [:m4_define([:m4svm_instruction:], [:m4svm_instruction_switch_threaded([:$1:], [:$2:], [:$3:],[:$4:]):]):]) */ /* ---------------------------------------------------------------------- m4svm_instruction_inlined_threaded ---------------------------------------------------------------------- */ void dummy () { switch (dummy) { m4svm_define_begin v = ":], [:m4svm_instruction_inlined_threaded:])"; /* -----------------------------------m4_dnl ----------------------------------- $1 -----------------------------------m4_dnl ----------------------------------- */ case SVM_INSTRUCTION_$1: { env->vm->instructions[instr].param_count = $3; /* implementation address */ env->vm->instructions[instr].code.implementation = &&START_$1; env->vm->instructions[instr].inlined_code.implementation = &&INLINED_START_$1; /* code size */ env->vm->instructions[instr].inlined_size = ((char *) &&END_$1) - ((char *) &&INLINED_START_$1); /* can the implementation be relocated? */ env->vm->instructions[instr].flag = $2; break; START_$1: #ifndef NDEBUG if (env->vm->verbose_instructions) { _svmf_printf (env, stdout, "[verbose instructions: executing @%p $1]\n", (void *) (pc - 1)); } #endif INLINED_START_$1: /* instruction body */ $4 m4_dnl; END_$1: /* dispatch */ goto *((pc++)->implementation); } m4svm_define_end = ":])"; } } /* ---------------------------------------------------------------------- m4svm_instruction_direct_threaded ---------------------------------------------------------------------- */ void dummy () { switch (dummy) { m4svm_define_begin v = ":], [:m4svm_instruction_direct_threaded:])"; /* -----------------------------------m4_dnl ----------------------------------- $1 -----------------------------------m4_dnl ----------------------------------- */ case SVM_INSTRUCTION_$1: { env->vm->instructions[instr].param_count = $3; /* implementation address */ env->vm->instructions[instr].code.implementation = &&START_$1; break; START_$1: #ifndef NDEBUG if (env->vm->verbose_instructions) { _svmf_printf (env, stdout, "[verbose instructions: executing @%p $1]\n", (void *) (pc - 1)); } #endif /* instruction body */ $4 m4_dnl; /* dispatch */ goto *((pc++)->implementation); } m4svm_define_end = ":])"; } } /* ---------------------------------------------------------------------- m4svm_instruction_switch_threaded ---------------------------------------------------------------------- */ void dummy () { switch (dummy) { m4svm_define_begin v = ":], [:m4svm_instruction_switch_threaded:])"; /* -----------------------------------m4_dnl ----------------------------------- $1 -----------------------------------m4_dnl ----------------------------------- */ case SVM_INSTRUCTION_$1: { env->vm->instructions[instr].code.jint = instr; env->vm->instructions[instr].param_count = $3; break; } m4svm_define_end = ":])"; } }