bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
private synchronized void fireCursorChanged(int update) { int startRow = getRow(lastPos); int startCol = getCol(lastPos); if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(update,startRow,startCol,startRow,startCol); } } }
|
private synchronized void fireCursorChanged(int update) { int startRow = getRow(lastPos); int startCol = getCol(lastPos); if (listeners != null) { Vector lc = new Vector(listeners); int size = lc.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(update,startRow,startCol,startRow,startCol); } } }
| 3,579
|
private synchronized void fireCursorChanged(int update) { int startRow = getRow(lastPos); int startCol = getCol(lastPos); if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(update,startRow,startCol,startRow,startCol); } } }
|
private synchronized void fireCursorChanged(int update) { int startRow = getRow(lastPos); int startCol = getCol(lastPos); if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)lc.elementAt(i); target.onScreenChanged(update,startRow,startCol,startRow,startCol); } } }
| 3,580
|
private void fireScreenChanged(int which, int startRow, int startCol, int endRow, int endCol) { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(1,startRow,startCol,endRow,endCol); } } dirtyScreen.setBounds(lenScreen,0,0,0); }
|
private void fireScreenChanged(int which, int startRow, int startCol, int endRow, int endCol) { if (listeners != null) { Vector lc = new Vector(listeners); int size = lc.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(1,startRow,startCol,endRow,endCol); } } dirtyScreen.setBounds(lenScreen,0,0,0); }
| 3,581
|
private void fireScreenChanged(int which, int startRow, int startCol, int endRow, int endCol) { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(1,startRow,startCol,endRow,endCol); } } dirtyScreen.setBounds(lenScreen,0,0,0); }
|
private void fireScreenChanged(int which, int startRow, int startCol, int endRow, int endCol) { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenChanged(1,startRow,startCol,endRow,endCol); } } dirtyScreen.setBounds(lenScreen,0,0,0); }
| 3,582
|
private void fireScreenSizeChanged() { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenSizeChanged(numRows,numCols); } } }
|
private void fireScreenSizeChanged() { if (listeners != null) { Vector lc = new Vector(listeners); int size = lc.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenSizeChanged(numRows,numCols); } } }
| 3,583
|
private void fireScreenSizeChanged() { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)listeners.elementAt(i); target.onScreenSizeChanged(numRows,numCols); } } }
|
private void fireScreenSizeChanged() { if (listeners != null) { int size = listeners.size(); for (int i = 0; i < size; i++) { ScreenListener target = (ScreenListener)lc.elementAt(i); target.onScreenSizeChanged(numRows,numCols); } } }
| 3,584
|
public void toXMLOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { //while writing out, attribHash should not be changed synchronized (attribHash) { String nodeNameString = this.classXDFNodeName; // Setup. Sometimes the name of the node we are opening is different from // that specified in the classXDFNodeName (*sigh*) if (newNodeNameString != null) nodeNameString = newNodeNameString;/* // 0. To be valid XML, we always start an XML block with an // XML declaration (e.g. somehting like "<?xml standalone="no"?>"). // Here we deal with printing out XML Declaration && its attributes if ((XMLDeclAttribs !=null) &&(!XMLDeclAttribs.isEmpty())) { indent = ""; writeXMLDeclToOutputStream(outputstream, XMLDeclAttribs); }*/ // 1. open this node, print its simple XML attributes if (nodeNameString != null) { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // For printing the opening statement we need to invoke a little // Voodoo to keep the DTD happy: the first structure node is always // called by the root node name instead of the usual nodeNameString // We can tell this by checking if this object is derived from class // Structure and if XMLDeclAttrib defined/populated with information // NOTE: This isnt really the way to do this. We need to check if 'this' is // is or has as a superclass xdf.Structure instead of the 'string check' below. // check is class Strucuture & XMLDeclAttribs populated?/* if ( nodeNameString.equals(Specification.getInstance().getXDFStructureNodeName()) && !XMLDeclAttribs.isEmpty() ) nodeNameString = Specification.getInstance().getXDFRootNodeName();*/ writeOut(outputstream,"<" + nodeNameString); // print opening statement } // gather info about XMLAttributes in this object/node Hashtable xmlInfo = getXMLInfo(); // 2. Print out string object XML attributes EXCEPT for the one that // matches PCDATAAttribute. ArrayList attribs = (ArrayList) xmlInfo.get("attribList"); // is synchronized here correct? synchronized(attribs) { int size = attribs.size(); for (int i = 0; i < size; i++) { Hashtable item = (Hashtable) attribs.get(i); writeOut(outputstream, " " + item.get("name") + "=\""); // this slows things down, should we use? //writeOutAttribute(outputstream, (String) item.get("value")); writeOut(outputstream, (String) item.get("value")); writeOut(outputstream, "\"" ); } } // 3. Print out Node PCData or Child Nodes as specified by object ref // XML attributes. The way this stuff occurs will also affect how we // close the node. ArrayList childObjs = (ArrayList) xmlInfo.get("childObjList"); String pcdata = (String) xmlInfo.get("PCDATA"); if ( childObjs.size() > 0 || pcdata != null || noChildObjectNodeName != null) { // close the opening tag if (nodeNameString != null) { writeOut(outputstream, ">"); if ((Specification.getInstance().isPrettyXDFOutput()) && (pcdata == null)) writeOut(outputstream, Constants.NEW_LINE); } // deal with object/list XML attributes, if any in our list int size = childObjs.size(); for (int i = 0; i < size; i++) { Hashtable item = (Hashtable) childObjs.get(i); if (item.get("type") == Constants.LIST_TYPE) { List objectList = (List) item.get("value"); // Im not sure this synchronized wrapper is needed, we are // only accessing stuff here.. Also, should synchronzied wrapper // occur back in the getXMLInfo method instead where the orig // access occured?!? synchronized(objectList) { Iterator iter = objectList.iterator(); // Must be in synchronized block while (iter.hasNext()) { BaseObject containedObj = (BaseObject) iter.next(); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); indent = dealWithClosingGroupNodes(containedObj, outputstream, indent); String newindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); containedObj.toXMLOutputStream(outputstream, new Hashtable(), newindent); } } } } else if (item.get("type") == Constants.OBJECT_TYPE) { BaseObject containedObj = (BaseObject) item.get("value"); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) // shouldnt this be synchronized too?? synchronized(containedObj) { indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); indent = dealWithClosingGroupNodes(containedObj, outputstream, indent); String newindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); containedObj.toXMLOutputStream(outputstream, new Hashtable(), newindent); } } } else { // error: weird type, actually shouldnt occur. Is this needed?? Log.errorln("Weird error: unknown XML attribute type for item:"+item); } } // print out PCDATA, if any if(pcdata != null) { writeOut(outputstream, pcdata); }; // if there are no PCDATA or child objects/nodes then // we print out noChildObjectNodeName and close the node if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent + Specification.getInstance().getPrettyXDFOutputIndentation()); writeOut(outputstream, "<" + noChildObjectNodeName + "/>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); } // ok, now deal with closing the node if (nodeNameString != null) { indent = dealWithClosingGroupNodes((BaseObject) this, outputstream, indent); if (Specification.getInstance().isPrettyXDFOutput() && pcdata == null) writeOut(outputstream, indent); if (!dontCloseNode) writeOut(outputstream, "</"+nodeNameString+">"); } } else { if (nodeNameString != null) { if (dontCloseNode) { // it may not have sub-objects, but we dont want to close it // (happens for group objects) writeOut(outputstream, ">"); } else { // no sub-objects, just close this node writeOut(outputstream, "/>"); } } } if (Specification.getInstance().isPrettyXDFOutput() && nodeNameString != null) writeOut(outputstream, Constants.NEW_LINE); }//synchronize }
|
public void toXMLOutputStream ( OutputStream outputstream, Hashtable XMLDeclAttribs, String indent, boolean dontCloseNode, String newNodeNameString, String noChildObjectNodeName ) { //while writing out, attribHash should not be changed synchronized (attribHash) { String nodeNameString = this.classXDFNodeName; // Setup. Sometimes the name of the node we are opening is different from // that specified in the classXDFNodeName (*sigh*) if (newNodeNameString != null) nodeNameString = newNodeNameString;/* // 0. To be valid XML, we always start an XML block with an // XML declaration (e.g. somehting like "<?xml standalone="no"?>"). // Here we deal with printing out XML Declaration && its attributes if ((XMLDeclAttribs !=null) &&(!XMLDeclAttribs.isEmpty())) { indent = ""; writeXMLDeclToOutputStream(outputstream, XMLDeclAttribs); }*/ // 1. open this node, print its simple XML attributes if (nodeNameString != null) { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent); // indent node if desired // For printing the opening statement we need to invoke a little // Voodoo to keep the DTD happy: the first structure node is always // called by the root node name instead of the usual nodeNameString // We can tell this by checking if this object is derived from class // Structure and if XMLDeclAttrib defined/populated with information // NOTE: This isnt really the way to do this. We need to check if 'this' is // is or has as a superclass xdf.Structure instead of the 'string check' below. // check is class Strucuture & XMLDeclAttribs populated?/* if ( nodeNameString.equals(Specification.getInstance().getXDFStructureNodeName()) && !XMLDeclAttribs.isEmpty() ) nodeNameString = Specification.getInstance().getXDFRootNodeName();*/ writeOut(outputstream,"<" + nodeNameString); // print opening statement } // gather info about XMLAttributes in this object/node Hashtable xmlInfo = getXMLInfo(); // 2. Print out string object XML attributes EXCEPT for the one that // matches PCDATAAttribute. ArrayList attribs = (ArrayList) xmlInfo.get("attribList"); // is synchronized here correct? synchronized(attribs) { int size = attribs.size(); for (int i = 0; i < size; i++) { Hashtable item = (Hashtable) attribs.get(i); writeOut(outputstream, " " + item.get("name") + "=\""); // this slows things down, should we use? //writeOutAttribute(outputstream, (String) item.get("value")); writeOut(outputstream, (String) item.get("value")); writeOut(outputstream, "\"" ); } } // 3. Print out Node PCData or Child Nodes as specified by object ref // XML attributes. The way this stuff occurs will also affect how we // close the node. ArrayList childObjs = (ArrayList) xmlInfo.get("childObjList"); String pcdata = (String) xmlInfo.get("PCDATA"); if ( childObjs.size() > 0 || pcdata != null || noChildObjectNodeName != null) { // close the opening tag if (nodeNameString != null) { writeOut(outputstream, ">"); if ((Specification.getInstance().isPrettyXDFOutput()) && (pcdata == null)) writeOut(outputstream, Constants.NEW_LINE); } // deal with object/list XML attributes, if any in our list int size = childObjs.size(); for (int i = 0; i < size; i++) { Hashtable item = (Hashtable) childObjs.get(i); if (item.get("type") == Constants.LIST_TYPE) { List objectList = (List) item.get("value"); // Im not sure this synchronized wrapper is needed, we are // only accessing stuff here.. Also, should synchronzied wrapper // occur back in the getXMLInfo method instead where the orig // access occured?!? synchronized(objectList) { Iterator iter = objectList.iterator(); // Must be in synchronized block while (iter.hasNext()) { BaseObject containedObj = (BaseObject) iter.next(); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); String newindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); containedObj.toXMLOutputStream(outputstream, new Hashtable(), newindent); } } } } else if (item.get("type") == Constants.OBJECT_TYPE) { BaseObject containedObj = (BaseObject) item.get("value"); if (containedObj != null) { // can happen from pre-allocation of axis values, etc (?) // shouldnt this be synchronized too?? synchronized(containedObj) { indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); String newindent = indent + Specification.getInstance().getPrettyXDFOutputIndentation(); containedObj.toXMLOutputStream(outputstream, new Hashtable(), newindent); } } } else { // error: weird type, actually shouldnt occur. Is this needed?? Log.errorln("Weird error: unknown XML attribute type for item:"+item); } } // print out PCDATA, if any if(pcdata != null) { writeOut(outputstream, pcdata); }; // if there are no PCDATA or child objects/nodes then // we print out noChildObjectNodeName and close the node if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) { if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, indent + Specification.getInstance().getPrettyXDFOutputIndentation()); writeOut(outputstream, "<" + noChildObjectNodeName + "/>"); if (Specification.getInstance().isPrettyXDFOutput()) writeOut(outputstream, Constants.NEW_LINE); } // ok, now deal with closing the node if (nodeNameString != null) { indent = dealWithClosingGroupNodes((BaseObject) this, outputstream, indent); if (Specification.getInstance().isPrettyXDFOutput() && pcdata == null) writeOut(outputstream, indent); if (!dontCloseNode) writeOut(outputstream, "</"+nodeNameString+">"); } } else { if (nodeNameString != null) { if (dontCloseNode) { // it may not have sub-objects, but we dont want to close it // (happens for group objects) writeOut(outputstream, ">"); } else { // no sub-objects, just close this node writeOut(outputstream, "/>"); } } } if (Specification.getInstance().isPrettyXDFOutput() && nodeNameString != null) writeOut(outputstream, Constants.NEW_LINE); }//synchronize }
| 3,585
|
private static final void checkTag(int value_tag) { if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff) && value_tag != vt_NULL && value_tag != vt_INDIRECTION ) throw new MARSHAL("Invalid value record, unsupported header tag: " + value_tag ); }
|
private static final void checkTag(int value_tag) { if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff) && value_tag != vt_NULL && value_tag != vt_INDIRECTION ) throw new MARSHAL("Invalid value record, unsupported header tag: " + value_tag ); }
| 3,587
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
| 3,588
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
| 3,589
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
| 3,590
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
| 3,591
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput( (cdrBufInput) bout.create_input_stream(), input); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
| 3,592
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
|
private static Object read_instance(InputStream input, Object value, int value_tag, Object helper ) { try { if ((value_tag & vf_CHUNKING) != 0) { ByteArrayOutputStream bout = null; int n = -1; // Read all chunks. int chunk_size = input.read_long(); if (chunk_size < 0) throw new MARSHAL("Invalid first chunk size " + chunk_size); byte[] r = new byte[ chunk_size ]; while (chunk_size > 0) { if (r.length < chunk_size) r = new byte[ chunk_size + 256 ]; n = 0; reading: while (n < chunk_size) n += input.read(r, n, r.length - n); // Read the size of the next chunk. chunk_size = input.read_long(); // If the value is non negative, there is more than one chunk. // Accumulate chunks in the buffer. // The last chunk (or the only chunk, if only one chunk is // present) is not written in the buffer. It is stored in the // array r, avoiding unnecessary buffer operations. if (chunk_size > 0) { bout = new ByteArrayOutputStream(2 * chunk_size); bout.write(r, 0, chunk_size); } } if (bout != null) { // More than one chunk was present. // Add the last chunk. bout.write(r, 0, n); input = new noHeaderInput(bout.toByteArray()); } else { // Only one chunk was present. input = new noHeaderInput(r); } } else { if (input instanceof cdrBufInput) { // Highly probable case. input = new noHeaderInput(((cdrBufInput) input).buffer.getBuffer()); } else { cdrBufOutput bout = new cdrBufOutput(); int c; while ((c = input.read()) >= 0) bout.write((byte) c); input = new noHeaderInput(bout.buffer.toByteArray()); } } } catch (IOException ex) { MARSHAL m = new MARSHAL("Unable to read chunks"); m.initCause(ex); throw m; } // The user-defines io operations are implemented. if (value instanceof CustomMarshal) { CustomMarshal marsh = (CustomMarshal) value; try { marsh.unmarshal((DataInputStream) input); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else // The IDL-generated io operations are implemented. if (value instanceof Streamable) { ((Streamable) value)._read(input); } else if (helper instanceof BoxedValueHelper) value = ((BoxedValueHelper) helper).read_value(input); else if (helper instanceof ValueFactory) value = ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input); else // Stating the interfaces that the USER should use. throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue or CustomValue." ); // The negative end of state marker is expected from OMG standard. // If the chunking is used, this marker is already extracted. if ((value_tag & vf_CHUNKING) == 0) { int eor = input.read_long(); if (eor >= 0) throw new MARSHAL("End of state marker has an invalid value " + eor); } return value; }
| 3,593
|
public static void write(OutputStream output, Serializable value) { // Write null if this is a null value. if (value == null) output.write_long(vt_NULL); else write(output, value, ObjectCreator.toIDL(value.getClass().getName())); }
|
public static void write(OutputStream output, Serializable value) { // Write null if this is a null value. if (value == null) output.write_long(vt_NULL); else write(output, value, value.getClass()); }
| 3,594
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,595
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. gnuValueStream rout = null; gnuRuntime runtime = null; try { if (output instanceof gnuValueStream) { int position; rout = (gnuValueStream) output; runtime = rout.getRunTime(); if (runtime == null) { runtime = new gnuRuntime(null, value); rout.setRunTime(runtime); rout.getRunTime().objectWritten(value, position = rout.getPosition()); } else if (runtime.target == value) { if (!writeSelf(output, value)) throw new InternalError("Recursive helper call for " + value.getClass().getName()); return; } else { position = runtime.isWrittenAt(value); if (position >= 0) { output.write_long(vt_INDIRECTION); output.write_long(position - rout.getPosition()); return; } else { runtime.objectWritten(value, position = rout.getPosition()); } } } int value_tag = vt_VALUE_TAG; if (ids instanceof String) value_tag |= vf_ID; else if (ids instanceof String[]) value_tag |= vf_MULTIPLE_IDS | vf_ID; int chunkSizeLocation; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,596
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,597
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,598
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,599
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if ((value_tag & vf_MULTIPLE_IDS) != 0) write_string_array(output, (String[]) ids); else if ((value_tag & vf_ID) != 0) write_string(output, (String) ids); if (USE_CHUNKING) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,600
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { output.write_long(0x55555555); chunkSizeLocation = rout.getPosition() - INT_SIZE; } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,601
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. chunkSizeLocation = -1; writeValue(outObj, value, helper); if (USE_CHUNKING) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,602
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,603
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,604
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,605
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
|
private static void write_instance(OutputStream output, Serializable value, String id, Object helper ) { // This implementation always writes a single repository id. // It never writes multiple repository ids and currently does not use // a codebase. int value_tag = vt_VALUE_TAG | vf_ID; OutputStream outObj; cdrBufOutput out = null; if (USE_CHUNKING) { out = new cdrBufOutput(); out.setOrb(output.orb()); outObj = out; value_tag |= vf_CHUNKING; } else outObj = output; output.write_long(value_tag); output.write_string(id); if (helper instanceof BoxedValueHelper) { ((BoxedValueHelper) helper).write_value(outObj, value); } else // User defince write method is present. if (value instanceof CustomMarshal) { try { ((CustomMarshal) value).marshal((DataOutputStream) outObj); } catch (ClassCastException ex) { incorrect_plug_in(ex); } } else if (value instanceof Streamable) { ((Streamable) value)._write(outObj); } else { // Try to find helper via class loader. boolean ok = false; try { Class helperClass = Class.forName(ObjectCreator.toHelperName(id)); // It will be the helper for the encapsulated boxed value, not the // for the global boxed value type itself. Method write = helperClass.getMethod("write", new Class[] { org.omg.CORBA.portable.OutputStream.class, value.getClass() } ); write.invoke(null, new Object[] { outObj, value }); ok = true; } catch (Exception ex) { ok = false; } // Stating the interfaces that the USER should use. if (!ok) throw new MARSHAL("The " + value.getClass().getName() + " must implement either StreamableValue" + " or CustomValue." ); } if (USE_CHUNKING) { output.write_long(out.buffer.size()); try { out.buffer.writeTo(output); } catch (IOException ex) { MARSHAL m = new MARSHAL(); m.initCause(ex); throw m; } } // The end of record marker, required by OMG standard. output.write_long(-1); }
| 3,606
|
public static String[] read(InputStream input) { String[] value = new String[ input.read_long() ]; for (int i = 0; i < value.length; i++) value [ i ] = input.read_wstring(); return value; }
|
public static String[] read(InputStream input) { String[] value = new String[ input.read_long() ]; for (int i = 0; i < value.length; i++) value [ i ] = input.read_string(); return value; }
| 3,607
|
public Object clone() { SimpleAttributeSet s = new SimpleAttributeSet(); s.tab = (Hashtable) tab.clone(); return s; }
|
public Object clone() { SimpleAttributeSet s = new SimpleAttributeSet(); s.tab = (Hashtable) tab.clone(); return s; }
| 3,610
|
public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals(JScrollBar.MODEL_CHANGED_PROPERTY)) { ((BoundedRangeModel) e.getOldValue()).removeChangeListener(modelListener); scrollbar.getModel().addChangeListener(modelListener); getThumbBounds(); } else if (e.getPropertyName().equals(JScrollBar.ORIENTATION_CHANGED_PROPERTY)) { incrButton.removeMouseListener(buttonListener); decrButton.removeMouseListener(buttonListener); incrButton = createIncreaseButton(scrollbar.getOrientation()); decrButton = createDecreaseButton(scrollbar.getOrientation()); incrButton.addMouseListener(buttonListener); decrButton.addMouseListener(buttonListener); calculatePreferredSize(); layoutContainer(scrollbar); } layoutContainer(scrollbar); scrollbar.repaint(); }
|
public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals("model")) { ((BoundedRangeModel) e.getOldValue()).removeChangeListener(modelListener); scrollbar.getModel().addChangeListener(modelListener); getThumbBounds(); } else if (e.getPropertyName().equals(JScrollBar.ORIENTATION_CHANGED_PROPERTY)) { incrButton.removeMouseListener(buttonListener); decrButton.removeMouseListener(buttonListener); incrButton = createIncreaseButton(scrollbar.getOrientation()); decrButton = createDecreaseButton(scrollbar.getOrientation()); incrButton.addMouseListener(buttonListener); decrButton.addMouseListener(buttonListener); calculatePreferredSize(); layoutContainer(scrollbar); } layoutContainer(scrollbar); scrollbar.repaint(); }
| 3,611
|
public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals(JScrollBar.MODEL_CHANGED_PROPERTY)) { ((BoundedRangeModel) e.getOldValue()).removeChangeListener(modelListener); scrollbar.getModel().addChangeListener(modelListener); getThumbBounds(); } else if (e.getPropertyName().equals(JScrollBar.ORIENTATION_CHANGED_PROPERTY)) { incrButton.removeMouseListener(buttonListener); decrButton.removeMouseListener(buttonListener); incrButton = createIncreaseButton(scrollbar.getOrientation()); decrButton = createDecreaseButton(scrollbar.getOrientation()); incrButton.addMouseListener(buttonListener); decrButton.addMouseListener(buttonListener); calculatePreferredSize(); layoutContainer(scrollbar); } layoutContainer(scrollbar); scrollbar.repaint(); }
|
public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals(JScrollBar.MODEL_CHANGED_PROPERTY)) { ((BoundedRangeModel) e.getOldValue()).removeChangeListener(modelListener); scrollbar.getModel().addChangeListener(modelListener); getThumbBounds(); } else if (e.getPropertyName().equals("orientation")) { incrButton.removeMouseListener(buttonListener); decrButton.removeMouseListener(buttonListener); incrButton = createIncreaseButton(scrollbar.getOrientation()); decrButton = createDecreaseButton(scrollbar.getOrientation()); incrButton.addMouseListener(buttonListener); decrButton.addMouseListener(buttonListener); calculatePreferredSize(); layoutContainer(scrollbar); } layoutContainer(scrollbar); scrollbar.repaint(); }
| 3,612
|
private void getPCFile() { String workingDir = System.getProperty("user.dir"); MyFileChooser pcFileChooser = new MyFileChooser(workingDir); // set the file filters for the file chooser filter = getFilterByDescription(); pcFileChooser.addChoosableFileFilter(filter); int ret = pcFileChooser.showSaveDialog(this); // check to see if something was actually chosen if (ret == JFileChooser.APPROVE_OPTION) { File file = pcFileChooser.getSelectedFile(); filter = null; if (pcFileChooser.getFileFilter() instanceof XTFRFileFilter ) filter = (XTFRFileFilter)pcFileChooser.getFileFilter(); else filter = htmlFilter; localFile.setText(filter.setExtension(file)); } }
|
private void getPCFile() { String workingDir = System.getProperty("user.dir"); TN5250jFileChooser pcFileChooser = new TN5250jFileChooser(workingDir); // set the file filters for the file chooser filter = getFilterByDescription(); pcFileChooser.addChoosableFileFilter(filter); int ret = pcFileChooser.showSaveDialog(this); // check to see if something was actually chosen if (ret == JFileChooser.APPROVE_OPTION) { File file = pcFileChooser.getSelectedFile(); filter = null; if (pcFileChooser.getFileFilter() instanceof XTFRFileFilter ) filter = (XTFRFileFilter)pcFileChooser.getFileFilter(); else filter = htmlFilter; localFile.setText(filter.setExtension(file)); } }
| 3,613
|
protected Option(String longName, String description) { this.longName = longName; this.description = description; }
|
protected Option(char shortName, String description) { this.longName = longName; this.description = description; }
| 3,614
|
protected Option(String longName, String description) { this.longName = longName; this.description = description; }
|
protected Option(String longName, String description) { if (shortName == 0) throw new IllegalArgumentException("short name must not be \\0"); this.shortName = shortName; this.description = description; }
| 3,615
|
private VmAbstractHeap allocHeap(int size, boolean addToHeapList) { //Unsafe.debug("allocHeap"); final Address start = helper.allocateBlock(size); //final Address start = MemoryBlockManager.allocateBlock(size); if (start == null) { return null; } final Address end = Address.add(start, size); final int slotSize = Unsafe.getCurrentProcessor().getArchitecture().getReferenceSize(); final VmAbstractHeap heap = VmDefaultHeap.setupHeap(helper, start, defaultHeapClass, slotSize); heap.initialize(start, end, slotSize); if (addToHeapList) { firstHeap.append(heap); } return heap; }
|
private VmAbstractHeap allocHeap(int size, boolean addToHeapList) { //Unsafe.debug("allocHeap"); final Address start = helper.allocateBlock(size); //final Address start = MemoryBlockManager.allocateBlock(size); if (start == null) { return null; } final Address end = Address.add(start, size); final int slotSize = Unsafe.getCurrentProcessor().getArchitecture().getReferenceSize(); final VmAbstractHeap heap = VmDefaultHeap.setupHeap(helper, start, defaultHeapClass, slotSize); heap.initialize(start, end, slotSize); if (addToHeapList) { firstHeap.append(heap); } return heap; }
| 3,616
|
protected Object allocObject(VmClassType vmClass, int size) { // Make sure the class is initialized vmClass.initialize(); final int alignedSize = ObjectLayout.objectAlign(size); //final Monitor mon = heapMonitor; VmAbstractHeap heap = currentHeap; Object result = null; int oomCount = 0; if (gcActive) { Unsafe.debug("Using GC Heap sz"); Unsafe.debug(alignedSize); result = gcHeap.alloc(vmClass, alignedSize); if (result == null) { helper.die("Out of GC heap memory."); } } else { final Monitor m = heapMonitor; //final Monitor m = null; if (m != null) { m.enter(); } try { while (result == null) { // The current heap is full if (heap == null) { //Unsafe.debug("allocHeap in allocObject("); Unsafe.debug(alignedSize); //Unsafe.debug(") "); int newHeapSize = DEFAULT_HEAP_SIZE; if (size > newHeapSize) { // this is a BIG object, try to allocate a new heap // only for it newHeapSize = size; } if ((heap = allocHeap(newHeapSize, true)) == null) { lowOnMemory = true; // It was not possible to allocate another heap. // First try to GC, if we've done that before // in this allocation, then we're in real panic. if (oomCount == 0) { oomCount++; Unsafe.debug("<oom/>"); gcThread.trigger(true); heap = firstHeap; currentHeap = firstHeap; } else { Unsafe.debug("Out of memory in allocObject("); Unsafe.debug(size); Unsafe.debug(")"); throw OOME; //Unsafe.die(); } } else { //Unsafe.debug("AO.G"); // We successfully allocated a new heap, set it // to current, so we'll use it for the following // allocations. currentHeap = heap; } } result = heap.alloc(vmClass, alignedSize); if (result == null) { heap = heap.getNext(); } } vmClass.incInstanceCount(); lowOnMemory = false; // Allocated objects are initially black. helper.unsafeSetObjectFlags(result, ObjectFlags.GC_DEFAULT_COLOR); allocatedSinceGcTrigger += alignedSize; if ((allocatedSinceGcTrigger > triggerSize) && (gcThread != null)) { Unsafe.debug("<alloc:GC trigger/>"); allocatedSinceGcTrigger = 0; gcThread.trigger(false); } } finally { if (m != null) { m.exit(); } } } return result; }
|
protected Object allocObject(VmClassType vmClass, int size) { // Make sure the class is initialized vmClass.initialize(); final int alignedSize = ObjectLayout.objectAlign(size); //final Monitor mon = heapMonitor; VmAbstractHeap heap = currentHeap; Object result = null; int oomCount = 0; if (gcActive) { Unsafe.debug("Using GC Heap sz"); Unsafe.debug(alignedSize); result = gcHeap.alloc(vmClass, alignedSize); if (result == null) { helper.die("Out of GC heap memory."); } } else { final Monitor m = heapMonitor; //final Monitor m = null; if (m != null) { m.enter(); } try { while (result == null) { // The current heap is full if (heap == null) { //Unsafe.debug("allocHeap in allocObject("); Unsafe.debug(alignedSize); //Unsafe.debug(") "); int newHeapSize = DEFAULT_HEAP_SIZE; if (size > newHeapSize) { // this is a BIG object, try to allocate a new heap // only for it newHeapSize = size; } if ((heap = allocHeap(newHeapSize, true)) == null) { lowOnMemory = true; // It was not possible to allocate another heap. // First try to GC, if we've done that before // in this allocation, then we're in real panic. if (oomCount == 0) { oomCount++; Unsafe.debug("<oom/>"); gcThread.trigger(true); heap = firstHeap; currentHeap = firstHeap; } else { Unsafe.debug("Out of memory in allocObject("); Unsafe.debug(size); Unsafe.debug(")"); throw OOME; //Unsafe.die(); } } else { //Unsafe.debug("AO.G"); // We successfully allocated a new heap, set it // to current, so we'll use it for the following // allocations. currentHeap = heap; } } result = heap.alloc(vmClass, alignedSize); if (result == null) { heap = heap.getNext(); } } vmClass.incInstanceCount(); lowOnMemory = false; // Allocated objects are initially black. helper.unsafeSetObjectFlags(result, ObjectFlags.GC_DEFAULT_COLOR); allocatedSinceGcTrigger += alignedSize; if ((allocatedSinceGcTrigger > triggerSize) && (gcThread != null)) { Unsafe.debug("<alloc:GC trigger/>"); allocatedSinceGcTrigger = 0; gcThread.trigger(false); } } finally { if (m != null) { m.exit(); } } } return result; }
| 3,617
|
protected Object allocObject(VmClassType vmClass, int size) { // Make sure the class is initialized vmClass.initialize(); final int alignedSize = ObjectLayout.objectAlign(size); //final Monitor mon = heapMonitor; VmAbstractHeap heap = currentHeap; Object result = null; int oomCount = 0; if (gcActive) { Unsafe.debug("Using GC Heap sz"); Unsafe.debug(alignedSize); result = gcHeap.alloc(vmClass, alignedSize); if (result == null) { helper.die("Out of GC heap memory."); } } else { final Monitor m = heapMonitor; //final Monitor m = null; if (m != null) { m.enter(); } try { while (result == null) { // The current heap is full if (heap == null) { //Unsafe.debug("allocHeap in allocObject("); Unsafe.debug(alignedSize); //Unsafe.debug(") "); int newHeapSize = DEFAULT_HEAP_SIZE; if (size > newHeapSize) { // this is a BIG object, try to allocate a new heap // only for it newHeapSize = size; } if ((heap = allocHeap(newHeapSize, true)) == null) { lowOnMemory = true; // It was not possible to allocate another heap. // First try to GC, if we've done that before // in this allocation, then we're in real panic. if (oomCount == 0) { oomCount++; Unsafe.debug("<oom/>"); gcThread.trigger(true); heap = firstHeap; currentHeap = firstHeap; } else { Unsafe.debug("Out of memory in allocObject("); Unsafe.debug(size); Unsafe.debug(")"); throw OOME; //Unsafe.die(); } } else { //Unsafe.debug("AO.G"); // We successfully allocated a new heap, set it // to current, so we'll use it for the following // allocations. currentHeap = heap; } } result = heap.alloc(vmClass, alignedSize); if (result == null) { heap = heap.getNext(); } } vmClass.incInstanceCount(); lowOnMemory = false; // Allocated objects are initially black. helper.unsafeSetObjectFlags(result, ObjectFlags.GC_DEFAULT_COLOR); allocatedSinceGcTrigger += alignedSize; if ((allocatedSinceGcTrigger > triggerSize) && (gcThread != null)) { Unsafe.debug("<alloc:GC trigger/>"); allocatedSinceGcTrigger = 0; gcThread.trigger(false); } } finally { if (m != null) { m.exit(); } } } return result; }
|
protected Object allocObject(VmClassType vmClass, int size) { // Make sure the class is initialized vmClass.initialize(); final int alignedSize = ObjectLayout.objectAlign(size); //final Monitor mon = heapMonitor; VmAbstractHeap heap = currentHeap; Object result = null; int oomCount = 0; if (gcActive) { Unsafe.debug("Using GC Heap sz"); Unsafe.debug(alignedSize); result = gcHeap.alloc(vmClass, alignedSize); if (result == null) { helper.die("Out of GC heap memory."); } } else { final Monitor m = heapMonitor; //final Monitor m = null; if (m != null) { m.enter(); } try { while (result == null) { // The current heap is full if (heap == null) { //Unsafe.debug("allocHeap in allocObject("); Unsafe.debug(alignedSize); //Unsafe.debug(") "); int newHeapSize = DEFAULT_HEAP_SIZE; if (size > newHeapSize) { // this is a BIG object, try to allocate a new heap // only for it newHeapSize = size; } if ((heap = allocHeap(newHeapSize, true)) == null) { lowOnMemory = true; // It was not possible to allocate another heap. // First try to GC, if we've done that before // in this allocation, then we're in real panic. if (oomCount == 0) { oomCount++; Unsafe.debug("<oom/>"); gcThread.trigger(true); heap = firstHeap; currentHeap = firstHeap; } else { Unsafe.debug("Out of memory in allocObject("); Unsafe.debug(size); Unsafe.debug(")"); throw OOME; //Unsafe.die(); } } else { //Unsafe.debug("AO.G"); // We successfully allocated a new heap, set it // to current, so we'll use it for the following // allocations. currentHeap = heap; } } result = heap.alloc(vmClass, alignedSize); if (result == null) { heap = heap.getNext(); } } vmClass.incInstanceCount(); lowOnMemory = false; // Allocated objects are initially black. helper.unsafeSetObjectFlags(result, ObjectFlags.GC_DEFAULT_COLOR); allocatedSinceGcTrigger += alignedSize; if ((allocatedSinceGcTrigger > triggerSize) && (gcThread != null)) { Unsafe.debug("<alloc:GC trigger/>"); allocatedSinceGcTrigger = 0; gcThread.trigger(false); } } finally { if (m != null) { m.exit(); } } } return result; }
| 3,618
|
protected Object allocObject(VmClassType vmClass, int size) { // Make sure the class is initialized vmClass.initialize(); final int alignedSize = ObjectLayout.objectAlign(size); //final Monitor mon = heapMonitor; VmAbstractHeap heap = currentHeap; Object result = null; int oomCount = 0; if (gcActive) { Unsafe.debug("Using GC Heap sz"); Unsafe.debug(alignedSize); result = gcHeap.alloc(vmClass, alignedSize); if (result == null) { helper.die("Out of GC heap memory."); } } else { final Monitor m = heapMonitor; //final Monitor m = null; if (m != null) { m.enter(); } try { while (result == null) { // The current heap is full if (heap == null) { //Unsafe.debug("allocHeap in allocObject("); Unsafe.debug(alignedSize); //Unsafe.debug(") "); int newHeapSize = DEFAULT_HEAP_SIZE; if (size > newHeapSize) { // this is a BIG object, try to allocate a new heap // only for it newHeapSize = size; } if ((heap = allocHeap(newHeapSize, true)) == null) { lowOnMemory = true; // It was not possible to allocate another heap. // First try to GC, if we've done that before // in this allocation, then we're in real panic. if (oomCount == 0) { oomCount++; Unsafe.debug("<oom/>"); gcThread.trigger(true); heap = firstHeap; currentHeap = firstHeap; } else { Unsafe.debug("Out of memory in allocObject("); Unsafe.debug(size); Unsafe.debug(")"); throw OOME; //Unsafe.die(); } } else { //Unsafe.debug("AO.G"); // We successfully allocated a new heap, set it // to current, so we'll use it for the following // allocations. currentHeap = heap; } } result = heap.alloc(vmClass, alignedSize); if (result == null) { heap = heap.getNext(); } } vmClass.incInstanceCount(); lowOnMemory = false; // Allocated objects are initially black. helper.unsafeSetObjectFlags(result, ObjectFlags.GC_DEFAULT_COLOR); allocatedSinceGcTrigger += alignedSize; if ((allocatedSinceGcTrigger > triggerSize) && (gcThread != null)) { Unsafe.debug("<alloc:GC trigger/>"); allocatedSinceGcTrigger = 0; gcThread.trigger(false); } } finally { if (m != null) { m.exit(); } } } return result; }
|
protected Object allocObject(VmClassType vmClass, int size) { // Make sure the class is initialized vmClass.initialize(); final int alignedSize = ObjectLayout.objectAlign(size); //final Monitor mon = heapMonitor; VmAbstractHeap heap = currentHeap; Object result = null; int oomCount = 0; if (gcActive) { Unsafe.debug("Using GC Heap sz"); Unsafe.debug(alignedSize); result = gcHeap.alloc(vmClass, alignedSize); if (result == null) { helper.die("Out of GC heap memory."); } } else { final Monitor m = heapMonitor; //final Monitor m = null; if (m != null) { m.enter(); } try { while (result == null) { // The current heap is full if (heap == null) { //Unsafe.debug("allocHeap in allocObject("); Unsafe.debug(alignedSize); //Unsafe.debug(") "); int newHeapSize = DEFAULT_HEAP_SIZE; if (size > newHeapSize) { // this is a BIG object, try to allocate a new heap // only for it newHeapSize = size; } if ((heap = allocHeap(newHeapSize, true)) == null) { lowOnMemory = true; // It was not possible to allocate another heap. // First try to GC, if we've done that before // in this allocation, then we're in real panic. if (oomCount == 0) { oomCount++; Unsafe.debug("<oom/>"); gcThread.trigger(true); heap = firstHeap; currentHeap = firstHeap; } else { Unsafe.debug("Out of memory in allocObject("); Unsafe.debug(size); Unsafe.debug(")"); throw OOME; //Unsafe.die(); } } else { //Unsafe.debug("AO.G"); // We successfully allocated a new heap, set it // to current, so we'll use it for the following // allocations. currentHeap = heap; } } result = heap.alloc(vmClass, alignedSize); if (result == null) { heap = heap.getNext(); } } vmClass.incInstanceCount(); lowOnMemory = false; // Allocated objects are initially black. helper.unsafeSetObjectFlags(result, ObjectFlags.GC_DEFAULT_COLOR); allocatedSinceGcTrigger += alignedSize; if ((allocatedSinceGcTrigger > triggerSize) && (gcThread != null)) { Unsafe.debug("<alloc:GC trigger/>"); allocatedSinceGcTrigger = 0; gcThread.trigger(false); } } finally { if (m != null) { m.exit(); } } } return result; }
| 3,619
|
public long getFreeMemory() { long size = bootHeap.getFreeSize(); VmAbstractHeap h = firstHeap; while (h != null) { size += h.getFreeSize(); h = h.getNext(); } //size += (Unsafe.addressToLong(heapEnd) - Unsafe.addressToLong(nextHeapPtr)); size += MemoryBlockManager.getFreeMemory(); return size; }
|
public long getFreeMemory() { long size = bootHeap.getFreeSize(); VmAbstractHeap h = firstHeap; while (h != null) { size += h.getFreeSize(); h = h.getNext(); } //size += (Unsafe.addressToLong(heapEnd) - Unsafe.addressToLong(nextHeapPtr)); size += MemoryBlockManager.getFreeMemory(); return size; }
| 3,620
|
public long getTotalMemory() { long size = bootHeap.getSize(); VmAbstractHeap h = firstHeap; while (h != null) { size += h.getSize(); h = h.getNext(); } //size += (Unsafe.addressToLong(heapEnd) - Unsafe.addressToLong(nextHeapPtr)); size += MemoryBlockManager.getFreeMemory(); return size; }
|
public long getTotalMemory() { long size = bootHeap.getSize(); VmAbstractHeap h = firstHeap; while (h != null) { size += h.getSize(); h = h.getNext(); } //size += (Unsafe.addressToLong(heapEnd) - Unsafe.addressToLong(nextHeapPtr)); size += MemoryBlockManager.getFreeMemory(); return size; }
| 3,621
|
protected void initialize() { // Set the basic fields final VmArchitecture arch = Unsafe.getCurrentProcessor().getArchitecture(); final int slotSize = arch.getReferenceSize(); // Initialize the boot heap. bootHeap.initialize(helper.getBootHeapStart(), helper.getBootHeapEnd(), slotSize); // Initialize the first normal heap Address ptr = helper.allocateBlock(DEFAULT_HEAP_SIZE); firstHeap.initialize(ptr, Address.add(ptr, DEFAULT_HEAP_SIZE), slotSize); // Initialize the GC heap gcHeap = allocHeap(DEFAULT_HEAP_SIZE, false); }
|
protected void initialize() { // Set the basic fields final VmArchitecture arch = Unsafe.getCurrentProcessor().getArchitecture(); final int slotSize = arch.getReferenceSize(); // Initialize the boot heap. bootHeap.initialize(helper.getBootHeapStart(), helper.getBootHeapEnd(), slotSize); // Initialize the first normal heap Address ptr = helper.allocateBlock(DEFAULT_HEAP_SIZE); firstHeap.initialize(ptr, Address.add(ptr, DEFAULT_HEAP_SIZE), slotSize); // Initialize the GC heap gcHeap = allocHeap(DEFAULT_HEAP_SIZE, false); }
| 3,622
|
public final boolean isObject(Address ptr) { long addrL = helper.addressToLong(ptr); if ((addrL & (ObjectLayout.OBJECT_ALIGN - 1)) != 0) { // The object is not at an object aligned boundary return false; } if (bootHeap.isObject(ptr)) { return true; } VmAbstractHeap heap = firstHeap; while (heap != null) { if (heap.isObject(ptr)) { return true; } heap = heap.getNext(); } return false; }
|
public final boolean isObject(Address ptr) { long addrL = helper.addressToLong(ptr); if ((addrL & (ObjectLayout.OBJECT_ALIGN - 1)) != 0) { // The object is not at an object aligned boundary return false; } if (bootHeap.isObject(ptr)) { return true; } VmAbstractHeap heap = firstHeap; while (heap != null) { if (heap.isObject(ptr)) { return true; } heap = heap.getNext(); } return false; }
| 3,623
|
final void resetCurrentHeap() { this.currentHeap = this.firstHeap; // Recalculate the trigger size triggerSize = (int)Math.min(Integer.MAX_VALUE, getFreeMemory() * GC_TRIGGER_PERCENTAGE); }
|
final void resetCurrentHeap() { this.currentHeap = this.firstHeap; // Recalculate the trigger size triggerSize = (int)Math.min(Integer.MAX_VALUE, getFreeMemory() * GC_TRIGGER_PERCENTAGE); }
| 3,624
|
public FatLfnDirEntry(AbstractDirectory dir, byte[] src, int offset) { super(dir, src, offset); }
|
public FatLfnDirEntry(AbstractDirectory dir, byte[] src, int offset) { super(dir, src, offset); }
| 3,626
|
public void emitMagic(EmitterContext ec, VmMethod method, boolean isstatic, X86BytecodeVisitor bcv) { //final int type = getClass(method); final MagicMethod mcode = MagicMethod.get(method); final VirtualStack vstack = ec.getVStack(); final X86Assembler os = ec.getStream(); final ItemFactory ifac = ec.getItemFactory(); final X86RegisterPool pool = ec.getGPRPool();// final EntryPoints context = ec.getContext(); final X86CompilerHelper helper = ec.getHelper(); final int slotSize = os.isCode32() ? 4 : 8; switch (mcode) { case ADD: { // addr + ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeADD(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case AND: { // addr & ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeAND(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case OR: { // addr | ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeOR(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case SUB: case DIFF: { // addr - ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeSUB(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case XOR: { // addr ^ ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeXOR(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case NOT: { // !addr if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); os.writeNOT(addr.getRegister()); vstack.push(addr); } break; case TOINT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); X86Register r = addr.getRegister(); if (os.isCode64()) { r = pool.getRegisterInSameGroup(r, JvmType.INT); // We just take the lower 32-bit, so no actual mov's needed. } addr.release(ec); L1AHelper.requestRegister(ec, r); final IntItem result = (IntItem) ifac.createReg(ec, JvmType.INT, r); pool.transferOwnerTo(r, result); vstack.push(result); } break; case TOWORD: case TOADDRESS: case TOOFFSET: case TOOBJECT: case TOOBJECTREFERENCE: case TOEXTENT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); vstack.push(addr); } break; case TOLONG: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final X86Register.GPR r = addr.getRegister(); addr.release(ec); L1AHelper.requestRegister(ec, r); final LongItem result; if (os.isCode32()) { final X86Register.GPR msb = (X86Register.GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); result = (LongItem) ifac.createReg(ec, JvmType.LONG, r, msb); os.writeXOR(msb, msb); pool.transferOwnerTo(msb, result); } else { result = (LongItem) ifac.createReg(ec, JvmType.LONG, (GPR64)r); } pool.transferOwnerTo(r, result); vstack.push(result); } break; case MAX: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = (RefItem) L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV_Const(r, -1); vstack.push(result); } break; case ONE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = (RefItem) L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV_Const(r, 1); vstack.push(result); } break; case ZERO: case NULLREFERENCE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = ifac.createAConst(ec, null); vstack.push(result); } break; case ISMAX: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR addrr = addr.getRegister(); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeCMP_Const(addrr, -1); os.writeSETCC(resultr, X86Constants.JE); addr.release(ec); vstack.push(result); } break; case ISZERO: case ISNULL: { // Just convert to int if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR addrr = addr.getRegister(); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeTEST(addrr, addrr); os.writeSETCC(resultr, X86Constants.JZ); addr.release(ec); vstack.push(result); } break; case EQUALS: case EQ: case NE: case LT: case LE: case GE: case GT: case SLT: case SLE: case SGE: case SGT: { // addr .. other if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem other = vstack.popRef(); final RefItem addr = vstack.popRef(); other.load(ec); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeCMP(addr.getRegister(), other.getRegister()); os.writeSETCC(resultr, methodToCC(mcode)); other.release(ec); addr.release(ec); vstack.push(result); } break; case FROMINT: case FROMINTSIGNEXTEND: case FROMINTZEROEXTEND: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem addr = vstack.popInt(); addr.load(ec); GPR r = addr.getRegister(); if (os.isCode64()) { final GPR64 newR = (GPR64)pool.getRegisterInSameGroup(r, JvmType.REFERENCE); if (mcode == FROMINTZEROEXTEND) { // Moving the register to itself in 32-bit mode, will // zero extend the top 32-bits. os.writeMOV(BITS32, r, r); } else { // Sign extend os.writeMOVSXD(newR, (GPR32)r); } r = newR; } addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case FROMADDRESS: case FROMOBJECT: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); // Do nothing vstack.push(obj); } break; case FROMLONG: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final LongItem addr = vstack.popLong(); addr.load(ec); final X86Register r; if (os.isCode32()) { r = addr.getLsbRegister(ec); } else { r = addr.getRegister(ec); } addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case LSH: case RSHA: case RSHL: { // addr shift cnt if (Vm.VerifyAssertions) Vm._assert(!isstatic); final IntItem cnt = vstack.popInt(); final RefItem addr = vstack.popRef(); if (!cnt.isConstant()) { L1AHelper.requestRegister(ec, X86Register.ECX); cnt.loadTo(ec, X86Register.ECX); } addr.load(ec); final int shift = methodToShift(mcode); if (cnt.isConstant()) { os.writeShift(shift, addr.getRegister(), cnt.getValue()); } else { os.writeShift_CL(shift, addr.getRegister()); } cnt.release(ec); vstack.push(addr); } break; case LOADBYTE: case LOADCHAR: case LOADSHORT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.loadToBITS8GPR(ec); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), true); final GPR resultr = result.getRegister(); if (mcode == LOADCHAR) { os.writeMOVZX(resultr, r, 0, methodToSize(mcode)); } else { os.writeMOVSX(resultr, r, 0, methodToSize(mcode)); } addr.release(ec); vstack.push(result); } break; case LOADINT: case LOADFLOAT: case LOADADDRESS: case LOADOBJECTREFERENCE: case LOADWORD: case PREPAREINT: case PREPAREADDRESS: case PREPAREOBJECTREFERENCE: case PREPAREWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), false); final GPR resultr = result.getRegister(); os.writeMOV(resultr.getSize(), resultr, r, 0); addr.release(ec); vstack.push(result); } break; case LOADLONG: case LOADDOUBLE: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); final X86Register.GPR r = addr.getRegister(); if (os.isCode32()) { final X86Register.GPR msb = (X86Register.GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); addr.release(ec); L1AHelper.releaseRegister(ec, msb); os.writeMOV(X86CompilerConstants.INTSIZE, msb, r, X86CompilerConstants.MSB); os.writeMOV(X86CompilerConstants.INTSIZE, r, r, X86CompilerConstants.LSB); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode), r, msb)); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode)); os.writeMOV(BITS64, result.getRegister(ec), r, 0); addr.release(ec); vstack.push(result); } } break; case LOADBYTE_OFS: case LOADCHAR_OFS: case LOADSHORT_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); os.writeLEA(r, r, ofsr, 1, 0); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), true); final GPR resultr = result.getRegister(); if (mcode == LOADCHAR_OFS) { os.writeMOVZX(resultr, r, 0, methodToSize(mcode)); } else { os.writeMOVSX(resultr, r, 0, methodToSize(mcode)); } ofs.release(ec); addr.release(ec); vstack.push(result); } break; case LOADINT_OFS: case LOADFLOAT_OFS: case LOADADDRESS_OFS: case LOADOBJECTREFERENCE_OFS: case LOADWORD_OFS: case PREPAREINT_OFS: case PREPAREADDRESS_OFS: case PREPAREOBJECTREFERENCE_OFS: case PREPAREWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), false); final GPR resultr = result.getRegister(); os.writeMOV(resultr.getSize(), resultr, r, ofsr, 1, 0); ofs.release(ec); addr.release(ec); vstack.push(result); } break; case LOADLONG_OFS: case LOADDOUBLE_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); if (os.isCode32()) { final GPR msb = (GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); os.writeMOV(X86CompilerConstants.INTSIZE, msb, r, ofsr, 1, X86CompilerConstants.MSB); os.writeMOV(X86CompilerConstants.INTSIZE, r, r, ofsr, 1, X86CompilerConstants.LSB); ofs.release(ec); addr.release(ec); L1AHelper.releaseRegister(ec, msb); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode), r, msb)); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode)); os.writeMOV(BITS64, result.getRegister(ec), r, ofsr, 1, 0); addr.release(ec); ofs.release(ec); vstack.push(result); } } break; case STOREBYTE: case STORECHAR: case STORESHORT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final IntItem val = vstack.popInt(); final RefItem addr = vstack.popRef(); val.loadToBITS8GPR(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(methodToSize(mcode), r, 0, valr); val.release(ec); addr.release(ec); } break; case STOREINT: case STOREFLOAT: case STOREADDRESS: case STOREOBJECTREFERENCE: case STOREWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem val = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(valr.getSize(), r, 0, valr); val.release(ec); addr.release(ec); } break; case STORELONG: case STOREDOUBLE: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final DoubleWordItem val = (DoubleWordItem)vstack.pop(); final RefItem addr = vstack.popRef(); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); if (os.isCode32()) { final GPR lsb = val.getLsbRegister(ec); final GPR msb = val.getMsbRegister(ec); os.writeMOV(X86CompilerConstants.INTSIZE, r, X86CompilerConstants.LSB, lsb); os.writeMOV(X86CompilerConstants.INTSIZE, r, X86CompilerConstants.MSB, msb); } else { final GPR64 valr = val.getRegister(ec); os.writeMOV(BITS64, r, 0, valr); } val.release(ec); addr.release(ec); } break; case STOREBYTE_OFS: case STORECHAR_OFS: case STORESHORT_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final IntItem val = vstack.popInt(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.loadToBITS8GPR(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(methodToSize(mcode), r, ofsr, 1, 0, valr); ofs.release(ec); val.release(ec); addr.release(ec); } break; case STOREINT_OFS: case STOREFLOAT_OFS: case STOREADDRESS_OFS: case STOREOBJECTREFERENCE_OFS: case STOREWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final WordItem val = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(valr.getSize(), r, ofsr, 1, 0, valr); ofs.release(ec); val.release(ec); addr.release(ec); } break; case STORELONG_OFS: case STOREDOUBLE_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final DoubleWordItem val = (DoubleWordItem)vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); if (os.isCode32()) { final GPR lsb = val.getLsbRegister(ec); final GPR msb = val.getMsbRegister(ec); os.writeMOV(X86CompilerConstants.INTSIZE, r, ofsr, 1, X86CompilerConstants.LSB, lsb); os.writeMOV(X86CompilerConstants.INTSIZE, r, ofsr, 1, X86CompilerConstants.MSB, msb); } else { final GPR64 valr = val.getRegister(ec); os.writeMOV(BITS64, r, ofsr, 1, 0, valr); } ofs.release(ec); val.release(ec); addr.release(ec); } break; case ATTEMPTINT: case ATTEMPTADDRESS: case ATTEMPTOBJECTREFERENCE: case ATTEMPTWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem val = (WordItem)vstack.pop(); final WordItem old = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); final X86Register.GPR aax; if ((mcode == ATTEMPTINT) || os.isCode32()) { aax = X86Register.EAX; } else { aax = X86Register.RAX; } if (!old.uses(aax)) { L1AHelper.requestRegister(ec, aax, old); val.load(ec); old.loadTo(ec, aax); } else { val.load(ec); } addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeCMPXCHG_EAX(r, 0, valr, true); os.writeSETCC(resultr, X86Constants.JZ); os.writeAND(resultr, 0xFF); val.release(ec); old.release(ec); addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.INT, resultr)); } break; case ATTEMPTINT_OFS: case ATTEMPTADDRESS_OFS: case ATTEMPTOBJECTREFERENCE_OFS: case ATTEMPTWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final WordItem val = (WordItem)vstack.pop(); final WordItem old = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); final X86Register.GPR aax; if ((mcode == ATTEMPTINT) || os.isCode32()) { aax = X86Register.EAX; } else { aax = X86Register.RAX; } if (!old.uses(aax)) { L1AHelper.requestRegister(ec, aax, old); ofs.load(ec); val.load(ec); old.loadTo(ec, aax); } else { ofs.load(ec); val.load(ec); } addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); final GPR ofsr = ofs.getRegister(); os.writeLEA(r, r, ofsr, 1, 0); os.writeCMPXCHG_EAX(r, 0, valr, true); os.writeSETCC(resultr, X86Constants.JZ); os.writeAND(resultr, 0xFF); ofs.release(ec); val.release(ec); old.release(ec); addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.INT, resultr)); } break; case GETOBJECTTYPE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final RefItem result = (RefItem)L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR resultr = result.getRegister(); // Get TIB os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.TIB_SLOT * slotSize); // Get VmType os.writeMOV(helper.ADDRSIZE, resultr, r, (TIBLayout.VMTYPE_INDEX + VmArray.DATA_OFFSET) * slotSize); obj.release(ec); vstack.push(result); } break; case GETTIB: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); // Get TIB os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.TIB_SLOT * slotSize); vstack.push(obj); } break; case GETOBJECTFLAGS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); // Get flags os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.FLAGS_SLOT * slotSize); obj.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case SETOBJECTFLAGS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem flags = vstack.popRef(); final RefItem obj = vstack.popRef(); flags.load(ec); obj.load(ec); final GPR flagsr = flags.getRegister(); final GPR r = obj.getRegister(); // Set flags os.writeMOV(helper.ADDRSIZE, r, ObjectLayout.FLAGS_SLOT * slotSize, flagsr); flags.release(ec); obj.release(ec); } break; case GETARRAYDATA: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); os.writeADD(r, VmArray.DATA_OFFSET * slotSize); vstack.push(obj); } break; case GETOBJECTCOLOR: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, false); final GPR resultr = result.getRegister(); // Get flags os.writeMOV(BITS32, resultr, r, ObjectLayout.FLAGS_SLOT * slotSize); os.writeAND(resultr, ObjectFlags.GC_COLOUR_MASK); obj.release(ec); vstack.push(result); } break; case ISFINALIZED: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, false); final GPR resultr = result.getRegister(); // Get flags os.writeMOV(BITS32, resultr, r, ObjectLayout.FLAGS_SLOT * slotSize); os.writeAND(resultr, ObjectFlags.STATUS_FINALIZED); obj.release(ec); vstack.push(result); } break; case ATOMICADD: case ATOMICAND: case ATOMICOR: case ATOMICSUB: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem value = vstack.popRef(); final RefItem addr = vstack.popRef(); value.load(ec); addr.load(ec); final X86Register.GPR valuer = (X86Register.GPR)value.getRegister(); final X86Register.GPR r = (X86Register.GPR)addr.getRegister(); os.writePrefix(X86Constants.LOCK_PREFIX); os.writeArithOp(methodCodeToOperation(mcode), r, 0, valuer); value.release(ec); addr.release(ec); } break; case GETCURRENTFRAME: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem result = L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV(helper.ADDRSIZE, r, helper.BP); vstack.push(result); } break; case GETTIMESTAMP: { if (Vm.VerifyAssertions) Vm._assert(isstatic); if (os.isCode32()) { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, JvmType.LONG, X86Register.EAX, X86Register.EDX); os.writeRDTSC(); vstack.push(result); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegister(ec, JvmType.LONG, X86Register.RAX); L1AHelper.requestRegister(ec, X86Register.RDX); os.writeRDTSC(); // Move MSB to upper 32-bit of RDX os.writeSHL(X86Register.RDX, 32); // RAX is zero extended by RDTSC, so an OR of RAX,RDX will combine // the upper 32-bits of RDX and the lower 32-bits of RAX. os.writeOR(X86Register.RAX, X86Register.RDX); // Now free RDX L1AHelper.releaseRegister(ec, X86Register.RDX); vstack.push(result); } } break; case INTBITSTOFLOAT: case FLOATTORAWINTBITS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem v = (WordItem)vstack.pop(); v.load(ec); final X86Register.GPR r = v.getRegister(); v.release(ec); final int resultType = (mcode == INTBITSTOFLOAT) ? JvmType.FLOAT : JvmType.INT; vstack.push(L1AHelper.requestWordRegister(ec, resultType, r)); } break; case LONGBITSTODOUBLE: case DOUBLETORAWLONGBITS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final DoubleWordItem v = (DoubleWordItem)vstack.pop(); v.load(ec); final int resultType = (mcode == LONGBITSTODOUBLE) ? JvmType.DOUBLE : JvmType.LONG; if (os.isCode32()) { final X86Register.GPR lsb = v.getLsbRegister(ec); final X86Register.GPR msb = v.getMsbRegister(ec); v.release(ec); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, resultType, lsb, msb)); } else { final GPR64 vreg = v.getRegister(ec); v.release(ec); vstack.push(L1AHelper.requestDoubleWordRegister(ec, resultType, vreg)); } } break; case BREAKPOINT: { if (Vm.VerifyAssertions) Vm._assert(isstatic); os.writeINT(3); } break; case CURRENTPROCESSOR: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem item = (RefItem)L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final int offset = ec.getContext().getVmProcessorMeField().getOffset(); if (os.isCode32()) { os.writePrefix(X86Constants.FS_PREFIX); os.writeMOV(item.getRegister(), offset); } else { os.writeMOV(BITS64, item.getRegister(), X86Register.R12, offset); } vstack.push(item); } break; // xyzArray classes case ARR_CREATE: { if (os.isCode32()) { bcv.visit_newarray(10); // int[] } else { bcv.visit_newarray(11); // long[] } } break; case ARR_GET: { bcv.waload(JvmType.REFERENCE); } break; case ARR_SET: { bcv.wastore(JvmType.REFERENCE); } break; case ARR_LENGTH: { bcv.visit_arraylength(); } break; default: throw new InternalError("Unknown method code for method " + method); } }
|
public void emitMagic(EmitterContext ec, VmMethod method, boolean isstatic, X86BytecodeVisitor bcv) { //final int type = getClass(method); final MagicMethod mcode = MagicMethod.get(method); final VirtualStack vstack = ec.getVStack(); final X86Assembler os = ec.getStream(); final ItemFactory ifac = ec.getItemFactory(); final X86RegisterPool pool = ec.getGPRPool();// final EntryPoints context = ec.getContext(); final X86CompilerHelper helper = ec.getHelper(); final int slotSize = os.isCode32() ? 4 : 8; switch (mcode) { case ADD: { // addr + ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeADD(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case AND: { // addr & ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeAND(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case OR: { // addr | ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeOR(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case SUB: case DIFF: { // addr - ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeSUB(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case XOR: { // addr ^ ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeXOR(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case NOT: { // !addr if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); os.writeNOT(addr.getRegister()); vstack.push(addr); } break; case TOINT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); X86Register r = addr.getRegister(); if (os.isCode64()) { r = pool.getRegisterInSameGroup(r, JvmType.INT); // We just take the lower 32-bit, so no actual mov's needed. } addr.release(ec); L1AHelper.requestRegister(ec, r); final IntItem result = (IntItem) ifac.createReg(ec, JvmType.INT, r); pool.transferOwnerTo(r, result); vstack.push(result); } break; case TOWORD: case TOADDRESS: case TOOFFSET: case TOOBJECT: case TOOBJECTREFERENCE: case TOEXTENT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); vstack.push(addr); } break; case TOLONG: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final X86Register.GPR r = addr.getRegister(); addr.release(ec); L1AHelper.requestRegister(ec, r); final LongItem result; if (os.isCode32()) { final X86Register.GPR msb = (X86Register.GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); result = (LongItem) ifac.createReg(ec, JvmType.LONG, r, msb); os.writeXOR(msb, msb); pool.transferOwnerTo(msb, result); } else { result = (LongItem) ifac.createReg(ec, JvmType.LONG, (GPR64)r); } pool.transferOwnerTo(r, result); vstack.push(result); } break; case MAX: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = (RefItem) L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV_Const(r, -1); vstack.push(result); } break; case ONE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = (RefItem) L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV_Const(r, 1); vstack.push(result); } break; case ZERO: case NULLREFERENCE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = ifac.createAConst(ec, null); vstack.push(result); } break; case ISMAX: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR addrr = addr.getRegister(); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeCMP_Const(addrr, -1); os.writeSETCC(resultr, X86Constants.JE); addr.release(ec); vstack.push(result); } break; case ISZERO: case ISNULL: { // Just convert to int if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR addrr = addr.getRegister(); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeTEST(addrr, addrr); os.writeSETCC(resultr, X86Constants.JZ); addr.release(ec); vstack.push(result); } break; case EQUALS: case EQ: case NE: case LT: case LE: case GE: case GT: case SLT: case SLE: case SGE: case SGT: { // addr .. other if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem other = vstack.popRef(); final RefItem addr = vstack.popRef(); other.load(ec); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeCMP(addr.getRegister(), other.getRegister()); os.writeSETCC(resultr, methodToCC(mcode)); other.release(ec); addr.release(ec); vstack.push(result); } break; case FROMINT: case FROMINTSIGNEXTEND: case FROMINTZEROEXTEND: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem addr = vstack.popInt(); addr.load(ec); GPR r = addr.getRegister(); if (os.isCode64()) { final GPR64 newR = (GPR64)pool.getRegisterInSameGroup(r, JvmType.REFERENCE); if (mcode == FROMINTZEROEXTEND) { // Moving the register to itself in 32-bit mode, will // zero extend the top 32-bits. os.writeMOV(BITS32, r, r); } else { // Sign extend os.writeMOVSXD(newR, (GPR32)r); } r = newR; } addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case FROMADDRESS: case FROMOBJECT: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); // Do nothing vstack.push(obj); } break; case FROMLONG: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final LongItem addr = vstack.popLong(); addr.load(ec); final X86Register r; if (os.isCode32()) { r = addr.getLsbRegister(ec); } else { r = addr.getRegister(ec); } addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case LSH: case RSHA: case RSHL: { // addr shift cnt if (Vm.VerifyAssertions) Vm._assert(!isstatic); final IntItem cnt = vstack.popInt(); final RefItem addr = vstack.popRef(); if (!cnt.isConstant()) { L1AHelper.requestRegister(ec, X86Register.ECX); cnt.loadTo(ec, X86Register.ECX); } addr.load(ec); final int shift = methodToShift(mcode); if (cnt.isConstant()) { os.writeShift(shift, addr.getRegister(), cnt.getValue()); } else { os.writeShift_CL(shift, addr.getRegister()); } cnt.release(ec); vstack.push(addr); } break; case LOADBYTE: case LOADCHAR: case LOADSHORT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.loadToBITS8GPR(ec); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), true); final GPR resultr = result.getRegister(); if (mcode == LOADCHAR) { os.writeMOVZX(resultr, r, 0, methodToSize(mcode)); } else { os.writeMOVSX(resultr, r, 0, methodToSize(mcode)); } addr.release(ec); vstack.push(result); } break; case LOADINT: case LOADFLOAT: case LOADADDRESS: case LOADOBJECTREFERENCE: case LOADWORD: case PREPAREINT: case PREPAREADDRESS: case PREPAREOBJECTREFERENCE: case PREPAREWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), false); final GPR resultr = result.getRegister(); os.writeMOV(resultr.getSize(), resultr, r, 0); addr.release(ec); vstack.push(result); } break; case LOADLONG: case LOADDOUBLE: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); final X86Register.GPR r = addr.getRegister(); if (os.isCode32()) { final X86Register.GPR msb = (X86Register.GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); addr.release(ec); L1AHelper.releaseRegister(ec, msb); os.writeMOV(X86CompilerConstants.INTSIZE, msb, r, X86CompilerConstants.MSB); os.writeMOV(X86CompilerConstants.INTSIZE, r, r, X86CompilerConstants.LSB); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode), r, msb)); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode)); os.writeMOV(BITS64, result.getRegister(ec), r, 0); addr.release(ec); vstack.push(result); } } break; case LOADBYTE_OFS: case LOADCHAR_OFS: case LOADSHORT_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); os.writeLEA(r, r, ofsr, 1, 0); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), true); final GPR resultr = result.getRegister(); if (mcode == LOADCHAR_OFS) { os.writeMOVZX(resultr, r, 0, methodToSize(mcode)); } else { os.writeMOVSX(resultr, r, 0, methodToSize(mcode)); } ofs.release(ec); addr.release(ec); vstack.push(result); } break; case LOADINT_OFS: case LOADFLOAT_OFS: case LOADADDRESS_OFS: case LOADOBJECTREFERENCE_OFS: case LOADWORD_OFS: case PREPAREINT_OFS: case PREPAREADDRESS_OFS: case PREPAREOBJECTREFERENCE_OFS: case PREPAREWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), false); final GPR resultr = result.getRegister(); os.writeMOV(resultr.getSize(), resultr, r, ofsr, 1, 0); ofs.release(ec); addr.release(ec); vstack.push(result); } break; case LOADLONG_OFS: case LOADDOUBLE_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); if (os.isCode32()) { final GPR msb = (GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); os.writeMOV(X86CompilerConstants.INTSIZE, msb, r, ofsr, 1, X86CompilerConstants.MSB); os.writeMOV(X86CompilerConstants.INTSIZE, r, r, ofsr, 1, X86CompilerConstants.LSB); ofs.release(ec); addr.release(ec); L1AHelper.releaseRegister(ec, msb); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode), r, msb)); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode)); os.writeMOV(BITS64, result.getRegister(ec), r, ofsr, 1, 0); addr.release(ec); ofs.release(ec); vstack.push(result); } } break; case STOREBYTE: case STORECHAR: case STORESHORT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final IntItem val = vstack.popInt(); final RefItem addr = vstack.popRef(); val.loadToBITS8GPR(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(methodToSize(mcode), r, 0, valr); val.release(ec); addr.release(ec); } break; case STOREINT: case STOREFLOAT: case STOREADDRESS: case STOREOBJECTREFERENCE: case STOREWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem val = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(valr.getSize(), r, 0, valr); val.release(ec); addr.release(ec); } break; case STORELONG: case STOREDOUBLE: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final DoubleWordItem val = (DoubleWordItem)vstack.pop(); final RefItem addr = vstack.popRef(); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); if (os.isCode32()) { final GPR lsb = val.getLsbRegister(ec); final GPR msb = val.getMsbRegister(ec); os.writeMOV(X86CompilerConstants.INTSIZE, r, X86CompilerConstants.LSB, lsb); os.writeMOV(X86CompilerConstants.INTSIZE, r, X86CompilerConstants.MSB, msb); } else { final GPR64 valr = val.getRegister(ec); os.writeMOV(BITS64, r, 0, valr); } val.release(ec); addr.release(ec); } break; case STOREBYTE_OFS: case STORECHAR_OFS: case STORESHORT_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final IntItem val = vstack.popInt(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.loadToBITS8GPR(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(methodToSize(mcode), r, ofsr, 1, 0, valr); ofs.release(ec); val.release(ec); addr.release(ec); } break; case STOREINT_OFS: case STOREFLOAT_OFS: case STOREADDRESS_OFS: case STOREOBJECTREFERENCE_OFS: case STOREWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final WordItem val = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(valr.getSize(), r, ofsr, 1, 0, valr); ofs.release(ec); val.release(ec); addr.release(ec); } break; case STORELONG_OFS: case STOREDOUBLE_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final DoubleWordItem val = (DoubleWordItem)vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); if (os.isCode32()) { final GPR lsb = val.getLsbRegister(ec); final GPR msb = val.getMsbRegister(ec); os.writeMOV(X86CompilerConstants.INTSIZE, r, ofsr, 1, X86CompilerConstants.LSB, lsb); os.writeMOV(X86CompilerConstants.INTSIZE, r, ofsr, 1, X86CompilerConstants.MSB, msb); } else { final GPR64 valr = val.getRegister(ec); os.writeMOV(BITS64, r, ofsr, 1, 0, valr); } ofs.release(ec); val.release(ec); addr.release(ec); } break; case ATTEMPTINT: case ATTEMPTADDRESS: case ATTEMPTOBJECTREFERENCE: case ATTEMPTWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem val = (WordItem)vstack.pop(); final WordItem old = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); final X86Register.GPR aax; if ((mcode == ATTEMPTINT) || os.isCode32()) { aax = X86Register.EAX; } else { aax = X86Register.RAX; } if (!old.uses(aax)) { L1AHelper.requestRegister(ec, aax, old); val.load(ec); old.loadTo(ec, aax); } else { val.load(ec); } addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeCMPXCHG_EAX(r, 0, valr, true); os.writeSETCC(resultr, X86Constants.JZ); os.writeAND(resultr, 0xFF); val.release(ec); old.release(ec); addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.INT, resultr)); } break; case ATTEMPTINT_OFS: case ATTEMPTADDRESS_OFS: case ATTEMPTOBJECTREFERENCE_OFS: case ATTEMPTWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final WordItem val = (WordItem)vstack.pop(); final WordItem old = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); final X86Register.GPR aax; if ((mcode == ATTEMPTINT) || os.isCode32()) { aax = X86Register.EAX; } else { aax = X86Register.RAX; } if (!old.uses(aax)) { L1AHelper.requestRegister(ec, aax, old); ofs.load(ec); val.load(ec); old.loadTo(ec, aax); } else { ofs.load(ec); val.load(ec); } addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); final GPR ofsr = ofs.getRegister(); os.writeLEA(r, r, ofsr, 1, 0); os.writeCMPXCHG_EAX(r, 0, valr, true); os.writeSETCC(resultr, X86Constants.JZ); os.writeAND(resultr, 0xFF); ofs.release(ec); val.release(ec); old.release(ec); addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.INT, resultr)); } break; case GETOBJECTTYPE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final RefItem result = (RefItem)L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR resultr = result.getRegister(); // Get TIB os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.TIB_SLOT * slotSize); // Get VmType os.writeMOV(helper.ADDRSIZE, resultr, r, (TIBLayout.VMTYPE_INDEX + VmArray.DATA_OFFSET) * slotSize); obj.release(ec); vstack.push(result); } break; case GETTIB: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); // Get TIB os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.TIB_SLOT * slotSize); vstack.push(obj); } break; case GETOBJECTFLAGS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); // Get flags os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.FLAGS_SLOT * slotSize); obj.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case SETOBJECTFLAGS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem flags = vstack.popRef(); final RefItem obj = vstack.popRef(); flags.load(ec); obj.load(ec); final GPR flagsr = flags.getRegister(); final GPR r = obj.getRegister(); // Set flags os.writeMOV(helper.ADDRSIZE, r, ObjectLayout.FLAGS_SLOT * slotSize, flagsr); flags.release(ec); obj.release(ec); } break; case GETARRAYDATA: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); os.writeADD(r, VmArray.DATA_OFFSET * slotSize); vstack.push(obj); } break; case GETOBJECTCOLOR: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, false); final GPR resultr = result.getRegister(); // Get flags os.writeMOV(BITS32, resultr, r, ObjectLayout.FLAGS_SLOT * slotSize); os.writeAND(resultr, ObjectFlags.GC_COLOUR_MASK); obj.release(ec); vstack.push(result); } break; case ISFINALIZED: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, false); final GPR resultr = result.getRegister(); // Get flags os.writeMOV(BITS32, resultr, r, ObjectLayout.FLAGS_SLOT * slotSize); os.writeAND(resultr, ObjectFlags.STATUS_FINALIZED); obj.release(ec); vstack.push(result); } break; case ATOMICADD: case ATOMICAND: case ATOMICOR: case ATOMICSUB: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem value = vstack.popRef(); final RefItem addr = vstack.popRef(); value.load(ec); addr.load(ec); final X86Register.GPR valuer = (X86Register.GPR)value.getRegister(); final X86Register.GPR r = (X86Register.GPR)addr.getRegister(); os.writePrefix(X86Constants.LOCK_PREFIX); os.writeArithOp(methodCodeToOperation(mcode), r, 0, valuer); value.release(ec); addr.release(ec); } break; case GETCURRENTFRAME: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem result = L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV(helper.ADDRSIZE, r, helper.BP); vstack.push(result); } break; case GETTIMESTAMP: { if (Vm.VerifyAssertions) Vm._assert(isstatic); if (os.isCode32()) { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, JvmType.LONG, X86Register.EAX, X86Register.EDX); os.writeRDTSC(); vstack.push(result); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegister(ec, JvmType.LONG, X86Register.RAX); L1AHelper.requestRegister(ec, X86Register.RDX); os.writeRDTSC(); // Move MSB to upper 32-bit of RDX os.writeSHL(X86Register.RDX, 32); // RAX is zero extended by RDTSC, so an OR of RAX,RDX will combine // the upper 32-bits of RDX and the lower 32-bits of RAX. os.writeOR(X86Register.RAX, X86Register.RDX); // Now free RDX L1AHelper.releaseRegister(ec, X86Register.RDX); vstack.push(result); } } break; case INTBITSTOFLOAT: case FLOATTORAWINTBITS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem v = (WordItem)vstack.pop(); v.load(ec); final X86Register.GPR r = v.getRegister(); v.release(ec); final int resultType = (mcode == INTBITSTOFLOAT) ? JvmType.FLOAT : JvmType.INT; vstack.push(L1AHelper.requestWordRegister(ec, resultType, r)); } break; case LONGBITSTODOUBLE: case DOUBLETORAWLONGBITS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final DoubleWordItem v = (DoubleWordItem)vstack.pop(); v.load(ec); final int resultType = (mcode == LONGBITSTODOUBLE) ? JvmType.DOUBLE : JvmType.LONG; if (os.isCode32()) { final X86Register.GPR lsb = v.getLsbRegister(ec); final X86Register.GPR msb = v.getMsbRegister(ec); v.release(ec); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, resultType, lsb, msb)); } else { final GPR64 vreg = v.getRegister(ec); v.release(ec); vstack.push(L1AHelper.requestDoubleWordRegister(ec, resultType, vreg)); } } break; case BREAKPOINT: { if (Vm.VerifyAssertions) Vm._assert(isstatic); os.writeINT(3); } break; case CURRENTPROCESSOR: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem item = (RefItem)L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final int offset = ec.getContext().getVmProcessorMeField().getOffset(); if (os.isCode32()) { os.writePrefix(X86Constants.FS_PREFIX); os.writeMOV(item.getRegister(), offset); } else { os.writeMOV(BITS64, item.getRegister(), X86Register.R12, offset); } vstack.push(item); } break; // xyzArray classes case ARR_CREATE: { if (os.isCode32()) { bcv.visit_newarray(10); // int[] } else { bcv.visit_newarray(11); // long[] } } break; case ARR_GET: { bcv.waload(JvmType.REFERENCE); } break; case ARR_SET: { bcv.wastore(JvmType.REFERENCE); } break; case ARR_LENGTH: { bcv.visit_arraylength(); } break; default: throw new InternalError("Unknown method code for method " + method); } }
| 3,627
|
public void emitMagic(EmitterContext ec, VmMethod method, boolean isstatic, X86BytecodeVisitor bcv) { //final int type = getClass(method); final MagicMethod mcode = MagicMethod.get(method); final VirtualStack vstack = ec.getVStack(); final X86Assembler os = ec.getStream(); final ItemFactory ifac = ec.getItemFactory(); final X86RegisterPool pool = ec.getGPRPool();// final EntryPoints context = ec.getContext(); final X86CompilerHelper helper = ec.getHelper(); final int slotSize = os.isCode32() ? 4 : 8; switch (mcode) { case ADD: { // addr + ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeADD(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case AND: { // addr & ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeAND(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case OR: { // addr | ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeOR(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case SUB: case DIFF: { // addr - ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeSUB(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case XOR: { // addr ^ ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeXOR(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case NOT: { // !addr if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); os.writeNOT(addr.getRegister()); vstack.push(addr); } break; case TOINT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); X86Register r = addr.getRegister(); if (os.isCode64()) { r = pool.getRegisterInSameGroup(r, JvmType.INT); // We just take the lower 32-bit, so no actual mov's needed. } addr.release(ec); L1AHelper.requestRegister(ec, r); final IntItem result = (IntItem) ifac.createReg(ec, JvmType.INT, r); pool.transferOwnerTo(r, result); vstack.push(result); } break; case TOWORD: case TOADDRESS: case TOOFFSET: case TOOBJECT: case TOOBJECTREFERENCE: case TOEXTENT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); vstack.push(addr); } break; case TOLONG: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final X86Register.GPR r = addr.getRegister(); addr.release(ec); L1AHelper.requestRegister(ec, r); final LongItem result; if (os.isCode32()) { final X86Register.GPR msb = (X86Register.GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); result = (LongItem) ifac.createReg(ec, JvmType.LONG, r, msb); os.writeXOR(msb, msb); pool.transferOwnerTo(msb, result); } else { result = (LongItem) ifac.createReg(ec, JvmType.LONG, (GPR64)r); } pool.transferOwnerTo(r, result); vstack.push(result); } break; case MAX: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = (RefItem) L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV_Const(r, -1); vstack.push(result); } break; case ONE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = (RefItem) L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV_Const(r, 1); vstack.push(result); } break; case ZERO: case NULLREFERENCE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = ifac.createAConst(ec, null); vstack.push(result); } break; case ISMAX: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR addrr = addr.getRegister(); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeCMP_Const(addrr, -1); os.writeSETCC(resultr, X86Constants.JE); addr.release(ec); vstack.push(result); } break; case ISZERO: case ISNULL: { // Just convert to int if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR addrr = addr.getRegister(); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeTEST(addrr, addrr); os.writeSETCC(resultr, X86Constants.JZ); addr.release(ec); vstack.push(result); } break; case EQUALS: case EQ: case NE: case LT: case LE: case GE: case GT: case SLT: case SLE: case SGE: case SGT: { // addr .. other if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem other = vstack.popRef(); final RefItem addr = vstack.popRef(); other.load(ec); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeCMP(addr.getRegister(), other.getRegister()); os.writeSETCC(resultr, methodToCC(mcode)); other.release(ec); addr.release(ec); vstack.push(result); } break; case FROMINT: case FROMINTSIGNEXTEND: case FROMINTZEROEXTEND: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem addr = vstack.popInt(); addr.load(ec); GPR r = addr.getRegister(); if (os.isCode64()) { final GPR64 newR = (GPR64)pool.getRegisterInSameGroup(r, JvmType.REFERENCE); if (mcode == FROMINTZEROEXTEND) { // Moving the register to itself in 32-bit mode, will // zero extend the top 32-bits. os.writeMOV(BITS32, r, r); } else { // Sign extend os.writeMOVSXD(newR, (GPR32)r); } r = newR; } addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case FROMADDRESS: case FROMOBJECT: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); // Do nothing vstack.push(obj); } break; case FROMLONG: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final LongItem addr = vstack.popLong(); addr.load(ec); final X86Register r; if (os.isCode32()) { r = addr.getLsbRegister(ec); } else { r = addr.getRegister(ec); } addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case LSH: case RSHA: case RSHL: { // addr shift cnt if (Vm.VerifyAssertions) Vm._assert(!isstatic); final IntItem cnt = vstack.popInt(); final RefItem addr = vstack.popRef(); if (!cnt.isConstant()) { L1AHelper.requestRegister(ec, X86Register.ECX); cnt.loadTo(ec, X86Register.ECX); } addr.load(ec); final int shift = methodToShift(mcode); if (cnt.isConstant()) { os.writeShift(shift, addr.getRegister(), cnt.getValue()); } else { os.writeShift_CL(shift, addr.getRegister()); } cnt.release(ec); vstack.push(addr); } break; case LOADBYTE: case LOADCHAR: case LOADSHORT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.loadToBITS8GPR(ec); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), true); final GPR resultr = result.getRegister(); if (mcode == LOADCHAR) { os.writeMOVZX(resultr, r, 0, methodToSize(mcode)); } else { os.writeMOVSX(resultr, r, 0, methodToSize(mcode)); } addr.release(ec); vstack.push(result); } break; case LOADINT: case LOADFLOAT: case LOADADDRESS: case LOADOBJECTREFERENCE: case LOADWORD: case PREPAREINT: case PREPAREADDRESS: case PREPAREOBJECTREFERENCE: case PREPAREWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), false); final GPR resultr = result.getRegister(); os.writeMOV(resultr.getSize(), resultr, r, 0); addr.release(ec); vstack.push(result); } break; case LOADLONG: case LOADDOUBLE: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); final X86Register.GPR r = addr.getRegister(); if (os.isCode32()) { final X86Register.GPR msb = (X86Register.GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); addr.release(ec); L1AHelper.releaseRegister(ec, msb); os.writeMOV(X86CompilerConstants.INTSIZE, msb, r, X86CompilerConstants.MSB); os.writeMOV(X86CompilerConstants.INTSIZE, r, r, X86CompilerConstants.LSB); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode), r, msb)); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode)); os.writeMOV(BITS64, result.getRegister(ec), r, 0); addr.release(ec); vstack.push(result); } } break; case LOADBYTE_OFS: case LOADCHAR_OFS: case LOADSHORT_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); os.writeLEA(r, r, ofsr, 1, 0); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), true); final GPR resultr = result.getRegister(); if (mcode == LOADCHAR_OFS) { os.writeMOVZX(resultr, r, 0, methodToSize(mcode)); } else { os.writeMOVSX(resultr, r, 0, methodToSize(mcode)); } ofs.release(ec); addr.release(ec); vstack.push(result); } break; case LOADINT_OFS: case LOADFLOAT_OFS: case LOADADDRESS_OFS: case LOADOBJECTREFERENCE_OFS: case LOADWORD_OFS: case PREPAREINT_OFS: case PREPAREADDRESS_OFS: case PREPAREOBJECTREFERENCE_OFS: case PREPAREWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), false); final GPR resultr = result.getRegister(); os.writeMOV(resultr.getSize(), resultr, r, ofsr, 1, 0); ofs.release(ec); addr.release(ec); vstack.push(result); } break; case LOADLONG_OFS: case LOADDOUBLE_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); if (os.isCode32()) { final GPR msb = (GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); os.writeMOV(X86CompilerConstants.INTSIZE, msb, r, ofsr, 1, X86CompilerConstants.MSB); os.writeMOV(X86CompilerConstants.INTSIZE, r, r, ofsr, 1, X86CompilerConstants.LSB); ofs.release(ec); addr.release(ec); L1AHelper.releaseRegister(ec, msb); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode), r, msb)); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode)); os.writeMOV(BITS64, result.getRegister(ec), r, ofsr, 1, 0); addr.release(ec); ofs.release(ec); vstack.push(result); } } break; case STOREBYTE: case STORECHAR: case STORESHORT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final IntItem val = vstack.popInt(); final RefItem addr = vstack.popRef(); val.loadToBITS8GPR(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(methodToSize(mcode), r, 0, valr); val.release(ec); addr.release(ec); } break; case STOREINT: case STOREFLOAT: case STOREADDRESS: case STOREOBJECTREFERENCE: case STOREWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem val = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(valr.getSize(), r, 0, valr); val.release(ec); addr.release(ec); } break; case STORELONG: case STOREDOUBLE: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final DoubleWordItem val = (DoubleWordItem)vstack.pop(); final RefItem addr = vstack.popRef(); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); if (os.isCode32()) { final GPR lsb = val.getLsbRegister(ec); final GPR msb = val.getMsbRegister(ec); os.writeMOV(X86CompilerConstants.INTSIZE, r, X86CompilerConstants.LSB, lsb); os.writeMOV(X86CompilerConstants.INTSIZE, r, X86CompilerConstants.MSB, msb); } else { final GPR64 valr = val.getRegister(ec); os.writeMOV(BITS64, r, 0, valr); } val.release(ec); addr.release(ec); } break; case STOREBYTE_OFS: case STORECHAR_OFS: case STORESHORT_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final IntItem val = vstack.popInt(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.loadToBITS8GPR(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(methodToSize(mcode), r, ofsr, 1, 0, valr); ofs.release(ec); val.release(ec); addr.release(ec); } break; case STOREINT_OFS: case STOREFLOAT_OFS: case STOREADDRESS_OFS: case STOREOBJECTREFERENCE_OFS: case STOREWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final WordItem val = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(valr.getSize(), r, ofsr, 1, 0, valr); ofs.release(ec); val.release(ec); addr.release(ec); } break; case STORELONG_OFS: case STOREDOUBLE_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final DoubleWordItem val = (DoubleWordItem)vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); if (os.isCode32()) { final GPR lsb = val.getLsbRegister(ec); final GPR msb = val.getMsbRegister(ec); os.writeMOV(X86CompilerConstants.INTSIZE, r, ofsr, 1, X86CompilerConstants.LSB, lsb); os.writeMOV(X86CompilerConstants.INTSIZE, r, ofsr, 1, X86CompilerConstants.MSB, msb); } else { final GPR64 valr = val.getRegister(ec); os.writeMOV(BITS64, r, ofsr, 1, 0, valr); } ofs.release(ec); val.release(ec); addr.release(ec); } break; case ATTEMPTINT: case ATTEMPTADDRESS: case ATTEMPTOBJECTREFERENCE: case ATTEMPTWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem val = (WordItem)vstack.pop(); final WordItem old = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); final X86Register.GPR aax; if ((mcode == ATTEMPTINT) || os.isCode32()) { aax = X86Register.EAX; } else { aax = X86Register.RAX; } if (!old.uses(aax)) { L1AHelper.requestRegister(ec, aax, old); val.load(ec); old.loadTo(ec, aax); } else { val.load(ec); } addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeCMPXCHG_EAX(r, 0, valr, true); os.writeSETCC(resultr, X86Constants.JZ); os.writeAND(resultr, 0xFF); val.release(ec); old.release(ec); addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.INT, resultr)); } break; case ATTEMPTINT_OFS: case ATTEMPTADDRESS_OFS: case ATTEMPTOBJECTREFERENCE_OFS: case ATTEMPTWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final WordItem val = (WordItem)vstack.pop(); final WordItem old = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); final X86Register.GPR aax; if ((mcode == ATTEMPTINT) || os.isCode32()) { aax = X86Register.EAX; } else { aax = X86Register.RAX; } if (!old.uses(aax)) { L1AHelper.requestRegister(ec, aax, old); ofs.load(ec); val.load(ec); old.loadTo(ec, aax); } else { ofs.load(ec); val.load(ec); } addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); final GPR ofsr = ofs.getRegister(); os.writeLEA(r, r, ofsr, 1, 0); os.writeCMPXCHG_EAX(r, 0, valr, true); os.writeSETCC(resultr, X86Constants.JZ); os.writeAND(resultr, 0xFF); ofs.release(ec); val.release(ec); old.release(ec); addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.INT, resultr)); } break; case GETOBJECTTYPE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final RefItem result = (RefItem)L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR resultr = result.getRegister(); // Get TIB os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.TIB_SLOT * slotSize); // Get VmType os.writeMOV(helper.ADDRSIZE, resultr, r, (TIBLayout.VMTYPE_INDEX + VmArray.DATA_OFFSET) * slotSize); obj.release(ec); vstack.push(result); } break; case GETTIB: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); // Get TIB os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.TIB_SLOT * slotSize); vstack.push(obj); } break; case GETOBJECTFLAGS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); // Get flags os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.FLAGS_SLOT * slotSize); obj.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case SETOBJECTFLAGS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem flags = vstack.popRef(); final RefItem obj = vstack.popRef(); flags.load(ec); obj.load(ec); final GPR flagsr = flags.getRegister(); final GPR r = obj.getRegister(); // Set flags os.writeMOV(helper.ADDRSIZE, r, ObjectLayout.FLAGS_SLOT * slotSize, flagsr); flags.release(ec); obj.release(ec); } break; case GETARRAYDATA: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); os.writeADD(r, VmArray.DATA_OFFSET * slotSize); vstack.push(obj); } break; case GETOBJECTCOLOR: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, false); final GPR resultr = result.getRegister(); // Get flags os.writeMOV(BITS32, resultr, r, ObjectLayout.FLAGS_SLOT * slotSize); os.writeAND(resultr, ObjectFlags.GC_COLOUR_MASK); obj.release(ec); vstack.push(result); } break; case ISFINALIZED: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, false); final GPR resultr = result.getRegister(); // Get flags os.writeMOV(BITS32, resultr, r, ObjectLayout.FLAGS_SLOT * slotSize); os.writeAND(resultr, ObjectFlags.STATUS_FINALIZED); obj.release(ec); vstack.push(result); } break; case ATOMICADD: case ATOMICAND: case ATOMICOR: case ATOMICSUB: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem value = vstack.popRef(); final RefItem addr = vstack.popRef(); value.load(ec); addr.load(ec); final X86Register.GPR valuer = (X86Register.GPR)value.getRegister(); final X86Register.GPR r = (X86Register.GPR)addr.getRegister(); os.writePrefix(X86Constants.LOCK_PREFIX); os.writeArithOp(methodCodeToOperation(mcode), r, 0, valuer); value.release(ec); addr.release(ec); } break; case GETCURRENTFRAME: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem result = L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV(helper.ADDRSIZE, r, helper.BP); vstack.push(result); } break; case GETTIMESTAMP: { if (Vm.VerifyAssertions) Vm._assert(isstatic); if (os.isCode32()) { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, JvmType.LONG, X86Register.EAX, X86Register.EDX); os.writeRDTSC(); vstack.push(result); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegister(ec, JvmType.LONG, X86Register.RAX); L1AHelper.requestRegister(ec, X86Register.RDX); os.writeRDTSC(); // Move MSB to upper 32-bit of RDX os.writeSHL(X86Register.RDX, 32); // RAX is zero extended by RDTSC, so an OR of RAX,RDX will combine // the upper 32-bits of RDX and the lower 32-bits of RAX. os.writeOR(X86Register.RAX, X86Register.RDX); // Now free RDX L1AHelper.releaseRegister(ec, X86Register.RDX); vstack.push(result); } } break; case INTBITSTOFLOAT: case FLOATTORAWINTBITS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem v = (WordItem)vstack.pop(); v.load(ec); final X86Register.GPR r = v.getRegister(); v.release(ec); final int resultType = (mcode == INTBITSTOFLOAT) ? JvmType.FLOAT : JvmType.INT; vstack.push(L1AHelper.requestWordRegister(ec, resultType, r)); } break; case LONGBITSTODOUBLE: case DOUBLETORAWLONGBITS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final DoubleWordItem v = (DoubleWordItem)vstack.pop(); v.load(ec); final int resultType = (mcode == LONGBITSTODOUBLE) ? JvmType.DOUBLE : JvmType.LONG; if (os.isCode32()) { final X86Register.GPR lsb = v.getLsbRegister(ec); final X86Register.GPR msb = v.getMsbRegister(ec); v.release(ec); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, resultType, lsb, msb)); } else { final GPR64 vreg = v.getRegister(ec); v.release(ec); vstack.push(L1AHelper.requestDoubleWordRegister(ec, resultType, vreg)); } } break; case BREAKPOINT: { if (Vm.VerifyAssertions) Vm._assert(isstatic); os.writeINT(3); } break; case CURRENTPROCESSOR: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem item = (RefItem)L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final int offset = ec.getContext().getVmProcessorMeField().getOffset(); if (os.isCode32()) { os.writePrefix(X86Constants.FS_PREFIX); os.writeMOV(item.getRegister(), offset); } else { os.writeMOV(BITS64, item.getRegister(), X86Register.R12, offset); } vstack.push(item); } break; // xyzArray classes case ARR_CREATE: { if (os.isCode32()) { bcv.visit_newarray(10); // int[] } else { bcv.visit_newarray(11); // long[] } } break; case ARR_GET: { bcv.waload(JvmType.REFERENCE); } break; case ARR_SET: { bcv.wastore(JvmType.REFERENCE); } break; case ARR_LENGTH: { bcv.visit_arraylength(); } break; default: throw new InternalError("Unknown method code for method " + method); } }
|
public void emitMagic(EmitterContext ec, VmMethod method, boolean isstatic, X86BytecodeVisitor bcv) { //final int type = getClass(method); final MagicMethod mcode = MagicMethod.get(method); final VirtualStack vstack = ec.getVStack(); final X86Assembler os = ec.getStream(); final ItemFactory ifac = ec.getItemFactory(); final X86RegisterPool pool = ec.getGPRPool();// final EntryPoints context = ec.getContext(); final X86CompilerHelper helper = ec.getHelper(); final int slotSize = os.isCode32() ? 4 : 8; switch (mcode) { case ADD: { // addr + ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeADD(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case AND: { // addr & ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeAND(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case OR: { // addr | ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeOR(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case SUB: case DIFF: { // addr - ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeSUB(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case XOR: { // addr ^ ofs if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem ofs = (WordItem) vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); GPR ofsr = ofs.getRegister(); final GPR addrr = addr.getRegister(); if (ofsr.getSize() != addrr.getSize()) { // Sign-extend offset final GPR64 ofsr64 = (GPR64)pool.getRegisterInSameGroup(ofsr, JvmType.REFERENCE); os.writeMOVSXD(ofsr64, (GPR32)ofsr); ofsr = ofsr64; } os.writeXOR(addrr, ofsr); ofs.release(ec); vstack.push(addr); } break; case NOT: { // !addr if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); os.writeNOT(addr.getRegister()); vstack.push(addr); } break; case TOINT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); X86Register r = addr.getRegister(); if (os.isCode64()) { r = pool.getRegisterInSameGroup(r, JvmType.INT); // We just take the lower 32-bit, so no actual mov's needed. } addr.release(ec); L1AHelper.requestRegister(ec, r); final IntItem result = (IntItem) ifac.createReg(ec, JvmType.INT, r); pool.transferOwnerTo(r, result); vstack.push(result); } break; case TOWORD: case TOADDRESS: case TOOFFSET: case TOOBJECT: case TOOBJECTREFERENCE: case TOEXTENT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); vstack.push(addr); } break; case TOLONG: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final X86Register.GPR r = addr.getRegister(); addr.release(ec); L1AHelper.requestRegister(ec, r); final LongItem result; if (os.isCode32()) { final X86Register.GPR msb = (X86Register.GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); result = (LongItem) ifac.createReg(ec, JvmType.LONG, r, msb); os.writeXOR(msb, msb); pool.transferOwnerTo(msb, result); } else { result = (LongItem) ifac.createReg(ec, JvmType.LONG, (GPR64)r); } pool.transferOwnerTo(r, result); vstack.push(result); } break; case MAX: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = (RefItem) L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV_Const(r, -1); vstack.push(result); } break; case ONE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = (RefItem) L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV_Const(r, 1); vstack.push(result); } break; case ZERO: case NULLREFERENCE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem result = ifac.createAConst(ec, null); vstack.push(result); } break; case ISMAX: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR addrr = addr.getRegister(); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeCMP_Const(addrr, -1); os.writeSETCC(resultr, X86Constants.JE); addr.release(ec); vstack.push(result); } break; case ISZERO: case ISNULL: { // Just convert to int if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem addr = vstack.popRef(); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR addrr = addr.getRegister(); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeTEST(addrr, addrr); os.writeSETCC(resultr, X86Constants.JZ); addr.release(ec); vstack.push(result); } break; case EQUALS: case EQ: case NE: case LT: case LE: case GE: case GT: case SLT: case SLE: case SGE: case SGT: { // addr .. other if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem other = vstack.popRef(); final RefItem addr = vstack.popRef(); other.load(ec); addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); os.writeXOR(resultr, resultr); os.writeCMP(addr.getRegister(), other.getRegister()); os.writeSETCC(resultr, methodToCC(mcode)); other.release(ec); addr.release(ec); vstack.push(result); } break; case FROMINT: case FROMINTSIGNEXTEND: case FROMINTZEROEXTEND: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem addr = vstack.popInt(); addr.load(ec); GPR r = addr.getRegister(); if (os.isCode64()) { final GPR64 newR = (GPR64)pool.getRegisterInSameGroup(r, JvmType.REFERENCE); if (mcode == FROMINTZEROEXTEND) { // Moving the register to itself in 32-bit mode, will // zero extend the top 32-bits. os.writeMOV(BITS32, r, r); } else { // Sign extend os.writeMOVSXD(newR, (GPR32)r); } r = newR; } addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case FROMADDRESS: case FROMOBJECT: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); // Do nothing vstack.push(obj); } break; case FROMLONG: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final LongItem addr = vstack.popLong(); addr.load(ec); final X86Register r; if (os.isCode32()) { r = addr.getLsbRegister(ec); } else { r = addr.getRegister(ec); } addr.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case LSH: case RSHA: case RSHL: { // addr shift cnt if (Vm.VerifyAssertions) Vm._assert(!isstatic); final IntItem cnt = vstack.popInt(); final RefItem addr = vstack.popRef(); if (!cnt.isConstant()) { L1AHelper.requestRegister(ec, X86Register.ECX); cnt.loadTo(ec, X86Register.ECX); } addr.load(ec); final int shift = methodToShift(mcode); if (cnt.isConstant()) { os.writeShift(shift, addr.getRegister(), cnt.getValue()); } else { os.writeShift_CL(shift, addr.getRegister()); } cnt.release(ec); vstack.push(addr); } break; case LOADBYTE: case LOADCHAR: case LOADSHORT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.loadToBITS8GPR(ec); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), true); final GPR resultr = result.getRegister(); if (mcode == LOADCHAR) { os.writeMOVZX(resultr, r, 0, methodToSize(mcode)); } else { os.writeMOVSX(resultr, r, 0, methodToSize(mcode)); } addr.release(ec); vstack.push(result); } break; case LOADINT: case LOADFLOAT: case LOADADDRESS: case LOADOBJECTREFERENCE: case LOADWORD: case PREPAREINT: case PREPAREADDRESS: case PREPAREOBJECTREFERENCE: case PREPAREWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), false); final GPR resultr = result.getRegister(); os.writeMOV(resultr.getSize(), resultr, r, 0); addr.release(ec); vstack.push(result); } break; case LOADLONG: case LOADDOUBLE: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem addr = vstack.popRef(); addr.load(ec); final X86Register.GPR r = addr.getRegister(); if (os.isCode32()) { final X86Register.GPR msb = (X86Register.GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); addr.release(ec); L1AHelper.releaseRegister(ec, msb); os.writeMOV(X86CompilerConstants.INTSIZE, msb, r, X86CompilerConstants.MSB); os.writeMOV(X86CompilerConstants.INTSIZE, r, r, X86CompilerConstants.LSB); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode), r, msb)); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode)); os.writeMOV(BITS64, result.getRegister(ec), r, 0); addr.release(ec); vstack.push(result); } } break; case LOADBYTE_OFS: case LOADCHAR_OFS: case LOADSHORT_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); os.writeLEA(r, r, ofsr, 1, 0); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), true); final GPR resultr = result.getRegister(); if (mcode == LOADCHAR_OFS) { os.writeMOVZX(resultr, r, 0, methodToSize(mcode)); } else { os.writeMOVSX(resultr, r, 0, methodToSize(mcode)); } ofs.release(ec); addr.release(ec); vstack.push(result); } break; case LOADINT_OFS: case LOADFLOAT_OFS: case LOADADDRESS_OFS: case LOADOBJECTREFERENCE_OFS: case LOADWORD_OFS: case PREPAREINT_OFS: case PREPAREADDRESS_OFS: case PREPAREOBJECTREFERENCE_OFS: case PREPAREWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); final WordItem result = L1AHelper.requestWordRegister(ec, methodToType(mcode), false); final GPR resultr = result.getRegister(); os.writeMOV(resultr.getSize(), resultr, r, ofsr, 1, 0); ofs.release(ec); addr.release(ec); vstack.push(result); } break; case LOADLONG_OFS: case LOADDOUBLE_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final RefItem addr = vstack.popRef(); ofs.load(ec); addr.load(ec); final GPR ofsr = ofs.getRegister(); final GPR r = addr.getRegister(); if (os.isCode32()) { final GPR msb = (GPR)L1AHelper.requestRegister(ec, JvmType.INT, false); os.writeMOV(X86CompilerConstants.INTSIZE, msb, r, ofsr, 1, X86CompilerConstants.MSB); os.writeMOV(X86CompilerConstants.INTSIZE, r, r, ofsr, 1, X86CompilerConstants.LSB); ofs.release(ec); addr.release(ec); L1AHelper.releaseRegister(ec, msb); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode), r, msb)); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, methodToType(mcode)); os.writeMOV(BITS64, result.getRegister(ec), r, ofsr, 1, 0); addr.release(ec); ofs.release(ec); vstack.push(result); } } break; case STOREBYTE: case STORECHAR: case STORESHORT: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final IntItem val = vstack.popInt(); final RefItem addr = vstack.popRef(); val.loadToBITS8GPR(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(methodToSize(mcode), r, 0, valr); val.release(ec); addr.release(ec); } break; case STOREINT: case STOREFLOAT: case STOREADDRESS: case STOREOBJECTREFERENCE: case STOREWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem val = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(valr.getSize(), r, 0, valr); val.release(ec); addr.release(ec); } break; case STORELONG: case STOREDOUBLE: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final DoubleWordItem val = (DoubleWordItem)vstack.pop(); final RefItem addr = vstack.popRef(); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); if (os.isCode32()) { final GPR lsb = val.getLsbRegister(ec); final GPR msb = val.getMsbRegister(ec); os.writeMOV(X86CompilerConstants.INTSIZE, r, X86CompilerConstants.LSB, lsb); os.writeMOV(X86CompilerConstants.INTSIZE, r, X86CompilerConstants.MSB, msb); } else { final GPR64 valr = val.getRegister(ec); os.writeMOV(BITS64, r, 0, valr); } val.release(ec); addr.release(ec); } break; case STOREBYTE_OFS: case STORECHAR_OFS: case STORESHORT_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final IntItem val = vstack.popInt(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.loadToBITS8GPR(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(methodToSize(mcode), r, ofsr, 1, 0, valr); ofs.release(ec); val.release(ec); addr.release(ec); } break; case STOREINT_OFS: case STOREFLOAT_OFS: case STOREADDRESS_OFS: case STOREOBJECTREFERENCE_OFS: case STOREWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final WordItem val = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); final GPR valr = val.getRegister(); os.writeMOV(valr.getSize(), r, ofsr, 1, 0, valr); ofs.release(ec); val.release(ec); addr.release(ec); } break; case STORELONG_OFS: case STOREDOUBLE_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final DoubleWordItem val = (DoubleWordItem)vstack.pop(); final RefItem addr = vstack.popRef(); ofs.load(ec); val.load(ec); addr.load(ec); final GPR r = addr.getRegister(); final GPR ofsr = ofs.getRegister(); if (os.isCode32()) { final GPR lsb = val.getLsbRegister(ec); final GPR msb = val.getMsbRegister(ec); os.writeMOV(X86CompilerConstants.INTSIZE, r, ofsr, 1, X86CompilerConstants.LSB, lsb); os.writeMOV(X86CompilerConstants.INTSIZE, r, ofsr, 1, X86CompilerConstants.MSB, msb); } else { final GPR64 valr = val.getRegister(ec); os.writeMOV(BITS64, r, ofsr, 1, 0, valr); } ofs.release(ec); val.release(ec); addr.release(ec); } break; case ATTEMPTINT: case ATTEMPTADDRESS: case ATTEMPTOBJECTREFERENCE: case ATTEMPTWORD: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final WordItem val = (WordItem)vstack.pop(); final WordItem old = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); final X86Register.GPR aax; if ((mcode == ATTEMPTINT) || os.isCode32()) { aax = X86Register.EAX; } else { aax = X86Register.RAX; } if (!old.uses(aax)) { L1AHelper.requestRegister(ec, aax, old); val.load(ec); old.loadTo(ec, aax); } else { val.load(ec); } addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); os.writeCMPXCHG_EAX(r, 0, valr, true); os.writeSETCC(resultr, X86Constants.JZ); os.writeAND(resultr, 0xFF); val.release(ec); old.release(ec); addr.release(ec); vstack.push(result); } break; case ATTEMPTINT_OFS: case ATTEMPTADDRESS_OFS: case ATTEMPTOBJECTREFERENCE_OFS: case ATTEMPTWORD_OFS: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem ofs = vstack.popRef(); final WordItem val = (WordItem)vstack.pop(); final WordItem old = (WordItem)vstack.pop(); final RefItem addr = vstack.popRef(); final X86Register.GPR aax; if ((mcode == ATTEMPTINT) || os.isCode32()) { aax = X86Register.EAX; } else { aax = X86Register.RAX; } if (!old.uses(aax)) { L1AHelper.requestRegister(ec, aax, old); ofs.load(ec); val.load(ec); old.loadTo(ec, aax); } else { ofs.load(ec); val.load(ec); } addr.load(ec); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, true); final GPR resultr = result.getRegister(); final GPR r = addr.getRegister(); final GPR valr = val.getRegister(); final GPR ofsr = ofs.getRegister(); os.writeLEA(r, r, ofsr, 1, 0); os.writeCMPXCHG_EAX(r, 0, valr, true); os.writeSETCC(resultr, X86Constants.JZ); os.writeAND(resultr, 0xFF); ofs.release(ec); val.release(ec); old.release(ec); addr.release(ec); vstack.push(result); } break; case GETOBJECTTYPE: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final RefItem result = (RefItem)L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR resultr = result.getRegister(); // Get TIB os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.TIB_SLOT * slotSize); // Get VmType os.writeMOV(helper.ADDRSIZE, resultr, r, (TIBLayout.VMTYPE_INDEX + VmArray.DATA_OFFSET) * slotSize); obj.release(ec); vstack.push(result); } break; case GETTIB: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); // Get TIB os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.TIB_SLOT * slotSize); vstack.push(obj); } break; case GETOBJECTFLAGS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); // Get flags os.writeMOV(helper.ADDRSIZE, r, r, ObjectLayout.FLAGS_SLOT * slotSize); obj.release(ec); vstack.push(L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, r)); } break; case SETOBJECTFLAGS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem flags = vstack.popRef(); final RefItem obj = vstack.popRef(); flags.load(ec); obj.load(ec); final GPR flagsr = flags.getRegister(); final GPR r = obj.getRegister(); // Set flags os.writeMOV(helper.ADDRSIZE, r, ObjectLayout.FLAGS_SLOT * slotSize, flagsr); flags.release(ec); obj.release(ec); } break; case GETARRAYDATA: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); os.writeADD(r, VmArray.DATA_OFFSET * slotSize); vstack.push(obj); } break; case GETOBJECTCOLOR: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, false); final GPR resultr = result.getRegister(); // Get flags os.writeMOV(BITS32, resultr, r, ObjectLayout.FLAGS_SLOT * slotSize); os.writeAND(resultr, ObjectFlags.GC_COLOUR_MASK); obj.release(ec); vstack.push(result); } break; case ISFINALIZED: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem obj = vstack.popRef(); obj.load(ec); final GPR r = obj.getRegister(); final IntItem result = (IntItem)L1AHelper.requestWordRegister(ec, JvmType.INT, false); final GPR resultr = result.getRegister(); // Get flags os.writeMOV(BITS32, resultr, r, ObjectLayout.FLAGS_SLOT * slotSize); os.writeAND(resultr, ObjectFlags.STATUS_FINALIZED); obj.release(ec); vstack.push(result); } break; case ATOMICADD: case ATOMICAND: case ATOMICOR: case ATOMICSUB: { if (Vm.VerifyAssertions) Vm._assert(!isstatic); final RefItem value = vstack.popRef(); final RefItem addr = vstack.popRef(); value.load(ec); addr.load(ec); final X86Register.GPR valuer = (X86Register.GPR)value.getRegister(); final X86Register.GPR r = (X86Register.GPR)addr.getRegister(); os.writePrefix(X86Constants.LOCK_PREFIX); os.writeArithOp(methodCodeToOperation(mcode), r, 0, valuer); value.release(ec); addr.release(ec); } break; case GETCURRENTFRAME: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem result = L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final GPR r = result.getRegister(); os.writeMOV(helper.ADDRSIZE, r, helper.BP); vstack.push(result); } break; case GETTIMESTAMP: { if (Vm.VerifyAssertions) Vm._assert(isstatic); if (os.isCode32()) { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters(ec, JvmType.LONG, X86Register.EAX, X86Register.EDX); os.writeRDTSC(); vstack.push(result); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegister(ec, JvmType.LONG, X86Register.RAX); L1AHelper.requestRegister(ec, X86Register.RDX); os.writeRDTSC(); // Move MSB to upper 32-bit of RDX os.writeSHL(X86Register.RDX, 32); // RAX is zero extended by RDTSC, so an OR of RAX,RDX will combine // the upper 32-bits of RDX and the lower 32-bits of RAX. os.writeOR(X86Register.RAX, X86Register.RDX); // Now free RDX L1AHelper.releaseRegister(ec, X86Register.RDX); vstack.push(result); } } break; case INTBITSTOFLOAT: case FLOATTORAWINTBITS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final WordItem v = (WordItem)vstack.pop(); v.load(ec); final X86Register.GPR r = v.getRegister(); v.release(ec); final int resultType = (mcode == INTBITSTOFLOAT) ? JvmType.FLOAT : JvmType.INT; vstack.push(L1AHelper.requestWordRegister(ec, resultType, r)); } break; case LONGBITSTODOUBLE: case DOUBLETORAWLONGBITS: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final DoubleWordItem v = (DoubleWordItem)vstack.pop(); v.load(ec); final int resultType = (mcode == LONGBITSTODOUBLE) ? JvmType.DOUBLE : JvmType.LONG; if (os.isCode32()) { final X86Register.GPR lsb = v.getLsbRegister(ec); final X86Register.GPR msb = v.getMsbRegister(ec); v.release(ec); vstack.push(L1AHelper.requestDoubleWordRegisters(ec, resultType, lsb, msb)); } else { final GPR64 vreg = v.getRegister(ec); v.release(ec); vstack.push(L1AHelper.requestDoubleWordRegister(ec, resultType, vreg)); } } break; case BREAKPOINT: { if (Vm.VerifyAssertions) Vm._assert(isstatic); os.writeINT(3); } break; case CURRENTPROCESSOR: { if (Vm.VerifyAssertions) Vm._assert(isstatic); final RefItem item = (RefItem)L1AHelper.requestWordRegister(ec, JvmType.REFERENCE, false); final int offset = ec.getContext().getVmProcessorMeField().getOffset(); if (os.isCode32()) { os.writePrefix(X86Constants.FS_PREFIX); os.writeMOV(item.getRegister(), offset); } else { os.writeMOV(BITS64, item.getRegister(), X86Register.R12, offset); } vstack.push(item); } break; // xyzArray classes case ARR_CREATE: { if (os.isCode32()) { bcv.visit_newarray(10); // int[] } else { bcv.visit_newarray(11); // long[] } } break; case ARR_GET: { bcv.waload(JvmType.REFERENCE); } break; case ARR_SET: { bcv.wastore(JvmType.REFERENCE); } break; case ARR_LENGTH: { bcv.visit_arraylength(); } break; default: throw new InternalError("Unknown method code for method " + method); } }
| 3,628
|
public void createFileInstance(String fileName) throws FileNotFoundException { fout = new DataOutputStream(new FileOutputStream(fileName)); }
|
public void createFileInstance(String fileName) throws FileNotFoundException { try { fout = new DataOutputStream(new FileOutputStream(fileName)); } catch (Exception e) { System.out.println("create file " + e.getMessage()); } }
| 3,629
|
public void setFCWs(int fcw1, int fcw2) { this.fcw1 = fcw1; this.fcw2 = fcw2; if ((fcw1 & 0x88) == 0x88) { cursorProg = fcw2; } }
|
public void setFCWs(int fcw1, int fcw2) { this.fcw1 = fcw1; this.fcw2 = fcw2; if (fcw1 == 0x88) { cursorProg = fcw2; } }
| 3,634
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value != null) { if (value instanceof JTextField) return new JTextField(((JTextField)value).getText()); super.setText(value.toString()); } setOpaque(true); if (table == null) return this; if (isSelected) { setBackground(table.getSelectionBackground()); setForeground(table.getSelectionForeground()); } else { setBackground(table.getBackground()); setForeground(table.getForeground()); } setEnabled(table.isEnabled()); setFont(table.getFont()); return this; }
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value != null) { if (value instanceof JTextField) return new JTextField(((JTextField)value).getText()); super.setText(value.toString()); } setOpaque(true); if (table == null) return this; if (isSelected && hasFocus) { setBackground(table.getBackground()); setForeground(table.getSelectionForeground()); } else if (table.isRowSelected(row)) { setBackground(table.getSelectionBackground()); setForeground(table.getSelectionForeground()); } else { setBackground(table.getBackground()); setForeground(table.getForeground()); } setEnabled(table.isEnabled()); setFont(table.getFont()); return this; }
| 3,635
|
public void actionPerformed(ActionEvent e) { Object obj = filelist.getSelectedValue(); if (obj != null) { File f = filechooser.getFileSystemView().createFileObject(obj .toString()); if (filechooser.isTraversable(f)) filechooser.setCurrentDirectory(f); else { filechooser.setSelectedFile(f); filechooser.approveSelection(); closeDialog(); } } }
|
public void actionPerformed(ActionEvent e) { Object obj = filelist.getSelectedValue(); if (obj != null) { File f = filechooser.getFileSystemView().createFileObject(obj .toString()); if (filechooser.isTraversable(f) && filechooser.getFileSelectionMode() == JFileChooser.FILES_ONLY) filechooser.setCurrentDirectory(f); else { filechooser.setSelectedFile(f); filechooser.approveSelection(); closeDialog(); } } }
| 3,636
|
public Dimension getPreferredSize(JComponent c) { JToolTip tip = (JToolTip) c; Rectangle vr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); Insets insets = tip.getInsets(); FontMetrics fm = tip.getToolkit().getFontMetrics(tip.getFont()); SwingUtilities.layoutCompoundLabel(tip, fm, tip.getTipText(), null, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, vr, ir, tr, 0); return new Dimension(insets.left + tr.width + insets.right, insets.top + tr.height + insets.bottom); }
|
public Dimension getPreferredSize(JComponent c) { JToolTip tip = (JToolTip) c; Rectangle vr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); Insets insets = tip.getInsets(); FontMetrics fm = tip.getToolkit().getFontMetrics(tip.getFont()); SwingUtilities.layoutCompoundLabel(tip, fm, tip.getTipText(), null, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, vr, ir, tr, 0); return new Dimension(insets.left + tr.width + insets.right, insets.top + tr.height + insets.bottom); }
| 3,637
|
public void paint(Graphics g, JComponent c) { JToolTip tip = (JToolTip) c; String text = tip.getTipText(); if (text == null) return; Rectangle vr = new Rectangle(); vr = SwingUtilities.calculateInnerArea(tip, vr); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); FontMetrics fm = tip.getToolkit().getFontMetrics(tip.getFont()); SwingUtilities.layoutCompoundLabel(tip, fm, tip.getTipText(), null, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, vr, ir, tr, 0); Color saved = g.getColor(); g.setColor(Color.BLACK); g.drawString(text, vr.x, vr.y + fm.getAscent()); g.setColor(saved); }
|
public void paint(Graphics g, JComponent c) { JToolTip tip = (JToolTip) c; String text = tip.getTipText(); if (text == null) return; Rectangle vr = new Rectangle(); vr = SwingUtilities.calculateInnerArea(tip, vr); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); FontMetrics fm = tip.getToolkit().getFontMetrics(tip.getFont()); SwingUtilities.layoutCompoundLabel(tip, fm, tip.getTipText(), null, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, vr, ir, tr, 0); Color saved = g.getColor(); g.setColor(Color.BLACK); g.drawString(text, vr.x, vr.y + fm.getAscent()); g.setColor(saved); }
| 3,638
|
public void paint(Graphics g, JComponent c) { JToolTip tip = (JToolTip) c; String text = tip.getTipText(); if (text == null) return; Rectangle vr = new Rectangle(); vr = SwingUtilities.calculateInnerArea(tip, vr); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); FontMetrics fm = tip.getToolkit().getFontMetrics(tip.getFont()); SwingUtilities.layoutCompoundLabel(tip, fm, tip.getTipText(), null, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, vr, ir, tr, 0); Color saved = g.getColor(); g.setColor(Color.BLACK); g.drawString(text, vr.x, vr.y + fm.getAscent()); g.setColor(saved); }
|
public void paint(Graphics g, JComponent c) { JToolTip tip = (JToolTip) c; String text = tip.getTipText(); if (text == null) return; Rectangle vr = new Rectangle(); vr = SwingUtilities.calculateInnerArea(tip, vr); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); FontMetrics fm = tip.getToolkit().getFontMetrics(tip.getFont()); SwingUtilities.layoutCompoundLabel(tip, fm, tip.getTipText(), null, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, vr, ir, tr, 0); Color saved = g.getColor(); g.setColor(Color.BLACK); g.drawString(text, vr.x, vr.y + ascent); if (accText != null) { g.setColor(accFore); int textWidth = fm.stringWidth(text + " "); fm = t.getFontMetrics(accFont); int width = fm.stringWidth(accText); g.drawString(accText, textWidth, vr.y + ascent); } g.setColor(saved); }
| 3,639
|
public final void visit_checkcast(VmConstClass classRef) { // Resolve classRef classRef.resolve(loader); final VmType<?> resolvedType = classRef.getResolvedVmClass(); final Label curInstrLabel = getCurInstrLabel(); if (resolvedType.isInterface() || resolvedType.isArray()) { // ClassRef is an interface or array, do the slow test // Pre-claim ECX L1AHelper.requestRegister(eContext, helper.AAX); // check that top item is a reference final RefItem ref = vstack.popRef(); // Load the ref ref.load(eContext); final GPR refr = ref.getRegister(); final GPR classr = helper.AAX; final GPR cntr = (GPR) L1AHelper.requestRegister(eContext, JvmType.INT, false); final GPR tmpr = (GPR) L1AHelper.requestRegister(eContext, JvmType.REFERENCE, false); // Resolve the class writeResolveAndLoadClassToReg(classRef, classr); helper.writeClassInitialize(curInstrLabel, classr, resolvedType); final Label okLabel = new Label(curInstrLabel + "cc-ok"); /* Is objectref null? */ os.writeTEST(refr, refr); os.writeJCC(okLabel, X86Constants.JZ); /* Is instanceof? */ instanceOf(refr, classr, tmpr, cntr, okLabel, true); /* Not instanceof */ // Call classCastFailed os.writePUSH(refr); os.writePUSH(classr); // Release temp registers here, so invokeJavaMethod can use it L1AHelper.releaseRegister(eContext, cntr); L1AHelper.releaseRegister(eContext, tmpr); L1AHelper.releaseRegister(eContext, classr); invokeJavaMethod(context.getClassCastFailedMethod()); /* Normal exit */ os.setObjectRef(okLabel); // Leave ref on stack vstack.push(ref); } else { // classRef is a class, do the fast test // Pre-claim EAX/RAX L1AHelper.requestRegister(eContext, helper.AAX); // check that top item is a reference final RefItem ref = vstack.popRef(); // Load the ref ref.load(eContext); final GPR refr = ref.getRegister(); final GPR tmpr = (GPR) L1AHelper.requestRegister(eContext, JvmType.REFERENCE, false); final Label okLabel = new Label(curInstrLabel + "cc-ok"); // Is objectref null? os.writeTEST(refr, refr); os.writeJCC(okLabel, X86Constants.JZ); // Is instanceof? instanceOfClass(refr, (VmClassType<?>) resolvedType, tmpr, null, okLabel, true); // Not instanceof // Release temp registers here, so invokeJavaMethod can use it L1AHelper.releaseRegister(eContext, helper.AAX); L1AHelper.releaseRegister(eContext, tmpr); // Call SoftByteCodes.systemException os.writePUSH(refr); invokeJavaMethod(context.getClassCastFailedMethod()); /* Normal exit */ os.setObjectRef(okLabel); // Leave ref on stack vstack.push(ref); } }
|
public final void visit_checkcast(VmConstClass classRef) { // Resolve classRef classRef.resolve(loader); final VmType<?> resolvedType = classRef.getResolvedVmClass(); final Label curInstrLabel = getCurInstrLabel(); if (resolvedType.isInterface() || resolvedType.isArray()) { // ClassRef is an interface or array, do the slow test // Pre-claim ECX L1AHelper.requestRegister(eContext, helper.AAX); // check that top item is a reference final RefItem ref = vstack.popRef(); // Load the ref ref.load(eContext); final GPR refr = ref.getRegister(); final GPR classr = helper.AAX; final GPR cntr = (GPR) L1AHelper.requestRegister(eContext, JvmType.INT, false); final GPR tmpr = (GPR) L1AHelper.requestRegister(eContext, JvmType.REFERENCE, false); // Resolve the class writeResolveAndLoadClassToReg(classRef, classr); helper.writeClassInitialize(curInstrLabel, classr, resolvedType); final Label okLabel = new Label(curInstrLabel + "cc-ok"); /* Is objectref null? */ os.writeTEST(refr, refr); os.writeJCC(okLabel, X86Constants.JZ); /* Is instanceof? */ instanceOf(refr, classr, tmpr, cntr, okLabel, true); /* Not instanceof */ // Call classCastFailed os.writePUSH(refr); os.writePUSH(classr); // Release temp registers here, so invokeJavaMethod can use it L1AHelper.releaseRegister(eContext, cntr); L1AHelper.releaseRegister(eContext, tmpr); L1AHelper.releaseRegister(eContext, classr); invokeJavaMethod(context.getClassCastFailedMethod()); /* Normal exit */ os.setObjectRef(okLabel); // Leave ref on stack vstack.push(ref); } else { // classRef is a class, do the fast test // Pre-claim EAX/RAX L1AHelper.requestRegister(eContext, helper.AAX); // check that top item is a reference final RefItem ref = vstack.popRef(); // Load the ref ref.load(eContext); final GPR refr = ref.getRegister(); final GPR tmpr = (GPR) L1AHelper.requestRegister(eContext, JvmType.REFERENCE, false); final Label okLabel = new Label(curInstrLabel + "cc-ok"); // Is objectref null? os.writeTEST(refr, refr); os.writeJCC(okLabel, X86Constants.JZ); // Is instanceof? instanceOfClass(refr, (VmClassType<?>) resolvedType, tmpr, null, okLabel, true); // Not instanceof // Release temp registers here, so invokeJavaMethod can use it L1AHelper.releaseRegister(eContext, helper.AAX); L1AHelper.releaseRegister(eContext, tmpr); // Call SoftByteCodes.systemException os.writePUSH(refr); invokeJavaMethod(context.getClassCastFailedMethod()); /* Normal exit */ os.setObjectRef(okLabel); // Leave ref on stack vstack.push(ref); } }
| 3,640
|
public Container getFocusCycleRootAncestor() { // as defined. return null; }
|
public final Container getFocusCycleRootAncestor() { // as defined. return null; }
| 3,642
|
public String getWarningString() { // as defined. return null; }
|
public final String getWarningString() { // as defined. return null; }
| 3,643
|
public boolean isFocusCycleRoot() { return true; }
|
public final boolean isFocusCycleRoot() { return true; }
| 3,644
|
public ThreadDeath() { super(); }
|
public ThreadDeath() { }
| 3,645
|
public ARPHeader(SocketBuffer skbuf) throws SocketException { hwtype = skbuf.get16(0); ptype = skbuf.get16(2); //int hwsize = skbuf.get(4); //int psize = skbuf.get(5); op = skbuf.get16(6); if ((hwtype == 1) && (ptype == EthernetConstants.ETH_P_IP)) { srcHWAddress = new EthernetAddress(skbuf, 8); srcPAddress = new IPv4Address(skbuf, 14); targetHWAddress = new EthernetAddress(skbuf, 18); targetPAddress = new IPv4Address(skbuf, 24); } else { throw new SocketException("Unknown hw,ptype: " + hwtype + "," + ptype); } }
|
public ARPHeader(SocketBuffer skbuf) throws SocketException { hwtype = skbuf.get16(0); ptype = skbuf.get16(2); //int hwsize = skbuf.get(4); //int psize = skbuf.get(5); op = skbuf.get16(6); if ((hwtype == 1) && (ptype == EthernetConstants.ETH_P_IP)) { srcHWAddress = new EthernetAddress(skbuf, 8); srcPAddress = new IPv4Address(skbuf, 14); targetHWAddress = new EthernetAddress(skbuf, 18); targetPAddress = new IPv4Address(skbuf, 24); } else { throw new SocketException("Unknown hw,ptype: " + hwtype + "," + ptype); } }
| 3,646
|
public InvalidLayerException(String message) { super(message); }
|
public InvalidLayerException(String message) { super(message); }
| 3,647
|
private boolean isAvailable(KeyEvent ke) { boolean exists = true; if (isLinux) { exists = mapper.isKeyStrokeDefined(ke,isAltGr); } else { exists = mapper.isKeyStrokeDefined(ke); } System.out.println(" key is available " + !exists); if (exists) { Object[] args = {getKeyDescription(ke)}; int result = JOptionPane.showConfirmDialog(this, LangTool.messageFormat("messages.mapKeyWarning",args), LangTool.getString("key.labelKeyExists"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (result == JOptionPane.YES_OPTION) return true; else return false; } return !exists; }
|
private boolean isAvailable(KeyEvent ke) { boolean exists = true; if (isLinux) { exists = mapper.isKeyStrokeDefined(ke,isAltGr); } else { exists = mapper.isKeyStrokeDefined(ke); } if (exists) { Object[] args = {getKeyDescription(ke)}; int result = JOptionPane.showConfirmDialog(this, LangTool.messageFormat("messages.mapKeyWarning",args), LangTool.getString("key.labelKeyExists"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (result == JOptionPane.YES_OPTION) return true; else return false; } return !exists; }
| 3,648
|
DataFlavor(){ mimeType = null; representationClass = null; humanPresentableName = null;}
|
DataFlavor(){ mimeType = null; representationClass = null; humanPresentableName = null;}
| 3,649
|
public Object clone () throws CloneNotSupportedException{ try { return(super.clone()); } catch(Exception e) { return(null); }}
|
public Object clone () throws CloneNotSupportedException{ try { return super.clone(); } catch(Exception e) { return(null); }}
| 3,650
|
public Object clone () throws CloneNotSupportedException{ try { return(super.clone()); } catch(Exception e) { return(null); }}
|
public Object clone () throws CloneNotSupportedException{ try { return(super.clone()); } catch(Exception e) { return null; } }}
| 3,651
|
public Object clone () throws CloneNotSupportedException{ try { return(super.clone()); } catch(Exception e) { return(null); }}
|
public Object clone () throws CloneNotSupportedException{ try { return(super.clone()); catch(Exception e) { return(null);
| 3,652
|
equals(DataFlavor flavor){ if (flavor == null) return(false); if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase())) return(false); if (!this.representationClass.equals(flavor.representationClass)) return(false); return(true);}
|
equals(DataFlavor flavor){ if (flavor == null) return(false); if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase())) return(false); if (!this.representationClass.equals(flavor.representationClass)) return(false); return(true);}
| 3,653
|
equals(DataFlavor flavor){ if (flavor == null) return(false); if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase())) return(false); if (!this.representationClass.equals(flavor.representationClass)) return(false); return(true);}
|
equals(DataFlavor flavor){ if (flavor == null) return false; if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase())) return false; if (!this.representationClass.equals(flavor.representationClass)) return false; return(true);}
| 3,654
|
equals(DataFlavor flavor){ if (flavor == null) return(false); if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase())) return(false); if (!this.representationClass.equals(flavor.representationClass)) return(false); return(true);}
|
equals(DataFlavor flavor){ if (flavor == null) return(false); if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase())) return(false); if (!this.representationClass.equals(flavor.representationClass)) return(false); return(true);}
| 3,655
|
equals(DataFlavor flavor){ if (flavor == null) return(false); if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase())) return(false); if (!this.representationClass.equals(flavor.representationClass)) return(false); return(true);}
|
equals(DataFlavor flavor){ if (flavor == null) return(false); if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase())) return(false); if (!this.representationClass.equals(flavor.representationClass)) return(false); return(true);}
| 3,656
|
equals(DataFlavor flavor){ if (flavor == null) return(false); if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase())) return(false); if (!this.representationClass.equals(flavor.representationClass)) return(false); return(true);}
|
equals(DataFlavor flavor){ if (flavor == null) return(false); if (!this.mimeType.toLowerCase().equals(flavor.mimeType.toLowerCase())) return(false); if (!this.representationClass.equals(flavor.representationClass)) return(false); return(true);}
| 3,657
|
getDefaultRepresentationClass(){ return(java.io.InputStream.class);}
|
getDefaultRepresentationClass(){ return(java.io.InputStream.class);}
| 3,658
|
getDefaultRepresentationClassAsString(){ return(getDefaultRepresentationClass().getName());}
|
getDefaultRepresentationClassAsString(){ return(getDefaultRepresentationClass().getName());}
| 3,659
|
getHumanPresentableName(){ return(humanPresentableName);}
|
getHumanPresentableName(){ return(humanPresentableName);}
| 3,660
|
getMimeType(){ return(mimeType);}
|
getMimeType(){ return(mimeType);}
| 3,661
|
getParameter(String paramName, String mimeString){ int idx = mimeString.indexOf(paramName + "="); if (idx == -1) return(null); String value = mimeString.substring(idx + paramName.length() + 1); idx = value.indexOf(" "); if (idx == -1) return(value); else return(value.substring(0, idx));}
|
getParameter(String paramName, String mimeString){ int idx = mimeString.indexOf(paramName + "="); if (idx == -1) return(null); String value = mimeString.substring(idx + paramName.length() + 1); idx = value.indexOf(" "); if (idx == -1) return(value); else return(value.substring(0, idx));}
| 3,662
|
getPrimaryType(){ int idx = mimeType.indexOf("/"); if (idx == -1) return(mimeType); return(mimeType.substring(0, idx));}
|
getPrimaryType(){ int idx = mimeType.indexOf("/"); if (idx == -1) return(mimeType); return(mimeType.substring(0, idx));}
| 3,663
|
public Reader getReaderForText(Transferable transferable) throws UnsupportedFlavorException, IOException{ if (!transferable.isDataFlavorSupported(this)) throw new UnsupportedFlavorException(this); if (Reader.class.isAssignableFrom(representationClass)) return((Reader)transferable.getTransferData(this)); if (String.class.isAssignableFrom(representationClass)) return(new StringReader((String)transferable.getTransferData(this))); if (InputStream.class.isAssignableFrom(representationClass) && "text".equals(getPrimaryType())) { InputStream in = (InputStream)transferable.getTransferData(this); String encoding = getParameter("charset"); if (encoding == null) encoding = "us-ascii"; return(new InputStreamReader(in, encoding)); } throw new UnsupportedFlavorException(this);}
|
public Reader getReaderForText(Transferable transferable) throws UnsupportedFlavorException, IOException{ if (!transferable.isDataFlavorSupported(this)) throw new UnsupportedFlavorException(this); if (Reader.class.isAssignableFrom(representationClass)) return (Reader)transferable.getTransferData(this); if (String.class.isAssignableFrom(representationClass)) return(new StringReader((String)transferable.getTransferData(this))); if (InputStream.class.isAssignableFrom(representationClass) && "text".equals(getPrimaryType())) { InputStream in = (InputStream)transferable.getTransferData(this); String encoding = getParameter("charset"); if (encoding == null) encoding = "us-ascii"; return(new InputStreamReader(in, encoding)); } throw new UnsupportedFlavorException(this);}
| 3,664
|
public Reader getReaderForText(Transferable transferable) throws UnsupportedFlavorException, IOException{ if (!transferable.isDataFlavorSupported(this)) throw new UnsupportedFlavorException(this); if (Reader.class.isAssignableFrom(representationClass)) return((Reader)transferable.getTransferData(this)); if (String.class.isAssignableFrom(representationClass)) return(new StringReader((String)transferable.getTransferData(this))); if (InputStream.class.isAssignableFrom(representationClass) && "text".equals(getPrimaryType())) { InputStream in = (InputStream)transferable.getTransferData(this); String encoding = getParameter("charset"); if (encoding == null) encoding = "us-ascii"; return(new InputStreamReader(in, encoding)); } throw new UnsupportedFlavorException(this);}
|
public Reader getReaderForText(Transferable transferable) throws UnsupportedFlavorException, IOException{ if (!transferable.isDataFlavorSupported(this)) throw new UnsupportedFlavorException(this); if (Reader.class.isAssignableFrom(representationClass)) return((Reader)transferable.getTransferData(this)); if (String.class.isAssignableFrom(representationClass)) return new StringReader((String)transferable.getTransferData(this)); if (InputStream.class.isAssignableFrom(representationClass) && "text".equals(getPrimaryType())) { InputStream in = (InputStream)transferable.getTransferData(this); String encoding = getParameter("charset"); if (encoding == null) encoding = "us-ascii"; return(new InputStreamReader(in, encoding)); } throw new UnsupportedFlavorException(this);}
| 3,665
|
public Reader getReaderForText(Transferable transferable) throws UnsupportedFlavorException, IOException{ if (!transferable.isDataFlavorSupported(this)) throw new UnsupportedFlavorException(this); if (Reader.class.isAssignableFrom(representationClass)) return((Reader)transferable.getTransferData(this)); if (String.class.isAssignableFrom(representationClass)) return(new StringReader((String)transferable.getTransferData(this))); if (InputStream.class.isAssignableFrom(representationClass) && "text".equals(getPrimaryType())) { InputStream in = (InputStream)transferable.getTransferData(this); String encoding = getParameter("charset"); if (encoding == null) encoding = "us-ascii"; return(new InputStreamReader(in, encoding)); } throw new UnsupportedFlavorException(this);}
|
public Reader getReaderForText(Transferable transferable) throws UnsupportedFlavorException, IOException{ if (!transferable.isDataFlavorSupported(this)) throw new UnsupportedFlavorException(this); if (Reader.class.isAssignableFrom(representationClass)) return((Reader)transferable.getTransferData(this)); if (String.class.isAssignableFrom(representationClass)) return(new StringReader((String)transferable.getTransferData(this))); if (InputStream.class.isAssignableFrom(representationClass) && "text".equals(getPrimaryType())) { InputStream in = (InputStream)transferable.getTransferData(this); String encoding = getParameter("charset"); if (encoding == null) encoding = "us-ascii"; return new InputStreamReader(in, encoding); } throw new UnsupportedFlavorException(this);}
| 3,666
|
getRepresentationClass(){ return(representationClass);}
|
getRepresentationClass(){ return(representationClass);}
| 3,667
|
getRepresentationClassFromMime(String mimeString, ClassLoader classLoader){ String classname = getParameter("class", mimeString); if (classname != null) { try { return tryToLoadClass(classname, classLoader); } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } else { return java.io.InputStream.class; }}
|
getRepresentationClassFromMime(String mimeString, ClassLoader classLoader){ String classname = getParameter("class", mimeString); if (classname != null) { try { return tryToLoadClass(classname, classLoader); } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } else { return java.io.InputStream.class; }}
| 3,668
|
getRepresentationClassFromMime(String mimeString, ClassLoader classLoader){ String classname = getParameter("class", mimeString); if (classname != null) { try { return tryToLoadClass(classname, classLoader); } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } else { return java.io.InputStream.class; }}
|
getRepresentationClassFromMime(String mimeString, ClassLoader classLoader){ String classname = getParameter("class", mimeString); if (classname != null) { String classname = getParameter("class", mimeString); if (classname != null) { return String classname = getParameter("class", mimeString); if (classname != null)ToLoadClass(classname, classLoader); } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } else { return java.io.InputStream.class; }}
| 3,669
|
getRepresentationClassFromMime(String mimeString, ClassLoader classLoader){ String classname = getParameter("class", mimeString); if (classname != null) { try { return tryToLoadClass(classname, classLoader); } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } else { return java.io.InputStream.class; }}
|
getRepresentationClassFromMime(String mimeString, ClassLoader classLoader){ String classname = getParameter("class", mimeString); if (classname != null) { try { try { return tryToLoadClass(classname, classLoader); } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } else { return java.io.InputStream.class; }}
| 3,670
|
getRepresentationClassFromMime(String mimeString, ClassLoader classLoader){ String classname = getParameter("class", mimeString); if (classname != null) { try { return tryToLoadClass(classname, classLoader); } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } else { return java.io.InputStream.class; }}
|
getRepresentationClassFromMime(String mimeString, ClassLoader classLoader){ String classname = getParameter("class", mimeString); if (classname != null) { try { return tryToLoadClass(classname, classLoader); } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } else { return java.io.InputStream.class; }}
| 3,671
|
getRepresentationClassFromMime(String mimeString, ClassLoader classLoader){ String classname = getParameter("class", mimeString); if (classname != null) { try { return tryToLoadClass(classname, classLoader); } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } else { return java.io.InputStream.class; }}
|
getRepresentationClassFromMime(String mimeString, ClassLoader classLoader){ String classname = getParameter("class", mimeString); if (classname != null) { try { return tryToLoadClass(classname, classLoader); } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } else { return java.io.InputStream.class; }}
| 3,672
|
getSubType(){ int start = mimeType.indexOf("/"); if (start == -1) return ""; int end = mimeType.indexOf(";", start + 1); if (end == -1) return mimeType.substring(start + 1); else return mimeType.substring(start + 1, end);}
|
getSubType(){ int start = mimeType.indexOf("/"); if (start == -1) return ""; int end = mimeType.indexOf(";", start + 1); if (end == -1) return mimeType.substring(start + 1); else return mimeType.substring(start + 1, end);}
| 3,673
|
getTextPlainUnicodeFlavor(){ return(plainTextFlavor);}
|
getTextPlainUnicodeFlavor(){ return(plainTextFlavor);}
| 3,674
|
hashCode(){ return(mimeType.toLowerCase().hashCode()^representationClass.hashCode());}
|
hashCode(){ return(mimeType.toLowerCase().hashCode()^representationClass.hashCode());}
| 3,675
|
isFlavorJavaFileListType(){ if (this.mimeType.equals(javaFileListFlavor.mimeType) && this.representationClass.equals(javaFileListFlavor.representationClass)) return(true); return(false);}
|
isFlavorJavaFileListType(){ if (this.mimeType.equals(javaFileListFlavor.mimeType) && this.representationClass.equals(javaFileListFlavor.representationClass)) return(true); return(false);}
| 3,676
|
isFlavorJavaFileListType(){ if (this.mimeType.equals(javaFileListFlavor.mimeType) && this.representationClass.equals(javaFileListFlavor.representationClass)) return(true); return(false);}
|
isFlavorJavaFileListType(){ if (this.mimeType.equals(javaFileListFlavor.mimeType) && this.representationClass.equals(javaFileListFlavor.representationClass)) return(true); return(false);}
| 3,677
|
isFlavorRemoteObjectType(){ return(mimeType.startsWith(javaRemoteObjectMimeType));}
|
isFlavorRemoteObjectType(){ return(mimeType.startsWith(javaRemoteObjectMimeType));}
| 3,678
|
isFlavorSerializedObjectType(){ // FIXME: What is the diff between this and isMimeTypeSerializedObject? return(mimeType.startsWith(javaSerializedObjectMimeType));}
|
isFlavorSerializedObjectType(){ // FIXME: What is the diff between this and isMimeTypeSerializedObject? return(mimeType.startsWith(javaSerializedObjectMimeType));}
| 3,679
|
isMimeTypeEqual(String mimeType){ String mime = getMimeType(); int i = mime.indexOf(";"); if (i != -1) mime = mime.substring(0, i); i = mimeType.indexOf(";"); if (i != -1) mimeType = mimeType.substring(0, i); return mime.equals(mimeType);}
|
isMimeTypeEqual(String mimeType){ String mime = getMimeType(); int i = mime.indexOf(";"); if (i != -1) mime = mime.substring(0, i); i = mimeType.indexOf(";"); if (i != -1) mimeType = mimeType.substring(0, i); return mime.equals(mimeType);}
| 3,680
|
isMimeTypeSerializedObject(){ return(mimeType.startsWith(javaSerializedObjectMimeType));}
|
isMimeTypeSerializedObject(){ return(mimeType.startsWith(javaSerializedObjectMimeType));}
| 3,681
|
isRepresentationClassInputStream(){ return(representationClass.getName().equals("java.io.InputStream"));}
|
isRepresentationClassInputStream(){ return(representationClass.getName().equals("java.io.InputStream"));}
| 3,682
|
isRepresentationClassRemote(){ return Remote.class.isAssignableFrom (representationClass);}
|
isRepresentationClassRemote(){ return Remote.class.isAssignableFrom (representationClass);}
| 3,683
|
isRepresentationClassSerializable(){ Class[] interfaces = representationClass.getInterfaces(); int i = 0; while (i < interfaces.length) { if (interfaces[i].getName().equals("java.io.Serializable")) return(true); ++i; } return(false);}
|
isRepresentationClassSerializable(){ Class[] interfaces = representationClass.getInterfaces(); int i = 0; while (i < interfaces.length) { if (interfaces[i].getName().equals("java.io.Serializable")) return(true); ++i; } return(false);}
| 3,684
|
isRepresentationClassSerializable(){ Class[] interfaces = representationClass.getInterfaces(); int i = 0; while (i < interfaces.length) { if (interfaces[i].getName().equals("java.io.Serializable")) return(true); ++i; } return(false);}
|
isRepresentationClassSerializable(){ Class[] interfaces = representationClass.getInterfaces(); int i = 0; while (i < interfaces.length) { if (interfaces[i].getName().equals("java.io.Serializable")) return true; ++i; } return(false);}
| 3,685
|
isRepresentationClassSerializable(){ Class[] interfaces = representationClass.getInterfaces(); int i = 0; while (i < interfaces.length) { if (interfaces[i].getName().equals("java.io.Serializable")) return(true); ++i; } return(false);}
|
isRepresentationClassSerializable(){ Class[] interfaces = representationClass.getInterfaces(); int i = 0; while (i < interfaces.length) { if (interfaces[i].getName().equals("java.io.Serializable")) return(true); ++i; } return(false);}
| 3,686
|
match(DataFlavor dataFlavor){ // XXX - How is this different from equals? return(equals(dataFlavor));}
|
match(DataFlavor dataFlavor){ // XXX - How is this different from equals? return(equals(dataFlavor));}
| 3,687
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.