WO2000028415A2 - Method for dynamically converting and executing an object code - Google Patents

Method for dynamically converting and executing an object code Download PDF

Info

Publication number
WO2000028415A2
WO2000028415A2 PCT/DE1999/003494 DE9903494W WO0028415A2 WO 2000028415 A2 WO2000028415 A2 WO 2000028415A2 DE 9903494 W DE9903494 W DE 9903494W WO 0028415 A2 WO0028415 A2 WO 0028415A2
Authority
WO
WIPO (PCT)
Prior art keywords
block
object code
machine
jump
tbx
Prior art date
Application number
PCT/DE1999/003494
Other languages
German (de)
French (fr)
Other versions
WO2000028415A3 (en
Inventor
Andreas Stotz
Original Assignee
Fujitsu Siemens Computers Gmbh
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 Fujitsu Siemens Computers Gmbh filed Critical Fujitsu Siemens Computers Gmbh
Publication of WO2000028415A2 publication Critical patent/WO2000028415A2/en
Publication of WO2000028415A3 publication Critical patent/WO2000028415A3/en

Links

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The inventive method for dynamically converting and carrying out an object code provides for the optimization of the control flow between the individually translated object code blocks, thereby reducing the calls of a run-time system (distributor) during execution of the translated object code. To this end, returns to the distributor are replaced as widely as possible by direct returns to a return target in the translated object code. This replacement converts run-time calculations to calculations regarding compilation time, thereby improving the run-time efficiency of the translated code.

Description

Beschreibungdescription
Verfahren zum dynamischen Umsetzen und Ausfuhren von ObjektcodeProcess for the dynamic implementation and export of object code
Die Erfindung betrifft ein Verfahren nach dem Oberbegriff des Anspruchs 1 zum dynamischen Umsetzen von Objektcode für eine erste Maschine oder Maschinenarchitektur m Objektcode für eine zweite Maschine oder Maschinenarchitektur- Die Umsetzung ist mit dem Ausfuhren des umgesetzten Objektcodes auf der zweiten Maschine oder Maschinenarchitektur verzahnt. Die Erfindung ist für die Umsetzung und Ausfuhrung von allen Arten von Programmen auf unterschiedlichen Maschinen und Maschinenarchitekturen einsetzbar.The invention relates to a method according to the preamble of claim 1 for the dynamic conversion of object code for a first machine or machine architecture m object code for a second machine or machine architecture. The implementation is interlinked with the execution of the converted object code on the second machine or machine architecture. The invention can be used for the implementation and execution of all types of programs on different machines and machine architectures.
Wegen der raschen Entwicklung der Computertechnik ist vielfach ein Wechsel zu neuen Rechnergenerationen und Maschinenarchitekturen erwünscht. Weil die vorhandenen Programme jedoch einen hohen wirtschaftlichen Wert darstellen und für den reibungslosen Ablauf von unternehmenskritischen Vorgangen entscheidend sein können, soll normalerweise die bestehende Softwarebasis weiter verwendet werden. Zu diesem Zweck werden Verfahren der automatiscnen Objektcode-Transformation eingesetzt.Due to the rapid development of computer technology, it is often desirable to switch to new computer generations and machine architectures. However, because the existing programs represent a high economic value and can be crucial for the smooth running of business-critical processes, the existing software base should normally continue to be used. Methods of automatic object code transformation are used for this purpose.
Allgemein wird bei der Objektcode-Trans iormation zwischen statischer und dynamischer Transformation unterschieden. Bei der statischen Transformation wird das ursprüngliche Maschinenprogramm zunächst vollständig m Objektcode für die Ziel- maschme umgesetzt. Als Ergebnis erhalt man ein vollständiges Programm, das auf der Zielmaschme unmittelbar (nativ) ab- lauffähig ist. Bei der dynamischen Objektcode-Transformation erfolgen dagegen die Umsetzung und die Ausfuhrung des umgesetzten Codes ineinander verzahnt. Der Objektcode der ersten Maschine wird stuckchenweise m Objektcode der zweiten Maschine umgesetzt. Unmittelbar nach der Umsetzung wird der er- zeugte Maschinencode nativ auf der zweiten Maschine ausgeführt .In general, a distinction is made between static and dynamic transformation in object code transmission. With the static transformation, the original machine program is initially implemented completely in object code for the target machine. The result is a complete program that can run directly (native) on the target machine. With dynamic object code transformation, on the other hand, the implementation and execution of the converted code are interlinked. The object code of the first machine is converted piece by piece into the object code of the second machine. Immediately after the implementation, the witnessed machine code executed natively on the second machine.
Aus dem Artikel "MIMIC: A Fast System/370 Simulator" von Ca- thy May, erschienen m Proc. SIGP AN '87 Symposium on Interpreters and Interpretive Techniques, Juni 1987, Seiten 1 bis 13, ist ein Verfahren zur dynamischen Objektcode-Trans- formation mit den Merkmalen des Oberbegriffs von Anspruch 1 bekannt. Bei diesem Verfahren ist ein Verteiler (dispatcher) vorgesehen, der als Laufzeitroutme den Kontrollfluß zwischen den übersetzten Objektcode-Blocken steuert und bei Bedarf die Übersetzung eines weiteren Blocks veranlaßt. Jeder übersetzte Block endet mit einem Rucksprung-Befehl zu dem Verteiler.From the article "MIMIC: A Fast System / 370 Simulator" by Caty May, m Proc. SIGP AN '87 Symposium on Interpreters and Interpretive Techniques, June 1987, pages 1 to 13, a method for dynamic object code transformation with the features of the preamble of claim 1 is known. In this method, a dispatcher is provided, which controls the flow of control between the translated object code blocks as runtime routines and, if necessary, triggers the translation of a further block. Each translated block ends with a return command to the distributor.
Die Laufzeiteffizienz des erzeugten Codes ist bei der Objektcode-Transformation von entscheidender Bedeutung. Bei dem gerade erwähnten Verfahren besteht aber das Problem, daß der Verteiler nach der Ausfuhrung jedes Ob ektcode-Blocks erneut aufgerufen wird. Bei jedem solchen Aufruf erfolgt eine Abfra- ge einer Tabelle, um aus einer Zieladresse im Objektcode für die erste Maschine zu ermitteln, ob entsprechender Objektcode für die zweite Maschine bereits vorliegt und, wenn dies der Fall ist, welche Adresse im übersetzten Objektcode der Zieladresse entspricht. Diese wiederholten Sprunge und Tabellen- abfragen zur Laufzeit verringern die Ausfuhrungsgeschwmdig- keit des übersetzten Objektcodes dauerhaft.The runtime efficiency of the generated code is of crucial importance in the object code transformation. In the method just mentioned, however, there is the problem that the distributor is called again after the execution of each ob ect code block. Each time such a call is made, a table is queried in order to determine from a target address in the object code for the first machine whether the corresponding object code already exists for the second machine and, if this is the case, which address in the translated object code corresponds to the target address . These repeated jumps and table queries at runtime permanently reduce the speed of execution of the translated object code.
Es ist daher Aufgabe der Erfindung, ein Verfahren zum dynamischen Umsetzen und Ausfuhren von Objektcode bereitzustellen, das eine möglichst hohe Laufzeiteffizienz aufweist. Insbesondere soll durch die Erfindung die Laufzeiteffizienz von Programmabschnitten erhöht werden, die bereits ganz oder m wesentlichen Teilen m Objektcode für die zweite Maschine übersetzt worden sind. Erfmdungsgemaß wird diese Aufgabe durch ein Verfahren mit den Merkmalen des Anspruchs 1 gelost. Die abhangigen Ansprüche betreffen bevorzugte Ausgestaltungen der Erfindung.It is therefore an object of the invention to provide a method for the dynamic implementation and export of object code which has the highest possible runtime efficiency. In particular, the invention is intended to increase the runtime efficiency of program sections which have already been translated entirely or in substantial parts in the object code for the second machine. According to the invention, this object is achieved by a method having the features of claim 1. The dependent claims relate to preferred embodiments of the invention.
Die Erfindung beruht auf der Grundidee, αen Kontrollfluß zwischen den einzelnen bersetzten Objektcode-Blocken zu optimieren und somit die Aufrufe eines Laufzeitsystems (Verteilers) wahrend der Ausführung des übersetzten Objektcodes zu reduzieren. Zu diesem Zweck ist vorgesehen, Rucksprunge zu dem Verteiler möglichst weitgehend durch unmittelbare Sprunge zu einem Sprungziel im übersetzten Objektcode zu ersetzen. Somit werden LaufZeitberechnungen m Berechnungen zur Com- pilezeit umgewandelt. Die Laufzeiteffizienz des übersetzten Codes wird dadurch erheblicn verbessert.The invention is based on the basic idea of optimizing the control flow between the individual translated object code blocks and thus reducing the calls to a runtime system (distributor) during the execution of the translated object code. For this purpose, provision is made to replace jumps back to the distributor as far as possible by direct jumps to a jump target in the translated object code. Thus runtime calculations are converted into calculations at compiling time. This significantly improves the runtime efficiency of the translated code.
Erfmdungsgemaß ist die Verwendung von unmittelbaren Sprungbefehlen anstelle von Aufrufen eines Verteilers dann vorgesehen, wenn ein Sprungziel αes Sprungbefehls im Objektcode für die erste Maschine zur Compilezeit als Konstante bere- chenbar ist. Wenn zu diesem Zeitpunkt bereits ein geeigneter Block des Objektcodes für die zweite Maschine übersetzt worden ist (das heißt, ein Block mit einem Einsprungpunkt entsprechend dem Sprungziel, der außerdem etwa bestehende Nebenbedingungen erfüllt) wird ein unmittelbarer Sprungbefehl zu diesem Block generiert. Wenn ein solcher Block noch nicht existiert, so wird ein Befehl zum Aufruf eines Verteilers generiert, und das Erzeugen eines unmittelbaren Sprungbefehls wie im erstgenannten Fall wird zumindest so lange aufgeschoben, bis ein geeigneter Block des Objektcodes für die zweite Maschine erzeugt worden ist.According to the invention, the use of direct jump commands instead of calling a distributor is provided when a jump target αes jump command in the object code can be calculated as a constant for the first machine at compile time. If at this point in time a suitable block of the object code for the second machine has already been translated (that is, a block with an entry point corresponding to the jump target, which also fulfills any existing constraints), an immediate jump command to this block is generated. If such a block does not yet exist, a command to call a distributor is generated, and the generation of an immediate jump command, as in the former case, is postponed at least until a suitable block of the object code has been generated for the second machine.
In bevorzugten Ausfuhrungsformen wird zwischen einem optimierenden Verteiler und einem nicht-optimierenden Verteiler unterschieden. Ein Befehl zum Aufruf des optimierenden Vertei- lers zeigt vorzugsweise an, daß der aufrufende Block noch optimiert werden kann, indem der Aufrufbefehl durch einen unmittelbaren Sprung zu einer konstanten Z--eladresse ersetzt wird. Dieses Ersetzen oαer Überschreiben erfolgt vorzugsweise durch den optimierenden Verteiler, nachdem der Block, den die Zieladresse fallt, m Objektcode für die zweite Maschine umgesetzt worden ist. Insbesondere kann der unmittelbare Sprungbefehl möglichst bald, namlich in enger zeitlicher Verbindung mit der Übersetzung des Blocks, m den die Zieladresse fallt, den aufrufenden Block eingefügt werden. Um das Ersetzen zu ermöglichen, kann der optimierende Verteiler als Parameter die Zieladresse sowie die Adresse des Aufrufbefehls im Objektcode für die zweite Maschine erhalten.In preferred embodiments, a distinction is made between an optimizing distributor and a non-optimizing distributor. A command to call the optimizing distributor preferably indicates that the calling block can still be optimized by replacing the call command with an immediate jump to a constant cell address becomes. This replacement or overwriting is preferably carried out by the optimizing distributor after the block to which the target address falls has been converted in the object code for the second machine. In particular, the immediate jump instruction can be inserted as soon as possible, namely in close time connection with the translation of the block in which the destination address falls, the calling block. To enable the replacement, the optimizing distributor can receive the target address and the address of the call command in the object code for the second machine as parameters.
In vorteilhaften Ausgestaltungen der Erfindung ist eine Tabelle vorgesehen, in der jeder umgesetzte Block des Objektcodes für die zweite Maschine eingetragen ist. Als Argument einer Tabellenabfrage kann eine Start- und/oder eine Ein- sprungadresse des Objektcodes für die erste Maschme dienen. Die Tabelle ermöglicht damit die Zuordnung von Adressen (zum Beispiel Sprungzielen) des Objektcodes für die erste Maschine zu umgesetzten Blocken des Objektcodes für die zweite Maschi- ne . In der Tabelle können ferner weitere Informationen eingetragen sein.In advantageous embodiments of the invention, a table is provided in which each converted block of the object code for the second machine is entered. A start and / or an entry address of the object code for the first mechanism can serve as the argument of a table query. The table thus enables addresses (for example jump destinations) of the object code for the first machine to be assigned to blocks of the object code for the second machine that have been converted. Further information can also be entered in the table.
In einer bevorzugten Weiterbildung der Erfindung werden der Umsetzung eines Blocks αes Objektcodes für die erste Maschine Annahmen hinsichtlich der Belegung mindestens eines Basisregisters zugrundegelegt. In diesem Fall kann es erforderlich oder wünschenswert sein, mindestens einen Block des Objektcodes für die erste Maschme in mehrere Blocke des Objektcodes für die zweite Maschine umzusetzen, wobei sich die Übersetzungen hinsichtlich der zugrundeliegenden Basisregisterbelegungen unterscheiden. Vorzugsweise ist eine Obergrenze für die Anzahl der Übersetzungen eines Blocks des Objektcodes für die erste Maschine vorgesehen. Bei Erreichen dieser Grenze kann eine generische Übersetzung erzeugt werden, die unabhängig von der Basisregisterbelegung ist. Mehrere Ausfuhrungsbeispiele der Erfindung werden im folgenden anhand der schematischen Zeichnungen genauer beschrieben. Es stellen dar:In a preferred development of the invention, the implementation of a block of object code for the first machine is based on assumptions regarding the assignment of at least one base register. In this case, it may be necessary or desirable to convert at least one block of the object code for the first machine into several blocks of the object code for the second machine, the translations differing in terms of the basic register assignments on which they are based. There is preferably an upper limit for the number of translations of a block of the object code for the first machine. When this limit is reached, a generic translation can be generated that is independent of the base register assignment. Several exemplary embodiments of the invention are described in more detail below with reference to the schematic drawings. They represent:
Fig. 1 eine beispielhafte Darstellung des Objektcodes für die erste und die zweite Maschine sowie der bei der Umsetzung beteiligten Komponenten m einem Verfahren nach dem Stand der Technik,1 shows an exemplary representation of the object code for the first and the second machine and of the components involved in the implementation in a method according to the prior art,
Fig. 2 eine Darstellung wie in Fig. 1 für das erf dungsge- maße Verfahren, undFIG. 2 shows an illustration as in FIG. 1 for the method according to the invention, and
Fig. 3 und Fig. 4 beispielhafte Darstellungen des Objektcodes für die zweite Maschine bei der weiteren Ausfuhrung des er- f dungsgemaßen Verfahrens, ausgehend von Fig. 2.3 and 4 show exemplary representations of the object code for the second machine in the further execution of the method according to the invention, starting from FIG. 2.
Bei dem m Fig. 1 gezeigten Verfahren nach dem Stand der Technik erfolgt eine dynamische Codetransformation von Objektcode OC1, der für eine erste Maschine Ml (beispielsweise einen Computer des Typs IBM /390) vorgesehen ist, m Objektcode OC2, der auf einer zweiten Maschine M2 ablauffähig ist. Die Umsetzung wird von der zweiten Maschine M2 durchgeführt und ist mit der Ausfuhrung αes umgesetzten Objektcodes OC2 durch die zweite Maschine M2 verzahnt. An der Umsetzung sind ein Compiler CMP, em nicht-optimierender Verteiler NDISP und eine Tabelle LUT beteiligt.In the method according to the prior art shown in FIG. 1, there is a dynamic code transformation of object code OC1, which is provided for a first machine M1 (for example a computer of the type IBM / 390), m object code OC2, which is on a second machine M2 is executable. The conversion is carried out by the second machine M2 and is interlocked with the execution of the converted object code OC2 by the second machine M2. A compiler CMP, a non-optimizing distributor NDISP and a table LUT are involved in the implementation.
Grundlage der Umsetzung ist eine Unterteilung des Objektcodes OC1 m einzelne Blocke (basic blocks) . In Fig. 1 sind bei- spielhaft fünf Blocke BBl bis BB5 gezeigt, die im folgenden allgemein mit BBx bezeichnet werden. Die Grenzen der Blocke BBx werden nacn vorbestimmten Kriterien bestimmt. Beispielsweise kann eines dieser Kriterien (oder das einzige) sein, daß jeder Block BBx em Ausschnitt aus dem Objektcode OC1 ist, der sich vom Ende eines vorhergehenden Blocks BB(x-l) bis zum nächsten Sprungbefehl erstreckt. Somit endet jeder Block BBx mit einem (gegebenenfalls bedingten) Sprungbefehl. Alternativ oder zusatzlich können m Ausfuhrungsalternativen Kriterien hinsichtlich der moglicnen Einsprungpunkte die Blocke BBx vorgegeben sein, zum Beispiel, daß nur der erste Befehl eines Blocks BBx em Einsprungpunkt sein kann (die in Fig. 1 beispielhaft gezeigten Blocke BBl bis BB5 erfüllen dieses Kriterium) .The basis of the implementation is a subdivision of the object code OC1 into individual blocks (basic blocks). 1 shows, by way of example, five blocks BB1 to BB5, which are generally referred to below as BBx. The boundaries of the blocks BBx are determined according to predetermined criteria. For example, one of these criteria (or the only one) can be that each block BBx is a section of the object code OC1, which extends from the end of a previous block BB (xl) to the next jump instruction. Each block BBx thus ends with a (possibly conditional) jump instruction. As an alternative or in addition, blocks BBx can be specified in the alternative design criteria with regard to the possible entry points, for example that only the first command of a block BBx can be an entry point (blocks BB1 to BB5 shown by way of example in FIG. 1 meet this criterion).
Der Compiler CMP übersetzt Blocke BBx des Objektcodes OC1 für die erste Maschine Ml m semantisch äquivalente Befehlsfolgen oder Blocke TB1 bis TB5 (im folgenden als TBx bezeichnet) des Objektcodes OC2 für die zweite Maschine M2. Als Schnittstelle kann beispielsweise em BefehlThe compiler CMP translates blocks BBx of the object code OC1 for the first machine Ml m semantically equivalent command sequences or blocks TB1 to TB5 (hereinafter referred to as TBx) of the object code OC2 for the second machine M2. As an interface, for example, an instruction
compile (pc)compile (pc)
vorgesehen sein, der den Block BBx ab einer Adresse pc übersetzt und die Anfangsadresse der Übersetzung als Resultat zurückgibt. Um die Laufzeiteffizienz des übersetzten Codes OC2 möglichst zu erhohen, wendet der Compiler CMP an sich bekann- te Optimierungstechniken an. Hierbei sind jedoch im allgemeinen nur Optimierungen möglich, die sich innerhalb eines Blocks TBx durchfuhren lassen.be provided which translates the block BBx from an address pc and returns the start address of the translation as a result. In order to increase the runtime efficiency of the translated code OC2 as much as possible, the compiler CMP uses known optimization techniques. In this case, however, optimizations are generally only possible that can be carried out within a block TBx.
Wie bereits erwähnt, endet jeder Block BBx des Objektcodes OC1 mit einem Sprungbefehl zu einem anderen Block BBx'. Die vom Compiler CMP umgesetzten Blocke TBx des Objektcodes OC2 enden dagegen jeweils mit Befehlen, die alle Seiteneffekte des ursprunglichen Sprungbefehls simulieren und dann zum nicht-optimierenden Verteiler NDISP verzweigen. Em derarti- ger Seiteneffekt ist immer die Berechnung derjenigen Adresse im Objektcode OC1, bei der die Programmausfuhrung fortgesetzt werden soll. Je nach den bei der Einteilung der Blocke BBx zugrundegelegten Kriterien kann diese Adresse immer dem Anfang eines Blocks BBx entsprechen. Die letzten Befehle eines umgesetzten Blocks TBx können zum Beispiel stets wie folgt aussehen, wobei die Zieladresse (target address) m einer Va- riablen pc an den nicht-optimierenden Verteiler NDISP übergeben wird:As already mentioned, each block BBx of the object code OC1 ends with a jump instruction to another block BBx '. The blocks TBx of the object code OC2 implemented by the compiler CMP, on the other hand, each end with commands that simulate all side effects of the original jump command and then branch to the non-optimizing distributor NDISP. Such a side effect is always the calculation of the address in the object code OC1 at which the program execution is to be continued. Depending on the criteria used to classify blocks BBx, this address can always correspond to the beginning of a block BBx. The last commands of a converted block TBx can, for example, always look as follows, the target address m being a value riablen pc is passed to the non-optimizing distributor NDISP:
set pc to target address; jump NDISP;set pc to target address; jump NDISP;
Der nicht-optimierende Verteiler NDISP steuert den gesamten Vorgang der Umsetzung und Programmausfuhrung. Er verwaltet dabei eine Tabelle (look up table) LUT, die eine Abbildung von Blocken BBx zu den entsprechenden Übersetzungen TBx realisiert. Als Schnittstelle zum Eintragen eines umgesetzten Blocks TBx (ab Adresse tc) für einen Block BBx (ab Adresse pc) kann zum Beispiel em AufrufThe non-optimizing distributor NDISP controls the entire process of implementation and program execution. He manages a table (look up table) LUT that realizes blocks BBx for the corresponding translations TBx. As an interface for entering a converted block TBx (from address tc) for a block BBx (from address pc), for example, em call
insert (pc, tc) ;insert (pc, tc);
dienen. Ähnlich kann zur Abfrage der Tabelle LUT em Aufrufserve. Similarly, to query the table LUT em call
lookup (pc) ;lookup (pc);
verwendet werden, der prüft, ob eine Übersetzung für den Block BBx (identifiziert durch die Adresse pc) existiert. Falls e entsprechender übersetzter Block TBx gefunden wird, wird dessen Anfangsadresse zuruckgeliefert, sonst em vorbe- stimmter Wert (zum Beispiel 0) .can be used, which checks whether a translation for the block BBx (identified by the address pc) exists. If a corresponding translated block TBx is found, its start address is returned, otherwise a predetermined value (for example 0).
Der nicht-optimierende Verteiler NDISP steuert als Laufzeit- routine den Kontrollfluß zwischen den Übersetzungen und laßt bei Bedarf je einen weiteren Block BBx übersetzen. Wenn der nicht-optimierende Verteiler NDISP mit einer Zieladresse als Parameter aufgerufen wird, überprüft er zunächst durch eine lookup-Abfrage der Tabelle LUT, ob bereits em umgesetzter Block TBx für die Zieladresse vorliegt. Wenn dies nicht der Fall ist, dann ruft der nicht-optimierende Verteiler NDISP den Compiler CMP auf, um den Block BBx, der mit der Zieladresse beginnt oder sie enthalt, m Objektcode OC2 für die zweite Maschine M2 zu übersetzen. Der uoersetzte Block TBx wird m die Tabelle LUT eingetragen. Anschließend erfolgt ein Sprung von dem nicht-optimierenden Verteiler NDISP zu der Zieladresse m dem gerade umgesetzten oder bereits vorhandenen Block TBx. Diese vom nicht-optimierenden Verteiler NDISP ausgeführten Schritte lassen sich wie folgt darstellen:The non-optimizing distributor NDISP controls the control flow between the translations as a runtime routine and, if necessary, has another block BBx translated. If the non-optimizing distributor NDISP is called up with a target address as a parameter, it first checks by lookup the table LUT to see whether there is already a converted block TBx for the target address. If this is not the case, the non-optimizing distributor NDISP calls the compiler CMP in order to translate the block BBx, which begins with or contains the target address, in the object code OC2 for the second machine M2. The translated block TBx the table LUT is entered. Then there is a jump from the non-optimizing distributor NDISP to the destination address m in the block TBx that has just been implemented or already exists. These steps performed by the non-optimizing distributor NDISP can be represented as follows:
NDISP: tc = lookup (pc) ; lf ( tc == 0 ) { tc = compιle (pc) ; msert (pc, tc) ; } j ump ( tc) ;NDISP: tc = lookup (pc); lf (tc == 0) {tc = component (pc); msert (pc, tc); } j ump (tc);
Wie bereits erwähnt, erfolgt der Rucksprung von dem Block TBx des Objektcodes OC2 zum nicht-optimierenden Verteiler NDISP am Ende dieses Blocks, wobei eine neue Zieladresse berechnet und an den nicht-optimierenden Verteiler NDISP übergeben wird. Diese Sprungfolge zwischen dem nicht-optimierenden Ver- teiler NDISP und einem Objektcode-Block TBx wiederholt sich fortlaufend. Auf diese Weise wird der Objektcode OC2 für die zweite Maschine M2 blockweise dynamisch aufgebaut und dabei gleicnzeitig auf der zweiten Maschine M2 ausgeführt.As already mentioned, the return from the block TBx of the object code OC2 to the non-optimizing distributor NDISP takes place at the end of this block, a new destination address being calculated and transferred to the non-optimizing distributor NDISP. This jump sequence between the non-optimizing distributor NDISP and an object code block TBx is repeated continuously. In this way, the object code OC2 for the second machine M2 is dynamically built up in blocks and executed simultaneously on the second machine M2.
Der m Fig. 1 gezeigte Zustand, bei dem Übersetzungen TBx für alle Blocke BBx vorliegen, ergibt sich, wenn der gesamte Objektcode OC1 für die Maschine Ml wahrend der Programmausfuhrung erreicht wurde. In diesem Zustand erfolgt keine weitere Optimierung. Das heißt, daß nach dem Ausfuhren jedes umge- setzten Blocks TBx e Rucksprung zu dem nicht-optimierenden Verteiler NDISP, eine Abfrage der Tabelle LUT und em Sprung zu dem durch die Tabellenabfrage ermittelten neuen Block TBx' erfolgen.The state shown in FIG. 1, in which translations TBx are available for all blocks BBx, is obtained when the entire object code OC1 for the machine M1 has been reached during the execution of the program. No further optimization takes place in this state. This means that after each implemented block TBx e returns to the non-optimizing distributor NDISP, the table LUT is queried and a jump is made to the new block TBx 'determined by the table query.
In Fig. 2 ist das erf dungsgemaße Umsetzungsverfahren veranschaulicht. Das Verfahren beruht auf der Überlegung, die beim Stand der Technik vorgesehenen Rucksprunge zum Verteiler mog- liehst weitgehend durch Sprunge zu ersetzen, die von einem Sprungbefehl im Objektcode OC2 unmittelbar zu einer ebenfalls im Objektcode OC2 befindlichen Zieladresse erfolgen. Dadurch wird auch die Laufzeitabfrage der Tabelle LUT eingespart.In Fig. 2, the inventive implementation process is illustrated. The method is based on the consideration that the jumps back to the distributor provided in the prior art may is largely to be replaced by jumps which take place from a jump command in the object code OC2 directly to a destination address which is also in the object code OC2. This also saves the runtime query in table LUT.
Gemäß Fig. 2 erfolgt die Aufteilung des Objektcodes OC1 in Blocke BBx ebenso wie beim Stand der Technik. Auch der Compiler CMP fuhrt im wesentlichen einen an sich bekannten Umsetzvorgang mit blocklokalen Optimierungen aus. Im Unterschied zu dem bekannten Verfahren werden jedoch Sprunge mit konstantem, zur Compilezeit berechenbarem Sprungziel ("konstante Sprunge") optimiert. Konstante Sprunge werden zum Beispiel oft zur Implementierung von IF- und WHILE-Anweisungen sowie Unterprogrammaufrufen verwendet. Sprunge, deren Sprungziel nicht zur Compilezeit als konstant bestimmt werden kann ("variableAccording to FIG. 2, the object code OC1 is divided into blocks BBx as in the prior art. The CMP compiler also essentially carries out a known conversion process with block-local optimizations. In contrast to the known method, however, jumps with a constant jump target that can be calculated at compile time ("constant jumps") are optimized. Constant jumps, for example, are often used to implement IF and WHILE statements and subroutine calls. Jumps whose jump target cannot be determined as constant at compile time ("variable
Sprunge"), werden nicht optimiert. Variable Sprunge realisieren oft SWITCH- und RETURN-Anweisungen sowie Aufrufe virtueller Funktionen. In den meisten Programmen sind variable Sprunge seltener als konstante Sprunge.Jumps ") are not optimized. Variable jumps often implement SWITCH and RETURN statements as well as calls to virtual functions. In most programs, variable jumps are less common than constant jumps.
Die Klassiflzierbarkeit eines Sprungs zur Compilezeit als konstanter Sprung hangt im allgemeinen vom Befehlssatz des Objektcodes OC1 ab. Manche Sprungbefehle des Objektcodes OC1 können trivial als konstante Sprunge klassifiziert werden (zum Beispiel Sprunge mit absoluter oder relativer Adreß- angabe) . Bei anderen Sprungbefehlen (zum Beispiel register- mdizierten Sprüngen) ist die Erkennung schwieriger. Es ist im allgemeinen nicht auszuschließen, daß Sprunge, die faktisch konstant sind, nicht als solche erkannt werden. Solche Sprunge werden nicht optimiert. Dies beeinträchtigt zwar die erzielte Laufzeiteffizienz, nicht aber die Korrektheit des umgesetzten Objektcodes. Daher ist das erfmdungsgemaße Umsetzverfahren auch für Befehlssatze geeignet, bei denen nicht alle Sprungbefehle eindeutig klassifizierbar sind.The classifiability of a jump at compile time as a constant jump generally depends on the instruction set of the object code OC1. Some jump commands of the object code OC1 can be classified trivially as constant jumps (for example jumps with absolute or relative address information). With other jump commands (for example register-indicated jumps) the detection is more difficult. In general, it cannot be ruled out that jumps that are actually constant are not recognized as such. Such jumps are not optimized. Although this affects the runtime efficiency achieved, it does not affect the correctness of the implemented object code. The conversion method according to the invention is therefore also suitable for instruction sets in which not all jump instructions can be clearly classified.
Der in Fig. 2 gezeigte Compiler CMP überprüft also zur Compilezeit, ob das Sprungziel eines Sprungbefehls, der einen gerade umgesetzten Block BBx abschließt, als konstant bestimmbar ist. Ist dies nicht der Fall, so erfolgt keine Optimierung, und der Compiler CMP erzeugt einen Rücksprung zu dem nicht-optimierenden Verteiler NDISP, wie bereits in Zusammen- hang mit Fig. 1 beschrieben.The compiler CMP shown in FIG. 2 thus checks at compile time whether the jump target of a jump instruction is the one block BBx that has just been implemented can be determined as constant. If this is not the case, then no optimization takes place, and the compiler CMP creates a return to the non-optimizing distributor NDISP, as already described in connection with FIG. 1.
Ist dagegen der Sprungbefehl im gerade umgesetzten Block BBx des Objektcodes OC1 als konstant erkannt worden (beispielsweise mit einem Sprungziel im Block BBx'), so ist das Sprung- ziel im erzeugten Block TBx des Objektcodes OC2 ebenfalls konstant . Es werden dann zwei Fälle der Optimierung unterschieden, die als statische bzw. dynamische Optimierung bezeichnet werden.If, on the other hand, the jump command in block BBx of object code OC1 that has just been implemented has been recognized as constant (for example with a jump target in block BBx '), the jump target in block TBx of object code OC2 generated is also constant. A distinction is then made between two cases of optimization, which are referred to as static or dynamic optimization.
Im ersten Fall (statische Optimierung) existiert bereits eine Übersetzung des das Sprungziel enthaltenden Blocks BBx' in einen entsprechenden Block TBx' des Objektcodes OC2. Der Compiler CMP generiert dann als Abschluß des erzeugten Blocks TBx statt des Rücksprungs zum nicht-optimierenden Verteiler NDISP einen unmittelbaren Sprungbefehl zu diesem Sprungziel im Block TBx' .In the first case (static optimization) there is already a translation of the block BBx 'containing the jump target into a corresponding block TBx' of the object code OC2. The compiler CMP then generates an immediate jump command to this jump destination in the block TBx 'as the end of the generated block TBx instead of the return to the non-optimizing distributor NDISP.
Im zweiten Fall (dynamische Optimierung) ist der Block BBx', der das Sprungziel enthält, noch nicht in einen entsprechen- den Block TBx' des Objektcodes OC2 übersetzt worden. Somit konnte zwar das Sprungziel bezüglich des Objektcodes OC1 ermittelt werden; die entsprechende Adresse im Objektcode OC2 steht aber wegen der blockweisen Generierung des Objektcodes OC2 noch nicht fest. Erfindungsgemäß ist vorgesehen, in die- sem Fall die Optimierung zu verzögern, bis der umgesetzteIn the second case (dynamic optimization), the block BBx ', which contains the jump target, has not yet been translated into a corresponding block TBx' of the object code OC2. Thus, the jump target with respect to the object code OC1 was determined; the corresponding address in the object code OC2 has not yet been determined due to the block-wise generation of the object code OC2. According to the invention, in this case the optimization is delayed until the implemented one
Block TBx' vorliegt. Genauer gesagt, wird im hier beschriebenen Ausführungsbeispiel ein unmittelbarer Sprung in den Block TBx des Objektcodes- OC2 eingefügt, sobald der Block TBx' zum ersten Mal angesprungen wird. Spätestens dann muß auch die Umsetzung des Blocks BBx' in den Block TBx' erfolgt sein. Im hier beschriebenen Ausfuhrungsbeispiel erzeugt der Compiler CMP zur dynamischen Optimierung bei der Umsetzung des Blocks BBx einen Befehl zum Aufruf eines optimierenden Verteilers ODISP. Dieser Befehl, der den umgesetzten Block TBx abschließt, übergibt als Parameter das als Konstante berechnete Sprungziel bezuglich des Objektcodes OC1 sowie die eigene Adresse im Block TBx des Objektcodes OC2. Der umgesetzte Block TBx endet m diesem Fall beispielsweise wie folgt:Block TBx 'is present. More specifically, in the exemplary embodiment described here, an immediate jump is inserted into the block TBx of the object code OC2 as soon as the block TBx 'is started for the first time. The block BBx 'must have been converted into the block TBx' at the latest. In the exemplary embodiment described here, the compiler CMP generates a command to call an optimizing distributor ODISP for the dynamic optimization when the block BBx is implemented. This command, which completes the converted block TBx, passes as parameters the jump target calculated as a constant with respect to the object code OC1 and the own address in the block TBx of the object code OC2. In this case, the converted block TBx ends, for example, as follows:
set pc to target address; set fixup to current address; jump ODISP;set pc to target address; set fixup to current address; jump ODISP;
Wenn nach der Ausfuhrung des umgesetzten Blocks TBx der gerade beschriebene Rucksprungbefehl erreicht wird, wird der optimierende Verteiler ODISP aufgerufen. Dieser entspricht in seiner Funktion dem nicht-optimierenden Verteiler NDISP. Auch der optimierende Verteiler ODISP greift auf die Tabelle LUT zu, die im hier beschriebenen Ausfuhrungsbeispiel ebenso wie m Fig. 1 ausbildet ist. Der optimierende Verteiler ODISP prüft, ob bereits e ne Übersetzung des das Sprungziel enthaltenden Blocks BBx' existiert, und stoßt, wenn notig, den Übersetzungsvorgang an, um den Block TBx' zu erzeugen. Im Un- terschied zu dem nicht-optimierenden Verteiler NDISP überschreibt der optimierende Verteiler ODISP aber den Sprungbefehl an der ihm mitgeteilten Adresse im Block TBx (einschließlich der zur Parameterubergabe dienenden Befehle) durch einen unmittelbaren Sprungbefehl zum Sprungziel im Block TBx' . Diese vom optimierenden Verteiler ODISP ausgeführten Schritte lassen sich wie folgt darstellen, wobei *fιxup den Inhalt des Speichers an der Adresse fixup (der Adresse des Befehls zum Aufruf des optimierenden Verteilers ODISP) und gen_jump eine Instruktion zum Generieren eines un- mittelbaren Sprungbefehls bezeichnen: ODISP: tc = lookup (pc) ; lf (tc == 0) { tc = compile (pc) ; msert (pc, tc) ;If the return command just described is reached after execution of the converted block TBx, the optimizing distributor ODISP is called. Its function corresponds to that of the non-optimizing distributor NDISP. The optimizing distributor ODISP also accesses the table LUT, which is formed in the exemplary embodiment described here as well as in FIG. 1. The optimizing distributor ODISP checks whether a translation of the block BBx 'containing the jump target already exists and, if necessary, initiates the translation process in order to generate the block TBx'. In contrast to the non-optimizing distributor NDISP, the optimizing distributor ODISP overwrites the jump command at the address communicated to it in block TBx (including the commands used for parameter transfer) by an immediate jump command to the jump target in block TBx '. These steps carried out by the optimizing distributor ODISP can be represented as follows, where * fιxup denotes the content of the memory at the address fixup (the address of the command to call the optimizing distributor ODISP) and gen_jump an instruction for generating an immediate jump command: ODISP: tc = lookup (pc); lf (tc == 0) {tc = compile (pc); msert (pc, tc);
}}
* fixup = gen_jump (tc) ;
Figure imgf000014_0001
* fixup = gen_jump (tc);
Figure imgf000014_0001
Durch diese Modifikation des bereits früher erzeugten Blocks TBx wird erreicht, daß bei einer weiteren Ausfuhrung des Blocks TBx der Sprung unmittelbar (ohne Umweg über den optimierenden Verteiler ODISP) zur Übersetzung des Sprungziels erfolgt .This modification of block TBx, which was generated earlier, ensures that if block TBx is executed again, the jump to the translation of the jump target takes place immediately (without going through the optimizing distributor ODISP).
Das bisher beschriebene Verfahren wird im folgenden unter Hinweis auf Fig. 2 bis Fig. 4 an einem Beispiel verdeutlicht. In Fig. 2 ist em Zwischenzustand der Übersetzung gezeigt, bei dem bereits die Blocke TB1 und TB2 des Objektcodes OC2 übersetzt worden sind (entsprechend den Blocken BBl und BB2 des Objektcodes OC1) . Bei beiden Blocken BBl und BB2 konnte jeweils das Sprungziel des den Block abschließenden Sprungbefehls als Konstante ermittelt werden.The method described so far is illustrated below with reference to FIGS. 2 to 4 using an example. 2 shows an intermediate state of the translation, in which blocks TB1 and TB2 of the object code OC2 have already been translated (corresponding to blocks BB1 and BB2 of the object code OC1). In the case of both blocks BB1 and BB2, the jump target of the jump command concluding the block could be determined as a constant.
Hinsichtlich des Blocks BBl liegt das ermittelte Sprungziel im Block BB5, für den noch keine Umsetzung m den Objektcode OC2 erzeugt wurde. Daher wurde bei der Umsetzung des Blocks BBl zur dynamischen Optimierung e Aufruf des optimierenden Verteilers ODISP m den Block TB1 eingefügt (in Fig. 1 durch einen punktierten Pfeil angedeutet) . Dieser Aufruf enthalt als Parameter das Sprungziel im Block BB5 (Variable pc) sowie die eigene Adresse im Block TB1 (Variable fixup) .With regard to block BB1, the jump target determined is in block BB5, for which no conversion m object code OC2 has yet been generated. Therefore, block TB1 was inserted in the implementation of block BB1 for dynamic optimization e call of the optimizing distributor ODISP m (indicated in FIG. 1 by a dotted arrow). This call contains the jump destination in block BB5 (variable pc) and its own address in block TB1 (variable fixup) as parameters.
Der Block BB2 wurde im Anschluß an den Block BBl übersetzt (es wird hier angenommen, daß der Sprung zum Block BB5 mBlock BB2 was translated after block BB1 (it is assumed here that the jump to block BB5 m
Block BBl bedingt war und die Bedingung nicht erfüllt wurde) . Bei dem den Block BB2 abscnließenden Sprungoefehl konnte eine statische Optimierung vorgenommen werden, weil dessen Sprungziel im Block BBl liegt, für den bereits die Übersetzung TB1 existiert. Daher wurde m die Übersetzung TB2 des Blocks BB2 em unmittelbarer Sprung zu dem Block TB1 eingefügt.Block BBl was conditional and the condition was not met). In the case of the jump command closing block BB2, a static optimization can be carried out because its jump destination is in block BB1, for which translation TB1 already exists. Therefore, the translation TB2 of block BB2 was inserted in the immediate jump to block TB1.
Wenn im weiteren Ablauf nach der Ausfuhrung des Blocks TB1 der optimierende Verteiler ODISP aufgerufen wird, so veranlaßt dieser zunächst eine Übersetzung des Blocks BB5 (entsprechend dem Sprungziel m Variable pc) , um den Block TB5 zu erhalten. Das Ergebnis des Ubersetzungsvorgangs ist in Fig. 3 gezeigt. Vor dem Sprung zu Block TB5 wird der ursprüngliche Aufruf des optimierenden Verteilers ODISP m Block TB1 durch einen unmittelbaren Sprung zu Block TB5 (entsprechend dem Sprungziel m Block BB5) ersetzt. Damit ist der m Fig. 4 ge- zeigte Zustand erreicht.If, after the execution of block TB1, the optimizing distributor ODISP is called in the further process, this first triggers a translation of block BB5 (corresponding to the jump target m variable pc) in order to obtain block TB5. The result of the translation process is shown in FIG. 3. Before the jump to block TB5, the original call of the optimizing distributor ODISP in block TB1 is replaced by an immediate jump to block TB5 (corresponding to the jump target in block BB5). The state shown in FIG. 4 is thus reached.
Durch die genannten Maßnahmen wurde m Versuchen eine Verbesserung der Laufzeiteffizienz um 5 ° erzielt.The measures mentioned resulted in m attempts to improve the runtime efficiency by 5 °.
Im hier beschriebenen Ausfuhrungsbeispiel ist, wie aus Fig. 2 ersichtlich, em Verteiler DISP vorgesehen, der den nicht- optimierenden Verteiler NDISP und den optimierenden Verteiler ODISP als zwei getrennte Routinen aufweist. In Ausfuhrungsalternativen kann der Verteiler DISP als einheitliches Pro- gramm ausgestaltet sein. Die Entscheidung, ob eine Optimierung erfolgen soll, kann dann durch Auswerten eines uberge- benen Parameters oder m Abhängigkeit von einem Emsprung- punkt oder nach sonstigen Kriterien getroffen werden.In the exemplary embodiment described here, as can be seen from FIG. 2, a distributor DISP is provided, which has the non-optimizing distributor NDISP and the optimizing distributor ODISP as two separate routines. In alternative versions, the DISP distributor can be designed as a uniform program. The decision as to whether an optimization should take place can then be made by evaluating a transferred parameter or depending on an origin or according to other criteria.
Wie bereits erwähnt, ist es für eine optimale Laufzeiteffizienz vorteilhaft, möglichst viele Sprunge als konstant zu klassifizieren. Dies ist aber insbesondere bei Spr ngen mit register-mdizierter Adreßangabe problematisch. Da weitverbreitete Maschinenarchitekturen (zum Beispiel die der IBM /390) vorwiegend oder ausschließlich register-mdizierteAs already mentioned, for optimal runtime efficiency it is advantageous to classify as many jumps as constant as possible. However, this is particularly problematic in the case of jumps with registered address information. Since widespread machine architectures (for example, those of the IBM / 390) predominantly or exclusively register-mediated
Sprunge aufweisen, wird im folgenden eine Ausfuhrungsalterna- tive des erf dungsgemaßen Verfahrens beschrieben, die in vielen Fallen eine Optimierung von register-mdizierten Sprüngen erlaubt, ohne daß der Inhalt eines Basisregisters zur Laufzeit überprüft werden mußte.Have jumps, an alternative embodiment of the inventive method is described below, which in Many cases allow optimization of register-mapped jumps without having to check the content of a base register at runtime.
Das Sprungziel bei register-mdizierten Sprüngen ergibt sich im allgemeinen aus einer Kombination einer in dem Sprungbefehl enthaltenen Distanz (Offset) mit dem zur Laufzeit aktuellen Inhalt eines Basisregisters. Um einen register-mdizierten Sprung als konstant klassifizieren zu können, muß da- her sichergestellt werden, daß das entsprechende Basisregi- ster bei jeder Ausfuhrung stets den gleichen Wert enthalt. In einfach gelagerten Fallen kann diese Eigenschaft durch eine abstrakte Codeanalyse des Objektcodes OC1 ermittelt werden. Allgemein ist dies aber nicht möglich.The jump target for register-mapped jumps generally results from a combination of a distance (offset) contained in the jump command with the current content of a base register at runtime. In order to be able to classify a register-mediated jump as constant, it must therefore be ensured that the corresponding basic register always contains the same value every time it is executed. In simple cases, this property can be determined by an abstract code analysis of the object code OC1. In general, however, this is not possible.
Daher wird m der hier beschriebenen Ausfuhrungsvariante vorgeschlagen, einen Block BBx des Objektcodes OC1 für die erste Maschine Ml in Abhängigkeit von einer Belegung eines Basisregisters m den entsprechenden Block TBx des Objektcodes OC2 für die zweite Maschine M2 zu übersetzen. Wenn sich diese Belegung bei einer weiteren Ausfuhrung des Blocks BBx geändert hat, muß der Block BBx erneut einen Block TBx' umgesetzt werden, wobei diesmal die geänderte Belegung des Basisregisters zugrundegelegt wird.Therefore, in the embodiment variant described here, it is proposed to translate a block BBx of the object code OC1 for the first machine Ml as a function of an assignment of a base register m the corresponding block TBx of the object code OC2 for the second machine M2. If this assignment has changed during a further execution of the block BBx, the block BBx must again be converted to a block TBx ', this time based on the changed assignment of the base register.
Theoretisch können auf diese Weise im Laufe der Zeit beliebig viele Übersetzungen eines einzigen Blocks BBx entstehen, die sich jeweils hinsichtlich der angenommenen Belegung des Basisregisters unterscheiden. In der hier beschriebenen Ausfuh- rungsvaπante wird jedoch nur eine vorbestimmte Maximalzahl von Übersetzungen für jeden Block BBx erzeugt. Wird diese Grenze erreicht, so erfolgt noch eine weitere Übersetzung, bei der aber keine Annahmen hinsichtlich des Basisregisters gemacht werden. Diese Übersetzung des Blocks BBx kann dann mit beliebigen Basisregisterbelegungen ausgeführt werden, wobei aber im allgemeinen keine Sprungoptimierungen möglich sind. In der bisher zusammenfassend beschriebenen Ausfuhrungsalternative wird also em Sprungziel eines register-mdizierten Sprungs nicht als Adresse, sondern als sogenanntes Sprung- muster ausgedruckt. Em Sprungmuster ist im vorliegenden Beispiel em Paar aus einem Basisregister (d.h., dessen Bezeichnung oder Nummer) und einer Sprungdistanz. Die Tabelle LUT wird dahingehend erweitert, daß sie eine Abbildung von Blocken BBx und Sprungmustern zu Übersetzungen TBx reali- siert.In theory, any number of translations of a single block BBx can arise in this way over time, each of which differs in terms of the assumed assignment of the base register. In the embodiment described here, however, only a predetermined maximum number of translations is generated for each block BBx. If this limit is reached, a further translation takes place, but no assumptions are made regarding the base register. This translation of the block BBx can then be carried out with any base register assignments, but in general no jump optimizations are possible. In the alternative embodiment described so far, the jump destination of a registered-mapped jump is not printed out as an address, but rather as a so-called jump pattern. In the present example, a jump pattern is a pair of a base register (ie, its name or number) and a jump distance. The table LUT is expanded in such a way that it realizes blocks BBx and jump patterns for translations TBx.
In Verbindung mit der Tatsache, daß zur Compilezeit das Sprungziel des die Umsetzung eines Blocks BBx auslosenden Sprungs bekannt ist, geht somit aus einem Sprungmuster die Belegung des darin enthaltenen Basisregisters eindeutig hervor. In weiteren Ausfuhrungsalternativen können andere Informationen als Sprungmuster dienen, beispielsweise Paare aus einem Basisregister und dessen Belegung.In conjunction with the fact that the jump target of the jump triggering the implementation of a block BBx is known at compile time, the assignment of the base register contained therein is clearly evident from a jump pattern. In other alternative embodiments, other information can serve as a jump pattern, for example pairs from a basic register and its assignment.
Bei einem Aufruf des Verteilers DISP (die beiden Routinen NDISP und ODISP unterscheiden sich diesbezüglich nicht) am Ende eines übersetzten Blocks TBx wird durch eine Abfrage der Tabelle LUT ermittelt, ob bereits em übersetzter Block TBx' existiert, der dem Sprungmuster des Verteileraufrufs (also dem Sprungmuster des den Block BBx abschließenden Sprungbefehls) entspricht. Ist dies der Fall, so erfolgt gegebenenfalls eine Optimierung des Blocks TBx und dann em Sprung zu dem Block TBx' auf die bereits beschriebene Weise.When the distributor DISP is called (the two routines NDISP and ODISP do not differ in this respect) at the end of a translated block TBx, a query in the table LUT determines whether a translated block TBx 'already exists that corresponds to the jump pattern of the distributor call (i.e. the Jump pattern of the jump command concluding block BBx) corresponds. If this is the case, the block TBx may be optimized and then a jump to the block TBx 'in the manner already described.
Wenn noch kein geeigneter Block TBx' des Objektcodes OC2 existiert, so wird der Compiler CMP aufgerufen. Der Compiler CMR erhalt dabei von dem Verteiler DISP em Sprungmuster (r,d), das festlegt, welche Annahmen hinsichtlich der Belegung des Basisregisters r bei der Umsetzung gemacht werden sollen. Das spezielle Sprungmuster (0,0) wird verwendet, um anzuzeigen, daß eine von der Basisregisterbelegung unabhängige Übersetzung erzeugt werden soll. Das Sprungmuster (0,0) wird erstens register-mdizierten Sprüngen mit einem zusatzlichen Indexregister in dem ursprünglichen Block BBx zugeordnet, da für solche Sprunge das Sprungziel nicht allem von der Basisregisterbelegung und der Distanz bestimmt wird. Zweitens setzt der Verteiler DISP das Sprungmuster auf (0,0), wenn für einen Block BBx bereits eine erste Übersetzung den Objektcode OC2 (mit einem anderen Sprungmuster) vorliegt. Durch diese Maßnahme wird sicherge- stellt, daß für jeden Block BBx maximal zwei Übersetzungen erzeugt werden, namlich eine erste Übersetzung mit dem ersten wahrend des Ablaufs auftretenden Sprungmuster und eine zweite Übersetzung, die universell verwendbar ist und m der Tabelle LUT dem Sprungmuster (0,0) zugeordnet ist.If there is no suitable block TBx 'of the object code OC2, the compiler CMP is called. The compiler CMR receives from the distributor DISP em jump pattern (r, d), which specifies which assumptions regarding the assignment of the base register r should be made during the implementation. The special jump pattern (0,0) is used to indicate that a translation independent of the base register assignment should be generated. The jump pattern (0,0) is first assigned to register-mdied jumps with an additional index register in the original block BBx, since the jump destination for such jumps is not determined by the base register assignment and the distance. Second, the distributor DISP sets the branch pattern to (0,0) if the object code OC2 (with a different branch pattern) is already available for a block BBx. This measure ensures that a maximum of two translations are generated for each block BBx, namely a first translation with the first jump pattern occurring during the sequence and a second translation that can be used universally and in the table LUT the jump pattern (0, 0) is assigned.
Um aus dem Sprungmuster (r,d) mit r ≠ 0 die Belegung des Basisregisters r abzuleiten, benotigt der Compiler CMP ferner eine Information über das Sprungziel z. Im vorliegenden Beispiel wird angenommen, daß Sprunge nur an den Anfang eines Blocks BBx zulassig sind. Das Sprungziel z ist somit dieIn order to derive the assignment of the base register r from the jump pattern (r, d) with r ≠ 0, the compiler CMP also requires information about the jump target z. In the present example it is assumed that jumps are only permitted at the beginning of a block BBx. The jump target z is therefore the
Startadresse des Blocks BBx. Damit ergibt sich eine Belegung des Basisregisters r mit der Adresse z - d. Wenn wahrend der Übersetzung des Blocks BBx keine Befehle gefunden werden, die das Basisregister r verandern konnten, so kann diese Belegung auch zum Berechnen eines Sprungs ausgewertet werden, der mit dem Basisregister r indiziert ist und den Block BBx abschließt. Em derartiger Sprung mit dem Sprungmuster (r,d') hat dann das (konstante) Ziel z - d + d' . Dieser Wert kann zur Optimierung der Übersetzung TBx des Blocks BBx verwendet werden. Start address of block BBx. This results in the base register r being assigned the address z - d. If, during the translation of the block BBx, no commands are found that could change the base register r, this assignment can also be evaluated to calculate a jump that is indexed with the base register r and that terminates the block BBx. Such a jump with the jump pattern (r, d ') then has the (constant) target z - d + d'. This value can be used to optimize the translation TBx of the block BBx.

Claims

Patentansprüche claims
1. Verfahren zum dynamischen Umsetzen von Objektcode (OC1) für eine erste Maschme (Ml) m Objektcode (OC2) f r eine zweite Maschine (M2) und zum Ausfuhren des umgesetzten Objektcodes (0C2) auf der zweiten Maschine (M2) , mit den Schritten: a) Bestimmen eines umzusetzenden Blocks (BBx) des Objektcodes (OCl) für die erste Maschine (Ml), so daß der Block (BBx) mindestens einen Sprungbefehl enthalt, b) Umsetzen des m Schritt a) bestimmten Blocks (BBx) m Objektcode (OC2) für die zweite Maschine (M2), und c) Ausfuhren des umgesetzten Blocks (TBx) auf der zweiten Maschine (M2) , d a d u r c h g e k e n n z e i c h n e t , daß in Schritt b) : bl) ermittelt wird, ob em Sprungziel des Sprungbefehls als1. A method for dynamically converting object code (OC1) for a first machine (Ml) m object code (OC2) for a second machine (M2) and for executing the converted object code (0C2) on the second machine (M2), with the steps : a) determining a block (BBx) of the object code (OCl) to be converted for the first machine (Ml), so that the block (BBx) contains at least one jump command, b) converting the block (BBx) determined in step a) m object code (OC2) for the second machine (M2), and c) executing the converted block (TBx) on the second machine (M2), characterized in that in step b): bl) it is determined whether the jump target of the jump command is as
Konstante berechenbar ist, b2) falls das Sprungziel als Konstante berechenbar ist und für dieses Sprungziel bereits em geeigneter Block (TBx) des Objektcodes (OC2) für die zweite Maschine (M2) existiert, em unmittelbarer Sprungbefehl zu diesem Block (TBx) generiert wird, b3) falls das Sprungziel als Konstante berechenbar ist und für dieses Sprungziel noch kein geeigneter Block (TBx) des Objektcodes (OC2) für die zweite Maschine (M2) existiert, e Befehl zum Aufruf eines Verteilers (DISP) generiert wird und das Generieren eines unmittelbaren Sprungbefehls zu dem genannten Block (TBx) des Ob ekt- codes (OC2) für die zweite Maschine (M2) zumindest so lange aufgeschoben wird, bis dieser Block (TBx) umgesetzt wurde, und b4) falls keine Optimierung erfolgen kann oder soll, em Befehl zum Aufruf eines Verteilers (DISP) generiert wird.Constant can be calculated, b2) if the jump target can be calculated as a constant and a suitable block (TBx) of the object code (OC2) for the second machine (M2) already exists for this jump target, an immediate jump command to this block (TBx) is generated, b3) if the jump target can be calculated as a constant and there is no suitable block (TBx) of the object code (OC2) for the second machine (M2) for this jump target, e command to call a distributor (DISP) is generated and the generation of an immediate one Jump command to said block (TBx) of the object code (OC2) for the second machine (M2) is postponed at least until this block (TBx) has been implemented, and b4) if no optimization can or should not be done, em Command to call a distributor (DISP) is generated.
2. Verfahren nach Anspruch 1, d a d u r c h g e k e n n z e i c h n e t , daß m Schritt b3) ein Befehl zum Aufruf eines optimierenden Verteilers (ODISP) und in Schritt b4) ein Befehl zum Aufruf eines nicht-optimierenden Verteilers (NDISP) generiert wird.2. The method according to claim 1, characterized in that m Step b3) a command to call an optimizing distributor (ODISP) and in step b4) a command to call a non-optimizing distributor (NDISP) is generated.
3. Verfahren nach Anspruch 2, d a d u r c h g e k e n n z e i c h n e t , daß im Anschluß an Schritt c) bei einem Aufruf des optimierenden Verteilers (ODISP) der den Aufruf bewirkende Befehl in dem Objektcode (0C2) für die zweite Maschine (M2) durch einen un- mittelbaren Sprungbefehl zu einem geeigneten, inzwischen umgesetzten Block (TBx) des Objektcodes (OC2) für die zweite Maschine (M2) ersetzt wird.3. The method according to claim 2, characterized in that following step c) when the optimizing distributor (ODISP) is called, the command causing the call in the object code (0C2) for the second machine (M2) is given by an immediate jump command a suitable, meanwhile implemented block (TBx) of the object code (OC2) for the second machine (M2) is replaced.
4. Verfahren nach Anspruch 2 oder Anspruch 3, d a d u r c h g e k e n n z e i c h n e t , daß der in Schritt b3) generierte Befehl zum Aufruf des optimierenden Verteilers (ODISP) als Parameter eine Zieladresse sowie die eigene Adresse im Objektcode (0C2) für die zweite Maschine (M2) erhält.4. The method according to claim 2 or claim 3, so that the command generated in step b3) for calling the optimizing distributor (ODISP) receives a target address as a parameter and its own address in the object code (0C2) for the second machine (M2).
5. Verfahren nach einem der Ansprüche 1 bis 4, d a d u r c h g e k e n n z e i c h n e t , daß in5. The method according to any one of claims 1 to 4, d a d u r c h g e k e n n z e i c h n e t that in
Schritt b3) das Generieren eines unmittelbaren Sprungbefehls zu dem Block (TBx) des Objektcodes (OC2) für die zweite Ma- schine (M2) bis zum ersten Ausführen dieses Blocks (TBx) aufgeschoben wird.Step b3) the generation of an immediate jump instruction to the block (TBx) of the object code (OC2) for the second machine (M2) is postponed until the first execution of this block (TBx).
6. Verfahren nach einem der Ansprüche 1 bis 5, d a d u r c h g e k e n n z e i c h n e t , daß in einer Tabelle (LUT) jeder umgesetzte Block (TBx) des Objektcodes (OC2) für die zweite Maschine (M2) zumindest mit einer Start- und/oder eine Einsprungadresse des entsprechenden Blocks (BBx) des Objektcodes (OC1) für die erste Maschine (Ml) eingetragen wird.6. The method according to any one of claims 1 to 5, characterized in that in a table (LUT) each converted block (TBx) of the object code (OC2) for the second machine (M2) at least with a start and / or an entry address of the corresponding Blocks (BBx) of the object code (OC1) for the first machine (Ml) is entered.
Verfahren nach Anspruch 6, d a d u r c h g e k e n n z e i c h n e t , daß in der Tabelle (LUT) für jeden umgesetzten Block (TBx) des Objektcodes (0C2) für die zweite Maschine (M2) ferner Informationen eingetragen werden, aus denen zumindest der Inhalt eines Basisregisters ableitbar ist.A method according to claim 6, characterized in that in The table (LUT) for each converted block (TBx) of the object code (0C2) for the second machine (M2) also contains information from which at least the content of a base register can be derived.
8. Verfahren nach einem der Ansprüche 1 bis 7, d a d u r c h g e k e n n z e i c h n e t , daß ein Block (BBx) des Objektcodes (OC1) für die erste Maschine (Ml) in mehr als einen Block (BBx) des Objektcodes (OC2) für die zweite Maschine (M2) umgesetzt wird, falls während des Programmablaufs der genannte Block (BBx) des Objektcodes (OC1) für die erste Maschine (Ml) mehrfach mit unterschiedlichen Belegungen eines Basisregisters ausgeführt wird.8. The method according to any one of claims 1 to 7, characterized in that a block (BBx) of the object code (OC1) for the first machine (Ml) in more than one block (BBx) of the object code (OC2) for the second machine (M2 ) is implemented if the said block (BBx) of the object code (OC1) for the first machine (Ml) is executed several times with different assignments of a base register during the program run.
9. Verfahren nach Anspruch 8, d a d u r c h g e k e n n z e i c h n e t , daß für einen Block (BBx) des Objektcodes (OC1) für die erste Maschine (Ml) höchstens eine vorbestimmte Anzahl von Blöcken (BBx) des Objektcodes (0C2) für die zweite Maschine (M2) ge- neriert wird und daß der letzte so generierte Block (BBx) des Objektcodes (OC2) für die zweite Maschine (M2) unabhängig von einer Belegung des Basisregisters lauffähig ist. 9. The method according to claim 8, characterized in that for a block (BBx) of the object code (OC1) for the first machine (Ml) at most a predetermined number of blocks (BBx) of the object code (0C2) for the second machine (M2) ge - is generated and that the last block (BBx) of the object code (OC2) generated in this way is executable for the second machine (M2) independently of an assignment of the base register.
PCT/DE1999/003494 1998-11-11 1999-11-02 Method for dynamically converting and executing an object code WO2000028415A2 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
DE19852052.2 1998-11-11
DE19852052 1998-11-11

Publications (2)

Publication Number Publication Date
WO2000028415A2 true WO2000028415A2 (en) 2000-05-18
WO2000028415A3 WO2000028415A3 (en) 2000-08-10

Family

ID=7887454

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/DE1999/003494 WO2000028415A2 (en) 1998-11-11 1999-11-02 Method for dynamically converting and executing an object code

Country Status (1)

Country Link
WO (1) WO2000028415A2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE10111461A1 (en) * 2001-03-09 2002-09-26 Fujitsu Siemens Computers Gmbh Object code conversion method e.g. for architectural compatibility of computers, uses analysis of each next command for providing converted object code

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5652889A (en) * 1991-03-07 1997-07-29 Digital Equipment Corporation Alternate execution and interpretation of computer program having code at unknown locations due to transfer instructions having computed destination addresses

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5652889A (en) * 1991-03-07 1997-07-29 Digital Equipment Corporation Alternate execution and interpretation of computer program having code at unknown locations due to transfer instructions having computed destination addresses

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
SILBERMAN G M ET AL: "AN ARCHITECTURAL FRAMEWORK FOR SUPPORTING HETEROGENEOUS INSTRUCTION-SET ARCHITECTURES" COMPUTER, Bd. 26, Nr. 6, Juni 1993 (1993-06), Seiten 39-56, XP000377627 US,IEEE COMPUTER SOCIETY, LONG BEACH., CA, US ISSN: 0018-9162 *
WITCHEL E ET AL: "EMBRA: FAST AND FLEXIBLE MACHINE SIMULATION" ACM SIGMETRICS INTERNATIONAL CONFERENCE ON MEASUREMENT AND MODELING OF COMPUTER SYSTEMS, [Online] 23. - 26. Mai 1996, Seiten 68-79, XP000679316 US,NEW YORK, ACM ISBN: 0-89791-793-6 ACM Digital Library Retrieved from the Internet: <URL:http://www.acm.org/pubs/articles/proc eedings/metrics/233013/p68-witchel/p68-wit chel.pdf> [retrieved on 2000-05-09] *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE10111461A1 (en) * 2001-03-09 2002-09-26 Fujitsu Siemens Computers Gmbh Object code conversion method e.g. for architectural compatibility of computers, uses analysis of each next command for providing converted object code
DE10111461B4 (en) * 2001-03-09 2005-08-11 Fujitsu Siemens Computers Gmbh A method for converting an object code for a first processor into an object code of a second processor

Also Published As

Publication number Publication date
WO2000028415A3 (en) 2000-08-10

Similar Documents

Publication Publication Date Title
DE60208710T2 (en) PLATFORM INDEPENDENT IM FORWARD COMPILATION
DE69924857T2 (en) PROGRAM CODE CONVERSION
DE69912601T2 (en) CUSTOMIZING REBASED AND REALIGNED EXECUTABLE FILES
EP0502857B1 (en) Process for dynamically linking definable programme elements of an interactive data-processing system
DE60313652T2 (en) METHOD AND DEVICE FOR CONTROLLING THE CONVERSION OF PROGRAM CODES
CH633643A5 (en) METHOD FOR BLOCK-FREE INTERLOCKED SIMULTANEOUS PROCESSING OF MULTIPLE TASKS BY MEANS OF SEVERAL PROGRAMS IN A DATA PROCESSING SYSTEM.
DE69905776T2 (en) Language processing method with little effort and storage space for profile data collection
WO2005098617A1 (en) Method for preventing data inconsistency between accesses of different functions of an application to a global variable in a data processing installation
DE10222361C2 (en) Method for operating a distributed computer network comprising a plurality of distributed computers
EP1010070B1 (en) Method for converting an object code into a programme code
DE10008632B4 (en) Method and system for generating a computer program
DE69731574T2 (en) Compiler and method
WO2000028415A2 (en) Method for dynamically converting and executing an object code
EP0575413B1 (en) Process for the machine production of a program to be made up of several modules
DE102009041098A1 (en) A method of identifying a computer program section contained in a computer storage system
DE112010003774T5 (en) COMPATIBILITY AT OBJECT LEVEL AND CLASS SCALING USING SEMANTIC VALUES
DE102004056006B3 (en) Emulation system for source data processor with program containing source code and output block frequently outputting data signals in source code to target code blocks using data table
DE102005023910B4 (en) Method for transforming a first computer language into a second computer language and computer program for carrying out the method
DE102008044808B4 (en) Method for generating program code in an operating system memory and an application memory of a data carrier
DE102004022183B4 (en) Correction of program object code due to source text changes is made without generating all new modules
DE102016000213A1 (en) A control system having a function of optimizing the control software of a numerical controller according to a machining program
DE10111461B4 (en) A method for converting an object code for a first processor into an object code of a second processor
DE2613703A1 (en) CIRCUIT ARRANGEMENT FOR TRANSLATING PROGRAM TEXT
EP1343078A1 (en) Modelling system and generation of software generating systems
DE102005030354B4 (en) Method for generating executable code

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A2

Designated state(s): JP US

AL Designated countries for regional patents

Kind code of ref document: A2

Designated state(s): AT BE CH CY DE DK ES FI FR GB GR IE IT LU MC NL PT SE

121 Ep: the epo has been informed by wipo that ep was designated in this application
DFPE Request for preliminary examination filed prior to expiration of 19th month from priority date (pct application filed before 20040101)
AK Designated states

Kind code of ref document: A3

Designated state(s): JP US

AL Designated countries for regional patents

Kind code of ref document: A3

Designated state(s): AT BE CH CY DE DK ES FI FR GB GR IE IT LU MC NL PT SE

122 Ep: pct application non-entry in european phase