Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove wrong prototype function

  • Loading branch information...
commit 74db25412ce44ba2a94103e20f8a1c8adc60d421 1 parent cd61d94
Jimmy Zhuo authored
Showing with 17 additions and 200 deletions.
  1. +17 −124 src/m0/c/m0_ops.c
  2. +0 −76 src/m0/m0_v2.ops
View
141 src/m0/c/m0_ops.c
@@ -41,7 +41,7 @@ m0_op_deref( M0_CallFrame *frame, const unsigned char *ops )
}
static void
-m0_op_deref_iii( M0_CallFrame *frame, const unsigned char *ops )
+m0_op_deref_i( M0_CallFrame *frame, const unsigned char *ops )
{
unsigned char ref = ops[2];
@@ -63,31 +63,9 @@ m0_op_deref_iii( M0_CallFrame *frame, const unsigned char *ops )
}
}
-static void
-m0_op_deref_iiI( M0_CallFrame *frame, const unsigned char *ops )
-{
- unsigned char ref = ops[2];
-
- switch (ref) {
- case CONSTS:
- {
- M0_Constants_Segment *consts =
- (M0_Constants_Segment *)frame->registers[ref];
- const unsigned long offset = (unsigned long)ops[3];
-
- frame->regs_ni.i[ops[1]] = *(uint64_t *)consts->consts[offset];
- //memcpy(&frame->regs_ni.i[ops[1]], (uint64_t *)consts->consts[offset], sizeof(uint64_t));
- break;
- }
-
- default:
- /* XXX: the rest of the system has non-uniform array handling */
- break;
- }
-}
static void
-m0_op_deref_Nii( M0_CallFrame *frame, const unsigned char *ops )
+m0_op_deref_n( M0_CallFrame *frame, const unsigned char *ops )
{
unsigned char ref = ops[2];
@@ -110,7 +88,7 @@ m0_op_deref_Nii( M0_CallFrame *frame, const unsigned char *ops )
}
static void
-m0_op_deref_NiI( M0_CallFrame *frame, const unsigned char *ops )
+m0_op_deref_s( M0_CallFrame *frame, const unsigned char *ops )
{
unsigned char ref = ops[2];
@@ -119,9 +97,9 @@ m0_op_deref_NiI( M0_CallFrame *frame, const unsigned char *ops )
{
M0_Constants_Segment *consts =
(M0_Constants_Segment *)frame->registers[ref];
- const unsigned long offset = (unsigned long)ops[3];
+ const unsigned long offset = frame->regs_ni.i[ops[3]];
- frame->regs_ni.n[ops[1]] = *(double *)consts->consts[offset];
+ frame->regs_ps.s[ops[1]] = (char *)consts->consts[offset];
//memcpy(&frame->regs_ni.i[ops[1]], (double *)consts->consts[offset], sizeof(uint64_t));
break;
}
@@ -161,26 +139,6 @@ m0_op_add_i( M0_CallFrame *frame, const unsigned char *ops )
}
static void
-m0_op_add_iii( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.i[ops[1]] = frame->regs_ni.i[ops[2]] +
- frame->regs_ni.i[ops[3]];
-}
-
-static void
-m0_op_add_iiI( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.i[ops[1]] = frame->regs_ni.i[ops[2]] +
- ops[3];
-}
-
-static void
-m0_op_add_iII( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.i[ops[1]] = ops[2] + ops[3];
-}
-
-static void
m0_op_add_n( M0_CallFrame *frame, const unsigned char *ops )
{
frame->regs_ni.n[ops[1]] = frame->regs_ni.n[ops[2]] +
@@ -188,25 +146,6 @@ m0_op_add_n( M0_CallFrame *frame, const unsigned char *ops )
}
static void
-m0_op_add_nnn( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.n[ops[1]] = frame->regs_ni.n[ops[2]] +
- frame->regs_ni.n[ops[3]];
-}
-
-static void
-m0_op_add_nnN( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.n[ops[1]] = frame->regs_ni.n[ops[2]] + ops[3];
-}
-
-static void
-m0_op_add_nNN( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.n[ops[1]] = ops[2] + ops[3];
-}
-
-static void
m0_op_sub_i( M0_CallFrame *frame, const unsigned char *ops )
{
frame->regs_ni.i[ops[1]] = frame->regs_ni.i[ops[2]] -
@@ -214,49 +153,12 @@ m0_op_sub_i( M0_CallFrame *frame, const unsigned char *ops )
}
static void
-m0_op_sub_iii( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.i[ops[1]] = frame->regs_ni.i[ops[2]] -
- frame->regs_ni.i[ops[3]];
-}
-
-static void
-m0_op_sub_iiI( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.i[ops[1]] = frame->regs_ni.i[ops[2]] - ops[3];
-}
-
-static void
-m0_op_sub_iII( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.i[ops[1]] = ops[2] - ops[3];
-}
-
-static void
m0_op_sub_n( M0_CallFrame *frame, const unsigned char *ops )
{
frame->regs_ni.n[ops[1]] = frame->regs_ni.n[ops[2]] -
frame->regs_ni.n[ops[3]];
}
-static void
-m0_op_sub_nnn( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.n[ops[1]] = frame->regs_ni.n[ops[2]] -
- frame->regs_ni.n[ops[3]];
-}
-
-static void
-m0_op_sub_nnN( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.n[ops[1]] = frame->regs_ni.n[ops[2]] - ops[3];
-}
-
-static void
-m0_op_sub_nNN( M0_CallFrame *frame, const unsigned char *ops )
-{
- frame->regs_ni.n[ops[1]] = ops[2] - ops[3];
-}
static void
m0_op_convert_n_i( M0_CallFrame *frame, const unsigned char *ops )
@@ -291,52 +193,43 @@ m0_op_goto_if( M0_CallFrame *frame, const unsigned char *ops )
static void
m0_op_mult_i( M0_CallFrame *frame, const unsigned char *ops )
{
- frame->registers[ops[1]] = frame->registers[ops[2]] *
- frame->registers[ops[3]];
+ frame->regs_ni.i[ops[1]] = frame->regs_ni.i[ops[2]] *
+ frame->regs_ni.i[ops[3]];
}
static void
m0_op_mult_n( M0_CallFrame *frame, const unsigned char *ops )
{
- float *r2 = (float*) &(frame->registers[ops[2]]);
- float *r3 = (float*) &(frame->registers[ops[3]]);
- float *result = (float*) &(frame->registers[ops[1]]);
- frame->registers[ops[1]] = (uint64_t)0;
- *result = *r2 * *r3;
+ frame->regs_ni.n[ops[1]] = frame->regs_ni.n[ops[2]] *
+ frame->regs_ni.n[ops[3]];
}
static void
m0_op_div_i( M0_CallFrame *frame, const unsigned char *ops )
{
- frame->registers[ops[1]] = frame->registers[ops[2]] /
- frame->registers[ops[3]];
+ frame->regs_ni.i[ops[1]] = frame->regs_ni.i[ops[2]] /
+ frame->regs_ni.i[ops[3]];
}
static void
m0_op_div_n( M0_CallFrame *frame, const unsigned char *ops )
{
- float *r2 = (float*) &(frame->registers[ops[2]]);
- float *r3 = (float*) &(frame->registers[ops[3]]);
- float *result = (float*) &(frame->registers[ops[1]]);
- frame->registers[ops[1]] = (uint64_t)0;
- *result = *r2 / *r3;
+ frame->regs_ni.n[ops[1]] = frame->regs_ni.n[ops[2]] /
+ frame->regs_ni.n[ops[3]];
}
static void
m0_op_mod_i( M0_CallFrame *frame, const unsigned char *ops )
{
- frame->registers[ops[1]] = frame->registers[ops[2]] %
- frame->registers[ops[3]];
+ frame->regs_ni.i[ops[1]] = frame->regs_ni.i[ops[2]] %
+ frame->regs_ni.i[ops[3]];
}
static void
m0_op_mod_n( M0_CallFrame *frame, const unsigned char *ops )
{
- float *r2 = (float*) &(frame->registers[ops[2]]);
- float *r3 = (float*) &(frame->registers[ops[3]]);
- float *result = (float*) &(frame->registers[ops[1]]);
- frame->registers[ops[1]] = (uint64_t)0;
- *result = (int)(*r2) % (int)(*r3);
+ frame->regs_ni.n[ops[1]] = frame->regs_ni.n[ops[2]] %
+ frame->regs_ni.n[ops[3]];
}
static void
View
76 src/m0/m0_v2.ops
@@ -1,76 +0,0 @@
-Here is the new ops definition, <xxxxxx> means it's a retained
-position, which will be added new op along with requirements change
-in the future. There will be more ops in the near future.
-
- 0x00 noop
- 0x01 goto_IIx
- 0x02 goto_iIx
- 0x03 goto_iix
- 0x04 xxxxxx
- 0x05 xxxxxx
- 0x06 goto_if_III
- 0x07 goto_if_IiI
- 0x08 xxxxxx
- 0x09 xxxxxx
- 0x0A xxxxxx
- 0x0B goto_chunk_iix
- 0x0C xxxxxx
- 0x0D xxxxxx
- 0x0E xxxxxx
- 0x0F xxxxxx
- 0x10 add_iII
- 0x11 add_iiI
- 0x12 add_iii
- 0x13 xxxxxx
- 0x14 xxxxxx
- 0x15 add_nNN
- 0x16 add_nnN
- 0x17 add_nnn
- 0x18 xxxxxx
- 0x19 xxxxxx
- 0x1A sub_iII
- 0x1B sub_iiI
- 0x1C sub_iii
- 0x1D xxxxxx
- 0x1E xxxxxx
- 0x1F sub_nNN
- 0x20 sub_nnN
- 0x21 sub_nnn
- 0x22 xxxxxx
- 0x23 xxxxxx
- 0x24 mult_iII
- 0x25 mult_iiI
- 0x26 mult_iii
- 0x27 xxxxxx
- 0x28 xxxxxx
- 0x29 mult_nNN
- 0x2A mult_nnN
- 0x2B mult_nnn
- 0x2C xxxxxx
- 0x2D xxxxxx
- 0x2E div_iII
- 0x2F div_iiI
- 0x30 div_iii
- 0x31 xxxxxx
- 0x32 xxxxxx
- 0x33 div_nNN
- 0x34 div_nnN
- 0x35 div_nnn
- 0x36 xxxxxx
- 0x37 xxxxxx
- 0x38 mod_iII
- 0x39 mod_iiI
- 0x3A mod_iii
- 0x3B xxxxxx
- 0x3C xxxxxx
- 0x3D mod_nNN
- 0x3E mod_nnN
- 0x3F mod_nnn
- 0x40 xxxxxx
- 0x41 xxxxxx
- 0x42 div_nNN
- 0x43 div_nnN
- 0x44 div_nnn
- 0x45 xxxxxx
- 0x46 xxxxxx
-
Please sign in to comment.
Something went wrong with that request. Please try again.