summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-04-29 19:29:14 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-04-29 19:29:14 (GMT)
commitd41d08e1111a2353e98c6814043b6441e6e71b64 (patch)
treeafd15372be814df73b18bb4c139fee4cc1de2be2 /generic
parent100542f06740e0120d51ef844f61d47b10ce39ef (diff)
downloadtcl-d41d08e1111a2353e98c6814043b6441e6e71b64.zip
tcl-d41d08e1111a2353e98c6814043b6441e6e71b64.tar.gz
tcl-d41d08e1111a2353e98c6814043b6441e6e71b64.tar.bz2
Parameterize TclInitByteCodeObj to callers sense of typePtr.dgp_init_bytecode
Diffstat (limited to 'generic')
-rw-r--r--generic/tclAssembly.c4
-rw-r--r--generic/tclCompile.c12
-rw-r--r--generic/tclCompile.h4
-rw-r--r--generic/tclExecute.c4
4 files changed, 10 insertions, 14 deletions
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 7db5d69..4ad31d2 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -891,15 +891,13 @@ CompileAssembleObj(
*/
TclEmitOpcode(INST_DONE, &compEnv);
- TclInitByteCodeObj(objPtr, &compEnv);
- objPtr->typePtr = &assembleCodeType;
+ codePtr = TclInitByteCodeObj(objPtr, &assembleCodeType, &compEnv);
TclFreeCompileEnv(&compEnv);
/*
* Record the local variable context to which the bytecode pertains
*/
- codePtr = objPtr->internalRep.twoPtrValue.ptr1;
if (iPtr->varFramePtr->localCachePtr) {
codePtr->localCachePtr = iPtr->varFramePtr->localCachePtr;
codePtr->localCachePtr->refCount++;
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 32a09b2..96b418c 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -868,7 +868,7 @@ TclSetByteCodeFromAny(
#endif /*TCL_COMPILE_DEBUG*/
if (result == TCL_OK) {
- TclInitByteCodeObj(objPtr, &compEnv);
+ (void) TclInitByteCodeObj(objPtr, &tclByteCodeType, &compEnv);
#ifdef TCL_COMPILE_DEBUG
if (tclTraceCompile >= 2) {
TclPrintByteCodeObj(interp, objPtr);
@@ -1322,11 +1322,9 @@ CompileSubstObj(
TclSubstCompile(interp, bytes, numBytes, flags, 1, &compEnv);
TclEmitOpcode(INST_DONE, &compEnv);
- TclInitByteCodeObj(objPtr, &compEnv);
- objPtr->typePtr = &substCodeType;
+ codePtr = TclInitByteCodeObj(objPtr, &substCodeType, &compEnv);
TclFreeCompileEnv(&compEnv);
- codePtr = objPtr->internalRep.twoPtrValue.ptr1;
objPtr->internalRep.twoPtrValue.ptr1 = codePtr;
objPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(flags);
if (iPtr->varFramePtr->localCachePtr) {
@@ -2879,11 +2877,12 @@ TclInitByteCode(
return codePtr;
}
-void
+ByteCode *
TclInitByteCodeObj(
Tcl_Obj *objPtr, /* Points object that should be initialized,
* and whose string rep contains the source
* code. */
+ const Tcl_ObjType *typePtr,
register CompileEnv *envPtr)/* Points to the CompileEnv structure from
* which to create a ByteCode structure. */
{
@@ -2900,7 +2899,8 @@ TclInitByteCodeObj(
TclFreeIntRep(objPtr);
objPtr->internalRep.twoPtrValue.ptr1 = codePtr;
- objPtr->typePtr = &tclByteCodeType;
+ objPtr->typePtr = typePtr;
+ return codePtr;
}
/*
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index af8d60f..f99c07c 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -1119,8 +1119,8 @@ MODULE_SCOPE int TclFixupForwardJump(CompileEnv *envPtr,
MODULE_SCOPE void TclFreeCompileEnv(CompileEnv *envPtr);
MODULE_SCOPE void TclFreeJumpFixupArray(JumpFixupArray *fixupArrayPtr);
MODULE_SCOPE ByteCode * TclInitByteCode(CompileEnv *envPtr);
-MODULE_SCOPE void TclInitByteCodeObj(Tcl_Obj *objPtr,
- CompileEnv *envPtr);
+MODULE_SCOPE ByteCode * TclInitByteCodeObj(Tcl_Obj *objPtr,
+ const Tcl_ObjType *typePtr, CompileEnv *envPtr);
MODULE_SCOPE void TclInitCompileEnv(Tcl_Interp *interp,
CompileEnv *envPtr, const char *string,
int numBytes, const CmdFrame *invoker, int word);
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 2a2b951..cd28a92 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -1565,10 +1565,8 @@ CompileExprObj(
*/
TclEmitOpcode(INST_DONE, &compEnv);
- TclInitByteCodeObj(objPtr, &compEnv);
- objPtr->typePtr = &exprCodeType;
+ codePtr = TclInitByteCodeObj(objPtr, &exprCodeType, &compEnv);
TclFreeCompileEnv(&compEnv);
- codePtr = objPtr->internalRep.twoPtrValue.ptr1;
if (iPtr->varFramePtr->localCachePtr) {
codePtr->localCachePtr = iPtr->varFramePtr->localCachePtr;
codePtr->localCachePtr->refCount++;