Skip to content

Commit f776e58

Browse files
committed
[js] Migrate _STable to $$STable
1 parent 74c31e2 commit f776e58

21 files changed

+242
-242
lines changed

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/BOOT.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* exports.Array is actually set in bootstrap.js */
22

33
module.exports.createArray = function(array) {
4-
return exports.Array._STable.REPR.allocateFromArray(exports.Array._STable, array);
4+
return exports.Array.$$STable.REPR.allocateFromArray(exports.Array.$$STable, array);
55
};
66

77
module.exports.createIntArray = function(array) {
8-
return exports.IntArray._STable.REPR.allocateFromArray(exports.IntArray._STable, array);
8+
return exports.IntArray.$$STable.REPR.allocateFromArray(exports.IntArray.$$STable, array);
99
};

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ function intishBool(b) {
2222
}
2323

2424
function makeNum(type, num) {
25-
const instance = type._STable.REPR.allocate(type._STable);
25+
const instance = type.$$STable.REPR.allocate(type.$$STable);
2626
instance.$$setNum(num);
2727
return instance;
2828
}
2929

3030
function makeBI(type, num) {
31-
const instance = type._STable.REPR.allocate(type._STable);
31+
const instance = type.$$STable.REPR.allocate(type.$$STable);
3232
instance.$$setBignum(num);
3333
return instance;
3434
}

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

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ globalContext.initialize(context => context.scs['__6MODEL_CORE__'] = core);
2626

2727
function addToScWithSt(obj) {
2828
core.rootObjects.push(obj);
29-
core.rootSTables.push(obj._STable);
29+
core.rootSTables.push(obj.$$STable);
3030
obj._SC = core;
31-
obj._STable._SC = core;
31+
obj.$$STable._SC = core;
3232
}
3333

3434
/* Creates and installs the KnowHOWAttribute type. */
3535
function createKnowHOWAttribute() {
36-
const metaObj = KnowHowHOW._STable.REPR.allocate(KnowHowHOW._STable);
36+
const metaObj = KnowHowHOW.$$STable.REPR.allocate(KnowHowHOW.$$STable);
3737

3838
const r = new reprs.KnowHOWAttribute();
3939
const typeObj = r.typeObjectFor(metaObj);
@@ -43,19 +43,19 @@ function createKnowHOWAttribute() {
4343
return new NQPStr(self.__name);
4444
};
4545
methods['new'] = function(ctx, _NAMED, self) {
46-
const attr = r.allocate(self._STable);
46+
const attr = r.allocate(self.$$STable);
4747
attr.__name = _NAMED.name.$$getStr();
4848
attr.__type = _NAMED.type;
4949
attr.__boxTarget = _NAMED.box_target ? _NAMED.box_target.$$getInt() : 0;
5050
return attr;
5151
};
5252

53-
typeObj._STable.methodCache = new Map();
54-
typeObj._STable.modeFlags = constants.METHOD_CACHE_AUTHORITATIVE;
53+
typeObj.$$STable.methodCache = new Map();
54+
typeObj.$$STable.modeFlags = constants.METHOD_CACHE_AUTHORITATIVE;
5555

5656
for (const method of Object.keys(methods)) {
57-
typeObj._STable.ObjConstructor.prototype[method] = methods[method];
58-
typeObj._STable.methodCache.set(method, wrapMethod(method, methods[method]));
57+
typeObj.$$STable.ObjConstructor.prototype[method] = methods[method];
58+
typeObj.$$STable.methodCache.set(method, wrapMethod(method, methods[method]));
5959
}
6060

6161
return typeObj;
@@ -74,12 +74,12 @@ KnowHowHOW.__name = 'KnowHOW';
7474

7575
addToScWithSt(KnowHowHOW);
7676

77-
KnowHOW._STable.HOW = KnowHowHOW;
77+
KnowHOW.$$STable.HOW = KnowHowHOW;
7878

79-
KnowHOW._STable.methodCache = new Map();
80-
KnowHOW._STable.modeFlags = constants.METHOD_CACHE_AUTHORITATIVE;
81-
KnowHowHOW._STable.methodCache = new Map();
82-
KnowHowHOW._STable.modeFlags = constants.METHOD_CACHE_AUTHORITATIVE;
79+
KnowHOW.$$STable.methodCache = new Map();
80+
KnowHOW.$$STable.modeFlags = constants.METHOD_CACHE_AUTHORITATIVE;
81+
KnowHowHOW.$$STable.methodCache = new Map();
82+
KnowHowHOW.$$STable.modeFlags = constants.METHOD_CACHE_AUTHORITATIVE;
8383

8484
function wrapMethod(name, method) {
8585
const codeRef = new CodeRef(name, undefined);
@@ -89,12 +89,12 @@ function wrapMethod(name, method) {
8989
function addKnowhowHowMethod(name, method) {
9090
/* TODO - think if setting the object cache would be better */
9191

92-
KnowHowHOW._STable.ObjConstructor.prototype[name] = method;
93-
KnowHOW._STable.ObjConstructor.prototype[name] = method;
92+
KnowHowHOW.$$STable.ObjConstructor.prototype[name] = method;
93+
KnowHOW.$$STable.ObjConstructor.prototype[name] = method;
9494

9595
const wrapped = wrapMethod(name, method);
96-
KnowHOW._STable.methodCache.set(name, wrapped);
97-
KnowHowHOW._STable.methodCache.set(name, wrapped);
96+
KnowHOW.$$STable.methodCache.set(name, wrapped);
97+
KnowHowHOW.$$STable.methodCache.set(name, wrapped);
9898
}
9999

100100
addKnowhowHowMethod('name', function(ctx, _NAMED, self) {
@@ -111,7 +111,7 @@ addKnowhowHowMethod('methods', function(ctx, _NAMED, self) {
111111

112112
addKnowhowHowMethod('new_type', function(ctx, _NAMED, self) {
113113
/* We first create a new HOW instance. */
114-
const HOW = self._STable.REPR.allocate(self._STable);
114+
const HOW = self.$$STable.REPR.allocate(self.$$STable);
115115

116116
/* See if we have a representation name; if not default to P6opaque. */
117117
const reprName = (_NAMED && _NAMED.repr) ? _NAMED.repr.$$getStr() : 'P6opaque';
@@ -129,7 +129,7 @@ addKnowhowHowMethod('new_type', function(ctx, _NAMED, self) {
129129
}
130130

131131
/* Set .WHO to an empty hash. */
132-
typeObject._STable.WHO = new Hash();
132+
typeObject.$$STable.WHO = new Hash();
133133

134134
return typeObject;
135135
});
@@ -144,12 +144,12 @@ addKnowhowHowMethod('add_method', function(ctx, _NAMED, self, type, name, code)
144144

145145
addKnowhowHowMethod('compose', function(ctx, _NAMED, self, typeObject) {
146146
/* Set method cache */
147-
typeObject._STable.setMethodCache(self.__methods.content);
148-
typeObject._STable.modeFlags = constants.METHOD_CACHE_AUTHORITATIVE;
147+
typeObject.$$STable.setMethodCache(self.__methods.content);
148+
typeObject.$$STable.modeFlags = constants.METHOD_CACHE_AUTHORITATIVE;
149149

150150
/* Set type check cache. */
151151

152-
typeObject._STable.typeCheckCache = [typeObject];
152+
typeObject.$$STable.typeCheckCache = [typeObject];
153153

154154
/* Use any attribute information to produce attribute protocol
155155
* data. The protocol consists of an array... */
@@ -188,7 +188,7 @@ addKnowhowHowMethod('compose', function(ctx, _NAMED, self, typeObject) {
188188

189189

190190
/* Compose the representation using it. */
191-
typeObject._STable.REPR.compose(typeObject._STable, reprInfoHash);
191+
typeObject.$$STable.REPR.compose(typeObject.$$STable, reprInfoHash);
192192

193193
return typeInfo;
194194
});
@@ -205,7 +205,7 @@ module.exports.knowhowattr = KnowHOWAttribute;
205205
addToScWithSt(KnowHOWAttribute);
206206

207207
function bootType(typeName, reprName) {
208-
const metaObj = KnowHowHOW._STable.REPR.allocate(KnowHowHOW._STable);
208+
const metaObj = KnowHowHOW.$$STable.REPR.allocate(KnowHowHOW.$$STable);
209209
metaObj.__name = typeName;
210210

211211
const typeObj = (new reprs[reprName]).typeObjectFor(metaObj);
@@ -220,15 +220,15 @@ function bootType(typeName, reprName) {
220220

221221
function bootArray(type) {
222222
const array = bootType('BOOTArray', 'VMArray');
223-
array._STable.REPR.type = Null;
224-
array._STable.REPR.primType = type;
225-
array._STable.REPR.setupSTableWhenComposed(array._STable);
226-
array._STable.setboolspec(8, Null);
223+
array.$$STable.REPR.type = Null;
224+
array.$$STable.REPR.primType = type;
225+
array.$$STable.REPR.setupSTableWhenComposed(array.$$STable);
226+
array.$$STable.setboolspec(8, Null);
227227
return array;
228228
}
229229

230230
BOOT.Array = bootArray(0);
231-
BOOT.Array._STable.hllRole = 4;
231+
BOOT.Array.$$STable.hllRole = 4;
232232

233233
BOOT.IntArray = bootArray(1);
234234
BOOT.NumArray = bootArray(2);

src/vm/js/nqp-runtime/container-specs.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ class NativeRef {
131131
// HACK - nqp still uses NQPInt instead of the thing in the hll config
132132
return new NQPInt(this.get());
133133
} else {
134-
const repr = type._STable.REPR;
135-
const obj = repr.allocate(type._STable);
134+
const repr = type.$$STable.REPR;
135+
const obj = repr.allocate(type.$$STable);
136136
obj.$$setInt(this.get());
137137
return obj;
138138
}
@@ -183,8 +183,8 @@ class NativeRef {
183183
// HACK - nqp still uses raw javascript numbers instead of the thing in the hll config
184184
return this.get();
185185
} else {
186-
const repr = type._STable.REPR;
187-
const obj = repr.allocate(type._STable);
186+
const repr = type.$$STable.REPR;
187+
const obj = repr.allocate(type.$$STable);
188188
obj.$$setNum(this.get());
189189
return obj;
190190
}
@@ -239,8 +239,8 @@ class NativeRef {
239239
// HACK - nqp still uses raw javascript strings instead of the thing in the hll config
240240
return this.get();
241241
} else {
242-
const repr = type._STable.REPR;
243-
const obj = repr.allocate(type._STable);
242+
const repr = type.$$STable.REPR;
243+
const obj = repr.allocate(type.$$STable);
244244
obj.$$setStr(this.get());
245245
return obj;
246246
}
@@ -296,8 +296,8 @@ class NativeRef {
296296

297297
const type = hll.get('int_box');
298298

299-
const repr = type._STable.REPR;
300-
const obj = repr.allocate(type._STable);
299+
const repr = type.$$STable.REPR;
300+
const obj = repr.allocate(type.$$STable);
301301
obj.$$setInt64(this.get());
302302
return obj;
303303
}

0 commit comments

Comments
 (0)