How to find all methods where ## occurs ?

62 views
Skip to first unread message

Marten Feldtmann

unread,
Jul 21, 2020, 4:46:59 AM7/21/20
to VA Smalltalk
e.g.

##MonticelloMethodCompilationFailure.

Mariano Martinez Peck

unread,
Jul 21, 2020, 9:39:58 AM7/21/20
to VA Smalltalk
I don't know an easy way (from the menu) to look for references to EsAtom in CompiledMethod literals. So in this case, I usually do a "Options" -> "Browse Methods" -> "Including String...".


On Tue, Jul 21, 2020 at 5:47 AM Marten Feldtmann <m.fel...@dimap.de> wrote:
e.g.

##MonticelloMethodCompilationFailure.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/758ee575-c97c-44ea-958c-bbe6a8a1dbc4n%40googlegroups.com.


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.

Marten Feldtmann

unread,
Jul 21, 2020, 10:17:22 AM7/21/20
to VA Smalltalk
Thanks, that is ok

Mariano Martinez Peck

unread,
Jul 21, 2020, 10:20:09 AM7/21/20
to VA Smalltalk
Sorry, I was wrong... there is a way to look for EsAtom in CompiledMethod literals... from the Transcript -> Tools -> Browse References and there, put the atom without the ##. For example, "MonticelloMethodCompilationFailure". However, in this case it won't work because the method that Monticello generates in this case its just a sentence like this:

##MonticelloMethodCompilationFailure.

That is a no-op, it has no effect and hence the Compiler ignores it and that's why that's not even in the bytecode. If the method would have been:

##MonticelloMethodCompilationFailure == 'aaa' 

or 

^ ##MonticelloMethodCompilationFailure. 

or anything that the Compiler wouldn't ignore it, it would have been found.

BTW, we changed this behavior for Tonel's #commentedSource


Richard Sargent

unread,
Jul 21, 2020, 1:17:38 PM7/21/20
to VA Smalltalk
On Tuesday, July 21, 2020 at 7:20:09 AM UTC-7, Mariano Martinez Peck wrote:
Sorry, I was wrong... there is a way to look for EsAtom in CompiledMethod literals... from the Transcript -> Tools -> Browse References and there, put the atom without the ##. For example, "MonticelloMethodCompilationFailure". However, in this case it won't work because the method that Monticello generates in this case its just a sentence like this:

##MonticelloMethodCompilationFailure.

That is a no-op, it has no effect and hence the Compiler ignores it and that's why that's not even in the bytecode. If the method would have been:

It's long been a complaint of mine that Atoms and Compile-time Constants should still have their source elements in the literals pool for the compiled method.
 

##MonticelloMethodCompilationFailure == 'aaa' 

or 

^ ##MonticelloMethodCompilationFailure. 

or anything that the Compiler wouldn't ignore it, it would have been found.

BTW, we changed this behavior for Tonel's #commentedSource

Also, it is quite easy to look up the implementation of the various methods for finding references and craft a variation that looks for e.g. methods containing an EsAtom or a CTC and them browsing those that do.

I don't have an example handy at the moment.




On Tue, Jul 21, 2020 at 10:39 AM Mariano Martinez Peck <mp...@instantiations.com> wrote:
I don't know an easy way (from the menu) to look for references to EsAtom in CompiledMethod literals. So in this case, I usually do a "Options" -> "Browse Methods" -> "Including String...".


On Tue, Jul 21, 2020 at 5:47 AM Marten Feldtmann <m.fel...@dimap.de> wrote:
e.g.

##MonticelloMethodCompilationFailure.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to va-sma...@googlegroups.com.


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.

Marten Feldtmann

unread,
Jul 21, 2020, 1:21:10 PM7/21/20
to VA Smalltalk
In this case it would be nice to find all methods, so one can fix them ..

Richard Sargent

unread,
Jul 21, 2020, 3:31:57 PM7/21/20
to VA Smalltalk
On Tuesday, July 21, 2020 at 10:21:10 AM UTC-7, Marten Feldtmann wrote:
In this case it would be nice to find all methods, so one can fix them ..

Fix them?

Marten Feldtmann

unread,
Jul 21, 2020, 3:50:02 PM7/21/20
to va-sma...@googlegroups.com
Am 21.07.20 um 21:31 schrieb Richard Sargent:
On Tuesday, July 21, 2020 at 10:21:10 AM UTC-7, Marten Feldtmann wrote:
In this case it would be nice to find all methods, so one can fix them ..

Fix them?

The MonticelloImporter remarks the original source code out if there is a compile error during import and adds a helper source into that method ... so you visit each method and fixes the errors.

Marten

Richard Sargent

unread,
Jul 22, 2020, 3:52:39 AM7/22/20
to VA Smalltalk
Can you elaborate on what's going on? What compile errors? Why? Atoms and Compile-time Constants should compile.

Marten

Richard Sargent

unread,
Jul 22, 2020, 4:08:07 AM7/22/20
to VA Smalltalk
Here is an example of browsing all methods with compile-time constants. (These are not Atoms; that's a different condition.)

| methods |
methods := CompiledMethod withAllSubclasses asArray multiAllInstances
                        select: [:each | each hasCTC].
 
((EtTools browser: #methods)
    on: methods
    labeled: 'Methods with Compile-time Constants')
        owningImage: self; 
        open

Richard Sargent

unread,
Jul 22, 2020, 4:11:22 AM7/22/20
to VA Smalltalk
And this variant shows all methods with Atoms.

| methods |
methods := CompiledMethod withAllSubclasses asArray multiAllInstances
                        select: [:each | each allLiterals anySatisfy: [:every | every isAtom]].

 
((EtTools browser: #methods)
    on: methods
    labeled: 'Methods with Atoms')
        owningImage: self; 
        open

Marten Feldtmann

unread,
Jul 22, 2020, 7:41:21 AM7/22/20
to VA Smalltalk
Richard, its all ok.

The way the MonticelloImporter works is totally ok and good. He imports the source code, tries to compile the method and if that fails, he preserves the original code (put them in "") and write a small helper code into that method - parts of this helper code is the "##ewifwoeifjw" (Atom) construction. Even though the compile errors are printed in the Transcript I personally would like to see, that I can query the system for methods where this specific Atom is placed in the source code.

Richard Sargent

unread,
Jul 22, 2020, 8:59:37 AM7/22/20
to VA Smalltalk
On Wed, Jul 22, 2020, 04:41 Marten Feldtmann <m.fel...@dimap.de> wrote:
Richard, its all ok.

The way the MonticelloImporter works is totally ok and good. He imports the source code, tries to compile the method and if that fails, he preserves the original code (put them in "") and write a small helper code into that method - parts of this helper code is the "##ewifwoeifjw" (Atom) construction. Even though the compile errors are printed in the Transcript I personally would like to see, that I can query the system for methods where this specific Atom is placed in the source code.

Oh, that makes sense now.

You can use a variant of the Atom example I provided. Instead of testing for #isAtom, you can test for that specific Atom, using #includes: rather than #anySatisfy:.



Richard Sargent schrieb am Mittwoch, 22. Juli 2020 um 09:52:39 UTC+2:
On Tuesday, July 21, 2020 at 12:50:02 PM UTC-7, Marten Feldtmann wrote:
Am 21.07.20 um 21:31 schrieb Richard Sargent:
On Tuesday, July 21, 2020 at 10:21:10 AM UTC-7, Marten Feldtmann wrote:
In this case it would be nice to find all methods, so one can fix them ..

Fix them?

The MonticelloImporter remarks the original source code out if there is a compile error during import and adds a helper source into that method ... so you visit each method and fixes the errors.


Can you elaborate on what's going on? What compile errors? Why? Atoms and Compile-time Constants should compile.

Marten

--
You received this message because you are subscribed to a topic in the Google Groups "VA Smalltalk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/va-smalltalk/C8UUxUDY1Q8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to va-smalltalk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/87634c40-6456-4df1-8af5-23740b1045dfn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages