# US 2008/0313440 A1 · Switching to original code comparison of modifiable code for translated code validity when frequency of detecting memory overwrites exceeds threshold

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2008/0313440 A1
- Document ID: US20080313440A1
- Status: Published application
- Kind: A1
- Application number: 12/177,836
- Filed: 2008-07-22
- Published: 2008-12-18
- Earliest claimed: 2000-03-30
- Assignees: Transmeta Corporation
- Inventors: John Banning; H. Peter Anvin; Robert Bedicheck; Guillermo J. Rozas; Andrew Shaw; Linus Torvalds; Jason Wilson
- Web page: https://patentgrep.com/patent/US20080313440A1

## CPC

- G06F 9/3808: {for instruction reuse, e.g. trace cache, branch target cache}
- G06F 9/3812: {with instruction modification, e.g. store into instruction stream}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method of translating instructions from a target instruction set to a host instruction set. In one embodiment, a plurality of first target instructions is translated into a plurality of first host instructions. After the translation, it is determined whether the plurality of first target instructions has changed. A copy of a second plurality of target instructions is stored and compared with the plurality of first target instructions if the determining slows the operation of the computer system. After comparing, the plurality of first host instructions is invalidated if there is a mismatch. According to one embodiment, the storing, the comparing and the invaliding is initiated when the determining indicates that a page contains at least one change to the plurality of first target instructions. In one embodiment, the determining is by examining a bit indicator associated with a memory location of the plurality of first target instructions.

## Claims

### Claim at position 1

1-24. (canceled)

### Claim 25

In a computer which translates instructions from a target instruction set to a host instruction set, a method comprising:
after translating a plurality of first target instructions, detecting a write operation in a memory location containing said translated plurality of first target instructions;
in response to said detecting, storing a copy of a plurality of second target instructions from said target instruction set;
comparing said plurality of first target instructions with said plurality of second target instructions; and
in response to a mismatch based on said comparison, disabling said translated plurality of first target instructions.

### Claim 26 (depends on 25)

The method as described in claim 25 further comprising:
in response to a match based on said comparison, executing said translated plurality of first target instructions.

### Claim 27 (depends on 25)

The method as described in claim 25, further comprising:
comparing a stored copy of said plurality of second target instructions with said plurality of first target instructions for a first increment of copies up to and including a store instruction of said plurality of first target instructions; and
comparing said stored copy with said plurality of first target instructions for a remaining increment of copies after execution of said translated plurality of first target instructions from the first increment of copies.

### Claim 28 (depends on 27)

The method as described in claim 27, further comprising:
resolving conflicts by executing said translated plurality of first target instructions in a chronological order different from its original chronological order if a load instruction used to implement the comparing of said copies and said plurality of first target instructions at the memory location has been reordered with respect to the store instruction.

### Claim 29 (depends on 28)

The method as described in claim 28, further comprising:
ending translation of target instructions into translated target instructions and committing state when a store occurs to target memory.

### Claim 30 (depends on 25)

The method as described in claim 25 further comprising:
determining whether said detecting said write operation slows execution of said translated plurality of first target instructions by said computer.

### Claim 31 (depends on 30)

The method as described in claim 30 further comprising:
disabling said detecting when said detecting said write operation slows the operation of said computer.

### Claim 32 (depends on 29)

The method as described in claim 29, wherein a measure of whether said detecting said write operation slows execution of said translated plurality of first target instruction by said computer is based on a frequency at which changes to said translated plurality of first target instructions occur.

### Claim 33

A computer system that translates target instructions from a target instruction set into host instructions from a host instruction set, the computer system having computer readable code which when executed by the computer system cause the computer system to implement a method of invalidating translated host instructions, said method comprising:
translating a plurality of first target instructions into a plurality of first host instructions;
storing a copy of a plurality of second target instructions from said target instruction set, wherein said plurality of second target instructions is operable to replace said plurality of first target instructions upon a mismatch between said plurality of second target instructions and said plurality of first target instructions;
comparing said plurality of first target instructions with said plurality of second target instructions; and
in response to a mismatch based on said comparing, invalidating said translated plurality of first target instructions.

### Claim 34 (depends on 33)

The computer system as described in claim 33 wherein said method further comprises:
in response to a match based on said comparing, executing said translated plurality of first target instructions.

### Claim 35 (depends on 33)

The computer system as described in claim 33 wherein said method further comprises:
initiating said storing, said comparing and said invalidating when said comparison indicates that a page contains at least one change to said plurality of first target instructions.

### Claim 36 (depends on 33)

The computer system as described in claim 33 wherein said method further comprises:
initiating said storing, said comparing and said invalidating when at least one of a plurality of sub areas of a page contains a target instruction from said first plurality of target instructions that has been changed.

### Claim 37 (depends on 33)

The computer system as described in claim 33 wherein said method further comprises:
determining whether said plurality of first target instructions have changed, wherein said determining comprises examining a bit indicator associated with a memory location of said plurality of first target instructions.

### Claim 38 (depends on 33)

The computer system as described in claim 33 wherein said method further comprises:
testing for an indicator that said plurality of first target instructions have been overwritten by examining a plurality of bit indicators; and
initiating said storing, said comparing and said invalidating when there is an indication that said testing is slowing operation of said computer system.

### Claim 39

In a computer system that translates target instructions from a target instruction set into host instructions from a host instruction set, a method of checking for changes in a sequence of target instructions, comprising:
subsequent to a translation of a first sequence of a plurality of target instructions, testing to determine changes to said first sequence;
storing a copy of said first sequence;
comparing said copy with a second sequence of a plurality of target instructions; and
responsive to a mismatch based on said comparison, invalidating said first sequence.

### Claim 40 (depends on 39)

The method as described in claim 39 further comprising:
initiating said storing, said comparing and said invalidating when a page containing said first sequence has been changed.

### Claim 41 (depends on 39)

The method as described in claim 39, wherein said testing comprises examining a bit indicator associated with a memory location where said first sequence is stored.

### Claim 42 (depends on 41)

The method as described in claim 41 further comprising:
initiating said storing, said comparing and said invalidating when said bit indicator indicates that at least one of a plurality of sub areas of a page containing said first sequence has been changed.

### Claim 43 (depends on 41)

The method as described in claim 41 further comprising:
testing for an indicator that said first sequence has been overwritten by examining a plurality of bit indicators; and
initiating said storing, said comparing and said invalidating when there is an indication that said testing is slowing operation of said computer.

### Claim 44 (depends on 39)

The method as described in claim 39 further comprising:
measuring a frequency at which changes to said first sequence occurs.
