summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-07-28 15:51:02 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-07-28 15:51:02 (GMT)
commitae7471ec7ee7c03de40fa1c899e56e31ddf7323f (patch)
tree90b52c22774d7435c31a6ad310a97132fed77036
parent861b69164d829d247b7d86a50ebf1821ef441118 (diff)
parente253c3eed9122505c8c33fa337ccab63a75675c2 (diff)
downloadtcl-ae7471ec7ee7c03de40fa1c899e56e31ddf7323f.zip
tcl-ae7471ec7ee7c03de40fa1c899e56e31ddf7323f.tar.gz
tcl-ae7471ec7ee7c03de40fa1c899e56e31ddf7323f.tar.bz2
A bunch of 64 bit fixes (int->Tcl_Size) and the like.
-rw-r--r--generic/tclAssembly.c2
-rw-r--r--generic/tclBasic.c27
-rw-r--r--generic/tclCmdMZ.c12
-rw-r--r--generic/tclCompCmdsSZ.c32
-rw-r--r--generic/tclCompile.c47
-rw-r--r--generic/tclCompile.h8
-rw-r--r--generic/tclEnsemble.c10
-rw-r--r--generic/tclExecute.c22
-rw-r--r--generic/tclInt.h20
-rw-r--r--generic/tclOOMethod.c4
-rw-r--r--generic/tclObj.c16
-rw-r--r--generic/tclParse.c23
-rw-r--r--generic/tclProc.c6
-rw-r--r--tests/bigdata.test15
14 files changed, 131 insertions, 113 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 4aa241a..f3f8144 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -224,7 +224,7 @@ typedef struct AssemblyEnv {
* offsets of the labels. */
Tcl_Size cmdLine; /* Current line number within the assembly
* code */
- int* clNext; /* Invisible continuation line for
+ Tcl_Size* clNext; /* Invisible continuation line for
* [info frame] */
BasicBlock* head_bb; /* First basic block in the code */
BasicBlock* curr_bb; /* Current basic block */
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index b412cd3..241dc78 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -5147,7 +5147,7 @@ TclEvalEx(
* evaluation of the script. Only
* TCL_EVAL_GLOBAL is currently supported. */
Tcl_Size line, /* The line the script starts on. */
- int *clNextOuter, /* Information about an outer context for */
+ Tcl_Size *clNextOuter, /* Information about an outer context for */
const char *outerScript) /* continuation line data. This is set only in
* TclSubstTokens(), to properly handle
* [...]-nested commands. The 'outerScript'
@@ -5169,7 +5169,8 @@ TclEvalEx(
const char *p, *next;
const int minObjs = 20;
Tcl_Obj **objv, **objvSpace;
- int *expand, *lines, *lineSpace;
+ int *expand;
+ Tcl_Size *lines, *lineSpace;
Tcl_Token *tokenPtr;
int expandRequested, code = TCL_OK;
Tcl_Size bytesLeft, commandLength;
@@ -5187,10 +5188,10 @@ TclEvalEx(
Tcl_Obj **stackObjArray = (Tcl_Obj **)
TclStackAlloc(interp, minObjs * sizeof(Tcl_Obj *));
int *expandStack = (int *)TclStackAlloc(interp, minObjs * sizeof(int));
- int *linesStack = (int *)TclStackAlloc(interp, minObjs * sizeof(int));
+ Tcl_Size *linesStack = (Tcl_Size *)TclStackAlloc(interp, minObjs * sizeof(Tcl_Size));
/* TIP #280 Structures for tracking of command
* locations. */
- int *clNext = NULL; /* Pointer for the tracking of invisible
+ Tcl_Size *clNext = NULL; /* Pointer for the tracking of invisible
* continuation lines. Initialized only if the
* caller gave us a table of locations to
* track, via scriptCLLocPtr. It always refers
@@ -5314,7 +5315,7 @@ TclEvalEx(
Tcl_Size wordLine = line;
const char *wordStart = parsePtr->commandStart;
- int *wordCLNext = clNext;
+ Tcl_Size *wordCLNext = clNext;
Tcl_Size objectsNeeded = 0;
Tcl_Size numWords = parsePtr->numWords;
@@ -5325,7 +5326,7 @@ TclEvalEx(
if (numWords > minObjs) {
expand = (int *)Tcl_Alloc(numWords * sizeof(int));
objvSpace = (Tcl_Obj **)Tcl_Alloc(numWords * sizeof(Tcl_Obj *));
- lineSpace = (int *)Tcl_Alloc(numWords * sizeof(int));
+ lineSpace = (Tcl_Size *)Tcl_Alloc(numWords * sizeof(Tcl_Size));
}
expandRequested = 0;
objv = objvSpace;
@@ -5351,7 +5352,7 @@ TclEvalEx(
wordStart = tokenPtr->start;
lines[objectsUsed] = TclWordKnownAtCompileTime(tokenPtr, NULL)
- ? (int)wordLine : -1;
+ ? wordLine : -1;
if (eeFramePtr->type == TCL_LOCATION_SOURCE) {
iPtr->evalFlags |= TCL_EVAL_FILE;
@@ -5417,14 +5418,14 @@ TclEvalEx(
*/
Tcl_Obj **copy = objvSpace;
- int *lcopy = lineSpace;
- int wordIdx = numWords;
- int objIdx = objectsNeeded - 1;
+ Tcl_Size *lcopy = lineSpace;
+ Tcl_Size wordIdx = numWords;
+ Tcl_Size objIdx = objectsNeeded - 1;
if ((numWords > minObjs) || (objectsNeeded > minObjs)) {
objv = objvSpace =
(Tcl_Obj **)Tcl_Alloc(objectsNeeded * sizeof(Tcl_Obj *));
- lines = lineSpace = (int *)Tcl_Alloc(objectsNeeded * sizeof(int));
+ lines = lineSpace = (Tcl_Size *)Tcl_Alloc(objectsNeeded * sizeof(Tcl_Size));
}
objectsUsed = 0;
@@ -5659,7 +5660,7 @@ TclAdvanceLines(
void
TclAdvanceContinuations(
Tcl_Size *line,
- int **clNextPtrPtr,
+ Tcl_Size **clNextPtrPtr,
int loc)
{
/*
@@ -5837,7 +5838,7 @@ TclArgumentBCEnter(
int objc,
void *codePtr,
CmdFrame *cfPtr,
- int cmd,
+ Tcl_Size cmd,
Tcl_Size pc)
{
ExtCmdLoc *eclPtr;
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index e6bda99..b27d3a9 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -3848,7 +3848,7 @@ TclNRSwitchObjCmd(
if (ctxPtr->type == TCL_LOCATION_SOURCE && ctxPtr->line[bidx] >= 0) {
int bline = ctxPtr->line[bidx];
- ctxPtr->line = (int *)Tcl_Alloc(objc * sizeof(int));
+ ctxPtr->line = (Tcl_Size *)Tcl_Alloc(objc * sizeof(Tcl_Size));
ctxPtr->nline = objc;
TclListLines(blist, bline, objc, ctxPtr->line, objv);
} else {
@@ -3862,7 +3862,7 @@ TclNRSwitchObjCmd(
int k;
- ctxPtr->line = (int *)Tcl_Alloc(objc * sizeof(int));
+ ctxPtr->line = (Tcl_Size *)Tcl_Alloc(objc * sizeof(Tcl_Size));
ctxPtr->nline = objc;
for (k=0; k < objc; k++) {
ctxPtr->line[k] = -1;
@@ -5302,17 +5302,17 @@ TclListLines(
* structure. Assumed to be valid. Assumed to
* contain n elements. */
Tcl_Size line, /* Line the list as a whole starts on. */
- int n, /* #elements in lines */
- int *lines, /* Array of line numbers, to fill. */
+ Tcl_Size n, /* #elements in lines */
+ Tcl_Size *lines, /* Array of line numbers, to fill. */
Tcl_Obj *const *elems) /* The list elems as Tcl_Obj*, in need of
* derived continuation data */
{
const char *listStr = TclGetString(listObj);
const char *listHead = listStr;
- int i, length = strlen(listStr);
+ Tcl_Size i, length = strlen(listStr);
const char *element = NULL, *next = NULL;
ContLineLoc *clLocPtr = TclContinuationsGet(listObj);
- int *clNext = (clLocPtr ? &clLocPtr->loc[0] : NULL);
+ Tcl_Size *clNext = (clLocPtr ? &clLocPtr->loc[0] : NULL);
for (i = 0; i < n; i++) {
TclFindElement(NULL, listStr, length, &element, &next, NULL, NULL);
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index 05d50e9..0a21226 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -41,12 +41,12 @@ static int CompileUnaryOpCmd(Tcl_Interp *interp,
CompileEnv *envPtr);
static void IssueSwitchChainedTests(Tcl_Interp *interp,
CompileEnv *envPtr, int mode, int noCase,
- int numWords, Tcl_Token **bodyToken,
- int *bodyLines, int **bodyNext);
+ Tcl_Size numWords, Tcl_Token **bodyToken,
+ Tcl_Size *bodyLines, Tcl_Size **bodyNext);
static void IssueSwitchJumpTable(Tcl_Interp *interp,
CompileEnv *envPtr, int numWords,
- Tcl_Token **bodyToken, int *bodyLines,
- int **bodyContLines);
+ Tcl_Token **bodyToken, Tcl_Size *bodyLines,
+ Tcl_Size **bodyContLines);
static int IssueTryClausesInstructions(Tcl_Interp *interp,
CompileEnv *envPtr, Tcl_Token *bodyToken,
int numHandlers, int *matchCodes,
@@ -1800,14 +1800,14 @@ TclCompileSwitchCmd(
Tcl_Token *bodyTokenArray; /* Array of real pattern list items. */
Tcl_Token **bodyToken; /* Array of pointers to pattern list items. */
- int *bodyLines; /* Array of line numbers for body list
+ Tcl_Size *bodyLines; /* Array of line numbers for body list
* items. */
- int **bodyContLines; /* Array of continuation line info. */
+ Tcl_Size **bodyContLines; /* Array of continuation line info. */
int noCase; /* Has the -nocase flag been given? */
int foundMode = 0; /* Have we seen a mode flag yet? */
int i, valueIndex;
int result = TCL_ERROR;
- int *clNext = envPtr->clNext;
+ Tcl_Size *clNext = envPtr->clNext;
/*
* Only handle the following versions:
@@ -1964,8 +1964,8 @@ TclCompileSwitchCmd(
}
bodyTokenArray = (Tcl_Token *)Tcl_Alloc(sizeof(Tcl_Token) * maxLen);
bodyToken = (Tcl_Token **)Tcl_Alloc(sizeof(Tcl_Token *) * maxLen);
- bodyLines = (int *)Tcl_Alloc(sizeof(int) * maxLen);
- bodyContLines = (int **)Tcl_Alloc(sizeof(int*) * maxLen);
+ bodyLines = (Tcl_Size *)Tcl_Alloc(sizeof(Tcl_Size) * maxLen);
+ bodyContLines = (Tcl_Size **)Tcl_Alloc(sizeof(Tcl_Size*) * maxLen);
bline = mapPtr->loc[eclIndex].line[valueIndex+1];
numWords = 0;
@@ -2025,8 +2025,8 @@ TclCompileSwitchCmd(
*/
bodyToken = (Tcl_Token **)Tcl_Alloc(sizeof(Tcl_Token *) * numWords);
- bodyLines = (int *)Tcl_Alloc(sizeof(int) * numWords);
- bodyContLines = (int **)Tcl_Alloc(sizeof(int*) * numWords);
+ bodyLines = (Tcl_Size *)Tcl_Alloc(sizeof(Tcl_Size) * numWords);
+ bodyContLines = (Tcl_Size **)Tcl_Alloc(sizeof(Tcl_Size*) * numWords);
bodyTokenArray = NULL;
for (i=0 ; i<numWords ; i++) {
/*
@@ -2116,13 +2116,13 @@ IssueSwitchChainedTests(
CompileEnv *envPtr, /* Holds resulting instructions. */
int mode, /* Exact, Glob or Regexp */
int noCase, /* Case-insensitivity flag. */
- int numBodyTokens, /* Number of tokens describing things the
+ Tcl_Size numBodyTokens, /* Number of tokens describing things the
* switch can match against and bodies to
* execute when the match succeeds. */
Tcl_Token **bodyToken, /* Array of pointers to pattern list items. */
- int *bodyLines, /* Array of line numbers for body list
+ Tcl_Size *bodyLines, /* Array of line numbers for body list
* items. */
- int **bodyContLines) /* Array of continuation line info. */
+ Tcl_Size **bodyContLines) /* Array of continuation line info. */
{
enum {Switch_Exact, Switch_Glob, Switch_Regexp};
int foundDefault; /* Flag to indicate whether a "default" clause
@@ -2368,9 +2368,9 @@ IssueSwitchJumpTable(
* switch can match against and bodies to
* execute when the match succeeds. */
Tcl_Token **bodyToken, /* Array of pointers to pattern list items. */
- int *bodyLines, /* Array of line numbers for body list
+ Tcl_Size *bodyLines, /* Array of line numbers for body list
* items. */
- int **bodyContLines) /* Array of continuation line info. */
+ Tcl_Size **bodyContLines) /* Array of continuation line info. */
{
JumptableInfo *jtPtr;
int infoIndex, isNew, *finalFixups, numRealBodies = 0, jumpLocation;
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index b974c30..c0723cd 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -701,7 +701,8 @@ static void StartExpanding(CompileEnv *envPtr);
*/
static void EnterCmdWordData(ExtCmdLoc *eclPtr, Tcl_Size srcOffset,
Tcl_Token *tokenPtr, const char *cmd,
- Tcl_Size numWords, Tcl_Size line, int *clNext, int **lines,
+ Tcl_Size numWords, Tcl_Size line,
+ Tcl_Size *clNext, Tcl_Size **lines,
CompileEnv *envPtr);
static void ReleaseCmdWordData(ExtCmdLoc *eclPtr);
@@ -1953,7 +1954,8 @@ CompileCmdCompileProc(
CompileEnv *envPtr)
{
DefineLineInformation;
- int unwind = 0, incrOffset = -1;
+ int unwind = 0;
+ Tcl_Size incrOffset = -1;
int depth = TclGetStackDepth(envPtr);
/*
@@ -2040,11 +2042,11 @@ CompileCommandTokens(
Command *cmdPtr = NULL;
int code = TCL_ERROR;
int cmdKnown, expand = -1;
- int *wlines, wlineat;
- int cmdLine = envPtr->line;
- int *clNext = envPtr->clNext;
- int cmdIdx = envPtr->numCommands;
- int startCodeOffset = envPtr->codeNext - envPtr->codeStart;
+ Tcl_Size *wlines, wlineat;
+ Tcl_Size cmdLine = envPtr->line;
+ Tcl_Size *clNext = envPtr->clNext;
+ Tcl_Size cmdIdx = envPtr->numCommands;
+ Tcl_Size startCodeOffset = envPtr->codeNext - envPtr->codeStart;
int depth = TclGetStackDepth(envPtr);
assert ((int)parsePtr->numWords > 0);
@@ -2194,7 +2196,7 @@ TclCompileScript(
Tcl_SetObjResult(interp,
Tcl_ObjPrintf("Script length %" TCL_SIZE_MODIFIER
"d exceeds max permitted length %d.",
- numBytes, (int)INT_MAX-1));
+ numBytes, INT_MAX-1));
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "SCRIPTLENGTH", NULL);
TclCompileSyntaxError(interp, envPtr);
return;
@@ -2421,19 +2423,20 @@ TclCompileTokens(
Tcl_Interp *interp, /* Used for error and status reporting. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* compile. */
- size_t count1, /* Number of tokens to consider at tokenPtr.
+ size_t count1, /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_DString textBuffer; /* Holds concatenated chars from adjacent
* TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
char buffer[4] = "";
- int i, numObjsToConcat, adjust;
+ Tcl_Size i, numObjsToConcat, adjust;
size_t length;
unsigned char *entryCodeNext = envPtr->codeNext;
#define NUM_STATIC_POS 20
- int isLiteral, maxNumCL, numCL;
- int *clPosition = NULL;
+ int isLiteral;
+ Tcl_Size maxNumCL, numCL;
+ Tcl_Size *clPosition = NULL;
int depth = TclGetStackDepth(envPtr);
int count = count1;
@@ -2463,7 +2466,7 @@ TclCompileTokens(
if (isLiteral) {
maxNumCL = NUM_STATIC_POS;
- clPosition = (int *)Tcl_Alloc(maxNumCL * sizeof(int));
+ clPosition = (Tcl_Size *)Tcl_Alloc(maxNumCL * sizeof(Tcl_Size));
}
adjust = 0;
@@ -2503,8 +2506,8 @@ TclCompileTokens(
if (numCL >= maxNumCL) {
maxNumCL *= 2;
- clPosition = (int *)Tcl_Realloc(clPosition,
- maxNumCL * sizeof(int));
+ clPosition = (Tcl_Size *)Tcl_Realloc(clPosition,
+ maxNumCL * sizeof(Tcl_Size));
}
clPosition[numCL] = clPos;
numCL ++;
@@ -3330,14 +3333,14 @@ EnterCmdWordData(
const char *cmd,
Tcl_Size numWords,
Tcl_Size line,
- int *clNext,
- int **wlines,
+ Tcl_Size *clNext,
+ Tcl_Size **wlines,
CompileEnv *envPtr)
{
ECL *ePtr;
const char *last;
Tcl_Size wordIdx, wordLine;
- int *wwlines, *wordNext;
+ Tcl_Size *wwlines, *wordNext;
if (eclPtr->nuloc >= eclPtr->nloc) {
/*
@@ -3356,10 +3359,10 @@ EnterCmdWordData(
ePtr = &eclPtr->loc[eclPtr->nuloc];
ePtr->srcOffset = srcOffset;
- ePtr->line = (int *)Tcl_Alloc(numWords * sizeof(int));
- ePtr->next = (int **)Tcl_Alloc(numWords * sizeof(int *));
+ ePtr->line = (Tcl_Size *)Tcl_Alloc(numWords * sizeof(Tcl_Size));
+ ePtr->next = (Tcl_Size **)Tcl_Alloc(numWords * sizeof(Tcl_Size *));
ePtr->nline = numWords;
- wwlines = (int *)Tcl_Alloc(numWords * sizeof(int));
+ wwlines = (Tcl_Size *)Tcl_Alloc(numWords * sizeof(Tcl_Size));
last = cmd;
wordLine = line;
@@ -3372,7 +3375,7 @@ EnterCmdWordData(
/* See Ticket 4b61afd660 */
wwlines[wordIdx] =
((wordIdx == 0) || TclWordKnownAtCompileTime(tokenPtr, NULL))
- ? (int)wordLine : -1;
+ ? wordLine : -1;
ePtr->line[wordIdx] = wordLine;
ePtr->next[wordIdx] = wordNext;
last = tokenPtr->start;
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index 558742f..90ae8a7 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -183,16 +183,16 @@ typedef struct {
typedef struct {
Tcl_Size srcOffset; /* Command location to find the entry. */
Tcl_Size nline; /* Number of words in the command */
- int *line; /* Line information for all words in the
+ Tcl_Size *line; /* Line information for all words in the
* command. */
- int **next; /* Transient information used by the compiler
+ Tcl_Size **next; /* Transient information used by the compiler
* for tracking of hidden continuation
* lines. */
} ECL;
typedef struct {
int type; /* Context type. */
- int start; /* Starting line for compiled script. Needed
+ Tcl_Size start; /* Starting line for compiled script. Needed
* for the extended recompile check in
* tclCompileObj. */
Tcl_Obj *path; /* Path of the sourced file the command is
@@ -392,7 +392,7 @@ typedef struct CompileEnv {
* encountered that have not yet been paired
* with a corresponding
* INST_INVOKE_EXPANDED. */
- int *clNext; /* If not NULL, it refers to the next slot in
+ Tcl_Size *clNext; /* If not NULL, it refers to the next slot in
* clLoc to check for an invisible
* continuation line. */
} CompileEnv;
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index c238141..deabfe2 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -3293,7 +3293,7 @@ TclAttemptCompileProc(
Tcl_Size i;
Tcl_Token *saveTokenPtr = parsePtr->tokenPtr;
Tcl_Size savedStackDepth = envPtr->currStackDepth;
- unsigned savedCodeNext = envPtr->codeNext - envPtr->codeStart;
+ Tcl_Size savedCodeNext = envPtr->codeNext - envPtr->codeStart;
Tcl_Size savedAuxDataArrayNext = envPtr->auxDataArrayNext;
Tcl_Size savedExceptArrayNext = envPtr->exceptArrayNext;
#ifdef TCL_COMPILE_DEBUG
@@ -3356,13 +3356,13 @@ TclAttemptCompileProc(
ExceptionAux *auxPtr = envPtr->exceptAuxArrayPtr;
for (i = 0; i < savedExceptArrayNext; i++) {
- while ((int)auxPtr->numBreakTargets > 0
- && auxPtr->breakTargets[auxPtr->numBreakTargets - 1]
+ while (auxPtr->numBreakTargets > 0
+ && (Tcl_Size) auxPtr->breakTargets[auxPtr->numBreakTargets - 1]
>= savedCodeNext) {
auxPtr->numBreakTargets--;
}
- while ((int)auxPtr->numContinueTargets > 0
- && auxPtr->continueTargets[auxPtr->numContinueTargets - 1]
+ while (auxPtr->numContinueTargets > 0
+ && (Tcl_Size) auxPtr->continueTargets[auxPtr->numContinueTargets - 1]
>= savedCodeNext) {
auxPtr->numContinueTargets--;
}
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index b9cf44b..097c60e 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -634,7 +634,7 @@ static ExceptionRange * GetExceptRangeForPc(const unsigned char *pc,
int searchMode, ByteCode *codePtr);
static const char * GetSrcInfoForPc(const unsigned char *pc,
ByteCode *codePtr, Tcl_Size *lengthPtr,
- const unsigned char **pcBeg, int *cmdIdxPtr);
+ const unsigned char **pcBeg, Tcl_Size *cmdIdxPtr);
static Tcl_Obj ** GrowEvaluationStack(ExecEnv *eePtr, TCL_HASH_TYPE growth,
int move);
static void IllegalExprOperandType(Tcl_Interp *interp,
@@ -1850,7 +1850,7 @@ ArgumentBCEnter(
int objc,
Tcl_Obj **objv)
{
- int cmd;
+ Tcl_Size cmd;
if (GetSrcInfoForPc(pc, codePtr, NULL, NULL, &cmd)) {
TclArgumentBCEnter(interp, objv, objc, codePtr, &tdPtr->cmdFrame, cmd,
@@ -9163,7 +9163,7 @@ TclGetSrcInfoForPc(
ExtCmdLoc *eclPtr;
ECL *locPtr = NULL;
Tcl_Size srcOffset;
- int i;
+ Tcl_Size i;
Interp *iPtr = (Interp *) *codePtr->interpHandle;
Tcl_HashEntry *hePtr =
Tcl_FindHashEntry(iPtr->lineBCPtr, codePtr);
@@ -9175,7 +9175,7 @@ TclGetSrcInfoForPc(
srcOffset = cfPtr->cmd - codePtr->source;
eclPtr = (ExtCmdLoc *)Tcl_GetHashValue(hePtr);
- for (i=0; i < (int)eclPtr->nuloc; i++) {
+ for (i=0; i < eclPtr->nuloc; i++) {
if (eclPtr->loc[i].srcOffset == srcOffset) {
locPtr = eclPtr->loc+i;
break;
@@ -9215,7 +9215,7 @@ GetSrcInfoForPc(
const unsigned char **pcBeg,/* If non-NULL, the bytecode location
* where the current instruction starts.
* If NULL; no pointer is stored. */
- int *cmdIdxPtr) /* If non-NULL, the location where the index
+ Tcl_Size *cmdIdxPtr) /* If non-NULL, the location where the index
* of the command containing the pc should
* be stored. */
{
@@ -9224,10 +9224,10 @@ GetSrcInfoForPc(
unsigned char *codeDeltaNext, *codeLengthNext;
unsigned char *srcDeltaNext, *srcLengthNext;
Tcl_Size codeOffset, codeLen, codeEnd, srcOffset, srcLen, delta, i;
- int bestDist = INT_MAX; /* Distance of pc to best cmd's start pc. */
- int bestSrcOffset = -1; /* Initialized to avoid compiler warning. */
- int bestSrcLength = -1; /* Initialized to avoid compiler warning. */
- int bestCmdIdx = -1;
+ Tcl_Size bestDist = TCL_SIZE_MAX; /* Distance of pc to best cmd's start pc. */
+ Tcl_Size bestSrcOffset = -1; /* Initialized to avoid compiler warning. */
+ Tcl_Size bestSrcLength = -1; /* Initialized to avoid compiler warning. */
+ Tcl_Size bestCmdIdx = -1;
/* The pc must point within the bytecode */
assert ((pcOffset >= 0) && (pcOffset < codePtr->numCodeBytes));
@@ -9306,7 +9306,7 @@ GetSrcInfoForPc(
* instructions. Stop when crossing pc; keep previous.
*/
- curr = ((bestDist == INT_MAX) ? codePtr->codeStart : pc - bestDist);
+ curr = ((bestDist == TCL_SIZE_MAX) ? codePtr->codeStart : pc - bestDist);
prev = curr;
while (curr <= pc) {
prev = curr;
@@ -9315,7 +9315,7 @@ GetSrcInfoForPc(
*pcBeg = prev;
}
- if (bestDist == INT_MAX) {
+ if (bestDist == TCL_SIZE_MAX) {
return NULL;
}
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 1b6b3c4..aed077c 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -1320,7 +1320,7 @@ typedef struct CmdFrame {
int type; /* Values see below. */
int level; /* Number of frames in stack, prevent O(n)
* scan of list. */
- int *line; /* Lines the words of the command start on. */
+ Tcl_Size *line; /* Lines the words of the command start on. */
Tcl_Size nline;
CallFrame *framePtr; /* Procedure activation record, may be
* NULL. */
@@ -1415,7 +1415,7 @@ typedef struct CFWordBC {
typedef struct ContLineLoc {
Tcl_Size num; /* Number of entries in loc, not counting the
* final -1 marker entry. */
- int loc[TCLFLEXARRAY];/* Table of locations, as character offsets.
+ Tcl_Size loc[TCLFLEXARRAY];/* Table of locations, as character offsets.
* The table is allocated as part of the
* structure, extending behind the nominal end
* of the structure. An entry containing the
@@ -3206,7 +3206,7 @@ MODULE_SCOPE void TclAppendBytesToByteArray(Tcl_Obj *objPtr,
const unsigned char *bytes, Tcl_Size len);
MODULE_SCOPE int TclNREvalCmd(Tcl_Interp *interp, Tcl_Obj *objPtr,
int flags);
-MODULE_SCOPE void TclAdvanceContinuations(Tcl_Size *line, int **next,
+MODULE_SCOPE void TclAdvanceContinuations(Tcl_Size *line, Tcl_Size **next,
int loc);
MODULE_SCOPE void TclAdvanceLines(Tcl_Size *line, const char *start,
const char *end);
@@ -3216,7 +3216,7 @@ MODULE_SCOPE void TclArgumentRelease(Tcl_Interp *interp,
Tcl_Obj *objv[], int objc);
MODULE_SCOPE void TclArgumentBCEnter(Tcl_Interp *interp,
Tcl_Obj *objv[], int objc,
- void *codePtr, CmdFrame *cfPtr, int cmd, Tcl_Size pc);
+ void *codePtr, CmdFrame *cfPtr, Tcl_Size cmd, Tcl_Size pc);
MODULE_SCOPE void TclArgumentBCRelease(Tcl_Interp *interp,
CmdFrame *cfPtr);
MODULE_SCOPE void TclArgumentGet(Tcl_Interp *interp, Tcl_Obj *obj,
@@ -3241,9 +3241,9 @@ MODULE_SCOPE Tcl_NRPostProc TclClearRootEnsemble;
MODULE_SCOPE int TclCompareTwoNumbers(Tcl_Obj *valuePtr,
Tcl_Obj *value2Ptr);
MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, Tcl_Size num,
- int *loc);
+ Tcl_Size *loc);
MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr,
- int start, int *clNext);
+ Tcl_Size start, Tcl_Size *clNext);
MODULE_SCOPE ContLineLoc *TclContinuationsGet(Tcl_Obj *objPtr);
MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj *objPtr,
Tcl_Obj *originObjPtr);
@@ -3268,7 +3268,7 @@ MODULE_SCOPE int TclFindDictElement(Tcl_Interp *interp,
/* TIP #280 - Modified token based evaluation, with line information. */
MODULE_SCOPE int TclEvalEx(Tcl_Interp *interp, const char *script,
Tcl_Size numBytes, int flags, Tcl_Size line,
- int *clNextOuter, const char *outerScript);
+ Tcl_Size *clNextOuter, const char *outerScript);
MODULE_SCOPE Tcl_ObjCmdProc TclFileAttrsCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclFileCopyCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclFileDeleteCmd;
@@ -3389,8 +3389,8 @@ MODULE_SCOPE Tcl_Obj * TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
Tcl_Size indexCount, Tcl_Obj *const indexArray[]);
MODULE_SCOPE Tcl_Obj * TclListObjGetElement(Tcl_Obj *listObj, Tcl_Size index);
/* TIP #280 */
-MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, Tcl_Size line, int n,
- int *lines, Tcl_Obj *const *elems);
+MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, Tcl_Size line, Tcl_Size n,
+ Tcl_Size *lines, Tcl_Obj *const *elems);
MODULE_SCOPE int TclListObjAppendElements(Tcl_Interp *interp,
Tcl_Obj *toObj, Tcl_Size elemCount,
Tcl_Obj *const elemObjv[]);
@@ -3558,7 +3558,7 @@ MODULE_SCOPE void TclSubstParse(Tcl_Interp *interp, const char *bytes,
Tcl_InterpState *statePtr);
MODULE_SCOPE int TclSubstTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
Tcl_Size count, int *tokensLeftPtr, Tcl_Size line,
- int *clNextOuter, const char *outerScript);
+ Tcl_Size *clNextOuter, const char *outerScript);
MODULE_SCOPE Tcl_Size TclTrim(const char *bytes, Tcl_Size numBytes,
const char *trim, Tcl_Size numTrim, Tcl_Size *trimRight);
MODULE_SCOPE Tcl_Size TclTrimLeft(const char *bytes, Tcl_Size numBytes,
diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c
index 34437c7..7a941b8 100644
--- a/generic/tclOOMethod.c
+++ b/generic/tclOOMethod.c
@@ -588,7 +588,7 @@ TclOOMakeProcInstanceMethod(
cfPtr->level = -1;
cfPtr->type = context.type;
- cfPtr->line = (int *)Tcl_Alloc(sizeof(int));
+ cfPtr->line = (Tcl_Size *)Tcl_Alloc(sizeof(Tcl_Size));
cfPtr->line[0] = context.line[3];
cfPtr->nline = 1;
cfPtr->framePtr = NULL;
@@ -701,7 +701,7 @@ TclOOMakeProcMethod(
cfPtr->level = -1;
cfPtr->type = context.type;
- cfPtr->line = (int *)Tcl_Alloc(sizeof(int));
+ cfPtr->line = (Tcl_Size *)Tcl_Alloc(sizeof(Tcl_Size));
cfPtr->line[0] = context.line[3];
cfPtr->nline = 1;
cfPtr->framePtr = NULL;
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 784162e..8b0aa47 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -555,13 +555,13 @@ ContLineLoc *
TclContinuationsEnter(
Tcl_Obj *objPtr,
Tcl_Size num,
- int *loc)
+ Tcl_Size *loc)
{
int newEntry;
ThreadSpecificData *tsdPtr = TclGetContLineTable();
Tcl_HashEntry *hPtr =
Tcl_CreateHashEntry(tsdPtr->lineCLPtr, objPtr, &newEntry);
- ContLineLoc *clLocPtr = (ContLineLoc *)Tcl_Alloc(offsetof(ContLineLoc, loc) + (num + 1U) *sizeof(int));
+ ContLineLoc *clLocPtr = (ContLineLoc *)Tcl_Alloc(offsetof(ContLineLoc, loc) + (num + 1U) *sizeof(Tcl_Size));
if (!newEntry) {
/*
@@ -589,7 +589,7 @@ TclContinuationsEnter(
}
clLocPtr->num = num;
- memcpy(&clLocPtr->loc, loc, num*sizeof(int));
+ memcpy(&clLocPtr->loc, loc, num*sizeof(Tcl_Size));
clLocPtr->loc[num] = CLL_END; /* Sentinel */
Tcl_SetHashValue(hPtr, clLocPtr);
@@ -618,12 +618,12 @@ TclContinuationsEnter(
void
TclContinuationsEnterDerived(
Tcl_Obj *objPtr,
- int start,
- int *clNext)
+ Tcl_Size start,
+ Tcl_Size *clNext)
{
Tcl_Size length;
- int end, num;
- int *wordCLLast = clNext;
+ Tcl_Size end, num;
+ Tcl_Size *wordCLLast = clNext;
/*
* We have to handle invisible continuations lines here as well, despite
@@ -666,7 +666,7 @@ TclContinuationsEnterDerived(
num = wordCLLast - clNext;
if (num) {
- int i;
+ Tcl_Size i;
ContLineLoc *clLocPtr = TclContinuationsEnter(objPtr, num, clNext);
/*
diff --git a/generic/tclParse.c b/generic/tclParse.c
index d8b40e4..55fd63d 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -1072,7 +1072,7 @@ ParseTokens(
* termination information. */
{
char type;
- int originalTokens;
+ Tcl_Size originalTokens;
int noSubstCmds = !(flags & TCL_SUBST_COMMANDS);
int noSubstVars = !(flags & TCL_SUBST_VARIABLES);
int noSubstBS = !(flags & TCL_SUBST_BACKSLASHES);
@@ -1106,7 +1106,7 @@ ParseTokens(
tokenPtr->size = src - tokenPtr->start;
parsePtr->numTokens++;
} else if (*src == '$') {
- int varToken;
+ Tcl_Size varToken;
if (noSubstVars) {
tokenPtr->type = TCL_TOKEN_TEXT;
@@ -1233,7 +1233,7 @@ ParseTokens(
*/
if (mask & TYPE_SPACE) {
- if ((int)parsePtr->numTokens == originalTokens) {
+ if (parsePtr->numTokens == originalTokens) {
goto finishToken;
}
break;
@@ -1254,7 +1254,7 @@ ParseTokens(
Tcl_Panic("ParseTokens encountered unknown character");
}
}
- if ((int)parsePtr->numTokens == originalTokens) {
+ if (parsePtr->numTokens == originalTokens) {
/*
* There was nothing in this range of text. Add an empty token for the
* empty range, so that there is always at least one token added.
@@ -1651,8 +1651,7 @@ Tcl_ParseBraces(
{
Tcl_Token *tokenPtr;
const char *src;
- int startIndex, level;
- Tcl_Size length;
+ Tcl_Size length, startIndex, level;
if (numBytes < 0 && start) {
numBytes = strlen(start);
@@ -1703,7 +1702,7 @@ Tcl_ParseBraces(
*/
if ((src != tokenPtr->start)
- || ((int)parsePtr->numTokens == startIndex)) {
+ || (parsePtr->numTokens == startIndex)) {
tokenPtr->size = (src - tokenPtr->start);
parsePtr->numTokens++;
}
@@ -2122,7 +2121,7 @@ TclSubstTokens(
* integer representing the number of tokens
* left to be substituted will be written */
Tcl_Size line, /* The line the script starts on. */
- int *clNextOuter, /* Information about an outer context for */
+ Tcl_Size *clNextOuter, /* Information about an outer context for */
const char *outerScript) /* continuation line data. This is set by
* EvalEx() to properly handle [...]-nested
* commands. The 'outerScript' refers to the
@@ -2145,7 +2144,7 @@ TclSubstTokens(
#define NUM_STATIC_POS 20
int isLiteral;
Tcl_Size i, maxNumCL, numCL, adjust;
- int *clPosition = NULL;
+ Tcl_Size *clPosition = NULL;
Interp *iPtr = (Interp *) interp;
int inFile = iPtr->evalFlags & TCL_EVAL_FILE;
@@ -2180,7 +2179,7 @@ TclSubstTokens(
if (isLiteral) {
maxNumCL = NUM_STATIC_POS;
- clPosition = (int *)Tcl_Alloc(maxNumCL * sizeof(int));
+ clPosition = (Tcl_Size *)Tcl_Alloc(maxNumCL * sizeof(Tcl_Size));
}
adjust = 0;
@@ -2230,8 +2229,8 @@ TclSubstTokens(
if (numCL >= maxNumCL) {
maxNumCL *= 2;
- clPosition = (int *)Tcl_Realloc(clPosition,
- maxNumCL * sizeof(int));
+ clPosition = (Tcl_Size *)Tcl_Realloc(clPosition,
+ maxNumCL * sizeof(Tcl_Size));
}
clPosition[numCL] = clPos;
numCL++;
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 8c84446..85e5c6f 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -268,7 +268,7 @@ Tcl_ProcObjCmd(
cfPtr->level = -1;
cfPtr->type = contextPtr->type;
- cfPtr->line = (int *)Tcl_Alloc(sizeof(int));
+ cfPtr->line = (Tcl_Size *)Tcl_Alloc(sizeof(Tcl_Size));
cfPtr->line[0] = contextPtr->line[3];
cfPtr->nline = 1;
cfPtr->framePtr = NULL;
@@ -2547,7 +2547,7 @@ SetLambdaFromAny(
if (contextPtr->line
&& (contextPtr->nline >= 2) && (contextPtr->line[1] >= 0)) {
- int buf[2];
+ Tcl_Size buf[2];
/*
* Move from approximation (line of list cmd word) to actual
@@ -2559,7 +2559,7 @@ SetLambdaFromAny(
cfPtr->level = -1;
cfPtr->type = contextPtr->type;
- cfPtr->line = (int *)Tcl_Alloc(sizeof(int));
+ cfPtr->line = (Tcl_Size *)Tcl_Alloc(sizeof(Tcl_Size));
cfPtr->line[0] = buf[1];
cfPtr->nline = 1;
cfPtr->framePtr = NULL;
diff --git a/tests/bigdata.test b/tests/bigdata.test
index b7afbbc..d173e90 100644
--- a/tests/bigdata.test
+++ b/tests/bigdata.test
@@ -1147,6 +1147,21 @@ test puts-bigdata-2 "puts" -setup {
set written
} -result {2345—}
+test source-bigdata-1 "source" -setup {
+ # This test crashes because the frame linenumber tracking
+ # wraps around at INT_MAX
+ set fpath [tcltest::makeFile {} source-bigdata-1.tcl]
+ set fd [open $fpath w]
+ fconfigure $fd -translation lf
+ puts -nonewline $fd [string repeat \n 4294967296]
+ puts $fd {dict get [info frame 0] line}
+ close $fd
+} -constraints {
+ bigdata knownBug
+} -body {
+ set line [source $fpath]
+} -result 4294967297
+
#
# TODO
# lremove