Permalink
Browse files

Add FIRST_UNIMPLEMENTED_OP instructioon to simplify bootstrapping aft…

…er adding new bytecode instructions at the end

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14734 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
1 parent c141951 commit 680fe9f91d2ba04f09c86b06f1dd84919c054b26 @lefessan lefessan committed May 4, 2014
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
@@ -98,10 +98,10 @@ char * caml_instr_base;
void caml_thread_code (code_t code, asize_t len)
{
code_t p;
- int l [STOP + 1];
+ int l [FIRST_UNIMPLEMENTED_OP];
int i;
- for (i = 0; i <= STOP; i++) {
+ for (i = 0; i < FIRST_UNIMPLEMENTED_OP; i++) {
l [i] = 0;
}
/* Instructions with one operand */
@@ -125,7 +125,7 @@ void caml_thread_code (code_t code, asize_t len)
len /= sizeof(opcode_t);
for (p = code; p < code + len; /*nothing*/) {
opcode_t instr = *p;
- if (instr < 0 || instr > STOP){
+ if (instr < 0 || instr >= FIRST_UNIMPLEMENTED_OP){
/* FIXME -- should Assert(false) ?
caml_fatal_error_arg ("Fatal error in fix_code: bad opcode (%lx)\n",
(char *)(long)instr);
View
@@ -40,7 +40,6 @@ enum instructions {
GETSTRINGCHAR, SETSTRINGCHAR,
BRANCH, BRANCHIF, BRANCHIFNOT, SWITCH, BOOLNOT,
PUSHTRAP, POPTRAP, RAISE,
- RERAISE, RAISE_NOTRACE,
CHECK_SIGNALS,
C_CALL1, C_CALL2, C_CALL3, C_CALL4, C_CALL5, C_CALLN,
CONST0, CONST1, CONST2, CONST3, CONSTINT,
@@ -55,7 +54,10 @@ enum instructions {
BULTINT, BUGEINT,
GETPUBMET, GETDYNMET,
STOP,
- EVENT, BREAK
+ EVENT, BREAK,
+ RERAISE, RAISE_NOTRACE,
+ FIRST_UNIMPLEMENTED_OP
};
+
#endif /* CAML_INSTRUCT_H */
View
@@ -1112,6 +1112,7 @@ value caml_interprete(code_t prog, asize_t prog_size)
/* Debugging and machine control */
+ Instruct(FIRST_UNIMPLEMENTED_OP):
Instruct(STOP):
caml_external_raise = initial_external_raise;
caml_extern_sp = sp;

0 comments on commit 680fe9f

Please sign in to comment.