File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class HLL::Backend::JVM {
36
36
}
37
37
38
38
method stages () {
39
- ' jast classfile jvm'
39
+ ' jast classfile jar jvm'
40
40
}
41
41
42
42
method is_precomp_stage ($ stage ) {
@@ -60,14 +60,18 @@ class HLL::Backend::JVM {
60
60
}
61
61
62
62
method classfile ($ jast , * % adverbs ) {
63
- if % adverbs <target > eq ' classfile' && % adverbs <output > {
63
+ if ( % adverbs <target > eq ' classfile' || % adverbs < target > eq ' jar ' ) && % adverbs <output > {
64
64
nqp ::compilejasttofile($ jast . dump(), % adverbs <output >);
65
65
nqp ::null()
66
66
}
67
67
else {
68
68
nqp ::compilejast($ jast . dump());
69
69
}
70
70
}
71
+
72
+ method jar ($ cu , * % adverbs ) {
73
+ $ cu ; # the actual work is done in classfile and compilejast...
74
+ }
71
75
72
76
method jvm ($ cu , * % adverbs ) {
73
77
nqp ::loadcompunit($ cu , , % adverbs <bootstrap > ?? 1 !! 0 )
Original file line number Diff line number Diff line change @@ -2942,6 +2942,11 @@ class QAST::CompilerJAST {
2942
2942
# Serialize it.
2943
2943
my $ sh := nqp ::list_s();
2944
2944
my $ serialized := nqp ::serialize($ sc , $ sh );
2945
+
2946
+ if % * COMPILING <%?OPTIONS ><target > eq ' jar' {
2947
+ $ * JCLASS . serialized($ serialized );
2948
+ $ serialized := nqp ::null();
2949
+ }
2945
2950
2946
2951
# Now it's serialized, pop this SC off the compiling SC stack.
2947
2952
nqp ::popcompsc();
@@ -2994,7 +2999,7 @@ class QAST::CompilerJAST {
2994
2999
),
2995
3000
QAST ::Op. new (
2996
3001
: op(' deserialize' ),
2997
- QAST ::SVal. new ( : value($ serialized ) ),
3002
+ nqp ::isnull( $ serialized ) ?? QAST ::Op . new ( : op( ' null_s ' ) ) !! QAST ::SVal. new ( : value($ serialized ) ),
2998
3003
QAST ::Var. new ( : name(' cur_sc' ), : scope(' local' ) ),
2999
3004
$ sh_ast ,
3000
3005
QAST ::Op. new ( : op(' null' ) ),
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ class JAST::Class is JAST::Node {
5
5
has str $ ! name ;
6
6
has str $ ! super ;
7
7
has str $ ! filename ;
8
+ has str $ ! serialized ;
8
9
has @ ! methods ;
9
10
has @ ! fields ;
10
11
@@ -26,13 +27,15 @@ class JAST::Class is JAST::Node {
26
27
27
28
method name (* @ value ) { @ value ?? ($ ! name := @ value [0 ]) !! $ ! name }
28
29
method super (* @ value ) { @ value ?? ($ ! super := @ value [0 ]) !! $ ! super }
30
+ method serialized (* @ value ) { @ value ?? ($ ! serialized := @ value [0 ]) !! $ ! serialized }
29
31
method methods () { @ ! methods }
30
32
31
33
method dump () {
32
34
my @ dumped ;
33
35
nqp :: push (@ dumped , " + class $ ! name" );
34
36
nqp :: push (@ dumped , " + super $ ! super" );
35
37
nqp :: push (@ dumped , " + filename $ ! filename" );
38
+ nqp :: push (@ dumped , " + serialized $ ! serialized" ) unless nqp ::isnull_s($ ! serialized );
36
39
for @ ! fields {
37
40
$ _ . dump(@ dumped );
38
41
}
You can’t perform that action at this time.
0 commit comments