摘要:
A system for providing a double compare and swap operation is disclosed. In the disclosed system, a first single compare and swap operation is performed. If a contents of a first variable is equal to an old value for the first variable, then the first compare and swap operation writes a value to the first variable indicating that the variable is not accessible and indicates success. A second single compare and swap operation is executed in the event that the first single compare and swap operation indicates success. If a contents of a second variable is equal to an old value for the second variable, then the second single compare and swap operation writes a new value for the second variable into the second variable and indicates success. If the second single compare and swap operation indicates success, a new value for the first variable is written to the first variable. Reads and writes on the first variable are prevented while the first variable contains the value indicating that the variable is inaccessible. The disclosed double compare and swap operation writes the old value for the first variable into the first variable if the second single compare and swap operation fails.
摘要:
A first computer system (34) compiles a source program into machine code for a register-oriented microprocessor, optimizing the global allocation of microprocessor registers in the process. It then translates the resultant code into generic-machine operand-stack-oriented code. In performing the translation, it generates code that preserves the register-oriented code's microprocessor-register allocation by filling the operand stack from local variables chosen in accordance with a predetermined correspondence between local variables and microprocessor registers. That code also stores the operand stack's contents in accordance with that same correspondence. A second computer system (32), which employs the register-oriented microprocessor, converts the resultant generic machine code into its own machine code in accordance with the same association between local variables to microprocessor registers.