Dear David, Right now I'm studying the Poly/ML's interpreter, trying to understand the semantics of opcodes implemented in interpret.cpp. However, I have difficulty on understanding some of the opcodes:
1. INSTR_non_local, in its implementation case INSTR_non_local: { PolyWord *t = sp+arg1; POLYSIGNED uu; for(uu = 1; uu <= arg2; uu++) t = (t[-1]).AsStackAddr(); uu = arg3; /* Can be negative. */ if (uu > 32767) uu -= 65536; *(--sp) = t[uu]; pc += 6; break; } Here what does this instruction do, and what does t[-1] holds? Also how about the semantics of INSTR_non_local_l_i (where i can be 1, 2 or 3)? 2. INSTR_const_addr_Xb, and INSTR_const_addr_Xw: in their implementations they have long expression for computing the addresses such as: PolyWord::FromCodePtr(pc + (pc[0]+4)*sizeof(PolyWord) + pc[1] + pc[2]*256 + 3)) I'm confused about what does the address computed by the long expression refer to and why it is computed in this way? What are the meanings of Xb, and Xw in the their instruction names? 3. INSTR_ldexc. This instruction pushes the content in p_reg[0] into the stack. I read the definition of the stack object in globals.h, but still couldn't understand what is the stack registers used for? Here could you give me some help for understanding the above instructions? Thanks, Yue _______________________________________________ polyml mailing list polyml@inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml