aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2019-05-29 23:34:17 -0400
committerEduardo Julian2019-05-29 23:34:17 -0400
commita85bfc405e7acaf86c61fcd8f7987da0200d7b03 (patch)
tree0bdcbef2e40814d9e5a828c9c8fcf83d233b2645
parent36d22e31ab696b2cf3382d77b0896dcb357dfb8c (diff)
Various fixes and tweaks.
-rw-r--r--documentation/research/browser.md4
-rw-r--r--documentation/research/game_programming.md1
-rw-r--r--documentation/research/machine_learning.md1
-rw-r--r--documentation/research/math.md6
-rw-r--r--documentation/research/operating_system.md1
-rw-r--r--documentation/research/web_framework.md1
-rw-r--r--luxc/src/lux/compiler/jvm/proc/host.clj2
-rw-r--r--new-luxc/source/luxc/lang/host/jvm/def.lux31
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux18
-rw-r--r--stdlib/source/lux/host.jvm.lux6
-rw-r--r--stdlib/source/lux/host.old.lux4
-rw-r--r--stdlib/source/lux/target/jvm/attribute.lux6
-rw-r--r--stdlib/source/lux/target/jvm/loader.lux59
13 files changed, 103 insertions, 37 deletions
diff --git a/documentation/research/browser.md b/documentation/research/browser.md
index 6cd54b268..f3c6bf511 100644
--- a/documentation/research/browser.md
+++ b/documentation/research/browser.md
@@ -28,6 +28,10 @@
1. [Secure Browser Architecture Based on Hardware Virtualization](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.664.9527&rep=rep1&type=pdf)
1. https://medium.com/personal-capital-tech-blog/why-we-write-post-only-apis-f15108fb6558
+# Performance
+
+1. https://github.com/slightlyoff/never_slow_mode
+
# Reference
1. http://news.mit.edu/2018/system-patches-private-browsing-0223
diff --git a/documentation/research/game_programming.md b/documentation/research/game_programming.md
index a26c03dbe..0241e84cc 100644
--- a/documentation/research/game_programming.md
+++ b/documentation/research/game_programming.md
@@ -47,6 +47,7 @@
# Rendering
+1. https://zzz.dog/
1. https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/
1. https://roughjs.com/
1. https://github.com/pshihn/rough
diff --git a/documentation/research/machine_learning.md b/documentation/research/machine_learning.md
index 6a46367da..f63e36d3c 100644
--- a/documentation/research/machine_learning.md
+++ b/documentation/research/machine_learning.md
@@ -22,6 +22,7 @@
# Deep learning
+1. https://github.com/microsoft/tensorwatch
1. https://d2l.ai/
1. https://hadrienj.github.io/posts/Deep-Learning-Book-Series-Introduction/
1. http://nlp.seas.harvard.edu/NamedTensor
diff --git a/documentation/research/math.md b/documentation/research/math.md
index 30a7fc8ab..fc3d8b495 100644
--- a/documentation/research/math.md
+++ b/documentation/research/math.md
@@ -1,3 +1,7 @@
+# Proof theory
+
+1. [Mathematical Components](https://math-comp.github.io/mcb/)
+
# Statistics
1. https://www.statisticsdonewrong.com/
@@ -69,6 +73,7 @@
# Linear Algebra
+1. [Covectors are Different than Vectors, Usually](http://infohost.nmt.edu/~parendt/Phys509/notes/2diracnot/node4.html)
1. [Introduction to Applied Linear Algebra: Vectors, Matrices, and Least Squares](https://web.stanford.edu/~boyd/vmls/vmls.pdf)
1. [Linear Algebra Done Wrong.](http://www.math.brown.edu/~treil/papers/LADW/LADW.html)
1. [Linear Algebra Done Right](http://linear.axler.net/)
@@ -143,6 +148,7 @@
# Calculus
+1. [Calculus on Manifolds](http://strangebeautiful.com/other-texts/spivak-calc-manifolds.pdf)
1. [Calculus BLUE](https://www.youtube.com/watch?v=Jes5jwLl1q8&list=PL8erL0pXF3JYm7VaTdKDaWc8Q3FuP8Sa7)
1. [Extending the Algebraic Manipulability of Differentials](https://arxiv.org/abs/1801.09553)
1. https://en.wikipedia.org/wiki/Fractional_calculus
diff --git a/documentation/research/operating_system.md b/documentation/research/operating_system.md
index 4fadac98c..b65b1c238 100644
--- a/documentation/research/operating_system.md
+++ b/documentation/research/operating_system.md
@@ -10,6 +10,7 @@
## Operating system
+1. https://medium.com/@jasonyuan/introducing-mercury-os-f4de45a04289
1. http://lsneff.me/why-nebulet/ ||| https://github.com/nebulet/nebulet
1. http://exposnitc.github.io/index.html
1. https://www.gocosmos.org/
diff --git a/documentation/research/web_framework.md b/documentation/research/web_framework.md
index ffb98b88b..5dd11d8c2 100644
--- a/documentation/research/web_framework.md
+++ b/documentation/research/web_framework.md
@@ -121,6 +121,7 @@
# Rendering
+1. https://medium.com/@ryansolid/the-fastest-way-to-render-the-dom-e3b226b15ca3
1. https://github.com/Famous/engine
1. https://redom.js.org/
1. https://svelte.dev/blog/virtual-dom-is-pure-overhead
diff --git a/luxc/src/lux/compiler/jvm/proc/host.clj b/luxc/src/lux/compiler/jvm/proc/host.clj
index 11cf39ee9..0d10d3569 100644
--- a/luxc/src/lux/compiler/jvm/proc/host.clj
+++ b/luxc/src/lux/compiler/jvm/proc/host.clj
@@ -165,7 +165,7 @@
&&/unwrap-char
(.visitInsn Opcodes/IRETURN))
- (&/$GenericClass _class-name (&/$Nil))
+ (&/$GenericClass _class-name _)
(doto writer
(.visitTypeInsn Opcodes/CHECKCAST (&host-generics/->bytecode-class-name _class-name))
(.visitInsn Opcodes/ARETURN))
diff --git a/new-luxc/source/luxc/lang/host/jvm/def.lux b/new-luxc/source/luxc/lang/host/jvm/def.lux
index bf4abc8ed..4d1b99da0 100644
--- a/new-luxc/source/luxc/lang/host/jvm/def.lux
+++ b/new-luxc/source/luxc/lang/host/jvm/def.lux
@@ -12,7 +12,8 @@
["." list ("#/." functor)]]]
[target
[jvm
- ["$t" type (#+ Method Class Type Parameter)]]]]
+ ["$t" type (#+ Method Class Type Parameter)
+ ["." reflection]]]]]
["." //])
(import: #long java/lang/Object)
@@ -71,10 +72,36 @@
(list.enumerate values))
output)))
+(def: (exception-class-name type)
+ (-> Type Text)
+ (case type
+ (#$t.Primitive prim)
+ (case prim
+ #$t.Boolean reflection.boolean
+ #$t.Byte reflection.byte
+ #$t.Short reflection.short
+ #$t.Int reflection.int
+ #$t.Long reflection.long
+ #$t.Float reflection.float
+ #$t.Double reflection.double
+ #$t.Char reflection.char)
+
+ (#$t.Array sub)
+ (format $t.array-prefix (exception-class-name sub))
+
+ (#$t.Generic generic)
+ (case generic
+ (#$t.Class class params)
+ ($t.binary-name class)
+
+ (^or (#$t.Var _) (#$t.Wildcard _))
+ ($t.binary-name $t.object-class))
+ ))
+
(def: exceptions-array
(-> Method (Array Text))
(|>> (get@ #$t.exceptions)
- (list/map (|>> #$t.Generic $t.descriptor))
+ (list/map (|>> #$t.Generic ..exception-class-name))
string-array))
(def: (version-flag version)
diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
index 83cbd017b..4239a89aa 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
@@ -4,6 +4,7 @@
["." monad (#+ do)]]
[control
["." exception (#+ exception:)]
+ ["." function]
["<>" parser ("#@." monad)
["<t>" text]
["<s>" synthesis (#+ Parser)]]]
@@ -343,7 +344,7 @@
(do phase.monad
[lengthI (generate lengthS)]
(wrap (|>> lengthI
- (_.array (jvm.array 1 jvm-primitive)))))
+ (_.array jvm-primitive))))
_
(phase.throw extension.invalid-syntax [extension-name %synthesis inputs]))))
@@ -728,6 +729,15 @@
#.None
argI))
+(def: (prepare-returnI return)
+ (-> Return Inst)
+ (case return
+ (#.Some _)
+ function.identity
+
+ #.None
+ (_.string synthesis.unit)))
+
(def: invoke::static
Handler
(..custom
@@ -739,7 +749,8 @@
(wrap (|>> (_.fuse (list@map ..prepare-argI argsTI))
(_.INVOKESTATIC class method
(jvm.method (list@map product.left argsTI) returnT (list))
- false)))))]))
+ false)
+ (prepare-returnI returnT)))))]))
(template [<name> <invoke> <interface?>]
[(def: <name>
@@ -756,7 +767,8 @@
(_.fuse (list@map ..prepare-argI argsTI))
(<invoke> class method
(jvm.method (list@map product.left argsTI) returnT (list))
- <interface?>)))))]))]
+ <interface?>)
+ (prepare-returnI returnT)))))]))]
[invoke::virtual _.INVOKEVIRTUAL false]
[invoke::special _.INVOKESPECIAL false]
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux
index eb81a408e..9578288c2 100644
--- a/stdlib/source/lux/host.jvm.lux
+++ b/stdlib/source/lux/host.jvm.lux
@@ -1007,7 +1007,7 @@
(code.local-identifier "?")
(#.Some [bound bound])
- (` [(~ (..bound$ bound)) (~ (generic$ bound))]))))
+ (` ((~ (..bound$ bound)) (~ (generic$ bound)))))))
(def: (type$ type)
(-> Type Code)
@@ -1464,8 +1464,8 @@
## else
(let [g!temp (` ((~' ~') (~ (code.identifier ["" " Ω "]))))]
(` (let [(~ g!temp) (~ return-term)]
- (if (not (null? (:coerce (primitive "java.lang.Object")
- (~ g!temp))))
+ (if (not (..null? (:coerce (primitive "java.lang.Object")
+ (~ g!temp))))
(~ g!temp)
(error! "Cannot produce null references from method calls."))))))
diff --git a/stdlib/source/lux/host.old.lux b/stdlib/source/lux/host.old.lux
index 5c2ac40d9..db8145ab2 100644
--- a/stdlib/source/lux/host.old.lux
+++ b/stdlib/source/lux/host.old.lux
@@ -1569,8 +1569,8 @@
(` (??? (~ return-term)))
(let [g!temp (` ((~' ~') (~ (code.identifier ["" " Ω "]))))]
(` (let [(~ g!temp) (~ return-term)]
- (if (not (null? (:coerce (primitive "java.lang.Object")
- (~ g!temp))))
+ (if (not (..null? (:coerce (primitive "java.lang.Object")
+ (~ g!temp))))
(~ g!temp)
(error! "Cannot produce null references from method calls."))))))
diff --git a/stdlib/source/lux/target/jvm/attribute.lux b/stdlib/source/lux/target/jvm/attribute.lux
index bcd3a3734..024f0ec3f 100644
--- a/stdlib/source/lux/target/jvm/attribute.lux
+++ b/stdlib/source/lux/target/jvm/attribute.lux
@@ -86,9 +86,9 @@
(State Pool Attribute))
(do state.monad
[@name (//constant/pool.utf8 "ConstantValue")]
- (wrap (#Constant {#name @name
- #length (//encoding.to-u4 //encoding.u2-bytes)
- #info index}))))
+ (wrap {#name @name
+ #length (//encoding.to-u4 //encoding.u2-bytes)
+ #info index})))
## (def: #export (code specification)
## (-> Code' (State Pool Attribute))
diff --git a/stdlib/source/lux/target/jvm/loader.lux b/stdlib/source/lux/target/jvm/loader.lux
index 882a5c7dd..5aa4bc271 100644
--- a/stdlib/source/lux/target/jvm/loader.lux
+++ b/stdlib/source/lux/target/jvm/loader.lux
@@ -1,5 +1,6 @@
(.module:
[lux #*
+ ["@" target]
[abstract
[monad (#+ do)]]
[control
@@ -45,7 +46,7 @@
(invoke [java/lang/Object [java/lang/Object]] #try java/lang/Object))
(import: #long (java/lang/Class a)
- (getDeclaredMethod [java/lang/String [(java/lang/Class java/lang/Object)]] #try java/lang/reflect/Method))
+ (getDeclaredMethod [java/lang/String [(java/lang/Class java/lang/Object)]] java/lang/reflect/Method))
(import: #long java/lang/Integer
(#static TYPE (java/lang/Class java/lang/Integer)))
@@ -68,10 +69,9 @@
(java/lang/Integer::TYPE)))
(host.array-write 3 (:coerce <elemT>
(java/lang/Integer::TYPE))))]
- (do-to (error.assume
- (java/lang/Class::getDeclaredMethod "defineClass"
- signature
- (host.class-for java/lang/ClassLoader)))
+ (do-to (java/lang/Class::getDeclaredMethod "defineClass"
+ signature
+ (host.class-for java/lang/ClassLoader))
(java/lang/reflect/AccessibleObject::setAccessible true)))))
(def: #export (define class-name bytecode loader)
@@ -81,9 +81,14 @@
(:coerce java/lang/Object
bytecode)
(:coerce java/lang/Object
- (host.long-to-int +0))
+ (|> 0
+ (:coerce (primitive "java.lang.Long"))
+ host.long-to-int))
(:coerce java/lang/Object
- (host.long-to-int (.int (binary.size bytecode))))))]
+ (|> bytecode
+ binary.size
+ (:coerce (primitive "java.lang.Long"))
+ host.long-to-int))))]
(java/lang/reflect/Method::invoke loader signature java/lang/ClassLoader::defineClass)))
(def: #export (new-library _)
@@ -92,22 +97,30 @@
(def: #export (memory library)
(-> Library java/lang/ClassLoader)
- (object [] java/lang/ClassLoader []
- []
- (java/lang/ClassLoader (findClass self {class-name java/lang/String}) java/lang/Class
- (let [classes (|> library atom.read io.run)]
- (case (dictionary.get class-name classes)
- (#.Some bytecode)
- (case (|> self
- (..define class-name bytecode))
- (#error.Success class)
- (:assume class)
-
- (#error.Failure error)
- (error! (ex.construct ..cannot-define [class-name error])))
-
- #.None
- (error! (ex.construct ..unknown [class-name (dictionary.keys classes)])))))))
+ (`` (with-expansions [<cast> (for {(~~ (static @.old))
+ (<|)
+
+ (~~ (static @.jvm))
+ "jvm object cast"})]
+ (<| <cast>
+ (object [] java/lang/ClassLoader []
+ []
+ (java/lang/ClassLoader (findClass self {class-name java/lang/String})
+ (java/lang/Class [? < java/lang/Object])
+ #throws [java/lang/ClassNotFoundException]
+ (let [class-name (:coerce Text class-name)
+ classes (|> library atom.read io.run)]
+ (case (dictionary.get class-name classes)
+ (#.Some bytecode)
+ (case (..define class-name bytecode (<| <cast> self))
+ (#error.Success class)
+ (:assume class)
+
+ (#error.Failure error)
+ (error! (ex.construct ..cannot-define [class-name error])))
+
+ #.None
+ (error! (ex.construct ..unknown [class-name (dictionary.keys classes)]))))))))))
(def: #export (store name bytecode library)
(-> Text Binary Library (IO (Error Any)))