Miscellanious opcode cleanup.
Miscellanious opcode cleanup.
1.1 --- a/jitcraft/BytecodeCompiler.cpp Sun Jul 01 00:00:27 2012 -0700
1.2 +++ b/jitcraft/BytecodeCompiler.cpp Sun Jul 01 00:07:40 2012 -0700
1.3 @@ -198,7 +198,7 @@
1.4
1.5 index->left()->accept(this);
1.6 index->right()->accept(this);
1.7 - __ bounds_sta();
1.8 + __ bounds();
1.9 node->expression()->accept(this);
1.10 if (index->left()->type()->contained()->isFloat()) {
1.11 __ setarray_f();
1.12 @@ -234,10 +234,10 @@
1.13 {
1.14 node->left()->accept(this);
1.15 node->right()->accept(this);
1.16 - __ bounds_sta();
1.17 + __ bounds();
1.18
1.19 if (node->type()->isArray()) {
1.20 - __ getarray_p();
1.21 + __ getarray_o();
1.22 } else if (node->type()->isFloat()) {
1.23 __ getarray_f();
1.24 } else {
1.25 @@ -409,7 +409,7 @@
1.26 if (type->isArray()) {
1.27 // :TODO: use Local
1.28 ArrayMap *map = BuildArrayMap(ZONE(), type);
1.29 - __ lifoarray(map);
1.30 + __ newarray_lifo(map);
1.31 } else {
1.32 if (node->initialization()) {
1.33 node->initialization()->accept(this);
1.34 @@ -451,7 +451,7 @@
1.35 IndexExpression *expr = arg->toIndexExpression();
1.36 expr->left()->accept(this);
1.37 expr->right()->accept(this);
1.38 - __ bounds_sta();
1.39 + __ bounds();
1.40 __ arrayref_lifo();
1.41 } else {
1.42 // We don't know how to, or can't, build a direct reference to
2.1 --- a/jitcraft/BytecodeEmitter.h Sun Jul 01 00:00:27 2012 -0700
2.2 +++ b/jitcraft/BytecodeEmitter.h Sun Jul 01 00:07:40 2012 -0700
2.3 @@ -280,11 +280,11 @@
2.4 void setarray_f() {
2.5 singleByteOp(OP_SETARRAY_F);
2.6 }
2.7 - void getarray_p() {
2.8 - singleByteOp(OP_GETARRAY_P);
2.9 + void getarray_o() {
2.10 + singleByteOp(OP_GETARRAY_O);
2.11 }
2.12 - void bounds_sta() {
2.13 - singleByteOp(OP_BOUNDS_STA);
2.14 + void bounds() {
2.15 + singleByteOp(OP_BOUNDS);
2.16 }
2.17 void float_(float value) {
2.18 ensure(OP_FLOAT_LENGTH);
2.19 @@ -294,9 +294,9 @@
2.20 void cvt_i2f() {
2.21 singleByteOp(OP_CVT_I2F);
2.22 }
2.23 - void lifoarray(Map *map) {
2.24 - ensure(OP_LIFOARRAY_LENGTH);
2.25 - writeOp(OP_LIFOARRAY);
2.26 + void newarray_lifo(Map *map) {
2.27 + ensure(OP_NEWARRAY_LIFO_LENGTH);
2.28 + writeOp(OP_NEWARRAY_LIFO);
2.29 writeMap(map);
2.30 }
2.31 void savelifo(unsigned slot) {
3.1 --- a/jitcraft/Interpreter.cpp Sun Jul 01 00:00:27 2012 -0700
3.2 +++ b/jitcraft/Interpreter.cpp Sun Jul 01 00:07:40 2012 -0700
3.3 @@ -373,7 +373,7 @@
3.4 break;
3.5 }
3.6
3.7 -case OP_BOUNDS_STA:
3.8 +case OP_BOUNDS:
3.9 {
3.10 Array *array = top.sp[-2].array;
3.11 int index = top.sp[-1].i32;
3.12 @@ -420,7 +420,7 @@
3.13 break;
3.14 }
3.15
3.16 -case OP_GETARRAY_P:
3.17 +case OP_GETARRAY_O:
3.18 {
3.19 Array *array = top.sp[-2].array;
3.20 int index = top.sp[-1].i32;
3.21 @@ -437,7 +437,7 @@
3.22 break;
3.23 }
3.24
3.25 -case OP_LIFOARRAY:
3.26 +case OP_NEWARRAY_LIFO:
3.27 {
3.28 // :TODO: use Local
3.29 ArrayMap *map = ArrayMap::cast(frame->code()->map(READ_UINT32(top.pc)));
4.1 --- a/jitcraft/Opcodes.cpp Sun Jul 01 00:00:27 2012 -0700
4.2 +++ b/jitcraft/Opcodes.cpp Sun Jul 01 00:07:40 2012 -0700
4.3 @@ -86,8 +86,8 @@
4.4 case OP_SETARRAY_I:
4.5 case OP_GETARRAY_F:
4.6 case OP_SETARRAY_F:
4.7 - case OP_GETARRAY_P:
4.8 - case OP_BOUNDS_STA:
4.9 + case OP_GETARRAY_O:
4.10 + case OP_BOUNDS:
4.11 case OP_SHL:
4.12 case OP_SHR:
4.13 case OP_USHR:
4.14 @@ -126,7 +126,7 @@
4.15 fprintf(fp, "%u (%+d)", unsigned((pc + READ_INT32(pc)) - code->start()), READ_INT32(pc));
4.16 break;
4.17
4.18 - case OP_LIFOARRAY:
4.19 + case OP_NEWARRAY_LIFO:
4.20 {
4.21 // :TODO: use Local
4.22 ArrayMap *map = ArrayMap::cast(code->map(READ_UINT32(pc)));
5.1 --- a/jitcraft/Opcodes.tbl Sun Jul 01 00:00:27 2012 -0700
5.2 +++ b/jitcraft/Opcodes.tbl Sun Jul 01 00:07:40 2012 -0700
5.3 @@ -20,7 +20,8 @@
5.4 //
5.5 // Type suffixes:
5.6 // I = 32-bit integer
5.7 -// P = reference to the UnsafeHeap or UnsafeStack
5.8 +// F = 32-bit IEEE-754 float
5.9 +// O = object reference
5.10
5.11 // No operation.
5.12 OPDEF(OP_NOP, 0, "nop", 1, 0, 0)
5.13 @@ -91,14 +92,14 @@
5.14 OPDEF(OP_SETARRAY_I, 24, "setarray.i", 1, 3, 1)
5.15 OPDEF(OP_GETARRAY_F, 25, "getarray.f", 1, 2, 1)
5.16 OPDEF(OP_SETARRAY_F, 26, "setarray.f", 1, 3, 1)
5.17 -OPDEF(OP_GETARRAY_P, 27, "getarray.p", 1, 2, 1)
5.18 +OPDEF(OP_GETARRAY_O, 27, "getarray.o", 1, 2, 1)
5.19
5.20 // Allocate an array, info LIFO space if possible. The ArrayMap to use is
5.21 // specified as an index into the script's Map table.
5.22 //
5.23 // Format:
5.24 // [u8 op] [u32 index]
5.25 -OPDEF(OP_LIFOARRAY, 28, "lifoarray", 5, 0, 1)
5.26 +OPDEF(OP_NEWARRAY_LIFO, 28, "newarray.lifo", 5, 0, 1)
5.27
5.28 // Performs a bounds check on an unsafe array.
5.29 //
5.30 @@ -106,7 +107,7 @@
5.31 // array = pop()
5.32 // push(array)
5.33 // push(index)
5.34 -OPDEF(OP_BOUNDS_STA, 29, "bounds.sta", 1, 2, 2)
5.35 +OPDEF(OP_BOUNDS, 29, "bounds", 1, 2, 2)
5.36
5.37 // Pushes a 32-bit IEEE-754 floating point immediate onto the stack.
5.38 OPDEF(OP_FLOAT, 30, "float", 5, 0, 1)