Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  unroll1.js

  Sprache: JAVA
 

// |jit-test| test-also=--setpref=wasm_unroll_loops=true

// Loop unrolling test: 2 exiting values, 1 exit target => can be unrolled.

let t = `
(module
  (func (export "f1") (param $limit i32) (result i32)
    (local $x i32)
    (local $y i32)
    (local.set $x (i32.const 1))
    (local.set $y (i32.const 1000))
    (loop $cont
       ;; x = x + 1
       (local.set $x (i32.add (local.get $x) (i32.const 1)))
       ;; y = y - 7
       (local.set $y (i32.sub (local.get $x) (i32.const 7)))
       ;;
       (br_if $cont (i32.lt_u (local.get $x) (local.get $limit)))
    )
    (i32.mul (local.get $x) (local.get $y))
  )
)`;

let i = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(t)));

// Run the loop some varying number of times, with the aim of exiting it at
// each copy of the loop, so as to check that the post-loop values of `x` and
// `y` are correct, regardless of which copy of the original loop exited.

assertEq(i.exports.f1(100), 9300);
assertEq(i.exports.f1(101), 9494);
assertEq(i.exports.f1(102), 9690);
assertEq(i.exports.f1(103), 9888);
assertEq(i.exports.f1(104), 10088);
assertEq(i.exports.f1(105), 10290);
assertEq(i.exports.f1(106), 10494);
assertEq(i.exports.f1(107), 10700);
assertEq(i.exports.f1(108), 10908);
assertEq(i.exports.f1(109), 11118);

Messung V0.5 in Prozent
C=93 H=96 G=94

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-08-26) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002