aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--cmake/Platform/Emscripten.cmake2
-rwxr-xr-xemcc2
-rw-r--r--src/analyzer.js12
-rw-r--r--src/compiler.js2
-rw-r--r--src/library_gl.js42
-rw-r--r--src/library_sdl.js1
-rw-r--r--src/relooper/Relooper.cpp48
-rw-r--r--src/relooper/Relooper.h34
-rw-r--r--src/relooper/fuzzer.py6
-rw-r--r--src/relooper/test.cpp28
-rw-r--r--src/relooper/test.txt377
-rw-r--r--src/relooper/test2.txt40
-rw-r--r--src/relooper/test3.txt82
-rw-r--r--src/relooper/test4.txt52
-rw-r--r--src/relooper/test5.txt104
-rw-r--r--src/relooper/test6.txt38
-rw-r--r--src/relooper/test_dead.txt2
-rw-r--r--src/relooper/test_debug.txt62
-rw-r--r--src/relooper/test_fuzz1.txt100
-rw-r--r--src/relooper/test_fuzz2.txt42
-rw-r--r--src/relooper/test_fuzz3.txt36
-rw-r--r--src/relooper/test_fuzz4.txt56
-rw-r--r--src/relooper/test_fuzz5.txt122
-rw-r--r--src/relooper/test_fuzz6.txt358
-rw-r--r--src/relooper/test_inf.txt1606
-rwxr-xr-xsrc/relooper/testit.sh30
-rw-r--r--tests/cases/longjmp_tiny_invoke_phi.ll46
-rw-r--r--tests/cases/longjmp_tiny_invoke_phi.txt4
-rw-r--r--tests/test_core.py2
-rw-r--r--tests/test_other.py2
-rw-r--r--tools/js-optimizer.js11
-rw-r--r--tools/shared.py4
33 files changed, 1787 insertions, 1567 deletions
diff --git a/AUTHORS b/AUTHORS
index d71eea47..6cf860ab 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -113,3 +113,4 @@ a license to everyone to use it as detailed in LICENSE.)
* Heidi Pan <heidi.pan@intel.com> (copyright owned by Intel)
* Vasilis Kalintiris <ehostunreach@gmail.com>
* Adam C. Clifton <adam@hulkamaniac.com>
+* Volo Zyko <volo.zyko@gmail.com>
diff --git a/cmake/Platform/Emscripten.cmake b/cmake/Platform/Emscripten.cmake
index c30632ca..ef813eb8 100644
--- a/cmake/Platform/Emscripten.cmake
+++ b/cmake/Platform/Emscripten.cmake
@@ -109,6 +109,8 @@ set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@")
# Specify the program to use when building static libraries. Force Emscripten-related command line options to clang.
set(CMAKE_CXX_ARCHIVE_CREATE "${CMAKE_AR} rc <TARGET> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <OBJECTS>${CMAKE_END_TEMP_FILE}")
set(CMAKE_C_ARCHIVE_CREATE "${CMAKE_AR} rc <TARGET> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <OBJECTS>${CMAKE_END_TEMP_FILE}")
+set(CMAKE_CXX_ARCHIVE_APPEND "${CMAKE_AR} r <TARGET> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <OBJECTS>${CMAKE_END_TEMP_FILE}")
+set(CMAKE_C_ARCHIVE_APPEND "${CMAKE_AR} r <TARGET> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <OBJECTS>${CMAKE_END_TEMP_FILE}")
# Set a global EMSCRIPTEN variable that can be used in client CMakeLists.txt to detect when building using Emscripten.
# There seems to be some kind of bug with CMake, so you might need to define this manually on the command line with "-DEMSCRIPTEN=1".
diff --git a/emcc b/emcc
index 8f98c3cd..baa20969 100755
--- a/emcc
+++ b/emcc
@@ -1079,7 +1079,7 @@ try:
if not arg.startswith('-'):
if not os.path.exists(arg):
- logging.error(arg + ': No such file or directory')
+ logging.error('%s: No such file or directory ("%s" was expected to be an input file, based on the commandline arguments provided)' % (arg, arg))
exit(1)
arg_ending = filename_type_ending(arg)
diff --git a/src/analyzer.js b/src/analyzer.js
index 17582ea3..e8ca6cf6 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -1570,7 +1570,17 @@ function analyzer(data, sidePass) {
for (var j = 0; j < label.lines.length; j++) {
var line = label.lines[j];
if ((line.intertype == 'call' || line.intertype == 'invoke') && line.ident == setjmp) {
- // Add a new label
+ if (line.intertype == 'invoke') {
+ // setjmp cannot trigger unwinding, so just reduce the invoke to a call + branch
+ line.intertype = 'call';
+ label.lines.push({
+ intertype: 'branch',
+ label: line.toLabel,
+ lineNum: line.lineNum + 0.01, // XXX legalizing might confuse this
+ });
+ line.toLabel = line.unwindLabel = -2;
+ }
+ // split this label into up to the setjmp (including), then a new label for the rest. longjmp will reach the rest
var oldLabel = label.ident;
var newLabel = func.labelIdCounter++;
if (!func.setjmpTable) func.setjmpTable = [];
diff --git a/src/compiler.js b/src/compiler.js
index 7d768c3d..e4ce1c88 100644
--- a/src/compiler.js
+++ b/src/compiler.js
@@ -134,7 +134,7 @@ load('settings.js');
var settings_file = arguments_[0];
var ll_file = arguments_[1];
phase = arguments_[2];
-if (phase == 'pre') {
+if (phase == 'pre' || phase == 'glue') {
additionalLibraries = Array.prototype.slice.call(arguments_, 3);
} else {
var forwardedDataFile = arguments_[3];
diff --git a/src/library_gl.js b/src/library_gl.js
index 29f78c8a..efe3b868 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -547,6 +547,9 @@ var LibraryGL = {
Module.ctx.getExtension('WEBKIT_EXT_texture_filter_anisotropic');
GL.floatExt = Module.ctx.getExtension('OES_texture_float');
+
+ // Extension available from Firefox 26 and Google Chrome 30
+ GL.instancedArraysExt = Module.ctx.getExtension('ANGLE_instanced_arrays');
// These are the 'safe' feature-enabling extensions that don't add any performance impact related to e.g. debugging, and
// should be enabled by default so that client GLES2/GL code will not need to go through extra hoops to get its stuff working.
@@ -4959,6 +4962,45 @@ var LibraryGL = {
return Module.ctx.getError();
}
},
+
+ // ANGLE_instanced_arrays WebGL extension related functions
+
+ glVertexAttribDivisor__sig: 'vii',
+ glVertexAttribDivisor: function(index, divisor) {
+#if GL_ASSERTIONS
+ assert(GL.instancedArraysExt, 'Must have ANGLE_instanced_arrays extension to use WebGL instancing');
+#endif
+ GL.instancedArraysExt.vertexAttribDivisorANGLE(index, divisor);
+ },
+
+ glDrawArraysInstanced_sig: 'viiii',
+ glDrawArraysInstanced: function(mode, first, count, primcount) {
+#if GL_ASSERTIONS
+ assert(GL.instancedArraysExt, 'Must have ANGLE_instanced_arrays extension to use WebGL instancing');
+#endif
+ GL.instancedArraysExt.drawArraysInstancedANGLE(mode, first, count, primcount);
+ },
+
+ glDrawElementsInstanced_sig: 'viiiii',
+ glDrawElementsInstanced: function(mode, count, type, indices, primcount) {
+#if GL_ASSERTIONS
+ assert(GL.instancedArraysExt, 'Must have ANGLE_instanced_arrays extension to use WebGL instancing');
+#endif
+ GL.instancedArraysExt.drawElementsInstancedANGLE(mode, count, type, indices, primcount);
+ },
+
+ // OpenGL Desktop/ES 2.0 instancing extensions compatibility
+
+ glVertexAttribDivisorNV: 'glVertexAttribDivisor',
+ glDrawArraysInstancedNV: 'glDrawArraysInstanced',
+ glDrawElementsInstancedNV: 'glDrawElementsInstanced',
+ glVertexAttribDivisorEXT: 'glVertexAttribDivisor',
+ glDrawArraysInstancedEXT: 'glDrawArraysInstanced',
+ glDrawElementsInstancedEXT: 'glDrawElementsInstanced',
+ glVertexAttribDivisorARB: 'glVertexAttribDivisor',
+ glDrawArraysInstancedARB: 'glDrawArraysInstanced',
+ glDrawElementsInstancedARB: 'glDrawElementsInstanced',
+
// signatures of simple pass-through functions, see later
glActiveTexture__sig: 'vi',
diff --git a/src/library_sdl.js b/src/library_sdl.js
index 2efc1271..1c1e8107 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -1220,6 +1220,7 @@ var LibrarySDL = {
if (surf) SDL.freeSurface(surf);
},
+ SDL_UpperBlit__deps: ['SDL_LockSurface'],
SDL_UpperBlit: function(src, srcrect, dst, dstrect) {
var srcData = SDL.surfaces[src];
var dstData = SDL.surfaces[dst];
diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp
index d2a48f63..70cf844b 100644
--- a/src/relooper/Relooper.cpp
+++ b/src/relooper/Relooper.cpp
@@ -101,9 +101,7 @@ void Branch::Render(Block *Target, bool SetLabel) {
// Block
-int Block::IdCounter = 1; // 0 is reserved for clearings
-
-Block::Block(const char *CodeInit, const char *BranchVarInit) : Parent(NULL), Id(Block::IdCounter++), IsCheckedMultipleEntry(false) {
+Block::Block(const char *CodeInit, const char *BranchVarInit) : Parent(NULL), Id(-1), IsCheckedMultipleEntry(false) {
Code = strdup(CodeInit);
BranchVar = BranchVarInit ? strdup(BranchVarInit) : NULL;
}
@@ -142,6 +140,7 @@ void Block::Render(bool InLoop) {
if (!ProcessedBranchesOut.size()) return;
bool SetLabel = true; // in some cases it is clear we can avoid setting label, see later
+ bool ForceSetLabel = Shape::IsEmulated(Parent);
// A setting of the label variable (label = x) is necessary if it can
// cause an impact. The main case is where we set label to x, then elsewhere
@@ -210,7 +209,7 @@ void Block::Render(bool InLoop) {
Target = DefaultTarget;
Details = ProcessedBranchesOut[DefaultTarget];
}
- bool SetCurrLabel = SetLabel && Target->IsCheckedMultipleEntry;
+ bool SetCurrLabel = (SetLabel && Target->IsCheckedMultipleEntry) || ForceSetLabel;
bool HasFusedContent = Fused && contains(Fused->InnerMap, Target);
bool HasContent = SetCurrLabel || Details->Type != Branch::Direct || HasFusedContent || Details->Code;
if (iter != ProcessedBranchesOut.end()) {
@@ -272,10 +271,6 @@ void Block::Render(bool InLoop) {
}
}
-// Shape
-
-int Shape::IdCounter = 0;
-
// MultipleShape
void MultipleShape::RenderLoopPrefix() {
@@ -330,16 +325,19 @@ void LoopShape::Render(bool InLoop) {
if (Next) Next->Render(InLoop);
};
-/*
// EmulatedShape
void EmulatedShape::Render(bool InLoop) {
+ PrintIndented("label = %d;\n", Entry->Id);
+ if (Labeled) {
+ PrintIndented("L%d: ", Id);
+ }
PrintIndented("while(1) {\n");
Indenter::Indent();
- PrintIndented("switch(label) {\n");
+ PrintIndented("switch(label|0) {\n");
Indenter::Indent();
- for (int i = 0; i < Blocks.size(); i++) {
- Block *Curr = Blocks[i];
+ for (BlockSet::iterator iter = Blocks.begin(); iter != Blocks.end(); iter++) {
+ Block *Curr = *iter;
PrintIndented("case %d: {\n", Curr->Id);
Indenter::Indent();
Curr->Render(InLoop);
@@ -353,11 +351,10 @@ void EmulatedShape::Render(bool InLoop) {
PrintIndented("}\n");
if (Next) Next->Render(InLoop);
};
-*/
// Relooper
-Relooper::Relooper() : Root(NULL) {
+Relooper::Relooper() : Root(NULL), Emulate(false), BlockIdCounter(1), ShapeIdCounter(0) { // block ID 0 is reserved for clearings
}
Relooper::~Relooper() {
@@ -366,6 +363,7 @@ Relooper::~Relooper() {
}
void Relooper::AddBlock(Block *New) {
+ New->Id = BlockIdCounter++;
Blocks.push_back(New);
}
@@ -461,7 +459,7 @@ void Relooper::Calculate(Block *Entry) {
}
}
- Pre.SplitDeadEnds();
+ if (!Emulate) Pre.SplitDeadEnds();
// Recursively process the graph
@@ -470,6 +468,7 @@ void Relooper::Calculate(Block *Entry) {
// Add a shape to the list of shapes in this Relooper calculation
void Notice(Shape *New) {
+ New->Id = Parent->ShapeIdCounter++;
Parent->Shapes.push_back(New);
}
@@ -526,6 +525,21 @@ void Relooper::Calculate(Block *Entry) {
return Simple;
}
+ Shape *MakeEmulated(BlockSet &Blocks, Block *Entry, BlockSet &NextEntries) {
+ PrintDebug("creating emulated block with entry #%d and everything it can reach, %d blocks\n", Entry->Id, Blocks.size());
+ EmulatedShape *Emulated = new EmulatedShape;
+ Notice(Emulated);
+ Emulated->Entry = Entry;
+ for (BlockSet::iterator iter = Blocks.begin(); iter != Blocks.end(); iter++) {
+ Block *Curr = *iter;
+ Emulated->Blocks.insert(Curr);
+ Curr->Parent = Emulated;
+ Solipsize(Curr, Branch::Continue, Emulated, Blocks);
+ }
+ Blocks.clear();
+ return Emulated;
+ }
+
Shape *MakeLoop(BlockSet &Blocks, BlockSet& Entries, BlockSet &NextEntries) {
// Find the inner blocks in this loop. Proceed backwards from the entries until
// you reach a seen block, collecting as you go.
@@ -837,6 +851,9 @@ void Relooper::Calculate(Block *Entry) {
if (Entries->size() == 0) return Ret;
if (Entries->size() == 1) {
Block *Curr = *(Entries->begin());
+ if (Parent->Emulate) {
+ Make(MakeEmulated(Blocks, Curr, *NextEntries));
+ }
if (Curr->BranchesIn.size() == 0) {
// One entry, no looping ==> Simple
Make(MakeSimple(Blocks, Curr, *NextEntries));
@@ -844,6 +861,7 @@ void Relooper::Calculate(Block *Entry) {
// One entry, looping ==> Loop
Make(MakeLoop(Blocks, *Entries, *NextEntries));
}
+
// More than one entry, try to eliminate through a Multiple groups of
// independent blocks from an entry/ies. It is important to remove through
// multiples as opposed to looping since the former is more performant.
diff --git a/src/relooper/Relooper.h b/src/relooper/Relooper.h
index f3dedf8c..04f2ffc3 100644
--- a/src/relooper/Relooper.h
+++ b/src/relooper/Relooper.h
@@ -57,7 +57,7 @@ struct Block {
BlockBranchMap ProcessedBranchesOut;
BlockSet ProcessedBranchesIn;
Shape *Parent; // The shape we are directly inside
- int Id; // A unique identifier
+ int Id; // A unique identifier, defined when added to relooper
const char *Code; // The string representation of the code in this block. Owning pointer (we copy the input)
const char *BranchVar; // If we have more than one branch out, the variable whose value determines where we go
bool IsCheckedMultipleEntry; // If true, we are a multiple entry, so reaching us requires setting the label variable
@@ -69,9 +69,6 @@ struct Block {
// Prints out the instructions code and branchings
void Render(bool InLoop);
-
- // INTERNAL
- static int IdCounter;
};
// Represents a structured control flow shape, one of
@@ -96,20 +93,22 @@ class SimpleShape;
class LabeledShape;
class MultipleShape;
class LoopShape;
+class EmulatedShape;
struct Shape {
- int Id; // A unique identifier. Used to identify loops, labels are Lx where x is the Id.
+ int Id; // A unique identifier. Used to identify loops, labels are Lx where x is the Id. Defined when added to relooper
Shape *Next; // The shape that will appear in the code right after this one
Shape *Natural; // The shape that control flow gets to naturally (if there is Next, then this is Next)
enum ShapeType {
Simple,
Multiple,
- Loop
+ Loop,
+ Emulated
};
ShapeType Type;
- Shape(ShapeType TypeInit) : Id(Shape::IdCounter++), Next(NULL), Type(TypeInit) {}
+ Shape(ShapeType TypeInit) : Id(-1), Next(NULL), Type(TypeInit) {}
virtual ~Shape() {}
virtual void Render(bool InLoop) = 0;
@@ -118,9 +117,7 @@ struct Shape {
static MultipleShape *IsMultiple(Shape *It) { return It && It->Type == Multiple ? (MultipleShape*)It : NULL; }
static LoopShape *IsLoop(Shape *It) { return It && It->Type == Loop ? (LoopShape*)It : NULL; }
static LabeledShape *IsLabeled(Shape *It) { return IsMultiple(It) || IsLoop(It) ? (LabeledShape*)It : NULL; }
-
- // INTERNAL
- static int IdCounter;
+ static EmulatedShape *IsEmulated(Shape *It) { return It && It->Type == Emulated ? (EmulatedShape*)It : NULL; }
};
struct SimpleShape : public Shape {
@@ -162,12 +159,15 @@ struct LoopShape : public LabeledShape {
void Render(bool InLoop);
};
-/*
-struct EmulatedShape : public Shape {
- std::deque<Block*> Blocks;
+// TODO EmulatedShape is only partially functional. Currently it can be used for the
+// entire set of blocks being relooped, but not subsets.
+struct EmulatedShape : public LabeledShape {
+ Block *Entry;
+ BlockSet Blocks;
+
+ EmulatedShape() : LabeledShape(Emulated) { Labeled = true; }
void Render(bool InLoop);
};
-*/
// Implements the relooper algorithm for a function's blocks.
//
@@ -184,6 +184,9 @@ struct Relooper {
std::deque<Block*> Blocks;
std::deque<Shape*> Shapes;
Shape *Root;
+ bool Emulate;
+ int BlockIdCounter;
+ int ShapeIdCounter;
Relooper();
~Relooper();
@@ -204,6 +207,9 @@ struct Relooper {
// Sets asm.js mode on or off (default is off)
static void SetAsmJSMode(int On);
+
+ // Sets whether we must emulate everything with switch-loop code
+ void SetEmulate(int E) { Emulate = E; }
};
typedef std::map<Block*, BlockSet> BlockBlockSetMap;
diff --git a/src/relooper/fuzzer.py b/src/relooper/fuzzer.py
index 50846d10..fa47583e 100644
--- a/src/relooper/fuzzer.py
+++ b/src/relooper/fuzzer.py
@@ -87,6 +87,12 @@ int main() {
Relooper r;
'''
+ if random.random() < 0.1:
+ print 'emulate'
+ fast += '''
+ r.SetEmulate(true);
+'''
+
for i in range(num):
fast += ''' r.AddBlock(b%d);
''' % i
diff --git a/src/relooper/test.cpp b/src/relooper/test.cpp
index fbd9c7aa..773f6ee4 100644
--- a/src/relooper/test.cpp
+++ b/src/relooper/test.cpp
@@ -258,5 +258,33 @@ int main() {
puts(buffer);
}
+
+ if (1) {
+ Relooper::SetOutputBuffer(buffer, sizeof(buffer));
+
+ printf("\n\n-- If pattern, emulated --\n\n", "the_var");
+
+ Block *b_a = new Block("// block A\n", NULL);
+ Block *b_b = new Block("// block B\n", "b_check()");
+ Block *b_c = new Block("// block C\n", NULL);
+
+ b_a->AddBranchTo(b_b, "check == 10", "atob();");
+ b_a->AddBranchTo(b_c, NULL, "atoc();");
+
+ b_b->AddBranchTo(b_c, "case 17:", "btoc();");
+ b_b->AddBranchTo(b_a, NULL, NULL);
+
+ Relooper r;
+ r.SetEmulate(true);
+ r.AddBlock(b_a);
+ r.AddBlock(b_b);
+ r.AddBlock(b_c);
+
+ r.Calculate(b_a);
+ printf("\n\n", "the_var");
+ r.Render();
+
+ puts(buffer);
+ }
}
diff --git a/src/relooper/test.txt b/src/relooper/test.txt
index 2c530567..540f7bdb 100644
--- a/src/relooper/test.txt
+++ b/src/relooper/test.txt
@@ -4,23 +4,23 @@
-// block A
-switch (the_var) {
-check == 10 {
- atob();
- // block B
+ // block A
switch (the_var) {
+ check == 10 {
+ atob();
+ // block B
+ switch (the_var) {
+ default: {
+ btoc();
+ }
+ }
+ break;
+ }
default: {
- btoc();
+ atoc();
}
}
- break;
-}
-default: {
- atoc();
-}
-}
-// block C
+ // block C
@@ -28,25 +28,25 @@ default: {
-// block A
-switch (the_var) {
-check == 15 {
- // block B
+ // block A
switch (the_var) {
- default: {
- }
+ check == 15 {
+ // block B
+ switch (the_var) {
+ default: {
+ }
+ }
+ break;
}
- break;
-}
-default: {
- // block C
- switch (the_var) {
default: {
+ // block C
+ switch (the_var) {
+ default: {
+ }
+ }
}
}
-}
-}
-// block D
+ // block D
@@ -54,81 +54,81 @@ default: {
-L9: while(1) {
- // block A
- var check = maybe();
- switch (the_var) {
- default: {
- }
- }
- // block B
- switch (the_var) {
- check == 41 {
- break;
- }
- default: {
- break L9;
- }
+ L0: while(1) {
+ // block A
+ var check = maybe();
+ switch (the_var) {
+ default: {
+ }
+ }
+ // block B
+ switch (the_var) {
+ check == 41 {
+ break;
+ }
+ default: {
+ break L0;
+ }
+ }
}
-}
-// block C
+ // block C
-- Loop with phi to head
-// code 1
-switch (the_var) {
-default: {
- var $i_0 = 0;var $x_0 = 5;
-}
-}
-L14: while(1) {
- // code 2
+ // code 1
switch (the_var) {
- $2 {
- break;
- }
default: {
- var $x_1 = $x_0;
- label = 18;
- break L14;
+ var $i_0 = 0;var $x_0 = 5;
+ }
+ }
+ L1: while(1) {
+ // code 2
+ switch (the_var) {
+ $2 {
+ break;
+ }
+ default: {
+ var $x_1 = $x_0;
+ label = -1;
+ break L1;
+ }
+ }
+ // code 3
+ switch (the_var) {
+ $6 {
+ break L1;
+ break;
+ }
+ default: {
+ var $i_0 = $7;var $x_0 = $5;
+ }
+ }
}
+ if (label == -1) {
+ // code 7
}
- // code 3
+ // code 4
switch (the_var) {
- $6 {
- break L14;
+ $10 {
+ // code 5
+ switch (the_var) {
+ default: {
+ }
+ }
break;
}
default: {
- var $i_0 = $7;var $x_0 = $5;
}
}
-}
-if (label == 18) {
- // code 7
-}
-// code 4
-switch (the_var) {
-$10 {
- // code 5
+ // code 6
switch (the_var) {
default: {
+ var $x_1 = $13;
}
}
- break;
-}
-default: {
-}
-}
-// code 6
-switch (the_var) {
-default: {
- var $x_1 = $13;
-}
-}
-// code 7
+ // code 7
@@ -136,30 +136,30 @@ default: {
-// block A...................................................................................................
-switch (the_var) {
-chak() {
- atob();
- // block B...................................................................................................
+ // block A...................................................................................................
switch (the_var) {
- default: {
- btod();
- }
+ chak() {
+ atob();
+ // block B...................................................................................................
+ switch (the_var) {
+ default: {
+ btod();
+ }
+ }
+ // block D
+ break;
}
- // block D
- break;
-}
-default: {
- atoc();
- // block C...................................................................................................
- switch (the_var) {
default: {
- ctod2();
+ atoc();
+ // block C...................................................................................................
+ switch (the_var) {
+ default: {
+ ctod2();
+ }
+ }
+ // block D
}
}
- // block D
-}
-}
@@ -167,27 +167,27 @@ default: {
-// block A
-switch (the_var) {
-check == 10 {
- break;
-}
-default: {
- return C;
-}
-}
-while(1) {
- // block B
+ // block A
switch (the_var) {
- default: {
- }
+ check == 10 {
+ break;
}
- // block D
- switch (the_var) {
default: {
+ return C;
}
}
-}
+ while(1) {
+ // block B
+ switch (the_var) {
+ default: {
+ }
+ }
+ // block D
+ switch (the_var) {
+ default: {
+ }
+ }
+ }
@@ -195,51 +195,51 @@ while(1) {
-// block A
-L37: do {
- switch (the_var) {
- expensive() {
- label = 33;
- break;
- }
- default: {
- // block B
+ // block A
+ L1: do {
switch (the_var) {
- expensive2() {
- label = 33;
- break L37;
+ expensive() {
+ label = 3;
break;
}
default: {
+ // block B
+ switch (the_var) {
+ expensive2() {
+ label = 3;
+ break L1;
+ break;
+ }
+ default: {
+ }
+ }
+ // block D
+ switch (the_var) {
+ default: {
+ }
+ }
}
}
- // block D
+ } while(0);
+ if (label == 3) {
+ // block C;
switch (the_var) {
default: {
}
}
}
+ while(1) {
+ // block E
+ switch (the_var) {
+ default: {
+ }
+ }
+ // block F
+ switch (the_var) {
+ default: {
+ }
+ }
}
-} while(0);
-if (label == 33) {
- // block C;
- switch (the_var) {
- default: {
- }
- }
-}
-while(1) {
- // block E
- switch (the_var) {
- default: {
- }
- }
- // block F
- switch (the_var) {
- default: {
- }
- }
-}
@@ -247,26 +247,71 @@ while(1) {
-// block A
-L46: do {
- switch (the_var) {
- shouldLoop() {
- while(1) {
- // block B
- switch (the_var) {
- moarLoop() {
+ // block A
+ L1: do {
+ switch (the_var) {
+ shouldLoop() {
+ while(1) {
+ // block B
+ switch (the_var) {
+ moarLoop() {
+ break;
+ }
+ default: {
+ break L1;
+ }
+ }
+ }
+ break;
+ }
+ default: {
+ }
+ }
+ } while(0);
+ // block C
+
+
+
+-- If pattern, emulated --
+
+
+
+ label = 1;
+ L0: while(1) {
+ switch(label|0) {
+ case 3: {
+ // block C
break;
}
- default: {
- break L46;
+ case 1: {
+ // block A
+ if (check == 10) {
+ atob();
+ label = 2;
+ continue L0;
+ } else {
+ atoc();
+ label = 3;
+ continue L0;
+ }
+ break;
}
+ case 2: {
+ // block B
+ switch (b_check()) {
+ case 17: {
+ btoc();
+ label = 3;
+ continue L0;
+ break;