deep

a Cross Development Platform for Java

User Tools

Site Tools


dev:crosscompiler:strings

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
dev:crosscompiler:strings [2015/04/06 16:14] – [Erzeugung] ursgrafdev:crosscompiler:strings [2015/04/06 16:28] – [Erzeugung] ursgraf
Line 20: Line 20:
 The field //size// holds the number of bytes of the whole object. This is analogous to other objects (see [[dev:rts:heap|Heap Manager and Garbage Collection]]). It is used for an efficient sweep phase. The field //size// holds the number of bytes of the whole object. This is analogous to other objects (see [[dev:rts:heap|Heap Manager and Garbage Collection]]). It is used for an efficient sweep phase.
  
-===== Erzeugung =====+===== Creation =====
 The Bytecode for the creation of a string is The Bytecode for the creation of a string is
 <code> <code>
Line 44: Line 44:
   * initialize the string.   * initialize the string.
 Finally, the reference to the newly created string has to be put into the result register of the //sCnew// instruction.   Finally, the reference to the newly created string has to be put into the result register of the //sCnew// instruction.  
-===== Feldzugriffe ===== +===== Access to Fields ===== 
-Sobald auf Felder des Stringarrays zugegriffen werden sollmuss das im Codegenerator speziell berücksichtigt werdenEin solcher Zugriff hat in der SSA die Form+When accessing fields of a stringthe code generator has to modify the codeSuch an access shows up in the SSA as follows
 <code> <code>
 1: MonadicRef[sCloadFromField] {0} <value([C)> (Char-Array) 1: MonadicRef[sCloadFromField] {0} <value([C)> (Char-Array)
Line 51: Line 51:
 3: Dyadic[sCloadFromArray] {1, 2} (Char) 3: Dyadic[sCloadFromArray] {1, 2} (Char)
 </code> </code>
-Zuerst wird also das Feld //value// geladen. //value// ist eine ReferenzAnschliessend wird über die Referenz und ein Index auf das Array zugegriffenIm Codegenerator muss bei einer Instruktion //sCloadFromField// geprüft werden, ob auf das Feld //String.value// zugegriffen wirdFalls jawird dieser Zugriff weggelassen und der Offset von //value// gemerktBei der darauffolgenden Instruktion //sCloadFromArray// muss dieser Offset zum Index dazuaddiert werdenEbenfalls darf als Arrayreferenz nicht das //value// dienen, sondern die Referenz auf den String. \\ +The field //value// is loaded. //value// is a referenceWith this reference and an index into the array the proper character can be accessedThe code generator has to check for the instruction //sCloadFromField// if the field is  //String.value//If truethe fetching is ommited and the offset of //value// is storedWith the subsequent instruction //sCloadFromArray//, the offset must be added to the indexAt the same time one cannot use //value// as the array reference but must use the reference to the string. \\ 
-Analog muss auch das Schreiben auf die Stringzeichen angepasst werdenHier gibt es aber noch eine Besonderheit. Weil Strings immutable sindwerden nur beim Initialisieren in den Fabrikmethoden die Arrayfelder geschriebenDarum kann die Prüfung auf Arrayüberschreitung weggelassen werden.+Similarly, writing to a string must be customizedHoweverstrings in java are immutable. Writing to strings happens only in the factory methods during initializationChecking for array index out of bounds may be ommited as well.
  
 ===== Constant String ===== ===== Constant String =====
dev/crosscompiler/strings.txt · Last modified: 2016/02/25 13:33 by 127.0.0.1