Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch apn-channel-perftools Excluding Merge-Ins
This is equivalent to a diff from 5d7aa913b0 to a8da039f50
|
2025-01-17
| ||
| 12:31 | Add dummy TclpLoadMemoryGetBuffer/TclpLoadMemory for Windows and UNIX, so compiling with TCL_LOAD_FR... check-in: 53a5a0cfa2 user: jan.nijtmans tags: trunk, main | |
|
2025-01-16
| ||
| 02:03 | Better off as extension and not in the core. Closed-Leaf check-in: a8da039f50 user: apnadkarni tags: apn-channel-perftools | |
|
2025-01-15
| ||
| 12:39 | Bug 73bb42fb3f: check also 2nd encoding conversion and set error as in the one above. This is effect... check-in: db261a5c5d user: oehhar tags: 73bb42fb3f-panic-buffer | |
| 02:58 | Merge trunk check-in: 490b048ff3 user: apnadkarni tags: apn-channel-perftools | |
|
2025-01-12
| ||
| 18:10 | Fix [70f3b23cad]. Doc fix only check-in: 5d7aa913b0 user: jan.nijtmans tags: trunk, main | |
| 18:04 | Fix [70f3b23cad]. Doc fix only check-in: e3fb9432f2 user: jan.nijtmans tags: core-8-branch | |
|
2025-01-10
| ||
| 21:37 | Merge-mark check-in: 5145a78372 user: jan.nijtmans tags: trunk, main | |
Changes to generic/tclEncoding.c.
| ︙ | |||
1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 | 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 | + |
result = encodingPtr->toUtfProc(encodingPtr->clientData, src, srcLen,
flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr,
dstCharsPtr);
if (*dstCharsPtr <= maxChars) {
break;
}
//__debugbreak();
dstLen = Tcl_UtfAtIndex(dst, maxChars) - dst + (TCL_UTF_MAX - 1);
*statePtr = savedState;
} while (1);
if (!noTerminate) {
/* ...and then append it */
dst[*dstWrotePtr] = '\0';
|
| ︙ |
Changes to generic/tclTest.c.
| ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | + | #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif #define TCLBOOLWARNING(boolPtr) /* needed here because we compile with -Wc++-compat */ #include "tclInt.h" #include "tclOO.h" #include <math.h> #include <assert.h> /* * Required for Testregexp*Cmd */ #include "tclRegexp.h" /* |
| ︙ | |||
275 276 277 278 279 280 281 282 283 284 285 286 287 288 | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | + | static Tcl_ObjCmdProc TesttranslatefilenameCmd; static Tcl_ObjCmdProc TestfstildeexpandCmd; static Tcl_ObjCmdProc TestupvarCmd; static Tcl_ObjCmdProc2 TestWrongNumArgsCmd; static Tcl_ObjCmdProc TestGetIndexFromObjStructCmd; static Tcl_ObjCmdProc TestChannelCmd; static Tcl_ObjCmdProc TestChannelEventCmd; static Tcl_ObjCmdProc TestChanCreateCmd; static Tcl_ObjCmdProc TestSocketCmd; static Tcl_ObjCmdProc TestFilesystemCmd; static Tcl_ObjCmdProc TestSimpleFilesystemCmd; static void TestReport(const char *cmd, Tcl_Obj *arg1, Tcl_Obj *arg2); static Tcl_Obj * TestReportGetNativePath(Tcl_Obj *pathPtr); static Tcl_FSStatProc TestReportStat; |
| ︙ | |||
563 564 565 566 567 568 569 570 571 572 573 574 575 576 | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | + + |
TestGetIndexFromObjStructCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testasync", TestasyncCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testbumpinterpepoch",
TestbumpinterpepochCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testchannel", TestChannelCmd,
NULL, NULL);
Tcl_CreateObjCommand(interp, "testchannelevent", TestChannelEventCmd,
NULL, NULL);
Tcl_CreateObjCommand(interp, "testchancreate", TestChanCreateCmd,
NULL, NULL);
Tcl_CreateObjCommand(interp, "testcmdtoken", TestcmdtokenCmd, NULL,
NULL);
Tcl_CreateObjCommand2(interp, "testcmdobj2", Testcmdobj2Cmd,
NULL, NULL);
Tcl_CreateObjCommand(interp, "testcmdinfo", TestcmdinfoCmd, NULL,
NULL);
|
| ︙ | |||
8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 | 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
Tcl_DecrRefCount(l1Obj);
}
if (l2Obj) {
Tcl_DecrRefCount(l2Obj);
}
return ret;
}
/*
* testchan{source,sink} implementation - TestChanCreateObjCmd
*/
/*
* Common blocking procedure for source and sink.
* Channel is always ready so no-op :-)
*/
static int
TestChanBlockMode(ClientData instanceData, int mode)
{
return 0;
}
static void
TestChanSourceWatch(ClientData instanceData, int mask)
{
if (mask)
Tcl_Panic("WatchModeProc not implemented for testchansource");
}
static void
TestChanSinkWatch(ClientData instanceData, int mask)
{
if (mask)
Tcl_Panic("WatchModeProc not implemented for testchansink");
}
typedef struct TestChanSourceState {
Tcl_Size numSourced; /* How many bytes returned so far */
int len; /* Length of data[] */
unsigned char data[1];
} TestChanSourceState;
static int
TestChanSourceInput(
ClientData instanceData,
char *outPtr, /* Where to store data. Assumed aligned */
const int maxReadCount, /* Maximum number of bytes to read. */
int *errorCodePtr) /* Where to store error codes. */
{
TestChanSourceState *chanPtr = (TestChanSourceState *)instanceData;
/* Arbitrary failsafe to prevent running out of memory */
if (chanPtr->numSourced > 100000000)
return 0;
/*
* Bit of optimization to minimize overhead since goal is channel i/o
* measurement. Wonder if compiler would have been better anyways...
*/
if (chanPtr->len == 1) {
memset(outPtr, chanPtr->data[0], maxReadCount);
} else if (chanPtr->len == sizeof(unsigned short) &&
sizeof(unsigned short) == 2) {
union {
unsigned short val;
unsigned char bytes[sizeof(unsigned short)];
} u;
if (chanPtr->numSourced & 1) {
u.bytes[0] = chanPtr->data[1];
u.bytes[1] = chanPtr->data[0];
} else {
u.bytes[0] = chanPtr->data[0];
u.bytes[1] = chanPtr->data[1];
}
unsigned short *to = (unsigned short *)outPtr;
unsigned short *end = to + (maxReadCount / sizeof(unsigned short));
while (to < end)
*to++ = u.val;
if (maxReadCount - (sizeof(unsigned short) * (end-to))) {
*to = u.bytes[0];
}
} else if (chanPtr->len == sizeof(unsigned int) &&
sizeof(unsigned int) == 4) {
union {
unsigned int val;
unsigned char bytes[sizeof(unsigned int)];
} u;
int offset = chanPtr->numSourced & 3;
u.bytes[0] = chanPtr->data[(offset + 0) & 3];
u.bytes[1] = chanPtr->data[(offset + 1) & 3];
u.bytes[2] = chanPtr->data[(offset + 2) & 3];
u.bytes[3] = chanPtr->data[(offset + 3) & 3];
unsigned int *to = (unsigned int *)outPtr;
unsigned int *end = to + (maxReadCount / sizeof(unsigned int));
int nremain = maxReadCount - (sizeof(unsigned int) * (end - to));
while (to < end)
*to++ = u.val;
assert(nremain < chanPtr->len);
while (nremain--)
*(nremain + (char *)to) = u.bytes[nremain];
} else {
char *to = outPtr;
int ncopied = 0;
int offset = chanPtr->numSourced % chanPtr->len;
if (offset) {
int nbytes = (chanPtr->len - offset);
if (maxReadCount <= nbytes) {
nbytes = maxReadCount;
}
memmove(to, chanPtr->data + offset, nbytes);
to += nbytes;
ncopied += nbytes;
}
int nchunks = (maxReadCount-ncopied)/chanPtr->len;
char *end = to + (nchunks * chanPtr->len);
int nremain = (maxReadCount-ncopied) - (end - to);
/* Copy the data in chunks */
while (to < end) {
memmove(to, chanPtr->data, chanPtr->len);
to += chanPtr->len;
}
assert(to == end);
if (nremain) {
assert(nremain < chanPtr->len);
memmove(outPtr + maxReadCount - nremain, chanPtr->data, nremain);
}
}
chanPtr->numSourced += maxReadCount;
return maxReadCount;
}
static int
TestChanSourceClose2 (
ClientData instanceData,
TCL_UNUSED(Tcl_Interp *), /* interp */
int flags)
{
if (flags && instanceData)
Tcl_Free(instanceData);
return 0;
}
static int
TestChanSinkOutput (
TCL_UNUSED(ClientData), /* Instance data */
TCL_UNUSED(const char *), /* Bytes to write */
int nbytes,
TCL_UNUSED(int *)) /* errorCodePtr */
{
return nbytes;
}
static int
TestChanSinkClose2 (
TCL_UNUSED(ClientData), /* Instance data */
TCL_UNUSED(Tcl_Interp *), /* interp */
int flags)
{
return 0;
}
Tcl_ChannelType TestChanSourceDispatch = {
"testchansource", /* Channel type name */
(Tcl_ChannelTypeVersion)TCL_CHANNEL_VERSION_5,
NULL,
TestChanSourceInput,
NULL, /* closeProc - not needed for Tcl 9 */
NULL, /* Seek */
NULL, /* SetOption */
NULL, /* GetOption */
TestChanSourceWatch,
NULL, /* GetHandle */
TestChanSourceClose2,
TestChanBlockMode, /* BlockMode */
NULL, /* Flush */
NULL, /* Handler */
NULL, /* WideSeek. */
NULL, /* ThreadAction */
NULL /* Truncate */
};
Tcl_ChannelType TestChanSinkDispatch = {
"testchansink", /* Channel type name */
(Tcl_ChannelTypeVersion)TCL_CHANNEL_VERSION_5,
NULL,
NULL,
TestChanSinkOutput,
NULL, /* No Seek ability */
NULL, /* SetOption */
NULL, /* GetOption */
TestChanSinkWatch,
NULL, /* GetHandle */
TestChanSinkClose2,
TestChanBlockMode, /* BlockMode */
NULL, /* Flush */
NULL, /* Handler */
NULL, /* WideSeekProc. */
NULL, /* ThreadAction */
NULL /* Truncate */
};
/*
*----------------------------------------------------------------------
*
* TestChanCreateCmd --
*
* This procedure implements the "testchancreate" command. The
* purpose is primarily isolated performance testing of channels
* and encodings.
*
* testchancreate source ?BINARY?
* Creates a read-only channel that will continuously return
* BINARY (defaults to '\0')
* testchancreate sink
* Sends written data off into the void.
*
* Results:
* A standard Tcl result.
*
* Side effects:
* Creates, deletes and returns channel event handlers.
*
*----------------------------------------------------------------------
*/
static int
TestChanCreateCmd(
TCL_UNUSED(void*),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
Tcl_Size len;
static const char *cmds[] = {"source", "sink", NULL};
enum { SOURCE, SINK } cmd;
int ret;
int flags;
void *instancePtr;
Tcl_ChannelType *dispatchPtr;
unsigned char *bytes = NULL;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "source|sink ...");
return TCL_ERROR;
}
ret = Tcl_GetIndexFromObj(interp, objv[1], cmds, "source|sink", 0, &cmd);
if (ret != TCL_OK)
return ret;
switch (cmd) {
case SINK:
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "sink");
return TCL_ERROR;
}
flags = TCL_WRITABLE;
instancePtr = NULL;
dispatchPtr = &TestChanSinkDispatch;
break;
case SOURCE:
if (objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "source ?BINARY?");
return TCL_ERROR;
}
if (objc == 2) {
bytes = NULL;
len = 0;
}
else {
bytes = Tcl_GetBytesFromObj(interp, objv[2], &len);
if (bytes == NULL)
return TCL_ERROR;
}
if (len == 0) {
len = 1;
bytes = "\0";
}
TestChanSourceState *sourceStatePtr;
sourceStatePtr = Tcl_Alloc(sizeof(TestChanSourceState) + len -
sizeof(sourceStatePtr->data));
sourceStatePtr->numSourced = 0;
sourceStatePtr->len = len;
memmove(sourceStatePtr->data, bytes, len);
instancePtr = sourceStatePtr;
flags = TCL_READABLE;
dispatchPtr = &TestChanSourceDispatch;
break;
}
Tcl_Channel chan;
char channelName[100];
static int nameCounter;
snprintf(channelName,
sizeof(channelName) / sizeof(channelName[0]),
"%s%d",
cmds[cmd],
++nameCounter);/* don't bother about race conditions */
chan = Tcl_CreateChannel(dispatchPtr, channelName, instancePtr, flags);
if (chan == NULL) {
if (instancePtr)
Tcl_Free(instancePtr);
Tcl_SetResult(interp, "Failed to create channel", TCL_STATIC);
return TCL_ERROR;
}
Tcl_RegisterChannel(interp, chan);
Tcl_SetObjResult(interp, Tcl_NewStringObj(channelName, -1));
return TCL_OK;
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
|