2929#include " ddr/ir/TypeVisitor.hpp"
3030#include " ddr/ir/TypedefUDT.hpp"
3131#include " ddr/ir/UnionUDT.hpp"
32- #include " ddr/std/sstream.hpp"
3332
3433#undef NDEBUG
3534
@@ -48,7 +47,6 @@ using std::string;
4847using std::pair;
4948using std::make_pair;
5049using std::vector;
51- using std::stringstream;
5250
5351#define INVALID_OFFSET (~(uint32_t )0 )
5452
@@ -281,7 +279,7 @@ JavaBlobGenerator::genBinaryBlob(OMRPortLibrary *portLibrary, Symbol_IR *ir, con
281279 /* compute offsets for each entry of string hash table
282280 * compute size of string data - update blob header
283281 */
284- rc = buildBlobData (portLibrary, ir);
282+ rc = buildBlobData (ir);
285283 }
286284
287285 intptr_t fd = -1 ;
@@ -368,13 +366,13 @@ JavaBlobGenerator::countStructsAndStrings(Symbol_IR *ir)
368366}
369367
370368DDR_RC
371- JavaBlobGenerator::buildBlobData (OMRPortLibrary *portLibrary, Symbol_IR *ir)
369+ JavaBlobGenerator::buildBlobData (Symbol_IR *ir)
372370{
373371 DDR_RC rc = DDR_RC_OK;
374372
375373 /* allocate hashtable */
376374 _buildInfo.stringHash =
377- hashTableNew (portLibrary , OMR_GET_CALLSITE (), 0 ,
375+ hashTableNew (_portLibrary , OMR_GET_CALLSITE (), 0 ,
378376 sizeof (StringTableEntry), 0 , 0 , OMRMEM_CATEGORY_UNKNOWN,
379377 stringTableHash, stringTableEquals, NULL , NULL );
380378
@@ -782,12 +780,14 @@ JavaBlobGenerator::addBlobStruct(const string &name, const string &superName, ui
782780class BlobFieldVisitor : public TypeVisitor
783781{
784782private:
783+ OMRPortLibrary * const _portLibrary;
785784 string * const _typePrefix;
786785 string * const _typeSuffix;
787786
788787public:
789- explicit BlobFieldVisitor (string *prefix, string *suffix)
790- : _typePrefix(prefix)
788+ BlobFieldVisitor (OMRPortLibrary *portLibrary, string *prefix, string *suffix)
789+ : _portLibrary(portLibrary)
790+ , _typePrefix(prefix)
791791 , _typeSuffix(suffix)
792792 {
793793 }
@@ -808,11 +808,11 @@ BlobFieldVisitor::visitType(Type *type) const
808808 size_t bitWidth = 0 ;
809809
810810 if (Type::isStandardType (typeName.c_str (), (size_t )typeName.length (), &isSigned, &bitWidth)) {
811- stringstream newType;
811+ OMRPORT_ACCESS_FROM_OMRPORT (_portLibrary);
812+ char newType[32 ];
812813
813- newType << (isSigned ? " I" : " U" ) << bitWidth;
814-
815- *_typePrefix += newType.str ();
814+ omrstr_printf (newType, sizeof (newType), " %c%zu" , isSigned ? ' I' : ' U' , bitWidth);
815+ *_typePrefix += newType;
816816 } else {
817817 *_typePrefix += typeName;
818818 }
@@ -860,11 +860,11 @@ BlobFieldVisitor::visitTypedef(TypedefUDT *type) const
860860 size_t bitWidth = 0 ;
861861
862862 if (Type::isStandardType (fullName.c_str (), (size_t )fullName.length (), &isSigned, &bitWidth)) {
863- stringstream newType;
864-
865- newType << (isSigned ? " I" : " U" ) << bitWidth;
863+ OMRPORT_ACCESS_FROM_OMRPORT (_portLibrary);
864+ char newType[32 ];
866865
867- *_typePrefix += newType.str ();
866+ omrstr_printf (newType, sizeof (newType), " %c%zu" , isSigned ? ' I' : ' U' , bitWidth);
867+ *_typePrefix += newType;
868868 } else {
869869 *_typePrefix += fullName;
870870 }
@@ -917,18 +917,22 @@ JavaBlobGenerator::formatFieldType(Field *field, string *fieldType)
917917 } else {
918918 typePrefix = field->_modifiers .getModifierNames ();
919919
920- rc = type->acceptVisitor (BlobFieldVisitor (&typePrefix, &typeSuffix));
920+ rc = type->acceptVisitor (BlobFieldVisitor (_portLibrary, &typePrefix, &typeSuffix));
921921 }
922922 }
923923
924924 if ((DDR_RC_OK == rc) && (NULL != type)) {
925- stringstream bits ;
925+ string bitField ;
926926
927927 if (0 != field->_bitField ) {
928- bits << " :" << field->_bitField ;
928+ OMRPORT_ACCESS_FROM_OMRPORT (_portLibrary);
929+ char width[32 ];
930+
931+ omrstr_printf (width, sizeof (width), " :%zu" , field->_bitField );
932+ bitField = width;
929933 }
930934
931- *fieldType = typePrefix + typeSuffix + bits. str () ;
935+ *fieldType = typePrefix + typeSuffix + bitField ;
932936 }
933937
934938 return rc;
0 commit comments