aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/generator/host/jvm
diff options
context:
space:
mode:
authorEduardo Julian2017-09-19 19:24:09 -0400
committerEduardo Julian2017-09-19 19:24:09 -0400
commit3744a2212a89d4ab0f176350d2d2f90696235a40 (patch)
tree28e9da49deddcb8253fca2ae94f479ba64cb5536 /new-luxc/source/luxc/generator/host/jvm
parente6afba3e17f03ed0652d18a26d0f3c053a49e7a5 (diff)
- Function generation.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/generator/host/jvm.lux8
-rw-r--r--new-luxc/source/luxc/generator/host/jvm/def.lux17
-rw-r--r--new-luxc/source/luxc/generator/host/jvm/inst.lux2
3 files changed, 19 insertions, 8 deletions
diff --git a/new-luxc/source/luxc/generator/host/jvm.lux b/new-luxc/source/luxc/generator/host/jvm.lux
index 4b4b1d38e..149fbf123 100644
--- a/new-luxc/source/luxc/generator/host/jvm.lux
+++ b/new-luxc/source/luxc/generator/host/jvm.lux
@@ -117,10 +117,14 @@
## Configs
(config: Class-Config noneC ++C [finalC])
-(config: Method-Config noneM ++M [staticM finalM synchronizedM])
-(config: Field-Config noneF ++F [staticF finalF transientF volatileF])
+(config: Method-Config noneM ++M [finalM staticM synchronizedM strictM])
+(config: Field-Config noneF ++F [finalF staticF transientF volatileF])
## Labels
(def: #export new-label
(-> Unit Label)
org.objectweb.asm.Label.new)
+
+(def: #export (simple-class name)
+ (-> Text Class)
+ [name (list)])
diff --git a/new-luxc/source/luxc/generator/host/jvm/def.lux b/new-luxc/source/luxc/generator/host/jvm/def.lux
index bb1d2cd94..18cd4f945 100644
--- a/new-luxc/source/luxc/generator/host/jvm/def.lux
+++ b/new-luxc/source/luxc/generator/host/jvm/def.lux
@@ -50,6 +50,7 @@
(host;import org.objectweb.asm.ClassWriter
(#static COMPUTE_MAXS int)
+ (#static COMPUTE_FRAMES int)
(new [int])
(visit [int int String String String (Array String)] void)
(visitEnd [] void)
@@ -100,10 +101,10 @@
(def: (method-flags config)
(-> $;Method-Config Int)
($_ i.+
- Opcodes.ACC_STRICT
(if (get@ #$;staticM config) Opcodes.ACC_STATIC 0)
(if (get@ #$;finalM config) Opcodes.ACC_FINAL 0)
- (if (get@ #$;synchronizedM config) Opcodes.ACC_SYNCHRONIZED 0)))
+ (if (get@ #$;synchronizedM config) Opcodes.ACC_SYNCHRONIZED 0)
+ (if (get@ #$;strictM config) Opcodes.ACC_STRICT 0)))
(def: (field-flags config)
(-> $;Field-Config Int)
@@ -145,12 +146,18 @@
(L/map (|>. class-to-type $t;signature))
(text;join-with "")))))
+(def: class-computes
+ Int
+ ($_ i.+
+ ClassWriter.COMPUTE_MAXS
+ ClassWriter.COMPUTE_FRAMES))
+
(do-template [<name> <flag>]
[(def: #export (<name> version visibility config name parameters super interfaces
definitions)
(-> $;Version $;Visibility $;Class-Config Text (List $;Parameter) $;Class (List $;Class) $;Def
host;Byte-Array)
- (let [writer (|> (do-to (ClassWriter.new ClassWriter.COMPUTE_MAXS)
+ (let [writer (|> (do-to (ClassWriter.new class-computes)
(ClassWriter.visit [(version-flag version)
($_ i.+
Opcodes.ACC_SUPER
@@ -177,7 +184,7 @@
definitions)
(-> $;Version $;Visibility $;Class-Config Text (List $;Parameter) (List $;Class) $;Def
host;Byte-Array)
- (let [writer (|> (do-to (ClassWriter.new ClassWriter.COMPUTE_MAXS)
+ (let [writer (|> (do-to (ClassWriter.new class-computes)
(ClassWriter.visit [(version-flag version)
($_ i.+
Opcodes.ACC_SUPER
@@ -277,4 +284,4 @@
singleton
(#;Cons head tail)
- (. head (fuse tail))))
+ (. (fuse tail) head)))
diff --git a/new-luxc/source/luxc/generator/host/jvm/inst.lux b/new-luxc/source/luxc/generator/host/jvm/inst.lux
index 0f947925c..02027294a 100644
--- a/new-luxc/source/luxc/generator/host/jvm/inst.lux
+++ b/new-luxc/source/luxc/generator/host/jvm/inst.lux
@@ -353,4 +353,4 @@
singleton
(#;Cons head tail)
- (. head (fuse tail))))
+ (. (fuse tail) head)))