From java at stefan-marr.de Mon Sep 5 18:03:54 2016 From: java at stefan-marr.de (Stefan Marr) Date: Mon, 5 Sep 2016 20:03:54 +0200 Subject: Questions on new Debugger API Message-ID: <95E5A53F-9458-4502-9165-82650CB291B3@stefan-marr.de> Hi: I started to look at the new Debugger API introduced in Truffle 0.17. I am a little unsure about how it is intended to be used. Should I request a DebuggerSession as late or as early as possible? The JavaDoc mentions that it is possible to have multiple sessions, which I assume, I can use to handle different entities actors/threads/what-ever separately from each other. Let?s assume an actor-based language, and that I got a debugger, which allows me to set line breakpoints (without any qualification/scoping). The intended breakpoint behavior here is that all actors executing that line are supposed to stop. To realize that, should I have one global session on which I register the breakpoint? I am not really sure how the debugger sessions are mapped to execution entities either. So, how do I ?scope? a session? Or should I create a session for each actor, probably when I instantiate the actor? And then the next step would be to have breakpoints local to an actor. For guess, I?d need to create a separate session, and then set the breakpoint there. However, I still haven?t seen how I could make sure the mapping between execution and actor could be done, especially since a single actor can over time be scheduled on different threads (in a pool). Thanks for any comments Stefan -- Stefan Marr Johannes Kepler Universit?t Linz http://stefan-marr.de/research/ From christian.humer at gmail.com Tue Sep 6 18:23:47 2016 From: christian.humer at gmail.com (Christian Humer) Date: Tue, 06 Sep 2016 18:23:47 +0000 Subject: Questions on new Debugger API In-Reply-To: <95E5A53F-9458-4502-9165-82650CB291B3@stefan-marr.de> References: <95E5A53F-9458-4502-9165-82650CB291B3@stefan-marr.de> Message-ID: Hi Stefan, Thanks for your questions. Please find my answers inline. On 05.09.2016 20:03:54, "Stefan Marr" wrote: >Hi: > >I started to look at the new Debugger API introduced in Truffle 0.17. > >I am a little unsure about how it is intended to be used. > >Should I request a DebuggerSession as late or as early as possible? Create creating an empty DebuggerSession without breakpoints and no suspensions will not cause any peak performance degradation. It will however create wrappers for statements that were executed once. This means that having a debugger session open will cause overhead in memory consumption and first-execution/interpreter performance. If there is a chance that the session will not be used, then I would open it as late as possible. If you are going to need it anyway, then I would open it as early as possible. > > >The JavaDoc mentions that it is possible to have multiple sessions, >which I assume, I can use to handle different entities >actors/threads/what-ever separately from each other. It might not make much sense to have multiple interactive debugging sessions, but the debugging framework is not limited to interactive debugging. Also automated tools that use the debugging framework can coexist with an interactive debugger. That's what sessions were designed for. Also since the Debugger is a singleton for a PolyglotEngine, we isolate users from each other using sessions. > >Let?s assume an actor-based language, and that I got a debugger, which >allows me to set line breakpoints (without any qualification/scoping). >The intended breakpoint behavior here is that all actors executing that >line are supposed to stop. >To realize that, should I have one global session on which I register >the breakpoint? Yes. > >I am not really sure how the debugger sessions are mapped to execution >entities either. So, how do I ?scope? a session? >Or should I create a session for each actor, probably when I >instantiate the actor? You should use only one session, but register multiple breakpoints with different conditions that scope your breakpoint. You can use SuspendedEvent#getBreakpoints() to find out which breakpoints were actually hit. > >And then the next step would be to have breakpoints local to an actor. >For guess, I?d need to create a separate session, and then set the >breakpoint there. However, I still haven?t seen how I could make sure >the mapping between execution and actor could be done, especially since >a single actor can over time be scheduled on different threads (in a >pool). Would multiple breakpoints and SuspendedEvent#getBreakpoints() help here? -- Christian Humer From java at stefan-marr.de Tue Sep 6 21:45:49 2016 From: java at stefan-marr.de (Stefan Marr) Date: Tue, 6 Sep 2016 23:45:49 +0200 Subject: Questions on new Debugger API In-Reply-To: References: <95E5A53F-9458-4502-9165-82650CB291B3@stefan-marr.de> Message-ID: <55BCC30C-56AF-43D4-8DAA-0475C10169E0@stefan-marr.de> Hi Christian: > On 06 Sep 2016, at 20:23, Christian Humer wrote: > >> Should I request a DebuggerSession as late or as early as possible? > Create creating an empty DebuggerSession without breakpoints and no suspensions will not cause any peak performance degradation. It will however create wrappers for statements that were executed once. This means that having a debugger session open will cause overhead in memory consumption and first-execution/interpreter performance. If there is a chance that the session will not be used, then I would open it as late as possible. If you are going to need it anyway, then I would open it as early as possible. Ok, good to know. >> The JavaDoc mentions that it is possible to have multiple sessions, which I assume, I can use to handle different entities actors/threads/what-ever separately from each other. > It might not make much sense to have multiple interactive debugging sessions, but the debugging framework is not limited to interactive debugging. Also automated tools that use the debugging framework can coexist with an interactive debugger. That's what sessions were designed for. Also since the Debugger is a singleton for a PolyglotEngine, we isolate users from each other using sessions. Hm, ok, I see, I think, I?ll need to do most of the checking whether a breakpoint applies myself anyway. So, indeed, the benefit of multiple sessions seems minimal for my scenario. >> I am not really sure how the debugger sessions are mapped to execution entities either. So, how do I ?scope? a session? >> Or should I create a session for each actor, probably when I instantiate the actor? > You should use only one session, but register multiple breakpoints with different conditions that scope your breakpoint. You can use SuspendedEvent#getBreakpoints() to find out which breakpoints were actually hit. > >> >> And then the next step would be to have breakpoints local to an actor. For guess, I?d need to create a separate session, and then set the breakpoint there. However, I still haven?t seen how I could make sure the mapping between execution and actor could be done, especially since a single actor can over time be scheduled on different threads (in a pool). > Would multiple breakpoints and SuspendedEvent#getBreakpoints() help here? Hm, well, yes, partially. Since Breakpoint is not extensible, I?ll actually need to manage language-specific breakpoint classes on top of that, which implement the additional semantics. So, yes, getBreakpoints() gives me some of what I need, but, I also need to manage another map to get the language-specific breakpoints. I can?t say I am a fan of that particular aspect of the design. Is extensibility really making it so much harder to design for maintainability? Oh well? Thanks Stefan -- Stefan Marr Johannes Kepler Universit?t Linz http://stefan-marr.de/research/ From christian.humer at gmail.com Wed Sep 7 12:17:37 2016 From: christian.humer at gmail.com (Christian Humer) Date: Wed, 07 Sep 2016 12:17:37 +0000 Subject: Questions on new Debugger API In-Reply-To: <55BCC30C-56AF-43D4-8DAA-0475C10169E0@stefan-marr.de> References: <95E5A53F-9458-4502-9165-82650CB291B3@stefan-marr.de> <55BCC30C-56AF-43D4-8DAA-0475C10169E0@stefan-marr.de> Message-ID: Hi Stefan, I don't see what breakpoint extensibility gets you. Could you elaborate? If you want to add information to a breakpoint, just wrap it. I don't see the need for a map. I agree we probably need Java breakpoint conditions (if that is what you mean). Yes, abstract classes are a lot harder to evolve than final classes. You should not mix API and SPI in the same class[1] when designing for longer term support. So if we would make breakpoints extensible, we would probably do it with a separate class. [1] http://wiki.apidesign.org/index.php?title=APIvsSPI Cheers, - Christian Humer On 06.09.2016 23:45:49, "Stefan Marr" wrote: >Hi Christian: > >> On 06 Sep 2016, at 20:23, Christian Humer >>wrote: >> >>> Should I request a DebuggerSession as late or as early as possible? >> Create creating an empty DebuggerSession without breakpoints and no >>suspensions will not cause any peak performance degradation. It will >>however create wrappers for statements that were executed once. This >>means that having a debugger session open will cause overhead in >>memory consumption and first-execution/interpreter performance. If >>there is a chance that the session will not be used, then I would open >>it as late as possible. If you are going to need it anyway, then I >>would open it as early as possible. > >Ok, good to know. > > >>> The JavaDoc mentions that it is possible to have multiple sessions, >>>which I assume, I can use to handle different entities >>>actors/threads/what-ever separately from each other. >> It might not make much sense to have multiple interactive debugging >>sessions, but the debugging framework is not limited to interactive >>debugging. Also automated tools that use the debugging framework can >>coexist with an interactive debugger. That's what sessions were >>designed for. Also since the Debugger is a singleton for a >>PolyglotEngine, we isolate users from each other using sessions. > >Hm, ok, I see, I think, I?ll need to do most of the checking whether a >breakpoint applies myself anyway. So, indeed, the benefit of multiple >sessions seems minimal for my scenario. > >>> I am not really sure how the debugger sessions are mapped to >>>execution entities either. So, how do I ?scope? a session? >>> Or should I create a session for each actor, probably when I >>>instantiate the actor? >> You should use only one session, but register multiple breakpoints >>with different conditions that scope your breakpoint. You can use >>SuspendedEvent#getBreakpoints() to find out which breakpoints were >>actually hit. >> >>> >>> And then the next step would be to have breakpoints local to an >>>actor. For guess, I?d need to create a separate session, and then set >>>the breakpoint there. However, I still haven?t seen how I could make >>>sure the mapping between execution and actor could be done, >>>especially since a single actor can over time be scheduled on >>>different threads (in a pool). >> Would multiple breakpoints and SuspendedEvent#getBreakpoints() help >>here? > >Hm, well, yes, partially. > >Since Breakpoint is not extensible, I?ll actually need to manage >language-specific breakpoint classes on top of that, which implement >the additional semantics. So, yes, getBreakpoints() gives me some of >what I need, but, I also need to manage another map to get the >language-specific breakpoints. > >I can?t say I am a fan of that particular aspect of the design. >Is extensibility really making it so much harder to design for >maintainability? > >Oh well? > >Thanks >Stefan > >-- >Stefan Marr >Johannes Kepler Universit?t Linz >http://stefan-marr.de/research/ > > > From java at stefan-marr.de Wed Sep 7 12:24:50 2016 From: java at stefan-marr.de (Stefan Marr) Date: Wed, 7 Sep 2016 14:24:50 +0200 Subject: Questions on new Debugger API In-Reply-To: References: <95E5A53F-9458-4502-9165-82650CB291B3@stefan-marr.de> <55BCC30C-56AF-43D4-8DAA-0475C10169E0@stefan-marr.de> Message-ID: <34F55B9F-6EB7-46E2-B8C4-84726DDBCBD1@stefan-marr.de> Hi Christian: > On 07 Sep 2016, at 14:17, Christian Humer wrote: > > Hi Stefan, > > I don't see what breakpoint extensibility gets you. Could you elaborate? > If you want to add information to a breakpoint, just wrap it. I don?t see the need for a map. Hm, well, wrapping is uni-directional, how do I get from the Breakpoint that I get in a suspended event back to a language-level breakpoint object? I would need a map for that, no? I can?t put a pointer to my own breakpoint representation in the Truffle `Breakpoint` object? > I agree we probably need Java breakpoint conditions (if that is what you mean). Yeah, I definitely need that. And, I used an interface for that. So, in such condition objects, I am actually also able to maintain a connection to my language-level breakpoint representation. > Yes, abstract classes are a lot harder to evolve than final classes. You should not mix API and SPI in the same class[1] when designing for longer term support. > So if we would make breakpoints extensible, we would probably do it with a separate class. Yeah, well, I perfectly understand your motivation to close things down. That doesn?t mean I need to like it, right? ;) I am just ranting as usual? sorry. Thanks Stefan > > [1] http://wiki.apidesign.org/index.php?title=APIvsSPI > > Cheers, > > - Christian Humer > > > On 06.09.2016 23:45:49, "Stefan Marr" wrote: > >> Hi Christian: >> >>> On 06 Sep 2016, at 20:23, Christian Humer wrote: >>> >>>> Should I request a DebuggerSession as late or as early as possible? >>> Create creating an empty DebuggerSession without breakpoints and no suspensions will not cause any peak performance degradation. It will however create wrappers for statements that were executed once. This means that having a debugger session open will cause overhead in memory consumption and first-execution/interpreter performance. If there is a chance that the session will not be used, then I would open it as late as possible. If you are going to need it anyway, then I would open it as early as possible. >> >> Ok, good to know. >> >> >>>> The JavaDoc mentions that it is possible to have multiple sessions, which I assume, I can use to handle different entities actors/threads/what-ever separately from each other. >>> It might not make much sense to have multiple interactive debugging sessions, but the debugging framework is not limited to interactive debugging. Also automated tools that use the debugging framework can coexist with an interactive debugger. That's what sessions were designed for. Also since the Debugger is a singleton for a PolyglotEngine, we isolate users from each other using sessions. >> >> Hm, ok, I see, I think, I?ll need to do most of the checking whether a breakpoint applies myself anyway. So, indeed, the benefit of multiple sessions seems minimal for my scenario. >> >>>> I am not really sure how the debugger sessions are mapped to execution entities either. So, how do I ?scope? a session? >>>> Or should I create a session for each actor, probably when I instantiate the actor? >>> You should use only one session, but register multiple breakpoints with different conditions that scope your breakpoint. You can use SuspendedEvent#getBreakpoints() to find out which breakpoints were actually hit. >>> >>>> >>>> And then the next step would be to have breakpoints local to an actor. For guess, I?d need to create a separate session, and then set the breakpoint there. However, I still haven?t seen how I could make sure the mapping between execution and actor could be done, especially since a single actor can over time be scheduled on different threads (in a pool). >>> Would multiple breakpoints and SuspendedEvent#getBreakpoints() help here? >> >> Hm, well, yes, partially. >> >> Since Breakpoint is not extensible, I?ll actually need to manage language-specific breakpoint classes on top of that, which implement the additional semantics. So, yes, getBreakpoints() gives me some of what I need, but, I also need to manage another map to get the language-specific breakpoints. >> >> I can?t say I am a fan of that particular aspect of the design. >> Is extensibility really making it so much harder to design for maintainability? >> >> Oh well? >> >> Thanks >> Stefan >> >> -- >> Stefan Marr >> Johannes Kepler Universit?t Linz >> http://stefan-marr.de/research/ >> >> >> > From chris.seaton at oracle.com Mon Sep 12 16:52:48 2016 From: chris.seaton at oracle.com (Chris Seaton) Date: Mon, 12 Sep 2016 17:52:48 +0100 Subject: Graal Updated to use Truffle 0.17 Message-ID: I?ve updated graal-core to use Truffle 0.17, which is the version used in GraalVM 0.16. Chris From jaroslav.tulach at oracle.com Fri Sep 16 10:07:17 2016 From: jaroslav.tulach at oracle.com (Jaroslav Tulach) Date: Fri, 16 Sep 2016 12:07:17 +0200 Subject: Questions on new Debugger API In-Reply-To: <55BCC30C-56AF-43D4-8DAA-0475C10169E0@stefan-marr.de> References: <95E5A53F-9458-4502-9165-82650CB291B3@stefan-marr.de> <55BCC30C-56AF-43D4-8DAA-0475C10169E0@stefan-marr.de> Message-ID: <43357594.CooM37OaoG@pracovni> Great FAQ! It should be written into a stone. I am trying that in https://github.com/jtulach/truffle/commit/ 6f4ff282f812495bb5b72fb7dfcf25cbeb3321e7 > Is extensibility really making it so much harder to design for > maintainability? Yes, indeed. > Since Breakpoint is not extensible, I?ll actually need to manage > language-specific breakpoint classes on top of that, which implement the > additional semantics. So, yes, getBreakpoints() gives me some of what I > need, but, I also need to manage another map to get the language-specific > breakpoints. We can give you a way to attach private data to a breakpoint when created and let you (and only you) retrieve them back (without extensibility) and be more effective than a map. -jt From cristian.esquivias at gmail.com Sat Sep 17 07:31:01 2016 From: cristian.esquivias at gmail.com (Cristian Esquivias) Date: Sat, 17 Sep 2016 00:31:01 -0700 Subject: Call Targets Not Optimized Message-ID: I moved to a new system and downloaded the latest Graal VM from OTN to try it out. When I ran IGV to see compilations none of my functions appeared. I enabled the TruffleCallTargetProfiling and TruffleCompilationStatistics flags and saw that none of my functions were optimized. Am I doing something wrong? I haven't changed my code, and I'm fairly certain compilation was triggered on my old system (I don't have access to it anymore). I think I set up Graal properly. I basically just call java from my downloaded VM like I normally do. Here's the full command for reference. ~/lib/graalvm-0.16/bin/java -Dgraal.TruffleCompilationStatistics=true -Dgraal.TruffleCompilationExceptionsAreFatal=true -Dgraal.TruffleCallTargetProfiling=true -Dgraal.Dump -Dgraal.TruffleBackgroundCompilation=true -Djvmci.option.Dump -cp $MUMBLER_LIB/antlr4-runtime-4.5.jar:$MUMBLER_LIB/lang.jar mumbler.truffle.TruffleMumblerMain /tmp/inline-test.mumbler My test program is a simple recursive loop that adds a number 1000+ times to trigger compilation. Nothing fancy. I tried to build graal per the instructions on GitHub but I get a compilation error. Some of the output from the flags: Truffle compilation statistics: Compilations : 0 Success : 0 Failed : 0 Interrupted : 0 Invalidated : 0 Queues : 7 Dequeues : 2 Splits : 0 Compilation Accuracy : NaN Queue Accuracy : 0.714286 Compilation Utilization : 0.000000 Remaining Compilation Queue : 6 Call Target | Total Calls || Interp. Calls | Opt. Calls || Direct Calls | Inlined Calls | Indirect Calls || Invalidations [AddBuiltinNodeGen at 6e2c634b] | 26000 || 26000 | 0 || 26000 | 0 | 0 || 0 [EqualBuiltinNodeGen at 4b9af9a9] | 23005 || 23005 | 0 || 23005 | 0 | 0 || 0 [SubBuiltinNodeGen at 4d405ef7] | 23001 || 23001 | 0 || 23001 | 0 | 0 || 0 Thanks, Cristian From chris.seaton at oracle.com Sat Sep 17 07:35:02 2016 From: chris.seaton at oracle.com (Chris Seaton) Date: Sat, 17 Sep 2016 08:35:02 +0100 Subject: Call Targets Not Optimized In-Reply-To: References: Message-ID: <826BE33E-8610-4BE0-8DAA-8ADB4E6091CB@oracle.com> Hi Christian, You run a loop 1000+ times, but then do you give it a chance to compile before the program exits? You?ve got background compilation enabled so the program won?t wait for compilation before it exits. Instead of running a loop 1000+ times, try making the loop infinite and running it for a few seconds to see what happens longer term. Try -Dgraal.TraceTruffleCompilation and -Dgraal.TraceTruffleCompilationDetails to see the compilation events printed as the program runs. Chris > On 17 Sep 2016, at 08:31, Cristian Esquivias wrote: > > I moved to a new system and downloaded the latest Graal VM from OTN to try > it out. When I ran IGV to see compilations none of my functions appeared. I > enabled the TruffleCallTargetProfiling and TruffleCompilationStatistics > flags and saw that none of my functions were optimized. > > Am I doing something wrong? I haven't changed my code, and I'm fairly > certain compilation was triggered on my old system (I don't have access to > it anymore). > > I think I set up Graal properly. I basically just call java from my > downloaded VM like I normally do. Here's the full command for reference. > > ~/lib/graalvm-0.16/bin/java > -Dgraal.TruffleCompilationStatistics=true > -Dgraal.TruffleCompilationExceptionsAreFatal=true > -Dgraal.TruffleCallTargetProfiling=true -Dgraal.Dump > -Dgraal.TruffleBackgroundCompilation=true -Djvmci.option.Dump -cp > $MUMBLER_LIB/antlr4-runtime-4.5.jar:$MUMBLER_LIB/lang.jar > mumbler.truffle.TruffleMumblerMain /tmp/inline-test.mumbler > > My test program is a simple recursive loop that adds a number 1000+ times > to trigger compilation. Nothing fancy. > > I tried to build graal per the instructions on GitHub but I get a > compilation error. > > Some of the output from the flags: > > Truffle compilation statistics: > Compilations : 0 > Success : 0 > Failed : 0 > Interrupted : 0 > Invalidated : 0 > Queues : 7 > Dequeues : 2 > Splits : 0 > Compilation Accuracy : NaN > Queue Accuracy : 0.714286 > Compilation Utilization : 0.000000 > Remaining Compilation Queue : 6 > > Call Target | Total Calls || > Interp. Calls | Opt. Calls || Direct Calls | Inlined Calls | > Indirect Calls || Invalidations > [AddBuiltinNodeGen at 6e2c634b] | 26000 || > 26000 | 0 || 26000 | 0 | > 0 || 0 > [EqualBuiltinNodeGen at 4b9af9a9] | 23005 || > 23005 | 0 || 23005 | 0 | > 0 || 0 > [SubBuiltinNodeGen at 4d405ef7] | 23001 || > 23001 | 0 || 23001 | 0 | > 0 || 0 > > Thanks, > Cristian From cristian.esquivias at gmail.com Sat Sep 17 07:54:01 2016 From: cristian.esquivias at gmail.com (Cristian Esquivias) Date: Sat, 17 Sep 2016 00:54:01 -0700 Subject: Call Targets Not Optimized In-Reply-To: <826BE33E-8610-4BE0-8DAA-8ADB4E6091CB@oracle.com> References: <826BE33E-8610-4BE0-8DAA-8ADB4E6091CB@oracle.com> Message-ID: Thanks Chris, having it run longer did the trick. I disabled background compilation and the program took forever (it's still running). Is there a way to trigger compilation for my functions for small tests without having to write infinite loops or blocking to compile every function? - Cristian On Sat, Sep 17, 2016 at 12:35 AM, Chris Seaton wrote: > Hi Christian, > > You run a loop 1000+ times, but then do you give it a chance to compile > before the program exits? You?ve got background compilation enabled so the > program won?t wait for compilation before it exits. > > Instead of running a loop 1000+ times, try making the loop infinite and > running it for a few seconds to see what happens longer term. > > Try -Dgraal.TraceTruffleCompilation and -Dgraal.TraceTruffleCompilationDetails > to see the compilation events printed as the program runs. > > Chris > > > On 17 Sep 2016, at 08:31, Cristian Esquivias < > cristian.esquivias at gmail.com> wrote: > > > > I moved to a new system and downloaded the latest Graal VM from OTN to > try > > it out. When I ran IGV to see compilations none of my functions > appeared. I > > enabled the TruffleCallTargetProfiling and TruffleCompilationStatistics > > flags and saw that none of my functions were optimized. > > > > Am I doing something wrong? I haven't changed my code, and I'm fairly > > certain compilation was triggered on my old system (I don't have access > to > > it anymore). > > > > I think I set up Graal properly. I basically just call java from my > > downloaded VM like I normally do. Here's the full command for reference. > > > > ~/lib/graalvm-0.16/bin/java > > -Dgraal.TruffleCompilationStatistics=true > > -Dgraal.TruffleCompilationExceptionsAreFatal=true > > -Dgraal.TruffleCallTargetProfiling=true -Dgraal.Dump > > -Dgraal.TruffleBackgroundCompilation=true -Djvmci.option.Dump -cp > > $MUMBLER_LIB/antlr4-runtime-4.5.jar:$MUMBLER_LIB/lang.jar > > mumbler.truffle.TruffleMumblerMain /tmp/inline-test.mumbler > > > > My test program is a simple recursive loop that adds a number 1000+ times > > to trigger compilation. Nothing fancy. > > > > I tried to build graal per the instructions on GitHub but I get a > > compilation error. > > > > Some of the output from the flags: > > > > Truffle compilation statistics: > > Compilations : 0 > > Success : 0 > > Failed : 0 > > Interrupted : 0 > > Invalidated : 0 > > Queues : 7 > > Dequeues : 2 > > Splits : 0 > > Compilation Accuracy : NaN > > Queue Accuracy : 0.714286 > > Compilation Utilization : 0.000000 > > Remaining Compilation Queue : 6 > > > > Call Target | Total Calls || > > Interp. Calls | Opt. Calls || Direct Calls | Inlined Calls | > > Indirect Calls || Invalidations > > [AddBuiltinNodeGen at 6e2c634b] | 26000 || > > 26000 | 0 || 26000 | 0 | > > 0 || 0 > > [EqualBuiltinNodeGen at 4b9af9a9] | 23005 || > > 23005 | 0 || 23005 | 0 | > > 0 || 0 > > [SubBuiltinNodeGen at 4d405ef7] | 23001 || > > 23001 | 0 || 23001 | 0 | > > 0 || 0 > > > > Thanks, > > Cristian > > From java at stefan-marr.de Sat Sep 17 08:00:03 2016 From: java at stefan-marr.de (Stefan Marr) Date: Sat, 17 Sep 2016 10:00:03 +0200 Subject: Call Targets Not Optimized In-Reply-To: References: <826BE33E-8610-4BE0-8DAA-8ADB4E6091CB@oracle.com> Message-ID: <845F91CA-1C08-4032-B43D-DD58DC68D64D@stefan-marr.de> Hi Cristian: You can adjust the compilation threshold for testing with: -Dgraal.TruffleCompilationThreshold=1 Best regards Stefan > On 17 Sep 2016, at 09:54, Cristian Esquivias wrote: > > Thanks Chris, having it run longer did the trick. I disabled background > compilation and the program took forever (it's still running). Is there a > way to trigger compilation for my functions for small tests without having > to write infinite loops or blocking to compile every function? > > - Cristian From chris.seaton at oracle.com Sat Sep 17 08:08:56 2016 From: chris.seaton at oracle.com (Chris Seaton) Date: Sat, 17 Sep 2016 09:08:56 +0100 Subject: Call Targets Not Optimized In-Reply-To: References: <826BE33E-8610-4BE0-8DAA-8ADB4E6091CB@oracle.com> Message-ID: You can use -Dgraal.TruffleCompileOnly=function_name, but for manual testing and just experimenting I almost always write an infinite loop. If you use too many options you can start to get an unrealistic understanding of how Truffle normally works. Or are you asking about automated testing, where an infinite loop isn?t going to work? For that case in Ruby I use CompilerAsserts.neverPartOfCompilation in a special Ruby method to stop the loop when it is compiled. This is complicated to get right though so ask if that?s what you?re doing and I?ll give more details. Chris > On 17 Sep 2016, at 08:54, Cristian Esquivias > wrote: > > Thanks Chris, having it run longer did the trick. I disabled background compilation and the program took forever (it's still running). Is there a way to trigger compilation for my functions for small tests without having to write infinite loops or blocking to compile every function? > > - Cristian > > On Sat, Sep 17, 2016 at 12:35 AM, Chris Seaton > wrote: > Hi Christian, > > You run a loop 1000+ times, but then do you give it a chance to compile before the program exits? You?ve got background compilation enabled so the program won?t wait for compilation before it exits. > > Instead of running a loop 1000+ times, try making the loop infinite and running it for a few seconds to see what happens longer term. > > Try -Dgraal.TraceTruffleCompilation and -Dgraal.TraceTruffleCompilationDetails to see the compilation events printed as the program runs. > > Chris > > > On 17 Sep 2016, at 08:31, Cristian Esquivias > wrote: > > > > I moved to a new system and downloaded the latest Graal VM from OTN to try > > it out. When I ran IGV to see compilations none of my functions appeared. I > > enabled the TruffleCallTargetProfiling and TruffleCompilationStatistics > > flags and saw that none of my functions were optimized. > > > > Am I doing something wrong? I haven't changed my code, and I'm fairly > > certain compilation was triggered on my old system (I don't have access to > > it anymore). > > > > I think I set up Graal properly. I basically just call java from my > > downloaded VM like I normally do. Here's the full command for reference. > > > > ~/lib/graalvm-0.16/bin/java > > -Dgraal.TruffleCompilationStatistics=true > > -Dgraal.TruffleCompilationExceptionsAreFatal=true > > -Dgraal.TruffleCallTargetProfiling=true -Dgraal.Dump > > -Dgraal.TruffleBackgroundCompilation=true -Djvmci.option.Dump -cp > > $MUMBLER_LIB/antlr4-runtime-4.5.jar:$MUMBLER_LIB/lang.jar > > mumbler.truffle.TruffleMumblerMain /tmp/inline-test.mumbler > > > > My test program is a simple recursive loop that adds a number 1000+ times > > to trigger compilation. Nothing fancy. > > > > I tried to build graal per the instructions on GitHub but I get a > > compilation error. > > > > Some of the output from the flags: > > > > Truffle compilation statistics: > > Compilations : 0 > > Success : 0 > > Failed : 0 > > Interrupted : 0 > > Invalidated : 0 > > Queues : 7 > > Dequeues : 2 > > Splits : 0 > > Compilation Accuracy : NaN > > Queue Accuracy : 0.714286 > > Compilation Utilization : 0.000000 > > Remaining Compilation Queue : 6 > > > > Call Target | Total Calls || > > Interp. Calls | Opt. Calls || Direct Calls | Inlined Calls | > > Indirect Calls || Invalidations > > [AddBuiltinNodeGen at 6e2c634b] | 26000 || > > 26000 | 0 || 26000 | 0 | > > 0 || 0 > > [EqualBuiltinNodeGen at 4b9af9a9] | 23005 || > > 23005 | 0 || 23005 | 0 | > > 0 || 0 > > [SubBuiltinNodeGen at 4d405ef7] | 23001 || > > 23001 | 0 || 23001 | 0 | > > 0 || 0 > > > > Thanks, > > Cristian > > From cristian.esquivias at gmail.com Sat Sep 17 08:18:47 2016 From: cristian.esquivias at gmail.com (Cristian Esquivias) Date: Sat, 17 Sep 2016 01:18:47 -0700 Subject: Call Targets Not Optimized In-Reply-To: References: <826BE33E-8610-4BE0-8DAA-8ADB4E6091CB@oracle.com> Message-ID: Nah, I meant just for manual testing. Off the bat, contorting my code for the benchmark felt like that would give me skewed results, but then I realized I can just stick my main function in an infinite loop and it shouldn't be so bad. I'll fiddle with the flags just in case that suits my needs. If I ever need something more robust I'll be sure to ask. Thanks, Cristian On Sat, Sep 17, 2016 at 1:08 AM, Chris Seaton wrote: > You can use -Dgraal.TruffleCompileOnly=function_name, but for manual > testing and just experimenting I almost always write an infinite loop. If > you use too many options you can start to get an unrealistic understanding > of how Truffle normally works. > > Or are you asking about automated testing, where an infinite loop isn?t > going to work? For that case in Ruby I use CompilerAsserts.neverPartOfCompilation > in a special Ruby method to stop the loop when it is compiled. This is > complicated to get right though so ask if that?s what you?re doing and I?ll > give more details. > > Chris > > On 17 Sep 2016, at 08:54, Cristian Esquivias > wrote: > > Thanks Chris, having it run longer did the trick. I disabled background > compilation and the program took forever (it's still running). Is there a > way to trigger compilation for my functions for small tests without having > to write infinite loops or blocking to compile every function? > > - Cristian > > On Sat, Sep 17, 2016 at 12:35 AM, Chris Seaton > wrote: > >> Hi Christian, >> >> You run a loop 1000+ times, but then do you give it a chance to compile >> before the program exits? You?ve got background compilation enabled so the >> program won?t wait for compilation before it exits. >> >> Instead of running a loop 1000+ times, try making the loop infinite and >> running it for a few seconds to see what happens longer term. >> >> Try -Dgraal.TraceTruffleCompilation and -Dgraal.TraceTruffleCompilationDetails >> to see the compilation events printed as the program runs. >> >> Chris >> >> > On 17 Sep 2016, at 08:31, Cristian Esquivias < >> cristian.esquivias at gmail.com> wrote: >> > >> > I moved to a new system and downloaded the latest Graal VM from OTN to >> try >> > it out. When I ran IGV to see compilations none of my functions >> appeared. I >> > enabled the TruffleCallTargetProfiling and TruffleCompilationStatistics >> > flags and saw that none of my functions were optimized. >> > >> > Am I doing something wrong? I haven't changed my code, and I'm fairly >> > certain compilation was triggered on my old system (I don't have access >> to >> > it anymore). >> > >> > I think I set up Graal properly. I basically just call java from my >> > downloaded VM like I normally do. Here's the full command for reference. >> > >> > ~/lib/graalvm-0.16/bin/java >> > -Dgraal.TruffleCompilationStatistics=true >> > -Dgraal.TruffleCompilationExceptionsAreFatal=true >> > -Dgraal.TruffleCallTargetProfiling=true -Dgraal.Dump >> > -Dgraal.TruffleBackgroundCompilation=true -Djvmci.option.Dump -cp >> > $MUMBLER_LIB/antlr4-runtime-4.5.jar:$MUMBLER_LIB/lang.jar >> > mumbler.truffle.TruffleMumblerMain /tmp/inline-test.mumbler >> > >> > My test program is a simple recursive loop that adds a number 1000+ >> times >> > to trigger compilation. Nothing fancy. >> > >> > I tried to build graal per the instructions on GitHub but I get a >> > compilation error. >> > >> > Some of the output from the flags: >> > >> > Truffle compilation statistics: >> > Compilations : 0 >> > Success : 0 >> > Failed : 0 >> > Interrupted : 0 >> > Invalidated : 0 >> > Queues : 7 >> > Dequeues : 2 >> > Splits : 0 >> > Compilation Accuracy : NaN >> > Queue Accuracy : 0.714286 >> > Compilation Utilization : 0.000000 >> > Remaining Compilation Queue : 6 >> > >> > Call Target | Total Calls || >> > Interp. Calls | Opt. Calls || Direct Calls | Inlined Calls | >> > Indirect Calls || Invalidations >> > [AddBuiltinNodeGen at 6e2c634b] | 26000 >> || >> > 26000 | 0 || 26000 | 0 | >> > 0 || 0 >> > [EqualBuiltinNodeGen at 4b9af9a9] | 23005 >> || >> > 23005 | 0 || 23005 | 0 | >> > 0 || 0 >> > [SubBuiltinNodeGen at 4d405ef7] | 23001 >> || >> > 23001 | 0 || 23001 | 0 | >> > 0 || 0 >> > >> > Thanks, >> > Cristian >> >> > > From java at stefan-marr.de Wed Sep 28 09:51:31 2016 From: java at stefan-marr.de (Stefan Marr) Date: Wed, 28 Sep 2016 11:51:31 +0200 Subject: Unset a slot in a frame Message-ID: Hi: Let?s imagine a code snippet like this, but assume a bit specific semantics close to my language. The `var` declaration ensures that there is a frame slot, and that it should contain a `nil` value. So, the following code should always print 0. for (int i = 0; i < 10; i++) { var local; if (local == nil) { local := 0 } else { local += 1; } print(local); } Further, the variables `i` and `local` are allocated as frame slots in the frame of the surrounding method. And, I would like to make sure that both frame slots can specialize themselves properly to integers. To realize that, I was thinking that the frame would need an `unset()` operation, which it currently does not have. I think, it could be sufficient to realize my semantics if the tag stored in the frame is reverted to `Illegal`. So, I am wondering whether there are any assumptions in Truffle/Graal that would prevent the introduction of an `unset()`. Perhaps some parts cannot handle the transition from an initialized state back to `Illegal`? My assumption is that the `tags` in a frame do not have to be stable, because there is already the transition from the initial state to the typed state. And, I also assume that reverting back to `Illegal` does not mess with the FrameDescriptor, because I don?t want to change the type specialization there either. I just want to ensure that the first read of `local` in each loop iteration is correctly in the `uninitialized` state. Would it be possible to add an `unset(slot)` to Frame? Thanks Stefan -- Stefan Marr Johannes Kepler Universit?t Linz http://stefan-marr.de/research/ From raffaello.giulietti at supsi.ch Fri Sep 30 16:49:36 2016 From: raffaello.giulietti at supsi.ch (Raffaello Giulietti) Date: Fri, 30 Sep 2016 16:49:36 +0000 Subject: Licensing question Message-ID: Hi all, I'm aware that this might not be the ideal place to ask about licensing issues but I'm just looking for unbinding opinions, not legal advice. My understanding is that Graal is licensed under the "viral" GPL while Truffle is licensed under the less restrictive GPL with Classpath exception. What does this imply for a Truffle language implementation that makes use of Graal for performance, even if it does not link directly to the Graal API? Does it indirectly inherit the stricter GPL status or can it be distributed with any license as allowed by the GPL with Classpath exception? Greetings Raffaello From dalibor.topic at oracle.com Fri Sep 30 17:22:28 2016 From: dalibor.topic at oracle.com (Dalibor Topic) Date: Fri, 30 Sep 2016 19:22:28 +0200 Subject: Licensing question In-Reply-To: References: Message-ID: Per the OpenJDK FAQ: Can I expect to get specific legal advice or answers to my legal questions on OpenJDK mailing lists? In general, no. The OpenJDK mailing lists serve for technical work around development of specific OpenJDK projects. In my opinion asking legal questions on mailing lists is at best just a waste of everyone's time. Cheers, Dalibor Topi? -- Dalibor Topic | Principal Product Manager Phone: +494089091214 | Mobile: +491737185961 ORACLE Deutschland B.V. & Co. KG | K?hneh?fe 5 | 22761 Hamburg ORACLE Deutschland B.V. & Co. KG Hauptverwaltung: Riesstr. 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment > On 30 Sep 2016, at 18:49, Raffaello Giulietti wrote: > > Hi all, > > I'm aware that this might not be the ideal place to ask about licensing > issues but I'm just looking for unbinding opinions, not legal advice. > > My understanding is that Graal is licensed under the "viral" GPL while > Truffle is licensed under the less restrictive GPL with Classpath exception. > > What does this imply for a Truffle language implementation that makes > use of Graal for performance, even if it does not link directly to the > Graal API? > Does it indirectly inherit the stricter GPL status or can it be > distributed with any license as allowed by the GPL with Classpath exception? > > Greetings > Raffaello From sid.kshatriya at gmail.com Fri Sep 30 17:54:23 2016 From: sid.kshatriya at gmail.com (Sidharth Kshatriya) Date: Fri, 30 Sep 2016 23:24:23 +0530 Subject: Licensing question In-Reply-To: References: Message-ID: I feel this response is not helpful. I can understand that it might be difficult for Oracle employees to give their opinions on this mailing list on licensing issues -- even if they felt they could offer some answers. But practically speaking, licensing issues are important. If the Graal/Truffle team wants people to actually use what they are building and make it a successful open source project then these questions should to be addressed, somewhere, if not here. So, as a fellow developer interested in Graal/Truffle, I hope Rafaello's query can be addressed and I would request we just don't throw the rule book at him :-) Thanks, Sidharth On Sep 30, 2016 10:52 PM, "Dalibor Topic" wrote: > Per the OpenJDK FAQ: > > Can I expect to get specific legal advice or answers to my legal questions > on OpenJDK mailing lists? > > In general, no. The OpenJDK mailing lists serve for technical work around > development of specific OpenJDK projects. > > In my opinion asking legal questions on mailing lists is at best just a > waste of everyone's time. > > Cheers, > Dalibor Topi? > > -- > Dalibor Topic | Principal Product Manager > Phone: +494089091214 | Mobile: +491737185961 > > > ORACLE Deutschland B.V. & Co. KG | K?hneh?fe 5 | 22761 Hamburg > > ORACLE Deutschland B.V. & Co. KG > Hauptverwaltung: Riesstr. 25, D-80992 M?nchen > Registergericht: Amtsgericht M?nchen, HRA 95603 > > Komplement?rin: ORACLE Deutschland Verwaltung B.V. > Hertogswetering 163/167, 3543 AS Utrecht, Niederlande > Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697 > Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher > > Oracle is committed to developing > practices and products that help protect the environment > > > On 30 Sep 2016, at 18:49, Raffaello Giulietti < > raffaello.giulietti at supsi.ch> wrote: > > > > Hi all, > > > > I'm aware that this might not be the ideal place to ask about licensing > > issues but I'm just looking for unbinding opinions, not legal advice. > > > > My understanding is that Graal is licensed under the "viral" GPL while > > Truffle is licensed under the less restrictive GPL with Classpath > exception. > > > > What does this imply for a Truffle language implementation that makes > > use of Graal for performance, even if it does not link directly to the > > Graal API? > > Does it indirectly inherit the stricter GPL status or can it be > > distributed with any license as allowed by the GPL with Classpath > exception? > > > > Greetings > > Raffaello > From christian.wimmer at oracle.com Fri Sep 30 18:05:16 2016 From: christian.wimmer at oracle.com (Christian Wimmer) Date: Fri, 30 Sep 2016 11:05:16 -0700 Subject: Licensing question In-Reply-To: References: Message-ID: <66ffbcaa-dd08-1dd4-f0bb-4c8d902e72ca@oracle.com> Graal is just another compiler alongside the Java HotSpot server compiler that optimizes code at run time, so the license of Graal does not affect Truffle any more than the license of the Java HotSpot VM (GPL without Classpath exception) in general. -Christian On 09/30/2016 09:49 AM, Raffaello Giulietti wrote: > Hi all, > > I'm aware that this might not be the ideal place to ask about licensing > issues but I'm just looking for unbinding opinions, not legal advice. > > My understanding is that Graal is licensed under the "viral" GPL while > Truffle is licensed under the less restrictive GPL with Classpath exception. > > What does this imply for a Truffle language implementation that makes > use of Graal for performance, even if it does not link directly to the > Graal API? > Does it indirectly inherit the stricter GPL status or can it be > distributed with any license as allowed by the GPL with Classpath exception? > > Greetings > Raffaello > From raffaello.giulietti at supsi.ch Fri Sep 30 18:14:47 2016 From: raffaello.giulietti at supsi.ch (Raffaello Giulietti) Date: Fri, 30 Sep 2016 18:14:47 +0000 Subject: Licensing question In-Reply-To: <66ffbcaa-dd08-1dd4-f0bb-4c8d902e72ca@oracle.com> References: <66ffbcaa-dd08-1dd4-f0bb-4c8d902e72ca@oracle.com> Message-ID: Christian, thanks for this clear and, in retrospect, rather logical answer. Greetings Raffaello On 2016-09-30 18:05, Christian Wimmer wrote: > Graal is just another compiler alongside the Java HotSpot server > compiler that optimizes code at run time, so the license of Graal does > not affect Truffle any more than the license of the Java HotSpot VM (GPL > without Classpath exception) in general. > > -Christian > > > On 09/30/2016 09:49 AM, Raffaello Giulietti wrote: >> Hi all, >> >> I'm aware that this might not be the ideal place to ask about licensing >> issues but I'm just looking for unbinding opinions, not legal advice. >> >> My understanding is that Graal is licensed under the "viral" GPL while >> Truffle is licensed under the less restrictive GPL with Classpath >> exception. >> >> What does this imply for a Truffle language implementation that makes >> use of Graal for performance, even if it does not link directly to the >> Graal API? >> Does it indirectly inherit the stricter GPL status or can it be >> distributed with any license as allowed by the GPL with Classpath >> exception? >> >> Greetings >> Raffaello >> From dalibor.topic at oracle.com Fri Sep 30 22:56:39 2016 From: dalibor.topic at oracle.com (dalibor topic) Date: Sat, 1 Oct 2016 00:56:39 +0200 Subject: Licensing question In-Reply-To: References: Message-ID: On 30.09.2016 19:54, Sidharth Kshatriya wrote: > I can understand that it might be > difficult for Oracle employees to give their opinions on this mailing > list on licensing issues -- even if they felt they could offer some answers. On a technical mailing list, typically none of the participants, regardless who happens to be their employer, are qualified to provide opinions on legal matters in any jurisdiction. Qualification is not a matter of feelings. For many professions, such as the legal one, it's matter of local formal education and local certification. cheers, dalibor topic -- Dalibor Topic | Principal Product Manager Phone: +494089091214 | Mobile: +491737185961 ORACLE Deutschland B.V. & Co. KG | K?hneh?fe 5 | 22761 Hamburg ORACLE Deutschland B.V. & Co. KG Hauptverwaltung: Riesstr. 25, D-80992 M?nchen Registergericht: Amtsgericht M?nchen, HRA 95603 Komplement?rin: ORACLE Deutschland Verwaltung B.V. Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697 Gesch?ftsf?hrer: Alexander van der Ven, Jan Schultheiss, Val Maher Oracle is committed to developing practices and products that help protect the environment From thomas.wuerthinger at oracle.com Fri Sep 30 23:30:32 2016 From: thomas.wuerthinger at oracle.com (Thomas Wuerthinger) Date: Sat, 1 Oct 2016 01:30:32 +0200 Subject: Licensing question In-Reply-To: References: Message-ID: <078FD8F3-D27F-4A52-B47F-89C1412EA07C@oracle.com> Raffaello, I believe this mail from the archives of this mailing list is addressing your question: http://mail.openjdk.java.net/pipermail/graal-dev/2013-August/000751.html Regards, thomas > On 30 Sep 2016, at 18:49, Raffaello Giulietti wrote: > > Hi all, > > I'm aware that this might not be the ideal place to ask about licensing > issues but I'm just looking for unbinding opinions, not legal advice. > > My understanding is that Graal is licensed under the "viral" GPL while > Truffle is licensed under the less restrictive GPL with Classpath exception. > > What does this imply for a Truffle language implementation that makes > use of Graal for performance, even if it does not link directly to the > Graal API? > Does it indirectly inherit the stricter GPL status or can it be > distributed with any license as allowed by the GPL with Classpath exception? > > Greetings > Raffaello From thomas.wuerthinger at oracle.com Fri Sep 30 23:49:46 2016 From: thomas.wuerthinger at oracle.com (Thomas Wuerthinger) Date: Sat, 1 Oct 2016 01:49:46 +0200 Subject: Licensing question In-Reply-To: References: Message-ID: We are not providing legal advice on this mailing list. However, it is fair to point out that the Truffle framework is licensed under GPLv2 with classpath exception (see last paragraph of https://github.com/graalvm/truffle). Existing Truffle language implementations are licensed under a wide variety of licenses, for example UPL (SimpleLanguage), BSD (Sulong), GPLv2 (FastR), or also proprietary licenses. They are not restricted to the use of any particular license. Sidharth, Raffaello, I hope this is helpful. Regards, thomas