From 13f504ce613b95282f1bbf0caa55c57bc54ece52 Mon Sep 17 00:00:00 2001 From: Junyan He Date: Mon, 18 Jan 2016 16:49:25 +0800 Subject: Add the serializeToBin and deserializeFromBin for kernel arg info. Signed-off-by: Junyan He Reviewed-by: Yang Rong --- backend/src/backend/program.cpp | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'backend') diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp index 383a10f9..7d12f73c 100644 --- a/backend/src/backend/program.cpp +++ b/backend/src/backend/program.cpp @@ -295,6 +295,24 @@ namespace gbe { OUT_UPDATE_SZ(arg.size); OUT_UPDATE_SZ(arg.align); OUT_UPDATE_SZ(arg.bti); + + OUT_UPDATE_SZ(arg.info.addrSpace); + + OUT_UPDATE_SZ(arg.info.typeName.size()); + outs.write(arg.info.typeName.c_str(), arg.info.typeName.size()); + ret_size += sizeof(char)*arg.info.typeName.size(); + + OUT_UPDATE_SZ(arg.info.accessQual.size()); + outs.write(arg.info.accessQual.c_str(), arg.info.accessQual.size()); + ret_size += sizeof(char)*arg.info.accessQual.size(); + + OUT_UPDATE_SZ(arg.info.typeQual.size()); + outs.write(arg.info.typeQual.c_str(), arg.info.typeQual.size()); + ret_size += sizeof(char)*arg.info.typeQual.size(); + + OUT_UPDATE_SZ(arg.info.argName.size()); + outs.write(arg.info.argName.c_str(), arg.info.argName.size()); + ret_size += sizeof(char)*arg.info.argName.size(); } OUT_UPDATE_SZ(patches.size()); @@ -385,6 +403,43 @@ namespace gbe { IN_UPDATE_SZ(arg.size); IN_UPDATE_SZ(arg.align); IN_UPDATE_SZ(arg.bti); + + IN_UPDATE_SZ(arg.info.addrSpace); + + size_t len; + char* a_name = NULL; + + IN_UPDATE_SZ(len); + a_name = new char[len+1]; + ins.read(a_name, len*sizeof(char)); + total_size += sizeof(char)*len; + a_name[len] = 0; + arg.info.typeName = a_name; + delete[] a_name; + + IN_UPDATE_SZ(len); + a_name = new char[len+1]; + ins.read(a_name, len*sizeof(char)); + total_size += sizeof(char)*len; + a_name[len] = 0; + arg.info.accessQual = a_name; + delete[] a_name; + + IN_UPDATE_SZ(len); + a_name = new char[len+1]; + ins.read(a_name, len*sizeof(char)); + total_size += sizeof(char)*len; + a_name[len] = 0; + arg.info.typeQual = a_name; + delete[] a_name; + + IN_UPDATE_SZ(len); + a_name = new char[len+1]; + ins.read(a_name, len*sizeof(char)); + total_size += sizeof(char)*len; + a_name[len] = 0; + arg.info.argName = a_name; + delete[] a_name; } IN_UPDATE_SZ(patch_num); -- cgit v1.2.1