Stephen Compall wrote:
> I was getting instvar indexing conflicts (different classes would choose
> instvar 0 for different instvars) in Compiler until the attached tiny
> patch to STSymbolTable>>#declareEnvironment:. Iterating from the other
> end of the inheritance tree seems to be what is intended by the readOnly
> calculation semantics, anyway.
Applied the patch, and reworked the readOnly stuff to be correct. See
the equivalent snippet of libgst/sym.c, where if the method is trusted
all variables are read-write (in is_instance_variable_read_only).
@@ -157,18 +157,19 @@ addPool: poolDictionary
declareEnvironment: aBehavior
- | i readOnly |
+ | i canAlwaysStore inSandbox |
environment := aBehavior.
+ inSandbox := thisContext isUntrusted.
i := -1.
- readOnly := aBehavior isUntrusted not and: [ thisContext isUntrusted ].
- aBehavior withAllSuperclassesDo: [ :class |
- readOnly := readOnly and: [ class isUntrusted not ].
+ canAlwaysStore := aBehavior isUntrusted.
+ aBehavior withAllSuperclasses reverseDo: [ :class |
+ canAlwaysStore := canAlwaysStore and: [ class isUntrusted ].
class instVarNames do: [ :iv |
instVars at: iv asSymbol put: (STVariable
id: (i := i + 1)
scope: 0
- canStore: readOnly not).
+ canStore: (canAlwaysStore or: [ inSandbox not ])).
].
].
self declareGlobals
Paolo
_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk