Overview
| Artifact ID: | b7fb03bd0d08ccff70590e917d2624f1b378e58f |
|---|---|
| Ticket: | d4e7780ca1681cd095dbd81fe264feff75c988f7
"global" cmd literal sharing vs. per-interp resolvers |
| User & Date: | gustafn2 on 2016-07-25 09:34:45 |
Changes
- icomment:
The attached patch resolver866-2 implements the alternative approach pointed out in the last paragraph of the bug-description. This alternative patch addresses the global literal sharing problem by introducing unshared literals. The first approach inserted a cmd literal to the global literal pool and used TclHideLiteral() to turn a shared literal into a private literal when necessary. In this 2nd approach, cmd literals which are resolved via custom name resolver are NOT shared at all (i.e. not inserted to the global per-interp literal pool) by allowing to create unshared literals by the literal infrastructure. To ease the handling of cmd resolvers, the patch introduces two new flags: CMD_VIA_RESOLVER and LITERAL_UNSHARED to make such cases more explicit and easier to maintain. - New flag CMD_VIA_RESOLVER for "struct Command": When this flag is set, the command was resolved via a custom resolver. - New flag LITERAL_UNSHARED for TclRegisterNewLiteral(): When the flag is set the literal should not be shared. As a consequence, there might exist local literals, which are not part of the global (per-interpreter) literal pool (which entails a modification in TclVerifyLocalLiteralTable()) This patch addresses as well part of 3418547 (testcase resolver-1.4). The testcases of 3418547 are a little problematic: By trying to be as little invasive as possible the cmd resolver change the literal "z" only when called from a proc named "x". However, during byte-code compilations of a proc body, the calling proc is not available, therefore Tcl_FindCommand() returns for the same "z" different as result as in other invocation contexts. This unstable result contributes may be as well to the need for TclInvalidateCmdLiteral() in the test cases. Results for resolver.test for cmd literal test cases when TclInvalidateCmdLiteral() is deactivated: OK: resolver-1.4, resolver-3.1a, resolver-3.1b, resolver-3.1c NOT OK: resolver-1.1, 1.2, 1.3, 1.5, 1.6 With this patch, all test-cases from the head version of nsf work fine, also when TclInvalidateCmdLiteral() is deactivated. - login: "gustafn2"
- mimetype: "text/plain"