AU2005236089A1 - Multiple computer architecture with replicated memory fields - Google Patents

Multiple computer architecture with replicated memory fields Download PDF

Info

Publication number
AU2005236089A1
AU2005236089A1 AU2005236089A AU2005236089A AU2005236089A1 AU 2005236089 A1 AU2005236089 A1 AU 2005236089A1 AU 2005236089 A AU2005236089 A AU 2005236089A AU 2005236089 A AU2005236089 A AU 2005236089A AU 2005236089 A1 AU2005236089 A1 AU 2005236089A1
Authority
AU
Australia
Prior art keywords
computers
index
application program
int
memory
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
AU2005236089A
Other versions
AU2005236089B2 (en
Inventor
John Matthew Holt
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.)
Waratek Pty Ltd
Original Assignee
Waratek Pty 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
Priority claimed from AU2004902146A external-priority patent/AU2004902146A0/en
Application filed by Waratek Pty Ltd filed Critical Waratek Pty Ltd
Priority to AU2005236089A priority Critical patent/AU2005236089B2/en
Priority claimed from PCT/AU2005/000582 external-priority patent/WO2005103928A1/en
Publication of AU2005236089A1 publication Critical patent/AU2005236089A1/en
Application granted granted Critical
Publication of AU2005236089B2 publication Critical patent/AU2005236089B2/en
Ceased legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Description

WO 2005/103928 PCT/AU2005/000582 MULTIPLE COMPUTER ARCHITECTURE WITH REPLICATED MEMORY FIELDS Field of the Invention The present invention relates to computers and, in particular, to a modified 5 machine architecture which enables improved performance to be achieved. Background Art Ever since the advent of computers, and computing, software for computers has been written to be operated upon a single machine. As indicated in Fig. 1, that single prior art machine 1 is made up from a central processing unit, or CPU, 2 which 10 is connected to a memory 3 via a bus 4. Also connected to the bus 4 are various other functional units of the single machine 1 such as a screen 5, keyboard 6 and mouse 7. A fundamental limit to the performance of the machine 1 is that the data to be manipulated by the CPU 2, and the results of those manipulations, must be moved by the bus 4. The bus 4 suffers from a number of problems including so called bus 15 "queues" formed by units wishing to gain an access to the bus, contention problems, and the like. These problems can, to some extent, be alleviated by various stratagems including cache memory, however, such stratagems invariably increase the administrative overhead of the machine 1. Naturally, over the years various attempts have been made to increase machine 20 perfonnance. One approach is to use symmetric multi-processors. This prior art approach has been used in so called "super" computers and is schematically indicated in Fig. 2. Here a plurality of CPU's 12 are connected to global memory 13. Again, a bottleneck arises in the communications between the CPU's 12 and the memory 13. This process has been termed "Single System Image". There is only one application 25 and one whole copy of the memory for the application which is distributed over the global memory. The single application can read from and write to, (ie share) any memory location completely transparently. Where there are a number of such machines interconnected via a network, this is achieved by taking the single application written for a single machine and 30 partitioning the required memory resources into parts. These parts are then distributed 1 WO 2005/103928 PCT/AU2005/000582 across a number of computers to form the global memory 13 accessible by all CPU's 12. This procedure relies on masking, or hiding, the memory partition from the single running application program. The performance degrades when one CPU on one machine must access (via a network) a memory location physically located in a 5 different machine. Although super computers have been technically successful in achieving high computational rates, they are not commercially successful in that their inherent complexity makes them extremely expensive not only to manufacture but to administer. In particular, the single system image concept has never been able to 10 scale over "commodity" (or mass produced) computers and networks. In particular, the Single System Image concept has only found practical application on very fast (and hence very expensive) computers interconnected by very fast (and similarly expensive) networks. A further possibility of increased computer power through the use of a plural 15 number of machines arises from the prior art concept of distributed computing which is schematically illustrated in Fig. 3. In this known arrangement, a single application program (Ap) is partitioned by its author (or another programmer who has become familiar with the application program) into various discrete tasks so as to run upon, say, three machines in which case n in Fig. 3 is the integer 3. The intention here is 20 that each of the machines M1.. .M3 runs a different third of the entire application and the intention is that the loads applied to the various machines be approximately equal. The machines communicate via a network 14 which can be provided in various forms such as a communications link, the internet, intranets, local area networks, and the like. Typically the speed of operation of such networks 14 is an order of magnitude 25 slower than the speed of operation of the bus 4 in each of the individual machines Ml, M2, etc. Distributed computing suffers from a number of disadvantages. Firstly, it is a difficultjob to partition the application and this must be done manually. Secondly, communicating data, partial results, results and the like over the network 14 is an 30 administrative overhead. Thirdly, the need for partitioning makes it extremely difficult to scale upwardly by utilising more machines since the application having 2 WO 2005/103928 PCT/AU2005/000582 been partitioned into, say three, does not run well upon four machines. Fourthly, in the event that one of the machines should become disabled, the overall performance of the entire system is substantially degraded. A further prior art arrangement is known as network computing via "clusters" 5 as is schematically illustrated in Fig. 4. In this approach, the entire application is loaded onto each of the machines Ml, M2 .... Mn. Each machine communicates with a common database but does not communicate directly with the other machines. Although each machine runs the same application, each machine is doing a different "job" and uses only its own memory. This is somewhat analogous to a number of 10 windows each of which sell train tickets to the public. This approach does operate, is scalable and mainly suffers from the disadvantage that it is difficult to administer the network. Object of the Invention The object of the present invention is to provide a modified machine 15 architecture which goes some way towards overcoming, or at least ameliorating, some of the abovementioned disadvantages. Summary of the Invention In accordance with a first aspect of the present invention there is disclosed a multiple computer system having at least one application program running 20 simultaneously on a plurality of computers interconnected by a communications network, wherein a like plurality of substantially identical objects are created, each in the corresponding computer. In accordance with a second aspect of the present invention there is disclosed a plurality of computers interconnected via a communications link and operating at least 25 one application program simultaneously. In accordance with a third aspect of the present invention there is disclosed a method of running at least one application program on a plurality of computers simultaneously, said computers being interconnected by means of a communications network, said method comprising the step of, 3 WO 2005/103928 PCT/AU2005/000582 (i) creating a like plurality of substantially identical objects each in the corresponding computer. In accordance with a fourth aspect of the present invention there is disclosed a method of loading an application program onto each of a plurality of computers, the 5 computers being interconnected via a communications link, the method comprising the step of modifying the application before, during, or after loading and before execution of the relevant portion of the application program. In accordance with a fifth aspect of the present invention there is disclosed a method of operating at least one application program simultaneously on a plurality of 10 computers all interconnected via a communications link and each having at least a minimum predetermined local memory capacity, said method comprising the steps of: (i) initially providing each local memory in substantially identical condition, (ii) satisfying all memory reads and writes generated by said application program from said local memory, and 15 (iii) communicating via said communications link all said memory writes at each said computer which take place locally to all the remainder of said plurality of computers whereby the contents of the local memory utilised by each said computer, subject to an updating data transmission delay, remains substantially identical. In accordance with a sixth aspect of the present invention there is disclosed a 20 method of compiling or modifying an application program to run simultaneously on a plurality of computers interconnected via a communications link, said method comprising the steps of: (i) detecting instructions which share memory records utilizing one of said computers, 25 (ii) listing all such shared memory records and providing a naming tag for each listed memory record, (iii) detecting those instructions which write to, or manipulate the contents of, any of said listed memory records, and (iv) activating an updating propagation routine following each said detected write 30 or manipulate instruction, said updating propagation routine forwarding the re-written 4 WO 2005/103928 1 PCT/AU2005/000582 or manipulated contents and name tag of each said re-written or manipulated listed memory record to the remainder of said computers. In accordance with a seventh aspect of the present invention there is disclosed in a multiple thread processing computer operation in which individual threads of a 5 single application program are simultaneously being processed each on a corresponding one of a plurality of computers interconnected via a communications link, the improvement comprising communicating changes in the contents of local memory physically associated with the computer processing each thread to the local memory of each other said computer via said communications link 10 In accordance with a eighth aspect of the present invention there is disclosed a computer program product which enables the abovementioned methods to be carried out. Brief Description of the Drawings Embodiments of the present invention will now be described with reference to 15 the drawings in which: Fig. 1 is a schematic view of the internal architecture of a conventional computer, Fig. 2 is a schematic illustration showing the internal architecture of known symmetric multiple processors, 20 Fig. 3 is a schematic representation of prior art distributed computing, Fig. 4 is a schematic representation of a prior art network computing using clusters, Fig. 5 is a schematic block diagram of a plurality of machines operating the same application program in accordance with a first embodiment of the present 25 invention, Fig. 6 is a schematic illustration of a prior art computer arranged to operate JAVA code and thereby constitute a JAVA virtual machine, Fig. 7 is a drawing similar to Fig. 6 but illustrating the initial loading of code in accordance with the preferred embodiment, 30 Fig. 8 is a drawing similar to Fig. 5 but illustrating the interconnection of a plurality of computers each operating JAVA code in the manner illustrated in Fig. 7, 5 WO 2005/103928 PCT/AU2005/000582 Fig. 9 is a flow chart of the procedure followed during loading of the same application on each machine in the network, Fig. 10 is a flow chart showing a modified procedure similar to that of Fig. 9, Fig. 11 is a schematic representation of multiple thread processing carried out 5 on the machines of Fig. 8 utilizing a first embodiment of memory updating, Fig. 12 is a schematic representation similar to Fig. 11 but illustrating an alternative embodiment, Fig. 13 illustrates multi-thread memory updating for the computers of Fig. 8, Fig. 14 is a schematic representation of two laptop computers interconnected 10 to simultaneously run a plurality of applications, with both applications running on a single computer, Fig. 15 is a view similar to Fig. 14 but showing the Fig. 14 apparatus with one application operating on each computer, and Fig. 16 is a view similar to Figs. 14 and 15 but showing the Fig. 14 apparatus 15 with both applications operating simultaneously on both computers. The specification includes an Annexure which provides actual program fragments which implement various aspects of the described embodiments. Detailed Description In connection with Fig. 5, in accordance with a preferred embodiment of the 20 present invention a single application program 50 can be operated simultaneously on a number of machines Ml, M2... Mn communicating via network 53. As it will become apparent hereafter, each of the machines Ml, M2.. .Mn operates with the same application program 50 on each machine Ml, M2.. .Mn and thus all of the machines Ml, M2... Mn have the same application code and data 50. Similarly, each of the 25 machines Ml, M2... Mn operates with the same (or substantially the same) modifier 51 on each machine Ml, M2.. .Mn and thus all of the machines Ml, M2.. .Mn have the same (or substantially the same) modifier 51 with the modifier of machine M2 being designated 51/2. In addition, during the loading of, or preceding the execution of, the application 50 on each machine Ml, M2... Mn, each application 50 has been 30 modified by the corresponding modifier 51 according to the same rules (or substantially the same rules since minor optimising changes are permitted within each modifier 51/1 ... 51/n). As a consequence of the above described arrangement, if each of the machines 6 WO 2005/103928 PCT/AU2005/000582 Ml, M2... Mn has, say, a shared memory capability of 10MB, then the total shared memory available to each application 50 is not, as one might expect, IOn MB but rather only 10MB. However, how this results in improved operation will become apparent hereafter. Naturally, each machine M1, M2... Mn has an unshared memory 5 capability. The unshared memory capability of the machines Ml, M2... Mn are normally approximately equal but need not be. It is known from the prior art to operate a machine (produced by one of various manufacturers and having an operating system operating in one of various different languages) in a particular language of the application, by creating a virtual 10 machine as schematically illustrated in Fig. 6. The prior art arrangement of Fig. 6 takes the form of the application 50 written in the Java language and executing within a Java Virtual Machine 61. Thus, where the intended language of the application is the language JAVA, a JAVA virtual machine is created which is able to operate code in JAVA irrespective of the machine manufacturer and internal details of the machine. 15 For further details see "The JAVA Virtual Machine Specification" 2 "d Edition by T. Lindholm & F. Yellin of Sun Microsystems Inc. of the USA. This well known prior art arrangement of Fig. 6 is modified in accordance with the preferred embodiment of the present invention by the provision of an additional facility which is conveniently termed "distributed run time" or DRT 71 as 20 seen in Fig. 7. In Fig. 7, the application 50 is loaded onto the Java Virtual Machine 72 via the distributed runtime system 71 through the loading procedure indicated by arrow 75. A distributed run time system is available from the Open Software Foundation under the name of Distributed Computing Environment (DCE). In particular, the distributed runtime 71 comes into operation during the loading 25 procedure indicated by arrow 75 of the JAVA application 50 so as to initially create the JAVA virtual machine 72. The sequence of operations during loading will be described hereafter in relation to Fig. 9. Fig. 8 shows in modified form the arrangement of Fig. 5 utilising JAVA virtual machines, each as illustrated in Fig. 7. It will be apparent that again the same 30 application 50 is loaded onto each machine Ml, M2... Mn. However, the communications between each machine Ml, M2... Mn, and indicated by arrows 83, although physically routed through the machine hardware, are controlled by the 7 WO 2005/103928 'PCT/AU2005/000582 individual DRT's 71/1.. .71/n within each machine. Thus, in practice this may be conceptionalised as the DRT's 71/1... 71/n communicating with each other via the network 73 rather than the machines M1, M2... Mn themselves. Turning now to Figs. 7 and 9, during the loading procedure 75, the program 50 5 being loaded to create each JAVA virtual machine -72 is modified. This modification commences at 90 in Fig. 9 and involves the initial step 91 of detecting all memory locations (termed fields in JAVA - but equivalent terms are used in other languages) in the application 50 being loaded. Such memory locations need to be identified for subsequent processing at steps 92 and 93. The DRT 71 during the loading procedure 10 75 creates a list of all the memory locations thus identified, the JAVA fields being listed by object and class. Both volatile and synchronous fields are listed. The next phase (designated 92 in Fig. 9) of the modification procedure is to search through the executable application code in order to locate every processing activity that manipulates or changes field values corresponding to the list generated at 15 step 91 and thus writes to fields so the value at the corresponding memory location is changed. When such an operation (typically putstatic or putfield in the JAVA language) is detected which changes the field value, then an "updating propagation routine" is inserted by step 93 at this place in the program to ensure that all other machines are notified that the value of the field has changed. Thereafter, the loading 20 procedure continues in a normal way as indicated by step 94 in Fig. 9. An alternative form of initial modification during loading is illustrated in Fig. 10. Here the start and listing steps 90 and 91 and the searching step 92 are the same as in Fig. 9. However, rather than insert the "updating propagation routine" as in step 93 in which the processing thread carries out the updating, instead an "alert 25 routine" is inserted at step 103. The "alert routine" instructs a thread or threads not used in processing and allocated to the DRT, to carry out the necessary propagation. This step 103 is a quicker alternative which results in lower overhead. Once this initial modification during the loading procedure has taken place, then either one of the multiple thread processing operations illustrated in Figs. 11 and 30 12 takes place. As seen in Fig. 11, multiple thread processing 110 on the machines consisting of threads 111/1... 111/4 is occurring and the processing of the second 8 WO 2005/103928 PCT/AU2005/000582 thread 111/2 (in this example) results in that thread 111/2 becoming aware at step 113 of a change of field value. At this stage the normal processing of that thread 111/2 is halted at step 114, and the same thread 111/2 notifies all other machines M2... Mn via the network 53 of the identity of the changed field and the changed value which 5 occurred at step 113. At the end of that communication procedure, the thread 111/2 then resumes the processing at step 115 until the next instance where there is a change of field value. In the alternative arrangement illustrated in Fig. 12, once a thread 121/2 has become aware of a change of field value at step 113, it instructs DRT processing 120 10 (as indicated by step 125 and arrow 127) that another thread(s) 121/1 allocated to the DRT processing 120 is to propagate in accordance with step 128 via the network 53 to all other machines M2... Mn the identity of the changed field and the changed value detected at step 113. This is an operation which can be carried out quickly and thus the processing of the initial thread 111/2 is only interrupted momentarily as indicated 15 in step 125 before the thread 111/2 resumes processing in step 115. The other thread 121/1 which has been notified of the change (as indicated by arrow 127) then communicates that change as indicated in step 128 via the network 53 to each of the other machines M2 .. Mn. This second arrangement of Fig. 12 makes better utilisation of the processing 20 power of the various threads 111/1 ... 111/3 and 12 1/1 (which are not, in general, subject to equal demands) and gives better scaling with increasing size of "n", (n being an integer greater than or equal to 2 which represents the total number of machines which are connected to the network 53 and which run the application program 50 simultaneously). Irrespective of which arrangement is used, the changed 25 field and identities and values detected at step 113 are propagated to all the other machines M2... Mn on the network. This is illustrated in Fig. 13 where the DRT 71/1 and its thread 12 1/1 of Fig. 12 (represented by step 128 in Fig. 13) sends via the network 53 the identity and changed value of the listed memory location generated at step 113 of Fig. 12 by 30 processing in machine M1, to each of the other machines M2... Mn. 9 WO 2005/103928 PCT/AU2005/000582 Each of the other machines M2.. .Mn carries out the action indicated by steps 135 and 136 in Fig. 13 for machine Mn by receiving the identity and value pair from the network 53 and writing the new value into the local corresponding memory location. 5 In the prior art arrangement in Fig. 3 utilising distributed software, memory accesses from one machine's software to memory physically located on another machine are permitted by the network interconnecting the machines. However, such memory accesses can result in delays in processing of the order of 106 _ 107 cycles of the central processing unit of the machine. This in large part accounts for the 10 diminished performance of the multiple interconnected machines. However, in the present arrangement as described above in connection with Fig. 8, it will be appreciated that all reading of data is satisfied locally because the current value of all fields is stored on the machine carrying out the processing which generates the demand to read memory. Such local processing can be satisfied within 15 10 2 10 3 cycles of the central processing unit. Thus, in practice, there is substantially no waiting for memory accesses which involves reads. However, most application software reads memory frequently but writes to memory relatively infrequently. As a consequence, the rate at which memory is being written or re-written is relatively slow compared to the rate at which memory is being 20 read. Because of this slow demand for writing or re-writing of memory, the fields can be continually updated at a relatively low speed via the inexpensive commodity network 53, yet this low speed is sufficient to meet the application program's demand for writing to memory. The result is that the performance of the Fig. 8 arrangement is vastly superior to that of Fig. 3. 25 In a further modification in relation to the above, the identities and values of changed fields can be grouped into batches so as to further reduce the demands on the communication speed of the network 53 interconnecting the various machines. It will also be apparent to those skilled in the art that in a table created by each DRT 71 when initially recording the fields, for each field there is a name or identity 30 which is common throughout the network and which the network recognises. 10 WO 2005/103928 PCT/AU2005/000582 However, in the individual machines the memory location corresponding to a given named field will vary over time since each machine will progressively store changed field values at different locations according to its own internal processes. Thus the table in each of the DRTs will have, in general, different memory locations but each 5 global "field name" will have the same "field value" stored in the different memory locations. It will also be apparent to those skilled in the art that the abovementioned modification of the application program during loading can be accomplished in up to five ways by: 10 (i) re-compilation at loading, (ii) by a pre-compilation procedure prior to loading, (iii) compilation prior to loading, (iv) a 'just-in-time" compilation, or (v) re-compilation after loading (but, or for example, before execution of the 15 relevant or corresponding application code in a distributed environment). Traditionally the term "compilation" implies a change in code or language, eg from source to object code or one language to another. Clearly the use of the term "compilation" (and its grammatical equivalents) in the present specification is not so restricted and can also include or embrace modifications within the same code or 20 language. In the first embodiment, a particular machine, say machine M2, loads the application code on itself, modifies it, and then loads each of the other machines Ml, M3 ... Mn (either sequentially or simultaneously) with the modified code. In this arrangement, which may be termed "master/slave", each of machines Ml, M3, ... Mn 25 loads what it is given by machine M2. In a still further embodiment, each machine receives the application code, but modifies it and loads the modified code on that machine. This enables the modification carried out by each machine to be slightly different being optimized 30 based upon its architecture and operating system, yet still coherent with all other similar modifications. 11 WO 2005/103928 PCT/AU2005/000582 In a further arrangement, a particular machine, say Ml, loads the unmodified code and all other machines M2, M3 ... Mn do a modification to delete the original application code and load the modified version. 5 In all instances, the supply can be branched (ie M2 supplies each of M1, M3, M4, etc directly) or cascaded or sequential (ie M2 applies M1 which then supplies M3 which then supplies M4, and so on). 10 In a still further arrangement, the machines Ml to Mn, can send all load requests to an additional machine (not illustrated) which is not running the application program, which performs the modification via any of the aforementioned methods, and returns the modified routine to each of the machines M1 to Mn which then load the modified routine locally. In this arrangement, machines M1 to Mn forward all 15 load requests to this additional machine which returns a modified routine to each machine. The modifications performed by this additional machine can include any of the modifications covered under the scope of the present invention. Persons skilled in the computing arts will be aware of at least four techniques 20 used in creating modifications in computer code. The first is to make the modification in the original (source) language. The second is to convert the original code (in say JAVA) into an intermediate representation (or intermediate language). Once this conversion takes place the modification is made and then the conversion is reversed. This gives the desired result of modified JAVA code. 25 The third possibility is to convert to machine code (either directly or via the abovementioned intermediate language). Then the machine code is modified before being loaded and executed. The fourth possibility is to convert the original code to an intermediate representation, which is then modified and subsequently converted into 30 machine code. The present invention encompasses all four modification routes and also a combination of two, three or even all four, of such routes. 12 WO 2005/103928 PCT/AU2005/000582 Turning now to Figs. 14-16, two laptop computers 101 and 102 are illustrated. The computers 101 and 102 are not necessarily identical and indeed, one can be an IBM or IBM-clone and the other can be an APPLE computer. The computers 101 and 102 have two screens 105, 115 two keyboards 106, 116 but a single mouse 107. The 5 two machines 101, 102 are interconnected by a means of a single coaxial cable or twisted pair cable 314. Two simple application programs are downloaded onto each of the machines 101, 102, the programs being modified as they are being loaded as described above. In this embodiment the first application is a simple calculator program and results in 10 the image of a calculator 108 being displayed on the screen 105. The second program is a graphics program which displays four coloured blocks 109 which are of different colours and which move about at random within a rectangular box 310. Again, after loading, the box 310 is displayed on the screen 105. Each application operates independently so that the blocks 109 are in random motion on the screen 105 whilst 15 numerals within the calculator 108 can be selected (with the mouse 107) together with a mathematical operator (such as addition or multiplication) so that the calculator 108 displays the result. The mouse 107 can be used to "grab" the box 310 and move same to the right across the screen 105 and onto the screen 115 so as to arrive at the situation illustrated 20 in Fig. 15. In this arrangement, the calculator application is being conducted on machine 101 whilst the graphics application resulting in display of box 310 is being conducted on machine 102. However, as illustrated in Fig. 16, it is possible by means of the mouse 107 to drag the calculator 108 to the right as seen in Fig. 13 so as to have a part of the 25 calculator 108 displayed by each of the screens 105, 115. Similarly, the box 310 can be dragged by means of the mouse 107 to the left as seen in Fig. 15 so that the box 310 is partially displayed by each of the screens 105, 115 as indicated Fig. 16. In this configuration, part of the calculator operation is being performed on machine 101 and part on machine 102 whilst part of the graphics application is being carried out the 30 machine 101 and the remainder is carried out on machine 102. 13 WO 2005/103928 PCT/AU2005/000582 The foregoing describes only some embodiments of the present invention and modifications, obvious to those skilled in the art, can be made thereto without departing from the scope of the present invention. For example, reference to JAVA includes both the JAVA language and also JAVA platform and architecture. 5 Those skilled in the programming arts will be aware that when additional code or instructions is/are inserted into an existing code or instruction set to modify same, the existing code or instruction set may well require further modification (eg by re-numbering of sequential instructions) so that offsets, branching, attributes, mark up and the like are catered for. 10 Similarly, in the JAVA language memory locations include, for example, both fields and array types. The above description deals with fields and the changes required for array types are essentially the same mutatis mutandis. Also the present invention is equally applicable to similar programming languages (including procedural, declarative and object orientated) to JAVA including Microsoft.NET 15 platform and architecture (eg Visual Basic, Visual C/C* and C#), FORTRAN, C/C", COBOL, BASIC etc. The abovementioned arrangement, in which the JAVA code which updates field values is modified, is based on the assumption that either the runtime system (say, JAVA HOTSPOT VIRTUAL MACHINE written in C and Java) or the 20 operating system (LINUX written in C and Assembler, for example) of each machine M1...Mn will ordinarily update memory on the local machine but not on any corresponding other machines. It is possible to leave the JAVA code which updates field values unamended and instead amend the LINUX or HOTSPOT routine which updates memory locally, so that it correspondingly updates memory on all other 25 machines as well. In order to embrace such an arrangement the term "updating propagation routine" used herein in conjunction with maintaining the memory of all machines Ml.. .Mn essentially the same, is to be understood to include within its scope both the JAVA routine and the "combination" of the JAVA routine and the LINUX or HOTSPOT code fragments which perform memory updating. 30 14 WO 2005/103928 -PCT/AU2005/000582 The terms object and class used herein are derived from the JAVA environment and are intended to embrace similar terms derived from different environments such as dynamically linked libraries (DLL), or object code packages, or function unit or memory locations. 5 The term "comprising" (and its grammatical variations) as used herein is used in the inclusive sense of "having" or "including" and not in the exclusive sense of "consisting only of'. Copyright Notice This patent specification contains material which is subject to copyright 10 protection. The copyright owner (which is the applicant) has no objection to the reproduction of this patent specification or related materials from publicly available associated Patent Office files for the purposes of review, but otherwise reserves all copyright whatsoever. In particular, the various instructions are not to be entered into a computer without the specific written approval of the copyright owner. 15 WO 2005/103928 PCT/AU2005/000582 Annexure A The following are program listings in the JAVA language: Al. This first excerpt is part of the modification code. It searches through the code array, and when it finds a putstatic instruction (opcode 178), it implements the modifications. // START byte[] code = Code attribute.code; // Bytecode of a given method in a // given classfile. int codelength = Codeattribute.code-length; int DRT = 99; // Location of the CONSTANT Methodref info for the // DRT.alert() method. for (int i=O; i<codelength; i++){ if ((code[i] & Oxff) == 179){ // Putstatic instruction. System.arraycopy(code, i+3, code, i+6, code_length-(i+3)); code~i+3] = (byte) 184; // Invokestatic instruction for the // DRT.alert() method. code[i+4] = (byte) ((DRT >>> 8) & Oxff); code[i+5] = (byte) (DRT & Oxff); // END A2. This second excerpt is part of the DRT.alert() method. This is the body of the DRT.alerto method when it is called. // START public static void alert({ synchronized (ALERTLOCK){ ALERT_LOCK.notify(); // Alerts a waiting DRT thread in the background. // END A3. This third excerpt is part of the DRT Sending. This code fragment shows the DRT in a separate thread, after being notified, sending the value across the network. // START MulticastSocket ms = DRT.getMulticastSocket(; // The multicast socket // used by the DRT for // communication. byte nameTag = 33; // This is the "name tag" on the network for this // field. 16 WO 2005/103928 PCT/AU2005/000582 Field field = modifiedClass.getDeclaredField("myFieldl"); / Stores // the field // from the // modified // class. // In this example, the field is a byte field. while (DRT.isRunning() synchronized (ALERT_LoCK){ ALERTLoCK.wait(; // The DRT thread is waiting for the alert // method to be called. byte[] b new byte[]{nameTag, field.getByte(null)}; // Stores // the // nameTag // and the // value // of the // field from // the modified // class in a // buffer. DatagramPacket dp = new DatagramPacket(b, 0, b.length); ms.send(dp); // Send the buffer out across the network. // END A4. The fourth excerpt is part of the DRT receiving. This is a fragment of code to receive a DRT sent alert over the network. // START MulticastSocket ms = DRT.getMulticastSocket( / The multicast socket // used by the DRT for // communication. DatagramPacket dp = new DatagramPacket(new byte[2], 0, 2); byte nameTag 33; // This is the "name tag" on the network for this // field. Field field = modifiedClass.getDeclaredField("myFieldl"); / Stores the // field from // the modified // class. // In this example, the field is a byte field. while (DRT.isRunning){ ms.receive(dp); // Receive the previously sent buffer from the network. byte[] b = dp.getData(; if (b(0} == nameTag){ // Check the nametags match. field.setByte(null, b[1]); // Write the value from the network packet // into the field location in memory. 17 WO 2005/103928 PCT/AU2005/000582 // END A5. The fifth excerpt is an example application before modification has occurred. Method void setValues(int, int) 0 iload 1 1 putstatic #3 <Field int staticValue> 4 aload 0 5 iload_2 6 putfield #2 <Field int instanceValue> 9 return A6. The sixth excerpt is the same example application in 5 after modification has been performed. The modifications are highlighted in bold. Method void setValues(int, int) 0 iload_1 1 putstatic #3 <Field int staticValue> 4 Ide #4 <String "example"> 6 iconst 0 7 invokestatic #5 <Method void alert(java.lang.Object, int)> 10 aload_0 11 iload_2 12 putfield #2 <Field int instanceValue> 15 aload_0 16 iconst_1 17 invokestatic #5 <Method void alert(java.lang.Object, int)> 20 return A7. The seventh excerpt is the source-code of the example application used in excerpt 5 and 6. import java.lang.*; public class example{ /** Shared static field. */ public static int staticValue = 0; /** Shared instance field. */ public int instanceValue = 0; /** Example method that writes to memory (instance field). public void setvalues(int a, int b){ staticValue = a; instanceValue = b; 18 WO 2005/103928 PCT/AU2005/000582 A8. The eighth excerpt is the source-code of FieldAlert, which alerts the "distributed run-time" to propagate a changed value. import java.lang.*; import java.util.*; import java.net.*; import java.io.*; public class FieldAlert{ /** Table of alerts. */ public final static Hashtable alerts = new Hashtable(; /** Object handle. */ public Object reference = null; /** Table of field alerts for this object. */ public boolean[] fieldAlerts = null; /** Constructor. */ public FieldAlert(Object c, int initialFieldCount){ reference = o; fieldAlerts = new bcolean[initialFieldCount]; /** Called when an application modifies a value. (Both objects and classes) */ public static void alert(Object o, int fieldID){ // Lock the alerts table. synchronized (alerts){ FieldAlert alert = (FieldAlert) alerts.get(o); if (alert == null){ / This object hasn't been alerted already, // so add to alerts table. alert = new FieldAlert(o, fieldID + 1); alerts.put(o, alert); if (fieldID >= alert.fieldAlerts.length){ // Ok, enlarge fieldAlerts array. boolean[] b = new boolean[fieldID+1]; System.arraycopy(alert.fieldAlerts, 0, b, 0, alert.fieldAlerts.length); alert.fieldAlerts = b; // Record the alert. alert.fieldAlerts[fieldID] = true; // Mark as pending. FieldSend.pending = true; // Signal that there is one or more // propagations waiting. // Finally, notify the waiting FieldSend thread(s) if (FieldSend.waiting){ FieldSend.waiting = false; alerts.notify(; 19 WO 2005/103928 PCT/AU2005/000582 A9. The ninth excerpt is the source-code of FieldSend, which propagates changes values alerted to it via FieldAlert. import java.lang.*; import java.lang.reflect.*; import java.util.*; import java.net.*; import java.io.*; public class FieldSend implements Runnable{ /** Protocol specific values. */ public final static int CLOSE -1; public final static int NACK = 0; public final static int ACK = 1; public final static int PROPAGATEOBJECT = 10; public final static int PROPAGATECLASS = 20; /** FieldAlert network values. */ public final static String group System.getProperty("FieldAlertnetworkgroup"); public final static int port = Integer.parseInt(System.getProperty("FieldAlert network port")); /** Table of global ID's for local objects. (hashcode-to-globalID mappings) */ public final static Hashtable objectToGlobalID = new Hashtableo; /** Table of global ID's for local classnames. (classname-to-globalID mappings) */ public final static Hashtable classNameToGlobalID = new Hashtable(); /** Pending. True if a propagation is pending. */ public static boolean pending = false; /** Waiting. True if the FieldSend thread(s) are waiting. */ public static boolean waiting = false; / Background send thread. Propagates values as this thread is alerted to their alteration. */ public void run)({ System.out.println("FieldAlert networkgroup=" + group); System.out.println("FieldAlert_networkport=" + port); try{ // Create a DatagramSocket to send propagated field values. DatagramSocket datagramSocket = new DatagramSocket(port, InetAddress.getByName(group)); 20 WO 2005/103928 PCT/AU2005/000582 // Next, create the buffer and packet for all transmissions. byte[] buffer = new byte[512]; // Working limit of 512 bytes // per packet. DatagramPacket datagramPacket = new DatagramPacket(buffer, 0, buffer.length); while (!Thread.interrupted(){ Object[] entries = null; // Lock the alerts table. synchronized (FieldAlert.alerts){ // Await for an alert to propagate something. while (!pending){ waiting = true; FieldAlert.alerts.wait(); waiting = false; pending = false; entries = FieldAlert.alerts.entrySet().toArray(); // Clear alerts once we have copied them. FieldAlert.alerts.clear(); // Process each object alert in turn. for (int i=O; i<entries.length; i++){ FieldAlert alert = (FieldAlert) entries[i]; int index = 0; datagramPacket.setLength(buffer.length); Object reference = null; if (alert.reference instanceof String){ // PROPAGATECLASS field operation. buffer[index++] = (byte) ((PROPAGATE_CLASS >> 24) & Oxff); buffer[index++] = (byte) ((PROPAGATE CLASS >> 16) & Oxff); buffer[index++] = (byte) ((PROPAGATECLASS >> 8) & Oxff); buffer(index++] = (byte) ((PROPAGATECLASS >> 0) & Oxff); String name = (String) alert.reference; int length = name.length(); buffer[index++] = (byte) ((length >> 24) & Oxff); buffer[index++] = (byte) ((length >> 16) & Oxff); buffer[index++] = (byte) ((length >> 8) & Oxff); buffer[index++] = (byte) ((length >> 0) & Oxff); byte[] bytes = name.getByteso; System.arraycopy(bytes, 0, buffer, index, length); index += length; }else{ // PROPAGATEOBJECT field operation. buffer[index++] = (byte) ((PROPAGATEOBJECT >> 24) & Oxff); buffer[index++] = (byte) ((PROPAGATEOBJECT >> 16) & Oxff); buffer[index++] = (byte) ((PROPAGATE OBJECT >> 8) & Oxff); buffer[index++] = (byte) ((PROPAGATEOBJECT >> 0) & Oxff); int globalID = ((Integer) 21 WO 2005/103928 PCT/AU2005/000582 objectToGlobalID.get(alert.reference)).intValue(; buffer[index4-+) = (byte) ((globallD >> 24) & Oxff); buffer)index++] = (byte) ((globalID >> 16) & Oxff); buffer[index++] ) (byte) ((globalID >> 8) & Oxff); buffer[index++] = (byte) ((globalID >> 0) & Oxff); reference = alert.reference; // Use reflection to get a table of fields that correspond to // the field indexes used internally. Field(] fields = null; if (reference == null){ fields = FieldLoader.loadClass((String) alert.reference).getDeclaredFields(); }else{ fields = alert.reference.getClass().getDeclaredFields(); // Now encode in batch mode the fieldID/value pairs. for (int j=O; j<alert.fieldAlerts.length; j++){ if (alert.fieldAlerts[j] == false) continue; bufferindex++] = (byte) ((j >> 24) & Oxff); buffer[index++] = (byte) ((j >> 16) & Oxff); buffer[index++] = (byte) ((j >> 8) & Oxff); buffer[index++] = (byte) ((j >> 0) & Oxff); // Encode value. Class type = fields[j].getType(; if (type == Boolean.TYPE){ buffer[index++] =(byte) (fields[j].getBcolean(reference)? 1 0); }else if (type == Byte.TYPE){ buffer[index++] = fields[j).getByte(reference); }else if (type == Short.TYPE){ short v = fieldslj).getShort(reference); buffer[index++] = (byte) ((v >> 8) & Oxff); buffer[index++3 = (byte) ((v >> 0) & Oxtf); }else if (type == Character.TYPE){ char v = fields[j).getChar(reference); buffer[index++) = (byte) ((v >> 8) & Oxff); buffer[index++] = (byte) ((v >> 0) & Oxff); }else if (type == Integer.TYPE){ int v = fields[j].getInt(reference); buffer[index++] = (byte) ((v >> 24) & Oxff); buffer[index++] = (byte) ((v >> 16) & Oxff); bufferrindex++1 = (byte) ((v >> B) & Oxff); buffer[index++] = (byte) ((v >> 0) & Oxff); }else if (type == Float.TYPE){ int v = Float.floatToIntBits( fields[j].getFloat(reference)); buffer[index++) = (byte) ((v >> 24) & Oxff); bufferindex++] = (byte) ((v >> 16) & Oxff); bufferindex++] = (byte) ((v >> 8) & Oxff); buffer[index++) = (byte) ((v >> 0) & Oxff); }else if (type == Long.TYPE){ long v = fields[j].getLong(reference); buffer(index++] = (byte) ((v >> 56) & Oxff); buffer[index++3 = (byte) ((v >> 48) & Oxff); buffer(index++] = (byte) ((v >> 40) & Oxff); buffer[index++] = (byte) ((v >> 32) & Oxff); buffer(index++) = (byte) ((v >> 24) & Oxff); 22 WO 2005/103928 PCT/AU2005/000582 buffer~index++] = (byte) ((v >> 16) & Oxff); buffer[index++] = (byte) ((v >> 8) & Oxff); buffer[index++] = (byte) ((v >> 0) & Oxff); }else if (type == Double.TYPE){ long v = Double.doubleToLongBits( fields[j].getDouble(reference)); buffer[index++] = (byte) ((v >> 56) & Oxff); buffer[index++] = (byte) ((v >> 48) & 0xff); buffer[index++] = (byte) ((v >> 40) & Oxff); buffer[index++] = (byte) ((v >> 32) & Oxff); buffer[index++] = (byte) ((v >> 24) & Oxff); buffer[index++] = (byte) ((v >> 16) & 0xff); buffer[index++] = (byte) ((v >> 8) & Oxff); buffer[index++] = (byte) ((v >> 0) & Oxff); else{ throw new AssertionError("Unsupported type."); // Now set the length of the datagrampacket. datagramPacket.setLength(index); // Now send the packet. datagramSocket.send(datagramPacket); }catch (Exception e){ throw new AssertionError("Exception: " + e.toString()); } A10. The tenth excerpt is the source-code of FieldReceive, which receives propagated changed values sent via FieldSend. import java.lang.*; import java.lang.reflect.*; import java.util.*; import java.net.*; import java.io.*; public class FieldReceive implements Runnable{ /** Protocol specific values. */ public final static int CLOSE = -1; public final static int NACK = 0; public final static int ACK = 1; public final static int PROPAGATE OBJECT = 10; public final static int PROPAGATECLASS = 20; /** FieldAlert network values. */ public final static String group .System.getProperty("FieldAlertnetworkgroup"); public final static int port = Integer.parselnt(System.getProperty("FieldAlertnetwork_port")); 23 WO 2005/103928 PCT/AU2005/000582 /** Table of global ID's for local objects. (globalID-to-hashcode mappings) */ public final static Hashtable globalIDToObject = new Hashtable(; /** Table of global ID's for local classnames. (globalID-to-classname mappings) */ public final static Hashtable globalIDToClassName = new Hashtable(; /** Called when an application is to acquire a lock. */ public void run({ System.out.println("FieldAlertnetwork-group=" + group); System.out.println("FieldAlert network port=" + port); try( // Create a DatagramSocket to send propagated field values from MulticastSocket multicastSocket = new MulticastSocket(port); multicastSocket.joinGroup(InetAddress.getByName(group)); // Next, create the buffer and packet for all transmissions. byte[] buffer = new byte[512]; // Working limit of 512 // bytes per packet. DatagramPacket datagramPacket = new DatagramPacket(buffer, 0, buffer.length); while (!Thread.interrupted()) // Make sure to reset length. datagramPacket.setLength(buffer.length); // Receive the next available packet. multicastSocket.receive(datagramPacket); int index = 0, length = datagramPacket.getLength(); // Decode the command. int command = (int) (((buffer[index++] & Oxff) << 24) I ((buffer[index++] & Oxff) << 16) | ((buffer[index++] & Oxff) << 8) | (buffer[index++] & Oxff)); if (command == PROPAGATEOBJECT){ // Propagate operation for // object fields. // Decode global id. int globalID = (int) (((buffer[index++] & Dxff) << 24) 1 ((buffer(index++] & 0xff) << 16) I ((buffer[index++] & Oxff) << 8) J (buffer[index++] & Oxff)); // Now, need to resolve the object in question. Object reference = globalIDToObject.get( new Integer(globalID)); // Next, get the array of fields for this object. Field[] fields = reference.getClass().getDeclaredFields(); while (index < length){ // Decode the field id. int fieldID = (int) (((buffer[index++] & Oxff) << 24) I ((buffer[index++] & Oxff) << 16) 1 ((buffer[index++) & Oxff) << 8) 24 WO 2005/103928 PCT/AU2005/000582 I (buffer[index++] & Oxff)); // Determine value length based on corresponding field // type. Field field = fields[fieldID]; Class type = field.getType(; if (type == Boolean.TYPE){ boolean v = (buffer[index++] == 1 ? true false); field.setBoolean(reference, v); )else if (type == Byte.TYPE){ byte v = buffer[index++]; field.setByte(reference, v); }else if (type == Short.TYPE){ short v = (short) (((buffer[index++] & Oxff) << 8) I (buffer[index++] & Oxff)); field.setShort(reference, v); }else if (type == Character.TYPE){ char v = (char) (((buffer[index++] & Oxff) << 8) 1 (buffer[index++] & Oxff)); field.setChar(reference, v); }else if (type == Integer.TYPE){ int v = (int) (((buffer[index++] & Oxff) << 24) I ((buffer[index++] & Oxff) << 16) I ((buffer[index++] & Oxff) << 8) I (buffer[index++] & Oxff)); field.setInt(reference, v); }else if (type == Float.TYPE){ int v = (int) (((buffer~index++] & Oxff) << 24) 1 ((buffer[index++] & Oxff) << 16) I ((buffer[index++] & Oxff) << 8) I (buffer[index++] & Oxff)); field.setFloat(reference, Float.intBitsToFloat(v)); }else if (type == Long.TYPE){ long v = (long) (((buffer[index++] & Oxff) << 56) ((buffer[index++] & Oxff) << 48) I ((buffer[index++] & Oxff) << 40) 1 ((bufferlindex++] & Oxff) << 32) I ((buffer[index++] & Oxff) << 24) I ((buffer[index++] & Oxff) << 16) ((buffer[index++j & Oxff) << 8) 1 (buffer[index++] & Oxff)); field.setLong(reference, v); }else if (type == Double.TYPE){ long v = (long) (((buffer[index++] & Oxff) << 56) I ((buffer(index++] & Oxff) << 48) I ((buffer[index++] & Oxff) << 40) I ((buffer[index++] & Gxff) << 32) | ((buffer[Lindex++] & Oxff) << 24) I ((buffer[index++] & Oxff) << 16) | ((buffer[index++] & Oxff) << 8) (buffer[index++] & 0xff)); field.setDouble(reference, Double.longBitsToDouble(v)); }else{ throw new AssertionError("Unsupported type."); }else if (command == PROPAGATECLASS){ // Propagate an update // to class fields. // Decode the classname. int nameLength = (int) (((buffer[index++] & Oxff) << 24) I ((buffer[index++) & Oxff) << 16) | ((buffer[index++] & Oxff) << 8) I (buffer[index++] & Oxff)); String name = new String(buffer, index, nameLength); 25 WO 2005/103928 PCT/AU2005/000582 index += nameLength; // Next, get the array of fields for this class. Field[] fields = FieldLoader.loadClass(name).getDeclaredFields(); // Decode all batched fields included in this propagation // packet. while (index < length){ // Decode the field id. int fieldID = (int) (((buffer[index++] & Oxff) << 24) I ((buffer[index++] & Oxff) << 16) I ((buffer[index++] & Oxff) << 8) I (buffer[index++] & Oxff)); // Determine field type to determine value length. Field field = fields[fieldID]; Class type = field.getType(; if (type == Boolean.TYPE){ boolean v = (buffer[index++] == 1 ? true : false); field.setBoolean(null, v); }else if (type == Byte.TYPE){ byte v = buffer[index++]; field.setByte(null, v); }else if (type == Short.TYPE){ short v = (short) (((buffer[index++] & Cxff) << 8) | (buffer[index++] & Oxff)); field.setShort(null, v); }else if (type == Character.TYPE){ char v = (char) (((buffer[index++] & Cxff) << 8) I (buffer[index++] & Oxff)); field.setChar(null, v); }else if (type == Integer.TYPE){ int v = (int) (((buffer[index++] & Oxff) << 24) 1 ((buffer[index++] & Oxff) << 16) 1 ((buffer[index++] & Oxff) << 8) 1 (buffer[index++] & Oxff)); field.setInt(null, v); }else if (type == Float.TYPE){ int v = (int) (((buffer[index++} & Oxff) << 24) I ((buffer[index++] & Oxff) << 16) I ((buffer[index++] & Oxff) << 8) (buffer[index++] & Oxff)); field.setFloat(null, Flcat.intBitsToFloat(v)); )else if (type == Long.TYPE){ long v = (long) (((buffer[index++] & Oxff) << 56) l ((buffer[index++] & Oxff) << 48) ((buffer[index++) & Oxff) << 40) ((buffer[index++] & Oxff) << 32) ((buffer[index++] & Oxff) << 24) I ((buffer[index++} & Oxff) << 16) 1 ((buffer[index++] & Oxff) << 8) I (buffer[index++] & Oxff)); field.setLong(null, v); }else if (type == Double.TYPE){ long v = (long) (((buffer[index++} & Oxff) << 56) ((buffer[index++] & Oxff) << 48) I ((buffer[index++] & Oxff) << 40) I ((buffer[index++} & Oxff) << 32) I ((buffer[index++] & Oxff) << 24) ((buffer[index++} & Cxff) << 16) I ((buffer[index++] & Oxff) << 8) I (buffer[index++] & Oxff)); field.setDouble(null, Double.longBitsToDouble(v)); }else{ // Unsupported field type. throw new AssertionError("Unsupported type."); 26 WO 2005/103928 PCT/AU2005/000582 }catch (Exception e){ throw new AssertionError("Exception: + e.toString()); All. FieldLoader.java This excerpt is the source-code of FieldLoader, which modifies an application as it is being loaded. import java.lang.*; import java.io.*; import java.net.*; public class FieldLoader extends URLClassLoader{ public FieldLoader(URL[] urls){ super (urls); protected Class findClass (String name) throws ClassNotFoundException{ ClassFile cf = null; try{ BufferedInputStream in new BufferedInputStream(findResource( name.replace('.
1 , '/').concat(".class")).opentream ()) cf = new ClassFile(in); }catch (Exception e) (throw new ClassNotFoundException(e.toString() ); } // Class-wide pointers to the ldc and alert index. int ldcindex = -1; int alertindex = -1; for (int i=O; i<cf.methods count; i++){ for (int j=O; j<cf.methods[i].attributescount; j++){ if (! (cf.methods[i].attributes[j] instanceof Codeattribute)) continue; Code attribute ca = (Code-attribute) cf.methods[i}.attributes[j]; boolean changed = false; for (int z-O; z<ca.code.length; z++){ if ((ca.code[z][0] & Oxff) == 179){ // Opcode for a PUTSTATIC // instruction. 27 WO 2005/103928 PCT/AU2005/000582 changed = true; // The code below only supports fields in this class. // Thus, first off, check that this field is local to this // class. CONSTANT Fieldref info fi - (CONSTANT Fieldref info) cf.constantpool[(int) (((ca.code[z][1] & Oxff) << 8) | (ca.code[z][2] & Oxff))]; CONSTANT Class info ci = (CONSTANTClassinfo) cf.constantpool[fi.class index]; String className = cf.constantpool[ci.nameindex].toString(; if (!name.equals(className)){ throw new AssertionError ("This code only supports fields "'local to this class"); // Ok, now search for the fields name and index. int index 0; CONSTANT NameAndType info ni = (CONSTANTNameAndTypeinfo) cf.constantpool[fi.name andtypeindex]; String fieldName = cf.constantpool[ni.nameindex].toString(; for (int a=0; a<cf.fieldscount; a++){ String fn = cf.constantpool[ cf.fields[a].name index].toString(); if (fieldName.equals (fn)){ index = a; break; // Next, realign the code array, making room for the // insertions. byte[][] code2 = new byte[ca.code.length+3][]; System.arraycopy(ca.code, 0, code2, 0, z+l); System.arraycopy(ca.code, z+1, code2, z+4, ca.code.length-(z+)); ca.code = code2; // Next, insert the LDCW instruction. if (ldcindex == -1){ CONSTANT_String info csi new CONSTANT Stringinfo(ci.nameindex); cpinfo[] cpi = new cpinfo[cf.constant pool.length+1]; System.arraycopy(cf.constant_pool, 0, cpi, 0, cf.constant_pool.length); cpi[cpi.length - 1] = csi; ldcindex = cpi.length-1; cf.constant_pool = cpi; cf.constant_pool count++; ca.code[z+1] = new byte[3]; ca.code[z+1][0] = (byte) 19; ca.code[z+1][1] = (byte) ((ldcindex >> 8) & Oxff); ca.code[z+l][2] = (byte) (ldcindex & Cxff); // Next, insert the SIPUSH instruction. ca.code[z+2] = new byte[3]; ca.code[z+21[0] = (byte) 17; ca.code[z+2][1] = (byte) ((index >> 8) & Oxff); ca.code[z+2][2] = (byte) (index & Oxff); 28 WO 2005/103928 PCT/AU2005/000582 // Finally, insert the INVOKESTATIC instruction. if (alertindex == -1){ // This is the first time this class is encourtering the // alert instruction, so have to add it to the constant // pool. cp_info[] cpi = new cp_info[cf.constant pool.length+6]; System.arraycopy(cf.constant pool, 0, cpi, 0, cf.constantpool.length); cf.constantpool = cpi; cf.constantpoolcount += 6; CONSTANT UtfB info ul = new CONSTANT Utf8 info("FieldAlert"); cf.constantpool[cf.constantpool.length-6] = ul; CONSTANT Class info cl = new CONSTANT Class info( cf.constantpoolcount-6); cf.constant pool(cf.constant-pool.length-5] = c1; ul = new CONSTANT Utfi info("alert"); cf.constant pool[cf.constant-pool.length-4] = ul; ul = new CONSTANT UtfB info("(Ljave/lang/Object;I)V"); cf.constant pool[cf.constant-pool.length-3] = ul; CONSTANT NameAndTypeinfo nl = new CONSTANT NameAndTypeinfo( cf.constantpool.length-4, cf.constant pool.length 3); cf.constant_pcol[cf.constant-pool.length-2] = nl; CONSTANTMethodref info ml = new CONSTANT Methodref info( cf.constant_pool.length-5, cf.constant pool.length 2); cf.constant-pool[cf.constant-pool.length-1] = ml; alertindex cf.constantpool.length-1; ca.code[z+3]= new byte[3]; ca.code[z+3][0] = (byte) 184; ca.code[z+3][1] = (byte) ((alertindex >> 8) & Oxff); ca.code[z+3][2] = (byte) (alertindex & Oxff); // And lastly, increase the CODELENGTH and ATTRIBUTELENGTH // values. ca.code length += 9; ca.attributelength += 9; // If we changed this method, then increase the stack size by one. if (changed){ ca.max stack++; // Just to make sure. try{ 29 WO 2005/103928 PCT/AU2005/000582 ByteArrayoutputStream out = new ByteArrayOutputStream(); cf.serialize(out); byte[] b = out.toByteArray(; return defineClass(name, b, 0, b.length); }catch (Exception e){ throw new ClassNotFoundException(name); A12. Attributeinfo.java Convience class for representing attribute-info structures within ClassFiles. import java.lang.*; import java.io.*; /** This abstract class represents all types of attribute-info * that are used in the JVM specifications. * All new attribute-info subclasses are to always inherit from this * class. */ public abstract class attribute info{ public int attribute-name index; public int attribute length; /** This is used by subclasses to register themselves * to their parent classFile. */ attribute info(ClassFile cf){) /** Used during input serialization by ClassFile only. */ attributeinfo(ClassFile of, DatalnputStream in) throws IOException{ attribute name index - in.readChar(; attribute-length = in.readInt(; /** Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ out.writeChar(attribute name-index); out.writeInt(attribute length); /** This class represents an unknown attribute info that * this current version of classfile specification does * not understand. */ public final static class Unknown extends attribute info{ byte[] info; /** Used during input serialization by ClassFile only. */ Unknown(ClassFile of, DataInputStream in) throws IOException{ super(cf, in); info - new byte[attributelength]; in.read(info, 0, attributelength); 30 WO 2005/103928 PCT/AU2005/000582 /** Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ ByteArrayOutputStream baos = new ByteArrayOutputStreamo; super.serialize(out); out.write(info, 0, attributelength); A13. ClassFile.java Convience class for representing ClassFile structures. import java.lang.*; import java.io.*; import java.util.a; /** The ClassFile follows verbatim from the JVM specification. */ public final class ClassFile { public int magic; public int minor-version; public int major version; public int constant_poolcount; public cpinfo[] constantpool; public int accessflags; public int this-class; public int super class; public int interfacescount; public int[] interfaces; public int fieldscount; public fieldinfo[] fields; public int methodscount; public method info[] methods; public int attributes count; public attributeinfo[] attributes; /** Constructor. Takes in a byte stream representation and transforms * each of the attributes in the ClassFile into objects to allow for * easier manipulation. */ public ClassFile(InputStream ins) throws IOException{ DataInputStream in = (ins instanceof DataInputStream ? (DataInputStream) ins : new DataInputStream(ins)); magic = in.readlnto; minor-version = in.readCharo; major version = in.readCharo; constant pool count = in.readChar(; constantpool = new cp_info[constant_poolcount]; for (int i=l; i<constant_pool count; i++){ in.mark(l); int s = in.read(; in.reset(); switch (s){ case 1: constant pool[i] = new CONSTANTUtf8_info(this, in); break; case 3: constantpool[i] = new CONSTANT_Integer info(this, in); break; case 4: constant_pool[i] = new CONSTANTFloat info(this, in); break; 31 WO 2005/103928 PCT/AU2005/000582 case 5: constantpoolij] = new CONSTANTLonginfo(this, in); i++; break; case 6: constantpool[i] = new CONSTANTDoubleinfo(this, in); i++; break; case 7: constant pool[i] = new CONSTANTClass info(this, in); break; case 8: constantpool[il = new CONSTANT_Stringinfo(this, in); break; case 9: constantpool[i] = new CONSTANTFieldrefinfo(this, in); break; case 10: constantpool[i] = new CONSTANTMethodrefinfo(this, in); break; case 11: constant_pool[i] = new CONSTANTInterfaceMethodref info(this, in); break; case 12: constant-pool[i] = new CONSTANTNameAndTypeinfo(this, in); break; default: throw new ClassFormatError("Invalid ConstantPoolTag"); access_flags = in.readChar(; thisclass = in.readChar(; superclass = in.readChar(; interfaces count = in.readChar(); interfaces = new int[interfaces count]; for (int i=0; i<interfaces count; i++) interfaces[i] = in.readCharo; fields count = in.readChar(); fields = new field infotfieldscount]; for (nt i=0; i<fields count; i++) { fields[i] = new field info(this, in); } methods count = in.readChar(; methods = new method info~methods count]; for (int i=0; i<methods count; i++) { methods[i] = new methodinfo(this, in); attributescount = in.readChar(); attributes = new attributeinfo[attributes count]; for (int i=0; i<attributes count; i++){ in.mark(2); String a = constantpocl[in.readCharo].toString(; in.reset(); if (s.equals("SourceFile")) attributes[i] = new SourceFileattribute(this, in); else if (s.equals("Deprecated")) attributes[i) = new Deprecatedattribute(this, in); else if (s.equals("InnerClasses")) attributes[i] = new InnerClassesattribute(this, in); else attributes[i] = new attribute info.Unknown(this, in); 32 WO 2005/103928 PCT/AU2005/000582 /** Serializes the ClassFile object into a byte stream. */ public void serialize(OutputStream o) throws IOException{ DataOutputStream out = (o instanceof DataOutputStream ? (DataOutputStream) o : new DataOutputStream(o)); out.writeInt(magic); out.writeChar(minor version); out.writeChar(majorversion); out.writeChar(constant pool count); for (int i=1; i<constant pool count; i++){ constant_pool[i].serialize(out); if (constantpool[i] instanceof CONSTANT_Longinfo |1 constant_pool[i] instanceof CONSTANTDouble info) out.writeChar(access flags); out.writeChar(this class); out.writeChar(super class); out.writeChar(interfaces count); for (int i=0; i<interfaces count; i++) out.writeChar(interfaces[i]); out.writeChar(fields count); for (int i=0; i<fields count; i++) fields[i].serialize(out); out.writeChar(methodscount); for (int i=0; i<methods count; i++) methods[i].serialize(out); out.writeChar(attributes count); for (int i=0; i<attributescount; i++) attributes[i].serialize(out); // Flush the outputstream just to make sure. out. flush(); A14. Code_attribute.java Convience class for representing Codeattribute structures within ClassFiles. import java.util.*; import java.lang.*; import java.io.*; * The code[] is stored a's a 2D array. */ public final class Codeattribute extends attribute-info{ public int max stack; public int max locals; public int code length; public byte[][] code; public int exception_tablelength; public exception table[] exception table; public int attributes count; public attribute-info[] attributes; /** Internal class that handles the exception table. */ public final static class exceptiontable{ public int startpc; public int endpc; public int handlerpc; public int catch-type; /* Constructor called only by methodinfo. */ Code attribute(ClassFile cf, int ani, int al, int ms, int ml, int cl, 33 WO 2005/103928 PCT/AU2005/000582 byte[][] cd, int etl, exception-table[] et, int ac, attribute-info[] a){ super(cf); attribute name index = ani; attribute length = al; max stack ms; max locals = ml; code length cl; code = cd; exceptiontablelength = etl; exception table = et; attributes count = ac; attributes = a; /** Used during input serialization by ClassFile only. */ Code attribute(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); max stack = in.readChar(; max locals in.readChar(; code length = in.readInt(; code = new byte[codelength][]; int i 0; for (int pos=O; pos<codelength; i++){ in.mark(l); int s = in.reado; in.reset(); switch (s){ case 16: case 18: case 21: case 22: case 23: case 24: case 25: case 54: case 55: case 56: case 52: case 58: case 169: case 188: case 196: code[i] = new byte[2]; break; case 17: case 19: case 20: case 132: case 153: case 154: case 155: case 156: case 157: case 158: case 159: case 160: case 161: case 162: case 163: case 164: case 165: case 166: case 167: case 168: 34 WO 2005/103928 PCT/AU2005/000582 case 178: case 179: case 180: case 181: case 182: case 183: case 184: case 187: case 189: case 192: case 193: case 198: case 199: case 209: code[i] = new byte[3]; break; case 197: code[i] = new byte[4]; break; case 185: case 200: case 201: code[i] = new byte[5]; break; case 170:{ int pad = 3 - (pos % 4); in.mark(pad+13); highbyte in.skipBytes(pad+5); lowbyte int low = in.readlnto; code[i] = new byte[pad + 13 + ((in.readlnt( low + 1) * 4)]; in.reset(; break; }case 171:{ int pad = 3 - (pos % 4); in.mark(pad+9); in.skipBytes(pad+5); code[i] = new byte[pad + 9 + (in.readlnt( 8)]; in.reset(); break; }default: code[i) - new byte{1]; in.read(code[i], 0, code[i].length); pos += codeli].length; /adjust the array to the new size and store the size byte][] temp /new byte[ih]; System.arraycopy(ccde, 0, temp, 0, i); coda = tamp; exception table-length = in.readCharo; exception table new Code -attribute.exception -table[exception_table length]; for (i= ; i<exception table length; i++) exceptiontable[i = new exception table; exception_table[i].start pc in.readChar(); exception table i.end pc = in.readCharo; exceptiontable[i].handler_pc = in.readChar; exception table[i].catchtype = in.readChar(; attributes count = in.readChar(); attributes = new attribute info[attributes count]; for (i=0; i<attributes count; i++){ in.mark(2); String s = cf.constant pool[in.readChar()].toString(); 35 WO 2005/103928 PCT/AU2005/000582 in.reset(); if (s.equals ("LineNumberTable")) attributes[i] = new LineNumberTableattribute(cf, in); else if (s.equals("LocalVariableTable")) attributes[i] = new LocalVariableTable attribute(cf, in); else attributes[i] = new attributeinfo.Unknown(cf, in); /** Used during output serialization by ClassFile only. void serialize(DataOutputStream out) throws IOException{ attributelength = 12 + codelength + (exception_tablelength * 8); for (int i=O; i<attributes count; i++) attribute length += attributes[i].attribute length + 6; super.serialize(out); out.writeChar(maxstack); out.writeChar(max locals); out.writelnt(code length); for (int i=O, pos=0; pos<code_length; i++){ out.write(code[i], 0, code[i].length); pos += code[i].Iength; out.writeChar(exception tablelength); for (nt i=0; i<exceptiontablelength; i++){ out.writeChar(exception table[i].start_pc); out.writeChar(exception table[i].endpc); out.writeChar(exceptiontable[i].handler pc); out.writeChar(exceptiontable[i].catchtype); out.writeChar(attributes count); for (int i=0; i<attributes count; i++) attributes[i].serialize(out); A15. CONSTANTClassinfo.java Convience class for representing CONSTANTClassinfo structures within ClassFiles. import java.lang.*; import java.io.*; /** Class subtype of a constant pool entry. */ public final class CONSTANTClassinfo extends cp_info{ /** The index to the name of this class. */ public int name-index = 0; /** Convenience constructor. public CONSTANT Class info(int index) tag = 7; name index = index; /** Used during input serialization by ClassFile only. */ CONSTANT Classinfo(ClassFile cf, DatalnputStream in) throws IOException{ super(cf, in); if (tag != 7) 36 WO 2005/103928 PCT/AU2005/000582 throw new ClassFormatErroro; nameindex = in.readChar(; /** Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ out.writeByte(tag); out.writeChar(name index); A16. CONSTANTDouble info.java Convience class for representing CONSTANT_Double info structures within ClassFiles. import java.lang.*; import java.io.*; /** Double subtype of a constant pool entry. */ public final class CONSTANTDouble info extends cp_info{ /** The actual value. */ public double bytes; public CONSTANT_Doubleinfo(double d){ tag = 6; bytes = d; /* Used during input serialization by ClassFile only. */ CONSTANTDoubleinfo(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); if (tag != 6) throw new ClassFormatError(; bytes = in.readDouble(); /** Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ out.writeByte(tag); out.writeDouble(bytes); long 1 = Double.doubleToLongBits(bytes); A17. CONSTANTFieldref info.java Convience class for representing CONSTANTFieldrefinfo structures within ClassFiles. import java.lang.*; import java.io.*; /* Fieldref subtype of a constant pool entry. */ public final class CONSTANTFieldref_info extends cp_info{ /** The index to the class that this field is referencing to. */ public int class-index; 37 WO 2005/103928 PCT/AU2005/000582 /** The name and type index this field if referencing to. */ public int name and typeindex; /** Convenience constructor. */ public CONSTANTFieldref info(int class-index, int nameandtype_index) tag = 9; this.class index = class index; this.name and type index = name and type index; /* Used during input serialization by ClassFile only. */ CONSTANT Fieldref info(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); if (tag != 9) throw new ClassFormatErroro; class-index = in.readChar(; name_andtype_index = in.readChar(; /** Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ out.writeByte(tag); out.writeChar(class index); out.writeChar(name andtypeindex); A18. CONSTANTFloatinfo.java Convience class for representing CONSTANTFloat info structures within ClassFiles. import java.lang.*; import java.io.*; /** Float subtype of a constant pool entry. */ public final class CONSTANTFloat info extends cp_info{ /** The actual value. */ public float bytes; public CONSTANTFloat info(float f){ tag = 4; bytes = f; /** Used during input serialization by ClassFile only. */ CONSTANT Floatinfo(ClassFile cf, DatalnputStream in) throws IOException{ super(cf, in); if (tag != 4) throw new ClassFormatError(; bytes = in.readFloat(; /* Used during output serialization by ClassFile only. */ public void serialize(DataOutputStream out) throws IOException{ out.writeByte(4); out.writeFloat(bytes); 38 WO 2005/103928 PCT/AU2005/000582 } A19. CONSTANTInteger info.java Convience class for representing CONSTANTInteger info structures within ClassFiles. import java.lang.*; import java.io.*; /** Integer subtype of a constant pool entry. */ public final class CONSTANT Integer info extends cp_info{ /** The actual value. */ public int bytes; public CONSTANTIntegerinfo (int b) tag = 3; bytes = b; /** Used during input serialization by ClassFile only. */ CONSTANT Integerinfo(ClassFile of, DataInputStream in) throws IOException{ super(cf, in); if (tag != 3) throw new ClassFormatErroro; bytes = in.readInt(; /** Used during output serialization by ClassFile only. */ public void serialize(DataOutputStream out) throws IOException{ out.writeByte(tag); out.writelnt(bytes); A20. CONSTANTInterfaceMethodref info.java Convience class for representing CONSTANTInterfaceMethodref info structures within ClassFiles. import java.lang.*; import java.io.*; / InterfaceMethodref subtype of a constant pool entry. */ public final class CONSTANTInterfaceMethodref info extends cp_info{ /** The index to the class that this field is referencing to. */ public int classindex; /** The name and type index this field if referencing to. */ public int nameandtype_index; public CONSTANTInterfaceMethodref info(int class index, int nameand typeindex) { tag = 11; this.classindex = class-index; this.name and typeindex = name_andtypeindex; 39 WO 2005/103928 PCT/AU2005/000582 /* Used during input serialization by ClassFile only. */ CONSTANTInterfaceMethodrefinfo(ClassFile cf, DataInputStream in) throws .IOException{ super(cf, in); if (tag 1= 11) throw new ClassFormatErroro; classindex = in.readChar(); nameandtypeindex = in.readChar(; /* Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ out.writeByte(tag); out.writeChar(class index); out.writeChar(name and type_index); A21. CONSTANT Longinfo.java Convience class for representing CONSTANTLong info structures within ClassFiles. import java.lang.*; import java.io.*; /** Long subtype of a constant pool entry. */ public final class CONSTANTLonginfo extends cp_info /** The actual value. */ public long bytes; public CONSTANT Long info(long b){ tag = 5; bytes = b; /** Used during input serialization by ClassFile only. */ CONSTANT Long_info(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); if (tag != 5) throw new ClassFormatError(); bytes = in.readLong(; /** Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ out.writeByte(tag); out.writeLong(bytes); } A22. CONSTANT Methodref info.java Convience class for representing CONSTANTMethodrefinfo structures within ClassFiles. 40 WO 2005/103928 PCT/AU2005/000582 import java.lang.*; import java.io.*; /** Methodref subtype of a constant pool entry. public final class CONSTANTMethodrefinfo extends cpinfo{ /** The index to the class that this field is referencing to. */ public int class-index; /** The name and type index this field if referencing to. */ public int name andtypeindex; public CONSTANTMethodrefinfo(int class-index, int nameand typeindex) tag = 10; this.classindex = classindex; this.name and-type-index = name and-typeindex; /* Used during input serialization by ClassFile only. */ CONSTANTMethodrefinfo(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); if (tag != 10) throw new ClassFormatErroro; class-index = in.readChar(); nameand typeindex = in.readChar(; /** Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ out.writeByte(tag); out.writeChar(class index); out.writeChar(nameandtype_index); A23. CONSTANTNameAndType-info.java Convience class for representing CONSTANTNameAndType info structures within ClassFiles. import java.io.*; import java.lang.*; /* NameAndType subtype of a constant pool entry. public final class CONSTANTNameAndTypeinfo extends cp_info( /** The index to the Utf8 that contains the name. public int nameindex; /** The index fo the Utf8 that constains the signature. */ public int descriptorindex; public CONSTANTNameAndTypeinfo(int name-index, int descriptor index) { tag = 12; this.name index = name index; this.descriptor index = descriptorindex; 41 WO 2005/103928 -PCT/AU2005/000582 /** Used during input serialization by ClassFile only. */ CONSTANTNameAndTypeinfo(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); if (tag ! 12) throw new ClassFormatError(; name-index = in.readCharo; descriptorindex = in.readChar(); /** Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ out.writeByte(tag); out.writeChar(name index); out.writeChar(descriptorindex); A24. CONSTANT Stringinfo.java Convience class for representing CONSTANTStringinfo structures within ClassFiles. import java.lang.*; import java.io.*; / String subtype of a constant pool entry. */ public final class CONSTANTString_info extends cp info{ /** The index to the actual value of the string. */ public int stringindex; public CONSTANTStringinfo(int value) { tag = 8; string_index = value; / ONLY TO BE USED BY CLASSFILE! */ public CONSTANTStringinfo(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); if (tag != 8) throw new ClassFormatError(); stringindex = in.readChar(; /** Output serialization, ONLY TO BE USED BY CLASSFILE! */ public void serialize(DataOutputStream out) throws IOException{ out.writeByte(tag); out.writeChar(stringindex); A25. CONSTANTUtf8_info.java Convience class for representing CONSTANTUtfSinfo structures within ClassFiles. 42 WO 2005/103928 PCT/AU2005/000582 import java.io.*; import java.lang.*; / Utf8 subtype of a constant pool entry. * We internally represent the Utf8 info byte array * as a String. public final class CONSTANTUtf8_info extends cpinfo{ /** Length of the byte array. */ public int length; /** The actual bytes, represented by a String. */ public String bytes; /** This constructor should be used for the purpose * of part creation. It does not set the parent * ClassFile reference. */ public CONSTANTUtf8_info(String s) tag = 1; length = s.length(; bytes s; /** Used during input serialization by ClassFile only. */ public CONSTANT Utf8 8info(ClassFile cf, DataInputStream in) throws IDException{ super(cf, in); if (tag != 1) throw new ClassFormatError(); length = in.readCharo; byte[] b = new byte[length]; in.read(b, 0, length); // WARNING: String constructor is deprecated. bytes = new String(b, 0, length); /** Used during output serialization by ClassFile only. */ public void serialize(DataOutputStream out) throws IOException{ out.writeByte(tag); out.writeChar(length); // WARNING: Handling of String coversion here might be problematic. out.writeBytes(bytes); public String toString(){ return bytes; A26. ConstantValueattribute.java Convience class for representing ConstantValueattribute structures within ClassFiles. import java.lang.*; import java.io.*; 43 WO 2005/103928 PCT/AU2005/000582 / Attribute that allows for initialization of static variables in * classes. This attribute will only reside in a field info struct. public final class ConstantValueattribute extends attribute info{ public int constantvalue index; public ConstantValueattribute(ClassFile cf, int ani, int al, int cvi){ super(cf); attribute name index = ani; attribute-length = al; constantvalue index = cvi; public ConstantValueattribute(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); constantvalue index = in.readCharo; public void serialize(DataOutputStream out) throws IOExceptionf attributelength = 2; super.serialize(out); out.writeChar(constantvalue index); A27. cp info.java Convience class for representing cp info structures within ClassFiles. import java.lang.*; import java.io.*; /** Represents the common interface of all constant pool parts * that all specific constant pool items must inherit from. * */ public abstract class cp info{ /** The type tag that signifies what kind of constant pool * item it is */ public int tag; /** Used for serialization of the object back into a bytestream. */ abstract void serialize(DataOutputStream out) throws IOException; /** Default constructor. Simply does nothing. */ public cp-info() {} /* Constructor simply takes in the ClassFile as a reference to * it's parent */ public cp info(ClassFile cf) {} /** Used during input serialization by ClassFile only. */ cp_info(ClassFile cf, DataInputStream in) throws IOException{ tag = in.readUnsignedByte(; 44 WO 2005/103928 PCT/AU2005/000582 A28. Deprecatedattribute.java Convience class for representing Deprecatedattribute structures within ClassFiles. import java.lang.*; import java.io.*; / A fix attributed that can be located either in the ClassFile, * field info or the methodinfo attribute. Mark deprecated to * indicate that the method, class or field has been superceded. public final class Deprecated-attribute extends attribute-info{ public Deprecated_attribute(ClassFile cf, int ani, int al){ super (cf); attribute name-index = ani; attribute-length = al; /** Used during input serialization by ClassFile only. */ Deprecatedattribute (ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); A29. Exceptionsattribute.java Convience class for representing Exceptions-attribute structures within ClassFiles. import java.lang.*; import java.io.*; /** This is the struct where the exceptions table are located. * <br><br> * This attribute can only appear once in a method info struct. public final class Exceptionsattribute extends attribute-info{ public int numberofexceptions; public int[] exception index table; public Exceptionsattribute(ClassFile cf, int ani, int al, int noe, int[] eit){ super(cf); attribute name index = ani; attribute length = al; numberof exceptions = noe; exception index table = eit; /** Used during input serialization by ClassFile only. */ Exceptions attribute(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); number-ofexceptions = in.readChar(; exception index table = new int[number of exceptions]; for (int i=0; i<number ofexceptions; i++) exceptionindextable[ij = in.readchar(); /** Used during output serialization by ClassFile only. */ public void serialize(DataoutputStream out) throws IOException{ 45 WO 2005/103928 PCT/AU2005/000582 attribute length = 2 + (number of exceptions*2); super.serialize(out); out.writeChar(number of exceptions); for (int i=O; i<numberofexceptions; i++) out.writeChar(exception index table[i]); A30. field info.java Convience class for representing field-info structures within ClassFiles. import java.lang.*; import java.io.*; /** Represents the field info structure as specified in the JVM specification. */ public final class field info{ public int accessflags; public int nameindex; public int descriptorindex; public int attributes count; public attribute-info[] attributes; /** Convenience constructor. */ public fieldinfo(ClassFile cf, int flags, int ni, int di){ access flags = flags; name index = ni; descriptor index = di; attributes count = 0; attributes = new attribute info[O]; /** Constructor called only during the serialization process. * <br><br> * This is intentionally left as package protected as we * should not normally call this constructor directly. * <br><br> * Warning: the handling of len is not correct (after String s =...) */ field info(ClassFile cf, DataInputStream in) throws IOException( access-flags = in.readChar(; name-index = in.readChar(; descriptor_index = in.readChar(; attributes count = in.readChar(; attributes = new attribute info[attributes count]; for (int i=O; i<attributes_count; i++){ in.mark(2); String s = cf.constant_pool[in.readCharo].toString(; in.reset(); if (s.equals ("ConstantValue")) attributes[i] = new ConstantValue attribute(cf, in); else if (s.equals("Synthetic")) attributes[i] = new Synthetic_attribute(cf, in); else if (s.equals("Deprecated")) attributes[i] = new Deprecatedattribute(cf, in); else attributes[i] = new attributeinfo.Unknown(cf, in); /* To serialize the contents into the output format. 46 WO 2005/103928 PCT/AU2005/000582 public void serialize(DataOutputStream out) throws IOException{ out.writeChar(accessflags); out.writeChar(name index); out.writeChar(descriptorindex); out.writeChar(attributes count); for (int i=O; i<attributescount; i++) attributes[i].serialize(out); A31. InnerClassesattribute.java Convience class for representing InnerClassesattribute structures within ClassFiles. import java.lang.*; import java.io.*; /I* A variable length structure that contains information about an * inner class of this class. public final class InnerClassesattribute extends attribute info{ public int numberof classes; public classes[] classes; public final static class classes{ int inner class info index; int outer-class info-index; int inner name index; int innerclassaccess_flags; public InnerClassesattribute(ClassFile cf, int ani, int al, int noc, classes[] c){ super(cf); attribute name index = ani; attributelength al; number of classes = noc; classes = c; /** Used during input serialization by ClassFile only. */ InnerClassesattribute(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); number ofclasses = in.readChar(; classes = new InnerClasses attribute.classes[number of-classes]; for (int i=O; i<number of classes; i++){ classes[i] = new classes; classes[i].inner class info index = in.readChar(); classes[i].outer class info index = in.readCharo; classes[i].inner name index = in.readChar(; classes[i].innerclass_access_flags = in.readCharo; /* Used during output serialization by ClassFile only. */ public void serialize(DataOutputStream out) throws IOException{ attributelength = 2 + (number of classes * 8); super.serialize(out); out.writeChar(number of classes); for (int i=O; i<number of classes; i++){ out.writeChar(classes[i].innerclass info-index); out.writeChar(classes[i].outerclass info index); 47 WO 2005/103928 PCT/AU2005/000582 out.writeChar(classes[i].inner name index); out.writeChar(classes[i].inner class_accessflags); A32. LineNumberTableattribute.java Convience class for representing LineNumberTable attribute structures within ClassFiles. import java.lang.*; import java.io.*; /** Determines which line of the binary code relates to the * corresponding source code. *k/ public final class LineNumberTableattribute extends attribute info{ public int line numbertable length; public linenumbertable[] linenumbertable; public final static class linenumbertable{ int startpc; int line-number; public LineNumberTable attribute (ClassFile cf, int ani, int al, int lntl, linenumbertable[] lnt){ super(cf); attribute name index = ani; attribute length = al; linenumbertablelength = lntl; line number table = lnt; /** Used during input serialization by ClassFile only. */ LineNumberTableattribute (ClassFile cf, DatalnputStream in) throws IOException{ super(cf, in); linenumber table_length = in.readChar(; line number table = new LineNumberTableattribute.linenumbertable[linenumbertable_length}; for (int i=0; i<line_numbertable_length; i++){ line number table[i] = new line number table(; linenumber table[i].startpc = in.readChar(); line number table[i].linenumber = in.readChar(; /** Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ attributelength = 2 + (linenumbertablelength * 4); super.serialize(out); out.writeChar(linenumbertable_length); for (int i=0; i<linenumbertable_length; i++){ out.writeChar(line_numbertable[i].start_pc); out.writeChar(line number table[i].line number); 48 WO 2005/103928 PCT/AU2005/000582 A33. LocalVariableTable attribute.java Convience class for representing LocalVariableTableattribute structures within ClassFiles. import java.lang.*; import java.ic.*; /** Used by debugger to find out how the source file line number is linked to the binary code. It has many to one correspondence and is found in the Code-attribute. */ public final class LocalVariableTable attribute extends attribute-info( public int localvariabletable-length; public local variabletable[] localvariable table; public final static class local variabletable{ int start_pc; int length; int name-index; int descriptorindex; int index; public LocalVariableTableattribute(ClassFile cf, int ani, int al, int lvtl, local variable table[] lvt){ super(cf); attribute name index = ani; attribute-length = al; local variable table length = lvtl; local variable table = lvt; } /** Used during input serialization by ClassFile only. */ LocalVariableTable attribute(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); local variable table length = in.readChar(; local variable table = new LocalVariableTable attribute.local variabletable[local variabletablelengt h) ; for (int i=0; i<local variable_tablelength; i++)i local variable table[i] = new localvariable table; local variable table[i].start-pc = in.readCharO; local variable table[i].length in.readChar); local variable table[i].name_index in.readCharo; local variable -table[i.descriptor_index = in.readChar(; local variable table[i].index = in.readChar(; /** Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ attribute_length = 2 + (localvariabletable_length * 10); super.serialize(out); out.writeChar(local variabletable length); for (int i=0; i<local_variable_table_length; i++){ out.writeChar(localvariabletable[i].start_pc); out.writeChar(local variable table i].length); out.writeChar(local variable table[i].name_index); out.writeChar(local variabletable[i].descriptorLindex); out.writeChar(local variabletable[i].index); 49 WO 2005/103928 PCT/AU2005/000582 A34. methodinfo.java Convience class for representing methodinfo structures within ClassFiles. import java.lang.*; import java.io.*; /** This follows the method-info in the JVM specification. public final class method info public int accessflags; public int name index; public int descriptor index; public int attributes count; public attribute info[] attributes; /** Constructor. Creates a method info, initializes it with * the flags set, and the name and descriptor indexes given. * A new uninitialized code attribute is also created, and stored * in the <i>code</i> variable.*/ public methodinfo(ClassFile cf, int flags, int ni, int di, int ac, attribute info[] a) access_flags = flags; name index = ni; descriptorindex = di; attributes count ac; attributes = a; /** This method creates a methodinfo from the current pointer in the * data stream. Only called by during the serialization of a complete * ClassFile from a bytestream, not normally invoked directly. method info(ClassFile cf, DataInputStream in) throws IOException{ access_flags = in.readChar(; name index = in.readChar(; descriptor index = in.readChar(; attributescount = in.readChar(; attributes = new attribute info[attributes count]; for (int i=O; i<attributes count; i++){ in.mark(2); String s = cf.constantpoollin.readChar()] .toString(; in.reset(); if (s.equals ("Code")) attributes(i] = new Code attribute(cf, in); else if (s.equals("Exceptions")) attributes[il = new Exceptions_attribute(cf, in); else if (s.equals("Synthetic")) attributes[il = new Synthetic_attribute(cf, in); else if (s.equals("Deprecated")) attributes[i) = new Deprecated attribute(cf, in); else attributes[i) = new attributeinfo.Unknown(cf, in); /* Output serialization of the methodinfo to a byte array. * Not normally invoked directly. public void serialize(DataOutputStream out) throws IOException{ 50 WO 2005/103928 PCT/AU2005/000582 out.writeChar(accessflags); out.writeChar(name index); out.writeChar(descriptorindex); out.writeChar(attributes count); for (int i=0; i<attributescount; i++) attributes[i].serialize(out); A35. SourceFileattribute.java Convience class for representing SourceFileattribute structures within ClassFiles. import java.lang.*; import java.io.*; /** A SourceFile attribute is an optional fixed length attribute in * the attributes table. Only located in the ClassFile struct only - once. public final class SourceFile attribute extends attribute info{ public int sourcefile index; public SourceFileattribute(ClassFile cf, int ani, int al, int sfi){ super (cf); attribute name-index = ani; attribute length = al; sourcefile index = sfi; /* Used during input serialization by ClassFile only. */ SourceFile attribute(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); sourcefile index = in.readChar(); /** Used during output serialization by ClassFile only. */ void serialize(DataOutputStream out) throws IOException{ attribute length = 2; super.serialize(out); out.writeChar(sourcefile index); A36. Synthetic attribute.java Convience class for representing Syntheticattribute structures within ClassFiles. import java.lang.*; import java.io.*; /** A synthetic attribute indicates that this class does not have * a generated code source. It is likely to imply that the code * is generated by machine means rather than coded directly. This * attribute can appear in the classfile, methodinfo or field-info. * It is fixed length. public final class Syntheticattribute extends attributeinfo{ public Synthetic attribute(ClassFile cf, int ani, int al){ super(cf); 51 WO 2005/103928 PCT/AU2005/000582 attribute name index = ani; attributelength = al; / Used during output serialization by ClassFile only. */ Syntheticattribute(ClassFile cf, DataInputStream in) throws IOException{ super(cf, in); 52

Claims (29)

1. A multiple computer system having at least one application program running simultaneously on a plurality of computers interconnected by a communications network, wherein a like plurality of substantially identical objects are created, each in the corresponding computer.
2. The system as claimed in claim I wherein each of said plurality of substantially identical objects has a substantially identical name.
3. The system as claimed in claim 2 wherein each said computer includes a distributed run time means with the distributed run time means of each said computer able to communicate with all other computers whereby if a portion of said application program(s) running on one of said computers changes the contents of an object in that computer then the change in content for said object is propagated by the distributed run time means of said one computer to all other computers to change the content of the corresponding object in each of said other computers.
4. The system as claimed in claim 3 wherein each said application program is modified before, during, or after loading by inserting an updating propagation routine to modify each instance at which said application program writes to memory, said updating propagation routine propagating every memory write by one computer to all said other computers.
5. The system as claimed in claim 4 wherein the application program is modified in accordance with a procedure selected from the group of procedures consisting of re-compilation at loading, pre-compilation prior to loading, compilation prior to loading, just-in-time compilation, and re-compilation after loading and before execution of the relevant portion of application program.
6. The system as claimed in claim 3 wherein said modified application program is transferred to all said computers in accordance with a procedure selected from the group consisting of master/slave transfer, branched transfer and cascaded transfer. 53 WO 2005/103928 -PCT/AU2005/000582
7. A plurality of computers interconnected via a communications link and operating at least one application program simultaneously.
8. The plurality of computers as claimed in claim 7 wherein each said computer in operating said at least one application program reads and writes only to local memory physically located in each said computer, the contents of the local memory utilized by each said computer is fundamentally similar but not, at each instant, identical, and every one of said computers has distribution update means to distribute to all other said computers the value of any memory location updated by said one computer.
9. The plurality of computers as claimed in claim 8 wherein the local memory capacity allocated to the or each said application program is substantially identical and the total memory capacity available to the or each said application program is said allocated memory capacity.
10. The plurality of computers as claimed in claim 8 wherein all said distribution update means communicate via said communications link at a data transfer rate which is substantially less than the local memory read rate.
11. The plurality of computers as claimed in claim 7 wherein at least some of said computers are manufactured by different manufacturers and/or have different operating systems.
12. A method of running at least one application program on a plurality of computers simultaneously, said computers being interconnected by means of a communications network, said method comprising the step of, (i) creating a like plurality of substantially identical objects each in the corresponding computer.
13. The method as claimed in claim 12 comprising the further step of, (ii) naming each of said plurality of substantially identical objects with a substantially identical name.
14. The method as claimed in claim 13 comprising the further step of, (iii) if a portion of said application program running on one of said 54 WO 2005/103928 PCT/AU2005/000582 computers changes the contents of an object in that computer, then the change in content of said object is propagated to all of the other computers via said communications network to change the content of the corresponding object in each of said other computers.
15. The method as claimed in claim 14 including the further step of: (iv) modifying said application program before, during or after loading by inserting an updating propagation routine to modify each instance at which said application program writes to memory, said updating propagation routine propagating every memory write by one computer to all said other computers.
16. The method as claimed in claim 15 including the further step of: (v) modifying said application program utilizing a procedure selected from the group of procedures consisting of re-compilation at loading, pre compilation prior to loading, compilation prior to loading, just-in-time compilation, and re-compilation after loading and before execution of the relevant portion of application program.
17. The method as claimed in claim 14 including the further step of: (vi) transferring the modified application program to all said computers utilizing a procedure selected from the group consisting of master/slave transfer, branched transfer and cascaded transfer.
18. A method of loading an application program onto each of a plurality of computers, the computers being interconnected via a communications link, the method comprising the step of modifying the application before, during, or after loading and before execution of the relevant portion of the application program.
19. The method as claimed in claim 18 wherein the modification of the application is different for different computers.
20. The method as claimed in claim 18 wherein said modifying step comprises: (i) detecting instructions which share memory records utilizing one of said computers, (ii) listing all such shared memory records and providing a naming tag for 55 WO 2005/103928 PCT/AU2005/000582 each listed memory record, (iii) detecting those instructions which write to, or manipulate the contents of, any of said listed memory records, and (iv) generating an updating propagation routine corresponding to each said detected write or manipulate instruction, said updating propagation routine forwarding the re-written or manipulated contents and name tag of each said re-written or manipulated listed memory record to all of the others of said computers.
21. A method of operating at least one application program simultaneously on a plurality of computers all interconnected via a communications link and each having at least a minimum predetermined local memory capacity, said method comprising the steps of: (i) initially providing each local memory in substantially identical condition, (ii) satisfying all memory reads and writes generated by said application program from said local memory, and (iii) communicating via said communications link all said memory writes at each said computer which take place locally to all the remainder of said plurality of computers whereby the contents of the local memory utilised by each said computer, subject to an updating data transmission delay, remains substantially identical.
22. The method as claimed in claim 21 including the further step of: (iv) communicating said local memory writes constituting an updating data transmission at a data transfer rate which is substantially less than the local memory read rate.
23. A method of compiling or modifying an application program to run simultaneously on a plurality of computers interconnected via a communications link, said method comprising the steps of: (i) detecting instructions which share memory records utilizing one of said computers, (ii) listing all such shared memory records and providing a naming tag for 56 WO 2005/103928 PCT/AU2005/000582 each listed memory record, (iii) detecting those instructions which write to, or manipulate the contents of, any of said listed memory records, and (iv) activating an updating propagation routine following each said detected write or manipulate instruction, said updating propagation routine forwarding the re-written or manipulated contents and name tag of each said re-written or manipulated listed memory record to the remainder of said computers.
24. The method as claimed in claim 23 and carried out prior to loading the application program onto each said computer, or during loading of the application program onto each said computer, or after loading of the application program onto each said computer and before execution of the relevant portion of the application program.
25. In a multiple thread processing computer operation in which individual threads of a single application program are simultaneously being processed each on a corresponding one of a plurality of computers interconnected via a communications link, the improvement comprising communicating changes in the contents of local memory physically associated with the computer processing each thread to the local memory of each other said computer via said communications link.
26. The improvement as claimed in claim 25 wherein changes to the memory associated with one said thread are communicated by the computer of said one thread to all other said computers.
27. The improvement as claimed in claim 25 wherein changes to the memory associated with one said thread are transmitted to the computer associated with another said thread and are transmitted thereby to all said other computers.
28. A computer program product comprising a set of program instructions stored in a storage medium and operable to permit a plurality of computers to carry out the method as claimed in claim 12 or 18 or 21 or 23. 57 WO 2005/103928 PCT/AU2005/000582
29. A plurality of computers interconnected via a communication network and operable to run an application program running simultaneously on said computers, said computers being programmed to carry out the method as claimed in claim 12 or 18 or 21 or 23 or being loaded with the computer program product as claimed in claim 28. 58
AU2005236089A 2004-04-22 2005-04-22 Multiple computer architecture with replicated memory fields Ceased AU2005236089B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
AU2005236089A AU2005236089B2 (en) 2004-04-22 2005-04-22 Multiple computer architecture with replicated memory fields

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
AU2004902146A AU2004902146A0 (en) 2004-04-22 Modified Computer Architecture
AU2004902146 2004-04-22
PCT/AU2005/000582 WO2005103928A1 (en) 2004-04-22 2005-04-22 Multiple computer architecture with replicated memory fields
AU2005236089A AU2005236089B2 (en) 2004-04-22 2005-04-22 Multiple computer architecture with replicated memory fields

Publications (2)

Publication Number Publication Date
AU2005236089A1 true AU2005236089A1 (en) 2005-11-03
AU2005236089B2 AU2005236089B2 (en) 2007-02-15

Family

ID=36950990

Family Applications (1)

Application Number Title Priority Date Filing Date
AU2005236089A Ceased AU2005236089B2 (en) 2004-04-22 2005-04-22 Multiple computer architecture with replicated memory fields

Country Status (1)

Country Link
AU (1) AU2005236089B2 (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2691559B1 (en) * 1992-05-25 1997-01-03 Cegelec REPLICATIVE OBJECT SOFTWARE SYSTEM USING DYNAMIC MESSAGING, IN PARTICULAR FOR REDUNDANT ARCHITECTURE CONTROL / CONTROL INSTALLATION.
GB2353113B (en) * 1999-08-11 2001-10-10 Sun Microsystems Inc Software fault tolerant computer system
US6560717B1 (en) * 1999-12-10 2003-05-06 Art Technology Group, Inc. Method and system for load balancing and management
WO2002044835A2 (en) * 2000-11-28 2002-06-06 Gingerich Gregory L A method and system for software and hardware multiplicity
WO2003083614A2 (en) * 2002-03-25 2003-10-09 Eternal Systems, Inc. Transparent consistent active replication of multithreaded application programs
US20040073828A1 (en) * 2002-08-30 2004-04-15 Vladimir Bronstein Transparent variable state mirroring

Also Published As

Publication number Publication date
AU2005236089B2 (en) 2007-02-15

Similar Documents

Publication Publication Date Title
EP1763774B1 (en) Multiple computer architecture with replicated memory fields
US20050262513A1 (en) Modified computer architecture with initialization of objects
US7860829B2 (en) Computer architecture and method of operation for multi-computer distributed processing with replicated memory
US7844665B2 (en) Modified computer architecture having coordinated deletion of corresponding replicated memory locations among plural computers
US20060095483A1 (en) Modified computer architecture with finalization of objects
US20060020913A1 (en) Multiple computer architecture with synchronization
US20050257219A1 (en) Multiple computer architecture with replicated memory fields
AU2005236089A1 (en) Multiple computer architecture with replicated memory fields
AU2005236088B2 (en) Modified computer architecture with finalization of objects
AU2005236085A1 (en) Modified computer architecture with initialization of objects
AU2005236087B2 (en) Modified computer architecture with coordinated objects
AU2005236086A1 (en) Multiple computer architecture with synchronization
AU2006238334A1 (en) Modified computer architecture for a computer to operate in a multiple computer system

Legal Events

Date Code Title Description
FGA Letters patent sealed or granted (standard patent)
MK14 Patent ceased section 143(a) (annual fees not paid) or expired