UNPKG

@powerlang/egg-js

Version:

A Smalltalk VM that runs on top of JavaScript

1,046 lines (902 loc) 26.3 kB
import EggBehaviorObject from './EggBehaviorObject.js'; import EggByteObject from './EggByteObject.js'; import EggExecutableCode from './EggExecutableCode.js'; import EggObjectHeader from './EggObjectHeader.js'; import EggRuntime from './EggRuntime.js'; import EggSlotObject from './EggSlotObject.js'; import EggSmallInteger from './EggSmallInteger.js'; import SCompiledBlockFlags from './SCompiledBlockFlags.js'; import SCompiledMethodFlags from './SCompiledMethodFlags.js'; let EggMetacircularRuntime = class extends EggRuntime { constructor() { super(); this._kernel = nil; this._wordSize = nil; this._bootstrapper = nil; this._behaviorNextIndex = nil; this._behaviorMethodDictionaryIndex = nil; this._behaviorClassIndex = nil; this._classNameIndex = nil; this._methodFlagsIndex = nil; this._symbolTable = nil; this._maxSMI = nil; this._minSMI = nil; this._knownSymbols = nil; this._arrayClass = nil; this._metaclassClass = nil; this._speciesInstanceBehaviorIndex = nil; this._speciesFormatIndex = nil; this._methodTreecodesIndex = nil; this._methodInstSize = nil; this._methodClassBindingIndex = nil; this._speciesSuperclassIndex = nil; this._methodClass = nil; this._smallIntegerClass = nil; this._blockClass = nil; this._speciesIvarsIndex = nil; this._dictionaryTableIndex = nil; this._metaclassInstanceClassIndex = nil; this._classModuleIndex = nil; this._moduleNamespaceIndex = nil; this._byteArrayClass = nil; this._stringClass = nil; this._closureBlockIndex = nil; this._closureClass = nil; this._lastHash = nil; this._blockMethodIndex = nil; this._behaviorClass = nil; this._classNamespacesIndex = nil; this._largePositiveIntegerClass = nil; this._largeNegativeIntegerClass = nil; this._methodSelectorIndex = nil; this._compiledCodeExecutableCodeIndex = nil; this._floatClass = nil; this._processStackSPIndex = nil; this._ffiMethodClass = nil; } addSymbol_(aSymbol) { let string; string = this.newString_(aSymbol.asString()); return this.sendLocal_to_("asSymbol", string); } arrayClass_(anLMRObject) { this._arrayClass = anLMRObject; return this; } arrayedSizeOf_(anLMRObject) { let species, ivars; if (anLMRObject.isImmediate()) { return 0 } ; species = this.speciesFor_(anLMRObject); ivars = this.speciesInstanceSize_(species); return (anLMRObject.size()-ivars); } associationValue_(association) { return association.slotAt_(2); } behaviorClass_(anLMRObject) { return anLMRObject.slotAt_(this._behaviorClassIndex); } behaviorClassIndex_(anInteger) { this._behaviorClassIndex = anInteger; return this; } behaviorClass__(anLMRObject) { this._behaviorClass = anLMRObject; return this; } behaviorMethodDictionary_(anLMRObject) { return anLMRObject.slotAt_(this._behaviorMethodDictionaryIndex); } behaviorMethodDictionaryIndex_(anInteger) { this._behaviorMethodDictionaryIndex = anInteger; return this; } behaviorNext_(anLMRObject) { return anLMRObject.slotAt_(this._behaviorNextIndex); } behaviorNextIndex_(anInteger) { this._behaviorNextIndex = anInteger; return this; } behaviorOf_(anLMRObject) { let _retval; if (anLMRObject.isImmediate()) { _retval = this.smallIntegerBehavior() } else { _retval = anLMRObject.behavior() } ; return _retval; } blockArgumentCount_(anLMRObject) { let flags; flags = anLMRObject.slotAt_(this._methodFlagsIndex); return ((flags.value()) & 0x3F); } blockCapturesHome_(block) { let flags; flags = block.slotAt_(this._methodFlagsIndex); return flags.value().anyMask_(BlockCapturesHome); } blockCapturesSelf_(block) { let flags; flags = block.slotAt_(this._methodFlagsIndex); return flags.value().anyMask_(BlockCapturesSelf); } blockClass_(anLMRObject) { this._blockClass = anLMRObject; return this; } blockEnvironmentCount_(anLMRObject) { let flags; flags = anLMRObject.slotAt_(this._methodFlagsIndex); return ((flags.value() >> 24) & 0x7F); } blockExecutableCode_(anLMRObject) { return this.methodExecutableCode_(anLMRObject); } blockExecutableCode_put_(anLMRObject, anObject) { return this.methodExecutableCode_put_(anLMRObject, anObject); } blockExecutionTree_(anLMRObject) { return anLMRObject.slotAt_(this._compiledCodeExecutableCodeIndex); } blockMethod_(anLMRObject) { return anLMRObject.slotAt_(this._blockMethodIndex); } blockMethodIndex_(anInteger) { this._blockMethodIndex = anInteger; return this; } blockTempCount_(anLMRObject) { let flags; flags = anLMRObject.slotAt_(this._methodFlagsIndex); return ((flags.value() >> 6) & 0xFF); } bootstrapper() { return this._bootstrapper; } bootstrapper_(aBootstrapper) { this._bootstrapper = aBootstrapper; return this; } byteArrayClass_(anLMRObject) { this._byteArrayClass = anLMRObject; return this; } classIvars_(anLMRObject) { return anLMRObject.slotAt_(this._speciesIvarsIndex); } classModule_(_class) { return _class.slotAt_(this._classModuleIndex); } classModuleIndex_(anInteger) { this._classModuleIndex = anInteger; return this; } className_(anLMRObject) { return anLMRObject.slotAt_(this._classNameIndex); } classNameIndex_(anInteger) { this._classNameIndex = anInteger; return this; } classNamespacesIndex_(anInteger) { this._classNamespacesIndex = anInteger; return this; } closureBlock_(closure) { return closure.slotAt_(this._closureBlockIndex); } closureBlockIndex_(anInteger) { this._closureBlockIndex = anInteger; return this; } closureClass_(anLMRObject) { this._closureClass = anLMRObject; return this; } closureHome_(closure) { let block, _retval; block = this.closureBlock_(closure); if (!this.blockCapturesHome_(block)) { this.error_("closure has no home") } ; if (this.blockCapturesSelf_(block)) { _retval = closure.at_(2) } else { _retval = closure.at_(1) } ; return _retval; } dictionaryTable_(anLMRObject) { return anLMRObject.slotAt_(this._dictionaryTableIndex); } dictionaryTableIndex_(anInteger) { this._dictionaryTableIndex = anInteger; return this; } doLookup_startingAt_(aSymbol, aBehavior) { let behavior, m; const _home = {}; try { behavior = aBehavior; (() => { m = this.methodFor_in_(aSymbol, behavior); if (nil !== m) { throw [_home, m] } ; behavior = this.behaviorNext_(behavior); return behavior._notEqual(this._nilObj) }).whileTrue(); return nil; } catch(e) { if (e[0] == _home) return e[1]; else throw(e); } } doesNotUnderstandMethod_(anEggObject) { this._doesNotUnderstandMethod = anEggObject; return this; } executableCodeWork_(anEggExecutableCode) { this.ASSERT_(anEggExecutableCode._notEqualEqual(this._nilObj)); return anEggExecutableCode.code(); } extensionMethodModule_(anLMRObject) { let association; association = anLMRObject.slotAt_(anLMRObject.size()); return this.associationValue_(association); } ffiMethodClass() { return this._ffiMethodClass; } ffiMethodClass_(anEggObject) { this._ffiMethodClass = anEggObject; return this; } fixOverrides() { let selector, md; this._overrides.keysAndValuesDo_((assoc, method) => { selector = assoc.value(); md = this.behaviorMethodDictionary_(assoc.key()); return this.sendLocal_to_with_("at:put:", md, [selector, method]) }); return this; } floatClass_(anLMRObject) { this._floatClass = anLMRObject; return this; } hashFor_(anLMRObject) { let shifted, hash, current; if (anLMRObject.isImmediate()) { return anLMRObject.value() } ; current = anLMRObject.headerHash(); if (current._notEqual(0)) { return current } ; shifted = this._lastHash.bitShift_(-1); if (this._lastHash.bitAnd_(1)._equal(0)) { hash = shifted } else { hash = shifted.bitXor_(47560) } ; anLMRObject.headerHash_(hash); return this._lastHash = hash; } initialize() { this._lastHash = 1; super.initialize(); return this; } integerFrom_(anLMRObject) { let behavior, _class, _retval; if (anLMRObject.isImmediate()) { return anLMRObject.value() } ; behavior = this.behaviorOf_(anLMRObject); _class = this.behaviorClass_(behavior); if (_class._equalEqual(this._largePositiveIntegerClass)) { _retval = anLMRObject.bytes().asLittleEndianPositiveInteger() } else { _retval = anLMRObject.bytes().asLittleEndianNegativeInteger() } ; return _retval; } isBlock_(compiledCode) { return this.behaviorClass_(compiledCode.behavior())._equalEqual(this._blockClass); } isExecutableCode_(code) { return code.class()._equalEqual(EggExecutableCode); } isMetaclass_(anLMRObject) { return this.speciesFor_(anLMRObject)._equalEqual(this._metaclassClass); } kernel() { return this._kernel; } kernel_(anLMRObject) { this._kernel = anLMRObject; return this; } knownSymbols_(associations) { this._knownSymbols = Map.withAll_(associations); return this; } largeNegativeIntegerClass_(anLMRObject) { this._largeNegativeIntegerClass = anLMRObject; return this; } largePositiveIntegerClass_(anLMRObject) { this._largePositiveIntegerClass = anLMRObject; return this; } loadAssociationValue_(association) { return association.slotAt_(2); } loadModule_(symbol) { return this._bootstrapper.loadModule_(symbol.asLocalString()); } localMethodTreecodes_(method) { return this.methodTreecodes_(method).bytes(); } lookupAssociationFor_in_(aSymbol, dictionary) { let table, assoc, key, _retval; const _home = {}; try { table = this.dictionaryTable_(dictionary); (2).to_do_(table.size(), (index) => { assoc = table.slotAt_(index); _retval = nil; if (!assoc._equalEqual(this._nilObj)) { key = assoc.slotAt_(1); _retval = nil; if (key._equalEqual(aSymbol)) { throw [_home, assoc] } ; _retval = _retval } ; return _retval }); return nil; } catch(e) { if (e[0] == _home) return e[1]; else throw(e); } } metaclassClass_(anLMRObject) { this._metaclassClass = anLMRObject; return this; } metaclassInstanceClass_(anLMRObject) { return anLMRObject.slotAt_(this._metaclassInstanceClassIndex); } metaclassInstanceClassIndex_(anInteger) { this._metaclassInstanceClassIndex = anInteger; return this; } method_literalAt_(method, index) { return method.slotAt_((this._methodInstSize+index)); } methodArgumentCount_(anLMRObject) { let flags; flags = anLMRObject.slotAt_(this._methodFlagsIndex); return ((flags.value()) & 0x3F); } methodClass_(anLMRObject) { this._methodClass = anLMRObject; return this; } methodClassBinding_(anLMRObject) { return anLMRObject.slotAt_(this._methodClassBindingIndex); } methodClassBindingIndex_(anInteger) { this._methodClassBindingIndex = anInteger; return this; } methodEnvironmentSize_(anLMRObject) { let flags; flags = anLMRObject.slotAt_(this._methodFlagsIndex); return ((flags.value() >> 25) & 0x3F); } methodExecutableCode_(anLMRObject) { return anLMRObject.slotAt_(this._compiledCodeExecutableCodeIndex); } methodExecutableCode_put_(anLMRObject, anObject) { return anLMRObject.slotAt_put_(this._compiledCodeExecutableCodeIndex, anObject); } methodExecutableCodeIndex_(anInteger) { this._compiledCodeExecutableCodeIndex = anInteger; return this; } methodFlagsIndex_(anInteger) { this._methodFlagsIndex = anInteger; return this; } methodFor_in_(aSymbol, behavior) { let md, table, _retval; const _home = {}; try { this._overrides.at_ifPresent_(behavior._arrow(aSymbol), (m) => { throw [_home, m] }); md = this.behaviorMethodDictionary_(behavior); table = this.dictionaryTable_(md); (2).to_by_do_(table.size(), 2, (index) => { _retval = nil; if (table.slotAt_(index)._equalEqual(aSymbol)) { throw [_home, table.slotAt_((index+1))] } ; return _retval }); return nil; } catch(e) { if (e[0] == _home) return e[1]; else throw(e); } } methodInstSize_(anInteger) { this._methodInstSize = anInteger; return this; } methodIsCallout_(method) { return this.speciesFor_(method)._equalEqual(this._ffiMethodClass); } methodIsExtension_(anLMRObject) { let flags; flags = anLMRObject.slotAt_(this._methodFlagsIndex); return flags.value().anyMask_(IsExtension); } methodNeedsEnvironment_(anLMRObject) { let flags; flags = anLMRObject.slotAt_(this._methodFlagsIndex); return flags.value().bitAnd_(HasEnvironment)._equal(HasEnvironment); } methodSelector_(anLMRObject) { return anLMRObject.slotAt_(this._methodSelectorIndex); } methodSelectorIndex_(anInteger) { this._methodSelectorIndex = anInteger; return this; } methodTempCount_(anLMRObject) { let flags; flags = anLMRObject.slotAt_(this._methodFlagsIndex); return ((flags.value() >> 13) & 0xFF); } methodTreecodes_(anLMRObject) { return anLMRObject.slotAt_(this._methodTreecodesIndex); } methodTreecodesIndex_(anInteger) { this._methodTreecodesIndex = anInteger; return this; } moduleNamespace_(anLMRObject) { return anLMRObject.slotAt_(this._moduleNamespaceIndex); } moduleNamespaceIndex_(anInteger) { this._moduleNamespaceIndex = anInteger; return this; } nativizeForLMR() { let script; script = "nativizeForLMR\r\tlmr := Kernel loadModule: 'Nativization/LMR'. \r\tlmr nativizeLoadedModules"; _cascade(this, (_recv) => { _recv.compile_in_(script, "UndefinedObject"); return _recv.sendLocal_to_("nativizeForLMR", this._nilObj);}); return this; } newArray_(anArray) { let result; result = this.newArraySized_(anArray.size()); anArray.withIndexDo_((elem, i) => { return result.at_put_(i, elem) }); return result; } newArraySized_(anInteger) { let behavior, header; behavior = this.speciesInstanceBehavior_(this._arrayClass); header = _cascade(EggObjectHeader.new(), (_recv) => { _recv.behavior_(behavior); _recv.bytes_arrayed_named_(false, true, false); _recv.size_(anInteger); return _recv.hash_(0);}); return EggSlotObject.new().header_(header); } newByteArray_(aByteArray) { let behavior, header; behavior = this.speciesInstanceBehavior_(this._byteArrayClass); header = _cascade(EggObjectHeader.new(), (_recv) => { _recv.behavior_(behavior); _recv.bytes_arrayed_named_(true, true, false); _recv.size_(aByteArray.size()); return _recv.hash_(0);}); return _cascade(EggByteObject.new(), (_recv) => { _recv.header_(header); return _recv.bytes_(aByteArray);}); } newBytes_size_(species, anInteger) { let behavior, header; behavior = this.speciesInstanceBehavior_(species); header = _cascade(EggObjectHeader.new(), (_recv) => { _recv.behavior_(behavior); _recv.bytes_arrayed_named_(true, true, false); _recv.size_(anInteger); return _recv.hash_(0);}); return _cascade(EggByteObject.new(), (_recv) => { _recv.header_(header); return _recv.bytes_(Array.newBytes_(anInteger));}); } newBytesOf_sized_(species, size) { return this.newBytes_size_(species, size); } newCharacter_(aCharacter) { let value; value = this.newInteger_(aCharacter.asInteger()); return this.sendLocal_to_("asCharacter", value); } newClosureFor_(compiledBlock) { let size, closure; size = this.blockEnvironmentCount_(compiledBlock); closure = this.newSlots_size_(this._closureClass, size); closure.slotAt_put_(this._closureBlockIndex, compiledBlock); return closure; } newCompiledMethod() { let behavior, header, method; behavior = this.speciesInstanceBehavior_(this._methodClass); header = _cascade(EggObjectHeader.new(), (_recv) => { _recv.behavior_(behavior); _recv.bytes_arrayed_named_(false, true, false); _recv.size_(this._methodInstSize); return _recv.hash_(0);}); method = EggSlotObject.new().header_(header); method.slotAt_put_(this._methodFlagsIndex, this.newInteger_(0)); return method; } newEnvironmentSized_(anInteger) { return this.newArraySized_(anInteger); } newExecutableCodeFor_(anObject) { let behavior, header; behavior = this.speciesInstanceBehavior_(this._arrayClass); header = _cascade(EggObjectHeader.new(), (_recv) => { _recv.behavior_(behavior); _recv.bytes_arrayed_named_(false, true, false); _recv.size_(0); return _recv.hash_(0);}); return _cascade(EggExecutableCode.new(), (_recv) => { _recv.header_(header); return _recv.code_(anObject);}); } newFloat_(aFloat) { let behavior, header; behavior = this.speciesInstanceBehavior_(this._floatClass); header = _cascade(EggObjectHeader.new(), (_recv) => { _recv.behavior_(behavior); _recv.bytes_arrayed_named_(true, true, false); _recv.size_(8); return _recv.hash_(0);}); return _cascade(EggByteObject.new(), (_recv) => { _recv.header_(header); return _recv.bytes_(aFloat.pointerDouble());}); } newInteger_(anInteger) { if (anInteger._greaterThan(this._maxSMI)) { return this.newLargePositiveInteger_(anInteger) } ; if (anInteger._lessThan(this._minSMI)) { return this.newLargeNegativeInteger_(anInteger) } ; return EggSmallInteger.new().value_(anInteger); } newLargeNegativeInteger_(anInteger) { let size, bytes, result; size = anInteger.bytesCount().alignedTo_(2).max_(this._wordSize); if (anInteger.byteAt_(size)._greaterThan(128)) { size = (size+2) } ; bytes = anInteger.asEggByteArrayOfSize_(size); result = this.newBytes_size_(this._largeNegativeIntegerClass, bytes.size()); return result.bytes_(bytes); } newLargePositiveInteger_(anInteger) { let size, bytes, result; size = anInteger.bytesCount().alignedTo_(2).max_(this._wordSize); bytes = anInteger.asEggByteArrayOfSize_(size); result = this.newBytes_size_(this._largePositiveIntegerClass, bytes.size()); return result.bytes_(bytes); } newOf_sized_(aSpecies, anInteger) { let _retval; if (this.speciesIsBytes_(aSpecies)) { _retval = this.newBytes_size_(aSpecies, anInteger) } else { _retval = this.newSlots_size_(aSpecies, anInteger) } ; return _retval; } newSlots_(_class) { return this.newSlots_size_(_class, 0); } newSlots_size_(_class, anInteger) { let ivars, behavior, header, result; ivars = this.speciesInstanceSize_(_class); behavior = this.speciesInstanceBehavior_(_class); header = _cascade(EggObjectHeader.new(), (_recv) => { _recv.behavior_(behavior); _recv.bytes_arrayed_named_(false, anInteger._greaterThan(0), ivars._greaterThan(0)); _recv.size_((ivars+anInteger)); return _recv.hash_(0);}); if (_class._equalEqual(this._behaviorClass)) { result = EggBehaviorObject.new().runtime_(this) } else { result = EggSlotObject.new() } ; return _cascade(result, (_recv) => { _recv.header_(header); return _recv.nilSlots_(this._nilObj);}); } newSlotsOf_(_class) { return this.newSlots_size_(_class, 0); } newSmallInteger_(anInteger) { return EggSmallInteger.new().value_(anInteger); } newString_(aString) { let behavior, header, bytes; behavior = this.speciesInstanceBehavior_(this._stringClass); bytes = aString.asByteArray().copyWith_(0); header = _cascade(EggObjectHeader.new(), (_recv) => { _recv.behavior_(behavior); _recv.bytes_arrayed_named_(true, true, false); _recv.size_(bytes.size()); return _recv.hash_(0);}); return _cascade(EggByteObject.new(), (_recv) => { _recv.header_(header); return _recv.bytes_(bytes);}); } nil_true_false_(n, t, f) { this._nilObj = n; this._trueObj = t; this._falseObj = f; return this; } override_with_(assoc, method) { this._overrides.at_put_(assoc, method); return this; } processStackSP_(anLMRObject) { return anLMRObject.slotAt_(this._processStackSPIndex); } processStackSPIndex_(anInteger) { this._processStackSPIndex = anInteger; return this; } readFile_(filename) { return this._bootstrapper.readFile_(filename.asLocalString()); } readKernel() { let script; script = "readKernel\r\t| reader |\r\treader := Kernel loadModule: 'ImageSegment/Reader'. \r\tsegment := reader read: 'build/Kernel.ims'.\r\t^segment"; _cascade(this, (_recv) => { _recv.compile_in_(script, "UndefinedObject"); return _recv.sendLocal_to_("readKernel", this._nilObj);}); return this; } removeOverride_(assoc) { let species, selector; species = assoc.key(); selector = assoc.value(); this._overrides.removeKey_(species._arrow(selector)); this._methodCache.removeKey_ifAbsent_(selector._arrow(species), nil); this._symbolCache.at_ifPresent_(selector, (messages) => { return messages.do_("flushCache") }); return this; } smallIntegerBehavior() { return this.speciesInstanceBehavior_(this._smallIntegerClass); } smallIntegerClass_(anLMRObject) { this._smallIntegerClass = anLMRObject; return this; } speciesFor_(anEggObject) { let behavior; behavior = this.behaviorOf_(anEggObject); return this.behaviorClass_(behavior); } speciesFormatIndex_(anInteger) { this._speciesFormatIndex = anInteger; return this; } speciesInstanceBehavior_(anLMRObject) { return anLMRObject.slotAt_(this._speciesInstanceBehaviorIndex); } speciesInstanceBehaviorIndex_(anInteger) { this._speciesInstanceBehaviorIndex = anInteger; return this; } speciesInstanceClass_(anLMRObject) { let metaclass, _retval; metaclass = this.isMetaclass_(anLMRObject); if (metaclass) { _retval = this.metaclassInstanceClass_(anLMRObject) } else { _retval = anLMRObject } ; return _retval; } speciesInstanceSize_(anLMRObject) { return anLMRObject.slotAt_(this._speciesFormatIndex).value().bitAnd_(127); } speciesIsBytes_(anLMRObject) { return anLMRObject.slotAt_(this._speciesFormatIndex).value().noMask_(16384); } speciesIvarsIndex_(anInteger) { this._speciesIvarsIndex = anInteger; return this; } speciesLocalName_(species) { let name, _class; if (!this.isMetaclass_(species)) { name = this.className_(species); return name.asLocalString() } ; _class = this.metaclassInstanceClass_(species); name = this.className_(_class); return name.asLocalString()._comma(" class"); } speciesModule_(species) { let _class; if (!this.isMetaclass_(species)) { return this.classModule_(species) } ; _class = this.metaclassInstanceClass_(species); return this.classModule_(_class); } speciesNamespaces_(anLMRObject) { let _class; _class = this.speciesInstanceClass_(anLMRObject); return _class.slotAt_(this._classNamespacesIndex); } speciesSuperclass_(anLMRObject) { return anLMRObject.slotAt_(this._speciesSuperclassIndex); } speciesSuperclassIndex_(anInteger) { this._speciesSuperclassIndex = anInteger; return this; } staticBindingForIvar_in_(aSymbol, receiver) { let _class, all, slots, bytes, _retval; const _home = {}; try { _class = this.speciesFor_(receiver); all = Array.new_(0); (() => { return _class._notEqual(this._nilObj) }).whileTrue_(() => { slots = this.classIvars_(_class); if (!slots._equalEqual(this._nilObj)) { all = slots.slots()._comma(all) } ; return _class = this.speciesSuperclass_(_class) }); bytes = aSymbol.bytes(); all.withIndexDo_((ivar, index) => { _retval = nil; if (ivar.bytes()._equal(bytes)) { throw [_home, index] } ; return _retval }); return 0; } catch(e) { if (e[0] == _home) return e[1]; else throw(e); } } storeAssociation_value_(association, anObject) { association.slotAt_put_(2, anObject); return this; } stringClass_(anLMRObject) { this._stringClass = anLMRObject; return this; } superBehaviorOf_(_class) { let superclass; superclass = this.speciesSuperclass_(_class); return this.speciesInstanceBehavior_(superclass); } symbolFromLocal_(aSymbol) { let bytes, table, symbol, _retval; const _home = {}; try { this._knownSymbols.at_ifPresent_(aSymbol, (s) => { throw [_home, s] }); bytes = aSymbol.asByteArray()._comma([0]); table = this._symbolTable.slotAt_(2); (2).to_do_(table.size(), (i) => { symbol = table.slotAt_(i); _retval = nil; if (!symbol._equalEqual(this._nilObj)) { _retval = nil; if (symbol.bytes()._equal(bytes)) { throw [_home, symbol] } ; _retval = _retval } ; return _retval }); this.error_("symbol not found"); return this; } catch(e) { if (e[0] == _home) return e[1]; else throw(e); } } symbolTable_(anLMRObject) { this._symbolTable = anLMRObject; return this; } wordSize() { return this._wordSize; } wordSize_(anInteger) { this._wordSize = anInteger; this._maxSMI = ((1).bitShift_(((this._wordSize*8)-2))-1); this._minSMI = (this._maxSMI.negated()-1); return this; } writeKernelAt_(anInteger) { let script; script = ("writeKernel\r\t| writer |\r\twriter := Kernel loadModule: 'ImageSegment/Writer'. \r\twriter write: Kernel at: ")._comma(anInteger.asString())._comma(" to: 'build/Kernel.ims'"); _cascade(this, (_recv) => { _recv.compile_in_(script, "UndefinedObject"); return _recv.sendLocal_to_("writeKernel", this._nilObj);}); return this; } } export default EggMetacircularRuntime