Variant c_ErrorException::ifa___construct(MethodCallPackage &mcp, int count, INVOKE_FEW_ARGS_IMPL_ARGS) { if (UNLIKELY(mcp.obj == 0)) { return ObjectData::ifa_dummy(mcp, count, INVOKE_FEW_ARGS_PASS_ARGS, ifa___construct, coo_ErrorException); } c_ErrorException *self ATTRIBUTE_UNUSED (static_cast<c_ErrorException*>(mcp.obj)); if (UNLIKELY(count > 5)) return throw_toomany_arguments("ErrorException::__construct", 5, 2); if (count <= 0) return (self->t___construct(), null); CVarRef arg0(a0); if (count <= 1) return (self->t___construct(arg0), null); CVarRef arg1(a1); if (count <= 2) return (self->t___construct(arg0, arg1), null); CVarRef arg2(a2); if (count <= 3) return (self->t___construct(arg0, arg1, arg2), null); CVarRef arg3(a3); if (count <= 4) return (self->t___construct(arg0, arg1, arg2, arg3), null); CVarRef arg4(a4); return (self->t___construct(arg0, arg1, arg2, arg3, arg4), null); }
Variant NEVER_INLINE c_SoapFault::ifa___construct(MethodCallPackage &mcp, int count, INVOKE_FEW_ARGS_IMPL_ARGS) { if (UNLIKELY(mcp.obj == 0)) { return ObjectData::ifa_dummy(mcp, count, INVOKE_FEW_ARGS_PASS_ARGS, ifa___construct, coo_SoapFault); } c_SoapFault *self ATTRIBUTE_UNUSED (static_cast<c_SoapFault*>(mcp.obj)); if (UNLIKELY(count < 2)) return throw_wrong_arguments("SoapFault::__construct", count, 2, 6, 2); CVarRef arg0(a0); CVarRef arg1(a1); if (count <= 2) return (self->t___construct(arg0, arg1), null); CVarRef arg2(a2); if (count <= 3) return (self->t___construct(arg0, arg1, arg2), null); CVarRef arg3(a3); if (count <= 4) return (self->t___construct(arg0, arg1, arg2, arg3), null); CVarRef arg4(a4); if (count <= 5) return (self->t___construct(arg0, arg1, arg2, arg3, arg4), null); CVarRef arg5(a5); return (self->t___construct(arg0, arg1, arg2, arg3, arg4, arg5), null); }
void testUint32() { { // Test for Null value constructor and toString Uint32Arg argNull; PEGASUS_TEST_ASSERT(argNull.isNull() == true); String x = argNull.toString(); VCOUT << x << endl; PEGASUS_TEST_ASSERT(x == String("NULL")); // set value and test for that value Uint32Arg arg(10); VCOUT << arg.toString() << endl; PEGASUS_TEST_ASSERT(arg.toString() == String("10")); PEGASUS_TEST_ASSERT(arg.getValue() == 10); PEGASUS_TEST_ASSERT(arg.isNull() == false); // test resetting to Null arg.setNullValue(); PEGASUS_TEST_ASSERT(arg.getValue() == 0); PEGASUS_TEST_ASSERT(arg.isNull() == true); VCOUT << arg.toString() << endl; PEGASUS_TEST_ASSERT(arg.toString() == String("NULL")); } { // test starting with null constructor and setting value Uint32Arg arg; PEGASUS_TEST_ASSERT(arg.getValue() == 0); PEGASUS_TEST_ASSERT(arg.isNull() == true); arg.setValue(10); PEGASUS_TEST_ASSERT(arg.getValue() == 10); PEGASUS_TEST_ASSERT(arg.isNull() == false); } { // test copy operations. Uint32Arg arg; PEGASUS_TEST_ASSERT(arg.getValue() == 0); PEGASUS_TEST_ASSERT(arg.isNull() == true); Uint32Arg arg2 = arg; PEGASUS_TEST_ASSERT(arg2.getValue() == 0); PEGASUS_TEST_ASSERT(arg2.isNull() == true); arg.setValue(10); PEGASUS_TEST_ASSERT(arg.getValue() == 10); PEGASUS_TEST_ASSERT(arg.isNull() == false); Uint32Arg arg3 = arg; PEGASUS_TEST_ASSERT(arg3.getValue() == 10); PEGASUS_TEST_ASSERT(arg3.isNull() == false); } { // test setting to max Uint32 value Uint32Arg arg; arg.setValue(4294967295UL); PEGASUS_TEST_ASSERT(arg.getValue() == 4294967295UL); PEGASUS_TEST_ASSERT(arg.isNull() == false); VCOUT << arg.toString() << endl; PEGASUS_TEST_ASSERT(arg.toString() == String("4294967295")); } { // test equal function Uint32Arg arg1; Uint32Arg arg2; PEGASUS_TEST_ASSERT(arg1.equal(arg2)); PEGASUS_TEST_ASSERT(arg1 == arg2); Uint32Arg arg3(987654); Uint32Arg arg4(987654); PEGASUS_TEST_ASSERT(arg3.equal(arg4)); PEGASUS_TEST_ASSERT(arg3 == arg4); PEGASUS_TEST_ASSERT(!arg1.equal(arg3)); PEGASUS_TEST_ASSERT(!(arg1 == arg3)); arg4.setValue(2); PEGASUS_TEST_ASSERT(!arg3.equal(arg4)); PEGASUS_TEST_ASSERT(!(arg3 == arg4)); } // test as parameter of a call. foo32(1234); }
void testUint64() { { // test constructors and setting value and null Uint64Arg argNull; String x = argNull.toString(); VCOUT << x << endl; PEGASUS_TEST_ASSERT(x == String("NULL")); //PEGASUS_TEST_ASSERT(x == "NULL"); Uint64Arg arg(102958); PEGASUS_TEST_ASSERT(arg.getValue() == 102958); PEGASUS_TEST_ASSERT(arg.isNull() == false); VCOUT << arg.toString() << endl; PEGASUS_TEST_ASSERT(arg.toString() == String("102958")); arg.setNullValue(); PEGASUS_TEST_ASSERT(arg.getValue() == 0); PEGASUS_TEST_ASSERT(arg.isNull() == true); String val = arg.toString(); VCOUT << val << endl; PEGASUS_TEST_ASSERT(val == String("NULL")); } { // test starting with Null constructor and setting value Uint64Arg arg; PEGASUS_TEST_ASSERT(arg.getValue() == 0); PEGASUS_TEST_ASSERT(arg.isNull() == true); arg.setValue(10); PEGASUS_TEST_ASSERT(arg.getValue() == 10); PEGASUS_TEST_ASSERT(arg.isNull() == false); } { // test copy operations. Uint64Arg arg; PEGASUS_TEST_ASSERT(arg.getValue() == 0); PEGASUS_TEST_ASSERT(arg.isNull() == true); Uint64Arg arg2 = arg; PEGASUS_TEST_ASSERT(arg2.getValue() == 0); PEGASUS_TEST_ASSERT(arg2.isNull() == true); arg.setValue(10); PEGASUS_TEST_ASSERT(arg.getValue() == 10); PEGASUS_TEST_ASSERT(arg.isNull() == false); Uint64Arg arg3 = arg; PEGASUS_TEST_ASSERT(arg3.getValue() == 10); PEGASUS_TEST_ASSERT(arg3.isNull() == false); } { // test setting to max Uint32 value Uint64Arg arg; arg.setValue(18446744073709551615ULL); PEGASUS_TEST_ASSERT(arg.getValue() == 18446744073709551615ULL); PEGASUS_TEST_ASSERT(arg.isNull() == false); VCOUT << arg.toString() << endl; PEGASUS_TEST_ASSERT(arg.toString() == String("18446744073709551615")); } { // test equal function Uint64Arg arg1; Uint64Arg arg2; PEGASUS_TEST_ASSERT(arg1.equal(arg2)); PEGASUS_TEST_ASSERT(arg1 == arg2); Uint64Arg arg3(987654); Uint64Arg arg4(987654); PEGASUS_TEST_ASSERT(arg3.equal(arg4)); PEGASUS_TEST_ASSERT(arg3 == arg4); PEGASUS_TEST_ASSERT(!arg1.equal(arg3)); PEGASUS_TEST_ASSERT(!(arg1 == arg3)); arg4.setValue(2); PEGASUS_TEST_ASSERT(!arg3.equal(arg4)); PEGASUS_TEST_ASSERT(!(arg3 == arg4)); } foo64(12345678); }
int main(int argc, char *argv[]){ if(argc < 4){ std::cerr << "4 arguments required" << std::endl; return -1; } //setting optimizations by commmand line if(argc>5){ std::string arg4(argv[4]); if(arg4 == "-q") { _sse_ON = true; blocking = false; } else if(arg4 == "-w") { _sse_ON = false; blocking = true; } else if(arg4 == "-e") { _sse_ON = false; blocking = false; } } //reading in A std::ifstream inputFileA(argv[1], std::ios::in); int ndimA; int mdimA; inputFileA >> mdimA; inputFileA >> ndimA; int size = ndimA*mdimA; double * dataA = new double[size]; for(int i = 0;i < size;) { inputFileA >> dataA[i++]; } //reading in B std::ifstream inputFileB(argv[2], std::ios::in); int ndimB; int mdimB; inputFileB >> mdimB; inputFileB >> ndimB; size = ndimB*mdimB; double * dataB = new double[size]; for(int i = 0;i < size;) { inputFileB >> dataB[i++]; } size = mdimA*ndimB; double * dataC = new double[size]; timeval start,end; gettimeofday(&start,0); matrixmult(mdimA,ndimB,ndimA,dataA,ndimA,dataB,ndimB,dataC,ndimB); gettimeofday(&end,0); std::cout << "wall clock time: " << ((double)(end.tv_sec*1000000 + end.tv_usec)-(double)(start.tv_sec*1000000 + start.tv_usec))/1000000 << std::endl; //writing C std::ofstream outputFile(argv[3], std::ios::out); outputFile << mdimA << " " << ndimB << std::endl; for(int i = 0; i < size; ++i) { outputFile << dataC[i] << std::endl; } return 0; }
TInt ClientThread(TAny* aTestMode) // // Passed as the first client thread - signals the server to do several tests // { // Create the message arguments to be pinned. Should be one of each type of // descriptor to test that the pinning code can correctly pin each type // descriptor data. Each descriptor's data should in a separate page in // thread's stack to ensure that access to each argument will cause a // separate page fault. TUint8 argBufs[KPageSize*(6+2)]; // enough for 6 whole pages TUint8* argBuf0 = (TUint8*)(TUintPtr(argBufs+gPageMask)&~gPageMask); TUint8* argBuf1 = argBuf0+KPageSize; TUint8* argBuf2 = argBuf1+KPageSize; TUint8* argBuf3 = argBuf2+KPageSize; TUint8* argBuf4 = argBuf3+KPageSize; TUint8* argBuf5 = argBuf4+KPageSize; argBuf0[0]='a'; argBuf0[1]='r'; argBuf0[2]='g'; argBuf0[3]='0'; argBuf0[4]='\0'; TPtr8 arg0(argBuf0, 5, 20); TBufC8<5>& arg1 = *(TBufC8<5>*)argBuf1; new (&arg1) TBufC8<5>((const TUint8*)"arg1"); argBuf2[0]='a'; argBuf2[1]='r'; argBuf2[2]='g'; argBuf2[3]='1'; argBuf2[4]='\0'; TPtrC8 arg2((const TUint8*)argBuf2); TBuf8<50>& arg3 = *(TBuf8<50>*)argBuf3; new (&arg3) TBuf8<50>((const TUint8*)"arg3"); // For some tests use this 5th and final type of descriptor. HBufC8* argTmp = HBufC8::New(7); *argTmp = (const TUint8*)"argTmp"; RBuf8 argTmpBuf(argTmp); // Need a couple of extra writable argments argBuf4[0]='a'; argBuf4[1]='r'; argBuf4[2]='g'; argBuf4[3]='4'; argBuf4[4]='\0'; TPtr8 arg4(argBuf4, 5, 20); argBuf5[0]='a'; argBuf5[1]='r'; argBuf5[2]='g'; argBuf5[3]='5'; argBuf5[4]='\0'; TPtr8 arg5(argBuf5, 5, 20); RTest test(_L("T_SVRPINNING...client")); RSession session; TInt r = session.PublicCreateSession(_L("CTestServer"),5); if (r != KErrNone) { gSem.Signal(); test(0); } switch((TInt)aTestMode) { case CTestSession::ETestRdPinAll: test.Printf(_L("Test pinning all args\n")); r = session.PublicSendReceive(CTestSession::ETestRdPinAll, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs()); break; case CTestSession::ETestRdUnpin3: test.Printf(_L("Read Arg3 unpinned\n")); r = session.PublicSendReceive(CTestSession::ETestRdUnpin3, TIpcArgs(&arg0, argTmp, &argTmpBuf, &arg3).PinArgs(ETrue, ETrue, ETrue, EFalse)); break; case CTestSession::ETestRdUnpin2: test.Printf(_L("Read Arg2 unpinned\n")); r = session.PublicSendReceive(CTestSession::ETestRdUnpin2, TIpcArgs(argTmp, &arg1, &arg2, &arg3).PinArgs(ETrue, ETrue, EFalse, ETrue)); break; case CTestSession::ETestRdUnpin1: test.Printf(_L("Read Arg1 unpinned\n")); r = session.PublicSendReceive(CTestSession::ETestRdUnpin1, TIpcArgs(&argTmpBuf, &arg1, &arg2, &arg3).PinArgs(ETrue, EFalse, ETrue, ETrue)); break; case CTestSession::ETestRdUnpin0: test.Printf(_L("Read Arg0 unpinned\n")); r = session.PublicSendReceive(CTestSession::ETestRdUnpin0, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs(EFalse, ETrue, ETrue, ETrue)); break; case CTestSession::ETestPinDefault: test.Printf(_L("Test the default pinning policy of this server\n")); r = session.PublicSendReceive(CTestSession::ETestPinDefault, TIpcArgs(&arg0, &arg1, &arg2, argTmp)); break; case CTestSession::ETestWrPinAll: test.Printf(_L("Test writing to pinned descriptors\n")); r = session.PublicSendReceive(CTestSession::ETestWrPinAll, TIpcArgs(&arg0, &arg3, &arg4, &arg5).PinArgs(ETrue, ETrue, ETrue, ETrue)); // Verify the index of each argument has been written to each descriptor. { TUint maxLength = arg0.MaxLength(); test_Equal(maxLength, arg0.Length()); TUint j = 0; for (; j < maxLength; j++) test_Equal(0, arg0[j]); maxLength = arg3.MaxLength(); test_Equal(maxLength, arg3.Length()); for (j = 0; j < maxLength; j++) test_Equal(1, arg3[j]); maxLength = arg4.MaxLength(); test_Equal(maxLength, arg4.Length()); for (j = 0; j < maxLength; j++) test_Equal(2, arg4[j]); maxLength = arg5.MaxLength(); test_Equal(maxLength, arg5.Length()); for (j = 0; j < maxLength; j++) test_Equal(3, arg5[j]); } break; case CTestSession::ETestWrPinNone: test.Printf(_L("Test writing to unpinned descriptors\n")); r = session.PublicSendReceive(CTestSession::ETestWrPinNone, TIpcArgs(&arg0, &arg3, &arg4, &arg5).PinArgs(EFalse, EFalse, EFalse, EFalse)); // Verify the index of each argument has been written to each descriptor. // Unless this is a pinnning server than the thread will be panicked before we reach there. { TUint maxLength = arg0.MaxLength(); test_Equal(maxLength, arg0.Length()); TUint j = 0; for (j = 0; j < maxLength; j++) test_Equal(0, arg0[j]); maxLength = arg3.MaxLength(); test_Equal(maxLength, arg3.Length()); for (j = 0; j < maxLength; j++) test_Equal(1, arg3[j]); maxLength = arg4.MaxLength(); test_Equal(maxLength, arg4.Length()); for (j = 0; j < maxLength; j++) test_Equal(2, arg4[j]); maxLength = arg5.MaxLength(); test_Equal(maxLength, arg5.Length()); for (j = 0; j < maxLength; j++) test_Equal(3, arg5[j]); } break; case CTestSession::ETestDeadServer: test.Printf(_L("Test pinning to dead server\n")); gSem.Signal(); gSem1.Wait(); r = session.PublicSendReceive(CTestSession::ETestRdPinAll, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs()); break; case CTestSession::ETestPinOOM: test.Printf(_L("Pinning OOM tests\n")); __KHEAP_MARK; const TUint KMaxKernelAllocations = 1024; TUint i; r = KErrNoMemory; for (i = 0; i < KMaxKernelAllocations && r == KErrNoMemory; i++) { __KHEAP_FAILNEXT(i); r = session.PublicSendReceive(CTestSession::ETestRdPinAll, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs()); __KHEAP_RESET; } test.Printf(_L("SendReceive took %d tries\n"),i); test_KErrNone(r); __KHEAP_MARKEND; break; } session.Close(); test.Close(); return r; }