Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Stackunderflow due to missing do clause in called rule
Stackunderflow due to missing do clause in called rule [message #1002375] Fri, 18 January 2013 08:30 Go to next message
Andreas Brieg is currently offline Andreas Brieg
Messages: 48
Registered: November 2012
Member
It is possible to provoke a stackunderflow when a do clause in a called rule is missing.

The following transformation will cause a stackunderflow:
-- @atlcompiler atl2010
-- @nsURI ECore=http://www.eclipse.org/emf/2002/Ecore

module provokeStackunderflow;
create output: ECore from input: ECore;

rule name {
	from
		input_name : ECore!EPackage
	to 
		output_name : ECore!EPackage (
		)
	do {
		thisModule.calledRule('abc').toString();
		output_name;
	}
}

rule calledRule(string: String) {
	to 
		output_name : ECore!EClass (
		)
}


The stack trace in the EMF-specific VM is:
org.eclipse.m2m.atl.engine.emfvm.VMException
	at __applyname#13(provokeStackunderflow.atl[15:3-15:43])
		local variables: self=provokeStackunderflow : ASMModule, link=TransientLink {rule = name, sourceElements = {input_name = org.eclipse.emf.ecore.impl.EPackageImpl@4daa6f34 (name: additionalDbadm) (nsURI: http://additional.dbadm/1.0, nsPrefix: additional.dbadm)}, targetElements = {output_name = org.eclipse.emf.ecore.impl.EPackageImpl@706ae6c1 (name: null) (nsURI: null, nsPrefix: null)}, variables = {}}, input_name=input!additionalDbadm, output_name=output!<unnamed>
	at __exec__#8(provokeStackunderflow.atl)
		local variables: self=provokeStackunderflow : ASMModule, e=TransientLink {rule = name, sourceElements = {input_name = org.eclipse.emf.ecore.impl.EPackageImpl@4daa6f34 (name: additionalDbadm) (nsURI: http://additional.dbadm/1.0, nsPrefix: additional.dbadm)}, targetElements = {output_name = org.eclipse.emf.ecore.impl.EPackageImpl@706ae6c1 (name: null) (nsURI: null, nsPrefix: null)}, variables = {}}
	at main#24(provokeStackunderflow.atl)
		local variables: self=provokeStackunderflow : ASMModule
Java Stack:
org.eclipse.m2m.atl.engine.emfvm.VMException
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:643)
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:388)
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:388)
	at org.eclipse.m2m.atl.engine.emfvm.ASM.run(ASM.java:208)
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(EMFVMLauncher.java:170)
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMUILauncher.launch(EMFVMUILauncher.java:46)
	at org.eclipse.m2m.atl.core.service.LauncherService.launch(LauncherService.java:136)
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(AtlLaunchConfigurationDelegate.java:300)
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:237)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.ArrayIndexOutOfBoundsException


The stack trace in the regular VM is:
java.util.EmptyStackException
	at java.util.Stack.peek(Unknown Source)
	at java.util.Stack.pop(Unknown Source)
	at org.eclipse.m2m.atl.engine.vm.ASMStackFrame.pop(ASMStackFrame.java:107)
	at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:250)
	at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:173)
	at org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:130)
	at org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:78)
	at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:251)
	at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:357)
	at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:173)
	at org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:130)
	at org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:78)
	at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:251)
	at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:173)
	at org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:346)
	at org.eclipse.m2m.atl.core.ui.vm.RegularVMLauncher.internalLaunch(RegularVMLauncher.java:252)
	at org.eclipse.m2m.atl.core.ui.vm.RegularVMLauncher.launch(RegularVMLauncher.java:163)
	at org.eclipse.m2m.atl.core.service.LauncherService.launch(LauncherService.java:136)
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(AtlLaunchConfigurationDelegate.java:300)
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:237)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)


This is (nearly) the same error as seen in this topic.

Either the do clause should default to
do {
    <first-to-element>;
}

or the ATL compiler should mark missing do clauses as error.

This problem is much harder to track down if a do clause is missing in the middle of a program, because the VM will continue to run and will eventually later crash with a totally misleading exception (for example an assignment can't be executed because of incompatible types).

Is there a bug filed for this or should I create one?

The behavior was observed with Eclipse Juno and ATL 3.3.1.
Re: Stackunderflow due to missing do clause in called rule [message #1004233 is a reply to message #1002375] Tue, 22 January 2013 16:04 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis Wagelaar
Messages: 153
Registered: September 2012
Senior Member

Best to report as a new bug, and use the stack trace as a duplicate detector.

Regards,
Dennis

Op 18/01/13 14:30, Andreas Brieg schreef:
> It is possible to provoke a stackunderflow when a do clause in a called rule
> is missing.
>
> The following transformation will cause a stackunderflow:
>
> -- @atlcompiler atl2010
> -- @nsURI ECore=http://www.eclipse.org/emf/2002/Ecore
>
> module provokeStackunderflow;
> create output: ECore from input: ECore;
>
> rule name {
> from
> input_name : ECore!EPackage
> to output_name : ECore!EPackage (
> )
> do {
> thisModule.calledRule('abc').toString();
> output_name;
> }
> }
>
> rule calledRule(string: String) {
> to output_name : ECore!EClass (
> )
> }
>
>
> The stack trace in the EMF-specific VM is:
>
> org.eclipse.m2m.atl.engine.emfvm.VMException
> at __applyname#13(provokeStackunderflow.atl[15:3-15:43])
> local variables: self=provokeStackunderflow : ASMModule,
> link=TransientLink {rule = name, sourceElements = {input_name =
> org.eclipse.emf.ecore.impl.EPackageImpl@4daa6f34 (name: additionalDbadm)
> (nsURI: http://additional.dbadm/1.0, nsPrefix: additional.dbadm)},
> targetElements = {output_name =
> org.eclipse.emf.ecore.impl.EPackageImpl@706ae6c1 (name: null) (nsURI: null,
> nsPrefix: null)}, variables = {}}, input_name=input!additionalDbadm,
> output_name=output!<unnamed>
> at __exec__#8(provokeStackunderflow.atl)
> local variables: self=provokeStackunderflow : ASMModule,
> e=TransientLink {rule = name, sourceElements = {input_name =
> org.eclipse.emf.ecore.impl.EPackageImpl@4daa6f34 (name: additionalDbadm)
> (nsURI: http://additional.dbadm/1.0, nsPrefix: additional.dbadm)},
> targetElements = {output_name =
> org.eclipse.emf.ecore.impl.EPackageImpl@706ae6c1 (name: null) (nsURI: null,
> nsPrefix: null)}, variables = {}}
> at main#24(provokeStackunderflow.atl)
> local variables: self=provokeStackunderflow : ASMModule
> Java Stack:
> org.eclipse.m2m.atl.engine.emfvm.VMException
> at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:643)
> at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:388)
> at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:388)
> at org.eclipse.m2m.atl.engine.emfvm.ASM.run(ASM.java:208)
> at
> org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(EMFVMLauncher.java:170)
>
> at
> org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMUILauncher.launch(EMFVMUILauncher.java:46)
>
> at
> org.eclipse.m2m.atl.core.service.LauncherService.launch(LauncherService.java:136)
> at
> org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(AtlLaunchConfigurationDelegate.java:300)
>
> at
> org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:237)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
>
> at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
> Caused by: java.lang.ArrayIndexOutOfBoundsException
>
>
> The stack trace in the regular VM is:
>
> java.util.EmptyStackException
> at java.util.Stack.peek(Unknown Source)
> at java.util.Stack.pop(Unknown Source)
> at org.eclipse.m2m.atl.engine.vm.ASMStackFrame.pop(ASMStackFrame.java:107)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:250)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:173)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:130)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:78)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:251)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:357)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:173)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:130)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:78)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:251)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:173)
> at
> org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:346)
> at
> org.eclipse.m2m.atl.core.ui.vm.RegularVMLauncher.internalLaunch(RegularVMLauncher.java:252)
>
> at
> org.eclipse.m2m.atl.core.ui.vm.RegularVMLauncher.launch(RegularVMLauncher.java:163)
>
> at
> org.eclipse.m2m.atl.core.service.LauncherService.launch(LauncherService.java:136)
> at
> org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(AtlLaunchConfigurationDelegate.java:300)
>
> at
> org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:237)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
>
> at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
>
>
> This is (nearly) the same error as seen in
> http://www.eclipse.org/forums/index.php/t/447702/.
>
> Either the do clause should default to
> do {
> <first-to-element>;
> }
>
> or the ATL compiler should mark missing do clauses as error.
>
> This problem is much harder to track down if a do clause is missing in the
> middle of a program, because the VM will continue to run and will eventually
> later crash with a totally misleading exception (for example an assignment
> can't be executed because of incompatible types).
>
> Is there a bug filed for this or should I create one?
>
> The behavior was observed with Eclipse Juno and ATL 3.3.1.


Cheers,
Dennis
Re: Stackunderflow due to missing do clause in called rule [message #1004953 is a reply to message #1004233] Thu, 24 January 2013 02:48 Go to previous messageGo to next message
Andreas Brieg is currently offline Andreas Brieg
Messages: 48
Registered: November 2012
Member
There it is:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=398943
Re: Stackunderflow due to missing do clause in called rule [message #1005800 is a reply to message #1004953] Mon, 28 January 2013 14:18 Go to previous message
Dennis Wagelaar is currently offline Dennis Wagelaar
Messages: 153
Registered: September 2012
Senior Member

Op 24-01-13 08:48, Andreas Brieg schreef:
> There it is:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=398943
thanks!


Cheers,
Dennis
Previous Topic:accessing base_Classifier
Next Topic:EMFTVM doesn't generate output
Goto Forum:
  


Current Time: Fri Aug 01 03:57:10 EDT 2014

Powered by FUDForum. Page generated in 0.02363 seconds