CN1836210A - Partitioning code in program code conversion to account for self-modifying code - Google Patents

Partitioning code in program code conversion to account for self-modifying code Download PDF

Info

Publication number
CN1836210A
CN1836210A CNA2004800232770A CN200480023277A CN1836210A CN 1836210 A CN1836210 A CN 1836210A CN A2004800232770 A CNA2004800232770 A CN A2004800232770A CN 200480023277 A CN200480023277 A CN 200480023277A CN 1836210 A CN1836210 A CN 1836210A
Authority
CN
China
Prior art keywords
code
instruction group
theme
translation
theme instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CNA2004800232770A
Other languages
Chinese (zh)
Other versions
CN100362475C (en
Inventor
艾利克斯·布朗
保罗·托马斯·诺尔斯
杰兰特·诺斯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
IBM United Kingdom Ltd
International Business Machines Corp
Original Assignee
Transitive Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Transitive Ltd filed Critical Transitive Ltd
Publication of CN1836210A publication Critical patent/CN1836210A/en
Application granted granted Critical
Publication of CN100362475C publication Critical patent/CN100362475C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45516Runtime code conversion or optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3802Instruction prefetching
    • G06F9/3812Instruction prefetching with instruction modification, e.g. store into instruction stream

Abstract

A partitioning technique utilized by a translator to divide subject code space into partitions, where each partition contains a distinct set of basic blocks of subject code and corresponding target code. Thus the translator's representation of subject code and subject code translations is divided into non-overlapping regions of subject memory. In this manner, when the subject program modifies subject code, only those partitions actually affected by the self-modifying code need be discarded and all translations in unaffected partitions can be kept. This partitioning technique is advantageous in limiting the amount of target code that must be retranslated in response to self-modifying code operation. In another process, the partitioning technique allows multithreaded subject programs that also involve self-modifying code to perform code modification in a thread-safe manner.

Description

Be used for dividing the method and apparatus of code in program code conversion
Technical field
The present invention relates generally to computing machine and software for calculation field, and relate in particular to the program code conversion method and apparatus that for example in code translation device, emulator and accelerator, uses.
Background technology
In embedded and non-embedded CPU, it is found that, if the existing master instruction collection of the main body of software framework (ISA) can be visited related software pellucidly, then can " promote " its performance, or it can be " translated " into many high-performance processors (capable processor) with better cost/performance advantage.People find that also the host CPU framework ISA with them in time is relevant, and can not improve performance or market scope.This structure can be benefited from " synthetic CPU " framework (co-architecture) altogether.
The program code conversion method and apparatus promotes this acceleration, translation and common architecture capabilities, and is for example put down in writing among the WO 00/22521 of " Program Code Conversion " at title.
During the source program of the architecture design that will be the theme converts the program code conversion of the target program that can carry out by target architecture to, for revising code certainly problem has appearred." revise code certainly " and refer to the source program of having a mind to revise its oneself subject code (subject code).The reason of the code of modification of program its oneself has multiple, has wherein listed some examples of revising code certainly in table 1.
Code Code function
Cover Overlays Covering is the employed mechanism of the system of not virtual support internal memory.In order to save address space, individual process can be reused the theme address realm, to keep different storehouses in the different time.This use can or can be with not relevant to the system call of mmap () or munmap ().
Trampoline Trampoline Trampoline is the segment code that makes up in data area (promptly in storehouse or heap), and it comprises calling any other local code in the system.
Code is repaired Code Patching Chain program and debugged program can be revised (repairing) existing code, to realize link and break-point operation.
Real-time program compiler Run-time Compilers Such comprises dynamic binary translator and in good time (JIT:just-in-time) compiler.This program may write many segments of subject code on the data area.
Signal handler Signal Handler The signal processor that is used for SIGILL (disable instruction) can be revised and cause code unusual and that continue.
Form 1: the example of revising code certainly
From revising code is exactly that the subject code that is modified may be corresponding with the object code that has been translated to one of them subject matter that dynamic translators occurred.When this modification of subject code occurring, all translations of the subject code that this must be modified are identified as inefficacy and it are abandoned.So translater must be able to be discerned all the object code sequences (i.e. translation) corresponding to the particular topic code address that just is being modified.In dynamic translators, seek and deletion is difficult corresponding to the object code of given theme address, and sometimes or even impossible.In some cases, at the translate duration optimizing application, the translation of its generation can be no longer accurately relevant with this scope of translating represented theme address.In these cases, if source program is revised its oneself code at place, certain theme address, then just can't to discern which translated object code be invalid to translater.
Summary of the invention
According to the present invention, provide a kind of equipment and method described in appended claims.According to dependent claims and following explanation, can obviously see preferred feature of the present invention.
Be the various aspects that can realize according to various embodiments of the present invention and the general introduction of advantage below.It provides as a kind of introduction, more promptly understands the detailed design discussion in back to help those skilled in the art, and it is not intended to by any way the scope of appending claims is limited yet.
Especially, the inventor has developed the many optimisation techniques that are used for the accelerated procedure code conversion, it particularly is being used in combination with the real time translation device, this real time translation device is translated into object code with the continuous fundamental block of source program code, wherein carries out the object code corresponding to first fundamental block before generation is used for the object code of next fundamental block.
In preferred the processing, translater adopts partitioning technique, and the subject code spatial division is become the zone, after this is referred to as subregion, and wherein each subregion comprises one group of different fundamental block of subject code and respective objects code.Subregion is represented the translater of subject code and subject code is translated the non-crossover zone that is divided into theme storer (subject memory).In this way, when the code revision of the modification certainly subject code in the source program, only need abandon and actually be subjected to this, and can keep all translations in the unaffected subregion from those subregions of revising the code influence.The advantage of this partitioning technique is, it has limited in response to must be by the quantity of Aim of Translation code again from revising the code operation.In another kind was handled, partitioning technique allowed also to comprise from the multithreading source program of revising code and revises with the mode run time version of thread-safe (thread-safe).
Description of drawings
Accompanying drawing is included in the instructions, and constitutes the part of instructions, and it has described currently preferred embodiment, wherein:
Fig. 1 is a block scheme of wherein using the equipment of the embodiment of the invention;
The synoptic diagram of Fig. 2 has been described fundamental block data structure and the buffer memory according to example embodiment of the present invention;
The flow chart description of Fig. 3 at partitioning technique that translate duration adopted;
The flow chart description of Fig. 4 the subregion modification;
The example schematic of Fig. 5 A and 5B has been described and created and revised subregion in partitioning technique;
The flow chart description of Fig. 6 cuttable partition zone optimizing technology;
The example schematic of Fig. 7 A and 7B has been described and has been used cuttable partition zone optimizing technology to create and revise subregion;
The example schematic of Fig. 8 A-8E has been described and has been used cuttable partition zone optimizing technology to create and revise the subregion with movable and non-movable SIG scope; With
The example schematic of Fig. 9 A and 9B has been described by the control stream of translater of the present invention between subregion.
Embodiment
The demonstration equipment of the various new features of being discussed below being used to implement has been shown among Fig. 1.The storer 18 that Fig. 1 has described the target processor 13 that comprises destination register 15 and stored a plurality of software components 19,20,21, wherein sort memory 18 also is provided for fundamental block buffer memory 23, global register store 27 and the work of the subject code 17 that will translate storage.Software component comprises the code 21 after operating system 20, translator code 19 and the translation.Translator code 19 for example can be used as emulator, is used for the subject code of an ISA is translated into code after the translation of another ISA, perhaps as accelerator, is used for subject code is translated into code after the translation of identical ISA.
Translater 19, promptly implement version after the compiling of source code of translater, and the translation of the code 21 after the translation, the subject code 17 that promptly produced by translater 19, the 20-of binding operation system is such as the UNIX that runs on the target processor 13, typically microprocessor or other suitable computing machine-operation together.It being understood that in the structure described in Fig. 1 only be exemplary, and, for example can be by residing in the operating system or in its lower section code implementation according to software of the present invention, method and processing.Subject code, translator code, operating system and memory stores mechanism can be the known any various wide range of types of those skilled in the art.
In equipment according to Fig. 1, preferably, when the code 21 after translation is moving, in working time, dynamically executive routine code conversion.Code 21 after translater 19 and the translation as one man moves.The execution route of Translation Processing is a Control Circulation, comprises the following steps: to carry out translator code 19, and it translates into code 21 after the translation with a subject code 17, carries out the code 21 behind this block translation then; The end of the code 21 behind each block translation comprises the instruction that control is turned back to translator code 19.In other words, translation and the step of carrying out subject code then interweave, thus the part of a translation source program 17 once, and the code 21 after the translation of carrying out first fundamental block before the fundamental block of translation back.The translation elementary cell of translater 19 is fundamental blocks, this means, translater 19 is next fundamental block ground translation subject codes 17.The formal definition of fundamental block is to have just what a inlet point and the just code section of what a exit point, and it is restricted to single control path with block code.Therefore, fundamental block is the elementary cell of control stream.
In the processing of the code 21 after producing translation, by instruction sequences generation intermediate representation (" the IR ") tree of translater 19 according to subject code 17.IR tree is the abstract representation of the performed operation of the expression formula calculated and source program.Subsequently, according to the code 21 after the IR tree generation translation.For example, at title " Block Translation Optimizations for Program CodeConversion ", and the applying date is the common unsettled U.S. Patent application No.10/439 on May 16th, 2003, described the method and apparatus that is used to produce this IR tree in 966, its full content is hereby incorporated by reference.
After producing the IR tree, produce corresponding object code 21 according to the IR tree.The process that produces object code 21 according to class IR is known in the art.The end of the piece after translation inserts object code 21, so that abstract register is stored in the global register store 27.After object code 21 produced, it was performed then.
Translater 19 at first produces pieces 21 after the translation according to the theme of first fundamental block instruction 17, carries out the code after the translation that is used for first fundamental block then.At the end of first fundamental block, the code 21 after the translation returns to translater 19 with control, and translater 19 is translated second fundamental block then.Carry out the code 21 after the translation be used for second fundamental block then.At the end of carrying out second fundamental block, the code after the translation returns to translater 19 with control, and translater 19 is translated next fundamental block then, or the like.
So, have two kinds of dissimilar codes carrying out with interleaving mode at the source program of 19 times operations of translater: the code 21 after translator code 19 and the translation.Translator code 19 is implemented to produce according to the high-level source code of translater 19 before working time by compiler.Code 21 after the translation is produced according to the subject code 17 of the program that just is being translated in the whole service time by translator code 19.
Similarly, the expression of between code 21 compositions after translater 19 and the translation, dividing the theme processor state.Translater 19 is stored in various explicit programming language devices with the theme memory state, such as variable and/or object, in; The compiler that is used for compiling translater is determined how enforcement state and operation in object code.Code 21 after the translation implicitly is stored in the theme processor state in destination register and the memory location by relatively, and it is by the target instruction target word direct control of the code 21 after translating.
For example, the rudimentary expression of global register store 27 is the zone of the storer that distributed.By preserving between defined memory area and a plurality of destination register and recover (restore), this is how code 21 after the translation sees abstract register and mutual with it.Yet in the source code of translater 19, global register store 27 is data arrays, or can be more senior by the object of access and operation.Code 21 as for after the translation does not just have senior expression.
In some cases, the theme processor state is static in translater 19 or can determines statically that it directly is encoded into the code 21 after the translation, rather than is dynamically calculated.For example, translater 19 can produce according to the instruction type of last flag affects (flag-affecting) instruction and the code 21 after the translation of appointment, this just means that if the instruction type of last flag affects instruction changes, then translater is that identical fundamental block produces different object codes.
Translater 19 comprises the data structure corresponding to each fundamental block translation, it is especially for promoting translation optimization, such as the fundamental block of expansion, be equal to the translation state optimization of piece (isoblock), chunk and buffer memory, as U.S. Patent application No.10/439, described in 966, and its full content is hereby incorporated by reference.Fig. 2 has described this fundamental block data structure 30, and it comprises theme address 31, object code pointer 33 (i.e. the destination address of the code after the translation), translation prompting 34, enter with exit criteria 35, general introduction tolerance (profiling metric) 37, to the reference 38,39 and the inlet register mappings 40 of the data structure of former and follow-up fundamental block.Fig. 2 has also described fundamental block buffer memory 23, and it is the set of fundamental block data structure, for example by 30,41,42,43,44 of theme address index ...In one embodiment, the data structure corresponding to the fundamental block after the certain translation can be stored in the C++ object.When the translation fundamental block, translater 19 is created new fundamental block object.
The theme address 31 of fundamental block is the start address of this fundamental block in the storage space of source program 17, if promptly source program 17 runs on the theme framework, and the present memory location of fundamental block.It is also referred to as the start address that is the theme.Though each fundamental block is corresponding to a theme address realm (one of each theme instruction), the theme start address is the theme address of first instruction in the fundamental block.
The destination address 33 of fundamental block is the memory location (start address) of the code 21 after the translation in the target program.Destination address 33 is also referred to as and is object code pointer, perhaps target start address.In order to carry out the piece after the translation, translater 19 is used as by dereference (dereference) destination address to call the function pointer of the code after (control transmission is given) translation.
Fundamental block data structure 30,41,42,43 ... be stored in the fundamental block buffer memory 23, it is the thesaurus by the fundamental block object of theme address tissue.When the code after the translation of fundamental block 21 finished to carry out, it returned to translater 19 with control, and also the value of purpose (follow-up) the theme address 31 of fundamental block was returned to translater.In order to determine whether follow-up fundamental block is translated, translater 19 compares the theme address 31 of the fundamental block (i.e. those that have been translated) in purpose theme address 31 and the fundamental block buffer memory 23.Translation is also carried out the fundamental block that also is not translated then.Carry out and be translated the fundamental block of (and have compatible entry condition, as described below) simply.As time goes on, the many fundamental blocks that run into will be translated, and this just makes the translation cost that increases progressively reduce.So it is faster that translater 19 becomes as time passes, because need the piece of translation fewer and feweri.
Subregion
In a preferred embodiment, translater 19 adopts choice of technology theme instruction set, after this is referred to as theme instruction group (SIG), so that each SIG is associated with the translater data structure (for example fundamental block) of different sets and the object code 21 after the translation.After this SIG is referred to as subregion with its relevant translater data structure and the combination of object code 21.Single SIG comprises the theme instruction in one or more theme address realms.Instruction from single theme address or a plurality of theme address realms can be included among several different SIG.Piece after the translation can include only the translation from a SIG.
The expression that the partitioning technique that translater 19 is utilized will be controlled the translater 19 of stream is divided into many groups theme instruction (SIG) that may be modified together.In some cases, these subregions are corresponding to different sink and the obj ect file of forming source program, thereby will arrive the theme storer as the partition map that the storehouse is created and replaced, and abandon in the back.When to revise its oneself subject code 17-and after this be referred to as " revising certainly "-source program when translating, partitioning technique can be particularly useful for translater 19.By with subject code 17 with and corresponding translation after object code 21 be divided into subregion, when the related subject code of affected one or more subregions is modified and does not influence in the useful information (for example translation) that its SIG does not have to set up in affected other subregion, can abandon these affected one or more subregions.If do not use this subregion,, need abandon all existing translations, even those are not subjected to the translation of code revision influence then in response to each code revision.
In a preferred embodiment, translater 19 keeps the data structure of isolating, thus by SIG with translation data structure organization Composition Region.This isolation makes it possible to once abandon and discharges the many block translations (and related data structure) that are included in the single subregion, rather than the lower floor of the code behind the ergodic translation represents, to search affected translation and with one of their each deletion.For example, in one embodiment, translater 19 keeps independent fundamental block buffer memory 23 for each subregion.
In a preferred embodiment, translater 19 definition SIG make the theme address among the single SIG form the address of single successive range.
In another preferred embodiment, translater 19 definition SIG make that the theme address among the single SIG comprises: the continuation address of the single scope that (1) may be modified together; The address of the additional range that (2) unlikely is modified.So just make single translation comprise instruction, thereby and form the translation of more optimizing from scope (1) and scope (2).
The step of being implemented in revising subregion by translater 19 has been described in Fig. 3.When subject code 17 is revised other subject code, in step 100, detect " modification incident " by translater 19.Definition modification incident is with corresponding to particular topic address realm (override, delete or other are modified the scope of the subject code that is influenced).Translater 19 must at first detect subject code when and where by modification certainly (that is, which subject code is carried out is revised, and which subject code is modified).The modification incident is any incident that subject code 17 is modified.Do not comprise the wherein situation of subject code 17 modification subject datas from revising code.Certainly the modification of subject code 17 can have various ways, includes, but are not limited to: (i) with File mapping (for example mmap () system call) in storer; (ii) from storer, remove file (for example munmap () system call); (iii) make memory area can carry out (for example using mprotect () system call to change its authority).
Under the situation of system call that use is known-revise such as mmap (), munmap () or mprotect ()-carry out subject code 17, translater 19 can detect in subject code 17 this system call all call, to detect the modification incident.Translater 19 also can detect subject code 17 by other mechanism and revise.For example, many theme processor requirements, before carrying out the code that has been modified, source program is the Instructions Cache of refresh process device (I-buffer memory) at first.Especially, the PowerPC framework has the specific instruction that is used for this purpose, and (the Instructions Cache piece is invalid: Instruction Cache Block Invalidate), and other framework can use the particular system that is used for identical purpose to call " ICBI ".On the framework with this cache flush requirement, translater 19 can detect the modification incident by the example that detects specific instruction (or particular system calls).
In another preferred embodiment, translater 19 uses the feature of destination OS 20 to monitor all write operations that carry out corresponding to the target memory zone of subject code, to detect the modification incident in step 100.In some system, system call mprotect () allows the specific region of translater 19 storeies to be set to " read-only ".Other system can utilize the function of the function that is equal to mprotect () system call, is defined as read-only with the specific region with storer.Any trial that writes to read-only zones all triggers the signal that is translated device 19 detections.Signalisation translater 19: subject code 17 occurred and revised, and translater 19 uses signal content to determine which theme address just is written.Afterwards, translater 19 allows to write normally then in the scope (being affected theme address) that detects modification incident and identification modification.
In another preferred embodiment, for the memory write operation after each translation in the subject code 17, translater 19 produces the specific objective code sequence, and it checks that whether write address is corresponding to subject code 17, rather than corresponding to subject data, in step 100, to detect the modification incident.
In each of various embodiments of the invention, after detecting the modification incident, revise and cause in step 102, creating new subregion, its SIG comprises the theme instruction in the scope that is modified.In addition, in step 104, revise existing subregion then, to consider (accountfor) new subregion of creating.In revising existing subregion, translater 19 is implemented the step described in Fig. 4.When because detected modification incident, when translater 19 is created new subregion, its at first in step 110, determine the SIG that newly creates the division whether with any existing subregion in SIG intersect.When finding that SIG with existing subregion does not have crossover, in step 116, keep existing subregion complete.If the SIG that any existing section post has comprises the theme address of intersecting (crossover) with the scope that is modified, then all these crossing subregions are destroyed in step 112, and in step 114, created again, only under some situation that following application additional information is optimized.For ruined each crossing subregion, in step 114 the new residue subregion of theme address creation of remaining one or more scopes among the original SIG, make new residue subregion comprise the original SIG that intersects subregion and deduct the crossing scope that is modified.When subregion was destroyed, existing object code 21 translations of all that are associated with this subregion all were dropped.The subregion of each new establishment is the object code 21 after the fully empty translation at first, this means, must be from the working area (scratch) translation is run into subsequently from any subject code 17 of the SIG of this subregion.
Fig. 5 A and 5B described from the example of one group of existing new subregion of partition creating and with the modification incident of the some of them crossover of these subregions.For the simple explanation example is provided, in the SIG of Fig. 5 A and 5B description, the theme instruction set that is used for each SIG forms single successive range, but the essence of this technology is not to want each SIG comprise single successive range.Before making amendment, the SIG of four subregion A, B, C and D is present in the theme address space, as shown in Fig. 5 A.Subject code 17 in this example is revised the scope that point 50 from storer extends to a little 52 theme coded address then.Modification scope 54 intersects with the SIG of subregion A and C, and fully the SIG of subregion B is surrounded.Fig. 5 B has described the change of existing section post being carried out in response to the modification incident.Be whole scope 104 M that creates the division that is modified.Subregion A and C are destroyed, and are the remainder of the A that not do not intersect with modification scope 104 and C create the division respectively A ' and C '.Subregion B is destroyed, and its SIG is comprised by new subregion M fully.The scope of subregion D does not have and modification scope 54 crossovers, and it remains unaffected.
In another preferred embodiment of translater 19, use inertia subregion allocation optimized technology by partitioning technique, to improve the performance of translater 19.In order to save storer, when creating the division, do not distribute the complete data structure of a subregion.On the contrary, the inactive partition of the SIG of initial creation reserved partition, but translater 19 does not initially distribute any lower floor translation data structure and storer.In this way, initial inactive partition is the empty framework subregion that only keeps specific SIG basically.Being translated device 19 is identified as the zone that just is modified the theme storage space that incident revises and can in fact never be translated into object code 21 in some cases.This may be because the theme memory area corresponding to data, or because the theme memory area corresponding to the code that never is performed.Inactive or the framework subregion of initial creation has been avoided the expense of the memory resource of waste.
When 17 actual being translated of any subject code among the SIG of subregion, inactive partition becomes alive or movable subregion, and the initialization partitioned data organization.Correspondingly, corresponding to the data segment of source program (for example, as data by the file of mmap (), and the file never carried out of source program as code) the modification incident make new inactive partition be created, but do not distribute any lower floor translation data structure and memory area.Has only the complete data structure that when translation occurring in the theme address realm at subregion, just realizes subregion.Because inactive partition does not comprise the translation of subject code, thus can create, delete or realize them, and the performance cost that does not need storer and be associated with active partition.
In some cases, translater 19 can distribute the large memories zone for new subregion, with 21 translations of storage object code.Object code 21 preferably is assigned to continuous, to avoid unnecessary segmentation.Translater 19 more may can make object code 21 continuous, if it uses the large memories zone.Error-detecting to subregion (promptly not corresponding to the modification incident in the theme memory range that can carry out subject code) sometimes may consume valuable memory resource, and without any purpose.By just just distributing translation data structure and storer in subject code 17 actual being translated in subregion (and execution), the inertia subregion distributes makes translater 19 can avoid because the negative influence of the false positive that the modification event detection mechanism that is associated with subregion is produced.
In another preferred embodiment, translater 19 has the interpreter function, with explanation subject code 17, rather than translates it.This just makes translater 19 can postpone the translation of subject code 17, thereby avoids distributing the subregion that is associated with this subject code 17.In the applying date is that on September 4th, 2003, title have been described interpretation method and the equipment of being convenient to this interpreter function among the common unsettled UK Patent Application No.03 20716.4 of " Method and Apparatus for PerformingInterpreter Optimizations during Program Code Conversion ", and its full content is hereby incorporated by reference.
In another preferred embodiment, 19 pairs of subregions of translater are handled the cuttable partition zone optimizing technology of using, to improve the performance of translater 19, wherein with the SIG reduction of subregion-rather than delete this subregion-to the littler SIG that comprises the actual address set of using in the subregion in response to the modification incident.The littler SIG of reduction does not comprise the defined scope of modification incident.Initially, in response to detecting the modification incident, create new subregion, wherein SIG comprises having its value by the start address of revising scope definition and the scope of end address.Yet in operation, the actual range of the theme address that is translated can be than defined subregion narrow range.Comprising that all reality in the subregion have been translated or have been labeled is used for the SIG of use that the SIG of the theme address of translation in the future is called " movable SIG " or subregion.The residue SIG of the theme address that also is not translated in the subregion is called " non-movable SIG ".In order to optimize the performance of translater 19, by deleting nude mobility range address portion at least, the scope of the SIG of subregion can be tapered to the Geng Xiaoji that comprises the address of its scope of activities the movable SIG from its initial defined address set corresponding to the crossover between non-movable SIG and the modification scope.
Though the notion that can implement to reduce subregion by any multiple mode, in a preferred embodiment, translater 19 keeps the address of the scope after scope of activities or the translation in the SIG of each subregion.When creating the division, its movable SIG initially is empty.At translate duration, when each theme instruction was translated, the movable SIG with current subregion compared with its theme address (" address after the translation ").If the address after the translation is outside current active SIG, expansion activity SIG then is to comprise the address after the translation.Like this, movable SIG will increase along with the carrying out of subject code translation.
Can reduce in the partition zone optimizing technology in execution, translater 19 is implemented in the step described in Fig. 6.When the device 19 of serving as interpreter detects the modification incident in step 200, create new subregion in step 202, wherein SIG comprises the modification scope.Translater 19 in step 204, determine then the modification scope whether with the initial defined SIG crossover of existing subregion.When finding not have crossover, the existing subregion that has defined is kept perfectly.If there is crossover, then translater 19 in step 208, determine then the modification scope in fact whether with the movable SIG crossover of subregion.If the modification scope not with movable SIG crossover, translater 19 can change the size of the initial defined SIG of subregion simply in step 210 so, and does not delete the translation data structure in the subregion.Reason is, though initial defined subregion SIG represents the possible range of subregion, as the last modification incident that creates the division defined, movable SIG represents the theme address set after the actual translation.Therefore the modification with movable SIG crossover does not make any translation in the subregion invalid, because translater 19 knows that the theme address after the translation is different with the theme address that is modified, and therefore not influenced by it.The size of SIG by changing subregion, to comprise scope of activities at least, the translation that is stored in the subregion can be maintained in this subregion, and does not need deleted.On the other hand, if the movable SIG crossover of modification scope and subregion, translater 19 must be deleted whole subregion in step 212 so, as mentioned above.
Referring now to Fig. 7 A and 7B, it has illustrated and can reduce the partition zone optimizing technology.Identical with shown in Fig. 5 A and the 5B basically at Fig. 7 A and the subregion described in the 7B is except subregion A and C comprise respectively the theme address 56 and 58 of scope of activities.Before revising, there are four subregion A, B, C and D, as shown in Figure 10 A.The point 50 that subject code is revised then from storer extends to a little 52 subject code address realm.Modification scope 54 intersects with the initial defined subregion scope of subregion A, but the modification scope is not crossing with the scope of activities 56 of subregion A.Fig. 7 B has described the change of existing section post being carried out in response to the modification incident.Creating the division after the M for modification scope 54, the scope that can reduce subregion A, and do not influence translation among the subregion A.On the contrary, can see in this example that modification scope 54 intersects with the scope of activities 58 of subregion C.So the scope that can not reduce subregion C simply must be destroyed subregion C, therefore be the new subregion C ' of remainder establishment that does not intersect with modification scope 54 of subregion C.Destroy subregion B, and its scope is comprised by new subregion M fully.Subregion D remains unaffected.
Referring now to Fig. 8 A-8E, described is cuttable partition zone optimizing technology, wherein has SIG 300, and it comprises a plurality of activities and nude mobility range.Fig. 8 A has described initial defined SIG 300, as its in theme address space 302 as shown in.SIG 300 comprises the subject code address 304 and 306 of two scopes.As shown in Fig. 8 B, each subject code address realm 304,306 comprises the subject code address 308,310 of scope of activities respectively.All the other theme addresses among the SIG 300 are the non-movable subject code addresses that are arranged in nude mobility range 312,314 and 316.In case the modification incident occurs, so subject code is revised the scope of subject code address, to create new SIG 318, described in Fig. 4 C.The scope of the new SIG 318 that creates and the initial defined subject code address realm of SIG 300 304 intersect, and wherein the scope of SIG 318 does not intersect with its scope of activities 308, and only intersects with its nude mobility range 314.After determining the range limit of SIG 318, can as shown in Fig. 4 D, reduce theme address realm 314, and not influence the translation in the scope of activities 308 of SIG 300.Theme address in the scope 320 that intersects by deletion and SIG318 reduces nude mobility range 314, with the nude mobility range 314 that produces reduction '.Fig. 4 E has described in response to the modification incident, to initial defined theme address realm 304,306 modifications of being carried out of SIG 300.As shown in the figure, as described above initial defined theme address realm 304 is tapered to comprise scope of activities 308 and nude mobility range 312,314 ' theme address realm 304 '.The influence that theme address realm 306 keeps not created new SIG 318.
Translater 19 can detect most of modification incidents in decoding, but may not know the actual subject address that will revise, the code 21 after carrying out translation.So the device 19 of serving as interpreter detects during decoding that subject code 17 is revised or during for the indication that occurs revising, translater 19 finishes the translation of current blocks, and and then inserts notice after the current block, will revise event notice to translater.
In an embodiment of translater 19,, in this translater 19, implement partitioning technique by means of specific.Though specific be those they can be corresponding to the particular topic address do not represent the piece of the translation of subject code.By contrast, the translation piece is represented the translation of the particular topic code sequence that begins with specific initial theme address.On the contrary, specific specific operation that comprises translater 19, it was inserted in the object code stream at translate duration before reality is carried out these pieces.In fact, specific is the certain translation structure of carrying out the operation of light weight translater, and it can be set at the specified point in the object code control stream, does not get back to the translater circulation and do not need high cost ground that content is switched out from object code.
Specific comprises pseudo-object code, rather than common object code.Common object code is represented the translation of certain subject code sequence.Pseudo-object code is made up of artificial (promptly untranslated) object code sequence, writes and is compiled to have the identical calling convention of object code that is produced with translater 19 in its object code that write direct or with high-level programming language (for example C++).Specific example is included in the notice piece and the Border Protection piece of this discussion.
During the control of the program after in a preferred embodiment, translater 19 will be called as " notice piece " specific and be inserted into translation on the point that and then comprises after revising the piece of subject code is flowed.The notice piece is " specific " translation structure, because be different from the translation piece, it does not represent the translation of any particular topic code, but expression modification incident.The actual subject code 17 of carrying out modification is translated the part as current block.The notice piece is inserted into as the follow-up of current block.So after and then carry out revising in the current block after translation, notice piece notice translater 19 is subsequently carried out suitable operation, with in response to this modification (being that subregion is regulated).Subject code 17 in the follow-up new piece that becomes the notice piece after the translation modification incident.
When operation in object code 21 during the arrival notice piece, the theme address realm of the code that is modified is notified to translater 19.Translater 19 uses this information to create new subregion, and it also can change or destroy existing subregion, as mentioned above.
Comprise from the piece of revising subject code (predecessor of notice piece) and after and then discerning the modification incident, finish, can be because revise so that current subregion is invalid.The subject code that is modified can be next theme instruction, the version that it can require the translater translation and carry out the new modification of this instruction, rather than the existing translation of execution legacy version.For example, on the PowerPC framework, after the cache flush instruction, piece must finish.So, when detecting the modification incident, finish the current block of translation, and insert the notice piece as follow-up.
The notice piece also with the copy of current theme address and compatibility list from its former block transfer to its successor block.After notice occurring,, in successor block, restart translation in next theme instruction.If owing to operation has destroyed current subregion, then notify piece also to carry out safe transition in the new subregion of replacing it, use the theme address and the compatibility list that are copied to come initialization successor block in new subregion.This has been avoided quoting at the transition period of new subregion the problem of data that may be deleted.
The translation piece must finish in partition boundaries, make the establishment of scoring area may have to otherwise the negative effect of the optimization that can on the major part of code, carry out.Because formed subregion, otherwise the code section that will be translated together is translated as independent piece, turns back to translater round-robin number of times so just reduced the scope of optimizing and increased.For example, optimize by partition boundaries restriction, such as common unsettled and transfer extension blocks and chunk optimization described in the assignee's identical with the present invention the U.S. Patent application No.10/439966, it is hereby incorporated by reference.Therefore, for the known source program of not revising its oneself subject code 17, can be applied to current partitioning technique with a kind of optimization that improves translater 19 performances is exactly, and all theme storeies are aggregated in the single subregion, makes all subject codes 17 be comprised in the subregion.
Can implement the polymerization of theme storer in several ways.In a kind of mode, the known one group of storehouse that is not modified in normal operations is aggregated in the single subregion.Source program is needed, be not that independent subregion is put in all the other storehouses of this invariant set part as common.Can more effectively translate with regard to making like this translation in the constant subregion, keep simultaneously response remaining, the subject code in the storehouse that may change is revised and the ability of other subject code.
In the another kind of mode of theme storer polymerization, the zone (1) that will comprise the theme address of one group of known subject code that is not modified in normal operations joins among the SIG of all subregions that comprise other zone (2) that may change dividually, so just make more desirably to produce the translation that is sent to the control stream of invariant region from the possible region of variation of subregion, but the ability that the subject code of the region of variation of the subregion of maintenance response is simultaneously revised.Revise if comprise the subject code in the whole zone of subregion (2), subregion is deleted with integral body, to save storer.
The scope of subregion must suitably define, because the subregion scope influences the performance of translater 19.If subregion is too little, control stream must constantly pass through Border Protection (as described below).If subregion is too big, it is invalid that small code revision needn't make that the code after the more most translation becomes.When selecting partition size, should consider this compromise appropriate balance, because it is related to the performance of translater 19.If determine the particular zones that is just being produced performance is had negative effect, then can be to the subregion optimizing application.Acquiescently, determine partition size by revising event detection mechanism.For example, if translater 19 detects the mmap () of runtime routine library, create the new subregion that comprises whole storehouse so.
Can be applied to subregion is exactly the subregion polymerization with a kind of optimisation technique that improves translater 19 performances.For example, but PowerPC ICBI cache flush instruction makes that a page of execute store is invalid.Yet if once revise a plurality of pages of subject code 17, source program can comprise the ICBI instruction of several successive, and it makes the invalid in abutting connection with multipage of storer.Under the situation of above-mentioned subregion mechanism, will produce the pagewidth subregion of a plurality of adjacency like this.Like this, a kind of optimization of subregion mechanism detects the cache flush instruction that continues exactly, and the scope that will revise engages the SIG that becomes " polymerization " subregion.
In an embodiment who implements subregion polymerization optimization, when creating new subregion, whether translater 19 inspection exists so existing subregion (promptly not being all the other subregions of creating as the secondary product of creating new subregion), and its SIG is adjacent and in its front with the SIG of new subregion in subject code.If have, the range expansion of the SIG of the last existing subregion scope to the SIG that comprises new subregion can be got up two subregion polymerizations effectively.After realizing polymerization, new subregion does not need to have independent expression.
Border Protection
In a preferred embodiment, translater 19 inserts the additional level of indirection that is used for the control stream of walking between two subregions.Translater 19 uses specific placeholder, is referred to as Border Protection herein, is used to contact the piece of partition boundaries, thereby whether former piece can be checked the successor block after the previous translation and also exist.Make in this way, when former piece follow-up deleted, can notify them effectively.Translater 19 strides across each point of partition boundaries at the control stream of source program, perhaps is referred to as boundary intersection, inserts a pair of Border Protection structure.This comprises Border Protection and withdraws from Border Protection and enter Border Protection.To withdraw from Border Protection be after former piece and specific of adding in the subregion identical with this predecessor's piece.Entering Border Protection is to withdraw from the data structure that Border Protection piece and successor block couple together accordingly.For the piece after the translation in the same subregion, control stream directly from former block transfer to successor block.For the piece in the different subregions (being boundary intersection), to withdrawing from Border Protection, utilization enters Border Protection and locatees successor block control stream then, withdraws from Border Protection and passes control to successor block from former block transfer.
Enter the placeholder of Border Protection, wherein enter the reference of withdrawing from Border Protection copy of Border Protection storage them as translater 19.Each data structure that withdraws from Border Protection also comprises the reference that it is entered the Border Protection copy.Also there is the illustrative successor block in front in the execution of withdrawing from Border Protection with regard to checking.The Border Protection piece is used for the bookkeeping function by the explicit representation that the subregion point of crossing is provided.When serving as interpreter device 19 deletion particular zones, it travels through interior each of this subregion and enters Border Protection, to search the corresponding protection of withdrawing from.Because subregion is deleted, each this copy of Border Protection that withdraws from is with reference to being set to sky.In certain embodiments, translater 19 is stored the Border Protection that enters of the given subregions that are useful on, thereby when subregion is deleted, can travel through them effectively.For example, in one embodiment, translater 19 is kept for the Border Protection that enters of each subregion and tabulates, and wherein as long as establishment or deletion enter Border Protection, just this tabulation is upgraded.
Correspondingly, when Border Protection was withdrawed from execution, it was by checking that simply its oneself copy is with reference to verifying that it follow-uply also exists.If defined reference, the so effectively follow-up existence after the translation, and control is sent to successor block by respectively entering Border Protection, (thereby also being sent to follow-up subregion).The successor block after Border Protection is not known effectively translation is withdrawed from the ifndef reference so, exists successor block and its deleted before promptly, and perhaps this withdraws from that Border Protection also never is performed and therefore follow-uply also never is determined.The reference of ifndef copy, then the fundamental block buffer memory by checking subregion separately or obtain new Border Protection and the successor block of entering by the translation successor block.From withdrawing from the angle of Border Protection, be translated and deleted then successor block does not have different with the successor block that never is translated.
Make the processing of scoring area deletion more effective by Border Protection to the explicit representation of resulting partition boundaries point of crossing.In order to delete subregion, all references to deleted block (being the piece of previous translation in the deleted subregion) must be discerned and cancel to translater 19.Do not have certain thin note mechanism, such as Border Protection, translater 19 needs the piece after a large amount of translations of traversal, with discern in the deleted subregion which piece have follow-up so that deletion is dropped follow-up reference to these.Except allowing the processing of deletion subregion become more effective, the Border Protection piece has promoted the boundary intersection of thread-safe, following with reference to multithread programs discuss like that.
In order to delete subregion, translater 19:(i existing under the situation of Border Protection) put sky (void) and point to the copy that all that will delete subregion withdraw from protection and link; (ii) to deleting the follow-up subregions notice of all of subregion: what can abandon them correspondingly enters protection; (iii) delete all translation structures and the object code 21 that belongs to deleted subregion.In first step (i), all in 19 pairs of subregions of translater enter Border Protection and travel through, and the Border Protection copy is withdrawed from their outside reset, and effectively to all former subregions notices: deleted subregion is put sky.Second step of subregion deletion (ii) in, all in the traversal subregion withdraw from Border Protection, with to follow-up subregion notice: what can abandon them correspondingly enters protection.In one embodiment, withdraw from Border Protection, carry out second step by each that travels through deleted subregion.In another embodiment, come in the index subregion all to enter protection by comprising the corresponding former subregion that withdraws from protection.In this case, deleted subregion only need be notified each follow-up subregion once, and each follow-up subregion can be discerned the corresponding inlet point that will delete then.
Multithread programs in the subregion
When using subregion, the multithreading source program provides difficulty to translater 19, just must carry out the subregion deletion in the mode of thread-safe.Particularly, during given subregion is just deleted, must prevent that thread from entering this subregion.Guaranteed that like this control always enters effective translation, and never entered deleted or invalid piece.After deleting or creating the division again, can allow thread to enter (empty again) subregion then.
In a preferred embodiment, translater 19 uses single overall mutual exclusion (" overall subregion locking ") with specific division operation serialization, to comprise: (i) control stream redirect between subregion (being boundary intersection); And (ii) delete subregion, and create the division again in adaptable place.So, withdraw from Border Protection and must be sent to it in control and correspondingly obtain overall subregion locking before entering Border Protection.Similarly, the notice piece must obtain overall subregion locking before destroying subregion.For needs deletions and the modification incident of creating one or more subregions subsequently again, under the protection of overall subregion locking, automatically carry out all this deletions and create again, just sequentially carry out all these operations and do not need to discharge and lock.Translater 19 is kept the partition identifier that is used for each thread, and it is changed when being controlled at when transmitting between the subregion.Keeping between overall subregion lockup period, by Border Protection to carrying out this change.
In another preferred embodiment, translater 19 uses single overall mutual exclusion (" overall subregion locking ") that particular zones is operated serialization, comprising: (i) create entering Border Protection; (ii) delete subregion, and create the division again in adaptable place.So, withdraw from Border Protection must its can obtain new enter Border Protection and successor block or create again previous delete enter Border Protection and successor block before obtain overall subregion locking.Under the situation of subregion deletion, the notice piece obtained overall subregion locking before deletion, and deleting mechanism is at first carried out traversal it is entered the operation of Border Protection set then, to withdraw from deletion copy reference the piece from corresponding.This just requires, and existing under the situation of carrying out other thread, can remove the link of single copy reference safely.In case all enter Border Protection and have all used this operation, then, must finish remaining deletion action, and discharge overall mutual exclusion any withdrawing from before Border Protection can obtain new follow-up among the SIG that deleted section post has of revising like this.
Referring now to Fig. 9 A and 9B, the control stream of wherein having described the program after the translation strides across partition boundaries, has and do not have the partition boundaries of passing through respectively.Fig. 9 A is depicted as when application partition not or when control stream is also stayed in the single subregion, the control stream of the particular source program in the translater 19.Control is sent to theme piece B 403 from theme piece A 401, is sent to theme piece C 405 then, is sent to theme piece D 407 then.For the program subject code, piece B 403 is the follow-up of piece A 401, and piece C 405 is the follow-up of piece B 403, and piece D 407 is the follow-up of piece C 405.
Exist between the theme piece B of Fig. 9 A and the theme piece C or the situation on the border 409 of creating the division under, when passing partition boundaries 409, the control Border Protection of must flowing through is right, as shown in Fig. 9 B.Piece A 401 and B 403 are in subregion 415, and piece C 405 and piece D 407 are in subregion 417.In the source program after translation, control directly is sent to the piece B 403 from piece A 401, because piece A 401 and B 403 are in same subregion 415.Yet the control from piece B 403 to piece C 405 transmits and strides across partition boundaries.So control is sent to from piece B 403 and withdraws from Border Protection piece 411.As mentioned above, withdraw from Border Protection 411 and check that its corresponding Border Protection 413 that enters does not also have deleted.In multithread programs (following), withdraw from Border Protection and also obtain overall subregion locking, thereby can stride across partition boundaries in the mode of thread-safe.Control is sent to it and enters Border Protection 213 accordingly from withdrawing from protection border 411 then.Carry out and entered into subregion 417 now.In multithread programs (following), enter the partition identifier that Border Protection changes current thread, at present in subregion 417, and discharge overall subregion locking then with the reflection thread.In case in subregion 417, control is sent to piece C 405 from entering Border Protection 413, and directly is sent to piece D 407 from piece C 405 then.
Memory management
Memory management be among each embodiment of dynamic binary translator 19 the emphasis of wanting consider.For translate be used in the program of carrying out on a kind of architecture higher to allow on another kind of architecture, to carry out to the demand of storer.Optimize when introducing-such as being equal to piece (isoblock), extension blocks and chunk, described in common unsettled U.S. Patent application No.10/439966-time, storage requirement is higher because each these optimize the possibility that the sequence that all produces a subject code 17 can be represented by a plurality of translations.The modification incident requires the deletion subregion, and therefore requires deletion all translation datas (being block structure and object code) wherein.
In a preferred embodiment, translater 19 provide its oneself the subject code subregion is carried out the memory management subsystem of mirror image.Subregion is used for by the pairing subject code of all translater data structures 17 zones all translater data structures being divided into groups.The part subject code 17 that might be disabled together forms subregion: therefore all relevant translater data structures are present in the intact target memory zone of identical definition.If subregion is disabled, then can wholely discharge all translation datas (translater structure and object code) that are associated with this subregion, needn't discharge each structure individually.
In this specific embodiment, translater 19 is carried out all memory allocation by the memory source object.Each subregion has a corresponding memory source.Memory source by conventional methods-such as mmap () system call-obtain storer from operating system, but not to be integral body carry out for they.Other translator code (comprising pseudo-object code) obtains storer (being less amount ground) as required, but from each partitioned memory source, rather than directly obtain from operating system.Like this by quantity that reduces lower floor's system call relevant and the performance that frequency has improved translater 19 with storer.Memory source also is provided for the function of the full content in a refresh memory source.Memory source can discharge lower floor's storer or implements to refresh by abandoning its all " distribution " of having carried out from this storer (be about to record (slate) removing, keep lower floor's storer simultaneously) simply by reality.
The memory sub-system of storer 19 is also simplified the processing of deletion subregion.In order to delete subregion, translater 19 is necessary: the copy link of withdrawing from protection of (i) putting empty all former subregions; (ii) notify all follow-up subregions: what can abandon them correspondingly enters protection; And (iii) delete all and translate structures and the object code that belongs to subregion.If there is not the memory management subsystem, translation structure and object code that third step (iii) requires translater to travel through each subregion are gathered, to discharge each structure respectively.If the use memory sub-system can pass through refresh memory source simply, once discharge all partitioned organizations.
Although illustrated and described a few preferred embodiment, those skilled in the art are understandable that, do not break away from as defined scope of the present invention in appended claims, can carry out various changes and modification.
Should be noted that apply for simultaneously with the application or application before and all openly give the public's All Files and document, and the content of all these files and document all is hereby incorporated by reference with this instructions.
Disclosed all features in this instructions (comprising any appending claims, summary and accompanying drawing), and/or the institute of disclosed so any method or processing in steps can combination in any, except some the conflicting combination in these features and/or the step at least.
In this instructions (comprising any appending claims, summary and accompanying drawing) disclosed each feature can be identical by being used for, be equal to or the replacement feature of similar purpose replaces, unless outside offering some clarification on.So, unless outside offering some clarification on, disclosed each feature is an example of being equal to of general class or similar features.
The present invention is not limited to the details of previous embodiment.The present invention expands to any new or any new combination of disclosed feature in this instructions (comprising any appending claims, summary and accompanying drawing), perhaps expands to any new or any new combination of the step of disclosed any method or processing.

Claims (23)

1. during the object code (21) after subject code (17) is translated into translation subject code (17) is divided into groups to comprise to consider revising the method for subject code (17) certainly:
Between the code period after subject code (17) is translated into translation, and also between the code period after carrying out translation subsequently, discern the code of the modification certainly incident in the described subject code (17); With
When identification is revised the code incident certainly, the memory area that will comprise described subject code (17) is divided at least one theme instruction group of theme address, and wherein each theme instruction group comprises the subject code address that is subjected to one or more scopes of revising the code events affecting certainly separately in the described storer.
2. according to the process of claim 1 wherein that each theme instruction group also with corresponding to the object code (21) after the translation that is included in the subject code (17) in this theme instruction group is associated.
3. according to the method for arbitrary aforementioned claim, wherein each described theme instruction group is represented not and the memory area of being organized described memory area crossover by other theme instruction.
4. according to the method for arbitrary aforementioned claim, wherein each described theme instruction group represent can with the memory area that is included in the memory area crossover in other theme instruction group.
5. according to the method for arbitrary aforementioned claim, wherein revise the subject code address of scope separately from revising the code incident, described method also comprises:
Modification be present in the described storer, comprise be subjected to described from revising the theme instruction group of the subject code address of code events affecting.
6. according to the method for claim 5, wherein said theme instruction group modify steps comprises:
Create new theme instruction group, comprise corresponding to described from the subject code address that is modified subject code (17) of revising the code incident to comprise; With
For the existing theme instruction group of subject code address realm with the subject code address crossover of the new theme instruction group of creating, revise described existing theme instruction group, with from the described existing theme instruction group of the subject code address crossover of the theme instruction group of new establishment the described subject code of deletion address, make described theme instruction organize no longer crossover.
7. according to the method for claim 6, wherein also with related corresponding to the object code (21) after the translation that is included in the subject code (17) in this theme instruction group, described method further comprises each theme instruction group:
Deletion with in response to described from modification code incident and the object code (21) after the translation that the theme instruction group that has been modified is associated; With
Translation is used for being included in the fresh target code (21) of the subject code (17) of the described theme instruction group that is modified.
8. according to the method for claim 6 or 7, further comprise: the object code after serving as interpreter (21) be included in corresponding subject code (17) in the theme instruction group when being translated, the object code after the described translation (21) is related with this theme instruction group.
9. method according to Claim 8, wherein each theme instruction group comprises the particular range of the subject code address that has been translated, make the subject code address that has been translated of described particular range comprise the movable son group that described theme instruction group is interior, described method further comprises:
Determine described new establishment theme instruction group the subject code address whether with the described movable son group of any existing theme instruction group in any subject code address crossover; With
For the existing theme instruction group that has with the movable son group of the subject code address crossover of the theme instruction group of described new establishment:
Deletion with in response to described from modification code incident and the object code (21) after the translation that the theme instruction group that has been modified is associated; With
Translation is used for being included in the fresh target code (21) of the subject code (17) of the described theme instruction group that is modified.
10. according to the method for claim 9, wherein each theme instruction group comprises the subject code address that also is not translated of one or more scopes, and it is called as the non-movable son group in the theme instruction group, and described method further comprises:
For have not with the movable son group of the subject code address crossover of the group of described new establishment, but have existing theme instruction group with the non-movable son group of the subject code address crossover of the theme instruction group of described new establishment:
Revise described existing theme instruction group, with from the described existing theme instruction group of the subject code address crossover of the theme instruction group of new establishment described non-movable son group in the described subject code of deletion address, make described theme instruction organize no longer crossover; With
Make with translation that movable son group in described existing group is associated after object code (21) remain unchanged.
11. the method according to arbitrary aforementioned claim further comprises:
Adjacent one another are in the recognition memory, have the theme instruction group of permission with their combined feature; With
Described adjacent topics instruction group is aggregated into the theme instruction group of single combination.
12. method according to arbitrary aforementioned claim, wherein identification is described from revising the code incident during the described subject code of decoding (17), described method further comprises: the certain translation structure is inserted in the control stream of the object code (21) after the translation, as the expression of revising the code incident certainly that is identified.
13. according to the method for claim 12, in response to running into described certain translation structure during the object code (21) after carrying out described translation, described method further comprises:
Identification is subjected to revising certainly the scope of the subject code address of code events affecting, and utilizes the scope of the subject code address of being discerned to create theme instruction group in storer.
14. the method according to arbitrary aforementioned claim further comprises: discern and represent in the current theme instruction group that reality maybe may arrive control transmission the control flow commands of theme address outside the current theme instruction group.
15. method according to claim 14, wherein during the described subject code of decoding (17), discern described control flow commands, described method further comprises: withdraw from the control stream that the translation structure is inserted into the object code (21) after the translation, as the expression of the control stream incident of being discerned specific.
16. method according to claim 15, wherein utilize a pair of certain translation structure to represent that from theme instruction group subject code (17) is sent to the control stream of subject code (17) in the second different theme instruction groups, wherein said certain translation structure makes each exit structure comprise the specific reference that the copy that is associated with the follow-up theme instruction group that next will carry out is entered structure to comprising described exit structure and entering structure.
17. method according to claim 16, when carrying out with object code (21) that current theme instruction group is associated during when running into exit structure, described method further comprises: checking will control be sent to subsequent sets from current subregion before, in follow-up theme instruction group, exist copy to enter structure.
18. method according to claim 17, when carrying out with object code (21) that current theme instruction group is associated during when running into exit structure, wherein said exit structure not with follow-up theme instruction group in existing copy enter structurally associated connection, create this structure that enters, and it is it is related with the suitable follow-up theme instruction group that comprises the follow-up theme address that will carry out, and revise described exit structure, with the structure that enters of the described new establishment of reference specifically.
19. according to claim 16,17 or 18 method, wherein there is the exit structure that comprises all subregions and enters one group of Border Protection of structure, described method further comprises: as long as in response to deleting theme instruction group from revising the code incident, just revise described one group of exit structure and enter structure.
20. according to the method for arbitrary aforementioned claim, wherein when subject code (17) definition multithread programs, described method further comprises: when theme instruction group is just revised by another thread, prevent that other thread from entering theme instruction group.
21. according to the method for arbitrary aforementioned claim, wherein each theme instruction group further with corresponding to the object code (21) after the translation that is included in the theme address in this theme instruction group is associated,
Wherein each subregion comprises that a group of being illustrated in the control stream that transmits between the theme instruction group enters structure and exit structure, make each exit structure comprise the specific reference that the copy in the follow-up theme instruction group that next will carry out is entered structure, described method further comprises:
Provide to have the memory management subsystem that theme instruction group is carried out the zone of mirror image wherein said memory management subsystem stores object code (21) and enter structure and exit structure with what its respective objects code (21) was associated with theme instruction group; With
As long as this particular topic instruction group is modified, just delete the whole zone corresponding to particular topic instruction group of described memory management subsystem.
22. there is the translater software of computer-readable code form in the above in a computer-readable recording medium, it can be carried out by computing machine, is used to carry out the method for arbitrary aforementioned claim.
23. target processor; With
Be used for enforcement of rights and require 1 to 21 each the combination of translator code of method.
CNB2004800232770A 2003-07-15 2004-07-13 Partitioning code in program code conversion to account for self-modifying code Active CN100362475C (en)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
GBGB0316532.1A GB0316532D0 (en) 2003-07-15 2003-07-15 Method and apparatus for partitioning code in program code conversion
GB0316532.1 2003-07-15
GB0328121.9 2003-12-09

Publications (2)

Publication Number Publication Date
CN1836210A true CN1836210A (en) 2006-09-20
CN100362475C CN100362475C (en) 2008-01-16

Family

ID=27763853

Family Applications (2)

Application Number Title Priority Date Filing Date
CNB2004800232770A Active CN100362475C (en) 2003-07-15 2004-07-13 Partitioning code in program code conversion to account for self-modifying code
CNB200480020101XA Active CN100458687C (en) 2003-07-15 2004-07-13 Shared code caching method and apparatus for program code conversion

Family Applications After (1)

Application Number Title Priority Date Filing Date
CNB200480020101XA Active CN100458687C (en) 2003-07-15 2004-07-13 Shared code caching method and apparatus for program code conversion

Country Status (5)

Country Link
CN (2) CN100362475C (en)
GB (3) GB0316532D0 (en)
HK (2) HK1068698A1 (en)
IL (1) IL172830A0 (en)
TW (2) TWI362614B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101458630B (en) * 2008-12-30 2011-07-27 中国科学院软件研究所 Self-modifying code identification method based on hardware emulator
CN110178115A (en) * 2017-01-26 2019-08-27 阿里巴巴集团控股有限公司 The method and apparatus for handling self modifying code
US20220100527A1 (en) * 2020-09-29 2022-03-31 Rockwell Automation Technologies, Inc. Supporting instruction set architecture components across releases

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070294675A1 (en) * 2006-06-20 2007-12-20 Transitive Limited Method and apparatus for handling exceptions during binding to native code
GB2442497B (en) * 2006-10-02 2010-03-31 Transitive Ltd Method and apparatus for administering a process filesystem with respect to program code conversion
US9015727B2 (en) 2008-04-02 2015-04-21 Qualcomm Incorporated Sharing operating system sub-processes across tasks
US8069339B2 (en) * 2009-05-20 2011-11-29 Via Technologies, Inc. Microprocessor with microinstruction-specifiable non-architectural condition code flag register
US8578357B2 (en) * 2009-12-21 2013-11-05 Intel Corporation Endian conversion tool
US8479176B2 (en) * 2010-06-14 2013-07-02 Intel Corporation Register mapping techniques for efficient dynamic binary translation
CN102043659A (en) * 2010-12-08 2011-05-04 上海交通大学 Compiling device for eliminating memory access conflict and implementation method thereof
US10146545B2 (en) 2012-03-13 2018-12-04 Nvidia Corporation Translation address cache for a microprocessor
US9880846B2 (en) 2012-04-11 2018-01-30 Nvidia Corporation Improving hit rate of code translation redirection table with replacement strategy based on usage history table of evicted entries
US10241810B2 (en) 2012-05-18 2019-03-26 Nvidia Corporation Instruction-optimizing processor with branch-count table in hardware
US20140189310A1 (en) 2012-12-27 2014-07-03 Nvidia Corporation Fault detection in instruction translations
US10108424B2 (en) 2013-03-14 2018-10-23 Nvidia Corporation Profiling code portions to generate translations
US9684607B2 (en) * 2015-02-25 2017-06-20 Microsoft Technology Licensing, Llc Automatic recovery of application cache warmth
CN105700932B (en) * 2014-11-25 2019-02-05 财团法人资讯工业策进会 For the variable inference system and method for software program
CN104375879B (en) * 2014-11-26 2018-02-09 康烁 Based on the binary translation method and device for performing tree depth
CN105893031B (en) * 2016-03-28 2019-12-24 广州华多网络科技有限公司 Cache operation implementation method, service layer method calling method and device
US10613844B2 (en) 2017-11-10 2020-04-07 International Business Machines Corporation Using comments of a program to provide optimizations
CN107902507B (en) * 2017-11-11 2021-05-04 林光琴 Control software field debugging system and debugging method
CN112416338A (en) * 2020-11-26 2021-02-26 上海睿成软件有限公司 Code warehouse system based on label
CN117348889B (en) * 2023-12-05 2024-02-02 飞腾信息技术有限公司 Code translation processing method, system, computer system and computer equipment

Family Cites Families (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5313614A (en) * 1988-12-06 1994-05-17 At&T Bell Laboratories Method and apparatus for direct conversion of programs in object code form between different hardware architecture computer systems
US5619665A (en) * 1995-04-13 1997-04-08 Intrnational Business Machines Corporation Method and apparatus for the transparent emulation of an existing instruction-set architecture by an arbitrary underlying instruction-set architecture
US5875318A (en) * 1996-04-12 1999-02-23 International Business Machines Corporation Apparatus and method of minimizing performance degradation of an instruction set translator due to self-modifying code
US6711667B1 (en) * 1996-06-28 2004-03-23 Legerity, Inc. Microprocessor configured to translate instructions from one instruction set to another, and to store the translated instructions
US6112280A (en) * 1998-01-06 2000-08-29 Hewlett-Packard Company Method and apparatus for distinct instruction pointer storage in a partitioned cache memory
US6205545B1 (en) * 1998-04-30 2001-03-20 Hewlett-Packard Company Method and apparatus for using static branch predictions hints with dynamically translated code traces to improve performance
US6397242B1 (en) * 1998-05-15 2002-05-28 Vmware, Inc. Virtualization system including a virtual machine monitor for a computer with a segmented architecture
US6339822B1 (en) * 1998-10-02 2002-01-15 Advanced Micro Devices, Inc. Using padded instructions in a block-oriented cache
US6820255B2 (en) * 1999-02-17 2004-11-16 Elbrus International Method for fast execution of translated binary code utilizing database cache for low-level code correspondence
GB2348305A (en) * 1999-03-24 2000-09-27 Int Computers Ltd Instruction execution mechanism
US6529862B1 (en) * 1999-06-30 2003-03-04 Bull Hn Information Systems Inc. Method and apparatus for dynamic management of translated code blocks in dynamic object code translation
US6516295B1 (en) * 1999-06-30 2003-02-04 Bull Hn Information Systems Inc. Method and apparatus for emulating self-modifying code
US7072939B1 (en) * 2000-01-27 2006-07-04 International Business Machines Corporation Instant selective multiple soft document sharing between multiple heterogeneous computing devices
US20010049818A1 (en) * 2000-02-09 2001-12-06 Sanjeev Banerjia Partitioned code cache organization to exploit program locallity
US6615300B1 (en) * 2000-06-19 2003-09-02 Transmeta Corporation Fast look-up of indirect branch destination in a dynamic translation system
US6980946B2 (en) * 2001-03-15 2005-12-27 Microsoft Corporation Method for hybrid processing of software instructions of an emulated computer system
US20030093775A1 (en) * 2001-11-14 2003-05-15 Ronald Hilton Processing of self-modifying code under emulation
GB2393274B (en) * 2002-09-20 2006-03-15 Advanced Risc Mach Ltd Data processing system having an external instruction set and an internal instruction set
GB2400937B (en) * 2003-04-22 2005-05-18 Transitive Ltd Method and apparatus for performing interpreter optimizations during program code conversion

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101458630B (en) * 2008-12-30 2011-07-27 中国科学院软件研究所 Self-modifying code identification method based on hardware emulator
CN110178115A (en) * 2017-01-26 2019-08-27 阿里巴巴集团控股有限公司 The method and apparatus for handling self modifying code
CN110178115B (en) * 2017-01-26 2023-08-29 阿里巴巴集团控股有限公司 Method and device for processing self-modifying code
US20220100527A1 (en) * 2020-09-29 2022-03-31 Rockwell Automation Technologies, Inc. Supporting instruction set architecture components across releases
US11442740B2 (en) * 2020-09-29 2022-09-13 Rockwell Automation Technologies, Inc. Supporting instruction set architecture components across releases

Also Published As

Publication number Publication date
CN100458687C (en) 2009-02-04
CN1823322A (en) 2006-08-23
GB2404043A (en) 2005-01-19
HK1068699A1 (en) 2005-04-29
TW200515280A (en) 2005-05-01
GB0316532D0 (en) 2003-08-20
HK1068698A1 (en) 2005-04-29
TWI362614B (en) 2012-04-21
GB2404044B (en) 2006-07-26
GB2404044A (en) 2005-01-19
GB0328119D0 (en) 2004-01-07
GB2404043B (en) 2006-04-12
TW200516497A (en) 2005-05-16
TWI365406B (en) 2012-06-01
GB0328121D0 (en) 2004-01-07
CN100362475C (en) 2008-01-16
IL172830A0 (en) 2006-06-11

Similar Documents

Publication Publication Date Title
CN100362475C (en) Partitioning code in program code conversion to account for self-modifying code
US7934204B2 (en) Partitioning code in program code conversion
US7143124B2 (en) Detection of dead regions during incremental collection
US4775932A (en) Computer memory system with parallel garbage collection independent from an associated user processor
CN1924815A (en) Apparatus, system, and method for implementing protected virtual memory subcontexts
US7711920B2 (en) Method and system for dynamically managing storage of data objects generated during execution of a computer program
CN1248742A (en) Method and device of memory distribution for multi-line range virtual machine
CN101075209A (en) System and method for collecting garbage in isomerized processor systems
CN1853165A (en) Methods and apparatuses for compiler-creating helper threads for multi-threading
CN104375899A (en) Thread for high-performance computer NUMA perception and memory resource optimizing method and system
US6282621B1 (en) Method and apparatus for reclaiming memory
CN1853166A (en) Methods and apparatuses for thread management of multi-threading
US11366678B2 (en) Avoiding or deferring data copies
DE112017001027T5 (en) Page troubleshooting
US7765524B2 (en) Method and system for global constant management
CN1816802A (en) Processor architecture for exact index identification
US11249853B2 (en) System and method for creating a snapshot of a subset of a database
US6965905B2 (en) Lock-free, parallel remembered sets
US20060230242A1 (en) Memory for multi-threaded applications on architectures with multiple locality domains
CN117581214A (en) Write barrier for memory set maintenance in a hierarchical Z garbage collector
Degenbaev et al. Concurrent marking of shape-changing objects
Goeckelmann et al. Compiler Support for Reference Tracking in a type-safe DSM
Lang Improved stack allocation using escape analysis in the KESO multi-JVM
Onozawa et al. Fusuma: Double-Ended Threaded Compaction (Full Version)
Bläser et al. Collecting Garbage on the Blockchain

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CI02 Correction of invention patent application

Correction item: Priority

Correct: 2003.12.04 GB 0328121.9

False: Lack of priority second

Number: 38

Page: The title page

Volume: 22

COR Change of bibliographic data

Free format text: CORRECT: PRIORITY; FROM: MISSING THE SECOND ARTICLE OF PRIORITY TO: 2003.12.4 GB 0328121.9

C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: INTERNATIONAL BUSINESS MACHINE CORP.

Free format text: FORMER OWNER: IBM YING CO., LTD.

Effective date: 20090724

Owner name: IBM YING CO., LTD.

Free format text: FORMER OWNER: TRANSITIVE LTD.

Effective date: 20090724

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20090724

Address after: American New York

Patentee after: International Business Machines Corp.

Address before: England Hampshire

Patentee before: IBM UK Ltd.

Effective date of registration: 20090724

Address after: England Hampshire

Patentee after: IBM UK Ltd.

Address before: London, England

Patentee before: Transitive Ltd.