diff options
author | Eduardo Julian | 2019-12-25 21:48:58 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-12-25 21:48:58 -0400 |
commit | 18f682e86ebec539ae57a37aac45ecb0eb498a1c (patch) | |
tree | cb132eede4471e0c0094cb2dbe19af1b748db976 | |
parent | fa37f5d17184db1ed95949352e71542af8fb4ce1 (diff) |
Optimized LuxRuntime::case and fixed a few bugs.
-rw-r--r-- | documentation/research/Berkeley Packet Filter (BPF).md | 5 | ||||
-rw-r--r-- | documentation/research/Graphic User Interface (GUI).md | 4 | ||||
-rw-r--r-- | documentation/research/Memory Management.md | 2 | ||||
-rw-r--r-- | documentation/research/Optimization.md | 4 | ||||
-rw-r--r-- | documentation/research/back-end/WebAssembly (WASM).md | 1 | ||||
-rw-r--r-- | documentation/research/debugging.md | 8 | ||||
-rw-r--r-- | documentation/research/documentation.md | 4 | ||||
-rw-r--r-- | documentation/research/falsehood.md | 4 | ||||
-rw-r--r-- | documentation/research/programmability.md | 4 | ||||
-rw-r--r-- | documentation/research/text_editor & ide.md | 2 | ||||
-rw-r--r-- | documentation/research/web_framework.md | 5 | ||||
-rw-r--r-- | stdlib/source/lux/tool/compiler/phase/generation/jvm/debug.lux | 32 | ||||
-rw-r--r-- | stdlib/source/lux/tool/compiler/phase/generation/jvm/host.lux | 2 | ||||
-rw-r--r-- | stdlib/source/lux/tool/compiler/phase/generation/jvm/runtime.lux | 58 | ||||
-rw-r--r-- | stdlib/source/test/lux/target/jvm.lux | 26 |
15 files changed, 108 insertions, 53 deletions
diff --git a/documentation/research/Berkeley Packet Filter (BPF).md b/documentation/research/Berkeley Packet Filter (BPF).md new file mode 100644 index 000000000..951e6ccac --- /dev/null +++ b/documentation/research/Berkeley Packet Filter (BPF).md @@ -0,0 +1,5 @@ +# Reference + +1. [Extended BPF: A new software type](https://www.youtube.com/watch?v=7pmXdG8-7WU) +1. [Berkeley Packet Filter](https://en.wikipedia.org/wiki/Berkeley_Packet_Filter) + diff --git a/documentation/research/Graphic User Interface (GUI).md b/documentation/research/Graphic User Interface (GUI).md index 210cf4756..10a2bb764 100644 --- a/documentation/research/Graphic User Interface (GUI).md +++ b/documentation/research/Graphic User Interface (GUI).md @@ -1,3 +1,7 @@ +# User experience (UX) + +1. https://lawsofux.com/ + # Widget 1. [Progress bar.js](https://kimmobrunfeldt.github.io/progressbar.js/) diff --git a/documentation/research/Memory Management.md b/documentation/research/Memory Management.md index 21a222ed9..a0524caef 100644 --- a/documentation/research/Memory Management.md +++ b/documentation/research/Memory Management.md @@ -29,7 +29,7 @@ 1. https://floooh.github.io/2018/06/17/handles-vs-pointers.html 1. https://www.codemag.com/Article/1807051/Introducing-.NET-Core-2.1-Flagship-Types-Span-T-and-Memory-T 1. https://stefansf.de/post/pointers-are-more-abstract-than-you-might-expect/ -1. http://www.memorymanagement.org/ +1. [Memory Management Reference](https://www.memorymanagement.org/) 1. [Pseudomonarchia jemallocum: The false kingdom of jemalloc, or On exploiting the jemalloc memory manager](http://phrack.com/issues/68/10.html#article) 1. https://gankro.github.io/blah/rust-layouts-and-abis/ 1. https://paul.bone.id.au/2018/10/19/gc-falsehoods/ diff --git a/documentation/research/Optimization.md b/documentation/research/Optimization.md index 32f8e0b18..a99b474e3 100644 --- a/documentation/research/Optimization.md +++ b/documentation/research/Optimization.md @@ -1,3 +1,7 @@ +# Partial evaluation + +1. [AnyDSL - A Partial Evaluation Framework for Programming High-Performance Libraries](https://anydsl.github.io/) + # For the compiler 1. [Self Hosting a Million-Lines-Per-Second Parser](https://bjou-lang.org/blog/7-10-2019-self-hosting-a-million-lines-per-second-parser/7-10-2019-self-hosting-a-million-lines-per-second-parser.html) diff --git a/documentation/research/back-end/WebAssembly (WASM).md b/documentation/research/back-end/WebAssembly (WASM).md index 3e8f5092e..4e6487d85 100644 --- a/documentation/research/back-end/WebAssembly (WASM).md +++ b/documentation/research/back-end/WebAssembly (WASM).md @@ -1,5 +1,6 @@ # Exemplar +1. [Announcing GraalWasm — a WebAssembly engine in GraalVM](https://medium.com/graalvm/announcing-graalwasm-a-webassembly-engine-in-graalvm-25cd0400a7f2) 1. [Towards a WebAssembly standalone runtime on GraalVM](https://dl.acm.org/citation.cfm?id=3362780) 1. https://github.com/vvanders/wasm_lua 1. https://github.com/AppCypher/webassemblylanguages diff --git a/documentation/research/debugging.md b/documentation/research/debugging.md index 555ae3e7f..6f7d5126b 100644 --- a/documentation/research/debugging.md +++ b/documentation/research/debugging.md @@ -1,3 +1,11 @@ +# Service + +1. https://www.bugreplay.com/ + +# Input + +1. [Debugging Inputs](https://www.dropbox.com/s/ddn3fe55lws1rdr/icse2020-ddmax.pdf) + # Omniscient debugging 1. https://pernos.co/ diff --git a/documentation/research/documentation.md b/documentation/research/documentation.md index f68070992..2bb1d12e6 100644 --- a/documentation/research/documentation.md +++ b/documentation/research/documentation.md @@ -1,3 +1,7 @@ +# Programming + +1. [Skribilo: The Ultimate Document Programming Framework](https://www.nongnu.org/skribilo/) + # Diagram | Chart 1. https://c4model.com/ diff --git a/documentation/research/falsehood.md b/documentation/research/falsehood.md new file mode 100644 index 000000000..3cf534fbc --- /dev/null +++ b/documentation/research/falsehood.md @@ -0,0 +1,4 @@ +# List + +1. [Falsehoods programmers believe about prices](https://gist.github.com/rgs/6509585) + diff --git a/documentation/research/programmability.md b/documentation/research/programmability.md new file mode 100644 index 000000000..ae8af0013 --- /dev/null +++ b/documentation/research/programmability.md @@ -0,0 +1,4 @@ +# Exemplar + +1. [offerzen: Developer-driven banking, for a developer-driven world.](https://www.offerzen.com/community/investec/) + diff --git a/documentation/research/text_editor & ide.md b/documentation/research/text_editor & ide.md index 5788c8003..98491682d 100644 --- a/documentation/research/text_editor & ide.md +++ b/documentation/research/text_editor & ide.md @@ -65,6 +65,8 @@ # Syntax Highlighting +1. [Syntax highlighting is backwards](https://www.benkuhn.net/syntax) +1. [Coding in color](https://medium.com/@evnbr/coding-in-color-3a6db2743a1e) 1. https://code.visualstudio.com/blogs/2017/02/08/syntax-highlighting-optimizations 1. https://github.com/alecthomas/chroma 1. https://www.crockford.com/contextcoloring.html diff --git a/documentation/research/web_framework.md b/documentation/research/web_framework.md index f84ca94c7..d8da1a97b 100644 --- a/documentation/research/web_framework.md +++ b/documentation/research/web_framework.md @@ -1,3 +1,7 @@ +# Virtual DOM + +1. [Optimal Virtual DOM](https://blog.kabir.sh/posts/optimal-virtual-dom.html) + # Input 1. [High-performance input handling on the web](https://nolanlawson.com/2019/08/11/high-performance-input-handling-on-the-web/) @@ -106,6 +110,7 @@ # Styling +1. [Cascading Scoped Style Sheets, aka CSSS, aka C3S](https://github.com/crislin2046/c3s) 1. [The importance of the CSS user-select property](https://www.malgol.com/the-importance-of-the-css-user-select-property/) 1. [Index fun](https://psuter.net/2019/07/07/z-index) 1. [Constraint layouts](https://blog.gtk.org/2019/07/02/constraint-layouts/) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/debug.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/debug.lux new file mode 100644 index 000000000..142c46224 --- /dev/null +++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/debug.lux @@ -0,0 +1,32 @@ +(.module: + [lux #* + [abstract + [monad (#+ do)]] + [control + ["." io (#+ IO)] + ["." try (#+ Try)] + [security + ["!" capability]]] + [data + [binary (#+ Binary)] + [text + ["%" format (#+ format)]]] + [world + ["." file (#+ File)]]]) + +(def: extension ".class") + +(def: #export (write-class! name bytecode) + (-> Text Binary (IO Text)) + (let [file-path (format name ..extension)] + (do io.monad + [outcome (do (try.with @) + [file (: (IO (Try (File IO))) + (file.get-file io.monad file.system file-path))] + (!.use (:: file over-write) bytecode))] + (wrap (case outcome + (#try.Success definition) + file-path + + (#try.Failure error) + error))))) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/host.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/host.lux index 2892ac045..86b9aa095 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/host.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/host.lux @@ -52,7 +52,7 @@ (import: #long java/lang/ClassLoader) -(def: value::field "_value") +(def: value::field "value") (def: value::type (type.class "java.lang.Object" (list))) (def: value::modifier ($_ modifier@compose field.public field.final field.static)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/runtime.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/runtime.lux index 3ed3ecb52..89a1b94c1 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/runtime.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/runtime.lux @@ -97,10 +97,12 @@ (def: (set! index value) (-> (Bytecode Any) (Bytecode Any) (Bytecode Any)) ($_ _.compose - _.dup - index - value - _.aastore)) + ## A + _.dup ## AA + index ## AAI + value ## AAIV + _.aastore ## A + )) (def: #export unit (_.string synthesis.unit)) @@ -125,10 +127,10 @@ ..variant::type (list) (#.Some ($_ _.compose - new-variant - (..set! ..variant-tag $tag) - (..set! ..variant-last? $last?) - (..set! ..variant-value $value) + new-variant ## A[3] + (..set! ..variant-tag $tag) ## A[3] + (..set! ..variant-last? $last?) ## A[3] + (..set! ..variant-value $value) ## A[3] _.areturn))))) (def: #export left-flag _.aconst-null) @@ -184,12 +186,12 @@ (def: decode-frac::method (method.method ..modifier ..decode-frac::name - ..variant::type + ..decode-frac::type (list) (#.Some (..risky ($_ _.compose - ..this + _.aload-0 (_.invokestatic //type.frac "parseDouble" (type.method [(list //type.text) type.double (list)])) (//value.wrap type.double) ))))) @@ -202,7 +204,7 @@ print-type (type.method [(list //type.value) type.void (list)]) print! (function (_ method) (_.invokevirtual ^PrintStream method print-type))] ($_ _.compose - out (_.string "LOG: ") (print! "print") + out (_.string "LUX LOG: ") (print! "print") out _.swap (print! "println")))) (def: exception-constructor (type.method [(list //type.text) type.void (list)])) @@ -290,9 +292,7 @@ not-found _.aconst-null - update-$tag ($_ _.compose - _.isub - _.istore-1) + update-$tag _.isub update-$variant ($_ _.compose $variant ::value (_.checkcast //type.variant) @@ -300,21 +300,24 @@ recur (: (-> Label (Bytecode Any)) (function (_ @loop-start) ($_ _.compose - update-$tag - update-$variant + ## tag, sumT + update-$variant ## tag, sumT + update-$tag ## sub-tag (_.goto @loop-start)))) super-nested-tag ($_ _.compose - $variant ::tag - $tag _.isub) + ## tag, sumT + _.swap ## sumT, tag + _.isub) super-nested ($_ _.compose - super-nested-tag - $variant ::last? - $variant ::value + ## tag, sumT + super-nested-tag ## super-tag + $variant ::last? ## super-tag, super-last + $variant ::value ## super-tag, super-last, super-value ..variant)]] ($_ _.compose - (_.set-label @loop) $tag + (_.set-label @loop) $variant ::tag _.dup2 (_.if-icmpeq @tags-match!) _.dup2 (_.if-icmpgt @maybe-nested) @@ -323,11 +326,11 @@ not-found _.areturn (_.set-label @tags-match!) ## tag, sumT - $last? ## tag, sumT, wants-last? + $last? ## tag, sumT, wants-last? $variant ::last? ## tag, sumT, wants-last?, is-last? (_.if-acmpeq @perfect-match!) ## tag, sumT - (_.set-label @maybe-nested) ## tag, sumT - $variant ::last? ## tag, sumT, last? + (_.set-label @maybe-nested) ## tag, sumT + $variant ::last? ## tag, sumT, last? (_.ifnull @mismatch!) ## tag, sumT (recur @loop) (_.set-label @perfect-match!) ## tag, sumT @@ -335,9 +338,8 @@ $variant ::value _.areturn (_.set-label @maybe-super-nested) ## tag, sumT - $last? (_.ifnull @mismatch!) - ## _.pop2 - super-nested + $last? (_.ifnull @mismatch!) ## tag, sumT + super-nested ## super-variant _.areturn (_.set-label @mismatch!) ## tag, sumT ## _.pop2 diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index ab6cd5867..a4a13cbe4 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -5,14 +5,11 @@ ["." monad (#+ do)]] [control ["." function] - ["." io (#+ IO)] - ["." try (#+ Try)] + ["." io] + ["." try] [concurrency - ["." atom]] - [security - ["!" capability]]] + ["." atom]]] [data - [binary (#+ Binary)] ["." maybe] ["." bit ("#@." equivalence)] [number @@ -31,8 +28,6 @@ ["." row] ["." set] ["." list ("#@." functor)]]] - [world - ["." file (#+ File)]] [math ["." random (#+ Random) ("#@." monad)]] ["_" test (#+ Test)]] @@ -57,21 +52,6 @@ ["#." type (#+ Type) ["." category (#+ Value Object Class)]]]}) -## (def: (write-class! name bytecode) -## (-> Text Binary (IO Text)) -## (let [file-path (format name ".class")] -## (do io.monad -## [outcome (do (try.with @) -## [file (: (IO (Try (File IO))) -## (file.get-file io.monad file.system file-path))] -## (!.use (:: file over-write) bytecode))] -## (wrap (case outcome -## (#try.Success definition) -## (format "Wrote: " (%.text file-path)) - -## (#try.Failure error) -## error))))) - (def: method-modifier ($_ /modifier@compose /method.public |