id
int32
0
12.9k
code
sequencelengths
2
264k
7,800
[ "<s>", "package", "erjang", ".", "m", ".", "ets", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "IPersistentCollection", ";", "public", "interface", "IPersistentBag", "extends", "IPersistentCollection", "{", "IPersistentBag", "disjoin", "(", "Object", "element", ")", ";", "}", "</s>" ]
7,801
[ "<s>", "package", "erjang", ".", "m", ".", "ets", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EBitString", ";", "import", "erjang", ".", "ECons", ";", "import", "erjang", ".", "EFun", ";", "import", "erjang", ".", "ENumber", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EPID", ";", "import", "erjang", ".", "EPort", ";", "import", "erjang", ".", "ERef", ";", "import", "erjang", ".", "ETuple", ";", "public", "abstract", "class", "ETermPattern", "{", "public", "boolean", "match", "(", "ETuple", "t", ",", "EMatchContext", "r", ")", "{", "return", "false", ";", "}", "public", "boolean", "match", "(", "ENumber", "n", ",", "EMatchContext", "r", ")", "{", "return", "false", ";", "}", "public", "boolean", "match", "(", "EAtom", "a", ",", "EMatchContext", "r", ")", "{", "return", "false", ";", "}", "public", "boolean", "match", "(", "ECons", "c", ",", "EMatchContext", "r", ")", "{", "return", "false", ";", "}", "public", "boolean", "match", "(", "EPID", "p", ",", "EMatchContext", "r", ")", "{", "return", "false", ";", "}", "public", "boolean", "match", "(", "EPort", "p", ",", "EMatchContext", "r", ")", "{", "return", "false", ";", "}", "public", "boolean", "match", "(", "EBitString", "bs", ",", "EMatchContext", "r", ")", "{", "return", "false", ";", "}", "public", "boolean", "match", "(", "EFun", "eFun", ",", "EMatchContext", "r", ")", "{", "return", "false", ";", "}", "public", "boolean", "match", "(", "ERef", "eRef", ",", "EMatchContext", "r", ")", "{", "return", "false", ";", "}", "}", "</s>" ]
7,802
[ "<s>", "package", "erjang", ".", "m", ".", "ets", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "IMapEntry", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "IPersistentCollection", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "IPersistentMap", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "ISeq", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "PersistentHashMap", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "PersistentList", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "PersistentTreeMap", ";", "public", "class", "PersistentBag", "extends", "Object", "implements", "IPersistentBag", "{", "public", "static", "PersistentBag", "EMPTY", "=", "new", "PersistentBag", "(", "PersistentHashMap", ".", "EMPTY", ",", "0", ")", ";", "IPersistentMap", "impl", ";", "int", "count", ";", "private", "PersistentBag", "(", "IPersistentMap", "impl", ",", "int", "count", ")", "{", "this", ".", "impl", "=", "impl", ";", "this", ".", "count", "=", "count", ";", "}", "@", "Override", "public", "IPersistentBag", "disjoin", "(", "Object", "element", ")", "{", "Integer", "val", "=", "(", "Integer", ")", "impl", ".", "valAt", "(", "element", ")", ";", "if", "(", "val", "==", "null", ")", "{", "return", "this", ";", "}", "else", "if", "(", "val", "==", "1", ")", "{", "try", "{", "return", "new", "PersistentBag", "(", "impl", ".", "without", "(", "element", ")", ",", "count", "-", "1", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "Error", "(", "e", ")", ";", "}", "}", "else", "{", "return", "new", "PersistentBag", "(", "impl", ".", "assoc", "(", "element", ",", "val", "-", "1", ")", ",", "count", "-", "1", ")", ";", "}", "}", "@", "Override", "public", "IPersistentCollection", "cons", "(", "Object", "element", ")", "{", "Integer", "val", "=", "(", "Integer", ")", "impl", ".", "valAt", "(", "element", ")", ";", "if", "(", "val", "==", "null", ")", "{", "return", "new", "PersistentBag", "(", "impl", ".", "assoc", "(", "element", ",", "1", ")", ",", "count", "+", "1", ")", ";", "}", "else", "{", "return", "new", "PersistentBag", "(", "impl", ".", "assoc", "(", "element", ",", "val", "+", "1", ")", ",", "count", "+", "1", ")", ";", "}", "}", "@", "Override", "public", "int", "count", "(", ")", "{", "return", "count", ";", "}", "@", "Override", "public", "IPersistentCollection", "empty", "(", ")", "{", "return", "new", "PersistentBag", "(", "PersistentTreeMap", ".", "EMPTY", ",", "0", ")", ";", "}", "@", "Override", "public", "boolean", "equiv", "(", "Object", "arg0", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}", "class", "ElemSeq", "implements", "ISeq", "{", "private", "final", "int", "total", ";", "private", "final", "int", "pos", ";", "private", "final", "ISeq", "pairs", ";", "@", "Override", "public", "ISeq", "cons", "(", "Object", "arg0", ")", "{", "return", "null", ";", "}", "@", "Override", "public", "Object", "first", "(", ")", "{", "IMapEntry", "elem_count_pair", "=", "(", "IMapEntry", ")", "pairs", ".", "first", "(", ")", ";", "return", "elem_count_pair", ".", "getKey", "(", ")", ";", "}", "@", "Override", "public", "ISeq", "more", "(", ")", "{", "ISeq", "next", "=", "next", "(", ")", ";", "if", "(", "next", "==", "null", ")", "return", "PersistentList", ".", "EMPTY", ";", "return", "next", ";", "}", "@", "Override", "public", "ISeq", "next", "(", ")", "{", "IMapEntry", "elem_count_pair", "=", "(", "IMapEntry", ")", "pairs", ".", "first", "(", ")", ";", "int", "count", "=", "(", "Integer", ")", "elem_count_pair", ".", "getValue", "(", ")", ";", "if", "(", "count", "==", "pos", "+", "1", ")", "{", "ISeq", "succ", "=", "pairs", ".", "next", "(", ")", ";", "if", "(", "succ", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "new", "ElemSeq", "(", "succ", ",", "0", ",", "total", "-", "1", ")", ";", "}", "}", "else", "{", "return", "new", "ElemSeq", "(", "pairs", ",", "pos", "+", "1", ",", "total", "-", "1", ")", ";", "}", "}", "@", "Override", "public", "int", "count", "(", ")", "{", "return", "total", ";", "}", "@", "Override", "public", "IPersistentCollection", "empty", "(", ")", "{", "return", "PersistentBag", ".", "EMPTY", ";", "}", "@", "Override", "public", "boolean", "equiv", "(", "Object", "arg0", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}", "@", "Override", "public", "ISeq", "seq", "(", ")", "{", "return", "this", ";", "}", "ElemSeq", "(", "ISeq", "pairs", ",", "int", "count", ",", "int", "total", ")", "{", "this", ".", "pairs", "=", "pairs", ";", "this", ".", "pos", "=", "count", ";", "this", ".", "total", "=", "total", ";", "}", "}", "@", "Override", "public", "ISeq", "seq", "(", ")", "{", "if", "(", "count", "(", ")", "==", "0", ")", "return", "null", ";", "return", "new", "ElemSeq", "(", "impl", ".", "seq", "(", ")", ",", "0", ",", "count", ")", ";", "}", "}", "</s>" ]
7,803
[ "<s>", "package", "erjang", ".", "m", ".", "file", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "ENative", ";", "import", "erjang", ".", "EObject", ";", "public", "class", "Native", "extends", "ENative", "{", "public", "static", "final", "EAtom", "am_latin1", "=", "EAtom", ".", "intern", "(", "\"latin1\"", ")", ";", "public", "static", "final", "EAtom", "am_utf8", "=", "EAtom", ".", "intern", "(", "\"utf8\"", ")", ";", "public", "static", "final", "EAtom", "am_unicode", "=", "EAtom", ".", "intern", "(", "\"unicode\"", ")", ";", "@", "BIF", "public", "static", "EObject", "native_name_encoding", "(", ")", "{", "return", "am_utf8", ";", "}", "}", "</s>" ]
7,804
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "import", "java", ".", "nio", ".", "ByteBuffer", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "kilim", ".", "Pausable", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EInternalPID", ";", "import", "erjang", ".", "EInternalPort", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EPort", ";", "import", "erjang", ".", "EProc", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "EString", ";", "import", "erjang", ".", "ETask", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ETuple2", ";", "import", "erjang", ".", "ETuple3", ";", "import", "erjang", ".", "driver", ".", "EDriver", ";", "import", "erjang", ".", "driver", ".", "EDriverInstance", ";", "import", "erjang", ".", "driver", ".", "EDriverTask", ";", "import", "erjang", ".", "driver", ".", "EExecDriverTask", ";", "import", "erjang", ".", "driver", ".", "EFDDriverTask", ";", "import", "erjang", ".", "driver", ".", "ESpawnDriverTask", ";", "import", "erjang", ".", "driver", ".", "tcp_inet", ".", "TCPINet", ";", "public", "class", "ErlPort", "{", "static", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.port\"", ")", ";", "public", "static", "final", "EAtom", "am_fd", "=", "EAtom", ".", "intern", "(", "\"fd\"", ")", ";", "private", "static", "final", "ByteBuffer", "EMPTY_BYTEBUFFER", "=", "ByteBuffer", ".", "allocate", "(", "0", ")", ";", "public", "static", "EAtom", "am_spawn", "=", "EAtom", ".", "intern", "(", "\"spawn\"", ")", ";", "static", "EAtom", "am_spawn_driver", "=", "EAtom", ".", "intern", "(", "\"spawn_driver\"", ")", ";", "static", "EAtom", "am_spawn_executable", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "@", "BIF", "static", "EObject", "port_connect", "(", "EProc", "proc", ",", "EObject", "arg_port", ",", "EObject", "arg_pid", ")", "throws", "Pausable", "{", "EInternalPort", "iport", ";", "EInternalPID", "ipid", ";", "if", "(", "(", "iport", "=", "arg_port", ".", "testInternalPort", "(", ")", ")", "==", "null", ")", "{", "EAtom", "port_name", "=", "arg_port", ".", "testAtom", "(", ")", ";", "EObject", "resolved", ";", "if", "(", "port_name", "!=", "null", "&&", "(", "resolved", "=", "ERT", ".", "whereis", "(", "port_name", ")", ")", "!=", "ERT", ".", "am_undefined", "&&", "(", "iport", "=", "resolved", ".", "testInternalPort", "(", ")", ")", "!=", "null", ")", "{", "}", "else", "{", "throw", "ERT", ".", "badarg", "(", "arg_port", ",", "arg_pid", ")", ";", "}", "}", "if", "(", "(", "ipid", "=", "arg_pid", ".", "testInternalPID", "(", ")", ")", "==", "null", ")", "{", "EAtom", "pid_name", "=", "arg_pid", ".", "testAtom", "(", ")", ";", "EObject", "resolved", ";", "if", "(", "pid_name", "!=", "null", "&&", "(", "resolved", "=", "ERT", ".", "whereis", "(", "pid_name", ")", ")", "!=", "ERT", ".", "am_undefined", "&&", "(", "ipid", "=", "resolved", ".", "testInternalPID", "(", ")", ")", "!=", "null", ")", "{", "}", "else", "{", "throw", "ERT", ".", "badarg", "(", "arg_port", ",", "arg_pid", ")", ";", "}", "}", "iport", ".", "set_owner", "(", "ipid", ")", ";", "ipid", ".", "task", "(", ")", ".", "link_to", "(", "iport", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "static", "EObject", "port_command", "(", "EProc", "proc", ",", "EObject", "port", ",", "EObject", "data", ")", "throws", "Pausable", "{", "EInternalPort", "p", "=", "port", ".", "testInternalPort", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "log", ".", "finer", "(", "\"\"", "+", "port", "+", "\",", "\"", "+", "data", ")", ";", "if", "(", "p", "==", "null", ")", "{", "port", "=", "ERT", ".", "whereis", "(", "port", ")", ";", "if", "(", "port", "==", "ERT", ".", "am_undefined", ")", "port", "=", "null", ";", "else", "p", "=", "port", ".", "testInternalPort", "(", ")", ";", "}", "List", "<", "ByteBuffer", ">", "ovec", "=", "new", "ArrayList", "<", "ByteBuffer", ">", "(", ")", ";", "if", "(", "p", "==", "null", "||", "!", "data", ".", "collectIOList", "(", "ovec", ")", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "WARNING", ")", ")", "{", "log", ".", "warning", "(", "\"\"", "+", "p", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "port", ",", "data", ")", ";", "}", "ByteBuffer", "[", "]", "out", "=", "new", "ByteBuffer", "[", "ovec", ".", "size", "(", ")", "]", ";", "ovec", ".", "toArray", "(", "out", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "log", ".", "fine", "(", "\"EVEC:", "\"", ")", ";", "TCPINet", ".", "dump_buffer", "(", "out", ")", ";", "}", "p", ".", "command", "(", "proc", ".", "self_handle", "(", ")", ",", "out", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "static", "EObject", "port_command", "(", "EProc", "proc", ",", "EObject", "port", ",", "EObject", "data", ",", "EObject", "options", ")", "throws", "Pausable", "{", "EInternalPort", "p", "=", "port", ".", "testInternalPort", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", "+", "port", "+", "\",", "\"", "+", "data", ")", ";", "if", "(", "p", "==", "null", ")", "{", "port", "=", "ERT", ".", "whereis", "(", "port", ")", ";", "if", "(", "port", "==", "ERT", ".", "am_undefined", ")", "port", "=", "null", ";", "else", "p", "=", "port", ".", "testInternalPort", "(", ")", ";", "}", "List", "<", "ByteBuffer", ">", "ovec", "=", "new", "ArrayList", "<", "ByteBuffer", ">", "(", ")", ";", "if", "(", "p", "==", "null", "||", "!", "data", ".", "collectIOList", "(", "ovec", ")", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "log", ".", "fine", "(", "\"\"", "+", "p", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "port", ",", "data", ")", ";", "}", "ByteBuffer", "[", "]", "out", "=", "new", "ByteBuffer", "[", "ovec", ".", "size", "(", ")", "]", ";", "ovec", ".", "toArray", "(", "out", ")", ";", "EDriverInstance", ".", "dump_buffer", "(", "log", ",", "\"EVEC:", "\"", ",", "out", ")", ";", "p", ".", "command", "(", "proc", ".", "self_handle", "(", ")", ",", "out", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "static", "EObject", "port_control", "(", "EProc", "proc", ",", "EObject", "port", ",", "EObject", "operation", ",", "EObject", "data", ")", "throws", "Pausable", "{", "try", "{", "return", "port_control0", "(", "proc", ",", "port", ",", "operation", ",", "data", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "throw", "e", ";", "}", "catch", "(", "Error", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "throw", "e", ";", "}", "}", "static", "EObject", "port_control0", "(", "EProc", "proc", ",", "EObject", "port", ",", "EObject", "operation", ",", "EObject", "data", ")", "throws", "Pausable", "{", "EInternalPort", "p", "=", "port", ".", "testInternalPort", "(", ")", ";", "if", "(", "p", "==", "null", ")", "{", "port", "=", "ERT", ".", "whereis", "(", "port", ")", ";", "if", "(", "port", "==", "ERT", ".", "am_undefined", ")", "port", "=", "null", ";", "p", "=", "port", ".", "testInternalPort", "(", ")", ";", "}", "ESmall", "op", "=", "operation", ".", "testSmall", "(", ")", ";", "List", "<", "ByteBuffer", ">", "ovec", "=", "new", "ArrayList", "<", "ByteBuffer", ">", "(", ")", ";", "if", "(", "p", "==", "null", "||", "op", "==", "null", "||", "!", "data", ".", "collectIOList", "(", "ovec", ")", ")", "{", "throw", "ERT", ".", "badarg", "(", "port", ",", "operation", ",", "data", ")", ";", "}", "ByteBuffer", "cmd", "=", "flatten", "(", "ovec", ")", ";", "return", "p", ".", "control", "(", "proc", ",", "op", ".", "value", ",", "cmd", ")", ";", "}", "private", "static", "ByteBuffer", "flatten", "(", "List", "<", "ByteBuffer", ">", "ovec", ")", "{", "if", "(", "ovec", ".", "size", "(", ")", "==", "0", ")", "{", "return", "EMPTY_BYTEBUFFER", ";", "}", "else", "if", "(", "ovec", ".", "size", "(", ")", "==", "1", ")", "{", "return", "ovec", ".", "get", "(", "0", ")", ";", "}", "int", "len", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ovec", ".", "size", "(", ")", ";", "i", "++", ")", "{", "len", "+=", "ovec", ".", "get", "(", "i", ")", ".", "remaining", "(", ")", ";", "}", "ByteBuffer", "res", "=", "ByteBuffer", ".", "allocate", "(", "len", ")", ";", "for", "(", "ByteBuffer", "bb", ":", "ovec", ")", "{", "res", ".", "put", "(", "bb", ")", ";", "}", "res", ".", "rewind", "(", ")", ";", "return", "res", ";", "}", "@", "BIF", "static", "EObject", "port_call", "(", "EProc", "proc", ",", "EObject", "port", ",", "EObject", "operation", ",", "EObject", "data", ")", "throws", "Pausable", "{", "EInternalPort", "p", "=", "port", ".", "testInternalPort", "(", ")", ";", "if", "(", "p", "==", "null", ")", "{", "port", "=", "ERT", ".", "whereis", "(", "port", ")", ";", "if", "(", "port", "==", "ERT", ".", "am_undefined", ")", "port", "=", "null", ";", "p", "=", "port", ".", "testInternalPort", "(", ")", ";", "}", "ESmall", "op", "=", "operation", ".", "testSmall", "(", ")", ";", "if", "(", "p", "==", "null", "||", "op", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "port", ",", "operation", ",", "data", ")", ";", "}", "return", "p", ".", "call", "(", "proc", ",", "op", ".", "value", ",", "data", ")", ";", "}", "@", "BIF", "static", "EPort", "open_port", "(", "EProc", "proc", ",", "EObject", "portName", ",", "EObject", "portSetting", ")", "throws", "Pausable", "{", "ETuple", "t", ";", "if", "(", "(", "t", "=", "portName", ".", "testTuple", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "portName", ",", "portSetting", ")", ";", "ETask", "<", "?", "extends", "EPort", ">", "task", "=", "null", ";", "ETuple2", "name", ";", "ETuple3", "name3", ";", "if", "(", "(", "name", "=", "ETuple2", ".", "cast", "(", "t", ")", ")", "!=", "null", ")", "{", "EAtom", "am", "=", "name", ".", "elem2", ".", "testAtom", "(", ")", ";", "EString", "command", "=", "(", "am", "==", "null", ")", "?", "(", "EString", ")", "EString", ".", "make", "(", "name", ".", "elem2", ")", ":", "EString", ".", "fromString", "(", "am", ".", "getName", "(", ")", ")", ";", "if", "(", "name", ".", "elem1", "==", "am_spawn", ")", "{", "EDriver", "drv", "=", "ERT", ".", "find_driver", "(", "command", ")", ";", "if", "(", "drv", "==", "null", ")", "{", "task", "=", "new", "EExecDriverTask", "(", "proc", ",", "name", ",", "command", ",", "portSetting", ")", ";", "}", "else", "{", "task", "=", "new", "ESpawnDriverTask", "(", "proc", ",", "drv", ",", "command", ",", "portSetting", ")", ";", "}", "}", "else", "if", "(", "name", ".", "elem1", "==", "am_spawn_driver", ")", "{", "EDriver", "drv", "=", "ERT", ".", "find_driver", "(", "command", ")", ";", "if", "(", "drv", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "portName", ",", "portSetting", ")", ";", "}", "task", "=", "new", "ESpawnDriverTask", "(", "proc", ",", "drv", ",", "command", ",", "portSetting", ")", ";", "}", "else", "if", "(", "name", ".", "elem1", "==", "am_spawn_executable", ")", "{", "task", "=", "new", "EExecDriverTask", "(", "proc", ",", "name", ",", "command", ",", "portSetting", ")", ";", "}", "}", "else", "if", "(", "(", "name3", "=", "ETuple3", ".", "cast", "(", "portName", ")", ")", "!=", "null", "&&", "name3", ".", "elem1", "==", "am_fd", ")", "{", "ESmall", "in", "=", "name3", ".", "elem2", ".", "testSmall", "(", ")", ";", "ESmall", "out", "=", "name3", ".", "elem3", ".", "testSmall", "(", ")", ";", "if", "(", "in", "==", "null", "||", "out", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "portName", ",", "portSetting", ")", ";", "task", "=", "new", "EFDDriverTask", "(", "proc", ",", "in", ".", "value", ",", "out", ".", "value", ",", "portSetting", ")", ";", "}", "if", "(", "task", "!=", "null", ")", "{", "task", ".", "link_to", "(", "proc", ")", ";", "ERT", ".", "run", "(", "task", ")", ";", "return", "task", ".", "self_handle", "(", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "portName", ",", "portSetting", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "port_close", "(", "EProc", "proc", ",", "EObject", "port", ")", "throws", "Pausable", "{", "EPort", "p", ";", "if", "(", "(", "p", "=", "port", ".", "testPort", "(", ")", ")", "==", "null", ")", "{", "EObject", "obj", "=", "ERT", ".", "whereis", "(", "port", ")", ";", "if", "(", "obj", "==", "ERT", ".", "am_undefined", "||", "(", "(", "p", "=", "obj", ".", "testPort", "(", ")", ")", "==", "null", ")", ")", "{", "throw", "ERT", ".", "badarg", "(", "port", ")", ";", "}", "}", "if", "(", "!", "p", ".", "isOpen", "(", ")", ")", "{", "throw", "ERT", ".", "badarg", "(", "port", ")", ";", "}", "proc", ".", "unlink", "(", "p", ")", ";", "p", ".", "close", "(", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "static", "public", "ESeq", "ports", "(", ")", "{", "return", "EDriverTask", ".", "all_ports", "(", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "port_info", "(", "EProc", "proc", ",", "EObject", "a1", ",", "EObject", "a2", ")", "{", "EPort", "p", "=", "a1", ".", "testPort", "(", ")", ";", "EAtom", "spec", "=", "a2", ".", "testAtom", "(", ")", ";", "if", "(", "p", "==", "null", "||", "spec", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", ")", ";", "EObject", "info", "=", "p", ".", "port_info", "(", "spec", ")", ";", "return", "info", ";", "}", "@", "BIF", "static", "public", "EObject", "port_set_data", "(", "EObject", "port", ",", "EObject", "data", ")", "{", "EPort", "p", "=", "id_or_name2port", "(", "port", ")", ";", "if", "(", "p", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "port", ",", "data", ")", ";", "}", "p", ".", "set_data", "(", "data", ")", ";", "return", "data", ";", "}", "@", "BIF", "static", "public", "EObject", "port_get_data", "(", "EObject", "port", ")", "{", "EPort", "p", "=", "id_or_name2port", "(", "port", ")", ";", "if", "(", "p", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "port", ")", ";", "}", "return", "p", ".", "get_data", "(", ")", ";", "}", "private", "static", "EPort", "id_or_name2port", "(", "EObject", "port", ")", "{", "EPort", "p", "=", "port", ".", "testPort", "(", ")", ";", "if", "(", "p", "!=", "null", ")", "return", "p", ";", "EObject", "p2", "=", "ERT", ".", "whereis", "(", "port", ")", ";", "return", "p2", ".", "testPort", "(", ")", ";", "}", "}", "</s>" ]
7,805
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "import", "kilim", ".", "Pausable", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EFun", ";", "import", "erjang", ".", "EFunHandler", ";", "import", "erjang", ".", "EModuleManager", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EProc", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ETuple2", ";", "import", "erjang", ".", "FunID", ";", "public", "class", "ErlFun", "{", "@", "BIF", "public", "static", "EObject", "is_function", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "a1", ".", "is_function", "(", "a2", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "function_exported", "(", "EObject", "a1", ",", "EObject", "a2", ",", "EObject", "a3", ")", "{", "EAtom", "mod", "=", "a1", ".", "testAtom", "(", ")", ";", "EAtom", "fun", "=", "a2", ".", "testAtom", "(", ")", ";", "ESmall", "ary", "=", "a3", ".", "testSmall", "(", ")", ";", "return", "ERT", ".", "box", "(", "EModuleManager", ".", "function_exported", "(", "mod", ",", "fun", ",", "ary", ".", "value", ")", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "fun_info", "(", "EObject", "fun_arg", ",", "EObject", "spec_arg", ")", "{", "EFun", "fun", "=", "fun_arg", ".", "testFunction", "(", ")", ";", "EAtom", "spec", "=", "spec_arg", ".", "testAtom", "(", ")", ";", "if", "(", "fun", "==", "null", "||", "spec", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "fun_arg", ",", "spec_arg", ")", ";", "return", "fun", ".", "info", "(", "spec", ")", ";", "}", "@", "BIF", "public", "static", "ESeq", "fun_info", "(", "EObject", "fun_arg", ")", "{", "EFun", "fun", "=", "fun_arg", ".", "testFunction", "(", ")", ";", "if", "(", "fun", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "fun_arg", ")", ";", "ESeq", "res", "=", "ERT", ".", "NIL", ";", "boolean", "is_local", "=", "fun", ".", "is_local", "(", ")", ";", "res", "=", "res", ".", "cons", "(", "fun", ".", "info", "(", "ERT", ".", "am_type", ")", ")", ";", "res", "=", "res", ".", "cons", "(", "fun", ".", "info", "(", "ERT", ".", "am_env", ")", ")", ";", "res", "=", "res", ".", "cons", "(", "fun", ".", "info", "(", "ERT", ".", "am_arity", ")", ")", ";", "res", "=", "res", ".", "cons", "(", "fun", ".", "info", "(", "ERT", ".", "am_name", ")", ")", ";", "if", "(", "is_local", ")", "{", "res", "=", "res", ".", "cons", "(", "fun", ".", "info", "(", "ERT", ".", "am_uniq", ")", ")", ";", "res", "=", "res", ".", "cons", "(", "fun", ".", "info", "(", "ERT", ".", "am_index", ")", ")", ";", "res", "=", "res", ".", "cons", "(", "fun", ".", "info", "(", "ERT", ".", "am_new_uniq", ")", ")", ";", "res", "=", "res", ".", "cons", "(", "fun", ".", "info", "(", "ERT", ".", "am_new_index", ")", ")", ";", "}", "res", "=", "res", ".", "cons", "(", "fun", ".", "info", "(", "ERT", ".", "am_module", ")", ")", ";", "if", "(", "is_local", ")", "{", "res", "=", "res", ".", "cons", "(", "fun", ".", "info", "(", "ERT", ".", "am_pid", ")", ")", ";", "}", "return", "res", ";", "}", "@", "BIF", "public", "static", "EFun", "make_fun", "(", "EObject", "m", ",", "EObject", "f", ",", "EObject", "a", ")", "{", "EAtom", "mod", "=", "m", ".", "testAtom", "(", ")", ";", "EAtom", "fun", "=", "f", ".", "testAtom", "(", ")", ";", "ESmall", "arity", "=", "a", ".", "testSmall", "(", ")", ";", "if", "(", "mod", "==", "null", "||", "fun", "==", "null", "||", "arity", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "m", ",", "f", ",", "a", ")", ";", "}", "return", "EModuleManager", ".", "resolve", "(", "new", "FunID", "(", "mod", ",", "fun", ",", "arity", ".", "value", ")", ")", ";", "}", "}", "</s>" ]
7,806
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ECons", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ERT", ";", "import", "java", ".", "util", ".", "LinkedList", ";", "public", "class", "ErlList", "{", "@", "BIF", "(", "name", "=", "\"--\"", ")", "public", "static", "ECons", "listDiff", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "ESeq", "l1", ",", "l2", ";", "if", "(", "(", "l1", "=", "a1", ".", "testSeq", "(", ")", ")", "==", "null", "||", "(", "l2", "=", "a2", ".", "testSeq", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "a1", ",", "a2", ")", ";", "if", "(", "l1", ".", "isNil", "(", ")", ")", "return", "l1", ";", "final", "EObject", "[", "]", "tmp", "=", "l1", ".", "toArray", "(", ")", ";", "int", "tmp_start", "=", "0", ";", "for", "(", "ESeq", "cur", "=", "l2", ";", "!", "cur", ".", "isNil", "(", ")", ";", "cur", "=", "cur", ".", "tail", "(", ")", ")", "{", "EObject", "elm", "=", "cur", ".", "head", "(", ")", ";", "for", "(", "int", "i", "=", "tmp_start", ";", "i", "<", "tmp", ".", "length", ";", "i", "++", ")", "{", "if", "(", "tmp", "[", "i", "]", "!=", "null", "&&", "tmp", "[", "i", "]", ".", "equalsExactly", "(", "elm", ")", ")", "{", "tmp", "[", "i", "]", "=", "null", ";", "if", "(", "i", "==", "tmp_start", ")", "{", "do", "{", "tmp_start", "++", ";", "}", "while", "(", "tmp_start", "<", "tmp", ".", "length", "&&", "tmp", "[", "tmp_start", "]", "==", "null", ")", ";", "if", "(", "tmp_start", "==", "tmp", ".", "length", ")", "return", "ERT", ".", "NIL", ";", "}", "break", ";", "}", "}", "}", "return", "ESeq", ".", "fromArraySkippingNulls", "(", "tmp", ",", "tmp_start", ",", "tmp", ".", "length", ")", ";", "}", "}", "</s>" ]
7,807
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "OutputStream", ";", "import", "java", ".", "math", ".", "BigInteger", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EBinary", ";", "import", "erjang", ".", "EBitString", ";", "import", "erjang", ".", "ECons", ";", "import", "erjang", ".", "EExternal", ";", "import", "erjang", ".", "EInputStream", ";", "import", "erjang", ".", "EInteger", ";", "import", "erjang", ".", "EDouble", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EOutputStream", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "EString", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ERef", ";", "import", "erjang", ".", "ETuple2", ";", "import", "erjang", ".", "ErlangError", ";", "import", "erjang", ".", "NotImplemented", ";", "import", "erjang", ".", "driver", ".", "IO", ";", "public", "class", "ErlConvert", "{", "private", "static", "final", "ESmall", "PLUS_SIGN", "=", "ERT", ".", "box", "(", "(", "int", ")", "'+'", ")", ";", "private", "static", "final", "EAtom", "am_compressed", "=", "EAtom", ".", "intern", "(", "\"compressed\"", ")", ";", "private", "static", "final", "EAtom", "am_minor_version", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "@", "BIF", "public", "static", "EObject", "binary_to_term", "(", "EObject", "arg", ")", "{", "EBinary", "bin", ";", "if", "(", "(", "bin", "=", "arg", ".", "testBinary", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "arg", ")", ";", "EInputStream", "in", "=", "bin", ".", "getInputStream", "(", ")", ";", "try", "{", "EObject", "val", "=", "in", ".", "read_any", "(", ")", ";", "return", "val", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "ErlangError", "(", "ERT", ".", "am_badarg", ",", "e", ",", "arg", ")", ";", "}", "}", "@", "BIF", "public", "static", "EBinary", "term_to_binary", "(", "EObject", "obj", ")", "{", "EOutputStream", "eos", "=", "new", "EOutputStream", "(", ")", ";", "eos", ".", "write", "(", "EExternal", ".", "versionTag", ")", ";", "eos", ".", "write_any", "(", "obj", ")", ";", "return", "eos", ".", "getBinaryContent", "(", ")", ";", "}", "@", "BIF", "public", "static", "ESmall", "external_size", "(", "EObject", "obj", ")", "{", "EBinary", "bin", "=", "term_to_binary", "(", "obj", ")", ";", "return", "ERT", ".", "box", "(", "bin", ".", "byteSize", "(", ")", ")", ";", "}", "@", "BIF", "static", "ETuple2", "split_binary", "(", "EObject", "bin", ",", "EObject", "idx", ")", "{", "EBitString", "b", ";", "ESmall", "i", ";", "if", "(", "(", "b", "=", "bin", ".", "testBitString", "(", ")", ")", "==", "null", "||", "(", "(", "i", "=", "idx", ".", "testSmall", "(", ")", ")", "==", "null", ")", "||", "i", ".", "value", "<", "0", "||", "i", ".", "value", ">", "b", ".", "byteSize", "(", ")", ")", "{", "throw", "ERT", ".", "badarg", "(", "bin", ")", ";", "}", "long", "split", "=", "i", ".", "value", "*", "8", ";", "return", "new", "ETuple2", "(", "b", ".", "substring", "(", "0", ",", "split", ")", ",", "b", ".", "substring", "(", "split", ")", ")", ";", "}", "@", "BIF", "public", "static", "ESeq", "fun_to_list", "(", "EObject", "fun", ")", "{", "return", "EString", ".", "fromString", "(", "fun", ".", "toString", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "EBinary", "term_to_binary", "(", "EObject", "obj", ",", "EObject", "spec", ")", "{", "int", "compression", "=", "0", ";", "int", "minor", "=", "0", ";", "ESeq", "opts", ";", "if", "(", "(", "opts", "=", "spec", ".", "testSeq", "(", ")", ")", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "obj", ",", "spec", ")", ";", "}", "while", "(", "!", "opts", ".", "isNil", "(", ")", ")", "{", "EObject", "val", "=", "opts", ".", "head", "(", ")", ";", "ETuple2", "tup", ";", "if", "(", "val", "==", "am_compressed", ")", "{", "compression", "=", "6", ";", "}", "else", "if", "(", "(", "tup", "=", "ETuple2", ".", "cast", "(", "val", ")", ")", "!=", "null", ")", "{", "if", "(", "tup", ".", "elem1", "==", "am_compressed", ")", "{", "ESmall", "sm", ";", "if", "(", "(", "sm", "=", "tup", ".", "elem2", ".", "testSmall", "(", ")", ")", "!=", "null", ")", "{", "compression", "=", "sm", ".", "value", ";", "}", "else", "{", "throw", "ERT", ".", "badarg", "(", "obj", ",", "spec", ")", ";", "}", "}", "else", "if", "(", "tup", ".", "elem1", "==", "am_minor_version", ")", "{", "ESmall", "sm", ";", "if", "(", "(", "sm", "=", "tup", ".", "elem2", ".", "testSmall", "(", ")", ")", "!=", "null", ")", "{", "minor", "=", "sm", ".", "value", ";", "}", "else", "{", "throw", "ERT", ".", "badarg", "(", "obj", ",", "spec", ")", ";", "}", "}", "}", "else", "{", "throw", "ERT", ".", "badarg", "(", "obj", ",", "spec", ")", ";", "}", "opts", "=", "opts", ".", "tail", "(", ")", ";", "}", "if", "(", "compression", "<", "0", "||", "compression", ">", "9", "||", "minor", "<", "0", "||", "minor", ">", "1", ")", "{", "throw", "ERT", ".", "badarg", "(", "obj", ",", "spec", ")", ";", "}", "if", "(", "minor", "==", "0", ")", "{", "throw", "new", "NotImplemented", "(", "\"\"", ")", ";", "}", "EOutputStream", "eos", "=", "new", "EOutputStream", "(", ")", ";", "eos", ".", "write", "(", "EExternal", ".", "versionTag", ")", ";", "if", "(", "compression", "!=", "0", ")", "{", "eos", ".", "write_compressed", "(", "obj", ",", "compression", ")", ";", "}", "else", "{", "eos", ".", "write_any", "(", "obj", ")", ";", "}", "return", "eos", ".", "getBinaryContent", "(", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "list_to_existing_atom", "(", "EObject", "obj", ")", "{", "EString", "seq", ";", "if", "(", "(", "seq", "=", "obj", ".", "testString", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "return", "EAtom", ".", "existing_atom", "(", "seq", ".", "stringValue", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "EInteger", "list_to_integer", "(", "EObject", "obj", ")", "{", "EString", "seq", ";", "if", "(", "(", "seq", "=", "obj", ".", "testString", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "if", "(", "!", "seq", ".", "isNil", "(", ")", ")", "{", "if", "(", "seq", ".", "head", "(", ")", ".", "equalsExactly", "(", "PLUS_SIGN", ")", ")", "{", "seq", "=", "seq", ".", "tail", "(", ")", ".", "testString", "(", ")", ";", "if", "(", "seq", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "}", "}", "}", "try", "{", "BigInteger", "val", "=", "new", "BigInteger", "(", "seq", ".", "stringValue", "(", ")", ")", ";", "return", "ERT", ".", "box", "(", "val", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "}", "}", "@", "BIF", "public", "static", "EDouble", "list_to_float", "(", "EObject", "obj", ")", "{", "EString", "seq", ";", "if", "(", "(", "seq", "=", "obj", ".", "testString", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "String", "string", "=", "seq", ".", "stringValue", "(", ")", ";", "if", "(", "string", ".", "length", "(", ")", "==", "0", "||", "string", ".", "charAt", "(", "0", ")", "==", "'.'", "||", "string", ".", "charAt", "(", "string", ".", "length", "(", ")", "-", "1", ")", "==", "'.'", "||", "string", ".", "indexOf", "(", "'.'", ")", "==", "-", "1", ")", "{", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "}", "try", "{", "double", "val", "=", "Double", ".", "parseDouble", "(", "string", ")", ";", "return", "ERT", ".", "box", "(", "val", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "}", "}", "@", "BIF", "public", "static", "ETuple", "list_to_tuple", "(", "EObject", "obj", ")", "{", "ESeq", "seq", ";", "if", "(", "(", "seq", "=", "obj", ".", "testSeq", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "return", "ETuple", ".", "make", "(", "seq", ".", "toArray", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "EString", "binary_to_list", "(", "EObject", "obj", ")", "{", "EBinary", "bin", "=", "obj", ".", "testBinary", "(", ")", ";", "if", "(", "bin", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "return", "EString", ".", "make", "(", "bin", ")", ";", "}", "@", "BIF", "public", "static", "EString", "binary_to_list", "(", "EObject", "obj", ",", "EObject", "start", ",", "EObject", "stop", ")", "{", "EBinary", "bin", "=", "obj", ".", "testBinary", "(", ")", ";", "ESmall", "s", "=", "start", ".", "testSmall", "(", ")", ";", "ESmall", "e", "=", "stop", ".", "testSmall", "(", ")", ";", "if", "(", "bin", "==", "null", "||", "s", "==", "null", "||", "e", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "obj", ",", "start", ",", "stop", ")", ";", "int", "idx0start", "=", "s", ".", "value", "-", "1", ";", "int", "len", "=", "e", ".", "value", "-", "s", ".", "value", "+", "1", ";", "if", "(", "idx0start", "<", "0", "||", "len", "<", "0", "||", "(", "idx0start", "+", "len", ")", ">", "bin", ".", "byteSize", "(", ")", ")", "throw", "ERT", ".", "badarg", "(", "obj", ",", "start", ",", "stop", ")", ";", "return", "EString", ".", "make", "(", "bin", ",", "idx0start", ",", "len", ")", ";", "}", "static", "private", "class", "BARR", "extends", "ByteArrayOutputStream", "{", "EBinary", "asBinary", "(", ")", "{", "return", "new", "EBinary", "(", "super", ".", "buf", ",", "0", ",", "super", ".", "count", ")", ";", "}", "}", "@", "BIF", "public", "static", "EBitString", "iolist_to_binary", "(", "EObject", "list", ")", "{", "EBitString", "bin", "=", "list", ".", "testBitString", "(", ")", ";", "if", "(", "bin", "!=", "null", ")", "return", "bin", ";", "ECons", "iol", "=", "list", ".", "testCons", "(", ")", ";", "if", "(", "iol", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "list", ")", ";", "if", "(", "iol", ".", "isNil", "(", ")", ")", "{", "return", "EBinary", ".", "EMPTY", ";", "}", "BARR", "barr", "=", "new", "BARR", "(", ")", ";", "try", "{", "collectList", "(", "list", ",", "iol", ",", "barr", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "InternalError", "(", ")", ";", "}", "return", "barr", ".", "asBinary", "(", ")", ";", "}", "private", "static", "void", "collectList", "(", "EObject", "list", ",", "ECons", "iol", ",", "OutputStream", "barr", ")", "throws", "IOException", "{", "EObject", "tail", ";", "ECons", "cons", ";", "for", "(", "tail", "=", "iol", ";", "(", "cons", "=", "tail", ".", "testNonEmptyList", "(", ")", ")", "!=", "null", ";", "tail", "=", "cons", ".", "tail", "(", ")", ")", "{", "EObject", "hd", "=", "cons", ".", "head", "(", ")", ";", "ESmall", "sm", ";", "EBinary", "bi", ";", "ECons", "co", ";", "if", "(", "(", "sm", "=", "hd", ".", "testSmall", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "sm", ".", "value", "<", "0", "||", "sm", ".", "value", ">", "255", ")", "throw", "ERT", ".", "badarg", "(", "list", ")", ";", "barr", ".", "write", "(", "sm", ".", "value", ")", ";", "}", "else", "if", "(", "(", "bi", "=", "hd", ".", "testBinary", "(", ")", ")", "!=", "null", ")", "{", "bi", ".", "writeTo", "(", "barr", ")", ";", "}", "else", "if", "(", "(", "co", "=", "hd", ".", "testNonEmptyList", "(", ")", ")", "!=", "null", ")", "{", "collectList", "(", "list", ",", "co", ",", "barr", ")", ";", "}", "else", "if", "(", "hd", ".", "isNil", "(", ")", ")", "{", "}", "else", "{", "throw", "ERT", ".", "badarg", "(", "list", ")", ";", "}", "}", "EBinary", "bi", ";", "if", "(", "(", "bi", "=", "tail", ".", "testBinary", "(", ")", ")", "!=", "null", ")", "{", "try", "{", "bi", ".", "writeTo", "(", "barr", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "InternalError", "(", "\"\"", ")", ";", "}", "}", "else", "if", "(", "!", "tail", ".", "isNil", "(", ")", ")", "{", "throw", "ERT", ".", "badarg", "(", "list", ")", ";", "}", "}", "public", "static", "void", "collectList", "(", "EObject", "list", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "ECons", "iol", "=", "list", ".", "testCons", "(", ")", ";", "if", "(", "iol", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "list", ")", ";", "if", "(", "iol", ".", "isNil", "(", ")", ")", "{", "return", ";", "}", "collectList", "(", "list", ",", "iol", ",", "out", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "tuple_to_list", "(", "EObject", "tup", ")", "{", "ETuple", "t", ";", "if", "(", "(", "t", "=", "tup", ".", "testTuple", "(", ")", ")", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "tup", ")", ";", "}", "ESeq", "res", "=", "ERT", ".", "NIL", ";", "for", "(", "int", "i", "=", "t", ".", "arity", "(", ")", ";", "i", ">", "0", ";", "i", "--", ")", "{", "EObject", "e", "=", "t", ".", "elm", "(", "i", ")", ";", "res", "=", "res", ".", "cons", "(", "e", "==", "null", "?", "ERT", ".", "NIL", ":", "e", ")", ";", "}", "return", "res", ";", "}", "@", "BIF", "public", "static", "EString", "ref_to_list", "(", "EObject", "obj", ")", "{", "ERef", "ref", "=", "obj", ".", "testReference", "(", ")", ";", "if", "(", "ref", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "return", "new", "EString", "(", "ref", ".", "toString", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "EBinary", "atom_to_binary", "(", "EObject", "obj", ",", "EObject", "enc", ")", "{", "EAtom", "am", "=", "obj", ".", "testAtom", "(", ")", ";", "EAtom", "en", "=", "enc", ".", "testAtom", "(", ")", ";", "if", "(", "am", "==", "null", "||", "en", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "obj", ",", "enc", ")", ";", "}", "byte", "[", "]", "data", ";", "String", "str", "=", "am", ".", "getName", "(", ")", ";", "if", "(", "en", "==", "ERT", ".", "am_latin1", ")", "{", "data", "=", "str", ".", "getBytes", "(", "IO", ".", "ISO_LATIN_1", ")", ";", "}", "else", "if", "(", "en", "==", "ERT", ".", "am_utf8", "||", "en", "==", "ERT", ".", "am_unicode", ")", "{", "data", "=", "str", ".", "getBytes", "(", "IO", ".", "UTF8", ")", ";", "}", "else", "{", "throw", "ERT", ".", "badarg", "(", "obj", ",", "enc", ")", ";", "}", "return", "new", "EBinary", "(", "data", ")", ";", "}", "}", "</s>" ]
7,808
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "public", "interface", "EDist", "{", "public", "static", "final", "int", "DFLAG_PUBLISHED", "=", "0x01", ";", "public", "static", "final", "int", "DFLAG_ATOM_CACHE", "=", "0x02", ";", "public", "static", "final", "int", "DFLAG_EXTENDED_REFERENCES", "=", "0x04", ";", "public", "static", "final", "int", "DFLAG_DIST_MONITOR", "=", "0x08", ";", "public", "static", "final", "int", "DFLAG_FUN_TAGS", "=", "0x10", ";", "public", "static", "final", "int", "DFLAG_DIST_MONITOR_NAME", "=", "0x20", ";", "public", "static", "final", "int", "DFLAG_HIDDEN_ATOM_CACHE", "=", "0x40", ";", "public", "static", "final", "int", "DFLAG_NEW_FUN_TAGS", "=", "0x80", ";", "public", "static", "final", "int", "DFLAG_EXTENDED_PIDS_PORTS", "=", "0x100", ";", "public", "static", "final", "int", "DFLAG_EXPORT_PTR_TAG", "=", "0x200", ";", "public", "static", "final", "int", "DFLAG_BIT_BINARIES", "=", "0x400", ";", "public", "static", "final", "int", "DFLAG_NEW_FLOATS", "=", "0x800", ";", "public", "static", "final", "int", "DFLAG_UNICODE_IO", "=", "0x1000", ";", "public", "static", "final", "int", "DFLAG_DIST_HDR_ATOM_CACHE", "=", "0x2000", ";", "public", "static", "final", "int", "DFLAG_SMALL_ATOM_TAGS", "=", "0x4000", ";", "public", "static", "final", "int", "TERM_TO_BINARY_DFLAGS", "=", "(", "DFLAG_EXTENDED_REFERENCES", "|", "DFLAG_NEW_FUN_TAGS", "|", "DFLAG_EXTENDED_PIDS_PORTS", "|", "DFLAG_EXPORT_PTR_TAG", "|", "DFLAG_BIT_BINARIES", ")", ";", "public", "static", "final", "int", "DOP_LINK", "=", "1", ";", "public", "static", "final", "int", "DOP_SEND", "=", "2", ";", "public", "static", "final", "int", "DOP_EXIT", "=", "3", ";", "public", "static", "final", "int", "DOP_UNLINK", "=", "4", ";", "public", "static", "final", "int", "DOP_NODE_LINK", "=", "5", ";", "public", "static", "final", "int", "DOP_REG_SEND", "=", "6", ";", "public", "static", "final", "int", "DOP_GROUP_LEADER", "=", "7", ";", "public", "static", "final", "int", "DOP_EXIT2", "=", "8", ";", "public", "static", "final", "int", "DOP_SEND_TT", "=", "12", ";", "public", "static", "final", "int", "DOP_EXIT_TT", "=", "13", ";", "public", "static", "final", "int", "DOP_REG_SEND_TT", "=", "16", ";", "public", "static", "final", "int", "DOP_EXIT2_TT", "=", "18", ";", "public", "static", "final", "int", "DOP_MONITOR_P", "=", "19", ";", "public", "static", "final", "int", "DOP_DEMONITOR_P", "=", "20", ";", "public", "static", "final", "int", "DOP_MONITOR_P_EXIT", "=", "21", ";", "}", "</s>" ]
7,809
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "import", "erjang", ".", "ENative", ";", "import", "erjang", ".", "ERT", ";", "public", "class", "Native", "extends", "ENative", "{", "@", "Override", "public", "Class", "<", "?", ">", "[", "]", "getNativeClasses", "(", ")", "{", "return", "new", "Class", "[", "]", "{", "BinOps", ".", "class", ",", "ErlBif", ".", "class", ",", "ErlProc", ".", "class", ",", "ErlList", ".", "class", ",", "ErlConvert", ".", "class", ",", "ErlPort", ".", "class", ",", "ErlHash", ".", "class", ",", "ErlDist", ".", "class", ",", "ErlFun", ".", "class", ",", "ERT", ".", "class", "}", ";", "}", "}", "</s>" ]
7,810
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "concurrent", ".", "ConcurrentHashMap", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EInternalPort", ";", "public", "class", "DistEntry", "{", "static", "Map", "<", "EAtom", ",", "DistEntry", ">", "table", "=", "new", "ConcurrentHashMap", "<", "EAtom", ",", "DistEntry", ">", "(", ")", ";", "static", "{", "}", "private", "final", "EAtom", "sysname", ";", "private", "final", "EInternalPort", "cid", ";", "public", "int", "flags", ";", "public", "DistEntry", "(", "EAtom", "sysname", ",", "EInternalPort", "cid", ")", "{", "this", ".", "sysname", "=", "sysname", ";", "this", ".", "cid", "=", "cid", ";", "table", ".", "put", "(", "sysname", ",", "this", ")", ";", "}", "static", "DistEntry", "find", "(", "EAtom", "sysname", ")", "{", "return", "table", ".", "get", "(", "sysname", ")", ";", "}", "static", "DistEntry", "find_or_insert", "(", "EAtom", "sysname", ")", "{", "DistEntry", "ent", "=", "table", ".", "get", "(", "sysname", ")", ";", "if", "(", "ent", "==", "null", ")", "{", "return", "new", "DistEntry", "(", "sysname", ",", "null", ")", ";", "}", "else", "{", "return", "ent", ";", "}", "}", "static", "DistEntry", "sysname_to_connected_dist_entry", "(", "EAtom", "sysname", ")", "{", "DistEntry", "ent", "=", "table", ".", "get", "(", "sysname", ")", ";", "if", "(", "ent", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "ent", ".", "cid", "==", "null", "?", "null", ":", "ent", ";", "}", "}", "}", "</s>" ]
7,811
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "import", "java", ".", "lang", ".", "management", ".", "GarbageCollectorMXBean", ";", "import", "java", ".", "lang", ".", "management", ".", "ManagementFactory", ";", "import", "java", ".", "lang", ".", "management", ".", "RuntimeMXBean", ";", "import", "java", ".", "math", ".", "BigDecimal", ";", "import", "java", ".", "nio", ".", "ByteBuffer", ";", "import", "java", ".", "security", ".", "MessageDigest", ";", "import", "java", ".", "security", ".", "NoSuchAlgorithmException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Calendar", ";", "import", "java", ".", "util", ".", "GregorianCalendar", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "TimeZone", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "java", ".", "util", ".", "concurrent", ".", "atomic", ".", "AtomicLong", ";", "import", "java", ".", "util", ".", "concurrent", ".", "atomic", ".", "AtomicStampedReference", ";", "import", "kilim", ".", "Pausable", ";", "import", "kilim", ".", "Task", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EBinary", ";", "import", "erjang", ".", "EBitString", ";", "import", "erjang", ".", "ECons", ";", "import", "erjang", ".", "EDouble", ";", "import", "erjang", ".", "EFun", ";", "import", "erjang", ".", "EInteger", ";", "import", "erjang", ".", "EModuleManager", ";", "import", "erjang", ".", "ENode", ";", "import", "erjang", ".", "ENumber", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EPID", ";", "import", "erjang", ".", "EPeer", ";", "import", "erjang", ".", "EPort", ";", "import", "erjang", ".", "EProc", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "EString", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ETuple2", ";", "import", "erjang", ".", "ETuple3", ";", "import", "erjang", ".", "ErlangError", ";", "import", "erjang", ".", "ErlangException", ";", "import", "erjang", ".", "ErlangRaise", ";", "import", "erjang", ".", "ErlangThrow", ";", "import", "erjang", ".", "FunID", ";", "import", "erjang", ".", "Module", ";", "import", "erjang", ".", "NotImplemented", ";", "import", "erjang", ".", "BIF", ".", "Type", ";", "import", "erjang", ".", "m", ".", "java", ".", "JavaObject", ";", "@", "Module", "(", "\"erlang\"", ")", "public", "class", "ErlBif", "{", "private", "static", "final", "TimeZone", "UTC_TIME_ZONE", "=", "TimeZone", ".", "getTimeZone", "(", "\"UTC\"", ")", ";", "private", "static", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erlang\"", ")", ";", "private", "static", "EAtom", "am_wall_clock", "=", "EAtom", ".", "intern", "(", "\"wall_clock\"", ")", ";", "private", "static", "EAtom", "am_reductions", "=", "EAtom", ".", "intern", "(", "\"reductions\"", ")", ";", "private", "static", "EAtom", "am_garbage_collection", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "EAtom", "am_runtime", "=", "EAtom", ".", "intern", "(", "\"runtime\"", ")", ";", "private", "static", "final", "EAtom", "am_run_queue", "=", "EAtom", ".", "intern", "(", "\"run_queue\"", ")", ";", "@", "BIF", "static", "EObject", "apply", "(", "EProc", "proc", ",", "EObject", "fun", ",", "EObject", "args", ")", "throws", "Pausable", "{", "ESeq", "a", "=", "args", ".", "testSeq", "(", ")", ";", "if", "(", "a", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "fun", ",", "args", ")", ";", "EObject", "res", ";", "EFun", "f", "=", "fun", ".", "testFunction", "(", ")", ";", "if", "(", "f", "!=", "null", ")", "{", "res", "=", "apply_last", "(", "proc", ",", "f", ",", "a", ")", ";", "}", "else", "{", "ETuple", "t", "=", "fun", ".", "testTuple", "(", ")", ";", "if", "(", "t", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "fun", ",", "args", ")", ";", "}", "ETuple2", "t2", "=", "ETuple2", ".", "cast", "(", "t", ")", ";", "if", "(", "t2", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "fun", ",", "args", ")", ";", "}", "EAtom", "mn", "=", "t2", ".", "elem1", ".", "testAtom", "(", ")", ";", "EAtom", "fn", "=", "t2", ".", "elem2", ".", "testAtom", "(", ")", ";", "FunID", "funspec", ";", "f", "=", "EModuleManager", ".", "resolve", "(", "funspec", "=", "new", "FunID", "(", "mn", ",", "fn", ",", "a", ".", "length", "(", ")", ")", ")", ";", "if", "(", "f", "==", "null", ")", "{", "throw", "ERT", ".", "undef", "(", "funspec", ",", "a", ".", "toArray", "(", ")", ")", ";", "}", "res", "=", "apply_last", "(", "proc", ",", "f", ",", "a", ")", ";", "}", "while", "(", "res", "==", "EProc", ".", "TAIL_MARKER", ")", "{", "res", "=", "proc", ".", "tail", ".", "go", "(", "proc", ")", ";", "}", "return", "res", ";", "}", "@", "BIF", "public", "static", "EBinary", "list_to_binary", "(", "EObject", "val", ")", "{", "EString", "es", ";", "if", "(", "(", "es", "=", "val", ".", "testString", "(", ")", ")", "!=", "null", ")", "{", "return", "es", ".", "asBitString", "(", ")", ";", "}", "ECons", "cons", "=", "val", ".", "testCons", "(", ")", ";", "if", "(", "cons", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "val", ")", ";", "List", "<", "ByteBuffer", ">", "out", "=", "new", "ArrayList", "<", "ByteBuffer", ">", "(", ")", ";", "if", "(", "!", "cons", ".", "collectIOList", "(", "out", ")", ")", "{", "throw", "ERT", ".", "badarg", "(", "val", ")", ";", "}", "if", "(", "out", ".", "size", "(", ")", "==", "1", ")", "{", "ByteBuffer", "b", "=", "out", ".", "get", "(", "0", ")", ";", "return", "EBinary", ".", "make", "(", "b", ")", ";", "}", "int", "length", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "out", ".", "size", "(", ")", ";", "i", "++", ")", "{", "length", "+=", "out", ".", "get", "(", "i", ")", ".", "remaining", "(", ")", ";", "}", "byte", "[", "]", "all", "=", "new", "byte", "[", "length", "]", ";", "int", "pos", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "out", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ByteBuffer", "bb", "=", "out", ".", "get", "(", "i", ")", ";", "int", "len", "=", "bb", ".", "remaining", "(", ")", ";", "bb", ".", "get", "(", "all", ",", "pos", ",", "len", ")", ";", "pos", "+=", "len", ";", "}", "assert", "(", "pos", "==", "length", ")", ";", "return", "new", "EBinary", "(", "all", ")", ";", "}", "@", "BIF", "static", "ESmall", "iolist_size", "(", "EObject", "val", ")", "{", "EBinary", "bin", ";", "if", "(", "(", "bin", "=", "val", ".", "testBinary", "(", ")", ")", "!=", "null", ")", "{", "return", "new", "ESmall", "(", "bin", ".", "byteSize", "(", ")", ")", ";", "}", "EString", "str", ";", "if", "(", "(", "str", "=", "val", ".", "testString", "(", ")", ")", "!=", "null", ")", "{", "return", "new", "ESmall", "(", "str", ".", "length", "(", ")", ")", ";", "}", "ECons", "seq", ";", "if", "(", "(", "seq", "=", "val", ".", "testCons", "(", ")", ")", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "val", ")", ";", "}", "ArrayList", "<", "ByteBuffer", ">", "al", "=", "new", "ArrayList", "<", "ByteBuffer", ">", "(", ")", ";", "seq", ".", "collectIOList", "(", "al", ")", ";", "int", "size", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "al", ".", "size", "(", ")", ";", "i", "++", ")", "{", "size", "+=", "al", ".", "get", "(", "i", ")", ".", "remaining", "(", ")", ";", "}", "return", "new", "ESmall", "(", "size", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "apply", "(", "EProc", "proc", ",", "EObject", "one", ",", "EObject", "two", ",", "EObject", "three", ")", "throws", "Pausable", "{", "EAtom", "mod", "=", "one", ".", "testAtom", "(", ")", ";", "ETuple", "t", "=", "one", ".", "testTuple", "(", ")", ";", "JavaObject", "jo", "=", "one", ".", "testJavaObject", "(", ")", ";", "EAtom", "fun", "=", "two", ".", "testAtom", "(", ")", ";", "ESeq", "args", "=", "three", ".", "testSeq", "(", ")", ";", "if", "(", "(", "mod", "==", "null", "&&", "t", "==", "null", "&&", "jo", "==", "null", ")", "||", "fun", "==", "null", "||", "args", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "one", ",", "two", ",", "three", ")", ";", "EFun", "f", "=", "ERT", ".", "resolve_fun", "(", "one", ",", "fun", ",", "args", ".", "length", "(", ")", ")", ";", "EObject", "res", "=", "apply_last", "(", "proc", ",", "f", ",", "args", ")", ";", "while", "(", "res", "==", "EProc", ".", "TAIL_MARKER", ")", "{", "res", "=", "proc", ".", "tail", ".", "go", "(", "proc", ")", ";", "}", "return", "res", ";", "}", "private", "static", "EObject", "apply_last", "(", "EProc", "proc", ",", "EFun", "fun", ",", "ESeq", "args", ")", "throws", "Pausable", "{", "ESeq", "rargs", "=", "args", ".", "reverse", "(", ")", ";", "int", "len", "=", "args", ".", "length", "(", ")", ";", "switch", "(", "len", ")", "{", "case", "11", ":", "proc", ".", "arg10", "=", "rargs", ".", "head", "(", ")", ";", "rargs", "=", "rargs", ".", "tail", "(", ")", ";", "case", "10", ":", "proc", ".", "arg9", "=", "rargs", ".", "head", "(", ")", ";", "rargs", "=", "rargs", ".", "tail", "(", ")", ";", "case", "9", ":", "proc", ".", "arg8", "=", "rargs", ".", "head", "(", ")", ";", "rargs", "=", "rargs", ".", "tail", "(", ")", ";", "case", "8", ":", "proc", ".", "arg7", "=", "rargs", ".", "head", "(", ")", ";", "rargs", "=", "rargs", ".", "tail", "(", ")", ";", "case", "7", ":", "proc", ".", "arg6", "=", "rargs", ".", "head", "(", ")", ";", "rargs", "=", "rargs", ".", "tail", "(", ")", ";", "case", "6", ":", "proc", ".", "arg5", "=", "rargs", ".", "head", "(", ")", ";", "rargs", "=", "rargs", ".", "tail", "(", ")", ";", "case", "5", ":", "proc", ".", "arg4", "=", "rargs", ".", "head", "(", ")", ";", "rargs", "=", "rargs", ".", "tail", "(", ")", ";", "case", "4", ":", "proc", ".", "arg3", "=", "rargs", ".", "head", "(", ")", ";", "rargs", "=", "rargs", ".", "tail", "(", ")", ";", "case", "3", ":", "proc", ".", "arg2", "=", "rargs", ".", "head", "(", ")", ";", "rargs", "=", "rargs", ".", "tail", "(", ")", ";", "case", "2", ":", "proc", ".", "arg1", "=", "rargs", ".", "head", "(", ")", ";", "rargs", "=", "rargs", ".", "tail", "(", ")", ";", "case", "1", ":", "proc", ".", "arg0", "=", "rargs", ".", "head", "(", ")", ";", "case", "0", ":", "break", ";", "default", ":", "return", "fun", ".", "apply", "(", "proc", ",", "args", ")", ";", "}", "proc", ".", "tail", "=", "fun", ";", "return", "EProc", ".", "TAIL_MARKER", ";", "}", "@", "BIF", "static", "public", "EPID", "self", "(", "EProc", "proc", ")", "{", "if", "(", "proc", "==", "null", ")", "{", "log", ".", "severe", "(", "\"\"", ")", ";", "}", "return", "proc", ".", "self_handle", "(", ")", ";", "}", "private", "static", "final", "AtomicStampedReference", "<", "ETuple", ">", "cachedDate", "=", "new", "AtomicStampedReference", "(", "null", ",", "0", ")", ";", "static", "final", "int", "MILLIS_PER_MINUTE", "=", "60", "*", "1000", ";", "@", "BIF", "static", "public", "ETuple", "date", "(", ")", "{", "long", "millis", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "int", "curMinutes", "=", "(", "int", ")", "(", "millis", "/", "MILLIS_PER_MINUTE", ")", ";", "int", "[", "]", "cacheValidUntilMinutes", "=", "new", "int", "[", "1", "]", ";", "ETuple", "cachedResult", "=", "cachedDate", ".", "get", "(", "cacheValidUntilMinutes", ")", ";", "if", "(", "curMinutes", "<", "cacheValidUntilMinutes", "[", "0", "]", "&&", "cachedResult", "!=", "null", ")", "{", "return", "cachedResult", ";", "}", "GregorianCalendar", "cal", "=", "new", "GregorianCalendar", "(", ")", ";", "int", "year", "=", "cal", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "int", "month", "=", "cal", ".", "get", "(", "Calendar", ".", "MONTH", ")", "+", "1", ";", "int", "day", "=", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ";", "ETuple", "result", "=", "ETuple", ".", "make", "(", "ERT", ".", "box", "(", "year", ")", ",", "ERT", ".", "box", "(", "month", ")", ",", "ERT", ".", "box", "(", "day", ")", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "1", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "0", ")", ";", "int", "newValidUntilMinutes", "=", "(", "int", ")", "(", "cal", ".", "getTime", "(", ")", ".", "getTime", "(", ")", "/", "MILLIS_PER_MINUTE", ")", ";", "cachedDate", ".", "weakCompareAndSet", "(", "cachedResult", ",", "result", ",", "cacheValidUntilMinutes", "[", "0", "]", ",", "newValidUntilMinutes", ")", ";", "return", "result", ";", "}", "@", "BIF", "static", "public", "ETuple", "time", "(", ")", "{", "GregorianCalendar", "cal", "=", "new", "GregorianCalendar", "(", ")", ";", "int", "hour", "=", "cal", ".", "get", "(", "Calendar", ".", "HOUR_OF_DAY", ")", ";", "int", "minute", "=", "cal", ".", "get", "(", "Calendar", ".", "MINUTE", ")", ";", "int", "second", "=", "cal", ".", "get", "(", "Calendar", ".", "SECOND", ")", ";", "return", "ETuple", ".", "make", "(", "ERT", ".", "box", "(", "hour", ")", ",", "ERT", ".", "box", "(", "minute", ")", ",", "ERT", ".", "box", "(", "second", ")", ")", ";", "}", "@", "BIF", "static", "public", "EString", "integer_to_list", "(", "EObject", "obj", ")", "{", "EInteger", "num", ";", "if", "(", "(", "num", "=", "obj", ".", "testInteger", "(", ")", ")", "!=", "null", ")", "{", "return", "new", "EString", "(", "num", ".", "toString", "(", ")", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "}", "@", "BIF", "static", "public", "EAtom", "list_to_atom", "(", "EObject", "obj", ")", "{", "EString", "es", ";", "if", "(", "(", "es", "=", "obj", ".", "testString", "(", ")", ")", "!=", "null", ")", "{", "return", "EAtom", ".", "intern", "(", "es", ".", "stringValue", "(", ")", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "}", "@", "BIF", "static", "public", "EPID", "list_to_pid", "(", "EObject", "obj", ")", "{", "ECons", "list", ";", "if", "(", "(", "list", "=", "obj", ".", "testCons", "(", ")", ")", "!=", "null", ")", "{", "ESeq", "s", "=", "EString", ".", "make", "(", "list", ")", ";", "return", "ERT", ".", "loopkup_pid", "(", "s", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "}", "@", "BIF", "static", "public", "EString", "pid_to_list", "(", "EObject", "obj", ")", "{", "EPID", "pid", ";", "if", "(", "(", "pid", "=", "obj", ".", "testPID", "(", ")", ")", "!=", "null", ")", "{", "return", "pid", ".", "getName", "(", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "}", "@", "BIF", "static", "public", "EString", "port_to_list", "(", "EObject", "obj", ")", "{", "EPort", "port", ";", "if", "(", "(", "port", "=", "obj", ".", "testPort", "(", ")", ")", "!=", "null", ")", "{", "return", "port", ".", "getName", "(", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "}", "@", "BIF", "static", "public", "EString", "float_to_list", "(", "EObject", "obj", ")", "{", "EDouble", "value", ";", "if", "(", "(", "value", "=", "obj", ".", "testFloat", "(", ")", ")", "!=", "null", ")", "{", "return", "value", ".", "to_list", "(", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "obj", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "error", "(", "EObject", "reason", ")", "{", "throw", "new", "ErlangError", "(", "reason", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "error", "(", "EObject", "reason", ",", "EObject", "args", ")", "{", "ESeq", "aseq", "=", "args", ".", "testSeq", "(", ")", ";", "if", "(", "aseq", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "reason", ",", "args", ")", ";", "throw", "new", "ErlangError", "(", "reason", ",", "aseq", ".", "toArray", "(", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"throw\"", ")", "static", "public", "EObject", "throw_ex", "(", "EObject", "reason", ")", "{", "throw", "new", "ErlangThrow", "(", "reason", ")", ";", "}", "@", "BIF", "static", "public", "ESeq", "get_module_info", "(", "EObject", "mod", ")", "{", "ESeq", "res", "=", "ERT", ".", "NIL", ";", "res", "=", "res", ".", "cons", "(", "new", "ETuple2", "(", "ERT", ".", "am_attributes", ",", "get_module_info", "(", "mod", ",", "ERT", ".", "am_attributes", ")", ")", ")", ";", "res", "=", "res", ".", "cons", "(", "new", "ETuple2", "(", "ERT", ".", "am_exports", ",", "get_module_info", "(", "mod", ",", "ERT", ".", "am_exports", ")", ")", ")", ";", "return", "res", ";", "}", "@", "BIF", "static", "public", "EObject", "get_module_info", "(", "EObject", "mod", ",", "EObject", "key", ")", "{", "EAtom", "m", "=", "mod", ".", "testAtom", "(", ")", ";", "EAtom", "k", "=", "key", ".", "testAtom", "(", ")", ";", "if", "(", "m", "==", "null", "||", "k", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "mod", ",", "key", ")", ";", "}", "if", "(", "k", "==", "ERT", ".", "am_attributes", ")", "{", "return", "EModuleManager", ".", "get_attributes", "(", "m", ")", ";", "}", "if", "(", "k", "==", "ERT", ".", "am_exports", ")", "{", "return", "EModuleManager", ".", "get_exports", "(", "m", ")", ";", "}", "if", "(", "k", "==", "ERT", ".", "am_module", ")", "{", "return", "mod", ";", "}", "return", "ERT", ".", "am_undefined", ";", "}", "public", "static", "final", "String", "[", "]", "PRE_LOADED_MODULES", "=", "new", "String", "[", "]", "{", "\"erlang\"", ",", "\"\"", ",", "\"init\"", ",", "\"otp_ring0\"", ",", "\"prim_file\"", ",", "\"prim_inet\"", ",", "\"prim_zip\"", ",", "\"zlib\"", "}", ";", "@", "BIF", "public", "static", "ESeq", "pre_loaded", "(", ")", "{", "ESeq", "res", "=", "ERT", ".", "NIL", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "PRE_LOADED_MODULES", ".", "length", ";", "i", "++", ")", "{", "res", "=", "res", ".", "cons", "(", "EAtom", ".", "intern", "(", "PRE_LOADED_MODULES", "[", "i", "]", ")", ")", ";", "}", "return", "res", ";", "}", "@", "BIF", "public", "static", "EObject", "garbage_collect", "(", ")", "{", "System", ".", "gc", "(", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "public", "static", "EObject", "garbage_collect", "(", "EObject", "pid", ")", "{", "System", ".", "gc", "(", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "static", "public", "ETuple", "setelement", "(", "EObject", "a1", ",", "EObject", "a2", ",", "EObject", "term", ")", "{", "ETuple", "t", "=", "a2", ".", "testTuple", "(", ")", ";", "ESmall", "i", "=", "a1", ".", "testSmall", "(", ")", ";", "if", "(", "t", "==", "null", "||", "i", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "a1", ",", "a2", ",", "term", ")", ";", "return", "t", ".", "setelement", "(", "i", ".", "value", ",", "term", ")", ";", "}", "@", "BIF", "static", "public", "ETuple", "setelement", "(", "int", "index", ",", "ETuple", "a2", ",", "EObject", "term", ")", "{", "return", "a2", ".", "setelement", "(", "index", ",", "term", ")", ";", "}", "@", "BIF", "static", "public", "ETuple", "setelement", "(", "ESmall", "index", ",", "ETuple", "a2", ",", "EObject", "term", ")", "{", "return", "a2", ".", "setelement", "(", "index", ".", "value", ",", "term", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"element\"", ")", "static", "public", "EObject", "element$g", "(", "EObject", "idx", ",", "EObject", "tup", ")", "{", "ESmall", "i", "=", "idx", ".", "testSmall", "(", ")", ";", "ETuple", "t", "=", "tup", ".", "testTuple", "(", ")", ";", "if", "(", "i", "==", "null", "||", "t", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "i", ".", "value", ">", "t", ".", "arity", "(", ")", ")", "return", "null", ";", "return", "t", ".", "elm", "(", "i", ".", "value", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "element", "(", "EObject", "idx", ",", "EObject", "tup", ")", "{", "ESmall", "i", "=", "idx", ".", "testSmall", "(", ")", ";", "ETuple", "t", "=", "tup", ".", "testTuple", "(", ")", ";", "if", "(", "i", "==", "null", "||", "t", "==", "null", "||", "i", ".", "value", "<", "1", "||", "i", ".", "value", ">", "t", ".", "arity", "(", ")", ")", "{", "throw", "ERT", ".", "badarg", "(", "idx", ",", "tup", ")", ";", "}", "return", "t", ".", "elm", "(", "i", ".", "asInt", "(", ")", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "element", "(", "int", "idx", ",", "ETuple", "tup", ")", "{", "if", "(", "tup", ".", "arity", "(", ")", ">=", "idx", ")", "{", "return", "tup", ".", "elm", "(", "idx", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "new", "ESmall", "(", "idx", ")", ",", "tup", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "element", "(", "ESmall", "sidx", ",", "ETuple", "tup", ")", "{", "int", "idx", "=", "sidx", ".", "value", ";", "if", "(", "tup", ".", "arity", "(", ")", ">=", "idx", ")", "{", "return", "tup", ".", "elm", "(", "idx", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "sidx", ",", "tup", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "element", "(", "int", "idx", ",", "EObject", "obj", ")", "{", "ETuple", "tup", ";", "if", "(", "(", "tup", "=", "obj", ".", "testTuple", "(", ")", ")", "!=", "null", "&&", "tup", ".", "arity", "(", ")", ">=", "idx", ")", "{", "return", "tup", ".", "elm", "(", "idx", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "new", "ESmall", "(", "idx", ")", ",", "obj", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "hd", "(", "ECons", "cell", ")", "{", "return", "cell", ".", "head", "(", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"hd\"", ")", "static", "public", "EObject", "hd$p", "(", "ECons", "cell", ")", "{", "return", "cell", ".", "head", "(", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "hd", "(", "EObject", "cell", ")", "{", "ECons", "cons", ";", "if", "(", "(", "cons", "=", "cell", ".", "testNonEmptyList", "(", ")", ")", "!=", "null", ")", "{", "return", "cons", ".", "head", "(", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "cell", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "tl", "(", "EObject", "cell", ")", "{", "ECons", "cons", ";", "if", "(", "(", "cons", "=", "cell", ".", "testNonEmptyList", "(", ")", ")", "!=", "null", ")", "{", "return", "cons", ".", "tail", "(", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "cell", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"hd\"", ")", "static", "public", "EObject", "hd$p", "(", "EObject", "cell", ")", "{", "ECons", "cons", ";", "if", "(", "(", "cons", "=", "cell", ".", "testNonEmptyList", "(", ")", ")", "!=", "null", ")", "{", "return", "cons", ".", "head", "(", ")", ";", "}", "return", "null", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"tl\"", ")", "static", "public", "EObject", "tl$p", "(", "EObject", "cell", ")", "{", "ECons", "cons", ";", "if", "(", "(", "cons", "=", "cell", ".", "testNonEmptyList", "(", ")", ")", "!=", "null", ")", "{", "return", "cons", ".", "tail", "(", ")", ";", "}", "return", "null", ";", "}", "@", "BIF", "static", "public", "EInteger", "length", "(", "EObject", "list", ")", "{", "ESeq", "seq", ";", "if", "(", "(", "seq", "=", "list", ".", "testSeq", "(", ")", ")", "!=", "null", ")", "{", "return", "ERT", ".", "box", "(", "seq", ".", "length", "(", ")", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "list", ")", ";", "}", "@", "BIF", "static", "public", "int", "length", "(", "ESeq", "list", ")", "{", "return", "list", ".", "length", "(", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"length\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ESmall", "length$p", "(", "EObject", "list", ")", "{", "ESeq", "seq", ";", "if", "(", "(", "seq", "=", "list", ".", "testSeq", "(", ")", ")", "!=", "null", ")", "{", "return", "ERT", ".", "box", "(", "seq", ".", "length", "(", ")", ")", ";", "}", "return", "null", ";", "}", "@", "BIF", "static", "public", "EObject", "whereis", "(", "EProc", "proc", ",", "EObject", "regname", ")", "{", "return", "ERT", ".", "whereis", "(", "regname", ")", ";", "}", "static", "final", "long", "wall_clock0", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "private", "static", "final", "EAtom", "am_total", "=", "EAtom", ".", "intern", "(", "\"total\"", ")", ";", "static", "long", "last_wall_clock", "=", "wall_clock0", ";", "static", "long", "last_reductions", "=", "0", ";", "static", "long", "last_runtime", "=", "0", ";", "@", "BIF", "static", "public", "EObject", "statistics", "(", "EProc", "proc", ",", "EObject", "spec", ")", "{", "if", "(", "spec", "==", "am_wall_clock", ")", "{", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "since_last", "=", "now", "-", "last_wall_clock", ";", "long", "since_epoch", "=", "now", "-", "wall_clock0", ";", "last_wall_clock", "=", "now", ";", "return", "ETuple", ".", "make", "(", "ERT", ".", "box", "(", "since_epoch", ")", ",", "ERT", ".", "box", "(", "since_last", ")", ")", ";", "}", "else", "if", "(", "spec", "==", "am_reductions", ")", "{", "long", "current_reds", "=", "proc", ".", "reds", ";", "long", "since_last", "=", "current_reds", "-", "last_reductions", ";", "last_reductions", "=", "current_reds", ";", "return", "new", "ETuple2", "(", "ERT", ".", "box", "(", "current_reds", ")", ",", "ERT", ".", "box", "(", "since_last", ")", ")", ";", "}", "else", "if", "(", "spec", "==", "am_runtime", ")", "{", "RuntimeMXBean", "b", "=", "ManagementFactory", ".", "getRuntimeMXBean", "(", ")", ";", "long", "current_runtime", "=", "b", ".", "getUptime", "(", ")", ";", "long", "since_last", "=", "current_runtime", "-", "last_runtime", ";", "last_runtime", "=", "current_runtime", ";", "return", "new", "ETuple2", "(", "ERT", ".", "box", "(", "current_runtime", ")", ",", "ERT", ".", "box", "(", "since_last", ")", ")", ";", "}", "else", "if", "(", "spec", "==", "am_garbage_collection", ")", "{", "List", "<", "GarbageCollectorMXBean", ">", "b", "=", "ManagementFactory", ".", "getGarbageCollectorMXBeans", "(", ")", ";", "long", "num_gcs", "=", "0", ";", "long", "time_gcs", "=", "0", ";", "for", "(", "GarbageCollectorMXBean", "bb", ":", "b", ")", "{", "num_gcs", "+=", "bb", ".", "getCollectionCount", "(", ")", ";", "time_gcs", "+=", "bb", ".", "getCollectionTime", "(", ")", ";", "}", "return", "ETuple", ".", "make", "(", "ERT", ".", "box", "(", "num_gcs", ")", ",", "ERT", ".", "box", "(", "time_gcs", ")", ",", "ERT", ".", "box", "(", "0", ")", ")", ";", "}", "else", "if", "(", "spec", "==", "am_run_queue", ")", "{", "return", "ERT", ".", "box", "(", "0", ")", ";", "}", "throw", "new", "NotImplemented", "(", "\"\"", "+", "spec", "+", "\")\"", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "put", "(", "EProc", "proc", ",", "EObject", "key", ",", "EObject", "value", ")", "{", "return", "proc", ".", "put", "(", "key", ",", "value", ")", ";", "}", "@", "BIF", "static", "public", "EString", "name", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "throw", "new", "NotImplemented", "(", ")", ";", "}", "@", "BIF", "static", "public", "ECons", "get", "(", "EProc", "proc", ")", "{", "return", "proc", ".", "get", "(", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "get", "(", "EProc", "proc", ",", "EObject", "key", ")", "{", "return", "proc", ".", "get", "(", "key", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "ARITHBIF", ")", "static", "public", "double", "fdiv", "(", "double", "v1", ",", "double", "v2", ")", "{", "test_zero", "(", "v1", ",", "v2", ")", ";", "return", "v1", "/", "v2", ";", "}", "private", "static", "void", "test_zero", "(", "double", "v1", ",", "double", "v2", ")", "{", "if", "(", "v2", "==", "0.0", ")", "throw", "new", "ErlangError", "(", "ERT", ".", "AM_BADARITH", ",", "ERT", ".", "NIL", ".", "cons", "(", "v2", ")", ".", "cons", "(", "v1", ")", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "ARITHBIF", ")", "static", "public", "double", "fsub", "(", "double", "v1", ",", "double", "v2", ")", "{", "return", "v1", "-", "v2", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "ARITHBIF", ")", "static", "public", "double", "fadd", "(", "double", "v1", ",", "double", "v2", ")", "{", "return", "v1", "+", "v2", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "ARITHBIF", ")", "static", "public", "double", "fmul", "(", "double", "v1", ",", "double", "v2", ")", "{", "return", "v1", "*", "v2", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "ARITHBIF", ")", "public", "static", "double", "fnegate", "(", "double", "val", ")", "{", "return", "-", "val", ";", "}", "@", "BIF", "(", "name", "=", "\"-\"", ")", "static", "public", "ENumber", "neg", "(", "EObject", "v1", ")", "{", "ENumber", "n1", ";", "if", "(", "(", "n1", "=", "v1", ".", "testNumber", "(", ")", ")", "!=", "null", ")", "{", "return", "n1", ".", "negate", "(", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "v1", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"-\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ENumber", "neg$g", "(", "EObject", "v1", ")", "{", "ENumber", "n1", ";", "if", "(", "(", "n1", "=", "v1", ".", "testNumber", "(", ")", ")", "!=", "null", ")", "{", "return", "n1", ".", "negate", "(", ")", ";", "}", "return", "null", ";", "}", "@", "BIF", "static", "public", "EInteger", "div", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "o1", ".", "idiv", "(", "o2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"div\"", ")", "static", "public", "ENumber", "div", "(", "EObject", "v1", ",", "int", "v2", ")", "{", "return", "v1", ".", "idiv", "(", "v2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"div\"", ")", "static", "public", "ENumber", "div", "(", "ENumber", "n1", ",", "int", "v2", ")", "{", "return", "n1", ".", "idiv", "(", "v2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"div\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ENumber", "div$g", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "ENumber", "n1", ",", "n2", ";", "if", "(", "(", "n1", "=", "v1", ".", "testInteger", "(", ")", ")", "!=", "null", "&&", "(", "n2", "=", "v2", ".", "testInteger", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "n2", ".", "erlangEquals", "(", "ESmall", ".", "ZERO", ")", ")", "return", "null", ";", "return", "n1", ".", "idiv", "(", "n2", ")", ";", "}", "return", "null", ";", "}", "@", "BIF", "(", "name", "=", "\"-\"", ")", "static", "public", "ENumber", "minus", "(", "EObject", "v1", ",", "int", "v2", ")", "{", "return", "v1", ".", "subtract", "(", "v2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"-\"", ")", "static", "public", "ENumber", "minus", "(", "int", "v1", ",", "int", "v2", ")", "{", "return", "ERT", ".", "box", "(", "(", "long", ")", "v1", "-", "(", "long", ")", "v2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"-\"", ")", "static", "public", "ENumber", "minus", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "return", "v1", ".", "subtract", "(", "v2", ",", "false", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"-\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ENumber", "subtract$p", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "return", "v1", ".", "subtract", "(", "v2", ",", "true", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"/\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ENumber", "divide$p", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "ENumber", "n1", ";", "if", "(", "(", "n1", "=", "v1", ".", "testNumber", "(", ")", ")", "!=", "null", ")", "{", "ENumber", "n2", ";", "if", "(", "(", "n2", "=", "v2", ".", "testNumber", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "n2", ".", "doubleValue", "(", ")", "==", "0.0", ")", "return", "null", ";", "return", "n1", ".", "divide", "(", "v2", ")", ";", "}", "}", "return", "null", ";", "}", "@", "BIF", "(", "name", "=", "\"/\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ENumber", "divide$p", "(", "EObject", "v1", ",", "double", "d2", ")", "{", "ENumber", "n1", ";", "if", "(", "d2", "!=", "0.0", "&&", "(", "n1", "=", "v1", ".", "testNumber", "(", ")", ")", "!=", "null", ")", "{", "return", "n1", ".", "divide", "(", "d2", ")", ";", "}", "return", "null", ";", "}", "@", "BIF", "(", "name", "=", "\"/\"", ")", "static", "public", "ENumber", "divide", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "return", "v1", ".", "divide", "(", "v2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"+\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ENumber", "plus$p", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "return", "v1", ".", "add", "(", "v2", ",", "true", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"+\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ENumber", "plus$p", "(", "EObject", "v1", ",", "ESmall", "s2", ")", "{", "return", "v1", ".", "add", "(", "s2", ".", "value", ",", "true", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"+\"", ")", "static", "public", "ENumber", "plus", "(", "int", "v1", ",", "int", "v2", ")", "{", "return", "ERT", ".", "box", "(", "(", "long", ")", "v1", "+", "(", "long", ")", "v2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"+\"", ")", "static", "public", "ENumber", "plus", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "return", "v1", ".", "add", "(", "v2", ",", "false", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"+\"", ")", "static", "public", "ENumber", "plus", "(", "EObject", "v1", ",", "int", "i2", ")", "{", "return", "v1", ".", "add", "(", "i2", ",", "false", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"+\"", ")", "static", "public", "ENumber", "plus", "(", "EObject", "v1", ",", "ESmall", "i2", ")", "{", "return", "v1", ".", "add", "(", "i2", ".", "value", ",", "false", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"-\"", ")", "static", "public", "ENumber", "minus", "(", "EObject", "v1", ",", "ESmall", "i2", ")", "{", "return", "v1", ".", "subtract", "(", "i2", ".", "value", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"-\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ENumber", "minus$g", "(", "EObject", "v1", ",", "ESmall", "i2", ")", "{", "ENumber", "n1", ";", "if", "(", "(", "n1", "=", "v1", ".", "testNumber", "(", ")", ")", "!=", "null", ")", "{", "return", "n1", ".", "subtract", "(", "i2", ".", "value", ")", ";", "}", "return", "null", ";", "}", "@", "BIF", "(", "name", "=", "\"*\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ENumber", "multiply$g", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "ENumber", "n1", ";", "if", "(", "(", "n1", "=", "v1", ".", "testNumber", "(", ")", ")", "!=", "null", ")", "{", "ENumber", "n2", ";", "if", "(", "(", "n2", "=", "v2", ".", "testNumber", "(", ")", ")", "!=", "null", ")", "{", "return", "n1", ".", "multiply", "(", "n2", ")", ";", "}", "}", "return", "null", ";", "}", "@", "BIF", "(", "name", "=", "\"*\"", ")", "static", "public", "ENumber", "multiply", "(", "int", "v1", ",", "int", "v2", ")", "{", "return", "ERT", ".", "box", "(", "(", "long", ")", "v1", "*", "(", "long", ")", "v2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"*\"", ")", "static", "public", "ENumber", "multiply", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "return", "v1", ".", "multiply", "(", "v2", ")", ";", "}", "@", "BIF", "static", "public", "EInteger", "trunc", "(", "EObject", "v1", ")", "{", "EInteger", "i1", ";", "if", "(", "(", "i1", "=", "v1", ".", "testInteger", "(", ")", ")", "!=", "null", ")", "{", "return", "i1", ";", "}", "EDouble", "n1", ";", "if", "(", "(", "n1", "=", "v1", ".", "testFloat", "(", ")", ")", "!=", "null", ")", "{", "return", "trunc", "(", "n1", ".", "value", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "v1", ")", ";", "}", "@", "BIF", "static", "public", "EInteger", "trunc", "(", "double", "d", ")", "{", "return", "ERT", ".", "box", "(", "new", "BigDecimal", "(", "d", ")", ".", "toBigInteger", "(", ")", ")", ";", "}", "@", "BIF", "static", "public", "EInteger", "trunc", "(", "EDouble", "d1", ")", "{", "return", "ERT", ".", "box", "(", "new", "BigDecimal", "(", "d1", ".", "value", ")", ".", "toBigInteger", "(", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"round\"", ")", "static", "public", "EInteger", "round", "(", "double", "d", ")", "{", "return", "ERT", ".", "box", "(", "Math", ".", "round", "(", "d", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"round\"", ")", "static", "public", "EInteger", "round", "(", "EDouble", "d", ")", "{", "return", "ERT", ".", "box", "(", "Math", ".", "round", "(", "d", ".", "value", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"round\"", ")", "static", "public", "EInteger", "round", "(", "EObject", "o", ")", "{", "EDouble", "d", ";", "if", "(", "(", "d", "=", "o", ".", "testFloat", "(", ")", ")", "!=", "null", ")", "return", "ERT", ".", "box", "(", "Math", ".", "round", "(", "d", ".", "value", ")", ")", ";", "EInteger", "i", ";", "if", "(", "(", "i", "=", "o", ".", "testInteger", "(", ")", ")", "!=", "null", ")", "return", "i", ";", "throw", "ERT", ".", "badarg", "(", "o", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"round\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "EInteger", "round$g", "(", "double", "d", ")", "{", "return", "ERT", ".", "box", "(", "Math", ".", "round", "(", "d", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"round\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "EInteger", "round$g", "(", "EDouble", "d", ")", "{", "return", "ERT", ".", "box", "(", "Math", ".", "round", "(", "d", ".", "value", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"round\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "EInteger", "round$g", "(", "EObject", "o", ")", "{", "EDouble", "d", "=", "o", ".", "testFloat", "(", ")", ";", "if", "(", "d", "==", "null", ")", "return", "null", ";", "return", "ERT", ".", "box", "(", "Math", ".", "round", "(", "d", ".", "value", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"float\"", ")", "static", "public", "double", "float$n", "(", "int", "v", ")", "{", "return", "(", "double", ")", "v", ";", "}", "@", "BIF", "(", "name", "=", "\"float\"", ")", "static", "public", "double", "float$n", "(", "ENumber", "v", ")", "{", "return", "v", ".", "doubleValue", "(", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"float\"", ")", "static", "public", "EDouble", "float$n", "(", "EObject", "v", ")", "{", "ENumber", "n", "=", "v", ".", "testNumber", "(", ")", ";", "if", "(", "n", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "v", ")", ";", "return", "ERT", ".", "box", "(", "n", ".", "doubleValue", "(", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"float\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "EDouble", "float$g", "(", "EObject", "v", ")", "{", "return", "v", ".", "testFloat", "(", ")", ";", "}", "@", "BIF", "static", "public", "ENumber", "rem", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "return", "v1", ".", "irem", "(", "v2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"rem\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "EInteger", "rem$p", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "if", "(", "v2", ".", "erlangEquals", "(", "ESmall", ".", "ZERO", ")", "||", "v1", ".", "testInteger", "(", ")", "==", "null", "||", "v2", ".", "testInteger", "(", ")", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "v1", ".", "irem", "(", "v2", ")", ";", "}", "}", "@", "BIF", "(", "name", "=", "\"rem\"", ")", "static", "public", "EInteger", "rem", "(", "EObject", "v1", ",", "int", "v2", ")", "{", "return", "v1", ".", "irem", "(", "v2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"abs\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ENumber", "abs$p", "(", "EObject", "v1", ")", "{", "ENumber", "num", ";", "if", "(", "(", "num", "=", "v1", ".", "testNumber", "(", ")", ")", "!=", "null", ")", "{", "return", "abs", "(", "num", ")", ";", "}", "return", "null", ";", "}", "@", "BIF", "(", "name", "=", "\"abs\"", ")", "static", "public", "ENumber", "abs", "(", "EObject", "v1", ")", "{", "ENumber", "num", ";", "if", "(", "(", "num", "=", "v1", ".", "testNumber", "(", ")", ")", "!=", "null", ")", "{", "return", "abs", "(", "num", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "v1", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"abs\"", ")", "static", "public", "ENumber", "abs", "(", "ENumber", "v1", ")", "{", "return", "v1", ".", "abs", "(", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"now\"", ")", "static", "public", "ETuple3", "now", "(", ")", "{", "long", "now", "=", "now_unique_micros", "(", ")", ";", "int", "micros", "=", "(", "int", ")", "(", "now", "%", "1000000", ")", ";", "now", "/=", "1000000", ";", "int", "secs", "=", "(", "int", ")", "(", "now", "%", "1000000", ")", ";", "now", "/=", "1000000", ";", "int", "megas", "=", "(", "int", ")", "now", ";", "ETuple3", "res", "=", "new", "ETuple3", "(", ")", ";", "res", ".", "elem1", "=", "ERT", ".", "box", "(", "megas", ")", ";", "res", ".", "elem2", "=", "ERT", ".", "box", "(", "secs", ")", ";", "res", ".", "elem3", "=", "ERT", ".", "box", "(", "micros", ")", ";", "return", "res", ";", "}", "final", "static", "AtomicLong", "latest_now", "=", "new", "AtomicLong", "(", ")", ";", "final", "static", "long", "micros_from_epoch_to_nanotime", "=", "System", ".", "currentTimeMillis", "(", ")", "*", "1000", "-", "System", ".", "nanoTime", "(", ")", "/", "1000", ";", "public", "static", "long", "now_raw_micros", "(", ")", "{", "return", "System", ".", "nanoTime", "(", ")", "/", "1000", "+", "micros_from_epoch_to_nanotime", ";", "}", "static", "long", "now_unique_micros", "(", ")", "{", "long", "micros", "=", "now_raw_micros", "(", ")", ";", "long", "prev", ";", "while", "(", "(", "prev", "=", "latest_now", ".", "get", "(", ")", ")", "<", "micros", ")", "{", "if", "(", "latest_now", ".", "compareAndSet", "(", "prev", ",", "micros", ")", ")", "{", "return", "micros", ";", "}", "}", "return", "latest_now", ".", "incrementAndGet", "(", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"==\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "is_eq$p", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "a1", ".", "erlangEquals", "(", "a2", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"=/=\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "is_ne_exact$g2", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "!", "a1", ".", "equalsExactly", "(", "a2", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"=/=\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "is_ne_exact$g", "(", "EObject", "a1", ",", "EAtom", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "a1", "!=", "a2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"=/=\"", ")", "public", "static", "final", "EAtom", "is_ne_exact", "(", "EObject", "a1", ",", "EAtom", "a2", ")", "{", "return", "ERT", ".", "box", "(", "a1", "!=", "a2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"=/=\"", ")", "public", "static", "final", "EAtom", "is_ne_exact", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "box", "(", "!", "a1", ".", "equalsExactly", "(", "a2", ")", ")", ";", "}", "@", "BIF", "public", "static", "final", "ESmall", "size", "(", "EObject", "o", ")", "{", "ETuple", "t", ";", "if", "(", "(", "t", "=", "o", ".", "testTuple", "(", ")", ")", "==", "null", ")", "{", "EBinary", "b", ";", "if", "(", "(", "b", "=", "o", ".", "testBinary", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "o", ")", ";", "return", "ERT", ".", "box", "(", "b", ".", "byteSize", "(", ")", ")", ";", "}", "return", "ERT", ".", "box", "(", "t", ".", "arity", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "final", "ESmall", "size", "(", "ETuple", "t", ")", "{", "return", "ERT", ".", "box", "(", "t", ".", "arity", "(", ")", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"size\"", ")", "public", "static", "final", "ESmall", "size$g", "(", "EObject", "o", ")", "{", "ETuple", "t", ";", "if", "(", "(", "t", "=", "o", ".", "testTuple", "(", ")", ")", "!=", "null", ")", "return", "ERT", ".", "box", "(", "t", ".", "arity", "(", ")", ")", ";", "EBinary", "b", ";", "if", "(", "(", "b", "=", "o", ".", "testBinary", "(", ")", ")", "!=", "null", ")", "return", "ERT", ".", "box", "(", "b", ".", "byteSize", "(", ")", ")", ";", "return", "null", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"size\"", ")", "public", "static", "final", "ESmall", "size$g", "(", "ETuple", "t", ")", "{", "return", "ERT", ".", "box", "(", "t", ".", "arity", "(", ")", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"size\"", ")", "public", "static", "final", "ESmall", "size$g", "(", "EBinary", "b", ")", "{", "return", "ERT", ".", "box", "(", "b", ".", "byteSize", "(", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"=:=\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "eqxp", "(", "EObject", "a1", ",", "EAtom", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "a1", "==", "a2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"=:=\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "eqxp", "(", "EObject", "a1", ",", "ESmall", "s2", ")", "{", "ESmall", "s1", ";", "if", "(", "(", "s1", "=", "a1", ".", "testSmall", "(", ")", ")", "!=", "null", ")", "{", "return", "ERT", ".", "guard", "(", "s1", ".", "value", "==", "s2", ".", "value", ")", ";", "}", "return", "ERT", ".", "guard", "(", "s2", ".", "equalsExactly", "(", "a1", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"=:=\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "eqxp", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "a1", ".", "equalsExactly", "(", "a2", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"==\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "is_eq_op$g", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "a1", ".", "erlangEquals", "(", "a2", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"==\"", ")", "public", "static", "final", "EAtom", "is_eq_op", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "a1", ".", "erlangEquals", "(", "a2", ")", "?", "ERT", ".", "TRUE", ":", "ERT", ".", "FALSE", ";", "}", "@", "BIF", "(", "name", "=", "\"=/=\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "is_ne_exact$g", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "!", "a1", ".", "equalsExactly", "(", "a2", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\">=\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "is_ge$g2", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "a1", ".", "erlangCompareTo", "(", "a2", ")", ">=", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\">\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "is_gt$g", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "a1", ".", "erlangCompareTo", "(", "a2", ")", ">", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"is_ge\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "is_ge$g", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "a1", ".", "erlangCompareTo", "(", "a2", ")", ">=", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\">\"", ")", "public", "static", "EAtom", "gt", "(", "EObject", "v1", ",", "EObject", "v2", ")", "{", "return", "ERT", ".", "box", "(", "v1", ".", "erlangCompareTo", "(", "v2", ")", ">", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\">\"", ")", "public", "static", "EAtom", "gt", "(", "EObject", "v1", ",", "ESmall", "v2", ")", "{", "return", "ERT", ".", "box", "(", "v1", ".", "erlangCompareTo", "(", "v2", ")", ">", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\">\"", ")", "public", "static", "EAtom", "gt", "(", "ESmall", "v1", ",", "EObject", "v2", ")", "{", "return", "ERT", ".", "box", "(", "v1", ".", "erlangCompareTo", "(", "v2", ")", ">", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"/=\"", ")", "public", "static", "final", "EAtom", "is_ne", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "boolean", "eq", "=", "a1", ".", "erlangEquals", "(", "a2", ")", ";", "return", "ERT", ".", "box", "(", "!", "eq", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"/=\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "is_ne$g", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "boolean", "eq", "=", "a1", ".", "erlangEquals", "(", "a2", ")", ";", "return", "ERT", ".", "guard", "(", "!", "eq", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"<\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "is_lt$g", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "a1", ".", "erlangCompareTo", "(", "a2", ")", "<", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"=<\"", ")", "public", "static", "final", "EAtom", "is_le", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "box", "(", "a1", ".", "erlangCompareTo", "(", "a2", ")", "<=", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"<\"", ")", "public", "static", "final", "EAtom", "is_lt", "(", "EObject", "a1", ",", "ESmall", "a2", ")", "{", "return", "ERT", ".", "box", "(", "a2", ".", "erlangCompareTo", "(", "a1", ")", ">", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"<\"", ")", "public", "static", "final", "EAtom", "is_lt", "(", "ESmall", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "box", "(", "a1", ".", "erlangCompareTo", "(", "a2", ")", "<", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"=<\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "final", "EAtom", "is_le$g", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "guard", "(", "a1", ".", "erlangCompareTo", "(", "a2", ")", "<=", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"<\"", ")", "public", "static", "final", "EAtom", "is_lt", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "box", "(", "a1", ".", "erlangCompareTo", "(", "a2", ")", "<", "0", ")", ";", "}", "@", "BIF", "(", "name", "=", "\">=\"", ")", "public", "static", "final", "EAtom", "is_ge", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "box", "(", "a1", ".", "erlangCompareTo", "(", "a2", ")", ">=", "0", ")", ";", "}", "@", "BIF", "public", "static", "final", "EAtom", "is_eq", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "box", "(", "a1", ".", "erlangEquals", "(", "a2", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"=:=\"", ")", "public", "static", "final", "EAtom", "is_eq_exact", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "ERT", ".", "box", "(", "a1", ".", "equalsExactly", "(", "a2", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"++\"", ")", "public", "static", "EObject", "append", "(", "EObject", "l1", ",", "EObject", "l2", ")", "{", "ESeq", "ll1", "=", "l1", ".", "testSeq", "(", ")", ";", "if", "(", "ll1", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "l1", ",", "l2", ")", ";", "return", "l2", ".", "prepend", "(", "ll1", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_list", "(", "EObject", "o", ")", "{", "return", "ERT", ".", "box", "(", "o", ".", "testCons", "(", ")", "!=", "null", "||", "o", ".", "testNil", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_nil", "(", "EObject", "o", ")", "{", "return", "ERT", ".", "box", "(", "o", ".", "testNil", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EString", "atom_to_list", "(", "EObject", "atom", ")", "{", "EAtom", "am", "=", "atom", ".", "testAtom", "(", ")", ";", "if", "(", "am", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "atom", ")", ";", "return", "new", "EString", "(", "am", ".", "getName", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "process_flag", "(", "EProc", "proc", ",", "EObject", "a1", ",", "EObject", "a2", ")", "{", "return", "proc", ".", "process_flag", "(", "a1", ".", "testAtom", "(", ")", ",", "a2", ")", ";", "}", "@", "BIF", "public", "static", "ESeq", "nodes", "(", ")", "{", "return", "EPeer", ".", "getRemoteNodes", "(", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"is_atom\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "EAtom", "is_atom$p", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", ".", "testAtom", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_atom", "(", "EObject", "obj", ")", "{", "return", "(", "obj", ".", "testAtom", "(", ")", "!=", "null", ")", "?", "ERT", ".", "TRUE", ":", "ERT", ".", "FALSE", ";", "}", "@", "BIF", "(", "name", "=", "\"is_list\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "EAtom", "is_list$p", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", ".", "testCons", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"is_tuple\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "EAtom", "is_tuple$p", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", ".", "testTuple", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_tuple", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "box", "(", "obj", ".", "testTuple", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"is_binary\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "EAtom", "is_binary$p", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", ".", "testBinary", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_binary", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "box", "(", "obj", ".", "testBinary", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_bitstring", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "box", "(", "obj", ".", "testBitString", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"is_bitstring\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "EAtom", "is_bitstring$g", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", ".", "testBitString", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_boolean", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "box", "(", "obj", "==", "ERT", ".", "TRUE", "||", "obj", "==", "ERT", ".", "FALSE", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"is_boolean\"", ")", "public", "static", "EAtom", "is_boolean$g", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", "==", "ERT", ".", "TRUE", "||", "obj", "==", "ERT", ".", "FALSE", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"is_integer\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "EAtom", "is_integer$p", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", ".", "testInteger", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"is_float\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "EAtom", "is_float$g", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", ".", "testFloat", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"is_number\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "EAtom", "is_number$g", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", ".", "testNumber", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_function", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "box", "(", "obj", ".", "testFunction", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_function", "(", "EObject", "obj", ",", "ESmall", "num", ")", "{", "return", "ERT", ".", "box", "(", "obj", ".", "testFunction2", "(", "num", ".", "value", ")", "!=", "null", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"is_function\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "EAtom", "is_function_guard", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", ".", "testFunction", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_reference", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "box", "(", "obj", ".", "testReference", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_pid", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "box", "(", "obj", ".", "testPID", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"is_pid\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "EAtom", "is_pid_guard", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", ".", "testPID", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_port", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "box", "(", "obj", ".", "testPort", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"is_port\"", ",", "type", "=", "Type", ".", "GUARD", ")", "public", "static", "EAtom", "is_port$g", "(", "EObject", "obj", ")", "{", "return", "ERT", ".", "guard", "(", "obj", ".", "testPort", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "ESeq", "loaded", "(", ")", "{", "return", "EModuleManager", ".", "loaded_modules", "(", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "delete_module", "(", "EObject", "m", ")", "{", "EAtom", "mod", "=", "m", ".", "testAtom", "(", ")", ";", "if", "(", "mod", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "m", ")", ";", "return", "EModuleManager", ".", "delete_module", "(", "mod", ")", ";", "}", "@", "BIF", "public", "static", "ETuple2", "load_module", "(", "EProc", "proc", ",", "EObject", "mod", ",", "EObject", "bin", ")", "throws", "Pausable", "{", "EAtom", "name", "=", "mod", ".", "testAtom", "(", ")", ";", "EBinary", "binary", "=", "bin", ".", "testBinary", "(", ")", ";", "return", "load_module", "(", "proc", ",", "name", ",", "binary", ")", ";", "}", "@", "BIF", "public", "static", "ETuple2", "load_module", "(", "EProc", "proc", ",", "EAtom", "mod", ",", "EBinary", "bin", ")", "{", "if", "(", "mod", "==", "null", "||", "bin", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "mod", ",", "bin", ")", ";", "try", "{", "ERT", ".", "load_module", "(", "mod", ",", "bin", ")", ";", "}", "catch", "(", "ErlangException", "e", ")", "{", "log", ".", "log", "(", "Level", ".", "FINE", ",", "\"\"", ",", "e", ")", ";", "return", "new", "ETuple2", "(", "ERT", ".", "am_error", ",", "e", ".", "reason", "(", ")", ")", ";", "}", "catch", "(", "ThreadDeath", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "ErlangError", "ee", "=", "new", "ErlangError", "(", "ERT", ".", "am_badfile", ",", "e", ",", "mod", ",", "bin", ")", ";", "ETuple2", "result", "=", "new", "ETuple2", "(", "ERT", ".", "am_error", ",", "ee", ".", "reason", "(", ")", ")", ";", "log", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"\"", "+", "mod", ",", "e", ")", ";", "return", "result", ";", "}", "return", "new", "ETuple2", "(", "ERT", ".", "am_module", ",", "mod", ")", ";", "}", "@", "BIF", "public", "static", "ETuple", "make_tuple", "(", "EObject", "arity", ",", "EObject", "initial", ")", "{", "ESmall", "sm", "=", "arity", ".", "testSmall", "(", ")", ";", "if", "(", "sm", "==", "null", "||", "sm", ".", "value", "<", "0", ")", "throw", "ERT", ".", "badarg", "(", "arity", ",", "initial", ")", ";", "ETuple", "et", "=", "ETuple", ".", "make", "(", "sm", ".", "value", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "sm", ".", "value", ";", "i", "++", ")", "{", "et", ".", "set", "(", "i", ",", "initial", ")", ";", "}", "return", "et", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_integer", "(", "EObject", "o", ")", "{", "return", "ERT", ".", "box", "(", "o", ".", "testInteger", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_float", "(", "EObject", "o", ")", "{", "return", "ERT", ".", "box", "(", "o", ".", "testFloat", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_number", "(", "EObject", "o", ")", "{", "return", "ERT", ".", "box", "(", "o", ".", "testNumber", "(", ")", "!=", "null", ")", ";", "}", "@", "BIF", "public", "static", "ESmall", "tuple_size", "(", "ETuple", "tup", ")", "{", "return", "ERT", ".", "box", "(", "tup", ".", "arity", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "ESmall", "tuple_size", "(", "EObject", "tup", ")", "{", "ETuple", "t", ";", "if", "(", "(", "t", "=", "tup", ".", "testTuple", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "tup", ")", ";", "return", "ERT", ".", "box", "(", "t", ".", "arity", "(", ")", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"tuple_size\"", ")", "public", "static", "ESmall", "tuple_size_guard", "(", "EObject", "tup", ")", "{", "ETuple", "t", ";", "if", "(", "(", "t", "=", "tup", ".", "testTuple", "(", ")", ")", "==", "null", ")", "return", "null", ";", "return", "ERT", ".", "box", "(", "t", ".", "arity", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "ESmall", "byte_size", "(", "EObject", "o", ")", "{", "EBitString", "bin", "=", "o", ".", "testBitString", "(", ")", ";", "if", "(", "bin", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "o", ")", ";", "return", "ERT", ".", "box", "(", "bin", ".", "totalByteSize", "(", ")", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"byte_size\"", ")", "public", "static", "ESmall", "byte_size_guard", "(", "EObject", "o", ")", "{", "EBitString", "bin", "=", "o", ".", "testBitString", "(", ")", ";", "if", "(", "bin", "==", "null", ")", "return", "null", ";", "return", "ERT", ".", "box", "(", "bin", ".", "totalByteSize", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "EInteger", "bit_size", "(", "EObject", "o", ")", "{", "EBitString", "bin", "=", "o", ".", "testBitString", "(", ")", ";", "if", "(", "bin", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "o", ")", ";", "return", "ERT", ".", "box", "(", "bin", ".", "bitSize", "(", ")", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"bit_size\"", ")", "public", "static", "EInteger", "bit_size_guard", "(", "EObject", "o", ")", "{", "EBitString", "bin", "=", "o", ".", "testBitString", "(", ")", ";", "if", "(", "bin", "==", "null", ")", "return", "null", ";", "return", "ERT", ".", "box", "(", "bin", ".", "bitSize", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "or", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "Boolean", "b1", "=", "ERT", ".", "asBoolean", "(", "o1", ")", ";", "Boolean", "b2", "=", "ERT", ".", "asBoolean", "(", "o2", ")", ";", "if", "(", "b1", "==", "null", "||", "b2", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "o1", ",", "o2", ")", ";", "return", "ERT", ".", "box", "(", "b1", ".", "booleanValue", "(", ")", "||", "b2", ".", "booleanValue", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "and", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "Boolean", "b1", "=", "ERT", ".", "asBoolean", "(", "o1", ")", ";", "Boolean", "b2", "=", "ERT", ".", "asBoolean", "(", "o2", ")", ";", "if", "(", "b1", "==", "null", "||", "b2", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "o1", ",", "o2", ")", ";", "return", "ERT", ".", "box", "(", "b1", ".", "booleanValue", "(", ")", "&&", "b2", ".", "booleanValue", "(", ")", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"or\"", ")", "public", "static", "EAtom", "or$g", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "if", "(", "o1", "==", "ERT", ".", "TRUE", ")", "{", "if", "(", "o2", "==", "ERT", ".", "TRUE", "||", "o2", "==", "ERT", ".", "FALSE", ")", "return", "ERT", ".", "TRUE", ";", "}", "else", "if", "(", "o2", "==", "ERT", ".", "TRUE", ")", "{", "if", "(", "o1", "==", "ERT", ".", "FALSE", ")", "return", "ERT", ".", "TRUE", ";", "}", "else", "if", "(", "o1", "==", "ERT", ".", "FALSE", "&&", "o2", "==", "ERT", ".", "FALSE", ")", "{", "return", "ERT", ".", "FALSE", ";", "}", "return", "null", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"and\"", ")", "public", "static", "EAtom", "and$g", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "ERT", ".", "guard", "(", "o1", "==", "ERT", ".", "TRUE", "&&", "o2", "==", "ERT", ".", "TRUE", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "not", "(", "EObject", "o1", ")", "{", "if", "(", "o1", ".", "testBoolean", "(", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "o1", ")", ";", "return", "ERT", ".", "box", "(", "o1", "==", "ERT", ".", "FALSE", ")", ";", "}", "@", "BIF", "public", "static", "EInteger", "bnot", "(", "EObject", "o", ")", "{", "return", "o", ".", "bnot", "(", ")", ";", "}", "@", "BIF", "public", "static", "EInteger", "bor", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "o1", ".", "bor", "(", "o2", ")", ";", "}", "@", "BIF", "public", "static", "EInteger", "bxor", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "o1", ".", "bxor", "(", "o2", ")", ";", "}", "@", "BIF", "public", "static", "EInteger", "band", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "o1", ".", "band", "(", "o2", ")", ";", "}", "@", "BIF", "public", "static", "EInteger", "band", "(", "EObject", "o1", ",", "ESmall", "o2", ")", "{", "return", "o2", ".", "band", "(", "o1", ")", ";", "}", "@", "BIF", "public", "static", "EInteger", "bsl", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "o1", ".", "bsl", "(", "o2", ")", ";", "}", "@", "BIF", "public", "static", "EInteger", "bsr", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "o1", ".", "bsr", "(", "o2", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"not\"", ")", "public", "static", "EAtom", "not$g", "(", "EObject", "o1", ")", "{", "if", "(", "o1", ".", "testBoolean", "(", ")", "==", "null", ")", "return", "null", ";", "return", "ERT", ".", "box", "(", "o1", "==", "ERT", ".", "FALSE", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "xor", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "EAtom", "a1", ",", "a2", ";", "if", "(", "(", "a1", "=", "o1", ".", "testBoolean", "(", ")", ")", "==", "null", "||", "(", "a2", "=", "o2", ".", "testBoolean", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "o1", ",", "o2", ")", ";", "boolean", "b1", "=", "a1", "==", "ERT", ".", "TRUE", ",", "b2", "=", "a2", "==", "ERT", ".", "TRUE", ";", "return", "ERT", ".", "box", "(", "b1", "^", "b2", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"bnot\"", ")", "public", "static", "EInteger", "bnot$g", "(", "EObject", "o", ")", "{", "EInteger", "i", ";", "if", "(", "(", "i", "=", "o", ".", "testInteger", "(", ")", ")", "==", "null", ")", "return", "null", ";", "return", "i", ".", "bnot", "(", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"bor\"", ")", "public", "static", "EInteger", "bor$g", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "EInteger", "i1", ";", "EInteger", "i2", ";", "if", "(", "(", "i1", "=", "o1", ".", "testInteger", "(", ")", ")", "==", "null", "||", "(", "i2", "=", "o2", ".", "testInteger", "(", ")", ")", "==", "null", ")", "return", "null", ";", "return", "i1", ".", "bor", "(", "i2", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"bxor\"", ")", "public", "static", "EInteger", "bxor$g", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "EInteger", "i1", ";", "EInteger", "i2", ";", "if", "(", "(", "i1", "=", "o1", ".", "testInteger", "(", ")", ")", "==", "null", "||", "(", "i2", "=", "o2", ".", "testInteger", "(", ")", ")", "==", "null", ")", "return", "null", ";", "return", "i1", ".", "bxor", "(", "i2", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"band\"", ")", "public", "static", "EInteger", "band$g", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "EInteger", "i1", ";", "EInteger", "i2", ";", "if", "(", "(", "i1", "=", "o1", ".", "testInteger", "(", ")", ")", "==", "null", "||", "(", "i2", "=", "o2", ".", "testInteger", "(", ")", ")", "==", "null", ")", "return", "null", ";", "return", "i1", ".", "band", "(", "i2", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"bsl\"", ")", "public", "static", "EInteger", "bsl$g", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "EInteger", "i1", ";", "EInteger", "i2", ";", "if", "(", "(", "i1", "=", "o1", ".", "testInteger", "(", ")", ")", "==", "null", "||", "(", "i2", "=", "o2", ".", "testInteger", "(", ")", ")", "==", "null", ")", "return", "null", ";", "return", "i1", ".", "bsl", "(", "i2", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"bsr\"", ")", "public", "static", "EInteger", "bsr$g", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "EInteger", "i1", ";", "EInteger", "i2", ";", "if", "(", "(", "i1", "=", "o1", ".", "testInteger", "(", ")", ")", "==", "null", "||", "(", "i2", "=", "o2", ".", "testInteger", "(", ")", ")", "==", "null", ")", "return", "null", ";", "return", "i1", ".", "bsr", "(", "i2", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "yield", "(", ")", "throws", "Pausable", "{", "Task", ".", "yield", "(", ")", ";", "Task", ".", "getCurrentTask", "(", ")", ".", "checkKill", "(", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "public", "static", "EObject", "bump_reductions", "(", "EProc", "self", ",", "EObject", "howmuch", ")", "throws", "Pausable", "{", "Task", ".", "yield", "(", ")", ";", "Task", ".", "getCurrentTask", "(", ")", ".", "checkKill", "(", ")", ";", "return", "ERT", ".", "box", "(", "1", ")", ";", "}", "@", "BIF", "public", "static", "ETuple2", "localtime", "(", ")", "{", "Calendar", "c", "=", "GregorianCalendar", ".", "getInstance", "(", ")", ";", "ETuple3", "date", "=", "new", "ETuple3", "(", ")", ";", "date", ".", "set", "(", "1", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "YEAR", ")", ")", ")", ";", "date", ".", "set", "(", "2", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "MONTH", ")", "-", "Calendar", ".", "JANUARY", "+", "1", ")", ")", ";", "date", ".", "set", "(", "3", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ")", ")", ";", "ETuple3", "time", "=", "new", "ETuple3", "(", ")", ";", "time", ".", "set", "(", "1", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "HOUR_OF_DAY", ")", ")", ")", ";", "time", ".", "set", "(", "2", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "MINUTE", ")", ")", ")", ";", "time", ".", "set", "(", "3", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "SECOND", ")", ")", ")", ";", "return", "new", "ETuple2", "(", "date", ",", "time", ")", ";", "}", "@", "BIF", "public", "static", "ETuple2", "universaltime", "(", ")", "{", "Calendar", "c", "=", "GregorianCalendar", ".", "getInstance", "(", "UTC_TIME_ZONE", ")", ";", "ETuple3", "date", "=", "new", "ETuple3", "(", ")", ";", "date", ".", "set", "(", "1", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "YEAR", ")", ")", ")", ";", "date", ".", "set", "(", "2", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "MONTH", ")", "-", "Calendar", ".", "JANUARY", "+", "1", ")", ")", ";", "date", ".", "set", "(", "3", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ")", ")", ";", "ETuple3", "time", "=", "new", "ETuple3", "(", ")", ";", "time", ".", "set", "(", "1", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "HOUR_OF_DAY", ")", ")", ")", ";", "time", ".", "set", "(", "2", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "MINUTE", ")", ")", ")", ";", "time", ".", "set", "(", "3", ",", "ERT", ".", "box", "(", "c", ".", "get", "(", "Calendar", ".", "SECOND", ")", ")", ")", ";", "return", "new", "ETuple2", "(", "date", ",", "time", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "localtime_to_universaltime", "(", "EObject", "a1", ")", "{", "return", "localtime_to_universaltime", "(", "a1", ",", "ERT", ".", "am_undefined", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "localtime_to_universaltime", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "ETuple2", "dt", ";", "if", "(", "(", "dt", "=", "ETuple2", ".", "cast", "(", "a1", ")", ")", "!=", "null", ")", "{", "ETuple3", "date", ";", "ETuple3", "time", ";", "ESmall", "year", ";", "ESmall", "month", ";", "ESmall", "day", ";", "ESmall", "hour", ";", "ESmall", "minute", ";", "ESmall", "sec", ";", "if", "(", "(", "date", "=", "ETuple3", ".", "cast", "(", "dt", ".", "elem1", ")", ")", "!=", "null", "&&", "(", "year", "=", "date", ".", "elem1", ".", "testSmall", "(", ")", ")", "!=", "null", "&&", "(", "month", "=", "date", ".", "elem2", ".", "testSmall", "(", ")", ")", "!=", "null", "&&", "(", "day", "=", "date", ".", "elem3", ".", "testSmall", "(", ")", ")", "!=", "null", "&&", "(", "time", "=", "ETuple3", ".", "cast", "(", "dt", ".", "elem2", ")", ")", "!=", "null", "&&", "(", "hour", "=", "time", ".", "elem1", ".", "testSmall", "(", ")", ")", "!=", "null", "&&", "(", "minute", "=", "time", ".", "elem2", ".", "testSmall", "(", ")", ")", "!=", "null", "&&", "(", "sec", "=", "time", ".", "elem3", ".", "testSmall", "(", ")", ")", "!=", "null", ")", "{", "Calendar", "in_date", "=", "GregorianCalendar", ".", "getInstance", "(", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "YEAR", ",", "year", ".", "value", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "MONTH", ",", "month", ".", "value", "-", "1", "+", "Calendar", ".", "JANUARY", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "day", ".", "value", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "hour", ".", "value", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "minute", ".", "value", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "SECOND", ",", "sec", ".", "value", ")", ";", "Calendar", "out_date", "=", "GregorianCalendar", ".", "getInstance", "(", "UTC_TIME_ZONE", ")", ";", "out_date", ".", "setTimeInMillis", "(", "in_date", ".", "getTimeInMillis", "(", ")", ")", ";", "ETuple3", "date2", "=", "new", "ETuple3", "(", ")", ";", "date2", ".", "set", "(", "1", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "YEAR", ")", ")", ")", ";", "date2", ".", "set", "(", "2", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "MONTH", ")", "-", "Calendar", ".", "JANUARY", "+", "1", ")", ")", ";", "date2", ".", "set", "(", "3", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ")", ")", ";", "ETuple3", "time2", "=", "new", "ETuple3", "(", ")", ";", "time2", ".", "set", "(", "1", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "HOUR_OF_DAY", ")", ")", ")", ";", "time2", ".", "set", "(", "2", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "MINUTE", ")", ")", ")", ";", "time2", ".", "set", "(", "3", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "SECOND", ")", ")", ")", ";", "return", "new", "ETuple2", "(", "date2", ",", "time2", ")", ";", "}", "}", "throw", "ERT", ".", "badarg", "(", "a1", ",", "a2", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "universaltime_to_localtime", "(", "EObject", "a1", ")", "{", "ETuple2", "dt", ";", "if", "(", "(", "dt", "=", "ETuple2", ".", "cast", "(", "a1", ")", ")", "!=", "null", ")", "{", "ETuple3", "date", ";", "ETuple3", "time", ";", "ESmall", "year", ";", "ESmall", "month", ";", "ESmall", "day", ";", "ESmall", "hour", ";", "ESmall", "minute", ";", "ESmall", "sec", ";", "if", "(", "(", "date", "=", "ETuple3", ".", "cast", "(", "dt", ".", "elem1", ")", ")", "!=", "null", "&&", "(", "year", "=", "date", ".", "elem1", ".", "testSmall", "(", ")", ")", "!=", "null", "&&", "(", "month", "=", "date", ".", "elem2", ".", "testSmall", "(", ")", ")", "!=", "null", "&&", "(", "day", "=", "date", ".", "elem3", ".", "testSmall", "(", ")", ")", "!=", "null", "&&", "(", "time", "=", "ETuple3", ".", "cast", "(", "dt", ".", "elem2", ")", ")", "!=", "null", "&&", "(", "hour", "=", "time", ".", "elem1", ".", "testSmall", "(", ")", ")", "!=", "null", "&&", "(", "minute", "=", "time", ".", "elem2", ".", "testSmall", "(", ")", ")", "!=", "null", "&&", "(", "sec", "=", "time", ".", "elem3", ".", "testSmall", "(", ")", ")", "!=", "null", ")", "{", "Calendar", "in_date", "=", "GregorianCalendar", ".", "getInstance", "(", "UTC_TIME_ZONE", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "YEAR", ",", "year", ".", "value", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "MONTH", ",", "month", ".", "value", "-", "1", "+", "Calendar", ".", "JANUARY", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "day", ".", "value", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "hour", ".", "value", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "minute", ".", "value", ")", ";", "in_date", ".", "set", "(", "Calendar", ".", "SECOND", ",", "sec", ".", "value", ")", ";", "Calendar", "out_date", "=", "GregorianCalendar", ".", "getInstance", "(", ")", ";", "out_date", ".", "setTimeInMillis", "(", "in_date", ".", "getTimeInMillis", "(", ")", ")", ";", "ETuple3", "date2", "=", "new", "ETuple3", "(", ")", ";", "date2", ".", "set", "(", "1", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "YEAR", ")", ")", ")", ";", "date2", ".", "set", "(", "2", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "MONTH", ")", "-", "Calendar", ".", "JANUARY", "+", "1", ")", ")", ";", "date2", ".", "set", "(", "3", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ")", ")", ";", "ETuple3", "time2", "=", "new", "ETuple3", "(", ")", ";", "time2", ".", "set", "(", "1", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "HOUR_OF_DAY", ")", ")", ")", ";", "time2", ".", "set", "(", "2", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "MINUTE", ")", ")", ")", ";", "time2", ".", "set", "(", "3", ",", "ERT", ".", "box", "(", "out_date", ".", "get", "(", "Calendar", ".", "SECOND", ")", ")", ")", ";", "return", "new", "ETuple2", "(", "date2", ",", "time2", ")", ";", "}", "}", "throw", "ERT", ".", "badarg", "(", "a1", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "system_flag", "(", "EObject", "flag_arg", ",", "EObject", "value", ")", "{", "throw", "new", "NotImplemented", "(", ")", ";", "}", "static", "EObject", "sysmon_pid", "=", "ERT", ".", "am_undefined", ";", "@", "BIF", "static", "public", "EObject", "system_monitor", "(", "EObject", "pid", ",", "EObject", "opts", ")", "{", "EPID", "spid", "=", "pid", ".", "testPID", "(", ")", ";", "if", "(", "spid", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "pid", ",", "opts", ")", ";", "sysmon_pid", "=", "pid", ";", "return", "system_monitor", "(", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "system_monitor", "(", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "return", "new", "ETuple2", "(", "sysmon_pid", ",", "ERT", ".", "NIL", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "memory", "(", "EObject", "type", ")", "{", "Runtime", "runtime", "=", "Runtime", ".", "getRuntime", "(", ")", ";", "if", "(", "type", "==", "am_total", ")", "{", "return", "ERT", ".", "box", "(", "runtime", ".", "totalMemory", "(", ")", "-", "runtime", ".", "freeMemory", "(", ")", ")", ";", "}", "else", "{", "throw", "ERT", ".", "notsup", "(", ")", ";", "}", "}", "@", "BIF", "public", "static", "EObject", "md5_init", "(", "EProc", "self", ")", "{", "MessageDigest", "md", ";", "try", "{", "md", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "throw", "new", "NotImplemented", "(", ")", ";", "}", "return", "new", "JavaObject", "(", "self", ",", "md", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "md5_update", "(", "EProc", "self", ",", "EObject", "context", ",", "EObject", "iolist_arg", ")", "{", "List", "<", "ByteBuffer", ">", "buf", "=", "new", "ArrayList", "<", "ByteBuffer", ">", "(", ")", ";", "if", "(", "!", "iolist_arg", ".", "collectIOList", "(", "buf", ")", ")", "{", "throw", "ERT", ".", "badarg", "(", "context", ",", "iolist_arg", ")", ";", "}", "JavaObject", "jo", ";", "if", "(", "(", "jo", "=", "context", ".", "testJavaObject", "(", ")", ")", "!=", "null", "&&", "(", "jo", ".", "realObject", "(", ")", "instanceof", "MessageDigest", ")", ")", "{", "MessageDigest", "md", "=", "(", "MessageDigest", ")", "jo", ".", "realObject", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "buf", ".", "size", "(", ")", ";", "i", "++", ")", "{", "md", ".", "update", "(", "buf", ".", "get", "(", "i", ")", ")", ";", "}", "return", "new", "JavaObject", "(", "self", ",", "md", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "context", ",", "iolist_arg", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "md5_final", "(", "EProc", "self", ",", "EObject", "context", ")", "{", "JavaObject", "jo", ";", "if", "(", "(", "jo", "=", "context", ".", "testJavaObject", "(", ")", ")", "!=", "null", "&&", "(", "jo", ".", "realObject", "(", ")", "instanceof", "MessageDigest", ")", ")", "{", "MessageDigest", "md", "=", "(", "MessageDigest", ")", "jo", ".", "realObject", "(", ")", ";", "byte", "[", "]", "res", "=", "md", ".", "digest", "(", ")", ";", "return", "EBinary", ".", "make", "(", "res", ",", "0", ",", "res", ".", "length", ",", "0", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "context", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "md5", "(", "EObject", "iolist_arg", ")", "{", "List", "<", "ByteBuffer", ">", "buf", "=", "new", "ArrayList", "<", "ByteBuffer", ">", "(", ")", ";", "if", "(", "!", "iolist_arg", ".", "collectIOList", "(", "buf", ")", ")", "{", "throw", "ERT", ".", "badarg", "(", "iolist_arg", ")", ";", "}", "MessageDigest", "md", ";", "try", "{", "md", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "throw", "new", "NotImplemented", "(", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "buf", ".", "size", "(", ")", ";", "i", "++", ")", "{", "md", ".", "update", "(", "buf", ".", "get", "(", "i", ")", ")", ";", "}", "byte", "[", "]", "res", "=", "md", ".", "digest", "(", ")", ";", "return", "EBinary", ".", "make", "(", "res", ",", "0", ",", "res", ".", "length", ",", "0", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "raise", "(", "EObject", "kind", ",", "EObject", "value", ",", "EObject", "trace", ")", "throws", "ErlangException", "{", "EAtom", "clazz", "=", "kind", ".", "testAtom", "(", ")", ";", "ESeq", "traz", "=", "trace", ".", "testSeq", "(", ")", ";", "if", "(", "traz", "==", "null", ")", "{", "return", "ERT", ".", "am_badarg", ";", "}", "if", "(", "clazz", "==", "ERT", ".", "am_exit", "||", "clazz", "==", "ERT", ".", "am_error", "||", "clazz", "==", "ERT", ".", "am_throw", ")", "throw", "new", "ErlangRaise", "(", "clazz", ",", "value", ",", "traz", ")", ";", "return", "ERT", ".", "am_badarg", ";", "}", "@", "BIF", "public", "static", "ESeq", "registered", "(", ")", "{", "return", "ERT", ".", "registered", "(", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "breakpoint", "(", ")", "{", "return", "ERT", ".", "am_ok", ";", "}", "}", "</s>" ]
7,812
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "import", "java", ".", "lang", ".", "management", ".", "ManagementFactory", ";", "import", "java", ".", "lang", ".", "management", ".", "MemoryMXBean", ";", "import", "java", ".", "lang", ".", "management", ".", "MemoryPoolMXBean", ";", "import", "java", ".", "lang", ".", "management", ".", "MemoryType", ";", "import", "java", ".", "lang", ".", "management", ".", "MemoryUsage", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "kilim", ".", "Pausable", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "EAbstractNode", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "ECons", ";", "import", "erjang", ".", "EFun", ";", "import", "erjang", ".", "EHandle", ";", "import", "erjang", ".", "EModuleManager", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EPID", ";", "import", "erjang", ".", "EPeer", ";", "import", "erjang", ".", "EProc", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ERef", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "EString", ";", "import", "erjang", ".", "ETask", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ETuple2", ";", "import", "erjang", ".", "ErjangHibernateException", ";", "import", "erjang", ".", "ErlangException", ";", "import", "erjang", ".", "ErlangExit", ";", "import", "erjang", ".", "ErlangHalt", ";", "import", "erjang", ".", "ErlangUndefined", ";", "import", "erjang", ".", "FunID", ";", "import", "erjang", ".", "Import", ";", "import", "erjang", ".", "Main", ";", "import", "erjang", ".", "NotImplemented", ";", "public", "class", "ErlProc", "{", "private", "static", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_smp_support", "=", "EAtom", ".", "intern", "(", "\"smp_support\"", ")", ";", "private", "static", "final", "EAtom", "am_schedulers", "=", "EAtom", ".", "intern", "(", "\"schedulers\"", ")", ";", "private", "static", "final", "EAtom", "am_break_ignored", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_threads", "=", "EAtom", ".", "intern", "(", "\"threads\"", ")", ";", "public", "static", "final", "EAtom", "am_process", "=", "EAtom", ".", "intern", "(", "\"process\"", ")", ";", "private", "static", "final", "EAtom", "am_wordsize", "=", "EAtom", ".", "intern", "(", "\"wordsize\"", ")", ";", "private", "static", "final", "EAtom", "am_thread_pool_size", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_os_type", "=", "EAtom", ".", "intern", "(", "\"os_type\"", ")", ";", "private", "static", "final", "EAtom", "am_win32", "=", "EAtom", ".", "intern", "(", "\"win32\"", ")", ";", "private", "static", "final", "EAtom", "am_unix", "=", "EAtom", ".", "intern", "(", "\"unix\"", ")", ";", "private", "static", "final", "EAtom", "am_version", "=", "EAtom", ".", "intern", "(", "\"version\"", ")", ";", "private", "static", "final", "EAtom", "am_undefined", "=", "EAtom", ".", "intern", "(", "\"undefined\"", ")", ";", "private", "static", "final", "EAtom", "am_heap", "=", "EAtom", ".", "intern", "(", "\"heap\"", ")", ";", "private", "static", "final", "EAtom", "am_non_heap", "=", "EAtom", ".", "intern", "(", "\"non_heap\"", ")", ";", "private", "static", "final", "EAtom", "am_jvm", "=", "EAtom", ".", "intern", "(", "\"jvm\"", ")", ";", "private", "static", "final", "EAtom", "am_allocated_areas", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_otp_release", "=", "EAtom", ".", "intern", "(", "\"otp_release\"", ")", ";", "private", "static", "final", "EAtom", "am_driver_version", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_global_heaps_size", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_process_count", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_system_architecture", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_logical_processors", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_hipe_architecture", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_machine", "=", "EAtom", ".", "intern", "(", "\"machine\"", ")", ";", "private", "static", "final", "EAtom", "am_link", "=", "EAtom", ".", "intern", "(", "\"link\"", ")", ";", "private", "static", "final", "EAtom", "am_monitor", "=", "EAtom", ".", "intern", "(", "\"monitor\"", ")", ";", "private", "static", "final", "EAtom", "am_priority", "=", "EAtom", ".", "intern", "(", "\"priority\"", ")", ";", "private", "static", "final", "EAtom", "am_system_version", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "public", "static", "final", "EAtom", "am_flush", "=", "EAtom", ".", "intern", "(", "\"flush\"", ")", ";", "public", "static", "final", "EAtom", "am_shutdown", "=", "EAtom", ".", "intern", "(", "\"shutdown\"", ")", ";", "private", "static", "final", "EAtom", "am_ets_alloc", "=", "EAtom", ".", "intern", "(", "\"ets_alloc\"", ")", ";", "private", "static", "final", "EAtom", "am_error_checker", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_debug_compiled", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_lock_checking", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "private", "static", "final", "EAtom", "am_compat_rel", "=", "EAtom", ".", "intern", "(", "\"compat_rel\"", ")", ";", "@", "BIF", "public", "static", "EObject", "process_info", "(", "EObject", "pid", ",", "EObject", "what", ")", "{", "EPID", "p", "=", "pid", ".", "testPID", "(", ")", ";", "if", "(", "p", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "pid", ",", "what", ")", ";", "return", "p", ".", "process_info", "(", "what", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "process_info", "(", "EObject", "pid", ")", "{", "EPID", "p", "=", "pid", ".", "testPID", "(", ")", ";", "if", "(", "p", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "pid", ")", ";", "return", "p", ".", "process_info", "(", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "display", "(", "EProc", "proc", ",", "EObject", "obj", ")", "{", "ERT", ".", "getOutputStream", "(", ")", ".", "println", "(", "obj", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "public", "static", "ESeq", "get_stacktrace", "(", "EProc", "proc", ")", "{", "ErlangException", "ex", "=", "proc", ".", "getLastException", "(", ")", ";", "return", "ex", "!=", "null", "?", "ex", ".", "getTrace", "(", ")", ":", "ERT", ".", "NIL", ";", "}", "@", "BIF", "public", "static", "EObject", "erase", "(", "EProc", "proc", ",", "EObject", "key", ")", "{", "return", "proc", ".", "erase", "(", "key", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "erase", "(", "EProc", "proc", ")", "{", "return", "proc", ".", "erase", "(", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "register", "(", "EObject", "name", ",", "EObject", "pid", ")", "{", "EAtom", "aname", ";", "EHandle", "handle", "=", "pid", ".", "testHandle", "(", ")", ";", "if", "(", "(", "aname", "=", "name", ".", "testAtom", "(", ")", ")", "==", "null", "||", "handle", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "name", ",", "pid", ")", ";", "ERT", ".", "register", "(", "aname", ",", "handle", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "public", "static", "EObject", "unregister", "(", "EObject", "name", ")", "{", "EAtom", "aname", ";", "if", "(", "(", "aname", "=", "name", ".", "testAtom", "(", ")", ")", "==", "null", "||", "!", "ERT", ".", "unregister", "(", "aname", ")", ")", "throw", "ERT", ".", "badarg", "(", "name", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "public", "static", "EObject", "spawn_link", "(", "EProc", "proc", ",", "EObject", "mod", ",", "EObject", "fun", ",", "EObject", "args", ")", "throws", "Pausable", "{", "EAtom", "m", "=", "mod", ".", "testAtom", "(", ")", ";", "EAtom", "f", "=", "fun", ".", "testAtom", "(", ")", ";", "ESeq", "a", "=", "args", ".", "testSeq", "(", ")", ";", "if", "(", "m", "==", "null", "||", "f", "==", "null", "||", "a", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "mod", ",", "fun", ",", "args", ")", ";", "EProc", "p2", "=", "new", "EProc", "(", "proc", ".", "group_leader", "(", ")", ",", "m", ",", "f", ",", "a", ")", ";", "p2", ".", "link_to", "(", "proc", ")", ";", "ERT", ".", "run", "(", "p2", ")", ";", "return", "p2", ".", "self_handle", "(", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "spawn_opt", "(", "EProc", "self", ",", "EObject", "tup", ")", "throws", "Pausable", "{", "ETuple", "t", ";", "EAtom", "m", ";", "EAtom", "f", ";", "ESeq", "a", ";", "ESeq", "o", ";", "if", "(", "(", "t", "=", "tup", ".", "testTuple", "(", ")", ")", "==", "null", "||", "t", ".", "arity", "(", ")", "!=", "4", "||", "(", "m", "=", "t", ".", "elm", "(", "1", ")", ".", "testAtom", "(", ")", ")", "==", "null", "||", "(", "f", "=", "t", ".", "elm", "(", "2", ")", ".", "testAtom", "(", ")", ")", "==", "null", "||", "(", "a", "=", "t", ".", "elm", "(", "3", ")", ".", "testSeq", "(", ")", ")", "==", "null", "||", "(", "o", "=", "t", ".", "elm", "(", "4", ")", ".", "testSeq", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "tup", ")", ";", "boolean", "link", "=", "false", ";", "boolean", "monitor", "=", "false", ";", "EAtom", "priority", "=", "null", ";", "for", "(", ";", "!", "o", ".", "isNil", "(", ")", ";", "o", "=", "o", ".", "tail", "(", ")", ")", "{", "EObject", "val", "=", "o", ".", "head", "(", ")", ";", "ETuple2", "t2", ";", "if", "(", "val", "==", "am_link", ")", "{", "link", "=", "true", ";", "}", "else", "if", "(", "val", "==", "am_monitor", ")", "{", "monitor", "=", "true", ";", "}", "else", "if", "(", "(", "t2", "=", "ETuple2", ".", "cast", "(", "val", ")", ")", "!=", "null", ")", "{", "if", "(", "t2", ".", "elm", "(", "1", ")", "==", "am_priority", ")", "{", "EAtom", "am", "=", "t2", ".", "elm", "(", "2", ")", ".", "testAtom", "(", ")", ";", "if", "(", "am", "!=", "null", ")", "priority", "=", "am", ";", "}", "}", "}", "EProc", "p2", "=", "new", "EProc", "(", "self", ".", "group_leader", "(", ")", ",", "m", ",", "f", ",", "a", ")", ";", "if", "(", "link", ")", "{", "p2", ".", "link_to", "(", "self", ")", ";", "}", "if", "(", "priority", "!=", "null", ")", "{", "p2", ".", "process_flag", "(", "am_priority", ",", "priority", ")", ";", "}", "ERef", "ref", "=", "null", ";", "if", "(", "monitor", ")", "{", "ref", "=", "ERT", ".", "getLocalNode", "(", ")", ".", "createRef", "(", ")", ";", "if", "(", "!", "self", ".", "monitor", "(", "p2", ".", "self_handle", "(", ")", ",", "p2", ".", "self_handle", "(", ")", ",", "ref", ")", ")", "{", "throw", "new", "InternalError", "(", "\"\"", ")", ";", "}", "}", "ERT", ".", "run", "(", "p2", ")", ";", "if", "(", "monitor", ")", "{", "return", "new", "ETuple2", "(", "p2", ".", "self_handle", "(", ")", ",", "ref", ")", ";", "}", "else", "{", "return", "p2", ".", "self_handle", "(", ")", ";", "}", "}", "@", "BIF", "public", "static", "EObject", "spawn", "(", "EProc", "proc", ",", "EObject", "mod", ",", "EObject", "fun", ",", "EObject", "args", ")", "{", "EAtom", "m", "=", "mod", ".", "testAtom", "(", ")", ";", "EAtom", "f", "=", "fun", ".", "testAtom", "(", ")", ";", "ESeq", "a", "=", "args", ".", "testSeq", "(", ")", ";", "if", "(", "m", "==", "null", "||", "f", "==", "null", "||", "a", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "mod", ",", "fun", ",", "args", ")", ";", "EProc", "p2", "=", "new", "EProc", "(", "proc", ".", "group_leader", "(", ")", ",", "m", ",", "f", ",", "a", ")", ";", "ERT", ".", "run", "(", "p2", ")", ";", "return", "p2", ".", "self_handle", "(", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "halt", "(", "EProc", "proc", ")", "{", "return", "halt", "(", "proc", ",", "null", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "halt", "(", "EProc", "proc", ",", "EObject", "value", ")", "{", "int", "exitCode", "=", "1", ";", "String", "message", "=", "null", ";", "if", "(", "value", "!=", "null", ")", "{", "ESmall", "val", "=", "value", ".", "testSmall", "(", ")", ";", "if", "(", "val", "!=", "null", ")", "{", "exitCode", "=", "val", ".", "value", ";", "}", "EString", "str", "=", "value", ".", "testString", "(", ")", ";", "if", "(", "str", "!=", "null", ")", "{", "message", "=", "str", ".", "stringValue", "(", ")", ";", "}", "}", "if", "(", "message", "!=", "null", ")", "{", "log", ".", "severe", "(", "\"\"", "+", "message", ")", ";", "}", "else", "{", "log", ".", "info", "(", "\"\"", ")", ";", "}", "ERT", ".", "shutdown", "(", ")", ";", "throw", "new", "ErlangHalt", "(", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "unlink", "(", "EProc", "self", ",", "EObject", "pid", ")", "throws", "Pausable", "{", "EHandle", "h", "=", "EHandle", ".", "cast", "(", "pid", ")", ";", "if", "(", "h", "!=", "null", ")", "{", "self", ".", "unlink", "(", "h", ")", ";", "}", "return", "pid", ";", "}", "@", "BIF", "static", "public", "EObject", "link", "(", "EProc", "self", ",", "EObject", "pid", ")", "throws", "Pausable", "{", "EHandle", "h", "=", "EHandle", ".", "cast", "(", "pid", ")", ";", "if", "(", "h", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "pid", ")", ";", "self", ".", "link_to", "(", "h", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "static", "public", "EObject", "monitor", "(", "EProc", "self", ",", "EObject", "how", ",", "EObject", "object", ")", "throws", "Pausable", "{", "if", "(", "how", "!=", "am_process", ")", "throw", "ERT", ".", "badarg", "(", "how", ",", "object", ")", ";", "EHandle", "h", "=", "EHandle", ".", "cast", "(", "object", ")", ";", "if", "(", "h", "!=", "null", ")", "{", "ERef", "ref", "=", "ERT", ".", "getLocalNode", "(", ")", ".", "createRef", "(", ")", ";", "if", "(", "!", "self", ".", "monitor", "(", "h", ",", "h", ",", "ref", ")", ")", "{", "self", ".", "mbox_send", "(", "ETuple", ".", "make", "(", "ERT", ".", "am_DOWN", ",", "ref", ",", "am_process", ",", "object", ",", "ERT", ".", "am_noproc", ")", ")", ";", "}", "return", "ref", ";", "}", "EAtom", "name", ";", "if", "(", "h", "==", "null", "&&", "(", "name", "=", "object", ".", "testAtom", "(", ")", ")", "!=", "null", ")", "{", "ERef", "ref", "=", "ERT", ".", "getLocalNode", "(", ")", ".", "createRef", "(", ")", ";", "boolean", "success", "=", "false", ";", "object", "=", "new", "ETuple2", "(", "name", ",", "ErlDist", ".", "node", "(", ")", ")", ";", "if", "(", "(", "h", "=", "ERT", ".", "whereis", "(", "name", ")", ".", "testHandle", "(", ")", ")", "!=", "null", ")", "{", "success", "=", "self", ".", "monitor", "(", "h", ",", "object", ",", "ref", ")", ";", "}", "if", "(", "!", "success", ")", "{", "self", ".", "mbox_send", "(", "ETuple", ".", "make", "(", "ERT", ".", "am_DOWN", ",", "ref", ",", "am_process", ",", "object", ",", "ERT", ".", "am_noproc", ")", ")", ";", "}", "return", "ref", ";", "}", "ETuple", "tup", ";", "EAtom", "node", ";", "if", "(", "(", "tup", "=", "object", ".", "testTuple", "(", ")", ")", "!=", "null", "&&", "tup", ".", "arity", "(", ")", "==", "2", "&&", "(", "name", "=", "tup", ".", "elm", "(", "1", ")", ".", "testAtom", "(", ")", ")", "!=", "null", "&&", "(", "node", "=", "tup", ".", "elm", "(", "2", ")", ".", "testAtom", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "node", "==", "ErlDist", ".", "node", "(", ")", ")", "{", "ERef", "ref", "=", "ERT", ".", "getLocalNode", "(", ")", ".", "createRef", "(", ")", ";", "boolean", "success", "=", "false", ";", "if", "(", "(", "h", "=", "ERT", ".", "whereis", "(", "name", ")", ".", "testHandle", "(", ")", ")", "!=", "null", ")", "{", "success", "=", "self", ".", "monitor", "(", "h", ",", "object", ",", "ref", ")", ";", "}", "if", "(", "!", "success", ")", "{", "self", ".", "mbox_send", "(", "ETuple", ".", "make", "(", "ERT", ".", "am_DOWN", ",", "ref", ",", "am_process", ",", "object", ",", "ERT", ".", "am_noproc", ")", ")", ";", "}", "return", "ref", ";", "}", "else", "{", "EPeer", "peer", "=", "(", "EPeer", ")", "EPeer", ".", "get", "(", "node", ")", ";", "if", "(", "peer", "!=", "null", ")", "{", "ERef", "ref", "=", "ERT", ".", "getLocalNode", "(", ")", ".", "createRef", "(", ")", ";", "self", ".", "monitor", "(", "tup", ",", "ref", ")", ";", "peer", ".", "dsig_monitor", "(", "self", ".", "self_handle", "(", ")", ",", "name", ",", "ref", ")", ";", "return", "ref", ";", "}", "return", "ErlDist", ".", "dmonitor_p2_trap", ".", "invoke", "(", "self", ",", "new", "EObject", "[", "]", "{", "how", ",", "object", "}", ")", ";", "}", "}", "throw", "ERT", ".", "badarg", "(", "how", ",", "object", ")", ";", "}", "@", "Import", "(", "module", "=", "\"erlang\"", ",", "fun", "=", "\"\"", ",", "arity", "=", "2", ")", "static", "EFun", "flush_monitor_message", "=", "null", ";", "@", "BIF", "static", "public", "EObject", "demonitor", "(", "EProc", "self", ",", "EObject", "ref", ")", "throws", "Pausable", "{", "return", "demonitor", "(", "self", ",", "ref", ",", "ERT", ".", "NIL", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "demonitor", "(", "EProc", "self", ",", "EObject", "ref", ",", "EObject", "options", ")", "throws", "Pausable", "{", "return", "demonitor", "(", "(", "ETask", "<", "?", ">", ")", "self", ",", "ref", ",", "options", ")", ";", "}", "static", "public", "EObject", "demonitor", "(", "ETask", "<", "?", ">", "self", ",", "EObject", "ref", ",", "EObject", "options", ")", "throws", "Pausable", "{", "ERef", "r", "=", "ref", ".", "testReference", "(", ")", ";", "ESeq", "o", "=", "options", ".", "testSeq", "(", ")", ";", "if", "(", "r", "==", "null", "||", "o", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "ref", ",", "options", ")", ";", "boolean", "flush", "=", "(", "!", "o", ".", "isNil", "(", ")", "&&", "o", ".", "head", "(", ")", "==", "am_flush", ")", ";", "EObject", "found", "=", "self", ".", "demonitor", "(", "r", ")", ";", "if", "(", "found", "==", "null", ")", "{", "return", "ERT", ".", "FALSE", ";", "}", "EHandle", "h", ";", "ETuple", "tup", ";", "EAtom", "name", ";", "EAtom", "node", ";", "if", "(", "(", "h", "=", "found", ".", "testHandle", "(", ")", ")", "!=", "null", ")", "{", "h", ".", "remove_monitor", "(", "self", ".", "self_handle", "(", ")", ",", "r", ",", "flush", ")", ";", "}", "else", "if", "(", "(", "tup", "=", "found", ".", "testTuple", "(", ")", ")", "!=", "null", "&&", "tup", ".", "arity", "(", ")", "==", "2", "&&", "(", "name", "=", "tup", ".", "elm", "(", "1", ")", ".", "testAtom", "(", ")", ")", "!=", "null", "&&", "(", "node", "=", "tup", ".", "elm", "(", "2", ")", ".", "testAtom", "(", ")", ")", "!=", "null", ")", "{", "EAbstractNode", "n", "=", "EAbstractNode", ".", "get_or_connect", "(", "self", ",", "node", ")", ";", "if", "(", "n", "!=", "null", ")", "{", "n", ".", "dsig_demonitor", "(", "self", ".", "self_handle", "(", ")", ",", "r", ",", "name", ")", ";", "}", "}", "if", "(", "flush", "&&", "(", "self", "instanceof", "EProc", ")", ")", "{", "flush_monitor_message", ".", "invoke", "(", "(", "EProc", ")", "self", ",", "new", "EObject", "[", "]", "{", "ref", ",", "ERT", ".", "am_ok", "}", ")", ";", "}", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "public", "static", "EAtom", "exit", "(", "EProc", "proc", ",", "EObject", "p", ",", "EObject", "reason", ")", "throws", "Pausable", "{", "EHandle", "pid", "=", "p", ".", "testHandle", "(", ")", ";", "if", "(", "pid", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "p", ",", "reason", ")", ";", "if", "(", "pid", "==", "proc", ".", "self_handle", "(", ")", ")", "{", "throw", "new", "ErlangExit", "(", "reason", ")", ";", "}", "pid", ".", "exit_signal", "(", "proc", ".", "self_handle", "(", ")", ",", "reason", ",", "true", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "public", "static", "EObject", "exit", "(", "EObject", "a1", ")", "{", "throw", "new", "ErlangExit", "(", "a1", ")", ";", "}", "@", "BIF", "public", "static", "ERef", "make_ref", "(", "EProc", "proc", ")", "{", "return", "ERT", ".", "getLocalNode", "(", ")", ".", "createRef", "(", ")", ";", "}", "@", "BIF", "static", "EObject", "group_leader", "(", "EProc", "proc", ")", "{", "return", "proc", ".", "group_leader", "(", ")", ";", "}", "@", "BIF", "static", "EObject", "group_leader", "(", "EObject", "group_leader", ",", "EObject", "pid", ")", "{", "EPID", "p", "=", "pid", ".", "testPID", "(", ")", ";", "EPID", "gl", "=", "group_leader", ".", "testPID", "(", ")", ";", "if", "(", "p", "==", "null", "||", "gl", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "group_leader", ",", "pid", ")", ";", "p", ".", "set_group_leader", "(", "gl", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "static", "EAtom", "am_allocator", "=", "EAtom", ".", "intern", "(", "\"allocator\"", ")", ";", "static", "EAtom", "am_heap_type", "=", "EAtom", ".", "intern", "(", "\"heap_type\"", ")", ";", "static", "EAtom", "am_shared", "=", "EAtom", ".", "intern", "(", "\"shared\"", ")", ";", "@", "BIF", "static", "EObject", "system_info", "(", "EProc", "proc", ",", "EObject", "type", ")", "{", "if", "(", "type", "==", "am_machine", ")", "{", "return", "EString", ".", "fromString", "(", "\"BEAM\"", ")", ";", "}", "else", "if", "(", "type", "==", "am_smp_support", ")", "{", "return", "ERT", ".", "TRUE", ";", "}", "else", "if", "(", "type", "==", "am_schedulers", ")", "{", "return", "ERT", ".", "box", "(", "ERT", ".", "threadPoolSize", "(", ")", ")", ";", "}", "else", "if", "(", "type", "==", "am_threads", ")", "{", "return", "ERT", ".", "box", "(", "true", ")", ";", "}", "else", "if", "(", "type", "==", "am_thread_pool_size", ")", "{", "return", "ERT", ".", "box", "(", "ERT", ".", "asyncThreadPoolSize", "(", ")", ")", ";", "}", "else", "if", "(", "type", "==", "am_break_ignored", ")", "{", "return", "ERT", ".", "box", "(", "false", ")", ";", "}", "else", "if", "(", "type", "==", "am_compat_rel", ")", "{", "return", "new", "ESmall", "(", "14", ")", ";", "}", "ETuple2", "tup", ";", "if", "(", "type", "==", "am_allocated_areas", ")", "{", "ECons", "res", "=", "ERT", ".", "NIL", ";", "List", "<", "MemoryPoolMXBean", ">", "bean2", "=", "ManagementFactory", ".", "getMemoryPoolMXBeans", "(", ")", ";", "if", "(", "bean2", "==", "null", ")", "{", "MemoryMXBean", "bean", "=", "ManagementFactory", ".", "getMemoryMXBean", "(", ")", ";", "if", "(", "bean", "!=", "null", ")", "{", "MemoryUsage", "mu", "=", "bean", ".", "getHeapMemoryUsage", "(", ")", ";", "res", "=", "res", ".", "cons", "(", "ETuple", ".", "make", "(", "am_heap", ",", "ERT", ".", "box", "(", "mu", ".", "getCommitted", "(", ")", ")", ",", "ERT", ".", "box", "(", "mu", ".", "getUsed", "(", ")", ")", ")", ")", ";", "mu", "=", "bean", ".", "getNonHeapMemoryUsage", "(", ")", ";", "res", "=", "res", ".", "cons", "(", "ETuple", ".", "make", "(", "am_non_heap", ",", "ERT", ".", "box", "(", "mu", ".", "getCommitted", "(", ")", ")", ",", "ERT", ".", "box", "(", "mu", ".", "getUsed", "(", ")", ")", ")", ")", ";", "}", "return", "res", ";", "}", "for", "(", "MemoryPoolMXBean", "mb", ":", "bean2", ")", "{", "String", "name", "=", "mb", ".", "getName", "(", ")", ";", "MemoryUsage", "mu", "=", "mb", ".", "getUsage", "(", ")", ";", "if", "(", "mu", "==", "null", ")", "continue", ";", "String", "name2", "=", "(", "mb", ".", "getType", "(", ")", "==", "MemoryType", ".", "HEAP", "?", "\"heap:\"", ":", "\"non_heap:\"", ")", "+", "name", ";", "res", "=", "res", ".", "cons", "(", "ETuple", ".", "make", "(", "EAtom", ".", "intern", "(", "name2", ")", ",", "ERT", ".", "box", "(", "mu", ".", "getCommitted", "(", ")", ")", ",", "ERT", ".", "box", "(", "mu", ".", "getUsed", "(", ")", ")", ")", ")", ";", "}", "return", "res", ";", "}", "else", "if", "(", "type", "==", "am_allocator", ")", "{", "return", "am_jvm", ";", "}", "else", "if", "(", "type", "==", "am_heap_type", ")", "{", "return", "am_shared", ";", "}", "else", "if", "(", "type", "==", "am_smp_support", ")", "{", "return", "ERT", ".", "TRUE", ";", "}", "else", "if", "(", "type", "==", "am_thread_pool_size", ")", "{", "return", "new", "ESmall", "(", "ERT", ".", "threadPoolSize", "(", ")", ")", ";", "}", "else", "if", "(", "type", "==", "am_os_type", ")", "{", "String", "os", "=", "System", ".", "getProperty", "(", "\"os.name\"", ")", ";", "if", "(", "os", ".", "startsWith", "(", "\"Windows\"", ")", ")", "{", "return", "ETuple", ".", "make", "(", "am_win32", ",", "new", "EString", "(", "os", ")", ")", ";", "}", "else", "{", "return", "ETuple", ".", "make", "(", "am_unix", ",", "new", "EString", "(", "os", ")", ")", ";", "}", "}", "else", "if", "(", "type", "==", "am_threads", ")", "{", "return", "ERT", ".", "TRUE", ";", "}", "else", "if", "(", "type", "==", "am_version", ")", "{", "String", "erts_version", "=", "ERT", ".", "runtime_info", ".", "erts_version", ";", "String", "prefix", "=", "\"erts-\"", ";", "if", "(", "erts_version", ".", "startsWith", "(", "prefix", ")", ")", "{", "erts_version", "=", "erts_version", ".", "substring", "(", "prefix", ".", "length", "(", ")", ")", ";", "}", "return", "EString", ".", "fromString", "(", "erts_version", ")", ";", "}", "else", "if", "(", "type", "==", "am_otp_release", ")", "{", "return", "new", "EString", "(", "ERT", ".", "runtime_info", ".", "otp_version", ")", ";", "}", "else", "if", "(", "type", "==", "am_logical_processors", ")", "{", "return", "ERT", ".", "box", "(", "Runtime", ".", "getRuntime", "(", ")", ".", "availableProcessors", "(", ")", ")", ";", "}", "else", "if", "(", "type", "==", "am_global_heaps_size", ")", "{", "return", "ERT", ".", "box", "(", "Runtime", ".", "getRuntime", "(", ")", ".", "totalMemory", "(", ")", ")", ";", "}", "else", "if", "(", "type", "==", "am_process_count", ")", "{", "return", "ERT", ".", "box", "(", "EProc", ".", "process_count", "(", ")", ")", ";", "}", "else", "if", "(", "type", "==", "am_system_architecture", ")", "{", "return", "new", "EString", "(", "Main", ".", "SYSTEM_ARCHITECTURE", ")", ";", "}", "else", "if", "(", "type", "==", "am_driver_version", ")", "{", "return", "new", "EString", "(", "Main", ".", "DRIVER_VERSION", ")", ";", "}", "else", "if", "(", "type", "==", "am_wordsize", ")", "{", "return", "new", "ESmall", "(", "4", ")", ";", "}", "else", "if", "(", "type", "==", "am_debug_compiled", "||", "type", "==", "am_lock_checking", ")", "{", "throw", "ERT", ".", "badarg", "(", "type", ")", ";", "}", "else", "if", "(", "type", "==", "am_hipe_architecture", ")", "{", "return", "am_undefined", ";", "}", "else", "if", "(", "type", "==", "am_system_version", ")", "{", "return", "new", "EString", "(", "\"Erjang", "[\"", "+", "ERT", ".", "runtime_info", ".", "erts_version", "+", "\"]\"", ")", ";", "}", "else", "if", "(", "(", "tup", "=", "ETuple2", ".", "cast", "(", "type", ")", ")", "!=", "null", ")", "{", "if", "(", "tup", ".", "elem1", "==", "am_allocator", ")", "{", "if", "(", "tup", ".", "elem2", "==", "am_ets_alloc", ")", "{", "return", "ERT", ".", "FALSE", ";", "}", "}", "else", "if", "(", "tup", ".", "elem1", "==", "am_error_checker", ")", "{", "throw", "ERT", ".", "badarg", "(", "type", ")", ";", "}", "return", "am_undefined", ";", "}", "else", "{", "log", ".", "info", "(", "\"\"", "+", "type", "+", "\")", "unknown\"", ")", ";", "throw", "ERT", ".", "badarg", "(", "type", ")", ";", "}", "}", "@", "BIF", "static", "EAtom", "module_loaded", "(", "EObject", "mod", ")", "{", "EAtom", "m", ";", "if", "(", "(", "m", "=", "mod", ".", "testAtom", "(", ")", ")", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "mod", ")", ";", "return", "EModuleManager", ".", "module_loaded", "(", "m", ")", "?", "ERT", ".", "TRUE", ":", "ERT", ".", "FALSE", ";", "}", "@", "BIF", "static", "ESeq", "processes", "(", ")", "{", "return", "EProc", ".", "processes", "(", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "is_process_alive", "(", "EObject", "p", ")", "{", "EPID", "pid", "=", "p", ".", "testPID", "(", ")", ";", "if", "(", "pid", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "p", ")", ";", "return", "ERT", ".", "box", "(", "pid", ".", "is_alive", "(", ")", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "suspend_process", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "throw", "new", "NotImplemented", "(", ")", ";", "}", "@", "BIF", "public", "static", "EAtom", "check_process_code", "(", "EObject", "pid_arg", ",", "EObject", "mod_arg", ")", "{", "EPID", "pid", "=", "pid_arg", ".", "testPID", "(", ")", ";", "EAtom", "mod", "=", "mod_arg", ".", "testAtom", "(", ")", ";", "if", "(", "pid", "==", "null", "||", "mod", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "pid_arg", ",", "mod_arg", ")", ";", "}", "log", ".", "log", "(", "Level", ".", "FINE", ",", "\"\"", "+", "pid", "+", "\",", "\"", "+", "mod", "+", "\")\"", ")", ";", "return", "ERT", ".", "FALSE", ";", "}", "@", "BIF", "public", "static", "EAtom", "purge_module", "(", "EObject", "mod_arg", ")", "{", "log", ".", "log", "(", "Level", ".", "FINE", ",", "\"\"", "+", "mod_arg", "+", "\")\"", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "@", "BIF", "public", "static", "EObject", "hibernate", "(", "EProc", "self", ",", "EObject", "a1", ",", "EObject", "a2", ",", "EObject", "a3", ")", "{", "EAtom", "m", "=", "a1", ".", "testAtom", "(", ")", ";", "EAtom", "f", "=", "a2", ".", "testAtom", "(", ")", ";", "ESeq", "a", "=", "a3", ".", "testSeq", "(", ")", ";", "if", "(", "m", "==", "null", "||", "f", "==", "null", "||", "a", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "a1", ",", "a2", ",", "a3", ")", ";", "}", "int", "arity", "=", "a", ".", "length", "(", ")", ";", "EFun", "target", "=", "EModuleManager", ".", "resolve", "(", "new", "FunID", "(", "m", ",", "f", ",", "arity", ")", ")", ";", "if", "(", "target", "==", "null", ")", "{", "throw", "new", "ErlangUndefined", "(", "m", ",", "f", ",", "new", "ESmall", "(", "arity", ")", ")", ";", "}", "self", ".", "tail", "=", "target", ";", "a", "=", "a", ".", "reverse", "(", ")", ";", "switch", "(", "arity", ")", "{", "default", ":", "throw", "new", "NotImplemented", "(", "\"hibernate", "w/\"", "+", "arity", "+", "\"", "args\"", ")", ";", "case", "7", ":", "self", ".", "arg6", "=", "a", ".", "head", "(", ")", ";", "a", "=", "a", ".", "tail", "(", ")", ";", "case", "6", ":", "self", ".", "arg5", "=", "a", ".", "head", "(", ")", ";", "a", "=", "a", ".", "tail", "(", ")", ";", "case", "5", ":", "self", ".", "arg4", "=", "a", ".", "head", "(", ")", ";", "a", "=", "a", ".", "tail", "(", ")", ";", "case", "4", ":", "self", ".", "arg3", "=", "a", ".", "head", "(", ")", ";", "a", "=", "a", ".", "tail", "(", ")", ";", "case", "3", ":", "self", ".", "arg2", "=", "a", ".", "head", "(", ")", ";", "a", "=", "a", ".", "tail", "(", ")", ";", "case", "2", ":", "self", ".", "arg1", "=", "a", ".", "head", "(", ")", ";", "a", "=", "a", ".", "tail", "(", ")", ";", "case", "1", ":", "self", ".", "arg0", "=", "a", ".", "head", "(", ")", ";", "case", "0", ":", "}", "throw", "ErjangHibernateException", ".", "INSTANCE", ";", "}", "}", "</s>" ]
7,813
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "EInteger", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ESmall", ";", "public", "class", "ErlHash", "{", "@", "BIF", "static", "public", "ESmall", "hash", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "ESmall", "range", ";", "if", "(", "(", "range", "=", "a2", ".", "testSmall", "(", ")", ")", "==", "null", "||", "range", ".", "value", "<=", "0", ")", "throw", "ERT", ".", "badarg", "(", "a1", ",", "a2", ")", ";", "int", "hash", "=", "make_broken_hash", "(", "a1", ")", ";", "return", "ERT", ".", "box", "(", "1", "+", "(", "hash", "%", "range", ".", "value", ")", ")", ";", "}", "private", "static", "int", "make_broken_hash", "(", "EObject", "value", ")", "{", "return", "value", ".", "hashCode", "(", ")", ";", "}", "static", "EInteger", "I2POW32", "=", "ERT", ".", "box", "(", "0x100000000L", ")", ";", "@", "BIF", "public", "static", "EObject", "phash", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "long", "hash", ",", "final_hash", ",", "range", ";", "if", "(", "I2POW32", ".", "equalsExactly", "(", "a2", ")", ")", "{", "range", "=", "0", ";", "}", "else", "{", "EInteger", "ival", ";", "if", "(", "(", "ival", "=", "a2", ".", "testInteger", "(", ")", ")", "==", "null", "||", "(", "range", "=", "ival", ".", "intValue", "(", ")", ")", "==", "0", "||", "(", "(", "range", "&", "~", "0xffffffffL", ")", "!=", "0", ")", ")", "throw", "ERT", ".", "badarg", "(", "a1", ",", "a2", ")", ";", "range", "=", "Math", ".", "abs", "(", "range", ")", "&", "0xffffffff", ";", "}", "hash", "=", "make_hash", "(", "a1", ")", "&", "0x7fffffff", ";", "if", "(", "range", "!=", "0", ")", "{", "final_hash", "=", "1", "+", "(", "hash", "%", "range", ")", ";", "}", "else", "{", "final_hash", "=", "hash", "+", "1", ";", "}", "return", "ERT", ".", "box", "(", "final_hash", ")", ";", "}", "private", "static", "int", "make_hash", "(", "EObject", "value", ")", "{", "return", "value", ".", "hashCode", "(", ")", ";", "}", "@", "BIF", "public", "static", "ESmall", "phash2", "(", "EObject", "value", ")", "{", "int", "hash", "=", "make_hash2", "(", "value", ")", "&", "0xffffffff", ";", "return", "ERT", ".", "box", "(", "hash", "&", "(", "(", "1", "<<", "27", ")", "-", "1", ")", ")", ";", "}", "private", "static", "int", "make_hash2", "(", "EObject", "value", ")", "{", "return", "value", ".", "hashCode", "(", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "phash2", "(", "EObject", "a1", ",", "EObject", "a2", ")", "{", "long", "hash", ",", "final_hash", ",", "range", ";", "if", "(", "I2POW32", ".", "equals", "(", "a2", ")", ")", "{", "range", "=", "0", ";", "}", "else", "{", "EInteger", "ival", ";", "if", "(", "(", "ival", "=", "a2", ".", "testInteger", "(", ")", ")", "==", "null", "||", "(", "range", "=", "ival", ".", "intValue", "(", ")", ")", "==", "0", "||", "(", "(", "range", "&", "~", "0xffffffffL", ")", "!=", "0", ")", ")", "throw", "ERT", ".", "badarg", "(", "a1", ",", "a2", ")", ";", "range", "=", "Math", ".", "abs", "(", "range", ")", "&", "0xffffffff", ";", "}", "hash", "=", "make_hash2", "(", "a1", ")", "&", "0xffffffff", ";", "if", "(", "range", "!=", "0", ")", "{", "final_hash", "=", "1", "+", "(", "hash", "%", "range", ")", ";", "}", "else", "{", "final_hash", "=", "hash", "+", "1", ";", "}", "return", "ERT", ".", "box", "(", "final_hash", ")", ";", "}", "}", "</s>" ]
7,814
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "kilim", ".", "Pausable", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "EAbstractNode", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EFun", ";", "import", "erjang", ".", "EHandle", ";", "import", "erjang", ".", "EInternalPID", ";", "import", "erjang", ".", "EInternalPort", ";", "import", "erjang", ".", "ENode", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EPeer", ";", "import", "erjang", ".", "EProc", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ERef", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ETuple2", ";", "import", "erjang", ".", "ErlangError", ";", "import", "erjang", ".", "Import", ";", "import", "erjang", ".", "NotImplemented", ";", "import", "erjang", ".", "BIF", ".", "Type", ";", "import", "erjang", ".", "driver", ".", "EDriverTask", ";", "public", "class", "ErlDist", "{", "static", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.dist\"", ")", ";", "private", "static", "DistEntry", "this_dist_entry", "=", "null", ";", "private", "static", "final", "EAtom", "am_net_kernel", "=", "EAtom", ".", "intern", "(", "\"net_kernel\"", ")", ";", "private", "static", "final", "EAtom", "am_Noname", "=", "EAtom", ".", "intern", "(", "\"Noname\"", ")", ";", "static", "{", "this_dist_entry", "=", "new", "DistEntry", "(", "am_Noname", ",", "(", "EInternalPort", ")", "null", ")", ";", "}", "@", "Import", "(", "module", "=", "\"net_kernel\"", ",", "fun", "=", "\"connect\"", ",", "arity", "=", "1", ")", "public", "static", "EFun", "net_kernel__connect__1", ";", "@", "Import", "(", "module", "=", "\"erlang\"", ",", "fun", "=", "\"dsend\"", ",", "arity", "=", "2", ")", "static", "EFun", "dsend2_trap", ";", "@", "Import", "(", "module", "=", "\"erlang\"", ",", "fun", "=", "\"dsend\"", ",", "arity", "=", "3", ")", "static", "EFun", "dsend3_trap", ";", "@", "Import", "(", "module", "=", "\"erlang\"", ",", "fun", "=", "\"dlink\"", ",", "arity", "=", "1", ")", "static", "EFun", "dlink1_trap", ";", "@", "Import", "(", "module", "=", "\"erlang\"", ",", "fun", "=", "\"dunlink\"", ",", "arity", "=", "1", ")", "static", "EFun", "dunlink1_trap", ";", "@", "Import", "(", "module", "=", "\"erlang\"", ",", "fun", "=", "\"\"", ",", "arity", "=", "3", ")", "static", "EFun", "dmonitor_node3_trap", ";", "@", "Import", "(", "module", "=", "\"erlang\"", ",", "fun", "=", "\"\"", ",", "arity", "=", "2", ")", "static", "EFun", "dgroup_leader2_trap", ";", "@", "Import", "(", "module", "=", "\"erlang\"", ",", "fun", "=", "\"dexit\"", ",", "arity", "=", "2", ")", "static", "EFun", "dexit2_trap", ";", "@", "Import", "(", "module", "=", "\"erlang\"", ",", "fun", "=", "\"dmonitor_p\"", ",", "arity", "=", "2", ")", "static", "EFun", "dmonitor_p2_trap", ";", "static", "EAtom", "erts_is_alive", "=", "ERT", ".", "FALSE", ";", "@", "BIF", "public", "static", "final", "EObject", "is_alive", "(", ")", "{", "return", "erts_is_alive", ";", "}", "@", "BIF", "public", "static", "EObject", "nodes", "(", "EObject", "node", ")", "{", "throw", "new", "NotImplemented", "(", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "monitor_node", "(", "EProc", "proc", ",", "EObject", "node", ",", "EObject", "flag", ",", "EObject", "opts", ")", "throws", "Pausable", "{", "EAtom", "aname", "=", "node", ".", "testAtom", "(", ")", ";", "EAtom", "aflag", "=", "flag", ".", "testAtom", "(", ")", ";", "ESeq", "sopts", "=", "opts", ".", "testSeq", "(", ")", ";", "if", "(", "aname", "==", "null", "||", "aflag", "==", "null", "||", "sopts", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "node", ",", "flag", ")", ";", "}", "EAbstractNode", "n", "=", "EPeer", ".", "get", "(", "aname", ")", ";", "if", "(", "n", "==", "null", ")", "{", "return", "dmonitor_node3_trap", ".", "invoke", "(", "proc", ",", "new", "EObject", "[", "]", "{", "aname", ",", "aflag", ",", "opts", "}", ")", ";", "}", "else", "{", "n", ".", "monitor_node", "(", "proc", ".", "self_handle", "(", ")", ",", "aflag", "==", "ERT", ".", "TRUE", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "}", "@", "BIF", "public", "static", "EObject", "monitor_node", "(", "EProc", "proc", ",", "EObject", "node", ",", "EObject", "flag", ")", "throws", "Pausable", "{", "return", "monitor_node", "(", "proc", ",", "node", ",", "flag", ",", "ERT", ".", "NIL", ")", ";", "}", "@", "BIF", "public", "static", "EObject", "dist_exit", "(", "EObject", "a1", ",", "EObject", "a2", ",", "EObject", "a3", ")", "{", "throw", "new", "NotImplemented", "(", ")", ";", "}", "@", "BIF", "static", "public", "EAtom", "node", "(", ")", "{", "EAtom", "val", "=", "ERT", ".", "getLocalNode", "(", ")", ".", "node", "(", ")", ";", "return", "val", ";", "}", "@", "BIF", "static", "public", "EAtom", "node", "(", "EObject", "name", ")", "{", "if", "(", "!", "ERT", ".", "getLocalNode", "(", ")", ".", "isALive", "(", ")", ")", "{", "return", "ENode", ".", "am_nonode_at_nohost", ";", "}", "ERef", "ref", ";", "if", "(", "(", "ref", "=", "name", ".", "testReference", "(", ")", ")", "!=", "null", ")", "return", "ref", ".", "node", "(", ")", ";", "EHandle", "handle", ";", "if", "(", "(", "handle", "=", "name", ".", "testHandle", "(", ")", ")", "!=", "null", ")", "return", "handle", ".", "node", "(", ")", ";", "throw", "ERT", ".", "badarg", "(", "name", ")", ";", "}", "@", "BIF", "(", "type", "=", "Type", ".", "GUARD", ",", "name", "=", "\"node\"", ")", "static", "public", "EAtom", "node$p", "(", "EObject", "name", ")", "{", "if", "(", "!", "ERT", ".", "getLocalNode", "(", ")", ".", "isALive", "(", ")", ")", "{", "return", "ENode", ".", "am_nonode_at_nohost", ";", "}", "EHandle", "handle", ";", "if", "(", "(", "handle", "=", "name", ".", "testHandle", "(", ")", ")", "!=", "null", ")", "{", "return", "handle", ".", "node", "(", ")", ";", "}", "ERef", "ref", ";", "if", "(", "(", "ref", "=", "name", ".", "testReference", "(", ")", ")", "!=", "null", ")", "{", "return", "ref", ".", "node", "(", ")", ";", "}", "return", "null", ";", "}", "@", "BIF", "public", "static", "EObject", "setnode", "(", "EObject", "arg_node", ",", "EObject", "arg_creation", ")", "throws", "Pausable", "{", "int", "creation", ";", "ESmall", "cr", "=", "arg_creation", ".", "testSmall", "(", ")", ";", "EAtom", "node", "=", "arg_node", ".", "testAtom", "(", ")", ";", "if", "(", "cr", "==", "null", "||", "node", "==", "null", "||", "cr", ".", "value", ">", "3", "||", "!", "is_node_name_atom", "(", "node", ")", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"cr=\"", "+", "cr", "+", "\";", "node=\"", "+", "node", "+", "\";", "is_name=\"", "+", "is_node_name_atom", "(", "node", ")", ")", ";", "throw", "ERT", ".", "badarg", "(", "arg_node", ",", "arg_creation", ")", ";", "}", "EObject", "net_kernel", "=", "ERT", ".", "whereis", "(", "am_net_kernel", ")", ";", "EInternalPID", "nk", "=", "net_kernel", ".", "testInternalPID", "(", ")", ";", "if", "(", "nk", "==", "null", ")", "{", "throw", "new", "ErlangError", "(", "EAtom", ".", "intern", "(", "\"\"", ")", ")", ";", "}", "nk", ".", "set_dist_entry", "(", "this_dist_entry", ")", ";", "set_this_node", "(", "node", ",", "cr", ".", "value", ")", ";", "erts_is_alive", "=", "ERT", ".", "TRUE", ";", "EAbstractNode", "n", "=", "EPeer", ".", "get", "(", "node", ")", ";", "n", ".", "node_up", "(", "null", ",", "ERT", ".", "NIL", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "private", "static", "void", "set_this_node", "(", "EAtom", "node", ",", "int", "value", ")", "{", "ERT", ".", "getLocalNode", "(", ")", ".", "set", "(", "node", ",", "value", ")", ";", "}", "private", "static", "Pattern", "node_name_regex", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "public", "static", "boolean", "is_node_name_atom", "(", "EAtom", "node", ")", "{", "if", "(", "node_name_regex", ".", "matcher", "(", "node", ".", "getName", "(", ")", ")", ".", "matches", "(", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}", "@", "BIF", "public", "static", "EObject", "setnode", "(", "EObject", "node_arg", ",", "EObject", "cid_arg", ",", "EObject", "type_arg", ")", "throws", "Pausable", "{", "EAtom", "node", ";", "int", "creation", "=", "0", ";", "ETuple2", "tup", ";", "if", "(", "(", "tup", "=", "ETuple2", ".", "cast", "(", "node_arg", ")", ")", "!=", "null", ")", "{", "node", "=", "tup", ".", "elem1", ".", "testAtom", "(", ")", ";", "ESmall", "sm", "=", "tup", ".", "elem2", ".", "testSmall", "(", ")", ";", "if", "(", "node", "==", "null", "||", "sm", "==", "null", "||", "!", "is_node_name_atom", "(", "node", ")", ")", "throw", "ERT", ".", "badarg", "(", "node_arg", ",", "cid_arg", ",", "type_arg", ")", ";", "creation", "=", "sm", ".", "value", ";", "}", "else", "if", "(", "(", "node", "=", "node_arg", ".", "testAtom", "(", ")", ")", "!=", "null", "&&", "is_node_name_atom", "(", "node", ")", ")", "{", "}", "else", "{", "throw", "ERT", ".", "badarg", "(", "node_arg", ",", "cid_arg", ",", "type_arg", ")", ";", "}", "EInternalPort", "port", "=", "cid_arg", ".", "testInternalPort", "(", ")", ";", "if", "(", "port", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "node_arg", ",", "cid_arg", ",", "type_arg", ")", ";", "}", "ETuple", "t", "=", "type_arg", ".", "testTuple", "(", ")", ";", "if", "(", "t", ".", "arity", "(", ")", "!=", "4", ")", "{", "throw", "ERT", ".", "badarg", "(", "node_arg", ",", "cid_arg", ",", "type_arg", ")", ";", "}", "ESmall", "flags", "=", "t", ".", "elm", "(", "1", ")", ".", "testSmall", "(", ")", ";", "ESmall", "version", "=", "t", ".", "elm", "(", "2", ")", ".", "testSmall", "(", ")", ";", "if", "(", "flags", "==", "null", "||", "version", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "node_arg", ",", "cid_arg", ",", "type_arg", ")", ";", "}", "EPeer", "n", "=", "EPeer", ".", "get_or_create", "(", "node", ",", "creation", ",", "port", ",", "flags", ".", "value", ",", "version", ".", "value", ")", ";", "EDriverTask", "task", "=", "port", ".", "task", "(", ")", ";", "if", "(", "task", "!=", "null", ")", "{", "task", ".", "node", "(", "n", ")", ";", "n", ".", "node_up", "(", "null", ",", "ERT", ".", "NIL", ")", ";", "return", "ERT", ".", "TRUE", ";", "}", "else", "{", "return", "ERT", ".", "FALSE", ";", "}", "}", "}", "</s>" ]
7,815
[ "<s>", "package", "erjang", ".", "m", ".", "erlang", ";", "import", "kilim", ".", "Pausable", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EInteger", ";", "import", "erjang", ".", "ENumber", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EProc", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "BIF", ".", "Type", ";", "public", "class", "BinOps", "{", "@", "BIF", "(", "name", "=", "\"band\"", ",", "type", "=", "Type", ".", "GUARD", ")", "static", "public", "ENumber", "band_guard", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "EInteger", "n1", ";", "EInteger", "n2", ";", "if", "(", "(", "n1", "=", "o1", ".", "testInteger", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "(", "n2", "=", "o2", ".", "testInteger", "(", ")", ")", "!=", "null", ")", "{", "return", "n1", ".", "band", "(", "n2", ")", ";", "}", "}", "return", "null", ";", "}", "@", "BIF", "static", "public", "EInteger", "band", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "o1", ".", "band", "(", "o2", ")", ";", "}", "@", "BIF", "static", "public", "EInteger", "bor", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "o1", ".", "bor", "(", "o2", ")", ";", "}", "@", "BIF", "static", "public", "EInteger", "bsr", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "o1", ".", "bsr", "(", "o2", ")", ";", "}", "@", "BIF", "static", "public", "EInteger", "bsl", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "o1", ".", "bsl", "(", "o2", ")", ";", "}", "@", "BIF", "static", "public", "EInteger", "bsl", "(", "EInteger", "o1", ",", "ESmall", "o2", ")", "{", "return", "o1", ".", "bsl", "(", "o2", ")", ";", "}", "@", "BIF", "(", "name", "=", "\">=\"", ")", "static", "public", "EAtom", "ge", "(", "EObject", "o1", ",", "EObject", "o2", ")", "{", "return", "o1", ".", "ge", "(", "o2", ")", ";", "}", "@", "BIF", "static", "public", "EObject", "send", "(", "EProc", "proc", ",", "EObject", "pid", ",", "EObject", "msg", ")", "throws", "Pausable", "{", "return", "ERT", ".", "send", "(", "proc", ",", "pid", ",", "msg", ")", ";", "}", "}", "</s>" ]
7,816
[ "<s>", "package", "erjang", ".", "m", ".", "crypto_server", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "ENative", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ETuple2", ";", "public", "class", "Native", "extends", "ENative", "{", "@", "BIF", "public", "static", "EObject", "init", "(", "EObject", "arg", ")", "{", "return", "new", "ETuple2", "(", "ERT", ".", "am_ok", ",", "ERT", ".", "NIL", ")", ";", "}", "}", "</s>" ]
7,817
[ "<s>", "package", "erjang", ".", "m", ".", "lists", ";", "import", "kilim", ".", "Pausable", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EFun", ";", "import", "erjang", ".", "EInteger", ";", "import", "erjang", ".", "EList", ";", "import", "erjang", ".", "ENative", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EProc", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ETuple2", ";", "import", "erjang", ".", "NotImplemented", ";", "public", "class", "Native", "extends", "ENative", "{", "@", "BIF", "public", "static", "EObject", "keymember", "(", "EObject", "key", ",", "EObject", "nth_arg", ",", "EObject", "list_arg", ")", "{", "ESmall", "nth", "=", "nth_arg", ".", "testSmall", "(", ")", ";", "ESeq", "list", "=", "list_arg", ".", "testSeq", "(", ")", ";", "if", "(", "key", "==", "null", "||", "nth", "==", "null", "|", "list", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "key", ",", "nth_arg", ",", "list_arg", ")", ";", "while", "(", "!", "list", ".", "isNil", "(", ")", ")", "{", "EObject", "elm", "=", "list", ".", "head", "(", ")", ";", "ETuple", "tup", "=", "elm", ".", "testTuple", "(", ")", ";", "if", "(", "tup", "!=", "null", "&&", "tup", ".", "arity", "(", ")", ">=", "nth", ".", "value", ")", "{", "EObject", "val", "=", "tup", ".", "elm", "(", "nth", ".", "value", ")", ";", "if", "(", "val", ".", "equals", "(", "key", ")", ")", "{", "return", "ERT", ".", "TRUE", ";", "}", "}", "list", "=", "list", ".", "tail", "(", ")", ";", "}", "return", "ERT", ".", "FALSE", ";", "}", "@", "BIF", "public", "static", "EObject", "keyfind", "(", "EObject", "key", ",", "EObject", "nth_arg", ",", "EObject", "list_arg", ")", "{", "ESmall", "nth", "=", "nth_arg", ".", "testSmall", "(", ")", ";", "ESeq", "list", "=", "list_arg", ".", "testSeq", "(", ")", ";", "if", "(", "key", "==", "null", "||", "nth", "==", "null", "|", "list", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "key", ",", "nth_arg", ",", "list_arg", ")", ";", "while", "(", "!", "list", ".", "isNil", "(", ")", ")", "{", "EObject", "elm", "=", "list", ".", "head", "(", ")", ";", "ETuple", "tup", "=", "elm", ".", "testTuple", "(", ")", ";", "if", "(", "tup", "!=", "null", "&&", "tup", ".", "arity", "(", ")", ">=", "nth", ".", "value", ")", "{", "EObject", "val", "=", "tup", ".", "elm", "(", "nth", ".", "value", ")", ";", "if", "(", "val", ".", "equals", "(", "key", ")", ")", "{", "return", "tup", ";", "}", "}", "list", "=", "list", ".", "tail", "(", ")", ";", "}", "return", "ERT", ".", "FALSE", ";", "}", "@", "BIF", "public", "static", "EObject", "keysearch", "(", "EObject", "k", ",", "EObject", "n", ",", "EObject", "list", ")", "{", "ESmall", "idx", "=", "n", ".", "testSmall", "(", ")", ";", "ESeq", "src", "=", "list", ".", "testSeq", "(", ")", ";", "if", "(", "k", "==", "null", "||", "idx", "==", "null", "||", "src", "==", "null", "||", "idx", ".", "value", "<", "1", ")", "throw", "ERT", ".", "badarg", "(", "k", ",", "n", ",", "list", ")", ";", "int", "index", "=", "idx", ".", "value", ";", "while", "(", "!", "src", ".", "isNil", "(", ")", ")", "{", "EObject", "elm", "=", "src", ".", "head", "(", ")", ";", "ETuple", "tup", ";", "if", "(", "(", "tup", "=", "elm", ".", "testTuple", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "tup", ".", "arity", "(", ")", ">=", "index", ")", "{", "if", "(", "tup", ".", "elm", "(", "index", ")", ".", "equals", "(", "k", ")", ")", "{", "return", "new", "ETuple2", "(", "ERT", ".", "am_value", ",", "tup", ")", ";", "}", "}", "}", "src", "=", "src", ".", "tail", "(", ")", ";", "}", "return", "ERT", ".", "FALSE", ";", "}", "@", "BIF", "public", "static", "ESeq", "reverse", "(", "EObject", "hd", ",", "EObject", "tl", ")", "{", "ESeq", "res", "=", "tl", ".", "testSeq", "(", ")", ";", "ESeq", "front", "=", "hd", ".", "testSeq", "(", ")", ";", "if", "(", "res", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "hd", ",", "tl", ")", ";", "return", "reverse", "(", "front", ",", "res", ")", ";", "}", "@", "BIF", "public", "static", "ESeq", "reverse", "(", "ESeq", "front", ",", "ESeq", "res", ")", "{", "while", "(", "!", "front", ".", "isNil", "(", ")", ")", "{", "res", "=", "res", ".", "cons", "(", "front", ".", "head", "(", ")", ")", ";", "front", "=", "front", ".", "tail", "(", ")", ";", "}", "return", "res", ";", "}", "@", "BIF", "public", "static", "EAtom", "member", "(", "EObject", "e", ",", "EObject", "l", ")", "{", "ESeq", "list", "=", "l", ".", "testSeq", "(", ")", ";", "if", "(", "list", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "e", ",", "l", ")", ";", "while", "(", "!", "list", ".", "isNil", "(", ")", ")", "{", "if", "(", "e", ".", "equals", "(", "list", ".", "head", "(", ")", ")", ")", "return", "ERT", ".", "TRUE", ";", "list", "=", "list", ".", "tail", "(", ")", ";", "}", "return", "ERT", ".", "FALSE", ";", "}", "@", "BIF", "public", "static", "ESeq", "map", "(", "EProc", "proc", ",", "EObject", "f", ",", "EObject", "s", ")", "throws", "Pausable", "{", "EFun", "fun", "=", "f", ".", "testFunction2", "(", "1", ")", ";", "ESeq", "seq", "=", "s", ".", "testSeq", "(", ")", ";", "if", "(", "fun", "==", "null", "||", "seq", "==", "null", ")", "throw", "ERT", ".", "badarg", "(", "f", ",", "s", ")", ";", "EObject", "[", "]", "arg", "=", "new", "EObject", "[", "1", "]", ";", "ESeq", "rev", "=", "ERT", ".", "NIL", ";", "for", "(", ";", "!", "seq", ".", "isNil", "(", ")", ";", "seq", "=", "seq", ".", "tail", "(", ")", ")", "{", "arg", "[", "0", "]", "=", "seq", ".", "head", "(", ")", ";", "EObject", "val", "=", "fun", ".", "invoke", "(", "proc", ",", "arg", ")", ";", "rev", "=", "rev", ".", "cons", "(", "val", ")", ";", "}", "return", "reverse", "(", "rev", ",", "ERT", ".", "NIL", ")", ";", "}", "@", "BIF", "public", "static", "ESeq", "seq", "(", "EObject", "start", ",", "EObject", "end", ")", "{", "ESmall", "sm_s", "=", "start", ".", "testSmall", "(", ")", ";", "ESmall", "sm_e", "=", "end", ".", "testSmall", "(", ")", ";", "if", "(", "sm_s", "==", "null", "||", "sm_e", "==", "null", ")", "{", "EInteger", "i_s", ";", "EInteger", "i_e", ";", "if", "(", "(", "i_s", "=", "start", ".", "testInteger", "(", ")", ")", "==", "null", "||", "(", "i_e", "=", "end", ".", "testInteger", "(", ")", ")", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", "start", ",", "end", ")", ";", "}", "return", "seq_big", "(", "i_s", ",", "i_e", ")", ";", "}", "if", "(", "(", "sm_e", ".", "value", "+", "1", ")", "<", "sm_s", ".", "value", ")", "throw", "ERT", ".", "badarg", "(", "start", ",", "end", ")", ";", "ESeq", "l", "=", "ERT", ".", "NIL", ";", "int", "val", "=", "sm_e", ".", "value", ";", "int", "first", "=", "sm_s", ".", "value", ";", "while", "(", "val", ">=", "first", ")", "{", "l", "=", "l", ".", "cons", "(", "val", ")", ";", "val", "-=", "1", ";", "}", "return", "l", ";", "}", "static", "ESeq", "seq_big", "(", "EInteger", "start", ",", "EInteger", "end", ")", "{", "if", "(", "(", "end", ".", "inc", "(", ")", ")", ".", "is_lt", "(", "start", ")", ")", "throw", "ERT", ".", "badarg", "(", "start", ",", "end", ")", ";", "ESeq", "l", "=", "ERT", ".", "NIL", ";", "EInteger", "val", "=", "end", ";", "EInteger", "first", "=", "start", ";", "while", "(", "val", ".", "is_ge", "(", "first", ")", ")", "{", "l", "=", "l", ".", "cons", "(", "val", ")", ";", "val", "=", "val", ".", "dec", "(", ")", ";", "}", "return", "l", ";", "}", "}", "</s>" ]
7,818
[ "<s>", "package", "erjang", ".", "m", ".", "code", ";", "import", "erjang", ".", "BIF", ";", "import", "erjang", ".", "ENative", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ERT", ";", "public", "class", "Native", "extends", "ENative", "{", "@", "BIF", "public", "static", "EObject", "is_module_native", "(", "EObject", "module", ")", "{", "return", "ERT", ".", "FALSE", ";", "}", "}", "</s>" ]
7,819
[ "<s>", "package", "erjang", ";", "public", "abstract", "class", "EPseudoTerm", "extends", "EObject", "{", "@", "Override", "int", "cmp_order", "(", ")", "{", "return", "CMP_ORDER_ERJANG_INTERNAL", ";", "}", "@", "Override", "public", "EBinary", "testBinary", "(", ")", "{", "return", "EBinary", ".", "fromString", "(", "\"\"", ")", ";", "}", "@", "Override", "public", "EBitString", "testBitString", "(", ")", "{", "return", "testBinary", "(", ")", ";", "}", "}", "</s>" ]
7,820
[ "<s>", "package", "erjang", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "CharArrayWriter", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "nio", ".", "ByteBuffer", ";", "import", "java", ".", "nio", ".", "charset", ".", "Charset", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "MethodVisitor", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Opcodes", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "public", "class", "EBigString", "extends", "ESeq", "implements", "CharSequence", "{", "private", "static", "final", "Charset", "ISO_LATIN_1", "=", "Charset", ".", "forName", "(", "\"ISO-8859-1\"", ")", ";", "private", "static", "final", "EBigString", "EMPTY", "=", "new", "EBigString", "(", "\"\"", ")", ";", "final", "char", "[", "]", "data", ";", "final", "int", "off", ";", "private", "int", "hash", "=", "-", "1", ";", "public", "EBigString", "(", "String", "value", ")", "{", "this", ".", "hash", "=", "value", ".", "hashCode", "(", ")", ";", "this", ".", "data", "=", "value", ".", "toCharArray", "(", ")", ";", "this", ".", "off", "=", "0", ";", "}", "public", "EBigString", "testBigString", "(", ")", "{", "return", "this", ";", "}", "EBigString", "(", "char", "[", "]", "data", ",", "int", "off", ")", "{", "this", ".", "data", "=", "data", ";", "this", ".", "off", "=", "off", ";", "}", "EBigString", "(", "char", "[", "]", "data", ",", "int", "off", ",", "int", "len", ")", "{", "if", "(", "data", ".", "length", "==", "off", "+", "len", ")", "{", "this", ".", "data", "=", "data", ";", "this", ".", "off", "=", "off", ";", "}", "else", "{", "this", ".", "data", "=", "new", "char", "[", "len", "]", ";", "this", ".", "off", "=", "0", ";", "System", ".", "arraycopy", "(", "data", ",", "off", ",", "this", ".", "data", ",", "0", ",", "len", ")", ";", "}", "}", "public", "static", "EBigString", "make", "(", "char", "[", "]", "array", ",", "int", "arrayOffset", ",", "int", "len", ")", "{", "if", "(", "len", "==", "array", ".", "length", "-", "arrayOffset", ")", "{", "return", "new", "EBigString", "(", "array", ",", "arrayOffset", ")", ";", "}", "else", "{", "char", "[", "]", "copy", "=", "new", "char", "[", "len", "]", ";", "System", ".", "arraycopy", "(", "array", ",", "arrayOffset", ",", "copy", ",", "0", ",", "len", ")", ";", "return", "new", "EBigString", "(", "copy", ",", "0", ")", ";", "}", "}", "public", "static", "EBigString", "make", "(", "ECons", "list", ")", "{", "EBigString", "s", ";", "if", "(", "(", "s", "=", "list", ".", "testBigString", "(", ")", ")", "!=", "null", ")", "{", "return", "s", ";", "}", "else", "if", "(", "list", ".", "isNil", "(", ")", ")", "{", "return", "EBigString", ".", "EMPTY", ";", "}", "else", "{", "CharArrayWriter", "barr", "=", "new", "CharArrayWriter", "(", ")", ";", "EObject", "tail", "=", "list", ";", "while", "(", "(", "list", "=", "tail", ".", "testNonEmptyList", "(", ")", ")", "!=", "null", ")", "{", "EObject", "head", "=", "list", ".", "head", "(", ")", ";", "ESmall", "intval", ";", "if", "(", "(", "intval", "=", "head", ".", "testSmall", "(", ")", ")", "==", "null", ")", "{", "throw", "ERT", ".", "badarg", "(", ")", ";", "}", "int", "byteValue", "=", "intval", ".", "value", "&", "0xffff", ";", "if", "(", "intval", ".", "value", "!=", "byteValue", ")", "{", "throw", "ERT", ".", "badarg", "(", ")", ";", "}", "barr", ".", "write", "(", "byteValue", ")", ";", "tail", "=", "list", ".", "tail", "(", ")", ";", "}", "return", "new", "EBigString", "(", "barr", ".", "toCharArray", "(", ")", ",", "0", ")", ";", "}", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "if", "(", "hash", "==", "-", "1", ")", "{", "hash", "=", "stringValue", "(", ")", ".", "hashCode", "(", ")", ";", "}", "return", "hash", ";", "}", "public", "String", "stringValue", "(", ")", "{", "return", "new", "String", "(", "data", ",", "off", ",", "data", ".", "length", "-", "off", ")", ";", "}", "public", "boolean", "equalsExactly", "(", "EObject", "rhs", ")", "{", "ENil", "nil", ";", "int", "length", "=", "length", "(", ")", ";", "if", "(", "(", "nil", "=", "rhs", ".", "testNil", "(", ")", ")", "!=", "null", ")", "{", "return", "length", "==", "0", ";", "}", "EBigString", "str", ";", "if", "(", "(", "str", "=", "rhs", ".", "testBigString", "(", ")", ")", "!=", "null", ")", "{", "EBigString", "es", "=", "str", ";", "if", "(", "length", "!=", "es", ".", "length", "(", ")", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "charAt", "(", "i", ")", "!=", "es", ".", "charAt", "(", "i", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "ESeq", "seq", ";", "if", "(", "(", "seq", "=", "rhs", ".", "testSeq", "(", ")", ")", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "seq", ".", "testNil", "(", ")", "!=", "null", ")", "return", "false", ";", "if", "(", "!", "seq", ".", "head", "(", ")", ".", "equalsExactly", "(", "new", "ESmall", "(", "charAt", "(", "i", ")", ")", ")", ")", "{", "return", "false", ";", "}", "seq", "=", "seq", ".", "tail", "(", ")", ";", "}", "return", "seq", ".", "isNil", "(", ")", ";", "}", "return", "false", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "String", ")", "{", "return", "(", "(", "String", ")", "obj", ")", ".", "equals", "(", "stringValue", "(", ")", ")", ";", "}", "if", "(", "!", "(", "obj", "instanceof", "EObject", ")", ")", "{", "return", "false", ";", "}", "return", "equalsExactly", "(", "(", "EObject", ")", "obj", ")", ";", "}", "@", "Override", "public", "char", "charAt", "(", "int", "index", ")", "{", "return", "data", "[", "off", "+", "index", "]", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "data", ".", "length", "-", "off", ";", "}", "@", "Override", "public", "CharSequence", "subSequence", "(", "final", "int", "start", ",", "final", "int", "end", ")", "{", "if", "(", "end", "==", "length", "(", ")", ")", "return", "new", "EBigString", "(", "data", ",", "off", "+", "start", ")", ";", "return", "new", "SubSequence", "(", "start", ",", "end", "-", "start", ")", ";", "}", "public", "class", "SubSequence", "implements", "CharSequence", "{", "private", "final", "int", "offset", ";", "private", "final", "int", "length", ";", "public", "SubSequence", "(", "int", "start", ",", "int", "length", ")", "{", "this", ".", "offset", "=", "start", ";", "this", ".", "length", "=", "length", ";", "EBigString", ".", "this", ".", "check_subseq", "(", "offset", ",", "length", ")", ";", "}", "@", "Override", "public", "char", "charAt", "(", "int", "index", ")", "{", "return", "EBigString", ".", "this", ".", "charAt", "(", "offset", "+", "index", ")", ";", "}", "@", "Override", "public", "int", "length", "(", ")", "{", "return", "length", ";", "}", "@", "Override", "public", "CharSequence", "subSequence", "(", "int", "start", ",", "int", "end", ")", "{", "return", "new", "SubSequence", "(", "this", ".", "offset", "+", "start", ",", "end", "-", "start", ")", ";", "}", "}", "void", "check_subseq", "(", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "offset", "<", "0", "||", "length", "<", "0", "||", "(", "offset", "+", "length", ")", ">", "length", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "'\"'", "+", "stringValue", "(", ")", "+", "'\"'", ";", "}", "public", "static", "EBigString", "fromString", "(", "String", "s", ")", "{", "return", "new", "EBigString", "(", "s", ")", ";", "}", "private", "static", "final", "Type", "ESTRING_TYPE", "=", "Type", ".", "getType", "(", "EBigString", ".", "class", ")", ";", "private", "static", "final", "Type", "STRING_TYPE", "=", "Type", ".", "getType", "(", "String", ".", "class", ")", ";", "@", "Override", "public", "Type", "emit_const", "(", "MethodVisitor", "fa", ")", "{", "Type", "type", "=", "ESTRING_TYPE", ";", "fa", ".", "visitLdcInsn", "(", "this", ".", "stringValue", "(", ")", ")", ";", "fa", ".", "visitMethodInsn", "(", "Opcodes", ".", "INVOKESTATIC", ",", "type", ".", "getInternalName", "(", ")", ",", "\"fromString\"", ",", "\"(\"", "+", "STRING_TYPE", ".", "getDescriptor", "(", ")", "+", "\")\"", "+", "type", ".", "getDescriptor", "(", ")", ")", ";", "return", "type", ";", "}", "@", "Override", "public", "EList", "cons", "(", "EObject", "h", ")", "{", "return", "new", "EList", "(", "h", ",", "this", ")", ";", "}", "@", "Override", "public", "ESeq", "tail", "(", ")", "{", "if", "(", "off", "==", "data", ".", "length", ")", "return", "ERT", ".", "NIL", ";", "return", "new", "EBigString", "(", "data", ",", "off", "+", "1", ")", ";", "}", "@", "Override", "public", "ESmall", "head", "(", ")", "{", "return", "new", "ESmall", "(", "data", "[", "off", "]", "&", "0xff", ")", ";", "}", "@", "Override", "public", "ENil", "testNil", "(", ")", "{", "return", "length", "(", ")", "==", "0", "?", "ERT", ".", "NIL", ":", "null", ";", "}", "@", "Override", "public", "ESeq", "testSeq", "(", ")", "{", "return", "this", ";", "}", "public", "ECons", "testNonEmptyList", "(", ")", "{", "return", "length", "(", ")", "==", "0", "?", "null", ":", "this", ";", "}", "public", "ECons", "testCons", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "int", "compare_same", "(", "EObject", "rhs", ")", "{", "if", "(", "rhs", ".", "isNil", "(", ")", ")", "return", "1", ";", "int", "length", "=", "length", "(", ")", ";", "EBigString", "str", ";", "if", "(", "(", "str", "=", "rhs", ".", "testBigString", "(", ")", ")", "!=", "null", ")", "{", "EBigString", "es", "=", "str", ";", "int", "length2", "=", "str", ".", "length", "(", ")", ";", "int", "limit", "=", "Math", ".", "min", "(", "length", ",", "length2", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "limit", ";", "i", "++", ")", "{", "char", "ch1", "=", "charAt", "(", "i", ")", ";", "char", "ch2", "=", "es", ".", "charAt", "(", "i", ")", ";", "if", "(", "ch1", "<", "ch2", ")", "return", "-", "1", ";", "if", "(", "ch1", ">", "ch2", ")", "return", "1", ";", "}", "if", "(", "length", ">", "length2", ")", "return", "1", ";", "if", "(", "length", "<", "length2", ")", "return", "-", "1", ";", "return", "0", ";", "}", "ECons", "seq", ";", "if", "(", "(", "seq", "=", "rhs", ".", "testCons", "(", ")", ")", "!=", "null", ")", "{", "int", "i", "=", "0", ";", "while", "(", "i", "<", "length", ")", "{", "if", "(", "(", "seq", ".", "testNil", "(", ")", ")", "!=", "null", ")", "{", "return", "-", "1", ";", "}", "int", "cmp", "=", "(", "new", "ESmall", "(", "charAt", "(", "i", "++", ")", ")", ")", ".", "erlangCompareTo", "(", "seq", ".", "head", "(", ")", ")", ";", "if", "(", "cmp", "!=", "0", ")", "return", "cmp", ";", "EObject", "res", "=", "seq", ".", "tail", "(", ")", ";", "if", "(", "(", "seq", "=", "res", ".", "testCons", "(", ")", ")", "!=", "null", ")", "{", "continue", ";", "}", "return", "-", "res", ".", "erlangCompareTo", "(", "new", "EBigString", "(", "data", ",", "i", ")", ")", ";", "}", "}", "return", "-", "rhs", ".", "erlangCompareTo", "(", "this", ")", ";", "}", "@", "Override", "public", "ESeq", "prepend", "(", "ESeq", "list", ")", "{", "EBigString", "other", "=", "list", ".", "testBigString", "(", ")", ";", "if", "(", "other", "!=", "null", ")", "{", "char", "[", "]", "out", "=", "new", "char", "[", "length", "(", ")", "+", "other", ".", "length", "(", ")", "]", ";", "System", ".", "arraycopy", "(", "other", ".", "data", ",", "other", ".", "off", ",", "out", ",", "0", ",", "other", ".", "length", "(", ")", ")", ";", "System", ".", "arraycopy", "(", "this", ".", "data", ",", "this", ".", "off", ",", "out", ",", "other", ".", "length", "(", ")", ",", "this", ".", "length", "(", ")", ")", ";", "return", "EBigString", ".", "make", "(", "out", ",", "0", ",", "out", ".", "length", ")", ";", "}", "else", "{", "return", "super", ".", "prepend", "(", "list", ")", ";", "}", "}", "public", "EBinary", "asBitString", "(", "Charset", "charset", ")", "{", "byte", "[", "]", "data", "=", "stringValue", "(", ")", ".", "getBytes", "(", "charset", ")", ";", "return", "new", "EBinary", "(", "data", ",", "0", ",", "data", ".", "length", ")", ";", "}", "public", "static", "EBigString", "make", "(", "EObject", "eObject", ")", "{", "ESeq", "str", ";", "if", "(", "(", "str", "=", "eObject", ".", "testSeq", "(", ")", ")", "!=", "null", ")", "return", "make", "(", "str", ")", ";", "EAtom", "am", "=", "eObject", ".", "testAtom", "(", ")", ";", "if", "(", "am", "!=", "null", ")", "{", "return", "fromString", "(", "am", ".", "toString", "(", ")", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", ")", ";", "}", "public", "void", "collectCharList", "(", "CharCollector", "out", ")", "throws", "CharCollector", ".", "CollectingException", ",", "IOException", "{", "try", "{", "out", ".", "addIntegers", "(", "data", ",", "off", ",", "data", ".", "length", "-", "off", ")", ";", "}", "catch", "(", "CharCollector", ".", "PartialDecodingException", "e", ")", "{", "int", "n", "=", "e", ".", "inputPos", ";", "throw", "new", "CharCollector", ".", "CollectingException", "(", "new", "EBigString", "(", "data", ",", "off", "+", "n", ")", ")", ";", "}", "}", "public", "static", "boolean", "isValidCodePoint", "(", "int", "cp", ")", "{", "return", "(", "cp", ">>>", "16", ")", "<=", "0x10", "&&", "(", "cp", "&", "~", "0x7FF", ")", "!=", "0xD800", "&&", "(", "cp", "&", "~", "1", ")", "!=", "0xFFFE", ";", "}", "public", "static", "ESeq", "read", "(", "EInputStream", "ei", ")", "throws", "IOException", "{", "return", "ei", ".", "read_string", "(", ")", ";", "}", "@", "Override", "public", "void", "encode", "(", "EOutputStream", "eos", ")", "{", "eos", ".", "write_string", "(", "stringValue", "(", ")", ")", ";", "}", "}", "</s>" ]
7,821
[ "<s>", "package", "erjang", ";", "public", "class", "FunID", "implements", "Comparable", "<", "FunID", ">", "{", "public", "final", "EAtom", "module", ";", "public", "final", "EAtom", "function", ";", "public", "final", "int", "arity", ";", "public", "FunID", "(", "String", "module", ",", "String", "function", ",", "int", "arity", ")", "{", "this", "(", "EAtom", ".", "intern", "(", "module", ")", ",", "EAtom", ".", "intern", "(", "function", ")", ",", "arity", ")", ";", "}", "public", "FunID", "(", "EAtom", "module", ",", "EAtom", "function", ",", "int", "arity", ")", "{", "this", ".", "module", "=", "module", ";", "this", ".", "function", "=", "function", ";", "this", ".", "arity", "=", "arity", ";", "}", "public", "FunID", "(", "Import", "imp", ")", "{", "this", "(", "imp", ".", "module", "(", ")", ",", "imp", ".", "fun", "(", ")", ",", "imp", ".", "arity", "(", ")", ")", ";", "}", "public", "FunID", "(", "Export", "exp", ")", "{", "this", "(", "exp", ".", "module", "(", ")", ",", "exp", ".", "fun", "(", ")", ",", "exp", ".", "arity", "(", ")", ")", ";", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "return", "module", ".", "hashCode", "(", ")", "+", "function", ".", "hashCode", "(", ")", "+", "arity", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "FunID", ")", "{", "FunID", "spec", "=", "(", "FunID", ")", "obj", ";", "return", "module", ".", "equals", "(", "spec", ".", "module", ")", "&&", "function", ".", "equals", "(", "spec", ".", "function", ")", "&&", "arity", "==", "spec", ".", "arity", ";", "}", "return", "false", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "module", "+", "\":\"", "+", "function", "+", "\"/\"", "+", "arity", ";", "}", "@", "Override", "public", "int", "compareTo", "(", "FunID", "o", ")", "{", "if", "(", "module", "!=", "o", ".", "module", ")", "{", "int", "c1", "=", "module", ".", "compareTo", "(", "o", ".", "module", ")", ";", "if", "(", "c1", "!=", "0", ")", "return", "c1", ";", "}", "if", "(", "function", "!=", "o", ".", "function", ")", "{", "int", "c2", "=", "function", ".", "compareTo", "(", "o", ".", "function", ")", ";", "if", "(", "c2", "!=", "0", ")", "return", "c2", ";", "}", "return", "arity", "-", "o", ".", "arity", ";", "}", "}", "</s>" ]
7,822
[ "<s>", "package", "erjang", ";", "public", "class", "ETuple0", "extends", "ETuple", "{", "static", "public", "ETuple0", "cast", "(", "ETuple", "value", ")", "{", "if", "(", "value", ".", "arity", "(", ")", "==", "0", ")", "return", "(", "ETuple0", ")", "value", ";", "return", "null", ";", "}", "static", "public", "ETuple0", "cast", "(", "EObject", "value", ")", "{", "if", "(", "value", "instanceof", "ETuple0", ")", "return", "(", "ETuple0", ")", "value", ";", "return", "null", ";", "}", "@", "Override", "public", "ETuple0", "blank", "(", ")", "{", "return", "new", "ETuple0", "(", ")", ";", "}", "@", "Override", "public", "int", "arity", "(", ")", "{", "return", "0", ";", "}", "@", "Override", "public", "EObject", "elm", "(", "int", "i", ")", "{", "return", "bad_nth", "(", "i", ")", ";", "}", "@", "Override", "public", "void", "set", "(", "int", "index", ",", "EObject", "term", ")", "{", "bad_nth", "(", "index", ")", ";", "}", "}", "</s>" ]
7,823
[ "<s>", "package", "erjang", ";", "import", "java", ".", "math", ".", "BigInteger", ";", "import", "java", ".", "nio", ".", "ByteOrder", ";", "public", "class", "EBinMatchState", "extends", "EPseudoTerm", "{", "public", "static", "final", "BigInteger", "TWO_TO_64", "=", "BigInteger", ".", "ONE", ".", "shiftLeft", "(", "64", ")", ";", "public", "EBinMatchState", "testBinMatchState", "(", ")", "{", "return", "this", ";", "}", "public", "static", "final", "int", "BSF_ALIGNED", "=", "1", ";", "public", "static", "final", "int", "BSF_LITTLE", "=", "2", ";", "public", "static", "final", "int", "BSF_SIGNED", "=", "4", ";", "public", "static", "final", "int", "BSF_EXACT", "=", "8", ";", "public", "static", "final", "int", "BSF_NATIVE", "=", "16", ";", "public", "static", "final", "EAtom", "ATOM_ALL", "=", "EAtom", ".", "intern", "(", "\"all\"", ")", ";", "public", "final", "EBitString", "bin", ";", "long", "offset", ";", "long", "save_offset0", ";", "long", "[", "]", "save_offsetN", ";", "private", "long", "start_offset", ";", "private", "long", "save_offset", "(", "int", "n", ")", "{", "if", "(", "n", "==", "0", ")", "return", "save_offset0", ";", "return", "save_offsetN", "[", "n", "-", "1", "]", ";", "}", "private", "void", "save_offset", "(", "int", "n", ",", "long", "off", ")", "{", "if", "(", "n", "==", "0", ")", "save_offset0", "=", "off", ";", "else", "save_offsetN", "[", "n", "+", "1", "]", "=", "off", ";", "}", "private", "int", "slots", "(", ")", "{", "if", "(", "save_offsetN", "==", "null", ")", "return", "1", ";", "else", "return", "save_offsetN", ".", "length", "+", "1", ";", "}", "public", "long", "bitsLeft", "(", ")", "{", "return", "bin", ".", "bitSize", "(", ")", "-", "offset", ";", "}", "public", "EBitString", "binary", "(", ")", "{", "return", "bin", ";", "}", "public", "static", "EObject", "bs_context_to_binary", "(", "EObject", "obj", ")", "{", "EBinMatchState", "bms", ";", "if", "(", "(", "bms", "=", "obj", ".", "testBinMatchState", "(", ")", ")", "!=", "null", ")", "{", "long", "off", "=", "bms", ".", "start_offset", ";", "if", "(", "off", "%", "8", "==", "0", ")", "{", "int", "start_byte", "=", "(", "int", ")", "(", "off", "/", "8", ")", ";", "EBitString", "result", "=", "EBitString", ".", "makeByteOffsetTail", "(", "bms", ".", "bin", ",", "start_byte", ")", ";", "return", "result", ";", "}", "else", "{", "throw", "new", "NotImplemented", "(", ")", ";", "}", "}", "else", "{", "return", "obj", ";", "}", "}", "public", "static", "void", "bs_save2", "(", "EObject", "obj", ",", "int", "slot", ")", "{", "EBinMatchState", "bms", ";", "if", "(", "(", "bms", "=", "obj", ".", "testBinMatchState", "(", ")", ")", "!=", "null", ")", "{", "bms", ".", "save_offset", "(", "slot", ",", "bms", ".", "offset", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "}", "public", "static", "void", "bs_save2_start", "(", "EObject", "obj", ")", "{", "EBinMatchState", "bms", ";", "if", "(", "(", "bms", "=", "obj", ".", "testBinMatchState", "(", ")", ")", "!=", "null", ")", "{", "bms", ".", "start_offset", "=", "bms", ".", "offset", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "}", "public", "static", "void", "bs_restore2", "(", "EObject", "obj", ",", "int", "slot", ")", "{", "EBinMatchState", "bms", ";", "if", "(", "(", "bms", "=", "obj", ".", "testBinMatchState", "(", ")", ")", "!=", "null", ")", "{", "bms", ".", "offset", "=", "bms", ".", "save_offset", "(", "slot", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "}", "public", "static", "void", "bs_restore2_start", "(", "EObject", "obj", ")", "{", "EBinMatchState", "bms", ";", "if", "(", "(", "bms", "=", "obj", ".", "testBinMatchState", "(", ")", ")", "!=", "null", ")", "{", "bms", ".", "offset", "=", "bms", ".", "save_offset", "(", "0", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "}", "public", "static", "EBinMatchState", "bs_start_match2", "(", "EObject", "obj", ",", "int", "slots", ")", "{", "EBinMatchState", "ms", ";", "if", "(", "(", "ms", "=", "obj", ".", "testBinMatchState", "(", ")", ")", "!=", "null", ")", "{", "int", "actual_slots", "=", "ms", ".", "slots", "(", ")", ";", "ms", ".", "save_offset", "(", "0", ",", "ms", ".", "offset", ")", ";", "ms", ".", "start_offset", "=", "ms", ".", "offset", ";", "if", "(", "actual_slots", "<", "slots", ")", "{", "EBinMatchState", "res", "=", "new", "EBinMatchState", "(", "ms", ".", "bin", ",", "slots", ")", ";", "res", ".", "offset", "=", "ms", ".", "offset", ";", "res", ".", "save_offset", "(", "0", ",", "ms", ".", "save_offset", "(", "0", ")", ")", ";", "res", ".", "start_offset", "=", "ms", ".", "offset", ";", "return", "res", ";", "}", "return", "ms", ";", "}", "EBitString", "bs", ";", "if", "(", "(", "bs", "=", "obj", ".", "testBitString", "(", ")", ")", "!=", "null", ")", "return", "new", "EBinMatchState", "(", "bs", ",", "slots", ")", ";", "return", "null", ";", "}", "public", "EBinMatchState", "(", "EBitString", "binary", ",", "int", "slots", ")", "{", "this", ".", "bin", "=", "binary", ";", "this", ".", "offset", "=", "0", ";", "if", "(", "slots", ">", "1", ")", "{", "save_offsetN", "=", "new", "long", "[", "slots", "-", "1", "]", ";", "}", "}", "public", "EBitString", "bs_get_binary2", "(", "EObject", "spec", ",", "int", "flags", ")", "{", "long", "bitLength", ";", "if", "(", "spec", "==", "ATOM_ALL", ")", "{", "bitLength", "=", "bitsLeft", "(", ")", ";", "}", "else", "{", "ESmall", "len", "=", "spec", ".", "testSmall", "(", ")", ";", "if", "(", "len", "!=", "null", ")", "{", "bitLength", "=", "len", ".", "intValue", "(", ")", "*", "8L", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"\"", "+", "spec", ")", ";", "}", "}", "if", "(", "bitLength", ">", "bitsLeft", "(", ")", ")", "{", "return", "null", ";", "}", "else", "{", "EBitString", "result", "=", "bin", ".", "substring", "(", "offset", ",", "bitLength", ")", ";", "offset", "+=", "bitLength", ";", "return", "result", ";", "}", "}", "public", "EDouble", "bs_get_float2", "(", "int", "size", ",", "int", "unit", ",", "int", "flags", ")", "{", "EInteger", "i", "=", "bs_get_integer2", "(", "size", ",", "unit", ",", "flags", ")", ";", "if", "(", "(", "size", "*", "unit", ")", "==", "64", ")", "{", "double", "d", "=", "Double", ".", "longBitsToDouble", "(", "i", ".", "longValue", "(", ")", ")", ";", "return", "new", "EDouble", "(", "d", ")", ";", "}", "if", "(", "(", "size", "*", "unit", ")", "==", "32", ")", "{", "double", "d", "=", "Float", ".", "intBitsToFloat", "(", "i", ".", "intValue", "(", ")", ")", ";", "return", "new", "EDouble", "(", "d", ")", ";", "}", "return", "null", ";", "}", "public", "EInteger", "bs_get_integer2", "(", "int", "size", ",", "int", "unit", ",", "int", "flags", ")", "{", "size", "*=", "unit", ";", "boolean", "signed", "=", "(", "(", "flags", "&", "BSF_SIGNED", ")", "==", "BSF_SIGNED", ")", ";", "boolean", "little_endian", "=", "(", "(", "flags", "&", "BSF_LITTLE", ")", "==", "BSF_LITTLE", ")", ";", "boolean", "native_endian", "=", "(", "(", "flags", "&", "BSF_NATIVE", ")", "==", "BSF_NATIVE", ")", ";", "if", "(", "native_endian", ")", "{", "little_endian", "=", "ByteOrder", ".", "nativeOrder", "(", ")", "==", "ByteOrder", ".", "LITTLE_ENDIAN", ";", "}", "if", "(", "size", "==", "0", ")", "{", "return", "ESmall", ".", "ZERO", ";", "}", "if", "(", "size", "<", "0", "||", "bin", ".", "bitSize", "(", ")", "<", "(", "offset", "+", "size", ")", ")", "{", "return", "null", ";", "}", "if", "(", "size", "<=", "32", ")", "{", "int", "value", "=", "little_endian", "?", "bin", ".", "intLittleEndianBitsAt", "(", "offset", ",", "size", ")", ":", "bin", ".", "intBitsAt", "(", "offset", ",", "size", ")", ";", "offset", "+=", "size", ";", "if", "(", "signed", ")", "{", "value", "=", "EBitString", ".", "signExtend", "(", "value", ",", "size", ")", ";", "}", "else", "if", "(", "value", "<", "0", ")", "{", "return", "new", "EBig", "(", "value", "&", "0xFFFFffffL", ")", ";", "}", "ESmall", "res", "=", "new", "ESmall", "(", "value", ")", ";", "return", "res", ";", "}", "if", "(", "size", "<=", "64", ")", "{", "long", "value", "=", "little_endian", "?", "bin", ".", "longLittleEndianBitsAt", "(", "offset", ",", "size", ")", ":", "bin", ".", "longBitsAt", "(", "offset", ",", "size", ")", ";", "offset", "+=", "size", ";", "if", "(", "signed", ")", "{", "value", "=", "EBitString", ".", "signExtend", "(", "value", ",", "size", ")", ";", "}", "else", "if", "(", "value", "<", "0", ")", "{", "BigInteger", "big", "=", "BigInteger", ".", "valueOf", "(", "value", ")", ".", "add", "(", "TWO_TO_64", ")", ";", "return", "new", "EBig", "(", "big", ")", ";", "}", "EInteger", "res", "=", "ERT", ".", "box", "(", "value", ")", ";", "return", "res", ";", "}", "byte", "[", "]", "data", ";", "int", "extra_in_front", "=", "(", "size", "%", "8", ")", ";", "int", "bytes_needed", ",", "out_offset", ";", "if", "(", "extra_in_front", "!=", "0", ")", "{", "out_offset", "=", "0", ";", "bytes_needed", "=", "size", "/", "8", "+", "1", ";", "}", "else", "{", "out_offset", "=", "signed", "?", "0", ":", "1", ";", "bytes_needed", "=", "size", "/", "8", "+", "out_offset", ";", "}", "data", "=", "new", "byte", "[", "bytes_needed", "]", ";", "long", "read_offset", ";", "if", "(", "little_endian", ")", "{", "read_offset", "=", "offset", "+", "size", ";", "}", "else", "{", "read_offset", "=", "offset", ";", "}", "if", "(", "extra_in_front", "!=", "0", ")", "{", "if", "(", "little_endian", ")", "{", "read_offset", "-=", "extra_in_front", ";", "data", "[", "0", "]", "=", "(", "byte", ")", "bin", ".", "intLittleEndianBitsAt", "(", "read_offset", ",", "extra_in_front", ")", ";", "}", "else", "{", "data", "[", "0", "]", "=", "(", "byte", ")", "bin", ".", "intBitsAt", "(", "read_offset", ",", "extra_in_front", ")", ";", "read_offset", "+=", "extra_in_front", ";", "}", "out_offset", "=", "1", ";", "if", "(", "signed", ")", "{", "data", "[", "0", "]", "=", "(", "byte", ")", "(", "0xff", "&", "EBitString", ".", "signExtend", "(", "data", "[", "0", "]", ",", "extra_in_front", ")", ")", ";", "}", "}", "if", "(", "little_endian", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", "/", "8", ";", "i", "++", ")", "{", "read_offset", "-=", "8", ";", "data", "[", "out_offset", "+", "i", "]", "=", "(", "byte", ")", "bin", ".", "intBitsAt", "(", "read_offset", ",", "8", ")", ";", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", "/", "8", ";", "i", "++", ")", "{", "data", "[", "out_offset", "+", "i", "]", "=", "(", "byte", ")", "bin", ".", "intBitsAt", "(", "read_offset", ",", "8", ")", ";", "read_offset", "+=", "8", ";", "}", "}", "offset", "+=", "size", ";", "BigInteger", "bi", "=", "new", "BigInteger", "(", "data", ")", ";", "return", "ERT", ".", "box", "(", "bi", ")", ";", "}", "public", "EBitString", "bs_match_string", "(", "EBitString", "ebs", ")", "{", "long", "size", "=", "ebs", ".", "bitSize", "(", ")", ";", "if", "(", "size", ">", "bitsLeft", "(", ")", ")", "{", "return", "null", ";", "}", "long", "limit", "=", "size", ";", "for", "(", "int", "pos", "=", "0", ";", "pos", "<", "limit", ";", "pos", "+=", "8", ")", "{", "int", "rest", "=", "(", "int", ")", "Math", ".", "min", "(", "8", ",", "limit", "-", "pos", ")", ";", "int", "oc1", "=", "0xff", "&", "bin", ".", "intBitsAt", "(", "offset", "+", "pos", ",", "rest", ")", ";", "int", "oc2", "=", "0xff", "&", "ebs", ".", "intBitsAt", "(", "pos", ",", "rest", ")", ";", "if", "(", "oc1", "!=", "oc2", ")", "return", "null", ";", "}", "offset", "+=", "size", ";", "return", "ebs", ";", "}", "public", "EObject", "bs_skip_bits2", "(", "EObject", "count_o", ",", "int", "bits", ",", "int", "flags", ")", "{", "if", "(", "count_o", "==", "ATOM_ALL", ")", "{", "long", "bitLength", "=", "bitsLeft", "(", ")", ";", "offset", "+=", "bitLength", ";", "return", "ERT", ".", "TRUE", ";", "}", "EInteger", "count", ";", "if", "(", "(", "count", "=", "count_o", ".", "testInteger", "(", ")", ")", "==", "null", ")", "{", "return", "null", ";", "}", "int", "bitsWanted", "=", "bits", "*", "count", ".", "intValue", "(", ")", ";", "if", "(", "bitsLeft", "(", ")", "<", "bitsWanted", ")", "{", "return", "null", ";", "}", "offset", "+=", "bitsWanted", ";", "return", "ERT", ".", "TRUE", ";", "}", "public", "boolean", "bs_test_unit", "(", "int", "unit", ")", "{", "boolean", "res", "=", "(", "bitsLeft", "(", ")", "%", "unit", ")", "==", "0", ";", "return", "res", ";", "}", "public", "boolean", "bs_test_tail2", "(", "int", "expected_left", ")", "{", "return", "(", "offset", "+", "(", "long", ")", "expected_left", "==", "bin", ".", "bitSize", "(", ")", ")", ";", "}", "public", "boolean", "bs_skip_utf8", "(", "int", "flags", ")", "{", "long", "save_offset", "=", "offset", ";", "int", "character", "=", "decodeUTF8", "(", ")", ";", "if", "(", "character", "<", "0", ")", "assert", "(", "offset", "==", "save_offset", ")", ";", "return", "(", "character", ">=", "0", ")", ";", "}", "public", "int", "bs_get_utf8", "(", "int", "flags", ")", "{", "long", "save_offset", "=", "offset", ";", "int", "character", "=", "decodeUTF8", "(", ")", ";", "if", "(", "character", "<", "0", ")", "assert", "(", "offset", "==", "save_offset", ")", ";", "return", "character", ";", "}", "public", "boolean", "bs_skip_utf16", "(", "int", "flags", ")", "{", "long", "save_offset", "=", "offset", ";", "int", "character", "=", "decodeUTF16", "(", "flags", ")", ";", "if", "(", "character", "<", "0", ")", "assert", "(", "offset", "==", "save_offset", ")", ";", "return", "(", "character", ">=", "0", ")", ";", "}", "public", "int", "bs_get_utf16", "(", "int", "flags", ")", "{", "long", "save_offset", "=", "offset", ";", "int", "character", "=", "decodeUTF16", "(", "flags", ")", ";", "if", "(", "character", "<", "0", ")", "assert", "(", "offset", "==", "save_offset", ")", ";", "return", "character", ";", "}", "public", "boolean", "bs_skip_utf32", "(", "int", "flags", ")", "{", "long", "save_offset", "=", "offset", ";", "int", "character", "=", "decodeUTF32", "(", "flags", ")", ";", "if", "(", "character", "<", "0", ")", "assert", "(", "offset", "==", "save_offset", ")", ";", "return", "(", "character", ">=", "0", ")", ";", "}", "public", "int", "bs_get_utf32", "(", "int", "flags", ")", "{", "long", "save_offset", "=", "offset", ";", "int", "character", "=", "decodeUTF32", "(", "flags", ")", ";", "if", "(", "character", "<", "0", ")", "assert", "(", "offset", "==", "save_offset", ")", ";", "return", "character", ";", "}", "static", "final", "int", "[", "]", "UTF8_MASK", "=", "{", "0", ",", "0x7F", ",", "0x7FF", ",", "0xFFFF", ",", "0x1FFFFF", "}", ";", "public", "int", "decodeUTF8", "(", ")", "{", "if", "(", "offset", "%", "8", "!=", "0", ")", "return", "-", "1", ";", "int", "byte_pos", "=", "(", "int", ")", "(", "offset", "/", "8", ")", ";", "if", "(", "bitsLeft", "(", ")", "<", "8", ")", "return", "-", "1", ";", "int", "acc", "=", "bin", ".", "octetAt", "(", "byte_pos", "++", ")", ";", "if", "(", "acc", "<", "0x80", ")", "{", "offset", "=", "8L", "*", "byte_pos", ";", "return", "acc", ";", "}", "if", "(", "(", "acc", "&", "0xC0", ")", "==", "0x80", ")", "return", "-", "1", ";", "if", "(", "acc", ">", "0xF8", ")", "return", "-", "1", ";", "int", "len", ";", "byte", "t", "=", "(", "byte", ")", "acc", ";", "for", "(", "len", "=", "1", ";", "(", "t", "<<=", "1", ")", "<", "0", ";", "len", "++", ")", "{", "if", "(", "bitsLeft", "(", ")", "-", "8", "*", "len", "<", "8", ")", "return", "-", "1", ";", "int", "b", "=", "bin", ".", "octetAt", "(", "byte_pos", "++", ")", ";", "if", "(", "(", "b", "&", "0xC0", ")", "!=", "0x80", ")", "return", "-", "1", ";", "acc", "=", "(", "acc", "<<", "6", ")", "+", "(", "b", "&", "0x3F", ")", ";", "}", "acc", "&=", "UTF8_MASK", "[", "len", "]", ";", "if", "(", "acc", "<=", "UTF8_MASK", "[", "len", "-", "1", "]", ")", "return", "-", "1", ";", "if", "(", "!", "isValidCodePoint", "(", "acc", ")", ")", "return", "-", "1", ";", "offset", "=", "8L", "*", "byte_pos", ";", "return", "acc", ";", "}", "public", "int", "decodeUTF16", "(", "int", "flags", ")", "{", "if", "(", "offset", "%", "8", "!=", "0", ")", "return", "-", "1", ";", "int", "byte_pos", "=", "(", "int", ")", "(", "offset", "/", "8", ")", ";", "if", "(", "bitsLeft", "(", ")", "<", "16", ")", "return", "-", "1", ";", "int", "acc", "=", "bin", ".", "uint16_at", "(", "byte_pos", ",", "flags", ")", ";", "byte_pos", "+=", "2", ";", "if", "(", "(", "acc", "&", "~", "0x3FF", ")", "==", "0xD800", ")", "{", "if", "(", "bitsLeft", "(", ")", "<", "2", "*", "16", ")", "return", "-", "1", ";", "int", "w2", "=", "bin", ".", "uint16_at", "(", "byte_pos", ",", "flags", ")", ";", "byte_pos", "+=", "2", ";", "if", "(", "(", "w2", "&", "~", "0x3FF", ")", "!=", "0xDC00", ")", "return", "-", "1", ";", "acc", "=", "(", "(", "acc", "&", "0x3FF", ")", "<<", "10", ")", "+", "(", "w2", "&", "0x3FF", ")", "+", "0x10000", ";", "}", "else", "if", "(", "(", "acc", "&", "~", "0x3FF", ")", "==", "0xDC00", ")", "{", "return", "-", "1", ";", "}", "if", "(", "!", "isValidCodePoint", "(", "acc", ")", ")", "return", "-", "1", ";", "offset", "=", "8L", "*", "byte_pos", ";", "return", "acc", ";", "}", "public", "int", "decodeUTF32", "(", "int", "flags", ")", "{", "if", "(", "offset", "%", "8", "!=", "0", ")", "return", "-", "1", ";", "int", "byte_pos", "=", "(", "int", ")", "(", "offset", "/", "8", ")", ";", "if", "(", "bitsLeft", "(", ")", "<", "32", ")", "return", "-", "1", ";", "int", "acc", "=", "bin", ".", "int32_at", "(", "byte_pos", ",", "flags", ")", ";", "if", "(", "acc", "<", "0", "||", "!", "isValidCodePoint", "(", "acc", ")", ")", "return", "-", "1", ";", "offset", "+=", "32", ";", "return", "acc", ";", "}", "public", "static", "boolean", "isValidCodePoint", "(", "int", "c", ")", "{", "return", "(", "(", "c", "&", "~", "0x7FF", ")", "!=", "0xD800", "&&", "(", "c", "&", "~", "0x1", ")", "!=", "0xFFFE", "&&", "c", "<", "0x110000", ")", ";", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "return", "System", ".", "identityHashCode", "(", "this", ")", ";", "}", "}", "</s>" ]
7,824
[ "<s>", "package", "erjang", ";", "import", "java", ".", "math", ".", "BigInteger", ";", "import", "java", ".", "nio", ".", "ByteBuffer", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "MethodVisitor", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Opcodes", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "public", "final", "class", "ESmall", "extends", "EInteger", "{", "private", "static", "final", "Type", "ESMALL_TYPE", "=", "Type", ".", "getType", "(", "ESmall", ".", "class", ")", ";", "public", "static", "final", "ESmall", "ZERO", "=", "new", "ESmall", "(", "0", ")", ";", "public", "static", "final", "ESmall", "MINUS_ONE", "=", "new", "ESmall", "(", "-", "1", ")", ";", "public", "static", "final", "ESmall", "ONE", "=", "new", "ESmall", "(", "1", ")", ";", "public", "final", "int", "value", ";", "final", "static", "int", "PREALLOC_COUNT", "=", "256", ";", "static", "final", "ESmall", "[", "]", "little", "=", "new", "ESmall", "[", "PREALLOC_COUNT", "]", ";", "static", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "little", ".", "length", ";", "i", "++", ")", "{", "little", "[", "i", "]", "=", "new", "ESmall", "(", "i", ")", ";", "}", "}", "@", "Override", "public", "ESmall", "testSmall", "(", ")", "{", "return", "this", ";", "}", "public", "ESmall", "(", "int", "value", ")", "{", "this", ".", "value", "=", "value", ";", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "return", "value", ";", "}", "public", "long", "longValue", "(", ")", "{", "return", "value", ";", "}", "public", "EInteger", "inc", "(", ")", "{", "if", "(", "value", "==", "Integer", ".", "MAX_VALUE", ")", "{", "return", "ERT", ".", "box", "(", "(", "long", ")", "Integer", ".", "MAX_VALUE", "+", "1L", ")", ";", "}", "else", "{", "return", "new", "ESmall", "(", "value", "+", "1", ")", ";", "}", "}", "public", "EInteger", "dec", "(", ")", "{", "if", "(", "value", "==", "Integer", ".", "MIN_VALUE", ")", "{", "return", "ERT", ".", "box", "(", "(", "long", ")", "Integer", ".", "MIN_VALUE", "-", "1L", ")", ";", "}", "else", "{", "return", "new", "ESmall", "(", "value", "-", "1", ")", ";", "}", "}", "public", "boolean", "is_zero", "(", ")", "{", "return", "value", "==", "0", ";", "}", "@", "Override", "public", "boolean", "collectIOList", "(", "List", "<", "ByteBuffer", ">", "out", ")", "{", "ByteBuffer", "b", "=", "ByteBuffer", ".", "allocate", "(", "1", ")", ";", "b", ".", "put", "(", "0", ",", "(", "byte", ")", "value", ")", ";", "out", ".", "add", "(", "b", ")", ";", "return", "true", ";", "}", "public", "boolean", "equals", "(", "EObject", "other", ")", "{", "if", "(", "other", "==", "this", ")", "return", "true", ";", "if", "(", "other", "instanceof", "ESmall", ")", "return", "(", "(", "ESmall", ")", "other", ")", ".", "value", "==", "value", ";", "if", "(", "other", "instanceof", "EDouble", ")", "return", "(", "(", "EDouble", ")", "other", ")", ".", "value", "==", "value", ";", "return", "false", ";", "}", "@", "Override", "int", "compare_same", "(", "EObject", "rhs", ")", "{", "return", "rhs", ".", "r_compare_same", "(", "this", ")", ";", "}", "int", "r_compare_same", "(", "ESmall", "lhs", ")", "{", "if", "(", "lhs", ".", "value", "<", "value", ")", "return", "-", "1", ";", "if", "(", "lhs", ".", "value", "==", "value", ")", "return", "0", ";", "return", "1", ";", "}", "int", "r_compare_same", "(", "EBig", "lhs", ")", "{", "return", "lhs", ".", "value", ".", "compareTo", "(", "BigInteger", ".", "valueOf", "(", "value", ")", ")", ";", "}", "int", "r_compare_same", "(", "EDouble", "lhs", ")", "{", "return", "lhs", ".", "value", "<", "value", "?", "-", "1", ":", "lhs", ".", "value", "==", "value", "?", "0", ":", "1", ";", "}", "@", "Override", "public", "boolean", "equalsExactly", "(", "EObject", "rhs", ")", "{", "return", "rhs", ".", "r_equals_exactly", "(", "this", ")", ";", "}", "boolean", "r_equals_exactly", "(", "ESmall", "lhs", ")", "{", "return", "lhs", ".", "value", "==", "value", ";", "}", "@", "Override", "public", "int", "asInt", "(", ")", "{", "return", "value", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "ESmall", ")", "{", "ESmall", "o", "=", "(", "ESmall", ")", "obj", ";", "return", "o", ".", "value", "==", "value", ";", "}", "return", "false", ";", "}", "public", "int", "intValue", "(", ")", "{", "return", "value", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "String", ".", "valueOf", "(", "value", ")", ";", "}", "@", "Override", "public", "org", ".", "objectweb", ".", "asm", ".", "Type", "emit_const", "(", "MethodVisitor", "fa", ")", "{", "Type", "type", "=", "ESMALL_TYPE", ";", "fa", ".", "visitTypeInsn", "(", "Opcodes", ".", "NEW", ",", "type", ".", "getInternalName", "(", ")", ")", ";", "fa", ".", "visitInsn", "(", "Opcodes", ".", "DUP", ")", ";", "fa", ".", "visitLdcInsn", "(", "new", "Integer", "(", "value", ")", ")", ";", "fa", ".", "visitMethodInsn", "(", "Opcodes", ".", "INVOKESPECIAL", ",", "type", ".", "getInternalName", "(", ")", ",", "\"<init>\"", ",", "\"(I)V\"", ")", ";", "return", "type", ";", "}", "@", "Override", "public", "EInteger", "abs", "(", ")", "{", "return", "ERT", ".", "box", "(", "Math", ".", "abs", "(", "(", "long", ")", "value", ")", ")", ";", "}", "public", "static", "ESmall", "make", "(", "int", "v", ")", "{", "if", "(", "v", ">=", "0", "&&", "v", "<", "PREALLOC_COUNT", ")", "return", "little", "[", "v", "]", ";", "else", "return", "new", "ESmall", "(", "v", ")", ";", "}", "public", "double", "doubleValue", "(", ")", "{", "return", "value", ";", "}", "public", "BigInteger", "bigintValue", "(", ")", "{", "return", "BigInteger", ".", "valueOf", "(", "value", ")", ";", "}", "public", "ENumber", "add", "(", "EObject", "other", ",", "boolean", "guard", ")", "{", "return", "other", ".", "add", "(", "value", ",", "guard", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"+\"", ")", "public", "ENumber", "add", "(", "EObject", "rhs", ")", "{", "return", "rhs", ".", "add", "(", "value", ",", "false", ")", ";", "}", "public", "EInteger", "add", "(", "int", "rhs", ",", "boolean", "guard", ")", "{", "return", "ERT", ".", "box", "(", "(", "long", ")", "value", "+", "(", "long", ")", "rhs", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"+\"", ")", "public", "EInteger", "add", "(", "ESmall", "rhs", ")", "{", "return", "ERT", ".", "box", "(", "(", "long", ")", "value", "+", "(", "long", ")", "rhs", ".", "value", ")", ";", "}", "public", "ENumber", "add", "(", "double", "lhs", ",", "boolean", "guard", ")", "{", "return", "ERT", ".", "box", "(", "lhs", "+", "value", ")", ";", "}", "public", "ENumber", "add", "(", "BigInteger", "lhs", ",", "boolean", "guard", ")", "{", "return", "ERT", ".", "box", "(", "lhs", ".", "add", "(", "BigInteger", ".", "valueOf", "(", "value", ")", ")", ")", ";", "}", "public", "ENumber", "subtract", "(", "EObject", "other", ",", "boolean", "guard", ")", "{", "return", "other", ".", "r_subtract", "(", "value", ",", "guard", ")", ";", "}", "public", "ENumber", "subtract", "(", "ESmall", "rhs", ")", "{", "return", "ERT", ".", "box", "(", "(", "long", ")", "value", "-", "(", "long", ")", "rhs", ".", "value", ")", ";", "}", "@", "Deprecated", "public", "ENumber", "subtract", "(", "int", "rhs", ")", "{", "return", "ERT", ".", "box", "(", "(", "long", ")", "value", "-", "rhs", ")", ";", "}", "public", "ENumber", "r_subtract", "(", "int", "lhs", ",", "boolean", "guard", ")", "{", "return", "ERT", ".", "box", "(", "(", "long", ")", "lhs", "-", "(", "long", ")", "value", ")", ";", "}", "public", "ENumber", "r_subtract", "(", "double", "lhs", ",", "boolean", "guard", ")", "{", "return", "ERT", ".", "box", "(", "lhs", "-", "value", ")", ";", "}", "public", "ENumber", "r_subtract", "(", "BigInteger", "lhs", ",", "boolean", "guard", ")", "{", "return", "ERT", ".", "box", "(", "lhs", ".", "subtract", "(", "BigInteger", ".", "valueOf", "(", "value", ")", ")", ")", ";", "}", "@", "BIF", "(", "name", "=", "\"*\"", ")", "public", "ENumber", "multiply", "(", "EObject", "other", ")", "{", "return", "other", ".", "r_multiply", "(", "value", ")", ";", "}", "public", "ENumber", "r_multiply", "(", "int", "lhs", ")", "{", "return", "ERT", ".", "box", "(", "(", "long", ")", "lhs", "*", "(", "long", ")", "value", ")", ";", "}", "public", "EDouble", "r_multiply", "(", "double", "lhs", ")", "{", "return", "ERT", ".", "box", "(", "lhs", "*", "value", ")", ";", "}", "public", "ENumber", "r_multiply", "(", "BigInteger", "lhs", ")", "{", "return", "ERT", ".", "box", "(", "lhs", ".", "multiply", "(", "BigInteger", ".", "valueOf", "(", "value", ")", ")", ")", ";", "}", "@", "Override", "public", "ENumber", "negate", "(", ")", "{", "return", "new", "ESmall", "(", "-", "value", ")", ";", "}", "public", "EDouble", "divide", "(", "EObject", "other", ")", "{", "return", "other", ".", "r_divide", "(", "value", ")", ";", "}", "public", "EDouble", "r_divide", "(", "int", "lhs", ")", "{", "if", "(", "value", "==", "0", ")", "throw", "ERT", ".", "badarith", "(", "lhs", ",", "this", ")", ";", "return", "ERT", ".", "box", "(", "(", "double", ")", "lhs", "/", "value", ")", ";", "}", "public", "EDouble", "r_divide", "(", "double", "lhs", ")", "{", "if", "(", "value", "==", "0", ")", "throw", "ERT", ".", "badarith", "(", "ERT", ".", "box", "(", "lhs", ")", ",", "this", ")", ";", "return", "ERT", ".", "box", "(", "lhs", "/", "value", ")", ";", "}", "public", "EDouble", "r_divide", "(", "BigInteger", "lhs", ")", "{", "if", "(", "value", "==", "0", ")", "throw", "ERT", ".", "badarith", "(", "ERT", ".", "box", "(", "lhs", ")", ",", "this", ")", ";", "return", "ERT", ".", "box", "(", "lhs", ".", "doubleValue", "(", ")", "/", "value", ")", ";", "}", "public", "EInteger", "idiv", "(", "EObject", "other", ")", "{", "return", "other", ".", "r_idiv", "(", "value", ")", ";", "}", "public", "EInteger", "idiv", "(", "int", "rhs", ")", "{", "if", "(", "rhs", "==", "0", ")", "throw", "ERT", ".", "badarith", "(", "this", ",", "ERT", ".", "box", "(", "rhs", ")", ")", ";", "return", "ERT", ".", "box", "(", "value", "/", "rhs", ")", ";", "}", "public", "EInteger", "r_idiv", "(", "int", "lhs", ")", "{", "if", "(", "value", "==", "0", ")", "throw", "ERT", ".", "badarith", "(", "ERT", ".", "box", "(", "lhs", ")", ",", "this", ")", ";", "return", "ERT", ".", "box", "(", "(", "long", ")", "lhs", "/", "(", "long", ")", "value", ")", ";", "}", "public", "EInteger", "r_idiv", "(", "BigInteger", "lhs", ")", "{", "if", "(", "value", "==", "0", ")", "throw", "ERT", ".", "badarith", "(", "lhs", ",", "this", ")", ";", "return", "ERT", ".", "box", "(", "lhs", ".", "divide", "(", "BigInteger", ".", "valueOf", "(", "value", ")", ")", ")", ";", "}", "public", "ESmall", "irem", "(", "int", "rhs", ")", "{", "if", "(", "rhs", "==", "0", ")", "throw", "ERT", ".", "badarith", "(", "this", ",", "ERT", ".", "box", "(", "rhs", ")", ")", ";", "return", "ERT", ".", "box", "(", "value", "%", "rhs", ")", ";", "}", "public", "EInteger", "irem", "(", "EObject", "other", ")", "{", "return", "other", ".", "r_irem", "(", "value", ")", ";", "}", "public", "EInteger", "r_irem", "(", "int", "lhs", ")", "{", "if", "(", "value", "==", "0", ")", "throw", "ERT", ".", "badarith", "(", "ERT", ".", "box", "(", "lhs", ")", ",", "this", ")", ";", "return", "ERT", ".", "box", "(", "lhs", "%", "value", ")", ";", "}", "public", "EInteger", "r_irem", "(", "BigInteger", "lhs", ")", "{", "if", "(", "value", "==", "0", ")", "throw", "ERT", ".", "badarith", "(", "ERT", ".", "box", "(", "lhs", ")", ",", "this", ")", ";", "return", "ERT", ".", "box", "(", "lhs", ".", "remainder", "(", "BigInteger", ".", "valueOf", "(", "value", ")", ")", ")", ";", "}", "public", "EInteger", "bsr", "(", "EObject", "other", ")", "{", "return", "other", ".", "r_bsr", "(", "value", ")", ";", "}", "public", "EInteger", "r_bsr", "(", "int", "lhs", ")", "{", "if", "(", "(", "value", "&", "~", "31", ")", "==", "0", ")", "return", "ERT", ".", "box", "(", "(", "lhs", ">>", "value", ")", ")", ";", "if", "(", "value", ">=", "32", ")", "{", "if", "(", "lhs", "<", "0", ")", "return", "ESmall", ".", "MINUS_ONE", ";", "else", "return", "ZERO", ";", "}", "else", "{", "return", "ERT", ".", "box", "(", "BigInteger", ".", "valueOf", "(", "lhs", ")", ".", "shiftRight", "(", "value", ")", ")", ";", "}", "}", "public", "EInteger", "r_bsr", "(", "BigInteger", "lhs", ")", "{", "return", "ERT", ".", "box", "(", "lhs", ".", "shiftRight", "(", "value", ")", ")", ";", "}", "public", "EInteger", "bsl", "(", "EObject", "other", ")", "{", "return", "other", ".", "r_bsl", "(", "value", ")", ";", "}", "public", "EInteger", "r_bsl", "(", "int", "lhs", ")", "{", "if", "(", "(", "value", "&", "~", "31", ")", "==", "0", ")", "return", "ERT", ".", "box", "(", "(", "(", "long", ")", "lhs", ")", "<<", "value", ")", ";", "return", "ERT", ".", "box", "(", "BigInteger", ".", "valueOf", "(", "lhs", ")", ".", "shiftLeft", "(", "value", ")", ")", ";", "}", "public", "EInteger", "r_bsl", "(", "BigInteger", "lhs", ")", "{", "return", "ERT", ".", "box", "(", "lhs", ".", "shiftLeft", "(", "value", ")", ")", ";", "}", "public", "EInteger", "band", "(", "EObject", "other", ")", "{", "return", "other", ".", "band", "(", "value", ")", ";", "}", "public", "EInteger", "band", "(", "int", "lhs", ")", "{", "return", "ERT", ".", "box", "(", "(", "lhs", "&", "value", ")", ")", ";", "}", "public", "EInteger", "band", "(", "BigInteger", "lhs", ")", "{", "return", "ERT", ".", "box", "(", "lhs", ".", "and", "(", "BigInteger", ".", "valueOf", "(", "value", ")", ")", ")", ";", "}", "public", "EInteger", "bor", "(", "EObject", "other", ")", "{", "return", "other", ".", "bor", "(", "value", ")", ";", "}", "public", "EInteger", "bor", "(", "int", "lhs", ")", "{", "return", "ERT", ".", "box", "(", "(", "lhs", "|", "value", ")", ")", ";", "}", "public", "EInteger", "bor", "(", "BigInteger", "lhs", ")", "{", "return", "ERT", ".", "box", "(", "lhs", ".", "or", "(", "BigInteger", ".", "valueOf", "(", "value", ")", ")", ")", ";", "}", "public", "EInteger", "bxor", "(", "EObject", "other", ")", "{", "return", "other", ".", "bxor", "(", "value", ")", ";", "}", "public", "EInteger", "bxor", "(", "int", "lhs", ")", "{", "return", "ERT", ".", "box", "(", "(", "lhs", "^", "value", ")", ")", ";", "}", "public", "EInteger", "bxor", "(", "BigInteger", "lhs", ")", "{", "return", "ERT", ".", "box", "(", "lhs", ".", "xor", "(", "BigInteger", ".", "valueOf", "(", "value", ")", ")", ")", ";", "}", "public", "EInteger", "bnot", "(", ")", "{", "return", "ERT", ".", "box", "(", "~", "value", ")", ";", "}", "@", "Override", "public", "void", "encode", "(", "EOutputStream", "eos", ")", "{", "eos", ".", "write_int", "(", "value", ")", ";", "}", "}", "</s>" ]
7,825
[ "<s>", "package", "erjang", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "NoSuchElementException", ";", "public", "class", "EObjectIterator", "implements", "Iterator", "<", "EObject", ">", "{", "private", "EObject", "object", "=", "null", ";", "public", "EObjectIterator", "(", "EObject", "object", ")", "{", "this", ".", "object", "=", "object", ";", "}", "public", "boolean", "hasNext", "(", ")", "{", "if", "(", "object", "==", "null", ")", "{", "return", "false", ";", "}", "return", "!", "object", ".", "isNil", "(", ")", ";", "}", "public", "EObject", "next", "(", ")", "{", "if", "(", "(", "object", "==", "null", ")", "||", "object", ".", "isNil", "(", ")", ")", "{", "throw", "new", "NoSuchElementException", "(", ")", ";", "}", "EObject", "next", ";", "ECons", "cons", "=", "object", ".", "testCons", "(", ")", ";", "if", "(", "(", "cons", "!=", "null", ")", "&&", "!", "(", "cons", "instanceof", "EString", ")", ")", "{", "next", "=", "cons", ".", "head", "(", ")", ";", "object", "=", "cons", ".", "tail", "(", ")", ";", "}", "else", "{", "next", "=", "object", ";", "object", "=", "null", ";", "}", "return", "next", ";", "}", "public", "void", "remove", "(", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}", "}", "</s>" ]
7,826
[ "<s>", "package", "erjang", ";", "import", "java", ".", "io", ".", "BufferedReader", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileReader", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "net", ".", "InetAddress", ";", "import", "java", ".", "net", ".", "UnknownHostException", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "concurrent", ".", "ConcurrentHashMap", ";", "import", "java", ".", "util", ".", "concurrent", ".", "atomic", ".", "AtomicInteger", ";", "import", "erjang", ".", "m", ".", "erlang", ".", "ErlDist", ";", "import", "kilim", ".", "Pausable", ";", "public", "abstract", "class", "EAbstractNode", "{", "public", "static", "final", "EAtom", "am_nonode_at_nohost", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "public", "static", "final", "EAtom", "am_nodedown", "=", "EAtom", ".", "intern", "(", "\"nodedown\"", ")", ";", "public", "static", "final", "EAtom", "am_nodeup", "=", "EAtom", ".", "intern", "(", "\"nodeup\"", ")", ";", "public", "static", "final", "EAtom", "am_nodedown_reason", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "public", "static", "final", "EAtom", "am_node_type", "=", "EAtom", ".", "intern", "(", "\"node_type\"", ")", ";", "public", "static", "final", "EAtom", "am_visible", "=", "EAtom", ".", "intern", "(", "\"visible\"", ")", ";", "public", "static", "final", "EAtom", "am_hidden", "=", "EAtom", ".", "intern", "(", "\"hidden\"", ")", ";", "public", "static", "final", "EAtom", "am_all", "=", "EAtom", ".", "intern", "(", "\"all\"", ")", ";", "static", "String", "localHost", "=", "null", ";", "EAtom", "node", "=", "am_nonode_at_nohost", ";", "String", "host", ";", "String", "alive", ";", "EAtom", "cookie", ";", "static", "EAtom", "defaultCookie", "=", "null", ";", "static", "final", "int", "NTYPE_R6", "=", "110", ";", "static", "final", "int", "NTYPE_R4_ERLANG", "=", "109", ";", "static", "final", "int", "NTYPE_R4_HIDDEN", "=", "104", ";", "public", "static", "final", "int", "ERTS_NODES_MON_OPT_TYPE_VISIBLE", "=", "1", "<<", "0", ";", "public", "static", "final", "int", "ERTS_NODES_MON_OPT_TYPE_HIDDEN", "=", "1", "<<", "1", ";", "public", "static", "final", "int", "ERTS_NODES_MON_OPT_DOWN_REASON", "=", "1", "<<", "2", ";", "public", "static", "final", "int", "ERTS_NODES_MON_OPT_TYPES", "=", "ERTS_NODES_MON_OPT_TYPE_VISIBLE", "|", "ERTS_NODES_MON_OPT_TYPE_HIDDEN", ";", "static", "final", "int", "dFlagPublished", "=", "1", ";", "static", "final", "int", "dFlagAtomCache", "=", "2", ";", "static", "final", "int", "dFlagExtendedReferences", "=", "4", ";", "static", "final", "int", "dFlagDistMonitor", "=", "8", ";", "static", "final", "int", "dFlagFunTags", "=", "0x10", ";", "static", "final", "int", "dFlagDistMonitorName", "=", "0x20", ";", "static", "final", "int", "dFlagHiddenAtomCache", "=", "0x40", ";", "static", "final", "int", "dflagNewFunTags", "=", "0x80", ";", "static", "final", "int", "dFlagExtendedPidsPorts", "=", "0x100", ";", "static", "final", "int", "dFlagExportPtrTag", "=", "0x200", ";", "static", "final", "int", "dFlagBitBinaries", "=", "0x400", ";", "static", "final", "int", "dFlagNewFloats", "=", "0x800", ";", "static", "final", "int", "dFUnicodeIO", "=", "0x1000", ";", "static", "final", "int", "dFDistHdrAtomCache", "=", "0x2000", ";", "static", "final", "int", "dFlagSmallAtoms", "=", "0x4000", ";", "int", "ntype", "=", "NTYPE_R6", ";", "int", "proto", "=", "0", ";", "int", "distHigh", "=", "5", ";", "int", "distLow", "=", "5", ";", "int", "creation", "=", "0", ";", "int", "flags", "=", "dFlagExtendedReferences", "|", "dFlagExtendedPidsPorts", "|", "dFlagBitBinaries", "|", "dFlagNewFloats", "|", "dFlagFunTags", "|", "dflagNewFunTags", ";", "static", "{", "try", "{", "localHost", "=", "InetAddress", ".", "getLocalHost", "(", ")", ".", "getHostName", "(", ")", ";", "final", "int", "dot", "=", "localHost", ".", "indexOf", "(", "\".\"", ")", ";", "if", "(", "dot", "!=", "-", "1", ")", "{", "localHost", "=", "localHost", ".", "substring", "(", "0", ",", "dot", ")", ";", "}", "}", "catch", "(", "final", "UnknownHostException", "e", ")", "{", "localHost", "=", "\"localhost\"", ";", "}", "final", "String", "dotCookieFilename", "=", "System", ".", "getProperty", "(", "\"user.home\"", ")", "+", "File", ".", "separator", "+", "\"\"", ";", "BufferedReader", "br", "=", "null", ";", "try", "{", "final", "File", "dotCookieFile", "=", "ERT", ".", "newFile", "(", "dotCookieFilename", ")", ";", "br", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "dotCookieFile", ")", ")", ";", "defaultCookie", "=", "EAtom", ".", "intern", "(", "br", ".", "readLine", "(", ")", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "defaultCookie", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "}", "finally", "{", "try", "{", "if", "(", "br", "!=", "null", ")", "{", "br", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "final", "IOException", "e", ")", "{", "}", "}", "}", "public", "EAbstractNode", "(", "EAtom", "node", ")", "{", "this", "(", "node", ",", "defaultCookie", ")", ";", "}", "public", "EAbstractNode", "(", ")", "{", "this", "(", "am_nonode_at_nohost", ")", ";", "}", "public", "EAbstractNode", "(", "EAtom", "node", ",", "EAtom", "cookie", ")", "{", "this", ".", "cookie", "=", "cookie", ";", "set", "(", "node", ",", "0", ")", ";", "}", "public", "void", "set", "(", "EAtom", "node", ",", "int", "cr", ")", "{", "String", "name", "=", "node", ".", "getName", "(", ")", ";", "final", "int", "i", "=", "name", ".", "indexOf", "(", "'@'", ",", "0", ")", ";", "if", "(", "i", "<", "0", ")", "{", "alive", "=", "name", ";", "host", "=", "localHost", ";", "}", "else", "{", "alive", "=", "name", ".", "substring", "(", "0", ",", "i", ")", ";", "host", "=", "name", ".", "substring", "(", "i", "+", "1", ",", "name", ".", "length", "(", ")", ")", ";", "}", "if", "(", "alive", ".", "length", "(", ")", ">", "0xff", ")", "{", "alive", "=", "alive", ".", "substring", "(", "0", ",", "0xff", ")", ";", "}", "this", ".", "node", "=", "EAtom", ".", "intern", "(", "alive", "+", "\"@\"", "+", "host", ")", ";", "this", ".", "creation", "=", "cr", ";", "}", "public", "EAtom", "node", "(", ")", "{", "return", "node", ";", "}", "public", "String", "host", "(", ")", "{", "return", "host", ";", "}", "public", "String", "alive", "(", ")", "{", "return", "alive", ";", "}", "public", "EAtom", "cookie", "(", ")", "{", "return", "cookie", ";", "}", "int", "type", "(", ")", "{", "return", "ntype", ";", "}", "int", "distHigh", "(", ")", "{", "return", "distHigh", ";", "}", "int", "distLow", "(", ")", "{", "return", "distLow", ";", "}", "int", "proto", "(", ")", "{", "return", "proto", ";", "}", "int", "creation", "(", ")", "{", "return", "creation", ";", "}", "public", "EAtom", "setCookie", "(", "final", "EAtom", "cookie", ")", "{", "final", "EAtom", "prev", "=", "this", ".", "cookie", ";", "this", ".", "cookie", "=", "cookie", ";", "return", "prev", ";", "}", "ConcurrentHashMap", "<", "EHandle", ",", "AtomicInteger", ">", "node_monitors", "=", "new", "ConcurrentHashMap", "<", "EHandle", ",", "AtomicInteger", ">", "(", ")", ";", "public", "void", "monitor_node", "(", "EHandle", "caller", ",", "boolean", "on", ")", "{", "node_monitors", ".", "putIfAbsent", "(", "caller", ",", "new", "AtomicInteger", "(", ")", ")", ";", "AtomicInteger", "ami", "=", "node_monitors", ".", "get", "(", "caller", ")", ";", "if", "(", "on", ")", "{", "ami", ".", "incrementAndGet", "(", ")", ";", "}", "else", "{", "ami", ".", "decrementAndGet", "(", ")", ";", "}", "}", "static", "ConcurrentHashMap", "<", "EHandle", ",", "ConcurrentHashMap", "<", "Integer", ",", "AtomicInteger", ">", ">", "nodes_monitors", "=", "new", "ConcurrentHashMap", "(", ")", ";", "public", "static", "Boolean", "monitor_nodes", "(", "EHandle", "caller", ",", "boolean", "on", ",", "ESeq", "opts_list", ")", "{", "boolean", "all", "=", "false", ",", "visible", "=", "false", ",", "hidden", "=", "false", ";", "int", "opts", "=", "0", ";", "for", "(", ";", "!", "opts_list", ".", "isNil", "(", ")", ";", "opts_list", "=", "opts_list", ".", "tail", "(", ")", ")", "{", "EObject", "opt", "=", "opts_list", ".", "head", "(", ")", ";", "ETuple2", "tp", ";", "if", "(", "opt", "==", "am_nodedown_reason", ")", "{", "opts", "|=", "ERTS_NODES_MON_OPT_DOWN_REASON", ";", "}", "else", "if", "(", "(", "tp", "=", "ETuple2", ".", "cast", "(", "opt", ")", ")", "!=", "null", ")", "{", "if", "(", "tp", ".", "elem1", "==", "am_node_type", ")", "{", "if", "(", "tp", ".", "elem2", "==", "am_visible", ")", "{", "if", "(", "hidden", "||", "all", ")", "return", "null", ";", "opts", "|=", "ERTS_NODES_MON_OPT_TYPE_VISIBLE", ";", "visible", "=", "true", ";", "}", "else", "if", "(", "tp", ".", "elem2", "==", "am_hidden", ")", "{", "if", "(", "visible", "||", "all", ")", "return", "null", ";", "opts", "|=", "ERTS_NODES_MON_OPT_TYPE_HIDDEN", ";", "hidden", "=", "true", ";", "}", "else", "if", "(", "tp", ".", "elem2", "==", "am_all", ")", "{", "if", "(", "visible", "||", "hidden", ")", "return", "null", ";", "opts", "|=", "ERTS_NODES_MON_OPT_TYPES", ";", "}", "else", "{", "return", "null", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}", "return", "Boolean", ".", "valueOf", "(", "monitor_nodes", "(", "caller", ",", "on", ",", "opts", ")", ")", ";", "}", "public", "static", "boolean", "monitor_nodes", "(", "EHandle", "caller", ",", "boolean", "on", ",", "int", "opts", ")", "{", "if", "(", "on", ")", "nodes_monitors", ".", "putIfAbsent", "(", "caller", ",", "new", "ConcurrentHashMap", "(", ")", ")", ";", "ConcurrentHashMap", "<", "Integer", ",", "AtomicInteger", ">", "forHandle", "=", "nodes_monitors", ".", "get", "(", "caller", ")", ";", "if", "(", "forHandle", "==", "null", ")", "return", "false", ";", "if", "(", "on", ")", "{", "forHandle", ".", "putIfAbsent", "(", "opts", ",", "new", "AtomicInteger", "(", "0", ")", ")", ";", "AtomicInteger", "ami", "=", "forHandle", ".", "get", "(", "opts", ")", ";", "if", "(", "ami", "==", "null", ")", "return", "false", ";", "int", "old", "=", "ami", ".", "getAndIncrement", "(", ")", ";", "return", "old", ">", "0", ";", "}", "else", "{", "AtomicInteger", "old", "=", "forHandle", ".", "remove", "(", "opts", ")", ";", "return", "old", "!=", "null", "&&", "old", ".", "get", "(", ")", ">", "0", ";", "}", "}", "public", "void", "node_going_down", "(", "EHandle", "sender", ",", "EObject", "reason", ")", "throws", "Pausable", "{", "for", "(", "Map", ".", "Entry", "<", "EHandle", ",", "AtomicInteger", ">", "ent", ":", "node_monitors", ".", "entrySet", "(", ")", ")", "{", "EHandle", "handle", "=", "ent", ".", "getKey", "(", ")", ";", "AtomicInteger", "howmany", "=", "ent", ".", "getValue", "(", ")", ";", "ETuple", "nd", "=", "ETuple", ".", "make", "(", "am_nodedown", ",", "this", ".", "node", "(", ")", ")", ";", "while", "(", "howmany", ".", "decrementAndGet", "(", ")", ">=", "0", ")", "{", "handle", ".", "send", "(", "sender", ",", "nd", ")", ";", "}", "}", "node_monitors", ".", "clear", "(", ")", ";", "}", "public", "void", "node_up", "(", "EHandle", "sender", ",", "EObject", "reason", ")", "throws", "Pausable", "{", "for", "(", "Map", ".", "Entry", "<", "EHandle", ",", "ConcurrentHashMap", "<", "Integer", ",", "AtomicInteger", ">", ">", "ent", ":", "nodes_monitors", ".", "entrySet", "(", ")", ")", "{", "EHandle", "handle", "=", "ent", ".", "getKey", "(", ")", ";", "ConcurrentHashMap", "<", "Integer", ",", "AtomicInteger", ">", "submap", "=", "ent", ".", "getValue", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "Integer", ",", "AtomicInteger", ">", "subent", ":", "submap", ".", "entrySet", "(", ")", ")", "{", "int", "opts", "=", "subent", ".", "getKey", "(", ")", ".", "intValue", "(", ")", ";", "int", "howmany", "=", "subent", ".", "getValue", "(", ")", ".", "get", "(", ")", ";", "final", "ETuple", "msg", ";", "if", "(", "opts", "==", "0", ")", "{", "msg", "=", "ETuple", ".", "make", "(", "am_nodeup", ",", "this", ".", "node", "(", ")", ")", ";", "}", "else", "{", "ECons", "info", "=", "ERT", ".", "NIL", ";", "msg", "=", "ETuple", ".", "make", "(", "am_nodeup", ",", "this", ".", "node", "(", ")", ",", "info", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "howmany", ";", "i", "++", ")", "{", "handle", ".", "send", "(", "sender", ",", "msg", ")", ";", "}", "}", "}", "}", "public", "abstract", "EObject", "dsig_reg_send", "(", "EInternalPID", "caller", ",", "EAtom", "name", ",", "EObject", "msg", ")", "throws", "Pausable", ";", "public", "abstract", "void", "dsig_demonitor", "(", "EHandle", "sender", ",", "ERef", "ref", ",", "EObject", "to_pid_or_name", ")", "throws", "Pausable", ";", "public", "static", "EAbstractNode", "get_or_connect", "(", "ETask", "proc", ",", "EAtom", "n", ")", "throws", "Pausable", "{", "EAbstractNode", "res", "=", "EPeer", ".", "get", "(", "n", ")", ";", "if", "(", "res", "==", "null", "&&", "(", "proc", "instanceof", "EProc", ")", ")", "{", "if", "(", "ErlDist", ".", "net_kernel__connect__1", ".", "invoke", "(", "(", "EProc", ")", "proc", ",", "new", "EObject", "[", "]", "{", "n", "}", ")", "==", "ERT", ".", "TRUE", ")", "{", "return", "EPeer", ".", "get", "(", "n", ")", ";", "}", "}", "return", "res", ";", "}", "}", "</s>" ]
7,827
[ "<s>", "package", "erjang", ";", "import", "java", ".", "nio", ".", "ByteBuffer", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "MethodVisitor", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Opcodes", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "public", "class", "ENil", "extends", "ESeq", "{", "private", "static", "final", "Type", "ENIL_TYPE", "=", "Type", ".", "getType", "(", "ENil", ".", "class", ")", ";", "private", "static", "final", "Type", "ERT_TYPE", "=", "Type", ".", "getType", "(", "ERT", ".", "class", ")", ";", "public", "ENil", "(", ")", "{", "super", "(", ")", ";", "}", "public", "boolean", "isNil", "(", ")", "{", "return", "true", ";", "}", "public", "String", "stringValue", "(", ")", "{", "return", "\"\"", ";", "}", "@", "Override", "public", "EObject", "head", "(", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}", "@", "Override", "public", "EList", "tail", "(", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}", "public", "boolean", "collectIOList", "(", "List", "<", "ByteBuffer", ">", "out", ")", "{", "return", "true", ";", "}", "@", "Override", "public", "void", "collectCharList", "(", "CharCollector", "out", ")", "{", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"[]\"", ";", "}", "@", "Override", "public", "ESeq", "cons", "(", "EObject", "h", ")", "{", "return", "new", "EList", "(", "h", ",", "this", ")", ";", "}", "@", "Override", "public", "Type", "emit_const", "(", "MethodVisitor", "fa", ")", "{", "fa", ".", "visitFieldInsn", "(", "Opcodes", ".", "GETSTATIC", ",", "ERT_TYPE", ".", "getInternalName", "(", ")", ",", "\"NIL\"", ",", "ENIL_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "return", "ENIL_TYPE", ";", "}", "@", "Override", "public", "ECons", "testNonEmptyList", "(", ")", "{", "return", "null", ";", "}", "@", "Override", "public", "ECons", "testCons", "(", ")", "{", "return", "this", ";", "}", "public", "ENil", "testNil", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "int", "compare_same", "(", "EObject", "rhs", ")", "{", "if", "(", "rhs", ".", "testNil", "(", ")", "!=", "null", ")", "return", "0", ";", "return", "-", "1", ";", "}", "@", "Override", "public", "void", "encode", "(", "EOutputStream", "eos", ")", "{", "eos", ".", "write_nil", "(", ")", ";", "}", "@", "Override", "public", "ESeq", "prepend", "(", "ESeq", "list", ")", "{", "return", "list", ";", "}", "@", "Override", "public", "boolean", "equalsExactly", "(", "EObject", "rhs", ")", "{", "return", "rhs", ".", "isNil", "(", ")", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "EObject", "other", ")", "{", "return", "other", ".", "isNil", "(", ")", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "Object", "other", ")", "{", "if", "(", "other", "instanceof", "EObject", ")", "{", "return", "(", "(", "EObject", ")", "other", ")", ".", "isNil", "(", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "return", "0", ";", "}", "}", "</s>" ]
7,828
[ "<s>", "package", "erjang", ";", "import", "kilim", ".", "Pausable", ";", "public", "interface", "EFunHandler", "{", "EObject", "invoke", "(", "EProc", "proc", ",", "EObject", "[", "]", "args", ")", "throws", "Pausable", ";", "}", "</s>" ]
7,829
[ "<s>", "package", "erjang", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "MethodVisitor", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Opcodes", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "public", "class", "EPair", "extends", "ECons", "{", "public", "final", "EObject", "head", ";", "public", "final", "EObject", "tail", ";", "public", "EPair", "(", "EObject", "h", ",", "EObject", "t", ")", "{", "assert", "(", "h", "!=", "null", ")", ";", "assert", "(", "t", "!=", "null", ")", ";", "this", ".", "head", "=", "h", ";", "this", ".", "tail", "=", "t", ";", "}", "public", "ECons", "testNonEmptyList", "(", ")", "{", "return", "this", ";", "}", "public", "EObject", "head", "(", ")", "{", "return", "head", ";", "}", "public", "EObject", "tail", "(", ")", "{", "return", "tail", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "\"[\"", ")", ";", "EObject", "val", "=", "this", ";", "while", "(", "val", "instanceof", "ECons", "&&", "val", "!=", "ERT", ".", "NIL", ")", "{", "ECons", "ep", "=", "(", "ECons", ")", "val", ";", "if", "(", "val", "!=", "this", ")", "{", "sb", ".", "append", "(", "\",\"", ")", ";", "}", "sb", ".", "append", "(", "ep", ".", "head", "(", ")", ")", ";", "val", "=", "ep", ".", "tail", "(", ")", ";", "}", "if", "(", "val", "!=", "ERT", ".", "NIL", ")", "{", "sb", ".", "append", "(", "'|'", ")", ";", "sb", ".", "append", "(", "val", ")", ";", "}", "sb", ".", "append", "(", "\"]\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}", "static", "Type", "EPAIR_TYPE", "=", "Type", ".", "getType", "(", "EPair", ".", "class", ")", ";", "static", "Type", "ETERM_TYPE", "=", "Type", ".", "getType", "(", "EObject", ".", "class", ")", ";", "static", "String", "CONSTRUCTOR_DESC", "=", "\"(\"", "+", "ETERM_TYPE", ".", "getDescriptor", "(", ")", "+", "ETERM_TYPE", ".", "getDescriptor", "(", ")", "+", "\")V\"", ";", "@", "Override", "public", "Type", "emit_const", "(", "MethodVisitor", "fa", ")", "{", "Type", "type", "=", "EPAIR_TYPE", ";", "fa", ".", "visitTypeInsn", "(", "Opcodes", ".", "NEW", ",", "type", ".", "getInternalName", "(", ")", ")", ";", "fa", ".", "visitInsn", "(", "Opcodes", ".", "DUP", ")", ";", "(", "(", "EObject", ")", "head", ")", ".", "emit_const", "(", "fa", ")", ";", "(", "(", "EObject", ")", "tail", ")", ".", "emit_const", "(", "fa", ")", ";", "fa", ".", "visitMethodInsn", "(", "Opcodes", ".", "INVOKESPECIAL", ",", "type", ".", "getInternalName", "(", ")", ",", "\"<init>\"", ",", "CONSTRUCTOR_DESC", ")", ";", "return", "type", ";", "}", "@", "Override", "public", "void", "encode", "(", "EOutputStream", "eos", ")", "{", "eos", ".", "write_list_head", "(", "1", ")", ";", "eos", ".", "write_any", "(", "head", ")", ";", "eos", ".", "write_any", "(", "tail", ")", ";", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "return", "31", "*", "head", ".", "hashCode", "(", ")", "+", "tail", ".", "hashCode", "(", ")", ";", "}", "}", "</s>" ]
7,830
[ "<s>", "package", "erjang", ";", "public", "class", "LocalFunID", "extends", "FunID", "{", "final", "int", "index", ";", "final", "int", "new_index", ";", "final", "int", "uniq", ";", "final", "EBinary", "new_uniq", ";", "public", "LocalFunID", "(", "EAtom", "module", ",", "EAtom", "function", ",", "int", "arity", ",", "int", "index", ",", "int", "new_index", ",", "int", "uniq", ",", "EBinary", "new_uniq", ")", "{", "super", "(", "module", ",", "function", ",", "arity", ")", ";", "this", ".", "index", "=", "index", ";", "this", ".", "new_index", "=", "new_index", ";", "this", ".", "uniq", "=", "uniq", ";", "this", ".", "new_uniq", "=", "new_uniq", ";", "}", "}", "</s>" ]
7,831
[ "<s>", "package", "erjang", ";", "import", "java", ".", "lang", ".", "annotation", ".", "ElementType", ";", "import", "java", ".", "lang", ".", "annotation", ".", "Retention", ";", "import", "java", ".", "lang", ".", "annotation", ".", "RetentionPolicy", ";", "import", "java", ".", "lang", ".", "annotation", ".", "Target", ";", "@", "Retention", "(", "RetentionPolicy", ".", "RUNTIME", ")", "@", "Target", "(", "ElementType", ".", "FIELD", ")", "public", "@", "interface", "Import", "{", "String", "module", "(", ")", ";", "String", "fun", "(", ")", ";", "int", "arity", "(", ")", ";", "}", "</s>" ]
7,832
[ "<s>", "package", "erjang", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Constructor", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Modifier", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "kilim", ".", "Pausable", ";", "import", "kilim", ".", "analysis", ".", "ClassInfo", ";", "import", "kilim", ".", "analysis", ".", "ClassWeaver", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "ClassWriter", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "FieldVisitor", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Label", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "MethodVisitor", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Opcodes", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "import", "erjang", ".", "beam", ".", "Compiler", ";", "import", "erjang", ".", "beam", ".", "CompilerVisitor", ";", "import", "erjang", ".", "beam", ".", "EUtil", ";", "import", "erjang", ".", "m", ".", "ets", ".", "EMatchContext", ";", "import", "erjang", ".", "m", ".", "ets", ".", "ETermPattern", ";", "public", "abstract", "class", "EFun", "extends", "EObject", "implements", "Opcodes", "{", "public", "abstract", "int", "arity", "(", ")", ";", "@", "BIF", "public", "EAtom", "is_function", "(", "EObject", "arity", ")", "{", "ESmall", "ary", ";", "if", "(", "(", "ary", "=", "arity", ".", "testSmall", "(", ")", ")", "!=", "null", ")", "{", "return", "ERT", ".", "box", "(", "arity", "(", ")", "==", "ary", ".", "value", ")", ";", "}", "throw", "ERT", ".", "badarg", "(", "this", ",", "arity", ")", ";", "}", "public", "EFun", "testFunction2", "(", "int", "nargs", ")", "{", "if", "(", "this", ".", "arity", "(", ")", "==", "nargs", ")", "return", "this", ";", "return", "null", ";", "}", "public", "EFun", "testFunction", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "int", "cmp_order", "(", ")", "{", "return", "CMP_ORDER_FUN", ";", "}", "@", "Override", "int", "compare_same", "(", "EObject", "rhs", ")", "{", "if", "(", "rhs", "==", "this", ")", "return", "0", ";", "return", "(", "System", ".", "identityHashCode", "(", "this", ")", "&", "0xffff", ")", "-", "(", "System", ".", "identityHashCode", "(", "rhs", ")", "&", "0xffff", ")", ";", "}", "public", "EObject", "go", "(", "EProc", "eproc", ")", "throws", "Pausable", "{", "return", "go2", "(", "eproc", ")", ";", "}", "public", "EObject", "go2", "(", "EProc", "eproc", ")", "{", "throw", "new", "java", ".", "lang", ".", "AbstractMethodError", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"#go2(EProc)\"", ")", ";", "}", "public", "abstract", "EObject", "invoke", "(", "EProc", "proc", ",", "EObject", "[", "]", "args", ")", "throws", "Pausable", ";", "public", "EObject", "invoke", "(", "EProc", "proc", ",", "EObject", "[", "]", "args", ",", "int", "off", ",", "int", "len", ")", "throws", "Pausable", "{", "EObject", "[", "]", "new_args", "=", "new", "EObject", "[", "len", "]", ";", "System", ".", "arraycopy", "(", "args", ",", "off", ",", "new_args", ",", "0", ",", "len", ")", ";", "return", "invoke", "(", "proc", ",", "new_args", ")", ";", "}", "public", "boolean", "match", "(", "ETermPattern", "matcher", ",", "EMatchContext", "r", ")", "{", "return", "matcher", ".", "match", "(", "this", ",", "r", ")", ";", "}", "private", "static", "final", "Type", "EFUN_TYPE", "=", "Type", ".", "getType", "(", "EFun", ".", "class", ")", ";", "private", "static", "final", "String", "EFUN_NAME", "=", "EFUN_TYPE", ".", "getInternalName", "(", ")", ";", "private", "static", "final", "Type", "EATOM_TYPE", "=", "Type", ".", "getType", "(", "EAtom", ".", "class", ")", ";", "private", "static", "final", "Type", "EFUNHANDLER_TYPE", "=", "Type", ".", "getType", "(", "EFunHandler", ".", "class", ")", ";", "private", "static", "final", "Type", "EOBJECT_TYPE", "=", "Type", ".", "getType", "(", "EObject", ".", "class", ")", ";", "private", "static", "final", "Type", "STRING_TYPE", "=", "Type", ".", "getType", "(", "String", ".", "class", ")", ";", "private", "static", "final", "Type", "EOBJECT_ARR_TYPE", "=", "Type", ".", "getType", "(", "EObject", "[", "]", ".", "class", ")", ";", "private", "static", "final", "Type", "EPROC_TYPE", "=", "Type", ".", "getType", "(", "EProc", ".", "class", ")", ";", "static", "final", "String", "GO_DESC", "=", "\"(\"", "+", "EPROC_TYPE", ".", "getDescriptor", "(", ")", "+", "\")\"", "+", "EOBJECT_TYPE", ".", "getDescriptor", "(", ")", ";", "private", "static", "final", "String", "EPROC_NAME", "=", "EPROC_TYPE", ".", "getInternalName", "(", ")", ";", "private", "static", "final", "String", "EOBJECT_DESC", "=", "EOBJECT_TYPE", ".", "getDescriptor", "(", ")", ";", "private", "static", "final", "String", "EATOM_DESC", "=", "EATOM_TYPE", ".", "getDescriptor", "(", ")", ";", "static", "final", "String", "[", "]", "PAUSABLE_EX", "=", "new", "String", "[", "]", "{", "Type", ".", "getType", "(", "Pausable", ".", "class", ")", ".", "getInternalName", "(", ")", "}", ";", "private", "static", "final", "HashMap", "<", "Method", ",", "EFun", ">", "method_fun_map", "=", "new", "HashMap", "<", "Method", ",", "EFun", ">", "(", ")", ";", "private", "static", "final", "String", "ERJANG_MODULES_DOT", "=", "\"erjang.m.\"", ";", "public", "static", "synchronized", "EFun", "make", "(", "Method", "method", ",", "String", "module", ")", "{", "EFun", "fun", "=", "method_fun_map", ".", "get", "(", "method", ")", ";", "if", "(", "fun", "==", "null", ")", "{", "method_fun_map", ".", "put", "(", "method", ",", "fun", "=", "do_make", "(", "method", ",", "module", ")", ")", ";", "}", "return", "fun", ";", "}", "private", "static", "EFun", "do_make", "(", "Method", "method", ",", "String", "module", ")", "{", "assert", "(", "Modifier", ".", "isStatic", "(", "method", ".", "getModifiers", "(", ")", ")", ")", ";", "assert", "(", "!", "Modifier", ".", "isPrivate", "(", "method", ".", "getModifiers", "(", ")", ")", ")", ";", "Class", "<", "?", ">", "[", "]", "parameterTypes", "=", "method", ".", "getParameterTypes", "(", ")", ";", "int", "ary", "=", "parameterTypes", ".", "length", ";", "boolean", "proc", "=", "(", "ary", ">", "0", "&&", "parameterTypes", "[", "0", "]", ".", "equals", "(", "EProc", ".", "class", ")", ")", ";", "if", "(", "proc", ")", "ary", "-=", "1", ";", "String", "fname", "=", "erlangNameOfMethod", "(", "method", ")", ";", "String", "mname", "=", "EUtil", ".", "getJavaName", "(", "EAtom", ".", "intern", "(", "fname", ")", ",", "ary", ")", ";", "Class", "<", "?", ">", "declaringClass", "=", "method", ".", "getDeclaringClass", "(", ")", ";", "Type", "type", "=", "Type", ".", "getType", "(", "declaringClass", ")", ";", "byte", "[", "]", "data", "=", "CompilerVisitor", ".", "make_invoker", "(", "module", ",", "fname", ",", "type", ",", "mname", ",", "method", ".", "getName", "(", ")", ",", "ary", ",", "proc", ",", "true", ",", "null", ",", "Type", ".", "getType", "(", "method", ".", "getReturnType", "(", ")", ")", ",", "true", ",", "true", ")", ";", "ClassLoader", "cl", "=", "declaringClass", ".", "getClassLoader", "(", ")", ";", "get_fun_class", "(", "ary", ")", ";", "data", "=", "weave", "(", "data", ")", ";", "String", "clname", "=", "type", ".", "getClassName", "(", ")", "+", "\"$FN_\"", "+", "mname", ";", "clname", "=", "clname", ".", "replace", "(", "'/'", ",", "'.'", ")", ";", "Class", "<", "?", "extends", "EFun", ">", "res_class", "=", "ERT", ".", "defineClass", "(", "cl", ",", "clname", ",", "data", ")", ";", "try", "{", "return", "res_class", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "Error", "(", "e", ")", ";", "}", "}", "private", "static", "String", "erlangNameOfMethod", "(", "Method", "method", ")", "{", "BIF", "bif_ann", "=", "method", ".", "getAnnotation", "(", "BIF", ".", "class", ")", ";", "if", "(", "bif_ann", "!=", "null", ")", "{", "String", "bif_name", "=", "bif_ann", ".", "name", "(", ")", ".", "equals", "(", "\"__SELFNAME__\"", ")", "?", "method", ".", "getName", "(", ")", ":", "bif_ann", ".", "name", "(", ")", ";", "if", "(", "bif_ann", ".", "type", "(", ")", "==", "BIF", ".", "Type", ".", "GUARD", ")", "return", "bif_name", "+", "\"\u0001\"", ";", "else", "return", "bif_name", ";", "}", "else", "{", "return", "method", ".", "getName", "(", ")", ";", "}", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "static", "Class", "<", "?", "extends", "EFun", ">", "get_fun_class", "(", "int", "arity", ")", "{", "try", "{", "String", "className", "=", "EFUN_TYPE", ".", "getClassName", "(", ")", "+", "arity", ";", "return", "(", "Class", "<", "?", "extends", "EFun", ">", ")", "Class", ".", "forName", "(", "className", ",", "true", ",", "EFun", ".", "class", ".", "getClassLoader", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "}", "byte", "[", "]", "data", "=", "gen_fun_class_data", "(", "arity", ")", ";", "data", "=", "weave", "(", "data", ")", ";", "String", "self_type", "=", "EFUN_TYPE", ".", "getInternalName", "(", ")", "+", "arity", ";", "self_type", "=", "self_type", ".", "replace", "(", "'/'", ",", "'.'", ")", ";", "return", "ERT", ".", "defineClass", "(", "EFun", ".", "class", ".", "getClassLoader", "(", ")", ",", "self_type", ",", "data", ")", ";", "}", "static", "byte", "[", "]", "gen_fun_class_data", "(", "int", "arity", ")", "{", "String", "self_type", "=", "EFUN_TYPE", ".", "getInternalName", "(", ")", "+", "arity", ";", "ClassWriter", "cw", "=", "new", "ClassWriter", "(", "true", ")", ";", "cw", ".", "visit", "(", "Opcodes", ".", "V1_5", ",", "Opcodes", ".", "ACC_PUBLIC", "|", "Opcodes", ".", "ACC_ABSTRACT", ",", "self_type", ",", "null", ",", "EFUN_TYPE", ".", "getInternalName", "(", ")", ",", "null", ")", ";", "make_invoke_method", "(", "cw", ",", "self_type", ",", "arity", ")", ";", "CompilerVisitor", ".", "make_invoketail_method", "(", "cw", ",", "self_type", ",", "arity", ",", "0", ")", ";", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "Opcodes", ".", "ACC_PUBLIC", ",", "\"arity\"", ",", "\"()I\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "arity", ")", ")", ";", "mv", ".", "visitInsn", "(", "Opcodes", ".", "IRETURN", ")", ";", "mv", ".", "visitMaxs", "(", "2", ",", "2", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "mv", "=", "cw", ".", "visitMethod", "(", "Opcodes", ".", "ACC_PUBLIC", ",", "\"invoke\"", ",", "\"(\"", "+", "EPROC_TYPE", ".", "getDescriptor", "(", ")", "+", "EOBJECT_ARR_TYPE", ".", "getDescriptor", "(", ")", "+", "\")\"", "+", "EOBJECT_TYPE", ".", "getDescriptor", "(", ")", ",", "null", ",", "PAUSABLE_EX", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "Opcodes", ".", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitVarInsn", "(", "Opcodes", ".", "ALOAD", ",", "1", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "Opcodes", ".", "ALOAD", ",", "2", ")", ";", "push_int", "(", "mv", ",", "i", ")", ";", "mv", ".", "visitInsn", "(", "Opcodes", ".", "AALOAD", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "Opcodes", ".", "INVOKEVIRTUAL", ",", "self_type", ",", "\"invoke\"", ",", "EUtil", ".", "getSignature", "(", "arity", ",", "true", ")", ")", ";", "mv", ".", "visitInsn", "(", "Opcodes", ".", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "arity", "+", "2", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "mv", "=", "cw", ".", "visitMethod", "(", "Opcodes", ".", "ACC_PROTECTED", ",", "\"<init>\"", ",", "\"()V\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitVarInsn", "(", "Opcodes", ".", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "Opcodes", ".", "INVOKESPECIAL", ",", "EFUN_TYPE", ".", "getInternalName", "(", ")", ",", "\"<init>\"", ",", "\"()V\"", ")", ";", "mv", ".", "visitInsn", "(", "Opcodes", ".", "RETURN", ")", ";", "mv", ".", "visitMaxs", "(", "1", ",", "1", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "make_cast_method", "(", "cw", ",", "arity", ")", ";", "cw", ".", "visitEnd", "(", ")", ";", "byte", "[", "]", "data", "=", "cw", ".", "toByteArray", "(", ")", ";", "return", "data", ";", "}", "static", "Map", "<", "String", ",", "Constructor", "<", "?", "extends", "EFun", ">", ">", "handlers", "=", "new", "HashMap", "<", "String", ",", "Constructor", "<", "?", "extends", "EFun", ">", ">", "(", ")", ";", "static", "final", "Pattern", "JAVA_ID", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "public", "static", "EFun", "get_fun_with_handler", "(", "String", "module", ",", "String", "function", ",", "int", "arity", ",", "EFunHandler", "handler", ",", "ClassLoader", "loader", ")", "{", "String", "signature", "=", "module", "+", "function", "+", "arity", ";", "Constructor", "<", "?", "extends", "EFun", ">", "h", "=", "handlers", ".", "get", "(", "signature", ")", ";", "if", "(", "h", "==", "null", ")", "{", "get_fun_class", "(", "arity", ")", ";", "String", "safe_function", "=", "JAVA_ID", ".", "matcher", "(", "function", ")", ".", "matches", "(", ")", "?", "function", ":", "make_valid_java_id", "(", "function", ")", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "String", "self_type", "=", "sb", ".", "append", "(", "EFUN_TYPE", ".", "getInternalName", "(", ")", ")", ".", "append", "(", "module", ")", ".", "append", "(", "safe_function", ")", ".", "append", "(", "\"Handler\"", ")", ".", "append", "(", "arity", ")", ".", "toString", "(", ")", ";", "ClassWriter", "cw", "=", "new", "ClassWriter", "(", "true", ")", ";", "String", "super_class_name", "=", "EFUN_TYPE", ".", "getInternalName", "(", ")", "+", "arity", ";", "cw", ".", "visit", "(", "Opcodes", ".", "V1_4", ",", "ACC_PUBLIC", ",", "self_type", ",", "null", ",", "super_class_name", ",", "null", ")", ";", "cw", ".", "visitField", "(", "ACC_PRIVATE", ",", "\"handler\"", ",", "EFUNHANDLER_TYPE", ".", "getDescriptor", "(", ")", ",", "null", ",", "null", ")", ".", "visitEnd", "(", ")", ";", "cw", ".", "visitField", "(", "ACC_PRIVATE", "|", "ACC_FINAL", ",", "\"module_name\"", ",", "EATOM_DESC", ",", "null", ",", "null", ")", ".", "visitEnd", "(", ")", ";", "cw", ".", "visitField", "(", "ACC_PRIVATE", "|", "ACC_FINAL", ",", "\"\"", ",", "EATOM_DESC", ",", "null", ",", "null", ")", ".", "visitEnd", "(", ")", ";", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"<init>\"", ",", "\"(\"", "+", "EFUNHANDLER_TYPE", ".", "getDescriptor", "(", ")", "+", "\")V\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "super_class_name", ",", "\"<init>\"", ",", "\"()V\"", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "self_type", ",", "\"handler\"", ",", "EFUNHANDLER_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitLdcInsn", "(", "module", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "EATOM_TYPE", ".", "getInternalName", "(", ")", ",", "\"intern\"", ",", "\"\"", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "self_type", ",", "\"module_name\"", ",", "EATOM_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitLdcInsn", "(", "function", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "EATOM_TYPE", ".", "getInternalName", "(", ")", ",", "\"intern\"", ",", "\"\"", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "self_type", ",", "\"\"", ",", "EATOM_DESC", ")", ";", "mv", ".", "visitInsn", "(", "RETURN", ")", ";", "mv", ".", "visitMaxs", "(", "3", ",", "3", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"toString\"", ",", "\"\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "self_type", ",", "\"handler\"", ",", "EFUNHANDLER_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "\"\"", ",", "\"toString\"", ",", "\"\"", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "3", ",", "3", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "make_invoke_method", "(", "cw", ",", "self_type", ",", "arity", ")", ";", "make_go_method", "(", "cw", ",", "self_type", ",", "arity", ")", ";", "make_encode_method", "(", "cw", ",", "self_type", ",", "arity", ")", ";", "cw", ".", "visitEnd", "(", ")", ";", "byte", "[", "]", "data", "=", "cw", ".", "toByteArray", "(", ")", ";", "data", "=", "weave", "(", "data", ")", ";", "Class", "<", "?", "extends", "EFun", ">", "clazz", "=", "ERT", ".", "defineClass", "(", "loader", ",", "self_type", ".", "replace", "(", "'/'", ",", "'.'", ")", ",", "data", ")", ";", "try", "{", "h", "=", "clazz", ".", "getConstructor", "(", "EFunHandler", ".", "class", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "Error", "(", "e", ")", ";", "}", "handlers", ".", "put", "(", "signature", ",", "h", ")", ";", "}", "try", "{", "return", "h", ".", "newInstance", "(", "handler", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "Error", "(", "e", ")", ";", "}", "}", "private", "static", "void", "make_cast_method", "(", "ClassWriter", "cw", ",", "int", "n", ")", "{", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "Opcodes", ".", "ACC_PUBLIC", "|", "Opcodes", ".", "ACC_STATIC", ",", "\"cast\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\")L\"", "+", "EFUN_NAME", "+", "n", "+", "\";\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "Opcodes", ".", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitTypeInsn", "(", "INSTANCEOF", ",", "EFUN_NAME", "+", "n", ")", ";", "Label", "fail", "=", "new", "Label", "(", ")", ";", "mv", ".", "visitJumpInsn", "(", "Opcodes", ".", "IFEQ", ",", "fail", ")", ";", "mv", ".", "visitVarInsn", "(", "Opcodes", ".", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitTypeInsn", "(", "Opcodes", ".", "CHECKCAST", ",", "EFUN_NAME", "+", "n", ")", ";", "mv", ".", "visitInsn", "(", "Opcodes", ".", "ARETURN", ")", ";", "mv", ".", "visitLabel", "(", "fail", ")", ";", "mv", ".", "visitInsn", "(", "Opcodes", ".", "ACONST_NULL", ")", ";", "mv", ".", "visitInsn", "(", "Opcodes", ".", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "2", ",", "2", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}", "private", "static", "void", "make_go_method", "(", "ClassWriter", "cw", ",", "String", "self_type", ",", "int", "arity", ")", "{", "MethodVisitor", "mv", ";", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"go\"", ",", "GO_DESC", ",", "null", ",", "PAUSABLE_EX", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "EPROC_NAME", ",", "\"arg\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "i", "+", "2", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitInsn", "(", "ACONST_NULL", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "EPROC_NAME", ",", "\"arg\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "}", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "self_type", ",", "\"handler\"", ",", "EFUNHANDLER_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "arity", ")", ")", ";", "mv", ".", "visitTypeInsn", "(", "ANEWARRAY", ",", "EOBJECT_TYPE", ".", "getInternalName", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", ";", "i", "++", ")", "{", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "i", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "i", "+", "2", ")", ";", "mv", ".", "visitInsn", "(", "AASTORE", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKEINTERFACE", ",", "EFUNHANDLER_TYPE", ".", "getInternalName", "(", ")", ",", "\"invoke\"", ",", "\"(\"", "+", "EPROC_TYPE", ".", "getDescriptor", "(", ")", "+", "\"[\"", "+", "EOBJECT_DESC", "+", "\")\"", "+", "EOBJECT_DESC", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "arity", "+", "2", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "cw", ".", "visitEnd", "(", ")", ";", "}", "private", "static", "void", "make_invoke_method", "(", "ClassWriter", "cw", ",", "String", "self_type", ",", "int", "arity", ")", "{", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"invoke\"", ",", "EUtil", ".", "getSignature", "(", "arity", ",", "true", ")", ",", "null", ",", "PAUSABLE_EX", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "i", "+", "2", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "self_type", ",", "\"invoke_tail\"", ",", "EUtil", ".", "getSignature", "(", "arity", ",", "true", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "arity", "+", "2", ")", ";", "Label", "done", "=", "new", "Label", "(", ")", ";", "Label", "loop", "=", "new", "Label", "(", ")", ";", "mv", ".", "visitLabel", "(", "loop", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "arity", "+", "2", ")", ";", "if", "(", "EProc", ".", "TAIL_MARKER", "==", "null", ")", "{", "mv", ".", "visitJumpInsn", "(", "IFNONNULL", ",", "done", ")", ";", "}", "else", "{", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "EPROC_TYPE", ".", "getInternalName", "(", ")", ",", "\"TAIL_MARKER\"", ",", "EOBJECT_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitJumpInsn", "(", "IF_ACMPNE", ",", "done", ")", ";", "}", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "EPROC_TYPE", ".", "getInternalName", "(", ")", ",", "\"tail\"", ",", "EFUN_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EFUN_TYPE", ".", "getInternalName", "(", ")", ",", "\"go\"", ",", "GO_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "loop", ")", ";", "mv", ".", "visitLabel", "(", "done", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "arity", "+", "2", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}", "static", "void", "make_encode_method", "(", "ClassWriter", "cw", ",", "String", "className", ",", "int", "arity", ")", "{", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"encode\"", ",", "\"(\"", "+", "Type", ".", "getDescriptor", "(", "EOutputStream", ".", "class", ")", "+", "\")V\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "className", ",", "\"module_name\"", ",", "EATOM_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "className", ",", "\"\"", ",", "EATOM_DESC", ")", ";", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "arity", ")", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "Type", ".", "getInternalName", "(", "EOutputStream", ".", "class", ")", ",", "\"\"", ",", "\"(\"", "+", "EATOM_DESC", "+", "EATOM_DESC", "+", "\"I)V\"", ")", ";", "mv", ".", "visitInsn", "(", "RETURN", ")", ";", "mv", ".", "visitMaxs", "(", "4", ",", "1", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}", "private", "static", "String", "make_valid_java_id", "(", "CharSequence", "seq", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "seq", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "ch", "=", "seq", ".", "charAt", "(", "i", ")", ";", "if", "(", "(", "ch", ">=", "'a'", "&&", "ch", "<=", "'z'", ")", "||", "(", "ch", ">=", "'A'", "&&", "ch", "<=", "'Z'", ")", "||", "(", "ch", ">=", "'0'", "&&", "ch", "<=", "'9'", ")", "||", "ch", "==", "'_'", "||", "ch", "==", "'$'", ")", "{", "sb", ".", "append", "(", "ch", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "'_'", ")", ".", "append", "(", "'x'", ")", ";", "if", "(", "ch", "<", "0x10", ")", "sb", ".", "append", "(", "'0'", ")", ";", "sb", ".", "append", "(", "Integer", ".", "toHexString", "(", "ch", ")", ".", "toUpperCase", "(", ")", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "static", "Class", "<", "?", "extends", "EFun", ">", "get_exported_fun_class", "(", "int", "arity", ")", "{", "String", "className", "=", "EFUN_TYPE", ".", "getClassName", "(", ")", "+", "arity", "+", "\"Exported\"", ";", "try", "{", "return", "(", "Class", "<", "?", "extends", "EFun", ">", ")", "Class", ".", "forName", "(", "className", ",", "true", ",", "EFun", ".", "class", ".", "getClassLoader", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "}", "byte", "[", "]", "data", "=", "get_exported_fun_class_data", "(", "arity", ")", ";", "data", "=", "weave", "(", "data", ")", ";", "return", "ERT", ".", "defineClass", "(", "EFun", ".", "class", ".", "getClassLoader", "(", ")", ",", "className", ",", "data", ")", ";", "}", "static", "byte", "[", "]", "get_exported_fun_class_data", "(", "int", "arity", ")", "{", "ensure", "(", "arity", ")", ";", "String", "super_type", "=", "EFUN_TYPE", ".", "getInternalName", "(", ")", "+", "arity", ";", "String", "self_type", "=", "super_type", "+", "\"Exported\"", ";", "ClassWriter", "cw", "=", "new", "ClassWriter", "(", "true", ")", ";", "cw", ".", "visit", "(", "Opcodes", ".", "V1_5", ",", "Opcodes", ".", "ACC_PUBLIC", "|", "Opcodes", ".", "ACC_ABSTRACT", ",", "self_type", ",", "null", ",", "super_type", ",", "null", ")", ";", "cw", ".", "visitField", "(", "ACC_PROTECTED", "|", "ACC_FINAL", ",", "\"module_name\"", ",", "EATOM_TYPE", ".", "getDescriptor", "(", ")", ",", "null", ",", "null", ")", ".", "visitEnd", "(", ")", ";", "cw", ".", "visitField", "(", "ACC_PROTECTED", "|", "ACC_FINAL", ",", "\"\"", ",", "EATOM_TYPE", ".", "getDescriptor", "(", ")", ",", "null", ",", "null", ")", ".", "visitEnd", "(", ")", ";", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "Opcodes", ".", "ACC_PROTECTED", ",", "\"<init>\"", ",", "\"\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitVarInsn", "(", "Opcodes", ".", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "Opcodes", ".", "INVOKESPECIAL", ",", "super_type", ",", "\"<init>\"", ",", "\"()V\"", ")", ";", "mv", ".", "visitVarInsn", "(", "Opcodes", ".", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitVarInsn", "(", "Opcodes", ".", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitMethodInsn", "(", "Opcodes", ".", "INVOKESTATIC", ",", "EATOM_TYPE", ".", "getInternalName", "(", ")", ",", "\"intern\"", ",", "\"\"", ")", ";", "mv", ".", "visitFieldInsn", "(", "Opcodes", ".", "PUTFIELD", ",", "self_type", ",", "\"module_name\"", ",", "EATOM_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "Opcodes", ".", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitVarInsn", "(", "Opcodes", ".", "ALOAD", ",", "2", ")", ";", "mv", ".", "visitMethodInsn", "(", "Opcodes", ".", "INVOKESTATIC", ",", "EATOM_TYPE", ".", "getInternalName", "(", ")", ",", "\"intern\"", ",", "\"\"", ")", ";", "mv", ".", "visitFieldInsn", "(", "Opcodes", ".", "PUTFIELD", ",", "self_type", ",", "\"\"", ",", "EATOM_DESC", ")", ";", "mv", ".", "visitInsn", "(", "Opcodes", ".", "RETURN", ")", ";", "mv", ".", "visitMaxs", "(", "3", ",", "3", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "make_encode_method_for_exported", "(", "cw", ",", "self_type", ",", "arity", ")", ";", "cw", ".", "visitEnd", "(", ")", ";", "byte", "[", "]", "data", "=", "cw", ".", "toByteArray", "(", ")", ";", "return", "data", ";", "}", "static", "void", "make_encode_method_for_exported", "(", "ClassWriter", "cw", ",", "String", "className", ",", "int", "arity", ")", "{", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"encode\"", ",", "\"(\"", "+", "Type", ".", "getDescriptor", "(", "EOutputStream", ".", "class", ")", "+", "\")V\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "className", ",", "\"module_name\"", ",", "EATOM_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "className", ",", "\"\"", ",", "EATOM_DESC", ")", ";", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "arity", ")", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "Type", ".", "getInternalName", "(", "EOutputStream", ".", "class", ")", ",", "\"\"", ",", "\"(\"", "+", "EATOM_DESC", "+", "EATOM_DESC", "+", "\"I)V\"", ")", ";", "mv", ".", "visitInsn", "(", "RETURN", ")", ";", "mv", ".", "visitMaxs", "(", "4", ",", "1", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}", "private", "static", "void", "push_int", "(", "MethodVisitor", "mv", ",", "int", "i", ")", "{", "if", "(", "i", ">=", "-", "1", "&&", "i", "<=", "5", ")", "{", "mv", ".", "visitInsn", "(", "Opcodes", ".", "ICONST_0", "+", "i", ")", ";", "}", "else", "{", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "i", ")", ")", ";", "}", "}", "public", "static", "byte", "[", "]", "weave", "(", "byte", "[", "]", "data", ")", "{", "ClassWeaver", "w", "=", "new", "ClassWeaver", "(", "data", ",", "new", "Compiler", ".", "ErjangDetector", "(", "\"/xx/\"", ",", "(", "Set", "<", "String", ">", ")", "Collections", ".", "EMPTY_SET", ")", ")", ";", "for", "(", "ClassInfo", "ci", ":", "w", ".", "getClassInfos", "(", ")", ")", "{", "if", "(", "!", "ci", ".", "className", ".", "startsWith", "(", "\"kilim\"", ")", ")", "data", "=", "ci", ".", "bytes", ";", "}", "return", "data", ";", "}", "public", "EObject", "apply", "(", "EProc", "proc", ",", "ESeq", "a", ")", "throws", "Pausable", "{", "return", "invoke", "(", "proc", ",", "a", ".", "toArray", "(", ")", ")", ";", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "10", ";", "i", "++", ")", "{", "get_fun_class", "(", "i", ")", ";", "get_exported_fun_class", "(", "i", ")", ";", "}", "}", "public", "static", "void", "ensure", "(", "int", "arity", ")", "{", "get_fun_class", "(", "arity", ")", ";", "}", "public", "static", "void", "ensure_exported", "(", "int", "arity", ")", "{", "get_exported_fun_class", "(", "arity", ")", ";", "}", "public", "static", "EFun", "read", "(", "EInputStream", "eis", ")", "throws", "IOException", "{", "return", "eis", ".", "read_fun", "(", ")", ";", "}", "public", "EObject", "info", "(", "EAtom", "spec", ")", "{", "FunID", "id", "=", "get_id", "(", ")", ";", "if", "(", "spec", "==", "ERT", ".", "am_arity", ")", "{", "return", "new", "ETuple2", "(", "spec", ",", "ERT", ".", "box", "(", "id", ".", "arity", "-", "get_env", "(", ")", ".", "length", "(", ")", ")", ")", ";", "}", "else", "if", "(", "spec", "==", "ERT", ".", "am_module", ")", "{", "return", "new", "ETuple2", "(", "spec", ",", "id", ".", "module", ")", ";", "}", "else", "if", "(", "spec", "==", "ERT", ".", "am_name", ")", "{", "return", "new", "ETuple2", "(", "spec", ",", "id", ".", "function", ")", ";", "}", "else", "if", "(", "spec", "==", "ERT", ".", "am_env", ")", "{", "return", "new", "ETuple2", "(", "spec", ",", "this", ".", "get_env", "(", ")", ")", ";", "}", "else", "if", "(", "spec", "==", "ERT", ".", "am_type", ")", "{", "return", "new", "ETuple2", "(", "ERT", ".", "am_type", ",", "(", "id", "instanceof", "LocalFunID", ")", "?", "ERT", ".", "am_local", ":", "ERT", ".", "am_external", ")", ";", "}", "if", "(", "id", "instanceof", "LocalFunID", ")", "{", "LocalFunID", "lid", "=", "(", "LocalFunID", ")", "id", ";", "if", "(", "spec", "==", "ERT", ".", "am_index", ")", "{", "return", "new", "ETuple2", "(", "spec", ",", "ERT", ".", "box", "(", "lid", ".", "index", ")", ")", ";", "}", "else", "if", "(", "spec", "==", "ERT", ".", "am_new_index", ")", "{", "return", "new", "ETuple2", "(", "spec", ",", "ERT", ".", "box", "(", "lid", ".", "new_index", ")", ")", ";", "}", "else", "if", "(", "spec", "==", "ERT", ".", "am_uniq", ")", "{", "return", "new", "ETuple2", "(", "spec", ",", "ERT", ".", "box", "(", "lid", ".", "uniq", ")", ")", ";", "}", "else", "if", "(", "spec", "==", "ERT", ".", "am_new_uniq", ")", "{", "return", "new", "ETuple2", "(", "spec", ",", "lid", ".", "new_uniq", ")", ";", "}", "else", "if", "(", "spec", "==", "ERT", ".", "am_pid", ")", "{", "return", "new", "ETuple2", "(", "spec", ",", "this", ".", "get_pid", "(", ")", ")", ";", "}", "}", "else", "{", "if", "(", "spec", "==", "ERT", ".", "am_type", ")", "{", "return", "new", "ETuple2", "(", "ERT", ".", "am_type", ",", "ERT", ".", "am_external", ")", ";", "}", "}", "return", "ERT", ".", "am_undefined", ";", "}", "public", "boolean", "is_local", "(", ")", "{", "return", "this", ".", "get_id", "(", ")", "instanceof", "LocalFunID", ";", "}", "protected", "EObject", "get_pid", "(", ")", "{", "return", "ERT", ".", "NIL", ";", "}", "protected", "ESeq", "get_env", "(", ")", "{", "return", "ERT", ".", "NIL", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "FunID", "id", "=", "get_id", "(", ")", ";", "if", "(", "id", "instanceof", "LocalFunID", ")", "{", "LocalFunID", "lid", "=", "(", "LocalFunID", ")", "id", ";", "return", "\"#Fun<\"", "+", "id", ".", "module", "+", "\".\"", "+", "lid", ".", "index", "+", "\".\"", "+", "lid", ".", "uniq", "+", "\">\"", ";", "}", "else", "{", "return", "\"#Fun<\"", "+", "id", ".", "module", "+", "\":\"", "+", "id", ".", "function", "+", "\"/\"", "+", "id", ".", "arity", "+", "\">\"", ";", "}", "}", "protected", "FunID", "get_id", "(", ")", "{", "String", "cname", "=", "getClass", "(", ")", ".", "getName", "(", ")", ";", "EAtom", "module", "=", "null", ";", "if", "(", "cname", ".", "startsWith", "(", "ERJANG_MODULES_DOT", ")", ")", "{", "int", "last", "=", "cname", ".", "lastIndexOf", "(", "'.'", ")", ";", "module", "=", "EAtom", ".", "intern", "(", "cname", ".", "substring", "(", "ERJANG_MODULES_DOT", ".", "length", "(", ")", ",", "last", ")", ")", ";", "}", "EAtom", "fun", "=", "null", ";", "int", "end", "=", "cname", ".", "lastIndexOf", "(", "\"__\"", ")", ";", "int", "start", "=", "cname", ".", "indexOf", "(", "\"$FN_\"", ")", ";", "if", "(", "start", "!=", "1", "&&", "end", "!=", "-", "1", ")", "{", "String", "method_name", "=", "cname", ".", "substring", "(", "start", "+", "4", ",", "end", ")", ";", "fun", "=", "EAtom", ".", "intern", "(", "EUtil", ".", "decodeJavaName", "(", "method_name", ")", ")", ";", "}", "return", "new", "FunID", "(", "module", ",", "fun", ",", "arity", "(", ")", ")", ";", "}", "}", "</s>" ]
7,833
[ "<s>", "package", "erjang", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileNotFoundException", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "erjang", ".", "beam", ".", "BeamFileData", ";", "import", "erjang", ".", "beam", ".", "BeamLoader", ";", "import", "erjang", ".", "beam", ".", "EUtil", ";", "import", "erjang", ".", "beam", ".", "loader", ".", "ErjangBeamDisLoader", ";", "import", "erjang", ".", "driver", ".", "efile", ".", "ClassPathResource", ";", "import", "erjang", ".", "util", ".", "Progress", ";", "class", "EModuleLoader", "{", "static", "final", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"\"", ")", ";", "final", "static", "BeamLoader", "beamParser", "=", "new", "ErjangBeamDisLoader", "(", ")", ";", "public", "static", "EModule", "find_and_load_module", "(", "String", "moduleName", ")", "throws", "IOException", "{", "File", "input", "=", "findBeamFile", "(", "moduleName", ")", ";", "if", "(", "input", "==", "null", ")", "throw", "new", "FileNotFoundException", "(", "moduleName", ")", ";", "return", "load_module", "(", "moduleName", ",", "input", ")", ";", "}", "public", "static", "EModule", "load_module", "(", "String", "moduleName", ",", "File", "beamFile", ")", "throws", "IOException", "{", "return", "load_module", "(", "moduleName", ",", "EUtil", ".", "readFile", "(", "beamFile", ")", ")", ";", "}", "static", "long", "acc_int_load", "=", "0", ";", "static", "long", "acc_load", "=", "0", ";", "public", "static", "EModule", "load_module", "(", "String", "moduleName", ",", "EBinary", "beamBin", ")", "throws", "IOException", "{", "boolean", "use_interpreter", "=", "ErjangConfig", ".", "getBoolean", "(", "\"\"", ")", ";", "long", "before", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "after", ";", "EModule", "loaded_module", ";", "Progress", ".", "activity", "(", "\"loading", "\"", "+", "moduleName", "+", "\"...\"", ")", ";", "if", "(", "use_interpreter", ")", "{", "BeamFileData", "bfd", "=", "beamParser", ".", "load", "(", "beamBin", ".", "toByteArray", "(", ")", ")", ";", "loaded_module", "=", "erjang", ".", "beam", ".", "interpreter", ".", "Interpreter", ".", "beamFileToEModule", "(", "bfd", ")", ";", "after", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "}", "else", "{", "EModuleClassLoader", "moduleClassLoader", "=", "ErjangCodeCache", ".", "getModuleClassLoader", "(", "moduleName", ",", "beamBin", ",", "beamParser", ")", ";", "after", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "loaded_module", "=", "load_compiled_module", "(", "moduleName", ",", "moduleClassLoader", ")", ";", "}", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "long", "after_load", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "use_interpreter", ")", "acc_int_load", "+=", "(", "after_load", "-", "after", ")", ";", "else", "acc_load", "+=", "(", "after_load", "-", "after", ")", ";", "log", ".", "fine", "(", "\"[\"", "+", "moduleName", "+", "\":\"", "+", "\"\"", "+", "(", "after", "-", "before", ")", "+", "\"ms\"", "+", "\";\"", "+", "(", "after_load", "-", "after", ")", "+", "\"ms]\"", "+", "\"(\"", "+", "acc_load", "+", "\")\"", ")", ";", "}", "Progress", ".", "done", "(", ")", ";", "return", "loaded_module", ";", "}", "private", "static", "File", "findBeamFile", "(", "String", "module", ")", "{", "String", "n", "=", "module", ";", "for", "(", "File", "e", ":", "loadPath", ")", "{", "File", "beam", "=", "new", "File", "(", "e", ",", "n", "+", "\".beam\"", ")", ";", "if", "(", "beam", ".", "exists", "(", ")", ")", "return", "beam", ";", "if", "(", "ClassPathResource", ".", "read_file", "(", "beam", ".", "getPath", "(", ")", ")", "!=", "null", ")", "return", "beam", ";", "}", "return", "null", ";", "}", "final", "static", "List", "<", "File", ">", "loadPath", "=", "new", "ArrayList", "<", "File", ">", "(", ")", ";", "static", "{", "String", "sys_path", "=", "System", ".", "getenv", "(", "\"ERJ_PATH\"", ")", ";", "if", "(", "sys_path", "!=", "null", ")", "addLoadPaths", "(", "loadPath", ",", "sys_path", ")", ";", "String", "path", "=", "ErjangConfig", ".", "getString", "(", "\"erjang.path\"", ",", "\".\"", ")", ";", "addLoadPaths", "(", "loadPath", ",", "path", ")", ";", "}", "private", "static", "void", "addLoadPaths", "(", "List", "<", "File", ">", "out", ",", "String", "path", ")", "{", "for", "(", "String", "s", ":", "path", ".", "split", "(", "File", ".", "pathSeparator", ")", ")", "{", "File", "elem", "=", "ERT", ".", "newFile", "(", "s", ")", ";", "if", "(", "elem", ".", "exists", "(", ")", "&&", "elem", ".", "isDirectory", "(", ")", ")", "{", "out", ".", "add", "(", "elem", ")", ";", "}", "}", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "EModule", "load_compiled_module", "(", "String", "mod", ",", "EModuleClassLoader", "loader", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "log", ".", "fine", "(", "\"\"", "+", "mod", "+", "\"", "@", "\"", "+", "loader", ")", ";", "}", "String", "internalName", "=", "erjang", ".", "beam", ".", "Compiler", ".", "moduleClassName", "(", "mod", ")", ";", "String", "java_name", "=", "internalName", ".", "replace", "(", "'/'", ",", "'.'", ")", ";", "Class", "<", "?", "extends", "EModule", ">", "clazz", ";", "try", "{", "clazz", "=", "(", "Class", "<", "?", "extends", "EModule", ">", ")", "loader", ".", "loadClass", "(", "java_name", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e1", ")", "{", "e1", ".", "printStackTrace", "(", ")", ";", "throw", "new", "ErlangError", "(", "e1", ")", ";", "}", "EModule", "mi", ";", "try", "{", "mi", "=", "clazz", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "throw", "new", "ErlangError", "(", "e", ")", ";", "}", "return", "mi", ";", "}", "}", "</s>" ]
7,834
[ "<s>", "package", "erjang", ";", "public", "interface", "ELocalHandle", "{", "}", "</s>" ]
7,835
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "abstract", "class", "BeamLoader", "{", "public", "abstract", "BeamFileData", "load", "(", "File", "file", ")", "throws", "IOException", ";", "public", "abstract", "BeamFileData", "load", "(", "byte", "[", "]", "data", ")", "throws", "IOException", ";", "}", "</s>" ]
7,836
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "ERLANG_ATOM", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "FALSE_ATOM", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "TRUE_ATOM", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "TreeMap", ";", "import", "java", ".", "util", ".", "TreeSet", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "kilim", ".", "Pausable", ";", "import", "kilim", ".", "analysis", ".", "ClassInfo", ";", "import", "kilim", ".", "analysis", ".", "ClassWeaver", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "AnnotationVisitor", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "ClassVisitor", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "ClassWriter", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "FieldVisitor", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Label", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "MethodVisitor", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Opcodes", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "commons", ".", "Method", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "IPersistentCollection", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EBinMatchState", ";", "import", "erjang", ".", "EBinary", ";", "import", "erjang", ".", "EBitString", ";", "import", "erjang", ".", "EBitStringBuilder", ";", "import", "erjang", ".", "ECons", ";", "import", "erjang", ".", "EDouble", ";", "import", "erjang", ".", "EFun", ";", "import", "erjang", ".", "EInteger", ";", "import", "erjang", ".", "EBig", ";", "import", "erjang", ".", "EInternalPID", ";", "import", "erjang", ".", "EList", ";", "import", "erjang", ".", "EModuleManager", ";", "import", "erjang", ".", "ENil", ";", "import", "erjang", ".", "ENumber", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EOutputStream", ";", "import", "erjang", ".", "EPID", ";", "import", "erjang", ".", "EPort", ";", "import", "erjang", ".", "EProc", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ERef", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "EString", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ETuple2", ";", "import", "erjang", ".", "ErlangException", ";", "import", "erjang", ".", "Export", ";", "import", "erjang", ".", "FunID", ";", "import", "erjang", ".", "Import", ";", "import", "erjang", ".", "LocalFunID", ";", "import", "erjang", ".", "Module", ";", "import", "erjang", ".", "beam", ".", "Arg", ".", "Kind", ";", "import", "erjang", ".", "beam", ".", "ModuleAnalyzer", ".", "FunInfo", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "ExtFun", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Insn", ";", "import", "erjang", ".", "m", ".", "erlang", ".", "ErlBif", ";", "public", "class", "CompilerVisitor", "implements", "ModuleVisitor", ",", "Opcodes", "{", "public", "static", "boolean", "PARANOIA_MODE", "=", "false", ";", "public", "static", "final", "int", "ATOM_SELECT_IF_ELSE_LIMIT", "=", "4", ";", "ECons", "atts", "=", "ERT", ".", "NIL", ";", "private", "Set", "<", "String", ">", "exported", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "private", "final", "ClassVisitor", "cv", ";", "private", "EAtom", "module_name", ";", "private", "Type", "self_type", ";", "private", "static", "final", "EObject", "ATOM_field_flags", "=", "EAtom", ".", "intern", "(", "\"field_flags\"", ")", ";", "private", "static", "final", "EObject", "ATOM_start", "=", "EAtom", ".", "intern", "(", "\"start\"", ")", ";", "static", "final", "String", "[", "]", "PAUSABLE_EX", "=", "new", "String", "[", "]", "{", "Type", ".", "getType", "(", "Pausable", ".", "class", ")", ".", "getInternalName", "(", ")", "}", ";", "static", "final", "Type", "EBINMATCHSTATE_TYPE", "=", "Type", ".", "getType", "(", "EBinMatchState", ".", "class", ")", ";", "static", "final", "Type", "EBINSTRINGBUILDER_TYPE", "=", "Type", ".", "getType", "(", "EBitStringBuilder", ".", "class", ")", ";", "static", "final", "Type", "ERLANG_EXCEPTION_TYPE", "=", "Type", ".", "getType", "(", "ErlangException", ".", "class", ")", ";", "static", "final", "Type", "ERT_TYPE", "=", "Type", ".", "getType", "(", "ERT", ".", "class", ")", ";", "static", "final", "Type", "EINTEGER_TYPE", "=", "Type", ".", "getType", "(", "EInteger", ".", "class", ")", ";", "static", "final", "Type", "ESTRING_TYPE", "=", "Type", ".", "getType", "(", "EString", ".", "class", ")", ";", "static", "final", "Type", "ECOMPILEDMODULE_TYPE", "=", "Type", ".", "getType", "(", "ECompiledModule", ".", "class", ")", ";", "static", "final", "String", "ECOMPILEDMODULE_NAME", "=", "ECOMPILEDMODULE_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "Type", "ENUMBER_TYPE", "=", "Type", ".", "getType", "(", "ENumber", ".", "class", ")", ";", "static", "final", "Type", "EOBJECT_TYPE", "=", "Type", ".", "getType", "(", "EObject", ".", "class", ")", ";", "static", "final", "String", "EOBJECT_DESC", "=", "EOBJECT_TYPE", ".", "getDescriptor", "(", ")", ";", "static", "final", "Type", "EPROC_TYPE", "=", "Type", ".", "getType", "(", "EProc", ".", "class", ")", ";", "static", "final", "String", "EPROC_NAME", "=", "EPROC_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "String", "EPROC_DESC", "=", "EPROC_TYPE", ".", "getDescriptor", "(", ")", ";", "static", "final", "Type", "ESMALL_TYPE", "=", "Type", ".", "getType", "(", "ESmall", ".", "class", ")", ";", "static", "final", "String", "ESMALL_NAME", "=", "ESMALL_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "Type", "EEXCEPTION_TYPE", "=", "Type", ".", "getType", "(", "ErlangException", ".", "class", ")", ";", "static", "final", "String", "EEXCEPTION_DESC", "=", "EEXCEPTION_TYPE", ".", "getDescriptor", "(", ")", ";", "static", "final", "String", "GO_DESC", "=", "\"(\"", "+", "EPROC_TYPE", ".", "getDescriptor", "(", ")", "+", "\")\"", "+", "EOBJECT_DESC", ";", "static", "final", "Type", "EDOUBLE_TYPE", "=", "Type", ".", "getType", "(", "EDouble", ".", "class", ")", ";", "static", "final", "Type", "EBIG_TYPE", "=", "Type", ".", "getType", "(", "EBig", ".", "class", ")", ";", "static", "final", "Type", "ENIL_TYPE", "=", "Type", ".", "getType", "(", "ENil", ".", "class", ")", ";", "static", "final", "Type", "EATOM_TYPE", "=", "Type", ".", "getType", "(", "EAtom", ".", "class", ")", ";", "static", "final", "Type", "ETUPLE_TYPE", "=", "Type", ".", "getType", "(", "ETuple", ".", "class", ")", ";", "static", "final", "Type", "EBINARY_TYPE", "=", "Type", ".", "getType", "(", "EBinary", ".", "class", ")", ";", "static", "final", "Type", "EBITSTRING_TYPE", "=", "Type", ".", "getType", "(", "EBitString", ".", "class", ")", ";", "static", "final", "Type", "EBITSTRINGBUILDER_TYPE", "=", "Type", ".", "getType", "(", "EBitStringBuilder", ".", "class", ")", ";", "static", "final", "Type", "ECONS_TYPE", "=", "Type", ".", "getType", "(", "ECons", ".", "class", ")", ";", "static", "final", "Type", "ESEQ_TYPE", "=", "Type", ".", "getType", "(", "ESeq", ".", "class", ")", ";", "static", "final", "Type", "ELIST_TYPE", "=", "Type", ".", "getType", "(", "EList", ".", "class", ")", ";", "static", "final", "Type", "EFUN_TYPE", "=", "Type", ".", "getType", "(", "EFun", ".", "class", ")", ";", "static", "final", "String", "EFUN_NAME", "=", "EFUN_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "String", "EOBJECT_NAME", "=", "EOBJECT_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "String", "ETUPLE_NAME", "=", "ETUPLE_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "String", "ERT_NAME", "=", "ERT_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "String", "EDOUBLE_NAME", "=", "EDOUBLE_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "String", "EBIG_NAME", "=", "EBIG_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "String", "EINTEGER_NAME", "=", "EINTEGER_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "String", "ENIL_NAME", "=", "ENIL_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "String", "ESEQ_NAME", "=", "ESEQ_TYPE", ".", "getInternalName", "(", ")", ";", "static", "final", "String", "ETUPLE_DESC", "=", "ETUPLE_TYPE", ".", "getDescriptor", "(", ")", ";", "static", "final", "String", "EATOM_DESC", "=", "EATOM_TYPE", ".", "getDescriptor", "(", ")", ";", "static", "final", "String", "ECONS_DESC", "=", "ECONS_TYPE", ".", "getDescriptor", "(", ")", ";", "static", "final", "String", "ESEQ_DESC", "=", "ESEQ_TYPE", ".", "getDescriptor", "(", ")", ";", "static", "final", "String", "EFUN_DESCRIPTOR", "=", "EFUN_TYPE", ".", "getDescriptor", "(", ")", ";", "static", "final", "Type", "EPID_TYPE", "=", "Type", ".", "getType", "(", "EPID", ".", "class", ")", ";", "static", "final", "Type", "EPORT_TYPE", "=", "Type", ".", "getType", "(", "EPort", ".", "class", ")", ";", "static", "final", "Type", "EMATCHSTATE_TYPE", "=", "Type", ".", "getType", "(", "EBinMatchState", ".", "class", ")", ";", "static", "final", "Type", "MODULE_ANN_TYPE", "=", "Type", ".", "getType", "(", "Module", ".", "class", ")", ";", "static", "final", "Type", "IMPORT_ANN_TYPE", "=", "Type", ".", "getType", "(", "Import", ".", "class", ")", ";", "static", "final", "Type", "EXPORT_ANN_TYPE", "=", "Type", ".", "getType", "(", "Export", ".", "class", ")", ";", "private", "final", "ClassRepo", "classRepo", ";", "public", "CompilerVisitor", "(", "ClassVisitor", "cv", ",", "ClassRepo", "classRepo", ")", "{", "this", ".", "cv", "=", "cv", ";", "this", ".", "classRepo", "=", "classRepo", ";", "}", "@", "Override", "public", "void", "visitModule", "(", "EAtom", "name", ")", "{", "this", ".", "module_name", "=", "name", ";", "this", ".", "self_type", "=", "Type", ".", "getType", "(", "\"L\"", "+", "getInternalClassName", "(", ")", "+", "\";\"", ")", ";", "cv", ".", "visit", "(", "V1_6", ",", "ACC_PUBLIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "null", ",", "ECOMPILEDMODULE_NAME", ",", "null", ")", ";", "add_module_annotation", "(", "cv", ")", ";", "cv", ".", "visitSource", "(", "name", ".", "getName", "(", ")", "+", "\".S\"", ",", "null", ")", ";", "}", "private", "void", "add_module_annotation", "(", "ClassVisitor", "cv", ")", "{", "AnnotationVisitor", "av", "=", "cv", ".", "visitAnnotation", "(", "MODULE_ANN_TYPE", ".", "getDescriptor", "(", ")", ",", "true", ")", ";", "av", ".", "visit", "(", "\"value\"", ",", "getModuleName", "(", ")", ")", ";", "av", ".", "visitEnd", "(", ")", ";", "}", "public", "String", "getInternalClassName", "(", ")", "{", "String", "moduleName", "=", "getModuleName", "(", ")", ";", "return", "Compiler", ".", "moduleClassName", "(", "moduleName", ")", ";", "}", "private", "String", "getModuleName", "(", ")", "{", "return", "module_name", ".", "getName", "(", ")", ";", "}", "Map", "<", "EObject", ",", "String", ">", "constants", "=", "new", "HashMap", "<", "EObject", ",", "String", ">", "(", ")", ";", "@", "Override", "public", "void", "visitAttribute", "(", "EAtom", "att", ",", "EObject", "value", ")", "{", "atts", "=", "atts", ".", "cons", "(", "ETuple2", ".", "make", "(", "att", ",", "value", ")", ")", ";", "}", "@", "Override", "public", "void", "visitEnd", "(", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "ExtFun", ">", "ent", ":", "imported", ".", "entrySet", "(", ")", ")", "{", "String", "field_name", "=", "ent", ".", "getKey", "(", ")", ";", "ExtFun", "f", "=", "ent", ".", "getValue", "(", ")", ";", "FieldVisitor", "fv", "=", "cv", ".", "visitField", "(", "ACC_STATIC", ",", "ent", ".", "getKey", "(", ")", ",", "\"L\"", "+", "EFUN_NAME", "+", "f", ".", "arity", "+", "\";\"", ",", "null", ",", "null", ")", ";", "EFun", ".", "ensure", "(", "f", ".", "arity", ")", ";", "AnnotationVisitor", "av", "=", "fv", ".", "visitAnnotation", "(", "IMPORT_ANN_TYPE", ".", "getDescriptor", "(", ")", ",", "true", ")", ";", "av", ".", "visit", "(", "\"module\"", ",", "f", ".", "mod", ".", "getName", "(", ")", ")", ";", "av", ".", "visit", "(", "\"fun\"", ",", "f", ".", "fun", ".", "getName", "(", ")", ")", ";", "av", ".", "visit", "(", "\"arity\"", ",", "f", ".", "arity", ")", ";", "av", ".", "visitEnd", "(", ")", ";", "fv", ".", "visitEnd", "(", ")", ";", "}", "generate_classinit", "(", ")", ";", "cv", ".", "visitEnd", "(", ")", ";", "}", "private", "void", "generate_classinit", "(", ")", "{", "MethodVisitor", "mv", "=", "cv", ".", "visitMethod", "(", "ACC_STATIC", "|", "ACC_PRIVATE", ",", "\"<clinit>\"", ",", "\"()V\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "ent", ":", "funs", ".", "entrySet", "(", ")", ")", "{", "String", "field", "=", "ent", ".", "getKey", "(", ")", ";", "String", "clazz", "=", "ent", ".", "getValue", "(", ")", ";", "mv", ".", "visitTypeInsn", "(", "NEW", ",", "clazz", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "clazz", ",", "\"<init>\"", ",", "\"()V\"", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTSTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "field", ",", "\"L\"", "+", "funt", ".", "get", "(", "field", ")", "+", "\";\"", ")", ";", "}", "for", "(", "Map", ".", "Entry", "<", "EObject", ",", "String", ">", "ent", ":", "constants", ".", "entrySet", "(", ")", ")", "{", "EObject", "term", "=", "ent", ".", "getKey", "(", ")", ";", "term", ".", "emit_const", "(", "mv", ")", ";", "mv", ".", "visitFieldInsn", "(", "Opcodes", ".", "PUTSTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "ent", ".", "getValue", "(", ")", ",", "Type", ".", "getType", "(", "term", ".", "getClass", "(", ")", ")", ".", "getDescriptor", "(", ")", ")", ";", "}", "cv", ".", "visitField", "(", "ACC_STATIC", "|", "ACC_PRIVATE", ",", "\"attributes\"", ",", "ESEQ_TYPE", ".", "getDescriptor", "(", ")", ",", "null", ",", "null", ")", ";", "atts", ".", "emit_const", "(", "mv", ")", ";", "mv", ".", "visitFieldInsn", "(", "Opcodes", ".", "PUTSTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "\"attributes\"", ",", "ESEQ_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "if", "(", "this", ".", "module_md5", "!=", "null", ")", "{", "cv", ".", "visitField", "(", "ACC_STATIC", ",", "\"module_md5\"", ",", "EBINARY_TYPE", ".", "getDescriptor", "(", ")", ",", "null", ",", "null", ")", ";", "module_md5", ".", "emit_const", "(", "mv", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTSTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "\"module_md5\"", ",", "EBINARY_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "}", "mv", ".", "visitInsn", "(", "RETURN", ")", ";", "mv", ".", "visitMaxs", "(", "200", ",", "10", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "mv", "=", "cv", ".", "visitMethod", "(", "ACC_PROTECTED", ",", "\"module_name\"", ",", "\"\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitLdcInsn", "(", "this", ".", "module_name", ".", "getName", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "1", ",", "1", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "mv", "=", "cv", ".", "visitMethod", "(", "ACC_PROTECTED", ",", "\"attributes\"", ",", "\"()\"", "+", "ESEQ_TYPE", ".", "getDescriptor", "(", ")", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitFieldInsn", "(", "Opcodes", ".", "GETSTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "\"attributes\"", ",", "ESEQ_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "1", ",", "1", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "mv", "=", "cv", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"<init>\"", ",", "\"()V\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "ECOMPILEDMODULE_NAME", ",", "\"<init>\"", ",", "\"()V\"", ")", ";", "mv", ".", "visitInsn", "(", "RETURN", ")", ";", "mv", ".", "visitMaxs", "(", "1", ",", "1", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "mv", "=", "cv", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"\"", ",", "\"()V\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "ECOMPILEDMODULE_NAME", ",", "\"\"", ",", "\"()V\"", ")", ";", "for", "(", "Lambda", "l", ":", "lambdas_xx", ".", "values", "(", ")", ")", "{", "mv", ".", "visitTypeInsn", "(", "NEW", ",", "Type", ".", "getInternalName", "(", "LocalFunID", ".", "class", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "module_name", ".", "emit_const", "(", "mv", ")", ";", "l", ".", "fun", ".", "emit_const", "(", "mv", ")", ";", "push_int", "(", "mv", ",", "l", ".", "arity", ")", ";", "push_int", "(", "mv", ",", "l", ".", "old_index", ")", ";", "push_int", "(", "mv", ",", "l", ".", "index", ")", ";", "push_int", "(", "mv", ",", "l", ".", "old_uniq", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "\"module_md5\"", ",", "EBINARY_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "Type", ".", "getInternalName", "(", "LocalFunID", ".", "class", ")", ",", "\"<init>\"", ",", "\"(\"", "+", "EATOM_DESC", "+", "EATOM_DESC", "+", "\"IIII\"", "+", "EBINARY_TYPE", ".", "getDescriptor", "(", ")", "+", "\")V\"", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "cv", ".", "visitField", "(", "ACC_STATIC", ",", "anon_fun_name", "(", "l", ")", ",", "Type", ".", "getDescriptor", "(", "LocalFunID", ".", "class", ")", ",", "null", ",", "null", ")", ".", "visitEnd", "(", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTSTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "anon_fun_name", "(", "l", ")", ",", "Type", ".", "getDescriptor", "(", "LocalFunID", ".", "class", ")", ")", ";", "String", "mname", "=", "EUtil", ".", "getJavaName", "(", "l", ".", "fun", ",", "l", ".", "arity", "-", "l", ".", "freevars", ")", ";", "String", "outer_name", "=", "self_type", ".", "getInternalName", "(", ")", ";", "String", "inner_name", "=", "\"FN_\"", "+", "mname", ";", "String", "full_inner_name", "=", "outer_name", "+", "\"$\"", "+", "inner_name", ";", "mv", ".", "visitLdcInsn", "(", "full_inner_name", ".", "replace", "(", "'/'", ",", "'.'", ")", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "Type", ".", "getInternalName", "(", "Class", ".", "class", ")", ",", "\"forName\"", ",", "\"\"", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "Type", ".", "getInternalName", "(", "EModuleManager", ".", "class", ")", ",", "\"\"", ",", "\"(\"", "+", "Type", ".", "getDescriptor", "(", "LocalFunID", ".", "class", ")", "+", "Type", ".", "getDescriptor", "(", "Class", ".", "class", ")", "+", "\")V\"", ")", ";", "}", "mv", ".", "visitInsn", "(", "RETURN", ")", ";", "mv", ".", "visitMaxs", "(", "1", ",", "1", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}", "public", "static", "String", "anon_fun_name", "(", "Lambda", "l", ")", "{", "return", "\"lambda_\"", "+", "l", ".", "index", "+", "\"_\"", "+", "l", ".", "old_index", "+", "\"_\"", "+", "l", ".", "old_uniq", ";", "}", "private", "void", "push_int", "(", "MethodVisitor", "mv", ",", "int", "val", ")", "{", "if", "(", "val", "==", "-", "1", ")", "{", "mv", ".", "visitInsn", "(", "ICONST_M1", ")", ";", "}", "else", "if", "(", "val", ">=", "0", "&&", "val", "<=", "5", ")", "{", "mv", ".", "visitInsn", "(", "ICONST_0", "+", "val", ")", ";", "}", "else", "{", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "val", ")", ")", ";", "}", "}", "@", "Override", "public", "void", "visitExport", "(", "EAtom", "name", ",", "int", "arity", ",", "int", "entry", ")", "{", "exported", ".", "add", "(", "EUtil", ".", "getJavaName", "(", "name", ",", "arity", ")", ")", ";", "}", "boolean", "isExported", "(", "EAtom", "name", ",", "int", "arity", ")", "{", "return", "exported", ".", "contains", "(", "EUtil", ".", "getJavaName", "(", "name", ",", "arity", ")", ")", ";", "}", "@", "Override", "public", "void", "declareFunction", "(", "EAtom", "fun", ",", "int", "arity", ",", "int", "label", ")", "{", "}", "@", "Override", "public", "FunctionVisitor", "visitFunction", "(", "EAtom", "name", ",", "int", "arity", ",", "int", "startLabel", ")", "{", "return", "new", "ASMFunctionAdapter", "(", "name", ",", "arity", ",", "startLabel", ")", ";", "}", "Map", "<", "FunID", ",", "Lambda", ">", "lambdas_xx", "=", "new", "TreeMap", "<", "FunID", ",", "Lambda", ">", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "funs", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "funt", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "Set", "<", "String", ">", "non_pausable_methods", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "public", "EBinary", "module_md5", ";", "private", "static", "final", "String", "SEQ_CONS_SIG", "=", "\"(\"", "+", "EOBJECT_DESC", "+", "\")\"", "+", "ESEQ_DESC", ";", "private", "static", "final", "String", "FUNC_INFO_SIG", "=", "\"(\"", "+", "EATOM_DESC", "+", "EATOM_DESC", "+", "ESEQ_DESC", "+", "\")\"", "+", "EOBJECT_DESC", ";", "private", "static", "final", "String", "ERT_CONS_SIG", "=", "\"(\"", "+", "EOBJECT_DESC", "+", "EOBJECT_DESC", "+", "\")\"", "+", "ECONS_TYPE", ".", "getDescriptor", "(", ")", ";", "private", "static", "final", "String", "TEST_FUN_SIG", "=", "\"(\"", "+", "EOBJECT_DESC", "+", "EFUN_DESCRIPTOR", "+", "\")V\"", ";", "class", "ASMFunctionAdapter", "implements", "FunctionVisitor2", "{", "private", "final", "EAtom", "fun_name", ";", "private", "final", "int", "arity", ";", "private", "final", "int", "startLabel", ";", "Map", "<", "Integer", ",", "Label", ">", "labels", "=", "new", "TreeMap", "<", "Integer", ",", "Label", ">", "(", ")", ";", "Map", "<", "Integer", ",", "Label", ">", "ex_handler_labels", "=", "new", "TreeMap", "<", "Integer", ",", "Label", ">", "(", ")", ";", "Set", "<", "Integer", ">", "label_inserted", "=", "new", "TreeSet", "<", "Integer", ">", "(", ")", ";", "List", "<", "EXHandler", ">", "ex_handlers", "=", "new", "ArrayList", "<", "EXHandler", ">", "(", ")", ";", "EXHandler", "activeExceptionHandler", ";", "BeamExceptionHandler", "active_beam_exh", ";", "private", "boolean", "isTailRecursive", ";", "private", "MethodVisitor", "mv", ";", "private", "int", "[", "]", "xregs", ";", "private", "int", "[", "]", "yregs", ";", "private", "int", "[", "]", "fpregs", ";", "private", "Label", "start", ";", "private", "Label", "end", ";", "private", "int", "scratch_reg", ";", "private", "int", "bit_string_builder", ";", "private", "int", "bit_string_matcher", ";", "private", "int", "bit_string_save", ";", "private", "FunInfo", "funInfo", ";", "Label", "getLabel", "(", "int", "i", ")", "{", "if", "(", "i", "<=", "0", ")", "throw", "new", "Error", "(", ")", ";", "Label", "l", "=", "labels", ".", "get", "(", "i", ")", ";", "if", "(", "l", "==", "null", ")", "{", "labels", ".", "put", "(", "i", ",", "l", "=", "new", "Label", "(", ")", ")", ";", "}", "return", "l", ";", "}", "Label", "getExceptionHandlerLabel", "(", "BeamExceptionHandler", "exh", ")", "{", "int", "i", "=", "exh", ".", "getHandlerLabel", "(", ")", ";", "Label", "l", "=", "ex_handler_labels", ".", "get", "(", "i", ")", ";", "if", "(", "l", "==", "null", ")", "{", "ex_handler_labels", ".", "put", "(", "i", ",", "l", "=", "new", "Label", "(", ")", ")", ";", "}", "return", "l", ";", "}", "public", "ASMFunctionAdapter", "(", "EAtom", "name", ",", "int", "arity", ",", "int", "startLabel", ")", "{", "this", ".", "fun_name", "=", "name", ";", "this", ".", "arity", "=", "arity", ";", "this", ".", "startLabel", "=", "startLabel", ";", "}", "@", "Override", "public", "void", "visitMaxs", "(", "Collection", "<", "Integer", ">", "x_regs", ",", "int", "y_count", ",", "int", "fp_count", ",", "boolean", "isTailRecursive", ")", "{", "FunID", "me", "=", "new", "FunID", "(", "module_name", ",", "fun_name", ",", "arity", ")", ";", "this", ".", "funInfo", "=", "funInfos", ".", "get", "(", "me", ")", ";", "this", ".", "isTailRecursive", "=", "isTailRecursive", ";", "Lambda", "lambda", "=", "get_lambda_freevars", "(", "fun_name", ",", "arity", ")", ";", "final", "int", "freevars", "=", "lambda", "==", "null", "?", "0", ":", "lambda", ".", "freevars", ";", "int", "real_arity", "=", "arity", "-", "freevars", ";", "String", "javaName", "=", "EUtil", ".", "getJavaName", "(", "fun_name", ",", "real_arity", ")", ";", "String", "signature", "=", "EUtil", ".", "getSignature", "(", "arity", ",", "true", ")", ";", "mv", "=", "cv", ".", "visitMethod", "(", "ACC_STATIC", "|", "ACC_PUBLIC", ",", "javaName", ",", "signature", ",", "null", ",", "funInfo", ".", "is_pausable", "?", "PAUSABLE_EX", ":", "null", ")", ";", "if", "(", "!", "funInfo", ".", "is_pausable", ")", "{", "non_pausable_methods", ".", "add", "(", "javaName", ")", ";", "}", "this", ".", "start", "=", "new", "Label", "(", ")", ";", "this", ".", "end", "=", "new", "Label", "(", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "allocate_regs_to_locals", "(", "x_regs", ",", "y_count", ",", "fp_count", ")", ";", "mv", ".", "visitLabel", "(", "start", ")", ";", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "getLabel", "(", "startLabel", ")", ")", ";", "}", "@", "Override", "public", "void", "visitEnd", "(", ")", "{", "adjust_exception_handlers", "(", "null", ",", "false", ")", ";", "mv", ".", "visitLabel", "(", "end", ")", ";", "for", "(", "EXHandler", "h", ":", "ex_handlers", ")", "{", "if", "(", "!", "label_inserted", ".", "contains", "(", "h", ".", "handler_beam_label", ")", ")", "throw", "new", "InternalError", "(", "\"\"", "+", "h", ".", "handler_beam_label", ")", ";", "mv", ".", "visitTryCatchBlock", "(", "h", ".", "begin", ",", "h", ".", "end", ",", "h", ".", "target", ",", "Type", ".", "getType", "(", "ErlangException", ".", "class", ")", ".", "getInternalName", "(", ")", ")", ";", "}", "mv", ".", "visitMaxs", "(", "20", ",", "scratch_reg", "+", "3", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "int", "arity_plus", "=", "arity", ";", "Lambda", "lambda", "=", "get_lambda_freevars", "(", "fun_name", ",", "arity_plus", ")", ";", "final", "int", "freevars", "=", "lambda", "==", "null", "?", "0", ":", "lambda", ".", "freevars", ";", "int", "real_arity", "=", "arity_plus", "-", "freevars", ";", "String", "mname", "=", "EUtil", ".", "getJavaName", "(", "fun_name", ",", "real_arity", ")", ";", "String", "outer_name", "=", "self_type", ".", "getInternalName", "(", ")", ";", "String", "inner_name", "=", "\"FN_\"", "+", "mname", ";", "String", "full_inner_name", "=", "outer_name", "+", "\"$\"", "+", "inner_name", ";", "boolean", "make_fun", "=", "false", ";", "boolean", "is_exported", "=", "isExported", "(", "fun_name", ",", "arity", ")", ";", "if", "(", "lambda", "!=", "null", ")", "{", "CompilerVisitor", ".", "this", ".", "module_md5", "=", "lambda", ".", "uniq", ";", "make_fun", "=", "true", ";", "}", "else", "{", "if", "(", "funInfo", ".", "is_called_locally_in_nontail_position", ")", "generate_invoke_call_self", "(", ")", ";", "if", "(", "funInfo", ".", "is_called_locally_in_tail_position", ")", "generate_tail_call_self", "(", "full_inner_name", ")", ";", "if", "(", "funInfo", ".", "mustHaveFun", "(", ")", ")", "{", "FieldVisitor", "fv", "=", "cv", ".", "visitField", "(", "ACC_STATIC", "|", "ACC_FINAL", ",", "mname", ",", "\"L\"", "+", "full_inner_name", "+", "\";\"", ",", "null", ",", "null", ")", ";", "EFun", ".", "ensure", "(", "arity", ")", ";", "if", "(", "is_exported", ")", "{", "if", "(", "ModuleAnalyzer", ".", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "ModuleAnalyzer", ".", "log", ".", "fine", "(", "\"export", "\"", "+", "module_name", "+", "\":\"", "+", "fun_name", "+", "\"/\"", "+", "arity", ")", ";", "AnnotationVisitor", "an", "=", "fv", ".", "visitAnnotation", "(", "EXPORT_ANN_TYPE", ".", "getDescriptor", "(", ")", ",", "true", ")", ";", "an", ".", "visit", "(", "\"module\"", ",", "module_name", ".", "getName", "(", ")", ")", ";", "an", ".", "visit", "(", "\"fun\"", ",", "fun_name", ".", "getName", "(", ")", ")", ";", "an", ".", "visit", "(", "\"arity\"", ",", "new", "Integer", "(", "arity", ")", ")", ";", "an", ".", "visitEnd", "(", ")", ";", "}", "fv", ".", "visitEnd", "(", ")", ";", "funs", ".", "put", "(", "mname", ",", "full_inner_name", ")", ";", "funt", ".", "put", "(", "mname", ",", "full_inner_name", ")", ";", "EFun", ".", "ensure", "(", "arity", ")", ";", "make_fun", "=", "true", ";", "}", "}", "if", "(", "make_fun", ")", "{", "cv", ".", "visitInnerClass", "(", "full_inner_name", ",", "outer_name", ",", "inner_name", ",", "ACC_STATIC", ")", ";", "byte", "[", "]", "data", "=", "CompilerVisitor", ".", "make_invoker", "(", "module_name", ".", "getName", "(", ")", ",", "fun_name", ".", "getName", "(", ")", ",", "self_type", ",", "mname", ",", "mname", ",", "arity", ",", "true", ",", "is_exported", ",", "lambda", ",", "EOBJECT_TYPE", ",", "funInfo", ".", "may_return_tail_marker", ",", "funInfo", ".", "is_pausable", "|", "funInfo", ".", "call_is_pausable", ")", ";", "ClassWeaver", "w", "=", "new", "ClassWeaver", "(", "data", ",", "new", "Compiler", ".", "ErjangDetector", "(", "self_type", ".", "getInternalName", "(", ")", ",", "non_pausable_methods", ")", ")", ";", "if", "(", "w", ".", "getClassInfos", "(", ")", ".", "size", "(", ")", "==", "0", ")", "{", "try", "{", "classRepo", ".", "store", "(", "full_inner_name", ",", "data", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "else", "{", "for", "(", "ClassInfo", "ci", ":", "w", ".", "getClassInfos", "(", ")", ")", "{", "try", "{", "classRepo", ".", "store", "(", "ci", ".", "className", ",", "ci", ".", "bytes", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "}", "}", "private", "void", "ensure_exception_handler_in_place", "(", ")", "{", "adjust_exception_handlers", "(", "active_beam_exh", ",", "false", ")", ";", "}", "private", "void", "adjust_exception_handlers", "(", "BeamExceptionHandler", "exh", ",", "boolean", "expectChange", ")", "{", "int", "desiredLabel", "=", "exh", "==", "null", "?", "-", "1", ":", "exh", ".", "getHandlerLabel", "(", ")", ";", "int", "actualLabel", "=", "activeExceptionHandler", "==", "null", "?", "-", "1", ":", "activeExceptionHandler", ".", "handler_beam_label", ";", "if", "(", "expectChange", ")", "assert", "(", "actualLabel", "!=", "desiredLabel", ")", ";", "if", "(", "actualLabel", "!=", "desiredLabel", ")", "{", "if", "(", "activeExceptionHandler", "!=", "null", ")", "{", "mv", ".", "visitLabel", "(", "activeExceptionHandler", ".", "end", ")", ";", "activeExceptionHandler", "=", "null", ";", "}", "if", "(", "exh", "!=", "null", ")", "{", "EXHandler", "h", "=", "new", "EXHandler", "(", ")", ";", "h", ".", "begin", "=", "new", "Label", "(", ")", ";", "h", ".", "end", "=", "new", "Label", "(", ")", ";", "h", ".", "target", "=", "getExceptionHandlerLabel", "(", "exh", ")", ";", "h", ".", "handler_beam_label", "=", "exh", ".", "getHandlerLabel", "(", ")", ";", "h", ".", "beam_exh", "=", "exh", ";", "ex_handlers", ".", "add", "(", "h", ")", ";", "mv", ".", "visitLabel", "(", "h", ".", "begin", ")", ";", "mv", ".", "visitInsn", "(", "NOP", ")", ";", "activeExceptionHandler", "=", "h", ";", "}", "}", "}", "private", "void", "generate_invoke_call_self", "(", ")", "{", "boolean", "pausable", "=", "funInfo", ".", "is_pausable", "||", "funInfo", ".", "call_is_pausable", ";", "String", "javaName", "=", "EUtil", ".", "getJavaName", "(", "fun_name", ",", "arity", ")", ";", "String", "signature", "=", "EUtil", ".", "getSignature", "(", "arity", ",", "true", ")", ";", "mv", "=", "cv", ".", "visitMethod", "(", "ACC_STATIC", ",", "javaName", "+", "\"$call\"", ",", "signature", ",", "null", ",", "pausable", "?", "PAUSABLE_EX", ":", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "if", "(", "!", "pausable", ")", "{", "non_pausable_methods", ".", "add", "(", "javaName", "+", "\"$call\"", ")", ";", "}", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "i", "+", "1", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "javaName", ",", "EUtil", ".", "getSignature", "(", "arity", ",", "true", ")", ")", ";", "if", "(", "funInfo", ".", "may_return_tail_marker", ")", "{", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "arity", "+", "1", ")", ";", "Label", "done", "=", "new", "Label", "(", ")", ";", "Label", "loop", "=", "new", "Label", "(", ")", ";", "mv", ".", "visitLabel", "(", "loop", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "arity", "+", "1", ")", ";", "if", "(", "EProc", ".", "TAIL_MARKER", "==", "null", ")", "{", "mv", ".", "visitJumpInsn", "(", "IFNONNULL", ",", "done", ")", ";", "}", "else", "{", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "EPROC_NAME", ",", "\"TAIL_MARKER\"", ",", "EOBJECT_DESC", ")", ";", "mv", ".", "visitJumpInsn", "(", "IF_ACMPNE", ",", "done", ")", ";", "}", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "EPROC_NAME", ",", "\"tail\"", ",", "EFUN_DESCRIPTOR", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EFUN_NAME", ",", "(", "pausable", "?", "\"go\"", ":", "\"go2\"", ")", ",", "GO_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "arity", "+", "1", ")", ";", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "loop", ")", ";", "mv", ".", "visitLabel", "(", "done", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "arity", "+", "1", ")", ";", "}", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "arity", "+", "2", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}", "private", "void", "generate_tail_call_self", "(", "String", "full_inner_name", ")", "{", "String", "javaName", "=", "EUtil", ".", "getJavaName", "(", "fun_name", ",", "arity", ")", ";", "String", "signature", "=", "EUtil", ".", "getSignature", "(", "arity", ",", "true", ")", ";", "mv", "=", "cv", ".", "visitMethod", "(", "ACC_STATIC", ",", "javaName", "+", "\"$tail\"", ",", "signature", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "i", "+", "1", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "EPROC_NAME", ",", "\"arg\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "}", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "javaName", ",", "\"L\"", "+", "full_inner_name", "+", "\";\"", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "EPROC_NAME", ",", "\"tail\"", ",", "EFUN_DESCRIPTOR", ")", ";", "if", "(", "EProc", ".", "TAIL_MARKER", "==", "null", ")", "{", "mv", ".", "visitInsn", "(", "ACONST_NULL", ")", ";", "}", "else", "{", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "EPROC_NAME", ",", "\"TAIL_MARKER\"", ",", "EOBJECT_DESC", ")", ";", "}", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "arity", "+", "2", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}", "private", "void", "allocate_regs_to_locals", "(", "Collection", "<", "Integer", ">", "xRegs", ",", "int", "yCount", ",", "int", "fpCount", ")", "{", "int", "max_y", "=", "yCount", ";", "int", "max_f", "=", "fpCount", ";", "int", "local", "=", "1", ";", "Integer", "[", "]", "xxregs", "=", "xRegs", ".", "toArray", "(", "new", "Integer", "[", "xRegs", ".", "size", "(", ")", "]", ")", ";", "if", "(", "xxregs", ".", "length", ">", "0", ")", "{", "Arrays", ".", "sort", "(", "xxregs", ")", ";", "Integer", "biggest_used", "=", "xxregs", "[", "xxregs", ".", "length", "-", "1", "]", ";", "xregs", "=", "new", "int", "[", "biggest_used", "+", "1", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "xxregs", ".", "length", ";", "i", "++", ")", "{", "xregs", "[", "xxregs", "[", "i", "]", "]", "=", "i", "+", "local", ";", "}", "local", "+=", "xxregs", ".", "length", ";", "}", "yregs", "=", "new", "int", "[", "max_y", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "max_y", ";", "i", "++", ")", "{", "yregs", "[", "i", "]", "=", "local", ";", "local", "+=", "1", ";", "}", "fpregs", "=", "new", "int", "[", "max_f", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "max_f", ";", "i", "++", ")", "{", "fpregs", "[", "i", "]", "=", "local", ";", "local", "+=", "2", ";", "}", "this", ".", "bit_string_builder", "=", "local", "++", ";", "this", ".", "bit_string_matcher", "=", "local", "++", ";", "this", ".", "bit_string_save", "=", "local", "++", ";", "this", ".", "scratch_reg", "=", "local", ";", "}", "@", "Override", "public", "BlockVisitor", "visitLabeledBlock", "(", "int", "label", ")", "{", "Label", "blockLabel", "=", "getLabel", "(", "label", ")", ";", "mv", ".", "visitLabel", "(", "blockLabel", ")", ";", "label_inserted", ".", "add", "(", "label", ")", ";", "mv", ".", "visitLineNumber", "(", "label", "&", "0x7fff", ",", "blockLabel", ")", ";", "return", "new", "ASMBlockVisitor", "(", "label", ")", ";", "}", "class", "ASMBlockVisitor", "implements", "BlockVisitor2", "{", "final", "int", "beam_label", ";", "public", "ASMBlockVisitor", "(", "int", "beam_label", ")", "{", "this", ".", "beam_label", "=", "beam_label", ";", "}", "@", "Override", "public", "void", "visitBegin", "(", "BeamExceptionHandler", "exh", ")", "{", "active_beam_exh", "=", "exh", ";", "if", "(", "exh", "==", "null", "||", "(", "exh", ".", "getHandlerLabel", "(", ")", "!=", "beam_label", ")", ")", "adjust_exception_handlers", "(", "exh", ",", "false", ")", ";", "}", "@", "Override", "public", "void", "visitBSAdd", "(", "Arg", "in1", ",", "Arg", "in2", ",", "int", "scale", ",", "Arg", "out", ")", "{", "push", "(", "in1", ",", "Type", ".", "INT_TYPE", ")", ";", "push_scaled", "(", "in2", ",", "scale", ")", ";", "mv", ".", "visitInsn", "(", "IADD", ")", ";", "pop", "(", "out", ",", "Type", ".", "INT_TYPE", ")", ";", "}", "@", "Override", "public", "void", "visitBS", "(", "BeamOpcode", "opcode", ",", "Arg", "arg", ",", "Arg", "imm", ")", "{", "switch", "(", "opcode", ")", "{", "case", "bs_save2", ":", "case", "bs_restore2", ":", "push", "(", "arg", ",", "EOBJECT_TYPE", ")", ";", "if", "(", "imm", ".", "value", "==", "ATOM_start", ")", "{", "String", "methName", "=", "(", "opcode", "==", "BeamOpcode", ".", "bs_restore2", ")", "?", "\"\"", ":", "\"\"", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "EBINMATCHSTATE_TYPE", ".", "getInternalName", "(", ")", ",", "methName", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\")V\"", ")", ";", "}", "else", "{", "push", "(", "imm", ",", "Type", ".", "INT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "EBINMATCHSTATE_TYPE", ".", "getInternalName", "(", ")", ",", "opcode", ".", "name", "(", ")", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\"I)V\"", ")", ";", "}", "return", ";", "case", "bs_context_to_binary", ":", "push", "(", "arg", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "EBINMATCHSTATE_TYPE", ".", "getInternalName", "(", ")", ",", "\"\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\")\"", "+", "EOBJECT_DESC", ")", ";", "pop", "(", "arg", ",", "EOBJECT_TYPE", ")", ";", "return", ";", "case", "bs_utf8_size", ":", "push", "(", "arg", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "EBINSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"bs_utf8_size\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\")\"", "+", "ESMALL_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "pop", "(", "imm", ",", "ESMALL_TYPE", ")", ";", "return", ";", "case", "bs_utf16_size", ":", "push", "(", "arg", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "EBINSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\")\"", "+", "ESMALL_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "pop", "(", "imm", ",", "ESMALL_TYPE", ")", ";", "return", ";", "}", "throw", "new", "Error", "(", "\"unhandled:", "\"", "+", "opcode", ")", ";", "}", "@", "Override", "public", "void", "visitInitWritable", "(", "Arg", "size", ",", "Arg", "out", ")", "{", "push", "(", "size", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\")\"", "+", "EBITSTRINGBUILDER_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "bit_string_builder", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"bitstring\"", ",", "\"()\"", "+", "EBITSTRING_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "pop", "(", "out", ",", "EBITSTRING_TYPE", ")", ";", "}", "@", "Override", "public", "void", "visitInitBitString", "(", "Arg", "size", ",", "int", "flags", ",", "Arg", "out", ",", "boolean", "unit_is_bits", ")", "{", "push", "(", "size", ",", "Type", ".", "INT_TYPE", ")", ";", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "flags", ")", ")", ";", "String", "methodName", "=", "unit_is_bits", "?", "\"bs_initBits\"", ":", "\"bs_init\"", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "methodName", ",", "\"(II)\"", "+", "EBITSTRINGBUILDER_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "bit_string_builder", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"bitstring\"", ",", "\"()\"", "+", "EBITSTRING_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "pop", "(", "out", ",", "EBITSTRING_TYPE", ")", ";", "return", ";", "}", "@", "Override", "public", "void", "visitBitStringAppend", "(", "BeamOpcode", "opcode", ",", "int", "label", ",", "Arg", "extra_size", ",", "Arg", "src", ",", "int", "unit", ",", "int", "flags", ",", "Arg", "dst", ")", "{", "push", "(", "src", ",", "EOBJECT_TYPE", ")", ";", "push", "(", "extra_size", ",", "Type", ".", "INT_TYPE", ")", ";", "push_int", "(", "unit", ")", ";", "push_int", "(", "flags", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "opcode", ".", "name", "(", ")", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\"III)\"", "+", "EBITSTRINGBUILDER_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "bit_string_builder", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"bitstring\"", ",", "\"()\"", "+", "EBITSTRING_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "pop", "(", "dst", ",", "EBITSTRING_TYPE", ")", ";", "return", ";", "}", "@", "Override", "public", "void", "visitBitStringPut", "(", "BeamOpcode", "opcode", ",", "Arg", "arg", ",", "Arg", "size", ",", "int", "unit", ",", "int", "flags", ")", "{", "switch", "(", "opcode", ")", "{", "case", "bs_put_string", ":", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "bit_string_builder", ")", ";", "push", "(", "arg", ",", "ESTRING_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"put_string\"", ",", "\"(\"", "+", "ESTRING_TYPE", ".", "getDescriptor", "(", ")", "+", "\")V\"", ")", ";", "return", ";", "case", "bs_put_integer", ":", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "bit_string_builder", ")", ";", "push", "(", "arg", ",", "EINTEGER_TYPE", ")", ";", "push_scaled", "(", "size", ",", "unit", ")", ";", "push_int", "(", "flags", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"put_integer\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\"II)V\"", ")", ";", "return", ";", "case", "bs_put_float", ":", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "bit_string_builder", ")", ";", "push", "(", "arg", ",", "EDOUBLE_TYPE", ")", ";", "push_scaled", "(", "size", ",", "unit", ")", ";", "push_int", "(", "flags", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"put_float\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\"II)V\"", ")", ";", "return", ";", "case", "bs_put_utf8", ":", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "bit_string_builder", ")", ";", "push", "(", "arg", ",", "EINTEGER_TYPE", ")", ";", "push_int", "(", "flags", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"put_utf8\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\"I)V\"", ")", ";", "return", ";", "case", "bs_put_utf16", ":", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "bit_string_builder", ")", ";", "push", "(", "arg", ",", "EINTEGER_TYPE", ")", ";", "push_int", "(", "flags", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"put_utf16\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\"I)V\"", ")", ";", "return", ";", "case", "bs_put_utf32", ":", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "bit_string_builder", ")", ";", "push", "(", "arg", ",", "EINTEGER_TYPE", ")", ";", "push_int", "(", "flags", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"put_utf32\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\"I)V\"", ")", ";", "return", ";", "case", "bs_put_binary", ":", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "bit_string_builder", ")", ";", "push", "(", "arg", ",", "EBITSTRING_TYPE", ")", ";", "if", "(", "size", ".", "kind", "==", "Kind", ".", "IMMEDIATE", "&&", "size", ".", "value", ".", "equals", "(", "EAtom", ".", "intern", "(", "\"all\"", ")", ")", ")", "push_int", "(", "-", "1", ")", ";", "else", "push_scaled", "(", "size", ",", "unit", ")", ";", "push_int", "(", "flags", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBITSTRINGBUILDER_TYPE", ".", "getInternalName", "(", ")", ",", "\"\"", ",", "\"(\"", "+", "EOBJECT_TYPE", ".", "getDescriptor", "(", ")", "+", "\"II)V\"", ")", ";", "return", ";", "}", "throw", "new", "Error", "(", "\"unhandled:", "\"", "+", "opcode", ")", ";", "}", "@", "Override", "public", "void", "visitBitStringTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "in", ",", "int", "intg", ",", "Arg", "dst", ")", "{", "switch", "(", "test", ")", "{", "case", "bs_start_match2", ":", "{", "push", "(", "in", ",", "EOBJECT_TYPE", ")", ";", "push_int", "(", "intg", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "EBINMATCHSTATE_TYPE", ".", "getInternalName", "(", ")", ",", "test", ".", "name", "(", ")", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\"I)\"", "+", "EMATCHSTATE_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "bit_string_matcher", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFNULL", ",", "getLabel", "(", "failLabel", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "bit_string_matcher", ")", ";", "pop", "(", "dst", ",", "EBINMATCHSTATE_TYPE", ")", ";", "return", ";", "}", "case", "bs_get_utf8", ":", "case", "bs_get_utf16", ":", "case", "bs_get_utf32", ":", "{", "push", "(", "in", ",", "EBINMATCHSTATE_TYPE", ")", ";", "push_int", "(", "intg", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBINMATCHSTATE_TYPE", ".", "getInternalName", "(", ")", ",", "test", ".", "name", "(", ")", ",", "\"(I)I\"", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ISTORE", ",", "scratch_reg", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFLT", ",", "getLabel", "(", "failLabel", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ILOAD", ",", "scratch_reg", ")", ";", "emit_box", "(", "Type", ".", "INT_TYPE", ",", "ESMALL_TYPE", ")", ";", "pop", "(", "dst", ",", "ESMALL_TYPE", ")", ";", "return", ";", "}", "default", ":", "throw", "new", "Error", "(", "\"\"", "+", "test", ")", ";", "}", "}", "@", "Override", "public", "void", "visitBitStringTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "in", ",", "EBitString", "bin", ")", "{", "switch", "(", "test", ")", "{", "case", "bs_match_string", ":", "{", "push", "(", "in", ",", "EBINMATCHSTATE_TYPE", ")", ";", "push_immediate", "(", "bin", ",", "EBITSTRING_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBINMATCHSTATE_TYPE", ".", "getInternalName", "(", ")", ",", "test", ".", "name", "(", ")", ",", "\"(\"", "+", "EBITSTRING_TYPE", ".", "getDescriptor", "(", ")", "+", "\")\"", "+", "EBITSTRING_TYPE", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFNULL", ",", "getLabel", "(", "failLabel", ")", ")", ";", "return", ";", "}", "default", ":", "throw", "new", "Error", "(", "\"\"", "+", "test", ")", ";", "}", "}", "@", "Override", "public", "void", "visitBitStringTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "in", ",", "Arg", "bits", ",", "int", "unit", ",", "int", "flags", ")", "{", "switch", "(", "test", ")", "{", "case", "bs_skip_bits2", ":", "{", "push", "(", "in", ",", "EBINMATCHSTATE_TYPE", ")", ";", "push", "(", "bits", ",", "EINTEGER_TYPE", ")", ";", "push_int", "(", "unit", ")", ";", "push_int", "(", "flags", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBINMATCHSTATE_TYPE", ".", "getInternalName", "(", ")", ",", "test", ".", "name", "(", ")", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\"II)\"", "+", "EOBJECT_DESC", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFNULL", ",", "getLabel", "(", "failLabel", ")", ")", ";", "return", ";", "}", "default", ":", "throw", "new", "Error", "(", "\"\"", "+", "test", ")", ";", "}", "}", "@", "Override", "public", "void", "visitBitStringTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "in", ",", "Arg", "bits", ",", "int", "unit", ",", "int", "flags", ",", "Arg", "dst", ")", "{", "switch", "(", "test", ")", "{", "case", "bs_get_binary2", ":", "{", "push", "(", "in", ",", "EBINMATCHSTATE_TYPE", ")", ";", "push", "(", "bits", ",", "EOBJECT_TYPE", ")", ";", "push_int", "(", "flags", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBINMATCHSTATE_TYPE", ".", "getInternalName", "(", ")", ",", "test", ".", "name", "(", ")", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\"I)\"", "+", "EBITSTRING_TYPE", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "scratch_reg", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFNULL", ",", "getLabel", "(", "failLabel", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "scratch_reg", ")", ";", "pop", "(", "dst", ",", "EBITSTRING_TYPE", ")", ";", "return", ";", "}", "case", "bs_get_integer2", ":", "{", "push", "(", "in", ",", "EBINMATCHSTATE_TYPE", ")", ";", "push", "(", "bits", ",", "Type", ".", "INT_TYPE", ")", ";", "push_int", "(", "unit", ")", ";", "push_int", "(", "flags", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBINMATCHSTATE_TYPE", ".", "getInternalName", "(", ")", ",", "test", ".", "name", "(", ")", ",", "\"(III)\"", "+", "EINTEGER_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "scratch_reg", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFNULL", ",", "getLabel", "(", "failLabel", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "scratch_reg", ")", ";", "pop", "(", "dst", ",", "EOBJECT_TYPE", ")", ";", "return", ";", "}", "case", "bs_get_float2", ":", "{", "push", "(", "in", ",", "EBINMATCHSTATE_TYPE", ")", ";", "push", "(", "bits", ",", "Type", ".", "INT_TYPE", ")", ";", "push_int", "(", "unit", ")", ";", "push_int", "(", "flags", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBINMATCHSTATE_TYPE", ".", "getInternalName", "(", ")", ",", "test", ".", "name", "(", ")", ",", "\"(III)\"", "+", "EDOUBLE_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "scratch_reg", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFNULL", ",", "getLabel", "(", "failLabel", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "scratch_reg", ")", ";", "pop", "(", "dst", ",", "EOBJECT_TYPE", ")", ";", "return", ";", "}", "default", ":", "throw", "new", "Error", "(", "\"\"", "+", "test", ")", ";", "}", "}", "@", "Override", "public", "void", "visitBitStringTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "in", ",", "int", "intg", ")", "{", "push", "(", "in", ",", "EBINMATCHSTATE_TYPE", ")", ";", "push_int", "(", "intg", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBINMATCHSTATE_TYPE", ".", "getInternalName", "(", ")", ",", "test", ".", "name", "(", ")", ",", "\"(I)Z\"", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFEQ", ",", "getLabel", "(", "failLabel", ")", ")", ";", "return", ";", "}", "@", "Override", "public", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "int", "failLabel", ",", "Arg", "[", "]", "in", ",", "Arg", "ex", ")", "{", "if", "(", "opcode", "==", "BeamOpcode", ".", "raise", ")", "{", "push", "(", "in", "[", "0", "]", ",", "EOBJECT_TYPE", ")", ";", "push", "(", "in", "[", "1", "]", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"raise\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "EOBJECT_DESC", "+", "\")\"", "+", "EOBJECT_DESC", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "return", ";", "}", "throw", "new", "Error", "(", "\"unhandled:", "\"", "+", "opcode", ")", ";", "}", "public", "void", "visitDecrement", "(", "Arg", "src", ",", "Arg", "out", ")", "{", "push", "(", "src", ",", "src", ".", "type", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EOBJECT_NAME", ",", "\"dec\"", ",", "\"()\"", "+", "ENUMBER_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "pop", "(", "out", ",", "EOBJECT_TYPE", ")", ";", "}", ";", "@", "Override", "public", "void", "visitIncrement", "(", "Arg", "src", ",", "Arg", "out", ")", "{", "push", "(", "src", ",", "src", ".", "type", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EOBJECT_NAME", ",", "\"inc\"", ",", "\"()\"", "+", "ENUMBER_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "pop", "(", "out", ",", "EOBJECT_TYPE", ")", ";", "return", ";", "}", "@", "Override", "public", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "int", "failLabel", ",", "Arg", "[", "]", "in", ",", "Arg", "out", ",", "BuiltInFunction", "bif", ")", "{", "ensure_exception_handler_in_place", "(", ")", ";", "switch", "(", "opcode", ")", "{", "case", "bif0", ":", "case", "bif1", ":", "case", "bif2", ":", "case", "gc_bif1", ":", "case", "gc_bif2", ":", "case", "fadd", ":", "case", "fsub", ":", "case", "fmul", ":", "case", "fdiv", ":", "Type", "[", "]", "parameterTypes", "=", "bif", ".", "getArgumentTypes", "(", ")", ";", "push", "(", "in", ",", "parameterTypes", ",", "bif", ".", "isVirtual", "(", ")", ")", ";", "mv", ".", "visitMethodInsn", "(", "bif", ".", "isVirtual", "(", ")", "?", "INVOKEVIRTUAL", ":", "INVOKESTATIC", ",", "bif", ".", "owner", ".", "getInternalName", "(", ")", ",", "bif", ".", "getName", "(", ")", ",", "bif", ".", "getDescriptor", "(", ")", ")", ";", "if", "(", "failLabel", "!=", "0", ")", "{", "if", "(", "out", "!=", "null", ")", "{", "pop", "(", "out", ",", "bif", ".", "getReturnType", "(", ")", ")", ";", "push", "(", "out", ",", "bif", ".", "getReturnType", "(", ")", ")", ";", "}", "if", "(", "bif", ".", "getReturnType", "(", ")", ".", "getSort", "(", ")", "==", "Type", ".", "BOOLEAN", ")", "{", "mv", ".", "visitJumpInsn", "(", "IFEQ", ",", "getLabel", "(", "failLabel", ")", ")", ";", "}", "else", "{", "if", "(", "bif", ".", "getReturnType", "(", ")", ".", "getSort", "(", ")", "!=", "Type", ".", "OBJECT", ")", "throw", "new", "Error", "(", "\"\"", "+", "bif", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFNULL", ",", "getLabel", "(", "failLabel", ")", ")", ";", "}", "}", "else", "{", "if", "(", "PARANOIA_MODE", "&&", "bif", ".", "getReturnType", "(", ")", ".", "getSort", "(", ")", "==", "Type", ".", "OBJECT", ")", "{", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitLdcInsn", "(", "bif", ".", "toString", "(", ")", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"\"", ",", "\"\"", ")", ";", "}", "pop", "(", "out", ",", "bif", ".", "getReturnType", "(", ")", ")", ";", "}", "return", ";", "}", "throw", "new", "Error", "(", ")", ";", "}", "public", "void", "visitUnreachablePoint", "(", ")", "{", "mv", ".", "visitLdcInsn", "(", "\"\"", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "\"\"", ",", "\"<init>\"", ",", "\"\"", ")", ";", "mv", ".", "visitInsn", "(", "ATHROW", ")", ";", "}", "public", "void", "visitCatchBlockStart", "(", "BeamOpcode", "opcode", ",", "int", "label", ",", "Arg", "out", ",", "BeamExceptionHandler", "exh", ")", "{", "switch", "(", "opcode", ")", "{", "case", "K_try", ":", "case", "K_catch", ":", "{", "active_beam_exh", "=", "exh", ";", "return", ";", "}", "}", "}", "public", "void", "visitCatchBlockEnd", "(", "BeamOpcode", "opcode", ",", "Arg", "out", ",", "BeamExceptionHandler", "exh", ")", "{", "active_beam_exh", "=", "exh", ".", "getParent", "(", ")", ";", "adjust_exception_handlers", "(", "active_beam_exh", ",", "false", ")", ";", "switch", "(", "opcode", ")", "{", "case", "try_end", ":", "{", "}", "break", ";", "case", "catch_end", ":", "{", "Label", "after", "=", "new", "Label", "(", ")", ";", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "after", ")", ";", "mv", ".", "visitLabel", "(", "getExceptionHandlerLabel", "(", "exh", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitInsn", "(", "SWAP", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "EPROC_NAME", ",", "\"\"", ",", "EEXCEPTION_DESC", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"\"", ",", "\"(\"", "+", "ERLANG_EXCEPTION_TYPE", ".", "getDescriptor", "(", ")", "+", "\")\"", "+", "EOBJECT_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "xregs", "[", "0", "]", ")", ";", "mv", ".", "visitLabel", "(", "after", ")", ";", "}", "break", ";", "case", "try_case", ":", "{", "mv", ".", "visitLabel", "(", "getExceptionHandlerLabel", "(", "exh", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitInsn", "(", "SWAP", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "EPROC_NAME", ",", "\"\"", ",", "EEXCEPTION_DESC", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"\"", ",", "\"(\"", "+", "ERLANG_EXCEPTION_TYPE", ".", "getDescriptor", "(", ")", "+", "\")\"", "+", "getTubleType", "(", "3", ")", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "ETUPLE_NAME", "+", "3", ",", "\"elem1\"", ",", "EOBJECT_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "xregs", "[", "0", "]", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "ETUPLE_NAME", "+", "3", ",", "\"elem2\"", ",", "EOBJECT_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "xregs", "[", "1", "]", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "ETUPLE_NAME", "+", "3", ",", "\"elem3\"", ",", "EOBJECT_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "xregs", "[", "2", "]", ")", ";", "}", "break", ";", "}", "}", "private", "int", "var_index", "(", "Arg", "out", ")", "{", "switch", "(", "out", ".", "kind", ")", "{", "case", "X", ":", "return", "xregs", "[", "out", ".", "no", "]", ";", "case", "Y", ":", "return", "yregs", "[", "out", ".", "no", "]", ";", "case", "F", ":", "return", "fpregs", "[", "out", ".", "no", "]", ";", "}", "throw", "new", "Error", "(", ")", ";", "}", "private", "void", "pop", "(", "Arg", "out", ",", "Type", "stack_type", ")", "{", "if", "(", "out", "==", "null", ")", "{", "if", "(", "stack_type", "!=", "null", "&&", "Type", ".", "DOUBLE_TYPE", ".", "equals", "(", "stack_type", ")", ")", "{", "mv", ".", "visitInsn", "(", "POP2", ")", ";", "}", "else", "{", "mv", ".", "visitInsn", "(", "POP", ")", ";", "}", "return", ";", "}", "if", "(", "stack_type", "==", "Type", ".", "DOUBLE_TYPE", "&&", "(", "out", ".", "kind", "==", "Kind", ".", "X", "||", "out", ".", "kind", "==", "Kind", ".", "Y", ")", ")", "{", "emit_convert", "(", "stack_type", ",", "stack_type", "==", "Type", ".", "DOUBLE_TYPE", "?", "EDOUBLE_TYPE", ":", "(", "stack_type", "==", "Type", ".", "INT_TYPE", "?", "EINTEGER_TYPE", ":", "EOBJECT_TYPE", ")", ")", ";", "}", "if", "(", "out", ".", "kind", "==", "Kind", ".", "X", "||", "out", ".", "kind", "==", "Kind", ".", "Y", ")", "{", "if", "(", "out", ".", "type", "==", "Type", ".", "INT_TYPE", "||", "out", ".", "type", "==", "Type", ".", "BOOLEAN_TYPE", "||", "(", "out", ".", "type", "==", "null", "&&", "stack_type", "==", "Type", ".", "INT_TYPE", ")", "||", "(", "out", ".", "type", "==", "null", "&&", "stack_type", "==", "Type", ".", "BOOLEAN_TYPE", ")", ")", "{", "mv", ".", "visitVarInsn", "(", "ISTORE", ",", "var_index", "(", "out", ")", ")", ";", "}", "else", "{", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "var_index", "(", "out", ")", ")", ";", "}", "}", "else", "if", "(", "out", ".", "kind", "==", "Kind", ".", "F", ")", "{", "if", "(", "!", "stack_type", ".", "equals", "(", "Type", ".", "DOUBLE_TYPE", ")", ")", "{", "emit_convert", "(", "stack_type", ",", "Type", ".", "DOUBLE_TYPE", ")", ";", "}", "mv", ".", "visitVarInsn", "(", "DSTORE", ",", "var_index", "(", "out", ")", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", ")", ";", "}", "}", "private", "void", "emit_convert", "(", "Type", "from_type", ",", "Type", "to_type", ")", "{", "if", "(", "from_type", ".", "equals", "(", "to_type", ")", ")", "return", ";", "if", "(", "from_type", ".", "getSort", "(", ")", "==", "Type", ".", "OBJECT", "&&", "to_type", ".", "getSort", "(", ")", "==", "Type", ".", "OBJECT", ")", "{", "return", ";", "}", "if", "(", "to_type", ".", "getSort", "(", ")", "==", "Type", ".", "OBJECT", ")", "{", "emit_box", "(", "from_type", ",", "to_type", ")", ";", "}", "else", "{", "emit_unbox", "(", "from_type", ",", "to_type", ")", ";", "}", "}", "private", "void", "emit_unbox", "(", "Type", "fromType", ",", "Type", "toType", ")", "{", "if", "(", "toType", ".", "equals", "(", "Type", ".", "INT_TYPE", ")", ")", "{", "if", "(", "fromType", ".", "equals", "(", "ESMALL_TYPE", ")", ")", "{", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "ESMALL_NAME", ",", "\"value\"", ",", "\"I\"", ")", ";", "return", ";", "}", "}", "if", "(", "toType", ".", "equals", "(", "Type", ".", "DOUBLE_TYPE", ")", ")", "{", "if", "(", "fromType", ".", "equals", "(", "EDOUBLE_TYPE", ")", ")", "{", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "EDOUBLE_NAME", ",", "\"value\"", ",", "\"D\"", ")", ";", "return", ";", "}", "}", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"unboxTo\"", "+", "primTypeName", "(", "toType", ")", ",", "\"(\"", "+", "fromType", ".", "getDescriptor", "(", ")", "+", "\")\"", "+", "toType", ".", "getDescriptor", "(", ")", ")", ";", "}", "private", "String", "primTypeName", "(", "Type", "typ", ")", "{", "switch", "(", "typ", ".", "getSort", "(", ")", ")", "{", "case", "Type", ".", "DOUBLE", ":", "return", "\"Double\"", ";", "case", "Type", ".", "INT", ":", "return", "\"Int\"", ";", "case", "Type", ".", "BOOLEAN", ":", "return", "\"Atom\"", ";", "default", ":", "throw", "new", "Error", "(", ")", ";", "}", "}", "private", "void", "emit_box", "(", "Type", "fromType", ",", "Type", "toType", ")", "{", "if", "(", "fromType", ".", "equals", "(", "Type", ".", "INT_TYPE", ")", "&&", "toType", ".", "getSort", "(", ")", "==", "Type", ".", "OBJECT", ")", "{", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"box\"", ",", "\"(I)\"", "+", "ESMALL_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "}", "else", "if", "(", "fromType", ".", "equals", "(", "Type", ".", "DOUBLE_TYPE", ")", "&&", "toType", ".", "getSort", "(", ")", "==", "Type", ".", "OBJECT", ")", "{", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"box\"", ",", "\"(D)\"", "+", "EDOUBLE_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "}", "else", "if", "(", "fromType", ".", "equals", "(", "Type", ".", "BOOLEAN_TYPE", ")", "&&", "toType", ".", "getSort", "(", ")", "==", "Type", ".", "OBJECT", ")", "{", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"box\"", ",", "\"(Z)\"", "+", "EATOM_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"cannot", "box", "\"", "+", "fromType", "+", "\"", "->", "\"", "+", "toType", ")", ";", "}", "}", "private", "void", "push", "(", "Arg", "[", "]", "in", ",", "Type", "[", "]", "parameterTypes", ",", "boolean", "isVirtual", ")", "{", "int", "off", "=", "0", ";", "if", "(", "isVirtual", ")", "{", "push", "(", "in", "[", "0", "]", ",", "EOBJECT_TYPE", ")", ";", "off", "=", "1", ";", "}", "if", "(", "in", ".", "length", "==", "parameterTypes", ".", "length", "-", "1", "&&", "EPROC_TYPE", ".", "equals", "(", "parameterTypes", "[", "0", "]", ")", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "in", ".", "length", "-", "off", ";", "i", "++", ")", "{", "Arg", "arg", "=", "in", "[", "i", "+", "off", "]", ";", "Type", "pt", "=", "parameterTypes", "[", "i", "]", ";", "push", "(", "arg", ",", "pt", ")", ";", "}", "}", "private", "void", "push_scaled", "(", "Arg", "value", ",", "int", "factor", ")", "{", "if", "(", "value", ".", "kind", "==", "Kind", ".", "IMMEDIATE", "&&", "value", ".", "value", "instanceof", "ESmall", ")", "{", "ESmall", "sm", "=", "(", "ESmall", ")", "value", ".", "value", ";", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "factor", "*", "sm", ".", "intValue", "(", ")", ")", ")", ";", "}", "else", "{", "push", "(", "value", ",", "Type", ".", "INT_TYPE", ")", ";", "push_int", "(", "factor", ")", ";", "mv", ".", "visitInsn", "(", "IMUL", ")", ";", "}", "}", "private", "void", "push", "(", "Arg", "value", ",", "Type", "stack_type", ")", "{", "Type", "t", "=", "value", ".", "type", ";", "if", "(", "value", ".", "kind", "==", "Kind", ".", "X", "||", "value", ".", "kind", "==", "Kind", ".", "Y", ")", "{", "if", "(", "value", ".", "type", "==", "Type", ".", "INT_TYPE", "||", "value", ".", "type", "==", "Type", ".", "BOOLEAN_TYPE", ")", "{", "mv", ".", "visitVarInsn", "(", "ILOAD", ",", "var_index", "(", "value", ")", ")", ";", "}", "else", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "var_index", "(", "value", ")", ")", ";", "}", "}", "else", "if", "(", "value", ".", "kind", "==", "Kind", ".", "F", ")", "{", "mv", ".", "visitVarInsn", "(", "DLOAD", ",", "var_index", "(", "value", ")", ")", ";", "}", "else", "if", "(", "value", ".", "kind", "==", "Kind", ".", "IMMEDIATE", ")", "{", "t", "=", "push_immediate", "(", "value", ".", "value", ",", "stack_type", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", ")", ";", "}", "if", "(", "t", "!=", "null", "&&", "!", "t", ".", "equals", "(", "stack_type", ")", ")", "{", "emit_convert", "(", "t", ",", "stack_type", ")", ";", "}", "}", "private", "Type", "push_immediate", "(", "EObject", "value", ",", "Type", "stack_type", ")", "{", "if", "(", "value", "==", "ERT", ".", "NIL", ")", "{", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "ERT_NAME", ",", "\"NIL\"", ",", "ENIL_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "return", "ENIL_TYPE", ";", "}", "if", "(", "value", "==", "ERT", ".", "TRUE", ")", "{", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "ERT_NAME", ",", "\"TRUE\"", ",", "EATOM_DESC", ")", ";", "return", "EATOM_TYPE", ";", "}", "if", "(", "value", "==", "ERT", ".", "FALSE", ")", "{", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "ERT_NAME", ",", "\"FALSE\"", ",", "EATOM_DESC", ")", ";", "return", "EATOM_TYPE", ";", "}", "if", "(", "stack_type", ".", "getSort", "(", ")", "!=", "Type", ".", "OBJECT", ")", "{", "if", "(", "value", "instanceof", "ESmall", ")", "{", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "value", ".", "asInt", "(", ")", ")", ")", ";", "return", "Type", ".", "INT_TYPE", ";", "}", "else", "if", "(", "value", "instanceof", "EBig", "&&", "stack_type", ".", "getSort", "(", ")", "==", "Type", ".", "DOUBLE", ")", "{", "push_immediate", "(", "value", ",", "EBIG_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EBIG_NAME", ",", "\"doubleValue\"", ",", "\"()D\"", ")", ";", "return", "Type", ".", "DOUBLE_TYPE", ";", "}", "else", "if", "(", "value", "instanceof", "EDouble", ")", "{", "mv", ".", "visitLdcInsn", "(", "new", "Double", "(", "(", "(", "EDouble", ")", "value", ")", ".", "value", ")", ")", ";", "return", "Type", ".", "DOUBLE_TYPE", ";", "}", "else", "if", "(", "value", "==", "TRUE_ATOM", ")", "{", "mv", ".", "visitInsn", "(", "ICONST_1", ")", ";", "return", "Type", ".", "BOOLEAN_TYPE", ";", "}", "else", "if", "(", "value", "==", "FALSE_ATOM", ")", "{", "mv", ".", "visitInsn", "(", "ICONST_0", ")", ";", "return", "Type", ".", "BOOLEAN_TYPE", ";", "}", "if", "(", "value", "instanceof", "ETuple2", ")", "{", "ETuple2", "t2", "=", "(", "ETuple2", ")", "value", ";", "if", "(", "t2", ".", "elm", "(", "1", ")", "==", "ATOM_field_flags", ")", "{", "push_int", "(", "t2", ".", "elem2", ".", "asInt", "(", ")", ")", ";", "return", "Type", ".", "INT_TYPE", ";", "}", "}", "throw", "new", "Error", "(", "\"\"", "+", "value", "+", "\"", "as", "\"", "+", "stack_type", ")", ";", "}", "String", "known", "=", "constants", ".", "get", "(", "value", ")", ";", "if", "(", "known", "==", "null", ")", "{", "Type", "type", "=", "Type", ".", "getType", "(", "value", ".", "getClass", "(", ")", ")", ";", "String", "cn", "=", "getConstantName", "(", "value", ",", "constants", ".", "size", "(", ")", ")", ";", "constants", ".", "put", "(", "value", ",", "known", "=", "cn", ")", ";", "cv", ".", "visitField", "(", "ACC_STATIC", ",", "known", ",", "type", ".", "getDescriptor", "(", ")", ",", "null", ",", "null", ")", ";", "}", "if", "(", "known", "!=", "null", ")", "{", "Type", "type", "=", "Type", ".", "getType", "(", "value", ".", "getClass", "(", ")", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "known", ",", "type", ".", "getDescriptor", "(", ")", ")", ";", "return", "type", ";", "}", "throw", "new", "Error", "(", "\"cannot", "push", "\"", "+", "value", "+", "\"", "as", "\"", "+", "stack_type", ")", ";", "}", "private", "String", "getConstantName", "(", "EObject", "value", ",", "int", "size", ")", "{", "if", "(", "value", "instanceof", "EAtom", ")", "return", "\"atom_\"", "+", "EUtil", ".", "toJavaIdentifier", "(", "(", "EAtom", ")", "value", ")", ";", "if", "(", "value", "instanceof", "ENumber", ")", "return", "EUtil", ".", "toJavaIdentifier", "(", "\"num_\"", "+", "value", ".", "toString", "(", ")", ".", "replace", "(", "'.'", ",", "'_'", ")", ".", "replace", "(", "'-'", ",", "'_'", ")", ")", ";", "if", "(", "value", "instanceof", "EString", ")", "return", "\"str_\"", "+", "size", ";", "else", "return", "\"cst_\"", "+", "size", ";", "}", "@", "Override", "public", "void", "visitReceive", "(", "BeamOpcode", "opcode", ",", "int", "blockLabel", ",", "Arg", "out", ")", "{", "switch", "(", "opcode", ")", "{", "case", "loop_rec", ":", "ensure_exception_handler_in_place", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"loop_rec\"", ",", "\"(\"", "+", "EPROC_TYPE", ".", "getDescriptor", "(", ")", "+", "\")\"", "+", "EOBJECT_DESC", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "pop", "(", "out", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFNULL", ",", "getLabel", "(", "blockLabel", ")", ")", ";", "return", ";", "}", "throw", "new", "Error", "(", ")", ";", "}", "@", "Override", "public", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "Arg", "[", "]", "in", ",", "Arg", "out", ")", "{", "switch", "(", "opcode", ")", "{", "case", "put_list", ":", "push", "(", "in", "[", "0", "]", ",", "EOBJECT_TYPE", ")", ";", "push", "(", "in", "[", "1", "]", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"cons\"", ",", "ERT_CONS_SIG", ")", ";", "pop", "(", "out", ",", "ECONS_TYPE", ")", ";", "return", ";", "case", "call_fun", ":", "case", "i_call_fun_last", ":", "{", "ensure_exception_handler_in_place", "(", ")", ";", "boolean", "is_tail", "=", "opcode", "==", "BeamOpcode", ".", "i_call_fun_last", ";", "int", "nargs", "=", "in", ".", "length", "-", "1", ";", "push", "(", "in", "[", "nargs", "]", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "String", "funtype", "=", "EFUN_NAME", "+", "nargs", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "funtype", ",", "\"cast\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\")L\"", "+", "funtype", "+", "\";\"", ")", ";", "mv", ".", "visitInsn", "(", "DUP_X1", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"test_fun\"", ",", "TEST_FUN_SIG", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nargs", ";", "i", "++", ")", "{", "push", "(", "in", "[", "i", "]", ",", "EOBJECT_TYPE", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "funtype", ",", "is_tail", "?", "\"invoke_tail\"", ":", "\"invoke\"", ",", "EUtil", ".", "getSignature", "(", "nargs", ",", "true", ")", ")", ";", "if", "(", "is_tail", ")", "{", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "}", "else", "{", "pop", "(", "out", ",", "EOBJECT_TYPE", ")", ";", "}", "return", ";", "}", "}", "throw", "new", "Error", "(", ")", ";", "}", "@", "Override", "public", "void", "visitInsn", "(", "BeamOpcode", "insn", ")", "{", "switch", "(", "insn", ")", "{", "case", "if_end", ":", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"if_end\"", ",", "EUtil", ".", "getSignature", "(", "0", ",", "false", ")", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "return", ";", "case", "timeout", ":", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"timeout\"", ",", "\"(\"", "+", "EPROC_DESC", "+", "\")V\"", ")", ";", "return", ";", "case", "remove_message", ":", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"\"", ",", "\"(\"", "+", "EPROC_TYPE", ".", "getDescriptor", "(", ")", "+", "\")V\"", ")", ";", "return", ";", "}", "throw", "new", "Error", "(", ")", ";", "}", "@", "Override", "public", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "int", "val", ",", "Arg", "out", ")", "{", "switch", "(", "opcode", ")", "{", "case", "put_tuple", ":", "mv", ".", "visitTypeInsn", "(", "NEW", ",", "out", ".", "type", ".", "getInternalName", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "out", ".", "type", ".", "getInternalName", "(", ")", ",", "\"<init>\"", ",", "\"()V\"", ")", ";", "pop", "(", "out", ",", "out", ".", "type", ")", ";", "return", ";", "case", "wait_timeout", ":", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "push", "(", "out", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"wait_timeout\"", ",", "\"(\"", "+", "EPROC_TYPE", ".", "getDescriptor", "(", ")", "+", "EOBJECT_TYPE", ".", "getDescriptor", "(", ")", "+", "\")Z\"", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFNE", ",", "getLabel", "(", "val", ")", ")", ";", "return", ";", "}", "case", "loop_rec_end", ":", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"loop_rec_end\"", ",", "\"(\"", "+", "EPROC_TYPE", ".", "getDescriptor", "(", ")", "+", "\")V\"", ")", ";", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "getLabel", "(", "val", ")", ")", ";", "return", ";", "case", "wait", ":", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"wait\"", ",", "\"(\"", "+", "EPROC_TYPE", ".", "getDescriptor", "(", ")", "+", "\")V\"", ")", ";", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "getLabel", "(", "val", ")", ")", ";", "return", ";", "}", "}", "throw", "new", "Error", "(", "\"unhandled:", "\"", "+", "opcode", ")", ";", "}", "@", "Override", "public", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "Arg", "val", ",", "Arg", "out", ",", "int", "pos", ")", "{", "if", "(", "opcode", "==", "BeamOpcode", ".", "put", ")", "{", "push", "(", "out", ",", "out", ".", "type", ")", ";", "push", "(", "val", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "out", ".", "type", ".", "getInternalName", "(", ")", ",", "\"elem\"", "+", "pos", ",", "EOBJECT_DESC", ")", ";", "return", ";", "}", "else", "if", "(", "opcode", "==", "BeamOpcode", ".", "get_tuple_element", ")", "{", "int", "known_arity", "=", "get_known_arity", "(", "val", ".", "type", ")", ";", "if", "(", "known_arity", ">=", "pos", "+", "1", ")", "{", "push", "(", "val", ",", "val", ".", "type", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "val", ".", "type", ".", "getInternalName", "(", ")", ",", "\"elem\"", "+", "(", "pos", "+", "1", ")", ",", "EOBJECT_DESC", ")", ";", "}", "else", "{", "push", "(", "val", ",", "val", ".", "type", ")", ";", "mv", ".", "visitTypeInsn", "(", "CHECKCAST", ",", "ETUPLE_NAME", ")", ";", "push_int", "(", "pos", "+", "1", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "ETUPLE_NAME", ",", "\"elm\"", ",", "\"(I)\"", "+", "EOBJECT_DESC", ")", ";", "}", "pop", "(", "out", ",", "EOBJECT_TYPE", ")", ";", "return", ";", "}", "else", "if", "(", "opcode", "==", "BeamOpcode", ".", "set_tuple_element", ")", "{", "push", "(", "out", ",", "out", ".", "type", ")", ";", "if", "(", "get_known_arity", "(", "out", ".", "type", ")", "<", "0", ")", "mv", ".", "visitTypeInsn", "(", "CHECKCAST", ",", "ETUPLE_NAME", ")", ";", "push_int", "(", "pos", "+", "1", ")", ";", "push", "(", "val", ",", "val", ".", "type", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "ETUPLE_NAME", ",", "\"set\"", ",", "\"(I\"", "+", "EOBJECT_DESC", "+", "\")V\"", ")", ";", "return", ";", "}", "throw", "new", "Error", "(", ")", ";", "}", "private", "int", "get_known_arity", "(", "Type", "type", ")", "{", "String", "in", "=", "type", ".", "getInternalName", "(", ")", ";", "if", "(", "in", ".", "startsWith", "(", "ETUPLE_NAME", ")", ")", "{", "int", "pfx_len", "=", "ETUPLE_NAME", ".", "length", "(", ")", ";", "if", "(", "in", ".", "length", "(", ")", "==", "pfx_len", ")", "{", "return", "0", ";", "}", "try", "{", "String", "arity", "=", "in", ".", "substring", "(", "pfx_len", ")", ";", "return", "Integer", ".", "parseInt", "(", "arity", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "0", ";", "}", "}", "return", "-", "1", ";", "}", "private", "void", "push_int", "(", "int", "pos", ")", "{", "if", "(", "pos", ">=", "-", "1", "&&", "pos", "<=", "5", ")", "{", "mv", ".", "visitInsn", "(", "ICONST_0", "+", "pos", ")", ";", "}", "else", "{", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "pos", ")", ")", ";", "}", "}", "@", "Override", "public", "void", "visitInsn", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "arg1", ",", "org", ".", "objectweb", ".", "asm", ".", "commons", ".", "Method", "bif", ")", "{", "throw", "new", "Error", "(", ")", ";", "}", "@", "Override", "public", "void", "visitEnd", "(", ")", "{", "}", "@", "Override", "public", "void", "visitInsn", "(", "Insn", "insn", ")", "{", "throw", "new", "Error", "(", ")", ";", "}", "@", "Override", "public", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "Arg", "arg", ")", "{", "switch", "(", "opcode", ")", "{", "case", "K_return", ":", "push", "(", "arg", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "return", ";", "case", "init", ":", "push_immediate", "(", "ERT", ".", "NIL", ",", "ENIL_TYPE", ")", ";", "pop", "(", "arg", ",", "ENIL_TYPE", ")", ";", "return", ";", "case", "try_case_end", ":", "push", "(", "arg", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"try_case_end\"", ",", "EUtil", ".", "getSignature", "(", "1", ",", "false", ")", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "return", ";", "case", "case_end", ":", "push", "(", "arg", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"case_end\"", ",", "EUtil", ".", "getSignature", "(", "1", ",", "false", ")", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "return", ";", "case", "badmatch", ":", "push", "(", "arg", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"badmatch\"", ",", "EUtil", ".", "getSignature", "(", "1", ",", "false", ")", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "return", ";", "}", "throw", "new", "Error", "(", "\"unhandled", "\"", "+", "opcode", ")", ";", "}", "public", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "ExtFun", "f", ")", "{", "switch", "(", "opcode", ")", "{", "case", "func_info", ":", "push_immediate", "(", "f", ".", "mod", ",", "EATOM_TYPE", ")", ";", "push_immediate", "(", "f", ".", "fun", ",", "EATOM_TYPE", ")", ";", "push_immediate", "(", "ERT", ".", "NIL", ",", "ENIL_TYPE", ")", ";", "for", "(", "int", "i", "=", "f", ".", "arity", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "push", "(", "new", "Arg", "(", "Kind", ".", "X", ",", "i", ")", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "ESEQ_NAME", ",", "\"cons\"", ",", "SEQ_CONS_SIG", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"func_info\"", ",", "FUNC_INFO_SIG", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "return", ";", "}", "throw", "new", "Error", "(", "\"unhandled", "\"", "+", "opcode", ")", ";", "}", "@", "Override", "public", "void", "visitTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "arg1", ",", "Type", "out", ")", "{", "Method", "test_bif", "=", "get_test_bif", "(", "test", ",", "arg1", ".", "type", ")", ";", "push", "(", "arg1", ",", "arg1", ".", "type", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EOBJECT_NAME", ",", "test_bif", ".", "getName", "(", ")", ",", "test_bif", ".", "getDescriptor", "(", ")", ")", ";", "Type", "returnType", "=", "test_bif", ".", "getReturnType", "(", ")", ";", "if", "(", "failLabel", "!=", "0", ")", "{", "if", "(", "returnType", ".", "getSort", "(", ")", "!=", "Type", ".", "OBJECT", ")", "throw", "new", "Error", "(", "\"\"", "+", "test_bif", ")", ";", "if", "(", "arg1", "!=", "null", ")", "{", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "scratch_reg", ")", ";", "}", "mv", ".", "visitJumpInsn", "(", "IFNULL", ",", "getLabel", "(", "failLabel", ")", ")", ";", "if", "(", "arg1", "!=", "null", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "scratch_reg", ")", ";", "pop", "(", "arg1", ",", "returnType", ")", ";", "}", "}", "else", "{", "pop", "(", "arg1", ",", "returnType", ")", ";", "}", "}", "@", "Override", "public", "void", "visitTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "arg", ",", "int", "arity", ",", "Type", "tupleType", ")", "{", "switch", "(", "test", ")", "{", "case", "test_arity", ":", "{", "Type", "tt", "=", "getTubleType", "(", "arity", ")", ";", "if", "(", "tt", ".", "equals", "(", "arg", ".", "type", ")", ")", "{", "}", "else", "{", "push", "(", "arg", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "tt", ".", "getInternalName", "(", ")", ",", "\"cast\"", ",", "\"(\"", "+", "arg", ".", "type", ".", "getDescriptor", "(", ")", "+", "\")\"", "+", "tt", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "scratch_reg", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFNULL", ",", "getLabel", "(", "failLabel", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "scratch_reg", ")", ";", "pop", "(", "arg", ",", "getTubleType", "(", "arity", ")", ")", ";", "}", "return", ";", "}", "}", "throw", "new", "Error", "(", "\"unhandled", "\"", "+", "test", ")", ";", "}", "@", "Override", "public", "void", "visitTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "arg", ",", "Arg", "arity", ",", "Type", "funType", ")", "{", "switch", "(", "test", ")", "{", "case", "is_function2", ":", "push", "(", "arg", ",", "EOBJECT_TYPE", ")", ";", "push", "(", "arity", ",", "Type", ".", "INT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EOBJECT_NAME", ",", "\"\"", ",", "\"(I)\"", "+", "EFUN_DESCRIPTOR", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "scratch_reg", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFNULL", ",", "getLabel", "(", "failLabel", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "scratch_reg", ")", ";", "pop", "(", "arg", ",", "funType", ")", ";", "return", ";", "}", "throw", "new", "Error", "(", "\"unhandled", "\"", "+", "test", ")", ";", "}", "@", "Override", "public", "void", "visitTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "[", "]", "args", ",", "Type", "outType", ")", "{", "switch", "(", "test", ")", "{", "case", "is_eq_exact", ":", "{", "if", "(", "args", "[", "0", "]", ".", "kind", "==", "Kind", ".", "IMMEDIATE", "&&", "args", "[", "0", "]", ".", "value", ".", "equalsExactly", "(", "ESmall", ".", "ZERO", ")", ")", "{", "push", "(", "args", "[", "1", "]", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EOBJECT_NAME", ",", "\"is_zero\"", ",", "\"()Z\"", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFEQ", ",", "getLabel", "(", "failLabel", ")", ")", ";", "return", ";", "}", "if", "(", "args", "[", "1", "]", ".", "kind", "==", "Kind", ".", "IMMEDIATE", "&&", "args", "[", "1", "]", ".", "value", ".", "equalsExactly", "(", "ESmall", ".", "ZERO", ")", ")", "{", "push", "(", "args", "[", "0", "]", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EOBJECT_NAME", ",", "\"is_zero\"", ",", "\"()Z\"", ")", ";", "mv", ".", "visitJumpInsn", "(", "IFEQ", ",", "getLabel", "(", "failLabel", ")", ")", ";", "return", ";", "}", "}", "case", "is_ne_exact", ":", "case", "is_ne", ":", "case", "is_eq", ":", "{", "if", "(", "args", "[", "0", "]", ".", "type", ".", "equals", "(", "EOBJECT_TYPE", ")", "&&", "!", "args", "[", "1", "]", ".", "type", ".", "equals", "(", "EOBJECT_TYPE", ")", ")", "{", "Arg", "t", "=", "args", "[", "0", "]", ";", "args", "[", "0", "]", "=", "args", "[", "1", "]", ";", "args", "[", "1", "]", "=", "t", ";", "}", "}", "case", "is_lt", ":", "case", "is_ge", ":", "{", "if", "(", "(", "test", "==", "BeamOpcode", ".", "is_eq_exact", "||", "test", "==", "BeamOpcode", ".", "is_eq", ")", "&&", "(", "args", "[", "0", "]", ".", "type", ".", "equals", "(", "EATOM_TYPE", ")", "||", "args", "[", "1", "]", ".", "type", ".", "equals", "(", "EATOM_TYPE", ")", ")", ")", "{", "push", "(", "args", "[", "0", "]", ",", "EOBJECT_TYPE", ")", ";", "push", "(", "args", "[", "1", "]", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitJumpInsn", "(", "IF_ACMPNE", ",", "getLabel", "(", "failLabel", ")", ")", ";", "return", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "push", "(", "args", "[", "i", "]", ",", "EOBJECT_TYPE", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EOBJECT_NAME", ",", "test", ".", "name", "(", ")", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\")Z\"", ")", ";", "if", "(", "failLabel", "!=", "0", ")", "{", "mv", ".", "visitJumpInsn", "(", "IFEQ", ",", "getLabel", "(", "failLabel", ")", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "if", "(", "test", "==", "BeamOpcode", ".", "is_eq_exact", "&&", "!", "Type", ".", "VOID_TYPE", ".", "equals", "(", "outType", ")", ")", "{", "if", "(", "args", "[", "0", "]", ".", "type", ".", "equals", "(", "EOBJECT_TYPE", ")", "&&", "args", "[", "0", "]", ".", "kind", ".", "isReg", "(", ")", ")", "{", "push", "(", "args", "[", "1", "]", ",", "outType", ")", ";", "args", "[", "0", "]", ".", "type", "=", "outType", ";", "pop", "(", "args", "[", "0", "]", ",", "outType", ")", ";", "}", "else", "if", "(", "args", "[", "1", "]", ".", "type", ".", "equals", "(", "EOBJECT_TYPE", ")", "&&", "args", "[", "1", "]", ".", "kind", ".", "isReg", "(", ")", ")", "{", "push", "(", "args", "[", "0", "]", ",", "outType", ")", ";", "args", "[", "1", "]", ".", "type", "=", "outType", ";", "pop", "(", "args", "[", "1", "]", ",", "outType", ")", ";", "}", "}", "return", ";", "}", "}", "throw", "new", "Error", "(", "\"unhandled", "\"", "+", "test", ")", ";", "}", "private", "String", "test2name", "(", "BeamOpcode", "test", ")", "{", "return", "test", ".", "name", "(", ")", ";", "}", "@", "Override", "public", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "Arg", "arg1", ",", "Arg", "arg2", ")", "{", "switch", "(", "opcode", ")", "{", "case", "fconv", ":", "case", "move", ":", "case", "fmove", ":", "if", "(", "arg1", ".", "kind", "==", "Kind", ".", "F", ")", "{", "push", "(", "arg1", ",", "Type", ".", "DOUBLE_TYPE", ")", ";", "if", "(", "arg2", ".", "kind", "==", "Kind", ".", "F", ")", "{", "pop", "(", "arg2", ",", "Type", ".", "DOUBLE_TYPE", ")", ";", "}", "else", "{", "emit_convert", "(", "Type", ".", "DOUBLE_TYPE", ",", "EDOUBLE_TYPE", ")", ";", "pop", "(", "arg2", ",", "EDOUBLE_TYPE", ")", ";", "}", "}", "else", "{", "if", "(", "arg2", ".", "kind", "==", "Kind", ".", "F", ")", "{", "push", "(", "arg1", ",", "Type", ".", "DOUBLE_TYPE", ")", ";", "pop", "(", "arg2", ",", "Type", ".", "DOUBLE_TYPE", ")", ";", "}", "else", "{", "push", "(", "arg1", ",", "arg1", ".", "type", ")", ";", "pop", "(", "arg2", ",", "arg1", ".", "type", ")", ";", "}", "}", "break", ";", "default", ":", "throw", "new", "Error", "(", "\"unhandled:", "\"", "+", "opcode", ")", ";", "}", "}", "private", "Method", "get_test_bif", "(", "BeamOpcode", "test", ",", "Type", "type", ")", "{", "if", "(", "!", "type", ".", "getInternalName", "(", ")", ".", "startsWith", "(", "\"erjang/E\"", ")", ")", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "switch", "(", "test", ")", "{", "case", "is_nonempty_list", ":", "return", "IS_NONEMPTY_LIST_TEST", ";", "case", "is_nil", ":", "return", "IS_NIL_TEST", ";", "case", "is_boolean", ":", "return", "IS_BOOLEAN_TEST", ";", "case", "is_number", ":", "return", "IS_NUMBER_TEST", ";", "case", "is_float", ":", "return", "IS_FLOAT_TEST", ";", "case", "is_atom", ":", "return", "IS_ATOM_TEST", ";", "case", "is_list", ":", "return", "IS_LIST_TEST", ";", "case", "is_tuple", ":", "return", "IS_TUPLE_TEST", ";", "case", "is_integer", ":", "return", "IS_INTEGER_TEST", ";", "case", "is_binary", ":", "return", "IS_BINARY_TEST", ";", "case", "is_bitstr", ":", "return", "IS_BITSTRING_TEST", ";", "case", "is_pid", ":", "return", "IS_PID_TEST", ";", "case", "is_port", ":", "return", "IS_PORT_TEST", ";", "case", "is_reference", ":", "return", "IS_REFERENCE_TEST", ";", "case", "is_function", ":", "return", "IS_FUNCTION_TEST", ";", "case", "is_function2", ":", "return", "IS_FUNCTION2_TEST", ";", "}", "throw", "new", "Error", "(", "\"unhandled", "\"", "+", "test", ")", ";", "}", "@", "Override", "public", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "Arg", "[", "]", "ys", ")", "{", "if", "(", "opcode", "==", "BeamOpcode", ".", "allocate_zero", "||", "opcode", "==", "BeamOpcode", ".", "allocate_heap_zero", ")", "{", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "ERT_NAME", ",", "\"NIL\"", ",", "ENIL_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ys", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", "!=", "(", "ys", ".", "length", "-", "1", ")", ")", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitInsn", "(", "NOP", ")", ";", "pop", "(", "ys", "[", "i", "]", ",", "ENIL_TYPE", ")", ";", "}", "return", ";", "}", "else", "if", "(", "opcode", "==", "BeamOpcode", ".", "get_list", ")", "{", "push", "(", "ys", "[", "0", "]", ",", "ECONS_TYPE", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "ECONS_TYPE", ".", "getInternalName", "(", ")", ",", "\"head\"", ",", "\"()\"", "+", "EOBJECT_DESC", ")", ";", "pop", "(", "ys", "[", "1", "]", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "ECONS_TYPE", ".", "getInternalName", "(", ")", ",", "\"tail\"", ",", "\"()\"", "+", "EOBJECT_DESC", ")", ";", "pop", "(", "ys", "[", "2", "]", ",", "EOBJECT_TYPE", ")", ";", "return", ";", "}", "ensure_exception_handler_in_place", "(", ")", ";", "if", "(", "opcode", "==", "BeamOpcode", ".", "apply", "||", "opcode", "==", "BeamOpcode", ".", "apply_last", ")", "{", "int", "arity", "=", "ys", ".", "length", "-", "2", ";", "push", "(", "ys", "[", "ys", ".", "length", "-", "2", "]", ",", "EOBJECT_TYPE", ")", ";", "push", "(", "ys", "[", "ys", ".", "length", "-", "1", "]", ",", "EOBJECT_TYPE", ")", ";", "push_int", "(", "arity", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"resolve_fun\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "EOBJECT_DESC", "+", "\"I)\"", "+", "EFUN_DESCRIPTOR", ")", ";", "String", "funtype", "=", "EFUN_NAME", "+", "arity", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "funtype", ",", "\"cast\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\")L\"", "+", "funtype", "+", "\";\"", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "int", "loops", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "ys", ".", "length", "-", "3", ";", "i", "++", ")", "{", "push", "(", "ys", "[", "i", "]", ",", "EOBJECT_TYPE", ")", ";", "loops", "+=", "1", ";", "}", "if", "(", "loops", "!=", "arity", ")", "{", "throw", "new", "InternalError", "(", "\"\"", ")", ";", "}", "boolean", "is_tail", "=", "opcode", "==", "BeamOpcode", ".", "apply_last", ";", "if", "(", "is_tail", ")", "{", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "funtype", ",", "\"invoke_tail\"", ",", "EUtil", ".", "getSignature", "(", "arity", ",", "true", ")", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "}", "else", "{", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "funtype", ",", "\"invoke\"", ",", "EUtil", ".", "getSignature", "(", "arity", ",", "true", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "xregs", "[", "0", "]", ")", ";", "}", "return", ";", "}", "else", "if", "(", "opcode", "==", "BeamOpcode", ".", "send", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ys", ".", "length", ";", "i", "++", ")", "{", "push", "(", "ys", "[", "i", "]", ",", "EOBJECT_TYPE", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"send\"", ",", "EUtil", ".", "getSignature", "(", "ys", ".", "length", ",", "true", ")", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "xregs", "[", "0", "]", ")", ";", "return", ";", "}", "throw", "new", "Error", "(", "\"unhandled:\"", "+", "opcode", ")", ";", "}", "@", "Override", "public", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "ExtFun", "efun", ",", "Arg", "[", "]", "freevars", ",", "int", "index", ",", "int", "old_index", ",", "EBinary", "uniq", ",", "int", "old_uniq", ")", "{", "ensure_exception_handler_in_place", "(", ")", ";", "if", "(", "opcode", "==", "BeamOpcode", ".", "make_fun2", ")", "{", "CompilerVisitor", ".", "this", ".", "register_lambda", "(", "efun", ".", "fun", ",", "efun", ".", "arity", ",", "freevars", ".", "length", ",", "index", ",", "old_index", ",", "uniq", ",", "old_uniq", ")", ";", "String", "inner", "=", "EUtil", ".", "getFunClassName", "(", "self_type", ",", "efun", ",", "freevars", ".", "length", ")", ";", "mv", ".", "visitTypeInsn", "(", "NEW", ",", "inner", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EPROC_NAME", ",", "\"self_handle\"", ",", "\"()\"", "+", "Type", ".", "getDescriptor", "(", "EInternalPID", ".", "class", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "freevars", ".", "length", ";", "i", "++", ")", "{", "push", "(", "freevars", "[", "i", "]", ",", "EOBJECT_TYPE", ")", ";", "}", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"(\"", ")", ";", "sb", ".", "append", "(", "EPID_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "freevars", ".", "length", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "EOBJECT_DESC", ")", ";", "}", "sb", ".", "append", "(", "\")V\"", ")", ";", "String", "gen_fun_desc", "=", "sb", ".", "toString", "(", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "inner", ",", "\"<init>\"", ",", "gen_fun_desc", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "xregs", "[", "0", "]", ")", ";", "return", ";", "}", "throw", "new", "Error", "(", ")", ";", "}", "@", "Override", "public", "void", "visitSelectValue", "(", "Arg", "in", ",", "int", "failLabel", ",", "Arg", "[", "]", "values", ",", "int", "[", "]", "targets", ")", "{", "boolean", "all_small_ints", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "(", "values", "[", "i", "]", ".", "value", "instanceof", "ESmall", ")", ")", "{", "all_small_ints", "=", "false", ";", "break", ";", "}", "}", "if", "(", "all_small_ints", ")", "{", "int", "[", "]", "ivals", "=", "new", "int", "[", "values", ".", "length", "]", ";", "Label", "[", "]", "label", "=", "new", "Label", "[", "values", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{", "ivals", "[", "i", "]", "=", "values", "[", "i", "]", ".", "value", ".", "asInt", "(", ")", ";", "label", "[", "i", "]", "=", "getLabel", "(", "targets", "[", "i", "]", ")", ";", "}", "push", "(", "in", ",", "Type", ".", "INT_TYPE", ")", ";", "sort", "(", "ivals", ",", "label", ")", ";", "mv", ".", "visitLookupSwitchInsn", "(", "getLabel", "(", "failLabel", ")", ",", "ivals", ",", "label", ")", ";", "return", ";", "}", "if", "(", "values", ".", "length", "<", "ATOM_SELECT_IF_ELSE_LIMIT", ")", "{", "boolean", "all_atoms", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "(", "values", "[", "i", "]", ".", "value", "instanceof", "EAtom", ")", ")", "{", "all_atoms", "=", "false", ";", "break", ";", "}", "}", "if", "(", "all_atoms", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{", "push", "(", "in", ",", "in", ".", "type", ")", ";", "push", "(", "values", "[", "i", "]", ",", "values", "[", "i", "]", ".", "type", ")", ";", "mv", ".", "visitJumpInsn", "(", "IF_ACMPEQ", ",", "getLabel", "(", "targets", "[", "i", "]", ")", ")", ";", "}", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "getLabel", "(", "failLabel", ")", ")", ";", "return", ";", "}", "}", "class", "Case", "implements", "Comparable", "<", "Case", ">", "{", "final", "Arg", "arg", ";", "final", "Label", "label", ";", "public", "Case", "(", "Arg", "arg", ",", "Label", "label", ")", "{", "this", ".", "arg", "=", "arg", ";", "this", ".", "label", "=", "label", ";", "}", "EObject", "value", "(", ")", "{", "return", "arg", ".", "value", ";", "}", "@", "Override", "public", "int", "compareTo", "(", "Case", "o", ")", "{", "int", "h", "=", "hashCode", "(", ")", ";", "int", "ho", "=", "o", ".", "hashCode", "(", ")", ";", "if", "(", "h", "<", "ho", ")", "return", "-", "1", ";", "if", "(", "h", ">", "ho", ")", "return", "1", ";", "return", "value", "(", ")", ".", "erlangCompareTo", "(", "o", ".", "value", "(", ")", ")", ";", "}", "}", "Map", "<", "Integer", ",", "List", "<", "Case", ">", ">", "cases", "=", "new", "TreeMap", "<", "Integer", ",", "List", "<", "Case", ">", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{", "int", "hash", "=", "values", "[", "i", "]", ".", "value", ".", "hashCode", "(", ")", ";", "List", "<", "Case", ">", "c", "=", "cases", ".", "get", "(", "hash", ")", ";", "if", "(", "c", "==", "null", ")", "{", "cases", ".", "put", "(", "hash", ",", "c", "=", "new", "ArrayList", "<", "Case", ">", "(", ")", ")", ";", "}", "c", ".", "add", "(", "new", "Case", "(", "values", "[", "i", "]", ",", "getLabel", "(", "targets", "[", "i", "]", ")", ")", ")", ";", "}", "int", "[", "]", "hashes", "=", "new", "int", "[", "cases", ".", "size", "(", ")", "]", ";", "Label", "[", "]", "tests", "=", "new", "Label", "[", "cases", ".", "size", "(", ")", "]", ";", "List", "<", "Case", ">", "[", "]", "idx_cases", "=", "new", "List", "[", "cases", ".", "size", "(", ")", "]", ";", "int", "idx", "=", "0", ";", "for", "(", "Map", ".", "Entry", "<", "Integer", ",", "List", "<", "Case", ">", ">", "c", ":", "cases", ".", "entrySet", "(", ")", ")", "{", "hashes", "[", "idx", "]", "=", "c", ".", "getKey", "(", ")", ";", "idx_cases", "[", "idx", "]", "=", "c", ".", "getValue", "(", ")", ";", "tests", "[", "idx", "++", "]", "=", "new", "Label", "(", ")", ";", "}", "push", "(", "in", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "\"\"", ",", "\"hashCode\"", ",", "\"()I\"", ")", ";", "mv", ".", "visitLookupSwitchInsn", "(", "getLabel", "(", "failLabel", ")", ",", "hashes", ",", "tests", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "idx_cases", ".", "length", ";", "i", "++", ")", "{", "mv", ".", "visitLabel", "(", "tests", "[", "i", "]", ")", ";", "for", "(", "Case", "c", ":", "idx_cases", "[", "i", "]", ")", "{", "Arg", "val_j", "=", "c", ".", "arg", ";", "Label", "target_j", "=", "c", ".", "label", ";", "if", "(", "val_j", ".", "type", ".", "equals", "(", "EATOM_TYPE", ")", ")", "{", "push", "(", "in", ",", "in", ".", "type", ")", ";", "push", "(", "val_j", ",", "val_j", ".", "type", ")", ";", "mv", ".", "visitJumpInsn", "(", "IF_ACMPEQ", ",", "target_j", ")", ";", "}", "else", "{", "if", "(", "in", ".", "type", "==", "val_j", ".", "type", ")", "{", "push", "(", "in", ",", "in", ".", "type", ")", ";", "push", "(", "val_j", ",", "val_j", ".", "type", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "ERT_NAME", ",", "\"eq\"", ",", "\"(\"", "+", "in", ".", "type", ".", "getDescriptor", "(", ")", "+", "in", ".", "type", ".", "getDescriptor", "(", ")", "+", "\")Z\"", ")", ";", "}", "else", "{", "push", "(", "in", ",", "EOBJECT_TYPE", ")", ";", "push", "(", "val_j", ",", "EOBJECT_TYPE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "\"\"", ",", "\"equals\"", ",", "\"\"", ")", ";", "}", "mv", ".", "visitJumpInsn", "(", "IFNE", ",", "target_j", ")", ";", "}", "}", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "getLabel", "(", "failLabel", ")", ")", ";", "}", "}", "private", "int", "[", "]", "sort", "(", "int", "[", "]", "ivals", ",", "Label", "[", "]", "label", ")", "{", "Label", "[", "]", "orig_labels", "=", "label", ".", "clone", "(", ")", ";", "int", "[", "]", "orig_ivals", "=", "ivals", ".", "clone", "(", ")", ";", "int", "[", "]", "res", "=", "new", "int", "[", "ivals", ".", "length", "]", ";", "Arrays", ".", "sort", "(", "ivals", ")", ";", "next_val", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ivals", ".", "length", ";", "i", "++", ")", "{", "int", "find", "=", "ivals", "[", "i", "]", ";", "for", "(", "int", "p", "=", "0", ";", "p", "<", "orig_ivals", ".", "length", ";", "p", "++", ")", "{", "int", "was", "=", "orig_ivals", "[", "p", "]", ";", "if", "(", "find", "==", "was", ")", "{", "res", "[", "p", "]", "=", "i", ";", "label", "[", "i", "]", "=", "orig_labels", "[", "p", "]", ";", "continue", "next_val", ";", "}", "}", "}", "return", "res", ";", "}", "class", "TupleArityLabel", "implements", "Comparable", "<", "TupleArityLabel", ">", "{", "Label", "cast_label", "=", "new", "Label", "(", ")", ";", "Label", "target", ";", "int", "arity", ";", "public", "TupleArityLabel", "(", "int", "arity", ",", "Label", "target", ")", "{", "this", ".", "arity", "=", "arity", ";", "this", ".", "target", "=", "target", ";", "}", "@", "Override", "public", "int", "compareTo", "(", "TupleArityLabel", "o", ")", "{", "if", "(", "this", ".", "arity", "<", "o", ".", "arity", ")", "return", "-", "1", ";", "if", "(", "this", ".", "arity", "==", "o", ".", "arity", ")", "return", "0", ";", "return", "1", ";", "}", "}", "@", "Override", "public", "void", "visitSelectTuple", "(", "Arg", "in", ",", "int", "failLabel", ",", "int", "[", "]", "arities", ",", "int", "[", "]", "targets", ")", "{", "push", "(", "in", ",", "ETUPLE_TYPE", ")", ";", "mv", ".", "visitTypeInsn", "(", "CHECKCAST", ",", "ETUPLE_NAME", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "ETUPLE_NAME", ",", "\"arity\"", ",", "\"()I\"", ")", ";", "TupleArityLabel", "[", "]", "cases", "=", "new", "TupleArityLabel", "[", "targets", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "targets", ".", "length", ";", "i", "++", ")", "{", "cases", "[", "i", "]", "=", "new", "TupleArityLabel", "(", "arities", "[", "i", "]", ",", "getLabel", "(", "targets", "[", "i", "]", ")", ")", ";", "}", "Arrays", ".", "sort", "(", "cases", ")", ";", "Label", "[", "]", "casts", "=", "new", "Label", "[", "cases", ".", "length", "]", ";", "int", "[", "]", "values", "=", "new", "int", "[", "cases", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cases", ".", "length", ";", "i", "++", ")", "{", "values", "[", "i", "]", "=", "cases", "[", "i", "]", ".", "arity", ";", "casts", "[", "i", "]", "=", "cases", "[", "i", "]", ".", "cast_label", ";", "}", "mv", ".", "visitLookupSwitchInsn", "(", "getLabel", "(", "failLabel", ")", ",", "values", ",", "casts", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cases", ".", "length", ";", "i", "++", ")", "{", "mv", ".", "visitLabel", "(", "cases", "[", "i", "]", ".", "cast_label", ")", ";", "push", "(", "in", ",", "ETUPLE_TYPE", ")", ";", "mv", ".", "visitTypeInsn", "(", "CHECKCAST", ",", "getTubleType", "(", "cases", "[", "i", "]", ".", "arity", ")", ".", "getInternalName", "(", ")", ")", ";", "pop", "(", "in", ",", "getTubleType", "(", "cases", "[", "i", "]", ".", "arity", ")", ")", ";", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "cases", "[", "i", "]", ".", "target", ")", ";", "}", "}", "@", "Override", "public", "void", "visitJump", "(", "int", "label", ")", "{", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "getLabel", "(", "label", ")", ")", ";", "}", "private", "Type", "getTubleType", "(", "int", "i", ")", "{", "return", "Type", ".", "getType", "(", "\"L\"", "+", "ETUPLE_NAME", "+", "i", "+", "\";\"", ")", ";", "}", "@", "Override", "public", "void", "visitCall", "(", "ExtFun", "fun", ",", "Arg", "[", "]", "args", ",", "boolean", "is_tail", ",", "boolean", "isExternal", ")", "{", "ensure_exception_handler_in_place", "(", ")", ";", "BuiltInFunction", "bif", "=", "null", ";", "bif", "=", "BIFUtil", ".", "getMethod", "(", "fun", ".", "mod", ".", "getName", "(", ")", ",", "fun", ".", "fun", ".", "getName", "(", ")", ",", "args", ",", "false", ",", "false", ")", ";", "if", "(", "bif", "!=", "null", "||", "isExternal", ")", "{", "if", "(", "bif", "==", "null", ")", "{", "String", "field", "=", "CompilerVisitor", ".", "this", ".", "getExternalFunction", "(", "fun", ")", ";", "String", "funTypeName", "=", "EFUN_NAME", "+", "args", ".", "length", ";", "EFun", ".", "ensure", "(", "args", ".", "length", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "field", ",", "\"L\"", "+", "funTypeName", "+", "\";\"", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "push", "(", "args", "[", "i", "]", ",", "EOBJECT_TYPE", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "funTypeName", ",", "(", "is_tail", "&&", "!", "isExitFunc", "(", "fun", ")", ")", "?", "\"invoke_tail\"", ":", "\"invoke\"", ",", "EUtil", ".", "getSignature", "(", "args", ".", "length", ",", "true", ")", ")", ";", "}", "else", "if", "(", "bif", ".", "isVirtual", "(", ")", ")", "{", "push", "(", "args", "[", "0", "]", ",", "bif", ".", "owner", ")", ";", "int", "off", "=", "0", ";", "if", "(", "bif", ".", "getArgumentTypes", "(", ")", ".", "length", ">", "0", "&&", "bif", ".", "getArgumentTypes", "(", ")", "[", "0", "]", ".", "equals", "(", "EPROC_TYPE", ")", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "off", "=", "1", ";", "}", "for", "(", "int", "i", "=", "1", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "push", "(", "args", "[", "i", "]", ",", "bif", ".", "getArgumentTypes", "(", ")", "[", "off", "-", "1", "]", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "bif", ".", "owner", ".", "getInternalName", "(", ")", ",", "bif", ".", "getName", "(", ")", ",", "bif", ".", "getDescriptor", "(", ")", ")", ";", "}", "else", "{", "int", "off", "=", "0", ";", "if", "(", "bif", ".", "getArgumentTypes", "(", ")", ".", "length", ">", "0", "&&", "bif", ".", "getArgumentTypes", "(", ")", "[", "0", "]", ".", "equals", "(", "EPROC_TYPE", ")", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "off", "=", "1", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "push", "(", "args", "[", "i", "]", ",", "bif", ".", "getArgumentTypes", "(", ")", "[", "off", "+", "i", "]", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "bif", ".", "owner", ".", "getInternalName", "(", ")", ",", "bif", ".", "getName", "(", ")", ",", "bif", ".", "getDescriptor", "(", ")", ")", ";", "}", "if", "(", "is_tail", "||", "isExitFunc", "(", "fun", ")", ")", "{", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "}", "else", "{", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "xregs", "[", "0", "]", ")", ";", "}", "}", "else", "{", "if", "(", "is_tail", "&&", "fun", ".", "arity", "==", "ASMFunctionAdapter", ".", "this", ".", "arity", "&&", "fun", ".", "fun", "==", "ASMFunctionAdapter", ".", "this", ".", "fun_name", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EPROC_NAME", ",", "\"check_exit\"", ",", "\"()V\"", ")", ";", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "getLabel", "(", "ASMFunctionAdapter", ".", "this", ".", "startLabel", ")", ")", ";", "return", ";", "}", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "push", "(", "args", "[", "i", "]", ",", "EOBJECT_TYPE", ")", ";", "}", "FunInfo", "target", "=", "funInfos", ".", "get", "(", "new", "FunID", "(", "fun", ".", "mod", ",", "fun", ".", "name", "(", ")", ",", "fun", ".", "arity", ")", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "self_type", ".", "getInternalName", "(", ")", ",", "EUtil", ".", "getJavaName", "(", "fun", ".", "fun", ",", "fun", ".", "arity", ")", "+", "(", "is_tail", "?", "\"$tail\"", ":", "(", "target", ".", "may_return_tail_marker", "?", "\"$call\"", ":", "\"\"", ")", ")", ",", "EUtil", ".", "getSignature", "(", "args", ".", "length", ",", "true", ")", ")", ";", "if", "(", "is_tail", ")", "{", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "}", "else", "{", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "xregs", "[", "0", "]", ")", ";", "}", "}", "}", "private", "boolean", "isExitFunc", "(", "ExtFun", "fun", ")", "{", "if", "(", "fun", ".", "mod", "==", "ERLANG_ATOM", ")", "{", "if", "(", "fun", ".", "fun", "==", "CodeAtoms", ".", "EXIT_ATOM", "&&", "fun", ".", "arity", "==", "1", ")", "return", "true", ";", "if", "(", "fun", ".", "fun", "==", "CodeAtoms", ".", "ERROR_ATOM", "&&", "(", "fun", ".", "arity", "==", "1", "||", "fun", ".", "arity", "==", "2", ")", ")", "return", "true", ";", "if", "(", "fun", ".", "fun", "==", "CodeAtoms", ".", "THROW_ATOM", "&&", "fun", ".", "arity", "==", "1", ")", "return", "true", ";", "}", "return", "false", ";", "}", "}", "}", "final", "static", "Method", "IS_NONEMPTY_LIST_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_LIST_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_TUPLE_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_INTEGER_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_ATOM_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_FLOAT_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_NIL_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_BOOLEAN_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_NUMBER_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_BINARY_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_BITSTRING_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_PID_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_PORT_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_REFERENCE_TEST", "=", "Method", ".", "getMethod", "(", "ERef", ".", "class", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "final", "static", "Method", "IS_FUNCTION_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "final", "static", "Method", "IS_FUNCTION2_TEST", "=", "Method", ".", "getMethod", "(", "\"\"", ")", ";", "Map", "<", "String", ",", "ExtFun", ">", "imported", "=", "new", "HashMap", "<", "String", ",", "ExtFun", ">", "(", ")", ";", "private", "Map", "<", "FunID", ",", "FunInfo", ">", "funInfos", ";", "public", "String", "getExternalFunction", "(", "ExtFun", "fun", ")", "{", "String", "name", "=", "EUtil", ".", "getJavaName", "(", "fun", ")", ";", "if", "(", "!", "imported", ".", "containsKey", "(", "name", ")", ")", "{", "imported", ".", "put", "(", "name", ",", "fun", ")", ";", "}", "return", "name", ";", "}", "static", "class", "Lambda", "{", "private", "final", "EAtom", "fun", ";", "private", "final", "int", "arity", ";", "private", "final", "int", "freevars", ";", "private", "final", "int", "index", ";", "private", "final", "int", "old_index", ";", "private", "final", "int", "old_uniq", ";", "private", "final", "EBinary", "uniq", ";", "public", "Lambda", "(", "EAtom", "fun", ",", "int", "arity", ",", "int", "freevars", ",", "int", "index", ",", "int", "old_index", ",", "EBinary", "uniq", ",", "int", "old_uniq", ")", "{", "this", ".", "fun", "=", "fun", ";", "this", ".", "arity", "=", "arity", ";", "this", ".", "freevars", "=", "freevars", ";", "this", ".", "index", "=", "index", ";", "this", ".", "old_index", "=", "old_index", ";", "this", ".", "uniq", "=", "uniq", ";", "this", ".", "old_uniq", "=", "old_uniq", ";", "}", "}", "public", "void", "register_lambda", "(", "EAtom", "fun", ",", "int", "arity_plus", ",", "int", "freevars", ",", "int", "index", ",", "int", "old_index", ",", "EBinary", "uniq", ",", "int", "old_uniq", ")", "{", "lambdas_xx", ".", "put", "(", "new", "FunID", "(", "module_name", ",", "fun", ",", "arity_plus", ")", ",", "new", "Lambda", "(", "fun", ",", "arity_plus", ",", "freevars", ",", "index", ",", "old_index", ",", "uniq", ",", "old_uniq", ")", ")", ";", "}", "public", "Lambda", "get_lambda_freevars", "(", "EAtom", "fun", ",", "int", "arity_plus", ")", "{", "return", "lambdas_xx", ".", "get", "(", "new", "FunID", "(", "module_name", ",", "fun", ",", "arity_plus", ")", ")", ";", "}", "static", "public", "byte", "[", "]", "make_invoker", "(", "String", "module", ",", "String", "function", ",", "Type", "self_type", ",", "String", "mname", ",", "String", "fname", ",", "int", "arity", ",", "boolean", "proc", ",", "boolean", "exported", ",", "Lambda", "lambda", ",", "Type", "return_type", ",", "boolean", "is_tail_call", ",", "final", "boolean", "is_pausable", ")", "{", "int", "freevars", "=", "lambda", "==", "null", "?", "0", ":", "lambda", ".", "freevars", ";", "String", "outer_name", "=", "self_type", ".", "getInternalName", "(", ")", ";", "String", "inner_name", "=", "\"FN_\"", "+", "mname", ";", "String", "full_inner_name", "=", "outer_name", "+", "\"$\"", "+", "inner_name", ";", "ClassWriter", "cw", "=", "new", "ClassWriter", "(", "true", ")", ";", "int", "residual_arity", "=", "arity", "-", "freevars", ";", "String", "super_class_name", "=", "EFUN_NAME", "+", "residual_arity", "+", "(", "exported", "?", "\"Exported\"", ":", "\"\"", ")", ";", "if", "(", "exported", ")", "EFun", ".", "ensure_exported", "(", "residual_arity", ")", ";", "else", "EFun", ".", "ensure", "(", "residual_arity", ")", ";", "cw", ".", "visit", "(", "V1_6", ",", "ACC_FINAL", "|", "ACC_PUBLIC", ",", "full_inner_name", ",", "null", ",", "super_class_name", ",", "null", ")", ";", "if", "(", "lambda", "!=", "null", ")", "{", "cw", ".", "visitField", "(", "ACC_STATIC", "|", "ACC_PUBLIC", "|", "ACC_FINAL", ",", "\"index\"", ",", "\"I\"", ",", "null", ",", "new", "Integer", "(", "lambda", ".", "index", ")", ")", ";", "cw", ".", "visitField", "(", "ACC_STATIC", "|", "ACC_PUBLIC", "|", "ACC_FINAL", ",", "\"old_index\"", ",", "\"I\"", ",", "null", ",", "new", "Integer", "(", "lambda", ".", "old_index", ")", ")", ";", "cw", ".", "visitField", "(", "ACC_STATIC", "|", "ACC_PUBLIC", "|", "ACC_FINAL", ",", "\"old_uniq\"", ",", "\"I\"", ",", "null", ",", "new", "Integer", "(", "lambda", ".", "old_uniq", ")", ")", ";", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"encode\"", ",", "\"(\"", "+", "Type", ".", "getDescriptor", "(", "EOutputStream", ".", "class", ")", "+", "\")V\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "full_inner_name", ",", "\"pid\"", ",", "EPID_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitLdcInsn", "(", "module", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "full_inner_name", ",", "\"old_index\"", ",", "\"I\"", ")", ";", "mv", ".", "visitInsn", "(", "I2L", ")", ";", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "arity", ")", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "outer_name", ",", "\"module_md5\"", ",", "EBINARY_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "full_inner_name", ",", "\"index\"", ",", "\"I\"", ")", ";", "mv", ".", "visitInsn", "(", "I2L", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "full_inner_name", ",", "\"old_uniq\"", ",", "\"I\"", ")", ";", "mv", ".", "visitInsn", "(", "I2L", ")", ";", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "freevars", ")", ")", ";", "mv", ".", "visitTypeInsn", "(", "ANEWARRAY", ",", "EOBJECT_NAME", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "if", "(", "i", "<=", "5", ")", "{", "mv", ".", "visitInsn", "(", "ICONST_0", "+", "i", ")", ";", "}", "else", "{", "mv", ".", "visitLdcInsn", "(", "new", "Integer", "(", "i", ")", ")", ";", "}", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "full_inner_name", ",", "\"fv\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "mv", ".", "visitInsn", "(", "AASTORE", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "Type", ".", "getInternalName", "(", "EOutputStream", ".", "class", ")", ",", "\"write_fun\"", ",", "\"(\"", "+", "EPID_TYPE", ".", "getDescriptor", "(", ")", "+", "\"\"", "+", "\"JI\"", "+", "EBINARY_TYPE", ".", "getDescriptor", "(", ")", "+", "\"JJ\"", "+", "Type", ".", "getDescriptor", "(", "EObject", "[", "]", ".", "class", ")", "+", "\")V\"", ")", ";", "mv", ".", "visitInsn", "(", "RETURN", ")", ";", "mv", ".", "visitMaxs", "(", "10", ",", "3", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}", "make_constructor", "(", "cw", ",", "module", ",", "function", ",", "full_inner_name", ",", "super_class_name", ",", "lambda", ",", "exported", ")", ";", "make_go_method", "(", "cw", ",", "outer_name", ",", "fname", ",", "full_inner_name", ",", "arity", ",", "proc", ",", "freevars", ",", "return_type", ",", "is_tail_call", ",", "is_pausable", ")", ";", "make_go2_method", "(", "cw", ",", "outer_name", ",", "fname", ",", "full_inner_name", ",", "arity", ",", "proc", ",", "freevars", ",", "return_type", ",", "is_tail_call", ",", "is_pausable", ")", ";", "return", "cw", ".", "toByteArray", "(", ")", ";", "}", "private", "static", "void", "make_constructor", "(", "ClassWriter", "cw", ",", "String", "module_name", ",", "String", "function_name", ",", "String", "full_inner_name", ",", "String", "super_class_name", ",", "Lambda", "lambda", ",", "boolean", "exported", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"(\"", ")", ";", "int", "freevars", "=", "lambda", "==", "null", "?", "0", ":", "lambda", ".", "freevars", ";", "if", "(", "lambda", "!=", "null", ")", "{", "sb", ".", "append", "(", "EPID_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "cw", ".", "visitField", "(", "ACC_PUBLIC", "|", "ACC_FINAL", ",", "\"pid\"", ",", "EPID_TYPE", ".", "getDescriptor", "(", ")", ",", "null", ",", "null", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "freevars", ";", "i", "++", ")", "{", "cw", ".", "visitField", "(", "ACC_PUBLIC", "|", "ACC_FINAL", ",", "\"fv\"", "+", "i", ",", "EOBJECT_DESC", ",", "null", ",", "null", ")", ";", "sb", ".", "append", "(", "EOBJECT_DESC", ")", ";", "}", "sb", ".", "append", "(", "\")V\"", ")", ";", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"<init>\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "if", "(", "exported", ")", "{", "mv", ".", "visitLdcInsn", "(", "module_name", ")", ";", "mv", ".", "visitLdcInsn", "(", "function_name", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "super_class_name", ",", "\"<init>\"", ",", "\"\"", ")", ";", "}", "else", "{", "mv", ".", "visitMethodInsn", "(", "INVOKESPECIAL", ",", "super_class_name", ",", "\"<init>\"", ",", "\"()V\"", ")", ";", "}", "if", "(", "lambda", "!=", "null", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "full_inner_name", ",", "\"pid\"", ",", "EPID_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "i", "+", "2", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "full_inner_name", ",", "\"fv\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "}", "mv", ".", "visitInsn", "(", "RETURN", ")", ";", "mv", ".", "visitMaxs", "(", "3", ",", "3", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "if", "(", "lambda", "!=", "null", ")", "{", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PROTECTED", ",", "\"get_env\"", ",", "\"()\"", "+", "ESEQ_DESC", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "ERT_NAME", ",", "\"NIL\"", ",", "ENIL_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "for", "(", "int", "i", "=", "freevars", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "full_inner_name", ",", "\"fv\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "ESEQ_NAME", ",", "\"cons\"", ",", "\"(\"", "+", "EOBJECT_DESC", "+", "\")\"", "+", "ESEQ_DESC", ")", ";", "}", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "3", ",", "3", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PROTECTED", ",", "\"get_pid\"", ",", "\"()\"", "+", "EOBJECT_DESC", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "full_inner_name", ",", "\"pid\"", ",", "EPID_TYPE", ".", "getDescriptor", "(", ")", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "3", ",", "3", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PROTECTED", ",", "\"get_id\"", ",", "\"()\"", "+", "Type", ".", "getDescriptor", "(", "FunID", ".", "class", ")", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "full_inner_name", ".", "substring", "(", "0", ",", "full_inner_name", ".", "indexOf", "(", "'$'", ")", ")", ",", "anon_fun_name", "(", "lambda", ")", ",", "Type", ".", "getDescriptor", "(", "LocalFunID", ".", "class", ")", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "3", ",", "3", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}", "}", "private", "static", "void", "make_invoke_method", "(", "ClassWriter", "cw", ",", "String", "outer_name", ",", "String", "mname", ",", "int", "arity", ",", "boolean", "proc", ",", "int", "freevars", ",", "Type", "returnType", ",", "boolean", "isTailCall", ")", "{", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"invoke\"", ",", "EUtil", ".", "getSignature", "(", "arity", "-", "freevars", ",", "true", ")", ",", "null", ",", "PAUSABLE_EX", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "if", "(", "proc", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", "-", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "i", "+", "2", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "outer_name", "+", "\"$FN_\"", "+", "mname", ",", "\"fv\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "outer_name", ",", "mname", ",", "EUtil", ".", "getSignature", "(", "arity", ",", "proc", ",", "returnType", ")", ")", ";", "if", "(", "isTailCall", ")", "{", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "arity", "+", "2", ")", ";", "Label", "done", "=", "new", "Label", "(", ")", ";", "Label", "loop", "=", "new", "Label", "(", ")", ";", "mv", ".", "visitLabel", "(", "loop", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "arity", "+", "2", ")", ";", "if", "(", "EProc", ".", "TAIL_MARKER", "==", "null", ")", "{", "mv", ".", "visitJumpInsn", "(", "IFNONNULL", ",", "done", ")", ";", "}", "else", "{", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "EPROC_NAME", ",", "\"TAIL_MARKER\"", ",", "EOBJECT_DESC", ")", ";", "mv", ".", "visitJumpInsn", "(", "IF_ACMPNE", ",", "done", ")", ";", "}", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "EPROC_NAME", ",", "\"tail\"", ",", "EFUN_DESCRIPTOR", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "EFUN_NAME", ",", "\"go\"", ",", "GO_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitJumpInsn", "(", "GOTO", ",", "loop", ")", ";", "mv", ".", "visitLabel", "(", "done", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "arity", "+", "2", ")", ";", "}", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "arity", "+", "2", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}", "public", "static", "void", "make_invoketail_method", "(", "ClassWriter", "cw", ",", "String", "full_inner", ",", "int", "arity", ",", "int", "freevars", ")", "{", "MethodVisitor", "mv", ";", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", "|", "ACC_FINAL", ",", "\"invoke_tail\"", ",", "EUtil", ".", "getSignature", "(", "arity", "-", "freevars", ",", "true", ")", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", "-", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "i", "+", "2", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "EPROC_NAME", ",", "\"arg\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "}", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "EPROC_NAME", ",", "\"tail\"", ",", "EFUN_DESCRIPTOR", ")", ";", "if", "(", "EProc", ".", "TAIL_MARKER", "==", "null", ")", "{", "mv", ".", "visitInsn", "(", "ACONST_NULL", ")", ";", "}", "else", "{", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "EPROC_NAME", ",", "\"TAIL_MARKER\"", ",", "EOBJECT_DESC", ")", ";", "}", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "arity", "+", "2", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}", "private", "static", "void", "make_go_method", "(", "ClassWriter", "cw", ",", "String", "outer_name", ",", "String", "mname", ",", "String", "full_inner", ",", "int", "arity", ",", "boolean", "proc", ",", "int", "freevars", ",", "Type", "returnType", ",", "boolean", "isTailCall", ",", "boolean", "isPausable", ")", "{", "if", "(", "!", "isPausable", ")", "return", ";", "MethodVisitor", "mv", ";", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"go\"", ",", "GO_DESC", ",", "null", ",", "PAUSABLE_EX", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", "-", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "EPROC_NAME", ",", "\"arg\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "i", "+", "2", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", "-", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitInsn", "(", "ACONST_NULL", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "EPROC_NAME", ",", "\"arg\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "}", "if", "(", "proc", ")", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", "-", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "i", "+", "2", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "full_inner", ",", "\"fv\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "outer_name", ",", "mname", ",", "EUtil", ".", "getSignature", "(", "arity", ",", "proc", ",", "returnType", ")", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "arity", "+", "2", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "cw", ".", "visitEnd", "(", ")", ";", "}", "private", "static", "void", "make_go2_method", "(", "ClassWriter", "cw", ",", "String", "outer_name", ",", "String", "mname", ",", "String", "full_inner", ",", "int", "arity", ",", "boolean", "proc", ",", "int", "freevars", ",", "Type", "returnType", ",", "boolean", "isTailCall", ",", "boolean", "isPausable", ")", "{", "if", "(", "isPausable", ")", "{", "if", "(", "ModuleAnalyzer", ".", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "ModuleAnalyzer", ".", "log", ".", "fine", "(", "\"\"", "+", "full_inner", ")", ";", "}", "return", ";", "}", "MethodVisitor", "mv", ";", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PUBLIC", ",", "\"go2\"", ",", "GO_DESC", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", "-", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "EPROC_NAME", ",", "\"arg\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "i", "+", "2", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", "-", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "mv", ".", "visitInsn", "(", "ACONST_NULL", ")", ";", "mv", ".", "visitFieldInsn", "(", "PUTFIELD", ",", "EPROC_NAME", ",", "\"arg\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "}", "if", "(", "proc", ")", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "1", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", "-", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "i", "+", "2", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "freevars", ";", "i", "++", ")", "{", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETFIELD", ",", "full_inner", ",", "\"fv\"", "+", "i", ",", "EOBJECT_DESC", ")", ";", "}", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "outer_name", ",", "mname", ",", "EUtil", ".", "getSignature", "(", "arity", ",", "proc", ",", "returnType", ")", ")", ";", "mv", ".", "visitInsn", "(", "ARETURN", ")", ";", "mv", ".", "visitMaxs", "(", "arity", "+", "2", ",", "arity", "+", "2", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "cw", ".", "visitEnd", "(", ")", ";", "}", "public", "void", "setFunInfos", "(", "Map", "<", "FunID", ",", "FunInfo", ">", "funInfos", ")", "{", "this", ".", "funInfos", "=", "funInfos", ";", "}", "}", "class", "EXHandler", "{", "int", "handler_beam_label", ";", "Label", "begin", ",", "end", ",", "target", ";", "BeamExceptionHandler", "beam_exh", ";", "}", "</s>" ]
7,837
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Modifier", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EBig", ";", "import", "erjang", ".", "EDouble", ";", "import", "erjang", ".", "ENative", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EProc", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "m", ".", "erlang", ".", "BinOps", ";", "import", "erjang", ".", "m", ".", "erlang", ".", "ErlBif", ";", "public", "class", "BIFUtil", "{", "public", "static", "final", "Type", "EOBJECT_TYPE", "=", "Type", ".", "getType", "(", "EObject", ".", "class", ")", ";", "public", "static", "final", "Type", "EPROC_TYPE", "=", "Type", ".", "getType", "(", "EProc", ".", "class", ")", ";", "static", "Map", "<", "String", ",", "BIFHandler", ">", "bifs", "=", "new", "HashMap", "<", "String", ",", "BIFHandler", ">", "(", ")", ";", "static", "Map", "<", "String", ",", "BIFHandler", ">", "guard_bifs", "=", "new", "HashMap", "<", "String", ",", "BIFHandler", ">", "(", ")", ";", "static", "{", "try", "{", "loadBIFs", "(", "new", "String", "[", "]", "{", "\"erlang\"", ",", "\"error_logger\"", ",", "\"ets\"", ",", "\"lists\"", ",", "\"math\"", ",", "\"net_kernel\"", ",", "\"os\"", ",", "\"re\"", ",", "\"unicode\"", ",", "\"crypto\"", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "Error", "(", "\"\"", ",", "e", ")", ";", "}", "}", "static", "class", "Args", "{", "Class", "[", "]", "args", ";", "private", "Args", "generic", ";", "private", "int", "hashCode", ";", "private", "int", "code", ";", "Args", "(", "Type", "[", "]", "types", ")", "{", "args", "=", "new", "Class", "[", "types", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "if", "(", "types", "[", "i", "]", "==", "Type", ".", "DOUBLE_TYPE", ")", "{", "args", "[", "i", "]", "=", "double", ".", "class", ";", "continue", ";", "}", "if", "(", "types", "[", "i", "]", "==", "Type", ".", "INT_TYPE", ")", "{", "args", "[", "i", "]", "=", "int", ".", "class", ";", "continue", ";", "}", "try", "{", "args", "[", "i", "]", "=", "Class", ".", "forName", "(", "types", "[", "i", "]", ".", "getClassName", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "if", "(", "types", "[", "i", "]", "==", "Type", ".", "BOOLEAN_TYPE", ")", "{", "args", "[", "i", "]", "=", "boolean", ".", "class", ";", "}", "else", "if", "(", "types", "[", "i", "]", "==", "Type", ".", "INT_TYPE", ")", "{", "args", "[", "i", "]", "=", "int", ".", "class", ";", "}", "else", "if", "(", "types", "[", "i", "]", "==", "Type", ".", "DOUBLE_TYPE", ")", "{", "args", "[", "i", "]", "=", "double", ".", "class", ";", "}", "else", "{", "throw", "new", "Error", "(", "e", ")", ";", "}", "}", "}", "}", "public", "Args", "(", "Class", "[", "]", "a", ")", "{", "this", ".", "args", "=", "a", ";", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "if", "(", "code", "!=", "0", ")", "return", "code", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "code", "+=", "args", "[", "i", "]", ".", "getName", "(", ")", ".", "hashCode", "(", ")", ";", "}", "for", "(", "Class", "c", ":", "args", ")", "{", "code", "+=", "c", ".", "hashCode", "(", ")", ";", "}", "return", "code", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "Args", ")", "{", "Args", "other", "=", "(", "Args", ")", "obj", ";", "if", "(", "other", ".", "args", ".", "length", "==", "args", ".", "length", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "args", "[", "i", "]", ".", "equals", "(", "other", ".", "args", "[", "i", "]", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "}", "return", "false", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"(\"", ")", ";", "boolean", "first", "=", "true", ";", "for", "(", "Class", "c", ":", "args", ")", "{", "if", "(", "!", "first", ")", "sb", ".", "append", "(", "\",\"", ")", ";", "else", "first", "=", "false", ";", "sb", ".", "append", "(", "c", ".", "getName", "(", ")", ")", ";", "}", "sb", ".", "append", "(", "\")\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}", "public", "Args", "generic", "(", ")", "{", "if", "(", "generic", "==", "null", ")", "{", "Class", "[", "]", "a", "=", "new", "Class", "[", "args", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "a", "[", "i", "]", "=", "EObject", ".", "class", ";", "}", "generic", "=", "new", "Args", "(", "a", ")", ";", "}", "return", "generic", ";", "}", "public", "List", "<", "Args", ">", "generalize", "(", ")", "{", "ArrayList", "<", "Args", ">", "res", "=", "new", "ArrayList", "<", "Args", ">", "(", ")", ";", "Class", "[", "]", "aa", "=", "this", ".", "args", ".", "clone", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "for", "(", "Class", "c", "=", "args", "[", "i", "]", ";", "!", "c", ".", "equals", "(", "Object", ".", "class", ")", ";", "c", "=", "super_class", "(", "c", ")", ")", "{", "aa", "[", "i", "]", "=", "c", ";", "res", ".", "add", "(", "new", "Args", "(", "aa", ".", "clone", "(", ")", ")", ")", ";", "for", "(", "int", "j", "=", "i", "+", "1", ";", "j", "<", "args", ".", "length", ";", "j", "++", ")", "{", "for", "(", "Class", "cc", "=", "args", "[", "j", "]", ";", "!", "cc", ".", "equals", "(", "Object", ".", "class", ")", ";", "cc", "=", "super_class", "(", "cc", ")", ")", "{", "aa", "[", "j", "]", "=", "cc", ";", "res", ".", "add", "(", "new", "Args", "(", "aa", ".", "clone", "(", ")", ")", ")", ";", "}", "}", "}", "}", "return", "res", ";", "}", "private", "Class", "super_class", "(", "Class", "c", ")", "{", "if", "(", "c", ".", "isPrimitive", "(", ")", ")", "{", "if", "(", "c", "==", "double", ".", "class", ")", "return", "EDouble", ".", "class", ";", "if", "(", "c", "==", "int", ".", "class", ")", "return", "ESmall", ".", "class", ";", "if", "(", "c", "==", "long", ".", "class", ")", "return", "EBig", ".", "class", ";", "if", "(", "c", "==", "boolean", ".", "class", ")", "return", "EAtom", ".", "class", ";", "return", "EObject", ".", "class", ";", "}", "else", "{", "return", "c", ".", "getSuperclass", "(", ")", ";", "}", "}", "}", "static", "class", "BIFHandler", "{", "Map", "<", "Args", ",", "BuiltInFunction", ">", "found", "=", "new", "HashMap", "<", "Args", ",", "BuiltInFunction", ">", "(", ")", ";", "private", "final", "String", "name", ";", "private", "final", "String", "javaName", ";", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "return", "name", ".", "hashCode", "(", ")", "+", "javaName", ".", "hashCode", "(", ")", "+", "found", ".", "values", "(", ")", ".", "hashCode", "(", ")", ";", "}", "public", "BIFHandler", "(", "String", "name", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "javaName", "=", "name", ";", "}", "public", "BIFHandler", "(", "String", "name", ",", "String", "javaName", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "javaName", "=", "javaName", ";", "}", "public", "Type", "getResult", "(", "Type", "[", "]", "parmTypes", ")", "{", "BuiltInFunction", "method", "=", "getMethod", "(", "parmTypes", ")", ";", "if", "(", "method", "==", "null", ")", "{", "throw", "new", "Error", "(", "\"no", "bif", "name", "\"", "+", "this", ".", "name", "+", "\"", "for", "parms", "\"", "+", "new", "Args", "(", "parmTypes", ")", ")", ";", "}", "return", "method", ".", "getReturnType", "(", ")", ";", "}", "public", "void", "registerMethod", "(", "Method", "method", ")", "{", "Args", "a", ";", "Class", "<", "?", ">", "[", "]", "pt", "=", "method", ".", "getParameterTypes", "(", ")", ";", "if", "(", "!", "Modifier", ".", "isStatic", "(", "method", ".", "getModifiers", "(", ")", ")", ")", "{", "Class", "[", "]", "all", "=", "new", "Class", "[", "pt", ".", "length", "+", "1", "]", ";", "all", "[", "0", "]", "=", "method", ".", "getDeclaringClass", "(", ")", ";", "System", ".", "arraycopy", "(", "pt", ",", "0", ",", "all", ",", "1", ",", "pt", ".", "length", ")", ";", "a", "=", "new", "Args", "(", "all", ")", ";", "}", "else", "{", "a", "=", "new", "Args", "(", "pt", ")", ";", "}", "found", ".", "put", "(", "a", ",", "new", "BuiltInFunction", "(", "method", ")", ")", ";", "}", "public", "BuiltInFunction", "getMethod", "(", "Type", "[", "]", "parmTypes", ")", "{", "BuiltInFunction", "m", "=", "find_bif", "(", "parmTypes", ")", ";", "if", "(", "m", "!=", "null", ")", "return", "m", ";", "if", "(", "parmTypes", ".", "length", "==", "0", "||", "!", "EPROC_TYPE", ".", "equals", "(", "parmTypes", "[", "0", "]", ")", ")", "{", "Type", "[", "]", "extra", "=", "new", "Type", "[", "parmTypes", ".", "length", "+", "1", "]", ";", "extra", "[", "0", "]", "=", "EPROC_TYPE", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parmTypes", ".", "length", ";", "i", "++", ")", "{", "extra", "[", "i", "+", "1", "]", "=", "parmTypes", "[", "i", "]", ";", "}", "m", "=", "find_bif", "(", "extra", ")", ";", "if", "(", "m", "!=", "null", ")", "return", "m", ";", "}", "return", "m", ";", "}", "private", "BuiltInFunction", "find_bif", "(", "Type", "[", "]", "parmTypes", ")", "{", "Args", "args", "=", "new", "Args", "(", "parmTypes", ")", ";", "BuiltInFunction", "m", "=", "found", ".", "get", "(", "args", ")", ";", "if", "(", "m", "!=", "null", ")", "{", "return", "m", ";", "}", "for", "(", "Args", "a", ":", "args", ".", "generalize", "(", ")", ")", "{", "m", "=", "found", ".", "get", "(", "a", ")", ";", "if", "(", "m", "!=", "null", ")", "{", "if", "(", "ERT", ".", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "ERT", ".", "log", ".", "fine", "(", "\"\"", "+", "EAtom", ".", "intern", "(", "name", ")", "+", "\"/\"", "+", "parmTypes", ".", "length", "+", "\"", "\"", "+", "args", "+", "\",", "ntusing", "\"", "+", "m", ")", ";", "return", "m", ";", "}", "}", "return", "null", ";", "}", "}", "public", "static", "Type", "getBifResult", "(", "String", "module", ",", "String", "name", ",", "Type", "[", "]", "parmTypes", ",", "boolean", "isGuard", ")", "{", "Map", "<", "String", ",", "BIFHandler", ">", "tab", "=", "isGuard", "?", "guard_bifs", ":", "bifs", ";", "BIFHandler", "bif", "=", "null", ";", "String", "key", "=", "module", "+", "\":\"", "+", "name", ";", "if", "(", "tab", ".", "containsKey", "(", "key", ")", ")", "{", "bif", "=", "tab", ".", "get", "(", "key", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"no", "\"", "+", "(", "isGuard", "?", "\"guard\"", ":", "\"normal\"", ")", "+", "\"", "bif", "named", "\"", "+", "module", "+", "\":'\"", "+", "name", "+", "\"'/\"", "+", "parmTypes", ".", "length", ")", ";", "}", "return", "bif", ".", "getResult", "(", "parmTypes", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "void", "loadBIFs", "(", "String", "[", "]", "mods", ")", "throws", "Exception", "{", "for", "(", "String", "mod", ":", "mods", ")", "{", "Class", "<", "ENative", ">", "en", "=", "(", "Class", "<", "ENative", ">", ")", "Class", ".", "forName", "(", "\"erjang.m.\"", "+", "mod", "+", "\".Native\"", ")", ";", "registerBifs", "(", "mod", ",", "en", ")", ";", "ENative", "enative", "=", "en", ".", "newInstance", "(", ")", ";", "for", "(", "Class", "c", ":", "enative", ".", "getNativeClasses", "(", ")", ")", "{", "if", "(", "c", "!=", "en", ")", "{", "registerBifs", "(", "mod", ",", "c", ")", ";", "}", "}", "}", "registerBifs", "(", "\"erlang\"", ",", "ERT", ".", "class", ")", ";", "registerBifs", "(", "\"erlang\"", ",", "EObject", ".", "class", ")", ";", "registerBifs", "(", "\"erlang\"", ",", "ESmall", ".", "class", ")", ";", "registerBifs", "(", "\"erlang\"", ",", "EBig", ".", "class", ")", ";", "}", "public", "static", "void", "registerBifs", "(", "String", "module", ",", "Class", "<", "?", ">", "clazz", ")", "{", "Method", "[", "]", "m", "=", "clazz", ".", "getMethods", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m", ".", "length", ";", "i", "++", ")", "{", "Method", "method", "=", "m", "[", "i", "]", ";", "erjang", ".", "BIF", "ann", "=", "method", ".", "getAnnotation", "(", "erjang", ".", "BIF", ".", "class", ")", ";", "if", "(", "ann", "!=", "null", ")", "{", "if", "(", "(", "method", ".", "getModifiers", "(", ")", "&", "Modifier", ".", "STATIC", ")", "!=", "Modifier", ".", "STATIC", ")", "{", "}", "Map", "<", "String", ",", "BIFHandler", ">", "tab", "=", "ann", ".", "type", "(", ")", "==", "erjang", ".", "BIF", ".", "Type", ".", "GUARD", "?", "guard_bifs", ":", "bifs", ";", "String", "bifName", "=", "ann", ".", "name", "(", ")", ";", "if", "(", "bifName", ".", "equals", "(", "\"__SELFNAME__\"", ")", ")", "{", "bifName", "=", "method", ".", "getName", "(", ")", ";", "}", "String", "key", "=", "module", "+", "\":\"", "+", "bifName", ";", "BIFHandler", "h", "=", "tab", ".", "get", "(", "key", ")", ";", "if", "(", "h", "==", "null", ")", "{", "tab", ".", "put", "(", "key", ",", "h", "=", "new", "BIFHandler", "(", "bifName", ")", ")", ";", "}", "h", ".", "registerMethod", "(", "method", ")", ";", "}", "}", "}", "public", "static", "BuiltInFunction", "getMethod", "(", "String", "module", ",", "String", "name", ",", "int", "arity", ",", "boolean", "isGuard", ",", "boolean", "fail_when_missing", ")", "{", "return", "getMethod", "(", "module", ",", "name", ",", "eobjectParmTypes", "(", "arity", ")", ",", "isGuard", ",", "fail_when_missing", ")", ";", "}", "private", "static", "Type", "[", "]", "eobjectParmTypes", "(", "int", "length", ")", "{", "Type", "[", "]", "res", "=", "new", "Type", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "res", "[", "i", "]", "=", "EOBJECT_TYPE", ";", "}", "return", "res", ";", "}", "public", "static", "BuiltInFunction", "getMethod", "(", "String", "module", ",", "String", "name", ",", "Type", "[", "]", "parmTypes", ",", "boolean", "isGuard", ",", "boolean", "fail_when_missing", ")", "{", "Map", "<", "String", ",", "BIFHandler", ">", "tab", "=", "isGuard", "?", "guard_bifs", ":", "bifs", ";", "BIFHandler", "bif", "=", "null", ";", "String", "key", "=", "module", "+", "\":\"", "+", "name", ";", "if", "(", "tab", ".", "containsKey", "(", "key", ")", ")", "{", "bif", "=", "tab", ".", "get", "(", "key", ")", ";", "}", "else", "if", "(", "fail_when_missing", ")", "{", "throw", "new", "Error", "(", "\"no", "\"", "+", "(", "isGuard", "?", "\"guard\"", ":", "\"normal\"", ")", "+", "\"", "bif", "named", "\"", "+", "module", "+", "\":'\"", "+", "name", "+", "\"'/\"", "+", "parmTypes", ".", "length", ")", ";", "}", "else", "{", "return", "null", ";", "}", "return", "bif", ".", "getMethod", "(", "parmTypes", ")", ";", "}", "public", "static", "BuiltInFunction", "getMethod", "(", "String", "module", ",", "String", "name", ",", "Arg", "[", "]", "args", ",", "boolean", "isGuard", ",", "boolean", "fail_when_missing", ")", "{", "Type", "[", "]", "parms", "=", "new", "Type", "[", "args", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "parms", "[", "i", "]", "=", "args", "[", "i", "]", ".", "type", ";", "}", "return", "getMethod", "(", "module", ",", "name", ",", "parms", ",", "isGuard", ",", "fail_when_missing", ")", ";", "}", "public", "static", "BuiltInFunction", "getMethod", "(", "EAtom", "module", ",", "EAtom", "function", ",", "int", "arity", ",", "boolean", "isGuard", ",", "boolean", "failWhenMissing", ")", "{", "return", "getMethod", "(", "module", ".", "getName", "(", ")", ",", "function", ".", "getName", "(", ")", ",", "arity", ",", "isGuard", ",", "failWhenMissing", ")", ";", "}", "static", "long", "all_bif_hash", "=", "0", ";", "public", "static", "long", "all_bif_hash", "(", ")", "{", "if", "(", "all_bif_hash", "==", "0", ")", "{", "for", "(", "BIFHandler", "b", ":", "bifs", ".", "values", "(", ")", ")", "{", "all_bif_hash", "+=", "b", ".", "hashCode", "(", ")", ";", "}", "for", "(", "BIFHandler", "b", ":", "guard_bifs", ".", "values", "(", ")", ")", "{", "all_bif_hash", "+=", "b", ".", "hashCode", "(", ")", ";", "}", "}", "return", "all_bif_hash", ";", "}", "}", "</s>" ]
7,838
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EObject", ";", "public", "class", "ModuleAdapter", "implements", "ModuleVisitor", "{", "private", "final", "ModuleVisitor", "mv", ";", "public", "ModuleAdapter", "(", "ModuleVisitor", "mv", ")", "{", "this", ".", "mv", "=", "mv", ";", "}", "public", "void", "visitModule", "(", "EAtom", "name", ")", "{", "mv", ".", "visitModule", "(", "name", ")", ";", "}", "public", "void", "visitExport", "(", "EAtom", "fun", ",", "int", "arity", ",", "int", "entry", ")", "{", "mv", ".", "visitExport", "(", "fun", ",", "arity", ",", "entry", ")", ";", "}", "public", "void", "visitAttribute", "(", "EAtom", "att", ",", "EObject", "value", ")", "{", "mv", ".", "visitAttribute", "(", "att", ",", "value", ")", ";", "}", "@", "Override", "public", "void", "declareFunction", "(", "EAtom", "fun", ",", "int", "arity", ",", "int", "label", ")", "{", "mv", ".", "declareFunction", "(", "fun", ",", "arity", ",", "label", ")", ";", "}", "public", "FunctionVisitor", "visitFunction", "(", "EAtom", "name", ",", "int", "arity", ",", "int", "startLabel", ")", "{", "return", "mv", ".", "visitFunction", "(", "name", ",", "arity", ",", "startLabel", ")", ";", "}", "public", "void", "visitEnd", "(", ")", "{", "mv", ".", "visitEnd", "(", ")", ";", "}", "}", "</s>" ]
7,839
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "EOFException", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "regex", ".", "Matcher", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "java", ".", "util", ".", "zip", ".", "CRC32", ";", "import", "java", ".", "util", ".", "zip", ".", "CheckedInputStream", ";", "import", "kilim", ".", "analysis", ".", "ClassInfo", ";", "import", "kilim", ".", "analysis", ".", "ClassWeaver", ";", "import", "kilim", ".", "analysis", ".", "Detector", ";", "import", "kilim", ".", "mirrors", ".", "ClassMirrorNotFoundException", ";", "import", "kilim", ".", "mirrors", ".", "Mirrors", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "ClassWriter", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Opcodes", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "util", ".", "CheckClassAdapter", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpAuthException", ";", "import", "erjang", ".", "EBinary", ";", "import", "erjang", ".", "EFun", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "beam", ".", "analysis", ".", "BeamTypeAnalysis", ";", "import", "erjang", ".", "ErjangCodeCache", ";", "import", "erjang", ".", "beam", ".", "loader", ".", "ErjangBeamDisLoader", ";", "public", "class", "Compiler", "implements", "Opcodes", "{", "private", "ClassRepo", "classRepo", ";", "public", "Compiler", "(", "ClassRepo", "repo", ")", "throws", "OtpAuthException", ",", "IOException", "{", "this", ".", "classRepo", "=", "repo", ";", "}", "public", "static", "void", "compile", "(", "BeamFileData", "data", ",", "ClassRepo", "repo", ")", "throws", "IOException", "{", "ClassWeaver", ".", "reset", "(", ")", ";", "ClassWriter", "cw", "=", "new", "ClassWriter", "(", "true", ")", ";", "CompilerVisitor", "cv", "=", "new", "CompilerVisitor", "(", "cw", ",", "repo", ")", ";", "BeamTypeAnalysis", "analysis", "=", "new", "BeamTypeAnalysis", "(", "cv", ")", ";", "ModuleAnalyzer", "ma", "=", "new", "ModuleAnalyzer", "(", ")", ";", "data", ".", "accept", "(", "ma", ")", ";", "cv", ".", "setFunInfos", "(", "ma", ".", "getFunInfos", "(", ")", ")", ";", "try", "{", "data", ".", "accept", "(", "analysis", ")", ";", "}", "catch", "(", "Error", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "byte", "[", "]", "byteArray", "=", "cw", ".", "toByteArray", "(", ")", ";", "repo", ".", "store", "(", "\"raw/\"", "+", "cv", ".", "getInternalClassName", "(", ")", ",", "byteArray", ")", ";", "boolean", "written", "=", "false", ";", "ClassWeaver", "cwe", "=", "new", "ClassWeaver", "(", "byteArray", ",", "new", "ErjangDetector", "(", "cv", ".", "getInternalClassName", "(", ")", ",", "cv", ".", "non_pausable_methods", ")", ")", ";", "for", "(", "ClassInfo", "ci", ":", "cwe", ".", "getClassInfos", "(", ")", ")", "{", "String", "name", "=", "ci", ".", "className", ";", "byte", "[", "]", "bytes", "=", "ci", ".", "bytes", ";", "String", "iname", "=", "name", ".", "replace", "(", "'.'", ",", "'/'", ")", ";", "if", "(", "iname", ".", "equals", "(", "cv", ".", "getInternalClassName", "(", ")", ")", ")", "{", "written", "=", "true", ";", "}", "repo", ".", "store", "(", "iname", ",", "bytes", ")", ";", "}", "if", "(", "!", "written", ")", "{", "repo", ".", "store", "(", "cv", ".", "getInternalClassName", "(", ")", ",", "byteArray", ")", ";", "}", "}", "public", "void", "compile", "(", "File", "file", ",", "BeamLoader", "beam_parser", ")", "throws", "IOException", "{", "EBinary", "eb", "=", "EUtil", ".", "readFile", "(", "file", ")", ";", "BeamFileData", "bfd", "=", "beam_parser", ".", "load", "(", "eb", ".", "getByteArray", "(", ")", ")", ";", "compile", "(", "bfd", ",", "this", ".", "classRepo", ")", ";", "}", "static", "public", "class", "ErjangDetector", "extends", "Detector", "{", "private", "final", "String", "className", ";", "private", "final", "Set", "<", "String", ">", "nonPausableMethods", ";", "public", "ErjangDetector", "(", "String", "className", ",", "Set", "<", "String", ">", "nonPausableMethods", ")", "{", "super", "(", "Mirrors", ".", "getRuntimeMirrors", "(", ")", ")", ";", "this", ".", "className", "=", "className", ";", "this", ".", "nonPausableMethods", "=", "nonPausableMethods", ";", "}", "static", "Pattern", "FUN", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "@", "Override", "public", "ArrayList", "<", "String", ">", "getSuperClasses", "(", "String", "cc", ")", "throws", "ClassMirrorNotFoundException", "{", "Matcher", "m", "=", "FUN", ".", "matcher", "(", "cc", ")", ";", "if", "(", "m", ".", "matches", "(", ")", ")", "{", "int", "arity", "=", "Integer", ".", "parseInt", "(", "m", ".", "group", "(", "1", ")", ")", ";", "ArrayList", "<", "String", ">", "result", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "result", ".", "add", "(", "EFun", ".", "class", ".", "getName", "(", ")", "+", "arity", ")", ";", "result", ".", "add", "(", "EFun", ".", "class", ".", "getName", "(", ")", ")", ";", "result", ".", "add", "(", "EObject", ".", "class", ".", "getName", "(", ")", ")", ";", "result", ".", "add", "(", "Object", ".", "class", ".", "getName", "(", ")", ")", ";", "return", "result", ";", "}", "return", "super", ".", "getSuperClasses", "(", "cc", ")", ";", "}", "@", "Override", "public", "int", "getPausableStatus", "(", "String", "className", ",", "String", "methodName", ",", "String", "desc", ")", "{", "if", "(", "className", ".", "startsWith", "(", "CompilerVisitor", ".", "ETUPLE_NAME", ")", ")", "{", "return", "Detector", ".", "METHOD_NOT_PAUSABLE", ";", "}", "if", "(", "className", ".", "startsWith", "(", "CompilerVisitor", ".", "EFUN_NAME", ")", ")", "{", "if", "(", "methodName", ".", "equals", "(", "\"go\"", ")", ")", "return", "Detector", ".", "PAUSABLE_METHOD_FOUND", ";", "if", "(", "methodName", ".", "equals", "(", "\"invoke\"", ")", ")", "return", "Detector", ".", "PAUSABLE_METHOD_FOUND", ";", "return", "Detector", ".", "METHOD_NOT_PAUSABLE", ";", "}", "if", "(", "className", ".", "equals", "(", "this", ".", "className", ")", ")", "{", "if", "(", "methodName", ".", "endsWith", "(", "\"$tail\"", ")", ")", "return", "Detector", ".", "METHOD_NOT_PAUSABLE", ";", "if", "(", "methodName", ".", "endsWith", "(", "\"init>\"", ")", ")", "return", "Detector", ".", "METHOD_NOT_PAUSABLE", ";", "if", "(", "methodName", ".", "equals", "(", "\"module_name\"", ")", ")", "return", "Detector", ".", "METHOD_NOT_PAUSABLE", ";", "if", "(", "nonPausableMethods", ".", "contains", "(", "methodName", ")", ")", "return", "Detector", ".", "METHOD_NOT_PAUSABLE", ";", "return", "Detector", ".", "PAUSABLE_METHOD_FOUND", ";", "}", "return", "super", ".", "getPausableStatus", "(", "className", ",", "methodName", ",", "desc", ")", ";", "}", "}", "public", "static", "String", "moduleClassName", "(", "String", "moduleName", ")", "{", "String", "cn", "=", "EUtil", ".", "toJavaIdentifier", "(", "moduleName", ")", ";", "String", "base", "=", "\"erjang/m/\"", "+", "cn", "+", "\"/\"", "+", "cn", ";", "return", "base", ";", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "File", "out_dir", "=", "new", "File", "(", "\"\"", ")", ";", "out_dir", ".", "mkdirs", "(", ")", ";", "BeamLoader", "beamParser", "=", "new", "ErjangBeamDisLoader", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "if", "(", "args", "[", "i", "]", ".", "endsWith", "(", "\".beam\"", ")", ")", "{", "File", "in", "=", "new", "File", "(", "args", "[", "i", "]", ")", ";", "if", "(", "!", "in", ".", "exists", "(", ")", "||", "!", "in", ".", "isFile", "(", ")", "||", "!", "in", ".", "canRead", "(", ")", ")", "throw", "new", "IOException", "(", "\"\"", "+", "in", ")", ";", "int", "idx", "=", "args", "[", "i", "]", ".", "lastIndexOf", "(", "'.'", ")", ";", "int", "idx0", "=", "args", "[", "i", "]", ".", "lastIndexOf", "(", "File", ".", "separator", ")", ";", "String", "shortName", "=", "args", "[", "i", "]", ".", "substring", "(", "idx0", "+", "1", ",", "idx", ")", ";", "File", "out", "=", "new", "File", "(", "out_dir", ",", "ErjangCodeCache", ".", "moduleJarFileName", "(", "shortName", ",", "crcFile", "(", "in", ")", ")", ")", ";", "JarClassRepo", "jcp", "=", "new", "JarClassRepo", "(", "out", ")", ";", "System", ".", "out", ".", "println", "(", "\"compiling", "\"", "+", "in", "+", "\"", "->", "\"", "+", "out", "+", "\"", "...\"", ")", ";", "new", "Compiler", "(", "jcp", ")", ".", "compile", "(", "in", ",", "beamParser", ")", ";", "jcp", ".", "close", "(", ")", ";", "}", "}", "}", "private", "static", "long", "crcFile", "(", "File", "file", ")", "throws", "IOException", "{", "CheckedInputStream", "cis", "=", "null", ";", "long", "fileSize", "=", "0", ";", "cis", "=", "new", "CheckedInputStream", "(", "new", "FileInputStream", "(", "file", ")", ",", "new", "CRC32", "(", ")", ")", ";", "try", "{", "byte", "[", "]", "buf", "=", "new", "byte", "[", "4", "*", "1024", "]", ";", "while", "(", "cis", ".", "read", "(", "buf", ")", ">=", "0", ")", ";", "return", "cis", ".", "getChecksum", "(", ")", ".", "getValue", "(", ")", ";", "}", "finally", "{", "cis", ".", "close", "(", ")", ";", "}", "}", "}", "</s>" ]
7,840
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "interface", "ClassRepo", "{", "void", "store", "(", "String", "internal_name", ",", "byte", "[", "]", "data", ")", "throws", "IOException", ";", "void", "close", "(", ")", "throws", "IOException", ";", "}", "</s>" ]
7,841
[ "<s>", "package", "erjang", ".", "beam", ".", "repr", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EBitString", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EString", ";", "public", "class", "CodeTables", "{", "protected", "EAtom", "[", "]", "atoms", ";", "protected", "EObject", "[", "]", "literals", ";", "protected", "ExtFun", "[", "]", "externalFuns", ";", "protected", "AnonFun", "[", "]", "anonymousFuns", ";", "protected", "byte", "[", "]", "stringpool", ";", "protected", "Map", "<", "Integer", ",", "FunctionInfo", ">", "functionMap", "=", "new", "HashMap", "<", "Integer", ",", "FunctionInfo", ">", "(", ")", ";", "public", "EAtom", "atom", "(", "int", "nr", ")", "{", "return", "atoms", "[", "nr", "-", "1", "]", ";", "}", "public", "EObject", "literal", "(", "int", "nr", ")", "{", "return", "literals", "[", "nr", "]", ";", "}", "public", "ExtFun", "extFun", "(", "int", "nr", ")", "{", "return", "externalFuns", "[", "nr", "]", ";", "}", "public", "AnonFun", "anonFun", "(", "int", "nr", ")", "{", "return", "anonymousFuns", "[", "nr", "]", ";", "}", "public", "EBitString", "bitstring", "(", "int", "start", ",", "int", "bits", ")", "{", "return", "EBitString", ".", "make", "(", "stringpool", ",", "start", ",", "bits", "/", "8", ",", "bits", "%", "8", ")", ";", "}", "public", "EString", "string", "(", "int", "start", ",", "int", "bytes", ")", "{", "return", "EString", ".", "make", "(", "stringpool", ",", "start", ",", "bytes", ")", ";", "}", "public", "EAtom", "moduleName", "(", ")", "{", "return", "atom", "(", "1", ")", ";", "}", "protected", "void", "addFunctionAtLabel", "(", "FunctionInfo", "fi", ")", "{", "assert", "(", "!", "functionMap", ".", "containsKey", "(", "fi", ".", "label", ")", ")", ";", "functionMap", ".", "put", "(", "fi", ".", "label", ",", "fi", ")", ";", "}", "public", "FunctionInfo", "functionAtLabel", "(", "int", "label", ")", "{", "return", "functionMap", ".", "get", "(", "label", ")", ";", "}", "}", "</s>" ]
7,842
[ "<s>", "package", "erjang", ".", "beam", ".", "repr", ";", "import", "java", ".", "util", ".", "List", ";", "import", "erjang", ".", "beam", ".", "BeamOpcode", ";", "import", "erjang", ".", "beam", ".", "ModuleVisitor", ";", "import", "erjang", ".", "beam", ".", "FunctionVisitor", ";", "import", "erjang", ".", "beam", ".", "BlockVisitor", ";", "import", "erjang", ".", "beam", ".", "CodeAtoms", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "beam", ".", "loader", ".", "Rewriter", ";", "public", "class", "FunctionRepr", "{", "protected", "FunctionInfo", "sig", ";", "protected", "List", "<", "Insn", ">", "body", ";", "public", "FunctionRepr", "(", "FunctionInfo", "sig", ",", "List", "<", "Insn", ">", "body", ")", "{", "this", ".", "sig", "=", "sig", ";", "this", ".", "body", "=", "body", ";", "}", "public", "void", "declare", "(", "ModuleVisitor", "mv", ")", "{", "mv", ".", "declareFunction", "(", "sig", ".", "fun", ",", "sig", ".", "arity", ",", "sig", ".", "label", ")", ";", "}", "public", "void", "accept", "(", "ModuleVisitor", "mv", ")", "{", "FunctionVisitor", "fv", "=", "mv", ".", "visitFunction", "(", "sig", ".", "fun", ",", "sig", ".", "arity", ",", "sig", ".", "label", ")", ";", "accept", "(", "fv", ")", ";", "}", "public", "void", "accept", "(", "FunctionVisitor", "fv", ")", "{", "BlockVisitor", "bv", "=", "null", ";", "for", "(", "Insn", "insn", ":", "body", ")", "{", "if", "(", "insn", ".", "opcode", "==", "BeamOpcode", ".", "label", ")", "{", "if", "(", "bv", "!=", "null", ")", "bv", ".", "visitEnd", "(", ")", ";", "bv", "=", "fv", ".", "visitLabeledBlock", "(", "(", "(", "Insn", ".", "I", ")", "insn", ")", ".", "i1", ")", ";", "}", "else", "{", "bv", ".", "visitInsn", "(", "insn", ")", ";", "}", "}", "if", "(", "bv", "!=", "null", ")", "bv", ".", "visitEnd", "(", ")", ";", "fv", ".", "visitEnd", "(", ")", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "EObject", "[", "]", "symBody", "=", "new", "EObject", "[", "body", ".", "size", "(", ")", "]", ";", "int", "i", "=", "0", ";", "for", "(", "Insn", "insn", ":", "body", ")", "{", "symBody", "[", "i", "++", "]", "=", "insn", ".", "toSymbolic", "(", ")", ";", "}", "ETuple", "fun", "=", "ETuple", ".", "make", "(", "CodeAtoms", ".", "FUNCTION_ATOM", ",", "sig", ".", "fun", ",", "new", "ESmall", "(", "sig", ".", "arity", ")", ",", "new", "ESmall", "(", "sig", ".", "label", ")", ",", "ESeq", ".", "fromArray", "(", "symBody", ")", ")", ";", "return", "fun", ";", "}", "public", "void", "rewrite", "(", "Rewriter", "rw", ")", "{", "rw", ".", "rewriteFunctionBody", "(", "body", ",", "sig", ")", ";", "}", "}", "</s>" ]
7,843
[ "<s>", "package", "erjang", ".", "beam", ".", "repr", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "ARITHFBIF_ATOM", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "ATOM_ATOM", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "BIF_ATOM", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "FIELD_FLAGS_ATOM", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "F_ATOM", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "GCBIF_ATOM", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "NOFAIL_ATOM", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "START_ATOM", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "TEST_ATOM", ";", "import", "erjang", ".", "EList", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "beam", ".", "BeamInstruction", ";", "import", "erjang", ".", "beam", ".", "BeamOpcode", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "AllocList", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "Atom", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "BitString", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "ByteString", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "DestinationOperand", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "Label", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "SelectList", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "SourceOperand", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "XReg", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "YReg", ";", "public", "class", "Insn", "implements", "BeamInstruction", "{", "protected", "final", "BeamOpcode", "opcode", ";", "public", "Insn", "(", "BeamOpcode", "opcode", ")", "{", "this", ".", "opcode", "=", "opcode", ";", "}", "public", "BeamOpcode", "opcode", "(", ")", "{", "return", "opcode", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "toSymbolic", "(", ")", ".", "toString", "(", ")", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "opcode", ".", "symbol", ";", "}", "public", "final", "ETuple", "toSymbolicTuple", "(", ")", "{", "EObject", "symInsn0", "=", "toSymbolic", "(", ")", ";", "ETuple", "symInsn", "=", "(", "symInsn0", "instanceof", "ETuple", ")", "?", "(", "(", "ETuple", ")", "symInsn0", ")", ":", "ETuple", ".", "make", "(", "symInsn0", ")", ";", "return", "symInsn", ";", "}", "private", "static", "EObject", "NOFAIL_REPR", "=", "ETuple", ".", "make", "(", "F_ATOM", ",", "new", "ESmall", "(", "0", ")", ")", ";", "private", "static", "EObject", "START_REPR", "=", "ETuple", ".", "make", "(", "ATOM_ATOM", ",", "START_ATOM", ")", ";", "static", "EObject", "labelToSymbolic", "(", "Label", "label", ")", "{", "return", "label", "==", "null", "?", "NOFAIL_REPR", ":", "label", ".", "toSymbolic", "(", ")", ";", "}", "static", "EObject", "labelToSymbolic_nf", "(", "Label", "label", ")", "{", "return", "label", "==", "null", "?", "NOFAIL_ATOM", ":", "label", ".", "toSymbolic", "(", ")", ";", "}", "static", "EObject", "bsFieldFlagsToSymbolic", "(", "int", "flags", ")", "{", "return", "ETuple", ".", "make", "(", "FIELD_FLAGS_ATOM", ",", "new", "ESmall", "(", "flags", ")", ")", ";", "}", "public", "static", "class", "I", "extends", "Insn", "{", "public", "final", "int", "i1", ";", "public", "I", "(", "BeamOpcode", "opcode", ",", "int", "i1", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "i1", "=", "i1", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "i1", ")", ")", ";", "}", "}", "public", "static", "class", "S", "extends", "Insn", "{", "public", "final", "SourceOperand", "src", ";", "public", "S", "(", "BeamOpcode", "opcode", ",", "SourceOperand", "src", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "src", "=", "src", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "src", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "D", "extends", "Insn", "{", "public", "final", "DestinationOperand", "dest", ";", "public", "D", "(", "BeamOpcode", "opcode", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "dest", "=", "dest", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "L", "extends", "Insn", "{", "public", "final", "Label", "label", ";", "public", "L", "(", "BeamOpcode", "opcode", ",", "Label", "label", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "label", "=", "label", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "F", "extends", "Insn", "{", "public", "final", "int", "anon_fun_no", ";", "public", "final", "AnonFun", "anon_fun", ";", "public", "F", "(", "BeamOpcode", "opcode", ",", "int", "anon_fun_no", ",", "AnonFun", "anon_fun", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "anon_fun_no", "=", "anon_fun_no", ";", "this", ".", "anon_fun", "=", "anon_fun", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "anon_fun", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "anon_fun_no", ")", ",", "new", "ESmall", "(", "anon_fun", ".", "old_uniq", ")", ",", "new", "ESmall", "(", "anon_fun", ".", "free_vars", ")", ")", ";", "}", "}", "public", "static", "class", "Y", "extends", "Insn", "{", "public", "final", "YReg", "y", ";", "public", "Y", "(", "BeamOpcode", "opcode", ",", "YReg", "y", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "y", "=", "y", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "y", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "By", "extends", "Insn", "{", "public", "final", "ByteString", "bin", ";", "public", "By", "(", "BeamOpcode", "opcode", ",", "ByteString", "bin", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "bin", "=", "bin", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "bin", ".", "byteLength", "(", ")", ")", ",", "bin", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "DI", "extends", "Insn", "{", "public", "final", "DestinationOperand", "dest", ";", "public", "final", "int", "i2", ";", "public", "final", "boolean", "is_saverestore", ";", "public", "DI", "(", "BeamOpcode", "opcode", ",", "DestinationOperand", "dest", ",", "int", "i2", ",", "boolean", "is_saverestore", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "dest", "=", "dest", ";", "this", ".", "i2", "=", "i2", ";", "this", ".", "is_saverestore", "=", "is_saverestore", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_saverestore", ")", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "dest", ".", "toSymbolic", "(", ")", ",", "(", "i2", "==", "-", "1", "?", "START_REPR", ":", "new", "ESmall", "(", "i2", ")", ")", ")", ";", "else", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "dest", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i2", ")", ")", ";", "}", "}", "public", "static", "class", "SD", "extends", "Insn", "{", "public", "final", "SourceOperand", "src", ";", "public", "final", "DestinationOperand", "dest", ";", "public", "SD", "(", "BeamOpcode", "opcode", ",", "SourceOperand", "src", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "src", "=", "src", ";", "this", ".", "dest", "=", "dest", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "src", ".", "toSymbolic", "(", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "LD", "extends", "L", "{", "public", "final", "DestinationOperand", "dest", ";", "public", "final", "boolean", "is_test", ";", "public", "LD", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ",", "label", ")", ";", "this", ".", "dest", "=", "dest", ";", "this", ".", "is_test", "=", "false", ";", "}", "public", "LD", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "DestinationOperand", "dest", ",", "boolean", "is_test", ")", "{", "super", "(", "opcode", ",", "label", ")", ";", "this", ".", "dest", "=", "dest", ";", "this", ".", "is_test", "=", "is_test", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_test", ")", "return", "ETuple", ".", "make", "(", "TEST_ATOM", ",", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "dest", ".", "toSymbolic", "(", ")", ")", ")", ";", "else", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "YL", "extends", "Insn", "{", "public", "final", "YReg", "y", ";", "public", "final", "Label", "label", ";", "public", "YL", "(", "BeamOpcode", "opcode", ",", "YReg", "y", ",", "Label", "label", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "y", "=", "y", ";", "this", ".", "label", "=", "label", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "y", ".", "toSymbolic", "(", ")", ",", "label", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "LS", "extends", "L", "{", "public", "final", "SourceOperand", "src", ";", "public", "final", "boolean", "is_test", ";", "public", "LS", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "SourceOperand", "src", ",", "boolean", "is_test", ")", "{", "super", "(", "opcode", ",", "label", ")", ";", "this", ".", "src", "=", "src", ";", "this", ".", "is_test", "=", "is_test", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_test", ")", "return", "ETuple", ".", "make", "(", "TEST_ATOM", ",", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "src", ".", "toSymbolic", "(", ")", ")", ")", ";", "else", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "src", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "II", "extends", "I", "{", "public", "final", "int", "i2", ";", "public", "II", "(", "BeamOpcode", "opcode", ",", "int", "i1", ",", "int", "i2", ")", "{", "super", "(", "opcode", ",", "i1", ")", ";", "this", ".", "i2", "=", "i2", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "i1", ")", ",", "new", "ESmall", "(", "i2", ")", ")", ";", "}", "}", "public", "static", "class", "IL", "extends", "I", "{", "public", "final", "Label", "label", ";", "public", "final", "boolean", "is_call", ";", "public", "final", "FunctionInfo", "functionAtLabel", ";", "public", "IL", "(", "BeamOpcode", "opcode", ",", "int", "i1", ",", "Label", "label", ",", "FunctionInfo", "fal", ")", "{", "super", "(", "opcode", ",", "i1", ")", ";", "this", ".", "label", "=", "label", ";", "this", ".", "is_call", "=", "true", ";", "this", ".", "functionAtLabel", "=", "fal", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_call", ")", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "i1", ")", ",", "functionAtLabel", ".", "toSymbolic", "(", ")", ")", ";", "else", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "i1", ")", ",", "label", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "SS", "extends", "Insn", "{", "public", "final", "SourceOperand", "src1", ",", "src2", ";", "public", "SS", "(", "BeamOpcode", "opcode", ",", "SourceOperand", "src1", ",", "SourceOperand", "src2", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "src1", "=", "src1", ";", "this", ".", "src2", "=", "src2", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "opcode", "==", "BeamOpcode", ".", "raise", ")", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "Label", "(", "0", ")", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "src1", ".", "toSymbolic", "(", ")", ",", "src2", ".", "toSymbolic", "(", ")", ")", ",", "XReg", ".", "get", "(", "0", ")", ".", "toSymbolic", "(", ")", ")", ";", "else", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "src1", ".", "toSymbolic", "(", ")", ",", "src2", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "AAI", "extends", "Insn", "{", "public", "final", "Atom", "a1", ",", "a2", ";", "public", "final", "int", "i3", ";", "public", "AAI", "(", "BeamOpcode", "opcode", ",", "Atom", "a1", ",", "Atom", "a2", ",", "int", "i3", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "a1", "=", "a1", ";", "this", ".", "a2", "=", "a2", ";", "this", ".", "i3", "=", "i3", ";", "}", "public", "ExtFun", "getExtFun", "(", ")", "{", "return", "new", "ExtFun", "(", "a1", ".", "getEAtom", "(", ")", ",", "a2", ".", "getEAtom", "(", ")", ",", "i3", ")", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "a1", ".", "toSymbolic", "(", ")", ",", "a2", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ")", ";", "}", "}", "public", "static", "class", "IE", "extends", "I", "{", "public", "final", "ExtFun", "ext_fun", ";", "public", "IE", "(", "BeamOpcode", "opcode", ",", "int", "i1", ",", "ExtFun", "ext_fun", ")", "{", "super", "(", "opcode", ",", "i1", ")", ";", "this", ".", "ext_fun", "=", "ext_fun", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "i1", ")", ",", "ext_fun", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "ID", "extends", "Insn", "{", "public", "final", "int", "i1", ";", "public", "final", "DestinationOperand", "dest", ";", "public", "ID", "(", "BeamOpcode", "opcode", ",", "int", "i1", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "i1", "=", "i1", ";", "this", ".", "dest", "=", "dest", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "i1", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "WI", "extends", "Insn", "{", "public", "final", "AllocList", "alist", ";", "public", "final", "int", "i2", ";", "public", "WI", "(", "BeamOpcode", "opcode", ",", "AllocList", "alist", ",", "int", "i2", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "alist", "=", "alist", ";", "this", ".", "i2", "=", "i2", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "alist", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i2", ")", ")", ";", "}", "}", "public", "static", "class", "IWI", "extends", "I", "{", "public", "final", "int", "i3", ";", "public", "final", "AllocList", "al", ";", "public", "IWI", "(", "BeamOpcode", "opcode", ",", "int", "i1", ",", "AllocList", "al", ",", "int", "i3", ")", "{", "super", "(", "opcode", ",", "i1", ")", ";", "this", ".", "al", "=", "al", ";", "this", ".", "i3", "=", "i3", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "i1", ")", ",", "al", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ")", ";", "}", "}", "public", "static", "class", "LDI", "extends", "LD", "{", "public", "final", "int", "i", ";", "public", "LDI", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "DestinationOperand", "dest", ",", "int", "i", ",", "boolean", "is_test", ")", "{", "super", "(", "opcode", ",", "label", ",", "dest", ",", "is_test", ")", ";", "this", ".", "i", "=", "i", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_test", ")", "return", "ETuple", ".", "make", "(", "TEST_ATOM", ",", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "dest", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i", ")", ")", ")", ";", "else", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "dest", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i", ")", ")", ";", "}", "}", "public", "static", "class", "SID", "extends", "Insn", "{", "public", "final", "SourceOperand", "src", ";", "public", "final", "int", "i", ";", "public", "final", "DestinationOperand", "dest", ";", "public", "SID", "(", "BeamOpcode", "opcode", ",", "SourceOperand", "src", ",", "int", "i", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "src", "=", "src", ";", "this", ".", "i", "=", "i", ";", "this", ".", "dest", "=", "dest", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "src", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "LSS", "extends", "L", "{", "public", "final", "SourceOperand", "src1", ",", "src2", ";", "public", "final", "boolean", "is_test", ";", "public", "LSS", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "SourceOperand", "src1", ",", "SourceOperand", "src2", ",", "boolean", "is_test", ")", "{", "super", "(", "opcode", ",", "label", ")", ";", "this", ".", "src1", "=", "src1", ";", "this", ".", "src2", "=", "src2", ";", "this", ".", "is_test", "=", "is_test", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_test", ")", "return", "ETuple", ".", "make", "(", "TEST_ATOM", ",", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "src1", ".", "toSymbolic", "(", ")", ",", "src2", ".", "toSymbolic", "(", ")", ")", ")", ";", "else", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "src1", ".", "toSymbolic", "(", ")", ",", "src2", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "LDS", "extends", "LD", "{", "public", "final", "SourceOperand", "src", ";", "public", "LDS", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "DestinationOperand", "dest", ",", "SourceOperand", "src", ",", "boolean", "is_test", ")", "{", "super", "(", "opcode", ",", "label", ",", "dest", ",", "is_test", ")", ";", "this", ".", "src", "=", "src", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_test", ")", "return", "ETuple", ".", "make", "(", "TEST_ATOM", ",", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "dest", ".", "toSymbolic", "(", ")", ",", "src", ".", "toSymbolic", "(", ")", ")", ")", ";", "else", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "dest", ".", "toSymbolic", "(", ")", ",", "src", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "LSD", "extends", "Insn", "{", "public", "final", "Label", "label", ";", "public", "final", "SourceOperand", "src", ";", "public", "final", "DestinationOperand", "dest", ";", "public", "LSD", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "SourceOperand", "src", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "label", "=", "label", ";", "this", ".", "src", "=", "src", ";", "this", ".", "dest", "=", "dest", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "src", ".", "toSymbolic", "(", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "SDD", "extends", "Insn", "{", "public", "final", "SourceOperand", "src", ";", "public", "final", "DestinationOperand", "dest1", ";", "public", "final", "DestinationOperand", "dest2", ";", "public", "SDD", "(", "BeamOpcode", "opcode", ",", "SourceOperand", "src", ",", "DestinationOperand", "dest1", ",", "DestinationOperand", "dest2", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "src", "=", "src", ";", "this", ".", "dest1", "=", "dest1", ";", "this", ".", "dest2", "=", "dest2", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "src", ".", "toSymbolic", "(", ")", ",", "dest1", ".", "toSymbolic", "(", ")", ",", "dest2", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "SSD", "extends", "Insn", "{", "public", "final", "SourceOperand", "src1", ";", "public", "final", "SourceOperand", "src2", ";", "public", "final", "DestinationOperand", "dest", ";", "public", "SSD", "(", "BeamOpcode", "opcode", ",", "SourceOperand", "src1", ",", "SourceOperand", "src2", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "src1", "=", "src1", ";", "this", ".", "src2", "=", "src2", ";", "this", ".", "dest", "=", "dest", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "src1", ".", "toSymbolic", "(", ")", ",", "src2", ".", "toSymbolic", "(", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "SDI", "extends", "Insn", "{", "public", "final", "SourceOperand", "src", ";", "public", "final", "DestinationOperand", "dest", ";", "public", "final", "int", "i", ";", "public", "SDI", "(", "BeamOpcode", "opcode", ",", "SourceOperand", "src", ",", "DestinationOperand", "dest", ",", "int", "i", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "src", "=", "src", ";", "this", ".", "dest", "=", "dest", ";", "this", ".", "i", "=", "i", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "src", ".", "toSymbolic", "(", ")", ",", "dest", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i", ")", ")", ";", "}", "}", "public", "static", "class", "ILI", "extends", "IL", "{", "public", "final", "int", "i3", ";", "public", "final", "boolean", "is_call", ";", "public", "ILI", "(", "BeamOpcode", "opcode", ",", "int", "i1", ",", "Label", "label", ",", "int", "i3", ",", "FunctionInfo", "fal", ")", "{", "super", "(", "opcode", ",", "i1", ",", "label", ",", "fal", ")", ";", "this", ".", "i3", "=", "i3", ";", "this", ".", "is_call", "=", "true", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_call", ")", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "i1", ")", ",", "functionAtLabel", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ")", ";", "else", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "i1", ")", ",", "label", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ")", ";", "}", "}", "public", "static", "class", "IEI", "extends", "IE", "{", "public", "final", "int", "i3", ";", "public", "IEI", "(", "BeamOpcode", "opcode", ",", "int", "i1", ",", "ExtFun", "ext_fun", ",", "int", "i3", ")", "{", "super", "(", "opcode", ",", "i1", ",", "ext_fun", ")", ";", "this", ".", "i3", "=", "i3", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "i1", ")", ",", "ext_fun", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ")", ";", "}", "}", "public", "static", "class", "ByD", "extends", "Insn", "{", "public", "final", "ByteString", "bin", ";", "public", "final", "DestinationOperand", "dest", ";", "public", "ByD", "(", "BeamOpcode", "opcode", ",", "ByteString", "bin", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "bin", "=", "bin", ";", "this", ".", "dest", "=", "dest", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "new", "ESmall", "(", "bin", ".", "byteLength", "(", ")", ")", ",", "bin", ".", "toSymbolic", "(", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "LSSD", "extends", "Insn", "{", "public", "final", "Label", "label", ";", "public", "final", "SourceOperand", "src1", ";", "public", "final", "SourceOperand", "src2", ";", "public", "final", "DestinationOperand", "dest", ";", "public", "final", "boolean", "is_arithfbif", ";", "public", "LSSD", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "SourceOperand", "src1", ",", "SourceOperand", "src2", ",", "DestinationOperand", "dest", ",", "boolean", "is_arithfbif", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "label", "=", "label", ";", "this", ".", "src1", "=", "src1", ";", "this", ".", "src2", "=", "src2", ";", "this", ".", "dest", "=", "dest", ";", "this", ".", "is_arithfbif", "=", "is_arithfbif", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_arithfbif", ")", "return", "ETuple", ".", "make", "(", "ARITHFBIF_ATOM", ",", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "src1", ".", "toSymbolic", "(", ")", ",", "src2", ".", "toSymbolic", "(", ")", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "else", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "src1", ".", "toSymbolic", "(", ")", ",", "src2", ".", "toSymbolic", "(", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "LSSID", "extends", "Insn", "{", "public", "final", "Label", "label", ";", "public", "final", "SourceOperand", "src1", ";", "public", "final", "SourceOperand", "src2", ";", "public", "final", "int", "i3", ";", "public", "final", "DestinationOperand", "dest", ";", "public", "LSSID", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "SourceOperand", "src1", ",", "SourceOperand", "src2", ",", "int", "i3", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "label", "=", "label", ";", "this", ".", "src1", "=", "src1", ";", "this", ".", "src2", "=", "src2", ";", "this", ".", "i3", "=", "i3", ";", "this", ".", "dest", "=", "dest", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "src1", ".", "toSymbolic", "(", ")", ",", "src2", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "LDBi", "extends", "LD", "{", "public", "final", "BitString", "bin", ";", "public", "LDBi", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "DestinationOperand", "dest", ",", "BitString", "bin", ")", "{", "super", "(", "opcode", ",", "label", ",", "dest", ",", "true", ")", ";", "this", ".", "bin", "=", "bin", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "TEST_ATOM", ",", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "dest", ".", "toSymbolic", "(", ")", ",", "ERT", ".", "box", "(", "bin", ".", "bitLength", "(", ")", ")", ",", "bin", ".", "toSymbolic", "(", ")", ")", ")", ";", "}", "}", "public", "static", "class", "LDII", "extends", "LD", "{", "public", "final", "int", "i3", ",", "i4", ";", "public", "LDII", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "DestinationOperand", "dest", ",", "int", "i3", ",", "int", "i4", ")", "{", "super", "(", "opcode", ",", "label", ",", "dest", ",", "true", ")", ";", "this", ".", "i3", "=", "i3", ";", "this", ".", "i4", "=", "i4", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "TEST_ATOM", ",", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "dest", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ",", "bsFieldFlagsToSymbolic", "(", "i4", ")", ")", ")", ";", "}", "}", "public", "static", "class", "LSIIS", "extends", "Insn", "{", "public", "final", "Label", "label", ";", "public", "final", "SourceOperand", "src2", ",", "src5", ";", "public", "final", "int", "i3", ",", "i4", ";", "public", "final", "boolean", "is_bs", ";", "public", "LSIIS", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "SourceOperand", "src2", ",", "int", "i3", ",", "int", "i4", ",", "SourceOperand", "src5", ",", "boolean", "is_bs", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "label", "=", "label", ";", "this", ".", "src2", "=", "src2", ";", "this", ".", "i3", "=", "i3", ";", "this", ".", "i4", "=", "i4", ";", "this", ".", "src5", "=", "src5", ";", "this", ".", "is_bs", "=", "is_bs", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_bs", ")", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "src2", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ",", "bsFieldFlagsToSymbolic", "(", "i4", ")", ",", "src5", ".", "toSymbolic", "(", ")", ")", ";", "else", "throw", "new", "erjang", ".", "NotImplemented", "(", ")", ";", "}", "}", "public", "static", "class", "LIS", "extends", "Insn", "{", "public", "final", "Label", "label", ";", "public", "final", "int", "i2", ";", "public", "final", "SourceOperand", "src", ";", "public", "final", "boolean", "is_bsput", ";", "public", "LIS", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "int", "i2", ",", "SourceOperand", "src", ",", "boolean", "is_bsput", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "label", "=", "label", ";", "this", ".", "i2", "=", "i2", ";", "this", ".", "src", "=", "src", ";", "this", ".", "is_bsput", "=", "is_bsput", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_bsput", ")", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "bsFieldFlagsToSymbolic", "(", "i2", ")", ",", "src", ".", "toSymbolic", "(", ")", ")", ";", "else", "throw", "new", "erjang", ".", "NotImplemented", "(", ")", ";", "}", "}", "public", "static", "class", "LDIID", "extends", "LD", "{", "public", "final", "int", "i3", ",", "i4", ";", "public", "final", "DestinationOperand", "dest5", ";", "public", "final", "boolean", "i4_is_bsflags", ";", "public", "LDIID", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "DestinationOperand", "dest2", ",", "int", "i3", ",", "int", "i4", ",", "DestinationOperand", "dest5", ",", "boolean", "i4_is_bsflags", ")", "{", "super", "(", "opcode", ",", "label", ",", "dest2", ",", "true", ")", ";", "this", ".", "i3", "=", "i3", ";", "this", ".", "i4", "=", "i4", ";", "this", ".", "dest5", "=", "dest5", ";", "this", ".", "i4_is_bsflags", "=", "i4_is_bsflags", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "TEST_ATOM", ",", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "dest", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ",", "i4_is_bsflags", "?", "bsFieldFlagsToSymbolic", "(", "i4", ")", ":", "new", "ESmall", "(", "i4", ")", ",", "dest5", ".", "toSymbolic", "(", ")", ")", ")", ";", "}", "}", "public", "static", "class", "LSIIID", "extends", "Insn", "{", "public", "final", "Label", "label", ";", "public", "final", "SourceOperand", "src2", ";", "public", "final", "int", "i3", ",", "i4", ",", "i5", ";", "public", "final", "DestinationOperand", "dest", ";", "public", "final", "boolean", "is_bs", ";", "public", "LSIIID", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "SourceOperand", "src2", ",", "int", "i3", ",", "int", "i4", ",", "int", "i5", ",", "DestinationOperand", "dest", ",", "boolean", "is_bs", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "label", "=", "label", ";", "this", ".", "src2", "=", "src2", ";", "this", ".", "i3", "=", "i3", ";", "this", ".", "i4", "=", "i4", ";", "this", ".", "i5", "=", "i5", ";", "this", ".", "dest", "=", "dest", ";", "this", ".", "is_bs", "=", "is_bs", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_bs", ")", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "labelToSymbolic", "(", "label", ")", ",", "src2", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ",", "new", "ESmall", "(", "i4", ")", ",", "bsFieldFlagsToSymbolic", "(", "i5", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "else", "throw", "new", "erjang", ".", "NotImplemented", "(", ")", ";", "}", "}", "public", "static", "class", "LDSII", "extends", "LD", "{", "public", "final", "SourceOperand", "src3", ";", "public", "final", "int", "i4", ",", "i5", ";", "public", "LDSII", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "DestinationOperand", "dest", ",", "SourceOperand", "src3", ",", "int", "i4", ",", "int", "i5", ")", "{", "super", "(", "opcode", ",", "label", ",", "dest", ",", "true", ")", ";", "this", ".", "src3", "=", "src3", ";", "this", ".", "i4", "=", "i4", ";", "this", ".", "i5", "=", "i5", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "TEST_ATOM", ",", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "dest", ".", "toSymbolic", "(", ")", ",", "src3", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i4", ")", ",", "bsFieldFlagsToSymbolic", "(", "i5", ")", ")", ")", ";", "}", "}", "public", "static", "class", "LDISIID", "extends", "LD", "{", "public", "final", "int", "i3", ";", "public", "final", "SourceOperand", "src4", ";", "public", "final", "int", "i5", ",", "i6", ";", "public", "final", "DestinationOperand", "dest7", ";", "public", "LDISIID", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "DestinationOperand", "dest2", ",", "int", "i3", ",", "SourceOperand", "src4", ",", "int", "i5", ",", "int", "i6", ",", "DestinationOperand", "dest7", ")", "{", "super", "(", "opcode", ",", "label", ",", "dest2", ",", "true", ")", ";", "this", ".", "i3", "=", "i3", ";", "this", ".", "src4", "=", "src4", ";", "this", ".", "i5", "=", "i5", ";", "this", ".", "i6", "=", "i6", ";", "this", ".", "dest7", "=", "dest7", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "if", "(", "is_test", ")", "return", "ETuple", ".", "make", "(", "TEST_ATOM", ",", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "EList", ".", "make", "(", "dest", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ",", "src4", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i5", ")", ",", "bsFieldFlagsToSymbolic", "(", "i6", ")", ",", "dest7", ".", "toSymbolic", "(", ")", ")", ")", ";", "else", "throw", "new", "erjang", ".", "NotImplemented", "(", ")", ";", "}", "}", "public", "static", "class", "Bif", "extends", "Insn", "{", "public", "final", "Label", "label", ";", "public", "final", "ExtFun", "ext_fun", ";", "public", "final", "SourceOperand", "[", "]", "args", ";", "public", "final", "DestinationOperand", "dest", ";", "protected", "Bif", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "ExtFun", "ext_fun", ",", "SourceOperand", "[", "]", "args", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "label", "=", "label", ";", "this", ".", "ext_fun", "=", "ext_fun", ";", "this", ".", "dest", "=", "dest", ";", "this", ".", "args", "=", "args", ";", "}", "private", "static", "SourceOperand", "[", "]", "NO_ARGS", "=", "new", "SourceOperand", "[", "]", "{", "}", ";", "public", "Bif", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "ExtFun", "ext_fun", ",", "DestinationOperand", "dest", ")", "{", "this", "(", "opcode", ",", "label", ",", "ext_fun", ",", "NO_ARGS", ",", "dest", ")", ";", "}", "public", "Bif", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "ExtFun", "ext_fun", ",", "SourceOperand", "src", ",", "DestinationOperand", "dest", ")", "{", "this", "(", "opcode", ",", "label", ",", "ext_fun", ",", "new", "SourceOperand", "[", "]", "{", "src", "}", ",", "dest", ")", ";", "}", "public", "Bif", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "ExtFun", "ext_fun", ",", "SourceOperand", "src1", ",", "SourceOperand", "src2", ",", "DestinationOperand", "dest", ")", "{", "this", "(", "opcode", ",", "label", ",", "ext_fun", ",", "new", "SourceOperand", "[", "]", "{", "src1", ",", "src2", "}", ",", "dest", ")", ";", "}", "public", "SourceOperand", "[", "]", "argList", "(", ")", "{", "return", "args", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "BIF_ATOM", ",", "ext_fun", ".", "fun", ",", "labelToSymbolic_nf", "(", "label", ")", ",", "Operands", ".", "toSymbolicList", "(", "args", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "GcBif", "extends", "Insn", "{", "public", "final", "Label", "label", ";", "public", "final", "ExtFun", "ext_fun", ";", "public", "final", "int", "i", ";", "public", "final", "SourceOperand", "[", "]", "args", ";", "public", "final", "DestinationOperand", "dest", ";", "protected", "GcBif", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "ExtFun", "ext_fun", ",", "int", "i", ",", "SourceOperand", "[", "]", "args", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "label", "=", "label", ";", "this", ".", "ext_fun", "=", "ext_fun", ";", "this", ".", "i", "=", "i", ";", "this", ".", "args", "=", "args", ";", "this", ".", "dest", "=", "dest", ";", "}", "public", "GcBif", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "ExtFun", "ext_fun", ",", "int", "i", ",", "SourceOperand", "src", ",", "DestinationOperand", "dest", ")", "{", "this", "(", "opcode", ",", "label", ",", "ext_fun", ",", "i", ",", "new", "SourceOperand", "[", "]", "{", "src", "}", ",", "dest", ")", ";", "}", "public", "GcBif", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "ExtFun", "ext_fun", ",", "int", "i", ",", "SourceOperand", "src1", ",", "SourceOperand", "src2", ",", "DestinationOperand", "dest", ")", "{", "this", "(", "opcode", ",", "label", ",", "ext_fun", ",", "i", ",", "new", "SourceOperand", "[", "]", "{", "src1", ",", "src2", "}", ",", "dest", ")", ";", "}", "public", "SourceOperand", "[", "]", "argList", "(", ")", "{", "return", "args", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "GCBIF_ATOM", ",", "ext_fun", ".", "fun", ",", "label", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i", ")", ",", "Operands", ".", "toSymbolicList", "(", "args", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "Select", "extends", "Insn", "{", "public", "final", "SourceOperand", "src", ";", "public", "final", "Label", "defaultLabel", ";", "public", "final", "SelectList", "jumpTable", ";", "public", "Select", "(", "BeamOpcode", "opcode", ",", "SourceOperand", "src", ",", "Label", "defaultLabel", ",", "SelectList", "jumpTable", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "src", "=", "src", ";", "this", ".", "defaultLabel", "=", "defaultLabel", ";", "this", ".", "jumpTable", "=", "jumpTable", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "src", ".", "toSymbolic", "(", ")", ",", "defaultLabel", ".", "toSymbolic", "(", ")", ",", "jumpTable", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "BSAppend", "extends", "Insn", "{", "public", "final", "Label", "label", ";", "public", "final", "SourceOperand", "src2", ";", "public", "final", "int", "i3", ",", "i4", ",", "i5", ",", "i7", ";", "public", "final", "SourceOperand", "src6", ";", "public", "final", "DestinationOperand", "dest8", ";", "public", "BSAppend", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "SourceOperand", "src2", ",", "int", "i3", ",", "int", "i4", ",", "int", "i5", ",", "SourceOperand", "src6", ",", "int", "i7", ",", "DestinationOperand", "dest8", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "label", "=", "label", ";", "this", ".", "src2", "=", "src2", ";", "this", ".", "i3", "=", "i3", ";", "this", ".", "i4", "=", "i4", ";", "this", ".", "i5", "=", "i5", ";", "this", ".", "src6", "=", "src6", ";", "this", ".", "i7", "=", "i7", ";", "this", ".", "dest8", "=", "dest8", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "src2", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ",", "new", "ESmall", "(", "i4", ")", ",", "new", "ESmall", "(", "i5", ")", ",", "src6", ".", "toSymbolic", "(", ")", ",", "bsFieldFlagsToSymbolic", "(", "i7", ")", ",", "dest8", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "static", "class", "BSPrivateAppend", "extends", "Insn", "{", "public", "final", "Label", "label", ";", "public", "final", "SourceOperand", "src2", ",", "src4", ";", "public", "final", "int", "i3", ",", "i5", ";", "public", "final", "DestinationOperand", "dest", ";", "public", "BSPrivateAppend", "(", "BeamOpcode", "opcode", ",", "Label", "label", ",", "SourceOperand", "src2", ",", "int", "i3", ",", "SourceOperand", "src4", ",", "int", "i5", ",", "DestinationOperand", "dest", ")", "{", "super", "(", "opcode", ")", ";", "this", ".", "label", "=", "label", ";", "this", ".", "src2", "=", "src2", ";", "this", ".", "i3", "=", "i3", ";", "this", ".", "src4", "=", "src4", ";", "this", ".", "i5", "=", "i5", ";", "this", ".", "dest", "=", "dest", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "opcode", ".", "symbol", ",", "label", ".", "toSymbolic", "(", ")", ",", "src2", ".", "toSymbolic", "(", ")", ",", "new", "ESmall", "(", "i3", ")", ",", "src4", ".", "toSymbolic", "(", ")", ",", "bsFieldFlagsToSymbolic", "(", "i5", ")", ",", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "}", "</s>" ]
7,844
[ "<s>", "package", "erjang", ".", "beam", ".", "repr", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EBinary", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ESmall", ";", "public", "class", "AnonFun", "{", "public", "final", "EAtom", "mod", ",", "fun", ";", "public", "final", "int", "total_arity", ",", "free_vars", ";", "public", "final", "int", "label", ";", "public", "final", "int", "index", ";", "public", "final", "int", "old_uniq", ";", "public", "final", "int", "old_index", ";", "public", "final", "EBinary", "mod_md5", ";", "public", "AnonFun", "(", "EAtom", "mod", ",", "EAtom", "fun", ",", "int", "arity", ",", "int", "label", ",", "int", "old_uniq", ",", "int", "old_index", ",", "EBinary", "mod_md5", ",", "int", "index", ",", "int", "free_vars", ")", "{", "this", ".", "mod", "=", "mod", ";", "this", ".", "fun", "=", "fun", ";", "this", ".", "total_arity", "=", "arity", ";", "this", ".", "free_vars", "=", "free_vars", ";", "this", ".", "label", "=", "label", ";", "this", ".", "index", "=", "index", ";", "this", ".", "old_index", "=", "old_index", ";", "this", ".", "old_uniq", "=", "old_uniq", ";", "this", ".", "mod_md5", "=", "mod_md5", ";", "}", "public", "ExtFun", "asExtFun", "(", ")", "{", "return", "new", "ExtFun", "(", "mod", ",", "fun", ",", "total_arity", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "fun", "+", "\"/\"", "+", "total_arity", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "mod", ",", "fun", ",", "new", "ESmall", "(", "total_arity", ")", ")", ";", "}", "}", "</s>" ]
7,845
[ "<s>", "package", "erjang", ".", "beam", ".", "repr", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "beam", ".", "BeamFileData", ";", "import", "erjang", ".", "beam", ".", "CodeAtoms", ";", "import", "erjang", ".", "beam", ".", "ModuleVisitor", ";", "import", "erjang", ".", "beam", ".", "loader", ".", "Rewriter", ";", "public", "class", "ModuleRepr", "implements", "BeamFileData", "{", "static", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.beam\"", ")", ";", "private", "EAtom", "moduleName", ";", "private", "final", "CodeTables", "ct", ";", "private", "final", "FunctionInfo", "[", "]", "exports", ";", "private", "final", "FunctionRepr", "[", "]", "functions", ";", "private", "ESeq", "attributes", ";", "private", "ESeq", "compilation_info", ";", "public", "ModuleRepr", "(", "CodeTables", "ct", ",", "EAtom", "moduleName", ",", "FunctionInfo", "[", "]", "exports", ",", "ESeq", "attributes", ",", "ESeq", "comp_info", ",", "FunctionRepr", "[", "]", "functions", ")", "{", "this", ".", "moduleName", "=", "moduleName", ";", "this", ".", "ct", "=", "ct", ";", "this", ".", "exports", "=", "exports", ";", "this", ".", "attributes", "=", "attributes", ";", "this", ".", "compilation_info", "=", "comp_info", ";", "this", ".", "functions", "=", "functions", ";", "}", "public", "void", "accept", "(", "ModuleVisitor", "v", ")", "{", "v", ".", "visitModule", "(", "moduleName", ")", ";", "visit_exports", "(", "v", ")", ";", "visit_attributes", "(", "v", ")", ";", "try", "{", "for", "(", "FunctionRepr", "fun", ":", "functions", ")", "fun", ".", "declare", "(", "v", ")", ";", "for", "(", "FunctionRepr", "fun", ":", "functions", ")", "fun", ".", "accept", "(", "v", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "log", ".", "severe", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "log", ".", "log", "(", "Level", ".", "FINE", ",", "\"details:", "\"", ",", "e", ")", ";", "throw", "(", "e", ")", ";", "}", "finally", "{", "v", ".", "visitEnd", "(", ")", ";", "}", "}", "private", "void", "visit_attributes", "(", "ModuleVisitor", "v", ")", "{", "for", "(", "ESeq", "exp", "=", "(", "ESeq", ")", "attributes", ";", "exp", "!=", "ERT", ".", "NIL", ";", "exp", "=", "exp", ".", "tail", "(", ")", ")", "{", "ETuple", "attr", "=", "(", "ETuple", ")", "exp", ".", "head", "(", ")", ";", "v", ".", "visitAttribute", "(", "(", "EAtom", ")", "attr", ".", "elm", "(", "1", ")", ",", "attr", ".", "elm", "(", "2", ")", ")", ";", "}", "}", "private", "void", "visit_exports", "(", "ModuleVisitor", "v", ")", "{", "for", "(", "FunctionInfo", "exp", ":", "exports", ")", "{", "v", ".", "visitExport", "(", "exp", ".", "fun", ",", "exp", ".", "arity", ",", "exp", ".", "label", ")", ";", "}", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "CodeAtoms", ".", "BEAM_FILE_ATOM", ",", "moduleName", ",", "symbolicExportList", "(", ")", ",", "symbolicAttributes", "(", ")", ",", "compilation_info", ",", "symbolicCode", "(", ")", ")", ";", "}", "public", "EObject", "symbolicAttributes", "(", ")", "{", "EObject", "[", "]", "attrs", "=", "attributes", ".", "toArray", "(", ")", ";", "Arrays", ".", "sort", "(", "attrs", ",", "EObject", ".", "ERLANG_ORDERING", ")", ";", "return", "ESeq", ".", "fromArray", "(", "attrs", ")", ";", "}", "public", "ESeq", "symbolicExportList", "(", ")", "{", "ArrayList", "<", "EObject", ">", "symExports", "=", "new", "ArrayList", "<", "EObject", ">", "(", "exports", ".", "length", ")", ";", "int", "i", "=", "0", ";", "for", "(", "FunctionInfo", "f", ":", "exports", ")", "{", "symExports", ".", "add", "(", "ETuple", ".", "make", "(", "f", ".", "fun", ",", "new", "ESmall", "(", "f", ".", "arity", ")", ",", "new", "ESmall", "(", "f", ".", "label", ")", ")", ")", ";", "}", "Collections", ".", "sort", "(", "symExports", ",", "EObject", ".", "ERLANG_ORDERING", ")", ";", "return", "ESeq", ".", "fromList", "(", "symExports", ")", ";", "}", "public", "ESeq", "symbolicCode", "(", ")", "{", "ArrayList", "<", "ETuple", ">", "symFunctions", "=", "new", "ArrayList", "<", "ETuple", ">", "(", "functions", ".", "length", ")", ";", "for", "(", "FunctionRepr", "fun", ":", "functions", ")", "{", "symFunctions", ".", "add", "(", "fun", ".", "toSymbolic", "(", ")", ")", ";", "}", "return", "ESeq", ".", "fromList", "(", "symFunctions", ")", ";", "}", "public", "void", "rewrite", "(", "Rewriter", "rw", ")", "{", "for", "(", "FunctionRepr", "f", ":", "functions", ")", "{", "f", ".", "rewrite", "(", "rw", ")", ";", "}", "}", "}", "</s>" ]
7,846
[ "<s>", "package", "erjang", ".", "beam", ".", "repr", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "EBig", ";", "import", "erjang", ".", "EDouble", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "EString", ";", "import", "erjang", ".", "EBitString", ";", "import", "erjang", ".", "ERT", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "math", ".", "BigInteger", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "*", ";", "public", "class", "Operands", "{", "public", "static", "abstract", "class", "Operand", "{", "public", "SourceOperand", "asSource", "(", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "this", ")", ";", "}", "public", "DestinationOperand", "asDestination", "(", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "this", ")", ";", "}", "public", "Label", "asLabel", "(", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "this", ")", ";", "}", "public", "Literal", "asLiteral", "(", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "this", ")", ";", "}", "public", "Atom", "asAtom", "(", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "this", ")", ";", "}", "public", "CodeInt", "asCodeInt", "(", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "this", ")", ";", "}", "public", "SelectList", "asSelectList", "(", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "this", ")", ";", "}", "public", "AllocList", "asAllocList", "(", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "this", ")", ";", "}", "public", "YReg", "asYReg", "(", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "this", ")", ";", "}", "public", "TableLiteral", "testTableLiteral", "(", ")", "{", "return", "null", ";", "}", "public", "Atom", "testAtom", "(", ")", "{", "return", "null", ";", "}", "public", "Int", "testInt", "(", ")", "{", "return", "null", ";", "}", "public", "BigInt", "testBigInt", "(", ")", "{", "return", "null", ";", "}", "public", "Float", "testFloat", "(", ")", "{", "return", "null", ";", "}", "public", "SelectList", "testSelectList", "(", ")", "{", "return", "null", ";", "}", "public", "AllocList", "testAllocList", "(", ")", "{", "return", "null", ";", "}", "public", "DestinationOperand", "testDestination", "(", ")", "{", "return", "null", ";", "}", "public", "XReg", "testXReg", "(", ")", "{", "return", "null", ";", "}", "public", "YReg", "testYReg", "(", ")", "{", "return", "null", ";", "}", "public", "FReg", "testFReg", "(", ")", "{", "return", "null", ";", "}", "public", "abstract", "EObject", "toSymbolic", "(", ")", ";", "}", "public", "static", "ESeq", "toSymbolicList", "(", "Operand", "[", "]", "args", ")", "{", "ESeq", "res", "=", "ERT", ".", "NIL", ";", "for", "(", "int", "i", "=", "args", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "res", "=", "res", ".", "cons", "(", "args", "[", "i", "]", ".", "toSymbolic", "(", ")", ")", ";", "}", "return", "res", ";", "}", "public", "static", "abstract", "class", "SourceOperand", "extends", "Operand", "{", "@", "Override", "public", "SourceOperand", "asSource", "(", ")", "{", "return", "this", ";", "}", "}", "public", "static", "abstract", "class", "DestinationOperand", "extends", "SourceOperand", "{", "@", "Override", "public", "DestinationOperand", "asDestination", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "public", "DestinationOperand", "testDestination", "(", ")", "{", "return", "this", ";", "}", "}", "public", "static", "abstract", "class", "Literal", "extends", "SourceOperand", "{", "@", "Override", "public", "Literal", "asLiteral", "(", ")", "{", "return", "this", ";", "}", "public", "abstract", "EObject", "literalValue", "(", ")", ";", "}", "public", "static", "Literal", "makeInt", "(", "byte", "[", "]", "d", ")", "{", "BigInteger", "tmp", "=", "new", "BigInteger", "(", "d", ")", ";", "return", "(", "d", ".", "length", "<=", "4", ")", "?", "new", "Int", "(", "tmp", ".", "intValue", "(", ")", ")", ":", "new", "BigInt", "(", "tmp", ")", ";", "}", "public", "static", "class", "CodeInt", "extends", "Operand", "{", "public", "final", "int", "value", ";", "public", "CodeInt", "(", "int", "value", ")", "{", "this", ".", "value", "=", "value", ";", "}", "@", "Override", "public", "CodeInt", "asCodeInt", "(", ")", "{", "return", "this", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "new", "ESmall", "(", "value", ")", ";", "}", "}", "public", "static", "class", "Int", "extends", "Literal", "{", "public", "final", "int", "value", ";", "public", "Int", "(", "int", "value", ")", "{", "this", ".", "value", "=", "value", ";", "}", "public", "boolean", "equals", "(", "int", "val", ")", "{", "return", "value", "==", "val", ";", "}", "@", "Override", "public", "Int", "testInt", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "public", "EObject", "literalValue", "(", ")", "{", "return", "new", "ESmall", "(", "value", ")", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "INTEGER_ATOM", ",", "new", "ESmall", "(", "value", ")", ")", ";", "}", "}", "public", "static", "class", "BigInt", "extends", "Literal", "{", "public", "final", "BigInteger", "value", ";", "public", "BigInt", "(", "BigInteger", "value", ")", "{", "this", ".", "value", "=", "value", ";", "}", "@", "Override", "public", "BigInt", "testBigInt", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "public", "EObject", "literalValue", "(", ")", "{", "return", "new", "EBig", "(", "value", ")", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "INTEGER_ATOM", ",", "new", "EBig", "(", "value", ")", ")", ";", "}", "}", "public", "static", "class", "Float", "extends", "Literal", "{", "public", "final", "double", "value", ";", "public", "Float", "(", "double", "value", ")", "{", "this", ".", "value", "=", "value", ";", "}", "@", "Override", "public", "Float", "testFloat", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "public", "EObject", "literalValue", "(", ")", "{", "return", "new", "EDouble", "(", "value", ")", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "FLOAT_ATOM", ",", "new", "EDouble", "(", "value", ")", ")", ";", "}", "}", "public", "static", "final", "Nil", "Nil", "=", "new", "Nil", "(", ")", ";", "public", "static", "class", "Nil", "extends", "Literal", "{", "private", "Nil", "(", ")", "{", "}", "@", "Override", "public", "EObject", "literalValue", "(", ")", "{", "return", "ERT", ".", "NIL", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "NIL_ATOM", ";", "}", "}", "public", "static", "class", "SelectList", "extends", "Operand", "{", "Operand", "[", "]", "list", ";", "public", "SelectList", "(", "Operand", "[", "]", "list", ")", "{", "this", ".", "list", "=", "list", ";", "}", "@", "Override", "public", "SelectList", "asSelectList", "(", ")", "{", "return", "this", ";", "}", "public", "int", "size", "(", ")", "{", "return", "list", ".", "length", "/", "2", ";", "}", "public", "Operand", "getValue", "(", "int", "i", ")", "{", "return", "list", "[", "2", "*", "i", "]", ";", "}", "public", "Label", "getLabel", "(", "int", "i", ")", "{", "return", "(", "Label", ")", "list", "[", "2", "*", "i", "+", "1", "]", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "EObject", "[", "]", "elems", "=", "new", "EObject", "[", "list", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "length", ";", "i", "++", ")", "{", "elems", "[", "i", "]", "=", "list", "[", "i", "]", ".", "toSymbolic", "(", ")", ";", "}", "return", "ETuple", ".", "make", "(", "LIST_ATOM", ",", "ESeq", ".", "fromArray", "(", "elems", ")", ")", ";", "}", "}", "public", "static", "class", "AllocList", "extends", "Operand", "{", "static", "final", "int", "WORDS", "=", "0", ";", "static", "final", "int", "FLOATS", "=", "1", ";", "int", "[", "]", "list", ";", "public", "AllocList", "(", "int", "[", "]", "list", ")", "{", "this", ".", "list", "=", "list", ";", "}", "public", "AllocList", "(", "int", "words", ")", "{", "list", "=", "new", "int", "[", "2", "]", ";", "list", "[", "0", "]", "=", "WORDS", ";", "list", "[", "1", "]", "=", "words", ";", "}", "@", "Override", "public", "AllocList", "asAllocList", "(", ")", "{", "return", "this", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "int", "len", "=", "list", ".", "length", "/", "2", ";", "if", "(", "len", "==", "1", "&&", "list", "[", "0", "]", "==", "WORDS", ")", "return", "new", "ESmall", "(", "list", "[", "1", "]", ")", ";", "EObject", "[", "]", "elems", "=", "new", "EObject", "[", "len", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "elems", "[", "i", "]", "=", "ETuple", ".", "make", "(", "kindToSymbolic", "(", "list", "[", "2", "*", "i", "]", ")", ",", "new", "ESmall", "(", "list", "[", "2", "*", "i", "+", "1", "]", ")", ")", ";", "}", "return", "ETuple", ".", "make", "(", "ALLOC_ATOM", ",", "ESeq", ".", "fromArray", "(", "elems", ")", ")", ";", "}", "protected", "EAtom", "kindToSymbolic", "(", "int", "kind", ")", "{", "switch", "(", "kind", ")", "{", "case", "WORDS", ":", "return", "WORDS_ATOM", ";", "case", "FLOATS", ":", "return", "FLOATS_ATOM", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "kind", ")", ";", "}", "}", "}", "public", "static", "class", "Atom", "extends", "Literal", "{", "private", "EAtom", "value", ";", "public", "Atom", "(", "EAtom", "value", ")", "{", "this", ".", "value", "=", "value", ";", "}", "@", "Override", "public", "Atom", "asAtom", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "public", "Atom", "testAtom", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "public", "EObject", "literalValue", "(", ")", "{", "return", "value", ";", "}", "public", "EAtom", "getEAtom", "(", ")", "{", "return", "value", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "ATOM_ATOM", ",", "value", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"atom:\"", "+", "value", ".", "toString", "(", ")", ";", "}", "}", "public", "static", "class", "BitString", "extends", "Literal", "{", "public", "final", "EBitString", "value", ";", "public", "BitString", "(", "EBitString", "value", ")", "{", "this", ".", "value", "=", "value", ";", "}", "@", "Override", "public", "EObject", "literalValue", "(", ")", "{", "return", "value", ";", "}", "public", "long", "bitLength", "(", ")", "{", "return", "value", ".", "bitSize", "(", ")", ";", "}", "@", "Override", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "value", ";", "}", "}", "public", "static", "class", "ByteString", "extends", "Literal", "{", "public", "final", "EString", "value", ";", "public", "ByteString", "(", "EString", "value", ")", "{", "this", ".", "value", "=", "value", ";", "}", "@", "Override", "public", "EObject", "literalValue", "(", ")", "{", "return", "value", ";", "}", "public", "int", "byteLength", "(", ")", "{", "return", "value", ".", "length", "(", ")", ";", "}", "@", "Override", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "STRING_ATOM", ",", "value", ")", ";", "}", "}", "public", "static", "class", "TableLiteral", "extends", "Literal", "{", "public", "final", "EObject", "value", ";", "public", "TableLiteral", "(", "EObject", "value", ")", "{", "this", ".", "value", "=", "value", ";", "}", "@", "Override", "public", "EObject", "literalValue", "(", ")", "{", "return", "value", ";", "}", "@", "Override", "public", "TableLiteral", "testTableLiteral", "(", ")", "{", "return", "this", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "LITERAL_ATOM", ",", "value", ")", ";", "}", "}", "public", "static", "class", "Label", "extends", "Operand", "{", "public", "final", "int", "nr", ";", "public", "Label", "(", "int", "nr", ")", "{", "this", ".", "nr", "=", "nr", ";", "}", "@", "Override", "public", "Label", "asLabel", "(", ")", "{", "return", "this", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "F_ATOM", ",", "new", "ESmall", "(", "nr", ")", ")", ";", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "return", "nr", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "Label", ")", "{", "Label", "lab", "=", "(", "Label", ")", "obj", ";", "return", "lab", ".", "nr", "==", "nr", ";", "}", "else", "{", "return", "false", ";", "}", "}", "}", "public", "static", "class", "XReg", "extends", "DestinationOperand", "{", "public", "final", "int", "nr", ";", "public", "XReg", "(", "int", "nr", ")", "{", "this", ".", "nr", "=", "nr", ";", "}", "@", "Override", "public", "XReg", "testXReg", "(", ")", "{", "return", "this", ";", "}", "private", "static", "ArrayList", "<", "XReg", ">", "cache", "=", "new", "ArrayList", "<", "XReg", ">", "(", ")", ";", "public", "static", "XReg", "get", "(", "int", "nr", ")", "{", "while", "(", "cache", ".", "size", "(", ")", "<=", "nr", ")", "{", "cache", ".", "add", "(", "new", "XReg", "(", "cache", ".", "size", "(", ")", ")", ")", ";", "}", "return", "cache", ".", "get", "(", "nr", ")", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "X_ATOM", ",", "new", "ESmall", "(", "nr", ")", ")", ";", "}", "}", "public", "static", "class", "YReg", "extends", "DestinationOperand", "{", "public", "final", "int", "nr", ";", "public", "YReg", "(", "int", "nr", ")", "{", "this", ".", "nr", "=", "nr", ";", "}", "@", "Override", "public", "YReg", "asYReg", "(", ")", "{", "return", "this", ";", "}", "@", "Override", "public", "YReg", "testYReg", "(", ")", "{", "return", "this", ";", "}", "private", "static", "ArrayList", "<", "YReg", ">", "cache", "=", "new", "ArrayList", "<", "YReg", ">", "(", ")", ";", "public", "static", "YReg", "get", "(", "int", "nr", ")", "{", "while", "(", "cache", ".", "size", "(", ")", "<=", "nr", ")", "{", "cache", ".", "add", "(", "new", "YReg", "(", "cache", ".", "size", "(", ")", ")", ")", ";", "}", "return", "cache", ".", "get", "(", "nr", ")", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "Y_ATOM", ",", "new", "ESmall", "(", "nr", ")", ")", ";", "}", "}", "public", "static", "class", "FReg", "extends", "DestinationOperand", "{", "public", "final", "int", "nr", ";", "public", "FReg", "(", "int", "nr", ")", "{", "this", ".", "nr", "=", "nr", ";", "}", "@", "Override", "public", "FReg", "testFReg", "(", ")", "{", "return", "this", ";", "}", "private", "static", "ArrayList", "<", "FReg", ">", "cache", "=", "new", "ArrayList", "<", "FReg", ">", "(", ")", ";", "public", "static", "FReg", "get", "(", "int", "nr", ")", "{", "while", "(", "cache", ".", "size", "(", ")", "<=", "nr", ")", "{", "cache", ".", "add", "(", "new", "FReg", "(", "cache", ".", "size", "(", ")", ")", ")", ";", "}", "return", "cache", ".", "get", "(", "nr", ")", ";", "}", "public", "EObject", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "FR_ATOM", ",", "new", "ESmall", "(", "nr", ")", ")", ";", "}", "}", "}", "</s>" ]
7,847
[ "<s>", "package", "erjang", ".", "beam", ".", "repr", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ESmall", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "EXTFUNC_ATOM", ";", "public", "class", "ExtFun", "{", "public", "final", "EAtom", "mod", ",", "fun", ";", "public", "final", "int", "arity", ";", "public", "ExtFun", "(", "EAtom", "mod", ",", "EAtom", "fun", ",", "int", "arity", ")", "{", "this", ".", "mod", "=", "mod", ";", "this", ".", "fun", "=", "fun", ";", "this", ".", "arity", "=", "arity", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "mod", "+", "\":\"", "+", "fun", "+", "\"/\"", "+", "arity", ";", "}", "public", "EAtom", "module", "(", ")", "{", "return", "mod", ";", "}", "public", "EAtom", "name", "(", ")", "{", "return", "fun", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "EXTFUNC_ATOM", ",", "mod", ",", "fun", ",", "new", "ESmall", "(", "arity", ")", ")", ";", "}", "}", "</s>" ]
7,848
[ "<s>", "package", "erjang", ".", "beam", ".", "repr", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ESmall", ";", "public", "class", "FunctionInfo", "{", "public", "final", "EAtom", "mod", ",", "fun", ";", "public", "final", "int", "arity", ",", "label", ";", "public", "FunctionInfo", "(", "EAtom", "mod", ",", "EAtom", "fun", ",", "int", "arity", ",", "int", "label", ")", "{", "this", ".", "mod", "=", "mod", ";", "this", ".", "fun", "=", "fun", ";", "this", ".", "arity", "=", "arity", ";", "this", ".", "label", "=", "label", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "mod", "+", "\":\"", "+", "fun", "+", "\"/\"", "+", "arity", ";", "}", "public", "ExtFun", "asExtFun", "(", ")", "{", "return", "new", "ExtFun", "(", "mod", ",", "fun", ",", "arity", ")", ";", "}", "public", "ETuple", "toSymbolic", "(", ")", "{", "return", "ETuple", ".", "make", "(", "mod", ",", "fun", ",", "new", "ESmall", "(", "arity", ")", ")", ";", "}", "}", "</s>" ]
7,849
[ "<s>", "package", "erjang", ".", "beam", ";", "public", "interface", "FunctionVisitor", "{", "void", "visitEnd", "(", ")", ";", "BlockVisitor", "visitLabeledBlock", "(", "int", "label", ")", ";", "}", "</s>" ]
7,850
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "erjang", ".", "EAtom", ";", "import", "java", ".", "util", ".", "EnumSet", ";", "public", "enum", "BeamOpcode", "{", "label", "(", "0x01", ")", ",", "func_info", "(", "0x02", ")", ",", "int_code_end", "(", "0x03", ")", ",", "call", "(", "0x04", ")", ",", "call_last", "(", "0x05", ")", ",", "call_only", "(", "0x06", ")", ",", "call_ext", "(", "0x07", ")", ",", "call_ext_last", "(", "0x08", ")", ",", "bif0", "(", "0x09", ")", ",", "bif1", "(", "0x0a", ")", ",", "bif2", "(", "0x0b", ")", ",", "allocate", "(", "0x0c", ")", ",", "allocate_heap", "(", "0x0d", ")", ",", "allocate_zero", "(", "0x0e", ")", ",", "allocate_heap_zero", "(", "0x0f", ")", ",", "test_heap", "(", "0x10", ")", ",", "init", "(", "0x11", ")", ",", "deallocate", "(", "0x12", ")", ",", "K_return", "(", "0x13", ")", ",", "send", "(", "0x14", ")", ",", "remove_message", "(", "0x15", ")", ",", "timeout", "(", "0x16", ")", ",", "loop_rec", "(", "0x17", ")", ",", "loop_rec_end", "(", "0x18", ")", ",", "wait", "(", "0x19", ")", ",", "wait_timeout", "(", "0x1a", ")", ",", "is_lt", "(", "0x27", ")", ",", "is_ge", "(", "0x28", ")", ",", "is_eq", "(", "0x29", ")", ",", "is_ne", "(", "0x2a", ")", ",", "is_eq_exact", "(", "0x2b", ")", ",", "is_ne_exact", "(", "0x2c", ")", ",", "is_integer", "(", "0x2d", ")", ",", "is_float", "(", "0x2e", ")", ",", "is_number", "(", "0x2f", ")", ",", "is_atom", "(", "0x30", ")", ",", "is_pid", "(", "0x31", ")", ",", "is_reference", "(", "0x32", ")", ",", "is_port", "(", "0x33", ")", ",", "is_nil", "(", "0x34", ")", ",", "is_binary", "(", "0x35", ")", ",", "is_list", "(", "0x37", ")", ",", "is_nonempty_list", "(", "0x38", ")", ",", "is_tuple", "(", "0x39", ")", ",", "test_arity", "(", "0x3a", ")", ",", "select_val", "(", "0x3b", ")", ",", "select_tuple_arity", "(", "0x3c", ")", ",", "jump", "(", "0x3d", ")", ",", "K_catch", "(", "0x3e", ")", ",", "catch_end", "(", "0x3f", ")", ",", "move", "(", "0x40", ")", ",", "get_list", "(", "0x41", ")", ",", "get_tuple_element", "(", "0x42", ")", ",", "set_tuple_element", "(", "0x43", ")", ",", "put_string", "(", "0x44", ")", ",", "put_list", "(", "0x45", ")", ",", "put_tuple", "(", "0x46", ")", ",", "put", "(", "0x47", ")", ",", "badmatch", "(", "0x48", ")", ",", "if_end", "(", "0x49", ")", ",", "case_end", "(", "0x4a", ")", ",", "call_fun", "(", "0x4b", ")", ",", "is_function", "(", "0x4d", ")", ",", "call_ext_only", "(", "0x4e", ")", ",", "bs_put_integer", "(", "0x59", ")", ",", "bs_put_binary", "(", "0x5a", ")", ",", "bs_put_float", "(", "0x5b", ")", ",", "bs_put_string", "(", "0x5c", ")", ",", "fclearerror", "(", "0x5e", ")", ",", "fcheckerror", "(", "0x5f", ")", ",", "fmove", "(", "0x60", ")", ",", "fconv", "(", "0x61", ")", ",", "fadd", "(", "0x62", ")", ",", "fsub", "(", "0x63", ")", ",", "fmul", "(", "0x64", ")", ",", "fdiv", "(", "0x65", ")", ",", "fnegate", "(", "0x66", ")", ",", "make_fun2", "(", "0x67", ")", ",", "K_try", "(", "0x68", ")", ",", "try_end", "(", "0x69", ")", ",", "try_case", "(", "0x6a", ")", ",", "try_case_end", "(", "0x6b", ")", ",", "raise", "(", "0x6c", ")", ",", "bs_init2", "(", "0x6d", ")", ",", "bs_bits_to_bytes", "(", "0x6e", ")", ",", "bs_add", "(", "0x6f", ")", ",", "apply", "(", "0x70", ")", ",", "apply_last", "(", "0x71", ")", ",", "is_boolean", "(", "0x72", ")", ",", "is_function2", "(", "0x73", ")", ",", "bs_start_match2", "(", "0x74", ")", ",", "bs_get_integer2", "(", "0x75", ")", ",", "bs_get_float2", "(", "0x76", ")", ",", "bs_get_binary2", "(", "0x77", ")", ",", "bs_skip_bits2", "(", "0x78", ")", ",", "bs_test_tail2", "(", "0x79", ")", ",", "bs_save2", "(", "0x7a", ")", ",", "bs_restore2", "(", "0x7b", ")", ",", "gc_bif1", "(", "0x7c", ")", ",", "gc_bif2", "(", "0x7d", ")", ",", "is_bitstr", "(", "0x81", ")", ",", "bs_context_to_binary", "(", "0x82", ")", ",", "bs_test_unit", "(", "0x83", ")", ",", "bs_match_string", "(", "0x84", ")", ",", "bs_init_writable", "(", "0x85", ")", ",", "bs_append", "(", "0x86", ")", ",", "bs_private_append", "(", "0x87", ")", ",", "trim", "(", "0x88", ")", ",", "bs_init_bits", "(", "0x89", ")", ",", "bs_get_utf8", "(", "0x8a", ")", ",", "bs_skip_utf8", "(", "0x8b", ")", ",", "bs_get_utf16", "(", "0x8c", ")", ",", "bs_skip_utf16", "(", "0x8d", ")", ",", "bs_get_utf32", "(", "0x8e", ")", ",", "bs_skip_utf32", "(", "0x8f", ")", ",", "bs_utf8_size", "(", "0x90", ")", ",", "bs_put_utf8", "(", "0x91", ")", ",", "bs_utf16_size", "(", "0x92", ")", ",", "bs_put_utf16", "(", "0x93", ")", ",", "bs_put_utf32", "(", "0x94", ")", ",", "on_load", "(", "0x95", ")", ",", "recv_mark", "(", "0x96", ")", ",", "recv_set", "(", "0x97", ")", ",", "test", ",", "bif", ",", "gc_bif", ",", "arithfbif", ",", "i_call_fun_last", "(", "0xF0", ")", ",", "NONE", ";", "public", "final", "EAtom", "symbol", "=", "EAtom", ".", "intern", "(", "name", "(", ")", ".", "startsWith", "(", "\"K_\"", ")", "?", "name", "(", ")", ".", "substring", "(", "2", ")", ":", "name", "(", ")", ")", ";", "public", "final", "int", "encoding", ";", "BeamOpcode", "(", ")", "{", "this", ".", "encoding", "=", "-", "1", ";", "}", "BeamOpcode", "(", "int", "encoding", ")", "{", "this", ".", "encoding", "=", "encoding", ";", "}", "static", "BeamOpcode", "[", "]", "decodeMap", ";", "static", "{", "decodeMap", "=", "new", "BeamOpcode", "[", "256", "]", ";", "for", "(", "BeamOpcode", "x", ":", "EnumSet", ".", "allOf", "(", "BeamOpcode", ".", "class", ")", ")", "if", "(", "x", ".", "encoding", ">=", "0", ")", "decodeMap", "[", "x", ".", "encoding", "]", "=", "x", ";", "}", "public", "static", "BeamOpcode", "decode", "(", "int", "opcode", ")", "{", "return", "decodeMap", "[", "opcode", "]", ";", "}", "static", "EAtom", "TRY", "=", "EAtom", ".", "intern", "(", "\"try\"", ")", ";", "static", "EAtom", "CATCH", "=", "EAtom", ".", "intern", "(", "\"catch\"", ")", ";", "static", "EAtom", "RETURN", "=", "EAtom", ".", "intern", "(", "\"return\"", ")", ";", "static", "public", "BeamOpcode", "get", "(", "EAtom", "sym", ")", "{", "String", "name", "=", "sym", ".", "getName", "(", ")", ";", "if", "(", "sym", "==", "TRY", ")", "return", "K_try", ";", "if", "(", "sym", "==", "CATCH", ")", "return", "K_catch", ";", "if", "(", "sym", "==", "RETURN", ")", "return", "K_return", ";", "return", "valueOf", "(", "name", ")", ";", "}", "}", "</s>" ]
7,851
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Collection", ";", "public", "class", "RamClassRepo", "implements", "ClassRepo", "{", "private", "final", "HashMap", "<", "String", ",", "byte", "[", "]", ">", "map", "=", "new", "HashMap", "(", ")", ";", "public", "RamClassRepo", "(", ")", "{", "}", "@", "Override", "public", "void", "store", "(", "String", "internalName", ",", "byte", "[", "]", "data", ")", "{", "map", ".", "put", "(", "internalName", ",", "data", ")", ";", "}", "@", "Override", "public", "void", "close", "(", ")", "{", "}", "public", "byte", "[", "]", "get", "(", "String", "className", ")", "{", "String", "pathName", "=", "className", ".", "replace", "(", "'.'", ",", "'/'", ")", ";", "return", "map", ".", "get", "(", "pathName", ")", ";", "}", "public", "Collection", "<", "Map", ".", "Entry", "<", "String", ",", "byte", "[", "]", ">", ">", "entrySet", "(", ")", "{", "return", "map", ".", "entrySet", "(", ")", ";", "}", "}", "</s>" ]
7,852
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "DataOutputStream", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "regex", ".", "Pattern", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EBinary", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "ExtFun", ";", "public", "class", "EUtil", "{", "static", "final", "Pattern", "SIMPLE_ID", "=", "Pattern", ".", "compile", "(", "\"\"", ")", ";", "private", "static", "final", "String", "EOBJECT_DESC", "=", "CompilerVisitor", ".", "EOBJECT_TYPE", ".", "getDescriptor", "(", ")", ";", "private", "static", "final", "String", "EPROC_DESC", "=", "CompilerVisitor", ".", "EPROC_TYPE", ".", "getDescriptor", "(", ")", ";", "static", "Map", "<", "Integer", ",", "String", ">", "signatures", "=", "new", "HashMap", "<", "Integer", ",", "String", ">", "(", ")", ";", "static", "Map", "<", "Integer", ",", "String", ">", "noproc_signatures", "=", "new", "HashMap", "<", "Integer", ",", "String", ">", "(", ")", ";", "public", "static", "String", "getSignature", "(", "int", "arity", ",", "boolean", "withProc", ")", "{", "Map", "<", "Integer", ",", "String", ">", "signatures", "=", "withProc", "?", "noproc_signatures", ":", "EUtil", ".", "signatures", ";", "String", "res", "=", "signatures", ".", "get", "(", "arity", ")", ";", "if", "(", "res", "==", "null", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "\"(\"", ")", ";", "if", "(", "withProc", ")", "{", "sb", ".", "append", "(", "EPROC_DESC", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "EOBJECT_DESC", ")", ";", "}", "sb", ".", "append", "(", "\")\"", ")", ";", "sb", ".", "append", "(", "EOBJECT_DESC", ")", ";", "signatures", ".", "put", "(", "arity", ",", "res", "=", "sb", ".", "toString", "(", ")", ")", ";", "}", "return", "res", ";", "}", "static", "String", "toJavaIdentifier", "(", "EAtom", "name", ")", "{", "return", "toJavaIdentifier", "(", "name", ".", "getName", "(", ")", ")", ";", "}", "static", "String", "toJavaIdentifier", "(", "String", "name", ")", "{", "if", "(", "SIMPLE_ID", ".", "matcher", "(", "name", ")", ".", "matches", "(", ")", ")", "return", "name", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "char", "c", ":", "name", ".", "toCharArray", "(", ")", ")", "{", "if", "(", "c", "==", "'$'", ")", "{", "sb", ".", "append", "(", "\"$$\"", ")", ";", "continue", ";", "}", "else", "if", "(", "sb", ".", "length", "(", ")", "==", "0", ")", "{", "if", "(", "Character", ".", "isJavaIdentifierStart", "(", "c", ")", ")", "{", "sb", ".", "append", "(", "c", ")", ";", "continue", ";", "}", "}", "else", "if", "(", "Character", ".", "isJavaIdentifierPart", "(", "c", ")", ")", "{", "sb", ".", "append", "(", "c", ")", ";", "continue", ";", "}", "try", "{", "sb", ".", "append", "(", "'$'", ")", ";", "ByteArrayOutputStream", "baro", "=", "new", "ByteArrayOutputStream", "(", "5", ")", ";", "DataOutputStream", "dao", "=", "new", "DataOutputStream", "(", "baro", ")", ";", "dao", ".", "writeUTF", "(", "new", "String", "(", "new", "char", "[", "]", "{", "c", "}", ")", ")", ";", "dao", ".", "close", "(", ")", ";", "byte", "[", "]", "data", "=", "baro", ".", "toByteArray", "(", ")", ";", "writeHexByte", "(", "sb", ",", "0xff", "&", "data", "[", "2", "]", ")", ";", "if", "(", "data", ".", "length", ">", "3", ")", "writeHexByte", "(", "sb", ",", "0xff", "&", "data", "[", "3", "]", ")", ";", "if", "(", "data", ".", "length", ">", "4", ")", "writeHexByte", "(", "sb", ",", "0xff", "&", "data", "[", "4", "]", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "Error", "(", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}", "private", "static", "void", "writeHexByte", "(", "StringBuilder", "sb", ",", "int", "b", ")", "{", "if", "(", "b", "<", "0x10", ")", "{", "sb", ".", "append", "(", "'0'", ")", ";", "}", "sb", ".", "append", "(", "Integer", ".", "toHexString", "(", "b", ")", ".", "toUpperCase", "(", ")", ")", ";", "}", "public", "static", "String", "plen", "(", "Object", "o", ")", "{", "String", "s", "=", "String", ".", "valueOf", "(", "o", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"_\"", ")", ";", "writeHexByte", "(", "sb", ",", "s", ".", "length", "(", ")", ")", ";", "sb", ".", "append", "(", "s", ")", ";", "return", "s", ".", "toString", "(", ")", ";", "}", "public", "static", "String", "getJavaName", "(", "EAtom", "fun", ",", "int", "arity", ")", "{", "String", "fname", "=", "fun", ".", "getName", "(", ")", ";", "if", "(", "fname", ".", "indexOf", "(", "\"__\"", ")", "==", "-", "1", ")", "{", "return", "toJavaIdentifier", "(", "fun", ".", "getName", "(", ")", "+", "\"__\"", "+", "arity", ")", ";", "}", "else", "{", "return", "toJavaIdentifier", "(", "plen", "(", "fun", ".", "getName", "(", ")", ")", "+", "\"__\"", "+", "arity", ")", ";", "}", "}", "public", "static", "String", "getJavaName", "(", "ExtFun", "fun", ")", "{", "return", "toJavaIdentifier", "(", "fun", ".", "mod", ")", "+", "\"__\"", "+", "getJavaName", "(", "fun", ".", "fun", ",", "fun", ".", "arity", ")", ";", "}", "public", "static", "String", "getFunClassName", "(", "Type", "self_type", ",", "ExtFun", "efun", ")", "{", "return", "self_type", ".", "getInternalName", "(", ")", "+", "\"$FN_\"", "+", "getJavaName", "(", "efun", ".", "fun", ",", "efun", ".", "arity", ")", ";", "}", "public", "static", "String", "getFunClassName", "(", "Type", "self_type", ",", "ExtFun", "efun", ",", "int", "freevars", ")", "{", "return", "self_type", ".", "getInternalName", "(", ")", "+", "\"$FN_\"", "+", "getJavaName", "(", "efun", ".", "fun", ",", "efun", ".", "arity", "-", "freevars", ")", ";", "}", "public", "static", "String", "getSignature", "(", "int", "arity", ",", "boolean", "withProc", ",", "Type", "returnType", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "\"(\"", ")", ";", "if", "(", "withProc", ")", "{", "sb", ".", "append", "(", "EPROC_DESC", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "EOBJECT_DESC", ")", ";", "}", "sb", ".", "append", "(", "\")\"", ")", ";", "sb", ".", "append", "(", "returnType", ".", "getDescriptor", "(", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}", "public", "static", "String", "decodeJavaName", "(", "String", "methodName", ")", "{", "int", "idx", ";", "if", "(", "(", "idx", "=", "methodName", ".", "indexOf", "(", "'$'", ")", ")", "==", "-", "1", ")", "return", "methodName", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "int", "start", "=", "0", ";", "while", "(", "idx", "!=", "-", "1", ")", "{", "sb", ".", "append", "(", "methodName", ".", "substring", "(", "start", ",", "idx", ")", ")", ";", "if", "(", "methodName", ".", "charAt", "(", "idx", "+", "1", ")", "==", "'$'", ")", "{", "sb", ".", "append", "(", "'$'", ")", ";", "start", "=", "idx", "+", "2", ";", "}", "else", "{", "String", "hex", "=", "methodName", ".", "substring", "(", "idx", "+", "1", ",", "idx", "+", "3", ")", ";", "char", "chval", ";", "try", "{", "chval", "=", "(", "char", ")", "Integer", ".", "parseInt", "(", "hex", ",", "16", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "chval", "=", "'?'", ";", "}", "sb", ".", "append", "(", "chval", ")", ";", "start", "=", "idx", "+", "3", ";", "}", "idx", "=", "methodName", ".", "indexOf", "(", "'$'", ",", "start", ")", ";", "}", "sb", ".", "append", "(", "methodName", ".", "substring", "(", "start", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}", "public", "static", "EBinary", "readFile", "(", "File", "file", ")", "throws", "IOException", "{", "int", "length", "=", "(", "int", ")", "file", ".", "length", "(", ")", ";", "byte", "[", "]", "data", "=", "new", "byte", "[", "length", "]", ";", "FileInputStream", "fi", "=", "new", "FileInputStream", "(", "file", ")", ";", "try", "{", "ByteArrayOutputStream", "bo", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "int", "read", "=", "0", ";", "while", "(", "read", "<", "length", ")", "{", "read", "+=", "fi", ".", "read", "(", "data", ",", "read", ",", "length", "-", "read", ")", ";", "}", "}", "finally", "{", "fi", ".", "close", "(", ")", ";", "}", "EBinary", "bin", "=", "new", "EBinary", "(", "data", ")", ";", "return", "bin", ";", "}", "}", "</s>" ]
7,853
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "erjang", ".", "EModule", ";", "import", "erjang", ".", "EModuleManager", ";", "import", "erjang", ".", "ENative", ";", "import", "erjang", ".", "EFun", ";", "import", "erjang", ".", "FunID", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EProc", ";", "import", "erjang", ".", "Export", ";", "import", "erjang", ".", "Import", ";", "import", "erjang", ".", "BIF", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Field", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Method", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Modifier", ";", "public", "abstract", "class", "ECompiledModule", "extends", "EModule", "{", "public", "ClassLoader", "getModuleClassLoader", "(", ")", "{", "return", "this", ".", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ";", "}", "public", "void", "registerImportsAndExports", "(", ")", "throws", "Exception", "{", "Class", "<", "?", "extends", "EModule", ">", "module_class", "=", "this", ".", "getClass", "(", ")", ";", "Field", "[", "]", "fields", "=", "module_class", ".", "getDeclaredFields", "(", ")", ";", "for", "(", "Field", "field", ":", "fields", ")", "{", "if", "(", "!", "Modifier", ".", "isStatic", "(", "field", ".", "getModifiers", "(", ")", ")", ")", "continue", ";", "Import", "imp", "=", "field", ".", "getAnnotation", "(", "Import", ".", "class", ")", ";", "if", "(", "imp", "!=", "null", ")", "{", "FunID", "f", "=", "new", "FunID", "(", "imp", ")", ";", "EModuleManager", ".", "add_import", "(", "f", ",", "new", "FieldBinder", "(", "field", ",", "f", ",", "module_name", "(", ")", ")", ")", ";", "continue", ";", "}", "Export", "exp", "=", "field", ".", "getAnnotation", "(", "Export", ".", "class", ")", ";", "if", "(", "exp", "!=", "null", ")", "{", "field", ".", "setAccessible", "(", "true", ")", ";", "EFun", "value", ";", "try", "{", "value", "=", "(", "EFun", ")", "field", ".", "get", "(", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "Error", "(", "e", ")", ";", "}", "if", "(", "value", "==", "null", ")", "throw", "new", "Error", "(", "\"field", "\"", "+", "field", "+", "\"\"", ")", ";", "FunID", "f", ";", "EModuleManager", ".", "add_export", "(", "this", ",", "f", "=", "new", "FunID", "(", "exp", ")", ",", "value", ")", ";", "continue", ";", "}", "}", "process_native_annotations", "(", "module_class", ")", ";", "String", "cname", "=", "module_class", ".", "getName", "(", ")", ";", "String", "nname", "=", "cname", ".", "substring", "(", "0", ",", "cname", ".", "lastIndexOf", "(", "'.'", ")", ")", "+", "\".Native\"", ";", "load_native_bifs", "(", ")", ";", "}", "}", "</s>" ]
7,854
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "FunID", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Insn", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Insn", ".", "IE", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Insn", ".", "IL", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Insn", ".", "ILI", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "Label", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "SourceOperand", ";", "public", "class", "ModuleAnalyzer", "implements", "ModuleVisitor", "{", "static", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"\"", ")", ";", "Map", "<", "Label", ",", "FunInfo", ">", "info", "=", "new", "HashMap", "<", "Label", ",", "FunInfo", ">", "(", ")", ";", "static", "class", "FunInfo", "{", "Set", "<", "FunInfo", ">", "callers", "=", "new", "HashSet", "<", "FunInfo", ">", "(", ")", ";", "Set", "<", "FunInfo", ">", "tail_callers", "=", "new", "HashSet", "<", "FunInfo", ">", "(", ")", ";", "FunID", "name", ";", "boolean", "may_return_tail_marker", ",", "is_pausable", ",", "call_is_pausable", ";", "public", "boolean", "exported", ";", "protected", "boolean", "is_called_locally_in_tail_position", ";", "protected", "boolean", "is_anon_fun", ";", "protected", "boolean", "is_called_locally_in_nontail_position", ";", "boolean", "mustHaveFun", "(", ")", "{", "return", "exported", "||", "is_called_locally_in_tail_position", "||", "is_anon_fun", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "(", "may_return_tail_marker", "?", "\"T\"", ":", "\"-\"", ")", "+", "(", "is_pausable", "?", "\"P\"", ":", "\"-\"", ")", "+", "\"", "\"", "+", "name", ";", "}", "void", "addCaller", "(", "FunInfo", "caller", ")", "{", "callers", ".", "add", "(", "caller", ")", ";", "}", "void", "addTailCaller", "(", "FunInfo", "caller", ")", "{", "tail_callers", ".", "add", "(", "caller", ")", ";", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "return", "name", ".", "hashCode", "(", ")", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "FunInfo", ")", "{", "FunInfo", "fi", "=", "(", "FunInfo", ")", "obj", ";", "return", "name", ".", "equals", "(", "fi", ".", "name", ")", ";", "}", "return", "false", ";", "}", "}", "void", "propagate", "(", ")", "{", "while", "(", "propagate_one", "(", ")", ")", ";", "}", "boolean", "propagate_one", "(", ")", "{", "boolean", "effect", "=", "false", ";", "for", "(", "FunInfo", "fun", ":", "info", ".", "values", "(", ")", ")", "{", "if", "(", "fun", ".", "is_pausable", "||", "fun", ".", "call_is_pausable", ")", "{", "for", "(", "FunInfo", "caller", ":", "fun", ".", "callers", ")", "{", "if", "(", "!", "caller", ".", "is_pausable", ")", "{", "effect", "=", "caller", ".", "is_pausable", "=", "true", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "log", ".", "fine", "(", "\"propagate", "\"", "+", "fun", "+", "\"", "->", "\"", "+", "caller", ")", ";", "}", "}", "}", "for", "(", "FunInfo", "caller", ":", "fun", ".", "tail_callers", ")", "{", "if", "(", "!", "caller", ".", "call_is_pausable", ")", "{", "effect", "=", "caller", ".", "call_is_pausable", "=", "true", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "log", ".", "fine", "(", "\"propagate", "\"", "+", "fun", "+", "\"", "->", "\"", "+", "caller", ")", ";", "}", "}", "}", "}", "}", "return", "effect", ";", "}", "FunInfo", "get", "(", "Label", "label", ")", "{", "FunInfo", "fi", "=", "info", ".", "get", "(", "label", ")", ";", "if", "(", "fi", "==", "null", ")", "{", "fi", "=", "new", "FunInfo", "(", ")", ";", "info", ".", "put", "(", "label", ",", "fi", ")", ";", "}", "return", "fi", ";", "}", "FunInfo", "get", "(", "EAtom", "fun", ",", "int", "arity", ",", "Label", "label", ")", "{", "FunInfo", "fi", "=", "get", "(", "label", ")", ";", "fi", ".", "name", "=", "new", "FunID", "(", "name", ",", "fun", ",", "arity", ")", ";", "return", "fi", ";", "}", "private", "EAtom", "name", ";", "@", "Override", "public", "void", "visitAttribute", "(", "EAtom", "att", ",", "EObject", "value", ")", "{", "}", "@", "Override", "public", "void", "visitExport", "(", "EAtom", "fun", ",", "int", "arity", ",", "int", "entry", ")", "{", "Label", "label", "=", "new", "Label", "(", "entry", ")", ";", "FunInfo", "fi", "=", "get", "(", "label", ")", ";", "fi", ".", "exported", "=", "true", ";", "}", "@", "Override", "public", "void", "visitEnd", "(", ")", "{", "propagate", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Label", ",", "FunInfo", ">", "e", ":", "info", ".", "entrySet", "(", ")", ")", "{", "log", ".", "fine", "(", "e", ".", "getValue", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "@", "Override", "public", "void", "declareFunction", "(", "EAtom", "fun", ",", "int", "arity", ",", "int", "startLabel", ")", "{", "Label", "label", "=", "new", "Label", "(", "startLabel", ")", ";", "get", "(", "fun", ",", "arity", ",", "label", ")", ";", "}", "@", "Override", "public", "FunctionVisitor", "visitFunction", "(", "EAtom", "name", ",", "int", "arity", ",", "final", "int", "startLabel", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "log", ".", "fine", "(", "\"\"", "+", "ModuleAnalyzer", ".", "this", ".", "name", "+", "\":\"", "+", "name", "+", "\"/\"", "+", "arity", ")", ";", "}", "Label", "start", "=", "new", "Label", "(", "startLabel", ")", ";", "final", "FunInfo", "self", "=", "get", "(", "name", ",", "arity", ",", "start", ")", ";", "return", "new", "FunctionVisitor", "(", ")", "{", "@", "Override", "public", "BlockVisitor", "visitLabeledBlock", "(", "int", "label", ")", "{", "return", "new", "BlockVisitor", "(", ")", "{", "@", "Override", "public", "void", "visitInsn", "(", "Insn", "insn", ")", "{", "BeamOpcode", "op", ";", "switch", "(", "op", "=", "insn", ".", "opcode", "(", ")", ")", "{", "case", "send", ":", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "!", "self", ".", "is_pausable", ")", "{", "log", ".", "fine", "(", "\"\"", ")", ";", "}", "self", ".", "is_pausable", "=", "true", ";", "break", ";", "}", "case", "call", ":", "{", "Insn", ".", "IL", "cl", "=", "(", "Insn", ".", "IL", ")", "insn", ";", "FunInfo", "target", "=", "get", "(", "cl", ".", "label", ")", ";", "BuiltInFunction", "bif", "=", "BIFUtil", ".", "getMethod", "(", "target", ".", "name", ".", "module", ",", "target", ".", "name", ".", "function", ",", "target", ".", "name", ".", "arity", ",", "false", ",", "false", ")", ";", "if", "(", "bif", "==", "null", ")", "{", "target", ".", "addCaller", "(", "self", ")", ";", "target", ".", "is_called_locally_in_nontail_position", "=", "true", ";", "}", "break", ";", "}", "case", "call_last", ":", "{", "ILI", "cl", "=", "(", "Insn", ".", "ILI", ")", "insn", ";", "boolean", "is_self_call", "=", "cl", ".", "label", ".", "nr", "==", "startLabel", ";", "self", ".", "may_return_tail_marker", "|=", "!", "is_self_call", ";", "FunInfo", "target", "=", "get", "(", "cl", ".", "label", ")", ";", "BuiltInFunction", "bif", "=", "BIFUtil", ".", "getMethod", "(", "target", ".", "name", ".", "module", ",", "target", ".", "name", ".", "function", ",", "target", ".", "name", ".", "arity", ",", "false", ",", "false", ")", ";", "if", "(", "bif", "==", "null", ")", "{", "target", ".", "addTailCaller", "(", "self", ")", ";", "target", ".", "is_called_locally_in_tail_position", "|=", "!", "is_self_call", ";", "}", "break", ";", "}", "case", "call_only", ":", "{", "IL", "cl", "=", "(", "Insn", ".", "IL", ")", "insn", ";", "boolean", "is_self_call", "=", "cl", ".", "label", ".", "nr", "==", "startLabel", ";", "self", ".", "may_return_tail_marker", "|=", "!", "is_self_call", ";", "FunInfo", "target", "=", "get", "(", "cl", ".", "label", ")", ";", "BuiltInFunction", "bif", "=", "BIFUtil", ".", "getMethod", "(", "target", ".", "name", ".", "module", ",", "target", ".", "name", ".", "function", ",", "target", ".", "name", ".", "arity", ",", "false", ",", "false", ")", ";", "if", "(", "bif", "==", "null", ")", "{", "target", ".", "addTailCaller", "(", "self", ")", ";", "target", ".", "is_called_locally_in_tail_position", "|=", "!", "is_self_call", ";", "}", "break", ";", "}", "case", "make_fun2", ":", "{", "Insn", ".", "F", "fi", "=", "(", "Insn", ".", "F", ")", "insn", ";", "Label", "anon", "=", "new", "Label", "(", "fi", ".", "anon_fun", ".", "label", ")", ";", "get", "(", "anon", ")", ".", "is_anon_fun", "=", "true", ";", "break", ";", "}", "case", "apply_last", ":", "case", "i_call_fun_last", ":", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "!", "self", ".", "call_is_pausable", ")", "{", "log", ".", "fine", "(", "\"\"", "+", "op", ")", ";", "}", "self", ".", "may_return_tail_marker", "=", "true", ";", "self", ".", "call_is_pausable", "=", "true", ";", "break", ";", "}", "case", "call_ext_last", ":", "case", "call_ext_only", ":", "{", "Insn", ".", "IE", "e", "=", "(", "IE", ")", "insn", ";", "String", "mod", "=", "e", ".", "ext_fun", ".", "mod", ".", "getName", "(", ")", ";", "String", "fun", "=", "e", ".", "ext_fun", ".", "fun", ".", "getName", "(", ")", ";", "int", "arity", "=", "e", ".", "ext_fun", ".", "arity", ";", "if", "(", "mod", ".", "equals", "(", "\"erlang\"", ")", "&&", "arity", "==", "1", "&&", "(", "fun", ".", "equals", "(", "\"throw\"", ")", "||", "fun", ".", "equals", "(", "\"error\"", ")", "||", "fun", ".", "equals", "(", "\"exit\"", ")", ")", ")", "{", "break", ";", "}", "}", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "!", "self", ".", "call_is_pausable", ")", "{", "log", ".", "fine", "(", "\"\"", "+", "op", ")", ";", "}", "self", ".", "may_return_tail_marker", "=", "true", ";", "self", ".", "call_is_pausable", "=", "true", ";", "case", "call_ext", ":", "if", "(", "self", ".", "is_pausable", ")", "{", "break", ";", "}", "Insn", ".", "IE", "e", "=", "(", "IE", ")", "insn", ";", "String", "mod", "=", "e", ".", "ext_fun", ".", "mod", ".", "getName", "(", ")", ";", "String", "fun", "=", "e", ".", "ext_fun", ".", "fun", ".", "getName", "(", ")", ";", "int", "arity", "=", "e", ".", "ext_fun", ".", "arity", ";", "BuiltInFunction", "bif", "=", "BIFUtil", ".", "getMethod", "(", "mod", ",", "fun", ",", "arity", ",", "false", ",", "false", ")", ";", "if", "(", "bif", "!=", "null", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "!", "self", ".", "is_pausable", "&&", "bif", ".", "isPausable", "(", ")", ")", "{", "log", ".", "fine", "(", "\"\"", "+", "bif", ".", "javaMethod", ")", ";", "}", "self", ".", "is_pausable", "|=", "bif", ".", "isPausable", "(", ")", ";", "}", "else", "if", "(", "op", "==", "BeamOpcode", ".", "call_ext", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "!", "self", ".", "is_pausable", ")", "{", "log", ".", "fine", "(", "\"\"", "+", "mod", "+", "\":\"", "+", "fun", "+", "\"/\"", "+", "arity", ")", ";", "}", "self", ".", "is_pausable", "=", "true", ";", "}", "break", ";", "case", "apply", ":", "case", "call_fun", ":", "case", "wait", ":", "case", "wait_timeout", ":", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "!", "self", ".", "is_pausable", ")", "{", "log", ".", "fine", "(", "\"pausable:", "\"", "+", "op", ")", ";", "}", "self", ".", "is_pausable", "=", "true", ";", "break", ";", "case", "bif", ":", "case", "bif0", ":", "case", "bif1", ":", "case", "bif2", ":", "{", "if", "(", "self", ".", "is_pausable", ")", "break", ";", "Insn", ".", "Bif", "bi", "=", "(", "Insn", ".", "Bif", ")", "insn", ";", "EAtom", "name", "=", "bi", ".", "ext_fun", ".", "fun", ";", "SourceOperand", "[", "]", "srcs", "=", "bi", ".", "args", ";", "bif", "=", "BIFUtil", ".", "getMethod", "(", "\"erlang\"", ",", "name", ".", "getName", "(", ")", ",", "srcs", ".", "length", ",", "false", ",", "true", ")", ";", "if", "(", "bif", "==", "null", ")", "{", "throw", "new", "Error", "(", "\"\"", "+", "bi", ".", "ext_fun", ")", ";", "}", "self", ".", "is_pausable", "|=", "bif", ".", "isPausable", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "self", ".", "is_pausable", ")", "{", "log", ".", "fine", "(", "\"\"", "+", "bif", ".", "javaMethod", ")", ";", "}", "}", "default", ":", "break", ";", "}", "}", "@", "Override", "public", "void", "visitEnd", "(", ")", "{", "}", "}", ";", "}", "@", "Override", "public", "void", "visitEnd", "(", ")", "{", "}", "}", ";", "}", "@", "Override", "public", "void", "visitModule", "(", "EAtom", "name", ")", "{", "this", ".", "name", "=", "name", ";", "}", "public", "Map", "<", "FunID", ",", "FunInfo", ">", "getFunInfos", "(", ")", "{", "Map", "<", "FunID", ",", "FunInfo", ">", "res", "=", "new", "HashMap", "<", "FunID", ",", "FunInfo", ">", "(", ")", ";", "for", "(", "FunInfo", "fi", ":", "info", ".", "values", "(", ")", ")", "{", "res", ".", "put", "(", "fi", ".", "name", ",", "fi", ")", ";", "}", "return", "res", ";", "}", "}", "</s>" ]
7,855
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "import", "erjang", ".", "EObject", ";", "public", "class", "Arg", "{", "public", "enum", "Kind", "{", "X", ",", "Y", ",", "F", ",", "IMMEDIATE", ",", "EXT_FUNC", ";", "public", "boolean", "isReg", "(", ")", "{", "return", "this", "==", "X", "||", "this", "==", "Y", "||", "this", "==", "F", ";", "}", "}", "public", "static", "final", "Arg", "[", "]", "NO_ARGS", "=", "new", "Arg", "[", "0", "]", ";", "public", "final", "Kind", "kind", ";", "int", "no", ";", "public", "Type", "type", ";", "EObject", "value", ";", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "kind", ".", "name", "(", ")", "+", "\"{#\"", "+", "no", "+", "\",", "val=\"", "+", "String", ".", "valueOf", "(", "value", ")", "+", "\",", "type=\"", "+", "String", ".", "valueOf", "(", "type", ")", "+", "\"}\"", ";", "}", "public", "Arg", "(", "Kind", "kind", ",", "int", "reg", ")", "{", "this", "(", "kind", ",", "reg", ",", "kind", "==", "Kind", ".", "F", "?", "Type", ".", "DOUBLE_TYPE", ":", "null", ")", ";", "}", "public", "Arg", "(", "Kind", "kind", ",", "int", "reg", ",", "Type", "type", ")", "{", "if", "(", "kind", "==", "Kind", ".", "IMMEDIATE", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "this", ".", "kind", "=", "kind", ";", "this", ".", "no", "=", "reg", ";", "this", ".", "type", "=", "type", ";", "}", "public", "Arg", "(", "EObject", "value", ")", "{", "this", ".", "kind", "=", "Kind", ".", "IMMEDIATE", ";", "this", ".", "value", "=", "value", ";", "this", ".", "type", "=", "Type", ".", "getType", "(", "value", ".", "getClass", "(", ")", ")", ";", "}", "public", "Arg", "(", "EObject", "value", ",", "Type", "type", ")", "{", "this", ".", "kind", "=", "Kind", ".", "IMMEDIATE", ";", "this", ".", "value", "=", "value", ";", "this", ".", "type", "=", "type", ";", "}", "public", "Arg", "(", "Arg", "arg1", ",", "Type", "type", ")", "{", "this", ".", "kind", "=", "arg1", ".", "kind", ";", "this", ".", "no", "=", "arg1", ".", "no", ";", "this", ".", "value", "=", "arg1", ".", "value", ";", "this", ".", "type", "=", "type", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "Arg", ")", "{", "Arg", "arg", "=", "(", "Arg", ")", "obj", ";", "return", "kind", "==", "arg", ".", "kind", "&&", "no", "==", "arg", ".", "no", "&&", "value", "==", "arg", ".", "value", ";", "}", "return", "false", ";", "}", "}", "</s>" ]
7,856
[ "<s>", "package", "erjang", ".", "beam", ";", "public", "class", "FunctionAdapter", "implements", "FunctionVisitor", "{", "protected", "final", "FunctionVisitor", "fv", ";", "public", "FunctionAdapter", "(", "FunctionVisitor", "fv", ")", "{", "this", ".", "fv", "=", "fv", ";", "}", "public", "void", "visitEnd", "(", ")", "{", "fv", ".", "visitEnd", "(", ")", ";", "}", "public", "BlockVisitor", "visitLabeledBlock", "(", "int", "label", ")", "{", "return", "fv", ".", "visitLabeledBlock", "(", "label", ")", ";", "}", "}", "</s>" ]
7,857
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "DirClassRepo", "implements", "ClassRepo", "{", "private", "File", "dir", ";", "public", "DirClassRepo", "(", "File", "dir", ")", "{", "this", ".", "dir", "=", "dir", ";", "dir", ".", "mkdirs", "(", ")", ";", "}", "@", "Override", "public", "void", "store", "(", "String", "internalName", ",", "byte", "[", "]", "data", ")", "throws", "IOException", "{", "File", "out", "=", "new", "File", "(", "dir", ",", "internalName", "+", "\".class\"", ")", ";", "File", "out_dir", "=", "out", ".", "getParentFile", "(", ")", ";", "out_dir", ".", "mkdirs", "(", ")", ";", "FileOutputStream", "fo", "=", "new", "FileOutputStream", "(", "out", ")", ";", "fo", ".", "write", "(", "data", ")", ";", "fo", ".", "close", "(", ")", ";", "}", "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "}", "}", "</s>" ]
7,858
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EList", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "NotImplemented", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "CodeTables", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Insn", ";", "public", "class", "SymbolicBeamFileData", "implements", "BeamFileData", "{", "private", "static", "final", "EAtom", "BEAM_FILE", "=", "EAtom", ".", "intern", "(", "\"beam_file\"", ")", ";", "private", "static", "final", "EAtom", "MODULE", "=", "EAtom", ".", "intern", "(", "\"module\"", ")", ";", "private", "static", "final", "EAtom", "EXPORTS", "=", "EAtom", ".", "intern", "(", "\"exports\"", ")", ";", "private", "static", "final", "EAtom", "ATTRIBUTES", "=", "EAtom", ".", "intern", "(", "\"attributes\"", ")", ";", "private", "static", "final", "EAtom", "COMP_INFO", "=", "EAtom", ".", "intern", "(", "\"comp_info\"", ")", ";", "private", "static", "final", "EAtom", "CODE", "=", "EAtom", ".", "intern", "(", "\"code\"", ")", ";", "private", "EAtom", "module", ";", "private", "ESeq", "exports", ";", "private", "ESeq", "attributes", ";", "private", "ESeq", "comp_info", ";", "private", "ESeq", "code", ";", "public", "SymbolicBeamFileData", "(", "ETuple", "data", ")", "{", "assert", "(", "data", ".", "elm", "(", "1", ")", "==", "BEAM_FILE", ")", ";", "module", "=", "data", ".", "elm", "(", "2", ")", ".", "testAtom", "(", ")", ";", "exports", "=", "data", ".", "elm", "(", "3", ")", ".", "testSeq", "(", ")", ";", "attributes", "=", "data", ".", "elm", "(", "4", ")", ".", "testSeq", "(", ")", ";", "comp_info", "=", "data", ".", "elm", "(", "5", ")", ".", "testSeq", "(", ")", ";", "code", "=", "data", ".", "elm", "(", "6", ")", ".", "testSeq", "(", ")", ";", "}", "public", "void", "accept", "(", "ModuleVisitor", "v", ")", "{", "v", ".", "visitModule", "(", "module", ")", ";", "visit_exports", "(", "v", ")", ";", "visit_attributes", "(", "v", ")", ";", "try", "{", "for", "(", "ESeq", "exp", "=", "(", "ESeq", ")", "code", ";", "exp", "!=", "ERT", ".", "NIL", ";", "exp", "=", "exp", ".", "tail", "(", ")", ")", "{", "ETuple", "fun", "=", "(", "ETuple", ")", "exp", ".", "head", "(", ")", ";", "visit_function", "(", "v", ",", "fun", ")", ";", "}", "}", "finally", "{", "v", ".", "visitEnd", "(", ")", ";", "}", "}", "private", "void", "visit_function", "(", "ModuleVisitor", "v", ",", "ETuple", "fun", ")", "{", "EAtom", "name", "=", "(", "EAtom", ")", "fun", ".", "elm", "(", "2", ")", ";", "int", "ary", "=", "fun", ".", "elm", "(", "3", ")", ".", "asInt", "(", ")", ";", "int", "entry", "=", "fun", ".", "elm", "(", "4", ")", ".", "asInt", "(", ")", ";", "EList", "insns", "=", "(", "EList", ")", "fun", ".", "elm", "(", "5", ")", ";", "FunctionVisitor", "fv", "=", "v", ".", "visitFunction", "(", "name", ",", "ary", ",", "entry", ")", ";", "visit_insns", "(", "insns", ",", "fv", ")", ";", "fv", ".", "visitEnd", "(", ")", ";", "}", "private", "void", "visit_insns", "(", "EList", "insns", ",", "FunctionVisitor", "fv", ")", "{", "throw", "new", "NotImplemented", "(", ")", ";", "}", "private", "void", "visit_attributes", "(", "ModuleVisitor", "v", ")", "{", "for", "(", "ESeq", "exp", "=", "(", "ESeq", ")", "attributes", ";", "exp", "!=", "ERT", ".", "NIL", ";", "exp", "=", "exp", ".", "tail", "(", ")", ")", "{", "ETuple", "one", "=", "(", "ETuple", ")", "exp", ".", "head", "(", ")", ";", "v", ".", "visitAttribute", "(", "(", "EAtom", ")", "one", ".", "elm", "(", "1", ")", ",", "one", ".", "elm", "(", "2", ")", ")", ";", "}", "}", "private", "void", "visit_exports", "(", "ModuleVisitor", "v", ")", "{", "for", "(", "ESeq", "exp", "=", "(", "ESeq", ")", "exports", ";", "exp", "!=", "ERT", ".", "NIL", ";", "exp", "=", "exp", ".", "tail", "(", ")", ")", "{", "ETuple", "one", "=", "(", "ETuple", ")", "exp", ".", "head", "(", ")", ";", "v", ".", "visitExport", "(", "(", "EAtom", ")", "one", ".", "elm", "(", "1", ")", ",", "one", ".", "elm", "(", "2", ")", ".", "asInt", "(", ")", ",", "one", ".", "elm", "(", "3", ")", ".", "asInt", "(", ")", ")", ";", "}", "}", "}", "</s>" ]
7,859
[ "<s>", "package", "erjang", ".", "beam", ".", "analysis", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "IPersistentMap", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "PersistentHashMap", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ETuple", ";", "class", "TypeMap", "{", "private", "static", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.beam\"", ")", ";", "private", "static", "Type", "TYPE_EOBJECT", "=", "Type", ".", "getType", "(", "EObject", ".", "class", ")", ";", "private", "static", "Type", "TYPE_ETUPLE", "=", "Type", ".", "getType", "(", "ETuple", ".", "class", ")", ";", "private", "static", "String", "ETUPLE_NAME", "=", "TYPE_ETUPLE", ".", "getInternalName", "(", ")", ";", "private", "static", "Type", "[", "]", "NO_TYPES", "=", "new", "Type", "[", "0", "]", ";", "private", "static", "IPersistentMap", "NO_XTYPES", "=", "PersistentHashMap", ".", "EMPTY", ";", "private", "final", "IPersistentMap", "xregs", ";", "private", "final", "Type", "[", "]", "yregs", ",", "fregs", ";", "final", "int", "stacksize", ";", "final", "BasicBlock", "bb", ";", "final", "ExceptionHandler", "exh", ";", "public", "TypeMap", "(", "BasicBlock", "bb", ")", "{", "xregs", "=", "NO_XTYPES", ";", "yregs", "=", "NO_TYPES", ";", "fregs", "=", "NO_TYPES", ";", "stacksize", "=", "0", ";", "this", ".", "bb", "=", "bb", ";", "exh", "=", "null", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"[\"", ")", ";", "boolean", "first", "=", "true", ";", "IPersistentMap", "xregs", "=", "this", ".", "xregs", ";", "first", "=", "printRegs", "(", "sb", ",", "first", ",", "(", "Map", "<", "Integer", ",", "Type", ">", ")", "xregs", ",", "'x'", ")", ";", "first", "=", "printRegs", "(", "sb", ",", "first", ",", "fregs", ",", "'f'", ")", ";", "first", "=", "printYRegs", "(", "sb", ",", "first", ")", ";", "sb", ".", "append", "(", "\",", "s=\"", "+", "stacksize", ")", ";", "sb", ".", "append", "(", "']'", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}", "private", "boolean", "printRegs", "(", "StringBuilder", "sb", ",", "boolean", "first", ",", "Type", "[", "]", "regs", ",", "char", "reg", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "regs", ".", "length", ";", "i", "++", ")", "{", "if", "(", "regs", "[", "i", "]", "!=", "null", ")", "{", "if", "(", "first", "==", "false", ")", "{", "sb", ".", "append", "(", "\",", "\"", ")", ";", "}", "else", "{", "first", "=", "false", ";", "}", "sb", ".", "append", "(", "reg", ")", ".", "append", "(", "i", ")", ".", "append", "(", "':'", ")", ";", "sb", ".", "append", "(", "shortName", "(", "regs", "[", "i", "]", ")", ")", ";", "}", "}", "return", "first", ";", "}", "private", "boolean", "printRegs", "(", "StringBuilder", "sb", ",", "boolean", "first", ",", "Map", "<", "Integer", ",", "Type", ">", "regs", ",", "char", "reg", ")", "{", "for", "(", "int", "i", ":", "regs", ".", "keySet", "(", ")", ")", "{", "if", "(", "regs", ".", "get", "(", "i", ")", "!=", "null", ")", "{", "if", "(", "first", "==", "false", ")", "{", "sb", ".", "append", "(", "\",", "\"", ")", ";", "}", "else", "{", "first", "=", "false", ";", "}", "sb", ".", "append", "(", "reg", ")", ".", "append", "(", "i", ")", ".", "append", "(", "':'", ")", ";", "sb", ".", "append", "(", "shortName", "(", "regs", ".", "get", "(", "i", ")", ")", ")", ";", "}", "}", "return", "first", ";", "}", "private", "boolean", "printYRegs", "(", "StringBuilder", "sb", ",", "boolean", "first", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "stacksize", ";", "i", "++", ")", "{", "if", "(", "i", ">=", "yregs", ".", "length", ")", "continue", ";", "if", "(", "yregs", "[", "i", "]", "!=", "null", ")", "{", "if", "(", "first", "==", "false", ")", "{", "sb", ".", "append", "(", "\",", "\"", ")", ";", "}", "else", "{", "first", "=", "false", ";", "}", "sb", ".", "append", "(", "'y'", ")", ".", "append", "(", "get_ypos", "(", "i", ")", ")", ".", "append", "(", "':'", ")", ";", "sb", ".", "append", "(", "shortName", "(", "yregs", "[", "i", "]", ")", ")", ";", "}", "}", "return", "first", ";", "}", "private", "String", "shortName", "(", "Type", "type", ")", "{", "if", "(", "type", ".", "getSort", "(", ")", "!=", "Type", ".", "OBJECT", ")", "{", "return", "type", ".", "getDescriptor", "(", ")", ";", "}", "String", "in", "=", "type", ".", "getInternalName", "(", ")", ";", "if", "(", "type", ".", "getSort", "(", ")", "==", "Type", ".", "OBJECT", ")", "{", "int", "idx", "=", "in", ".", "lastIndexOf", "(", "'/'", ")", ";", "String", "sh", "=", "in", ".", "substring", "(", "idx", "+", "1", ")", ";", "if", "(", "sh", ".", "length", "(", ")", ">", "6", "&&", "sh", ".", "startsWith", "(", "\"ETuple\"", ")", ")", "{", "return", "\"T\"", "+", "sh", ".", "substring", "(", "6", ")", ";", "}", "else", "{", "return", "sh", ".", "substring", "(", "1", ",", "3", ")", ";", "}", "}", "else", "{", "return", "in", ";", "}", "}", "private", "TypeMap", "(", "IPersistentMap", "xregs", ",", "Type", "[", "]", "yregs", ",", "Type", "[", "]", "fregs", ",", "int", "stacksize", ",", "BasicBlock", "bb", ",", "ExceptionHandler", "exh", ")", "{", "super", "(", ")", ";", "this", ".", "xregs", "=", "xregs", ";", "this", ".", "yregs", "=", "yregs", ";", "this", ".", "fregs", "=", "fregs", ";", "this", ".", "stacksize", "=", "stacksize", ";", "this", ".", "bb", "=", "bb", ";", "this", ".", "exh", "=", "exh", ";", "if", "(", "stacksize", ">", "1023", ")", "{", "log", ".", "warning", "(", "\"\"", ")", ";", "}", "}", "public", "boolean", "equals", "(", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "TypeMap", ")", "{", "TypeMap", "other", "=", "(", "TypeMap", ")", "obj", ";", "return", "eq", "(", "(", "Map", ")", "xregs", ",", "(", "Map", ")", "other", ".", "xregs", ")", "&&", "eqy", "(", "this", ",", "other", ")", "&&", "eq", "(", "fregs", ",", "other", ".", "fregs", ")", "&&", "eq", "(", "exh", ",", "other", ".", "exh", ")", ";", "}", "return", "false", ";", "}", "private", "static", "boolean", "eqy", "(", "TypeMap", "me", ",", "TypeMap", "other", ")", "{", "if", "(", "me", ".", "stacksize", "!=", "other", ".", "stacksize", ")", "return", "false", ";", "return", "eqy_prefix", "(", "me", ",", "other", ",", "Math", ".", "min", "(", "me", ".", "stacksize", ",", "other", ".", "stacksize", ")", ")", ";", "}", "private", "static", "boolean", "eqy_prefix", "(", "TypeMap", "me", ",", "TypeMap", "other", ",", "int", "count", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "if", "(", "!", "eq", "(", "me", ".", "gety", "(", "i", ")", ",", "other", ".", "gety", "(", "i", ")", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "private", "boolean", "eq", "(", "Map", "m1", ",", "Map", "m2", ")", "{", "return", "m1", ".", "equals", "(", "m2", ")", ";", "}", "private", "boolean", "eq", "(", "Type", "[", "]", "r1", ",", "Type", "[", "]", "r2", ")", "{", "int", "max", "=", "Math", ".", "max", "(", "r1", ".", "length", ",", "r2", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "!", "eq", "(", "get", "(", "r1", ",", "i", ")", ",", "get", "(", "r2", ",", "i", ")", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "private", "static", "boolean", "eq", "(", "Type", "t1", ",", "Type", "t2", ")", "{", "if", "(", "t1", "==", "t2", ")", "return", "true", ";", "if", "(", "t1", "==", "null", "||", "t2", "==", "null", ")", "return", "false", ";", "return", "t1", ".", "equals", "(", "t2", ")", ";", "}", "private", "static", "boolean", "eq", "(", "ExceptionHandler", "e1", ",", "ExceptionHandler", "e2", ")", "{", "return", "(", "e1", "==", "e2", ")", "||", "(", "e1", "!=", "null", "&&", "e1", ".", "equals", "(", "e2", ")", ")", ";", "}", "public", "TypeMap", "mergeFrom", "(", "TypeMap", "other", ")", "{", "IPersistentMap", "new_x", "=", "eq", "(", "(", "Map", ")", "xregs", ",", "(", "Map", ")", "other", ".", "xregs", ")", "?", "xregs", ":", "merge_regs", "(", "xregs", ",", "other", ".", "xregs", ")", ";", "Type", "[", "]", "new_f", "=", "eq", "(", "fregs", ",", "other", ".", "fregs", ")", "?", "fregs", ":", "merge_regs", "(", "fregs", ",", "other", ".", "fregs", ")", ";", "Type", "[", "]", "new_y", "=", "yregs", ";", "int", "new_stacksize", "=", "Math", ".", "min", "(", "stacksize", ",", "other", ".", "stacksize", ")", ";", "if", "(", "!", "eqy_prefix", "(", "this", ",", "other", ",", "new_stacksize", ")", ")", "{", "new_y", "=", "new", "Type", "[", "new_stacksize", "]", ";", "boolean", "differs_from_my_y", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "new_stacksize", ";", "i", "++", ")", "{", "Type", "t1", ";", "Type", "res", "=", "merge", "(", "t1", "=", "this", ".", "gety", "(", "i", ")", ",", "other", ".", "gety", "(", "i", ")", ")", ";", "new_y", "[", "new_stacksize", "-", "i", "-", "1", "]", "=", "res", ";", "differs_from_my_y", "=", "differs_from_my_y", "||", "(", "res", "!=", "t1", "&&", "(", "res", "==", "null", "||", "!", "res", ".", "equals", "(", "t1", ")", ")", ")", ";", "}", "if", "(", "!", "differs_from_my_y", ")", "new_y", "=", "yregs", ";", "}", "ExceptionHandler", "new_exh", ";", "try", "{", "new_exh", "=", "ExceptionHandler", ".", "merge", "(", "exh", ",", "other", ".", "exh", ")", ";", "}", "catch", "(", "IllegalArgumentException", "iae", ")", "{", "new_exh", "=", "ExceptionHandler", ".", "Ambiguous", ".", "make", "(", "exh", ",", "other", ".", "exh", ")", ";", "}", "if", "(", "new_x", "==", "xregs", "&&", "new_y", "==", "yregs", "&&", "new_f", "==", "fregs", "&&", "new_stacksize", "==", "stacksize", "&&", "new_exh", "==", "exh", ")", "{", "return", "this", ";", "}", "else", "{", "return", "new", "TypeMap", "(", "new_x", ",", "new_y", ",", "new_f", ",", "new_stacksize", ",", "bb", ",", "new_exh", ")", ";", "}", "}", "private", "Type", "[", "]", "merge_regs", "(", "Type", "[", "]", "r1", ",", "Type", "[", "]", "r2", ")", "{", "Type", "[", "]", "res", "=", "new", "Type", "[", "Math", ".", "max", "(", "r1", ".", "length", ",", "r2", ".", "length", ")", "]", ";", "boolean", "differs_from_r1", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "res", ".", "length", ";", "i", "++", ")", "{", "Type", "t1", "=", "get", "(", "r1", ",", "i", ")", ";", "Type", "t2", "=", "get", "(", "r2", ",", "i", ")", ";", "res", "[", "i", "]", "=", "merge", "(", "t1", ",", "t2", ")", ";", "differs_from_r1", "=", "differs_from_r1", "||", "(", "res", "[", "i", "]", "!=", "t1", "&&", "(", "res", "[", "i", "]", "==", "null", "||", "!", "res", "[", "i", "]", ".", "equals", "(", "t1", ")", ")", ")", ";", "}", "assert", "(", "eq", "(", "r1", ",", "res", ")", "||", "differs_from_r1", ")", ";", "return", "differs_from_r1", "?", "res", ":", "r1", ";", "}", "private", "IPersistentMap", "merge_regs", "(", "IPersistentMap", "r1", ",", "IPersistentMap", "r2", ")", "{", "IPersistentMap", "out", "=", "PersistentHashMap", ".", "EMPTY", ";", "for", "(", "Integer", "r", ":", "(", "(", "Map", "<", "Integer", ",", "Type", ">", ")", "r1", ")", ".", "keySet", "(", ")", ")", "{", "Type", "t1", "=", "(", "Type", ")", "r1", ".", "valAt", "(", "r", ")", ";", "Type", "t2", "=", "(", "Type", ")", "r2", ".", "valAt", "(", "r", ")", ";", "Type", "m", "=", "merge", "(", "t1", ",", "t2", ")", ";", "if", "(", "m", "!=", "null", ")", "{", "out", "=", "out", ".", "assoc", "(", "r", ",", "m", ")", ";", "}", "}", "return", "out", ";", "}", "private", "Type", "merge", "(", "Type", "t1", ",", "Type", "t2", ")", "{", "if", "(", "t1", "==", "null", "||", "t2", "==", "null", ")", "return", "null", ";", "if", "(", "t1", ".", "equals", "(", "t2", ")", ")", "return", "t1", ";", "if", "(", "t1", ".", "getSort", "(", ")", "==", "Type", ".", "OBJECT", "&&", "t2", ".", "getSort", "(", ")", "==", "Type", ".", "OBJECT", ")", "{", "if", "(", "t1", ".", "getInternalName", "(", ")", ".", "startsWith", "(", "ETUPLE_NAME", ")", "&&", "t2", ".", "getInternalName", "(", ")", ".", "startsWith", "(", "ETUPLE_NAME", ")", ")", "{", "return", "TYPE_ETUPLE", ";", "}", "}", "return", "TYPE_EOBJECT", ";", "}", "private", "Type", "get", "(", "Type", "[", "]", "regs", ",", "int", "i", ")", "{", "if", "(", "i", "<", "regs", ".", "length", ")", "return", "regs", "[", "i", "]", ";", "else", "return", "null", ";", "}", "public", "TypeMap", "setx", "(", "int", "reg", ",", "Type", "t", ",", "XRegMarker", "marker", ")", "{", "marker", ".", "mark_xreg_as_used", "(", "reg", ")", ";", "bb", ".", "kill_x", "(", "reg", ")", ";", "if", "(", "eq", "(", "getx", "(", "reg", ")", ",", "t", ")", ")", "return", "this", ";", "IPersistentMap", "new_xregs", "=", "xregs", ".", "assoc", "(", "reg", ",", "t", ")", ";", "return", "new", "TypeMap", "(", "new_xregs", ",", "yregs", ",", "fregs", ",", "stacksize", ",", "bb", ",", "exh", ")", ";", "}", "public", "TypeMap", "setf", "(", "int", "reg", ",", "Type", "t", ")", "{", "bb", ".", "kill_fr", "(", "reg", ")", ";", "if", "(", "eq", "(", "getf", "(", "reg", ")", ",", "t", ")", ")", "return", "this", ";", "Type", "[", "]", "new_fregs", ";", "if", "(", "fregs", ".", "length", "<=", "reg", ")", "{", "new_fregs", "=", "grow", "(", "fregs", ",", "reg", ")", ";", "}", "else", "{", "new_fregs", "=", "copy", "(", "fregs", ")", ";", "}", "new_fregs", "[", "reg", "]", "=", "t", ";", "return", "new", "TypeMap", "(", "xregs", ",", "yregs", ",", "new_fregs", ",", "stacksize", ",", "bb", ",", "exh", ")", ";", "}", "private", "Type", "[", "]", "copy", "(", "Type", "[", "]", "regs", ")", "{", "Type", "[", "]", "res", "=", "new", "Type", "[", "regs", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "regs", ".", "length", ";", "i", "++", ")", "{", "res", "[", "i", "]", "=", "regs", "[", "i", "]", ";", "}", "return", "res", ";", "}", "private", "static", "Type", "[", "]", "grow", "(", "Type", "[", "]", "regs", ",", "int", "reg", ")", "{", "Type", "[", "]", "res", "=", "new", "Type", "[", "reg", "+", "6", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "regs", ".", "length", ";", "i", "++", ")", "{", "res", "[", "i", "]", "=", "regs", "[", "i", "]", ";", "}", "return", "res", ";", "}", "public", "Type", "getx", "(", "int", "reg", ")", "{", "bb", ".", "use_x", "(", "reg", ")", ";", "return", "(", "Type", ")", "xregs", ".", "valAt", "(", "reg", ",", "null", ")", ";", "}", "public", "Type", "getf", "(", "int", "reg", ")", "{", "bb", ".", "use_fr", "(", "reg", ")", ";", "if", "(", "reg", ">=", "fregs", ".", "length", ")", "{", "return", "null", ";", "}", "else", "{", "return", "fregs", "[", "reg", "]", ";", "}", "}", "public", "TypeMap", "sety", "(", "int", "reg", ",", "Type", "t", ")", "{", "bb", ".", "kill_y", "(", "this", ",", "reg", ")", ";", "if", "(", "eq", "(", "gety", "(", "reg", ")", ",", "t", ")", ")", "return", "this", ";", "int", "pos", "=", "get_ypos", "(", "reg", ")", ";", "if", "(", "pos", "<", "0", "||", "pos", ">=", "stacksize", ")", "throw", "new", "IllegalArgumentException", "(", "\"No", "Y\"", "+", "reg", "+", "\"\"", ")", ";", "Type", "[", "]", "new_yregs", ";", "if", "(", "yregs", ".", "length", "<=", "pos", ")", "{", "new_yregs", "=", "grow", "(", "yregs", ",", "pos", ")", ";", "}", "else", "{", "new_yregs", "=", "copy", "(", "yregs", ")", ";", "}", "new_yregs", "[", "pos", "]", "=", "t", ";", "return", "new", "TypeMap", "(", "xregs", ",", "new_yregs", ",", "fregs", ",", "stacksize", ",", "bb", ",", "exh", ")", ";", "}", "public", "Type", "gety", "(", "int", "reg", ")", "{", "bb", ".", "use_y", "(", "this", ",", "reg", ")", ";", "int", "pos", "=", "get_ypos", "(", "reg", ")", ";", "if", "(", "pos", "<", "0", "||", "pos", ">=", "stacksize", ")", "throw", "new", "IllegalArgumentException", "(", "\"no", "Y\"", "+", "reg", "+", "\"", "register\"", ")", ";", "if", "(", "pos", ">=", "yregs", ".", "length", ")", "return", "null", ";", "return", "yregs", "[", "pos", "]", ";", "}", "public", "int", "get_ypos", "(", "int", "reg", ")", "{", "if", "(", "reg", "<", "0", "||", "reg", ">=", "stacksize", ")", "throw", "new", "IllegalArgumentException", "(", "\"No", "Y\"", "+", "reg", "+", "\"\"", ")", ";", "return", "stacksize", "-", "reg", "-", "1", ";", "}", "public", "TypeMap", "trim_y", "(", "int", "howmuch", ")", "{", "return", "new", "TypeMap", "(", "xregs", ",", "yregs", ",", "fregs", ",", "stacksize", "-", "howmuch", ",", "bb", ",", "exh", ")", ";", "}", "public", "TypeMap", "alloc_y", "(", "int", "howmuch", ")", "{", "return", "new", "TypeMap", "(", "xregs", ",", "yregs", ",", "fregs", ",", "stacksize", "+", "howmuch", ",", "bb", ",", "exh", ")", ";", "}", "public", "TypeMap", "clearLive", "(", "BasicBlock", "bb", ")", "{", "return", "new", "TypeMap", "(", "xregs", ",", "yregs", ",", "fregs", ",", "stacksize", ",", "bb", ",", "exh", ")", ";", "}", "public", "TypeMap", "pushExceptionHandler", "(", "int", "handlerLabel", ")", "{", "ExceptionHandler", "new_exh", "=", "ExceptionHandler", ".", "push", "(", "exh", ",", "handlerLabel", ")", ";", "return", "new", "TypeMap", "(", "xregs", ",", "yregs", ",", "fregs", ",", "stacksize", ",", "bb", ",", "new_exh", ")", ";", "}", "public", "TypeMap", "popExceptionHandler", "(", ")", "{", "ExceptionHandler", "new_exh", "=", "(", "exh", "instanceof", "ExceptionHandler", ".", "Ambiguous", ")", "?", "null", ":", "ExceptionHandler", ".", "pop", "(", "exh", ")", ";", "return", "new", "TypeMap", "(", "xregs", ",", "yregs", ",", "fregs", ",", "stacksize", ",", "bb", ",", "new_exh", ")", ";", "}", "public", "void", "add_succ", "(", "BasicBlock", "succ", ")", "{", "bb", ".", "succ", "(", "succ", ")", ";", "}", "public", "void", "touchx", "(", "int", "from", ",", "int", "to", ")", "{", "for", "(", "int", "i", "=", "from", ";", "i", "<", "to", ";", "i", "++", ")", "{", "bb", ".", "use_x", "(", "i", ")", ";", "}", "}", "public", "Set", "<", "Integer", ">", "allXregs", "(", ")", "{", "return", "(", "(", "Map", ")", "xregs", ")", ".", "keySet", "(", ")", ";", "}", "public", "int", "max_freg", "(", ")", "{", "int", "max", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fregs", ".", "length", ";", "i", "++", ")", "{", "if", "(", "fregs", "[", "i", "]", "!=", "null", ")", "max", "=", "i", ";", "}", "return", "max", "+", "1", ";", "}", "interface", "XRegMarker", "{", "void", "mark_xreg_as_used", "(", "int", "reg", ")", ";", "}", "}", "</s>" ]
7,860
[ "<s>", "package", "erjang", ".", "beam", ".", "analysis", ";", "import", "erjang", ".", "beam", ".", "BeamExceptionHandler", ";", "import", "erjang", ".", "ErlangException", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "public", "class", "ExceptionHandler", "implements", "BeamExceptionHandler", "{", "public", "static", "final", "BeamExceptionHandler", "NULL", "=", "new", "BeamExceptionHandler", "(", ")", "{", "public", "int", "getHandlerLabel", "(", ")", "{", "throw", "new", "InternalError", "(", ")", ";", "}", "public", "BeamExceptionHandler", "getParent", "(", ")", "{", "throw", "new", "InternalError", "(", ")", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"NULL\"", ";", "}", "}", ";", "private", "final", "int", "handlerLabel", ";", "private", "final", "ExceptionHandler", "parent", ";", "public", "ExceptionHandler", "(", "int", "handlerLabel", ",", "ExceptionHandler", "parent", ")", "{", "this", ".", "handlerLabel", "=", "handlerLabel", ";", "this", ".", "parent", "=", "parent", ";", "}", "public", "int", "getHandlerLabel", "(", ")", "{", "return", "handlerLabel", ";", "}", "public", "ExceptionHandler", "getParent", "(", ")", "{", "return", "parent", ";", "}", "public", "List", "<", "BeamExceptionHandler", ">", "ambiguousities", "(", ")", "{", "return", "null", ";", "}", "public", "static", "ExceptionHandler", "push", "(", "ExceptionHandler", "org", ",", "int", "newHandlerLabel", ")", "{", "assert", "(", "!", "(", "org", "instanceof", "Ambiguous", ")", ")", ";", "return", "new", "ExceptionHandler", "(", "newHandlerLabel", ",", "org", ")", ";", "}", "public", "static", "ExceptionHandler", "pop", "(", "ExceptionHandler", "org", ")", "{", "if", "(", "org", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "assert", "(", "!", "(", "org", "instanceof", "Ambiguous", ")", ")", ";", "return", "org", ".", "parent", ";", "}", "public", "static", "ExceptionHandler", "merge", "(", "ExceptionHandler", "e1", ",", "ExceptionHandler", "e2", ")", "throws", "ErlangException", "{", "if", "(", "e1", "==", "e2", ")", "return", "e1", ";", "if", "(", "e1", "==", "null", "||", "e2", "==", "null", "||", "e1", ".", "handlerLabel", "!=", "e2", ".", "handlerLabel", ")", "throw", "new", "IllegalArgumentException", "(", "\"\"", ")", ";", "ExceptionHandler", "mergedParent", "=", "merge", "(", "e1", ".", "parent", ",", "e2", ".", "parent", ")", ";", "if", "(", "mergedParent", "==", "e1", ".", "parent", ")", "return", "e1", ";", "if", "(", "mergedParent", "==", "e2", ".", "parent", ")", "return", "e2", ";", "return", "new", "ExceptionHandler", "(", "e1", ".", "handlerLabel", ",", "mergedParent", ")", ";", "}", "public", "boolean", "equals", "(", "Object", "other", ")", "{", "return", "other", "instanceof", "ExceptionHandler", "&&", "equals", "(", "(", "ExceptionHandler", ")", "other", ")", ";", "}", "public", "boolean", "equals", "(", "ExceptionHandler", "other", ")", "{", "return", "equals", "(", "this", ",", "other", ")", ";", "}", "public", "static", "boolean", "equals", "(", "ExceptionHandler", "e1", ",", "ExceptionHandler", "e2", ")", "{", "if", "(", "e1", "==", "e2", ")", "return", "true", ";", "if", "(", "e1", "==", "null", "||", "e2", "==", "null", ")", "return", "false", ";", "if", "(", "e1", ".", "handlerLabel", "!=", "e2", ".", "handlerLabel", ")", "return", "false", ";", "if", "(", "e1", "instanceof", "Ambiguous", "&&", "e2", "instanceof", "Ambiguous", ")", "{", "Ambiguous", "a1", "=", "(", "Ambiguous", ")", "e1", ";", "Ambiguous", "a2", "=", "(", "Ambiguous", ")", "e2", ";", "return", "a1", ".", "exhs", ".", "equals", "(", "a2", ".", "exhs", ")", ";", "}", "if", "(", "e1", "instanceof", "Ambiguous", "||", "e2", "instanceof", "Ambiguous", ")", "return", "false", ";", "return", "equals", "(", "e1", ".", "parent", ",", "e2", ".", "parent", ")", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "handlerLabel", ";", "}", "public", "int", "compareTo", "(", "Object", "other", ")", "{", "if", "(", "!", "(", "other", "instanceof", "ExceptionHandler", ")", ")", "return", "1", ";", "return", "compareTo", "(", "(", "ExceptionHandler", ")", "other", ")", ";", "}", "public", "int", "compareTo", "(", "ExceptionHandler", "other", ")", "{", "return", "this", ".", "handlerLabel", "-", "other", ".", "handlerLabel", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"lbl\"", "+", "handlerLabel", "+", "\"+\"", "+", "parent", ";", "}", "public", "static", "class", "Ambiguous", "extends", "ExceptionHandler", "{", "final", "Set", "<", "BeamExceptionHandler", ">", "exhs", ";", "public", "Ambiguous", "(", "ExceptionHandler", "src1", ",", "ExceptionHandler", "src2", ")", "{", "super", "(", "-", "1", ",", "null", ")", ";", "exhs", "=", "new", "HashSet", "(", ")", ";", "add_to_set", "(", "exhs", ",", "src1", ")", ";", "add_to_set", "(", "exhs", ",", "src2", ")", ";", "}", "public", "Ambiguous", "(", "Set", "<", "BeamExceptionHandler", ">", "exhs", ")", "{", "super", "(", "-", "1", ",", "null", ")", ";", "this", ".", "exhs", "=", "exhs", ";", "}", "public", "static", "Ambiguous", "make", "(", "ExceptionHandler", "src1", ",", "ExceptionHandler", "src2", ")", "{", "HashSet", "<", "BeamExceptionHandler", ">", "exhs", "=", "new", "HashSet", "(", ")", ";", "add_to_set", "(", "exhs", ",", "src1", ")", ";", "add_to_set", "(", "exhs", ",", "src2", ")", ";", "Ambiguous", "a", ";", "if", "(", "src1", "instanceof", "Ambiguous", "&&", "exhs", ".", "equals", "(", "(", "a", "=", "(", "Ambiguous", ")", "src1", ")", ".", "exhs", ")", ")", "return", "a", ";", "if", "(", "src2", "instanceof", "Ambiguous", "&&", "exhs", ".", "equals", "(", "(", "a", "=", "(", "Ambiguous", ")", "src2", ")", ".", "exhs", ")", ")", "return", "a", ";", "return", "new", "Ambiguous", "(", "exhs", ")", ";", "}", "private", "static", "void", "add_to_set", "(", "Set", "<", "BeamExceptionHandler", ">", "exhs", ",", "ExceptionHandler", "src", ")", "{", "if", "(", "src", "instanceof", "Ambiguous", ")", "exhs", ".", "addAll", "(", "(", "(", "Ambiguous", ")", "src", ")", ".", "exhs", ")", ";", "else", "if", "(", "src", "==", "null", ")", "exhs", ".", "add", "(", "NULL", ")", ";", "else", "exhs", ".", "add", "(", "src", ")", ";", "}", "public", "int", "hashCode", "(", ")", "{", "return", "exhs", ".", "hashCode", "(", ")", ";", "}", "public", "List", "<", "BeamExceptionHandler", ">", "ambiguousities", "(", ")", "{", "List", "<", "BeamExceptionHandler", ">", "result", "=", "new", "ArrayList", "<", "BeamExceptionHandler", ">", "(", "exhs", ".", "size", "(", ")", ")", ";", "for", "(", "BeamExceptionHandler", "x", ":", "exhs", ")", "result", ".", "add", "(", "x", "==", "NULL", "?", "null", ":", "x", ")", ";", "return", "result", ";", "}", "public", "String", "toString", "(", ")", "{", "StringBuffer", "res", "=", "new", "StringBuffer", "(", "\"ambi(\"", ")", ";", "for", "(", "BeamExceptionHandler", "e", ":", "exhs", ")", "{", "res", ".", "append", "(", "e", ")", ".", "append", "(", "\"", "\"", ")", ";", "}", "res", ".", "append", "(", "\")\"", ")", ";", "return", "res", ".", "toString", "(", ")", ";", "}", "}", "}", "</s>" ]
7,861
[ "<s>", "package", "erjang", ".", "beam", ".", "analysis", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "Comparator", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "SortedSet", ";", "import", "java", ".", "util", ".", "TreeMap", ";", "import", "java", ".", "util", ".", "TreeSet", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EBig", ";", "import", "erjang", ".", "EBinMatchState", ";", "import", "erjang", ".", "EBinary", ";", "import", "erjang", ".", "EBitString", ";", "import", "erjang", ".", "ECons", ";", "import", "erjang", ".", "EDouble", ";", "import", "erjang", ".", "EFun", ";", "import", "erjang", ".", "EInteger", ";", "import", "erjang", ".", "EList", ";", "import", "erjang", ".", "EString", ";", "import", "erjang", ".", "ENil", ";", "import", "erjang", ".", "ENumber", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EPID", ";", "import", "erjang", ".", "EPort", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ERef", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ESmall", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "ETuple2", ";", "import", "erjang", ".", "beam", ".", "Arg", ";", "import", "erjang", ".", "beam", ".", "BIFUtil", ";", "import", "erjang", ".", "beam", ".", "BeamCodeBlock", ";", "import", "erjang", ".", "beam", ".", "BeamFunction", ";", "import", "erjang", ".", "beam", ".", "BeamInstruction", ";", "import", "erjang", ".", "beam", ".", "BeamOpcode", ";", "import", "erjang", ".", "beam", ".", "BeamExceptionHandler", ";", "import", "erjang", ".", "beam", ".", "BlockVisitor", ";", "import", "erjang", ".", "beam", ".", "BlockVisitor2", ";", "import", "erjang", ".", "beam", ".", "BuiltInFunction", ";", "import", "erjang", ".", "beam", ".", "ExtFunc", ";", "import", "erjang", ".", "beam", ".", "FunctionAdapter", ";", "import", "erjang", ".", "beam", ".", "FunctionVisitor", ";", "import", "erjang", ".", "beam", ".", "FunctionVisitor2", ";", "import", "erjang", ".", "beam", ".", "ModuleAdapter", ";", "import", "erjang", ".", "beam", ".", "ModuleVisitor", ";", "import", "erjang", ".", "beam", ".", "Arg", ".", "Kind", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Insn", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "ExtFun", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "Int", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "XReg", ";", "import", "static", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "SourceOperand", ";", "import", "static", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "DestinationOperand", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "*", ";", "public", "class", "BeamTypeAnalysis", "extends", "ModuleAdapter", "{", "static", "final", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.beam\"", ")", ";", "public", "BeamTypeAnalysis", "(", "ModuleVisitor", "mv", ")", "{", "super", "(", "mv", ")", ";", "}", "static", "final", "Type", "ESMALL_TYPE", "=", "Type", ".", "getType", "(", "ESmall", ".", "class", ")", ";", "static", "final", "Type", "EBIG_TYPE", "=", "Type", ".", "getType", "(", "EBig", ".", "class", ")", ";", "static", "final", "Type", "EINTEGER_TYPE", "=", "Type", ".", "getType", "(", "EInteger", ".", "class", ")", ";", "static", "final", "Type", "ENUMBER_TYPE", "=", "Type", ".", "getType", "(", "ENumber", ".", "class", ")", ";", "static", "final", "Type", "EOBJECT_TYPE", "=", "Type", ".", "getType", "(", "EObject", ".", "class", ")", ";", "static", "final", "Type", "EDOUBLE_TYPE", "=", "Type", ".", "getType", "(", "EDouble", ".", "class", ")", ";", "static", "final", "Type", "ENIL_TYPE", "=", "Type", ".", "getType", "(", "ENil", ".", "class", ")", ";", "static", "final", "Type", "EATOM_TYPE", "=", "Type", ".", "getType", "(", "EAtom", ".", "class", ")", ";", "static", "final", "Type", "ETUPLE_TYPE", "=", "Type", ".", "getType", "(", "ETuple", ".", "class", ")", ";", "static", "final", "Type", "EBINARY_TYPE", "=", "Type", ".", "getType", "(", "EBinary", ".", "class", ")", ";", "static", "final", "Type", "EBITSTRING_TYPE", "=", "Type", ".", "getType", "(", "EBitString", ".", "class", ")", ";", "static", "final", "Type", "ECONS_TYPE", "=", "Type", ".", "getType", "(", "ECons", ".", "class", ")", ";", "static", "final", "Type", "ESEQ_TYPE", "=", "Type", ".", "getType", "(", "ESeq", ".", "class", ")", ";", "static", "final", "Type", "ELIST_TYPE", "=", "Type", ".", "getType", "(", "EList", ".", "class", ")", ";", "static", "final", "Type", "EFUN_TYPE", "=", "Type", ".", "getType", "(", "EFun", ".", "class", ")", ";", "static", "final", "Type", "EPID_TYPE", "=", "Type", ".", "getType", "(", "EPID", ".", "class", ")", ";", "static", "final", "Type", "EPORT_TYPE", "=", "Type", ".", "getType", "(", "EPort", ".", "class", ")", ";", "static", "final", "Type", "EREFERENCE_TYPE", "=", "Type", ".", "getType", "(", "ERef", ".", "class", ")", ";", "static", "final", "Type", "EMATCHSTATE_TYPE", "=", "Type", ".", "getType", "(", "EBinMatchState", ".", "class", ")", ";", "static", "final", "EAtom", "am_plus", "=", "EAtom", ".", "intern", "(", "\"+\"", ")", ";", "static", "final", "EAtom", "am_minus", "=", "EAtom", ".", "intern", "(", "\"-\"", ")", ";", "private", "static", "final", "ETuple", "X0_REG", "=", "ETuple", ".", "make", "(", "new", "EObject", "[", "]", "{", "X_ATOM", ",", "new", "ESmall", "(", "0", ")", "}", ")", ";", "private", "EAtom", "moduleName", ";", "private", "List", "<", "FV", ">", "functions", "=", "new", "ArrayList", "<", "FV", ">", "(", ")", ";", "@", "Override", "public", "void", "declareFunction", "(", "EAtom", "fun", ",", "int", "arity", ",", "int", "label", ")", "{", "}", "@", "Override", "public", "FunctionVisitor", "visitFunction", "(", "EAtom", "name", ",", "int", "arity", ",", "int", "startLabel", ")", "{", "FV", "f", "=", "new", "FV", "(", "super", ".", "visitFunction", "(", "name", ",", "arity", ",", "startLabel", ")", ",", "name", ",", "arity", ",", "startLabel", ")", ";", "functions", ".", "add", "(", "f", ")", ";", "return", "f", ";", "}", "class", "FV", "extends", "FunctionAdapter", "implements", "BeamFunction", ",", "TypeMap", ".", "XRegMarker", "{", "BasicBlock", "makeBasicBlock", "(", "int", "label", ",", "int", "index", ")", "{", "assert", "(", "(", "label", "&", "0xffff", ")", "==", "label", ")", ";", "assert", "(", "(", "index", "&", "0xffff", ")", "==", "index", ")", ";", "int", "bbk", "=", "(", "label", "<<", "16", ")", "|", "index", ";", "BasicBlock", "bb", "=", "bbs", ".", "get", "(", "bbk", ")", ";", "if", "(", "bb", "==", "null", ")", "{", "bbs", ".", "put", "(", "bbk", ",", "bb", "=", "new", "BasicBlock", "(", "label", ",", "index", ")", ")", ";", "}", "return", "bb", ";", "}", "TreeMap", "<", "Integer", ",", "BasicBlock", ">", "bbs", "=", "new", "TreeMap", "<", "Integer", ",", "BasicBlock", ">", "(", ")", ";", "TreeMap", "<", "Integer", ",", "List", "<", "BeamExceptionHandler", ">", ">", "blocks_with_ambiguous_exh", "=", "new", "TreeMap", "<", "Integer", ",", "List", "<", "BeamExceptionHandler", ">", ">", "(", ")", ";", "void", "live_analysis", "(", ")", "{", "Integer", "[", "]", "all", "=", "bbs", ".", "keySet", "(", ")", ".", "toArray", "(", "new", "Integer", "[", "bbs", ".", "size", "(", ")", "]", ")", ";", "Arrays", ".", "sort", "(", "all", ")", ";", "boolean", "change", "=", "false", ";", "int", "iter", "=", "0", ";", "do", "{", "iter", "+=", "1", ";", "for", "(", "int", "n", "=", "all", ".", "length", "-", "1", ";", "n", ">=", "0", ";", "n", "--", ")", "{", "BasicBlock", "bb", "=", "bbs", ".", "get", "(", "all", "[", "n", "]", ")", ";", "TreeSet", "<", "Integer", ">", "inq", "=", "bb", ".", "in", ";", "TreeSet", "<", "Integer", ">", "outq", "=", "bb", ".", "out", ";", "TreeSet", "<", "Integer", ">", "in_n", "=", "new", "TreeSet", "<", "Integer", ">", "(", ")", ";", "in_n", ".", "addAll", "(", "outq", ")", ";", "in_n", ".", "removeAll", "(", "bb", ".", "kill", ")", ";", "in_n", ".", "addAll", "(", "bb", ".", "use", ")", ";", "bb", ".", "in", "=", "in_n", ";", "TreeSet", "<", "Integer", ">", "out_n", "=", "new", "TreeSet", "<", "Integer", ">", "(", ")", ";", "for", "(", "BasicBlock", "s", ":", "bb", ".", "succ", ")", "{", "TreeSet", "<", "Integer", ">", "in_s", "=", "s", ".", "in", ";", "if", "(", "in_s", "!=", "null", ")", "{", "out_n", ".", "addAll", "(", "in_s", ")", ";", "}", "}", "bb", ".", "out", "=", "out_n", ";", "change", "=", "(", "!", "inq", ".", "equals", "(", "in_n", ")", ")", "||", "(", "!", "outq", ".", "equals", "(", "out_n", ")", ")", ";", "}", "}", "while", "(", "change", ")", ";", "}", "Map", "<", "Integer", ",", "LabeledBlock", ">", "lbs", "=", "new", "TreeMap", "<", "Integer", ",", "LabeledBlock", ">", "(", ")", ";", "private", "final", "EAtom", "name", ";", "private", "final", "int", "arity", ";", "private", "final", "int", "startLabel", ";", "private", "SortedSet", "<", "LabeledBlock", ">", "needs_analyze", "=", "new", "TreeSet", "<", "LabeledBlock", ">", "(", "new", "Comparator", "<", "LabeledBlock", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "LabeledBlock", "o1", ",", "LabeledBlock", "o2", ")", "{", "return", "o2", ".", "block_label", "-", "o1", ".", "block_label", ";", "}", "}", ")", ";", "public", "int", "max_stack", ";", "public", "HashSet", "<", "Integer", ">", "all_xregs", "=", "new", "HashSet", "(", ")", ";", "public", "int", "max_freg", ";", "private", "boolean", "is_tail_recursive", ";", "public", "FV", "(", "FunctionVisitor", "fv", ",", "EAtom", "name", ",", "int", "arity", ",", "int", "startLabel", ")", "{", "super", "(", "fv", ")", ";", "this", ".", "name", "=", "name", ";", "this", ".", "arity", "=", "arity", ";", "this", ".", "startLabel", "=", "startLabel", ";", "}", "@", "Override", "public", "void", "visitEnd", "(", ")", "{", "LabeledBlock", "lb", "=", "lbs", ".", "get", "(", "startLabel", ")", ";", "lb", ".", "merge_from", "(", "this", ".", "make_initial", "(", ")", ")", ";", "try", "{", "while", "(", "!", "needs_analyze", ".", "isEmpty", "(", ")", ")", "{", "lb", "=", "needs_analyze", ".", "first", "(", ")", ";", "needs_analyze", ".", "remove", "(", "lb", ")", ";", "lb", ".", "analyze", "(", ")", ";", "}", "}", "catch", "(", "RuntimeException", "t", ")", "{", "dump", "(", ")", ";", "throw", "t", ";", "}", "catch", "(", "Error", "t", ")", "{", "dump", "(", ")", ";", "throw", "t", ";", "}", "SortedSet", "<", "Integer", ">", "labels", "=", "new", "TreeSet", "<", "Integer", ">", "(", ")", ";", "labels", ".", "addAll", "(", "lbs", ".", "keySet", "(", ")", ")", ";", "for", "(", "int", "i", ":", "labels", ")", "{", "lb", "=", "lbs", ".", "get", "(", "i", ")", ";", "if", "(", "lb", ".", "initial", "==", "null", ")", "continue", ";", "ExceptionHandler", "e", "=", "lb", ".", "initial", ".", "exh", ";", "if", "(", "e", "==", "null", ")", "continue", ";", "List", "<", "BeamExceptionHandler", ">", "ambi", "=", "e", ".", "ambiguousities", "(", ")", ";", "if", "(", "ambi", "!=", "null", ")", "{", "blocks_with_ambiguous_exh", ".", "put", "(", "i", ",", "ambi", ")", ";", "}", "}", "boolean", "has_unreachable_code", "=", "false", ";", "for", "(", "int", "i", ":", "labels", ")", "{", "lb", "=", "lbs", ".", "get", "(", "i", ")", ";", "if", "(", "lb", ".", "isDeadCode", "(", ")", ")", "{", "if", "(", "lb", ".", "insns", ".", "get", "(", "0", ")", ".", "opcode", "(", ")", "==", "BeamOpcode", ".", "func_info", ")", "{", "}", "else", "{", "log", ".", "fine", "(", "\"UNREACHABLE", "\"", "+", "lb", ".", "block_label", ")", ";", "has_unreachable_code", "=", "true", ";", "}", "}", "}", "if", "(", "has_unreachable_code", ")", "{", "this", ".", "dump", "(", ")", ";", "}", "function_visit_end", "(", ")", ";", "}", "private", "void", "function_visit_end", "(", ")", "{", "if", "(", "fv", "instanceof", "FunctionVisitor2", ")", "{", "(", "(", "FunctionVisitor2", ")", "fv", ")", ".", "visitMaxs", "(", "(", "Collection", "<", "Integer", ">", ")", "this", ".", "all_xregs", ",", "this", ".", "max_stack", ",", "this", ".", "max_freg", ",", "this", ".", "is_tail_recursive", ")", ";", "}", "for", "(", "LabeledBlock", "block", ":", "this", ".", "lbs", ".", "values", "(", ")", ")", "{", "ExceptionHandler", "block_exh", "=", "block", ".", "initial", "==", "null", "?", "null", ":", "block", ".", "initial", ".", "exh", ";", "assert", "(", "blocks_with_ambiguous_exh", ".", "containsKey", "(", "block", ".", "block_label", ")", "==", "(", "block_exh", "!=", "null", "&&", "block_exh", ".", "ambiguousities", "(", ")", "!=", "null", ")", ")", ";", "if", "(", "block_exh", "!=", "null", "&&", "block_exh", ".", "ambiguousities", "(", ")", "!=", "null", ")", "{", "List", "<", "BeamExceptionHandler", ">", "ambi", "=", "blocks_with_ambiguous_exh", ".", "get", "(", "block", ".", "block_label", ")", ";", "for", "(", "BeamExceptionHandler", "e", ":", "ambi", ")", "{", "int", "ext_label", "=", "extendedLabel", "(", "block", ".", "block_label", ",", "e", ")", ";", "function_visit_end_aux", "(", "block", ",", "ext_label", ",", "e", ")", ";", "}", "}", "else", "{", "int", "ext_label", "=", "extendedLabel", "(", "block", ".", "block_label", ",", "block_exh", ")", ";", "function_visit_end_aux", "(", "block", ",", "ext_label", ",", "block_exh", ")", ";", "}", "}", "super", ".", "fv", ".", "visitEnd", "(", ")", ";", "}", "private", "void", "function_visit_end_aux", "(", "LabeledBlock", "block", ",", "int", "ext_label", ",", "BeamExceptionHandler", "exh", ")", "{", "BlockVisitor", "vis", "=", "super", ".", "fv", ".", "visitLabeledBlock", "(", "ext_label", ")", ";", "try", "{", "block", ".", "accept", "(", "vis", ",", "exh", ")", ";", "}", "catch", "(", "Error", "e", ")", "{", "dump", "(", ")", ";", "throw", "e", ";", "}", "}", "private", "void", "dump", "(", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "{", "log", ".", "finer", "(", "\"DUMPING", "\"", "+", "name", "+", "\"/\"", "+", "arity", ")", ";", "for", "(", "Map", ".", "Entry", "<", "Integer", ",", "LabeledBlock", ">", "ent", ":", "lbs", ".", "entrySet", "(", ")", ")", "{", "ent", ".", "getValue", "(", ")", ".", "dump", "(", ")", ";", "}", "}", "}", "@", "Override", "public", "BlockVisitor", "visitLabeledBlock", "(", "int", "label", ")", "{", "return", "get_lb", "(", "label", ",", "true", ")", ";", "}", "private", "TypeMap", "make_initial", "(", ")", "{", "TypeMap", "res", "=", "new", "TypeMap", "(", "makeBasicBlock", "(", "startLabel", ",", "0", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", ";", "i", "++", ")", "{", "res", "=", "res", ".", "setx", "(", "i", ",", "EOBJECT_TYPE", ",", "this", ")", ";", "}", "return", "res", ";", "}", "private", "LabeledBlock", "get_lb", "(", "int", "label", ",", "boolean", "create", ")", "{", "if", "(", "lbs", ".", "containsKey", "(", "label", ")", ")", "{", "LabeledBlock", "res", "=", "lbs", ".", "get", "(", "label", ")", ";", "return", "res", ";", "}", "else", "if", "(", "create", ")", "{", "LabeledBlock", "res", "=", "new", "LabeledBlock", "(", "label", ")", ";", "lbs", ".", "put", "(", "label", ",", "res", ")", ";", "return", "res", ";", "}", "else", "{", "return", "null", ";", "}", "}", "int", "extendedLabel", "(", "int", "label", ",", "BeamExceptionHandler", "exh", ")", "{", "assert", "(", "(", "label", "&", "~", "0xffff", ")", "==", "0", ")", ";", "int", "extLabel", "=", "label", ";", "if", "(", "blocks_with_ambiguous_exh", ".", "containsKey", "(", "label", ")", ")", "{", "if", "(", "exh", "!=", "null", ")", "{", "assert", "(", "!", "blocks_with_ambiguous_exh", ".", "containsKey", "(", "exh", ".", "getHandlerLabel", "(", ")", ")", ")", ";", "int", "handlerLabel", "=", "exh", ".", "getHandlerLabel", "(", ")", ";", "assert", "(", "(", "handlerLabel", "&", "~", "0xffff", ")", "==", "0", ")", ";", "extLabel", "|=", "(", "handlerLabel", "<<", "16", ")", ";", "}", "}", "return", "extLabel", ";", "}", "public", "void", "mark_xreg_as_used", "(", "int", "reg", ")", "{", "all_xregs", ".", "add", "(", "reg", ")", ";", "}", "private", "void", "update_max_regs", "(", "TypeMap", "current", ")", "{", "max_stack", "=", "Math", ".", "max", "(", "max_stack", ",", "current", ".", "stacksize", ")", ";", "max_freg", "=", "Math", ".", "max", "(", "max_freg", ",", "current", ".", "max_freg", "(", ")", ")", ";", "}", "class", "LabeledBlock", "implements", "BlockVisitor", ",", "BeamCodeBlock", "{", "private", "final", "int", "block_label", ";", "TypeMap", "initial", ";", "boolean", "last", "=", "false", ";", "TypeMap", "[", "]", "map", ";", "public", "LabeledBlock", "(", "int", "label", ")", "{", "this", ".", "block_label", "=", "label", ";", "initial", "=", "null", ";", "}", "public", "void", "accept", "(", "BlockVisitor", "vis", ",", "BeamExceptionHandler", "exh", ")", "{", "try", "{", "if", "(", "!", "isDeadCode", "(", ")", ")", "{", "if", "(", "vis", "instanceof", "BlockVisitor2", ")", "{", "accept_2", "(", "(", "BlockVisitor2", ")", "vis", ",", "exh", ")", ";", "}", "else", "{", "accept_1", "(", "vis", ")", ";", "}", "}", "}", "finally", "{", "vis", ".", "visitEnd", "(", ")", ";", "}", "}", "private", "void", "accept_1", "(", "BlockVisitor", "vis", ")", "{", "throw", "new", "erjang", ".", "NotImplemented", "(", ")", ";", "}", "private", "void", "accept_2", "(", "BlockVisitor2", "vis", ",", "BeamExceptionHandler", "exh", ")", "{", "int", "tuple_pos", "=", "0", ";", "Arg", "tuple_reg", "=", "null", ";", "vis", ".", "visitBegin", "(", "exh", ")", ";", "for", "(", "int", "insn_idx", "=", "0", ";", "insn_idx", "<", "insns", ".", "size", "(", ")", ";", "insn_idx", "++", ")", "{", "Insn", "insn_", "=", "insns", ".", "get", "(", "insn_idx", ")", ";", "BeamOpcode", "opcode", "=", "insn_", ".", "opcode", "(", ")", ";", "TypeMap", "type_map", "=", "this", ".", "map", "[", "insn_idx", "]", ";", "switch", "(", "opcode", ")", "{", "case", "func_info", ":", "{", "Insn", ".", "AAI", "insn", "=", "(", "Insn", ".", "AAI", ")", "insn_", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "insn", ".", "getExtFun", "(", ")", ")", ";", "break", ";", "}", "case", "fconv", ":", "case", "fmove", ":", "case", "move", ":", "{", "Insn", ".", "SD", "insn", "=", "(", "Insn", ".", "SD", ")", "insn_", ";", "Arg", "src", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ";", "Arg", "dest", "=", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "if", "(", "dest", ".", "kind", "!=", "Kind", ".", "F", ")", "{", "if", "(", "src", ".", "kind", "==", "Kind", ".", "F", ")", "{", "dest", "=", "new", "Arg", "(", "dest", ",", "EDOUBLE_TYPE", ")", ";", "}", "else", "{", "dest", "=", "new", "Arg", "(", "dest", ",", "src", ".", "type", ")", ";", "}", "}", "else", "{", "}", "vis", ".", "visitInsn", "(", "opcode", ",", "src", ",", "dest", ")", ";", "break", ";", "}", "case", "put_string", ":", "{", "Insn", ".", "ByD", "insn", "=", "(", "Insn", ".", "ByD", ")", "insn_", ";", "Arg", "src", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "bin", ")", ";", "Arg", "dest", "=", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "dest", "=", "new", "Arg", "(", "dest", ",", "ESEQ_TYPE", ")", ";", "vis", ".", "visitInsn", "(", "BeamOpcode", ".", "move", ",", "src", ",", "dest", ")", ";", "break", ";", "}", "case", "fadd", ":", "case", "fsub", ":", "case", "fmul", ":", "case", "fdiv", ":", "{", "Insn", ".", "LSSD", "insn", "=", "(", "Insn", ".", "LSSD", ")", "insn_", ";", "EAtom", "name", "=", "opcode", ".", "symbol", ";", "int", "failLabel", "=", "decode_labelref", "(", "insn", ".", "label", ",", "type_map", ".", "exh", ")", ";", "Arg", "[", "]", "in", "=", "new", "Arg", "[", "]", "{", "src_arg", "(", "insn_idx", ",", "insn", ".", "src1", ")", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "src2", ")", "}", ";", "Type", "[", "]", "inTypes", "=", "new", "Type", "[", "]", "{", "in", "[", "0", "]", ".", "type", ",", "in", "[", "1", "]", ".", "type", "}", ";", "Arg", "out", "=", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "BuiltInFunction", "bif", "=", "BIFUtil", ".", "getMethod", "(", "\"erlang\"", ",", "name", ".", "getName", "(", ")", ",", "inTypes", ",", "failLabel", "!=", "0", ",", "true", ")", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "failLabel", ",", "in", ",", "out", ",", "bif", ")", ";", "break", ";", "}", "case", "bif0", ":", "case", "bif1", ":", "case", "bif2", ":", "{", "Insn", ".", "Bif", "insn", "=", "(", "Insn", ".", "Bif", ")", "insn_", ";", "EAtom", "name", "=", "insn", ".", "ext_fun", ".", "fun", ";", "int", "failLabel", "=", "decode_labelref", "(", "insn", ".", "label", ",", "type_map", ".", "exh", ")", ";", "SourceOperand", "[", "]", "srcs", "=", "insn", ".", "args", ";", "Arg", "[", "]", "in", "=", "src_args", "(", "insn_idx", ",", "srcs", ")", ";", "Arg", "out", "=", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "BuiltInFunction", "bif", "=", "BIFUtil", ".", "getMethod", "(", "\"erlang\"", ",", "name", ".", "getName", "(", ")", ",", "parmTypes", "(", "type_map", ",", "srcs", ")", ",", "failLabel", "!=", "0", ",", "true", ")", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "failLabel", ",", "in", ",", "out", ",", "bif", ")", ";", "break", ";", "}", "case", "gc_bif1", ":", "case", "gc_bif2", ":", "{", "Insn", ".", "GcBif", "insn", "=", "(", "Insn", ".", "GcBif", ")", "insn_", ";", "EAtom", "name", "=", "insn", ".", "ext_fun", ".", "fun", ";", "int", "failLabel", "=", "decode_labelref", "(", "insn", ".", "label", ",", "type_map", ".", "exh", ")", ";", "SourceOperand", "[", "]", "srcs", "=", "insn", ".", "args", ";", "Arg", "[", "]", "in", "=", "src_args", "(", "insn_idx", ",", "srcs", ")", ";", "Arg", "out", "=", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "Int", "lop", "=", "null", ",", "rop", "=", "null", ";", "if", "(", "srcs", ".", "length", "==", "2", "&&", "(", "(", "(", "name", "==", "am_plus", "||", "name", "==", "am_minus", ")", "&&", "(", "rop", "=", "srcs", "[", "1", "]", ".", "testInt", "(", ")", ")", "!=", "null", "&&", "rop", ".", "equals", "(", "1", ")", ")", "||", "(", "name", "==", "am_plus", "&&", "(", "lop", "=", "srcs", "[", "0", "]", ".", "testInt", "(", ")", ")", "!=", "null", "&&", "lop", ".", "equals", "(", "1", ")", ")", ")", ")", "{", "if", "(", "name", "==", "am_plus", ")", "{", "Arg", "src", "=", "(", "lop", "==", "null", ")", "?", "in", "[", "0", "]", ":", "in", "[", "1", "]", ";", "vis", ".", "visitIncrement", "(", "src", ",", "out", ")", ";", "break", ";", "}", "else", "if", "(", "name", "==", "am_minus", ")", "{", "Arg", "src", "=", "in", "[", "0", "]", ";", "vis", ".", "visitDecrement", "(", "src", ",", "out", ")", ";", "break", ";", "}", "}", "BuiltInFunction", "bif", "=", "BIFUtil", ".", "getMethod", "(", "\"erlang\"", ",", "name", ".", "getName", "(", ")", ",", "parmTypes", "(", "type_map", ",", "srcs", ")", ",", "failLabel", "!=", "0", ",", "true", ")", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "failLabel", ",", "in", ",", "out", ",", "bif", ")", ";", "break", ";", "}", "case", "is_tuple", ":", "{", "if", "(", "insn_idx", "+", "1", "<", "insns", ".", "size", "(", ")", ")", "{", "Insn", "next_insn", "=", "insns", ".", "get", "(", "insn_idx", "+", "1", ")", ";", "if", "(", "next_insn", ".", "opcode", "(", ")", "==", "BeamOpcode", ".", "test_arity", ")", "{", "int", "this_fail", "=", "decode_labelref", "(", "(", "(", "Insn", ".", "L", ")", "insn_", ")", ".", "label", ",", "this", ".", "map", "[", "insn_idx", "]", ".", "exh", ")", ";", "int", "next_fail", "=", "decode_labelref", "(", "(", "(", "Insn", ".", "L", ")", "next_insn", ")", ".", "label", ",", "this", ".", "map", "[", "insn_idx", "+", "1", "]", ".", "exh", ")", ";", "if", "(", "this_fail", "==", "next_fail", ")", "{", "Arg", "this_arg", "=", "src_arg", "(", "insn_idx", ",", "(", "(", "Insn", ".", "LD", ")", "insn_", ")", ".", "dest", ")", ";", "Arg", "next_arg", "=", "src_arg", "(", "insn_idx", "+", "1", ",", "(", "(", "Insn", ".", "LD", ")", "next_insn", ")", ".", "dest", ")", ";", "if", "(", "this_arg", ".", "equals", "(", "next_arg", ")", ")", "{", "break", ";", "}", "}", "}", "}", "}", "case", "is_integer", ":", "case", "is_float", ":", "case", "is_number", ":", "case", "is_atom", ":", "case", "is_pid", ":", "case", "is_reference", ":", "case", "is_port", ":", "case", "is_nil", ":", "case", "is_binary", ":", "case", "is_list", ":", "case", "is_nonempty_list", ":", "case", "is_function", ":", "case", "is_boolean", ":", "case", "is_bitstr", ":", "case", "test_arity", ":", "case", "bs_test_tail2", ":", "case", "bs_test_unit", ":", "case", "is_lt", ":", "case", "is_ge", ":", "case", "is_eq", ":", "case", "is_ne", ":", "case", "is_eq_exact", ":", "case", "is_ne_exact", ":", "case", "is_function2", ":", "case", "bs_match_string", ":", "case", "bs_skip_utf8", ":", "case", "bs_skip_utf16", ":", "case", "bs_skip_utf32", ":", "case", "bs_start_match2", ":", "case", "bs_get_utf8", ":", "case", "bs_get_utf16", ":", "case", "bs_get_utf32", ":", "case", "bs_skip_bits2", ":", "case", "bs_get_integer2", ":", "case", "bs_get_float2", ":", "case", "bs_get_binary2", ":", "accept_2_test", "(", "vis", ",", "(", "Insn", ".", "L", ")", "insn_", ",", "insn_idx", ")", ";", "break", ";", "case", "K_return", ":", "vis", ".", "visitInsn", "(", "opcode", ",", "new", "Arg", "(", "Arg", ".", "Kind", ".", "X", ",", "0", ",", "type_map", ".", "getx", "(", "0", ")", ")", ")", ";", "break", ";", "case", "allocate_heap_zero", ":", "case", "allocate_zero", ":", "{", "Insn", ".", "I", "insn", "=", "(", "Insn", ".", "I", ")", "insn_", ";", "int", "depth", "=", "type_map", ".", "stacksize", ";", "int", "count", "=", "insn", ".", "i1", ";", "Arg", "[", "]", "ys", "=", "new", "Arg", "[", "count", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "ys", "[", "i", "]", "=", "new", "Arg", "(", "Arg", ".", "Kind", ".", "Y", ",", "depth", "+", "i", ",", "null", ")", ";", "}", "vis", ".", "visitInsn", "(", "opcode", ",", "(", "Arg", "[", "]", ")", "ys", ")", ";", "break", ";", "}", "case", "test_heap", ":", "break", ";", "case", "fclearerror", ":", "case", "fcheckerror", ":", "break", ";", "case", "recv_mark", ":", "case", "recv_set", ":", "break", ";", "case", "call_ext_last", ":", "case", "call_ext_only", ":", "do_call", "(", "vis", ",", "insn_idx", ",", "(", "Insn", ".", "I", ")", "insn_", ",", "true", ",", "true", ")", ";", "break", ";", "case", "call_ext", ":", "do_call", "(", "vis", ",", "insn_idx", ",", "(", "Insn", ".", "I", ")", "insn_", ",", "false", ",", "true", ")", ";", "if", "(", "is_exceptional_call", "(", "insn_", ")", ")", "{", "vis", ".", "visitUnreachablePoint", "(", ")", ";", "}", "break", ";", "case", "call", ":", "do_call", "(", "vis", ",", "insn_idx", ",", "(", "Insn", ".", "I", ")", "insn_", ",", "false", ",", "false", ")", ";", "break", ";", "case", "call_last", ":", "case", "call_only", ":", "do_call", "(", "vis", ",", "insn_idx", ",", "(", "Insn", ".", "I", ")", "insn_", ",", "true", ",", "false", ")", ";", "break", ";", "case", "apply_last", ":", "case", "apply", ":", "{", "Insn", ".", "I", "insn", "=", "(", "Insn", ".", "I", ")", "insn_", ";", "Arg", "[", "]", "args", "=", "new", "Arg", "[", "2", "+", "insn", ".", "i1", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "args", "[", "i", "]", "=", "new", "Arg", "(", "Arg", ".", "Kind", ".", "X", ",", "i", ",", "map", "[", "insn_idx", "]", ".", "getx", "(", "i", ")", ")", ";", "}", "vis", ".", "visitInsn", "(", "opcode", ",", "args", ")", ";", "break", ";", "}", "case", "make_fun2", ":", "{", "Insn", ".", "F", "insn", "=", "(", "Insn", ".", "F", ")", "insn_", ";", "ExtFun", "efun", "=", "insn", ".", "anon_fun", ".", "asExtFun", "(", ")", ";", "int", "numfree", "=", "insn", ".", "anon_fun", ".", "free_vars", ";", "int", "index", "=", "insn", ".", "anon_fun", ".", "index", ";", "int", "old_index", "=", "insn", ".", "anon_fun", ".", "old_index", ";", "EBinary", "uniq", "=", "insn", ".", "anon_fun", ".", "mod_md5", ";", "int", "old_uniq", "=", "insn", ".", "anon_fun", ".", "old_uniq", ";", "Arg", "[", "]", "free", "=", "new", "Arg", "[", "numfree", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numfree", ";", "i", "++", ")", "{", "free", "[", "i", "]", "=", "new", "Arg", "(", "Arg", ".", "Kind", ".", "X", ",", "i", ",", "map", "[", "insn_idx", "]", ".", "getx", "(", "i", ")", ")", ";", "}", "vis", ".", "visitInsn", "(", "opcode", ",", "efun", ",", "free", ",", "index", ",", "old_index", ",", "uniq", ",", "old_uniq", ")", ";", "break", ";", "}", "case", "init", ":", "{", "Insn", ".", "D", "insn", "=", "(", "Insn", ".", "D", ")", "insn_", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ")", ";", "break", ";", "}", "case", "put_list", ":", "{", "Insn", ".", "SSD", "insn", "=", "(", "Insn", ".", "SSD", ")", "insn_", ";", "Arg", "[", "]", "in", "=", "new", "Arg", "[", "]", "{", "src_arg", "(", "insn_idx", ",", "insn", ".", "src1", ")", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "src2", ")", "}", ";", "Arg", "out", "=", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "in", ",", "out", ")", ";", "break", ";", "}", "case", "put_tuple", ":", "{", "Insn", ".", "ID", "insn", "=", "(", "Insn", ".", "ID", ")", "insn_", ";", "int", "arity", "=", "insn", ".", "i1", ";", "tuple_reg", "=", "new", "Arg", "(", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ",", "getTupleType", "(", "arity", ")", ")", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "arity", ",", "tuple_reg", ")", ";", "tuple_pos", "=", "1", ";", "break", ";", "}", "case", "put", ":", "{", "Insn", ".", "S", "insn", "=", "(", "Insn", ".", "S", ")", "insn_", ";", "Arg", "val", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "val", ",", "tuple_reg", ",", "tuple_pos", "++", ")", ";", "break", ";", "}", "case", "set_tuple_element", ":", "{", "Insn", ".", "SDI", "insn", "=", "(", "Insn", ".", "SDI", ")", "insn_", ";", "Arg", "in", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ";", "Arg", "out", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "int", "idx", "=", "insn", ".", "i", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "in", ",", "out", ",", "idx", ")", ";", "break", ";", "}", "case", "allocate_heap", ":", "case", "allocate", ":", "case", "deallocate", ":", "{", "break", ";", "}", "case", "select_tuple_arity", ":", "{", "Insn", ".", "Select", "insn", "=", "(", "Insn", ".", "Select", ")", "insn_", ";", "int", "failLabel", "=", "decode_labelref", "(", "insn", ".", "defaultLabel", ",", "type_map", ".", "exh", ")", ";", "Arg", "in", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ";", "Operands", ".", "SelectList", "jumpTable", "=", "insn", ".", "jumpTable", ";", "int", "len", "=", "jumpTable", ".", "size", "(", ")", ";", "int", "[", "]", "arities", "=", "new", "int", "[", "len", "]", ";", "int", "[", "]", "targets", "=", "new", "int", "[", "len", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "Operands", ".", "Operand", "value", "=", "jumpTable", ".", "getValue", "(", "i", ")", ";", "Operands", ".", "Label", "target", "=", "jumpTable", ".", "getLabel", "(", "i", ")", ";", "arities", "[", "i", "]", "=", "value", ".", "asCodeInt", "(", ")", ".", "value", ";", "targets", "[", "i", "]", "=", "decode_labelref", "(", "target", ",", "type_map", ".", "exh", ")", ";", "}", "vis", ".", "visitSelectTuple", "(", "in", ",", "failLabel", ",", "arities", ",", "targets", ")", ";", "break", ";", "}", "case", "select_val", ":", "{", "Insn", ".", "Select", "insn", "=", "(", "Insn", ".", "Select", ")", "insn_", ";", "int", "failLabel", "=", "decode_labelref", "(", "insn", ".", "defaultLabel", ",", "type_map", ".", "exh", ")", ";", "Arg", "in", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ";", "Operands", ".", "SelectList", "jumpTable", "=", "insn", ".", "jumpTable", ";", "int", "len", "=", "jumpTable", ".", "size", "(", ")", ";", "Arg", "[", "]", "values", "=", "new", "Arg", "[", "len", "]", ";", "int", "[", "]", "targets", "=", "new", "int", "[", "len", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "Operands", ".", "Operand", "value", "=", "jumpTable", ".", "getValue", "(", "i", ")", ";", "Operands", ".", "Label", "target", "=", "jumpTable", ".", "getLabel", "(", "i", ")", ";", "values", "[", "i", "]", "=", "arg", "(", "value", ".", "asLiteral", "(", ")", ")", ";", "targets", "[", "i", "]", "=", "decode_labelref", "(", "target", ",", "type_map", ".", "exh", ")", ";", "}", "vis", ".", "visitSelectValue", "(", "in", ",", "failLabel", ",", "values", ",", "targets", ")", ";", "break", ";", "}", "case", "get_tuple_element", ":", "{", "Insn", ".", "SID", "insn", "=", "(", "Insn", ".", "SID", ")", "insn_", ";", "Arg", "in", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ";", "int", "idx", "=", "insn", ".", "i", ";", "Arg", "out", "=", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "in", ",", "out", ",", "idx", ")", ";", "break", ";", "}", "case", "jump", ":", "{", "Insn", ".", "L", "insn", "=", "(", "Insn", ".", "L", ")", "insn_", ";", "vis", ".", "visitJump", "(", "decode_labelref", "(", "insn", ".", "label", ",", "type_map", ".", "exh", ")", ")", ";", "break", ";", "}", "case", "on_load", ":", "case", "trim", ":", "break", ";", "case", "get_list", ":", "{", "Insn", ".", "SDD", "insn", "=", "(", "Insn", ".", "SDD", ")", "insn_", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "new", "Arg", "[", "]", "{", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ",", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest1", ")", ",", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest2", ")", "}", ")", ";", "break", ";", "}", "case", "try_case_end", ":", "case", "badmatch", ":", "case", "case_end", ":", "{", "Insn", ".", "S", "insn", "=", "(", "Insn", ".", "S", ")", "insn_", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ")", ";", "break", ";", "}", "case", "if_end", ":", "vis", ".", "visitInsn", "(", "opcode", ")", ";", "break", ";", "case", "send", ":", "{", "vis", ".", "visitInsn", "(", "opcode", ",", "new", "Arg", "[", "]", "{", "new", "Arg", "(", "Arg", ".", "Kind", ".", "X", ",", "0", ")", ",", "new", "Arg", "(", "Arg", ".", "Kind", ".", "X", ",", "1", ")", "}", ")", ";", "break", ";", "}", "case", "K_try", ":", "case", "K_catch", ":", "{", "Insn", ".", "YL", "insn", "=", "(", "Insn", ".", "YL", ")", "insn_", ";", "TypeMap", "type_map_after", "=", "this", ".", "map", "[", "insn_idx", "+", "1", "]", ";", "vis", ".", "visitCatchBlockStart", "(", "opcode", ",", "decode_labelref", "(", "insn", ".", "label", ",", "type_map", ".", "exh", ")", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "y", ")", ",", "type_map_after", ".", "exh", ")", ";", "break", ";", "}", "case", "raise", ":", "{", "Insn", ".", "SS", "insn", "=", "(", "Insn", ".", "SS", ")", "insn_", ";", "Arg", "[", "]", "in", "=", "{", "src_arg", "(", "insn_idx", ",", "insn", ".", "src1", ")", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "src2", ")", "}", ";", "Arg", "ex", "=", "new", "Arg", "(", "Arg", ".", "Kind", ".", "X", ",", "0", ")", ";", "int", "failLabel", "=", "0", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "failLabel", ",", "in", ",", "ex", ")", ";", "break", ";", "}", "case", "try_end", ":", "case", "try_case", ":", "case", "catch_end", ":", "{", "Insn", ".", "Y", "insn", "=", "(", "Insn", ".", "Y", ")", "insn_", ";", "vis", ".", "visitCatchBlockEnd", "(", "opcode", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "y", ")", ",", "type_map", ".", "exh", ")", ";", "break", ";", "}", "case", "loop_rec", ":", "{", "Insn", ".", "LD", "insn", "=", "(", "Insn", ".", "LD", ")", "insn_", ";", "vis", ".", "visitReceive", "(", "opcode", ",", "decode_labelref", "(", "insn", ".", "label", ",", "type_map", ".", "exh", ")", ",", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ")", ";", "break", ";", "}", "case", "remove_message", ":", "case", "timeout", ":", "vis", ".", "visitInsn", "(", "opcode", ")", ";", "break", ";", "case", "loop_rec_end", ":", "case", "wait", ":", "{", "Insn", ".", "L", "insn", "=", "(", "Insn", ".", "L", ")", "insn_", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "decode_labelref", "(", "insn", ".", "label", ",", "type_map", ".", "exh", ")", ",", "null", ")", ";", "break", ";", "}", "case", "wait_timeout", ":", "{", "Insn", ".", "LS", "insn", "=", "(", "Insn", ".", "LS", ")", "insn_", ";", "vis", ".", "visitInsn", "(", "opcode", ",", "decode_labelref", "(", "insn", ".", "label", ",", "type_map", ".", "exh", ")", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ")", ";", "break", ";", "}", "case", "call_fun", ":", "case", "i_call_fun_last", ":", "{", "Insn", ".", "I", "insn", "=", "(", "Insn", ".", "I", ")", "insn_", ";", "int", "nargs", "=", "insn", ".", "i1", ";", "Arg", "[", "]", "args", "=", "new", "Arg", "[", "nargs", "+", "1", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "args", "[", "i", "]", "=", "new", "Arg", "(", "Arg", ".", "Kind", ".", "X", ",", "i", ",", "map", "[", "insn_idx", "]", ".", "getx", "(", "i", ")", ")", ";", "}", "vis", ".", "visitInsn", "(", "opcode", ",", "args", ",", "new", "Arg", "(", "Arg", ".", "Kind", ".", "X", ",", "0", ",", "null", ")", ")", ";", "break", ";", "}", "case", "bs_add", ":", "{", "Insn", ".", "LSSID", "insn", "=", "(", "Insn", ".", "LSSID", ")", "insn_", ";", "vis", ".", "visitBSAdd", "(", "src_arg", "(", "insn_idx", ",", "insn", ".", "src1", ")", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "src2", ")", ",", "insn", ".", "i3", ",", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ")", ";", "break", ";", "}", "case", "bs_context_to_binary", ":", "{", "Insn", ".", "D", "insn", "=", "(", "Insn", ".", "D", ")", "insn_", ";", "vis", ".", "visitBS", "(", "opcode", ",", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ",", "null", ")", ";", "break", ";", "}", "case", "bs_restore2", ":", "case", "bs_save2", ":", "{", "Insn", ".", "DI", "insn", "=", "(", "Insn", ".", "DI", ")", "insn_", ";", "vis", ".", "visitBS", "(", "opcode", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ",", "insn", ".", "i2", "==", "-", "1", "?", "new", "Arg", "(", "EAtom", ".", "intern", "(", "\"start\"", ")", ")", ":", "new", "Arg", "(", "new", "ESmall", "(", "insn", ".", "i2", ")", ")", ")", ";", "break", ";", "}", "case", "bs_init_writable", ":", "{", "Arg", "size", "=", "src_arg", "(", "insn_idx", ",", "new", "Operands", ".", "XReg", "(", "0", ")", ")", ";", "Arg", "dest", "=", "dest_arg", "(", "new", "Operands", ".", "XReg", "(", "0", ")", ")", ";", "vis", ".", "visitInitWritable", "(", "size", ",", "dest", ")", ";", "break", ";", "}", "case", "bs_init2", ":", "case", "bs_init_bits", ":", "{", "Insn", ".", "LSIIID", "insn", "=", "(", "Insn", ".", "LSIIID", ")", "insn_", ";", "Arg", "size", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src2", ")", ";", "int", "flags", "=", "insn", ".", "i5", ";", "Arg", "out", "=", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "boolean", "unit_is_bits", "=", "(", "opcode", "==", "BeamOpcode", ".", "bs_init_bits", ")", ";", "vis", ".", "visitInitBitString", "(", "size", ",", "flags", ",", "out", ",", "unit_is_bits", ")", ";", "break", ";", "}", "case", "bs_put_string", ":", "{", "Insn", ".", "By", "insn", "=", "(", "Insn", ".", "By", ")", "insn_", ";", "Arg", "str", "=", "arg", "(", "insn", ".", "bin", ")", ";", "vis", ".", "visitBitStringPut", "(", "opcode", ",", "str", ",", "null", ",", "-", "1", ",", "-", "1", ")", ";", "break", ";", "}", "case", "bs_put_binary", ":", "case", "bs_put_integer", ":", "case", "bs_put_float", ":", "{", "Insn", ".", "LSIIS", "insn", "=", "(", "Insn", ".", "LSIIS", ")", "insn_", ";", "Arg", "size", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src2", ")", ";", "int", "unit", "=", "insn", ".", "i3", ";", "int", "flags", "=", "insn", ".", "i4", ";", "Arg", "value", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src5", ")", ";", "vis", ".", "visitBitStringPut", "(", "opcode", ",", "value", ",", "size", ",", "unit", ",", "flags", ")", ";", "break", ";", "}", "case", "bs_put_utf8", ":", "case", "bs_put_utf16", ":", "case", "bs_put_utf32", ":", "{", "Insn", ".", "LIS", "insn", "=", "(", "Insn", ".", "LIS", ")", "insn_", ";", "int", "flags", "=", "insn", ".", "i2", ";", "Arg", "value", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ";", "vis", ".", "visitBitStringPut", "(", "opcode", ",", "value", ",", "null", ",", "-", "1", ",", "flags", ")", ";", "break", ";", "}", "case", "bs_utf8_size", ":", "case", "bs_utf16_size", ":", "{", "Insn", ".", "LSD", "insn", "=", "(", "Insn", ".", "LSD", ")", "insn_", ";", "Arg", "value", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ";", "Arg", "out", "=", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "vis", ".", "visitBS", "(", "opcode", ",", "value", ",", "out", ")", ";", "break", ";", "}", "case", "bs_private_append", ":", "{", "Insn", ".", "BSPrivateAppend", "insn", "=", "(", "Insn", ".", "BSPrivateAppend", ")", "insn_", ";", "Arg", "extra_size", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src2", ")", ";", "Arg", "src", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src4", ")", ";", "int", "unit", "=", "insn", ".", "i3", ";", "int", "flags", "=", "insn", ".", "i5", ";", "Arg", "dst", "=", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "vis", ".", "visitBitStringAppend", "(", "opcode", ",", "decode_labelref", "(", "insn", ".", "label", ",", "type_map", ".", "exh", ")", ",", "extra_size", ",", "src", ",", "unit", ",", "flags", ",", "dst", ")", ";", "break", ";", "}", "case", "bs_append", ":", "{", "Insn", ".", "BSAppend", "insn", "=", "(", "Insn", ".", "BSAppend", ")", "insn_", ";", "Arg", "extra_size", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src2", ")", ";", "Arg", "src", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "src6", ")", ";", "int", "unit", "=", "insn", ".", "i5", ";", "int", "flags", "=", "insn", ".", "i7", ";", "Arg", "dst", "=", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest8", ")", ";", "vis", ".", "visitBitStringAppend", "(", "opcode", ",", "decode_labelref", "(", "insn", ".", "label", ",", "type_map", ".", "exh", ")", ",", "extra_size", ",", "src", ",", "unit", ",", "flags", ",", "dst", ")", ";", "break", ";", "}", "default", ":", "throw", "new", "Error", "(", "\"\"", "+", "insn_", ".", "toSymbolicTuple", "(", ")", ")", ";", "}", "}", "}", "private", "void", "do_call", "(", "BlockVisitor2", "vis", ",", "int", "insn_idx", ",", "Insn", ".", "I", "insn", ",", "boolean", "is_tail", ",", "boolean", "is_external", ")", "throws", "Error", "{", "int", "arg_count", "=", "insn", ".", "i1", ";", "Arg", "[", "]", "args", "=", "new", "Arg", "[", "arg_count", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arg_count", ";", "i", "++", ")", "{", "args", "[", "i", "]", "=", "new", "Arg", "(", "Kind", ".", "X", ",", "i", ",", "this", ".", "map", "[", "insn_idx", "]", ".", "getx", "(", "i", ")", ")", ";", "}", "ExtFun", "fun", ";", "if", "(", "insn", "instanceof", "Insn", ".", "IE", ")", "{", "fun", "=", "(", "(", "Insn", ".", "IE", ")", "insn", ")", ".", "ext_fun", ";", "}", "else", "if", "(", "insn", "instanceof", "Insn", ".", "IL", ")", "{", "fun", "=", "(", "(", "Insn", ".", "IL", ")", "insn", ")", ".", "functionAtLabel", ".", "asExtFun", "(", ")", ";", "}", "else", "throw", "new", "Error", "(", "\"\"", "+", "insn", ")", ";", "vis", ".", "visitCall", "(", "fun", ",", "args", ",", "is_tail", ",", "is_external", ")", ";", "}", "private", "void", "accept_2_test", "(", "BlockVisitor2", "vis", ",", "Insn", ".", "L", "insn_", ",", "int", "insn_idx", ")", "{", "TypeMap", "typeMap", "=", "this", ".", "map", "[", "insn_idx", "]", ";", "int", "failLabel", "=", "decode_labelref", "(", "insn_", ".", "label", ",", "typeMap", ".", "exh", ")", ";", "BeamOpcode", "test", "=", "insn_", ".", "opcode", "(", ")", ";", "if", "(", "insn_", "instanceof", "Insn", ".", "LD", ")", "{", "Insn", ".", "LD", "insn", "=", "(", "Insn", ".", "LD", ")", "insn_", ";", "Arg", "arg", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "Type", "test_type", "=", "type_tested_for", "(", "insn", ")", ";", "if", "(", "test_type", "!=", "null", ")", "{", "if", "(", "insn_", ".", "opcode", "(", ")", "==", "BeamOpcode", ".", "is_nonempty_list", "||", "!", "test_type", ".", "equals", "(", "arg", ".", "type", ")", ")", "vis", ".", "visitTest", "(", "test", ",", "failLabel", ",", "arg", ",", "test_type", ")", ";", "return", ";", "}", "}", "switch", "(", "test", ")", "{", "case", "is_function2", ":", "{", "Insn", ".", "LDS", "insn", "=", "(", "Insn", ".", "LDS", ")", "insn_", ";", "vis", ".", "visitTest", "(", "test", ",", "failLabel", ",", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "src", ")", ",", "EFUN_TYPE", ")", ";", "break", ";", "}", "case", "is_eq_exact", ":", "case", "is_lt", ":", "case", "is_ge", ":", "case", "is_ne_exact", ":", "case", "is_ne", ":", "case", "is_eq", ":", "{", "Insn", ".", "LSS", "insn", "=", "(", "Insn", ".", "LSS", ")", "insn_", ";", "Arg", "[", "]", "args", "=", "new", "Arg", "[", "]", "{", "src_arg", "(", "insn_idx", ",", "insn", ".", "src1", ")", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "src2", ")", "}", ";", "Type", "outType", "=", "Type", ".", "VOID_TYPE", ";", "Type", "t1", "=", "getType", "(", "typeMap", ",", "insn", ".", "src1", ")", ";", "Type", "t2", "=", "getType", "(", "typeMap", ",", "insn", ".", "src2", ")", ";", "if", "(", "t1", ".", "equals", "(", "EOBJECT_TYPE", ")", "&&", "!", "t2", ".", "equals", "(", "EOBJECT_TYPE", ")", ")", "{", "outType", "=", "t2", ";", "}", "if", "(", "t2", ".", "equals", "(", "EOBJECT_TYPE", ")", "&&", "!", "t1", ".", "equals", "(", "EOBJECT_TYPE", ")", ")", "{", "outType", "=", "t1", ";", "}", "vis", ".", "visitTest", "(", "test", ",", "failLabel", ",", "args", ",", "outType", ")", ";", "break", ";", "}", "case", "test_arity", ":", "{", "Insn", ".", "LDI", "insn", "=", "(", "Insn", ".", "LDI", ")", "insn_", ";", "int", "arity", "=", "insn", ".", "i", ";", "Arg", "reg", "=", "src_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ";", "vis", ".", "visitTest", "(", "test", ",", "failLabel", ",", "reg", ",", "arity", ",", "getTupleType", "(", "arity", ")", ")", ";", "break", ";", "}", "case", "bs_start_match2", ":", "case", "bs_get_utf8", ":", "case", "bs_get_utf16", ":", "case", "bs_get_utf32", ":", "{", "Insn", ".", "LDIID", "insn", "=", "(", "Insn", ".", "LDIID", ")", "insn_", ";", "vis", ".", "visitBitStringTest", "(", "test", ",", "failLabel", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ",", "insn", ".", "i4", ",", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest5", ")", ")", ";", "break", ";", "}", "case", "bs_match_string", ":", "{", "Insn", ".", "LDBi", "insn", "=", "(", "Insn", ".", "LDBi", ")", "insn_", ";", "vis", ".", "visitBitStringTest", "(", "test", ",", "failLabel", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ",", "insn", ".", "bin", ".", "value", ")", ";", "break", ";", "}", "case", "bs_get_integer2", ":", "case", "bs_get_float2", ":", "case", "bs_get_binary2", ":", "{", "Insn", ".", "LDISIID", "insn", "=", "(", "Insn", ".", "LDISIID", ")", "insn_", ";", "vis", ".", "visitBitStringTest", "(", "test", ",", "failLabel", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "src4", ")", ",", "insn", ".", "i5", ",", "insn", ".", "i6", ",", "dest_arg", "(", "insn_idx", ",", "insn", ".", "dest7", ")", ")", ";", "break", ";", "}", "case", "bs_skip_bits2", ":", "{", "Insn", ".", "LDSII", "insn", "=", "(", "Insn", ".", "LDSII", ")", "insn_", ";", "vis", ".", "visitBitStringTest", "(", "test", ",", "failLabel", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "src3", ")", ",", "insn", ".", "i4", ",", "insn", ".", "i5", ")", ";", "break", ";", "}", "case", "bs_test_unit", ":", "case", "bs_test_tail2", ":", "{", "Insn", ".", "LDI", "insn", "=", "(", "Insn", ".", "LDI", ")", "insn_", ";", "vis", ".", "visitBitStringTest", "(", "test", ",", "failLabel", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ",", "insn", ".", "i", ")", ";", "break", ";", "}", "case", "bs_skip_utf8", ":", "case", "bs_skip_utf16", ":", "case", "bs_skip_utf32", ":", "{", "Insn", ".", "LDII", "insn", "=", "(", "Insn", ".", "LDII", ")", "insn_", ";", "vis", ".", "visitBitStringTest", "(", "test", ",", "failLabel", ",", "src_arg", "(", "insn_idx", ",", "insn", ".", "dest", ")", ",", "insn", ".", "i4", ")", ";", "break", ";", "}", "default", ":", "throw", "new", "Error", "(", "\"\"", "+", "insn_", ".", "toSymbolic", "(", ")", "+", "\"", "at", "index", "\"", "+", "insn_idx", "+", "\"", "//", "\"", "+", "test", "+", "\":\"", "+", "test", ".", "ordinal", "(", ")", ")", ";", "}", "}", "private", "Arg", "[", "]", "decode_args", "(", "int", "insn_idx", ",", "EObject", "[", "]", "input", ")", "{", "Arg", "[", "]", "output", "=", "new", "Arg", "[", "input", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "input", ".", "length", ";", "i", "++", ")", "{", "output", "[", "i", "]", "=", "decode_arg", "(", "insn_idx", ",", "input", "[", "i", "]", ")", ";", "}", "return", "output", ";", "}", "private", "Arg", "decode_arg", "(", "int", "insn_idx", ",", "EObject", "src", ")", "{", "TypeMap", "current", "=", "this", ".", "map", "[", "insn_idx", "]", ";", "if", "(", "src", "instanceof", "ETuple2", ")", "{", "ETuple2", "tup", "=", "(", "ETuple2", ")", "src", ";", "if", "(", "tup", ".", "elem1", "==", "X_ATOM", ")", "{", "int", "xreg", "=", "tup", ".", "elem2", ".", "asInt", "(", ")", ";", "return", "new", "Arg", "(", "Arg", ".", "Kind", ".", "X", ",", "xreg", ",", "current", ".", "getx", "(", "xreg", ")", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "Y_ATOM", ")", "{", "int", "yreg", "=", "tup", ".", "elem2", ".", "asInt", "(", ")", ";", "return", "new", "Arg", "(", "Arg", ".", "Kind", ".", "Y", ",", "current", ".", "get_ypos", "(", "yreg", ")", ",", "current", ".", "gety", "(", "yreg", ")", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "FR_ATOM", ")", "{", "int", "freg", "=", "tup", ".", "elem2", ".", "asInt", "(", ")", ";", "return", "new", "Arg", "(", "Arg", ".", "Kind", ".", "F", ",", "freg", ",", "Type", ".", "DOUBLE_TYPE", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "ATOM_ATOM", ")", "{", "return", "new", "Arg", "(", "tup", ".", "elem2", ",", "EATOM_TYPE", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "LITERAL_ATOM", ")", "{", "return", "new", "Arg", "(", "tup", ".", "elem2", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "STRING_ATOM", ")", "{", "return", "new", "Arg", "(", "tup", ".", "elem2", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "INTEGER_ATOM", ")", "{", "return", "new", "Arg", "(", "tup", ".", "elem2", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "FLOAT_ATOM", ")", "{", "return", "new", "Arg", "(", "tup", ".", "elem2", ",", "Type", ".", "DOUBLE_TYPE", ")", ";", "}", "}", "else", "if", "(", "src", "==", "NIL_ATOM", ")", "{", "return", "new", "Arg", "(", "ERT", ".", "NIL", ",", "ENIL_TYPE", ")", ";", "}", "return", "new", "Arg", "(", "src", ")", ";", "}", "private", "Arg", "[", "]", "src_args", "(", "int", "insn_idx", ",", "SourceOperand", "[", "]", "args", ")", "{", "Arg", "[", "]", "res", "=", "new", "Arg", "[", "args", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "res", "[", "i", "]", "=", "src_arg", "(", "insn_idx", ",", "args", "[", "i", "]", ")", ";", "}", "return", "res", ";", "}", "private", "Arg", "src_arg", "(", "int", "insn_idx", ",", "SourceOperand", "src", ")", "{", "TypeMap", "current", "=", "this", ".", "map", "[", "insn_idx", "]", ";", "if", "(", "src", "instanceof", "Operands", ".", "XReg", ")", "return", "src_arg", "(", "(", "Operands", ".", "XReg", ")", "src", ",", "current", ")", ";", "if", "(", "src", "instanceof", "Operands", ".", "YReg", ")", "return", "src_arg", "(", "(", "Operands", ".", "YReg", ")", "src", ",", "current", ")", ";", "if", "(", "src", "instanceof", "Operands", ".", "FReg", ")", "return", "arg", "(", "(", "Operands", ".", "FReg", ")", "src", ")", ";", "if", "(", "src", "instanceof", "Operands", ".", "Float", ")", "return", "arg", "(", "(", "Operands", ".", "Float", ")", "src", ")", ";", "if", "(", "src", "instanceof", "Operands", ".", "Literal", ")", "return", "arg", "(", "(", "Operands", ".", "Literal", ")", "src", ")", ";", "throw", "new", "Error", "(", "\"\"", "+", "src", ".", "toSymbolic", "(", ")", ")", ";", "}", "private", "Arg", "dest_arg", "(", "int", "insn_idx", ",", "DestinationOperand", "dest", ")", "{", "TypeMap", "current", "=", "this", ".", "map", "[", "insn_idx", "]", ";", "if", "(", "dest", "instanceof", "Operands", ".", "XReg", ")", "return", "dest_arg", "(", "(", "Operands", ".", "XReg", ")", "dest", ")", ";", "if", "(", "dest", "instanceof", "Operands", ".", "YReg", ")", "return", "dest_arg", "(", "(", "Operands", ".", "YReg", ")", "dest", ",", "current", ")", ";", "if", "(", "dest", "instanceof", "Operands", ".", "FReg", ")", "return", "arg", "(", "(", "Operands", ".", "FReg", ")", "dest", ")", ";", "throw", "new", "Error", "(", "\"\"", "+", "dest", ".", "toSymbolic", "(", ")", ")", ";", "}", "private", "Arg", "src_arg", "(", "Operands", ".", "XReg", "xreg", ",", "TypeMap", "tm", ")", "{", "return", "new", "Arg", "(", "Kind", ".", "X", ",", "xreg", ".", "nr", ",", "tm", ".", "getx", "(", "xreg", ".", "nr", ")", ")", ";", "}", "private", "Arg", "src_arg", "(", "Operands", ".", "YReg", "yreg", ",", "TypeMap", "tm", ")", "{", "return", "new", "Arg", "(", "Kind", ".", "Y", ",", "tm", ".", "get_ypos", "(", "yreg", ".", "nr", ")", ",", "tm", ".", "gety", "(", "yreg", ".", "nr", ")", ")", ";", "}", "private", "Arg", "dest_arg", "(", "Operands", ".", "XReg", "xreg", ")", "{", "return", "new", "Arg", "(", "Kind", ".", "X", ",", "xreg", ".", "nr", ")", ";", "}", "private", "Arg", "dest_arg", "(", "Operands", ".", "YReg", "yreg", ",", "TypeMap", "tm", ")", "{", "return", "new", "Arg", "(", "Kind", ".", "Y", ",", "tm", ".", "get_ypos", "(", "yreg", ".", "nr", ")", ")", ";", "}", "private", "Arg", "arg", "(", "Operands", ".", "FReg", "freg", ")", "{", "return", "new", "Arg", "(", "Kind", ".", "F", ",", "freg", ".", "nr", ")", ";", "}", "private", "Arg", "arg", "(", "Operands", ".", "Float", "flt", ")", "{", "return", "new", "Arg", "(", "flt", ".", "literalValue", "(", ")", ",", "Type", ".", "DOUBLE_TYPE", ")", ";", "}", "private", "Arg", "arg", "(", "Operands", ".", "Literal", "lit", ")", "{", "return", "new", "Arg", "(", "lit", ".", "literalValue", "(", ")", ")", ";", "}", "private", "Arg", "decode_value", "(", "EObject", "src", ")", "{", "if", "(", "src", "instanceof", "ETuple2", ")", "{", "ETuple2", "tup", "=", "(", "ETuple2", ")", "src", ";", "if", "(", "tup", ".", "elem1", "==", "ATOM_ATOM", ")", "{", "return", "new", "Arg", "(", "tup", ".", "elem2", ",", "EATOM_TYPE", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "LITERAL_ATOM", ")", "{", "return", "new", "Arg", "(", "tup", ".", "elem2", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "INTEGER_ATOM", ")", "{", "return", "new", "Arg", "(", "tup", ".", "elem2", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "FLOAT_ATOM", ")", "{", "return", "new", "Arg", "(", "tup", ".", "elem2", ")", ";", "}", "}", "else", "if", "(", "src", "==", "NIL_ATOM", ")", "{", "return", "new", "Arg", "(", "ERT", ".", "NIL", ",", "ENIL_TYPE", ")", ";", "}", "throw", "new", "Error", "(", "\"\"", "+", "src", ")", ";", "}", "private", "Arg", "decode_out_arg", "(", "int", "insn_idx", ",", "EObject", "src", ")", "{", "TypeMap", "current", "=", "this", ".", "map", "[", "insn_idx", "]", ";", "if", "(", "src", "instanceof", "ETuple2", ")", "{", "ETuple2", "tup", "=", "(", "ETuple2", ")", "src", ";", "if", "(", "tup", ".", "elem1", "==", "X_ATOM", ")", "{", "int", "xreg", "=", "tup", ".", "elem2", ".", "asInt", "(", ")", ";", "return", "new", "Arg", "(", "Arg", ".", "Kind", ".", "X", ",", "xreg", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "Y_ATOM", ")", "{", "int", "yreg", "=", "tup", ".", "elem2", ".", "asInt", "(", ")", ";", "return", "new", "Arg", "(", "Arg", ".", "Kind", ".", "Y", ",", "current", ".", "get_ypos", "(", "yreg", ")", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "FR_ATOM", ")", "{", "int", "freg", "=", "tup", ".", "elem2", ".", "asInt", "(", ")", ";", "return", "new", "Arg", "(", "Arg", ".", "Kind", ".", "F", ",", "freg", ")", ";", "}", "}", "throw", "new", "Error", "(", ")", ";", "}", "private", "int", "decode_labelref", "(", "EObject", "f_tup", ",", "ExceptionHandler", "exh", ")", "{", "if", "(", "f_tup", "==", "NOFAIL_ATOM", ")", "return", "0", ";", "assert", "(", "f_tup", ".", "testTuple", "(", ")", ".", "elm", "(", "1", ")", "==", "F_ATOM", ")", ";", "return", "extendedLabel", "(", "f_tup", ".", "testTuple", "(", ")", ".", "elm", "(", "2", ")", ".", "asInt", "(", ")", ",", "exh", ")", ";", "}", "private", "int", "decode_labelref", "(", "Operands", ".", "Label", "label", ",", "ExceptionHandler", "exh", ")", "{", "if", "(", "label", "==", "null", ")", "return", "0", ";", "return", "extendedLabel", "(", "label", ".", "nr", ",", "exh", ")", ";", "}", "public", "boolean", "isDeadCode", "(", ")", "{", "return", "initial", "==", "null", ";", "}", "public", "void", "analyze", "(", ")", "{", "try", "{", "analyze0", "(", ")", ";", "}", "catch", "(", "RuntimeException", "x", ")", "{", "throw", "x", ";", "}", "}", "private", "void", "dump", "(", ")", "{", "if", "(", "!", "log", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "return", ";", "next_insn", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "insns", ".", "size", "(", ")", ";", "i", "++", ")", "{", "log", ".", "finer", "(", "name", "+", "\"(\"", "+", "block_label", "+", "\"):\"", "+", "i", "+", "\"", "::", "\"", "+", "(", "map", "==", "null", "?", "\"?\"", ":", "map", "[", "i", "]", ")", ")", ";", "log", ".", "finer", "(", "\"", ">>", "\"", "+", "insns", ".", "get", "(", "i", ")", ")", ";", "}", "}", "public", "void", "analyze0", "(", ")", "{", "TypeMap", "current", "=", "initial", ";", "BeamOpcode", "last_opcode", "=", "BeamOpcode", ".", "NONE", ";", "Insn", "last_insn", "=", "null", ";", "map", "=", "new", "TypeMap", "[", "insns", ".", "size", "(", ")", "]", ";", "next_insn", ":", "for", "(", "int", "insn_idx", "=", "0", ";", "insn_idx", "<", "insns", ".", "size", "(", ")", ";", "insn_idx", "++", ")", "{", "update_max_regs", "(", "current", ")", ";", "if", "(", "is_term", "(", "last_opcode", ")", ")", "{", "throw", "new", "Error", "(", "\"\"", "+", "this", ".", "block_label", "+", "\":\"", "+", "insn_idx", ")", ";", "}", "map", "[", "insn_idx", "]", "=", "current", ";", "Insn", "insn_", "=", "insns", ".", "get", "(", "insn_idx", ")", ";", "BeamOpcode", "code", "=", "insn_", ".", "opcode", "(", ")", ";", "last_opcode", "=", "code", ";", "last_insn", "=", "insn_", ";", "if", "(", "current", ".", "exh", "!=", "null", "&&", "may_terminate_exceptionally", "(", "code", ")", ")", "addExceptionEdge", "(", "current", ")", ";", "switch", "(", "code", ")", "{", "case", "fmove", ":", "case", "move", ":", "{", "Insn", ".", "SD", "insn", "=", "(", "Insn", ".", "SD", ")", "insn_", ";", "SourceOperand", "src", "=", "insn", ".", "src", ";", "DestinationOperand", "dst", "=", "insn", ".", "dest", ";", "Type", "srcType", "=", "getType", "(", "current", ",", "src", ")", ";", "Type", "dstType", "=", "srcType", ";", "if", "(", "dst", ".", "testFReg", "(", ")", "!=", "null", ")", "{", "dstType", "=", "Type", ".", "DOUBLE_TYPE", ";", "}", "else", "if", "(", "sizeof", "(", "current", ",", "src", ")", ">", "sizeof", "(", "current", ",", "dst", ")", ")", "{", "if", "(", "srcType", ".", "equals", "(", "Type", ".", "DOUBLE_TYPE", ")", ")", "{", "dstType", "=", "EDOUBLE_TYPE", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"why?\"", "+", "insn", ".", "toSymbolic", "(", ")", "+", "\";", "srcType=\"", "+", "getType", "(", "current", ",", "src", ")", ")", ";", "}", "}", "current", "=", "setType", "(", "current", ",", "dst", ",", "dstType", ")", ";", "continue", "next_insn", ";", "}", "case", "put_string", ":", "{", "Insn", ".", "ByD", "insn", "=", "(", "Insn", ".", "ByD", ")", "insn_", ";", "DestinationOperand", "dst", "=", "insn", ".", "dest", ";", "current", "=", "setType", "(", "current", ",", "dst", ",", "ESEQ_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "jump", ":", "{", "Insn", ".", "L", "insn", "=", "(", "Insn", ".", "L", ")", "insn_", ";", "current", "=", "branch", "(", "current", ",", "insn", ".", "label", ",", "insn_idx", ")", ";", "continue", "next_insn", ";", "}", "case", "send", ":", "{", "current", ".", "touchx", "(", "0", ",", "2", ")", ";", "current", "=", "current", ".", "setx", "(", "0", ",", "current", ".", "getx", "(", "1", ")", ",", "FV", ".", "this", ")", ";", "continue", "next_insn", ";", "}", "case", "fadd", ":", "case", "fsub", ":", "case", "fmul", ":", "case", "fdiv", ":", "{", "Insn", ".", "LSSD", "insn", "=", "(", "Insn", ".", "LSSD", ")", "insn_", ";", "EAtom", "name", "=", "insn", ".", "opcode", "(", ")", ".", "symbol", ";", "SourceOperand", "[", "]", "parms", "=", "new", "SourceOperand", "[", "]", "{", "insn", ".", "src1", ",", "insn", ".", "src2", "}", ";", "Type", "type", "=", "getBifResult", "(", "\"erlang\"", ",", "name", ".", "getName", "(", ")", ",", "parmTypes", "(", "current", ",", "parms", ")", ",", "false", ")", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "type", ")", ";", "continue", "next_insn", ";", "}", "case", "gc_bif1", ":", "case", "gc_bif2", ":", "{", "Insn", ".", "GcBif", "insn", "=", "(", "Insn", ".", "GcBif", ")", "insn_", ";", "boolean", "is_guard", "=", "(", "insn", ".", "label", ".", "nr", "!=", "0", ")", ";", "current", "=", "branch", "(", "current", ",", "insn", ".", "label", ",", "insn_idx", ")", ";", "EAtom", "name", "=", "insn", ".", "ext_fun", ".", "fun", ";", "SourceOperand", "[", "]", "parms", "=", "insn", ".", "argList", "(", ")", ";", "Type", "type", "=", "getBifResult", "(", "\"erlang\"", ",", "name", ".", "getName", "(", ")", ",", "parmTypes", "(", "current", ",", "parms", ")", ",", "is_guard", ")", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "type", ")", ";", "continue", "next_insn", ";", "}", "case", "bif0", ":", "case", "bif1", ":", "case", "bif2", ":", "{", "Insn", ".", "Bif", "insn", "=", "(", "Insn", ".", "Bif", ")", "insn_", ";", "current", "=", "branch", "(", "current", ",", "insn", ".", "label", ",", "insn_idx", ")", ";", "EAtom", "name", "=", "insn", ".", "ext_fun", ".", "fun", ";", "SourceOperand", "[", "]", "parms", "=", "insn", ".", "argList", "(", ")", ";", "Type", "type", "=", "getBifResult", "(", "\"erlang\"", ",", "name", ".", "getName", "(", ")", ",", "parmTypes", "(", "current", ",", "parms", ")", ",", "false", ")", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "type", ")", ";", "continue", "next_insn", ";", "}", "case", "is_tuple", ":", "{", "if", "(", "insn_idx", "+", "1", "<", "insns", ".", "size", "(", ")", ")", "{", "Insn", "next_insn", "=", "insns", ".", "get", "(", "insn_idx", "+", "1", ")", ";", "if", "(", "next_insn", ".", "opcode", "(", ")", "==", "BeamOpcode", ".", "test_arity", ")", "{", "if", "(", "this", ".", "map", "[", "insn_idx", "+", "1", "]", "==", "null", ")", "{", "this", ".", "map", "[", "insn_idx", "+", "1", "]", "=", "this", ".", "map", "[", "insn_idx", "]", ";", "}", "int", "this_fail", "=", "decode_labelref", "(", "(", "(", "Insn", ".", "L", ")", "insn_", ")", ".", "label", ",", "this", ".", "map", "[", "insn_idx", "]", ".", "exh", ")", ";", "int", "next_fail", "=", "decode_labelref", "(", "(", "(", "Insn", ".", "L", ")", "next_insn", ")", ".", "label", ",", "this", ".", "map", "[", "insn_idx", "+", "1", "]", ".", "exh", ")", ";", "if", "(", "this_fail", "==", "next_fail", ")", "{", "Arg", "this_arg", "=", "src_arg", "(", "insn_idx", ",", "(", "(", "Insn", ".", "LD", ")", "insn_", ")", ".", "dest", ")", ";", "Arg", "next_arg", "=", "src_arg", "(", "insn_idx", "+", "1", ",", "(", "(", "Insn", ".", "LD", ")", "next_insn", ")", ".", "dest", ")", ";", "if", "(", "this_arg", ".", "equals", "(", "next_arg", ")", ")", "{", "continue", "next_insn", ";", "}", "}", "}", "}", "}", "case", "is_integer", ":", "case", "is_float", ":", "case", "is_number", ":", "case", "is_atom", ":", "case", "is_pid", ":", "case", "is_reference", ":", "case", "is_port", ":", "case", "is_nil", ":", "case", "is_binary", ":", "case", "is_list", ":", "case", "is_nonempty_list", ":", "case", "is_function", ":", "case", "is_boolean", ":", "case", "is_bitstr", ":", "case", "test_arity", ":", "case", "bs_test_tail2", ":", "case", "bs_test_unit", ":", "case", "is_lt", ":", "case", "is_ge", ":", "case", "is_eq", ":", "case", "is_ne", ":", "case", "is_eq_exact", ":", "case", "is_ne_exact", ":", "case", "is_function2", ":", "case", "bs_match_string", ":", "case", "bs_skip_utf8", ":", "case", "bs_skip_utf16", ":", "case", "bs_skip_utf32", ":", "case", "bs_start_match2", ":", "case", "bs_get_utf8", ":", "case", "bs_get_utf16", ":", "case", "bs_get_utf32", ":", "case", "bs_skip_bits2", ":", "case", "bs_get_integer2", ":", "case", "bs_get_float2", ":", "case", "bs_get_binary2", ":", "{", "try", "{", "current", "=", "analyze_test", "(", "current", ",", "(", "Insn", ".", "L", ")", "insn_", ",", "insn_idx", ")", ";", "}", "catch", "(", "Error", "e", ")", "{", "throw", "new", "Error", "(", "\"", "at", "\"", "+", "LabeledBlock", ".", "this", ".", "block_label", "+", "\":\"", "+", "insn_idx", ",", "e", ")", ";", "}", "assert", "(", "current", "!=", "null", ")", ";", "continue", "next_insn", ";", "}", "case", "fconv", ":", "{", "Insn", ".", "SD", "insn", "=", "(", "Insn", ".", "SD", ")", "insn_", ";", "getType", "(", "current", ",", "insn", ".", "src", ")", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "Type", ".", "DOUBLE_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "init", ":", "{", "Insn", ".", "D", "insn", "=", "(", "Insn", ".", "D", ")", "insn_", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "ENIL_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "set_tuple_element", ":", "{", "Insn", ".", "SDI", "insn", "=", "(", "Insn", ".", "SDI", ")", "insn_", ";", "getType", "(", "current", ",", "insn", ".", "src", ")", ";", "getType", "(", "current", ",", "insn", ".", "dest", ")", ";", "continue", "next_insn", ";", "}", "case", "get_tuple_element", ":", "{", "Insn", ".", "SID", "insn", "=", "(", "Insn", ".", "SID", ")", "insn_", ";", "getType", "(", "current", ",", "insn", ".", "src", ")", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "EOBJECT_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "get_list", ":", "{", "Insn", ".", "SDD", "insn", "=", "(", "Insn", ".", "SDD", ")", "insn_", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest1", ",", "EOBJECT_TYPE", ")", ";", "Type", "list_type", "=", "getType", "(", "current", ",", "insn", ".", "src", ")", ";", "Type", "tail_type", "=", "(", "list_type", "==", "ELIST_TYPE", "||", "list_type", "==", "ESEQ_TYPE", ")", "?", "ESEQ_TYPE", ":", "EOBJECT_TYPE", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest2", ",", "tail_type", ")", ";", "continue", "next_insn", ";", "}", "case", "put_list", ":", "{", "Insn", ".", "SSD", "insn", "=", "(", "Insn", ".", "SSD", ")", "insn_", ";", "Type", "head_type", "=", "getType", "(", "current", ",", "insn", ".", "src1", ")", ";", "Type", "tail_type", "=", "getType", "(", "current", ",", "insn", ".", "src2", ")", ";", "if", "(", "tail_type", "==", "null", ")", "{", "throw", "new", "Error", "(", "\"value:", "\"", "+", "insn", ".", "src2", ".", "toSymbolic", "(", ")", "+", "\"", "has", "no", "type\"", ")", ";", "}", "Type", "list_type", "=", "(", "tail_type", ".", "equals", "(", "ENIL_TYPE", ")", "||", "tail_type", ".", "equals", "(", "ESEQ_TYPE", ")", "||", "tail_type", ".", "equals", "(", "ELIST_TYPE", ")", ")", "?", "ELIST_TYPE", ":", "ECONS_TYPE", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "list_type", ")", ";", "continue", "next_insn", ";", "}", "case", "put_tuple", ":", "{", "Insn", ".", "ID", "insn", "=", "(", "Insn", ".", "ID", ")", "insn_", ";", "int", "arity", "=", "insn", ".", "i1", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "getTupleType", "(", "arity", ")", ")", ";", "continue", "next_insn", ";", "}", "case", "K_try", ":", "{", "Insn", ".", "YL", "insn", "=", "(", "Insn", ".", "YL", ")", "insn_", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "y", ",", "EOBJECT_TYPE", ")", ";", "current", "=", "installExceptionHandler", "(", "current", ",", "insn", ".", "label", ",", "insn_idx", ")", ";", "continue", "next_insn", ";", "}", "case", "try_end", ":", "{", "current", "=", "current", ".", "popExceptionHandler", "(", ")", ";", "continue", "next_insn", ";", "}", "case", "try_case", ":", "{", "Insn", ".", "Y", "insn", "=", "(", "Insn", ".", "Y", ")", "insn_", ";", "getType", "(", "current", ",", "insn", ".", "y", ")", ";", "current", "=", "current", ".", "popExceptionHandler", "(", ")", ";", "current", "=", "current", ".", "setx", "(", "0", ",", "EATOM_TYPE", ",", "FV", ".", "this", ")", ";", "current", "=", "current", ".", "setx", "(", "1", ",", "EOBJECT_TYPE", ",", "FV", ".", "this", ")", ";", "current", "=", "current", ".", "setx", "(", "2", ",", "EOBJECT_TYPE", ",", "FV", ".", "this", ")", ";", "continue", "next_insn", ";", "}", "case", "try_case_end", ":", "continue", "next_insn", ";", "case", "raise", ":", "{", "Insn", ".", "SS", "insn", "=", "(", "Insn", ".", "SS", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "src1", ")", ";", "checkArg", "(", "current", ",", "insn", ".", "src2", ")", ";", "current", "=", "setType", "(", "current", ",", "Operands", ".", "XReg", ".", "get", "(", "0", ")", ",", "EOBJECT_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "K_catch", ":", "{", "Insn", ".", "YL", "insn", "=", "(", "Insn", ".", "YL", ")", "insn_", ";", "current", "=", "installExceptionHandler", "(", "current", ",", "insn", ".", "label", ",", "insn_idx", ")", ";", "continue", "next_insn", ";", "}", "case", "catch_end", ":", "{", "current", "=", "current", ".", "popExceptionHandler", "(", ")", ";", "current", "=", "current", ".", "setx", "(", "0", ",", "EOBJECT_TYPE", ",", "FV", ".", "this", ")", ";", "continue", "next_insn", ";", "}", "case", "make_fun2", ":", "{", "Insn", ".", "F", "insn", "=", "(", "Insn", ".", "F", ")", "insn_", ";", "current", ".", "touchx", "(", "0", ",", "insn", ".", "anon_fun", ".", "free_vars", ")", ";", "current", "=", "current", ".", "setx", "(", "0", ",", "EFUN_TYPE", ",", "FV", ".", "this", ")", ";", "continue", "next_insn", ";", "}", "case", "loop_rec", ":", "{", "Insn", ".", "LD", "insn", "=", "(", "Insn", ".", "LD", ")", "insn_", ";", "current", "=", "branch", "(", "current", ",", "insn", ".", "label", ",", "insn_idx", ")", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "EOBJECT_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "remove_message", ":", "continue", "next_insn", ";", "case", "loop_rec_end", ":", "case", "timeout", ":", "{", "continue", "next_insn", ";", "}", "case", "wait_timeout", ":", "{", "checkArg", "(", "current", ",", "(", "(", "Insn", ".", "LS", ")", "insn_", ")", ".", "src", ")", ";", "}", "case", "wait", ":", "{", "Insn", ".", "L", "insn", "=", "(", "Insn", ".", "L", ")", "insn_", ";", "current", "=", "branch", "(", "current", ",", "insn", ".", "label", ",", "insn_idx", ")", ";", "continue", "next_insn", ";", "}", "case", "deallocate", ":", "case", "trim", ":", "{", "Insn", ".", "I", "insn", "=", "(", "Insn", ".", "I", ")", "insn_", ";", "int", "howmuch", "=", "insn", ".", "i1", ";", "current", "=", "current", ".", "trim_y", "(", "howmuch", ")", ";", "continue", "next_insn", ";", "}", "case", "on_load", ":", "case", "test_heap", ":", "{", "continue", "next_insn", ";", "}", "case", "allocate_zero", ":", "case", "allocate_heap_zero", ":", "{", "Insn", ".", "I", "insn", "=", "(", "Insn", ".", "I", ")", "insn_", ";", "int", "slots", "=", "insn", ".", "i1", ";", "current", "=", "current", ".", "alloc_y", "(", "slots", ")", ";", "for", "(", "int", "slot", "=", "0", ";", "slot", "<", "slots", ";", "slot", "++", ")", "{", "current", "=", "current", ".", "sety", "(", "slot", ",", "ENIL_TYPE", ")", ";", "}", "continue", "next_insn", ";", "}", "case", "allocate", ":", "case", "allocate_heap", ":", "{", "Insn", ".", "I", "insn", "=", "(", "Insn", ".", "I", ")", "insn_", ";", "current", "=", "current", ".", "alloc_y", "(", "insn", ".", "i1", ")", ";", "continue", "next_insn", ";", "}", "case", "fcheckerror", ":", "case", "fclearerror", ":", "continue", "next_insn", ";", "case", "recv_mark", ":", "case", "recv_set", ":", "continue", "next_insn", ";", "case", "put", ":", "{", "Insn", ".", "S", "insn", "=", "(", "Insn", ".", "S", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "src", ")", ";", "continue", "next_insn", ";", "}", "case", "select_tuple_arity", ":", "{", "Insn", ".", "Select", "insn", "=", "(", "Insn", ".", "Select", ")", "insn_", ";", "current", "=", "branch", "(", "current", ",", "insn", ".", "defaultLabel", ",", "insn_idx", ")", ";", "checkArg", "(", "current", ",", "insn", ".", "src", ")", ";", "DestinationOperand", "dest", "=", "insn", ".", "src", ".", "testDestination", "(", ")", ";", "Operands", ".", "SelectList", "jumpTable", "=", "insn", ".", "jumpTable", ";", "int", "len", "=", "jumpTable", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "Operands", ".", "Operand", "value", "=", "jumpTable", ".", "getValue", "(", "i", ")", ";", "Operands", ".", "Label", "target", "=", "jumpTable", ".", "getLabel", "(", "i", ")", ";", "if", "(", "dest", "!=", "null", ")", "{", "int", "arity", "=", "value", ".", "asCodeInt", "(", ")", ".", "value", ";", "current", "=", "setType", "(", "current", ",", "dest", ",", "getTupleType", "(", "arity", ")", ")", ";", "}", "current", "=", "branch", "(", "current", ",", "target", ",", "insn_idx", ")", ";", "}", "continue", "next_insn", ";", "}", "case", "select_val", ":", "{", "Insn", ".", "Select", "insn", "=", "(", "Insn", ".", "Select", ")", "insn_", ";", "current", "=", "branch", "(", "current", ",", "insn", ".", "defaultLabel", ",", "insn_idx", ")", ";", "checkArg", "(", "current", ",", "insn", ".", "src", ")", ";", "Operands", ".", "SelectList", "jumpTable", "=", "insn", ".", "jumpTable", ";", "int", "len", "=", "jumpTable", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "Operands", ".", "Label", "target", "=", "jumpTable", ".", "getLabel", "(", "i", ")", ";", "current", "=", "branch", "(", "current", ",", "target", ",", "insn_idx", ")", ";", "}", "continue", "next_insn", ";", "}", "case", "apply", ":", "case", "call", ":", "case", "call_ext", ":", "{", "Insn", ".", "I", "insn", "=", "(", "Insn", ".", "I", ")", "insn_", ";", "int", "argCount", "=", "insn", ".", "i1", ";", "current", ".", "touchx", "(", "0", ",", "argCount", ")", ";", "current", "=", "current", ".", "setx", "(", "0", ",", "EOBJECT_TYPE", ",", "FV", ".", "this", ")", ";", "continue", "next_insn", ";", "}", "case", "K_return", ":", "getType", "(", "current", ",", "X0_REG", ")", ";", "continue", "next_insn", ";", "case", "apply_last", ":", "case", "call_last", ":", "case", "call_only", ":", "case", "call_ext_last", ":", "case", "call_ext_only", ":", "{", "Insn", ".", "I", "insn", "=", "(", "Insn", ".", "I", ")", "insn_", ";", "int", "argCount", "=", "insn", ".", "i1", ";", "current", ".", "touchx", "(", "0", ",", "argCount", ")", ";", "is_tail_recursive", "=", "true", ";", "continue", "next_insn", ";", "}", "case", "func_info", ":", "continue", "next_insn", ";", "case", "if_end", ":", "case", "badmatch", ":", "case", "case_end", ":", "continue", "next_insn", ";", "case", "bs_add", ":", "{", "Insn", ".", "LSSID", "insn", "=", "(", "Insn", ".", "LSSID", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "src1", ")", ";", "checkArg", "(", "current", ",", "insn", ".", "src2", ")", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "Type", ".", "INT_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "bs_context_to_binary", ":", "{", "Insn", ".", "D", "insn", "=", "(", "Insn", ".", "D", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "dest", ")", ";", "current", "=", "current", ".", "setx", "(", "0", ",", "EBINARY_TYPE", ",", "FV", ".", "this", ")", ";", "continue", "next_insn", ";", "}", "case", "bs_save2", ":", "{", "continue", "next_insn", ";", "}", "case", "bs_restore2", ":", "{", "Insn", ".", "DI", "insn", "=", "(", "Insn", ".", "DI", ")", "insn_", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "EMATCHSTATE_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "bs_init2", ":", "{", "Insn", ".", "LSIIID", "insn", "=", "(", "Insn", ".", "LSIIID", ")", "insn_", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "EBINARY_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "bs_init_bits", ":", "{", "Insn", ".", "LSIIID", "insn", "=", "(", "Insn", ".", "LSIIID", ")", "insn_", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "EBITSTRING_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "bs_init_writable", ":", "{", "XReg", "x0", "=", "new", "Operands", ".", "XReg", "(", "0", ")", ";", "checkArg", "(", "current", ",", "x0", ")", ";", "current", "=", "setType", "(", "current", ",", "x0", ",", "EBITSTRING_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "bs_private_append", ":", "{", "Insn", ".", "BSPrivateAppend", "insn", "=", "(", "Insn", ".", "BSPrivateAppend", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "src2", ")", ";", "checkArg", "(", "current", ",", "insn", ".", "src4", ")", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "EBITSTRING_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "bs_append", ":", "{", "Insn", ".", "BSAppend", "insn", "=", "(", "Insn", ".", "BSAppend", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "src6", ")", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest8", ",", "EBITSTRING_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "bs_put_string", ":", "case", "bs_put_binary", ":", "case", "bs_put_float", ":", "case", "bs_put_integer", ":", "{", "continue", "next_insn", ";", "}", "case", "bs_put_utf8", ":", "case", "bs_put_utf16", ":", "case", "bs_put_utf32", ":", "{", "Insn", ".", "LIS", "insn", "=", "(", "Insn", ".", "LIS", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "src", ")", ";", "continue", "next_insn", ";", "}", "case", "bs_utf8_size", ":", "case", "bs_utf16_size", ":", "{", "Insn", ".", "LSD", "insn", "=", "(", "Insn", ".", "LSD", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "src", ")", ";", "current", "=", "setType", "(", "current", ",", "insn", ".", "dest", ",", "ESMALL_TYPE", ")", ";", "continue", "next_insn", ";", "}", "case", "call_fun", ":", "case", "i_call_fun_last", ":", "{", "Insn", ".", "I", "insn", "=", "(", "Insn", ".", "I", ")", "insn_", ";", "int", "nargs", "=", "insn", ".", "i1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nargs", ";", "i", "++", ")", "{", "if", "(", "current", ".", "getx", "(", "i", ")", "==", "null", ")", "throw", "new", "Error", "(", "\"\"", "+", "i", ")", ";", "}", "if", "(", "code", "==", "BeamOpcode", ".", "i_call_fun_last", ")", "{", "is_tail_recursive", "=", "true", ";", "}", "else", "{", "current", "=", "current", ".", "setx", "(", "0", ",", "EOBJECT_TYPE", ",", "FV", ".", "this", ")", ";", "}", "continue", "next_insn", ";", "}", "default", ":", "{", "ETuple", "insn", "=", "insn_", ".", "toSymbolicTuple", "(", ")", ";", "throw", "new", "Error", "(", "\"unhandled:", "\"", "+", "insn", "+", "\"::\"", "+", "current", ")", ";", "}", "}", "}", "update_max_regs", "(", "current", ")", ";", "if", "(", "is_term", "(", "last_opcode", ")", "==", "false", "&&", "!", "is_exceptional_call", "(", "last_insn", ")", ")", "{", "LabeledBlock", "lbv", ";", "lbv", "=", "get_lb", "(", "this", ".", "block_label", "+", "1", ",", "false", ")", ";", "try", "{", "if", "(", "lbv", "!=", "null", ")", "lbv", ".", "merge_from", "(", "current", ")", ";", "}", "catch", "(", "Error", "e", ")", "{", "log", ".", "severe", "(", "\"merge", "\"", "+", "current", "+", "\"n", "|", "\"", "+", "lbv", ".", "initial", "+", "\"n", "FAILED\"", ")", ";", "throw", "e", ";", "}", "}", "}", "boolean", "is_term", "(", "BeamOpcode", "code", ")", "{", "switch", "(", "code", ")", "{", "case", "K_return", ":", "case", "if_end", ":", "case", "badmatch", ":", "case", "case_end", ":", "case", "try_case_end", ":", "case", "call_last", ":", "case", "call_only", ":", "case", "call_ext_last", ":", "case", "call_ext_only", ":", "case", "func_info", ":", "case", "apply_last", ":", "case", "i_call_fun_last", ":", "case", "wait", ":", "case", "select_tuple_arity", ":", "case", "select_val", ":", "case", "jump", ":", "return", "true", ";", "default", ":", "return", "false", ";", "}", "}", "boolean", "may_terminate_exceptionally", "(", "BeamOpcode", "code", ")", "{", "switch", "(", "code", ")", "{", "case", "label", ":", "case", "jump", ":", "case", "K_return", ":", "case", "move", ":", "case", "K_try", ":", "case", "K_catch", ":", "case", "try_end", ":", "case", "catch_end", ":", "return", "false", ";", "default", ":", "return", "true", ";", "}", "}", "boolean", "is_exceptional_call", "(", "Insn", "insn", ")", "{", "BeamOpcode", "opcode", "=", "insn", ".", "opcode", "(", ")", ";", "if", "(", "opcode", "==", "BeamOpcode", ".", "call_ext", ")", "{", "Insn", ".", "IE", "spec_insn", "=", "(", "Insn", ".", "IE", ")", "insn", ";", "ExtFun", "ext_fun", "=", "spec_insn", ".", "ext_fun", ";", "if", "(", "ext_fun", ".", "mod", "==", "ERLANG_ATOM", "&&", "(", "ext_fun", ".", "fun", "==", "ERROR_ATOM", "||", "ext_fun", ".", "fun", "==", "THROW_ATOM", "||", "ext_fun", ".", "fun", "==", "EXIT_ATOM", ")", "&&", "ext_fun", ".", "arity", "==", "1", ")", "return", "true", ";", "}", "return", "false", ";", "}", "private", "int", "sizeof", "(", "TypeMap", "current", ",", "Operands", ".", "SourceOperand", "cell", ")", "{", "if", "(", "cell", "instanceof", "Operands", ".", "XReg", "||", "cell", "instanceof", "Operands", ".", "YReg", ")", "return", "32", ";", "if", "(", "cell", "instanceof", "Operands", ".", "FReg", ")", "return", "64", ";", "Type", "t", "=", "getType", "(", "current", ",", "cell", ")", ";", "if", "(", "t", "==", "Type", ".", "DOUBLE_TYPE", ")", "{", "return", "64", ";", "}", "else", "{", "return", "32", ";", "}", "}", "private", "Type", "getBifResult", "(", "String", "module", ",", "String", "name", ",", "Type", "[", "]", "parmTypes", ",", "boolean", "is_guard", ")", "{", "return", "BIFUtil", ".", "getBifResult", "(", "module", ",", "name", ",", "parmTypes", ",", "is_guard", ")", ";", "}", "@", "Deprecated", "private", "Type", "[", "]", "parmTypes", "(", "TypeMap", "current", ",", "ESeq", "args", ")", "{", "ArrayList", "<", "Type", ">", "res", "=", "new", "ArrayList", "<", "Type", ">", "(", ")", ";", "while", "(", "args", "!=", "ERT", ".", "NIL", ")", "{", "EObject", "arg", "=", "args", ".", "head", "(", ")", ";", "res", ".", "add", "(", "getType", "(", "current", ",", "arg", ")", ")", ";", "args", "=", "args", ".", "tail", "(", ")", ";", "}", "return", "res", ".", "toArray", "(", "new", "Type", "[", "res", ".", "size", "(", ")", "]", ")", ";", "}", "private", "Type", "[", "]", "parmTypes", "(", "TypeMap", "current", ",", "SourceOperand", "[", "]", "args", ")", "{", "Type", "[", "]", "res", "=", "new", "Type", "[", "args", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "SourceOperand", "arg", "=", "args", "[", "i", "]", ";", "Type", "argType", "=", "getType", "(", "current", ",", "arg", ")", ";", "if", "(", "argType", "==", "null", ")", "{", "throw", "new", "Error", "(", "\"\"", "+", "arg", ")", ";", "}", "res", "[", "i", "]", "=", "argType", ";", "}", "return", "res", ";", "}", "private", "void", "checkArg", "(", "TypeMap", "current", ",", "SourceOperand", "arg", ")", "{", "Type", "argType", "=", "getType", "(", "current", ",", "arg", ")", ";", "if", "(", "argType", "==", "null", ")", "{", "throw", "new", "Error", "(", "\"\"", "+", "arg", ")", ";", "}", "}", "private", "TypeMap", "analyze_test", "(", "TypeMap", "current", ",", "Insn", ".", "L", "insn_", ",", "int", "insn_idx", ")", "{", "current", "=", "branch", "(", "current", ",", "insn_", ".", "label", ",", "insn_idx", ")", ";", "BeamOpcode", "opcode", "=", "insn_", ".", "opcode", "(", ")", ";", "switch", "(", "opcode", ")", "{", "case", "is_lt", ":", "case", "is_ge", ":", "case", "is_ne", ":", "case", "is_eq", ":", "case", "is_ne_exact", ":", "{", "Insn", ".", "LSS", "insn", "=", "(", "Insn", ".", "LSS", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "src1", ")", ";", "checkArg", "(", "current", ",", "insn", ".", "src2", ")", ";", "return", "current", ";", "}", "case", "is_eq_exact", ":", "{", "Insn", ".", "LSS", "insn", "=", "(", "Insn", ".", "LSS", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "src1", ")", ";", "checkArg", "(", "current", ",", "insn", ".", "src2", ")", ";", "Type", "t1", "=", "getType", "(", "current", ",", "insn", ".", "src1", ")", ";", "Type", "t2", "=", "getType", "(", "current", ",", "insn", ".", "src2", ")", ";", "if", "(", "!", "t1", ".", "equals", "(", "t2", ")", ")", "{", "DestinationOperand", "reg", ";", "if", "(", "(", "reg", "=", "insn", ".", "src1", ".", "testDestination", "(", ")", ")", "!=", "null", ")", "{", "current", "=", "setType", "(", "current", ",", "reg", ",", "t2", ")", ";", "}", "if", "(", "(", "reg", "=", "insn", ".", "src2", ".", "testDestination", "(", ")", ")", "!=", "null", ")", "{", "current", "=", "setType", "(", "current", ",", "reg", ",", "t1", ")", ";", "}", "}", "return", "current", ";", "}", "case", "bs_start_match2", ":", "{", "Insn", ".", "LDIID", "insn", "=", "(", "Insn", ".", "LDIID", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "dest", ")", ";", "return", "setType", "(", "current", ",", "insn", ".", "dest5", ",", "EMATCHSTATE_TYPE", ")", ";", "}", "case", "bs_get_integer2", ":", "{", "Insn", ".", "LDISIID", "insn", "=", "(", "Insn", ".", "LDISIID", ")", "insn_", ";", "if", "(", "!", "EMATCHSTATE_TYPE", ".", "equals", "(", "getType", "(", "current", ",", "insn", ".", "dest", ")", ")", ")", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "return", "setType", "(", "current", ",", "insn", ".", "dest7", ",", "EINTEGER_TYPE", ")", ";", "}", "case", "bs_get_binary2", ":", "{", "Insn", ".", "LDISIID", "insn", "=", "(", "Insn", ".", "LDISIID", ")", "insn_", ";", "if", "(", "!", "EMATCHSTATE_TYPE", ".", "equals", "(", "getType", "(", "current", ",", "insn", ".", "dest", ")", ")", ")", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "return", "setType", "(", "current", ",", "insn", ".", "dest7", ",", "EBINARY_TYPE", ")", ";", "}", "case", "bs_get_float2", ":", "{", "Insn", ".", "LDISIID", "insn", "=", "(", "Insn", ".", "LDISIID", ")", "insn_", ";", "if", "(", "!", "EMATCHSTATE_TYPE", ".", "equals", "(", "getType", "(", "current", ",", "insn", ".", "dest", ")", ")", ")", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "return", "setType", "(", "current", ",", "insn", ".", "dest7", ",", "Type", ".", "DOUBLE_TYPE", ")", ";", "}", "case", "bs_test_tail2", ":", "case", "bs_test_unit", ":", "case", "bs_skip_bits2", ":", "case", "bs_match_string", ":", "case", "bs_skip_utf8", ":", "case", "bs_skip_utf16", ":", "case", "bs_skip_utf32", ":", "{", "Insn", ".", "LD", "insn", "=", "(", "Insn", ".", "LD", ")", "insn_", ";", "if", "(", "!", "EMATCHSTATE_TYPE", ".", "equals", "(", "getType", "(", "current", ",", "insn", ".", "dest", ")", ")", ")", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "return", "current", ";", "}", "case", "bs_get_utf8", ":", "case", "bs_get_utf16", ":", "case", "bs_get_utf32", ":", "{", "Insn", ".", "LDIID", "insn", "=", "(", "Insn", ".", "LDIID", ")", "insn_", ";", "if", "(", "!", "EMATCHSTATE_TYPE", ".", "equals", "(", "getType", "(", "current", ",", "insn", ".", "dest", ")", ")", ")", "{", "throw", "new", "Error", "(", "\"\"", ")", ";", "}", "return", "setType", "(", "current", ",", "insn", ".", "dest5", ",", "ESMALL_TYPE", ")", ";", "}", "default", ":", "{", "Insn", ".", "LD", "insn", "=", "(", "Insn", ".", "LD", ")", "insn_", ";", "checkArg", "(", "current", ",", "insn", ".", "dest", ")", ";", "switch", "(", "opcode", ")", "{", "case", "test_arity", ":", "{", "int", "arity", "=", "(", "(", "Insn", ".", "LDI", ")", "insn", ")", ".", "i", ";", "return", "setType", "(", "current", ",", "insn", ".", "dest", ",", "getTupleType", "(", "arity", ")", ")", ";", "}", "case", "is_function2", ":", "{", "Insn", ".", "LDS", "insn2", "=", "(", "Insn", ".", "LDS", ")", "insn", ";", "checkArg", "(", "current", ",", "insn2", ".", "src", ")", ";", "return", "setType", "(", "current", ",", "insn", ".", "dest", ",", "EFUN_TYPE", ")", ";", "}", "default", ":", "{", "if", "(", "insn", "instanceof", "Insn", ".", "LD", ")", "{", "Type", "test_type", "=", "type_tested_for", "(", "(", "Insn", ".", "LD", ")", "insn", ")", ";", "if", "(", "test_type", "!=", "null", ")", "return", "setType", "(", "current", ",", "insn", ".", "dest", ",", "test_type", ")", ";", "}", "throw", "new", "Error", "(", "\"\"", "+", "insn_", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "}", "}", "}", "private", "Type", "type_tested_for", "(", "Insn", ".", "LD", "insn", ")", "{", "switch", "(", "insn", ".", "opcode", "(", ")", ")", "{", "case", "is_nil", ":", "return", "ENIL_TYPE", ";", "case", "is_binary", ":", "return", "EBINARY_TYPE", ";", "case", "is_tuple", ":", "return", "ETUPLE_TYPE", ";", "case", "is_integer", ":", "return", "EINTEGER_TYPE", ";", "case", "is_bitstr", ":", "return", "EBITSTRING_TYPE", ";", "case", "is_number", ":", "return", "ENUMBER_TYPE", ";", "case", "is_pid", ":", "return", "EPID_TYPE", ";", "case", "is_port", ":", "return", "EPORT_TYPE", ";", "case", "is_reference", ":", "return", "EREFERENCE_TYPE", ";", "case", "is_float", ":", "return", "EDOUBLE_TYPE", ";", "case", "is_function", ":", "return", "EFUN_TYPE", ";", "case", "is_list", ":", "case", "is_nonempty_list", ":", "return", "ECONS_TYPE", ";", "case", "is_boolean", ":", "case", "is_atom", ":", "return", "EATOM_TYPE", ";", "default", ":", "return", "null", ";", "}", "}", "private", "TypeMap", "branch", "(", "TypeMap", "current", ",", "Operands", ".", "Label", "target", ",", "int", "idx", ")", "{", "return", "branch", "(", "current", ",", "target", "==", "null", "?", "-", "1", ":", "target", ".", "nr", ",", "idx", ")", ";", "}", "private", "TypeMap", "branch", "(", "TypeMap", "current", ",", "int", "target", ",", "int", "idx", ")", "{", "if", "(", "target", ">", "0", ")", "{", "get_lb", "(", "target", ",", "false", ")", ".", "merge_from", "(", "current", ")", ";", "}", "return", "current", ".", "clearLive", "(", "makeBasicBlock", "(", "block_label", ",", "idx", "+", "1", ")", ")", ";", "}", "private", "TypeMap", "installExceptionHandler", "(", "TypeMap", "current", ",", "Operands", ".", "Label", "target", ",", "int", "idx", ")", "{", "TypeMap", "afterPush", "=", "current", ".", "pushExceptionHandler", "(", "target", ".", "nr", ")", ";", "return", "afterPush", ".", "clearLive", "(", "makeBasicBlock", "(", "block_label", ",", "idx", "+", "1", ")", ")", ";", "}", "private", "void", "addExceptionEdge", "(", "TypeMap", "current", ")", "{", "int", "handler_lbl", "=", "current", ".", "exh", ".", "getHandlerLabel", "(", ")", ";", "if", "(", "handler_lbl", ">=", "0", ")", "get_lb", "(", "handler_lbl", ",", "false", ")", ".", "merge_from", "(", "current", ")", ";", "}", "private", "Type", "getTupleType", "(", "int", "arity", ")", "{", "ETuple", ".", "get_tuple_class", "(", "arity", ")", ";", "String", "tt", "=", "\"L\"", "+", "ETUPLE_TYPE", ".", "getInternalName", "(", ")", "+", "arity", "+", "\";\"", ";", "return", "Type", ".", "getType", "(", "tt", ")", ";", "}", "public", "void", "merge_from", "(", "TypeMap", "typeMap", ")", "{", "if", "(", "initial", "==", "null", ")", "{", "initial", "=", "typeMap", ".", "clearLive", "(", "makeBasicBlock", "(", "this", ".", "block_label", ",", "0", ")", ")", ";", "needs_analyze", ".", "add", "(", "this", ")", ";", "}", "else", "{", "TypeMap", "new_types", "=", "initial", ".", "mergeFrom", "(", "typeMap", ")", ";", "if", "(", "new_types", "==", "initial", ")", "{", "}", "else", "if", "(", "new_types", ".", "equals", "(", "initial", ")", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "}", "else", "{", "initial", "=", "new_types", ";", "needs_analyze", ".", "add", "(", "this", ")", ";", "}", "}", "typeMap", ".", "add_succ", "(", "initial", ".", "bb", ")", ";", "}", "List", "<", "Insn", ">", "insns", "=", "new", "ArrayList", "<", "Insn", ">", "(", ")", ";", "@", "Override", "public", "void", "visitEnd", "(", ")", "{", "}", "@", "Override", "public", "void", "visitInsn", "(", "Insn", "insn", ")", "{", "insns", ".", "add", "(", "insn", ")", ";", "}", "private", "TypeMap", "setType", "(", "TypeMap", "current", ",", "EObject", "dd", ",", "Type", "type", ")", "{", "ETuple", "dst", "=", "dd", ".", "testTuple", "(", ")", ";", "EObject", "key", "=", "dst", ".", "elm", "(", "1", ")", ";", "EObject", "value", "=", "dst", ".", "elm", "(", "2", ")", ";", "if", "(", "key", "==", "X_ATOM", ")", "{", "current", "=", "current", ".", "setx", "(", "value", ".", "asInt", "(", ")", ",", "type", "==", "Type", ".", "DOUBLE_TYPE", "?", "EDOUBLE_TYPE", ":", "type", ",", "FV", ".", "this", ")", ";", "}", "else", "if", "(", "key", "==", "Y_ATOM", ")", "{", "current", "=", "current", ".", "sety", "(", "value", ".", "asInt", "(", ")", ",", "type", "==", "Type", ".", "DOUBLE_TYPE", "?", "EDOUBLE_TYPE", ":", "type", ")", ";", "}", "else", "if", "(", "key", "==", "FR_ATOM", ")", "{", "current", "=", "current", ".", "setf", "(", "value", ".", "asInt", "(", ")", ",", "type", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "\"unknown", "\"", "+", "dst", ")", ";", "}", "return", "current", ";", "}", "private", "TypeMap", "setType", "(", "TypeMap", "current", ",", "DestinationOperand", "dst", ",", "Type", "type", ")", "{", "{", "Operands", ".", "FReg", "freg", ";", "if", "(", "(", "freg", "=", "dst", ".", "testFReg", "(", ")", ")", "!=", "null", ")", "{", "return", "current", ".", "setf", "(", "freg", ".", "nr", ",", "type", ")", ";", "}", "}", "type", "=", "type", "==", "Type", ".", "DOUBLE_TYPE", "?", "EDOUBLE_TYPE", ":", "type", ";", "{", "Operands", ".", "XReg", "xreg", ";", "if", "(", "(", "xreg", "=", "dst", ".", "testXReg", "(", ")", ")", "!=", "null", ")", "{", "return", "current", ".", "setx", "(", "xreg", ".", "nr", ",", "type", ",", "FV", ".", "this", ")", ";", "}", "}", "{", "Operands", ".", "YReg", "yreg", ";", "if", "(", "(", "yreg", "=", "dst", ".", "testYReg", "(", ")", ")", "!=", "null", ")", "{", "return", "current", ".", "sety", "(", "yreg", ".", "nr", ",", "type", ")", ";", "}", "}", "throw", "new", "Error", "(", "\"unknown", "\"", "+", "dst", ")", ";", "}", "@", "Deprecated", "private", "Type", "getType", "(", "TypeMap", "current", ",", "EObject", "src", ")", "{", "if", "(", "src", "instanceof", "ETuple2", ")", "{", "ETuple2", "tup", "=", "(", "ETuple2", ")", "src", ";", "if", "(", "tup", ".", "elem1", "==", "X_ATOM", ")", "{", "return", "current", ".", "getx", "(", "tup", ".", "elem2", ".", "asInt", "(", ")", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "Y_ATOM", ")", "{", "return", "current", ".", "gety", "(", "tup", ".", "elem2", ".", "asInt", "(", ")", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "FR_ATOM", ")", "{", "return", "current", ".", "getf", "(", "tup", ".", "elem2", ".", "asInt", "(", ")", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "ATOM_ATOM", ")", "{", "return", "EATOM_TYPE", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "LITERAL_ATOM", ")", "{", "return", "Type", ".", "getType", "(", "tup", ".", "elem2", ".", "getClass", "(", ")", ")", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "INTEGER_ATOM", ")", "{", "if", "(", "tup", ".", "elem2", ".", "getClass", "(", ")", "==", "ESmall", ".", "class", ")", "{", "return", "ESMALL_TYPE", ";", "}", "else", "if", "(", "tup", ".", "elem2", ".", "getClass", "(", ")", "==", "EBig", ".", "class", ")", "{", "return", "EBIG_TYPE", ";", "}", "else", "{", "return", "Type", ".", "getType", "(", "tup", ".", "elem2", ".", "getClass", "(", ")", ")", ";", "}", "}", "else", "if", "(", "tup", ".", "elem1", "==", "FLOAT_ATOM", ")", "{", "return", "Type", ".", "DOUBLE_TYPE", ";", "}", "else", "if", "(", "tup", ".", "elem1", "==", "FIELD_FLAGS_ATOM", ")", "{", "return", "Type", ".", "INT_TYPE", ";", "}", "}", "else", "if", "(", "src", "==", "NIL_ATOM", ")", "{", "return", "ENIL_TYPE", ";", "}", "else", "if", "(", "src", "instanceof", "ESmall", ")", "{", "return", "EINTEGER_TYPE", ";", "}", "throw", "new", "Error", "(", "\"unknown", "\"", "+", "src", ")", ";", "}", "private", "Type", "getType", "(", "TypeMap", "current", ",", "SourceOperand", "src", ")", "{", "{", "Operands", ".", "XReg", "xreg", ";", "if", "(", "(", "xreg", "=", "src", ".", "testXReg", "(", ")", ")", "!=", "null", ")", "return", "current", ".", "getx", "(", "xreg", ".", "nr", ")", ";", "}", "{", "Operands", ".", "YReg", "yreg", ";", "if", "(", "(", "yreg", "=", "src", ".", "testYReg", "(", ")", ")", "!=", "null", ")", "return", "current", ".", "gety", "(", "yreg", ".", "nr", ")", ";", "}", "{", "Operands", ".", "FReg", "freg", ";", "if", "(", "(", "freg", "=", "src", ".", "testFReg", "(", ")", ")", "!=", "null", ")", "return", "current", ".", "getf", "(", "freg", ".", "nr", ")", ";", "}", "if", "(", "(", "src", ".", "testAtom", "(", ")", ")", "!=", "null", ")", "return", "EATOM_TYPE", ";", "else", "if", "(", "(", "src", ".", "testInt", "(", ")", ")", "!=", "null", ")", "return", "ESMALL_TYPE", ";", "else", "if", "(", "(", "src", ".", "testBigInt", "(", ")", ")", "!=", "null", ")", "return", "EBIG_TYPE", ";", "else", "if", "(", "(", "src", ".", "testFloat", "(", ")", ")", "!=", "null", ")", "return", "Type", ".", "DOUBLE_TYPE", ";", "else", "if", "(", "src", "instanceof", "Operands", ".", "Nil", ")", "return", "ENIL_TYPE", ";", "{", "Operands", ".", "TableLiteral", "lit", ";", "if", "(", "(", "lit", "=", "src", ".", "testTableLiteral", "(", ")", ")", "!=", "null", ")", "return", "Type", ".", "getType", "(", "lit", ".", "value", ".", "getClass", "(", ")", ")", ";", "}", "throw", "new", "Error", "(", "\"unknown", "\"", "+", "src", ")", ";", "}", "@", "Override", "public", "BeamInstruction", "[", "]", "getInstructions", "(", ")", "{", "BeamInstruction", "[", "]", "res", "=", "new", "BeamInstruction", "[", "insns", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "insns", ".", "size", "(", ")", ";", "i", "++", ")", "{", "res", "[", "i", "]", "=", "new", "BInsn", "(", "insns", ".", "get", "(", "i", ")", ",", "this", ".", "map", "[", "i", "]", ")", ";", "}", "return", "res", ";", "}", "@", "Override", "public", "int", "getLabel", "(", ")", "{", "return", "this", ".", "block_label", ";", "}", "class", "BInsn", "implements", "BeamInstruction", "{", "private", "final", "Insn", "insn", ";", "private", "final", "TypeMap", "current", ";", "public", "BInsn", "(", "Insn", "insn", ",", "TypeMap", "current", ")", "{", "this", ".", "insn", "=", "insn", ";", "this", ".", "current", "=", "current", ";", "}", "@", "Override", "public", "BeamOpcode", "opcode", "(", ")", "{", "return", "insn", ".", "opcode", "(", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "insn", ".", "toString", "(", ")", ";", "}", "}", "}", "@", "Override", "public", "int", "getArity", "(", ")", "{", "return", "arity", ";", "}", "@", "Override", "public", "String", "getName", "(", ")", "{", "return", "name", ".", "getName", "(", ")", ";", "}", "@", "Override", "public", "String", "getModuleName", "(", ")", "{", "return", "moduleName", ".", "getName", "(", ")", ";", "}", "@", "Override", "public", "boolean", "isExported", "(", ")", "{", "String", "externalName", "=", "getName", "(", ")", "+", "\"/\"", "+", "getArity", "(", ")", ";", "return", "exports", ".", "contains", "(", "externalName", ")", ";", "}", "@", "Override", "public", "int", "getFregCount", "(", ")", "{", "return", "max_freg", ";", "}", "@", "Override", "public", "Set", "<", "Integer", ">", "getXRegisters", "(", ")", "{", "return", "all_xregs", ";", "}", "@", "Override", "public", "int", "getYregCount", "(", ")", "{", "return", "max_stack", ";", "}", "@", "Override", "public", "BeamCodeBlock", "[", "]", "getCodeBlocks", "(", ")", "{", "BeamCodeBlock", "[", "]", "blocks", "=", "this", ".", "lbs", ".", "values", "(", ")", ".", "toArray", "(", "new", "BeamCodeBlock", "[", "0", "]", ")", ";", "return", "blocks", ";", "}", "@", "Override", "public", "int", "getEntryLabel", "(", ")", "{", "return", "startLabel", ";", "}", "}", "public", "void", "visitModule", "(", "EAtom", "name", ")", "{", "this", ".", "moduleName", "=", "name", ";", "super", ".", "visitModule", "(", "name", ")", ";", "}", "Set", "<", "String", ">", "exports", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "public", "void", "visitExport", "(", "EAtom", "fun", ",", "int", "arity", ",", "int", "entry", ")", "{", "exports", ".", "add", "(", "fun", ".", "getName", "(", ")", "+", "\"/\"", "+", "arity", ")", ";", "super", ".", "visitExport", "(", "fun", ",", "arity", ",", "entry", ")", ";", "}", "public", "void", "visitAttribute", "(", "EAtom", "att", ",", "EObject", "value", ")", "{", "super", ".", "visitAttribute", "(", "att", ",", "value", ")", ";", "}", "public", "String", "getModuleName", "(", ")", "{", "return", "this", ".", "moduleName", ".", "getName", "(", ")", ";", "}", "public", "BeamFunction", "[", "]", "functions", "(", ")", "{", "return", "functions", ".", "toArray", "(", "new", "BeamFunction", "[", "functions", ".", "size", "(", ")", "]", ")", ";", "}", "}", "</s>" ]
7,862
[ "<s>", "package", "erjang", ".", "beam", ".", "analysis", ";", "import", "java", ".", "util", ".", "Comparator", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "util", ".", "TreeSet", ";", "class", "BasicBlock", "{", "final", "int", "label", ";", "final", "int", "index", ";", "TreeSet", "<", "Integer", ">", "use", "=", "new", "TreeSet", "<", "Integer", ">", "(", ")", ";", "TreeSet", "<", "Integer", ">", "kill", "=", "new", "TreeSet", "<", "Integer", ">", "(", ")", ";", "TreeSet", "<", "Integer", ">", "in", "=", "new", "TreeSet", "<", "Integer", ">", "(", ")", ";", "TreeSet", "<", "Integer", ">", "out", "=", "new", "TreeSet", "<", "Integer", ">", "(", ")", ";", "Set", "<", "BasicBlock", ">", "succ", "=", "new", "TreeSet", "<", "BasicBlock", ">", "(", "new", "Comparator", "<", "BasicBlock", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "BasicBlock", "o1", ",", "BasicBlock", "o2", ")", "{", "if", "(", "o1", "==", "o2", ")", "return", "0", ";", "int", "loff", "=", "o1", ".", "label", "-", "o2", ".", "label", ";", "if", "(", "loff", "!=", "0", ")", "{", "return", "loff", ";", "}", "return", "o1", ".", "index", "-", "o2", ".", "index", ";", "}", "}", ")", ";", ";", "public", "BasicBlock", "(", "int", "label", ",", "int", "index", ")", "{", "this", ".", "label", "=", "label", ";", "this", ".", "index", "=", "index", ";", "}", "public", "void", "succ", "(", "BasicBlock", "bb", ")", "{", "succ", ".", "add", "(", "bb", ")", ";", "}", "public", "void", "use_x", "(", "int", "reg", ")", "{", "use", ".", "add", "(", "KEY_X", "|", "reg", ")", ";", "}", "public", "void", "use_y", "(", "TypeMap", "map", ",", "int", "reg", ")", "{", "use", ".", "add", "(", "KEY_X", "|", "map", ".", "get_ypos", "(", "reg", ")", ")", ";", "}", "public", "void", "use_fr", "(", "int", "reg", ")", "{", "use", ".", "add", "(", "KEY_X", "|", "reg", ")", ";", "}", "public", "void", "kill_x", "(", "int", "reg", ")", "{", "kill", ".", "add", "(", "KEY_X", "|", "reg", ")", ";", "}", "public", "void", "kill_y", "(", "TypeMap", "map", ",", "int", "reg", ")", "{", "kill", ".", "add", "(", "KEY_X", "|", "map", ".", "get_ypos", "(", "reg", ")", ")", ";", "}", "public", "void", "kill_fr", "(", "int", "reg", ")", "{", "kill", ".", "add", "(", "KEY_X", "|", "reg", ")", ";", "}", "static", "final", "int", "KEY_X", "=", "0", "<<", "16", ";", "static", "final", "int", "KEY_Y", "=", "1", "<<", "16", ";", "static", "final", "int", "KEY_FR", "=", "2", "<<", "16", ";", "}", "</s>" ]
7,863
[ "<s>", "package", "erjang", ".", "beam", ";", "public", "interface", "BeamExceptionHandler", "{", "public", "int", "getHandlerLabel", "(", ")", ";", "public", "BeamExceptionHandler", "getParent", "(", ")", ";", "}", "</s>" ]
7,864
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "ETuple", ";", "public", "class", "ExtFunc", "extends", "erjang", ".", "beam", ".", "Arg", "{", "public", "final", "EAtom", "mod", ";", "public", "final", "EAtom", "fun", ";", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "mod", ".", "toString", "(", ")", "+", "':'", "+", "fun", ".", "toString", "(", ")", "+", "\"/\"", "+", "no", ";", "}", "public", "ExtFunc", "(", "EAtom", "mod", ",", "EAtom", "fun", ",", "int", "arity", ")", "{", "super", "(", "Kind", ".", "EXT_FUNC", ",", "arity", ")", ";", "this", ".", "mod", "=", "mod", ";", "this", ".", "fun", "=", "fun", ";", "}", "public", "ExtFunc", "(", "ETuple", "ext", ")", "{", "super", "(", "Kind", ".", "EXT_FUNC", ",", "ext", ".", "elm", "(", "3", ")", ".", "asInt", "(", ")", ")", ";", "this", ".", "mod", "=", "ext", ".", "elm", "(", "1", ")", ".", "testAtom", "(", ")", ";", "this", ".", "fun", "=", "ext", ".", "elm", "(", "2", ")", ".", "testAtom", "(", ")", ";", "}", "}", "</s>" ]
7,865
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangAtom", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangBinary", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangBitstr", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangDouble", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangList", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangLong", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangObject", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangString", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangTuple", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EBinary", ";", "import", "erjang", ".", "EBitString", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "EString", ";", "import", "erjang", ".", "ETuple", ";", "abstract", "class", "Converter", "<", "T", ">", "{", "abstract", "EObject", "conv", "(", "T", "obj", ")", ";", "}", "public", "class", "OtpConverter", "{", "static", "Map", "<", "Class", ",", "Converter", ">", "conv", "=", "new", "HashMap", "<", "Class", ",", "Converter", ">", "(", ")", ";", "static", "<", "T", ">", "void", "add", "(", "Class", "<", "T", ">", "c", ",", "Converter", "<", "T", ">", "co", ")", "{", "conv", ".", "put", "(", "c", ",", "co", ")", ";", "}", "static", "{", "add", "(", "OtpErlangTuple", ".", "class", ",", "new", "Converter", "<", "OtpErlangTuple", ">", "(", ")", "{", "EObject", "conv", "(", "OtpErlangTuple", "obj", ")", "{", "EObject", "[", "]", "vals", "=", "new", "EObject", "[", "obj", ".", "arity", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "obj", ".", "arity", "(", ")", ";", "i", "++", ")", "{", "vals", "[", "i", "]", "=", "convert", "(", "obj", ".", "elementAt", "(", "i", ")", ")", ";", "}", "return", "ETuple", ".", "make", "(", "vals", ")", ";", "}", "}", ")", ";", "add", "(", "OtpErlangList", ".", "class", ",", "new", "Converter", "<", "OtpErlangList", ">", "(", ")", "{", "@", "Override", "EObject", "conv", "(", "OtpErlangList", "obj", ")", "{", "EObject", "tail", "=", "obj", ".", "getLastTail", "(", ")", "==", "null", "?", "ERT", ".", "NIL", ":", "convert", "(", "obj", ".", "getLastTail", "(", ")", ")", ";", "for", "(", "int", "i", "=", "obj", ".", "arity", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "tail", "=", "ERT", ".", "cons", "(", "convert", "(", "obj", ".", "elementAt", "(", "i", ")", ")", ",", "tail", ")", ";", "}", "return", "tail", ";", "}", "}", ")", ";", "add", "(", "OtpErlangAtom", ".", "class", ",", "new", "Converter", "<", "OtpErlangAtom", ">", "(", ")", "{", "EObject", "conv", "(", "OtpErlangAtom", "obj", ")", "{", "return", "EAtom", ".", "intern", "(", "obj", ".", "atomValue", "(", ")", ")", ";", "}", "}", ")", ";", "add", "(", "OtpErlangLong", ".", "class", ",", "new", "Converter", "<", "OtpErlangLong", ">", "(", ")", "{", "EObject", "conv", "(", "OtpErlangLong", "obj", ")", "{", "return", "(", "obj", ".", "isLong", "(", ")", ")", "?", "ERT", ".", "box", "(", "obj", ".", "longValue", "(", ")", ")", ":", "ERT", ".", "box", "(", "obj", ".", "bigIntegerValue", "(", ")", ")", ";", "}", "}", ")", ";", "add", "(", "OtpErlangString", ".", "class", ",", "new", "Converter", "<", "OtpErlangString", ">", "(", ")", "{", "EObject", "conv", "(", "OtpErlangString", "obj", ")", "{", "return", "new", "EString", "(", "obj", ".", "stringValue", "(", ")", ")", ";", "}", "}", ")", ";", "add", "(", "OtpErlangDouble", ".", "class", ",", "new", "Converter", "<", "OtpErlangDouble", ">", "(", ")", "{", "EObject", "conv", "(", "OtpErlangDouble", "obj", ")", "{", "return", "ERT", ".", "box", "(", "obj", ".", "doubleValue", "(", ")", ")", ";", "}", "}", ")", ";", "add", "(", "OtpErlangBinary", ".", "class", ",", "new", "Converter", "<", "OtpErlangBinary", ">", "(", ")", "{", "EObject", "conv", "(", "OtpErlangBinary", "obj", ")", "{", "return", "new", "EBinary", "(", "obj", ".", "binaryValue", "(", ")", ")", ";", "}", "}", ")", ";", "add", "(", "OtpErlangBitstr", ".", "class", ",", "new", "Converter", "<", "OtpErlangBitstr", ">", "(", ")", "{", "EObject", "conv", "(", "OtpErlangBitstr", "obj", ")", "{", "return", "EBitString", ".", "make", "(", "obj", ".", "binaryValue", "(", ")", ",", "0", ",", "obj", ".", "size", "(", ")", ",", "obj", ".", "pad_bits", "(", ")", ")", ";", "}", "}", ")", ";", "}", "public", "static", "EObject", "convert", "(", "OtpErlangObject", "value", ")", "{", "Class", "<", "?", "extends", "OtpErlangObject", ">", "c", "=", "value", ".", "getClass", "(", ")", ";", "Converter", "cc", "=", "conv", ".", "get", "(", "c", ")", ";", "if", "(", "cc", "==", "null", ")", "{", "throw", "new", "Error", "(", "\"\"", "+", "c", ")", ";", "}", "else", "{", "return", "cc", ".", "conv", "(", "value", ")", ";", "}", "}", "}", "</s>" ]
7,866
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "util", ".", "Collection", ";", "public", "interface", "FunctionVisitor2", "extends", "FunctionVisitor", "{", "public", "void", "visitMaxs", "(", "Collection", "<", "Integer", ">", "maxXreg", ",", "int", "y_count", ",", "int", "fp_count", ",", "boolean", "isTailRecursive", ")", ";", "}", "</s>" ]
7,867
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EObject", ";", "public", "interface", "ModuleVisitor", "{", "void", "visitModule", "(", "EAtom", "name", ")", ";", "void", "visitExport", "(", "EAtom", "fun", ",", "int", "arity", ",", "int", "entry", ")", ";", "void", "visitAttribute", "(", "EAtom", "att", ",", "EObject", "value", ")", ";", "void", "declareFunction", "(", "EAtom", "fun", ",", "int", "arity", ",", "int", "label", ")", ";", "FunctionVisitor", "visitFunction", "(", "EAtom", "name", ",", "int", "arity", ",", "int", "startLabel", ")", ";", "void", "visitEnd", "(", ")", ";", "}", "</s>" ]
7,868
[ "<s>", "package", "erjang", ".", "beam", ";", "public", "interface", "BeamInstruction", "{", "public", "BeamOpcode", "opcode", "(", ")", ";", "}", "</s>" ]
7,869
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpAuthException", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpConnection", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangAtom", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangBinary", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangExit", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangObject", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangString", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpErlangTuple", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpPeer", ";", "import", "com", ".", "ericsson", ".", "otp", ".", "erlang", ".", "OtpSelf", ";", "import", "erjang", ".", "ETuple", ";", "public", "class", "ErlangBeamDisLoader", "extends", "BeamLoader", "{", "static", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.beam\"", ")", ";", "final", "boolean", "TRY_NATIVE_LOADER", "=", "true", ";", "String", "myid", "=", "\"\"", ";", "OtpConnection", "conn", ";", "private", "OtpSelf", "self", ";", "private", "OtpPeer", "peer", ";", "public", "ErlangBeamDisLoader", "(", ")", "throws", "OtpAuthException", ",", "IOException", "{", "self", "=", "new", "OtpSelf", "(", "myid", ")", ";", "peer", "=", "new", "OtpPeer", "(", "\"\"", ")", ";", "conn", "=", "self", ".", "connect", "(", "peer", ")", ";", "}", "@", "Override", "public", "BeamFileData", "load", "(", "File", "file", ")", "throws", "IOException", "{", "sendGEN", "(", "conn", ",", "\"beam_loader\"", ",", "new", "OtpErlangTuple", "(", "new", "OtpErlangObject", "[", "]", "{", "new", "OtpErlangAtom", "(", "\"disasm\"", ")", ",", "new", "OtpErlangString", "(", "file", ".", "getAbsolutePath", "(", ")", ")", "}", ")", ")", ";", "try", "{", "OtpErlangObject", "reply", "=", "conn", ".", "receiveRPC", "(", ")", ";", "return", "new", "SymbolicBeamFileData", "(", "check", "(", "(", "ETuple", ")", "OtpConverter", ".", "convert", "(", "reply", ")", ",", "file", ")", ")", ";", "}", "catch", "(", "OtpErlangExit", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", ",", "e", ")", ";", "}", "catch", "(", "OtpAuthException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", ",", "e", ")", ";", "}", "}", "@", "Override", "public", "BeamFileData", "load", "(", "byte", "[", "]", "data", ")", "throws", "IOException", "{", "sendGEN", "(", "conn", ",", "\"beam_loader\"", ",", "new", "OtpErlangTuple", "(", "new", "OtpErlangObject", "[", "]", "{", "new", "OtpErlangAtom", "(", "\"disasm\"", ")", ",", "new", "OtpErlangBinary", "(", "data", ")", "}", ")", ")", ";", "try", "{", "OtpErlangObject", "reply", "=", "conn", ".", "receiveRPC", "(", ")", ";", "return", "new", "SymbolicBeamFileData", "(", "check", "(", "(", "ETuple", ")", "OtpConverter", ".", "convert", "(", "reply", ")", ",", "data", ")", ")", ";", "}", "catch", "(", "OtpErlangExit", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", ",", "e", ")", ";", "}", "catch", "(", "OtpAuthException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"\"", ",", "e", ")", ";", "}", "}", "public", "void", "sendGEN", "(", "final", "OtpConnection", "conn", ",", "String", "server", ",", "final", "OtpErlangObject", "request", ")", "throws", "IOException", "{", "final", "OtpErlangObject", "[", "]", "gen", "=", "new", "OtpErlangObject", "[", "3", "]", ";", "final", "OtpErlangObject", "[", "]", "reply", "=", "new", "OtpErlangObject", "[", "2", "]", ";", "reply", "[", "0", "]", "=", "self", ".", "pid", "(", ")", ";", "reply", "[", "1", "]", "=", "self", ".", "createRef", "(", ")", ";", "gen", "[", "0", "]", "=", "new", "OtpErlangAtom", "(", "\"$gen_call\"", ")", ";", "gen", "[", "1", "]", "=", "new", "OtpErlangTuple", "(", "reply", ")", ";", "gen", "[", "2", "]", "=", "request", ";", "conn", ".", "send", "(", "server", ",", "new", "OtpErlangTuple", "(", "gen", ")", ")", ";", "}", "protected", "ETuple", "check", "(", "ETuple", "dis1", ",", "File", "file", ")", "throws", "IOException", "{", "if", "(", "!", "TRY_NATIVE_LOADER", ")", "return", "dis1", ";", "ETuple", "dis2", "=", "erjang", ".", "beam", ".", "loader", ".", "BeamLoader", ".", "read", "(", "file", ".", "getAbsolutePath", "(", ")", ")", ".", "toSymbolic", "(", ")", ";", "return", "check", "(", "dis1", ",", "dis2", ")", ";", "}", "protected", "ETuple", "check", "(", "ETuple", "dis1", ",", "byte", "[", "]", "data", ")", "throws", "IOException", "{", "if", "(", "!", "TRY_NATIVE_LOADER", ")", "return", "dis1", ";", "ETuple", "dis2", "=", "erjang", ".", "beam", ".", "loader", ".", "BeamLoader", ".", "parse", "(", "data", ")", ".", "toSymbolic", "(", ")", ";", "return", "check", "(", "dis1", ",", "dis2", ")", ";", "}", "protected", "ETuple", "check", "(", "ETuple", "dis1", ",", "ETuple", "dis2", ")", "{", "log", ".", "fine", "(", "\"\"", ")", ";", "boolean", "eq", "=", "false", ";", "try", "{", "eq", "=", "dis1", ".", "equals", "(", "dis2", ")", ";", "}", "catch", "(", "RuntimeException", "re", ")", "{", "log", ".", "log", "(", "Level", ".", "WARNING", ",", "\"\"", ",", "re", ")", ";", "}", "if", "(", "eq", ")", "log", ".", "fine", "(", "\"OK\"", ")", ";", "else", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "log", ".", "fine", "(", "\"DIFF:n\"", "+", "dis1", "+", "\"nvsn\"", "+", "dis2", ")", ";", "}", "}", "return", "dis1", ";", "}", "}", "</s>" ]
7,870
[ "<s>", "package", "erjang", ".", "beam", ".", "loader", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "erjang", ".", "ETuple", ";", "import", "erjang", ".", "beam", ".", "BeamFileData", ";", "import", "erjang", ".", "beam", ".", "loader", ".", "BeamLoader", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "ModuleRepr", ";", "public", "class", "ErjangBeamDisLoader", "extends", "erjang", ".", "beam", ".", "BeamLoader", "{", "public", "ErjangBeamDisLoader", "(", ")", "{", "}", "@", "Override", "public", "BeamFileData", "load", "(", "File", "file", ")", "throws", "IOException", "{", "ModuleRepr", "mod", "=", "BeamLoader", ".", "read", "(", "file", ".", "getAbsolutePath", "(", ")", ")", ";", "mod", ".", "rewrite", "(", "new", "Rewriter", "(", ")", ")", ";", "return", "mod", ";", "}", "@", "Override", "public", "BeamFileData", "load", "(", "byte", "[", "]", "data", ")", "throws", "IOException", "{", "ModuleRepr", "mod", "=", "BeamLoader", ".", "parse", "(", "data", ")", ";", "mod", ".", "rewrite", "(", "new", "Rewriter", "(", ")", ")", ";", "return", "mod", ";", "}", "}", "</s>" ]
7,871
[ "<s>", "package", "erjang", ".", "beam", ".", "loader", ";", "import", "static", "erjang", ".", "beam", ".", "CodeAtoms", ".", "START_ATOM", ";", "import", "java", ".", "io", ".", "ByteArrayInputStream", ";", "import", "java", ".", "io", ".", "DataInputStream", ";", "import", "java", ".", "io", ".", "EOFException", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "math", ".", "BigInteger", ";", "import", "java", ".", "security", ".", "MessageDigest", ";", "import", "java", ".", "security", ".", "NoSuchAlgorithmException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "EBinary", ";", "import", "erjang", ".", "EInputStream", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "beam", ".", "BeamOpcode", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "AnonFun", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "CodeTables", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "ExtFun", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "FunctionInfo", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "FunctionRepr", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Insn", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "ModuleRepr", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "AllocList", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "Atom", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "BitString", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "ByteString", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "DestinationOperand", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "FReg", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "Label", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "Literal", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "Operand", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "SelectList", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "SourceOperand", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "TableLiteral", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "XReg", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "YReg", ";", "public", "class", "BeamLoader", "extends", "CodeTables", "{", "static", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.beam\"", ")", ";", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "for", "(", "String", "filename", ":", "args", ")", "read", "(", "filename", ")", ";", "}", "public", "static", "ModuleRepr", "read", "(", "String", "filename", ")", "throws", "IOException", "{", "long", "file_size", "=", "new", "File", "(", "filename", ")", ".", "length", "(", ")", ";", "DataInputStream", "in", "=", "null", ";", "try", "{", "in", "=", "new", "DataInputStream", "(", "new", "FileInputStream", "(", "filename", ")", ")", ";", "BeamLoader", "bl", "=", "new", "BeamLoader", "(", "in", ",", "file_size", ",", "false", ")", ";", "bl", ".", "read", "(", ")", ";", "return", "bl", ".", "toModuleRepr", "(", ")", ";", "}", "finally", "{", "if", "(", "in", "!=", "null", ")", "in", ".", "close", "(", ")", ";", "}", "}", "public", "static", "ModuleRepr", "parse", "(", "byte", "[", "]", "data", ")", "throws", "IOException", "{", "ByteArrayInputStream", "in", "=", "new", "ByteArrayInputStream", "(", "data", ")", ";", "BeamLoader", "bl", "=", "new", "BeamLoader", "(", "new", "DataInputStream", "(", "in", ")", ",", "data", ".", "length", ",", "false", ")", ";", "bl", ".", "read", "(", ")", ";", "return", "bl", ".", "toModuleRepr", "(", ")", ";", "}", "private", "EInputStream", "in", ";", "private", "boolean", "include_debug_info", ";", "private", "EObject", "attributes", ",", "compilation_info", ",", "abstract_tree", ";", "private", "FunctionInfo", "[", "]", "exports", "=", "new", "FunctionInfo", "[", "0", "]", ",", "localFunctions", "=", "new", "FunctionInfo", "[", "0", "]", ";", "private", "ArrayList", "<", "Insn", ">", "code", ";", "private", "ArrayList", "<", "FunctionRepr", ">", "functionReprs", ";", "private", "EBinary", "module_md5", ";", "public", "ModuleRepr", "toModuleRepr", "(", ")", "{", "FunctionRepr", "[", "]", "functions", "=", "new", "FunctionRepr", "[", "functionReprs", ".", "size", "(", ")", "]", ";", "functions", "=", "functionReprs", ".", "toArray", "(", "functions", ")", ";", "return", "new", "ModuleRepr", "(", "this", ",", "atom", "(", "1", ")", ",", "exports", ",", "(", "ESeq", ")", "attributes", ",", "(", "ESeq", ")", "compilation_info", ",", "functions", ")", ";", "}", "static", "final", "int", "FOR1", "=", "0x464f5231", ";", "static", "final", "int", "BEAM", "=", "0x4245414d", ";", "static", "final", "int", "GZIP", "=", "0x1f8b0000", ";", "static", "final", "int", "ATOM", "=", "0x41746f6d", ";", "static", "final", "int", "CODE", "=", "0x436f6465", ";", "static", "final", "int", "STR_T", "=", "0x53747254", ";", "static", "final", "int", "IMP_T", "=", "0x496d7054", ";", "static", "final", "int", "EXP_T", "=", "0x45787054", ";", "static", "final", "int", "LIT_T", "=", "0x4c697454", ";", "static", "final", "int", "FUN_T", "=", "0x46756e54", ";", "static", "final", "int", "LOC_T", "=", "0x4c6f6354", ";", "static", "final", "int", "ATTR", "=", "0x41747472", ";", "static", "final", "int", "C_INF", "=", "0x43496e66", ";", "static", "final", "int", "ABST", "=", "0x41627374", ";", "static", "final", "int", "[", "]", "SECTION_READING_ORDER", "=", "{", "ATOM", ",", "STR_T", ",", "LIT_T", ",", "IMP_T", ",", "EXP_T", ",", "FUN_T", ",", "LOC_T", ",", "CODE", ",", "C_INF", ",", "ATTR", ",", "ABST", "}", ";", "public", "BeamLoader", "(", "DataInputStream", "in", ",", "long", "actual_file_size", ",", "boolean", "include_debug_info", ")", "throws", "IOException", "{", "this", ".", "include_debug_info", "=", "include_debug_info", ";", "int", "header", ";", "in", "=", "new", "DataInputStream", "(", "new", "java", ".", "io", ".", "BufferedInputStream", "(", "in", ")", ")", ";", "boolean", "zipped", "=", "false", ";", "in", ".", "mark", "(", "8", ")", ";", "if", "(", "(", "header", "=", "in", ".", "readInt", "(", ")", ")", "!=", "FOR1", ")", "{", "if", "(", "(", "header", "&", "0xffff0000", ")", "==", "GZIP", ")", "{", "in", ".", "reset", "(", ")", ";", "in", "=", "new", "DataInputStream", "(", "new", "java", ".", "util", ".", "zip", ".", "GZIPInputStream", "(", "in", ")", ")", ";", "zipped", "=", "true", ";", "if", "(", "in", ".", "readInt", "(", ")", "!=", "FOR1", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "}", "else", "{", "throw", "new", "IOException", "(", "\"\"", "+", "Integer", ".", "toHexString", "(", "header", ")", ")", ";", "}", "}", "int", "stated_length", "=", "in", ".", "readInt", "(", ")", ";", "if", "(", "in", ".", "readInt", "(", ")", "!=", "BEAM", ")", "throw", "new", "IOException", "(", "\"\"", ")", ";", "if", "(", "!", "zipped", "&&", "(", "stated_length", "+", "8", "!=", "actual_file_size", ")", ")", "throw", "new", "IOException", "(", "\"\"", "+", "(", "stated_length", "+", "8", ")", "+", "\",", "is", "\"", "+", "actual_file_size", ")", ";", "byte", "[", "]", "data", "=", "new", "byte", "[", "stated_length", "-", "4", "]", ";", "in", ".", "readFully", "(", "data", ")", ";", "this", ".", "in", "=", "new", "EInputStream", "(", "data", ")", ";", "}", "public", "void", "read", "(", ")", "throws", "IOException", "{", "final", "HashMap", "<", "Integer", ",", "SectionMetadata", ">", "section_map", "=", "new", "HashMap", "<", "Integer", ",", "SectionMetadata", ">", "(", ")", ";", "for", "(", "SectionMetadata", "smd", ";", "(", "smd", "=", "readSectionHeader", "(", ")", ")", "!=", "null", ";", ")", "{", "section_map", ".", "put", "(", "smd", ".", "tag", ",", "smd", ")", ";", "in", ".", "setPos", "(", "smd", ".", "offset", "+", "(", "(", "smd", ".", "length", "+", "3", ")", "&", "~", "3", ")", ")", ";", "}", "compute_module_md5", "(", "section_map", ")", ";", "for", "(", "int", "tag", ":", "SECTION_READING_ORDER", ")", "{", "SectionMetadata", "smd", "=", "section_map", ".", "get", "(", "tag", ")", ";", "if", "(", "smd", "!=", "null", ")", "readSection", "(", "smd", ")", ";", "}", "functionReprs", "=", "partitionCodeByFunction", "(", ")", ";", "}", "static", "final", "int", "[", "]", "SECTION_MD5_ORDER", "=", "{", "ATOM", ",", "CODE", ",", "STR_T", ",", "IMP_T", ",", "EXP_T", ",", "}", ";", "private", "void", "compute_module_md5", "(", "final", "HashMap", "<", "Integer", ",", "SectionMetadata", ">", "section_map", ")", "{", "SectionMetadata", "smd", ";", "MessageDigest", "context", ";", "try", "{", "context", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{", "return", ";", "}", "for", "(", "int", "tag", ":", "SECTION_MD5_ORDER", ")", "{", "smd", "=", "section_map", ".", "get", "(", "tag", ")", ";", "in", ".", "updateMessageDigest", "(", "context", ",", "smd", ".", "offset", ",", "smd", ".", "length", ")", ";", "}", "if", "(", "(", "smd", "=", "section_map", ".", "get", "(", "FUN_T", ")", ")", "!=", "null", ")", "{", "int", "start", "=", "smd", ".", "offset", ";", "int", "left", "=", "smd", ".", "length", ";", "if", "(", "left", ">=", "4", ")", "{", "byte", "[", "]", "zero", "=", "new", "byte", "[", "4", "]", ";", "in", ".", "updateMessageDigest", "(", "context", ",", "start", ",", "4", ")", ";", "start", "+=", "4", ";", "left", "-=", "4", ";", "while", "(", "left", ">=", "24", ")", "{", "in", ".", "updateMessageDigest", "(", "context", ",", "start", ",", "20", ")", ";", "context", ".", "update", "(", "zero", ",", "0", ",", "4", ")", ";", "start", "+=", "24", ";", "left", "-=", "24", ";", "}", "}", "if", "(", "left", ">", "0", ")", "{", "in", ".", "updateMessageDigest", "(", "context", ",", "start", ",", "left", ")", ";", "}", "}", "if", "(", "(", "smd", "=", "section_map", ".", "get", "(", "LIT_T", ")", ")", "!=", "null", ")", "{", "in", ".", "updateMessageDigest", "(", "context", ",", "smd", ".", "offset", ",", "smd", ".", "length", ")", ";", "}", "byte", "[", "]", "digest", "=", "context", ".", "digest", "(", ")", ";", "this", ".", "module_md5", "=", "new", "EBinary", "(", "digest", ")", ";", "}", "public", "ArrayList", "<", "FunctionRepr", ">", "partitionCodeByFunction", "(", ")", "{", "int", "funCount", "=", "(", "exports", "==", "null", "?", "0", ":", "exports", ".", "length", ")", "+", "(", "localFunctions", "==", "null", "?", "0", ":", "localFunctions", ".", "length", ")", ";", "ArrayList", "<", "FunctionRepr", ">", "functions", "=", "new", "ArrayList", "<", "FunctionRepr", ">", "(", "funCount", ")", ";", "FunctionInfo", "fi", "=", "null", ";", "ArrayList", "<", "Insn", ">", "currentFunctionBody", "=", "null", ";", "for", "(", "Insn", "insn", ":", "code", ")", "{", "FunctionInfo", "newFI", "=", "null", ";", "if", "(", "insn", ".", "opcode", "(", ")", "==", "BeamOpcode", ".", "label", ")", "{", "int", "labelNr", "=", "(", "(", "Insn", ".", "I", ")", "insn", ")", ".", "i1", ";", "newFI", "=", "functionAtLabel", "(", "labelNr", "+", "1", ")", ";", "if", "(", "newFI", "==", "null", ")", "newFI", "=", "functionAtLabel", "(", "labelNr", ")", ";", "}", "else", "if", "(", "insn", ".", "opcode", "(", ")", "==", "BeamOpcode", ".", "int_code_end", ")", "{", "newFI", "=", "new", "FunctionInfo", "(", "null", ",", "null", ",", "-", "1", ",", "-", "1", ")", ";", "}", "if", "(", "newFI", "!=", "null", "&&", "newFI", "!=", "fi", ")", "{", "if", "(", "fi", "!=", "null", ")", "{", "FunctionRepr", "fun", "=", "new", "FunctionRepr", "(", "fi", ",", "currentFunctionBody", ")", ";", "functions", ".", "add", "(", "fun", ")", ";", "}", "fi", "=", "newFI", ";", "currentFunctionBody", "=", "new", "ArrayList", "<", "Insn", ">", "(", ")", ";", "}", "currentFunctionBody", ".", "add", "(", "insn", ")", ";", "}", "return", "functions", ";", "}", "public", "SectionMetadata", "readSectionHeader", "(", ")", "throws", "IOException", "{", "int", "tag", ";", "try", "{", "tag", "=", "in", ".", "read4BE", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", "+", "toSymbolicTag", "(", "tag", ")", "+", "\"", "at", "\"", "+", "in", ".", "getPos", "(", ")", ")", ";", "}", "catch", "(", "EOFException", "eof", ")", "{", "return", "null", ";", "}", "int", "sectionLength", "=", "in", ".", "read4BE", "(", ")", ";", "int", "startPos", "=", "in", ".", "getPos", "(", ")", ";", "return", "new", "SectionMetadata", "(", "tag", ",", "startPos", ",", "sectionLength", ")", ";", "}", "public", "void", "readSection", "(", "SectionMetadata", "section", ")", "throws", "IOException", "{", "in", ".", "setPos", "(", "section", ".", "offset", ")", ";", "try", "{", "if", "(", "section", ".", "length", ">", "0", ")", "switch", "(", "section", ".", "tag", ")", "{", "case", "ATOM", ":", "readAtomSection", "(", ")", ";", "break", ";", "case", "CODE", ":", "readCodeSection", "(", ")", ";", "break", ";", "case", "STR_T", ":", "readStringSection", "(", "section", ".", "length", ")", ";", "break", ";", "case", "IMP_T", ":", "readImportSection", "(", ")", ";", "break", ";", "case", "EXP_T", ":", "readExportSection", "(", ")", ";", "break", ";", "case", "FUN_T", ":", "readFunctionSection", "(", ")", ";", "break", ";", "case", "LIT_T", ":", "readLiteralSection", "(", ")", ";", "break", ";", "case", "LOC_T", ":", "readLocalFunctionSection", "(", ")", ";", "break", ";", "case", "ATTR", ":", "readAttributeSection", "(", ")", ";", "break", ";", "case", "C_INF", ":", "readCompilationInfoSection", "(", ")", ";", "break", ";", "case", "ABST", ":", "readASTSection", "(", ")", ";", "break", ";", "default", ":", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "WARNING", ")", ")", "log", ".", "warning", "(", "\"\"", "+", "Integer", ".", "toHexString", "(", "section", ".", "tag", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "int", "relPos", "=", "in", ".", "getPos", "(", ")", "-", "section", ".", "offset", ";", "try", "{", "int", "curPos", "=", "in", ".", "getPos", "(", ")", ";", "in", ".", "setPos", "(", "curPos", "-", "16", ")", ";", "byte", "[", "]", "d", "=", "new", "byte", "[", "64", "]", ";", "int", "ctxlen", "=", "in", ".", "read", "(", "d", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "SEVERE", ")", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ctxlen", ";", "i", "++", ")", "{", "int", "byt", "=", "d", "[", "i", "]", "&", "0xFF", ";", "if", "(", "byt", "<", "16", ")", "sb", ".", "append", "(", "\"0\"", ")", ";", "sb", ".", "append", "(", "Integer", ".", "toHexString", "(", "byt", "&", "0xFF", ")", ")", ";", "sb", ".", "append", "(", "\"", "\"", ")", ";", "if", "(", "(", "i", "+", "1", ")", "%", "16", "==", "0", "||", "(", "i", "+", "1", ")", "==", "ctxlen", ")", "sb", ".", "append", "(", "\"n\"", ")", ";", "}", "log", ".", "severe", "(", "sb", ".", "toString", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e2", ")", "{", "}", "throw", "new", "IOException", "(", "\"\"", "+", "relPos", "+", "\"=0x\"", "+", "Integer", ".", "toHexString", "(", "relPos", ")", "+", "\"\"", "+", "Integer", ".", "toHexString", "(", "section", ".", "tag", ")", ",", "e", ")", ";", "}", "int", "readLength", "=", "in", ".", "getPos", "(", ")", "-", "section", ".", "offset", ";", "if", "(", "readLength", ">", "section", ".", "length", ")", "throw", "new", "IOException", "(", "\"\"", "+", "Integer", ".", "toHexString", "(", "section", ".", "tag", ")", "+", "\":", "used", "\"", "+", "readLength", "+", "\"", "bytes", "of", "\"", "+", "section", ".", "length", "+", "\"", "(pos=\"", "+", "in", ".", "getPos", "(", ")", ")", ";", "}", "private", "String", "toSymbolicTag", "(", "int", "tag", ")", "{", "char", "[", "]", "sym", "=", "new", "char", "[", "4", "]", ";", "for", "(", "int", "i", "=", "3", ",", "d", "=", "tag", ";", "i", ">=", "0", ";", "i", "--", ",", "d", ">>>=", "8", ")", "{", "sym", "[", "i", "]", "=", "(", "char", ")", "(", "d", "&", "0xff", ")", ";", "if", "(", "!", "Character", ".", "isJavaIdentifierPart", "(", "sym", "[", "i", "]", ")", ")", "{", "return", "\"0x\"", "+", "Integer", ".", "toHexString", "(", "tag", ")", ";", "}", "}", "return", "new", "String", "(", "sym", ")", ";", "}", "public", "void", "readAtomSection", "(", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "int", "nAtoms", "=", "in", ".", "read4BE", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", "+", "nAtoms", ")", ";", "atoms", "=", "new", "EAtom", "[", "nAtoms", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nAtoms", ";", "i", "++", ")", "{", "String", "atom", "=", "readString", "(", "in", ".", "read1", "(", ")", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"-", "#\"", "+", "(", "i", "+", "1", ")", "+", "\":", "'\"", "+", "atom", "+", "\"'\"", ")", ";", "atoms", "[", "i", "]", "=", "EAtom", ".", "intern", "(", "atom", ")", ";", "}", "}", "public", "void", "readStringSection", "(", "int", "sectionLength", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "stringpool", "=", "readBinary", "(", "sectionLength", ")", ";", "}", "public", "void", "readExportSection", "(", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "int", "nExports", "=", "in", ".", "read4BE", "(", ")", ";", "exports", "=", "new", "FunctionInfo", "[", "nExports", "]", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", "+", "nExports", ")", ";", "EAtom", "mod", "=", "moduleName", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nExports", ";", "i", "++", ")", "{", "int", "fun_atom_nr", "=", "in", ".", "read4BE", "(", ")", ";", "int", "arity", "=", "in", ".", "read4BE", "(", ")", ";", "int", "label", "=", "in", ".", "read4BE", "(", ")", ";", "EAtom", "fun", "=", "atom", "(", "fun_atom_nr", ")", ";", "exports", "[", "i", "]", "=", "new", "FunctionInfo", "(", "mod", ",", "fun", ",", "arity", ",", "label", ")", ";", "addFunctionAtLabel", "(", "exports", "[", "i", "]", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "atoms", "!=", "null", ")", "{", "log", ".", "fine", "(", "\"-", "#\"", "+", "(", "i", "+", "1", ")", "+", "\":", "\"", "+", "atom", "(", "fun_atom_nr", ")", "+", "\"/\"", "+", "arity", "+", "\"", "@", "\"", "+", "label", ")", ";", "}", "}", "}", "public", "void", "readLocalFunctionSection", "(", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "int", "nLocals", "=", "in", ".", "read4BE", "(", ")", ";", "localFunctions", "=", "new", "FunctionInfo", "[", "nLocals", "]", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", "+", "nLocals", ")", ";", "EAtom", "mod", "=", "moduleName", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nLocals", ";", "i", "++", ")", "{", "int", "fun_atom_nr", "=", "in", ".", "read4BE", "(", ")", ";", "int", "arity", "=", "in", ".", "read4BE", "(", ")", ";", "int", "label", "=", "in", ".", "read4BE", "(", ")", ";", "EAtom", "fun", "=", "atom", "(", "fun_atom_nr", ")", ";", "localFunctions", "[", "i", "]", "=", "new", "FunctionInfo", "(", "mod", ",", "fun", ",", "arity", ",", "label", ")", ";", "addFunctionAtLabel", "(", "localFunctions", "[", "i", "]", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "atoms", "!=", "null", ")", "{", "log", ".", "fine", "(", "\"-", "#\"", "+", "(", "i", "+", "1", ")", "+", "\":", "\"", "+", "atom", "(", "fun_atom_nr", ")", "+", "\"/\"", "+", "arity", "+", "\"", "@", "\"", "+", "label", ")", ";", "}", "}", "}", "public", "void", "readFunctionSection", "(", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "int", "nFunctions", "=", "in", ".", "read4BE", "(", ")", ";", "anonymousFuns", "=", "new", "AnonFun", "[", "nFunctions", "]", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", "+", "nFunctions", ")", ";", "EAtom", "mod", "=", "moduleName", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nFunctions", ";", "i", "++", ")", "{", "int", "fun_atom_nr", "=", "in", ".", "read4BE", "(", ")", ";", "int", "arity", "=", "in", ".", "read4BE", "(", ")", ";", "int", "label", "=", "in", ".", "read4BE", "(", ")", ";", "int", "index", "=", "in", ".", "read4BE", "(", ")", ";", "int", "free_vars", "=", "in", ".", "read4BE", "(", ")", ";", "int", "old_uniq", "=", "in", ".", "read4BE", "(", ")", ";", "EAtom", "fun", "=", "atom", "(", "fun_atom_nr", ")", ";", "anonymousFuns", "[", "i", "]", "=", "new", "AnonFun", "(", "mod", ",", "fun", ",", "arity", ",", "label", ",", "old_uniq", ",", "i", ",", "module_md5", ",", "index", ",", "free_vars", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "atoms", "!=", "null", ")", "{", "log", ".", "fine", "(", "\"-", "#\"", "+", "(", "i", "+", "1", ")", "+", "\":", "\"", "+", "fun", "+", "\"/\"", "+", "arity", "+", "\"", "@", "\"", "+", "label", ")", ";", "log", ".", "fine", "(", "\"-->", "occur:\"", "+", "index", "+", "\"", "free:\"", "+", "free_vars", "+", "\"", "$", "\"", "+", "old_uniq", ")", ";", "}", "}", "}", "public", "void", "readImportSection", "(", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "int", "nImports", "=", "in", ".", "read4BE", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", "+", "nImports", ")", ";", "externalFuns", "=", "new", "ExtFun", "[", "nImports", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nImports", ";", "i", "++", ")", "{", "int", "m_atm_no", "=", "in", ".", "read4BE", "(", ")", ";", "int", "f_atm_no", "=", "in", ".", "read4BE", "(", ")", ";", "int", "arity", "=", "in", ".", "read4BE", "(", ")", ";", "EAtom", "mod", "=", "atom", "(", "m_atm_no", ")", ",", "fun", "=", "atom", "(", "f_atm_no", ")", ";", "externalFuns", "[", "i", "]", "=", "new", "ExtFun", "(", "mod", ",", "fun", ",", "arity", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "atoms", "!=", "null", ")", "{", "log", ".", "fine", "(", "\"-", "#\"", "+", "(", "i", "+", "1", ")", "+", "\":", "\"", "+", "mod", "+", "\":\"", "+", "fun", "+", "\"/\"", "+", "arity", ")", ";", "}", "}", "}", "public", "void", "readAttributeSection", "(", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "attributes", "=", "in", ".", "read_any", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"Attibutes:", "\"", "+", "attributes", ")", ";", "}", "public", "void", "readCompilationInfoSection", "(", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "compilation_info", "=", "in", ".", "read_any", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", "+", "compilation_info", ")", ";", "}", "public", "void", "readASTSection", "(", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "if", "(", "!", "include_debug_info", ")", "return", ";", "abstract_tree", "=", "in", ".", "read_any", "(", ")", ";", "}", "public", "void", "readLiteralSection", "(", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "final", "byte", "[", "]", "buf", "=", "in", ".", "read_size_and_inflate", "(", ")", ";", "final", "EInputStream", "is", "=", "new", "EInputStream", "(", "buf", ")", ";", "int", "nLiterals", "=", "is", ".", "read4BE", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", "+", "nLiterals", ")", ";", "literals", "=", "new", "EObject", "[", "nLiterals", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nLiterals", ";", "i", "++", ")", "{", "int", "lit_length", "=", "is", ".", "read4BE", "(", ")", ";", "int", "pos_before_lit", "=", "is", ".", "getPos", "(", ")", ";", "literals", "[", "i", "]", "=", "is", ".", "read_any", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"-", "#\"", "+", "i", "+", "\":", "\"", "+", "literals", "[", "i", "]", ")", ";", "int", "pos_after_lit", "=", "is", ".", "getPos", "(", ")", ";", "assert", "(", "pos_after_lit", "==", "pos_before_lit", "+", "lit_length", ")", ";", "}", "}", "public", "void", "readCodeSection", "(", ")", "throws", "IOException", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", ")", ";", "int", "flags", "=", "in", ".", "read4BE", "(", ")", ";", "int", "zero", "=", "in", ".", "read4BE", "(", ")", ";", "int", "highestOpcode", "=", "in", ".", "read4BE", "(", ")", ";", "int", "labelCnt", "=", "in", ".", "read4BE", "(", ")", ";", "int", "funCnt", "=", "in", ".", "read4BE", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "log", ".", "fine", "(", "\"\"", "+", "flags", "+", "\",", "z:\"", "+", "zero", "+", "\",", "hop:\"", "+", "highestOpcode", "+", "\",", "L:\"", "+", "labelCnt", "+", "\",", "f:\"", "+", "funCnt", ")", ";", "code", "=", "new", "ArrayList", "<", "Insn", ">", "(", ")", ";", "Insn", "insn", ";", "do", "{", "insn", "=", "readInstruction", "(", ")", ";", "code", ".", "add", "(", "insn", ")", ";", "}", "while", "(", "insn", ".", "opcode", "(", ")", "!=", "BeamOpcode", ".", "int_code_end", ")", ";", "}", "public", "Insn", "readInstruction", "(", ")", "throws", "IOException", "{", "int", "opcode_no", "=", "in", ".", "read1", "(", ")", ";", "BeamOpcode", "opcode", "=", "BeamOpcode", ".", "decode", "(", "opcode_no", ")", ";", "if", "(", "opcode", "!=", "null", ")", "{", "switch", "(", "opcode", ")", "{", "case", "K_return", ":", "case", "send", ":", "case", "remove_message", ":", "case", "timeout", ":", "case", "if_end", ":", "case", "int_code_end", ":", "case", "fclearerror", ":", "case", "bs_init_writable", ":", "case", "on_load", ":", "return", "new", "Insn", "(", "opcode", ")", ";", "case", "label", ":", "case", "deallocate", ":", "case", "call_fun", ":", "case", "apply", ":", "{", "int", "i1", "=", "readCodeInteger", "(", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", "&&", "opcode", "==", "BeamOpcode", ".", "label", ")", "log", ".", "fine", "(", "\"\"", "+", "i1", "+", "\"###\"", ")", ";", "return", "new", "Insn", ".", "I", "(", "opcode", ",", "i1", ")", ";", "}", "case", "loop_rec_end", ":", "case", "wait", ":", "case", "jump", ":", "case", "fcheckerror", ":", "case", "recv_mark", ":", "case", "recv_set", ":", "{", "Label", "lbl", "=", "readLabel", "(", ")", ";", "return", "new", "Insn", ".", "L", "(", "opcode", ",", "lbl", ")", ";", "}", "case", "put", ":", "case", "badmatch", ":", "case", "case_end", ":", "case", "try_case_end", ":", "{", "SourceOperand", "src", "=", "readSource", "(", ")", ";", "return", "new", "Insn", ".", "S", "(", "opcode", ",", "src", ")", ";", "}", "case", "init", ":", "case", "bs_context_to_binary", ":", "{", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "D", "(", "opcode", ",", "dest", ")", ";", "}", "case", "make_fun2", ":", "{", "int", "fun_ref", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "F", "(", "opcode", ",", "fun_ref", ",", "anonFun", "(", "fun_ref", ")", ")", ";", "}", "case", "try_end", ":", "case", "catch_end", ":", "case", "try_case", ":", "{", "YReg", "y", "=", "readYReg", "(", ")", ";", "return", "new", "Insn", ".", "Y", "(", "opcode", ",", "y", ")", ";", "}", "case", "bs_put_string", ":", "{", "ByteString", "bin", "=", "readBytestringRef", "(", ")", ";", "return", "new", "Insn", ".", "By", "(", "opcode", ",", "bin", ")", ";", "}", "case", "allocate", ":", "case", "allocate_zero", ":", "case", "trim", ":", "case", "apply_last", ":", "{", "int", "i1", "=", "readCodeInteger", "(", ")", ";", "int", "i2", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "II", "(", "opcode", ",", "i1", ",", "i2", ")", ";", "}", "case", "test_heap", ":", "{", "AllocList", "al", "=", "readAllocList", "(", ")", ";", "int", "i2", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "WI", "(", "opcode", ",", "al", ",", "i2", ")", ";", "}", "case", "call", ":", "case", "call_only", ":", "{", "int", "i1", "=", "readCodeInteger", "(", ")", ";", "Label", "label", "=", "readLabel", "(", ")", ";", "return", "new", "Insn", ".", "IL", "(", "opcode", ",", "i1", ",", "label", ",", "functionAtLabel", "(", "label", ".", "nr", ")", ")", ";", "}", "case", "call_ext", ":", "case", "call_ext_only", ":", "{", "int", "i1", "=", "readCodeInteger", "(", ")", ";", "int", "ext_fun_ref", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "IE", "(", "opcode", ",", "i1", ",", "extFun", "(", "ext_fun_ref", ")", ")", ";", "}", "case", "bs_save2", ":", "case", "bs_restore2", ":", "{", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "int", "i2", ";", "if", "(", "(", "peekTag", "(", ")", "&", "0x7", ")", "==", "ATOM4_TAG", ")", "{", "if", "(", "readAtom", "(", ")", ".", "getEAtom", "(", ")", "!=", "START_ATOM", ")", "throw", "new", "IOException", "(", "\"\"", ")", ";", "i2", "=", "-", "1", ";", "}", "else", "i2", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "DI", "(", "opcode", ",", "dest", ",", "i2", ",", "true", ")", ";", "}", "case", "move", ":", "case", "fmove", ":", "case", "fconv", ":", "{", "SourceOperand", "src", "=", "readSource", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "SD", "(", "opcode", ",", "src", ",", "dest", ")", ";", "}", "case", "put_tuple", ":", "{", "int", "i1", "=", "readCodeInteger", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "ID", "(", "opcode", ",", "i1", ",", "dest", ")", ";", "}", "case", "loop_rec", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "LD", "(", "opcode", ",", "label", ",", "dest", ")", ";", "}", "case", "K_try", ":", "case", "K_catch", ":", "{", "YReg", "y", "=", "readYReg", "(", ")", ";", "Label", "label", "=", "readLabel", "(", ")", ";", "return", "new", "Insn", ".", "YL", "(", "opcode", ",", "y", ",", "label", ")", ";", "}", "case", "is_integer", ":", "case", "is_float", ":", "case", "is_number", ":", "case", "is_atom", ":", "case", "is_pid", ":", "case", "is_reference", ":", "case", "is_port", ":", "case", "is_nil", ":", "case", "is_binary", ":", "case", "is_list", ":", "case", "is_nonempty_list", ":", "case", "is_tuple", ":", "case", "is_function", ":", "case", "is_boolean", ":", "case", "is_bitstr", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "DestinationOperand", "src", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "LD", "(", "opcode", ",", "label", ",", "src", ",", "true", ")", ";", "}", "case", "wait_timeout", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "SourceOperand", "src", "=", "readSource", "(", ")", ";", "return", "new", "Insn", ".", "LS", "(", "opcode", ",", "label", ",", "src", ",", "false", ")", ";", "}", "case", "raise", ":", "{", "SourceOperand", "src1", "=", "readSource", "(", ")", ";", "SourceOperand", "src2", "=", "readSource", "(", ")", ";", "return", "new", "Insn", ".", "SS", "(", "opcode", ",", "src1", ",", "src2", ")", ";", "}", "case", "put_string", ":", "{", "ByteString", "bin", "=", "readBytestringRef", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "ByD", "(", "opcode", ",", "bin", ",", "dest", ")", ";", "}", "case", "allocate_heap", ":", "case", "allocate_heap_zero", ":", "{", "int", "i1", "=", "readCodeInteger", "(", ")", ";", "AllocList", "al", "=", "readAllocList", "(", ")", ";", "int", "i3", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "IWI", "(", "opcode", ",", "i1", ",", "al", ",", "i3", ")", ";", "}", "case", "func_info", ":", "{", "Atom", "mod", "=", "readAtom", "(", ")", ";", "Atom", "fun", "=", "readAtom", "(", ")", ";", "int", "arity", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "AAI", "(", "opcode", ",", "mod", ",", "fun", ",", "arity", ")", ";", "}", "case", "call_ext_last", ":", "{", "int", "arity", "=", "readCodeInteger", "(", ")", ";", "int", "ext_fun_ref", "=", "readCodeInteger", "(", ")", ";", "int", "dealloc", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "IEI", "(", "opcode", ",", "arity", ",", "extFun", "(", "ext_fun_ref", ")", ",", "dealloc", ")", ";", "}", "case", "put_list", ":", "{", "SourceOperand", "src1", "=", "readSource", "(", ")", ";", "SourceOperand", "src2", "=", "readSource", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "SSD", "(", "opcode", ",", "src1", ",", "src2", ",", "dest", ")", ";", "}", "case", "get_tuple_element", ":", "{", "SourceOperand", "src", "=", "readSource", "(", ")", ";", "int", "i", "=", "readCodeInteger", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "SID", "(", "opcode", ",", "src", ",", "i", ",", "dest", ")", ";", "}", "case", "set_tuple_element", ":", "{", "SourceOperand", "src", "=", "readSource", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "int", "i", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "SDI", "(", "opcode", ",", "src", ",", "dest", ",", "i", ")", ";", "}", "case", "get_list", ":", "{", "SourceOperand", "src", "=", "readSource", "(", ")", ";", "DestinationOperand", "dest1", "=", "readDestination", "(", ")", ";", "DestinationOperand", "dest2", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "SDD", "(", "opcode", ",", "src", ",", "dest1", ",", "dest2", ")", ";", "}", "case", "test_arity", ":", "case", "bs_test_tail2", ":", "case", "bs_test_unit", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "int", "i1", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "LDI", "(", "opcode", ",", "label", ",", "dest", ",", "i1", ",", "true", ")", ";", "}", "case", "is_lt", ":", "case", "is_ge", ":", "case", "is_eq", ":", "case", "is_ne", ":", "case", "is_eq_exact", ":", "case", "is_ne_exact", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "SourceOperand", "src1", "=", "readSource", "(", ")", ";", "SourceOperand", "src2", "=", "readSource", "(", ")", ";", "return", "new", "Insn", ".", "LSS", "(", "opcode", ",", "label", ",", "src1", ",", "src2", ",", "true", ")", ";", "}", "case", "is_function2", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "SourceOperand", "src", "=", "readSource", "(", ")", ";", "return", "new", "Insn", ".", "LDS", "(", "opcode", ",", "label", ",", "dest", ",", "src", ",", "true", ")", ";", "}", "case", "fnegate", ":", "case", "bs_utf8_size", ":", "case", "bs_utf16_size", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "SourceOperand", "src", "=", "readSource", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "LSD", "(", "opcode", ",", "label", ",", "src", ",", "dest", ")", ";", "}", "case", "call_last", ":", "{", "int", "i1", "=", "readCodeInteger", "(", ")", ";", "Label", "label", "=", "readLabel", "(", ")", ";", "int", "i3", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "ILI", "(", "opcode", ",", "i1", ",", "label", ",", "i3", ",", "functionAtLabel", "(", "label", ".", "nr", ")", ")", ";", "}", "case", "fadd", ":", "case", "fsub", ":", "case", "fmul", ":", "case", "fdiv", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "SourceOperand", "src1", "=", "readSource", "(", ")", ";", "SourceOperand", "src2", "=", "readSource", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "LSSD", "(", "opcode", ",", "label", ",", "src1", ",", "src2", ",", "dest", ",", "true", ")", ";", "}", "case", "bs_add", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "SourceOperand", "src1", "=", "readSource", "(", ")", ";", "SourceOperand", "src2", "=", "readSource", "(", ")", ";", "int", "i3", "=", "readCodeInteger", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "LSSID", "(", "opcode", ",", "label", ",", "src1", ",", "src2", ",", "i3", ",", "dest", ")", ";", "}", "case", "bs_skip_utf8", ":", "case", "bs_skip_utf16", ":", "case", "bs_skip_utf32", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "int", "i3", "=", "readCodeInteger", "(", ")", ";", "int", "i4", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "LDII", "(", "opcode", ",", "label", ",", "dest", ",", "i3", ",", "i4", ")", ";", "}", "case", "bs_match_string", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "BitString", "bin", "=", "readBitstringRef", "(", ")", ";", "return", "new", "Insn", ".", "LDBi", "(", "opcode", ",", "label", ",", "dest", ",", "bin", ")", ";", "}", "case", "bs_put_utf8", ":", "case", "bs_put_utf16", ":", "case", "bs_put_utf32", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "int", "i2", "=", "readCodeInteger", "(", ")", ";", "SourceOperand", "src", "=", "readSource", "(", ")", ";", "return", "new", "Insn", ".", "LIS", "(", "opcode", ",", "label", ",", "i2", ",", "src", ",", "true", ")", ";", "}", "case", "bs_start_match2", ":", "case", "bs_get_utf8", ":", "case", "bs_get_utf16", ":", "case", "bs_get_utf32", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "DestinationOperand", "dest1", "=", "readDestination", "(", ")", ";", "int", "i3", "=", "readCodeInteger", "(", ")", ";", "int", "i4", "=", "readCodeInteger", "(", ")", ";", "DestinationOperand", "dest2", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "LDIID", "(", "opcode", ",", "label", ",", "dest1", ",", "i3", ",", "i4", ",", "dest2", ",", "opcode", "!=", "BeamOpcode", ".", "bs_start_match2", ")", ";", "}", "case", "bs_put_integer", ":", "case", "bs_put_float", ":", "case", "bs_put_binary", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "SourceOperand", "src2", "=", "readSource", "(", ")", ";", "int", "i3", "=", "readCodeInteger", "(", ")", ";", "int", "i4", "=", "readCodeInteger", "(", ")", ";", "SourceOperand", "src5", "=", "readSource", "(", ")", ";", "return", "new", "Insn", ".", "LSIIS", "(", "opcode", ",", "label", ",", "src2", ",", "i3", ",", "i4", ",", "src5", ",", "true", ")", ";", "}", "case", "bs_init2", ":", "case", "bs_init_bits", ":", "{", "Label", "label", "=", "readOptionalLabel", "(", ")", ";", "SourceOperand", "src2", ";", "if", "(", "(", "peekTag", "(", ")", "&", "0x7", ")", "==", "CODEINT4_TAG", ")", "{", "int", "i2", "=", "readCodeInteger", "(", ")", ";", "src2", "=", "new", "Operands", ".", "Int", "(", "i2", ")", ";", "}", "else", "{", "src2", "=", "readSource", "(", ")", ";", "}", "int", "i3", "=", "readCodeInteger", "(", ")", ";", "int", "i4", "=", "readCodeInteger", "(", ")", ";", "int", "i5", "=", "readCodeInteger", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "LSIIID", "(", "opcode", ",", "label", ",", "src2", ",", "i3", ",", "i4", ",", "i5", ",", "dest", ",", "true", ")", ";", "}", "case", "bs_skip_bits2", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "SourceOperand", "src", "=", "readSource", "(", ")", ";", "int", "i3", "=", "readCodeInteger", "(", ")", ";", "int", "i4", "=", "readCodeInteger", "(", ")", ";", "return", "new", "Insn", ".", "LDSII", "(", "opcode", ",", "label", ",", "dest", ",", "src", ",", "i3", ",", "i4", ")", ";", "}", "case", "bs_get_integer2", ":", "case", "bs_get_float2", ":", "case", "bs_get_binary2", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "DestinationOperand", "dest2", "=", "readDestination", "(", ")", ";", "int", "i3", "=", "readCodeInteger", "(", ")", ";", "SourceOperand", "src4", "=", "readSource", "(", ")", ";", "int", "i5", "=", "readCodeInteger", "(", ")", ";", "int", "i6", "=", "readCodeInteger", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "LDISIID", "(", "opcode", ",", "label", ",", "dest2", ",", "i3", ",", "src4", ",", "i5", ",", "i6", ",", "dest", ")", ";", "}", "case", "bs_append", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "SourceOperand", "src2", "=", "readSource", "(", ")", ";", "int", "i3", "=", "readCodeInteger", "(", ")", ";", "int", "i4", "=", "readCodeInteger", "(", ")", ";", "int", "i5", "=", "readCodeInteger", "(", ")", ";", "SourceOperand", "src6", "=", "readSource", "(", ")", ";", "int", "i7", "=", "readCodeInteger", "(", ")", ";", "DestinationOperand", "dest8", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "BSAppend", "(", "opcode", ",", "label", ",", "src2", ",", "i3", ",", "i4", ",", "i5", ",", "src6", ",", "i7", ",", "dest8", ")", ";", "}", "case", "bs_private_append", ":", "{", "Label", "label", "=", "readLabel", "(", ")", ";", "SourceOperand", "src2", "=", "readSource", "(", ")", ";", "int", "i3", "=", "readCodeInteger", "(", ")", ";", "SourceOperand", "src4", "=", "readSource", "(", ")", ";", "int", "i5", "=", "readCodeInteger", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "BSPrivateAppend", "(", "opcode", ",", "label", ",", "src2", ",", "i3", ",", "src4", ",", "i5", ",", "dest", ")", ";", "}", "case", "select_val", ":", "case", "select_tuple_arity", ":", "{", "SourceOperand", "src", "=", "readSource", "(", ")", ";", "Label", "defaultLbl", "=", "readLabel", "(", ")", ";", "SelectList", "jumpTable", "=", "readSelectList", "(", ")", ";", "return", "new", "Insn", ".", "Select", "(", "opcode", ",", "src", ",", "defaultLbl", ",", "jumpTable", ")", ";", "}", "case", "bif0", ":", "{", "Label", "optLabel", "=", "readOptionalLabel", "(", ")", ";", "int", "ext_fun_ref", "=", "readCodeInteger", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "Bif", "(", "opcode", ",", "optLabel", ",", "extFun", "(", "ext_fun_ref", ")", ",", "dest", ")", ";", "}", "case", "bif1", ":", "{", "Label", "optLabel", "=", "readOptionalLabel", "(", ")", ";", "int", "ext_fun_ref", "=", "readCodeInteger", "(", ")", ";", "SourceOperand", "arg", "=", "readSource", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "Bif", "(", "opcode", ",", "optLabel", ",", "extFun", "(", "ext_fun_ref", ")", ",", "arg", ",", "dest", ")", ";", "}", "case", "bif2", ":", "{", "Label", "optLabel", "=", "readOptionalLabel", "(", ")", ";", "int", "ext_fun_ref", "=", "readCodeInteger", "(", ")", ";", "SourceOperand", "arg1", "=", "readSource", "(", ")", ";", "SourceOperand", "arg2", "=", "readSource", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "Bif", "(", "opcode", ",", "optLabel", ",", "extFun", "(", "ext_fun_ref", ")", ",", "arg1", ",", "arg2", ",", "dest", ")", ";", "}", "case", "gc_bif1", ":", "{", "Label", "optLabel", "=", "readOptionalLabel", "(", ")", ";", "int", "save", "=", "readCodeInteger", "(", ")", ";", "int", "ext_fun_ref", "=", "readCodeInteger", "(", ")", ";", "SourceOperand", "arg", "=", "readSource", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "GcBif", "(", "opcode", ",", "optLabel", ",", "extFun", "(", "ext_fun_ref", ")", ",", "save", ",", "arg", ",", "dest", ")", ";", "}", "case", "gc_bif2", ":", "{", "Label", "optLabel", "=", "readOptionalLabel", "(", ")", ";", "int", "save", "=", "readCodeInteger", "(", ")", ";", "int", "ext_fun_ref", "=", "readCodeInteger", "(", ")", ";", "SourceOperand", "arg1", "=", "readSource", "(", ")", ";", "SourceOperand", "arg2", "=", "readSource", "(", ")", ";", "DestinationOperand", "dest", "=", "readDestination", "(", ")", ";", "return", "new", "Insn", ".", "GcBif", "(", "opcode", ",", "optLabel", ",", "extFun", "(", "ext_fun_ref", ")", ",", "save", ",", "arg1", ",", "arg2", ",", "dest", ")", ";", "}", "default", ":", "throw", "new", "IOException", "(", "\"\"", "+", "opcode", ")", ";", "}", "}", "else", "throw", "new", "IOException", "(", "\"\"", "+", "Integer", ".", "toHexString", "(", "opcode_no", ")", ")", ";", "}", "public", "String", "readString", "(", "int", "len", ")", "throws", "IOException", "{", "return", "new", "String", "(", "readBinary", "(", "len", ")", ")", ";", "}", "public", "byte", "[", "]", "readBinary", "(", "int", "len", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "len", "]", ";", "in", ".", "readFully", "(", "data", ")", ";", "return", "data", ";", "}", "static", "final", "int", "CODEINT4_TAG", "=", "0", ";", "static", "final", "int", "INTLIT4_TAG", "=", "1", ";", "static", "final", "int", "ATOM4_TAG", "=", "2", ";", "static", "final", "int", "XREG4_TAG", "=", "3", ";", "static", "final", "int", "YREG4_TAG", "=", "4", ";", "static", "final", "int", "LABEL4_TAG", "=", "5", ";", "static", "final", "int", "EXTENDED_TAG", "=", "7", ";", "static", "final", "int", "CODEINT12_TAG", "=", "8", ";", "static", "final", "int", "BIGINT_TAG", "=", "9", ";", "static", "final", "int", "ATOM12_TAG", "=", "10", ";", "static", "final", "int", "XREG12_TAG", "=", "11", ";", "static", "final", "int", "YREG12_TAG", "=", "12", ";", "static", "final", "int", "LABEL12_TAG", "=", "13", ";", "static", "final", "int", "EXTENDED2_TAG", "=", "7", ";", "static", "final", "int", "FLOATLIT_TAG2", "=", "0", ";", "static", "final", "int", "SELECTLIST_TAG2", "=", "1", ";", "static", "final", "int", "FLOATREG_TAG2", "=", "2", ";", "static", "final", "int", "ALLOCLIST_TAG2", "=", "3", ";", "static", "final", "int", "LITERAL_TAG2", "=", "4", ";", "int", "peekTag", "(", ")", "throws", "IOException", "{", "return", "in", ".", "peek", "(", ")", "&", "0x0F", ";", "}", "public", "SourceOperand", "readSource", "(", ")", "throws", "IOException", "{", "return", "readOperand", "(", ")", ".", "asSource", "(", ")", ";", "}", "public", "DestinationOperand", "readDestination", "(", ")", "throws", "IOException", "{", "return", "readOperand", "(", ")", ".", "asDestination", "(", ")", ";", "}", "public", "Label", "readOptionalLabel", "(", ")", "throws", "IOException", "{", "return", "(", "peekTag", "(", ")", "==", "LABEL4_TAG", "||", "peekTag", "(", ")", "==", "LABEL12_TAG", ")", "?", "readLabel", "(", ")", ":", "null", ";", "}", "public", "Label", "readLabel", "(", ")", "throws", "IOException", "{", "return", "readOperand", "(", ")", ".", "asLabel", "(", ")", ";", "}", "public", "Literal", "readLiteral", "(", ")", "throws", "IOException", "{", "return", "readOperand", "(", ")", ".", "asLiteral", "(", ")", ";", "}", "public", "Atom", "readAtom", "(", ")", "throws", "IOException", "{", "return", "readOperand", "(", ")", ".", "asAtom", "(", ")", ";", "}", "public", "BitString", "readBitstringRef", "(", ")", "throws", "IOException", "{", "int", "bits", "=", "readCodeInteger", "(", ")", ";", "int", "start", "=", "readCodeInteger", "(", ")", ";", "return", "new", "BitString", "(", "bitstring", "(", "start", ",", "bits", ")", ")", ";", "}", "public", "ByteString", "readBytestringRef", "(", ")", "throws", "IOException", "{", "int", "bytes", "=", "readCodeInteger", "(", ")", ";", "int", "start", "=", "readCodeInteger", "(", ")", ";", "return", "new", "ByteString", "(", "string", "(", "start", ",", "bytes", ")", ")", ";", "}", "public", "SelectList", "readSelectList", "(", ")", "throws", "IOException", "{", "return", "readOperand", "(", ")", ".", "asSelectList", "(", ")", ";", "}", "public", "AllocList", "readAllocList", "(", ")", "throws", "IOException", "{", "switch", "(", "peekTag", "(", ")", ")", "{", "case", "CODEINT4_TAG", ":", "case", "CODEINT12_TAG", ":", "{", "int", "words", "=", "readCodeInteger", "(", ")", ";", "return", "new", "AllocList", "(", "words", ")", ";", "}", "case", "EXTENDED_TAG", ":", "{", "return", "readOperand", "(", ")", ".", "asAllocList", "(", ")", ";", "}", "default", ":", "throw", "new", "IOException", "(", "\"\"", "+", "readOperand", "(", ")", ".", "toSymbolic", "(", ")", ")", ";", "}", "}", "public", "YReg", "readYReg", "(", ")", "throws", "IOException", "{", "return", "readOperand", "(", ")", ".", "asYReg", "(", ")", ";", "}", "public", "int", "readCodeInteger", "(", ")", "throws", "IOException", "{", "int", "d1", "=", "in", ".", "read1", "(", ")", ";", "int", "tag", "=", "d1", "&", "0x07", ";", "if", "(", "tag", "==", "CODEINT4_TAG", ")", "return", "readSmallIntValue", "(", "d1", ")", ";", "else", "throw", "new", "IOException", "(", "\"\"", "+", "readOperand", "(", "d1", ")", ".", "toSymbolic", "(", ")", ")", ";", "}", "public", "Operand", "readOperand", "(", ")", "throws", "IOException", "{", "int", "d1", "=", "in", ".", "read1", "(", ")", ";", "return", "readOperand", "(", "d1", ")", ";", "}", "public", "Operand", "readOperand", "(", "int", "d1", ")", "throws", "IOException", "{", "int", "tag", "=", "d1", "&", "0x07", ";", "switch", "(", "tag", ")", "{", "case", "CODEINT4_TAG", ":", "return", "new", "Operands", ".", "CodeInt", "(", "readSmallIntValue", "(", "d1", ")", ")", ";", "case", "INTLIT4_TAG", ":", "{", "if", "(", "(", "d1", "&", "0x8", ")", "==", "0", ")", "return", "new", "Operands", ".", "Int", "(", "readSmallIntValue", "(", "d1", ")", ")", ";", "else", "{", "int", "hdata", "=", "d1", ">>", "4", ";", "if", "(", "(", "hdata", "&", "1", ")", "==", "0", ")", "{", "return", "new", "Operands", ".", "Int", "(", "(", "hdata", "<<", "7", ")", "+", "in", ".", "read1", "(", ")", ")", ";", "}", "else", "{", "int", "len", ";", "if", "(", "hdata", "<", "15", ")", "{", "len", "=", "2", "+", "(", "hdata", ">>", "1", ")", ";", "}", "else", "{", "len", "=", "2", "+", "(", "hdata", ">>", "1", ")", "+", "readCodeInteger", "(", ")", ";", "}", "byte", "d", "[", "]", "=", "new", "byte", "[", "len", "]", ";", "in", ".", "readFully", "(", "d", ")", ";", "return", "Operands", ".", "makeInt", "(", "d", ")", ";", "}", "}", "}", "case", "ATOM4_TAG", ":", "case", "ATOM12_TAG", ":", "{", "int", "nr", "=", "readSmallIntValue", "(", "d1", ")", ";", "return", "(", "nr", "==", "0", ")", "?", "Operands", ".", "Nil", ":", "new", "Operands", ".", "Atom", "(", "atom", "(", "nr", ")", ")", ";", "}", "case", "XREG4_TAG", ":", "case", "XREG12_TAG", ":", "{", "int", "nr", "=", "readSmallIntValue", "(", "d1", ")", ";", "return", "XReg", ".", "get", "(", "nr", ")", ";", "}", "case", "YREG4_TAG", ":", "case", "YREG12_TAG", ":", "{", "int", "nr", "=", "readSmallIntValue", "(", "d1", ")", ";", "return", "YReg", ".", "get", "(", "nr", ")", ";", "}", "case", "LABEL4_TAG", ":", "case", "LABEL12_TAG", ":", "{", "int", "nr", "=", "readSmallIntValue", "(", "d1", ")", ";", "return", "new", "Label", "(", "nr", ")", ";", "}", "case", "EXTENDED_TAG", ":", "{", "int", "moretag", "=", "d1", ">>", "4", ";", "switch", "(", "moretag", ")", "{", "case", "FLOATLIT_TAG2", ":", "{", "double", "value", "=", "Double", ".", "longBitsToDouble", "(", "in", ".", "readBE", "(", "8", ")", ")", ";", "return", "new", "Operands", ".", "Float", "(", "value", ")", ";", "}", "case", "SELECTLIST_TAG2", ":", "{", "int", "length", "=", "readCodeInteger", "(", ")", ";", "assert", "(", "length", "%", "2", "==", "0", ")", ";", "Operand", "[", "]", "list", "=", "new", "Operand", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", ")", "{", "list", "[", "i", "++", "]", "=", "readOperand", "(", ")", ";", "list", "[", "i", "++", "]", "=", "readLabel", "(", ")", ";", "}", "return", "new", "SelectList", "(", "list", ")", ";", "}", "case", "ALLOCLIST_TAG2", ":", "{", "int", "length", "=", "readCodeInteger", "(", ")", ";", "int", "[", "]", "list", "=", "new", "int", "[", "2", "*", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "list", "[", "2", "*", "i", "]", "=", "readCodeInteger", "(", ")", ";", "list", "[", "2", "*", "i", "+", "1", "]", "=", "readCodeInteger", "(", ")", ";", "}", "return", "new", "AllocList", "(", "list", ")", ";", "}", "case", "FLOATREG_TAG2", ":", "{", "int", "nr", "=", "readSmallIntValue", "(", "in", ".", "read1", "(", ")", ")", ";", "return", "new", "FReg", "(", "nr", ")", ";", "}", "case", "LITERAL_TAG2", ":", "{", "int", "nr", "=", "readSmallIntValue", "(", "in", ".", "read1", "(", ")", ")", ";", "return", "new", "TableLiteral", "(", "literal", "(", "nr", ")", ")", ";", "}", "default", ":", "log", ".", "warning", "(", "\"\"", "+", "moretag", ")", ";", "}", "break", ";", "}", "default", ":", "log", ".", "warning", "(", "\"\"", "+", "tag", ")", ";", "}", "return", "null", ";", "}", "public", "int", "readSmallIntValue", "(", "int", "head", ")", "throws", "IOException", "{", "int", "tag", "=", "head", "&", "0x0F", ";", "int", "hdata", "=", "head", ">>", "4", ";", "if", "(", "(", "tag", "&", "0x08", ")", "==", "0", ")", "{", "return", "hdata", ";", "}", "else", "if", "(", "(", "hdata", "&", "1", ")", "==", "0", ")", "{", "return", "(", "hdata", "<<", "7", ")", "+", "in", ".", "read1", "(", ")", ";", "}", "else", "{", "int", "len", "=", "2", "+", "(", "hdata", ">>", "1", ")", ";", "byte", "d", "[", "]", "=", "new", "byte", "[", "len", "]", ";", "in", ".", "readFully", "(", "d", ")", ";", "BigInteger", "value", "=", "new", "BigInteger", "(", "d", ")", ";", "if", "(", "len", ">", "4", "||", "value", ".", "compareTo", "(", "BigInteger", ".", "ZERO", ")", "<", "0", ")", "throw", "new", "IOException", "(", "\"\"", "+", "value", ")", ";", "else", "return", "value", ".", "intValue", "(", ")", ";", "}", "}", "static", "class", "SectionMetadata", "{", "final", "int", "tag", ",", "offset", ",", "length", ";", "public", "SectionMetadata", "(", "int", "tag", ",", "int", "offset", ",", "int", "length", ")", "{", "this", ".", "tag", "=", "tag", ";", "this", ".", "offset", "=", "offset", ";", "this", ".", "length", "=", "length", ";", "}", "}", "}", "</s>" ]
7,872
[ "<s>", "package", "erjang", ".", "beam", ".", "loader", ";", "import", "erjang", ".", "beam", ".", "BeamOpcode", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Insn", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ".", "Label", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "FunctionInfo", ";", "import", "erjang", ".", "EAtom", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "ListIterator", ";", "public", "class", "Rewriter", "{", "public", "void", "rewriteFunctionBody", "(", "List", "<", "Insn", ">", "body", ",", "FunctionInfo", "sig", ")", "{", "ListIterator", "<", "Insn", ">", "it", "=", "body", ".", "listIterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "final", "Insn", "insn", "=", "it", ".", "next", "(", ")", ";", "switch", "(", "insn", ".", "opcode", "(", ")", ")", "{", "case", "call_fun", ":", "{", "int", "save_pos", "=", "savePos", "(", "it", ")", ";", "boolean", "trigger", "=", "(", "it", ".", "hasNext", "(", ")", "&&", "it", ".", "next", "(", ")", ".", "opcode", "(", ")", "==", "BeamOpcode", ".", "deallocate", "&&", "it", ".", "hasNext", "(", ")", "&&", "it", ".", "next", "(", ")", ".", "opcode", "(", ")", "==", "BeamOpcode", ".", "K_return", ")", ";", "restorePos", "(", "it", ",", "save_pos", ")", ";", "if", "(", "trigger", ")", "{", "Insn", ".", "I", "old", "=", "(", "Insn", ".", "I", ")", "insn", ";", "it", ".", "set", "(", "new", "Insn", ".", "I", "(", "BeamOpcode", ".", "i_call_fun_last", ",", "old", ".", "i1", ")", ")", ";", "it", ".", "next", "(", ")", ";", "it", ".", "remove", "(", ")", ";", "it", ".", "next", "(", ")", ";", "it", ".", "remove", "(", ")", ";", "}", "}", "}", "}", "}", "private", "int", "savePos", "(", "ListIterator", "<", "Insn", ">", "it", ")", "{", "return", "it", ".", "nextIndex", "(", ")", "-", "1", ";", "}", "private", "void", "restorePos", "(", "ListIterator", "<", "Insn", ">", "it", ",", "int", "save_pos", ")", "{", "int", "i", "=", "0", ";", "while", "(", "it", ".", "previousIndex", "(", ")", ">=", "save_pos", ")", "{", "int", "pi", "=", "it", ".", "previousIndex", "(", ")", ";", "Insn", "insn", "=", "it", ".", "previous", "(", ")", ";", "i", "++", ";", "}", "if", "(", "it", ".", "nextIndex", "(", ")", "<=", "save_pos", ")", "it", ".", "next", "(", ")", ";", "}", "private", "Insn", "nop", "(", ")", "{", "return", "new", "Insn", ".", "I", "(", "BeamOpcode", ".", "label", ",", "-", "1", ")", ";", "}", "}", "</s>" ]
7,873
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Insn", ";", "public", "interface", "BlockVisitor", "{", "public", "void", "visitInsn", "(", "Insn", "insn", ")", ";", "public", "void", "visitEnd", "(", ")", ";", "}", "</s>" ]
7,874
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "FileOutputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "jar", ".", "JarOutputStream", ";", "import", "java", ".", "util", ".", "zip", ".", "ZipEntry", ";", "public", "class", "JarClassRepo", "implements", "ClassRepo", "{", "private", "JarOutputStream", "jo", ";", "public", "JarClassRepo", "(", "File", "jarFile", ")", "throws", "IOException", "{", "FileOutputStream", "fo", "=", "new", "FileOutputStream", "(", "jarFile", ")", ";", "jo", "=", "new", "JarOutputStream", "(", "fo", ")", ";", "}", "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "jo", ".", "close", "(", ")", ";", "}", "@", "Override", "public", "void", "store", "(", "String", "internalName", ",", "byte", "[", "]", "data", ")", "throws", "IOException", "{", "String", "out", "=", "internalName", "+", "\".class\"", ";", "jo", ".", "putNextEntry", "(", "new", "ZipEntry", "(", "out", ")", ")", ";", "jo", ".", "write", "(", "data", ")", ";", "jo", ".", "closeEntry", "(", ")", ";", "}", "}", "</s>" ]
7,875
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "com", ".", "trifork", ".", "clj_ds", ".", "IPersistentCollection", ";", "public", "interface", "BeamFunction", "{", "boolean", "isExported", "(", ")", ";", "String", "getModuleName", "(", ")", ";", "String", "getName", "(", ")", ";", "int", "getArity", "(", ")", ";", "Set", "<", "Integer", ">", "getXRegisters", "(", ")", ";", "int", "getYregCount", "(", ")", ";", "int", "getFregCount", "(", ")", ";", "int", "getEntryLabel", "(", ")", ";", "BeamCodeBlock", "[", "]", "getCodeBlocks", "(", ")", ";", "}", "</s>" ]
7,876
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "erjang", ".", "EAtom", ";", "public", "class", "CodeAtoms", "{", "public", "static", "final", "EAtom", "TRUE_ATOM", "=", "EAtom", ".", "intern", "(", "\"true\"", ")", ";", "public", "static", "final", "EAtom", "FALSE_ATOM", "=", "EAtom", ".", "intern", "(", "\"false\"", ")", ";", "public", "static", "final", "EAtom", "X_ATOM", "=", "EAtom", ".", "intern", "(", "\"x\"", ")", ";", "public", "static", "final", "EAtom", "Y_ATOM", "=", "EAtom", ".", "intern", "(", "\"y\"", ")", ";", "public", "static", "final", "EAtom", "FR_ATOM", "=", "EAtom", ".", "intern", "(", "\"fr\"", ")", ";", "public", "static", "final", "EAtom", "NIL_ATOM", "=", "EAtom", ".", "intern", "(", "\"nil\"", ")", ";", "public", "static", "final", "EAtom", "INTEGER_ATOM", "=", "EAtom", ".", "intern", "(", "\"integer\"", ")", ";", "public", "static", "final", "EAtom", "STRING_ATOM", "=", "EAtom", ".", "intern", "(", "\"string\"", ")", ";", "public", "static", "final", "EAtom", "FLOAT_ATOM", "=", "EAtom", ".", "intern", "(", "\"float\"", ")", ";", "public", "static", "final", "EAtom", "ATOM_ATOM", "=", "EAtom", ".", "intern", "(", "\"atom\"", ")", ";", "public", "static", "final", "EAtom", "LIST_ATOM", "=", "EAtom", ".", "intern", "(", "\"list\"", ")", ";", "public", "static", "final", "EAtom", "LITERAL_ATOM", "=", "EAtom", ".", "intern", "(", "\"literal\"", ")", ";", "public", "static", "final", "EAtom", "TEST_ATOM", "=", "EAtom", ".", "intern", "(", "\"test\"", ")", ";", "public", "static", "final", "EAtom", "ALLOC_ATOM", "=", "EAtom", ".", "intern", "(", "\"alloc\"", ")", ";", "public", "static", "final", "EAtom", "WORDS_ATOM", "=", "EAtom", ".", "intern", "(", "\"words\"", ")", ";", "public", "static", "final", "EAtom", "FLOATS_ATOM", "=", "EAtom", ".", "intern", "(", "\"floats\"", ")", ";", "public", "static", "final", "EAtom", "NOFAIL_ATOM", "=", "EAtom", ".", "intern", "(", "\"nofail\"", ")", ";", "public", "static", "final", "EAtom", "START_ATOM", "=", "EAtom", ".", "intern", "(", "\"start\"", ")", ";", "public", "static", "final", "EAtom", "F_ATOM", "=", "EAtom", ".", "intern", "(", "\"f\"", ")", ";", "public", "static", "final", "EAtom", "FIELD_FLAGS_ATOM", "=", "EAtom", ".", "intern", "(", "\"field_flags\"", ")", ";", "public", "static", "final", "EAtom", "EXTFUNC_ATOM", "=", "EAtom", ".", "intern", "(", "\"extfunc\"", ")", ";", "public", "static", "final", "EAtom", "APPLY_ATOM", "=", "EAtom", ".", "intern", "(", "\"apply\"", ")", ";", "public", "static", "final", "EAtom", "ERLANG_ATOM", "=", "EAtom", ".", "intern", "(", "\"erlang\"", ")", ";", "public", "static", "final", "EAtom", "ERROR_ATOM", "=", "EAtom", ".", "intern", "(", "\"error\"", ")", ";", "public", "static", "final", "EAtom", "EXIT_ATOM", "=", "EAtom", ".", "intern", "(", "\"exit\"", ")", ";", "public", "static", "final", "EAtom", "THROW_ATOM", "=", "EAtom", ".", "intern", "(", "\"throw\"", ")", ";", "public", "static", "final", "EAtom", "BEAM_FILE_ATOM", "=", "EAtom", ".", "intern", "(", "\"beam_file\"", ")", ";", "public", "static", "final", "EAtom", "FUNCTION_ATOM", "=", "EAtom", ".", "intern", "(", "\"function\"", ")", ";", "public", "static", "final", "EAtom", "BIF_ATOM", "=", "EAtom", ".", "intern", "(", "\"bif\"", ")", ";", "public", "static", "final", "EAtom", "GCBIF_ATOM", "=", "EAtom", ".", "intern", "(", "\"gc_bif\"", ")", ";", "public", "static", "final", "EAtom", "ARITHFBIF_ATOM", "=", "EAtom", ".", "intern", "(", "\"arithfbif\"", ")", ";", "}", "</s>" ]
7,877
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "commons", ".", "Method", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "ExtFun", ";", "import", "erjang", ".", "EBinary", ";", "import", "erjang", ".", "EBitString", ";", "public", "interface", "BlockVisitor2", "extends", "BlockVisitor", "{", "void", "visitBegin", "(", "BeamExceptionHandler", "exh", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "insn", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "int", "failLabel", ",", "Arg", "arg1", ",", "Method", "bif", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "int", "failLabel", ",", "Arg", "[", "]", "in", ",", "Arg", "out", ",", "BuiltInFunction", "bif", ")", ";", "void", "visitTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "arg1", ",", "Type", "out", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "Arg", "arg", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "ExtFun", "ext_fun", ")", ";", "void", "visitTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "[", "]", "args", ",", "Type", "voidType", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "Arg", "arg1", ",", "Arg", "arg2", ")", ";", "void", "visitCall", "(", "ExtFun", "fun", ",", "Arg", "[", "]", "args", ",", "boolean", "isTail", ",", "boolean", "isExternal", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "Arg", "[", "]", "ys", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "ExtFun", "efun", ",", "Arg", "[", "]", "freevars", ",", "int", "index", ",", "int", "old_index", ",", "EBinary", "uniq", ",", "int", "old_uniq", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "Arg", "[", "]", "in", ",", "Arg", "out", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "int", "val", ",", "Arg", "out", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "Arg", "val", ",", "Arg", "out", ",", "int", "pos", ")", ";", "void", "visitSelectTuple", "(", "Arg", "in", ",", "int", "failLabel", ",", "int", "[", "]", "arities", ",", "int", "[", "]", "targets", ")", ";", "void", "visitSelectValue", "(", "Arg", "in", ",", "int", "failLabel", ",", "Arg", "[", "]", "values", ",", "int", "[", "]", "targets", ")", ";", "void", "visitTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "arg", ",", "int", "arity", ",", "Type", "tupleType", ")", ";", "void", "visitTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "arg", ",", "Arg", "arity", ",", "Type", "funType", ")", ";", "void", "visitJump", "(", "int", "decodeLabelref", ")", ";", "void", "visitReceive", "(", "BeamOpcode", "opcode", ",", "int", "block_label", ",", "Arg", "out", ")", ";", "void", "visitInsn", "(", "BeamOpcode", "opcode", ",", "int", "failLabel", ",", "Arg", "[", "]", "in", ",", "Arg", "ex", ")", ";", "void", "visitBitStringTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "in", ",", "int", "intg", ",", "Arg", "dst", ")", ";", "void", "visitBitStringTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "in", ",", "EBitString", "bin", ")", ";", "void", "visitBitStringTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "in", ",", "Arg", "bits", ",", "int", "unit", ",", "int", "flags", ")", ";", "void", "visitBitStringTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "in", ",", "Arg", "bits", ",", "int", "unit", ",", "int", "flags", ",", "Arg", "dst", ")", ";", "void", "visitBitStringTest", "(", "BeamOpcode", "test", ",", "int", "failLabel", ",", "Arg", "in", ",", "int", "intg", ")", ";", "void", "visitInitBitString", "(", "Arg", "size", ",", "int", "flags", ",", "Arg", "out", ",", "boolean", "unit_is_bits", ")", ";", "void", "visitBitStringPut", "(", "BeamOpcode", "opcode", ",", "Arg", "value", ",", "Arg", "size", ",", "int", "unit", ",", "int", "flags", ")", ";", "void", "visitBitStringAppend", "(", "BeamOpcode", "opcode", ",", "int", "label", ",", "Arg", "extra_size", ",", "Arg", "src", ",", "int", "unit", ",", "int", "flags", ",", "Arg", "dst", ")", ";", "void", "visitBS", "(", "BeamOpcode", "opcode", ",", "Arg", "arg1", ",", "Arg", "arg2", ")", ";", "void", "visitBSAdd", "(", "Arg", "in1", ",", "Arg", "in2", ",", "int", "scale", ",", "Arg", "out", ")", ";", "void", "visitUnreachablePoint", "(", ")", ";", "void", "visitCatchBlockStart", "(", "BeamOpcode", "opcode", ",", "int", "label", ",", "Arg", "out", ",", "BeamExceptionHandler", "exh", ")", ";", "void", "visitCatchBlockEnd", "(", "BeamOpcode", "opcode", ",", "Arg", "out", ",", "BeamExceptionHandler", "exh", ")", ";", "void", "visitIncrement", "(", "Arg", "src", ",", "Arg", "out", ")", ";", "void", "visitDecrement", "(", "Arg", "src", ",", "Arg", "out", ")", ";", "void", "visitInitWritable", "(", "Arg", "size", ",", "Arg", "dest", ")", ";", "}", "</s>" ]
7,878
[ "<s>", "package", "erjang", ".", "beam", ".", "interpreter", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "erjang", ".", "EModule", ";", "import", "erjang", ".", "EModuleManager", ";", "import", "erjang", ".", "EFun", ";", "import", "erjang", ".", "FunID", ";", "import", "erjang", ".", "EModuleClassLoader", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "ErlangError", ";", "import", "erjang", ".", "ErlangException", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EAtom", ";", "import", "erjang", ".", "ESeq", ";", "import", "erjang", ".", "ETuple3", ";", "import", "erjang", ".", "EPseudoTerm", ";", "import", "erjang", ".", "beam", ".", "ModuleVisitor", ";", "import", "erjang", ".", "beam", ".", "FunctionVisitor", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Insn", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "Operands", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "ExtFun", ";", "import", "erjang", ".", "beam", ".", "repr", ".", "FunctionInfo", ";", "import", "kilim", ".", "Pausable", ";", "public", "class", "AbstractInterpreter", "{", "static", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.beam\"", ")", ";", "public", "static", "abstract", "class", "Encoder", "implements", "ModuleVisitor", "{", "private", "EAtom", "moduleName", ";", "final", "HashMap", "<", "Integer", ",", "Insn", ">", "insn_start", "=", "new", "HashMap", "<", "Integer", ",", "Insn", ">", "(", ")", ";", "final", "ArrayList", "<", "Character", ">", "code", "=", "new", "ArrayList", "<", "Character", ">", "(", ")", ";", "final", "ArrayList", "<", "EObject", ">", "consts", "=", "new", "ArrayList", "<", "EObject", ">", "(", ")", ";", "final", "ArrayList", "<", "ValueJumpTable", ">", "value_jump_tables", "=", "new", "ArrayList", "<", "ValueJumpTable", ">", "(", ")", ";", "final", "ArrayList", "<", "ArityJumpTable", ">", "arity_jump_tables", "=", "new", "ArrayList", "<", "ArityJumpTable", ">", "(", ")", ";", "final", "HashMap", "<", "EObject", ",", "Integer", ">", "const_map", "=", "new", "HashMap", "<", "EObject", ",", "Integer", ">", "(", ")", ";", "final", "HashMap", "<", "Integer", ",", "Integer", ">", "label_map", "=", "new", "HashMap", "<", "Integer", ",", "Integer", ">", "(", ")", ";", "final", "ArrayList", "<", "Backpatch", ">", "backpatches", "=", "new", "ArrayList", "<", "Backpatch", ">", "(", ")", ";", "final", "HashMap", "<", "FunIDWithGuardedness", ",", "Integer", ">", "ext_fun_map", "=", "new", "HashMap", "<", "FunIDWithGuardedness", ",", "Integer", ">", "(", ")", ";", "final", "ArrayList", "<", "FunIDWithGuardedness", ">", "imports", "=", "new", "ArrayList", "<", "FunIDWithGuardedness", ">", "(", ")", ";", "final", "ArrayList", "<", "FunctionInfo", ">", "raw_exports", "=", "new", "ArrayList", "<", "FunctionInfo", ">", "(", ")", ";", "public", "void", "visitModule", "(", "EAtom", "name", ")", "{", "this", ".", "moduleName", "=", "name", ";", "}", "public", "void", "visitExport", "(", "EAtom", "fun", ",", "int", "arity", ",", "int", "entryLabel", ")", "{", "raw_exports", ".", "add", "(", "new", "FunctionInfo", "(", "moduleName", ",", "fun", ",", "arity", ",", "entryLabel", ")", ")", ";", "}", "public", "void", "visitAttribute", "(", "EAtom", "att", ",", "EObject", "value", ")", "{", "}", "public", "void", "visitEnd", "(", ")", "{", "log", ".", "fine", "(", "\"\"", "+", "moduleName", "+", "\"':\"", ")", ";", "for", "(", "Backpatch", "bp", ":", "backpatches", ")", "{", "bp", ".", "patch", "(", "label_map", ".", "get", "(", "bp", ".", "label", ")", ")", ";", "}", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "code", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Insn", "insn", "=", "insn_start", ".", "get", "(", "i", ")", ";", "log", ".", "fine", "(", "(", "insn", "!=", "null", "?", "\"*\"", ":", "\"", "\"", ")", "+", "i", "+", "\":", "\"", "+", "(", "int", ")", "code", ".", "get", "(", "i", ")", "+", "(", "insn", "!=", "null", "?", "(", "\"t\"", "+", "insn", ".", "toSymbolic", "(", ")", ".", "toString", "(", ")", ")", ":", "\"\"", ")", ")", ";", "}", "}", "}", "public", "EModule", "toEModule", "(", ")", "{", "char", "[", "]", "codeArray", "=", "toArray", "(", "code", ")", ";", "EObject", "[", "]", "constArray", "=", "consts", ".", "toArray", "(", "new", "EObject", "[", "consts", ".", "size", "(", ")", "]", ")", ";", "ValueJumpTable", "[", "]", "valueJumpTableArray", "=", "value_jump_tables", ".", "toArray", "(", "new", "ValueJumpTable", "[", "value_jump_tables", ".", "size", "(", ")", "]", ")", ";", "ArityJumpTable", "[", "]", "arityJumpTableArray", "=", "arity_jump_tables", ".", "toArray", "(", "new", "ArityJumpTable", "[", "arity_jump_tables", ".", "size", "(", ")", "]", ")", ";", "List", "<", "FunIDWithEntry", ">", "exports", "=", "convertExports", "(", "raw_exports", ")", ";", "log", ".", "fine", "(", "\"\"", "+", "moduleName", ".", "getName", "(", ")", ")", ";", "return", "makeModule", "(", "moduleName", ".", "getName", "(", ")", ",", "codeArray", ",", "constArray", ",", "valueJumpTableArray", ",", "arityJumpTableArray", ",", "exports", ",", "imports", ")", ";", "}", "protected", "abstract", "EModule", "makeModule", "(", "String", "name", ",", "char", "[", "]", "code", ",", "EObject", "[", "]", "consts", ",", "ValueJumpTable", "[", "]", "value_jump_tables", ",", "ArityJumpTable", "[", "]", "arity_jump_tables", ",", "List", "<", "FunIDWithEntry", ">", "exports", ",", "List", "<", "FunIDWithGuardedness", ">", "imports", ")", ";", "static", "char", "[", "]", "toArray", "(", "List", "<", "Character", ">", "org", ")", "{", "int", "len", "=", "org", ".", "size", "(", ")", ";", "char", "[", "]", "res", "=", "new", "char", "[", "len", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "res", "[", "i", "]", "=", "org", ".", "get", "(", "i", ")", ";", "return", "res", ";", "}", "List", "<", "FunIDWithEntry", ">", "convertExports", "(", "List", "<", "FunctionInfo", ">", "org", ")", "{", "List", "<", "FunIDWithEntry", ">", "res", "=", "new", "ArrayList", "(", "org", ".", "size", "(", ")", ")", ";", "for", "(", "FunctionInfo", "fi", ":", "org", ")", "{", "res", ".", "add", "(", "new", "FunIDWithEntry", "(", "fi", ".", "mod", ",", "fi", ".", "fun", ",", "fi", ".", "arity", ",", "label_map", ".", "get", "(", "fi", ".", "label", ")", ")", ")", ";", "}", "return", "res", ";", "}", "public", "void", "declareFunction", "(", "EAtom", "name", ",", "int", "arity", ",", "int", "startLabel", ")", "{", "}", "public", "abstract", "FunctionVisitor", "visitFunction", "(", "EAtom", "name", ",", "int", "arity", ",", "int", "startLabel", ")", ";", "protected", "int", "codePos", "(", ")", "{", "return", "code", ".", "size", "(", ")", ";", "}", "protected", "void", "emit", "(", "char", "val", ")", "{", "code", ".", "add", "(", "val", ")", ";", "}", "protected", "void", "emitAt", "(", "int", "pos", ",", "char", "val", ")", "{", "code", ".", "set", "(", "pos", ",", "val", ")", ";", "}", "protected", "void", "nop", "(", "int", "code_pos", ")", "{", "code", ".", "remove", "(", "code_pos", ")", ";", "code", ".", "subList", "(", "code_pos", ",", "code", ".", "size", "(", ")", ")", ".", "clear", "(", ")", ";", "}", "protected", "void", "emit", "(", "int", "intval", ")", "{", "char", "val", "=", "(", "char", ")", "intval", ";", "if", "(", "val", "!=", "intval", ")", "throw", "new", "Error", "(", "\"\"", "+", "intval", ")", ";", "code", ".", "add", "(", "val", ")", ";", "}", "protected", "void", "emitAt", "(", "int", "pos", ",", "int", "intval", ")", "{", "char", "val", "=", "(", "char", ")", "intval", ";", "if", "(", "val", "!=", "intval", ")", "throw", "new", "Error", "(", "\"\"", "+", "intval", ")", ";", "code", ".", "set", "(", "pos", ",", "val", ")", ";", "}", "protected", "int", "emitPlaceholder", "(", ")", "{", "int", "pos", "=", "codePos", "(", ")", ";", "code", ".", "add", "(", "(", "char", ")", "0xFFFF", ")", ";", "return", "pos", ";", "}", "protected", "int", "encodeLiteral", "(", "Operands", ".", "Literal", "lit", ")", "{", "EObject", "value", "=", "lit", ".", "literalValue", "(", ")", ";", "Integer", "index", "=", "const_map", ".", "get", "(", "value", ")", ";", "if", "(", "index", "==", "null", ")", "{", "index", "=", "const_map", ".", "size", "(", ")", ";", "consts", ".", "add", "(", "value", ")", ";", "const_map", ".", "put", "(", "value", ",", "index", ")", ";", "}", "return", "index", ";", "}", "protected", "int", "encodeExtFun", "(", "ExtFun", "extfun", ")", "{", "FunIDWithGuardedness", "id", "=", "new", "FunIDWithGuardedness", "(", "extfun", ".", "mod", ",", "extfun", ".", "fun", ",", "extfun", ".", "arity", ",", "false", ")", ";", "return", "encodeExtFun_common", "(", "id", ")", ";", "}", "protected", "int", "encodeGuardExtFun", "(", "ExtFun", "extfun", ")", "{", "FunIDWithGuardedness", "id", "=", "new", "FunIDWithGuardedness", "(", "extfun", ".", "mod", ",", "extfun", ".", "fun", ",", "extfun", ".", "arity", ",", "true", ")", ";", "return", "encodeExtFun_common", "(", "id", ")", ";", "}", "protected", "int", "encodeExtFun_common", "(", "FunIDWithGuardedness", "id", ")", "{", "Integer", "index", "=", "ext_fun_map", ".", "get", "(", "id", ")", ";", "if", "(", "index", "==", "null", ")", "{", "index", "=", "imports", ".", "size", "(", ")", ";", "imports", ".", "add", "(", "id", ")", ";", "ext_fun_map", ".", "put", "(", "id", ",", "index", ")", ";", "}", "return", "index", ";", "}", "protected", "int", "encodeValueJumpTable", "(", "Operands", ".", "SelectList", "jumpTable", ")", "{", "final", "ValueJumpTable", "table", "=", "new", "ValueJumpTable", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "jumpTable", ".", "size", "(", ")", ";", "i", "++", ")", "{", "final", "EObject", "value", "=", "(", "(", "Operands", ".", "Literal", ")", "jumpTable", ".", "getValue", "(", "i", ")", ")", ".", "literalValue", "(", ")", ";", "int", "label", "=", "jumpTable", ".", "getLabel", "(", "i", ")", ".", "nr", ";", "table", ".", "put", "(", "value", ",", "-", "12347", ")", ";", "backpatches", ".", "add", "(", "new", "Backpatch", "(", "label", ")", "{", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "label", "+", "\">\"", ";", "}", "public", "void", "patch", "(", "int", "labelOffset", ")", "{", "table", ".", "put", "(", "value", ",", "labelOffset", ")", ";", "}", "}", ")", ";", "}", "int", "index", "=", "value_jump_tables", ".", "size", "(", ")", ";", "value_jump_tables", ".", "add", "(", "table", ")", ";", "return", "index", ";", "}", "protected", "int", "encodeArityJumpTable", "(", "Operands", ".", "SelectList", "jumpTable", ")", "{", "final", "ArityJumpTable", "table", "=", "new", "ArityJumpTable", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "jumpTable", ".", "size", "(", ")", ";", "i", "++", ")", "{", "final", "int", "arity", "=", "(", "(", "Operands", ".", "CodeInt", ")", "jumpTable", ".", "getValue", "(", "i", ")", ")", ".", "value", ";", "int", "label", "=", "jumpTable", ".", "getLabel", "(", "i", ")", ".", "nr", ";", "table", ".", "put", "(", "arity", ",", "-", "12346", ")", ";", "backpatches", ".", "add", "(", "new", "Backpatch", "(", "label", ")", "{", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "label", "+", "\">\"", ";", "}", "public", "void", "patch", "(", "int", "labelOffset", ")", "{", "table", ".", "put", "(", "arity", ",", "labelOffset", ")", ";", "}", "}", ")", ";", "}", "int", "index", "=", "arity_jump_tables", ".", "size", "(", ")", ";", "arity_jump_tables", ".", "add", "(", "table", ")", ";", "return", "index", ";", "}", "protected", "int", "encodeLabel", "(", "int", "label", ")", "{", "if", "(", "label_map", ".", "containsKey", "(", "label", ")", ")", "{", "return", "(", "char", ")", "label_map", ".", "get", "(", "label", ")", ".", "intValue", "(", ")", ";", "}", "else", "{", "if", "(", "label", "!=", "0", ")", "{", "final", "int", "codePos", "=", "codePos", "(", ")", ";", "backpatches", ".", "add", "(", "new", "Backpatch", "(", "label", ")", "{", "public", "String", "toString", "(", ")", "{", "return", "\"\"", "+", "label", "+", "\"", "@", "\"", "+", "codePos", "+", "\">\"", ";", "}", "public", "void", "patch", "(", "int", "labelOffset", ")", "{", "emitAt", "(", "codePos", ",", "(", "char", ")", "labelOffset", ")", ";", "}", "}", ")", ";", "}", "return", "(", "char", ")", "-", "1", ";", "}", "}", "protected", "void", "registerLabel", "(", "int", "beamLabel", ")", "{", "assert", "(", "!", "label_map", ".", "containsKey", "(", "beamLabel", ")", ")", ";", "label_map", ".", "put", "(", "beamLabel", ",", "codePos", "(", ")", ")", ";", "}", "}", "public", "static", "abstract", "class", "Module", "extends", "EModule", "{", "final", "protected", "String", "name", ";", "final", "protected", "ClassLoader", "module_class_loader", ";", "protected", "Module", "(", "String", "name", ",", "boolean", "delay_setup", ")", "{", "super", "(", "delay_setup", ")", ";", "this", ".", "name", "=", "name", ";", "this", ".", "module_class_loader", "=", "new", "EModuleClassLoader", "(", "null", ")", ";", "}", "public", "ClassLoader", "getModuleClassLoader", "(", ")", "{", "return", "module_class_loader", ";", "}", "public", "String", "module_name", "(", ")", "{", "return", "name", ";", "}", "}", "protected", "static", "EObject", "[", "]", "getRegs", "(", "erjang", ".", "EProc", "proc", ")", "{", "if", "(", "proc", ".", "regs", "==", "null", ")", "{", "proc", ".", "regs", "=", "new", "EObject", "[", "1024", "]", ";", "}", "return", "proc", ".", "regs", ";", "}", "protected", "static", "EObject", "[", "]", "ensureCapacity", "(", "EObject", "[", "]", "array", ",", "int", "atLeast", ")", "{", "if", "(", "atLeast", ">=", "array", ".", "length", ")", "{", "EObject", "[", "]", "tmp", "=", "new", "EObject", "[", "(", "atLeast", ")", "*", "3", "/", "2", "]", ";", "System", ".", "arraycopy", "(", "array", ",", "0", ",", "tmp", ",", "0", ",", "array", ".", "length", ")", ";", "array", "=", "tmp", ";", "}", "return", "array", ";", "}", "protected", "static", "EObject", "[", "]", "ensureCapacity", "(", "EObject", "[", "]", "array", ",", "int", "atLeast", ",", "int", "keep", ")", "{", "if", "(", "atLeast", ">=", "array", ".", "length", ")", "{", "EObject", "[", "]", "tmp", "=", "new", "EObject", "[", "(", "atLeast", ")", "*", "3", "/", "2", "]", ";", "System", ".", "arraycopy", "(", "array", ",", "0", ",", "tmp", ",", "0", ",", "keep", ")", ";", "array", "=", "tmp", ";", "}", "return", "array", ";", "}", "public", "static", "ESeq", "xregsSeq", "(", "EObject", "[", "]", "reg", ",", "int", "arity", ")", "{", "ESeq", "res", "=", "ERT", ".", "NIL", ";", "for", "(", "int", "i", "=", "arity", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "res", "=", "res", ".", "cons", "(", "reg", "[", "i", "]", ")", ";", "}", "return", "res", ";", "}", "public", "static", "EObject", "[", "]", "xregsArray", "(", "EObject", "[", "]", "reg", ",", "int", "arity", ")", "{", "EObject", "[", "]", "res", "=", "new", "EObject", "[", "arity", "]", ";", "System", ".", "arraycopy", "(", "reg", ",", "0", ",", "res", ",", "0", ",", "arity", ")", ";", "return", "res", ";", "}", "public", "static", "int", "nofailLabel", "(", ")", "{", "throw", "new", "ErlangError", "(", "EAtom", ".", "intern", "(", "\"\"", ")", ")", ";", "}", "static", "class", "FunIDWithEntry", "extends", "FunID", "{", "final", "int", "start_pc", ";", "public", "FunIDWithEntry", "(", "EAtom", "mod", ",", "EAtom", "fun", ",", "int", "arity", ",", "int", "start_pc", ")", "{", "super", "(", "mod", ",", "fun", ",", "arity", ")", ";", "this", ".", "start_pc", "=", "start_pc", ";", "}", "}", "static", "class", "FunIDWithGuardedness", "{", "final", "FunID", "fun", ";", "final", "boolean", "is_guard", ";", "public", "FunIDWithGuardedness", "(", "EAtom", "mod", ",", "EAtom", "fun", ",", "int", "arity", ",", "boolean", "is_guard", ")", "{", "this", ".", "fun", "=", "new", "FunID", "(", "mod", ",", "fun", ",", "arity", ")", ";", "this", ".", "is_guard", "=", "is_guard", ";", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "return", "fun", ".", "hashCode", "(", ")", "+", "(", "is_guard", "?", "307", ":", "0", ")", ";", "}", "@", "Override", "public", "boolean", "equals", "(", "Object", "other", ")", "{", "return", "(", "other", "instanceof", "FunIDWithGuardedness", ")", "&&", "(", "(", "FunIDWithGuardedness", ")", "other", ")", ".", "fun", ".", "equals", "(", "this", ".", "fun", ")", "&&", "(", "(", "FunIDWithGuardedness", ")", "other", ")", ".", "is_guard", "==", "this", ".", "is_guard", ";", "}", "}", "static", "class", "ValueJumpTable", "extends", "HashMap", "<", "EObject", ",", "Integer", ">", "{", "public", "int", "lookup", "(", "EObject", "key", ",", "int", "defaultLabel", ")", "{", "Integer", "lbl", "=", "get", "(", "key", ")", ";", "return", "(", "lbl", "!=", "null", ")", "?", "lbl", ".", "intValue", "(", ")", ":", "defaultLabel", ";", "}", "}", "static", "class", "ArityJumpTable", "extends", "HashMap", "<", "Integer", ",", "Integer", ">", "{", "public", "int", "lookup", "(", "int", "key", ",", "int", "defaultLabel", ")", "{", "Integer", "lbl", "=", "get", "(", "key", ")", ";", "return", "(", "lbl", "!=", "null", ")", "?", "lbl", ".", "intValue", "(", ")", ":", "defaultLabel", ";", "}", "}", "static", "abstract", "class", "Backpatch", "{", "final", "int", "label", ";", "public", "Backpatch", "(", "int", "label", ")", "{", "this", ".", "label", "=", "label", ";", "}", "public", "abstract", "void", "patch", "(", "int", "labelOffset", ")", ";", "}", "protected", "static", "class", "VectorFunBinder", "extends", "EModuleManager", ".", "FunctionBinder", "{", "final", "EFun", "[", "]", "vector", ";", "final", "FunID", "funID", ";", "final", "int", "index", ";", "public", "VectorFunBinder", "(", "EFun", "[", "]", "vector", ",", "FunID", "funID", ",", "int", "index", ")", "{", "this", ".", "vector", "=", "vector", ";", "this", ".", "funID", "=", "funID", ";", "this", ".", "index", "=", "index", ";", "}", "public", "FunID", "getFunID", "(", ")", "{", "return", "funID", ";", "}", "public", "void", "bind", "(", "EFun", "value", ")", "{", "vector", "[", "index", "]", "=", "value", ";", "}", "}", "static", "abstract", "class", "ExceptionHandlerStackElement", "extends", "EPseudoTerm", "{", "final", "int", "pc", ";", "final", "ExceptionHandlerStackElement", "next", ";", "public", "ExceptionHandlerStackElement", "(", "int", "pc", ",", "ExceptionHandlerStackElement", "next", ")", "{", "this", ".", "pc", "=", "pc", ";", "this", ".", "next", "=", "next", ";", "}", "public", "String", "toString", "(", ")", "{", "return", "\"ExhElem(\"", "+", "pc", "+", "\",\"", "+", "next", "+", "\")\"", ";", "}", "public", "abstract", "void", "catchAction", "(", "ErlangException", "e", ",", "EObject", "[", "]", "reg", ")", ";", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "return", "2", ";", "}", "}", "static", "class", "CatchExceptionHandler", "extends", "ExceptionHandlerStackElement", "{", "public", "CatchExceptionHandler", "(", "int", "pc", ",", "ExceptionHandlerStackElement", "next", ")", "{", "super", "(", "pc", ",", "next", ")", ";", "}", "public", "void", "catchAction", "(", "ErlangException", "e", ",", "EObject", "[", "]", "reg", ")", "{", "reg", "[", "0", "]", "=", "e", ".", "getCatchValue", "(", ")", ";", "}", "}", "static", "class", "TryExceptionHandler", "extends", "ExceptionHandlerStackElement", "{", "public", "TryExceptionHandler", "(", "int", "pc", ",", "ExceptionHandlerStackElement", "next", ")", "{", "super", "(", "pc", ",", "next", ")", ";", "}", "public", "void", "catchAction", "(", "ErlangException", "e", ",", "EObject", "[", "]", "reg", ")", "{", "ETuple3", "tmp", "=", "e", ".", "getTryValue", "(", ")", ";", "reg", "[", "0", "]", "=", "tmp", ".", "elem1", ";", "reg", "[", "1", "]", "=", "tmp", ".", "elem2", ";", "reg", "[", "2", "]", "=", "tmp", ".", "elem3", ";", "}", "}", "}", "</s>" ]
7,879
[ "<s>", "package", "erjang", ".", "beam", ";", "import", "java", ".", "lang", ".", "reflect", ".", "Modifier", ";", "import", "kilim", ".", "Pausable", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "Type", ";", "import", "org", ".", "objectweb", ".", "asm", ".", "commons", ".", "Method", ";", "public", "class", "BuiltInFunction", "{", "public", "final", "Type", "owner", ";", "public", "final", "java", ".", "lang", ".", "reflect", ".", "Method", "javaMethod", ";", "public", "final", "Method", "method", ";", "public", "final", "boolean", "isVirtual", ";", "public", "final", "boolean", "isPausable", ";", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "method", ".", "toString", "(", ")", ";", "}", "@", "Override", "public", "int", "hashCode", "(", ")", "{", "return", "toString", "(", ")", ".", "hashCode", "(", ")", ";", "}", "public", "BuiltInFunction", "(", "java", ".", "lang", ".", "reflect", ".", "Method", "m", ")", "{", "this", ".", "javaMethod", "=", "m", ";", "this", ".", "owner", "=", "Type", ".", "getType", "(", "m", ".", "getDeclaringClass", "(", ")", ")", ";", "this", ".", "method", "=", "new", "Method", "(", "m", ".", "getName", "(", ")", ",", "Type", ".", "getType", "(", "m", ".", "getReturnType", "(", ")", ")", ",", "Type", ".", "getArgumentTypes", "(", "m", ")", ")", ";", "isVirtual", "=", "!", "Modifier", ".", "isStatic", "(", "m", ".", "getModifiers", "(", ")", ")", ";", "boolean", "p", "=", "false", ";", "for", "(", "Class", "c", ":", "m", ".", "getExceptionTypes", "(", ")", ")", "{", "if", "(", "Pausable", ".", "class", ".", "equals", "(", "c", ")", ")", "{", "p", "=", "true", ";", "break", ";", "}", "}", "isPausable", "=", "p", ";", "}", "public", "Type", "[", "]", "getArgumentTypes", "(", ")", "{", "return", "method", ".", "getArgumentTypes", "(", ")", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "method", ".", "getName", "(", ")", ";", "}", "public", "String", "getDescriptor", "(", ")", "{", "return", "method", ".", "getDescriptor", "(", ")", ";", "}", "public", "Type", "getReturnType", "(", ")", "{", "return", "method", ".", "getReturnType", "(", ")", ";", "}", "public", "Type", "getOwner", "(", ")", "{", "return", "owner", ";", "}", "public", "boolean", "isVirtual", "(", ")", "{", "return", "isVirtual", ";", "}", "public", "boolean", "isPausable", "(", ")", "{", "return", "isPausable", ";", "}", "}", "</s>" ]
7,880
[ "<s>", "package", "erjang", ".", "beam", ";", "public", "interface", "BeamCodeBlock", "{", "boolean", "isDeadCode", "(", ")", ";", "int", "getLabel", "(", ")", ";", "BeamInstruction", "[", "]", "getInstructions", "(", ")", ";", "}", "</s>" ]
7,881
[ "<s>", "package", "erjang", ".", "beam", ";", "public", "interface", "BeamFileData", "{", "public", "void", "accept", "(", "ModuleVisitor", "v", ")", ";", "}", "</s>" ]
7,882
[ "<s>", "package", "erjang", ".", "console", ";", "import", "java", ".", "awt", ".", "Color", ";", "import", "java", ".", "awt", ".", "Toolkit", ";", "import", "java", ".", "awt", ".", "datatransfer", ".", "Clipboard", ";", "import", "java", ".", "awt", ".", "datatransfer", ".", "DataFlavor", ";", "import", "java", ".", "awt", ".", "datatransfer", ".", "Transferable", ";", "import", "java", ".", "awt", ".", "event", ".", "KeyEvent", ";", "import", "java", ".", "awt", ".", "event", ".", "KeyListener", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "io", ".", "OutputStream", ";", "import", "java", ".", "nio", ".", "ByteBuffer", ";", "import", "java", ".", "nio", ".", "ByteOrder", ";", "import", "javax", ".", "swing", ".", "JTextPane", ";", "import", "javax", ".", "swing", ".", "SwingUtilities", ";", "import", "javax", ".", "swing", ".", "text", ".", "AbstractDocument", ";", "import", "javax", ".", "swing", ".", "text", ".", "AttributeSet", ";", "import", "javax", ".", "swing", ".", "text", ".", "BadLocationException", ";", "import", "javax", ".", "swing", ".", "text", ".", "Document", ";", "import", "javax", ".", "swing", ".", "text", ".", "DocumentFilter", ";", "import", "javax", ".", "swing", ".", "text", ".", "MutableAttributeSet", ";", "import", "javax", ".", "swing", ".", "text", ".", "SimpleAttributeSet", ";", "import", "javax", ".", "swing", ".", "text", ".", "StyleConstants", ";", "import", "kilim", ".", "Pausable", ";", "import", "erjang", ".", "EBinary", ";", "import", "erjang", ".", "EHandle", ";", "import", "erjang", ".", "EObject", ";", "import", "erjang", ".", "EPID", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "EString", ";", "import", "erjang", ".", "driver", ".", "EDriverInstance", ";", "import", "erjang", ".", "driver", ".", "IO", ";", "public", "class", "TTYTextAreaDriverControl", "extends", "EDriverInstance", "implements", "KeyListener", "{", "static", "final", "int", "OP_PUTC", "=", "0", ";", "static", "final", "int", "OP_MOVE", "=", "1", ";", "static", "final", "int", "OP_INSC", "=", "2", ";", "static", "final", "int", "OP_DELC", "=", "3", ";", "static", "final", "int", "OP_BEEP", "=", "4", ";", "static", "final", "int", "CTRL_OP_GET_WINSIZE", "=", "100", ";", "static", "final", "int", "CTRL_OP_GET_UNICODE_STATE", "=", "101", ";", "static", "final", "int", "CTRL_OP_SET_UNICODE_STATE", "=", "102", ";", "static", "final", "int", "CONTROL_TAG", "=", "0x10000000", ";", "static", "final", "int", "ESCAPED_TAG", "=", "0x01000000", ";", "static", "final", "int", "TAG_MASK", "=", "0xFF000000", ";", "static", "final", "int", "MAXSIZE", "=", "1", "<<", "16", ";", "private", "JTextPane", "area", ";", "private", "SimpleAttributeSet", "promptStyle", ";", "private", "SimpleAttributeSet", "inputStyle", ";", "private", "SimpleAttributeSet", "outputStyle", ";", "private", "SimpleAttributeSet", "resultStyle", ";", "private", "int", "startPos", ";", "private", "boolean", "utf8_mode", "=", "true", ";", "private", "Clipboard", "clipboard", ";", "private", "SimpleAttributeSet", "errorStyle", ";", "private", "static", "final", "int", "MAX_DOC_SIZE", "=", "100000", ";", "public", "TTYTextAreaDriverControl", "(", "TTYTextAreaDriver", "driver", ",", "JTextPane", "text", ",", "String", "message", ")", "{", "super", "(", "driver", ")", ";", "this", ".", "clipboard", "=", "text", ".", "getToolkit", "(", ")", ".", "getSystemClipboard", "(", ")", ";", "this", ".", "area", "=", "text", ";", "text", ".", "addKeyListener", "(", "this", ")", ";", "text", ".", "setAutoscrolls", "(", "true", ")", ";", "if", "(", "text", ".", "getDocument", "(", ")", "instanceof", "AbstractDocument", ")", "(", "(", "AbstractDocument", ")", "text", ".", "getDocument", "(", ")", ")", ".", "setDocumentFilter", "(", "new", "DocumentFilter", "(", ")", "{", "public", "void", "insertString", "(", "DocumentFilter", ".", "FilterBypass", "fb", ",", "int", "offset", ",", "String", "string", ",", "AttributeSet", "attr", ")", "throws", "BadLocationException", "{", "if", "(", "offset", ">=", "startPos", ")", "super", ".", "insertString", "(", "fb", ",", "offset", ",", "string", ",", "attr", ")", ";", "}", "public", "void", "remove", "(", "DocumentFilter", ".", "FilterBypass", "fb", ",", "int", "offset", ",", "int", "length", ")", "throws", "BadLocationException", "{", "if", "(", "offset", ">=", "startPos", "||", "offset", "==", "0", ")", "super", ".", "remove", "(", "fb", ",", "offset", ",", "length", ")", ";", "}", "public", "void", "replace", "(", "DocumentFilter", ".", "FilterBypass", "fb", ",", "int", "offset", ",", "int", "length", ",", "String", "text", ",", "AttributeSet", "attrs", ")", "throws", "BadLocationException", "{", "if", "(", "offset", ">=", "startPos", ")", "super", ".", "replace", "(", "fb", ",", "offset", ",", "length", ",", "text", ",", "attrs", ")", ";", "}", "}", ")", ";", "promptStyle", "=", "new", "SimpleAttributeSet", "(", ")", ";", "StyleConstants", ".", "setForeground", "(", "promptStyle", ",", "new", "Color", "(", "0xa4", ",", "0x00", ",", "0x00", ")", ")", ";", "inputStyle", "=", "new", "SimpleAttributeSet", "(", ")", ";", "StyleConstants", ".", "setForeground", "(", "inputStyle", ",", "new", "Color", "(", "0x20", ",", "0x4a", ",", "0x87", ")", ")", ";", "outputStyle", "=", "new", "SimpleAttributeSet", "(", ")", ";", "StyleConstants", ".", "setForeground", "(", "outputStyle", ",", "Color", ".", "darkGray", ")", ";", "errorStyle", "=", "new", "SimpleAttributeSet", "(", ")", ";", "StyleConstants", ".", "setForeground", "(", "errorStyle", ",", "Color", ".", "red", ")", ";", "resultStyle", "=", "new", "SimpleAttributeSet", "(", ")", ";", "StyleConstants", ".", "setItalic", "(", "resultStyle", ",", "true", ")", ";", "StyleConstants", ".", "setForeground", "(", "resultStyle", ",", "new", "Color", "(", "0x20", ",", "0x4a", ",", "0x87", ")", ")", ";", "if", "(", "message", "!=", "null", ")", "{", "final", "MutableAttributeSet", "messageStyle", "=", "new", "SimpleAttributeSet", "(", ")", ";", "StyleConstants", ".", "setBackground", "(", "messageStyle", ",", "text", ".", "getForeground", "(", ")", ")", ";", "StyleConstants", ".", "setForeground", "(", "messageStyle", ",", "text", ".", "getBackground", "(", ")", ")", ";", "append", "(", "message", ",", "messageStyle", ")", ";", "}", "startPos", "=", "text", ".", "getDocument", "(", ")", ".", "getLength", "(", ")", ";", "}", "public", "InputStream", "getInputStream", "(", ")", "{", "return", "ERT", ".", "getInputStream", "(", ")", ";", "}", "public", "OutputStream", "getOutputStream", "(", ")", "{", "return", "new", "Output", "(", "outputStyle", ")", ";", "}", "public", "OutputStream", "getErrorStream", "(", ")", "{", "return", "new", "Output", "(", "errorStyle", ")", ";", "}", "class", "Output", "extends", "OutputStream", "{", "private", "AttributeSet", "style", ";", "public", "Output", "(", "AttributeSet", "style", ")", "{", "this", ".", "style", "=", "style", ";", "}", "@", "Override", "public", "void", "write", "(", "int", "b", ")", "throws", "IOException", "{", "String", "data", "=", "new", "String", "(", "new", "byte", "[", "]", "{", "(", "byte", ")", "b", "}", ",", "IO", ".", "UTF8", ")", ";", "append", "(", "data", ",", "style", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "String", "data", "=", "new", "String", "(", "b", ",", "off", ",", "len", ",", "IO", ".", "UTF8", ")", ";", "append", "(", "data", ",", "style", ")", ";", "}", "}", "protected", "void", "append", "(", "final", "String", "toAppend", ",", "final", "AttributeSet", "style", ")", "{", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "try", "{", "Document", "doc", "=", "area", ".", "getDocument", "(", ")", ";", "doc", ".", "insertString", "(", "doc", ".", "getLength", "(", ")", ",", "toAppend", ",", "style", ")", ";", "area", ".", "setCaretPosition", "(", "doc", ".", "getLength", "(", ")", ")", ";", "int", "extra", "=", "doc", ".", "getLength", "(", ")", "-", "MAX_DOC_SIZE", ";", "if", "(", "extra", ">", "0", ")", "{", "int", "removeBytes", "=", "extra", "+", "MAX_DOC_SIZE", "/", "10", ";", "doc", ".", "remove", "(", "0", ",", "removeBytes", ")", ";", "startPos", "-=", "removeBytes", ";", "}", "}", "catch", "(", "BadLocationException", "e", ")", "{", "}", "}", "}", ")", ";", "}", "@", "Override", "protected", "void", "output", "(", "EHandle", "caller", ",", "ByteBuffer", "buf", ")", "throws", "IOException", ",", "Pausable", "{", "switch", "(", "buf", ".", "get", "(", ")", ")", "{", "case", "OP_PUTC", ":", "put_chars", "(", "buf", ")", ";", "break", ";", "case", "OP_MOVE", ":", "move_rel", "(", "buf", ".", "getShort", "(", ")", ")", ";", "break", ";", "case", "OP_INSC", ":", "ins_chars", "(", "buf", ")", ";", "break", ";", "case", "OP_DELC", ":", "del_chars", "(", "buf", ".", "getShort", "(", ")", ")", ";", "break", ";", "case", "OP_BEEP", ":", "visible_beep", "(", ")", ";", "break", ";", "default", ":", "break", ";", "}", "return", ";", "}", "private", "void", "visible_beep", "(", ")", "{", "{", "Color", "fg", "=", "area", ".", "getForeground", "(", ")", ";", "Color", "bg", "=", "area", ".", "getBackground", "(", ")", ";", "area", ".", "setForeground", "(", "bg", ")", ";", "area", ".", "setBackground", "(", "fg", ")", ";", "area", ".", "repaint", "(", ")", ";", "Toolkit", ".", "getDefaultToolkit", "(", ")", ".", "beep", "(", ")", ";", "try", "{", "Thread", ".", "sleep", "(", "100", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "}", "area", ".", "setForeground", "(", "fg", ")", ";", "area", ".", "setBackground", "(", "bg", ")", ";", "area", ".", "repaint", "(", ")", ";", "}", "}", "private", "void", "del_chars", "(", "int", "i", ")", "{", "try", "{", "Document", "doc", "=", "area", ".", "getDocument", "(", ")", ";", "int", "offs", "=", "area", ".", "getCaretPosition", "(", ")", "+", "i", ";", "doc", ".", "remove", "(", "offs", ",", "-", "i", ")", ";", "}", "catch", "(", "BadLocationException", "e", ")", "{", "}", "}", "private", "void", "ins_chars", "(", "ByteBuffer", "buf", ")", "{", "final", "String", "string", "=", "new", "String", "(", "buf", ".", "array", "(", ")", ",", "buf", ".", "arrayOffset", "(", ")", "+", "buf", ".", "position", "(", ")", ",", "buf", ".", "remaining", "(", ")", ",", "IO", ".", "UTF8", ")", ";", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "try", "{", "Document", "doc", "=", "area", ".", "getDocument", "(", ")", ";", "int", "pos", "=", "area", ".", "getCaretPosition", "(", ")", ";", "doc", ".", "insertString", "(", "pos", ",", "string", ",", "inputStyle", ")", ";", "area", ".", "setCaretPosition", "(", "pos", "+", "string", ".", "length", "(", ")", ")", ";", "area", ".", "select", "(", "area", ".", "getCaretPosition", "(", ")", ",", "area", ".", "getCaretPosition", "(", ")", ")", ";", "int", "extra", "=", "doc", ".", "getLength", "(", ")", "-", "MAX_DOC_SIZE", ";", "if", "(", "extra", ">", "0", ")", "{", "int", "removeBytes", "=", "extra", "+", "MAX_DOC_SIZE", "/", "10", ";", "doc", ".", "remove", "(", "0", ",", "removeBytes", ")", ";", "startPos", "-=", "removeBytes", ";", "}", "}", "catch", "(", "BadLocationException", "e", ")", "{", "}", "}", "}", ")", ";", "}", "private", "void", "move_rel", "(", "final", "int", "delta_pos", ")", "{", "if", "(", "delta_pos", "!=", "0", ")", "{", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "int", "curr", "=", "area", ".", "getCaretPosition", "(", ")", ";", "area", ".", "setCaretPosition", "(", "curr", "+", "delta_pos", ")", ";", "area", ".", "select", "(", "area", ".", "getCaretPosition", "(", ")", ",", "area", ".", "getCaretPosition", "(", ")", ")", ";", "}", "}", ")", ";", "}", "}", "private", "void", "put_chars", "(", "ByteBuffer", "buf", ")", "{", "String", "string", "=", "new", "String", "(", "buf", ".", "array", "(", ")", ",", "buf", ".", "arrayOffset", "(", ")", "+", "buf", ".", "position", "(", ")", ",", "buf", ".", "remaining", "(", ")", ",", "IO", ".", "UTF8", ")", ";", "append", "(", "string", ",", "outputStyle", ")", ";", "}", "private", "void", "put_chars", "(", "String", "string", ")", "{", "append", "(", "string", ",", "outputStyle", ")", ";", "}", "@", "Override", "public", "void", "keyTyped", "(", "KeyEvent", "e", ")", "{", "e", ".", "consume", "(", ")", ";", "}", "@", "Override", "public", "void", "keyReleased", "(", "KeyEvent", "e", ")", "{", "}", "@", "Override", "public", "void", "keyPressed", "(", "KeyEvent", "event", ")", "{", "int", "code", "=", "event", ".", "getKeyCode", "(", ")", ";", "if", "(", "code", "==", "KeyEvent", ".", "VK_COPY", "||", "(", "code", "==", "KeyEvent", ".", "VK_C", "&&", "event", ".", "isMetaDown", "(", ")", ")", ")", "{", "return", ";", "}", "if", "(", "code", "==", "KeyEvent", ".", "VK_PASTE", "||", "(", "code", "==", "KeyEvent", ".", "VK_V", "&&", "event", ".", "isMetaDown", "(", ")", ")", ")", "{", "Transferable", "clipData", "=", "clipboard", ".", "getContents", "(", "clipboard", ")", ";", "try", "{", "if", "(", "clipData", ".", "isDataFlavorSupported", "(", "DataFlavor", ".", "stringFlavor", ")", ")", "{", "String", "s", "=", "(", "String", ")", "(", "clipData", ".", "getTransferData", "(", "DataFlavor", ".", "stringFlavor", ")", ")", ";", "out", "(", "s", ")", ";", "}", "}", "catch", "(", "Exception", "ufe", ")", "{", "}", "event", ".", "consume", "(", ")", ";", "return", ";", "}", "if", "(", "code", "==", "KeyEvent", ".", "VK_CUT", "||", "(", "code", "==", "KeyEvent", ".", "VK_X", "&&", "event", ".", "isMetaDown", "(", ")", ")", ")", "{", "event", ".", "consume", "(", ")", ";", "visible_beep", "(", ")", ";", "return", ";", "}", "event", ".", "consume", "(", ")", ";", "switch", "(", "code", ")", "{", "case", "KeyEvent", ".", "VK_TAB", ":", "out", "(", "'\\t'", ")", ";", "return", ";", "case", "KeyEvent", ".", "VK_ESCAPE", ":", "out_byte", "(", "(", "byte", ")", "27", ")", ";", "return", ";", "case", "KeyEvent", ".", "VK_LEFT", ":", "out_ctrl", "(", "'b'", ")", ";", "return", ";", "case", "KeyEvent", ".", "VK_DELETE", ":", "out_ctrl", "(", "'d'", ")", ";", "return", ";", "case", "KeyEvent", ".", "VK_RIGHT", ":", "out_ctrl", "(", "'f'", ")", ";", "return", ";", "case", "KeyEvent", ".", "VK_BACK_SPACE", ":", "out_ctrl", "(", "'h'", ")", ";", "return", ";", "case", "KeyEvent", ".", "VK_ENTER", ":", "out_ctrl", "(", "'j'", ")", ";", "return", ";", "case", "KeyEvent", ".", "VK_DOWN", ":", "out_ctrl", "(", "'n'", ")", ";", "return", ";", "case", "KeyEvent", ".", "VK_UP", ":", "out_ctrl", "(", "'p'", ")", ";", "return", ";", "}", "if", "(", "event", ".", "getKeyChar", "(", ")", "==", "KeyEvent", ".", "CHAR_UNDEFINED", ")", "{", "return", ";", "}", "if", "(", "(", "event", ".", "getModifiersEx", "(", ")", "&", "KeyEvent", ".", "CTRL_DOWN_MASK", ")", "!=", "0", ")", "{", "if", "(", "code", ">=", "KeyEvent", ".", "VK_A", "&&", "code", "<=", "KeyEvent", ".", "VK_Z", ")", "{", "out_ctrl", "(", "'a'", "+", "code", "-", "KeyEvent", ".", "VK_A", ")", ";", "}", "}", "else", "{", "out", "(", "event", ".", "getKeyChar", "(", ")", ")", ";", "}", "}", "private", "void", "out_ctrl", "(", "int", "i", ")", "{", "if", "(", "i", ">=", "'a'", "&&", "i", "<=", "'z'", ")", "{", "out_byte", "(", "(", "byte", ")", "(", "(", "i", "-", "'a'", ")", "+", "1", ")", ")", ";", "}", "}", "private", "void", "out_byte", "(", "int", "b", ")", "{", "ByteBuffer", "buf", "=", "ByteBuffer", ".", "wrap", "(", "new", "byte", "[", "]", "{", "(", "byte", ")", "b", "}", ")", ";", "EObject", "out", ";", "if", "(", "task", ".", "send_binary_data", "(", ")", ")", "{", "out", "=", "EBinary", ".", "make", "(", "buf", ")", ";", "}", "else", "{", "out", "=", "EString", ".", "make", "(", "buf", ")", ";", "}", "task", ".", "output_from_driver_b", "(", "out", ")", ";", "}", "private", "void", "out", "(", "char", "ch", ")", "{", "String", "string", "=", "new", "String", "(", "new", "char", "[", "]", "{", "ch", "}", ")", ";", "out", "(", "string", ")", ";", "}", "private", "void", "out", "(", "String", "string", ")", "{", "byte", "[", "]", "bytes", "=", "string", ".", "getBytes", "(", "IO", ".", "UTF8", ")", ";", "ByteBuffer", "buf", "=", "ByteBuffer", ".", "wrap", "(", "bytes", ")", ";", "EObject", "out", ";", "if", "(", "task", ".", "send_binary_data", "(", ")", ")", "{", "out", "=", "EBinary", ".", "make", "(", "buf", ")", ";", "}", "else", "{", "out", "=", "EString", ".", "make", "(", "buf", ")", ";", "}", "task", ".", "output_from_driver_b", "(", "out", ")", ";", "}", "@", "Override", "protected", "ByteBuffer", "control", "(", "EPID", "pid", ",", "int", "command", ",", "ByteBuffer", "cmd", ")", "throws", "Pausable", "{", "if", "(", "command", "==", "CTRL_OP_GET_WINSIZE", ")", "{", "ByteBuffer", "rep", "=", "ByteBuffer", ".", "allocate", "(", "8", ")", ";", "rep", ".", "order", "(", "ByteOrder", ".", "nativeOrder", "(", ")", ")", ";", "rep", ".", "putInt", "(", "80", ")", ";", "rep", ".", "putInt", "(", "25", ")", ";", "return", "rep", ";", "}", "else", "if", "(", "command", "==", "CTRL_OP_GET_UNICODE_STATE", ")", "{", "ByteBuffer", "rep", "=", "ByteBuffer", ".", "allocate", "(", "1", ")", ";", "rep", ".", "put", "(", "(", "byte", ")", "(", "utf8_mode", "?", "1", ":", "0", ")", ")", ";", "return", "rep", ";", "}", "else", "if", "(", "command", "==", "CTRL_OP_SET_UNICODE_STATE", "&&", "cmd", ".", "remaining", "(", ")", "==", "1", ")", "{", "ByteBuffer", "rep", "=", "ByteBuffer", ".", "allocate", "(", "1", ")", ";", "rep", ".", "put", "(", "(", "byte", ")", "(", "utf8_mode", "?", "1", ":", "0", ")", ")", ";", "utf8_mode", "=", "cmd", ".", "get", "(", ")", "==", "0", "?", "false", ":", "true", ";", "return", "rep", ";", "}", "else", "{", "return", "null", ";", "}", "}", "}", "</s>" ]
7,883
[ "<s>", "package", "erjang", ".", "console", ";", "import", "java", ".", "awt", ".", "BorderLayout", ";", "import", "java", ".", "awt", ".", "Color", ";", "import", "java", ".", "awt", ".", "Component", ";", "import", "java", ".", "awt", ".", "Dimension", ";", "import", "java", ".", "awt", ".", "Font", ";", "import", "java", ".", "awt", ".", "Graphics", ";", "import", "java", ".", "awt", ".", "GraphicsEnvironment", ";", "import", "java", ".", "awt", ".", "Insets", ";", "import", "java", ".", "awt", ".", "SystemColor", ";", "import", "java", ".", "awt", ".", "event", ".", "WindowAdapter", ";", "import", "java", ".", "awt", ".", "event", ".", "WindowEvent", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Timer", ";", "import", "java", ".", "util", ".", "TimerTask", ";", "import", "javax", ".", "swing", ".", "BorderFactory", ";", "import", "javax", ".", "swing", ".", "Icon", ";", "import", "javax", ".", "swing", ".", "JFrame", ";", "import", "javax", ".", "swing", ".", "JLabel", ";", "import", "javax", ".", "swing", ".", "JPanel", ";", "import", "javax", ".", "swing", ".", "JScrollPane", ";", "import", "javax", ".", "swing", ".", "JTextPane", ";", "import", "javax", ".", "swing", ".", "ScrollPaneConstants", ";", "import", "javax", ".", "swing", ".", "SwingUtilities", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "util", ".", "Progress", ";", "import", "erjang", ".", "util", ".", "ProgressListener", ";", "public", "class", "ERLConsole", "extends", "JFrame", "{", "public", "ERLConsole", "(", "String", "title", ")", "{", "super", "(", "title", ")", ";", "}", "static", "final", "int", "HINSET", "=", "8", ";", "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "{", "ERLConsole", "console", "=", "new", "ERLConsole", "(", "\"\"", ")", ";", "console", ".", "getContentPane", "(", ")", ".", "setLayout", "(", "new", "BorderLayout", "(", ")", ")", ";", "console", ".", "setSize", "(", "700", ",", "600", ")", ";", "final", "JTextPane", "text", "=", "new", "JTextPane", "(", ")", ";", "text", ".", "setMargin", "(", "new", "Insets", "(", "8", ",", "HINSET", ",", "8", ",", "HINSET", ")", ")", ";", "text", ".", "setCaretColor", "(", "new", "Color", "(", "0xa4", ",", "0x00", ",", "0x00", ")", ")", ";", "text", ".", "setBackground", "(", "new", "Color", "(", "0xf2", ",", "0xf2", ",", "0xf2", ")", ")", ";", "text", ".", "setForeground", "(", "new", "Color", "(", "0xa4", ",", "0x00", ",", "0x00", ")", ")", ";", "Font", "font", "=", "console", ".", "findFont", "(", "\"Monospaced\"", ",", "Font", ".", "PLAIN", ",", "14", ",", "new", "String", "[", "]", "{", "\"Monaco\"", ",", "\"Andale", "Mono\"", "}", ")", ";", "text", ".", "setFont", "(", "font", ")", ";", "JScrollPane", "pane", "=", "new", "JScrollPane", "(", ")", ";", "pane", ".", "setHorizontalScrollBarPolicy", "(", "ScrollPaneConstants", ".", "HORIZONTAL_SCROLLBAR_NEVER", ")", ";", "pane", ".", "setViewportView", "(", "text", ")", ";", "pane", ".", "setBorder", "(", "BorderFactory", ".", "createLineBorder", "(", "Color", ".", "darkGray", ")", ")", ";", "console", ".", "getContentPane", "(", ")", ".", "add", "(", "pane", ",", "BorderLayout", ".", "CENTER", ")", ";", "final", "StatusBar", "status", "=", "new", "StatusBar", "(", ")", ";", "console", ".", "getContentPane", "(", ")", ".", "add", "(", "status", ",", "BorderLayout", ".", "SOUTH", ")", ";", "console", ".", "validate", "(", ")", ";", "final", "TTYTextAreaDriver", "tty", "=", "new", "TTYTextAreaDriver", "(", "text", ",", "\"\"", ")", ";", "console", ".", "addWindowListener", "(", "new", "WindowAdapter", "(", ")", "{", "public", "void", "windowClosing", "(", "WindowEvent", "e", ")", "{", "ERT", ".", "shutdown", "(", ")", ";", "}", "}", ")", ";", "console", ".", "setVisible", "(", "true", ")", ";", "Timer", "timer", "=", "new", "Timer", "(", "true", ")", ";", "timer", ".", "schedule", "(", "new", "TimerTask", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "status", ".", "updateMemory", "(", ")", ";", "}", "}", ",", "1000", ",", "1000", ")", ";", "erjang", ".", "OTPMain", ".", "add_driver", "(", "tty", ")", ";", "Thread", "t2", "=", "new", "Thread", "(", ")", "{", "public", "void", "run", "(", ")", "{", "try", "{", "erjang", ".", "Main", ".", "main", "(", "args", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", ";", "t2", ".", "start", "(", ")", ";", "try", "{", "t2", ".", "join", "(", ")", ";", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "}", "timer", ".", "cancel", "(", ")", ";", "timer", ".", "purge", "(", ")", ";", "timer", "=", "null", ";", "console", ".", "setVisible", "(", "false", ")", ";", "console", ".", "dispose", "(", ")", ";", "console", "=", "null", ";", "}", "private", "Font", "findFont", "(", "String", "otherwise", ",", "int", "style", ",", "int", "size", ",", "String", "[", "]", "families", ")", "{", "String", "[", "]", "fonts", "=", "GraphicsEnvironment", ".", "getLocalGraphicsEnvironment", "(", ")", ".", "getAvailableFontFamilyNames", "(", ")", ";", "Arrays", ".", "sort", "(", "fonts", ")", ";", "Font", "font", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "families", ".", "length", ";", "i", "++", ")", "{", "if", "(", "Arrays", ".", "binarySearch", "(", "fonts", ",", "families", "[", "i", "]", ")", ">=", "0", ")", "{", "font", "=", "new", "Font", "(", "families", "[", "i", "]", ",", "style", ",", "size", ")", ";", "break", ";", "}", "}", "if", "(", "font", "==", "null", ")", "font", "=", "new", "Font", "(", "otherwise", ",", "style", ",", "size", ")", ";", "return", "font", ";", "}", "private", "static", "final", "long", "serialVersionUID", "=", "3746242973444417387L", ";", "}", "@", "SuppressWarnings", "(", "\"serial\"", ")", "class", "StatusBar", "extends", "JPanel", "{", "private", "JLabel", "mem_label", ";", "private", "JLabel", "progress", ";", "public", "StatusBar", "(", ")", "{", "setLayout", "(", "new", "BorderLayout", "(", ")", ")", ";", "setPreferredSize", "(", "new", "Dimension", "(", "10", ",", "23", ")", ")", ";", "JPanel", "rightPanel", "=", "new", "JPanel", "(", "new", "BorderLayout", "(", ")", ")", ";", "rightPanel", ".", "add", "(", "new", "JLabel", "(", "new", "AngledLinesWindowsCornerIcon", "(", ")", ")", ",", "BorderLayout", ".", "SOUTH", ")", ";", "rightPanel", ".", "setOpaque", "(", "false", ")", ";", "add", "(", "rightPanel", ",", "BorderLayout", ".", "EAST", ")", ";", "setBackground", "(", "SystemColor", ".", "control", ")", ";", "progress", "=", "new", "JLabel", "(", "\"booting...\"", ")", ";", "progress", ".", "setPreferredSize", "(", "new", "Dimension", "(", "300", ",", "23", ")", ")", ";", "Progress", ".", "setListener", "(", "new", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "progress", "(", "final", "String", "msg", ")", "{", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "progress", ".", "setText", "(", "msg", ")", ";", "progress", ".", "repaint", "(", ")", ";", "}", "}", ")", ";", "}", "}", ")", ";", "add", "(", "progress", ",", "BorderLayout", ".", "WEST", ")", ";", "mem_label", "=", "new", "JLabel", "(", ")", ";", "add", "(", "mem_label", ",", "BorderLayout", ".", "CENTER", ")", ";", "}", "void", "updateMemory", "(", ")", "{", "double", "total", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "totalMemory", "(", ")", "/", "(", "1024.0", "*", "1024.0", ")", ";", "double", "free", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "freeMemory", "(", ")", "/", "(", "1024.0", "*", "1024.0", ")", ";", "String", "msg", "=", "\"\"", "+", "(", "(", "int", ")", "(", "total", "-", "free", ")", ")", "+", "\"/\"", "+", "(", "(", "int", ")", "total", ")", "+", "\"MB\"", ";", "mem_label", ".", "setText", "(", "msg", ")", ";", "}", "protected", "void", "paintComponent", "(", "Graphics", "g", ")", "{", "super", ".", "paintComponent", "(", "g", ")", ";", "int", "y", "=", "0", ";", "g", ".", "setColor", "(", "new", "Color", "(", "156", ",", "154", ",", "140", ")", ")", ";", "g", ".", "drawLine", "(", "0", ",", "y", ",", "getWidth", "(", ")", ",", "y", ")", ";", "y", "++", ";", "g", ".", "setColor", "(", "new", "Color", "(", "196", ",", "194", ",", "183", ")", ")", ";", "g", ".", "drawLine", "(", "0", ",", "y", ",", "getWidth", "(", ")", ",", "y", ")", ";", "y", "++", ";", "g", ".", "setColor", "(", "new", "Color", "(", "218", ",", "215", ",", "201", ")", ")", ";", "g", ".", "drawLine", "(", "0", ",", "y", ",", "getWidth", "(", ")", ",", "y", ")", ";", "y", "++", ";", "g", ".", "setColor", "(", "new", "Color", "(", "233", ",", "231", ",", "217", ")", ")", ";", "g", ".", "drawLine", "(", "0", ",", "y", ",", "getWidth", "(", ")", ",", "y", ")", ";", "y", "=", "getHeight", "(", ")", "-", "3", ";", "g", ".", "setColor", "(", "new", "Color", "(", "233", ",", "232", ",", "218", ")", ")", ";", "g", ".", "drawLine", "(", "0", ",", "y", ",", "getWidth", "(", ")", ",", "y", ")", ";", "y", "++", ";", "g", ".", "setColor", "(", "new", "Color", "(", "233", ",", "231", ",", "216", ")", ")", ";", "g", ".", "drawLine", "(", "0", ",", "y", ",", "getWidth", "(", ")", ",", "y", ")", ";", "y", "=", "getHeight", "(", ")", "-", "1", ";", "g", ".", "setColor", "(", "new", "Color", "(", "221", ",", "221", ",", "220", ")", ")", ";", "g", ".", "drawLine", "(", "0", ",", "y", ",", "getWidth", "(", ")", ",", "y", ")", ";", "}", "}", "class", "AngledLinesWindowsCornerIcon", "implements", "Icon", "{", "private", "static", "final", "Color", "WHITE_LINE_COLOR", "=", "new", "Color", "(", "255", ",", "255", ",", "255", ")", ";", "private", "static", "final", "Color", "GRAY_LINE_COLOR", "=", "new", "Color", "(", "172", ",", "168", ",", "153", ")", ";", "private", "static", "final", "int", "WIDTH", "=", "13", ";", "private", "static", "final", "int", "HEIGHT", "=", "13", ";", "public", "int", "getIconHeight", "(", ")", "{", "return", "WIDTH", ";", "}", "public", "int", "getIconWidth", "(", ")", "{", "return", "HEIGHT", ";", "}", "public", "void", "paintIcon", "(", "Component", "c", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ")", "{", "g", ".", "setColor", "(", "WHITE_LINE_COLOR", ")", ";", "g", ".", "drawLine", "(", "0", ",", "12", ",", "12", ",", "0", ")", ";", "g", ".", "drawLine", "(", "5", ",", "12", ",", "12", ",", "5", ")", ";", "g", ".", "drawLine", "(", "10", ",", "12", ",", "12", ",", "10", ")", ";", "g", ".", "setColor", "(", "GRAY_LINE_COLOR", ")", ";", "g", ".", "drawLine", "(", "1", ",", "12", ",", "12", ",", "1", ")", ";", "g", ".", "drawLine", "(", "2", ",", "12", ",", "12", ",", "2", ")", ";", "g", ".", "drawLine", "(", "3", ",", "12", ",", "12", ",", "3", ")", ";", "g", ".", "drawLine", "(", "6", ",", "12", ",", "12", ",", "6", ")", ";", "g", ".", "drawLine", "(", "7", ",", "12", ",", "12", ",", "7", ")", ";", "g", ".", "drawLine", "(", "8", ",", "12", ",", "12", ",", "8", ")", ";", "g", ".", "drawLine", "(", "11", ",", "12", ",", "12", ",", "11", ")", ";", "g", ".", "drawLine", "(", "12", ",", "12", ",", "12", ",", "12", ")", ";", "}", "}", "</s>" ]
7,884
[ "<s>", "package", "erjang", ".", "console", ";", "import", "java", ".", "io", ".", "PrintStream", ";", "import", "java", ".", "util", ".", "concurrent", ".", "locks", ".", "ReentrantLock", ";", "import", "javax", ".", "swing", ".", "JTextPane", ";", "import", "erjang", ".", "ERT", ";", "import", "erjang", ".", "EString", ";", "import", "erjang", ".", "driver", ".", "EDriver", ";", "import", "erjang", ".", "driver", ".", "EDriverControl", ";", "public", "class", "TTYTextAreaDriver", "implements", "EDriver", "{", "private", "kilim", ".", "ReentrantLock", "lock", ";", "final", "JTextPane", "text", ";", "final", "String", "message", ";", "private", "TTYTextAreaDriverControl", "control", ";", "public", "TTYTextAreaDriver", "(", "JTextPane", "text2", ",", "String", "message", ")", "{", "this", ".", "text", "=", "text2", ";", "this", ".", "message", "=", "message", ";", "this", ".", "control", "=", "new", "TTYTextAreaDriverControl", "(", "this", ",", "text", ",", "message", ")", ";", "ERT", ".", "set_stdio", "(", "control", ".", "getInputStream", "(", ")", ",", "new", "PrintStream", "(", "control", ".", "getOutputStream", "(", ")", ")", ",", "new", "PrintStream", "(", "control", ".", "getErrorStream", "(", ")", ")", ")", ";", "}", "@", "Override", "public", "String", "driverName", "(", ")", "{", "return", "\"tty_sl\"", ";", "}", "@", "Override", "public", "void", "finish", "(", ")", "{", "}", "@", "Override", "public", "ReentrantLock", "getLock", "(", ")", "{", "if", "(", "lock", "==", "null", ")", "{", "lock", "=", "new", "kilim", ".", "ReentrantLock", "(", ")", ";", "}", "return", "lock", ";", "}", "@", "Override", "public", "EDriverControl", "start", "(", "EString", "command", ")", "{", "return", "control", ";", "}", "@", "Override", "public", "boolean", "useDriverLevelLocking", "(", ")", "{", "return", "false", ";", "}", "}", "</s>" ]
7,885
[ "<s>", "package", "erjang", ".", "epmd", ";", "public", "interface", "Connection", "{", "int", "CLOSED", "=", "0", ";", "int", "OPEN", "=", "1", ";", "int", "OPENING", "=", "2", ";", "int", "CLOSING", "=", "4", ";", "void", "setName", "(", "String", "nm", ")", ";", "}", "</s>" ]
7,886
[ "<s>", "package", "erjang", ".", "epmd", ";", "import", "java", ".", "io", ".", "*", ";", "import", "java", ".", "net", ".", "*", ";", "import", "java", ".", "util", ".", "*", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "java", ".", "nio", ".", "*", ";", "import", "java", ".", "nio", ".", "channels", ".", "*", ";", "public", "abstract", "class", "PacketServer", "{", "static", "final", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.epmd\"", ")", ";", "private", "ServerSocket", "ss", ";", "private", "ServerSocketChannel", "sschan", ";", "private", "Selector", "selector", ";", "private", "int", "bufsz", "=", "8192", ";", "protected", "void", "listen", "(", "int", "port", ")", "{", "int", "n", "=", "0", ";", "Iterator", "<", "SelectionKey", ">", "it", ";", "SelectionKey", "key", ";", "log", ".", "info", "(", "\"\"", "+", "port", ")", ";", "try", "{", "sschan", "=", "ServerSocketChannel", ".", "open", "(", ")", ";", "sschan", ".", "configureBlocking", "(", "false", ")", ";", "ss", "=", "sschan", ".", "socket", "(", ")", ";", "ss", ".", "bind", "(", "new", "InetSocketAddress", "(", "InetAddress", ".", "getByAddress", "(", "new", "byte", "[", "]", "{", "127", ",", "0", ",", "0", ",", "1", "}", ")", ",", "port", ")", ")", ";", "selector", "=", "Selector", ".", "open", "(", ")", ";", "sschan", ".", "register", "(", "selector", ",", "SelectionKey", ".", "OP_ACCEPT", ")", ";", "}", "catch", "(", "IOException", "ie", ")", "{", "ie", ".", "printStackTrace", "(", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "while", "(", "true", ")", "{", "try", "{", "n", "=", "selector", ".", "select", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "severe", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "log", ".", "log", "(", "Level", ".", "FINE", ",", "\"details:", "\"", ",", "e", ")", ";", "}", "log", ".", "fine", "(", "\"select", "n=\"", "+", "n", ")", ";", "Set", "<", "SelectionKey", ">", "selectedKeys", "=", "selector", ".", "selectedKeys", "(", ")", ";", "it", "=", "selectedKeys", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "key", "=", "(", "SelectionKey", ")", "it", ".", "next", "(", ")", ";", "int", "kro", "=", "key", ".", "readyOps", "(", ")", ";", "log", ".", "fine", "(", "\"kro=\"", "+", "kro", ")", ";", "if", "(", "(", "kro", "&", "SelectionKey", ".", "OP_READ", ")", "==", "SelectionKey", ".", "OP_READ", ")", "doRead", "(", "key", ")", ";", "if", "(", "(", "kro", "&", "SelectionKey", ".", "OP_WRITE", ")", "==", "SelectionKey", ".", "OP_WRITE", ")", "doWrite", "(", "key", ")", ";", "if", "(", "(", "kro", "&", "SelectionKey", ".", "OP_ACCEPT", ")", "==", "SelectionKey", ".", "OP_ACCEPT", ")", "doAccept", "(", "key", ")", ";", "if", "(", "(", "kro", "&", "SelectionKey", ".", "OP_CONNECT", ")", "==", "SelectionKey", ".", "OP_CONNECT", ")", "doConnect", "(", "key", ")", ";", "if", "(", "key", ".", "isValid", "(", ")", "&&", "key", ".", "interestOps", "(", ")", "==", "0", ")", "{", "it", ".", "remove", "(", ")", ";", "}", "}", "}", "}", "private", "void", "doAccept", "(", "SelectionKey", "sk", ")", "{", "ServerSocketChannel", "sc", "=", "(", "ServerSocketChannel", ")", "sk", ".", "channel", "(", ")", ";", "log", ".", "fine", "(", "\"accept\"", ")", ";", "SocketChannel", "usc", "=", "null", ";", "ByteBuffer", "data", ";", "try", "{", "usc", "=", "sc", ".", "accept", "(", ")", ";", "if", "(", "usc", "==", "null", ")", "return", ";", "usc", ".", "configureBlocking", "(", "false", ")", ";", "Socket", "sock", "=", "usc", ".", "socket", "(", ")", ";", "String", "nm", "=", "sock", ".", "getInetAddress", "(", ")", "+", "\":\"", "+", "sock", ".", "getPort", "(", ")", ";", "log", ".", "info", "(", "\"\"", "+", "nm", ")", ";", "sock", ".", "setKeepAlive", "(", "true", ")", ";", "data", "=", "ByteBuffer", ".", "allocate", "(", "bufsz", ")", ";", "data", ".", "position", "(", "data", ".", "limit", "(", ")", ")", ";", "SelectionKey", "dsk", "=", "usc", ".", "register", "(", "selector", ",", "SelectionKey", ".", "OP_READ", ",", "null", ")", ";", "Connection", "conn", "=", "newConnection", "(", "dsk", ")", ";", "conn", ".", "setName", "(", "nm", ")", ";", "dsk", ".", "attach", "(", "conn", ")", ";", "}", "catch", "(", "IOException", "re", ")", "{", "log", ".", "severe", "(", "\"\"", "+", "re", ".", "getMessage", "(", ")", ")", ";", "log", ".", "log", "(", "Level", ".", "FINE", ",", "\"details:", "\"", ",", "re", ")", ";", "}", "}", "protected", "abstract", "PacketConnection", "newConnection", "(", "SelectionKey", "dsk", ")", ";", "private", "void", "doRead", "(", "SelectionKey", "sk", ")", "{", "PacketConnection", "conn", "=", "(", "PacketConnection", ")", "sk", ".", "attachment", "(", ")", ";", "conn", ".", "doRead", "(", ")", ";", "}", "private", "void", "doWrite", "(", "SelectionKey", "sk", ")", "{", "PacketConnection", "conn", "=", "(", "PacketConnection", ")", "sk", ".", "attachment", "(", ")", ";", "conn", ".", "doWrite", "(", ")", ";", "}", "private", "void", "doConnect", "(", "SelectionKey", "sk", ")", "{", "PacketConnection", "conn", "=", "(", "PacketConnection", ")", "sk", ".", "attachment", "(", ")", ";", "conn", ".", "doConnect", "(", ")", ";", "}", "}", "</s>" ]
7,887
[ "<s>", "package", "erjang", ".", "epmd", ";", "import", "java", ".", "nio", ".", "channels", ".", "SelectionKey", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "class", "EPMDServer", "extends", "PacketServer", "{", "private", "static", "int", "epmd_port", ";", "@", "Override", "protected", "PacketConnection", "newConnection", "(", "SelectionKey", "dsk", ")", "{", "return", "new", "EPMDConnection", "(", "epmd_port", ",", "dsk", ")", ";", "}", "static", "public", "void", "main", "(", "String", "[", "]", "args", ")", "{", "epmd_port", "=", "4369", ";", "Level", "level", "=", "Level", ".", "WARNING", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "if", "(", "args", "[", "i", "]", ".", "startsWith", "(", "\"-p\"", ")", ")", "epmd_port", "=", "toInt", "(", "args", "[", "i", "]", ".", "substring", "(", "2", ")", ",", "epmd_port", ")", ";", "if", "(", "args", "[", "i", "]", ".", "startsWith", "(", "\"-d\"", ")", ")", "level", "=", "toLevel", "(", "toInt", "(", "args", "[", "i", "]", ".", "substring", "(", "2", ")", ",", "2", ")", ")", ";", "}", "final", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.epmd\"", ")", ";", "log", ".", "setLevel", "(", "level", ")", ";", "new", "EPMDServer", "(", ")", ".", "listen", "(", "epmd_port", ")", ";", "}", "public", "static", "int", "toInt", "(", "String", "intString", ",", "int", "defaultValue", ")", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "intString", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "defaultValue", ";", "}", "}", "public", "static", "Level", "toLevel", "(", "int", "level", ")", "{", "if", "(", "level", "<=", "0", ")", "{", "return", "Level", ".", "OFF", ";", "}", "switch", "(", "level", ")", "{", "case", "1", ":", "return", "Level", ".", "SEVERE", ";", "case", "2", ":", "return", "Level", ".", "WARNING", ";", "case", "3", ":", "return", "Level", ".", "INFO", ";", "case", "4", ":", "return", "Level", ".", "FINE", ";", "case", "5", ":", "return", "Level", ".", "FINER", ";", "case", "6", ":", "return", "Level", ".", "FINEST", ";", "default", ":", "return", "Level", ".", "FINEST", ";", "}", "}", "}", "</s>" ]
7,888
[ "<s>", "package", "erjang", ".", "epmd", ";", "import", "java", ".", "nio", ".", "ByteBuffer", ";", "import", "java", ".", "nio", ".", "channels", ".", "SelectionKey", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "erjang", ".", "driver", ".", "IO", ";", "public", "class", "EPMDConnection", "extends", "PacketConnection", "{", "static", "final", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.epmd\"", ")", ";", "private", "NodeInfo", "connectedNode", ";", "private", "int", "epmdPort", ";", "static", "final", "byte", "EPMD_ALIVE_REQ", "=", "'a'", ";", "static", "final", "byte", "EPMD_ALIVE_OK_RESP", "=", "'Y'", ";", "static", "final", "byte", "EPMD_PORT_REQ", "=", "'p'", ";", "static", "final", "byte", "EPMD_NAMES_REQ", "=", "'n'", ";", "static", "final", "byte", "EPMD_DUMP_REQ", "=", "'d'", ";", "static", "final", "byte", "EPMD_KILL_REQ", "=", "'k'", ";", "static", "final", "byte", "EPMD_STOP_REQ", "=", "'s'", ";", "static", "final", "int", "ALIVE2_REQ", "=", "'x'", ";", "static", "final", "int", "ALIVE2_RESP", "=", "'y'", ";", "static", "final", "int", "PORT2_REQ", "=", "'z'", ";", "static", "final", "byte", "PORT2_RESP", "=", "'w'", ";", "public", "EPMDConnection", "(", "int", "epmdPort", ",", "SelectionKey", "dsk", ")", "{", "super", "(", "dsk", ")", ";", "this", ".", "epmdPort", "=", "epmdPort", ";", "}", "@", "Override", "protected", "void", "receivePacket", "(", "ByteBuffer", "buf", ")", "{", "int", "op", "=", "buf", ".", "get", "(", ")", ";", "log", ".", "fine", "(", "\"\"", "+", "op", "+", "\"", "from", "\"", "+", "getName", "(", ")", ")", ";", "switch", "(", "op", ")", "{", "case", "ALIVE2_REQ", ":", "{", "int", "eport", "=", "buf", ".", "getShort", "(", ")", "&", "0xffff", ";", "int", "nodetype", "=", "buf", ".", "get", "(", ")", ";", "int", "proto", "=", "buf", ".", "get", "(", ")", ";", "int", "highvsn", "=", "buf", ".", "getShort", "(", ")", "&", "0xffff", ";", "int", "lowvsn", "=", "buf", ".", "getShort", "(", ")", "&", "0xffff", ";", "int", "nlen", "=", "buf", ".", "getShort", "(", ")", "&", "0xffff", ";", "byte", "[", "]", "name", "=", "new", "byte", "[", "nlen", "]", ";", "buf", ".", "get", "(", "name", ")", ";", "int", "elen", "=", "buf", ".", "getShort", "(", ")", "&", "0xffff", ";", "byte", "[", "]", "extra", "=", "new", "byte", "[", "elen", "]", ";", "buf", ".", "get", "(", "extra", ")", ";", "NodeInfo", "node", ";", "if", "(", "(", "node", "=", "node_reg2", "(", "name", ",", "eport", ",", "nodetype", ",", "proto", ",", "highvsn", ",", "lowvsn", ",", "extra", ")", ")", "==", "null", ")", "{", "ByteBuffer", "resp", "=", "ByteBuffer", ".", "allocate", "(", "4", ")", ";", "resp", ".", "put", "(", "(", "byte", ")", "ALIVE2_RESP", ")", ";", "resp", ".", "put", "(", "(", "byte", ")", "1", ")", ";", "resp", ".", "putShort", "(", "(", "short", ")", "99", ")", ";", "this", ".", "sendPacket", "(", "resp", ",", "false", ")", ";", "}", "else", "{", "ByteBuffer", "resp", "=", "ByteBuffer", ".", "allocate", "(", "4", ")", ";", "resp", ".", "put", "(", "(", "byte", ")", "ALIVE2_RESP", ")", ";", "resp", ".", "put", "(", "(", "byte", ")", "0", ")", ";", "resp", ".", "putShort", "(", "node", ".", "creation", ")", ";", "this", ".", "keep", "=", "true", ";", "this", ".", "sendPacket", "(", "resp", ",", "false", ")", ";", "}", "return", ";", "}", "case", "PORT2_REQ", ":", "{", "int", "len", "=", "buf", ".", "remaining", "(", ")", ";", "byte", "[", "]", "data", "=", "new", "byte", "[", "len", "]", ";", "buf", ".", "get", "(", "data", ")", ";", "String", "n", "=", "new", "String", "(", "data", ",", "IO", ".", "ISO_LATIN_1", ")", ";", "NodeInfo", "node", "=", "nodes", ".", "get", "(", "n", ")", ";", "if", "(", "n", "==", "null", ")", "{", "ByteBuffer", "resp", "=", "ByteBuffer", ".", "allocate", "(", "2", ")", ";", "resp", ".", "put", "(", "(", "byte", ")", "PORT2_RESP", ")", ";", "resp", ".", "put", "(", "(", "byte", ")", "1", ")", ";", "sendPacket", "(", "resp", ",", "false", ")", ";", "return", ";", "}", "else", "{", "ByteBuffer", "resp", "=", "ByteBuffer", ".", "allocate", "(", "20", "+", "node", ".", "extra", ".", "length", "+", "node", ".", "nodeName", ".", "length", ")", ";", "resp", ".", "put", "(", "PORT2_RESP", ")", ";", "resp", ".", "put", "(", "(", "byte", ")", "0", ")", ";", "resp", ".", "putShort", "(", "(", "short", ")", "node", ".", "portNo", ")", ";", "resp", ".", "put", "(", "(", "byte", ")", "node", ".", "nodeType", ")", ";", "resp", ".", "put", "(", "(", "byte", ")", "node", ".", "protocol", ")", ";", "resp", ".", "putShort", "(", "(", "short", ")", "node", ".", "highVersion", ")", ";", "resp", ".", "putShort", "(", "(", "short", ")", "node", ".", "lowVersion", ")", ";", "resp", ".", "putShort", "(", "(", "short", ")", "node", ".", "nodeName", ".", "length", ")", ";", "resp", ".", "put", "(", "node", ".", "nodeName", ")", ";", "resp", ".", "putShort", "(", "(", "short", ")", "node", ".", "extra", ".", "length", ")", ";", "resp", ".", "put", "(", "node", ".", "extra", ")", ";", "sendPacket", "(", "resp", ",", "false", ")", ";", "}", "return", ";", "}", "case", "EPMD_NAMES_REQ", ":", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "NodeInfo", "n", ":", "nodes", ".", "values", "(", ")", ")", "{", "sb", ".", "append", "(", "\"name", "\"", ")", ".", "append", "(", "n", ".", "name", ")", ".", "append", "(", "\"", "at", "port", "\"", ")", ".", "append", "(", "n", ".", "portNo", ")", ".", "append", "(", "'\\n'", ")", ";", "}", "ByteBuffer", "resp", "=", "ByteBuffer", ".", "allocate", "(", "4", "+", "sb", ".", "length", "(", ")", ")", ";", "resp", ".", "putInt", "(", "epmdPort", ")", ";", "resp", ".", "put", "(", "sb", ".", "toString", "(", ")", ".", "getBytes", "(", "IO", ".", "ISO_LATIN_1", ")", ")", ";", "sendPacket", "(", "resp", ",", "false", ")", ";", "return", ";", "}", "case", "EPMD_DUMP_REQ", ":", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "NodeInfo", "n", ":", "nodes", ".", "values", "(", ")", ")", "{", "sb", ".", "append", "(", "\"\"", ")", ".", "append", "(", "n", ".", "name", ")", ".", "append", "(", "\">", "at", "port", "\"", ")", ".", "append", "(", "n", ".", "portNo", ")", ".", "append", "(", "\",", "fd", "=", "\"", ")", ".", "append", "(", "n", ".", "fd", ")", ".", "append", "(", "'\\n'", ")", ";", "}", "for", "(", "NodeInfo", "n", ":", "nodes", ".", "values", "(", ")", ")", "{", "sb", ".", "append", "(", "\"\"", ")", ".", "append", "(", "n", ".", "name", ")", ".", "append", "(", "\">", "at", "port", "\"", ")", ".", "append", "(", "n", ".", "portNo", ")", ".", "append", "(", "\",", "fd", "=", "\"", ")", ".", "append", "(", "n", ".", "fd", ")", ".", "append", "(", "'\\n'", ")", ";", "}", "ByteBuffer", "resp", "=", "ByteBuffer", ".", "allocate", "(", "4", "+", "sb", ".", "length", "(", ")", ")", ";", "resp", ".", "putInt", "(", "epmdPort", ")", ";", "resp", ".", "put", "(", "sb", ".", "toString", "(", ")", ".", "getBytes", "(", "IO", ".", "ISO_LATIN_1", ")", ")", ";", "sendPacket", "(", "resp", ",", "false", ")", ";", "return", ";", "}", "case", "EPMD_KILL_REQ", ":", "{", "ByteBuffer", "resp", "=", "ByteBuffer", ".", "allocate", "(", "7", ")", ";", "resp", ".", "put", "(", "\"NOEXIST\"", ".", "getBytes", "(", "IO", ".", "ISO_LATIN_1", ")", ")", ";", "sendPacket", "(", "resp", ",", "false", ")", ";", "return", ";", "}", "default", ":", "log", ".", "warning", "(", "\"\"", "+", "op", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "}", "static", "Map", "<", "String", ",", "NodeInfo", ">", "unreg", "=", "new", "HashMap", "<", "String", ",", "NodeInfo", ">", "(", ")", ";", "static", "Map", "<", "String", ",", "NodeInfo", ">", "nodes", "=", "new", "HashMap", "<", "String", ",", "NodeInfo", ">", "(", ")", ";", "private", "NodeInfo", "node_reg2", "(", "byte", "[", "]", "name", ",", "int", "eport", ",", "int", "nodetype", ",", "int", "proto", ",", "int", "highvsn", ",", "int", "lowvsn", ",", "byte", "[", "]", "extra", ")", "{", "String", "n", "=", "new", "String", "(", "name", ",", "IO", ".", "ISO_LATIN_1", ")", ";", "if", "(", "nodes", ".", "containsKey", "(", "n", ")", ")", "{", "return", "null", ";", "}", "NodeInfo", "node", "=", "unreg", ".", "remove", "(", "n", ")", ";", "if", "(", "node", "==", "null", ")", "{", "node", "=", "new", "NodeInfo", "(", ")", ";", "node", ".", "creation", "=", "(", "short", ")", "(", "(", "System", ".", "currentTimeMillis", "(", ")", "%", "3", ")", "+", "1", ")", ";", "}", "else", "{", "node", ".", "creation", "=", "(", "short", ")", "(", "(", "node", ".", "creation", "%", "3", ")", "+", "1", ")", ";", "}", "node", ".", "name", "=", "n", ";", "node", ".", "portNo", "=", "eport", ";", "node", ".", "nodeType", "=", "nodetype", ";", "node", ".", "protocol", "=", "proto", ";", "node", ".", "highVersion", "=", "highvsn", ";", "node", ".", "lowVersion", "=", "lowvsn", ";", "node", ".", "extra", "=", "extra", ";", "node", ".", "fd", "=", "0", ";", "nodes", ".", "put", "(", "n", ",", "node", ")", ";", "this", ".", "connectedNode", "=", "node", ";", "return", "node", ";", "}", "@", "Override", "protected", "void", "connectionClosed", "(", ")", "{", "NodeInfo", "node", "=", "this", ".", "connectedNode", ";", "this", ".", "connectedNode", "=", "null", ";", "if", "(", "node", "!=", "null", ")", "{", "nodes", ".", "remove", "(", "node", ".", "name", ")", ";", "unreg", ".", "put", "(", "node", ".", "name", ",", "node", ")", ";", "}", "}", "}", "</s>" ]
7,889
[ "<s>", "package", "erjang", ".", "epmd", ";", "class", "NodeInfo", "{", "public", "int", "portNo", ";", "public", "int", "nodeType", ";", "public", "int", "protocol", ";", "public", "int", "highVersion", ";", "public", "int", "lowVersion", ";", "public", "byte", "[", "]", "nodeName", ";", "public", "byte", "[", "]", "extra", ";", "public", "short", "creation", ";", "public", "String", "name", ";", "public", "int", "fd", ";", "}", "</s>" ]
7,890
[ "<s>", "package", "erjang", ".", "epmd", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "net", ".", "Socket", ";", "import", "java", ".", "nio", ".", "ByteBuffer", ";", "import", "java", ".", "nio", ".", "channels", ".", "GatheringByteChannel", ";", "import", "java", ".", "nio", ".", "channels", ".", "SelectionKey", ";", "import", "java", ".", "nio", ".", "channels", ".", "SocketChannel", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "abstract", "class", "PacketConnection", "implements", "Connection", "{", "static", "final", "Logger", "log", "=", "Logger", ".", "getLogger", "(", "\"erjang.epmd\"", ")", ";", "protected", "SelectionKey", "sk", ";", "private", "int", "state", ";", "private", "ByteBuffer", "recvBuffer", "=", "null", ";", "private", "String", "name", "=", "\"\"", ";", "ArrayList", "<", "ByteBuffer", ">", "outbuf", "=", "new", "ArrayList", "<", "ByteBuffer", ">", "(", ")", ";", "protected", "void", "receivePacket", "(", "ByteBuffer", "buf", ")", "{", "}", "protected", "void", "connectionClosed", "(", ")", "{", "}", "void", "sendPacket", "(", "ByteBuffer", "buf", ",", "boolean", "includeSize", ")", "{", "if", "(", "includeSize", ")", "{", "ByteBuffer", "size", "=", "ByteBuffer", ".", "allocate", "(", "2", ")", ";", "size", ".", "putShort", "(", "0", ",", "(", "short", ")", "buf", ".", "position", "(", ")", ")", ";", "outbuf", ".", "add", "(", "size", ")", ";", "}", "buf", ".", "flip", "(", ")", ";", "outbuf", ".", "add", "(", "buf", ")", ";", "sk", ".", "interestOps", "(", "SelectionKey", ".", "OP_WRITE", "|", "sk", ".", "interestOps", "(", ")", ")", ";", "}", "PacketConnection", "(", "SelectionKey", "sk", ")", "{", "SocketChannel", "sch", "=", "(", "SocketChannel", ")", "sk", ".", "channel", "(", ")", ";", "if", "(", "sch", ".", "isConnected", "(", ")", ")", "{", "sk", ".", "interestOps", "(", "SelectionKey", ".", "OP_READ", ")", ";", "state", "=", "Connection", ".", "OPEN", ";", "}", "else", "if", "(", "sch", ".", "isConnectionPending", "(", ")", ")", "{", "sk", ".", "interestOps", "(", "SelectionKey", ".", "OP_CONNECT", ")", ";", "state", "=", "Connection", ".", "OPENING", ";", "}", "this", ".", "sk", "=", "sk", ";", "sk", ".", "attach", "(", "this", ")", ";", "recvBuffer", "=", "ByteBuffer", ".", "allocate", "(", "8196", ")", ";", "}", "public", "void", "doConnect", "(", ")", "{", "SocketChannel", "sc", "=", "(", "SocketChannel", ")", "sk", ".", "channel", "(", ")", ";", "try", "{", "sc", ".", "finishConnect", "(", ")", ";", "sk", ".", "interestOps", "(", "sk", ".", "interestOps", "(", ")", "&", "~", "SelectionKey", ".", "OP_CONNECT", ")", ";", "log", ".", "fine", "(", "\"\"", ")", ";", "state", "=", "Connection", ".", "OPEN", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "closeComplete", "(", ")", ";", "}", "}", "ByteBuffer", "rcvBuf", ";", "protected", "boolean", "keep", ";", "public", "void", "doRead", "(", ")", "{", "SocketChannel", "sc", "=", "(", "SocketChannel", ")", "sk", ".", "channel", "(", ")", ";", "if", "(", "sc", ".", "isOpen", "(", ")", ")", "{", "int", "len", ";", "recvBuffer", ".", "clear", "(", ")", ";", "try", "{", "len", "=", "sc", ".", "read", "(", "recvBuffer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "len", "=", "-", "1", ";", "}", "log", ".", "finer", "(", "\"read", "len=\"", "+", "len", ")", ";", "if", "(", "len", "==", "-", "1", ")", "{", "close", "(", ")", ";", "return", ";", "}", "int", "start", "=", "0", ";", "while", "(", "recvBuffer", ".", "position", "(", ")", ">", "start", "+", "2", ")", "{", "int", "pklen", "=", "recvBuffer", ".", "getShort", "(", "start", ")", "&", "0xffff", ";", "if", "(", "recvBuffer", ".", "position", "(", ")", ">=", "start", "+", "2", "+", "pklen", ")", "{", "ByteBuffer", "buf", "=", "slice", "(", "recvBuffer", ",", "start", "+", "2", ",", "pklen", ")", ";", "receivePacket", "(", "buf", ")", ";", "if", "(", "!", "this", ".", "keep", "&&", "outbuf", ".", "isEmpty", "(", ")", ")", "{", "close", "(", ")", ";", "return", ";", "}", "start", "+=", "2", "+", "pklen", ";", "}", "else", "if", "(", "recvBuffer", ".", "position", "(", ")", "==", "recvBuffer", ".", "limit", "(", ")", ")", "{", "int", "available", "=", "recvBuffer", ".", "position", "(", ")", "-", "start", ";", "byte", "[", "]", "data", "=", "new", "byte", "[", "pklen", "+", "2", "]", ";", "recvBuffer", ".", "position", "(", "start", ")", ";", "recvBuffer", ".", "get", "(", "data", ",", "0", ",", "available", ")", ";", "recvBuffer", "=", "ByteBuffer", ".", "wrap", "(", "data", ")", ";", "return", ";", "}", "}", "if", "(", "start", ">", "0", "&&", "recvBuffer", ".", "position", "(", ")", ">", "0", ")", "{", "if", "(", "recvBuffer", ".", "position", "(", ")", "==", "start", ")", "{", "recvBuffer", ".", "clear", "(", ")", ";", "}", "else", "{", "int", "left", "=", "recvBuffer", ".", "position", "(", ")", "-", "start", ";", "byte", "[", "]", "data", "=", "new", "byte", "[", "left", "]", ";", "recvBuffer", ".", "position", "(", "start", ")", ";", "recvBuffer", ".", "get", "(", "data", ")", ";", "recvBuffer", ".", "clear", "(", ")", ";", "recvBuffer", ".", "put", "(", "data", ")", ";", "}", "}", "}", "else", "{", "close", "(", ")", ";", "}", "}", "private", "ByteBuffer", "slice", "(", "ByteBuffer", "buf", ",", "int", "start", ",", "int", "len", ")", "{", "int", "savePos", "=", "buf", ".", "position", "(", ")", ";", "int", "saveLim", "=", "buf", ".", "limit", "(", ")", ";", "buf", ".", "position", "(", "start", ")", ";", "buf", ".", "limit", "(", "start", "+", "len", ")", ";", "ByteBuffer", "res", "=", "buf", ".", "slice", "(", ")", ";", "buf", ".", "position", "(", "savePos", ")", ";", "buf", ".", "limit", "(", "saveLim", ")", ";", "return", "res", ";", "}", "public", "void", "doWrite", "(", ")", "{", "log", ".", "finer", "(", "\"write", "ready\"", ")", ";", "if", "(", "!", "outbuf", ".", "isEmpty", "(", ")", ")", "{", "GatheringByteChannel", "bc", "=", "(", "GatheringByteChannel", ")", "sk", ".", "channel", "(", ")", ";", "ByteBuffer", "[", "]", "out", "=", "outbuf", ".", "toArray", "(", "new", "ByteBuffer", "[", "outbuf", ".", "size", "(", ")", "]", ")", ";", "try", "{", "bc", ".", "write", "(", "out", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "out", ".", "length", "&&", "!", "out", "[", "i", "]", ".", "hasRemaining", "(", ")", ";", "i", "++", ")", "{", "outbuf", ".", "remove", "(", "0", ")", ";", "}", "}", "if", "(", "outbuf", ".", "isEmpty", "(", ")", ")", "{", "sk", ".", "interestOps", "(", "sk", ".", "interestOps", "(", ")", "&", "~", "SelectionKey", ".", "OP_WRITE", ")", ";", "}", "if", "(", "!", "this", ".", "keep", "&&", "outbuf", ".", "isEmpty", "(", ")", ")", "{", "close", "(", ")", ";", "}", "}", "public", "void", "close", "(", ")", "{", "if", "(", "state", "!=", "Connection", ".", "CLOSED", ")", "{", "SocketChannel", "sc", "=", "(", "SocketChannel", ")", "sk", ".", "channel", "(", ")", ";", "if", "(", "sc", ".", "isOpen", "(", ")", ")", "{", "if", "(", "state", "==", "Connection", ".", "OPEN", ")", "{", "log", ".", "fine", "(", "\"\"", ")", ";", "state", "=", "Connection", ".", "CLOSING", ";", "Socket", "sock", "=", "sc", ".", "socket", "(", ")", ";", "try", "{", "sock", ".", "shutdownOutput", "(", ")", ";", "}", "catch", "(", "IOException", "se", ")", "{", "log", ".", "severe", "(", "\"\"", "+", "se", ".", "getMessage", "(", ")", ")", ";", "log", ".", "log", "(", "Level", ".", "FINE", ",", "\"details:", "\"", ",", "se", ")", ";", "}", "}", "else", "closeComplete", "(", ")", ";", "}", "else", "log", ".", "warning", "(", "\"\"", ")", ";", "}", "}", "private", "void", "closeComplete", "(", ")", "{", "log", ".", "fine", "(", "\"\"", ")", ";", "try", "{", "sk", ".", "interestOps", "(", "0", ")", ";", "SocketChannel", "sc", "=", "(", "SocketChannel", ")", "sk", ".", "channel", "(", ")", ";", "if", "(", "sc", "!=", "null", "&&", "sc", ".", "isOpen", "(", ")", ")", "sc", ".", "close", "(", ")", ";", "sk", ".", "selector", "(", ")", ".", "wakeup", "(", ")", ";", "sk", ".", "attach", "(", "null", ")", ";", "}", "catch", "(", "IOException", "ce", ")", "{", "log", ".", "severe", "(", "\"\"", "+", "ce", ".", "getMessage", "(", ")", ")", ";", "log", ".", "log", "(", "Level", ".", "FINE", ",", "\"details:", "\"", ",", "ce", ")", ";", "}", "state", "=", "Connection", ".", "CLOSED", ";", "connectionClosed", "(", ")", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "name", ";", "}", "public", "void", "setName", "(", "String", "nm", ")", "{", "name", "=", "nm", ";", "}", "public", "int", "getState", "(", ")", "{", "return", "state", ";", "}", "}", "</s>" ]
7,891
[ "<s>", "package", "erjang", ";", "import", "java", ".", "io", ".", "ByteArrayInputStream", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "EOFException", ";", "import", "java", ".", "math", ".", "BigDecimal", ";", "import", "java", ".", "math", ".", "BigInteger", ";", "import", "java", ".", "security", ".", "MessageDigest", ";", "import", "erjang", ".", "driver", ".", "IO", ";", "public", "class", "EInputStream", "extends", "ByteArrayInputStream", "{", "public", "static", "int", "DECODE_INT_LISTS_AS_STRINGS", "=", "1", ";", "private", "final", "int", "flags", ";", "private", "EAtom", "[", "]", "atom_cache_refs", ";", "public", "EInputStream", "(", "final", "byte", "[", "]", "buf", ")", "{", "this", "(", "buf", ",", "0", ")", ";", "}", "public", "EInputStream", "(", "final", "byte", "[", "]", "buf", ",", "final", "int", "flags", ")", "{", "super", "(", "buf", ")", ";", "this", ".", "flags", "=", "flags", ";", "}", "public", "EInputStream", "(", "final", "byte", "[", "]", "buf", ",", "final", "int", "offset", ",", "final", "int", "length", ",", "final", "int", "flags", ")", "{", "super", "(", "buf", ",", "offset", ",", "length", ")", ";", "this", ".", "flags", "=", "flags", ";", "}", "public", "void", "updateMessageDigest", "(", "MessageDigest", "digest", ",", "int", "offset", ",", "int", "len", ")", "{", "digest", ".", "update", "(", "this", ".", "buf", ",", "offset", ",", "len", ")", ";", "}", "public", "int", "getPos", "(", ")", "{", "return", "super", ".", "pos", ";", "}", "public", "int", "setPos", "(", "int", "pos", ")", "{", "final", "int", "oldpos", "=", "super", ".", "pos", ";", "if", "(", "pos", ">", "super", ".", "count", ")", "{", "pos", "=", "super", ".", "count", ";", "}", "else", "if", "(", "pos", "<", "0", ")", "{", "pos", "=", "0", ";", "}", "super", ".", "pos", "=", "pos", ";", "return", "oldpos", ";", "}", "public", "int", "readN", "(", "final", "byte", "[", "]", "buf", ")", "throws", "IOException", "{", "return", "this", ".", "readN", "(", "buf", ",", "0", ",", "buf", ".", "length", ")", ";", "}", "public", "int", "readN", "(", "final", "byte", "[", "]", "buf", ",", "final", "int", "off", ",", "final", "int", "len", ")", "throws", "IOException", "{", "if", "(", "len", "==", "0", "&&", "available", "(", ")", "==", "0", ")", "{", "return", "0", ";", "}", "final", "int", "i", "=", "super", ".", "read", "(", "buf", ",", "off", ",", "len", ")", ";", "if", "(", "i", "<", "0", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "return", "i", ";", "}", "public", "int", "peek", "(", ")", "throws", "IOException", "{", "return", "peek1", "(", ")", ";", "}", "public", "int", "peek1", "(", ")", "throws", "IOException", "{", "int", "i", ";", "try", "{", "i", "=", "super", ".", "buf", "[", "super", ".", "pos", "]", ";", "if", "(", "i", "<", "0", ")", "{", "i", "+=", "256", ";", "}", "return", "i", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "}", "public", "int", "peek1skip_version", "(", ")", "throws", "IOException", "{", "int", "i", "=", "peek1", "(", ")", ";", "if", "(", "i", "==", "EExternal", ".", "versionTag", ")", "{", "read1", "(", ")", ";", "i", "=", "peek1", "(", ")", ";", "}", "return", "i", ";", "}", "public", "int", "read1", "(", ")", "throws", "IOException", "{", "int", "i", ";", "i", "=", "super", ".", "read", "(", ")", ";", "if", "(", "i", "<", "0", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "return", "i", ";", "}", "public", "int", "read1skip_version", "(", ")", "throws", "IOException", "{", "int", "tag", "=", "read1", "(", ")", ";", "if", "(", "tag", "==", "EExternal", ".", "versionTag", ")", "{", "tag", "=", "read1", "(", ")", ";", "}", "return", "tag", ";", "}", "public", "void", "readFully", "(", "byte", "[", "]", "b", ")", "throws", "IOException", "{", "int", "pos", "=", "0", ";", "while", "(", "pos", "<", "b", ".", "length", ")", "{", "int", "read", ";", "try", "{", "read", "=", "super", ".", "read", "(", "b", ",", "pos", ",", "b", ".", "length", "-", "pos", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "ioobe", ")", "{", "read", "=", "0", ";", "}", "if", "(", "read", "==", "0", ")", "throw", "new", "EOFException", "(", "\"\"", ")", ";", "pos", "+=", "read", ";", "}", "}", "public", "int", "read2BE", "(", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "b", "=", "new", "byte", "[", "2", "]", ";", "readFully", "(", "b", ")", ";", "return", "(", "b", "[", "0", "]", "<<", "8", "&", "0xff00", ")", "+", "(", "b", "[", "1", "]", "&", "0xff", ")", ";", "}", "public", "int", "read4BE", "(", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "b", "=", "new", "byte", "[", "4", "]", ";", "readFully", "(", "b", ")", ";", "return", "(", "b", "[", "0", "]", "<<", "24", "&", "0xff000000", ")", "+", "(", "b", "[", "1", "]", "<<", "16", "&", "0xff0000", ")", "+", "(", "b", "[", "2", "]", "<<", "8", "&", "0xff00", ")", "+", "(", "b", "[", "3", "]", "&", "0xff", ")", ";", "}", "public", "int", "read2LE", "(", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "b", "=", "new", "byte", "[", "2", "]", ";", "readFully", "(", "b", ")", ";", "return", "(", "b", "[", "1", "]", "<<", "8", "&", "0xff00", ")", "+", "(", "b", "[", "0", "]", "&", "0xff", ")", ";", "}", "public", "int", "read4LE", "(", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "b", "=", "new", "byte", "[", "4", "]", ";", "readFully", "(", "b", ")", ";", "return", "(", "b", "[", "3", "]", "<<", "24", "&", "0xff000000", ")", "+", "(", "b", "[", "2", "]", "<<", "16", "&", "0xff0000", ")", "+", "(", "b", "[", "1", "]", "<<", "8", "&", "0xff00", ")", "+", "(", "b", "[", "0", "]", "&", "0xff", ")", ";", "}", "public", "long", "readLE", "(", "int", "n", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "b", "=", "new", "byte", "[", "n", "]", ";", "try", "{", "super", ".", "read", "(", "b", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", ";", "long", "v", "=", "0", ";", "while", "(", "n", "--", ">", "0", ")", "{", "v", "=", "v", "<<", "8", "|", "(", "long", ")", "b", "[", "n", "]", "&", "0xff", ";", "}", "return", "v", ";", "}", "public", "long", "readBE", "(", "final", "int", "n", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "b", "=", "new", "byte", "[", "n", "]", ";", "try", "{", "super", ".", "read", "(", "b", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", ";", "long", "v", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "v", "=", "v", "<<", "8", "|", "(", "long", ")", "b", "[", "i", "]", "&", "0xff", ";", "}", "return", "v", ";", "}", "public", "boolean", "read_boolean", "(", ")", "throws", "IOException", "{", "return", "read_atom", "(", ")", "==", "ERT", ".", "TRUE", ";", "}", "public", "EAtom", "read_atom", "(", ")", "throws", "IOException", "{", "int", "tag", ";", "int", "len", ";", "byte", "[", "]", "strbuf", ";", "String", "atom", ";", "tag", "=", "read1skip_version", "(", ")", ";", "if", "(", "tag", "==", "EExternal", ".", "atomCacheRef", ")", "{", "int", "index", "=", "read1", "(", ")", "&", "0xff", ";", "EAtom", "res", "=", "atom_cache_refs", "[", "index", "]", ";", "if", "(", "res", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "index", ")", ";", "}", "return", "res", ";", "}", "if", "(", "tag", "==", "EExternal", ".", "smallAtomTag", ")", "{", "len", "=", "read1", "(", ")", ";", "}", "else", "{", "if", "(", "tag", "!=", "EExternal", ".", "atomTag", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "EExternal", ".", "atomTag", "+", "\",", "got", "\"", "+", "tag", ")", ";", "}", "len", "=", "read2BE", "(", ")", ";", "}", "strbuf", "=", "new", "byte", "[", "len", "]", ";", "this", ".", "readN", "(", "strbuf", ")", ";", "char", "[", "]", "in", "=", "new", "char", "[", "len", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "in", "[", "i", "]", "=", "(", "char", ")", "(", "strbuf", "[", "i", "]", "&", "0xff", ")", ";", "}", "atom", "=", "new", "String", "(", "in", ")", ";", "if", "(", "atom", ".", "length", "(", ")", ">", "EExternal", ".", "maxAtomLength", ")", "{", "atom", "=", "atom", ".", "substring", "(", "0", ",", "EExternal", ".", "maxAtomLength", ")", ";", "}", "return", "EAtom", ".", "intern", "(", "atom", ")", ";", "}", "public", "byte", "[", "]", "read_binary", "(", ")", "throws", "IOException", "{", "int", "tag", ";", "int", "len", ";", "byte", "[", "]", "bin", ";", "tag", "=", "read1skip_version", "(", ")", ";", "if", "(", "tag", "!=", "EExternal", ".", "binTag", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "EExternal", ".", "binTag", "+", "\",", "got", "\"", "+", "tag", ")", ";", "}", "len", "=", "read4BE", "(", ")", ";", "bin", "=", "new", "byte", "[", "len", "]", ";", "this", ".", "readN", "(", "bin", ")", ";", "return", "bin", ";", "}", "public", "byte", "[", "]", "read_bitstr", "(", "final", "int", "pad_bits", "[", "]", ")", "throws", "IOException", "{", "int", "tag", ";", "int", "len", ";", "byte", "[", "]", "bin", ";", "tag", "=", "read1skip_version", "(", ")", ";", "if", "(", "tag", "!=", "EExternal", ".", "bitBinTag", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "EExternal", ".", "bitBinTag", "+", "\",", "got", "\"", "+", "tag", ")", ";", "}", "len", "=", "read4BE", "(", ")", ";", "bin", "=", "new", "byte", "[", "len", "]", ";", "final", "int", "tail_bits", "=", "read1", "(", ")", ";", "if", "(", "tail_bits", "<", "0", "||", "7", "<", "tail_bits", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "tail_bits", ")", ";", "}", "if", "(", "len", "==", "0", "&&", "tail_bits", "!=", "0", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "tail_bits", ")", ";", "}", "this", ".", "readN", "(", "bin", ")", ";", "pad_bits", "[", "0", "]", "=", "8", "-", "tail_bits", ";", "return", "bin", ";", "}", "public", "float", "read_float", "(", ")", "throws", "IOException", "{", "final", "double", "d", "=", "read_double", "(", ")", ";", "return", "(", "float", ")", "d", ";", "}", "public", "double", "read_double", "(", ")", "throws", "IOException", "{", "int", "tag", ";", "tag", "=", "read1skip_version", "(", ")", ";", "switch", "(", "tag", ")", "{", "case", "EExternal", ".", "newFloatTag", ":", "{", "return", "Double", ".", "longBitsToDouble", "(", "readBE", "(", "8", ")", ")", ";", "}", "case", "EExternal", ".", "floatTag", ":", "{", "BigDecimal", "val", ";", "int", "epos", ";", "int", "exp", ";", "final", "byte", "[", "]", "strbuf", "=", "new", "byte", "[", "31", "]", ";", "String", "str", ";", "this", ".", "readN", "(", "strbuf", ")", ";", "str", "=", "new", "String", "(", "strbuf", ",", "IO", ".", "ISO_LATIN_1", ")", ";", "epos", "=", "str", ".", "indexOf", "(", "'e'", ",", "0", ")", ";", "if", "(", "epos", "<", "0", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "str", "+", "\"'\"", ")", ";", "}", "String", "estr", "=", "str", ".", "substring", "(", "epos", "+", "1", ")", ".", "trim", "(", ")", ";", "if", "(", "estr", ".", "substring", "(", "0", ",", "1", ")", ".", "equals", "(", "\"+\"", ")", ")", "{", "estr", "=", "estr", ".", "substring", "(", "1", ")", ";", "}", "exp", "=", "Integer", ".", "valueOf", "(", "estr", ")", ".", "intValue", "(", ")", ";", "val", "=", "new", "BigDecimal", "(", "str", ".", "substring", "(", "0", ",", "epos", ")", ")", ".", "movePointRight", "(", "exp", ")", ";", "return", "val", ".", "doubleValue", "(", ")", ";", "}", "default", ":", "throw", "new", "IOException", "(", "\"\"", "+", "EExternal", ".", "newFloatTag", "+", "\",", "got", "\"", "+", "tag", ")", ";", "}", "}", "public", "byte", "read_byte", "(", ")", "throws", "IOException", "{", "final", "long", "l", "=", "this", ".", "read_long", "(", "false", ")", ";", "final", "byte", "i", "=", "(", "byte", ")", "l", ";", "if", "(", "l", "!=", "i", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "l", ")", ";", "}", "return", "i", ";", "}", "public", "char", "read_char", "(", ")", "throws", "IOException", "{", "final", "long", "l", "=", "this", ".", "read_long", "(", "true", ")", ";", "final", "char", "i", "=", "(", "char", ")", "l", ";", "if", "(", "l", "!=", "(", "i", "&", "0xffffL", ")", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "l", ")", ";", "}", "return", "i", ";", "}", "public", "int", "read_uint", "(", ")", "throws", "IOException", "{", "final", "long", "l", "=", "this", ".", "read_long", "(", "true", ")", ";", "final", "int", "i", "=", "(", "int", ")", "l", ";", "if", "(", "l", "!=", "(", "i", "&", "0xFFFFffffL", ")", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "l", ")", ";", "}", "return", "i", ";", "}", "public", "int", "read_int", "(", ")", "throws", "IOException", "{", "final", "long", "l", "=", "this", ".", "read_long", "(", "false", ")", ";", "final", "int", "i", "=", "(", "int", ")", "l", ";", "if", "(", "l", "!=", "i", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "l", ")", ";", "}", "return", "i", ";", "}", "public", "short", "read_ushort", "(", ")", "throws", "IOException", "{", "final", "long", "l", "=", "this", ".", "read_long", "(", "true", ")", ";", "final", "short", "i", "=", "(", "short", ")", "l", ";", "if", "(", "l", "!=", "(", "i", "&", "0xffffL", ")", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "l", ")", ";", "}", "return", "i", ";", "}", "public", "short", "read_short", "(", ")", "throws", "IOException", "{", "final", "long", "l", "=", "this", ".", "read_long", "(", "false", ")", ";", "final", "short", "i", "=", "(", "short", ")", "l", ";", "if", "(", "l", "!=", "i", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "l", ")", ";", "}", "return", "i", ";", "}", "public", "long", "read_ulong", "(", ")", "throws", "IOException", "{", "return", "this", ".", "read_long", "(", "true", ")", ";", "}", "public", "long", "read_long", "(", ")", "throws", "IOException", "{", "return", "this", ".", "read_long", "(", "false", ")", ";", "}", "public", "long", "read_long", "(", "final", "boolean", "unsigned", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "b", "=", "read_integer_byte_array", "(", ")", ";", "return", "EInputStream", ".", "byte_array_to_long", "(", "b", ",", "unsigned", ")", ";", "}", "public", "EInteger", "read_tagged_integer", "(", ")", "throws", "IOException", "{", "int", "tag", "=", "read1skip_version", "(", ")", ";", "switch", "(", "tag", ")", "{", "case", "EExternal", ".", "smallIntTag", ":", "return", "new", "ESmall", "(", "read1", "(", ")", ")", ";", "case", "EExternal", ".", "intTag", ":", "return", "new", "ESmall", "(", "read4BE", "(", ")", ")", ";", "default", ":", "setPos", "(", "getPos", "(", ")", "-", "1", ")", ";", "return", "ERT", ".", "box", "(", "new", "BigInteger", "(", "read_integer_byte_array", "(", ")", ")", ")", ";", "}", "}", "public", "byte", "[", "]", "read_integer_byte_array", "(", ")", "throws", "IOException", "{", "int", "tag", ";", "byte", "[", "]", "nb", ";", "tag", "=", "read1skip_version", "(", ")", ";", "switch", "(", "tag", ")", "{", "case", "EExternal", ".", "smallIntTag", ":", "nb", "=", "new", "byte", "[", "2", "]", ";", "nb", "[", "0", "]", "=", "0", ";", "nb", "[", "1", "]", "=", "(", "byte", ")", "read1", "(", ")", ";", "break", ";", "case", "EExternal", ".", "intTag", ":", "nb", "=", "new", "byte", "[", "4", "]", ";", "if", "(", "this", ".", "readN", "(", "nb", ")", "!=", "4", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "break", ";", "case", "EExternal", ".", "smallBigTag", ":", "case", "EExternal", ".", "largeBigTag", ":", "int", "arity", ";", "int", "sign", ";", "if", "(", "tag", "==", "EExternal", ".", "smallBigTag", ")", "{", "arity", "=", "read1", "(", ")", ";", "sign", "=", "read1", "(", ")", ";", "}", "else", "{", "arity", "=", "read4BE", "(", ")", ";", "sign", "=", "read1", "(", ")", ";", "if", "(", "arity", "+", "1", "<", "0", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "arity", "+", "\"", "sign", "\"", "+", "sign", ")", ";", "}", "}", "nb", "=", "new", "byte", "[", "arity", "+", "1", "]", ";", "if", "(", "this", ".", "readN", "(", "nb", ",", "0", ",", "arity", ")", "!=", "arity", ")", "{", "throw", "new", "IOException", "(", "\"\"", ")", ";", "}", "for", "(", "int", "i", "=", "0", ",", "j", "=", "nb", ".", "length", ";", "i", "<", "j", "--", ";", "i", "++", ")", "{", "final", "byte", "b", "=", "nb", "[", "i", "]", ";", "nb", "[", "i", "]", "=", "nb", "[", "j", "]", ";", "nb", "[", "j", "]", "=", "b", ";", "}", "if", "(", "sign", "!=", "0", ")", "{", "int", "c", "=", "1", ";", "for", "(", "int", "j", "=", "nb", ".", "length", ";", "j", "--", ">", "0", ";", ")", "{", "c", "=", "(", "~", "nb", "[", "j", "]", "&", "0xFF", ")", "+", "c", ";", "nb", "[", "j", "]", "=", "(", "byte", ")", "c", ";", "c", ">>=", "8", ";", "}", "}", "break", ";", "default", ":", "throw", "new", "IOException", "(", "\"\"", "+", "tag", ")", ";", "}", "return", "nb", ";", "}", "public", "static", "long", "byte_array_to_long", "(", "final", "byte", "[", "]", "b", ",", "final", "boolean", "unsigned", ")", "throws", "IOException", "{", "long", "v", ";", "switch", "(", "b", ".", "length", ")", "{", "case", "0", ":", "v", "=", "0", ";", "break", ";", "case", "2", ":", "v", "=", "(", "(", "b", "[", "0", "]", "&", "0xFF", ")", "<<", "8", ")", "+", "(", "b", "[", "1", "]", "&", "0xFF", ")", ";", "v", "=", "(", "short", ")", "v", ";", "if", "(", "v", "<", "0", "&&", "unsigned", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "v", ")", ";", "}", "break", ";", "case", "4", ":", "v", "=", "(", "(", "b", "[", "0", "]", "&", "0xFF", ")", "<<", "24", ")", "+", "(", "(", "b", "[", "1", "]", "&", "0xFF", ")", "<<", "16", ")", "+", "(", "(", "b", "[", "2", "]", "&", "0xFF", ")", "<<", "8", ")", "+", "(", "b", "[", "3", "]", "&", "0xFF", ")", ";", "v", "=", "(", "int", ")", "v", ";", "if", "(", "v", "<", "0", "&&", "unsigned", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "v", ")", ";", "}", "break", ";", "default", ":", "int", "i", "=", "0", ";", "final", "byte", "c", "=", "b", "[", "i", "]", ";", "if", "(", "unsigned", ")", "{", "if", "(", "c", "<", "0", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "b", ")", ";", "}", "while", "(", "b", "[", "i", "]", "==", "0", ")", "{", "i", "++", ";", "}", "}", "else", "{", "if", "(", "c", "==", "0", "||", "c", "==", "-", "1", ")", "{", "i", "=", "1", ";", "while", "(", "i", "<", "b", ".", "length", "&&", "b", "[", "i", "]", "==", "c", ")", "{", "i", "++", ";", "}", "if", "(", "i", "<", "b", ".", "length", ")", "{", "if", "(", "(", "(", "c", "^", "b", "[", "i", "]", ")", "&", "0x80", ")", "!=", "0", ")", "{", "i", "--", ";", "}", "}", "}", "}", "if", "(", "b", ".", "length", "-", "i", ">", "8", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "b", ")", ";", "}", "for", "(", "v", "=", "c", "<", "0", "?", "-", "1", ":", "0", ";", "i", "<", "b", ".", "length", ";", "i", "++", ")", "{", "v", "=", "v", "<<", "8", "|", "b", "[", "i", "]", "&", "0xFF", ";", "}", "}", "return", "v", ";", "}", "public", "int", "read_list_head", "(", ")", "throws", "IOException", "{", "int", "arity", "=", "0", ";", "final", "int", "tag", "=", "read1skip_version", "(", ")", ";", "switch", "(", "tag", ")", "{", "case", "EExternal", ".", "nilTag", ":", "arity", "=", "0", ";", "break", ";", "case", "EExternal", ".", "stringTag", ":", "arity", "=", "read2BE", "(", ")", ";", "break", ";", "case", "EExternal", ".", "listTag", ":", "arity", "=", "read4BE", "(", ")", ";", "break", ";", "default", ":", "throw", "new", "IOException", "(", "\"\"", "+", "tag", ")", ";", "}", "return", "arity", ";", "}", "public", "int", "read_tuple_head", "(", ")", "throws", "IOException", "{", "int", "arity", "=", "0", ";", "final", "int", "tag", "=", "read1skip_version", "(", ")", ";", "switch", "(", "tag", ")", "{", "case", "EExternal", ".", "smallTupleTag", ":", "arity", "=", "read1", "(", ")", ";", "break", ";", "case", "EExternal", ".", "largeTupleTag", ":", "arity", "=", "read4BE", "(", ")", ";", "break", ";", "default", ":", "throw", "new", "IOException", "(", "\"\"", "+", "tag", ")", ";", "}", "return", "arity", ";", "}", "public", "int", "read_nil", "(", ")", "throws", "IOException", "{", "int", "arity", "=", "0", ";", "final", "int", "tag", "=", "read1skip_version", "(", ")", ";", "switch", "(", "tag", ")", "{", "case", "EExternal", ".", "nilTag", ":", "arity", "=", "0", ";", "break", ";", "default", ":", "throw", "new", "IOException", "(", "\"\"", "+", "tag", ")", ";", "}", "return", "arity", ";", "}", "public", "EPID", "read_pid", "(", ")", "throws", "IOException", "{", "EAtom", "node", ";", "int", "id", ";", "int", "serial", ";", "int", "creation", ";", "int", "tag", ";", "tag", "=", "read1skip_version", "(", ")", ";", "if", "(", "tag", "!=", "EExternal", ".", "pidTag", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "EExternal", ".", "pidTag", "+", "\",", "got", "\"", "+", "tag", ")", ";", "}", "node", "=", "read_atom", "(", ")", ";", "id", "=", "read4BE", "(", ")", "&", "0x7fff", ";", "serial", "=", "read4BE", "(", ")", "&", "0x1fff", ";", "creation", "=", "read1", "(", ")", "&", "0x03", ";", "return", "EPID", ".", "make", "(", "node", ",", "id", ",", "serial", ",", "creation", ")", ";", "}", "public", "EPort", "read_port", "(", ")", "throws", "IOException", "{", "EAtom", "node", ";", "int", "id", ";", "int", "creation", ";", "int", "tag", ";", "tag", "=", "read1skip_version", "(", ")", ";", "if", "(", "tag", "!=", "EExternal", ".", "portTag", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "EExternal", ".", "portTag", "+", "\",", "got", "\"", "+", "tag", ")", ";", "}", "node", "=", "read_atom", "(", ")", ";", "id", "=", "read4BE", "(", ")", "&", "0xfffffff", ";", "creation", "=", "read1", "(", ")", "&", "0x03", ";", "return", "EPort", ".", "make", "(", "node", ",", "id", ",", "creation", ")", ";", "}", "public", "ERef", "read_ref", "(", ")", "throws", "IOException", "{", "EAtom", "node", ";", "int", "id", ";", "int", "creation", ";", "int", "tag", ";", "tag", "=", "read1skip_version", "(", ")", ";", "switch", "(", "tag", ")", "{", "case", "EExternal", ".", "refTag", ":", "node", "=", "read_atom", "(", ")", ";", "id", "=", "read4BE", "(", ")", "&", "0x3ffff", ";", "creation", "=", "read1", "(", ")", "&", "0x03", ";", "return", "new", "ERef", "(", "node", ",", "id", ",", "creation", ")", ";", "case", "EExternal", ".", "newRefTag", ":", "final", "int", "arity", "=", "read2BE", "(", ")", ";", "node", "=", "read_atom", "(", ")", ";", "creation", "=", "read1", "(", ")", "&", "0x03", ";", "final", "int", "[", "]", "ids", "=", "new", "int", "[", "arity", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arity", ";", "i", "++", ")", "{", "ids", "[", "i", "]", "=", "read4BE", "(", ")", ";", "}", "ids", "[", "0", "]", "&=", "0x3ffff", ";", "return", "new", "ERef", "(", "node", ",", "ids", ",", "creation", ")", ";", "default", ":", "throw", "new", "IOException", "(", "\"\"", "+", "tag", ")", ";", "}", "}", "public", "EFun", "read_fun", "(", ")", "throws", "IOException", "{", "final", "int", "tag", "=", "read1skip_version", "(", ")", ";", "if", "(", "tag", "==", "EExternal", ".", "funTag", ")", "{", "final", "int", "nFreeVars", "=", "read4BE", "(", ")", ";", "final", "EPID", "pid", "=", "read_pid", "(", ")", ";", "final", "EAtom", "module", "=", "read_atom", "(", ")", ";", "final", "long", "index", "=", "read_long", "(", ")", ";", "final", "long", "uniq", "=", "read_long", "(", ")", ";", "final", "EObject", "[", "]", "freeVars", "=", "new", "EObject", "[", "nFreeVars", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nFreeVars", ";", "++", "i", ")", "{", "freeVars", "[", "i", "]", "=", "read_any", "(", ")", ";", "}", "return", "EModuleManager", ".", "resolve", "(", "pid", ",", "module", ",", "(", "int", ")", "uniq", ",", "(", "int", ")", "index", ",", "freeVars", ")", ";", "}", "else", "if", "(", "tag", "==", "EExternal", ".", "newFunTag", ")", "{", "@", "SuppressWarnings", "(", "\"unused\"", ")", "final", "int", "n", "=", "read4BE", "(", ")", ";", "final", "int", "arity", "=", "read1", "(", ")", ";", "final", "byte", "[", "]", "md5", "=", "new", "byte", "[", "16", "]", ";", "readN", "(", "md5", ")", ";", "final", "int", "index", "=", "read4BE", "(", ")", ";", "final", "int", "nFreeVars", "=", "read4BE", "(", ")", ";", "final", "EAtom", "module", "=", "read_atom", "(", ")", ";", "final", "long", "oldIndex", "=", "read_long", "(", ")", ";", "final", "long", "uniq", "=", "read_long", "(", ")", ";", "final", "EPID", "pid", "=", "read_pid", "(", ")", ";", "final", "EObject", "[", "]", "freeVars", "=", "new", "EObject", "[", "nFreeVars", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nFreeVars", ";", "++", "i", ")", "{", "freeVars", "[", "i", "]", "=", "read_any", "(", ")", ";", "}", "return", "EModuleManager", ".", "resolve", "(", "pid", ",", "module", ",", "new", "EBinary", "(", "md5", ")", ",", "index", ",", "(", "int", ")", "uniq", ",", "(", "int", ")", "oldIndex", ",", "arity", ",", "freeVars", ")", ";", "}", "else", "if", "(", "tag", "==", "EExternal", ".", "externalFunTag", ")", "{", "final", "EAtom", "module", "=", "read_atom", "(", ")", ";", "final", "EAtom", "function", "=", "read_atom", "(", ")", ";", "final", "int", "arity", "=", "(", "int", ")", "read_long", "(", ")", ";", "return", "EModuleManager", ".", "resolve", "(", "new", "FunID", "(", "module", ",", "function", ",", "arity", ")", ")", ";", "}", "else", "{", "throw", "new", "IOException", "(", "\"\"", "+", "tag", ")", ";", "}", "}", "public", "EFun", "read_external_fun", "(", ")", "throws", "IOException", "{", "final", "int", "tag", "=", "read1skip_version", "(", ")", ";", "if", "(", "tag", "!=", "EExternal", ".", "externalFunTag", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "tag", ")", ";", "}", "final", "EAtom", "module", "=", "read_atom", "(", ")", ";", "final", "EAtom", "function", "=", "read_atom", "(", ")", ";", "final", "int", "arity", "=", "(", "int", ")", "read_long", "(", ")", ";", "return", "EModuleManager", ".", "resolve", "(", "new", "FunID", "(", "module", ",", "function", ",", "arity", ")", ")", ";", "}", "public", "ESeq", "read_string", "(", ")", "throws", "IOException", "{", "int", "tag", ";", "int", "len", ";", "byte", "[", "]", "strbuf", ";", "int", "[", "]", "intbuf", ";", "tag", "=", "read1skip_version", "(", ")", ";", "switch", "(", "tag", ")", "{", "case", "EExternal", ".", "stringTag", ":", "len", "=", "read2BE", "(", ")", ";", "strbuf", "=", "new", "byte", "[", "len", "]", ";", "this", ".", "readN", "(", "strbuf", ")", ";", "return", "EString", ".", "make", "(", "strbuf", ")", ";", "case", "EExternal", ".", "nilTag", ":", "return", "ERT", ".", "NIL", ";", "case", "EExternal", ".", "listTag", ":", "len", "=", "read4BE", "(", ")", ";", "intbuf", "=", "new", "int", "[", "len", "]", ";", "boolean", "unicode", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "intbuf", "[", "i", "]", "=", "read_int", "(", ")", ";", "unicode", "|=", "intbuf", "[", "i", "]", ">", "0xff", ";", "if", "(", "!", "EString", ".", "isValidCodePoint", "(", "intbuf", "[", "i", "]", ")", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "intbuf", "[", "i", "]", ")", ";", "}", "}", "read_nil", "(", ")", ";", "return", "EList", ".", "make", "(", "intbuf", ")", ";", "default", ":", "throw", "new", "IOException", "(", "\"\"", "+", "EExternal", ".", "stringTag", "+", "\"", "or", "\"", "+", "EExternal", ".", "listTag", "+", "\",", "got", "\"", "+", "tag", ")", ";", "}", "}", "public", "EObject", "read_compressed", "(", ")", "throws", "IOException", "{", "final", "int", "tag", "=", "read1skip_version", "(", ")", ";", "if", "(", "tag", "!=", "EExternal", ".", "compressedTag", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "EExternal", ".", "compressedTag", "+", "\",", "got", "\"", "+", "tag", ")", ";", "}", "final", "byte", "[", "]", "buf", "=", "read_size_and_inflate", "(", ")", ";", "final", "EInputStream", "ois", "=", "new", "EInputStream", "(", "buf", ",", "flags", ")", ";", "return", "ois", ".", "read_any", "(", ")", ";", "}", "public", "byte", "[", "]", "read_size_and_inflate", "(", ")", "throws", "IOException", "{", "final", "int", "size", "=", "read4BE", "(", ")", ";", "final", "byte", "[", "]", "buf", "=", "new", "byte", "[", "size", "]", ";", "final", "java", ".", "util", ".", "zip", ".", "Inflater", "inflater", "=", "new", "java", ".", "util", ".", "zip", ".", "Inflater", "(", ")", ";", "final", "java", ".", "util", ".", "zip", ".", "InflaterInputStream", "is", "=", "new", "java", ".", "util", ".", "zip", ".", "InflaterInputStream", "(", "this", ",", "inflater", ")", ";", "try", "{", "int", "pos", "=", "0", ";", "while", "(", "pos", "<", "size", ")", "{", "final", "int", "dsize", "=", "is", ".", "read", "(", "buf", ",", "pos", ",", "size", "-", "pos", ")", ";", "if", "(", "dsize", "==", "0", ")", "break", ";", "pos", "+=", "dsize", ";", "}", "if", "(", "pos", "<", "size", ")", "{", "throw", "new", "IOException", "(", "\"\"", "+", "pos", "+", "\"", "bytes,", "not", "\"", "+", "size", ")", ";", "}", "int", "read_ahead", "=", "inflater", ".", "getRemaining", "(", ")", ";", "setPos", "(", "getPos", "(", ")", "-", "read_ahead", ")", ";", "}", "finally", "{", "is", ".", "close", "(", ")", ";", "}", "return", "buf", ";", "}", "public", "EObject", "read_any", "(", ")", "throws", "IOException", "{", "final", "int", "tag", "=", "peek1skip_version", "(", ")", ";", "switch", "(", "tag", ")", "{", "case", "EExternal", ".", "smallIntTag", ":", "case", "EExternal", ".", "intTag", ":", "case", "EExternal", ".", "smallBigTag", ":", "case", "EExternal", ".", "largeBigTag", ":", "return", "EInteger", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "atomCacheRef", ":", "case", "EExternal", ".", "atomTag", ":", "case", "EExternal", ".", "smallAtomTag", ":", "return", "EAtom", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "floatTag", ":", "case", "EExternal", ".", "newFloatTag", ":", "return", "EDouble", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "refTag", ":", "case", "EExternal", ".", "newRefTag", ":", "return", "ERef", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "portTag", ":", "return", "EPort", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "pidTag", ":", "return", "EPID", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "stringTag", ":", "return", "EString", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "listTag", ":", "case", "EExternal", ".", "nilTag", ":", "if", "(", "(", "flags", "&", "DECODE_INT_LISTS_AS_STRINGS", ")", "!=", "0", ")", "{", "final", "int", "savePos", "=", "getPos", "(", ")", ";", "try", "{", "return", "EString", ".", "read", "(", "this", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "}", "setPos", "(", "savePos", ")", ";", "}", "return", "EList", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "smallTupleTag", ":", "case", "EExternal", ".", "largeTupleTag", ":", "return", "ETuple", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "binTag", ":", "return", "EBinary", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "bitBinTag", ":", "return", "EBitString", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "compressedTag", ":", "return", "read_compressed", "(", ")", ";", "case", "EExternal", ".", "newFunTag", ":", "case", "EExternal", ".", "funTag", ":", "return", "EFun", ".", "read", "(", "this", ")", ";", "case", "EExternal", ".", "externalFunTag", ":", "return", "read_external_fun", "(", ")", ";", "default", ":", "throw", "new", "IOException", "(", "\"\"", "+", "tag", "+", "\"\"", "+", "getPos", "(", ")", ")", ";", "}", "}", "public", "void", "setAtomCacheRefs", "(", "EAtom", "[", "]", "atomCacheRefs", ")", "{", "this", ".", "atom_cache_refs", "=", "atomCacheRefs", ";", "}", "}", "</s>" ]
7,892
[ "<s>", "package", "erjang", ";", "public", "class", "EHash", "{", "static", "final", "int", "BINARY_DEF", "=", "0x0", ";", "static", "final", "int", "LIST_DEF", "=", "0x1", ";", "static", "final", "int", "NIL_DEF", "=", "0x2", ";", "static", "final", "int", "TUPLE_DEF", "=", "0x3", ";", "static", "final", "int", "PID_DEF", "=", "0x4", ";", "static", "final", "int", "EXTERNAL_PID_DEF", "=", "0x5", ";", "static", "final", "int", "PORT_DEF", "=", "0x6", ";", "static", "final", "int", "EXTERNAL_PORT_DEF", "=", "0x7", ";", "static", "final", "int", "EXPORT_DEF", "=", "0x8", ";", "static", "final", "int", "FUN_DEF", "=", "0x9", ";", "static", "final", "int", "REF_DEF", "=", "0xa", ";", "static", "final", "int", "EXTERNAL_REF_DEF", "=", "0xb", ";", "static", "final", "int", "ATOM_DEF", "=", "0xc", ";", "static", "final", "int", "FLOAT_DEF", "=", "0xd", ";", "static", "final", "int", "BIG_DEF", "=", "0xe", ";", "static", "final", "int", "SMALL_DEF", "=", "0xf", ";", "static", "final", "int", "FUNNY_NUMBER1", "=", "268440163", ";", "static", "final", "int", "FUNNY_NUMBER2", "=", "268439161", ";", "static", "final", "int", "FUNNY_NUMBER3", "=", "268435459", ";", "static", "final", "int", "FUNNY_NUMBER4", "=", "268436141", ";", "static", "final", "int", "FUNNY_NUMBER5", "=", "268438633", ";", "static", "final", "int", "FUNNY_NUMBER6", "=", "268437017", ";", "static", "final", "int", "FUNNY_NUMBER7", "=", "268438039", ";", "static", "final", "int", "FUNNY_NUMBER8", "=", "268437511", ";", "static", "final", "int", "FUNNY_NUMBER9", "=", "268439627", ";", "static", "final", "int", "FUNNY_NUMBER10", "=", "268440479", ";", "static", "final", "int", "FUNNY_NUMBER11", "=", "268440577", ";", "static", "final", "int", "FUNNY_NUMBER12", "=", "268440581", ";", "static", "final", "int", "HCONST", "=", "0x9e3779b9", ";", "int", "block_hash", "(", "byte", "[", "]", "k", ",", "int", "length", ",", "int", "initval", ")", "{", "int", "a", ",", "b", ",", "c", ";", "int", "len", ";", "len", "=", "length", ";", "a", "=", "b", "=", "HCONST", ";", "c", "=", "initval", ";", "int", "p", "=", "0", ";", "while", "(", "len", ">=", "12", ")", "{", "a", "+=", "(", "uint", "(", "k", "[", "p", "+", "0", "]", ")", "+", "uint", "(", "k", "[", "p", "+", "1", "]", ")", "<<", "8", "+", "uint", "(", "k", "[", "p", "+", "2", "]", ")", "<<", "16", "+", "uint", "(", "k", "[", "p", "+", "3", "]", ")", "<<", "24", ")", ";", "b", "+=", "(", "uint", "(", "k", "[", "p", "+", "4", "]", ")", "+", "uint", "(", "k", "[", "p", "+", "5", "]", ")", "<<", "8", "+", "uint", "(", "k", "[", "p", "+", "6", "]", ")", "<<", "16", "+", "uint", "(", "k", "[", "p", "+", "7", "]", ")", "<<", "24", ")", ";", "c", "+=", "(", "uint", "(", "k", "[", "p", "+", "8", "]", ")", "+", "uint", "(", "k", "[", "p", "+", "9", "]", ")", "<<", "8", "+", "uint", "(", "k", "[", "p", "+", "10", "]", ")", "<<", "16", "+", "uint", "(", "k", "[", "p", "+", "11", "]", ")", "<<", "24", ")", ";", "a", "-=", "b", ";", "a", "-=", "c", ";", "a", "^=", "(", "c", ">>>", "13", ")", ";", "b", "-=", "c", ";", "b", "-=", "a", ";", "b", "^=", "(", "a", "<<", "8", ")", ";", "c", "-=", "a", ";", "c", "-=", "b", ";", "c", "^=", "(", "b", ">>>", "13", ")", ";", "a", "-=", "b", ";", "a", "-=", "c", ";", "a", "^=", "(", "c", ">>>", "12", ")", ";", "b", "-=", "c", ";", "b", "-=", "a", ";", "b", "^=", "(", "a", "<<", "16", ")", ";", "c", "-=", "a", ";", "c", "-=", "b", ";", "c", "^=", "(", "b", ">>>", "5", ")", ";", "a", "-=", "b", ";", "a", "-=", "c", ";", "a", "^=", "(", "c", ">>>", "3", ")", ";", "b", "-=", "c", ";", "b", "-=", "a", ";", "b", "^=", "(", "a", "<<", "10", ")", ";", "c", "-=", "a", ";", "c", "-=", "b", ";", "c", "^=", "(", "b", ">>>", "15", ")", ";", "p", "+=", "12", ";", "len", "-=", "12", ";", "}", "c", "+=", "length", ";", "switch", "(", "len", ")", "{", "case", "11", ":", "c", "+=", "uint", "(", "k", "[", "p", "+", "10", "]", ")", "<<", "24", ";", "case", "10", ":", "c", "+=", "uint", "(", "k", "[", "p", "+", "9", "]", ")", "<<", "16", ";", "case", "9", ":", "c", "+=", "uint", "(", "k", "[", "p", "+", "8", "]", ")", "<<", "8", ";", "case", "8", ":", "b", "+=", "uint", "(", "k", "[", "p", "+", "7", "]", ")", "<<", "24", ";", "case", "7", ":", "b", "+=", "uint", "(", "k", "[", "p", "+", "6", "]", ")", "<<", "16", ";", "case", "6", ":", "b", "+=", "uint", "(", "k", "[", "p", "+", "5", "]", ")", "<<", "8", ";", "case", "5", ":", "b", "+=", "uint", "(", "k", "[", "4", "]", ")", ";", "case", "4", ":", "a", "+=", "uint", "(", "k", "[", "p", "+", "3", "]", ")", "<<", "24", ";", "case", "3", ":", "a", "+=", "uint", "(", "k", "[", "p", "+", "2", "]", ")", "<<", "16", ";", "case", "2", ":", "a", "+=", "uint", "(", "k", "[", "p", "+", "1", "]", ")", "<<", "8", ";", "case", "1", ":", "a", "+=", "uint", "(", "k", "[", "p", "+", "0", "]", ")", ";", "}", "c", "=", "mix", "(", "a", ",", "b", ",", "c", ")", ";", "return", "c", ";", "}", "static", "final", "int", "uint", "(", "byte", "b", ")", "{", "return", "(", "(", "int", ")", "b", ")", "&", "0xff", ";", "}", "static", "final", "int", "mix", "(", "int", "a", ",", "int", "b", ",", "int", "c", ")", "{", "a", "-=", "b", ";", "a", "-=", "c", ";", "a", "^=", "(", "c", ">>>", "13", ")", ";", "b", "-=", "c", ";", "b", "-=", "a", ";", "b", "^=", "(", "a", "<<", "8", ")", ";", "c", "-=", "a", ";", "c", "-=", "b", ";", "c", "^=", "(", "b", ">>>", "13", ")", ";", "a", "-=", "b", ";", "a", "-=", "c", ";", "a", "^=", "(", "c", ">>>", "12", ")", ";", "b", "-=", "c", ";", "b", "-=", "a", ";", "b", "^=", "(", "a", "<<", "16", ")", ";", "c", "-=", "a", ";", "c", "-=", "b", ";", "c", "^=", "(", "b", ">>>", "5", ")", ";", "a", "-=", "b", ";", "a", "-=", "c", ";", "a", "^=", "(", "c", ">>>", "3", ")", ";", "b", "-=", "c", ";", "b", "-=", "a", ";", "b", "^=", "(", "a", "<<", "10", ")", ";", "c", "-=", "a", ";", "c", "-=", "b", ";", "c", "^=", "(", "b", ">>>", "15", ")", ";", "return", "c", ";", "}", "static", "final", "int", "HCONST_2", "=", "0x3c6ef372", ";", "static", "final", "int", "HCONST_3", "=", "0xdaa66d2b", ";", "static", "final", "int", "HCONST_4", "=", "0x78dde6e4", ";", "static", "final", "int", "HCONST_5", "=", "0x1715609d", ";", "static", "final", "int", "HCONST_6", "=", "0xb54cda56", ";", "static", "final", "int", "HCONST_7", "=", "0x5384540f", ";", "static", "final", "int", "HCONST_8", "=", "0xf1bbcdc8", ";", "static", "final", "int", "HCONST_9", "=", "0x8ff34781", ";", "static", "final", "int", "HCONST_10", "=", "0x2e2ac13a", ";", "static", "final", "int", "HCONST_11", "=", "0xcc623af3", ";", "static", "final", "int", "HCONST_12", "=", "0x6a99b4ac", ";", "static", "final", "int", "HCONST_13", "=", "0x08d12e65", ";", "static", "final", "int", "HCONST_14", "=", "0xa708a81e", ";", "static", "final", "int", "HCONST_15", "=", "0x454021d7", ";", "static", "final", "int", "HCONST_NIL", "=", "(", "int", ")", "3468870702L", ";", "static", "final", "int", "UINT32_HASH_2", "(", "int", "expr1", ",", "int", "expr2", ",", "int", "aconst", ",", "int", "hash", ")", "{", "int", "a", ",", "b", ";", "a", "=", "aconst", "+", "expr1", ";", "b", "=", "aconst", "+", "expr2", ";", "return", "mix", "(", "a", ",", "b", ",", "hash", ")", ";", "}", "static", "final", "int", "UINT32_HASH", "(", "int", "expr", ",", "int", "aconst", ",", "int", "hash", ")", "{", "return", "UINT32_HASH_2", "(", "expr", ",", "0", ",", "aconst", ",", "hash", ")", ";", "}", "static", "final", "int", "SINT32_HASH", "(", "int", "expr", ",", "int", "aconst", ",", "int", "hash", ")", "{", "if", "(", "expr", "<", "0", ")", "{", "return", "UINT32_HASH", "(", "-", "expr", ",", "aconst", ",", "hash", ")", ";", "}", "else", "{", "return", "UINT32_HASH", "(", "expr", ",", "aconst", ",", "hash", ")", ";", "}", "}", "public", "static", "int", "hash2", "(", "EAtom", "val", ",", "int", "hash", ")", "{", "if", "(", "hash", "==", "0", ")", "{", "return", "val", ".", "hash", ";", "}", "else", "{", "return", "UINT32_HASH", "(", "val", ".", "hash", ",", "HCONST_3", ",", "hash", ")", ";", "}", "}", "public", "static", "int", "hash2", "(", "ESmall", "val", ",", "int", "hash", ")", "{", "return", "SINT32_HASH", "(", "val", ".", "value", ",", "HCONST", ",", "hash", ")", ";", "}", "public", "static", "int", "hash2", "(", "EString", "val", ",", "int", "hash", ")", "{", "int", "c", "=", "0", ";", "int", "sh", "=", "0", ";", "for", "(", "int", "p", "=", "0", ";", "p", "<", "val", ".", "length", "(", ")", ";", "p", "++", ")", "{", "sh", "=", "(", "sh", "<<", "8", ")", "+", "val", ".", "charAt", "(", "p", ")", ";", "if", "(", "c", "==", "3", ")", "{", "hash", "=", "UINT32_HASH", "(", "sh", ",", "HCONST_4", ",", "hash", ")", ";", "c", "=", "sh", "=", "0", ";", "}", "else", "{", "c", "++", ";", "}", "}", "if", "(", "c", ">", "0", ")", "{", "hash", "=", "UINT32_HASH", "(", "sh", ",", "HCONST_4", ",", "hash", ")", ";", "}", "return", "hash", ";", "}", "public", "static", "int", "hash2", "(", "ERef", "ref", ",", "int", "hash", ")", "{", "return", "UINT32_HASH", "(", "ref", ".", "internal_ref_numbers", "(", ")", "[", "0", "]", ",", "HCONST_7", ",", "hash", ")", ";", "}", "public", "static", "int", "hash2", "(", "EInternalPort", "port", ",", "int", "hash", ")", "{", "return", "UINT32_HASH", "(", "port", ".", "internal_port_number", "(", ")", ",", "HCONST_6", ",", "hash", ")", ";", "}", "public", "static", "int", "hash2", "(", "EInternalPID", "pid", ",", "int", "hash", ")", "{", "return", "UINT32_HASH", "(", "pid", ".", "internal_pid_number", "(", ")", ",", "HCONST_5", ",", "hash", ")", ";", "}", "public", "static", "int", "hash2", "(", "ENil", "nil", ",", "int", "hash", ")", "{", "if", "(", "hash", "==", "0", ")", "{", "return", "HCONST_NIL", ";", "}", "else", "{", "return", "UINT32_HASH", "(", "NIL_DEF", ",", "HCONST_2", ",", "hash", ")", ";", "}", "}", "}", "</s>" ]
7,893
[ "<s>", "package", "erjang", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "InputStream", ";", "import", "java", ".", "net", ".", "URL", ";", "import", "java", ".", "net", ".", "URLClassLoader", ";", "import", "erjang", ".", "beam", ".", "RamClassRepo", ";", "public", "class", "EModuleClassLoader", "extends", "URLClassLoader", "{", "private", "final", "RamClassRepo", "ramClassRepo", ";", "public", "EModuleClassLoader", "(", "URL", "loadFrom", ",", "RamClassRepo", "repo", ")", "{", "super", "(", "loadFrom", "==", "null", "?", "new", "URL", "[", "0", "]", ":", "new", "URL", "[", "]", "{", "loadFrom", "}", ",", "EObject", ".", "class", ".", "getClassLoader", "(", ")", ")", ";", "this", ".", "ramClassRepo", "=", "repo", ";", "}", "public", "EModuleClassLoader", "(", "URL", "loadFrom", ")", "{", "this", "(", "loadFrom", ",", "null", ")", ";", "}", "String", "ETUPLE_NAME", "=", "ETuple", ".", "class", ".", "getName", "(", ")", ";", "String", "EFUN_NAME", "=", "EFun", ".", "class", ".", "getName", "(", ")", ";", "@", "Override", "protected", "Class", "<", "?", ">", "findClass", "(", "String", "name", ")", "throws", "ClassNotFoundException", "{", "if", "(", "name", ".", "startsWith", "(", "ETUPLE_NAME", ")", ")", "{", "int", "arity", "=", "Integer", ".", "parseInt", "(", "name", ".", "substring", "(", "ETUPLE_NAME", ".", "length", "(", ")", ")", ")", ";", "return", "ETuple", ".", "get_tuple_class", "(", "arity", ")", ";", "}", "if", "(", "name", ".", "startsWith", "(", "EFUN_NAME", ")", ")", "{", "if", "(", "name", ".", "endsWith", "(", "\"Exported\"", ")", ")", "{", "int", "num_start", "=", "EFUN_NAME", ".", "length", "(", ")", ";", "int", "num_end", "=", "name", ".", "length", "(", ")", "-", "\"Exported\"", ".", "length", "(", ")", ";", "int", "arity", "=", "Integer", ".", "parseInt", "(", "name", ".", "substring", "(", "num_start", ",", "num_end", ")", ")", ";", "return", "EFun", ".", "get_exported_fun_class", "(", "arity", ")", ";", "}", "else", "{", "int", "arity", "=", "Integer", ".", "parseInt", "(", "name", ".", "substring", "(", "EFUN_NAME", ".", "length", "(", ")", ")", ")", ";", "return", "EFun", ".", "get_fun_class", "(", "arity", ")", ";", "}", "}", "if", "(", "name", ".", "startsWith", "(", "\"kilim.S_\"", ")", ")", "{", "String", "classResourceName", "=", "name", ".", "replace", "(", "'.'", ",", "'/'", ")", "+", "\".class\"", ";", "InputStream", "resource", "=", "super", ".", "getResourceAsStream", "(", "classResourceName", ")", ";", "byte", "[", "]", "bb", ";", "if", "(", "resource", "!=", "null", ")", "{", "try", "{", "bb", "=", "new", "byte", "[", "resource", ".", "available", "(", ")", "]", ";", "resource", ".", "read", "(", "bb", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "Error", "(", "ex", ")", ";", "}", "}", "else", "if", "(", "ramClassRepo", "!=", "null", ")", "{", "bb", "=", "ramClassRepo", ".", "get", "(", "name", ")", ";", "}", "else", "bb", "=", "null", ";", "if", "(", "bb", "==", "null", ")", "{", "throw", "new", "ClassNotFoundException", "(", "name", ",", "new", "Error", "(", "\"\"", "+", "this", ".", "getURLs", "(", ")", "[", "0", "]", ")", ")", ";", "}", "return", "ERT", ".", "defineClass", "(", "EModuleClassLoader", ".", "class", ".", "getClassLoader", "(", ")", ",", "name", ",", "bb", ")", ";", "}", "if", "(", "ramClassRepo", "!=", "null", ")", "{", "byte", "[", "]", "data", "=", "ramClassRepo", ".", "get", "(", "name", ")", ";", "if", "(", "data", "!=", "null", ")", "{", "return", "super", ".", "defineClass", "(", "name", ",", "data", ",", "0", ",", "data", ".", "length", ")", ";", "}", "}", "return", "super", ".", "findClass", "(", "name", ")", ";", "}", "}", "</s>" ]
7,894
[ "<s>", "package", "erjang", ";", "public", "abstract", "class", "ELazySeq", "extends", "ESeq", "{", "ESeq", "value", "=", "null", ";", "@", "Override", "public", "ESeq", "cons", "(", "EObject", "h", ")", "{", "return", "value", "(", ")", ".", "cons", "(", "h", ")", ";", "}", "private", "ESeq", "value", "(", ")", "{", "if", "(", "value", "==", "null", ")", "{", "value", "=", "initialValue", "(", ")", ";", "assert", "value", ".", "testNil", "(", ")", "==", "null", ";", "}", "return", "value", ";", "}", "protected", "abstract", "ESeq", "initialValue", "(", ")", ";", "@", "Override", "public", "ESeq", "tail", "(", ")", "{", "return", "value", "(", ")", ".", "tail", "(", ")", ";", "}", "@", "Override", "public", "EObject", "head", "(", ")", "{", "return", "value", "(", ")", ".", "head", "(", ")", ";", "}", "@", "Override", "public", "boolean", "isNil", "(", ")", "{", "return", "value", "(", ")", ".", "isNil", "(", ")", ";", "}", "@", "Override", "public", "ESeq", "testSeq", "(", ")", "{", "return", "value", "(", ")", ".", "testSeq", "(", ")", ";", "}", "}", "</s>" ]
7,895
[ "<s>", "package", "erjang", ";", "import", "java", ".", "util", ".", "Timer", ";", "import", "java", ".", "util", ".", "TimerTask", ";", "import", "java", ".", "util", ".", "concurrent", ".", "ConcurrentHashMap", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "kilim", ".", "Pausable", ";", "import", "kilim", ".", "Task", ";", "public", "abstract", "class", "ETimerTask", "extends", "TimerTask", "implements", "ExitHook", "{", "static", "ConcurrentHashMap", "<", "ERef", ",", "ETimerTask", ">", "timer_refs", "=", "new", "ConcurrentHashMap", "(", ")", ";", "static", "Timer", "send_timer", "=", "new", "Timer", "(", ")", ";", "final", "ERef", "ref", ";", "private", "final", "EInternalPID", "pid", ";", "long", "when", "=", "-", "1", ";", "public", "ETimerTask", "(", ")", "{", "ref", "=", "ERT", ".", "getLocalNode", "(", ")", ".", "createRef", "(", ")", ";", "pid", "=", "null", ";", "timer_refs", ".", "put", "(", "ref", ",", "this", ")", ";", "}", "public", "ETimerTask", "(", "EInternalPID", "pid", ")", "{", "ref", "=", "ERT", ".", "getLocalNode", "(", ")", ".", "createRef", "(", ")", ";", "this", ".", "pid", "=", "pid", ";", "if", "(", "pid", "!=", "null", ")", "{", "pid", ".", "add_exit_hook", "(", "this", ")", ";", "}", "timer_refs", ".", "put", "(", "ref", ",", "this", ")", ";", "}", "@", "Override", "public", "synchronized", "final", "void", "run", "(", ")", "{", "if", "(", "timer_refs", ".", "remove", "(", "ref", ")", "==", "null", ")", "{", "return", ";", "}", "if", "(", "pid", "!=", "null", ")", "{", "pid", ".", "remove_exit_hook", "(", "this", ")", ";", "}", "ERT", ".", "scheduler", ".", "schedule", "(", "new", "Task", "(", ")", "{", "@", "Override", "public", "void", "execute", "(", ")", "throws", "Pausable", ",", "Exception", "{", "on_timeout", "(", ")", ";", "}", "}", ")", ";", "}", "@", "Override", "public", "boolean", "cancel", "(", ")", "{", "return", "cancel_timer", "(", ")", ">=", "0", ";", "}", "public", "synchronized", "long", "cancel_timer", "(", ")", "{", "if", "(", "super", ".", "cancel", "(", ")", ")", "{", "timer_refs", ".", "remove", "(", "ref", ")", ";", "if", "(", "pid", "!=", "null", ")", "{", "pid", ".", "remove_exit_hook", "(", "this", ")", ";", "}", "return", "when", "-", "System", ".", "currentTimeMillis", "(", ")", ";", "}", "else", "{", "return", "-", "1", ";", "}", "}", "public", "static", "long", "cancel", "(", "ERef", "ref", ")", "{", "ETimerTask", "timer_task", "=", "timer_refs", ".", "get", "(", "ref", ")", ";", "if", "(", "timer_task", "!=", "null", ")", "{", "return", "timer_task", ".", "cancel_timer", "(", ")", ";", "}", "return", "-", "1", ";", "}", "public", "synchronized", "final", "void", "on_exit", "(", "EInternalPID", "pid", ")", "throws", "Pausable", "{", "assert", "(", "pid", "==", "this", ".", "pid", ")", ":", "\"\"", ";", "timer_refs", ".", "remove", "(", "ref", ")", ";", "this", ".", "cancel", "(", ")", ";", "}", ";", "protected", "abstract", "void", "on_timeout", "(", ")", "throws", "Pausable", ";", "public", "void", "schedule", "(", "long", "ms_delay", ")", "{", "when", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "ms_delay", ";", "send_timer", ".", "schedule", "(", "this", ",", "ms_delay", ")", ";", "}", "public", "static", "long", "read_timer", "(", "ERef", "ref", ")", "{", "ETimerTask", "timer_task", "=", "timer_refs", ".", "get", "(", "ref", ")", ";", "if", "(", "timer_task", "!=", "null", ")", "{", "return", "timer_task", ".", "when", "-", "System", ".", "currentTimeMillis", "(", ")", ";", "}", "return", "-", "1", ";", "}", "public", "static", "void", "shutdown", "(", ")", "{", "send_timer", ".", "cancel", "(", ")", ";", "send_timer", ".", "purge", "(", ")", ";", "}", "}", "</s>" ]
7,896
[ "<s>", "package", "erjang", ";", "import", "erjang", ".", "m", ".", "rpc", ".", "MBox", ";", "public", "class", "RPC", "{", "static", "EAtom", "am_$gen_call", "=", "EAtom", ".", "intern", "(", "\"$gen_call\"", ")", ";", "static", "EAtom", "am_rex", "=", "EAtom", ".", "intern", "(", "\"rex\"", ")", ";", "static", "EAtom", "am_undefined", "=", "EAtom", ".", "intern", "(", "\"undefined\"", ")", ";", "static", "EAtom", "am_user", "=", "EAtom", ".", "intern", "(", "\"user\"", ")", ";", "static", "EAtom", "am_call", "=", "EAtom", ".", "intern", "(", "\"call\"", ")", ";", "static", "EAtom", "am_rpc", "=", "EAtom", ".", "intern", "(", "\"rpc\"", ")", ";", "static", "EAtom", "am_call_from_java", "=", "EAtom", ".", "intern", "(", "\"\"", ")", ";", "static", "EAtom", "am_init", "=", "EAtom", ".", "intern", "(", "\"init\"", ")", ";", "static", "EAtom", "am_get_status", "=", "EAtom", ".", "intern", "(", "\"get_status\"", ")", ";", "static", "EAtom", "am_started", "=", "EAtom", ".", "intern", "(", "\"started\"", ")", ";", "public", "static", "EObject", "call", "(", "EAtom", "mod", ",", "EAtom", "fun", ",", "EObject", "...", "args", ")", "{", "return", "call", "(", "mod", ",", "fun", ",", "EList", ".", "fromArray", "(", "args", ")", ")", ";", "}", "public", "static", "EObject", "call", "(", "EAtom", "mod", ",", "EAtom", "fun", ",", "ESeq", "args", ")", "{", "MBox", "mbox", "=", "new", "MBox", "(", ")", ";", "ESeq", "callargs", "=", "EList", ".", "make", "(", "mod", ",", "fun", ",", "args", ",", "mbox", ")", ";", "EProc", "proc", "=", "new", "EProc", "(", "default_groupleader", "(", ")", ",", "am_rpc", ",", "am_call_from_java", ",", "callargs", ")", ";", "ERT", ".", "run", "(", "proc", ")", ";", "return", "mbox", ".", "get_b", "(", ")", ";", "}", "private", "static", "EPID", "default_groupleader", "(", ")", "{", "return", "erjang", ".", "m", ".", "rpc", ".", "Native", ".", "get_local_group_leader", "(", ")", ";", "}", "public", "static", "EObject", "call", "(", "EAtom", "mod", ",", "EAtom", "fun", ",", "ESeq", "args", ",", "long", "timeout", ")", "{", "MBox", "mbox", "=", "new", "MBox", "(", ")", ";", "EProc", "proc", "=", "new", "EProc", "(", "default_groupleader", "(", ")", ",", "am_rpc", ",", "am_call_from_java", ",", "EList", ".", "make", "(", "mod", ",", "fun", ",", "args", ",", "mbox", ")", ")", ";", "ERT", ".", "run", "(", "proc", ")", ";", "return", "mbox", ".", "get_b", "(", "timeout", ")", ";", "}", "public", "static", "void", "wait_for_erjang_started", "(", "long", "timeout", ")", "{", "erjang", ".", "m", ".", "rpc", ".", "Native", ".", "wait_for_started", "(", "timeout", ")", ";", "}", "}", "</s>" ]
7,897
[ "<s>", "package", "erjang", ";", "import", "java", ".", "lang", ".", "annotation", ".", "ElementType", ";", "import", "java", ".", "lang", ".", "annotation", ".", "Retention", ";", "import", "java", ".", "lang", ".", "annotation", ".", "RetentionPolicy", ";", "import", "java", ".", "lang", ".", "annotation", ".", "Target", ";", "@", "Retention", "(", "RetentionPolicy", ".", "RUNTIME", ")", "@", "Target", "(", "ElementType", ".", "TYPE", ")", "public", "@", "interface", "Module", "{", "String", "value", "(", ")", ";", "}", "</s>" ]
7,898
[ "<s>", "package", "erjang", ";", "import", "java", ".", "math", ".", "BigInteger", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "abstract", "class", "EInteger", "extends", "ENumber", "{", "abstract", "BigInteger", "bigintValue", "(", ")", ";", "public", "EInteger", "testInteger", "(", ")", "{", "return", "this", ";", "}", "public", "EInteger", "asInteger", "(", ")", "{", "return", "this", ";", "}", "public", "abstract", "EInteger", "dec", "(", ")", ";", "public", "long", "longValue", "(", ")", "{", "return", "bigintValue", "(", ")", ".", "longValue", "(", ")", ";", "}", "public", "static", "EInteger", "read", "(", "EInputStream", "ei", ")", "throws", "IOException", "{", "return", "ei", ".", "read_tagged_integer", "(", ")", ";", "}", "}", "</s>" ]
7,899
[ "<s>", "package", "erjang", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "erjang", ".", "driver", ".", "efile", ".", "EFile", ";", "public", "class", "Main", "{", "public", "static", "final", "String", "SYSTEM_ARCHITECTURE", "=", "\"java\"", ";", "public", "static", "final", "String", "DRIVER_VERSION", "=", "\"1.5\"", ";", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "ErjangConfig", ".", "init", "(", ")", ";", "ArrayList", "<", "String", ">", "ra", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "String", "cmd_line_root", "=", "null", ";", "String", "otp_version", "=", "(", "ErjangConfig", ".", "hasString", "(", "\"\"", ")", "?", "ErjangConfig", ".", "getString", "(", "\"\"", ",", "null", ")", ":", "null", ")", ";", "String", "erts_version", "=", "(", "ErjangConfig", ".", "hasString", "(", "\"\"", ")", "?", "\"erts-\"", "+", "ErjangConfig", ".", "getString", "(", "\"\"", ",", "null", ")", ":", "null", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "if", "(", "\"-root\"", ".", "equals", "(", "args", "[", "i", "]", ")", "&&", "i", "<", "args", ".", "length", ")", "{", "cmd_line_root", "=", "args", "[", "i", "+", "1", "]", ";", "i", "+=", "1", ";", "}", "else", "if", "(", "\"+e\"", ".", "equals", "(", "args", "[", "i", "]", ")", "&&", "i", "<", "args", ".", "length", ")", "{", "erts_version", "=", "\"erts-\"", "+", "args", "[", "i", "+", "1", "]", ";", "i", "+=", "1", ";", "}", "}", "RuntimeInfo", "runtimeInfo", "=", "RuntimeInfo", ".", "setup", "(", "erts_version", ",", "otp_version", ",", "cmd_line_root", ")", ";", "try", "{", "runtimeInfo", ".", "verify", "(", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "String", "reason", "=", "e", ".", "getMessage", "(", ")", ";", "ERT", ".", "log", ".", "severe", "(", "reason", ")", ";", "System", ".", "err", ".", "println", "(", "reason", ")", ";", "return", ";", "}", "String", "root", "=", "runtimeInfo", ".", "erl_rootdir", ";", "ra", ".", "add", "(", "\"-root\"", ")", ";", "ra", ".", "add", "(", "root", ")", ";", "arg_loop", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "String", "arg", "=", "args", "[", "i", "]", ";", "if", "(", "\"-extra\"", ".", "equals", "(", "arg", ")", ")", "{", "for", "(", "int", "ii", "=", "i", ";", "ii", "<", "args", ".", "length", ";", "ii", "++", ")", "{", "ra", ".", "add", "(", "args", "[", "ii", "]", ")", ";", "}", "break", ";", "}", "if", "(", "\"-root\"", ".", "equals", "(", "args", "[", "i", "]", ")", "&&", "i", "<", "args", ".", "length", ")", "{", "i", "++", ";", "continue", ";", "}", "if", "(", "arg", ".", "startsWith", "(", "\"+\"", ")", ")", "{", "switch", "(", "arg", ".", "charAt", "(", "1", ")", ")", "{", "case", "'a'", ":", "case", "'e'", ":", "case", "'A'", ":", "case", "'B'", ":", "case", "'h'", ":", "case", "'K'", ":", "case", "'M'", ":", "case", "'P'", ":", "case", "'R'", ":", "case", "'S'", ":", "case", "'s'", ":", "case", "'t'", ":", "case", "'T'", ":", "case", "'W'", ":", "System", ".", "setProperty", "(", "\"\"", "+", "arg", ".", "substring", "(", "1", ")", ",", "args", "[", "i", "+", "1", "]", ")", ";", "i", "+=", "1", ";", "continue", "arg_loop", ";", "default", ":", "System", ".", "setProperty", "(", "\"\"", "+", "arg", ".", "substring", "(", "1", ")", ",", "\"true\"", ")", ";", "continue", "arg_loop", ";", "}", "}", "ra", ".", "add", "(", "arg", ")", ";", "}", "if", "(", "!", "ra", ".", "contains", "(", "\"-home\"", ")", ")", "{", "ra", ".", "add", "(", "\"-home\"", ")", ";", "ra", ".", "add", "(", "System", ".", "getProperty", "(", "\"user.home\"", ")", ")", ";", "}", "ERT", ".", "setRuntimeInfo", "(", "runtimeInfo", ")", ";", "if", "(", "!", "(", "new", "File", "(", "runtimeInfo", ".", "erl_bootstrap_ebindir", ")", ")", ".", "exists", "(", ")", "&&", "!", "runtimeInfo", ".", "erl_bootstrap_ebindir", ".", "startsWith", "(", "EFile", ".", "RESOURCE_PREFIX", ")", ")", "{", "ERT", ".", "log", ".", "severe", "(", "\"\"", "+", "runtimeInfo", ".", "erl_bootstrap_ebindir", ")", ";", "throw", "new", "IllegalArgumentException", "(", "\"\"", "+", "runtimeInfo", ".", "erl_bootstrap_ebindir", ")", ";", "}", "OTPMain", ".", "main", "(", "ra", ".", "toArray", "(", "new", "String", "[", "ra", ".", "size", "(", ")", "]", ")", ")", ";", "}", "}", "</s>" ]