Skip to content

Commit 338ca44

Browse files
KJ-11 Eliminate the rule [runtime-elabExpressions].
Fixed the problems reported by jenkins test.
1 parent ad2d339 commit 338ca44

4 files changed

Lines changed: 21 additions & 15 deletions

File tree

semantics/api-core.k

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,13 @@ rule [storeCopyDiscard]:
275275
//@We need to synchronize access to class literals to avoid instantiation of the came .class by multiple threads. This is done by the term temp in <classLiteralsMap>. We cannot use 'Synchronized because it required an objectClousre as argument, and we might not have any objects instantiated at the moment.
276276
rule [ClassLiteralInstantiate]:
277277
<k>
278-
(. => saveClassLiteral(T, 'NewInstance(
278+
(. => saveClassLiteral(T,
279+
elab('NewInstance(
279280
'None(.KList),,
280281
class String2Id("java.lang.Class"),,
281282
'ListWrap(toString(T)),,
282283
'None(.KList)
283-
))
284+
)))
284285
)
285286
~> 'Lit('Class(T:Type))::_
286287
...

semantics/elaborate-blocks.k

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,17 +1267,6 @@ rule count(Ks:KList) => count(0, Ks)
12671267
rule count(I:Int, K:K,, Ks:KList) => count(I +Int 1, Ks)
12681268
rule count(I:Int, .KList) => I::int
12691269
1270-
//@ Unwrap elaborated terms in execution phase, so that they could be executed.
1271-
rule [elabRes-ExecutionPhase-discard1]:
1272-
<k> (elabRes(K:K) => K) ~> KL:KLabel(_) ...</k>
1273-
<globalPhase> ExecutionPhase </globalPhase>
1274-
when
1275-
KL =/=KLabel 'elab`(_`)
1276-
1277-
rule [elabRes-ExecutionPhase-discard2]:
1278-
<k> elabRes(K:K) => K </k>
1279-
<globalPhase> ExecutionPhase </globalPhase>
1280-
12811270
//@\subsection{Elaboration of SuperConstrInv, AltConstrInv}
12821271
12831272
//@ Desugaring unqualified superclass constructor invocation into a qualified one
@@ -1356,4 +1345,20 @@ rule [getEnclosingClass]:
13561345
<classType> Class </classType>
13571346
<enclosingClass> EnclosingClass:ClassType </enclosingClass>
13581347

1348+
//@ \subsection{Hacks related to elaboration during execution phase}
1349+
1350+
//@ Unwrap elaborated terms in execution phase, so that they could be executed.
1351+
rule [elabRes-ExecutionPhase-discard1]:
1352+
<k> (elabRes(K:K) => K) ~> KL:KLabel(_) ...</k>
1353+
<globalPhase> ExecutionPhase </globalPhase>
1354+
when
1355+
KL =/=KLabel 'elab`(_`)
1356+
1357+
rule [elabRes-ExecutionPhase-discard2]:
1358+
<k> elabRes(K:K) => K </k>
1359+
<globalPhase> ExecutionPhase </globalPhase>
1360+
1361+
//Required for [VarDecWithArrayInitDesugar], [FieldDecWithArrayInitDesugar]
1362+
rule elab(elab(K:K)) => elab(K)
1363+
13591364
endmodule

semantics/statements.k

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ rule [ThrowCheckedTrue]:
412412
~> catchBlocks(catchImpl(paramImpl(T:Type, X:Id), CatchS:K),, _)
413413
=> 'Block('ListWrap(
414414
'LocalVarDec(.K,, T,, 'ListWrap('VarDec(X))),,
415-
'ExprStm('Assign(localVar(X)::T,, TV)),,
415+
elab('ExprStm('Assign(localVar(X)::T,, TV))),,
416416
CatchS
417417
))
418418

semantics/static-init.k

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ rule [staticInit]:
3636
=> elab('ListWrap(
3737
staticInit(BaseClass),,
3838
'Try(
39-
StaticInit,,
39+
elabRes(StaticInit),,
4040

4141
//catch clause of 'Try
4242
'ListWrap(

0 commit comments

Comments
 (0)