Patent ID: 7360028

Claim:
A method for self-modifying code comprising: distinguishing between a store-to-data-space instruction and a store-to-instruction-space instruction in an execution sequence of instructions; executing the store-to-data-space instruction to update a data space target in a memory shared amongst a plurality of processing units that each has a separate instruction cache; executing the store-to-instruction-space instruction to update an instruction space target in the shared memory; ensuring coherency between the instruction caches and the shared memory without snooping traffic that corresponds to a store-to-data-space instruction; and at least one of: updating a location in a data cache incident to the executing the store-to-instruction-space instruction when the location hosts content at an instruction space target indicated by the store-to-instruction-space instruction, wherein the data cache is accessible to the plurality of processing units; bypassing the data cache and writing directly to the shared memory incident to the executing the store-to-instruction-space instruction when the data cache does not represent an instruction space target indicated by the store-to-instruction-space instruction; or incident to the executing the store-to-instruction-space instruction wherein the store-to-instruction-space instructions indicates the instruction space target and new content, when the location in the data cache does not host content at the instruction space target, then copying content from the instruction space target to the location in the data cache, updating the data cache location with the new content, and copying the new content to the instruction space target from the data cache location.