@@ -38,8 +38,8 @@ var detrand = (function() {
3838 } ;
3939} ) ( ) ;
4040
41- // Bysyncify integration.
42- var Bysyncify = {
41+ // Asyncify integration.
42+ var Asyncify = {
4343 sleeping : false ,
4444 sleepingFunction : null ,
4545 sleeps : 0 ,
@@ -55,43 +55,43 @@ var Bysyncify = {
5555 if ( typeof imports [ module ] [ i ] === 'function' ) {
5656 ( function ( module , i ) {
5757 ret [ module ] [ i ] = function ( ) {
58- if ( ! Bysyncify . sleeping ) {
59- // Sleep if bysyncify support is present, and at a certain
58+ if ( ! Asyncify . sleeping ) {
59+ // Sleep if asyncify support is present, and at a certain
6060 // probability.
61- if ( exports . bysyncify_start_unwind &&
61+ if ( exports . asyncify_start_unwind &&
6262 detrand ( ) < 0.5 ) {
6363 // We are called in order to start a sleep/unwind.
64- console . log ( 'bysyncify : sleep in ' + i + '...' ) ;
65- Bysyncify . sleepingFunction = i ;
66- Bysyncify . sleeps ++ ;
64+ console . log ( 'asyncify : sleep in ' + i + '...' ) ;
65+ Asyncify . sleepingFunction = i ;
66+ Asyncify . sleeps ++ ;
6767 var depth = new Error ( ) . stack . split ( '\n' ) . length - 6 ;
68- Bysyncify . maxDepth = Math . max ( Bysyncify . maxDepth , depth ) ;
68+ Asyncify . maxDepth = Math . max ( Asyncify . maxDepth , depth ) ;
6969 // Save the memory we use for data, so after we restore it later, the
7070 // sleep/resume appears to have had no change to memory.
71- Bysyncify . savedMemory = new Int32Array ( view . subarray ( Bysyncify . DATA_ADDR >> 2 , Bysyncify . DATA_MAX >> 2 ) ) ;
71+ Asyncify . savedMemory = new Int32Array ( view . subarray ( Asyncify . DATA_ADDR >> 2 , Asyncify . DATA_MAX >> 2 ) ) ;
7272 // Unwinding.
7373 // Fill in the data structure. The first value has the stack location,
7474 // which for simplicity we can start right after the data structure itself.
75- view [ Bysyncify . DATA_ADDR >> 2 ] = Bysyncify . DATA_ADDR + 8 ;
75+ view [ Asyncify . DATA_ADDR >> 2 ] = Asyncify . DATA_ADDR + 8 ;
7676 // The end of the stack will not be reached here anyhow.
77- view [ Bysyncify . DATA_ADDR + 4 >> 2 ] = Bysyncify . DATA_MAX ;
78- exports . bysyncify_start_unwind ( Bysyncify . DATA_ADDR ) ;
79- Bysyncify . sleeping = true ;
77+ view [ Asyncify . DATA_ADDR + 4 >> 2 ] = Asyncify . DATA_MAX ;
78+ exports . asyncify_start_unwind ( Asyncify . DATA_ADDR ) ;
79+ Asyncify . sleeping = true ;
8080 } else {
8181 // Don't sleep, normal execution.
8282 return imports [ module ] [ i ] . apply ( null , arguments ) ;
8383 }
8484 } else {
8585 // We are called as part of a resume/rewind. Stop sleeping.
86- console . log ( 'bysyncify : resume in ' + i + '...' ) ;
87- assert ( Bysyncify . sleepingFunction === i ) ;
88- exports . bysyncify_stop_rewind ( ) ;
86+ console . log ( 'asyncify : resume in ' + i + '...' ) ;
87+ assert ( Asyncify . sleepingFunction === i ) ;
88+ exports . asyncify_stop_rewind ( ) ;
8989 // The stack should have been all used up, and so returned to the original state.
90- assert ( view [ Bysyncify . DATA_ADDR >> 2 ] == Bysyncify . DATA_ADDR + 8 ) ;
91- assert ( view [ Bysyncify . DATA_ADDR + 4 >> 2 ] == Bysyncify . DATA_MAX ) ;
92- Bysyncify . sleeping = false ;
90+ assert ( view [ Asyncify . DATA_ADDR >> 2 ] == Asyncify . DATA_ADDR + 8 ) ;
91+ assert ( view [ Asyncify . DATA_ADDR + 4 >> 2 ] == Asyncify . DATA_MAX ) ;
92+ Asyncify . sleeping = false ;
9393 // Restore the memory to the state from before we slept.
94- view . set ( Bysyncify . savedMemory , Bysyncify . DATA_ADDR >> 2 ) ;
94+ view . set ( Asyncify . savedMemory , Asyncify . DATA_ADDR >> 2 ) ;
9595 return imports [ module ] [ i ] . apply ( null , arguments ) ;
9696 }
9797 } ;
@@ -101,27 +101,27 @@ var Bysyncify = {
101101 }
102102 }
103103 }
104- // Add ignored.print, which is ignored by bysyncify , and allows debugging of bysyncified code.
104+ // Add ignored.print, which is ignored by asyncify , and allows debugging of asyncified code.
105105 ret [ 'ignored' ] = { 'print' : function ( x , y ) { console . log ( x , y ) } } ;
106106 return ret ;
107107 } ,
108108 instrumentExports : function ( exports ) {
109109 var ret = { } ;
110110 for ( var e in exports ) {
111111 if ( typeof exports [ e ] === 'function' &&
112- ! e . startsWith ( 'bysyncify_ ' ) ) {
112+ ! e . startsWith ( 'asyncify_ ' ) ) {
113113 ( function ( e ) {
114114 ret [ e ] = function ( ) {
115115 while ( 1 ) {
116116 var ret = exports [ e ] . apply ( null , arguments ) ;
117117 // If we are sleeping, then the stack was unwound; rewind it.
118- if ( Bysyncify . sleeping ) {
119- console . log ( 'bysyncify : stop unwind; rewind' ) ;
118+ if ( Asyncify . sleeping ) {
119+ console . log ( 'asyncify : stop unwind; rewind' ) ;
120120 assert ( ! ret , 'results during sleep are meaningless, just 0' ) ;
121- //console.log('bysyncify : after unwind', view[Bysyncify .DATA_ADDR >> 2], view[Bysyncify .DATA_ADDR + 4 >> 2]);
121+ //console.log('asyncify : after unwind', view[Asyncify .DATA_ADDR >> 2], view[Asyncify .DATA_ADDR + 4 >> 2]);
122122 try {
123- exports . bysyncify_stop_unwind ( ) ;
124- exports . bysyncify_start_rewind ( Bysyncify . DATA_ADDR ) ;
123+ exports . asyncify_stop_unwind ( ) ;
124+ exports . asyncify_start_rewind ( Asyncify . DATA_ADDR ) ;
125125 } catch ( e ) {
126126 console . log ( 'error in unwind/rewind switch' , e ) ;
127127 }
@@ -138,11 +138,11 @@ var Bysyncify = {
138138 return ret ;
139139 } ,
140140 check : function ( ) {
141- assert ( ! Bysyncify . sleeping ) ;
141+ assert ( ! Asyncify . sleeping ) ;
142142 } ,
143143 finish : function ( ) {
144- if ( Bysyncify . sleeps > 0 ) {
145- print ( 'bysyncify :' , 'sleeps:' , Bysyncify . sleeps , 'max depth:' , Bysyncify . maxDepth ) ;
144+ if ( Asyncify . sleeps > 0 ) {
145+ print ( 'asyncify :' , 'sleeps:' , Asyncify . sleeps , 'max depth:' , Asyncify . maxDepth ) ;
146146 }
147147 } ,
148148} ;
@@ -170,14 +170,14 @@ var imports = {
170170 } ,
171171} ;
172172
173- imports = Bysyncify . instrumentImports ( imports ) ;
173+ imports = Asyncify . instrumentImports ( imports ) ;
174174
175175// Create the wasm.
176176var instance = new WebAssembly . Instance ( new WebAssembly . Module ( binary ) , imports ) ;
177177
178178// Handle the exports.
179179var exports = instance . exports ;
180- exports = Bysyncify . instrumentExports ( exports ) ;
180+ exports = Asyncify . instrumentExports ( exports ) ;
181181if ( exports . memory ) {
182182 var view = new Int32Array ( exports . memory . buffer ) ;
183183}
@@ -190,10 +190,10 @@ for (var e in exports) {
190190sortedExports . sort ( ) ;
191191sortedExports = sortedExports . filter ( function ( e ) {
192192 // Filter special intrinsic functions.
193- return ! e . startsWith ( 'bysyncify_ ' ) ;
193+ return ! e . startsWith ( 'asyncify_ ' ) ;
194194} ) ;
195195sortedExports . forEach ( function ( e ) {
196- Bysyncify . check ( ) ;
196+ Asyncify . check ( ) ;
197197 if ( typeof exports [ e ] !== 'function' ) return ;
198198 try {
199199 console . log ( '[fuzz-exec] calling $' + e ) ;
@@ -207,5 +207,5 @@ sortedExports.forEach(function(e) {
207207} ) ;
208208
209209// Finish up
210- Bysyncify . finish ( ) ;
210+ Asyncify . finish ( ) ;
211211
0 commit comments