1460759133-2d59d2b5-1bec-4680-b025-64bf5fa51b41

1. A method for detecting an alignment of a document having a side edge in an automatic document feeder, the automatic document feeder included in an optical scanner having a scanning window, the method comprising:
actuating the automatic document feeder to feed in the document to a first position, wherein a portion of the side edge of the document in the first position is defined by the scanning window and a colored pattern layer in the scanning window;
capturing a first image of the document while the document is in said first position;
feeding the document a feeding length that is less than a total length of the document to a second position;
capturing a second image of the document while said document is in said second position; and
calculating a slant value by comparing the first image with the second image.
2. The method of claim 1, wherein a color of the colored pattern layer is different from that of the document.
3. The method of claim 1, wherein the side edge is substantially parallel to a feeding direction of the document.
4. The method of claim 1, wherein a first distance comprises a distance from the side edge to a reference point positioned in the colored pattern layer.
5. The method automatic document feeder of claim 4, wherein a second distance comprises a distance from the side edge to the reference point after the document is fed the feeding length to the second position.
6. The method of claim 5, wherein the slant value comprises a ratio of a difference value of the first distance and the second distance to the feeding length, wherein the feeding length further comprises a length sufficient to enable measuring of a slant value.
7. The method of claim 6, wherein the slant value is calculated by an electronic calculation device.
8. The method of claim 7, wherein the electronic calculation device comprises a software calculation program.
9. The method of claim 7, wherein the electronic calculation device further comprises a calculator in a computer.
10. The method of claim 4, wherein the reference point is positioned on a scan line of the scanning window.
11. The method of claim 1, and further comprising comparing the slant value with a preset value.
12. The method of claim 11, wherein the preset value comprises a value that is tested and provided for the document.
13. The method of claim 11, and further comprising scanning the document in response to the slant value being smaller than the preset value.
14. The method of claim 11, and further comprising terminating scanning in response to the slant value being larger than the preset value.
15. The method of claim 14, and further comprising taking the document out of the document feeder, and repeating said actuating the automatic document feeder, said capturing the first image of the document, said feeding the document the feeding length to the second position, said capturing the second image of the document, and said calculating the slant value by comparing the first image with the second image.
16. The method of claim 15, wherein said taking the document out of the document feeder further comprises manually taking the document out of the document feeder.
17. The method of claim 13, and further comprising setting off an alarm in response to the slant value being larger than the preset value.
18. A method comprising:
actuating a document feeder in an optical scanner to place a document in a first position;
capturing a first image while said document is in said first position;
actuating the document feeder to feed the document into the optical scanner an appropriate length that is less than a total length of the document, to place said document in a second position;
capturing a second image while said document is in said second position; and
determining a slant value based, at least in part, on a comparison of the first image with the second image.
19. The method of claim 18, and further comprising arranging a colored pattern in or near a scanning window of the optical scanner.
20. The method of claim 19, wherein a color of a colored pattern is different from that of the document.
21. The method of claim 20, and further comprising positioning a first edge of the document between the scanning window and the colored pattern.
22. The method of claim 21, and further comprising measuring a first distance between the first edge and a reference point positioned in the colored pattern.
23. The method of claim 22, and further comprising measuring a second distance between the first edge and the reference point positioned in the colored pattern.
24. The method of claim 23, wherein the reference point is positioned on a scan line of the scanning window.
25. The method of claim 23, and further comprising determining the slant value based, at least in part, on a ratio of a difference between the first distance and the second distance to the appropriate length.
26. The method of claim 25 wherein the appropriate length comprises a length sufficient to determine the slant value.
27. The method of claim 18, wherein the slant value is calculated by an electronic calculation device.
28. The method of claim 27, wherein the electronic calculation device further comprises a software calculation program.
29. The method of claim 27, wherein the electronic calculation device comprises a calculator in a computer.
30. The method of claim 18, and further comprising comparing the slant value with a preset value.
31. The method of claim 30, wherein the preset value comprises a value that is tested and provided for the document.
32. The method of claim 30, and further comprising continuously scanning in response to the slant value being smaller than the preset value.
33. The method of claim 30, and further comprising terminating a scanning operation in response to the slant value being larger than the preset value.
34. The method of claim 33, and further comprising repositioning the document.
35. The method of claim 33, and further comprising setting off an alarm in response to the slant value exceeding the preset value.
36. The method of claim 18, wherein said actuating a document feeder in an optical scanner to place a document in a first position comprises automatically actuating the document feeder.
37. The method of claim 18, wherein said actuating the document feeder to feed the document into the optical scanner an appropriate length to place the document in a second position comprises automatically actuating the document feeder.
38. An optical scanning device, comprising:
a document feeder adapted to place a document in a first position, wherein the optical scanning device is adapted to capture a first image while the document is in the first position, the document feeder is further adapted to feed the document into the optical scanner a feeding length to place the document in a second position, wherein the feeding length is less than a total length of the document, and wherein the optical scanning device is further adapted to capture a second image while the document is in the second position, and further wherein the optical scanning device is adapted to determine a slant value based, at least in part, on a comparison of the first image with the second image.
39. The optical scanning device of claim 38, wherein the document feeder comprises a colored pattern positioned in an area corresponding to a scanning window of the optical scanner.
40. The optical scanning device of claim 39, wherein a color of the colored pattern is different from that of the document.
41. The optical scanning device of claim 40, wherein the document feeder is adapted to position a first edge of the document between the scanning window and the colored pattern.
42. The optical scanning device of claim 41, wherein the optical scanning device is adapted to measure a first distance between the first edge and a reference point positioned in the colored pattern.
43. The optical scanning device of claim 42, wherein the optical scanning device is further adapted to measure a second distance between the first edge and the reference point positioned in the colored pattern.
44. The optical scanning device of claim 43, wherein the reference point is positioned on a scan line of the scanning window.
45. The optical scanning device of claim 44, wherein the optical scanning device is further adapted to determine the slant value based, at least in part, on a ratio of a difference between the first distance and the second distance to the feeding length.
46. The optical scanning device of claim 45, wherein the feeding length comprises a length sufficient to determine the slant value.
47. The optical scanning device of claim 38, further comprising an electronic calculation device adapted to calculate the slant value.
48. The optical scanning device of claim 47, wherein the electronic calculation device further comprises a software calculation program.
49. The optical scanning device of claim 47, wherein the electronic calculation device comprises a calculator in a computer.
50. The optical scanning device of claim 38, wherein the optical scanning device is further adapted to compare the slant value with a preset value.
51. The optical scanning device of claim 50, wherein the preset value comprises a value that is tested and provided for the document.
52. The optical scanning device of claim 50, wherein the optical scanning device is adapted to continuously scan in response to the slant value being smaller than the preset value.
53. The optical scanning device of claim 50, wherein the optical scanning device is adapted to terminate a scanning operation in response to the slant value being larger than the preset value.
54. The optical scanning device of claim 53, wherein the optical scanning device is further adapted to set off an alarm in response to the slant value exceeding the preset value.
55. The optical scanning device of claim 38, wherein the document feeder comprises an automatic document feeder.

The claims below are in addition to those above.
All refrences to claim(s) which appear below refer to the numbering after this setence.

What is claimed is:

1. A method that predicts a result produced by a section of code in order to support speculative program execution, the section of code including a plurality of program instructions, the method comprising:
executing the section of code within a program using a head thread, wherein executing the section of code produces the result;
before the head thread produces the result, generating a predicted result to be used in place of the result;
allowing the speculative thread to speculatively execute subsequent code within the program using the predicted result, wherein the subsequent code follows the section of code in an execution stream of the program; and
after the head thread finishes executing the section of code, determining if a difference between the predicted result and the result generated by the head thread affected execution of the speculative thread;
if the difference affected execution of the speculative thread, executing the subsequent code again using the result generated by the head thread; and
if the difference did not affect execution of the speculative thread, performing a join operation to merge state associated with the speculative thread with state associated with the head thread.
2. The method of claim 1, wherein executing the subsequent code again involves performing a rollback operation for the speculative thread to undo actions performed by the speculative thread.
3. The method of claim 1, wherein determining if the difference affected execution of the speculative thread involves determining if the speculative thread accessed the predicted result.
4. The method of claim 1, wherein determining if the difference affected execution of the speculative thread involves determining if the predicted result differs from the result generated by the head thread.
5. The method of claim 1, wherein generating the predicted result involves looking up a value based upon a program counter for the program.
6. The method of claim 5, wherein generating the predicted result involves additionally looking up the value based upon at least one previously generated value for the result.
7. The method of claim 5, wherein generating the predicted result involves performing a function on the value.
8. The method of claim 1, wherein executing the section of code involves performing one of:
a method invocation to execute the section of code;
a function call to execute the section of code; and
a procedure call to execute the section of code.
9. The method of claim 1, wherein the section of code is a body of a loop in the program, and the result is a loop carried dependency for the loop.
10. The method of claim 1, wherein during a write operation to a memory element by the head thread, the method further comprises:
performing the write operation to a primary version of the memory element;
checking status information associated with the memory element to determine if the memory element has been read by the speculative thread;
if the memory element has been read by the speculative thread, causing the speculative thread to roll back so that the speculative thread can read a result of the write operation; and
if the memory element has not been read by the speculative thread, performing the write operation to a space-time dimensioned version of the memory element if the space-time dimensioned version exists.
11. The method of claim 10, wherein performing the join operation involves merging the space-time dimensioned version of the memory element into the primary version of the memory element and discarding the space-time dimensioned version of the memory element.
12. An apparatus that facilitates predicting a result produced by a section of code in order to support speculative program execution, the section of code including a plurality of program instructions, the apparatus comprising:
a head thread that is configured to execute the section of code within a program, wherein executing the section of code produces the result;
a prediction mechanism that is configured to generate a predicted result to be used in place of the result before the head thread produces the result;
a speculative thread that is configured to speculatively execute subsequent code within the program using the predicted result, wherein the subsequent code follows the section of code in an execution stream of the program; and
a determination mechanism that is configured to determine if a difference between the predicted result and the result generated by the head thread affected execution of the speculative thread; and
a joining mechanism that is configured to merge state associated with the speculative thread with state associated with the head thread if the difference did not affect execution of the speculative thread;
wherein if the difference affected execution of the speculative thread, the apparatus is configured to execute the subsequent code again using the result generated by the head thread.
13. The apparatus of claim 12, wherein while executing the subsequent code again, the apparatus is configured to perform a rollback operation for the speculative thread to undo actions performed by the speculative thread.
14. The apparatus of claim 12, wherein the determination mechanism is configured to determine if the speculative thread accessed the predicted result.
15. The apparatus of claim 12, wherein the determination mechanism is configured to determine if the predicted result differs from the result generated by the head thread.
16. The apparatus of claim 12, wherein the prediction mechanism is configured to generate the predicted result by looking up a value based upon a program counter for the program.
17. The apparatus of claim 16, wherein the prediction mechanism is configured to generate the predicted result by additionally looking up the value based upon at least one previously generated value for the result.
18. The apparatus of claim 16, wherein the prediction mechanism is configured to generate the predicted result by performing a function on the value.
19. The apparatus of claim 12, wherein the section of code includes one of, a method, a function and a procedure.
20. The apparatus of claim 12, wherein the section of code is a body of a loop in the program, and the result is a loop carried dependency for the loop.
21. The apparatus of claim 12, further comprising a mechanism that performs write operations for the head thread, the mechanism being configured to:
perform a write operation to a primary version of a memory element;
check status information associated with the memory element to determine if the memory element has been read by the speculative thread;
cause the speculative thread to roll back so that the speculative thread can read a result of the write operation if the memory element has been read by the speculative thread; and
perform the write operation to a space-time dimensioned version of the memory element if the space-time dimensioned version exists and if the memory element has not been read by the speculative thread.
22. The apparatus of claim 21, wherein the joining mechanism is configured to:
merge the space-time dimensioned version of the memory element into the primary version of the memory element; and to
discard the space-time dimensioned version of the memory element.
23. A computer-readable storage medium storing instructions that when executed by a computer cause the computer to perform a method that predicts a result produced by a section of code in order to support speculative program execution, the section of code including a plurality of program instructions, the method comprising:
executing the section of code within a program using a head thread, wherein executing the section of code produces the result;
before the head thread produces the result, generating a predicted result to be used in place of the result;
allowing the speculative thread to speculatively execute subsequent code within the program using the predicted result, wherein the subsequent code follows the section of code in an execution stream of the program; and
after the head thread finishes executing the section of code, determining if a difference between the predicted result and the result generated by the head thread affected execution of the speculative thread;
if the difference affected execution of the speculative thread, executing the subsequent code again using the result generated by the head thread; and
if the difference did not affect execution of the speculative thread, performing a join operation to merge state associated with the speculative thread with state associated with the head thread.
24. The computer-readable storage medium of claim 23, wherein executing the subsequent code again involves performing a rollback operation for the speculative thread to undo actions performed by the speculative thread.