Skip to content

Commit cb5eeaa

Browse files
committed
[js] Rename _SC to $$SC
1 parent f776e58 commit cb5eeaa

File tree

10 files changed

+81
-81
lines changed

10 files changed

+81
-81
lines changed

src/vm/js/Compiler.nqp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,7 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
22492249
my str $attr := $self.expr ~ '.attr$' ~ $hint;
22502250
if $*BINDVAL {
22512251
my $bindval := self.as_js_clear_bindval($*BINDVAL, :want($type));
2252-
Chunk.new($type, $bindval.expr, [$self, $bindval, "$attr = {$bindval.expr};\n", "if ({$self.expr}._SC !== undefined) {$self.expr}.\$\$scwb();\n"]);
2252+
Chunk.new($type, $bindval.expr, [$self, $bindval, "$attr = {$bindval.expr};\n", "if ({$self.expr}.\$\$SC !== undefined) {$self.expr}.\$\$scwb();\n"]);
22532253
}
22542254
else {
22552255
Chunk.new($type, $attr, $self);

src/vm/js/Operations.nqp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,10 +1583,10 @@ class QAST::OperationsJS {
15831583
%ops<die_s> := %ops<die>;
15841584

15851585

1586-
add_simple_op('how', $T_OBJ, [$T_OBJ], sub ($obj) {"$obj.$$STable.HOW"}, :decont(0));
1587-
add_simple_op('how_nd', $T_OBJ, [$T_OBJ], sub ($obj) {"$obj.$$STable.HOW"});
1588-
add_simple_op('who', $T_OBJ, [$T_OBJ], sub ($obj) {"$obj.$$STable.WHO"}, :decont(0));
1589-
add_simple_op('setwho', $T_OBJ, [$T_OBJ, $T_OBJ], sub ($obj, $who) {"($obj.$$STable.WHO = $who, $obj)"}, :side_effects, :decont(0));
1586+
add_simple_op('how', $T_OBJ, [$T_OBJ], sub ($obj) {"$obj.\$\$STable.HOW"}, :decont(0));
1587+
add_simple_op('how_nd', $T_OBJ, [$T_OBJ], sub ($obj) {"$obj.\$\$STable.HOW"});
1588+
add_simple_op('who', $T_OBJ, [$T_OBJ], sub ($obj) {"$obj.\$\$STable.WHO"}, :decont(0));
1589+
add_simple_op('setwho', $T_OBJ, [$T_OBJ, $T_OBJ], sub ($obj, $who) {"($obj.\$\$STable.WHO = $who, $obj)"}, :side_effects, :decont(0));
15901590

15911591
# TODO decont second argument
15921592
add_simple_op('rebless', $T_OBJ, [$T_OBJ, $T_OBJ], :side_effects, :decont(0, 1));
@@ -1603,8 +1603,8 @@ class QAST::OperationsJS {
16031603

16041604
# HACK
16051605
# TODO think what we should return on 1.WHAT and "foo".WHAT
1606-
add_simple_op('what', $T_OBJ, [$T_OBJ], sub ($obj) {"($obj.$$STable ? $obj.$$STable.WHAT : nqp.Null)"}, :decont(0));
1607-
add_simple_op('what_nd', $T_OBJ, [$T_OBJ], sub ($obj) {"($obj.$$STable ? $obj.$$STable.WHAT : nqp.Null)"});
1606+
add_simple_op('what', $T_OBJ, [$T_OBJ], sub ($obj) {"($obj.\$\$STable ? $obj.\$\$STable.WHAT : nqp.Null)"}, :decont(0));
1607+
add_simple_op('what_nd', $T_OBJ, [$T_OBJ], sub ($obj) {"($obj.\$\$STable ? $obj.\$\$STable.WHAT : nqp.Null)"});
16081608

16091609
add_simple_op('knowhowattr', $T_OBJ, [], sub () {"nqp.knowhowattr"});
16101610
add_simple_op('knowhow', $T_OBJ, [], sub () {"nqp.knowhow"});

src/vm/js/nqp-runtime/bootstrap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ globalContext.initialize(context => context.scs['__6MODEL_CORE__'] = core);
2727
function addToScWithSt(obj) {
2828
core.rootObjects.push(obj);
2929
core.rootSTables.push(obj.$$STable);
30-
obj._SC = core;
31-
obj.$$STable._SC = core;
30+
obj.$$SC = core;
31+
obj.$$STable.$$SC = core;
3232
}
3333

3434
/* Creates and installs the KnowHOWAttribute type. */
@@ -211,7 +211,7 @@ function bootType(typeName, reprName) {
211211
const typeObj = (new reprs[reprName]).typeObjectFor(metaObj);
212212

213213
core.rootObjects.push(metaObj);
214-
metaObj._SC = core;
214+
metaObj.$$SC = core;
215215

216216
addToScWithSt(typeObj);
217217

src/vm/js/nqp-runtime/core.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ op.getcodeobj = function(codeRef) {
377377

378378
op.settypecache = function(obj, cache) {
379379
obj.$$STable.typeCheckCache = cache.array;
380-
if (obj.$$STable._SC !== undefined) obj.$$STable.scwb();
380+
if (obj.$$STable.$$SC !== undefined) obj.$$STable.scwb();
381381
return obj;
382382
};
383383

@@ -392,7 +392,7 @@ op.setmethcache = function(obj, cache) {
392392
console.log('we expect a hash here');
393393
}
394394
obj.$$STable.setMethodCache(cache.content);
395-
if (obj.$$STable._SC !== undefined) obj.$$STable.scwb();
395+
if (obj.$$STable.$$SC !== undefined) obj.$$STable.scwb();
396396
return obj;
397397
};
398398

@@ -402,7 +402,7 @@ op.setmethcacheauth = function(obj, isAuth) {
402402
} else {
403403
obj.$$STable.modeFlags &= ~constants.METHOD_CACHE_AUTHORITATIVE;
404404
}
405-
if (obj.$$STable._SC !== undefined) obj.$$STable.scwb();
405+
if (obj.$$STable.$$SC !== undefined) obj.$$STable.scwb();
406406
return obj;
407407
};
408408

@@ -455,7 +455,7 @@ op.setcodename = function(code, name) {
455455

456456
op.rebless = function(obj, newType) {
457457
obj.$$STable.REPR.changeType(obj, newType);
458-
if (obj._SC !== undefined) obj.$$scwb();
458+
if (obj.$$SC !== undefined) obj.$$scwb();
459459
return obj;
460460
};
461461

src/vm/js/nqp-runtime/deserialization.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ op.deserialize = function(currentHLL, blob, sc, sh, codeRefs, conflicts, cuids,
5454

5555
for (let i = 0; i < sc.codeRefs.length; i++) {
5656
sc.codeRefs[i].isStatic = true;
57-
sc.codeRefs[i]._SC = sc;
57+
sc.codeRefs[i].$$SC = sc;
5858
sc.rootCodes.push(sc.codeRefs[i]);
5959
}
6060

@@ -163,7 +163,7 @@ class BinaryCursor {
163163
}
164164
const bootArray = BOOT.createArray(array);
165165
if (this.sc.currentObject) {
166-
bootArray._SC = this.sc;
166+
bootArray.$$SC = this.sc;
167167
this.sc.ownedObjects.set(bootArray, this.sc.currentObject);
168168
}
169169
return bootArray;
@@ -249,7 +249,7 @@ class BinaryCursor {
249249
}
250250

251251
if (this.sc.currentObject) {
252-
hash._SC = this.sc;
252+
hash.$$SC = this.sc;
253253
this.sc.ownedObjects.set(hash, this.sc.currentObject);
254254
}
255255

@@ -615,7 +615,7 @@ class BinaryCursor {
615615
if (closures[i].codeObj) sc.codeRefs[closuresBase + i].codeObj = closures[i].codeObj;
616616
closures[i].index = closuresBase + i;
617617

618-
closures[i]._SC = sc;
618+
closures[i].$$SC = sc;
619619
sc.rootCodes.push(closures[i]);
620620
}
621621

@@ -716,7 +716,7 @@ class BinaryCursor {
716716
REPR.name = repr;
717717
const HOW = null; /* We will fill that in later once objects are stubbed */
718718
this.sc.rootSTables[i] = new sixmodel.STable(REPR, HOW);
719-
this.sc.rootSTables[i]._SC = this.sc;
719+
this.sc.rootSTables[i].$$SC = this.sc;
720720
}
721721
}
722722
}
@@ -742,7 +742,7 @@ class BinaryCursor {
742742
this.sc.rootObjects[i] = objects[i].isConcrete ?
743743
new (STableForObj.ObjConstructor)() :
744744
STableForObj.createTypeObject();
745-
this.sc.rootObjects[i]._SC = this.sc;
745+
this.sc.rootObjects[i].$$SC = this.sc;
746746
}
747747
}
748748
}
@@ -769,12 +769,12 @@ class BinaryCursor {
769769
const origSTable = this.sc.deps[entry.origSC].rootSTables[entry.origIndex];
770770
this.sc.rootSTables[entry.index] = origSTable;
771771

772-
if (origSTable._SC != this.sc.deps[entry.origSC]) {
772+
if (origSTable.$$SC != this.sc.deps[entry.origSC]) {
773773
throw new NQPException('STable conflict detected during deserialization.\n'
774774
+ '(Probable attempt to load a mutated module or modules that cannot be loaded together).');
775775
}
776776

777-
origSTable._SC = this.sc;
777+
origSTable.$$SC = this.sc;
778778
}
779779
}
780780
}
@@ -783,14 +783,14 @@ class BinaryCursor {
783783
for (const entry of repossessed) {
784784
if (entry.type === 0) {
785785
const origObj = this.sc.deps[entry.origSC].rootObjects[entry.origIndex];
786-
if (origObj._SC !== this.sc.deps[entry.origSC]) {
786+
if (origObj.$$SC !== this.sc.deps[entry.origSC]) {
787787
const backup = origObj.$$typeObject ? origObj.$$STable.createTypeObject() : origObj.$$clone();
788788
conflicts.$$push(backup);
789789
conflicts.$$push(origObj);
790790
}
791791

792792
this.sc.rootObjects[entry.index] = origObj;
793-
origObj._SC = this.sc;
793+
origObj.$$SC = this.sc;
794794

795795
const STableForObj =
796796
this.sc.deps[objects[entry.index].STable[0]].rootSTables[objects[entry.index].STable[1]];

src/vm/js/nqp-runtime/hash.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ const sixmodel = require('./sixmodel.js');
1010
class Hash extends NQPObject {
1111
constructor() {
1212
super();
13-
this._SC = undefined;
13+
this.$$SC = undefined;
1414
this.content = new Map();
1515
}
1616

1717
$$bindkey(key, value) {
1818
this.content.set(key, value);
19-
if (this._SC !== undefined) this.$$scwb();
19+
if (this.$$SC !== undefined) this.$$scwb();
2020
return value;
2121
}
2222

@@ -29,7 +29,7 @@ class Hash extends NQPObject {
2929
}
3030

3131
$$deletekey(key) {
32-
if (this._SC !== undefined) this.$$scwb();
32+
if (this.$$SC !== undefined) this.$$scwb();
3333
this.content.delete(key);
3434
return this;
3535
}

src/vm/js/nqp-runtime/reprs.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class REPR {
129129
ObjConstructor.prototype = Object.create(new Proxy({}, handler));
130130
ObjConstructor.prototype.$$STable = STable;
131131

132-
ObjConstructor.prototype._SC = undefined;
132+
ObjConstructor.prototype.$$SC = undefined;
133133
ObjConstructor.prototype._WHERE = undefined;
134134

135135
return ObjConstructor;
@@ -183,7 +183,7 @@ class REPRWithAttributes extends REPR {
183183

184184
generateUniversalAccessor(STable, name, action, extraSig, scwb, actionDescription) {
185185
let code = 'function(classHandle, attrName' + extraSig + ') {\n' +
186-
(scwb ? 'if (this._SC !== undefined) this.$$scwb();\n' : '') +
186+
(scwb ? 'if (this.$$SC !== undefined) this.$$scwb();\n' : '') +
187187
'switch (classHandle) {\n';
188188
let classKeyIndex = 0;
189189
let setup = '';
@@ -541,7 +541,7 @@ class P6opaque extends REPRWithAttributes {
541541

542542
STable.compileAccessor('$$bindattr$' + slot, 'function(value) {\n' +
543543
'this.' + attr + ' = value;\n' +
544-
'if (this._SC !== undefined) this.$$scwb();\n' +
544+
'if (this.$$SC !== undefined) this.$$scwb();\n' +
545545
'return value;\n' +
546546
'}\n');
547547

@@ -1223,12 +1223,12 @@ class VMArray extends REPR {
12231223
}
12241224

12251225
$$bindpos(index, value) {
1226-
if (this._SC !== undefined) this.$$scwb();
1226+
if (this.$$SC !== undefined) this.$$scwb();
12271227
return this.array[index < 0 ? this.array.length + index : index] = value;
12281228
}
12291229

12301230
$$push(value) {
1231-
if (this._SC !== undefined) this.$$scwb();
1231+
if (this.$$SC !== undefined) this.$$scwb();
12321232
this.array.push(value);
12331233
return value;
12341234
}
@@ -1284,7 +1284,7 @@ class VMArray extends REPR {
12841284
}
12851285

12861286
$$push_i(value) {
1287-
if (this._SC !== undefined) this.$$scwb();
1287+
if (this.$$SC !== undefined) this.$$scwb();
12881288
this.array.push(this.$$mangle(value));
12891289
return value;
12901290
}
@@ -1296,7 +1296,7 @@ class VMArray extends REPR {
12961296
}
12971297

12981298
$$bindpos_i(index, value) {
1299-
if (this._SC !== undefined) this.$$scwb();
1299+
if (this.$$SC !== undefined) this.$$scwb();
13001300
this.array[index < 0 ? this.array.length + index : index] = this.$$mangle(value);
13011301
return value;
13021302
}
@@ -1335,12 +1335,12 @@ class VMArray extends REPR {
13351335
}
13361336

13371337
$$bindpos_n(index, value) {
1338-
if (this._SC !== undefined) this.$$scwb();
1338+
if (this.$$SC !== undefined) this.$$scwb();
13391339
return this.array[index < 0 ? this.array.length + index : index] = value;
13401340
}
13411341

13421342
$$push_n(value) {
1343-
if (this._SC !== undefined) this.$$scwb();
1343+
if (this.$$SC !== undefined) this.$$scwb();
13441344
this.array.push(value);
13451345
return value;
13461346
}
@@ -1379,12 +1379,12 @@ class VMArray extends REPR {
13791379
}
13801380

13811381
$$bindpos_s(index, value) {
1382-
if (this._SC !== undefined) this.$$scwb();
1382+
if (this.$$SC !== undefined) this.$$scwb();
13831383
return this.array[index < 0 ? this.array.length + index : index] = value;
13841384
}
13851385

13861386
$$push_s(value) {
1387-
if (this._SC !== undefined) this.$$scwb();
1387+
if (this.$$SC !== undefined) this.$$scwb();
13881388
this.array.push(value);
13891389
return value;
13901390
}
@@ -1525,7 +1525,7 @@ class VMHash extends REPR {
15251525

15261526
$$bindkey(key, value) {
15271527
this.content.set(key, value);
1528-
if (this._SC !== undefined) this.$$scwb();
1528+
if (this.$$SC !== undefined) this.$$scwb();
15291529
return value;
15301530
}
15311531

@@ -1538,7 +1538,7 @@ class VMHash extends REPR {
15381538
}
15391539

15401540
$$deletekey(key) {
1541-
if (this._SC !== undefined) this.$$scwb();
1541+
if (this.$$SC !== undefined) this.$$scwb();
15421542
this.content.delete(key);
15431543
return this;
15441544
}
@@ -2505,7 +2505,7 @@ class WrappedJSObject extends REPR {
25052505
ObjConstructor.prototype = Object.create(new Proxy({}, handler));
25062506
ObjConstructor.prototype.$$STable = STable;
25072507

2508-
ObjConstructor.prototype._SC = undefined;
2508+
ObjConstructor.prototype.$$SC = undefined;
25092509
ObjConstructor.prototype._WHERE = undefined;
25102510

25112511
return ObjConstructor;

src/vm/js/nqp-runtime/serialization-context.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class SerializationContext extends NQPObject {
4545

4646
setObj(idx, obj) {
4747
this.rootObjects[idx] = obj;
48-
if (!obj.$$STable._SC) {
48+
if (!obj.$$STable.$$SC) {
4949
this.rootSTables.push(obj.$$STable);
50-
obj.$$STable._SC = this;
50+
obj.$$STable.$$SC = this;
5151
}
5252
}
5353

@@ -60,19 +60,19 @@ class SerializationContext extends NQPObject {
6060
this.rootSTables.push(STable);
6161

6262
this.repIndexes.push((newSlot << 1) | 1);
63-
this.repScs.push(STable._SC);
63+
this.repScs.push(STable.$$SC);
6464

65-
STable._SC = this;
65+
STable.$$SC = this;
6666
}
6767

6868
repossessObject(obj) {
6969
const newSlot = this.rootObjects.length;
7070
this.rootObjects.push(obj);
7171

7272
this.repIndexes.push((newSlot << 1));
73-
this.repScs.push(obj._SC);
73+
this.repScs.push(obj.$$SC);
7474

75-
obj._SC = this;
75+
obj.$$SC = this;
7676
}
7777

7878
$$toBool(ctx) {

0 commit comments

Comments
 (0)