Currently the origin-track-forced strategy abuses the fact that the one strategy tracks origins by constructing a list and then applying the one strategy. This has the overhead of constructing and deconstructing a list. If it was implemented as a primitive that gets and sets origins, the overhead of list construction and deconstruction is removed.

Submitted by Gabriël Konat on 9 July 2013 at 00:09

On 9 July 2013 at 00:10 Gabriël Konat tagged origin-tracking

On 9 July 2013 at 00:10 Gabriël Konat removed tag error

On 9 July 2013 at 00:10 Gabriël Konat tagged improvement

On 13 July 2013 at 01:54 Gabriël Konat tagged performance

On 13 July 2013 at 01:54 Gabriël Konat tagged minor

On 16 May 2014 at 17:51 Gabriël Konat commented:

Implemented a primitive for preserving origins and annotations in https://github.com/metaborg/mb-exec/commit/18953f5c24770e06a2fe3c6697bbe5954eed43e0.


On 16 May 2014 at 17:51 Gabriël Konat closed this issue.

On 21 January 2015 at 15:09 D. Pelsmaeker commented:

The SSL_preserve_annotations_attachments primitive throws an exception when the term is not mutable.

Caused by: org.strategoxt.lang.StrategoException: Exception in execution of primitive 'SSL_preserve_annotations_attachments'
	at org.strategoxt.lang.StackSaver.invokeStackFriendly(StackSaver.java:77)
	at org.strategoxt.lang.Context.invokeStrategyCLI(Context.java:178)
	at org.strategoxt.strj.Main.mainNoExit(Main.java:2786)
	... 65 more
Caused by: org.strategoxt.lang.StrategoException: Exception in execution of primitive 'SSL_preserve_annotations_attachments'
	at org.strategoxt.lang.Context.invokePrimitive(Context.java:240)
	at org.strategoxt.lang.Context.invokePrimitive(Context.java:216)
	at org.strategoxt.strc.preserve_annotations_attachments_1_0.invoke(preserve_annotations_attachments_1_0.java:25)
	... 69 more
Caused by: java.lang.IllegalArgumentException: Target term is not mutable and does not support attachments
	at org.spoofax.terms.AbstractTermFactory.copyAttachments(AbstractTermFactory.java:150)
	at org.spoofax.interpreter.library.ssl.SSL_preserve_annotations_attachments.call(SSL_preserve_annotations_attachments.java:28)
	... 72 more

For example, apparently this desugar rule results in an immutable term, which causes preserve-annotations-attachments(desugar) to throw.

desugar: List([]) -> Op("Nil", [])

Would it be possible to let SSL_preserve_annotations_attachments make a mutable clone of such an immutable term, and use that instead?

Log in to post comments