git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit cbaa5108c37a1044ce3682079c2e0dd7cb939698

Merge pull request #3 from dfinity/small-fixes

more small fixes
wanderer authored on 3/7/2018, 10:10:00 PM
GitHub committed on 3/7/2018, 10:10:00 PM
Parent: 888b8752d6766cfe61cb86689a349d3d493661c6
Parent: 3293a87f5f8d4e902258609eb8f0c213b7c38192

Files changed

index.jschanged
injectGlobals.jschanged
systemObjects.jschanged
index.jsView
@@ -100,11 +100,15 @@
100100 * @returns {Promise}
101101 */
102102 createStateRoot () {
103103 return new Promise((resolve, reject) => {
104- this.scheduler.on('idle', () => {
104+ if (!this.scheduler._running) {
105105 this.tree.flush().then(resolve)
106- })
106+ } else {
107+ this.scheduler.on('idle', () => {
108+ this.tree.flush().then(resolve)
109+ })
110+ }
107111 })
108112 }
109113
110114 /**
injectGlobals.jsView
@@ -1,21 +1,21 @@
11 const {findSections} = require('wasm-json-toolkit')
2-const wantedSections = ['type', 'import', 'function', 'export', 'code']
32
43 module.exports = function injectGlobals (json, globals) {
4+ const wantedSections = ['type', 'import', 'function', 'export', 'code']
55 const iter = findSections(json, wantedSections)
6- const {value: type} = iter.next()
6+ const {value: type = {entries: []}} = iter.next()
77 const getterType = type.entries.push(typeEntry()) - 1
88 const setterType = type.entries.push(typeEntry(Array(globals.length).fill('i32'))) - 1
99
1010 const {value: imports = {entries: []}} = iter.next()
11- const {value: func} = iter.next()
11+ const {value: func = {entries: []}} = iter.next()
1212 const getterIndex = func.entries.push(getterType) - 1 + imports.entries.length
1313 const setterIndex = func.entries.push(setterType) - 1 + imports.entries.length
14- const {value: exports} = iter.next()
14+ const {value: exports = {entries: []}} = iter.next()
1515 exports.entries.push(exportEntry('getter_globals', getterIndex))
1616 exports.entries.push(exportEntry('setter_globals', setterIndex))
17- const {value: code} = iter.next()
17+ const {value: code = {entries: []}} = iter.next()
1818 const getterCode = []
1919 const setterCode = []
2020 globals.forEach((global, index) => {
2121 const globalIndex = global.index
systemObjects.jsView
@@ -16,14 +16,14 @@
1616 func: new cbor.Tagged(TAGS.func, 0)
1717 }
1818
1919 class FunctionRef {
20- constructor (privateFunc, identifier, params, id) {
20+ constructor (privateFunc, identifier, params, id, gas=0) {
2121 this.private = privateFunc
2222 this.identifier = identifier
2323 this.destId = id
2424 this.params = params
25- this.gas = 0
25+ this.gas = gas
2626 }
2727
2828 encodeCBOR (gen) {
2929 return gen.write(new cbor.Tagged(TAGS.func, [

Built with git-ssb-web