diff options
Diffstat (limited to 'tests/examplefiles')
23 files changed, 3034 insertions, 1789 deletions
diff --git a/tests/examplefiles/99_bottles_of_beer.chpl b/tests/examplefiles/99_bottles_of_beer.chpl index f73be7b1..47fcaaf6 100644 --- a/tests/examplefiles/99_bottles_of_beer.chpl +++ b/tests/examplefiles/99_bottles_of_beer.chpl @@ -112,7 +112,50 @@ c = nil; c = new Oval(r=1.0, r2=2.0); writeln("Area of oval: " + c.area()); +// This is a valid decimal integer: +var x = 0000000000012; + union U { var i: int; var r: real; } + +// chapel ranges are awesome. +var r1 = 1..10, // 1 2 3 4 5 6 7 8 9 10 + r2 = 10..1, // no values in this range + r3 = 1..10 by -1, // 10 9 8 7 6 5 4 3 2 1 + r4 = 1..10 by 2, // 1 3 5 7 9 + r5 = 1..10 by 2 align 0, // 2 4 6 8 10 + r6 = 1..10 by 2 align 2, // 2 4 6 8 10 + r7 = 1..10 # 3, // 1 2 3 + r8 = 1..10 # -2, // 9 10 + r9 = 1..100 # 10 by 2, // 1 3 5 7 9 + ra = 1..100 by 2 # 10, // 1 3 5 7 9 11 13 15 17 19 + rb = 1.. # 100 by 10; // 1 11 21 31 41 51 61 71 81 91 + +// create a variable with default initialization +var myVarWithoutInit: real = noinit; +myVarWithoutInit = 1.0; + +// Chapel has <~> operator for read and write I/O operations. +class IntPair { + var x: int; + var y: int; + proc readWriteThis(f) { + f <~> x <~> new ioLiteral(",") <~> y <~> new ioNewline(); + } +} +var ip = new IntPair(17,2); +write(ip); + +var targetDom: {1..10}, + target: [targetDom] int; +coforall i in targetDom with (ref target) { + targetDom[i] = i ** 3; +} + +var wideOpen = 0o777, + mememe = 0o600, + clique_y = 0O660, + zeroOct = 0o0, + minPosOct = 0O1; diff --git a/tests/examplefiles/Errors.scala b/tests/examplefiles/Errors.scala index 67198c05..7af70280 100644 --- a/tests/examplefiles/Errors.scala +++ b/tests/examplefiles/Errors.scala @@ -11,6 +11,11 @@ String val foo_+ = "foo plus" val foo_⌬⌬ = "double benzene" + // Test some interpolated strings + val mu = s"${if (true) "a:b" else "c" {with "braces"}}" + val mu2 = f"${if (true) "a:b" else "c" {with "braces"}}" + val raw = raw"a raw\nstring\"with escaped quotes" + def main(argv: Array[String]) { println(⌘.interface + " " + foo_+ + " " + foo_⌬⌬ ) } diff --git a/tests/examplefiles/all.nit b/tests/examplefiles/all.nit new file mode 100644 index 00000000..d4e1ddfa --- /dev/null +++ b/tests/examplefiles/all.nit @@ -0,0 +1,1986 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2013 Alexis Laferrière <alexis.laf@xymus.net> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import gtk + +class CalculatorContext + var result : nullable Float = null + + var last_op : nullable Char = null + + var current : nullable Float = null + var after_point : nullable Int = null + + fun push_op( op : Char ) + do + apply_last_op_if_any + if op == 'C' then + self.result = 0.0 + last_op = null + else + last_op = op # store for next push_op + end + + # prepare next current + after_point = null + current = null + end + + fun push_digit( digit : Int ) + do + var current = current + if current == null then current = 0.0 + + var after_point = after_point + if after_point == null then + current = current * 10.0 + digit.to_f + else + current = current + digit.to_f * 10.0.pow(after_point.to_f) + self.after_point -= 1 + end + + self.current = current + end + + fun switch_to_decimals + do + if self.current == null then current = 0.0 + if after_point != null then return + + after_point = -1 + end + + fun apply_last_op_if_any + do + var op = last_op + + var result = result + if result == null then result = 0.0 + + var current = current + if current == null then current = 0.0 + + if op == null then + result = current + else if op == '+' then + result = result + current + else if op == '-' then + result = result - current + else if op == '/' then + result = result / current + else if op == '*' then + result = result * current + end + self.result = result + self.current = null + end +end + +class CalculatorGui + super GtkCallable + + var win : GtkWindow + var container : GtkGrid + + var lbl_disp : GtkLabel + var but_eq : GtkButton + var but_dot : GtkButton + + var context = new CalculatorContext + + redef fun signal( sender, user_data ) + do + var after_point = context.after_point + if after_point == null then + after_point = 0 + else + after_point = (after_point.abs) + end + + if user_data isa Char then # is an operation + var c = user_data + if c == '.' then + but_dot.sensitive= false + context.switch_to_decimals + lbl_disp.text = "{context.current.to_i}." + else + but_dot.sensitive= true + context.push_op( c ) + + var s = context.result.to_precision_native(6) + var index : nullable Int = null + for i in s.length.times do + var chiffre = s.chars[i] + if chiffre == '0' and index == null then + index = i + else if chiffre != '0' then + index = null + end + end + if index != null then + s = s.substring(0, index) + if s.chars[s.length-1] == ',' then s = s.substring(0, s.length-1) + end + lbl_disp.text = s + end + else if user_data isa Int then # is a number + var n = user_data + context.push_digit( n ) + lbl_disp.text = context.current.to_precision_native(after_point) + end + end + + init + do + init_gtk + + win = new GtkWindow( 0 ) + + container = new GtkGrid(5,5,true) + win.add( container ) + + lbl_disp = new GtkLabel( "_" ) + container.attach( lbl_disp, 0, 0, 5, 1 ) + + # digits + for n in [0..9] do + var but = new GtkButton.with_label( n.to_s ) + but.request_size( 64, 64 ) + but.signal_connect( "clicked", self, n ) + if n == 0 then + container.attach( but, 0, 4, 1, 1 ) + else container.attach( but, (n-1)%3, 3-(n-1)/3, 1, 1 ) + end + + # operators + var r = 1 + for op in ['+', '-', '*', '/' ] do + var but = new GtkButton.with_label( op.to_s ) + but.request_size( 64, 64 ) + but.signal_connect( "clicked", self, op ) + container.attach( but, 3, r, 1, 1 ) + r+=1 + end + + # = + but_eq = new GtkButton.with_label( "=" ) + but_eq.request_size( 64, 64 ) + but_eq.signal_connect( "clicked", self, '=' ) + container.attach( but_eq, 4, 3, 1, 2 ) + + # . + but_dot = new GtkButton.with_label( "." ) + but_dot.request_size( 64, 64 ) + but_dot.signal_connect( "clicked", self, '.' ) + container.attach( but_dot, 1, 4, 1, 1 ) + + #C + var but_c = new GtkButton.with_label( "C" ) + but_c.request_size( 64, 64 ) + but_c.signal_connect("clicked", self, 'C') + container.attach( but_c, 2, 4, 1, 1 ) + + win.show_all + end +end + +# context tests +var context = new CalculatorContext +context.push_digit( 1 ) +context.push_digit( 2 ) +context.push_op( '+' ) +context.push_digit( 3 ) +context.push_op( '*' ) +context.push_digit( 2 ) +context.push_op( '=' ) +var r = context.result.to_precision( 2 ) +assert r == "30.00" else print r + +context = new CalculatorContext +context.push_digit( 1 ) +context.push_digit( 4 ) +context.switch_to_decimals +context.push_digit( 1 ) +context.push_op( '*' ) +context.push_digit( 3 ) +context.push_op( '=' ) +r = context.result.to_precision( 2 ) +assert r == "42.30" else print r + +context.push_op( '+' ) +context.push_digit( 1 ) +context.push_digit( 1 ) +context.push_op( '=' ) +r = context.result.to_precision( 2 ) +assert r == "53.30" else print r + +context = new CalculatorContext +context.push_digit( 4 ) +context.push_digit( 2 ) +context.switch_to_decimals +context.push_digit( 3 ) +context.push_op( '/' ) +context.push_digit( 3 ) +context.push_op( '=' ) +r = context.result.to_precision( 2 ) +assert r == "14.10" else print r + +#test multiple decimals +context = new CalculatorContext +context.push_digit( 5 ) +context.push_digit( 0 ) +context.switch_to_decimals +context.push_digit( 1 ) +context.push_digit( 2 ) +context.push_digit( 3 ) +context.push_op( '+' ) +context.push_digit( 1 ) +context.push_op( '=' ) +r = context.result.to_precision( 3 ) +assert r == "51.123" else print r + +#test 'C' button +context = new CalculatorContext +context.push_digit( 1 ) +context.push_digit( 0 ) +context.push_op( '+' ) +context.push_digit( 1 ) +context.push_digit( 0 ) +context.push_op( '=' ) +context.push_op( 'C' ) +r = context.result.to_precision( 1 ) +assert r == "0.0" else print r + +# graphical application + +if "NIT_TESTING".environ != "true" then + var app = new CalculatorGui + run_gtk +end +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2013 Matthieu Lucas <lucasmatthieu@gmail.com> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This sample has been implemented to show you how simple is it to play +# with native callbacks (C) through an high level with NIT program. + +module callback_chimpanze +import callback_monkey + +class Chimpanze + super MonkeyActionCallable + + fun create + do + var monkey = new Monkey + print "Hum, I'm sleeping ..." + # Invoking method which will take some time to compute, and + # will be back in wokeUp method with information. + # - Callback method defined in MonkeyActionCallable Interface + monkey.wokeUpAction(self, "Hey, I'm awake.") + end + + # Inherit callback method, defined by MonkeyActionCallable interface + # - Back of wokeUpAction method + redef fun wokeUp( sender:Monkey, message:Object ) + do + print message + end +end + +var m = new Chimpanze +m.create +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2013 Matthieu Lucas <lucasmatthieu@gmail.com> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This sample has been implemented to show you how simple is it to play +# with native callbacks (C) through an high level with NIT program. + +module callback_monkey + +in "C header" `{ + #include <stdio.h> + #include <stdlib.h> + + typedef struct { + int id; + int age; + } CMonkey; + + typedef struct { + MonkeyActionCallable toCall; + Object message; + } MonkeyAction; +`} + +in "C body" `{ + // Method which reproduce a callback answer + // Please note that a function pointer is only used to reproduce the callback + void cbMonkey(CMonkey *mkey, void callbackFunc(CMonkey*, MonkeyAction*), MonkeyAction *data) + { + sleep(2); + callbackFunc( mkey, data ); + } + + // Back of background treatment, will be redirected to callback function + void nit_monkey_callback_func( CMonkey *mkey, MonkeyAction *data ) + { + // To call a your method, the signature must be written like this : + // <Interface Name>_<Method>... + MonkeyActionCallable_wokeUp( data->toCall, mkey, data->message ); + } +`} + +# Implementable interface to get callback in defined methods +interface MonkeyActionCallable + fun wokeUp( sender:Monkey, message: Object) is abstract +end + +# Defining my object type Monkey, which is, in a low level, a pointer to a C struct (CMonkey) +extern class Monkey `{ CMonkey * `} + + new `{ + CMonkey *monkey = malloc( sizeof(CMonkey) ); + monkey->age = 10; + monkey->id = 1; + return monkey; + `} + + # Object method which will get a callback in wokeUp method, defined in MonkeyActionCallable interface + # Must be defined as Nit/C method because of C call inside + fun wokeUpAction( toCall: MonkeyActionCallable, message: Object ) is extern import MonkeyActionCallable.wokeUp `{ + + // Allocating memory to keep reference of received parameters : + // - Object receiver + // - Message + MonkeyAction *data = malloc( sizeof(MonkeyAction) ); + + // Incrementing reference counter to prevent from releasing + MonkeyActionCallable_incr_ref( toCall ); + Object_incr_ref( message ); + + data->toCall = toCall; + data->message = message; + + // Calling method which reproduce a callback by passing : + // - Receiver + // - Function pointer to object return method + // - Datas + cbMonkey( recv, &nit_monkey_callback_func, data ); + `} +end +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Implementation of circular lists +# This example shows the usage of generics and somewhat a specialisation of collections. +module circular_list + +# Sequences of elements implemented with a double-linked circular list +class CircularList[E] + # Like standard Array or LinkedList, CircularList is a Sequence. + super Sequence[E] + + # The first node of the list if any + # The special case of an empty list is handled by a null node + private var node: nullable CLNode[E] = null + + redef fun iterator do return new CircularListIterator[E](self) + + redef fun first do return self.node.item + + redef fun push(e) + do + var new_node = new CLNode[E](e) + var n = self.node + if n == null then + # the first node + self.node = new_node + else + # not the first one, so attach nodes correctly. + var old_last_node = n.prev + new_node.next = n + new_node.prev = old_last_node + old_last_node.next = new_node + n.prev = new_node + end + end + + redef fun pop + do + var n = self.node + assert n != null + var prev = n.prev + if prev == n then + # the only node + self.node = null + return n.item + end + # not the only one do detach nodes correctly. + var prev_prev = prev.prev + n.prev = prev_prev + prev_prev.next = n + return prev.item + end + + redef fun unshift(e) + do + # Circularity has benefits. + push(e) + self.node = self.node.prev + end + + redef fun shift + do + # Circularity has benefits. + self.node = self.node.next + return self.pop + end + + # Move the first at the last position, the second at the first, etc. + fun rotate + do + var n = self.node + if n == null then return + self.node = n.next + end + + # Sort the list using the Josephus algorithm. + fun josephus(step: Int) + do + var res = new CircularList[E] + while not self.is_empty do + # count 'step' + for i in [1..step[ do self.rotate + # kill + var x = self.shift + res.add(x) + end + self.node = res.node + end +end + +# Nodes of a CircularList +private class CLNode[E] + # The current item + var item: E + + # The next item in the circular list. + # Because of circularity, there is always a next; + # so by default let it be self + var next: CLNode[E] = self + + # The previous item in the circular list. + # Coherence between next and previous nodes has to be maintained by the + # circular list. + var prev: CLNode[E] = self +end + +# An iterator of a CircularList. +private class CircularListIterator[E] + super IndexedIterator[E] + + redef var index: Int + + # The current node pointed. + # Is null if the list is empty. + var node: nullable CLNode[E] + + # The list iterated. + var list: CircularList[E] + + redef fun is_ok + do + # Empty lists are not OK. + # Pointing again the first node is not OK. + return self.node != null and (self.index == 0 or self.node != self.list.node) + end + + redef fun next + do + self.node = self.node.next + self.index += 1 + end + + redef fun item do return self.node.item + + init(list: CircularList[E]) + do + self.node = list.node + self.list = list + self.index = 0 + end +end + +var i = new CircularList[Int] +i.add_all([1, 2, 3, 4, 5, 6, 7]) +print i.first +print i.join(":") + +i.push(8) +print i.shift +print i.pop +i.unshift(0) +print i.join(":") + +i.josephus(3) +print i.join(":") +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This module beef up the clock module by allowing a clock to be comparable. +# It show the usage of class refinement +module clock_more + +import clock + +redef class Clock + # Clock are now comparable + super Comparable + + # Comparaison of a clock make only sense with an other clock + redef type OTHER: Clock + + redef fun <(o) + do + # Note: < is the only abstract method of Comparable. + # All other operators and methods rely on < and ==. + return self.total_minutes < o.total_minutes + end +end + +var c1 = new Clock(8, 12) +var c2 = new Clock(8, 13) +var c3 = new Clock(9, 13) + +print "{c1}<{c2}? {c1<c2}" +print "{c1}<={c2}? {c1<=c2}" +print "{c1}>{c2}? {c1>c2}" +print "{c1}>={c2}? {c1>=c2}" +print "{c1}<=>{c2}? {c1<=>c2}" +print "{c1},{c2}? max={c1.max(c2)} min={c1.min(c2)}" +print "{c1}.is_between({c2}, {c3})? {c1.is_between(c2, c3)}" +print "{c2}.is_between({c1}, {c3})? {c2.is_between(c1, c3)}" + +print "-" + +c1.minutes += 1 + +print "{c1}<{c2}? {c1<c2}" +print "{c1}<={c2}? {c1<=c2}" +print "{c1}>{c2}? {c1>c2}" +print "{c1}>={c2}? {c1>=c2}" +print "{c1}<=>{c2}? {c1<=>c2}" +print "{c1},{c2}? max={c1.max(c2)} min={c1.min(c2)}" +print "{c1}.is_between({c2}, {c3})? {c1.is_between(c2, c3)}" +print "{c2}.is_between({c1}, {c3})? {c2.is_between(c1, c3)}" +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This module provide a simple wall clock. +# It is an example of getters and setters. +# A beefed-up module is available in clock_more +module clock + +# A simple wall clock with 60 minutes and 12 hours. +class Clock + # total number of minutes from 0 to 719 + var total_minutes: Int + # Note: only the read acces is public, the write access is private. + + # number of minutes in the current hour (from 0 to 59) + fun minutes: Int do return self.total_minutes % 60 + + # set the number of minutes in the current hour. + # if m < 0 or m >= 60, the hour will be changed accordinlgy + fun minutes=(m: Int) do self.total_minutes = self.hours * 60 + m + + # number of hours (from 0 to 11) + fun hours: Int do return self.total_minutes / 60 + + # set the number of hours + # the minutes will not be updated + fun hours=(h: Int) do self.total_minutes = h * 60 + minutes + + # the position of the hour arrow in the [0..60[ interval + fun hour_pos: Int do return total_minutes / 12 + + # replace the arrow of hours (from 0 to 59). + # the hours and the minutes will be updated. + fun hour_pos=(h: Int) do self.total_minutes = h * 12 + + redef fun to_s do return "{hours}:{minutes}" + + fun reset(hours, minutes: Int) do self.total_minutes = hours*60 + minutes + + init(hours, minutes: Int) do self.reset(hours, minutes) + + redef fun ==(o) + do + # Note: o is a nullable Object, a type test is required + # Thanks to adaptive typing, there is no downcast + # i.e. the code is safe! + return o isa Clock and self.total_minutes == o.total_minutes + end +end + +var c = new Clock(10,50) +print "It's {c} o'clock." + +c.minutes += 22 +print "Now it's {c} o'clock." + +print "The short arrow in on the {c.hour_pos/5} and the long arrow in on the {c.minutes/5}." + +c.hours -= 2 +print "Now it's {c} o'clock." + +var c2 = new Clock(9, 11) +print "It's {c2} on the second clock." +print "The two clocks are synchronized: {c == c2}." +c2.minutes += 1 +print "It's now {c2} on the second clock." +print "The two clocks are synchronized: {c == c2}." +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2013 Matthieu Lucas <lucasmatthieu@gmail.com> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Sample of the Curl module. +module curl_http + +import curl + +# Small class to represent an Http Fetcher +class MyHttpFetcher + super CurlCallbacks + + var curl: Curl + var our_body: String = "" + + init(curl: Curl) do self.curl = curl + + # Release curl object + fun destroy do self.curl.destroy + + # Header callback + redef fun header_callback(line: String) do + # We keep this callback silent for testing purposes + #if not line.has_prefix("Date:") then print "Header_callback : {line}" + end + + # Body callback + redef fun body_callback(line: String) do self.our_body = "{self.our_body}{line}" + + # Stream callback - Cf : No one is registered + redef fun stream_callback(buffer: String, size: Int, count: Int) do print "Stream_callback : {buffer} - {size} - {count}" +end + + +# Program +if args.length < 2 then + print "Usage: curl_http <method wished [POST, GET, GET_FILE]> <target url>" +else + var curl = new Curl + var url = args[1] + var request = new CurlHTTPRequest(url, curl) + + # HTTP Get Request + if args[0] == "GET" then + request.verbose = false + var getResponse = request.execute + + if getResponse isa CurlResponseSuccess then + print "Status code : {getResponse.status_code}" + print "Body : {getResponse.body_str}" + else if getResponse isa CurlResponseFailed then + print "Error code : {getResponse.error_code}" + print "Error msg : {getResponse.error_msg}" + end + + # HTTP Post Request + else if args[0] == "POST" then + var myHttpFetcher = new MyHttpFetcher(curl) + request.delegate = myHttpFetcher + + var postDatas = new HeaderMap + postDatas["Bugs Bunny"] = "Daffy Duck" + postDatas["Batman"] = "Robin likes special characters @#ùà!è§'(\"é&://,;<>∞~*" + postDatas["Batman"] = "Yes you can set multiple identical keys, but APACHE will consider only once, the last one" + request.datas = postDatas + request.verbose = false + var postResponse = request.execute + + print "Our body from the callback : {myHttpFetcher.our_body}" + + if postResponse isa CurlResponseSuccess then + print "*** Answer ***" + print "Status code : {postResponse.status_code}" + print "Body should be empty, because we decided to manage callbacks : {postResponse.body_str.length}" + else if postResponse isa CurlResponseFailed then + print "Error code : {postResponse.error_code}" + print "Error msg : {postResponse.error_msg}" + end + + # HTTP Get to file Request + else if args[0] == "GET_FILE" then + var headers = new HeaderMap + headers["Accept"] = "Moo" + request.headers = headers + request.verbose = false + var downloadResponse = request.download_to_file(null) + + if downloadResponse isa CurlFileResponseSuccess then + print "*** Answer ***" + print "Status code : {downloadResponse.status_code}" + print "Size downloaded : {downloadResponse.size_download}" + else if downloadResponse isa CurlResponseFailed then + print "Error code : {downloadResponse.error_code}" + print "Error msg : {downloadResponse.error_msg}" + end + # Program logic + else + print "Usage : Method[POST, GET, GET_FILE]" + end +end +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2013 Matthieu Lucas <lucasmatthieu@gmail.com> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Mail sender sample using the Curl module +module curl_mail + +import curl + +var curl = new Curl +var mail_request = new CurlMailRequest(curl) + +# Networks +var response = mail_request.set_outgoing_server("smtps://smtp.example.org:465", "user@example.org", "mypassword") +if response isa CurlResponseFailed then + print "Error code : {response.error_code}" + print "Error msg : {response.error_msg}" +end + +# Headers +mail_request.from = "Billy Bob" +mail_request.to = ["user@example.org"] +mail_request.cc = ["bob@example.org"] +mail_request.bcc = null + +var headers_body = new HeaderMap +headers_body["Content-Type:"] = "text/html; charset=\"UTF-8\"" +headers_body["Content-Transfer-Encoding:"] = "quoted-printable" +mail_request.headers_body = headers_body + +# Content +mail_request.body = "<h1>Here you can write HTML stuff.</h1>" +mail_request.subject = "Hello From My Nit Program" + +# Others +mail_request.verbose = false + +# Send mail +response = mail_request.execute +if response isa CurlResponseFailed then + print "Error code : {response.error_code}" + print "Error msg : {response.error_msg}" +else if response isa CurlMailResponseSuccess then + print "Mail Sent" +else + print "Unknown Curl Response type" +end +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012-2013 Alexis Laferrière <alexis.laf@xymus.net> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Draws an arithmetic operation to the terminal +module draw_operation + +redef enum Int + fun n_chars: Int `{ + int c; + if ( abs(recv) >= 10 ) + c = 1+(int)log10f( (float)abs(recv) ); + else + c = 1; + if ( recv < 0 ) c ++; + return c; + `} +end + +redef enum Char + fun as_operator(a, b: Int): Int + do + if self == '+' then return a + b + if self == '-' then return a - b + if self == '*' then return a * b + if self == '/' then return a / b + if self == '%' then return a % b + abort + end + + fun override_dispc: Bool + do + return self == '+' or self == '-' or self == '*' or self == '/' or self == '%' + end + + fun lines(s: Int): Array[Line] + do + if self == '+' then + return [new Line(new P(0,s/2),1,0,s), new Line(new P(s/2,1),0,1,s-2)] + else if self == '-' then + return [new Line(new P(0,s/2),1,0,s)] + else if self == '*' then + var lines = new Array[Line] + for y in [1..s-1[ do + lines.add( new Line(new P(1,y), 1,0,s-2) ) + end + return lines + else if self == '/' then + return [new Line(new P(s-1,0), -1,1, s )] + else if self == '%' then + var q4 = s/4 + var lines = [new Line(new P(s-1,0),-1,1,s)] + for l in [0..q4[ do + lines.append([ new Line( new P(0,l), 1,0,q4), new Line( new P(s-1,s-1-l), -1,0,q4) ]) + end + return lines + else if self == '1' then + return [new Line(new P(s/2,0), 0,1,s),new Line(new P(0,s-1),1,0,s), + new Line( new P(s/2,0),-1,1,s/2)] + else if self == '2' then + return [new Line(new P(0,0), 1,0,s),new Line(new P(s-1,0),0,1,s/2), + new Line( new P(0,s-1),1,0,s), new Line( new P(0,s/2), 0,1,s/2), + new Line( new P(0,s/2), 1,0,s)] + else if self == '3' then + return [new Line(new P(0,0), 1,0,s),new Line(new P(s-1,0),0,1,s), + new Line( new P(0,s-1),1,0,s), new Line( new P(0,s/2), 1,0,s)] + else if self == '4' then + return [new Line(new P(s-1,0),0,1,s), new Line( new P(0,0), 0,1,s/2), + new Line( new P(0,s/2), 1,0,s)] + else if self == '5' then + return [new Line(new P(0,0), 1,0,s),new Line(new P(s-1,s/2),0,1,s/2), + new Line( new P(0,s-1),1,0,s), new Line( new P(0,0), 0,1,s/2), + new Line( new P(0,s/2), 1,0,s)] + else if self == '6' then + return [new Line(new P(0,0), 1,0,s),new Line(new P(s-1,s/2),0,1,s/2), + new Line( new P(0,s-1),1,0,s), new Line( new P(0,0), 0,1,s), + new Line( new P(0,s/2), 1,0,s)] + else if self == '7' then + var tl = new P(0,0) + var tr = new P(s-1,0) + return [new Line(tl, 1,0,s), new Line(tr,-1,1,s)] + else if self == '8' then + return [new Line(new P(0,0), 1,0,s),new Line(new P(s-1,0),0,1,s), + new Line( new P(0,s-1),1,0,s), new Line( new P(0,0), 0,1,s), + new Line( new P(0,s/2), 1,0,s)] + else if self == '9' then + return [new Line(new P(0,0), 1,0,s),new Line(new P(s-1,0),0,1,s), + new Line( new P(0,s-1),1,0,s), new Line( new P(0,0), 0,1,s/2), + new Line( new P(0,s/2), 1,0,s)] + else if self == '0' then + return [new Line(new P(0,0), 1,0,s),new Line(new P(s-1,0),0,1,s), + new Line( new P(0,s-1),1,0,s), new Line( new P(0,0), 0,1,s)] + end + return new Array[Line] + end +end + +class P + var x : Int + var y : Int +end + +redef class String + # hack is to support a bug in the evaluation software + fun draw(dispc: Char, size, gap: Int, hack: Bool) + do + var w = size * length +(length-1)*gap + var h = size + var map = new Array[Array[Char]] + for x in [0..w[ do + map[x] = new Array[Char].filled_with( ' ', h ) + end + + var ci = 0 + for c in self.chars do + var local_dispc + if c.override_dispc then + local_dispc = c + else + local_dispc = dispc + end + + var lines = c.lines( size ) + for line in lines do + var x = line.o.x+ci*size + x += ci*gap + var y = line.o.y + for s in [0..line.len[ do + assert map.length > x and map[x].length > y else print "setting {x},{y} as {local_dispc}" + map[x][y] = local_dispc + x += line.step_x + y += line.step_y + end + end + + ci += 1 + end + + if hack then + for c in [0..size[ do + map[c][0] = map[map.length-size+c][0] + map[map.length-size+c][0] = ' ' + end + end + + for y in [0..h[ do + for x in [0..w[ do + printn map[x][y] + end + print "" + end + end +end + +class Line + var o : P + var step_x : Int + var step_y : Int + var len : Int +end + +var a +var b +var op_char +var disp_char +var disp_size +var disp_gap + +if "NIT_TESTING".environ == "true" then + a = 567 + b = 13 + op_char = '*' + disp_char = 'O' + disp_size = 8 + disp_gap = 1 +else + printn "Left operand: " + a = gets.to_i + + printn "Right operand: " + b = gets.to_i + + printn "Operator (+, -, *, /, %): " + op_char = gets.chars[0] + + printn "Char to display: " + disp_char = gets.chars[0] + + printn "Size of text: " + disp_size = gets.to_i + + printn "Space between digits: " + disp_gap = gets.to_i +end + +var result = op_char.as_operator( a, b ) + +var len_a = a.n_chars +var len_b = b.n_chars +var len_res = result.n_chars +var max_len = len_a.max( len_b.max( len_res ) ) + 1 + +# draw first line +var d = max_len - len_a +var line_a = "" +for i in [0..d[ do line_a += " " +line_a += a.to_s +line_a.draw( disp_char, disp_size, disp_gap, false ) + +print "" +# draw second line +d = max_len - len_b-1 +var line_b = op_char.to_s +for i in [0..d[ do line_b += " " +line_b += b.to_s +line_b.draw( disp_char, disp_size, disp_gap, false ) + +# draw ----- +print "" +for i in [0..disp_size*max_len+(max_len-1)*disp_gap] do + printn "_" +end +print "" +print "" + +# draw result +d = max_len - len_res +var line_res = "" +for i in [0..d[ do line_res += " " +line_res += result.to_s +line_res.draw( disp_char, disp_size, disp_gap, false ) +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2013 Alexis Laferrière <alexis.laf@xymus.net> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Example using the privileges module to drop privileges from root +module drop_privileges + +import privileges + +# basic command line options +var opts = new OptionContext +var opt_ug = new OptionUserAndGroup.for_dropping_privileges +opt_ug.mandatory = true +opts.add_option(opt_ug) + +# parse and check command line options +opts.parse(args) +if not opts.errors.is_empty then + print opts.errors + print "Usage: drop_privileges [options]" + opts.usage + exit 1 +end + +# original user +print "before {sys.uid}:{sys.gid}" + +# make the switch +var user_group = opt_ug.value +assert user_group != null +user_group.drop_privileges + +# final user +print "after {sys.uid}:{sys.egid}" +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012-2013 Alexis Laferrière <alexis.laf@xymus.net> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This module illustrates some uses of the FFI, specifically +# how to use extern methods. Which means to implement a Nit method in C. +module extern_methods + +redef enum Int + # Returns self'th fibonnaci number + # implemented here in C for optimization purposes + fun fib : Int import fib `{ + if ( recv < 2 ) + return recv; + else + return Int_fib( recv-1 ) + Int_fib( recv-2 ); + `} + + # System call to sleep for "self" seconds + fun sleep `{ + sleep( recv ); + `} + + # Return atan2l( self, x ) from libmath + fun atan_with( x : Int ) : Float `{ + return atan2( recv, x ); + `} + + # This method callback to Nit methods from C code + # It will use from C code: + # * the local fib method + # * the + operator, a method of Int + # * to_s, a method of all objects + # * String.to_cstring, a method of String to return an equivalent char* + fun foo import fib, +, to_s, String.to_cstring `{ + long recv_fib = Int_fib( recv ); + long recv_plus_fib = Int__plus( recv, recv_fib ); + + String nit_string = Int_to_s( recv_plus_fib ); + char *c_string = String_to_cstring( nit_string ); + + printf( "from C: self + fib(self) = %s\n", c_string ); + `} + + # Equivalent to foo but written in pure Nit + fun bar do print "from Nit: self + fib(self) = {self+self.fib}" +end + +print 12.fib + +print "sleeping 1 second..." +1.sleep + +print 100.atan_with( 200 ) +8.foo +8.bar + +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2004-2008 Jean Privat <jean@pryen.org> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A simple exemple of refinement where a method is added to the integer class. +module fibonacci + +redef class Int + # Calculate the self-th element of the fibonacci sequence. + fun fibonacci: Int + do + if self < 2 then + return 1 + else + return (self-2).fibonacci + (self-1).fibonacci + end + end +end + +# Print usage and exit. +fun usage +do + print "Usage: fibonnaci <integer>" + exit 0 +end + +# Main part +if args.length != 1 then + usage +end +print args.first.to_i.fibonacci +print "hello world" +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import html + +class NitHomepage + super HTMLPage + + redef fun head do + add("meta").attr("charset", "utf-8") + add("title").text("Nit") + add("link").attr("rel", "icon").attr("href", "http://nitlanguage.org/favicon.ico").attr("type", "image/x-icon") + add("link").attr("rel", "stylesheet").attr("href", "http://nitlanguage.org/style.css").attr("type", "text/css") + add("link").attr("rel", "stylesheet").attr("href", "http://nitlanguage.org/local.css").attr("type", "text/css") + end + + redef fun body do + open("article").add_class("page") + open("section").add_class("pageheader") + add_html("<a id='toptitle_first' class='toptitle'>the</a><a id='toptitle_second' class='toptitle' href=''>Nit</a><a id='toptitle_third' class='toptitle' href=''>Programming Language</a>") + open("header").add_class("header") + open("div").add_class("topsubtitle") + add("p").text("A Fun Language for Serious Programming") + close("div") + close("header") + close("section") + + open("div").attr("id", "pagebody") + open("section").attr("id", "content") + add("h1").text("# What is Nit?") + add("p").text("Nit is an object-oriented programming language. The goal of Nit is to propose a robust statically typed programming language where structure is not a pain.") + add("p").text("So, what does the famous hello world program look like, in Nit?") + add_html("<pre><tt><span class='normal'>print </span><span class='string'>'Hello, World!'</span></tt></pre>") + + add("h1").text("# Feature Highlights") + add("h2").text("Usability") + add("p").text("Nit's goal is to be usable by real programmers for real projects") + + open("ul") + open("li") + add("a").attr("href", "http://en.wikipedia.org/wiki/KISS_principle").text("KISS principle") + close("li") + add("li").text("Script-like language without verbosity nor cryptic statements") + add("li").text("Painless static types: static typing should help programmers") + add("li").text("Efficient development, efficient execution, efficient evolution.") + close("ul") + + add("h2").text("Robustness") + add("p").text("Nit will help you to write bug-free programs") + + open("ul") + add("li").text("Strong static typing") + add("li").text("No more NullPointerException") + close("ul") + + add("h2").text("Object-Oriented") + add("p").text("Nit's guideline is to follow the most powerful OO principles") + + open("ul") + open("li") + add("a").attr("href", "./everything_is_an_object/").text("Everything is an object") + close("li") + open("li") + add("a").attr("href", "./multiple_inheritance/").text("Multiple inheritance") + close("li") + open("li") + add("a").attr("href", "./refinement/").text("Open classes") + close("li") + open("li") + add("a").attr("href", "./virtual_types/").text("Virtual types") + close("li") + close("ul") + + + add("h1").text("# Getting Started") + add("p").text("Get Nit from its Git repository:") + + add_html("<pre><code>$ git clone http://nitlanguage.org/nit.git</code></pre>") + add("p").text("Build the compiler (may be long):") + add_html("<pre><code>$ cd nit\n") + add_html("$ make</code></pre>") + add("p").text("Compile a program:") + add_html("<pre><code>$ bin/nitc examples/hello_world.nit</code></pre>") + add("p").text("Execute the program:") + add_html("<pre><code>$ ./hello_world</code></pre>") + close("section") + close("div") + close("article") + end +end + +var page = new NitHomepage +page.write_to stdout +page.write_to_file("nit.html") +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# An example that defines and uses stacks of integers. +# The implementation is done with a simple linked list. +# It features: free constructors, nullable types and some adaptive typing. +module int_stack + +# A stack of integer implemented by a simple linked list. +# Note that this is only a toy class since a real linked list will gain to use +# generics and extends interfaces, like Collection, from the standard library. +class IntStack + # The head node of the list. + # Null means that the stack is empty. + private var head: nullable ISNode = null + + # Add a new integer in the stack. + fun push(val: Int) + do + self.head = new ISNode(val, self.head) + end + + # Remove and return the last pushed integer. + # Return null if the stack is empty. + fun pop: nullable Int + do + var head = self.head + if head == null then return null + # Note: the followings are statically safe because of the + # previous 'if'. + var val = head.val + self.head = head.next + return val + end + + # Return the sum of all integers of the stack. + # Return 0 if the stack is empty. + fun sumall: Int + do + var sum = 0 + var cur = self.head + while cur != null do + # Note: the followings are statically safe because of + # the condition of the 'while'. + sum += cur.val + cur = cur.next + end + return sum + end + + # Note: Because all attributes have a default value, a free constructor + # "init()" is implicitly defined. +end + +# A node of a IntStack +private class ISNode + # The integer value stored in the node. + var val: Int + + # The next node, if any. + var next: nullable ISNode + + # Note: A free constructor "init(val: Int, next: nullable ISNode)" is + # implicitly defined. +end + +var l = new IntStack +l.push(1) +l.push(2) +l.push(3) + +print l.sumall + +# Note: the 'for' control structure cannot be used on IntStack in its current state. +# It requires a more advanced topic. +# However, why not using the 'loop' control structure? +loop + var i = l.pop + if i == null then break + # The following is statically safe because of the previous 'if'. + print i * 10 +end + +# Note: 'or else' is used to give an alternative of a null expression. +l.push(5) +print l.pop or else 0 # l.pop gives 5, so print 5 +print l.pop or else 0 # l.pop gives null, so print the alternative: 0 + + +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2014 Alexis Laferrière <alexis.laf@xymus.net> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Basic example of OpenGL ES 2.0 usage from the book OpenGL ES 2.0 Programming Guide. +# +# Code reference: +# https://code.google.com/p/opengles-book-samples/source/browse/trunk/LinuxX11/Chapter_2/Hello_Triangle/Hello_Triangle.c +module opengles2_hello_triangle + +import glesv2 +import egl +import mnit_linux # for sdl +import x11 + +if "NIT_TESTING".environ == "true" then exit(0) + +var window_width = 800 +var window_height = 600 + +# +## SDL +# +var sdl_display = new SDLDisplay(window_width, window_height) +var sdl_wm_info = new SDLSystemWindowManagerInfo +var x11_window_handle = sdl_wm_info.x11_window_handle + +# +## X11 +# +var x_display = x_open_default_display +assert x_display != 0 else print "x11 fail" + +# +## EGL +# +var egl_display = new EGLDisplay(x_display) +assert egl_display.is_valid else print "EGL display is not valid" +egl_display.initialize + +print "EGL version: {egl_display.version}" +print "EGL vendor: {egl_display.vendor}" +print "EGL extensions: {egl_display.extensions.join(", ")}" +print "EGL client APIs: {egl_display.client_apis.join(", ")}" + +assert egl_display.is_valid else print egl_display.error + +var config_chooser = new EGLConfigChooser +#config_chooser.surface_type_egl +config_chooser.blue_size = 8 +config_chooser.green_size = 8 +config_chooser.red_size = 8 +#config_chooser.alpha_size = 8 +#config_chooser.depth_size = 8 +#config_chooser.stencil_size = 8 +#config_chooser.sample_buffers = 1 +config_chooser.close + +var configs = config_chooser.choose(egl_display) +assert configs != null else print "choosing config failed: {egl_display.error}" +assert not configs.is_empty else print "no EGL config" + +print "{configs.length} EGL configs available" +for config in configs do + var attribs = config.attribs(egl_display) + print "* caveats: {attribs.caveat}" + print " conformant to: {attribs.conformant}" + print " size of RGBA: {attribs.red_size} {attribs.green_size} {attribs.blue_size} {attribs.alpha_size}" + print " buffer, depth, stencil: {attribs.buffer_size} {attribs.depth_size} {attribs.stencil_size}" +end + +var config = configs.first + +var format = config.attribs(egl_display).native_visual_id + +# TODO android part +# Opengles1Display_midway_init(recv, format); + +var surface = egl_display.create_window_surface(config, x11_window_handle, [0]) +assert surface.is_ok else print egl_display.error + +var context = egl_display.create_context(config) +assert context.is_ok else print egl_display.error + +var make_current_res = egl_display.make_current(surface, surface, context) +assert make_current_res + +var width = surface.attribs(egl_display).width +var height = surface.attribs(egl_display).height +print "Width: {width}" +print "Height: {height}" + +assert egl_bind_opengl_es_api else print "eglBingAPI failed: {egl_display.error}" + +# +## GLESv2 +# + +print "Can compile shaders? {gl_shader_compiler}" +assert_no_gl_error + +assert gl_shader_compiler else print "Cannot compile shaders" + +# gl program +print gl_error.to_s +var program = new GLProgram +if not program.is_ok then + print "Program is not ok: {gl_error.to_s}\nLog:" + print program.info_log + abort +end +assert_no_gl_error + +# vertex shader +var vertex_shader = new GLVertexShader +assert vertex_shader.is_ok else print "Vertex shader is not ok: {gl_error}" +vertex_shader.source = """ +attribute vec4 vPosition; +void main() +{ + gl_Position = vPosition; +} """ +vertex_shader.compile +assert vertex_shader.is_compiled else print "Vertex shader compilation failed with: {vertex_shader.info_log} {program.info_log}" +assert_no_gl_error + +# fragment shader +var fragment_shader = new GLFragmentShader +assert fragment_shader.is_ok else print "Fragment shader is not ok: {gl_error}" +fragment_shader.source = """ +precision mediump float; +void main() +{ + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); +} +""" +fragment_shader.compile +assert fragment_shader.is_compiled else print "Fragment shader compilation failed with: {fragment_shader.info_log}" +assert_no_gl_error + +program.attach_shader vertex_shader +program.attach_shader fragment_shader +program.bind_attrib_location(0, "vPosition") +program.link +assert program.is_linked else print "Linking failed: {program.info_log}" +assert_no_gl_error + +# draw! +var vertices = [0.0, 0.5, 0.0, -0.5, -0.5, 0.0, 0.5, -0.5, 0.0] +var vertex_array = new VertexArray(0, 3, vertices) +vertex_array.attrib_pointer +gl_clear_color(0.5, 0.0, 0.5, 1.0) +for i in [0..10000[ do + printn "." + assert_no_gl_error + gl_viewport(0, 0, width, height) + gl_clear_color_buffer + program.use + vertex_array.enable + vertex_array.draw_arrays_triangles + egl_display.swap_buffers(surface) +end + +# delete +program.delete +vertex_shader.delete +fragment_shader.delete + +# +## EGL +# +# close +egl_display.make_current(new EGLSurface.none, new EGLSurface.none, new EGLContext.none) +egl_display.destroy_context(context) +egl_display.destroy_surface(surface) + +# +## SDL +# +# close +sdl_display.destroy +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2004-2008 Jean Privat <jean@pryen.org> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# How to print arguments of the command line. +module print_arguments + +for a in args do + print a +end +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2004-2008 Jean Privat <jean@pryen.org> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# A procedural program (without explicit class definition). +# This program manipulates arrays of integers. +module procedural_array + +# The sum of the elements of `a'. +# Uses a 'for' control structure. +fun array_sum(a: Array[Int]): Int +do + var sum = 0 + for i in a do + sum = sum + i + end + return sum +end + +# The sum of the elements of `a' (alternative version). +# Uses a 'while' control structure. +fun array_sum_alt(a: Array[Int]): Int +do + var sum = 0 + var i = 0 + while i < a.length do + sum = sum + a[i] + i = i + 1 + end + return sum +end + +# The main part of the program. +var a = [10, 5, 8, 9] +print(array_sum(a)) +print(array_sum_alt(a)) +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2013 Matthieu Lucas <lucasmatthieu@gmail.com> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Client sample using the Socket module which connect to the server sample. +module socket_client + +import socket + +if args.length < 2 then + print "Usage : socket_client <host> <port>" + return +end + +var s = new Socket.client(args[0], args[1].to_i) +print "[HOST ADDRESS] : {s.address}" +print "[HOST] : {s.host}" +print "[PORT] : {s.port}" +print "Connecting ... {s.connected}" +if s.connected then + print "Writing ... Hello server !" + s.write("Hello server !") + print "[Response from server] : {s.read(100)}" + print "Closing ..." + s.close +end +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2013 Matthieu Lucas <lucasmatthieu@gmail.com> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Server sample using the Socket module which allow client to connect +module socket_server + +import socket + +if args.is_empty then + print "Usage : socket_server <port>" + return +end + +var socket = new Socket.server(args[0].to_i, 1) +print "[PORT] : {socket.port.to_s}" + +var clients = new Array[Socket] +var max = socket +loop + var fs = new SocketObserver(true, true, true) + fs.readset.set(socket) + + for c in clients do fs.readset.set(c) + + if fs.select(max, 4, 0) == 0 then + print "Error occured in select {sys.errno.strerror}" + break + end + + if fs.readset.is_set(socket) then + var ns = socket.accept + print "Accepting {ns.address} ... " + print "[Message from {ns.address}] : {ns.read(100)}" + ns.write("Goodbye client.") + print "Closing {ns.address} ..." + ns.close + end +end + +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import template + +### Here, definition of the specific templates + +# The root template for composers +class TmplComposers + super Template + + # Short list of composers + var composers = new Array[TmplComposer] + + # Detailled list of composers + var composer_details = new Array[TmplComposerDetail] + + # Add a composer in both lists + fun add_composer(firstname, lastname: String, birth, death: Int) + do + composers.add(new TmplComposer(lastname)) + composer_details.add(new TmplComposerDetail(firstname, lastname, birth, death)) + end + + redef fun rendering do + add """ +COMPOSERS +========= +""" + add_all composers + add """ + +DETAILS +======= +""" + add_all composer_details + end +end + +# A composer in the short list of composers +class TmplComposer + super Template + + # Short name + var name: String + + init(name: String) do self.name = name + + redef fun rendering do add "- {name}\n" +end + +# A composer in the detailled list of composers +class TmplComposerDetail + super Template + + var firstname: String + var lastname: String + var birth: Int + var death: Int + + init(firstname, lastname: String, birth, death: Int) do + self.firstname = firstname + self.lastname = lastname + self.birth = birth + self.death = death + end + + redef fun rendering do add """ + +COMPOSER: {{{firstname}}} {{{lastname}}} +BIRTH...: {{{birth}}} +DEATH...: {{{death}}} +""" + +end + +### Here a simple usage of the templates + +var f = new TmplComposers +f.add_composer("Johann Sebastian", "Bach", 1685, 1750) +f.add_composer("George Frideric", "Handel", 1685, 1759) +f.add_composer("Wolfgang Amadeus", "Mozart", 1756, 1791) +f.write_to(stdout) +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2014 Lucas Bajolet <r4pass@hotmail.com> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Sample module for a minimal chat server using Websockets on port 8088 +module websocket_server + +import websocket + +var sock = new WebSocket(8088, 1) + +var msg: String + +if sock.listener.eof then + print sys.errno.strerror +end + +sock.accept + +while not sock.listener.eof do + if not sock.connected then sock.accept + if sys.stdin.poll_in then + msg = gets + printn "Received message : {msg}" + if msg == "exit" then sock.close + if msg == "disconnect" then sock.disconnect_client + sock.write(msg) + end + if sock.can_read(10) then + msg = sock.read_line + if msg != "" then print msg + end +end + diff --git a/tests/examplefiles/docker.docker b/tests/examplefiles/docker.docker new file mode 100644 index 00000000..d65385b6 --- /dev/null +++ b/tests/examplefiles/docker.docker @@ -0,0 +1,5 @@ +maintainer First O'Last + +run echo \ + 123 $bar +# comment diff --git a/tests/examplefiles/example.cob b/tests/examplefiles/example.cob index 3f65e498..92d2e300 100644 --- a/tests/examplefiles/example.cob +++ b/tests/examplefiles/example.cob @@ -2617,940 +2617,4 @@ GC0710 88 Token-Is-Reserved-Word VALUE " ". *****************************************************************
** Perform all program-wide initialization operations **
*****************************************************************
- 101-Establish-Working-Env.
- MOVE TRIM(Src-Filename,Leading) TO Src-Filename
- ACCEPT Env-TEMP
- FROM ENVIRONMENT "TEMP"
- END-ACCEPT
- ACCEPT Lines-Per-Page-ENV
- FROM ENVIRONMENT "OCXREF_LINES"
- END-ACCEPT
- INSPECT Src-Filename REPLACING ALL "\" BY "/"
- INSPECT Env-TEMP REPLACING ALL "\" BY "/"
- MOVE Src-Filename TO Program-Path
- MOVE Program-Path TO Heading-2
- CALL "C$JUSTIFY"
- USING Heading-2, "Right"
- END-CALL
- MOVE LENGTH(TRIM(Src-Filename,Trailing)) TO I
- MOVE 0 TO J
- PERFORM UNTIL Src-Filename(I:1) = '/'
- OR I = 0
- SUBTRACT 1 FROM I
- ADD 1 TO J
- END-PERFORM
- UNSTRING Src-Filename((I + 1):J) DELIMITED BY "."
- INTO Filename, Dummy
- END-UNSTRING
- STRING TRIM(Env-TEMP,Trailing)
- "/"
- TRIM(Filename,Trailing)
- ".i"
- DELIMITED SIZE
- INTO Expanded-Src-Filename
- END-STRING
- STRING Program-Path(1:I)
- TRIM(Filename,Trailing)
- ".lst"
- DELIMITED SIZE
- INTO Report-Filename
- END-STRING
- IF Lines-Per-Page-ENV NOT = SPACES
- MOVE NUMVAL(Lines-Per-Page-ENV) TO Lines-Per-Page
- ELSE
- MOVE 60 TO Lines-Per-Page
- END-IF
- ACCEPT Todays-Date
- FROM DATE YYYYMMDD
- END-ACCEPT
- MOVE Todays-Date TO H1X-Date
- H1S-Date
- MOVE "????????????..." TO SPI-Current-Program-ID
- MOVE SPACES TO SPI-Current-Verb
- Held-Reference
- MOVE "Y" TO F-First-Record
- .
- /
- 200-Execute-cobc SECTION.
- 201-Build-Cmd.
- STRING "cobc -E "
- TRIM(Program-Path, Trailing)
- " > "
- TRIM(Expanded-Src-Filename,Trailing)
- DELIMITED SIZE
- INTO Cmd
- END-STRING
- CALL "SYSTEM"
- USING Cmd
- END-CALL
- IF RETURN-CODE NOT = 0
- DISPLAY
- "Cross-reference terminated by previous errors"
- UPON SYSERR
- END-DISPLAY
- GOBACK
- END-IF
- .
-
- 209-Exit.
- EXIT
- .
- /
- 300-Tokenize-Source SECTION.
- 301-Driver.
- OPEN INPUT Expand-Code
- MOVE SPACES TO Expand-Code-Rec
- MOVE 256 TO Src-Ptr
- MOVE 0 TO Num-UserNames
- SPI-Current-Line-No
- MOVE "?" TO SPI-Current-Division
-GC0710 MOVE "N" TO F-Verb-Has-Been-Found.
- PERFORM FOREVER
- PERFORM 310-Get-Token
- IF Token-Is-EOF
- EXIT PERFORM
- END-IF
- MOVE UPPER-CASE(SPI-Current-Token)
- TO SPI-Current-Token-UC
- IF Token-Is-Verb
- MOVE SPI-Current-Token-UC TO SPI-Current-Verb
- SPI-Prior-Token
- IF Held-Reference NOT = SPACES
- MOVE Held-Reference TO Sort-Rec
- MOVE SPACES TO Held-Reference
- RELEASE Sort-Rec
- END-IF
- END-IF
- EVALUATE TRUE
- WHEN In-IDENTIFICATION-DIVISION
- PERFORM 320-IDENTIFICATION-DIVISION
- WHEN In-ENVIRONMENT-DIVISION
- PERFORM 330-ENVIRONMENT-DIVISION
- WHEN In-DATA-DIVISION
- PERFORM 340-DATA-DIVISION
- WHEN In-PROCEDURE-DIVISION
- PERFORM 350-PROCEDURE-DIVISION
- END-EVALUATE
- IF Token-Is-Key-Word
- MOVE SPI-Current-Token-UC TO SPI-Prior-Token
- END-IF
- IF F-Token-Ended-Sentence = "Y"
- AND SPI-Current-Division NOT = "I"
- MOVE SPACES TO SPI-Prior-Token
- SPI-Current-Verb
- END-IF
-
- END-PERFORM
- CLOSE Expand-Code
- EXIT SECTION
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 310-Get-Token.
- *>-- Position to 1st non-blank character
- MOVE F-Token-Ended-Sentence TO F-Last-Token-Ended-Sent
- MOVE "N" TO F-Token-Ended-Sentence
- PERFORM UNTIL Expand-Code-Rec(Src-Ptr : 1) NOT = SPACE
- IF Src-Ptr > 255
- READ Expand-Code AT END
- IF Held-Reference NOT = SPACES
- MOVE Held-Reference TO Sort-Rec
- MOVE SPACES TO Held-Reference
- RELEASE Sort-Rec
- END-IF
- SET Token-Is-EOF TO TRUE
- MOVE 0 TO SPI-Current-Line-No
- EXIT PARAGRAPH
- END-READ
- IF ECR-1 = "#"
- PERFORM 311-Control-Record
- ELSE
- PERFORM 312-Expand-Code-Record
- END-IF
- ELSE
- ADD 1 TO Src-Ptr
- END-IF
- END-PERFORM
- *>-- Extract token string
- MOVE Expand-Code-Rec(Src-Ptr : 1) TO SPI-Current-Char
- MOVE Expand-Code-Rec(Src-Ptr + 1: 1) TO SPI-Next-Char
- IF SPI-Current-Char = "."
- ADD 1 TO Src-Ptr
- MOVE SPI-Current-Char TO SPI-Current-Token
- MOVE SPACE TO SPI-Token-Type
- MOVE "Y" TO F-Token-Ended-Sentence
- EXIT PARAGRAPH
- END-IF
- IF Current-Char-Is-Punct
- AND SPI-Current-Char = "="
- AND SPI-Current-Division = "P"
- ADD 1 TO Src-Ptr
- MOVE "EQUALS" TO SPI-Current-Token
- MOVE "K" TO SPI-Token-Type
- EXIT PARAGRAPH
- END-IF
- IF Current-Char-Is-Punct *> So subscripts don't get flagged w/ "*"
- AND SPI-Current-Char = "("
- AND SPI-Current-Division = "P"
- MOVE SPACES TO SPI-Prior-Token
- END-IF
- IF Current-Char-Is-Punct
- ADD 1 TO Src-Ptr
- MOVE SPI-Current-Char TO SPI-Current-Token
- MOVE SPACE TO SPI-Token-Type
- EXIT PARAGRAPH
- END-IF
- IF Current-Char-Is-Quote
- ADD 1 TO Src-Ptr
- UNSTRING Expand-Code-Rec
- DELIMITED BY SPI-Current-Char
- INTO SPI-Current-Token
- WITH POINTER Src-Ptr
- END-UNSTRING
- IF Expand-Code-Rec(Src-Ptr : 1) = "."
- MOVE "Y" TO F-Token-Ended-Sentence
- ADD 1 TO Src-Ptr
- END-IF
- SET Token-Is-Literal-Alpha TO TRUE
- EXIT PARAGRAPH
- END-IF
- IF Current-Char-Is-X AND Next-Char-Is-Quote
- ADD 2 TO Src-Ptr
- UNSTRING Expand-Code-Rec
- DELIMITED BY SPI-Next-Char
- INTO SPI-Current-Token
- WITH POINTER Src-Ptr
- END-UNSTRING
- IF Expand-Code-Rec(Src-Ptr : 1) = "."
- MOVE "Y" TO F-Token-Ended-Sentence
- ADD 1 TO Src-Ptr
- END-IF
- SET Token-Is-Literal-Number TO TRUE
- EXIT PARAGRAPH
- END-IF
- IF Current-Char-Is-Z AND Next-Char-Is-Quote
- ADD 2 TO Src-Ptr
- UNSTRING Expand-Code-Rec
- DELIMITED BY SPI-Next-Char
- INTO SPI-Current-Token
- WITH POINTER Src-Ptr
- END-UNSTRING
- IF Expand-Code-Rec(Src-Ptr : 1) = "."
- MOVE "Y" TO F-Token-Ended-Sentence
- ADD 1 TO Src-Ptr
- END-IF
- SET Token-Is-Literal-Alpha TO TRUE
- EXIT PARAGRAPH
- END-IF
- IF F-Processing-PICTURE = "Y"
- UNSTRING Expand-Code-Rec
- DELIMITED BY ". " OR " "
- INTO SPI-Current-Token
- DELIMITER IN Delim
- WITH POINTER Src-Ptr
- END-UNSTRING
- IF Delim = ". "
- MOVE "Y" TO F-Token-Ended-Sentence
- ADD 1 TO Src-Ptr
- END-IF
- IF UPPER-CASE(SPI-Current-Token) = "IS"
- MOVE SPACE TO SPI-Token-Type
- EXIT PARAGRAPH
- ELSE
- MOVE "N" TO F-Processing-PICTURE
- MOVE SPACE TO SPI-Token-Type
- EXIT PARAGRAPH
- END-IF
- END-IF
- UNSTRING Expand-Code-Rec
- DELIMITED BY ". " OR " " OR "=" OR "(" OR ")" OR "*"
- OR "/" OR "&" OR ";" OR "," OR "<"
- OR ">" OR ":"
- INTO SPI-Current-Token
- DELIMITER IN Delim
- WITH POINTER Src-Ptr
- END-UNSTRING
- IF Delim = ". "
- MOVE "Y" TO F-Token-Ended-Sentence
- END-IF
- IF Delim NOT = ". " AND " "
- SUBTRACT 1 FROM Src-Ptr
- END-IF
- *>-- Classify Token
- MOVE UPPER-CASE(SPI-Current-Token) TO Search-Token
- IF Search-Token = "EQUAL" OR "EQUALS"
- MOVE "EQUALS" TO SPI-Current-Token
- MOVE "K" TO SPI-Token-Type
- EXIT PARAGRAPH
- END-IF
- SEARCH ALL Reserved-Word
- WHEN RW-Word (RW-Idx) = Search-Token
- MOVE RW-Type (RW-Idx) TO SPI-Token-Type
-GC0710 IF Token-Is-Verb
-GC0710 MOVE "Y" TO F-Verb-Has-Been-Found
-GC0710 END-IF
- EXIT PARAGRAPH
- END-SEARCH
- *>-- Not a reserved word, must be a user name
- SET Token-Is-Identifier TO TRUE *> NEEDS EXPANSION!!!!
- PERFORM 313-Check-For-Numeric-Token
- IF Token-Is-Literal-Number
- IF (F-Last-Token-Ended-Sent = "Y")
- AND (SPI-Current-Division = "D")
- MOVE "LEVEL #" TO SPI-Current-Token
- MOVE "K" TO SPI-Token-Type
- EXIT PARAGRAPH
- ELSE
- EXIT PARAGRAPH
- END-IF
- END-IF
- EXIT PARAGRAPH
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 311-Control-Record.
- UNSTRING ECR-2-256
- DELIMITED BY '"'
- INTO PIC-X10, PIC-X256, Dummy
- END-UNSTRING
- INSPECT PIC-X10 REPLACING ALL '"' BY SPACE
- COMPUTE I = NUMVAL(PIC-X10) - 1
- IF TRIM(PIC-X256,Trailing) = TRIM(Program-Path,Trailing)
- MOVE I TO SPI-Current-Line-No
- SET In-Main-Module TO TRUE
- IF Saved-Section NOT = SPACES
- MOVE Saved-Section TO SPI-Current-Section
- END-IF
- ELSE
- SET In-Copybook TO TRUE
- IF Saved-Section = SPACES
- MOVE SPI-Current-Section TO Saved-Section
- END-IF
- MOVE LENGTH(TRIM(PIC-X256,Trailing)) TO I
- MOVE 0 TO J
- PERFORM UNTIL PIC-X256(I:1) = '/'
- OR I = 0
- SUBTRACT 1 FROM I
- ADD 1 TO J
- END-PERFORM
- UNSTRING PIC-X256((I + 1):J) DELIMITED BY "."
- INTO Filename, Dummy
- END-UNSTRING
- MOVE "[" TO SPI-CS-1
- MOVE Filename TO SPI-CS-2-14
- IF SPI-CS-11-14 NOT = SPACES
- MOVE "..." TO SPI-CS-11-14
- END-IF
- MOVE "]" TO SPI-CS-15
- END-IF
- MOVE SPACES TO Expand-Code-Rec *> Force another READ
- MOVE 256 TO Src-Ptr
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 312-Expand-Code-Record.
- MOVE 1 TO Src-Ptr
- IF In-Main-Module
- ADD 1 To SPI-Current-Line-No
- END-IF
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 313-Check-For-Numeric-Token.
- MOVE SPI-Current-Token TO PIC-X32
- INSPECT PIC-X32
- REPLACING TRAILING SPACES BY "0"
- IF PIC-X32 IS NUMERIC *> Simple Unsigned Integer
- SET Token-Is-Literal-Number TO TRUE
- EXIT PARAGRAPH
- END-IF
- IF PIC-X32(1:1) = "+" OR "-"
- MOVE "0" TO PIC-X32(1:1)
- END-IF
- MOVE 0 TO Tally
- INSPECT PIC-X32
- TALLYING Tally FOR ALL "."
- IF Tally = 1
- INSPECT PIC-X32 REPLACING ALL "." BY "0"
- END-IF
- IF PIC-X32 IS NUMERIC
- SET Token-Is-Literal-Number TO TRUE
- EXIT PARAGRAPH
- END-IF
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 320-IDENTIFICATION-DIVISION.
-GC0710 MOVE "N" TO F-Verb-Has-Been-Found
- IF Token-Is-Key-Word AND SPI-Current-Token = "DIVISION"
- MOVE SPI-Prior-Token TO SPI-Current-Division
- EXIT PARAGRAPH
- END-IF
- IF SPI-Prior-Token = "PROGRAM-ID"
- MOVE SPACES TO SPI-Prior-Token
- MOVE SPI-Current-Token TO SPI-Current-Program-ID
- IF SPI-CP-13-15 NOT = SPACES
- MOVE "..." TO SPI-CP-13-15
- END-IF
- EXIT PARAGRAPH
- END-IF
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 330-ENVIRONMENT-DIVISION.
- IF Token-Is-Key-Word AND SPI-Current-Token = "DIVISION"
- MOVE SPI-Prior-Token TO SPI-Current-Division
- EXIT PARAGRAPH
- END-IF
- IF Token-Is-Key-Word AND SPI-Current-Token = "SECTION"
- MOVE SPI-Prior-Token TO SPI-Current-Section
- EXIT PARAGRAPH
- END-IF
- IF Token-Is-Identifier
- PERFORM 361-Release-Ref
- END-IF
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 340-DATA-DIVISION.
- IF Token-Is-Key-Word AND SPI-Current-Token = "DIVISION"
- MOVE SPI-Prior-Token TO SPI-Current-Division
- EXIT PARAGRAPH
- END-IF
- IF Token-Is-Key-Word AND SPI-Current-Token = "SECTION"
- MOVE SPI-Prior-Token TO SPI-Current-Section
- EXIT PARAGRAPH
- END-IF
- IF (SPI-Current-Token = "PIC" OR "PICTURE")
- AND (Token-Is-Key-Word)
- MOVE "Y" TO F-Processing-PICTURE
- EXIT PARAGRAPH
- END-IF
-GC0710 IF Token-Is-Reserved-Word
-GC0710 AND SPI-Prior-Token = "LEVEL #"
-GC0710 MOVE SPACES TO SPI-Prior-Token
-GC0710 EXIT PARAGRAPH
-GC0710 END-IF
- IF Token-Is-Identifier
- EVALUATE SPI-Prior-Token
- WHEN "FD"
- PERFORM 360-Release-Def
- MOVE SPACES TO SPI-Prior-Token
- WHEN "SD"
- PERFORM 360-Release-Def
- MOVE SPACES TO SPI-Prior-Token
- WHEN "LEVEL #"
- PERFORM 360-Release-Def
- MOVE SPACES TO SPI-Prior-Token
- WHEN "INDEXED"
- PERFORM 360-Release-Def
- MOVE SPACES TO SPI-Prior-Token
- WHEN "USING"
- PERFORM 362-Release-Upd
- MOVE SPACES TO SPI-Prior-Token
- WHEN "INTO"
- PERFORM 362-Release-Upd
- MOVE SPACES TO SPI-Prior-Token
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- EXIT PARAGRAPH
- END-IF
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 350-PROCEDURE-DIVISION.
- IF SPI-Current-Section NOT = "PROCEDURE"
- MOVE "PROCEDURE" TO SPI-Current-Section
- END-IF
-GC0710 IF SPI-Current-Token-UC = "PROGRAM"
-GC0710 AND SPI-Prior-Token = "END"
-GC0710 MOVE "?" TO SPI-Current-Division
-GC0710 EXIT PARAGRAPH
-GC0710 END-IF
- IF Token-Is-Key-Word AND SPI-Current-Token = "DIVISION"
- MOVE SPI-Prior-Token TO SPI-Current-Division
- EXIT PARAGRAPH
- END-IF
- IF SPI-Current-Verb = SPACES
-GC0710 AND F-Verb-Has-Been-Found = "Y"
- IF Token-Is-Identifier
- PERFORM 360-Release-Def
- MOVE SPACES TO SPI-Prior-Token
- END-IF
- EXIT PARAGRAPH
- END-IF
- IF NOT Token-Is-Identifier
- EXIT PARAGRAPH
- END-IF
- EVALUATE SPI-Current-Verb
- WHEN "ACCEPT"
- PERFORM 351-ACCEPT
- WHEN "ADD"
- PERFORM 351-ADD
- WHEN "ALLOCATE"
- PERFORM 351-ALLOCATE
- WHEN "CALL"
- PERFORM 351-CALL
- WHEN "COMPUTE"
- PERFORM 351-COMPUTE
- WHEN "DIVIDE"
- PERFORM 351-DIVIDE
- WHEN "FREE"
- PERFORM 351-FREE
- WHEN "INITIALIZE"
- PERFORM 351-INITIALIZE
- WHEN "INSPECT"
- PERFORM 351-INSPECT
- WHEN "MOVE"
- PERFORM 351-MOVE
- WHEN "MULTIPLY"
- PERFORM 351-MULTIPLY
- WHEN "PERFORM"
- PERFORM 351-PERFORM
- WHEN "SET"
- PERFORM 351-SET
- WHEN "STRING"
- PERFORM 351-STRING
- WHEN "SUBTRACT"
- PERFORM 351-SUBTRACT
- WHEN "TRANSFORM"
- PERFORM 351-TRANSFORM
- WHEN "UNSTRING"
- PERFORM 351-UNSTRING
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-ACCEPT.
- EVALUATE SPI-Prior-Token
- WHEN "ACCEPT"
- PERFORM 362-Release-Upd
- MOVE SPACES TO SPI-Prior-Token
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-ADD.
- EVALUATE SPI-Prior-Token
- WHEN "GIVING"
- PERFORM 362-Release-Upd
- WHEN "TO"
- PERFORM 362-Release-Upd
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-ALLOCATE.
- EVALUATE SPI-Prior-Token
- WHEN "ALLOCATE"
- PERFORM 362-Release-Upd
- MOVE SPACES TO SPI-Prior-Token
- WHEN "RETURNING"
- PERFORM 362-Release-Upd
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-CALL.
- EVALUATE SPI-Prior-Token
- WHEN "RETURNING"
- PERFORM 362-Release-Upd
- WHEN "GIVING"
- PERFORM 362-Release-Upd
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-COMPUTE.
- EVALUATE SPI-Prior-Token
- WHEN "COMPUTE"
- PERFORM 362-Release-Upd
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-DIVIDE.
- EVALUATE SPI-Prior-Token
- WHEN "INTO"
- PERFORM 363-Set-Upd
- MOVE Sort-Rec TO Held-Reference
- WHEN "GIVING"
- IF Held-Reference NOT = SPACES
- MOVE Held-Reference To Sort-Rec
- MOVE SPACES To Held-Reference
- SR-Ref-Flag
- RELEASE Sort-Rec
- END-IF
- PERFORM 362-Release-Upd
- WHEN "REMAINDER"
- PERFORM 362-Release-Upd
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-FREE.
- PERFORM 362-Release-Upd
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-INITIALIZE.
- EVALUATE SPI-Prior-Token
- WHEN "INITIALIZE"
- PERFORM 362-Release-Upd
- WHEN "REPLACING"
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-INSPECT.
- EVALUATE SPI-Prior-Token
- WHEN "INSPECT"
- PERFORM 364-Set-Ref
- MOVE SPACES TO Held-Reference
- MOVE SPACES TO SPI-Prior-Token
- WHEN "TALLYING"
- PERFORM 362-Release-Upd
- MOVE SPACES TO SPI-Prior-Token
- WHEN "REPLACING"
- IF Held-Reference NOT = SPACES
- MOVE Held-Reference TO Sort-Rec
- MOVE SPACES TO Held-Reference
- MOVE "*" TO SR-Ref-Flag
- RELEASE Sort-Rec
- END-IF
- MOVE SPACES TO SPI-Prior-Token
- WHEN "CONVERTING"
- IF Held-Reference NOT = SPACES
- MOVE Held-Reference TO Sort-Rec
- MOVE SPACES TO Held-Reference
- MOVE "*" TO SR-Ref-Flag
- RELEASE Sort-Rec
- END-IF
- MOVE SPACES TO SPI-Prior-Token
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-MOVE.
- EVALUATE SPI-Prior-Token
- WHEN "TO"
- PERFORM 362-Release-Upd
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-MULTIPLY.
- EVALUATE SPI-Prior-Token
- WHEN "BY"
- PERFORM 363-Set-Upd
- MOVE Sort-Rec TO Held-Reference
- WHEN "GIVING"
- MOVE Held-Reference TO Sort-Rec
- MOVE SPACES TO Held-Reference
- SR-Ref-Flag
- RELEASE Sort-Rec
- PERFORM 362-Release-Upd
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-PERFORM.
- EVALUATE SPI-Prior-Token
- WHEN "VARYING"
- PERFORM 362-Release-Upd
- MOVE SPACES TO SPI-Prior-Token
- WHEN "AFTER"
- PERFORM 362-Release-Upd
- MOVE SPACES TO SPI-Prior-Token
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-SET.
- EVALUATE SPI-Prior-Token
- WHEN "SET"
- PERFORM 362-Release-Upd
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-STRING.
- EVALUATE SPI-Prior-Token
- WHEN "INTO"
- PERFORM 362-Release-Upd
- WHEN "POINTER"
- PERFORM 362-Release-Upd
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-SUBTRACT.
- EVALUATE SPI-Prior-Token
- WHEN "GIVING"
- PERFORM 362-Release-Upd
- WHEN "FROM"
- PERFORM 362-Release-Upd
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-TRANSFORM.
- EVALUATE SPI-Prior-Token
- WHEN "TRANSFORM"
- PERFORM 362-Release-Upd
- MOVE SPACES TO SPI-Prior-Token
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 351-UNSTRING.
- EVALUATE SPI-Prior-Token
- WHEN "INTO"
- PERFORM 362-Release-Upd
- WHEN "DELIMITER"
- PERFORM 362-Release-Upd
- WHEN "COUNT"
- PERFORM 362-Release-Upd
- WHEN "POINTER"
- PERFORM 362-Release-Upd
- WHEN "TALLYING"
- PERFORM 362-Release-Upd
- WHEN OTHER
- PERFORM 361-Release-Ref
- END-EVALUATE
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 360-Release-Def.
- MOVE SPACES TO Sort-Rec
- MOVE SPI-Current-Program-ID TO SR-Prog-ID
- MOVE SPI-Current-Token-UC TO SR-Token-UC
- MOVE SPI-Current-Token TO SR-Token
- MOVE SPI-Current-Section TO SR-Section
- MOVE SPI-Current-Line-No TO SR-Line-No-Def
- MOVE 0 TO SR-Line-No-Ref
- RELEASE Sort-Rec
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 361-Release-Ref.
- PERFORM 364-Set-Ref
- RELEASE Sort-Rec
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 362-Release-Upd.
- PERFORM 363-Set-Upd
- RELEASE Sort-Rec
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 363-Set-Upd.
- MOVE SPACES TO Sort-Rec
- MOVE SPI-Current-Program-ID TO SR-Prog-ID
- MOVE SPI-Current-Token-UC TO SR-Token-UC
- MOVE SPI-Current-Token TO SR-Token
- MOVE SPI-Current-Section TO SR-Section
- MOVE SPI-Current-Line-No TO SR-Line-No-Ref
- MOVE "*" TO SR-Ref-Flag
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 364-Set-Ref.
- MOVE SPACES TO Sort-Rec
- MOVE SPI-Current-Program-ID TO SR-Prog-ID
- MOVE SPI-Current-Token-UC TO SR-Token-UC
- MOVE SPI-Current-Token TO SR-Token
- MOVE SPI-Current-Section TO SR-Section
- MOVE SPI-Current-Line-No TO SR-Line-No-Ref
- .
- /
- 400-Produce-Xref-Listing SECTION.
- 401-Init.
- MOVE SPACES TO Detail-Line-X
- Group-Indicators
- MOVE 0 TO I
- Lines-Left
-GC0710 MOVE 'N' TO F-Duplicate
- .
-
- 402-Process-Sorted-Recs.
- PERFORM FOREVER
- RETURN Sort-File AT END
- EXIT PERFORM
- END-RETURN
- IF SR-Prog-ID NOT = GI-Prog-ID
- OR SR-Token-UC NOT = GI-Token
-GC0710 MOVE 'N' TO F-Duplicate
- IF Detail-Line-X NOT = SPACES
- PERFORM 410-Generate-Report-Line
- END-IF
- IF SR-Prog-ID NOT = GI-Prog-ID
- MOVE 0 TO Lines-Left
- END-IF
- MOVE SR-Prog-ID TO GI-Prog-ID
- MOVE SR-Token-UC TO GI-Token
- END-IF
-GC0710 IF SR-Token-UC = GI-Token
-GC0710 AND SR-Line-No-Def NOT = SPACES
-GC0710 AND Detail-Line-X NOT = SPACES
-GC0710 MOVE 'Y' TO F-Duplicate
-GC0710 PERFORM 410-Generate-Report-Line
-GC0710 MOVE 0 TO I
-GC0710 MOVE SR-Prog-ID TO DLX-Prog-ID
-GC0710 MOVE ' (Duplicate Definition)' TO DLX-Token
-GC0710 MOVE SR-Section TO DLX-Section
-GC0710 MOVE SR-Line-No-Def TO DLX-Line-No-Def
-GC0710 EXIT PERFORM CYCLE
-GC0710 END-IF
-GC0710 IF SR-Token-UC = GI-Token
-GC0710 AND SR-Line-No-Def = SPACES
-GC0710 AND F-Duplicate = 'Y'
-GC0710 MOVE 'N' TO F-Duplicate
-GC0710 PERFORM 410-Generate-Report-Line
-GC0710 MOVE 0 TO I
-GC0710 MOVE SR-Prog-ID TO DLX-Prog-ID
-GC0710 MOVE ' (Duplicate References)' TO DLX-Token
-GC0710 END-IF
- IF Detail-Line-X = SPACES
- MOVE SR-Prog-ID TO DLX-Prog-ID
- MOVE SR-Token TO DLX-Token
- MOVE SR-Section TO DLX-Section
- IF SR-Line-No-Def NOT = SPACES
- MOVE SR-Line-No-Def TO DLX-Line-No-Def
- END-IF
- END-IF
- IF SR-Reference > '000000'
- ADD 1 TO I
- IF I > Line-Nos-Per-Rec
- PERFORM 410-Generate-Report-Line
- MOVE 1 TO I
- END-IF
- MOVE SR-Line-No-Ref TO DLX-Line-No-Ref (I)
- MOVE SR-Ref-Flag TO DLX-Ref-Flag (I)
- END-IF
- END-PERFORM
- IF Detail-Line-X NOT = SPACES
- PERFORM 410-Generate-Report-Line
- END-IF
- EXIT SECTION
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 410-Generate-Report-Line.
- IF Lines-Left < 1
- IF F-First-Record = "Y"
- MOVE "N" TO F-First-Record
- WRITE Report-Rec FROM Heading-1X BEFORE 1
- ELSE
- MOVE SPACES TO Report-Rec
- WRITE Report-Rec BEFORE PAGE
- MOVE SPACES TO Report-Rec
- WRITE Report-Rec BEFORE 1
- WRITE Report-Rec FROM Heading-1X BEFORE 1
- END-IF
- WRITE Report-Rec FROM Heading-2 BEFORE 1
- WRITE Report-Rec FROM Heading-4X BEFORE 1
- WRITE Report-Rec FROM Heading-5X BEFORE 1
- COMPUTE
- Lines-Left = Lines-Per-Page - 4
- END-COMPUTE
- END-IF
- WRITE Report-Rec FROM Detail-Line-X BEFORE 1
- MOVE SPACES TO Detail-Line-X
- MOVE 0 TO I
- SUBTRACT 1 FROM Lines-Left
- .
- /
- 500-Produce-Source-Listing SECTION.
- 501-Generate-Source-Listing.
- OPEN INPUT Source-Code
- Expand-Code
- MOVE 0 TO Source-Line-No
- PERFORM FOREVER
- READ Expand-Code AT END
- EXIT PERFORM
- END-READ
- IF ECR-1 = "#"
- PERFORM 510-Control-Record
- ELSE
- PERFORM 520-Expand-Code-Record
- END-IF
- END-PERFORM
- CLOSE Source-Code
- Expand-Code
- EXIT SECTION
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 510-Control-Record.
- UNSTRING ECR-2-256
- DELIMITED BY '"'
- INTO PIC-X10, PIC-X256, Dummy
- END-UNSTRING
- IF TRIM(PIC-X256,Trailing) = TRIM(Program-Path,Trailing) *> Main Pgm
- SET In-Main-Module TO TRUE
- IF Source-Line-No > 0
- READ Expand-Code END-READ
- END-IF
- ELSE *> COPY
- SET In-Copybook TO TRUE
- END-IF
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 520-Expand-Code-Record.
- IF In-Main-Module
- ADD 1 To SPI-Current-Line-No
- READ Source-Code AT END NEXT SENTENCE END-READ
- ADD 1 TO Source-Line-No
- MOVE SPACES TO Detail-Line-S
- MOVE Source-Line-No TO DLS-Line-No
- MOVE SCR-1-128 TO DLS-Statement
-GC0410 IF SCR-7 = "/"
-GC0410 MOVE 0 TO Lines-Left
-GC0410 END-IF
- PERFORM 530-Generate-Source-Line
- IF SCR-129-256 NOT = SPACES
- MOVE SPACES TO Detail-Line-S
- MOVE SCR-129-256 TO DLS-Statement
- PERFORM 530-Generate-Source-Line
- END-IF
- ELSE
- IF Expand-Code-Rec NOT = SPACES
- MOVE SPACES TO Detail-Line-S
- MOVE ECR-1-128 TO DLS-Statement
- PERFORM 530-Generate-Source-Line
- IF ECR-129-256 NOT = SPACES
- MOVE SPACES TO Detail-Line-S
- MOVE ECR-129-256 TO DLS-Statement
- PERFORM 530-Generate-Source-Line
- END-IF
- END-IF
- END-IF
- .
- *>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- 530-Generate-Source-Line.
- IF Lines-Left < 1
- IF F-First-Record = "Y"
- MOVE "N" TO F-First-Record
- WRITE Report-Rec FROM Heading-1S BEFORE 1
- ELSE
- MOVE SPACES TO Report-Rec
- WRITE Report-Rec BEFORE PAGE
- MOVE SPACES TO Report-Rec
- WRITE Report-Rec BEFORE 1
- WRITE Report-Rec FROM Heading-1S BEFORE 1
- END-IF
- WRITE Report-Rec FROM Heading-2 BEFORE 1
- WRITE Report-Rec FROM Heading-4S BEFORE 1
- WRITE Report-Rec FROM Heading-5S BEFORE 1
- COMPUTE
- Lines-Left = Lines-Per-Page - 4
- END-COMPUTE
- END-IF
- WRITE Report-Rec FROM Detail-Line-S BEFORE 1
- MOVE SPACES TO Detail-Line-S
- SUBTRACT 1 FROM Lines-Left
- .
-
END PROGRAM LISTING.
diff --git a/tests/examplefiles/example.golo b/tests/examplefiles/example.golo new file mode 100644 index 00000000..92ff78b5 --- /dev/null +++ b/tests/examplefiles/example.golo @@ -0,0 +1,113 @@ +# +# Comments +# + +module pygments.Example + +import some.Module + +local function foo = |a, b| -> a + b + +---- +golodoc string +---- +augment java.util.Collection { + + ---- + sub doc + ---- + function plop = |this, v| { + return this: length() + v + } +} + +function bar = |a, b| { + let msg = "a string" + var tmp = "" + tmp = tmp + a: toString() + println(tmp + b) +} + +function baz = { + foreach i in range(0, 5) { + if i % 2 == 0 and true or false { + print("e") + } else { + print("o") + } + } +} + +function userMatch = |v| -> + match { + when v % 2 == 0 then "e" + otherwise "o" + } +} + +function add = |x| -> |y| -> x + y + +let aChar = 'a' + +let multiline = +""" +foo +bar +baz +""" + +local function myObj = -> DynamicObject(): + name("foo"): + age(25): + define("meth", |this| -> this: name() + this: age() + +---- +Golo doc string +---- +function nullTest = { + let m = map[ + ["a", 1], + ["b", 2] + ] + + println(map: get("a") orIfNull 0) + println(map: get("b")?: toString() orIfNull "0") + +} + +struct Point = { x, y } + +function deco1 = |fun| { + return |args...| { + return "deco1 + " + fun: invokeWithArguments(args) + } +} + +@deco1 +function decofoo = |a| { + return "foo: " + a +} + +@deco1 +function decobar = |a| -> "bar: " + a + +function deco2 = |fun| { + return |args...| { + return "deco2 + " + fun: invokeWithArguments(args) + } +} + +@deco2 +@deco1 +function decobaz = |a| -> "baz: " + a + +let deco3 = ^deco1: andThen(^deco2) + +@deco3 +function decospam = |a| -> "spam: " + a + +@another.Module.deco +function ping = -> "pong" + +@deco("with", params) +function gnop = -> "gnip" diff --git a/tests/examplefiles/example.hs b/tests/examplefiles/example.hs index 9efd3364..f5e2b555 100644 --- a/tests/examplefiles/example.hs +++ b/tests/examplefiles/example.hs @@ -25,3 +25,7 @@ data ĈrazyThings = House | Peár deriving (Show, Eq) + +-- some char literals: + +charl = ['"', 'a', '\ESC', '\'', ' '] diff --git a/tests/examplefiles/example.hx b/tests/examplefiles/example.hx index 381cf825..7584fc81 100644 --- a/tests/examplefiles/example.hx +++ b/tests/examplefiles/example.hx @@ -181,5 +181,12 @@ var c = macro class MyClass { var c = macro interface IClass {}; +//macro class could have no name... +var def = macro class { + private inline function new(loader) this = loader; + private var loader(get,never) : $loaderType; + inline private function get_loader() : $loaderType return this; +}; + //ECheckType var f = (123:Float);
\ No newline at end of file diff --git a/tests/examplefiles/example.stan b/tests/examplefiles/example.stan index 7eb6fdfc..716b4d12 100644 --- a/tests/examplefiles/example.stan +++ b/tests/examplefiles/example.stan @@ -5,6 +5,14 @@ It is not a real model and will not compile */ # also a comment // also a comment +functions { + void f1(void a, real b) { + return 1 / a; + } + real f2(int a, vector b, real c) { + return a + b + c; + } +} data { // valid name int abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_abc; @@ -20,6 +28,7 @@ data { corr_matrix[3] grault; cov_matrix[3] garply; cholesky_factor_cov[3] waldo; + cholesky_factor_corr[3] waldo2; real<lower=-1,upper=1> foo1; real<lower=0> foo2; @@ -87,6 +96,7 @@ model { tmp / tmp; tmp .* tmp; tmp ./ tmp; + tmp ^ tmp; ! tmp; - tmp; + tmp; @@ -107,4 +117,3 @@ generated quantities { real bar1; bar1 <- foo + 1; } - diff --git a/tests/examplefiles/example.thy b/tests/examplefiles/example.thy new file mode 100644 index 00000000..abaa1af8 --- /dev/null +++ b/tests/examplefiles/example.thy @@ -0,0 +1,751 @@ +(* from Isabelle2013-2 src/HOL/Power.thy; BSD license *) + +(* Title: HOL/Power.thy + Author: Lawrence C Paulson, Cambridge University Computer Laboratory + Copyright 1997 University of Cambridge +*) + +header {* Exponentiation *} + +theory Power +imports Num +begin + +subsection {* Powers for Arbitrary Monoids *} + +class power = one + times +begin + +primrec power :: "'a \<Rightarrow> nat \<Rightarrow> 'a" (infixr "^" 80) where + power_0: "a ^ 0 = 1" + | power_Suc: "a ^ Suc n = a * a ^ n" + +notation (latex output) + power ("(_\<^bsup>_\<^esup>)" [1000] 1000) + +notation (HTML output) + power ("(_\<^bsup>_\<^esup>)" [1000] 1000) + +text {* Special syntax for squares. *} + +abbreviation (xsymbols) + power2 :: "'a \<Rightarrow> 'a" ("(_\<^sup>2)" [1000] 999) where + "x\<^sup>2 \<equiv> x ^ 2" + +notation (latex output) + power2 ("(_\<^sup>2)" [1000] 999) + +notation (HTML output) + power2 ("(_\<^sup>2)" [1000] 999) + +end + +context monoid_mult +begin + +subclass power . + +lemma power_one [simp]: + "1 ^ n = 1" + by (induct n) simp_all + +lemma power_one_right [simp]: + "a ^ 1 = a" + by simp + +lemma power_commutes: + "a ^ n * a = a * a ^ n" + by (induct n) (simp_all add: mult_assoc) + +lemma power_Suc2: + "a ^ Suc n = a ^ n * a" + by (simp add: power_commutes) + +lemma power_add: + "a ^ (m + n) = a ^ m * a ^ n" + by (induct m) (simp_all add: algebra_simps) + +lemma power_mult: + "a ^ (m * n) = (a ^ m) ^ n" + by (induct n) (simp_all add: power_add) + +lemma power2_eq_square: "a\<^sup>2 = a * a" + by (simp add: numeral_2_eq_2) + +lemma power3_eq_cube: "a ^ 3 = a * a * a" + by (simp add: numeral_3_eq_3 mult_assoc) + +lemma power_even_eq: + "a ^ (2 * n) = (a ^ n)\<^sup>2" + by (subst mult_commute) (simp add: power_mult) + +lemma power_odd_eq: + "a ^ Suc (2*n) = a * (a ^ n)\<^sup>2" + by (simp add: power_even_eq) + +lemma power_numeral_even: + "z ^ numeral (Num.Bit0 w) = (let w = z ^ (numeral w) in w * w)" + unfolding numeral_Bit0 power_add Let_def .. + +lemma power_numeral_odd: + "z ^ numeral (Num.Bit1 w) = (let w = z ^ (numeral w) in z * w * w)" + unfolding numeral_Bit1 One_nat_def add_Suc_right add_0_right + unfolding power_Suc power_add Let_def mult_assoc .. + +lemma funpow_times_power: + "(times x ^^ f x) = times (x ^ f x)" +proof (induct "f x" arbitrary: f) + case 0 then show ?case by (simp add: fun_eq_iff) +next + case (Suc n) + def g \<equiv> "\<lambda>x. f x - 1" + with Suc have "n = g x" by simp + with Suc have "times x ^^ g x = times (x ^ g x)" by simp + moreover from Suc g_def have "f x = g x + 1" by simp + ultimately show ?case by (simp add: power_add funpow_add fun_eq_iff mult_assoc) +qed + +end + +context comm_monoid_mult +begin + +lemma power_mult_distrib: + "(a * b) ^ n = (a ^ n) * (b ^ n)" + by (induct n) (simp_all add: mult_ac) + +end + +context semiring_numeral +begin + +lemma numeral_sqr: "numeral (Num.sqr k) = numeral k * numeral k" + by (simp only: sqr_conv_mult numeral_mult) + +lemma numeral_pow: "numeral (Num.pow k l) = numeral k ^ numeral l" + by (induct l, simp_all only: numeral_class.numeral.simps pow.simps + numeral_sqr numeral_mult power_add power_one_right) + +lemma power_numeral [simp]: "numeral k ^ numeral l = numeral (Num.pow k l)" + by (rule numeral_pow [symmetric]) + +end + +context semiring_1 +begin + +lemma of_nat_power: + "of_nat (m ^ n) = of_nat m ^ n" + by (induct n) (simp_all add: of_nat_mult) + +lemma power_zero_numeral [simp]: "(0::'a) ^ numeral k = 0" + by (simp add: numeral_eq_Suc) + +lemma zero_power2: "0\<^sup>2 = 0" (* delete? *) + by (rule power_zero_numeral) + +lemma one_power2: "1\<^sup>2 = 1" (* delete? *) + by (rule power_one) + +end + +context comm_semiring_1 +begin + +text {* The divides relation *} + +lemma le_imp_power_dvd: + assumes "m \<le> n" shows "a ^ m dvd a ^ n" +proof + have "a ^ n = a ^ (m + (n - m))" + using `m \<le> n` by simp + also have "\<dots> = a ^ m * a ^ (n - m)" + by (rule power_add) + finally show "a ^ n = a ^ m * a ^ (n - m)" . +qed + +lemma power_le_dvd: + "a ^ n dvd b \<Longrightarrow> m \<le> n \<Longrightarrow> a ^ m dvd b" + by (rule dvd_trans [OF le_imp_power_dvd]) + +lemma dvd_power_same: + "x dvd y \<Longrightarrow> x ^ n dvd y ^ n" + by (induct n) (auto simp add: mult_dvd_mono) + +lemma dvd_power_le: + "x dvd y \<Longrightarrow> m \<ge> n \<Longrightarrow> x ^ n dvd y ^ m" + by (rule power_le_dvd [OF dvd_power_same]) + +lemma dvd_power [simp]: + assumes "n > (0::nat) \<or> x = 1" + shows "x dvd (x ^ n)" +using assms proof + assume "0 < n" + then have "x ^ n = x ^ Suc (n - 1)" by simp + then show "x dvd (x ^ n)" by simp +next + assume "x = 1" + then show "x dvd (x ^ n)" by simp +qed + +end + +context ring_1 +begin + +lemma power_minus: + "(- a) ^ n = (- 1) ^ n * a ^ n" +proof (induct n) + case 0 show ?case by simp +next + case (Suc n) then show ?case + by (simp del: power_Suc add: power_Suc2 mult_assoc) +qed + +lemma power_minus_Bit0: + "(- x) ^ numeral (Num.Bit0 k) = x ^ numeral (Num.Bit0 k)" + by (induct k, simp_all only: numeral_class.numeral.simps power_add + power_one_right mult_minus_left mult_minus_right minus_minus) + +lemma power_minus_Bit1: + "(- x) ^ numeral (Num.Bit1 k) = - (x ^ numeral (Num.Bit1 k))" + by (simp only: eval_nat_numeral(3) power_Suc power_minus_Bit0 mult_minus_left) + +lemma power_neg_numeral_Bit0 [simp]: + "neg_numeral k ^ numeral (Num.Bit0 l) = numeral (Num.pow k (Num.Bit0 l))" + by (simp only: neg_numeral_def power_minus_Bit0 power_numeral) + +lemma power_neg_numeral_Bit1 [simp]: + "neg_numeral k ^ numeral (Num.Bit1 l) = neg_numeral (Num.pow k (Num.Bit1 l))" + by (simp only: neg_numeral_def power_minus_Bit1 power_numeral pow.simps) + +lemma power2_minus [simp]: + "(- a)\<^sup>2 = a\<^sup>2" + by (rule power_minus_Bit0) + +lemma power_minus1_even [simp]: + "-1 ^ (2*n) = 1" +proof (induct n) + case 0 show ?case by simp +next + case (Suc n) then show ?case by (simp add: power_add power2_eq_square) +qed + +lemma power_minus1_odd: + "-1 ^ Suc (2*n) = -1" + by simp + +lemma power_minus_even [simp]: + "(-a) ^ (2*n) = a ^ (2*n)" + by (simp add: power_minus [of a]) + +end + +context ring_1_no_zero_divisors +begin + +lemma field_power_not_zero: + "a \<noteq> 0 \<Longrightarrow> a ^ n \<noteq> 0" + by (induct n) auto + +lemma zero_eq_power2 [simp]: + "a\<^sup>2 = 0 \<longleftrightarrow> a = 0" + unfolding power2_eq_square by simp + +lemma power2_eq_1_iff: + "a\<^sup>2 = 1 \<longleftrightarrow> a = 1 \<or> a = - 1" + unfolding power2_eq_square by (rule square_eq_1_iff) + +end + +context idom +begin + +lemma power2_eq_iff: "x\<^sup>2 = y\<^sup>2 \<longleftrightarrow> x = y \<or> x = - y" + unfolding power2_eq_square by (rule square_eq_iff) + +end + +context division_ring +begin + +text {* FIXME reorient or rename to @{text nonzero_inverse_power} *} +lemma nonzero_power_inverse: + "a \<noteq> 0 \<Longrightarrow> inverse (a ^ n) = (inverse a) ^ n" + by (induct n) + (simp_all add: nonzero_inverse_mult_distrib power_commutes field_power_not_zero) + +end + +context field +begin + +lemma nonzero_power_divide: + "b \<noteq> 0 \<Longrightarrow> (a / b) ^ n = a ^ n / b ^ n" + by (simp add: divide_inverse power_mult_distrib nonzero_power_inverse) + +end + + +subsection {* Exponentiation on ordered types *} + +context linordered_ring (* TODO: move *) +begin + +lemma sum_squares_ge_zero: + "0 \<le> x * x + y * y" + by (intro add_nonneg_nonneg zero_le_square) + +lemma not_sum_squares_lt_zero: + "\<not> x * x + y * y < 0" + by (simp add: not_less sum_squares_ge_zero) + +end + +context linordered_semidom +begin + +lemma zero_less_power [simp]: + "0 < a \<Longrightarrow> 0 < a ^ n" + by (induct n) (simp_all add: mult_pos_pos) + +lemma zero_le_power [simp]: + "0 \<le> a \<Longrightarrow> 0 \<le> a ^ n" + by (induct n) (simp_all add: mult_nonneg_nonneg) + +lemma power_mono: + "a \<le> b \<Longrightarrow> 0 \<le> a \<Longrightarrow> a ^ n \<le> b ^ n" + by (induct n) (auto intro: mult_mono order_trans [of 0 a b]) + +lemma one_le_power [simp]: "1 \<le> a \<Longrightarrow> 1 \<le> a ^ n" + using power_mono [of 1 a n] by simp + +lemma power_le_one: "\<lbrakk>0 \<le> a; a \<le> 1\<rbrakk> \<Longrightarrow> a ^ n \<le> 1" + using power_mono [of a 1 n] by simp + +lemma power_gt1_lemma: + assumes gt1: "1 < a" + shows "1 < a * a ^ n" +proof - + from gt1 have "0 \<le> a" + by (fact order_trans [OF zero_le_one less_imp_le]) + have "1 * 1 < a * 1" using gt1 by simp + also have "\<dots> \<le> a * a ^ n" using gt1 + by (simp only: mult_mono `0 \<le> a` one_le_power order_less_imp_le + zero_le_one order_refl) + finally show ?thesis by simp +qed + +lemma power_gt1: + "1 < a \<Longrightarrow> 1 < a ^ Suc n" + by (simp add: power_gt1_lemma) + +lemma one_less_power [simp]: + "1 < a \<Longrightarrow> 0 < n \<Longrightarrow> 1 < a ^ n" + by (cases n) (simp_all add: power_gt1_lemma) + +lemma power_le_imp_le_exp: + assumes gt1: "1 < a" + shows "a ^ m \<le> a ^ n \<Longrightarrow> m \<le> n" +proof (induct m arbitrary: n) + case 0 + show ?case by simp +next + case (Suc m) + show ?case + proof (cases n) + case 0 + with Suc.prems Suc.hyps have "a * a ^ m \<le> 1" by simp + with gt1 show ?thesis + by (force simp only: power_gt1_lemma + not_less [symmetric]) + next + case (Suc n) + with Suc.prems Suc.hyps show ?thesis + by (force dest: mult_left_le_imp_le + simp add: less_trans [OF zero_less_one gt1]) + qed +qed + +text{*Surely we can strengthen this? It holds for @{text "0<a<1"} too.*} +lemma power_inject_exp [simp]: + "1 < a \<Longrightarrow> a ^ m = a ^ n \<longleftrightarrow> m = n" + by (force simp add: order_antisym power_le_imp_le_exp) + +text{*Can relax the first premise to @{term "0<a"} in the case of the +natural numbers.*} +lemma power_less_imp_less_exp: + "1 < a \<Longrightarrow> a ^ m < a ^ n \<Longrightarrow> m < n" + by (simp add: order_less_le [of m n] less_le [of "a^m" "a^n"] + power_le_imp_le_exp) + +lemma power_strict_mono [rule_format]: + "a < b \<Longrightarrow> 0 \<le> a \<Longrightarrow> 0 < n \<longrightarrow> a ^ n < b ^ n" + by (induct n) + (auto simp add: mult_strict_mono le_less_trans [of 0 a b]) + +text{*Lemma for @{text power_strict_decreasing}*} +lemma power_Suc_less: + "0 < a \<Longrightarrow> a < 1 \<Longrightarrow> a * a ^ n < a ^ n" + by (induct n) + (auto simp add: mult_strict_left_mono) + +lemma power_strict_decreasing [rule_format]: + "n < N \<Longrightarrow> 0 < a \<Longrightarrow> a < 1 \<longrightarrow> a ^ N < a ^ n" +proof (induct N) + case 0 then show ?case by simp +next + case (Suc N) then show ?case + apply (auto simp add: power_Suc_less less_Suc_eq) + apply (subgoal_tac "a * a^N < 1 * a^n") + apply simp + apply (rule mult_strict_mono) apply auto + done +qed + +text{*Proof resembles that of @{text power_strict_decreasing}*} +lemma power_decreasing [rule_format]: + "n \<le> N \<Longrightarrow> 0 \<le> a \<Longrightarrow> a \<le> 1 \<longrightarrow> a ^ N \<le> a ^ n" +proof (induct N) + case 0 then show ?case by simp +next + case (Suc N) then show ?case + apply (auto simp add: le_Suc_eq) + apply (subgoal_tac "a * a^N \<le> 1 * a^n", simp) + apply (rule mult_mono) apply auto + done +qed + +lemma power_Suc_less_one: + "0 < a \<Longrightarrow> a < 1 \<Longrightarrow> a ^ Suc n < 1" + using power_strict_decreasing [of 0 "Suc n" a] by simp + +text{*Proof again resembles that of @{text power_strict_decreasing}*} +lemma power_increasing [rule_format]: + "n \<le> N \<Longrightarrow> 1 \<le> a \<Longrightarrow> a ^ n \<le> a ^ N" +proof (induct N) + case 0 then show ?case by simp +next + case (Suc N) then show ?case + apply (auto simp add: le_Suc_eq) + apply (subgoal_tac "1 * a^n \<le> a * a^N", simp) + apply (rule mult_mono) apply (auto simp add: order_trans [OF zero_le_one]) + done +qed + +text{*Lemma for @{text power_strict_increasing}*} +lemma power_less_power_Suc: + "1 < a \<Longrightarrow> a ^ n < a * a ^ n" + by (induct n) (auto simp add: mult_strict_left_mono less_trans [OF zero_less_one]) + +lemma power_strict_increasing [rule_format]: + "n < N \<Longrightarrow> 1 < a \<longrightarrow> a ^ n < a ^ N" +proof (induct N) + case 0 then show ?case by simp +next + case (Suc N) then show ?case + apply (auto simp add: power_less_power_Suc less_Suc_eq) + apply (subgoal_tac "1 * a^n < a * a^N", simp) + apply (rule mult_strict_mono) apply (auto simp add: less_trans [OF zero_less_one] less_imp_le) + done +qed + +lemma power_increasing_iff [simp]: + "1 < b \<Longrightarrow> b ^ x \<le> b ^ y \<longleftrightarrow> x \<le> y" + by (blast intro: power_le_imp_le_exp power_increasing less_imp_le) + +lemma power_strict_increasing_iff [simp]: + "1 < b \<Longrightarrow> b ^ x < b ^ y \<longleftrightarrow> x < y" +by (blast intro: power_less_imp_less_exp power_strict_increasing) + +lemma power_le_imp_le_base: + assumes le: "a ^ Suc n \<le> b ^ Suc n" + and ynonneg: "0 \<le> b" + shows "a \<le> b" +proof (rule ccontr) + assume "~ a \<le> b" + then have "b < a" by (simp only: linorder_not_le) + then have "b ^ Suc n < a ^ Suc n" + by (simp only: assms power_strict_mono) + from le and this show False + by (simp add: linorder_not_less [symmetric]) +qed + +lemma power_less_imp_less_base: + assumes less: "a ^ n < b ^ n" + assumes nonneg: "0 \<le> b" + shows "a < b" +proof (rule contrapos_pp [OF less]) + assume "~ a < b" + hence "b \<le> a" by (simp only: linorder_not_less) + hence "b ^ n \<le> a ^ n" using nonneg by (rule power_mono) + thus "\<not> a ^ n < b ^ n" by (simp only: linorder_not_less) +qed + +lemma power_inject_base: + "a ^ Suc n = b ^ Suc n \<Longrightarrow> 0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> a = b" +by (blast intro: power_le_imp_le_base antisym eq_refl sym) + +lemma power_eq_imp_eq_base: + "a ^ n = b ^ n \<Longrightarrow> 0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 < n \<Longrightarrow> a = b" + by (cases n) (simp_all del: power_Suc, rule power_inject_base) + +lemma power2_le_imp_le: + "x\<^sup>2 \<le> y\<^sup>2 \<Longrightarrow> 0 \<le> y \<Longrightarrow> x \<le> y" + unfolding numeral_2_eq_2 by (rule power_le_imp_le_base) + +lemma power2_less_imp_less: + "x\<^sup>2 < y\<^sup>2 \<Longrightarrow> 0 \<le> y \<Longrightarrow> x < y" + by (rule power_less_imp_less_base) + +lemma power2_eq_imp_eq: + "x\<^sup>2 = y\<^sup>2 \<Longrightarrow> 0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> x = y" + unfolding numeral_2_eq_2 by (erule (2) power_eq_imp_eq_base) simp + +end + +context linordered_ring_strict +begin + +lemma sum_squares_eq_zero_iff: + "x * x + y * y = 0 \<longleftrightarrow> x = 0 \<and> y = 0" + by (simp add: add_nonneg_eq_0_iff) + +lemma sum_squares_le_zero_iff: + "x * x + y * y \<le> 0 \<longleftrightarrow> x = 0 \<and> y = 0" + by (simp add: le_less not_sum_squares_lt_zero sum_squares_eq_zero_iff) + +lemma sum_squares_gt_zero_iff: + "0 < x * x + y * y \<longleftrightarrow> x \<noteq> 0 \<or> y \<noteq> 0" + by (simp add: not_le [symmetric] sum_squares_le_zero_iff) + +end + +context linordered_idom +begin + +lemma power_abs: + "abs (a ^ n) = abs a ^ n" + by (induct n) (auto simp add: abs_mult) + +lemma abs_power_minus [simp]: + "abs ((-a) ^ n) = abs (a ^ n)" + by (simp add: power_abs) + +lemma zero_less_power_abs_iff [simp, no_atp]: + "0 < abs a ^ n \<longleftrightarrow> a \<noteq> 0 \<or> n = 0" +proof (induct n) + case 0 show ?case by simp +next + case (Suc n) show ?case by (auto simp add: Suc zero_less_mult_iff) +qed + +lemma zero_le_power_abs [simp]: + "0 \<le> abs a ^ n" + by (rule zero_le_power [OF abs_ge_zero]) + +lemma zero_le_power2 [simp]: + "0 \<le> a\<^sup>2" + by (simp add: power2_eq_square) + +lemma zero_less_power2 [simp]: + "0 < a\<^sup>2 \<longleftrightarrow> a \<noteq> 0" + by (force simp add: power2_eq_square zero_less_mult_iff linorder_neq_iff) + +lemma power2_less_0 [simp]: + "\<not> a\<^sup>2 < 0" + by (force simp add: power2_eq_square mult_less_0_iff) + +lemma abs_power2 [simp]: + "abs (a\<^sup>2) = a\<^sup>2" + by (simp add: power2_eq_square abs_mult abs_mult_self) + +lemma power2_abs [simp]: + "(abs a)\<^sup>2 = a\<^sup>2" + by (simp add: power2_eq_square abs_mult_self) + +lemma odd_power_less_zero: + "a < 0 \<Longrightarrow> a ^ Suc (2*n) < 0" +proof (induct n) + case 0 + then show ?case by simp +next + case (Suc n) + have "a ^ Suc (2 * Suc n) = (a*a) * a ^ Suc(2*n)" + by (simp add: mult_ac power_add power2_eq_square) + thus ?case + by (simp del: power_Suc add: Suc mult_less_0_iff mult_neg_neg) +qed + +lemma odd_0_le_power_imp_0_le: + "0 \<le> a ^ Suc (2*n) \<Longrightarrow> 0 \<le> a" + using odd_power_less_zero [of a n] + by (force simp add: linorder_not_less [symmetric]) + +lemma zero_le_even_power'[simp]: + "0 \<le> a ^ (2*n)" +proof (induct n) + case 0 + show ?case by simp +next + case (Suc n) + have "a ^ (2 * Suc n) = (a*a) * a ^ (2*n)" + by (simp add: mult_ac power_add power2_eq_square) + thus ?case + by (simp add: Suc zero_le_mult_iff) +qed + +lemma sum_power2_ge_zero: + "0 \<le> x\<^sup>2 + y\<^sup>2" + by (intro add_nonneg_nonneg zero_le_power2) + +lemma not_sum_power2_lt_zero: + "\<not> x\<^sup>2 + y\<^sup>2 < 0" + unfolding not_less by (rule sum_power2_ge_zero) + +lemma sum_power2_eq_zero_iff: + "x\<^sup>2 + y\<^sup>2 = 0 \<longleftrightarrow> x = 0 \<and> y = 0" + unfolding power2_eq_square by (simp add: add_nonneg_eq_0_iff) + +lemma sum_power2_le_zero_iff: + "x\<^sup>2 + y\<^sup>2 \<le> 0 \<longleftrightarrow> x = 0 \<and> y = 0" + by (simp add: le_less sum_power2_eq_zero_iff not_sum_power2_lt_zero) + +lemma sum_power2_gt_zero_iff: + "0 < x\<^sup>2 + y\<^sup>2 \<longleftrightarrow> x \<noteq> 0 \<or> y \<noteq> 0" + unfolding not_le [symmetric] by (simp add: sum_power2_le_zero_iff) + +end + + +subsection {* Miscellaneous rules *} + +lemma power_eq_if: "p ^ m = (if m=0 then 1 else p * (p ^ (m - 1)))" + unfolding One_nat_def by (cases m) simp_all + +lemma power2_sum: + fixes x y :: "'a::comm_semiring_1" + shows "(x + y)\<^sup>2 = x\<^sup>2 + y\<^sup>2 + 2 * x * y" + by (simp add: algebra_simps power2_eq_square mult_2_right) + +lemma power2_diff: + fixes x y :: "'a::comm_ring_1" + shows "(x - y)\<^sup>2 = x\<^sup>2 + y\<^sup>2 - 2 * x * y" + by (simp add: ring_distribs power2_eq_square mult_2) (rule mult_commute) + +lemma power_0_Suc [simp]: + "(0::'a::{power, semiring_0}) ^ Suc n = 0" + by simp + +text{*It looks plausible as a simprule, but its effect can be strange.*} +lemma power_0_left: + "0 ^ n = (if n = 0 then 1 else (0::'a::{power, semiring_0}))" + by (induct n) simp_all + +lemma power_eq_0_iff [simp]: + "a ^ n = 0 \<longleftrightarrow> + a = (0::'a::{mult_zero,zero_neq_one,no_zero_divisors,power}) \<and> n \<noteq> 0" + by (induct n) + (auto simp add: no_zero_divisors elim: contrapos_pp) + +lemma (in field) power_diff: + assumes nz: "a \<noteq> 0" + shows "n \<le> m \<Longrightarrow> a ^ (m - n) = a ^ m / a ^ n" + by (induct m n rule: diff_induct) (simp_all add: nz field_power_not_zero) + +text{*Perhaps these should be simprules.*} +lemma power_inverse: + fixes a :: "'a::division_ring_inverse_zero" + shows "inverse (a ^ n) = inverse a ^ n" +apply (cases "a = 0") +apply (simp add: power_0_left) +apply (simp add: nonzero_power_inverse) +done (* TODO: reorient or rename to inverse_power *) + +lemma power_one_over: + "1 / (a::'a::{field_inverse_zero, power}) ^ n = (1 / a) ^ n" + by (simp add: divide_inverse) (rule power_inverse) + +lemma power_divide: + "(a / b) ^ n = (a::'a::field_inverse_zero) ^ n / b ^ n" +apply (cases "b = 0") +apply (simp add: power_0_left) +apply (rule nonzero_power_divide) +apply assumption +done + +text {* Simprules for comparisons where common factors can be cancelled. *} + +lemmas zero_compare_simps = + add_strict_increasing add_strict_increasing2 add_increasing + zero_le_mult_iff zero_le_divide_iff + zero_less_mult_iff zero_less_divide_iff + mult_le_0_iff divide_le_0_iff + mult_less_0_iff divide_less_0_iff + zero_le_power2 power2_less_0 + + +subsection {* Exponentiation for the Natural Numbers *} + +lemma nat_one_le_power [simp]: + "Suc 0 \<le> i \<Longrightarrow> Suc 0 \<le> i ^ n" + by (rule one_le_power [of i n, unfolded One_nat_def]) + +lemma nat_zero_less_power_iff [simp]: + "x ^ n > 0 \<longleftrightarrow> x > (0::nat) \<or> n = 0" + by (induct n) auto + +lemma nat_power_eq_Suc_0_iff [simp]: + "x ^ m = Suc 0 \<longleftrightarrow> m = 0 \<or> x = Suc 0" + by (induct m) auto + +lemma power_Suc_0 [simp]: + "Suc 0 ^ n = Suc 0" + by simp + +text{*Valid for the naturals, but what if @{text"0<i<1"}? +Premises cannot be weakened: consider the case where @{term "i=0"}, +@{term "m=1"} and @{term "n=0"}.*} +lemma nat_power_less_imp_less: + assumes nonneg: "0 < (i\<Colon>nat)" + assumes less: "i ^ m < i ^ n" + shows "m < n" +proof (cases "i = 1") + case True with less power_one [where 'a = nat] show ?thesis by simp +next + case False with nonneg have "1 < i" by auto + from power_strict_increasing_iff [OF this] less show ?thesis .. +qed + +lemma power_dvd_imp_le: + "i ^ m dvd i ^ n \<Longrightarrow> (1::nat) < i \<Longrightarrow> m \<le> n" + apply (rule power_le_imp_le_exp, assumption) + apply (erule dvd_imp_le, simp) + done + +lemma power2_nat_le_eq_le: + fixes m n :: nat + shows "m\<^sup>2 \<le> n\<^sup>2 \<longleftrightarrow> m \<le> n" + by (auto intro: power2_le_imp_le power_mono) + +lemma power2_nat_le_imp_le: + fixes m n :: nat + assumes "m\<^sup>2 \<le> n" + shows "m \<le> n" + using assms by (cases m) (simp_all add: power2_eq_square) + + + +subsection {* Code generator tweak *} + +lemma power_power_power [code]: + "power = power.power (1::'a::{power}) (op *)" + unfolding power_def power.power_def .. + +declare power.power.simps [code] + +code_identifier + code_module Power \<rightharpoonup> (SML) Arith and (OCaml) Arith and (Haskell) Arith + +end + diff --git a/tests/examplefiles/example.weechatlog b/tests/examplefiles/example.weechatlog index 9f036166..15e8130f 100644 --- a/tests/examplefiles/example.weechatlog +++ b/tests/examplefiles/example.weechatlog @@ -6,4 +6,6 @@ 2007 Sep 01 00:23:55 -=- Das Topic von &bitlbee lautet: "Welcome to the control channel. Type help for help information." 2007 Sep 01 00:23:55 <root> Welcome to the BitlBee gateway! 2007 Sep 01 00:23:55 <root> -2007 Sep 01 00:23:55 <root> If you've never used BitlBee before, please do read the help information using the help command. Lots of FAQ's are answered there.
\ No newline at end of file +2007 Sep 01 00:23:55 <root> If you've never used BitlBee before, please do read the help information using the help command. Lots of FAQ's are answered there. +# check for fixed pathological matching behavior +1111111111111111111111111111111 diff --git a/tests/examplefiles/example_coq.v b/tests/examplefiles/example_coq.v new file mode 100644 index 00000000..fd1a7bc8 --- /dev/null +++ b/tests/examplefiles/example_coq.v @@ -0,0 +1,4 @@ +Lemma FalseLemma : False <-> False. +tauto. +Qed. +Check FalseLemma. diff --git a/tests/examplefiles/example_elixir.ex b/tests/examplefiles/example_elixir.ex index 0912d099..ddca7f60 100644 --- a/tests/examplefiles/example_elixir.ex +++ b/tests/examplefiles/example_elixir.ex @@ -1,13 +1,19 @@ # Numbers 0b0101011 -1234 ; 0x1A ; 0xbeef ; 0763 +1234 ; 0x1A ; 0xbeef ; 0763 ; 0o123 3.14 ; 5.0e21 ; 0.5e-12 100_000_000 +# these are not valid numbers +0b012 ; 0xboar ; 0o888 +0B01 ; 0XAF ; 0O123 + # Characters ?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, ?\x{12} ; ?\x{abcd} -?\x34 ; ?\xf +?\x34 ; ?\xF + +# these show that only the first digit is part of the character ?\123 ; ?\12 ; ?\7 # Atoms @@ -18,12 +24,13 @@ line ' \s \123 \xff atom" :... ; :<<>> ; :%{} ; :% ; :{} -:++; :--; :*; :~~~ +:++; :--; :*; :~~~; ::: +:% ; :. ; :<- # Strings "Hello world" -"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\z\+ \\ escapes" -"Quotes ' inside \" \123 the \"\" \xF string \\\" end" +"Interspersed \x{ff} codes \7 \8 \65 \016 and \t\s\\s\z\+ \\ escapes" +"Quotes ' inside \" \123 the \"\" \xF \\xF string \\\" end" "Multiline string" @@ -45,18 +52,28 @@ atom" ~w(hello #{ ["has" <> "123", '\c\d', "\123 interpol" | []] } world)s ~W(hello #{no "123" \c\d \123 interpol} world)s +~s{Escapes terminators \{ and \}, but no {balancing} # outside of sigil here } + ~S"No escapes \s\t\n and no #{interpolation}" :"atoms work #{"to" <> "o"}" # Operators x = 1 + 2.0 * 3 -y = true and false; z = false xor true +y = true and false; z = false or true ... = 144 ... == !x && y || z "hello" |> String.upcase |> String.downcase() {^z, a} = {true, x} +# Free operators (added in 1.0.0) +p ~>> f = bind(p, f) +p1 ~> p2 = pair_right(p1, p2) +p1 <~ p2 = pair_left(p1, p2) +p1 <~> p2 = pair_both(p1, p2) +p |~> f = map(p, f) +p1 <|> p2 = either(p1, p2) + # Lists, tuples, maps, keywords [1, :a, 'hello'] ++ [2, 3] [:head | [?t, ?a, ?i, ?l]] @@ -75,13 +92,18 @@ map = %{shortcut: "syntax"} # Comprehensions for x <- 1..10, x < 5, do: {x, x} pixels = "12345678" -for << <<r::4, g::4, b::4, a::4>> <- pixels >> do +for << <<r::4, g::4, b::4, a::size(4)>> <- pixels >> do [r, {g, %{"b" => a}}] end # String interpolation "String #{inspect "interpolation"} is quite #{1+4+7} difficult" +# Identifiers +abc_123 = 1 +_018OP = 2 +A__0 == 3 + # Modules defmodule Long.Module.Name do @moduledoc "Simple module docstring" @@ -89,7 +111,12 @@ defmodule Long.Module.Name do @doc """ Multiline docstring "with quotes" - and #{ %{"interpolation" => "in" <> "action"} } + and #{ inspect %{"interpolation" => "in" <> "action"} } + now with #{ {:a, 'tuple'} } + and #{ inspect { + :tuple, + %{ with: "nested #{ inspect %{ :interpolation => %{} } }" } + } } """ defstruct [:a, :name, :height] @@ -110,7 +137,8 @@ end # Structs defmodule Second.Module do s = %Long.Module.Name{name: "Silly"} - %{s | height: {192, :cm}} + %Long.Module.Name{s | height: {192, :cm}} + ".. #{%Long.Module.Name{s | height: {192, :cm}}} .." end # Types, pseudo-vars, attributes @@ -182,7 +210,7 @@ end # Lexical scope modifiers import Kernel, except: [spawn: 1, +: 2, /: 2, Unless: 2] -alias Long.Module.Name, as: Namen +alias Long.Module.Name, as: N0men123_and4 use Bitwise 4 &&& 5 diff --git a/tests/examplefiles/interp.scala b/tests/examplefiles/interp.scala new file mode 100644 index 00000000..4131b75e --- /dev/null +++ b/tests/examplefiles/interp.scala @@ -0,0 +1,10 @@ +val n = 123; +val a = s"n=$n"; +val a2 = s"n=$n''"; +val b = s"""n=$n"""; +val c = f"n=$n%f"; +val d = f"""n=$n%f"""; +val d2 = s"""a""""; +val e = s"abc\u00e9"; +val f = s"a${n}b"; +val g = s"a${n + 1}b"; diff --git a/tests/examplefiles/matlab_sample b/tests/examplefiles/matlab_sample index 4f61afe8..bb00b517 100644 --- a/tests/examplefiles/matlab_sample +++ b/tests/examplefiles/matlab_sample @@ -28,3 +28,7 @@ y = exp(x); {% a block comment %} + +function no_arg_func +fprintf('%s\n', 'function with no args') +end diff --git a/tests/examplefiles/pycon_test.pycon b/tests/examplefiles/pycon_test.pycon index ff702864..9c4fc3d3 100644 --- a/tests/examplefiles/pycon_test.pycon +++ b/tests/examplefiles/pycon_test.pycon @@ -9,6 +9,9 @@ KeyboardInterrupt >>> 1/0 Traceback (most recent call last): -... + ... ZeroDivisionError +>>> 1/0 # this used to swallow the traceback +Traceback (most recent call last): + ... diff --git a/tests/examplefiles/rust_example.rs b/tests/examplefiles/rust_example.rs index 1c0a70c3..8c44af1d 100644 --- a/tests/examplefiles/rust_example.rs +++ b/tests/examplefiles/rust_example.rs @@ -11,6 +11,8 @@ // based on: // http://shootout.alioth.debian.org/u32/benchmark.php?test=nbody&lang=java +/* nest some /* comments */ */ + extern mod std; use core::os; @@ -22,7 +24,7 @@ use core::os; // an llvm intrinsic. #[nolink] extern mod libc { - #[legacy_exports]; + #![legacy_exports]; fn sqrt(n: float) -> float; } diff --git a/tests/examplefiles/test.agda b/tests/examplefiles/test.agda index d930a77b..f6cea91c 100644 --- a/tests/examplefiles/test.agda +++ b/tests/examplefiles/test.agda @@ -12,11 +12,18 @@ open import Data.List hiding ([_]) open import Data.Vec hiding ([_]) open import Relation.Nullary.Core open import Relation.Binary.PropositionalEquality using (_≡_; refl; cong; trans; inspect; [_]) + renaming (setoid to setiod) open SemiringSolver {- this is a {- nested -} comment -} +postulate pierce : {A B : Set} → ((A → B) → A) → A + +instance + someBool : Bool + someBool = true + -- Factorial _! : ℕ → ℕ 0 ! = 1 diff --git a/tests/examplefiles/test.idr b/tests/examplefiles/test.idr index f0e96d88..fd008d31 100644 --- a/tests/examplefiles/test.idr +++ b/tests/examplefiles/test.idr @@ -60,6 +60,7 @@ using (G : Vect n Ty) fromInteger = Val . fromInteger + ||| Evaluates an expression in the given context. interp : Env G -> {static} Expr G t -> interpTy t interp env (Var i) = lookup i env interp env (Val x) = x @@ -87,6 +88,13 @@ using (G : Vect n Ty) testFac : Int testFac = interp [] eFac 4 +--testFacTooBig : Int +--testFacTooBig = interp [] eFac 100000 + + {-testFacTooBig2 : Int +testFacTooBig2 = interp [] eFac 1000 +-} + main : IO () main = print testFac diff --git a/tests/examplefiles/test.php b/tests/examplefiles/test.php index 218892fe..2ce4023e 100644 --- a/tests/examplefiles/test.php +++ b/tests/examplefiles/test.php @@ -504,4 +504,12 @@ function &byref() { $x = array(); return $x; } + + echo <<<EOF + + Test the heredocs... + + EOF; + ?> + diff --git a/tests/examplefiles/test.pypylog b/tests/examplefiles/test.pypylog index f85030cb..1a6aa5ed 100644 --- a/tests/examplefiles/test.pypylog +++ b/tests/examplefiles/test.pypylog @@ -998,842 +998,3 @@ setfield_gc(p73, i14, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntO setarrayitem_gc(p60, 9, p73, descr=<GcPtrArrayDescr>) p76 = new_with_vtable(19800744) setfield_gc(p76, f15, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -setarrayitem_gc(p60, 10, p76, descr=<GcPtrArrayDescr>) -setfield_gc(p1, 1, descr=<BoolFieldDescr pypy.interpreter.pyframe.PyFrame.inst_frame_finished_execution 148>) -setfield_gc(p1, ConstPtr(ptr79), descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_pycode 112>) -setfield_gc(p1, ConstPtr(ptr55), descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_lastblock 104>) -setfield_gc(p1, 0, descr=<SignedFieldDescr pypy.interpreter.pyframe.PyFrame.inst_valuestackdepth 128>) -setfield_gc(p1, p4, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_last_exception 88>) -setfield_gc(p1, 0, descr=<BoolFieldDescr pypy.interpreter.pyframe.PyFrame.inst_is_being_profiled 149>) -setfield_gc(p1, 307, descr=<SignedFieldDescr pypy.interpreter.pyframe.PyFrame.inst_last_instr 96>) -p84 = new_with_vtable(19800744) -setfield_gc(p84, f36, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -finish(p84, descr=<DoneWithThisFrameDescrRef object at 0x140bcc0>) -[5ed6619e9448] jit-log-opt-bridge} -[5ed74f2eef6e] {jit-log-opt-loop -# Loop 2 : loop with 394 ops -[p0, p1, p2, p3, p4, p5, p6, p7, i8, f9, i10, i11, p12, p13] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #21 LOAD_FAST', 0) -guard_nonnull_class(p7, 19800744, descr=<Guard180>) [p1, p0, p7, p2, p3, p4, p5, p6, i8] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #24 LOAD_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #27 COMPARE_OP', 0) -f15 = getfield_gc_pure(p7, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -i16 = float_gt(f15, f9) -guard_true(i16, descr=<Guard181>) [p1, p0, p6, p7, p2, p3, p4, p5, i8] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #30 POP_JUMP_IF_FALSE', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #33 LOAD_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #36 POP_JUMP_IF_FALSE', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #39 LOAD_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #42 LOAD_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #45 COMPARE_OP', 0) -i17 = int_ge(i8, i10) -guard_false(i17, descr=<Guard182>) [p1, p0, p5, p2, p3, p4, p6, p7, i8] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #48 POP_JUMP_IF_FALSE', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #55 LOAD_GLOBAL', 0) -p18 = getfield_gc(p0, descr=<GcPtrFieldDescr pypy.interpreter.eval.Frame.inst_w_globals 8>) -guard_value(p18, ConstPtr(ptr19), descr=<Guard183>) [p1, p0, p18, p2, p3, p4, p5, p6, p7, i8] -p20 = getfield_gc(p18, descr=<GcPtrFieldDescr pypy.objspace.std.dictmultiobject.W_DictMultiObject.inst_r_dict_content 8>) -guard_isnull(p20, descr=<Guard184>) [p1, p0, p20, p18, p2, p3, p4, p5, p6, p7, i8] -p22 = getfield_gc(ConstPtr(ptr21), descr=<GcPtrFieldDescr pypy.objspace.std.celldict.ModuleCell.inst_w_value 8>) -guard_nonnull_class(p22, ConstClass(Function), descr=<Guard185>) [p1, p0, p22, p2, p3, p4, p5, p6, p7, i8] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #58 LOAD_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #61 CALL_FUNCTION', 0) -p24 = getfield_gc(p22, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_code 24>) -guard_value(p24, ConstPtr(ptr25), descr=<Guard186>) [p1, p0, p24, p22, p2, p3, p4, p5, p6, p7, i8] -p26 = getfield_gc(p22, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_w_func_globals 64>) -p27 = getfield_gc(p22, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_closure 16>) -i28 = force_token() -i29 = int_is_zero(i11) -guard_true(i29, descr=<Guard187>) [p1, p0, p12, p2, p3, p22, p4, p5, p6, p7, p26, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #0 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #3 LOAD_ATTR', 1) -p30 = getfield_gc(p4, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst_map 48>) -guard_value(p30, ConstPtr(ptr31), descr=<Guard188>) [p1, p0, p12, p4, p30, p2, p3, p22, p5, p6, p7, p26, p13, i28, i8] -p33 = getfield_gc(ConstPtr(ptr32), descr=<GcPtrFieldDescr pypy.objspace.std.typeobject.W_TypeObject.inst__version_tag 16>) -guard_value(p33, ConstPtr(ptr34), descr=<Guard189>) [p1, p0, p12, p4, p33, p2, p3, p22, p5, p6, p7, p26, p13, i28, i8] -p35 = getfield_gc(p4, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst__value2 24>) -guard_nonnull_class(p35, 19800744, descr=<Guard190>) [p1, p0, p12, p35, p4, p2, p3, p22, p5, p6, p7, p26, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #6 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #9 LOAD_ATTR', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #12 BINARY_MULTIPLY', 1) -f37 = getfield_gc_pure(p35, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -f38 = float_mul(f37, f37) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #13 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #16 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #19 LOAD_ATTR', 1) -p39 = getfield_gc(p4, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst__value3 32>) -guard_nonnull_class(p39, 19800744, descr=<Guard191>) [p1, p0, p12, p39, p4, p2, p3, p22, p5, p6, p7, f38, p26, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #22 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #25 LOAD_ATTR', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #28 BINARY_MULTIPLY', 1) -f41 = getfield_gc_pure(p39, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -f42 = float_mul(f41, f41) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #29 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #32 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #35 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #38 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #41 BINARY_ADD', 1) -f43 = float_add(f38, f42) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #42 BINARY_DIVIDE', 1) -i45 = float_eq(f43, 0.000000) -guard_false(i45, descr=<Guard192>) [p1, p0, p12, f43, p2, p3, p22, p4, p5, p6, p7, f42, f38, p26, p13, i28, i8] -f47 = float_truediv(0.500000, f43) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #43 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #46 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #49 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #52 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #55 LOAD_ATTR', 1) -p48 = getfield_gc(p4, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst__value0 8>) -guard_nonnull_class(p48, ConstClass(W_IntObject), descr=<Guard193>) [p1, p0, p12, p48, p4, p2, p3, p22, p5, p6, p7, f47, f42, f38, p26, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #58 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #61 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #64 LOAD_ATTR', 1) -p50 = getfield_gc(p4, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst__value1 16>) -guard_nonnull_class(p50, ConstClass(W_IntObject), descr=<Guard194>) [p1, p0, p12, p50, p4, p2, p3, p22, p5, p6, p7, p48, f47, f42, f38, p26, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #67 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #70 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #73 LOAD_ATTR', 1) -p52 = getfield_gc(p4, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst__value4 40>) -guard_nonnull_class(p52, 19886912, descr=<Guard195>) [p1, p0, p12, p52, p4, p2, p3, p22, p5, p6, p7, p50, p48, f47, f42, f38, p26, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #76 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #79 SETUP_LOOP', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #82 LOAD_GLOBAL', 1) -guard_value(p26, ConstPtr(ptr54), descr=<Guard196>) [p1, p0, p12, p26, p2, p3, p22, p4, p5, p6, p7, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -p56 = getfield_gc(p26, descr=<GcPtrFieldDescr pypy.objspace.std.dictmultiobject.W_DictMultiObject.inst_r_dict_content 8>) -guard_isnull(p56, descr=<Guard197>) [p1, p0, p12, p56, p26, p2, p3, p22, p4, p5, p6, p7, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -p58 = getfield_gc(ConstPtr(ptr57), descr=<GcPtrFieldDescr pypy.objspace.std.celldict.ModuleCell.inst_w_value 8>) -guard_isnull(p58, descr=<Guard198>) [p1, p0, p12, p58, p2, p3, p22, p4, p5, p6, p7, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -p60 = getfield_gc(ConstPtr(ptr59), descr=<GcPtrFieldDescr pypy.interpreter.module.Module.inst_w_dict 8>) -guard_value(p60, ConstPtr(ptr61), descr=<Guard199>) [p1, p0, p12, p60, p2, p3, p22, p4, p5, p6, p7, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -p62 = getfield_gc(p60, descr=<GcPtrFieldDescr pypy.objspace.std.dictmultiobject.W_DictMultiObject.inst_r_dict_content 8>) -guard_isnull(p62, descr=<Guard200>) [p1, p0, p12, p62, p60, p2, p3, p22, p4, p5, p6, p7, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -p64 = getfield_gc(ConstPtr(ptr63), descr=<GcPtrFieldDescr pypy.objspace.std.celldict.ModuleCell.inst_w_value 8>) -guard_value(p64, ConstPtr(ptr65), descr=<Guard201>) [p1, p0, p12, p64, p2, p3, p22, p4, p5, p6, p7, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #85 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #88 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #91 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #94 BINARY_SUBTRACT', 1) -i66 = getfield_gc_pure(p48, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -i68 = int_sub_ovf(i66, 1) -guard_no_overflow(, descr=<Guard202>) [p1, p0, p12, p48, i68, p2, p3, p22, p4, p5, p6, p7, p64, p52, p50, None, f47, f42, f38, None, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #95 CALL_FUNCTION', 1) -p70 = getfield_gc(ConstPtr(ptr69), descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_name 40>) -p71 = getfield_gc(ConstPtr(ptr69), descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_defs 32>) -i72 = getfield_gc_pure(p71, descr=<BoolFieldDescr pypy.interpreter.function.Defaults.inst_promote 16>) -guard_false(i72, descr=<Guard203>) [p1, p0, p12, p70, p71, p2, p3, p22, p4, p5, p6, p7, i68, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -p73 = getfield_gc_pure(p71, descr=<GcPtrFieldDescr pypy.interpreter.function.Defaults.inst_items 8>) -i74 = arraylen_gc(p73, descr=<GcPtrArrayDescr>) -i76 = int_sub(4, i74) -i78 = int_ge(3, i76) -guard_true(i78, descr=<Guard204>) [p1, p0, p12, p70, i76, p71, p2, p3, p22, p4, p5, p6, p7, i68, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i79 = int_sub(3, i76) -i80 = getfield_gc_pure(p71, descr=<BoolFieldDescr pypy.interpreter.function.Defaults.inst_promote 16>) -guard_false(i80, descr=<Guard205>) [p1, p0, p12, p70, i79, i76, p71, p2, p3, p22, p4, p5, p6, p7, i68, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -p81 = getfield_gc_pure(p71, descr=<GcPtrFieldDescr pypy.interpreter.function.Defaults.inst_items 8>) -p82 = getarrayitem_gc(p81, i79, descr=<GcPtrArrayDescr>) -guard_class(p82, ConstClass(W_IntObject), descr=<Guard206>) [p1, p0, p12, p82, p2, p3, p22, p4, p5, p6, p7, i68, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i84 = getfield_gc_pure(p82, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -i85 = int_is_zero(i84) -guard_false(i85, descr=<Guard207>) [p1, p0, p12, i84, i68, p2, p3, p22, p4, p5, p6, p7, p82, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i87 = int_lt(i84, 0) -guard_false(i87, descr=<Guard208>) [p1, p0, p12, i84, i68, p2, p3, p22, p4, p5, p6, p7, p82, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i89 = int_lt(1, i68) -guard_true(i89, descr=<Guard209>) [p1, p0, p12, i84, i68, p2, p3, p22, p4, p5, p6, p7, p82, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i90 = int_sub(i68, 1) -i92 = int_sub(i90, 1) -i93 = uint_floordiv(i92, i84) -i95 = int_add(i93, 1) -i97 = int_lt(i95, 0) -guard_false(i97, descr=<Guard210>) [p1, p0, p12, i84, i95, p2, p3, p22, p4, p5, p6, p7, p82, i68, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #98 GET_ITER', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #99 FOR_ITER', 1) -i99 = int_gt(i95, 0) -guard_true(i99, descr=<Guard211>) [p1, p0, p12, p2, p3, p22, p4, p5, p6, p7, i84, i95, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i100 = int_add(1, i84) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #102 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #105 SETUP_LOOP', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #108 LOAD_GLOBAL', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #111 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #114 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #117 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #120 BINARY_SUBTRACT', 1) -i101 = getfield_gc_pure(p50, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -i103 = int_sub_ovf(i101, 1) -guard_no_overflow(, descr=<Guard212>) [p1, p0, p12, p50, i103, p2, p3, p22, p4, p5, p6, p7, i100, i93, i84, None, None, None, None, p52, None, p48, f47, f42, f38, None, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #121 CALL_FUNCTION', 1) -i104 = getfield_gc_pure(p71, descr=<BoolFieldDescr pypy.interpreter.function.Defaults.inst_promote 16>) -guard_false(i104, descr=<Guard213>) [p1, p0, p12, p70, p71, p2, p3, p22, p4, p5, p6, p7, i103, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -p105 = getfield_gc_pure(p71, descr=<GcPtrFieldDescr pypy.interpreter.function.Defaults.inst_items 8>) -i106 = arraylen_gc(p105, descr=<GcPtrArrayDescr>) -i108 = int_sub(4, i106) -i110 = int_ge(3, i108) -guard_true(i110, descr=<Guard214>) [p1, p0, p12, p70, i108, p71, p2, p3, p22, p4, p5, p6, p7, i103, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i111 = int_sub(3, i108) -i112 = getfield_gc_pure(p71, descr=<BoolFieldDescr pypy.interpreter.function.Defaults.inst_promote 16>) -guard_false(i112, descr=<Guard215>) [p1, p0, p12, p70, i111, i108, p71, p2, p3, p22, p4, p5, p6, p7, i103, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -p113 = getfield_gc_pure(p71, descr=<GcPtrFieldDescr pypy.interpreter.function.Defaults.inst_items 8>) -p114 = getarrayitem_gc(p113, i111, descr=<GcPtrArrayDescr>) -guard_class(p114, ConstClass(W_IntObject), descr=<Guard216>) [p1, p0, p12, p114, p2, p3, p22, p4, p5, p6, p7, i103, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i116 = getfield_gc_pure(p114, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -i117 = int_is_zero(i116) -guard_false(i117, descr=<Guard217>) [p1, p0, p12, i116, i103, p2, p3, p22, p4, p5, p6, p7, p114, None, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i119 = int_lt(i116, 0) -guard_false(i119, descr=<Guard218>) [p1, p0, p12, i116, i103, p2, p3, p22, p4, p5, p6, p7, p114, None, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i121 = int_lt(1, i103) -guard_true(i121, descr=<Guard219>) [p1, p0, p12, i116, i103, p2, p3, p22, p4, p5, p6, p7, p114, None, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i122 = int_sub(i103, 1) -i124 = int_sub(i122, 1) -i125 = uint_floordiv(i124, i116) -i127 = int_add(i125, 1) -i129 = int_lt(i127, 0) -guard_false(i129, descr=<Guard220>) [p1, p0, p12, i116, i127, p2, p3, p22, p4, p5, p6, p7, p114, i103, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #124 GET_ITER', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #125 FOR_ITER', 1) -i131 = int_gt(i127, 0) -guard_true(i131, descr=<Guard221>) [p1, p0, p12, p2, p3, p22, p4, p5, p6, p7, i116, i127, None, None, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -i132 = int_add(1, i116) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #128 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #131 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #134 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #137 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #140 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #141 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #144 BINARY_ADD', 1) -i133 = int_add_ovf(i66, 1) -guard_no_overflow(, descr=<Guard222>) [p1, p0, p12, i133, p2, p3, p22, p4, p5, p6, p7, i132, i125, i66, i116, None, None, None, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #145 BINARY_SUBSCR', 1) -i134 = getfield_gc(p52, descr=<SignedFieldDescr pypy.module.array.interp_array.W_ArrayTyped.inst_len 32>) -i135 = int_lt(i133, i134) -guard_true(i135, descr=<Guard223>) [p1, p0, p12, p52, i133, p2, p3, p22, p4, p5, p6, p7, i132, i125, None, i116, None, None, None, i100, i93, i84, None, None, None, None, None, p50, p48, f47, f42, f38, None, p13, i28, i8] -i136 = getfield_gc(p52, descr=<NonGcPtrFieldDescr pypy.module.array.interp_array.W_ArrayTyped.inst_buffer 24>) -f137 = getarrayitem_raw(i136, i133, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #146 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #149 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #152 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #155 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #158 BINARY_SUBTRACT', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #159 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #162 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #163 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #166 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #167 BINARY_SUBSCR', 1) -f138 = getarrayitem_raw(i136, 1, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #168 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #171 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #174 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #177 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #178 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #181 BINARY_MULTIPLY', 1) -i140 = int_mul_ovf(2, i66) -guard_no_overflow(, descr=<Guard224>) [p1, p0, p12, p48, i140, p2, p3, p22, p4, p5, p6, p7, f138, f137, i132, i125, None, i116, None, None, None, i100, i93, i84, None, None, None, None, p52, p50, None, f47, f42, f38, None, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #182 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #185 BINARY_ADD', 1) -i141 = int_add_ovf(i140, 1) -guard_no_overflow(, descr=<Guard225>) [p1, p0, p12, i141, p2, p3, p22, p4, p5, p6, p7, i140, f138, f137, i132, i125, None, i116, None, None, None, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #186 BINARY_SUBSCR', 1) -i143 = int_lt(i141, 0) -guard_false(i143, descr=<Guard226>) [p1, p0, p12, p52, i141, i134, p2, p3, p22, p4, p5, p6, p7, None, f138, f137, i132, i125, None, i116, None, None, None, i100, i93, i84, None, None, None, None, None, p50, p48, f47, f42, f38, None, p13, i28, i8] -i144 = int_lt(i141, i134) -guard_true(i144, descr=<Guard227>) [p1, p0, p12, p52, i141, p2, p3, p22, p4, p5, p6, p7, None, f138, f137, i132, i125, None, i116, None, None, None, i100, i93, i84, None, None, None, None, None, p50, p48, f47, f42, f38, None, p13, i28, i8] -f145 = getarrayitem_raw(i136, i141, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #187 BINARY_ADD', 1) -f146 = float_add(f138, f145) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #188 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #191 BINARY_MULTIPLY', 1) -f147 = float_mul(f146, f42) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #192 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #195 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #198 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #201 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #202 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #205 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #206 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #209 BINARY_SUBTRACT', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #210 BINARY_SUBSCR', 1) -i148 = int_lt(i66, i134) -guard_true(i148, descr=<Guard228>) [p1, p0, p12, p52, i66, p2, p3, p22, p4, p5, p6, p7, f147, None, None, f137, i132, i125, None, i116, None, None, None, i100, i93, i84, None, None, None, None, None, p50, p48, f47, f42, f38, None, p13, i28, i8] -f149 = getarrayitem_raw(i136, i66, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #211 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #214 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #217 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #220 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #221 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #224 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #225 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #228 BINARY_ADD', 1) -i151 = int_add(i133, 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #229 BINARY_SUBSCR', 1) -i152 = int_lt(i151, i134) -guard_true(i152, descr=<Guard229>) [p1, p0, p12, p52, i151, p2, p3, p22, p4, p5, p6, p7, f149, f147, None, None, f137, i132, i125, None, i116, None, None, None, i100, i93, i84, None, None, None, None, None, p50, p48, f47, f42, f38, None, p13, i28, i8] -f153 = getarrayitem_raw(i136, i151, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #230 BINARY_ADD', 1) -f154 = float_add(f149, f153) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #231 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #234 BINARY_MULTIPLY', 1) -f155 = float_mul(f154, f38) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #235 BINARY_ADD', 1) -f156 = float_add(f147, f155) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #236 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #239 BINARY_MULTIPLY', 1) -f157 = float_mul(f156, f47) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #240 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #243 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #246 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #249 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #250 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #253 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #254 STORE_SUBSCR', 1) -setarrayitem_raw(i136, i133, f157, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #255 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #258 LOAD_GLOBAL', 1) -p159 = getfield_gc(ConstPtr(ptr158), descr=<GcPtrFieldDescr pypy.objspace.std.celldict.ModuleCell.inst_w_value 8>) -guard_nonnull_class(p159, ConstClass(Function), descr=<Guard230>) [p1, p0, p12, p159, p2, p3, p22, p4, p5, p6, p7, None, None, None, None, f137, i132, i125, None, i116, None, None, None, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #261 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #264 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #267 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #270 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #271 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #274 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #275 BINARY_SUBSCR', 1) -f161 = getarrayitem_raw(i136, i133, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #276 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #279 BINARY_SUBTRACT', 1) -f162 = float_sub(f161, f137) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #280 CALL_FUNCTION', 1) -p163 = getfield_gc(p159, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_code 24>) -guard_value(p163, ConstPtr(ptr164), descr=<Guard231>) [p1, p0, p12, p163, p159, p2, p3, p22, p4, p5, p6, p7, f162, None, None, None, None, f137, i132, i125, None, i116, None, None, None, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -p165 = getfield_gc(p159, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_w_func_globals 64>) -p166 = getfield_gc(p159, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_closure 16>) -i167 = force_token() -debug_merge_point('<code object sqr, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 7> #0 LOAD_FAST', 2) -debug_merge_point('<code object sqr, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 7> #3 LOAD_FAST', 2) -debug_merge_point('<code object sqr, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 7> #6 BINARY_MULTIPLY', 2) -f168 = float_mul(f162, f162) -debug_merge_point('<code object sqr, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 7> #7 RETURN_VALUE', 2) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #283 INPLACE_ADD', 1) -f170 = float_add(0.000000, f168) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #284 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #287 JUMP_ABSOLUTE', 1) -i172 = getfield_raw(38968960, descr=<SignedFieldDescr pypysig_long_struct.c_value 0>) -i174 = int_sub(i172, 100) -setfield_raw(38968960, i174, descr=<SignedFieldDescr pypysig_long_struct.c_value 0>) -i176 = int_lt(i174, 0) -guard_false(i176, descr=<Guard232>) [p1, p0, p12, p2, p3, p22, p4, p5, p6, p7, f170, None, None, None, None, None, f137, i132, i125, None, i116, None, None, None, i100, i93, i84, None, None, None, None, p52, p50, p48, f47, f42, f38, None, p13, i28, i8] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #125 FOR_ITER', 1) -i177 = force_token() -p179 = new_with_vtable(19809200) -setfield_gc(p179, i28, descr=<SignedFieldDescr JitVirtualRef.virtual_token 8>) -setfield_gc(p12, p179, descr=<GcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_topframeref 56>) -setfield_gc(p0, i177, descr=<SignedFieldDescr pypy.interpreter.pyframe.PyFrame.vable_token 24>) -p181 = new_with_vtable(19863424) -setfield_gc(p181, p13, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_f_backref 48>) -setfield_gc(p181, ConstPtr(ptr54), descr=<GcPtrFieldDescr pypy.interpreter.eval.Frame.inst_w_globals 8>) -setfield_gc(p181, 34, descr=<INTFieldDescr pypy.interpreter.pyframe.PyFrame.inst_f_lineno 144>) -setfield_gc(p181, ConstPtr(ptr25), descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_pycode 112>) -p184 = new_array(8, descr=<GcPtrArrayDescr>) -p186 = new_with_vtable(19861240) -setfield_gc(p186, i100, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_current 8>) -setfield_gc(p186, i93, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_remaining 16>) -setfield_gc(p186, i84, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_step 24>) -setarrayitem_gc(p184, 0, p186, descr=<GcPtrArrayDescr>) -p189 = new_with_vtable(19861240) -setfield_gc(p189, i132, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_current 8>) -setfield_gc(p189, i125, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_remaining 16>) -setfield_gc(p189, i116, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_step 24>) -setarrayitem_gc(p184, 1, p189, descr=<GcPtrArrayDescr>) -setfield_gc(p181, p184, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_valuestack_w 120>) -setfield_gc(p181, 125, descr=<SignedFieldDescr pypy.interpreter.pyframe.PyFrame.inst_last_instr 96>) -p193 = new_with_vtable(19865144) -setfield_gc(p193, 291, descr=<UnsignedFieldDescr pypy.interpreter.pyopcode.FrameBlock.inst_handlerposition 8>) -setfield_gc(p193, 1, descr=<SignedFieldDescr pypy.interpreter.pyopcode.FrameBlock.inst_valuestackdepth 24>) -p197 = new_with_vtable(19865144) -setfield_gc(p197, 295, descr=<UnsignedFieldDescr pypy.interpreter.pyopcode.FrameBlock.inst_handlerposition 8>) -setfield_gc(p193, p197, descr=<GcPtrFieldDescr pypy.interpreter.pyopcode.FrameBlock.inst_previous 16>) -setfield_gc(p181, p193, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_lastblock 104>) -p200 = new_array(11, descr=<GcPtrArrayDescr>) -setarrayitem_gc(p200, 0, p4, descr=<GcPtrArrayDescr>) -p203 = new_with_vtable(19800744) -setfield_gc(p203, f38, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -setarrayitem_gc(p200, 1, p203, descr=<GcPtrArrayDescr>) -p206 = new_with_vtable(19800744) -setfield_gc(p206, f42, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -setarrayitem_gc(p200, 2, p206, descr=<GcPtrArrayDescr>) -p209 = new_with_vtable(19800744) -setfield_gc(p209, f47, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -setarrayitem_gc(p200, 3, p209, descr=<GcPtrArrayDescr>) -p212 = new_with_vtable(19800744) -setfield_gc(p212, f170, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -setarrayitem_gc(p200, 4, p212, descr=<GcPtrArrayDescr>) -setarrayitem_gc(p200, 5, p48, descr=<GcPtrArrayDescr>) -setarrayitem_gc(p200, 6, p50, descr=<GcPtrArrayDescr>) -setarrayitem_gc(p200, 7, p52, descr=<GcPtrArrayDescr>) -p218 = new_with_vtable(ConstClass(W_IntObject)) -setfield_gc(p218, 1, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -setarrayitem_gc(p200, 8, p218, descr=<GcPtrArrayDescr>) -p221 = new_with_vtable(ConstClass(W_IntObject)) -setfield_gc(p221, 1, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -setarrayitem_gc(p200, 9, p221, descr=<GcPtrArrayDescr>) -p224 = new_with_vtable(19800744) -setfield_gc(p224, f137, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -setarrayitem_gc(p200, 10, p224, descr=<GcPtrArrayDescr>) -setfield_gc(p181, p200, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_fastlocals_w 56>) -setfield_gc(p181, 2, descr=<SignedFieldDescr pypy.interpreter.pyframe.PyFrame.inst_valuestackdepth 128>) -p235 = call_assembler(p181, p12, ConstPtr(ptr25), p193, 2, ConstPtr(ptr227), 0, 125, p186, p189, ConstPtr(ptr229), ConstPtr(ptr230), ConstPtr(ptr231), ConstPtr(ptr232), ConstPtr(ptr233), ConstPtr(ptr234), p4, p203, p206, p209, p212, p48, p50, p52, p218, p221, p224, descr=<Loop1>) -guard_not_forced(, descr=<Guard233>) [p1, p0, p12, p181, p235, p179, p2, p3, p22, p4, p5, p6, p7, i8] -guard_no_exception(, descr=<Guard234>) [p1, p0, p12, p181, p235, p179, p2, p3, p22, p4, p5, p6, p7, i8] -p236 = getfield_gc(p12, descr=<GcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_w_tracefunc 72>) -guard_isnull(p236, descr=<Guard235>) [p1, p0, p12, p235, p181, p236, p179, p2, p3, p22, p4, p5, p6, p7, i8] -i237 = ptr_eq(p181, p0) -guard_false(i237, descr=<Guard236>) [p1, p0, p12, p235, p181, p179, p2, p3, p22, p4, p5, p6, p7, i8] -i238 = getfield_gc(p12, descr=<NonGcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_profilefunc 40>) -setfield_gc(p181, ConstPtr(ptr239), descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_last_exception 88>) -i240 = int_is_true(i238) -guard_false(i240, descr=<Guard237>) [p1, p0, p235, p181, p12, p179, p2, p3, p22, p4, p5, p6, p7, i8] -p241 = getfield_gc(p181, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_f_backref 48>) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #64 STORE_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #67 LOAD_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #70 LOAD_CONST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #73 INPLACE_ADD', 0) -i243 = int_add(i8, 1) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #74 STORE_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #77 JUMP_ABSOLUTE', 0) -i245 = getfield_raw(38968960, descr=<SignedFieldDescr pypysig_long_struct.c_value 0>) -i247 = int_sub(i245, 100) -setfield_raw(38968960, i247, descr=<SignedFieldDescr pypysig_long_struct.c_value 0>) -setfield_gc(p12, p241, descr=<GcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_topframeref 56>) -setfield_gc(p179, p181, descr=<GcPtrFieldDescr JitVirtualRef.forced 16>) -setfield_gc(p179, -3, descr=<SignedFieldDescr JitVirtualRef.virtual_token 8>) -i250 = int_lt(i247, 0) -guard_false(i250, descr=<Guard238>) [p1, p0, p2, p3, p4, p5, p6, p235, i243, None] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #21 LOAD_FAST', 0) -jump(p0, p1, p2, p3, p4, p5, p6, p235, i243, f9, i10, i238, p12, p241, descr=<Loop2>) -[5ed74fc965fa] jit-log-opt-loop} -[5ed74fe43ee0] {jit-log-opt-loop -# Loop 3 : entry bridge with 413 ops -[p0, p1, p2, p3, i4, p5, i6, i7, p8, p9, p10, p11, p12, p13, p14] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #21 LOAD_FAST', 0) -guard_value(i4, 0, descr=<Guard239>) [i4, p1, p0, p2, p3, p5, i6, i7, p8, p9, p10, p11, p12, p13, p14] -guard_nonnull_class(p13, 19800744, descr=<Guard240>) [p1, p0, p13, p2, p3, p5, i6, p8, p9, p10, p11, p12, p14] -guard_value(i6, 0, descr=<Guard241>) [i6, p1, p0, p2, p3, p5, p13, p9, p10, p11, p12, p14] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #24 LOAD_FAST', 0) -guard_nonnull_class(p12, 19800744, descr=<Guard242>) [p1, p0, p12, p2, p3, p5, p13, p9, p10, p11, p14] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #27 COMPARE_OP', 0) -f19 = getfield_gc_pure(p13, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -f20 = getfield_gc_pure(p12, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -i21 = float_gt(f19, f20) -guard_true(i21, descr=<Guard243>) [p1, p0, p12, p13, p2, p3, p5, p10, p11, p14] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #30 POP_JUMP_IF_FALSE', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #33 LOAD_FAST', 0) -guard_nonnull_class(p11, ConstClass(W_IntObject), descr=<Guard244>) [p1, p0, p11, p2, p3, p5, p10, p12, p13, p14] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #36 POP_JUMP_IF_FALSE', 0) -i23 = getfield_gc_pure(p11, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -i24 = int_is_true(i23) -guard_true(i24, descr=<Guard245>) [p1, p0, p11, p2, p3, p5, p10, p12, p13, p14] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #39 LOAD_FAST', 0) -guard_nonnull_class(p14, ConstClass(W_IntObject), descr=<Guard246>) [p1, p0, p14, p2, p3, p5, p10, p11, p12, p13] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #42 LOAD_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #45 COMPARE_OP', 0) -i26 = getfield_gc_pure(p14, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -i27 = int_ge(i26, i23) -guard_false(i27, descr=<Guard247>) [p1, p0, p11, p14, p2, p3, p5, p10, p12, p13] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #48 POP_JUMP_IF_FALSE', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #55 LOAD_GLOBAL', 0) -guard_value(p2, ConstPtr(ptr28), descr=<Guard248>) [p1, p0, p2, p3, p5, p10, p11, p12, p13, p14] -p29 = getfield_gc(p0, descr=<GcPtrFieldDescr pypy.interpreter.eval.Frame.inst_w_globals 8>) -guard_value(p29, ConstPtr(ptr30), descr=<Guard249>) [p1, p0, p29, p3, p5, p10, p11, p12, p13, p14] -p31 = getfield_gc(p29, descr=<GcPtrFieldDescr pypy.objspace.std.dictmultiobject.W_DictMultiObject.inst_r_dict_content 8>) -guard_isnull(p31, descr=<Guard250>) [p1, p0, p31, p29, p3, p5, p10, p11, p12, p13, p14] -p33 = getfield_gc(ConstPtr(ptr32), descr=<GcPtrFieldDescr pypy.objspace.std.celldict.ModuleCell.inst_w_value 8>) -guard_nonnull_class(p33, ConstClass(Function), descr=<Guard251>) [p1, p0, p33, p3, p5, p10, p11, p12, p13, p14] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #58 LOAD_FAST', 0) -guard_nonnull_class(p10, 19852624, descr=<Guard252>) [p1, p0, p10, p3, p5, p33, p11, p12, p13, p14] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #61 CALL_FUNCTION', 0) -p36 = getfield_gc(p33, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_code 24>) -guard_value(p36, ConstPtr(ptr37), descr=<Guard253>) [p1, p0, p36, p33, p3, p5, p10, p11, p12, p13, p14] -p38 = getfield_gc(p33, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_w_func_globals 64>) -p39 = getfield_gc(p33, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_closure 16>) -p41 = call(ConstClass(getexecutioncontext), descr=<GcPtrCallDescr>) -p42 = getfield_gc(p41, descr=<GcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_topframeref 56>) -i43 = force_token() -p44 = getfield_gc(p41, descr=<GcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_w_tracefunc 72>) -guard_isnull(p44, descr=<Guard254>) [p1, p0, p41, p44, p3, p5, p33, p10, p11, p12, p13, p14, i43, p42, p38] -i45 = getfield_gc(p41, descr=<NonGcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_profilefunc 40>) -i46 = int_is_zero(i45) -guard_true(i46, descr=<Guard255>) [p1, p0, p41, p3, p5, p33, p10, p11, p12, p13, p14, i43, p42, p38] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #0 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #3 LOAD_ATTR', 1) -p47 = getfield_gc(p10, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst_map 48>) -guard_value(p47, ConstPtr(ptr48), descr=<Guard256>) [p1, p0, p41, p10, p47, p3, p5, p33, p11, p12, p13, p14, i43, p42, p38] -p50 = getfield_gc(ConstPtr(ptr49), descr=<GcPtrFieldDescr pypy.objspace.std.typeobject.W_TypeObject.inst__version_tag 16>) -guard_value(p50, ConstPtr(ptr51), descr=<Guard257>) [p1, p0, p41, p10, p50, p3, p5, p33, p11, p12, p13, p14, i43, p42, p38] -p52 = getfield_gc(p10, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst__value2 24>) -guard_nonnull_class(p52, 19800744, descr=<Guard258>) [p1, p0, p41, p52, p10, p3, p5, p33, p11, p12, p13, p14, i43, p42, p38] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #6 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #9 LOAD_ATTR', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #12 BINARY_MULTIPLY', 1) -f54 = getfield_gc_pure(p52, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -f55 = float_mul(f54, f54) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #13 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #16 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #19 LOAD_ATTR', 1) -p56 = getfield_gc(p10, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst__value3 32>) -guard_nonnull_class(p56, 19800744, descr=<Guard259>) [p1, p0, p41, p56, p10, p3, p5, p33, p11, p12, p13, p14, f55, i43, p42, p38] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #22 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #25 LOAD_ATTR', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #28 BINARY_MULTIPLY', 1) -f58 = getfield_gc_pure(p56, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -f59 = float_mul(f58, f58) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #29 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #32 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #35 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #38 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #41 BINARY_ADD', 1) -f60 = float_add(f55, f59) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #42 BINARY_DIVIDE', 1) -i62 = float_eq(f60, 0.000000) -guard_false(i62, descr=<Guard260>) [p1, p0, p41, f60, p3, p5, p33, p10, p11, p12, p13, p14, f59, f55, i43, p42, p38] -f64 = float_truediv(0.500000, f60) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #43 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #46 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #49 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #52 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #55 LOAD_ATTR', 1) -p65 = getfield_gc(p10, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst__value0 8>) -guard_nonnull_class(p65, ConstClass(W_IntObject), descr=<Guard261>) [p1, p0, p41, p65, p10, p3, p5, p33, p11, p12, p13, p14, f64, f59, f55, i43, p42, p38] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #58 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #61 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #64 LOAD_ATTR', 1) -p67 = getfield_gc(p10, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst__value1 16>) -guard_nonnull_class(p67, ConstClass(W_IntObject), descr=<Guard262>) [p1, p0, p41, p67, p10, p3, p5, p33, p11, p12, p13, p14, p65, f64, f59, f55, i43, p42, p38] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #67 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #70 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #73 LOAD_ATTR', 1) -p69 = getfield_gc(p10, descr=<GcPtrFieldDescr pypy.objspace.std.mapdict.W_ObjectObjectSize5.inst__value4 40>) -guard_nonnull_class(p69, 19886912, descr=<Guard263>) [p1, p0, p41, p69, p10, p3, p5, p33, p11, p12, p13, p14, p67, p65, f64, f59, f55, i43, p42, p38] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #76 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #79 SETUP_LOOP', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #82 LOAD_GLOBAL', 1) -guard_value(p38, ConstPtr(ptr71), descr=<Guard264>) [p1, p0, p41, p38, p3, p5, p33, p10, p11, p12, p13, p14, p69, p67, p65, f64, f59, f55, i43, p42, None] -p73 = getfield_gc(p38, descr=<GcPtrFieldDescr pypy.objspace.std.dictmultiobject.W_DictMultiObject.inst_r_dict_content 8>) -guard_isnull(p73, descr=<Guard265>) [p1, p0, p41, p73, p38, p3, p5, p33, p10, p11, p12, p13, p14, p69, p67, p65, f64, f59, f55, i43, p42, None] -p75 = getfield_gc(ConstPtr(ptr74), descr=<GcPtrFieldDescr pypy.objspace.std.celldict.ModuleCell.inst_w_value 8>) -guard_isnull(p75, descr=<Guard266>) [p1, p0, p41, p75, p3, p5, p33, p10, p11, p12, p13, p14, p69, p67, p65, f64, f59, f55, i43, p42, None] -p77 = getfield_gc(ConstPtr(ptr76), descr=<GcPtrFieldDescr pypy.interpreter.module.Module.inst_w_dict 8>) -guard_value(p77, ConstPtr(ptr78), descr=<Guard267>) [p1, p0, p41, p77, p3, p5, p33, p10, p11, p12, p13, p14, p69, p67, p65, f64, f59, f55, i43, p42, None] -p79 = getfield_gc(p77, descr=<GcPtrFieldDescr pypy.objspace.std.dictmultiobject.W_DictMultiObject.inst_r_dict_content 8>) -guard_isnull(p79, descr=<Guard268>) [p1, p0, p41, p79, p77, p3, p5, p33, p10, p11, p12, p13, p14, p69, p67, p65, f64, f59, f55, i43, p42, None] -p81 = getfield_gc(ConstPtr(ptr80), descr=<GcPtrFieldDescr pypy.objspace.std.celldict.ModuleCell.inst_w_value 8>) -guard_value(p81, ConstPtr(ptr82), descr=<Guard269>) [p1, p0, p41, p81, p3, p5, p33, p10, p11, p12, p13, p14, p69, p67, p65, f64, f59, f55, i43, p42, None] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #85 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #88 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #91 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #94 BINARY_SUBTRACT', 1) -i83 = getfield_gc_pure(p65, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -i85 = int_sub_ovf(i83, 1) -guard_no_overflow(, descr=<Guard270>) [p1, p0, p41, p65, i85, p3, p5, p33, p10, p11, p12, p13, p14, p81, p69, p67, None, f64, f59, f55, i43, p42, None] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #95 CALL_FUNCTION', 1) -p87 = getfield_gc(ConstPtr(ptr86), descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_name 40>) -p88 = getfield_gc(ConstPtr(ptr86), descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_defs 32>) -i89 = getfield_gc_pure(p88, descr=<BoolFieldDescr pypy.interpreter.function.Defaults.inst_promote 16>) -guard_false(i89, descr=<Guard271>) [p1, p0, p41, p87, p88, p3, p5, p33, p10, p11, p12, p13, p14, i85, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -p90 = getfield_gc_pure(p88, descr=<GcPtrFieldDescr pypy.interpreter.function.Defaults.inst_items 8>) -i91 = arraylen_gc(p90, descr=<GcPtrArrayDescr>) -i93 = int_sub(4, i91) -i95 = int_ge(3, i93) -guard_true(i95, descr=<Guard272>) [p1, p0, p41, p87, i93, p88, p3, p5, p33, p10, p11, p12, p13, p14, i85, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i96 = int_sub(3, i93) -i97 = getfield_gc_pure(p88, descr=<BoolFieldDescr pypy.interpreter.function.Defaults.inst_promote 16>) -guard_false(i97, descr=<Guard273>) [p1, p0, p41, p87, i96, i93, p88, p3, p5, p33, p10, p11, p12, p13, p14, i85, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -p98 = getfield_gc_pure(p88, descr=<GcPtrFieldDescr pypy.interpreter.function.Defaults.inst_items 8>) -p99 = getarrayitem_gc(p98, i96, descr=<GcPtrArrayDescr>) -guard_class(p99, ConstClass(W_IntObject), descr=<Guard274>) [p1, p0, p41, p99, p3, p5, p33, p10, p11, p12, p13, p14, i85, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i101 = getfield_gc_pure(p99, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -i102 = int_is_zero(i101) -guard_false(i102, descr=<Guard275>) [p1, p0, p41, i101, i85, p3, p5, p33, p10, p11, p12, p13, p14, p99, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i104 = int_lt(i101, 0) -guard_false(i104, descr=<Guard276>) [p1, p0, p41, i101, i85, p3, p5, p33, p10, p11, p12, p13, p14, p99, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i106 = int_lt(1, i85) -guard_true(i106, descr=<Guard277>) [p1, p0, p41, i101, i85, p3, p5, p33, p10, p11, p12, p13, p14, p99, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i107 = int_sub(i85, 1) -i109 = int_sub(i107, 1) -i110 = uint_floordiv(i109, i101) -i112 = int_add(i110, 1) -i114 = int_lt(i112, 0) -guard_false(i114, descr=<Guard278>) [p1, p0, p41, i101, i112, p3, p5, p33, p10, p11, p12, p13, p14, p99, i85, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #98 GET_ITER', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #99 FOR_ITER', 1) -i116 = int_gt(i112, 0) -guard_true(i116, descr=<Guard279>) [p1, p0, p41, p3, p5, p33, p10, p11, p12, p13, p14, i112, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i117 = int_add(1, i101) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #102 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #105 SETUP_LOOP', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #108 LOAD_GLOBAL', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #111 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #114 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #117 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #120 BINARY_SUBTRACT', 1) -i118 = getfield_gc_pure(p67, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -i120 = int_sub_ovf(i118, 1) -guard_no_overflow(, descr=<Guard280>) [p1, p0, p41, p67, i120, p3, p5, p33, p10, p11, p12, p13, p14, i110, i117, None, i101, None, None, None, p69, None, p65, f64, f59, f55, i43, p42, None] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #121 CALL_FUNCTION', 1) -i121 = getfield_gc_pure(p88, descr=<BoolFieldDescr pypy.interpreter.function.Defaults.inst_promote 16>) -guard_false(i121, descr=<Guard281>) [p1, p0, p41, p87, p88, p3, p5, p33, p10, p11, p12, p13, p14, i120, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -p122 = getfield_gc_pure(p88, descr=<GcPtrFieldDescr pypy.interpreter.function.Defaults.inst_items 8>) -i123 = arraylen_gc(p122, descr=<GcPtrArrayDescr>) -i125 = int_sub(4, i123) -i127 = int_ge(3, i125) -guard_true(i127, descr=<Guard282>) [p1, p0, p41, p87, i125, p88, p3, p5, p33, p10, p11, p12, p13, p14, i120, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i128 = int_sub(3, i125) -i129 = getfield_gc_pure(p88, descr=<BoolFieldDescr pypy.interpreter.function.Defaults.inst_promote 16>) -guard_false(i129, descr=<Guard283>) [p1, p0, p41, p87, i128, i125, p88, p3, p5, p33, p10, p11, p12, p13, p14, i120, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -p130 = getfield_gc_pure(p88, descr=<GcPtrFieldDescr pypy.interpreter.function.Defaults.inst_items 8>) -p131 = getarrayitem_gc(p130, i128, descr=<GcPtrArrayDescr>) -guard_class(p131, ConstClass(W_IntObject), descr=<Guard284>) [p1, p0, p41, p131, p3, p5, p33, p10, p11, p12, p13, p14, i120, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i133 = getfield_gc_pure(p131, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -i134 = int_is_zero(i133) -guard_false(i134, descr=<Guard285>) [p1, p0, p41, i133, i120, p3, p5, p33, p10, p11, p12, p13, p14, p131, None, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i136 = int_lt(i133, 0) -guard_false(i136, descr=<Guard286>) [p1, p0, p41, i133, i120, p3, p5, p33, p10, p11, p12, p13, p14, p131, None, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i138 = int_lt(1, i120) -guard_true(i138, descr=<Guard287>) [p1, p0, p41, i133, i120, p3, p5, p33, p10, p11, p12, p13, p14, p131, None, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i139 = int_sub(i120, 1) -i141 = int_sub(i139, 1) -i142 = uint_floordiv(i141, i133) -i144 = int_add(i142, 1) -i146 = int_lt(i144, 0) -guard_false(i146, descr=<Guard288>) [p1, p0, p41, i133, i144, p3, p5, p33, p10, p11, p12, p13, p14, p131, i120, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #124 GET_ITER', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #125 FOR_ITER', 1) -i148 = int_gt(i144, 0) -guard_true(i148, descr=<Guard289>) [p1, p0, p41, p3, p5, p33, p10, p11, p12, p13, p14, i144, i133, None, None, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -i149 = int_add(1, i133) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #128 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #131 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #134 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #137 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #140 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #141 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #144 BINARY_ADD', 1) -i150 = int_add_ovf(i83, 1) -guard_no_overflow(, descr=<Guard290>) [p1, p0, p41, i150, p3, p5, p33, p10, p11, p12, p13, p14, i83, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #145 BINARY_SUBSCR', 1) -i151 = getfield_gc(p69, descr=<SignedFieldDescr pypy.module.array.interp_array.W_ArrayTyped.inst_len 32>) -i152 = int_lt(i150, i151) -guard_true(i152, descr=<Guard291>) [p1, p0, p41, p69, i150, p3, p5, p33, p10, p11, p12, p13, p14, None, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, None, p67, p65, f64, f59, f55, i43, p42, None] -i153 = getfield_gc(p69, descr=<NonGcPtrFieldDescr pypy.module.array.interp_array.W_ArrayTyped.inst_buffer 24>) -f154 = getarrayitem_raw(i153, i150, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #146 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #149 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #152 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #155 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #158 BINARY_SUBTRACT', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #159 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #162 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #163 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #166 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #167 BINARY_SUBSCR', 1) -f155 = getarrayitem_raw(i153, 1, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #168 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #171 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #174 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #177 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #178 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #181 BINARY_MULTIPLY', 1) -i157 = int_mul_ovf(2, i83) -guard_no_overflow(, descr=<Guard292>) [p1, p0, p41, p65, i157, p3, p5, p33, p10, p11, p12, p13, p14, f154, f155, None, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, p69, p67, None, f64, f59, f55, i43, p42, None] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #182 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #185 BINARY_ADD', 1) -i158 = int_add_ovf(i157, 1) -guard_no_overflow(, descr=<Guard293>) [p1, p0, p41, i158, p3, p5, p33, p10, p11, p12, p13, p14, i157, f154, f155, None, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #186 BINARY_SUBSCR', 1) -i160 = int_lt(i158, 0) -guard_false(i160, descr=<Guard294>) [p1, p0, p41, p69, i158, i151, p3, p5, p33, p10, p11, p12, p13, p14, None, f154, f155, None, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, None, p67, p65, f64, f59, f55, i43, p42, None] -i161 = int_lt(i158, i151) -guard_true(i161, descr=<Guard295>) [p1, p0, p41, p69, i158, p3, p5, p33, p10, p11, p12, p13, p14, None, f154, f155, None, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, None, p67, p65, f64, f59, f55, i43, p42, None] -f162 = getarrayitem_raw(i153, i158, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #187 BINARY_ADD', 1) -f163 = float_add(f155, f162) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #188 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #191 BINARY_MULTIPLY', 1) -f164 = float_mul(f163, f59) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #192 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #195 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #198 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #201 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #202 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #205 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #206 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #209 BINARY_SUBTRACT', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #210 BINARY_SUBSCR', 1) -i165 = int_lt(i83, i151) -guard_true(i165, descr=<Guard296>) [p1, p0, p41, p69, i83, p3, p5, p33, p10, p11, p12, p13, p14, f164, None, f154, None, None, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, None, p67, p65, f64, f59, f55, i43, p42, None] -f166 = getarrayitem_raw(i153, i83, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #211 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #214 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #217 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #220 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #221 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #224 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #225 LOAD_CONST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #228 BINARY_ADD', 1) -i168 = int_add(i150, 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #229 BINARY_SUBSCR', 1) -i169 = int_lt(i168, i151) -guard_true(i169, descr=<Guard297>) [p1, p0, p41, p69, i168, p3, p5, p33, p10, p11, p12, p13, p14, f166, f164, None, f154, None, None, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, None, p67, p65, f64, f59, f55, i43, p42, None] -f170 = getarrayitem_raw(i153, i168, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #230 BINARY_ADD', 1) -f171 = float_add(f166, f170) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #231 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #234 BINARY_MULTIPLY', 1) -f172 = float_mul(f171, f55) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #235 BINARY_ADD', 1) -f173 = float_add(f164, f172) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #236 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #239 BINARY_MULTIPLY', 1) -f174 = float_mul(f173, f64) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #240 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #243 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #246 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #249 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #250 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #253 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #254 STORE_SUBSCR', 1) -setarrayitem_raw(i153, i150, f174, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #255 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #258 LOAD_GLOBAL', 1) -p176 = getfield_gc(ConstPtr(ptr175), descr=<GcPtrFieldDescr pypy.objspace.std.celldict.ModuleCell.inst_w_value 8>) -guard_nonnull_class(p176, ConstClass(Function), descr=<Guard298>) [p1, p0, p41, p176, p3, p5, p33, p10, p11, p12, p13, p14, None, None, None, f154, None, None, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #261 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #264 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #267 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #270 BINARY_MULTIPLY', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #271 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #274 BINARY_ADD', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #275 BINARY_SUBSCR', 1) -f178 = getarrayitem_raw(i153, i150, descr=<FloatArrayNoLengthDescr>) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #276 LOAD_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #279 BINARY_SUBTRACT', 1) -f179 = float_sub(f178, f154) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #280 CALL_FUNCTION', 1) -p180 = getfield_gc(p176, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_code 24>) -guard_value(p180, ConstPtr(ptr181), descr=<Guard299>) [p1, p0, p41, p180, p176, p3, p5, p33, p10, p11, p12, p13, p14, f179, None, None, None, f154, None, None, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -p182 = getfield_gc(p176, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_w_func_globals 64>) -p183 = getfield_gc(p176, descr=<GcPtrFieldDescr pypy.interpreter.function.Function.inst_closure 16>) -i184 = force_token() -debug_merge_point('<code object sqr, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 7> #0 LOAD_FAST', 2) -debug_merge_point('<code object sqr, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 7> #3 LOAD_FAST', 2) -debug_merge_point('<code object sqr, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 7> #6 BINARY_MULTIPLY', 2) -f185 = float_mul(f179, f179) -debug_merge_point('<code object sqr, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 7> #7 RETURN_VALUE', 2) -i186 = int_is_true(i45) -guard_false(i186, descr=<Guard300>) [p1, p0, p41, p3, p5, p33, p10, p11, p12, p13, p14, p182, i184, p176, f185, f179, None, None, None, f154, None, None, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #283 INPLACE_ADD', 1) -f188 = float_add(0.000000, f185) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #284 STORE_FAST', 1) -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #287 JUMP_ABSOLUTE', 1) -i190 = getfield_raw(38968960, descr=<SignedFieldDescr pypysig_long_struct.c_value 0>) -i192 = int_sub(i190, 100) -setfield_raw(38968960, i192, descr=<SignedFieldDescr pypysig_long_struct.c_value 0>) -i194 = int_lt(i192, 0) -guard_false(i194, descr=<Guard301>) [p1, p0, p41, p3, p5, p33, p10, p11, p12, p13, p14, f188, None, None, None, None, None, None, None, None, f154, None, None, i149, i142, None, i133, None, None, i110, i117, None, i101, None, None, None, p69, p67, p65, f64, f59, f55, i43, p42, None] -debug_merge_point('<code object time_step, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 34> #125 FOR_ITER', 1) -i195 = force_token() -p197 = new_with_vtable(19809200) -setfield_gc(p197, i43, descr=<SignedFieldDescr JitVirtualRef.virtual_token 8>) -setfield_gc(p41, p197, descr=<GcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_topframeref 56>) -setfield_gc(p0, i195, descr=<SignedFieldDescr pypy.interpreter.pyframe.PyFrame.vable_token 24>) -p199 = new_with_vtable(19863424) -setfield_gc(p199, p42, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_f_backref 48>) -setfield_gc(p199, ConstPtr(ptr71), descr=<GcPtrFieldDescr pypy.interpreter.eval.Frame.inst_w_globals 8>) -setfield_gc(p199, 34, descr=<INTFieldDescr pypy.interpreter.pyframe.PyFrame.inst_f_lineno 144>) -setfield_gc(p199, ConstPtr(ptr37), descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_pycode 112>) -p202 = new_array(8, descr=<GcPtrArrayDescr>) -p204 = new_with_vtable(19861240) -setfield_gc(p204, i117, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_current 8>) -setfield_gc(p204, i110, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_remaining 16>) -setfield_gc(p204, i101, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_step 24>) -setarrayitem_gc(p202, 0, p204, descr=<GcPtrArrayDescr>) -p207 = new_with_vtable(19861240) -setfield_gc(p207, i149, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_current 8>) -setfield_gc(p207, i142, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_remaining 16>) -setfield_gc(p207, i133, descr=<SignedFieldDescr pypy.module.__builtin__.functional.W_XRangeIterator.inst_step 24>) -setarrayitem_gc(p202, 1, p207, descr=<GcPtrArrayDescr>) -setfield_gc(p199, p202, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_valuestack_w 120>) -setfield_gc(p199, 125, descr=<SignedFieldDescr pypy.interpreter.pyframe.PyFrame.inst_last_instr 96>) -p211 = new_with_vtable(19865144) -setfield_gc(p211, 291, descr=<UnsignedFieldDescr pypy.interpreter.pyopcode.FrameBlock.inst_handlerposition 8>) -setfield_gc(p211, 1, descr=<SignedFieldDescr pypy.interpreter.pyopcode.FrameBlock.inst_valuestackdepth 24>) -p215 = new_with_vtable(19865144) -setfield_gc(p215, 295, descr=<UnsignedFieldDescr pypy.interpreter.pyopcode.FrameBlock.inst_handlerposition 8>) -setfield_gc(p211, p215, descr=<GcPtrFieldDescr pypy.interpreter.pyopcode.FrameBlock.inst_previous 16>) -setfield_gc(p199, p211, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_lastblock 104>) -p218 = new_array(11, descr=<GcPtrArrayDescr>) -setarrayitem_gc(p218, 0, p10, descr=<GcPtrArrayDescr>) -p221 = new_with_vtable(19800744) -setfield_gc(p221, f55, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -setarrayitem_gc(p218, 1, p221, descr=<GcPtrArrayDescr>) -p224 = new_with_vtable(19800744) -setfield_gc(p224, f59, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -setarrayitem_gc(p218, 2, p224, descr=<GcPtrArrayDescr>) -p227 = new_with_vtable(19800744) -setfield_gc(p227, f64, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -setarrayitem_gc(p218, 3, p227, descr=<GcPtrArrayDescr>) -p230 = new_with_vtable(19800744) -setfield_gc(p230, f188, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -setarrayitem_gc(p218, 4, p230, descr=<GcPtrArrayDescr>) -setarrayitem_gc(p218, 5, p65, descr=<GcPtrArrayDescr>) -setarrayitem_gc(p218, 6, p67, descr=<GcPtrArrayDescr>) -setarrayitem_gc(p218, 7, p69, descr=<GcPtrArrayDescr>) -p236 = new_with_vtable(ConstClass(W_IntObject)) -setfield_gc(p236, 1, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -setarrayitem_gc(p218, 8, p236, descr=<GcPtrArrayDescr>) -p239 = new_with_vtable(ConstClass(W_IntObject)) -setfield_gc(p239, 1, descr=<SignedFieldDescr pypy.objspace.std.intobject.W_IntObject.inst_intval 8>) -setarrayitem_gc(p218, 9, p239, descr=<GcPtrArrayDescr>) -p242 = new_with_vtable(19800744) -setfield_gc(p242, f154, descr=<FloatFieldDescr pypy.objspace.std.floatobject.W_FloatObject.inst_floatval 8>) -setarrayitem_gc(p218, 10, p242, descr=<GcPtrArrayDescr>) -setfield_gc(p199, p218, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_fastlocals_w 56>) -setfield_gc(p199, 2, descr=<SignedFieldDescr pypy.interpreter.pyframe.PyFrame.inst_valuestackdepth 128>) -p253 = call_assembler(p199, p41, ConstPtr(ptr37), p211, 2, ConstPtr(ptr245), 0, 125, p204, p207, ConstPtr(ptr247), ConstPtr(ptr248), ConstPtr(ptr249), ConstPtr(ptr250), ConstPtr(ptr251), ConstPtr(ptr252), p10, p221, p224, p227, p230, p65, p67, p69, p236, p239, p242, descr=<Loop1>) -guard_not_forced(, descr=<Guard302>) [p1, p0, p41, p199, p253, p197, p3, p5, p33, p10, p11, p12, p13, p14] -guard_no_exception(, descr=<Guard303>) [p1, p0, p41, p199, p253, p197, p3, p5, p33, p10, p11, p12, p13, p14] -p254 = getfield_gc(p41, descr=<GcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_w_tracefunc 72>) -guard_isnull(p254, descr=<Guard304>) [p1, p0, p41, p253, p199, p254, p197, p3, p5, p33, p10, p11, p12, p13, p14] -i255 = ptr_eq(p199, p0) -guard_false(i255, descr=<Guard305>) [p1, p0, p41, p253, p199, p197, p3, p5, p33, p10, p11, p12, p13, p14] -i256 = getfield_gc(p41, descr=<NonGcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_profilefunc 40>) -setfield_gc(p199, ConstPtr(ptr257), descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_last_exception 88>) -i258 = int_is_true(i256) -guard_false(i258, descr=<Guard306>) [p1, p0, p253, p199, p41, p197, p3, p5, p33, p10, p11, p12, p13, p14] -p259 = getfield_gc(p199, descr=<GcPtrFieldDescr pypy.interpreter.pyframe.PyFrame.inst_f_backref 48>) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #64 STORE_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #67 LOAD_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #70 LOAD_CONST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #73 INPLACE_ADD', 0) -i261 = int_add(i26, 1) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #74 STORE_FAST', 0) -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #77 JUMP_ABSOLUTE', 0) -i263 = getfield_raw(38968960, descr=<SignedFieldDescr pypysig_long_struct.c_value 0>) -i265 = int_sub(i263, 100) -setfield_raw(38968960, i265, descr=<SignedFieldDescr pypysig_long_struct.c_value 0>) -setfield_gc(p41, p259, descr=<GcPtrFieldDescr pypy.interpreter.executioncontext.ExecutionContext.inst_topframeref 56>) -setfield_gc(p197, p199, descr=<GcPtrFieldDescr JitVirtualRef.forced 16>) -setfield_gc(p197, -3, descr=<SignedFieldDescr JitVirtualRef.virtual_token 8>) -i268 = int_lt(i265, 0) -guard_false(i268, descr=<Guard307>) [p1, p0, p3, p5, p10, p11, p12, p253, i261] -debug_merge_point('<code object laplace_solve, file '/home/alex/projects/hack/benchmarks/laplace/laplace.py', line 52> #21 LOAD_FAST', 0) -jump(p0, p1, p3, p5, p10, p11, p12, p253, i261, f20, i23, i256, p41, p259, descr=<Loop2>) -[5ed74ff695c8] jit-log-opt-loop} -[5ed8737e9776] {jit-backend-counts -0:493724565 -1:2281802 -2:1283242 -3:993105 -4:2933 -5:2163 -6:2492 -7:1799 -8:963 -9:36 -[5ed8737ee19c] jit-backend-counts} diff --git a/tests/examplefiles/unicode.js b/tests/examplefiles/unicode.js new file mode 100644 index 00000000..e77bfb80 --- /dev/null +++ b/tests/examplefiles/unicode.js @@ -0,0 +1,5 @@ +var école; +var sinθ; +var เมือง; +var a\u1234b; + diff --git a/tests/examplefiles/vpath.mk b/tests/examplefiles/vpath.mk new file mode 100644 index 00000000..a7f18fc3 --- /dev/null +++ b/tests/examplefiles/vpath.mk @@ -0,0 +1,16 @@ +vpath %.c src +vpath %.h header +EXEC=hello +SRC= hello.c main.c +OBJ= $(SRC:.c=.o) + +all: $(EXEC) + +hello: $(OBJ) + $(CC) -o $@ $^ $(LDFLAGS) + +main.o: hello.h + +%.o: %.c + $(CC) -I header -o $@ \ + -c $< $(CFLAGS) |