summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclAssembly.c4
-rw-r--r--generic/tclCompCmdsGR.c2
-rw-r--r--generic/tclCompile.c28
-rw-r--r--generic/tclCompile.h14
-rw-r--r--generic/tclDisassemble.c10
-rw-r--r--generic/tclExecute.c20
-rw-r--r--generic/tclOptimize.c8
7 files changed, 43 insertions, 43 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index b8a4606..c53fd0b 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -4011,7 +4011,7 @@ UnstackExpiredCatches(
--catchDepth;
if (catches[catchDepth] != NULL) {
range = envPtr->exceptArrayPtr + catchIndices[catchDepth];
- range->numCodeBytes = bbPtr->startOffset - range->codeOffset;
+ range->numCodeBytes = bbPtr->startOffset - (int)range->codeOffset;
catches[catchDepth] = NULL;
catchIndices[catchDepth] = -1;
}
@@ -4030,7 +4030,7 @@ UnstackExpiredCatches(
if (catches[catchDepth] != NULL) {
if (catches[catchDepth] != block || catchState >= BBCS_CAUGHT) {
range = envPtr->exceptArrayPtr + catchIndices[catchDepth];
- range->numCodeBytes = bbPtr->startOffset - range->codeOffset;
+ range->numCodeBytes = bbPtr->startOffset - (int)range->codeOffset;
catches[catchDepth] = NULL;
catchIndices[catchDepth] = -1;
}
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index 6486b21..92dec77 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -2510,7 +2510,7 @@ TclCompileReturnCmd(
ExceptionRange range = envPtr->exceptArrayPtr[index];
if ((range.type == CATCH_EXCEPTION_RANGE)
- && (range.catchOffset == -1)) {
+ && (range.catchOffset == TCL_INDEX_NONE)) {
enclosingCatch = 1;
break;
}
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index e86a363..a0004dc 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -3409,11 +3409,11 @@ TclCreateExceptRange(
rangePtr = &envPtr->exceptArrayPtr[index];
rangePtr->type = type;
rangePtr->nestingLevel = envPtr->exceptDepth;
- rangePtr->codeOffset = -1;
- rangePtr->numCodeBytes = -1;
- rangePtr->breakOffset = -1;
- rangePtr->continueOffset = -1;
- rangePtr->catchOffset = -1;
+ rangePtr->codeOffset = TCL_INDEX_NONE;
+ rangePtr->numCodeBytes = TCL_INDEX_NONE;
+ rangePtr->breakOffset = TCL_INDEX_NONE;
+ rangePtr->continueOffset = TCL_INDEX_NONE;
+ rangePtr->catchOffset = TCL_INDEX_NONE;
auxPtr = &envPtr->exceptAuxArrayPtr[index];
auxPtr->supportsContinue = 1;
auxPtr->stackDepth = envPtr->currStackDepth;
@@ -3454,9 +3454,9 @@ TclGetInnermostExceptionRange(
while (i > 0) {
rangePtr--; i--;
- if (CurrentOffset(envPtr) >= rangePtr->codeOffset &&
- (rangePtr->numCodeBytes == -1 || CurrentOffset(envPtr) <
- rangePtr->codeOffset+rangePtr->numCodeBytes) &&
+ if (CurrentOffset(envPtr) >= (int)rangePtr->codeOffset &&
+ (rangePtr->numCodeBytes == TCL_INDEX_NONE || CurrentOffset(envPtr) <
+ (int)rangePtr->codeOffset+(int)rangePtr->numCodeBytes) &&
(returnCode != TCL_CONTINUE ||
envPtr->exceptAuxArrayPtr[i].supportsContinue)) {
@@ -3603,10 +3603,10 @@ StartExpanding(
* Ignore loops unless they're still being built.
*/
- if (rangePtr->codeOffset > CurrentOffset(envPtr)) {
+ if ((int)rangePtr->codeOffset > CurrentOffset(envPtr)) {
continue;
}
- if (rangePtr->numCodeBytes != -1) {
+ if (rangePtr->numCodeBytes != TCL_INDEX_NONE) {
continue;
}
@@ -3661,12 +3661,12 @@ TclFinalizeLoopExceptionRange(
for (i=0 ; i<auxPtr->numBreakTargets ; i++) {
site = envPtr->codeStart + auxPtr->breakTargets[i];
- offset = rangePtr->breakOffset - auxPtr->breakTargets[i];
+ offset = (int)rangePtr->breakOffset - auxPtr->breakTargets[i];
TclUpdateInstInt4AtPc(INST_JUMP4, offset, site);
}
for (i=0 ; i<auxPtr->numContinueTargets ; i++) {
site = envPtr->codeStart + auxPtr->continueTargets[i];
- if (rangePtr->continueOffset == -1) {
+ if (rangePtr->continueOffset == TCL_INDEX_NONE) {
int j;
/*
@@ -3679,7 +3679,7 @@ TclFinalizeLoopExceptionRange(
*++site = INST_NOP;
}
} else {
- offset = rangePtr->continueOffset - auxPtr->continueTargets[i];
+ offset = (int)rangePtr->continueOffset - auxPtr->continueTargets[i];
TclUpdateInstInt4AtPc(INST_JUMP4, offset, site);
}
}
@@ -4044,7 +4044,7 @@ TclFixupForwardJump(
switch (rangePtr->type) {
case LOOP_EXCEPTION_RANGE:
rangePtr->breakOffset += 3;
- if (rangePtr->continueOffset != -1) {
+ if (rangePtr->continueOffset != TCL_INDEX_NONE) {
rangePtr->continueOffset += 3;
}
break;
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index b0491be..439122b 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -92,17 +92,17 @@ typedef struct {
int nestingLevel; /* Static depth of the exception range. Used
* to find the most deeply-nested range
* surrounding a PC at runtime. */
- int codeOffset; /* Offset of the first instruction byte of the
+ size_t codeOffset; /* Offset of the first instruction byte of the
* code range. */
- int numCodeBytes; /* Number of bytes in the code range. */
- int breakOffset; /* If LOOP_EXCEPTION_RANGE, the target PC
+ size_t numCodeBytes; /* Number of bytes in the code range. */
+ size_t breakOffset; /* If LOOP_EXCEPTION_RANGE, the target PC
* offset for a break command in the range. */
- int continueOffset; /* If LOOP_EXCEPTION_RANGE and not -1, the
+ size_t continueOffset; /* If LOOP_EXCEPTION_RANGE and not -1, the
* target PC offset for a continue command in
* the code range. Otherwise, ignore this
* range when processing a continue
* command. */
- int catchOffset; /* If a CATCH_EXCEPTION_RANGE, the target PC
+ size_t catchOffset; /* If a CATCH_EXCEPTION_RANGE, the target PC
* offset for any "exception" in range. */
} ExceptionRange;
@@ -1585,11 +1585,11 @@ MODULE_SCOPE int TclPushProcCallFrame(void *clientData,
(((envPtr)->exceptDepth++), \
((envPtr)->maxExceptDepth = \
TclMax((envPtr)->exceptDepth, (envPtr)->maxExceptDepth)), \
- ((envPtr)->exceptArrayPtr[(index)].codeOffset = CurrentOffset(envPtr)))
+ ((envPtr)->exceptArrayPtr[(index)].codeOffset= CurrentOffset(envPtr)))
#define ExceptionRangeEnds(envPtr, index) \
(((envPtr)->exceptDepth--), \
((envPtr)->exceptArrayPtr[(index)].numCodeBytes = \
- CurrentOffset(envPtr) - (envPtr)->exceptArrayPtr[(index)].codeOffset))
+ CurrentOffset(envPtr) - (int)(envPtr)->exceptArrayPtr[(index)].codeOffset))
#define ExceptionRangeTarget(envPtr, index, targetType) \
((envPtr)->exceptArrayPtr[(index)].targetType = CurrentOffset(envPtr))
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c
index 1cef2d2..ff12770 100644
--- a/generic/tclDisassemble.c
+++ b/generic/tclDisassemble.c
@@ -358,18 +358,18 @@ DisassembleByteCodeObj(
ExceptionRange *rangePtr = &codePtr->exceptArrayPtr[i];
Tcl_AppendPrintfToObj(bufferObj,
- " %d: level %d, %s, pc %d-%d, ",
+ " %d: level %d, %s, pc %" TCL_Z_MODIFIER "u-%" TCL_Z_MODIFIER "u, ",
i, rangePtr->nestingLevel,
(rangePtr->type==LOOP_EXCEPTION_RANGE ? "loop" : "catch"),
rangePtr->codeOffset,
(rangePtr->codeOffset + rangePtr->numCodeBytes - 1));
switch (rangePtr->type) {
case LOOP_EXCEPTION_RANGE:
- Tcl_AppendPrintfToObj(bufferObj, "continue %d, break %d\n",
+ Tcl_AppendPrintfToObj(bufferObj, "continue %" TCL_Z_MODIFIER "u, break %" TCL_Z_MODIFIER "u\n",
rangePtr->continueOffset, rangePtr->breakOffset);
break;
case CATCH_EXCEPTION_RANGE:
- Tcl_AppendPrintfToObj(bufferObj, "catch %d\n",
+ Tcl_AppendPrintfToObj(bufferObj, "catch %" TCL_Z_MODIFIER "u\n",
rangePtr->catchOffset);
break;
default:
@@ -1144,14 +1144,14 @@ DisassembleByteCodeAsDicts(
switch (rangePtr->type) {
case LOOP_EXCEPTION_RANGE:
Tcl_ListObjAppendElement(NULL, exn, Tcl_ObjPrintf(
- "type %s level %d from %d to %d break %d continue %d",
+ "type %s level %d from %" TCL_Z_MODIFIER "u to %" TCL_Z_MODIFIER "u break %" TCL_Z_MODIFIER "u continue %" TCL_Z_MODIFIER "u",
"loop", rangePtr->nestingLevel, rangePtr->codeOffset,
rangePtr->codeOffset + rangePtr->numCodeBytes - 1,
rangePtr->breakOffset, rangePtr->continueOffset));
break;
case CATCH_EXCEPTION_RANGE:
Tcl_ListObjAppendElement(NULL, exn, Tcl_ObjPrintf(
- "type %s level %d from %d to %d catch %d",
+ "type %s level %d from %" TCL_Z_MODIFIER "u to %" TCL_Z_MODIFIER "u catch %" TCL_Z_MODIFIER "u",
"catch", rangePtr->nestingLevel, rangePtr->codeOffset,
rangePtr->codeOffset + rangePtr->numCodeBytes - 1,
rangePtr->catchOffset));
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 0483bec..9fbf803 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -7228,20 +7228,20 @@ TEBCresume(
}
if (result == TCL_BREAK) {
result = TCL_OK;
- pc = (codePtr->codeStart + rangePtr->breakOffset);
- TRACE_APPEND(("%s, range at %d, new pc %d\n",
+ pc = (codePtr->codeStart + (int)rangePtr->breakOffset);
+ TRACE_APPEND(("%s, range at %" TCL_Z_MODIFIER "u, new pc %" TCL_Z_MODIFIER "u\n",
StringForResultCode(result),
rangePtr->codeOffset, rangePtr->breakOffset));
NEXT_INST_F(0, 0, 0);
}
- if (rangePtr->continueOffset == -1) {
+ if (rangePtr->continueOffset == TCL_INDEX_NONE) {
TRACE_APPEND(("%s, loop w/o continue, checking for catch\n",
StringForResultCode(result)));
goto checkForCatch;
}
result = TCL_OK;
- pc = (codePtr->codeStart + rangePtr->continueOffset);
- TRACE_APPEND(("%s, range at %d, new pc %d\n",
+ pc = (codePtr->codeStart + (int)rangePtr->continueOffset);
+ TRACE_APPEND(("%s, range at %" TCL_Z_MODIFIER "u, new pc %" TCL_Z_MODIFIER "u\n",
StringForResultCode(result),
rangePtr->codeOffset, rangePtr->continueOffset));
NEXT_INST_F(0, 0, 0);
@@ -7413,13 +7413,13 @@ TEBCresume(
}
#ifdef TCL_COMPILE_DEBUG
if (traceInstructions) {
- fprintf(stdout, " ... found catch at %d, catchTop=%d, "
+ fprintf(stdout, " ... found catch at %" TCL_Z_MODIFIER "u, catchTop=%d, "
"unwound to %ld, new pc %" TCL_Z_MODIFIER "u\n",
rangePtr->codeOffset, (int) (catchTop - initCatchTop - 1),
- (long)*catchTop, (size_t) rangePtr->catchOffset);
+ (long)*catchTop, rangePtr->catchOffset);
}
#endif
- pc = (codePtr->codeStart + rangePtr->catchOffset);
+ pc = (codePtr->codeStart + (int)rangePtr->catchOffset);
NEXT_INST_F(0, 0, 0); /* Restart the execution loop at pc. */
/*
@@ -9120,7 +9120,7 @@ GetExceptRangeForPc(
* for the enclosing ExceptionRange. */
{
ExceptionRange *rangeArrayPtr;
- int numRanges = codePtr->numExceptRanges;
+ size_t numRanges = codePtr->numExceptRanges;
ExceptionRange *rangePtr;
size_t pcOffset = pc - codePtr->codeStart;
size_t start;
@@ -9147,7 +9147,7 @@ GetExceptRangeForPc(
if (searchMode == TCL_BREAK) {
return rangePtr;
}
- if (searchMode == TCL_CONTINUE && rangePtr->continueOffset != -1){
+ if (searchMode == TCL_CONTINUE && rangePtr->continueOffset != TCL_INDEX_NONE){
return rangePtr;
}
}
diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c
index 094638e..2fcc8e1 100644
--- a/generic/tclOptimize.c
+++ b/generic/tclOptimize.c
@@ -129,13 +129,13 @@ LocateTargetAddresses(
ExceptionRange *rangePtr = &envPtr->exceptArrayPtr[i];
if (rangePtr->type == CATCH_EXCEPTION_RANGE) {
- targetInstPtr = envPtr->codeStart + rangePtr->catchOffset;
+ targetInstPtr = envPtr->codeStart + (int)rangePtr->catchOffset;
DefineTargetAddress(tablePtr, targetInstPtr);
} else {
- targetInstPtr = envPtr->codeStart + rangePtr->breakOffset;
+ targetInstPtr = envPtr->codeStart + (int)rangePtr->breakOffset;
DefineTargetAddress(tablePtr, targetInstPtr);
- if (rangePtr->continueOffset >= 0) {
- targetInstPtr = envPtr->codeStart + rangePtr->continueOffset;
+ if (rangePtr->continueOffset != TCL_INDEX_NONE) {
+ targetInstPtr = envPtr->codeStart + (int)rangePtr->continueOffset;
DefineTargetAddress(tablePtr, targetInstPtr);
}
}