Monthly Archives: February 2015

CompiledMethod got a Twin

Hi,

In 40516 there is now a strange, but rather powerful mechanism for CompiledMethod: the Twin.

What does that do?

you can call on a method #createTwin

(ReflectivityExamples>>#exampleMethod) createTwin.

after this, the CompiledMethod has a high-level representation (the AST) attached that itself references the CompiledMethod
(they form a twin).

(ReflectivityExamples>>#exampleMethod) reflectiveMethod

The fun thing is now that one can install either in the class. Call #invalidate to make sure the reflective method is installed.

ReflectiveMethod implements #run:with:in: which calls a compilation hook (too re-create from the AST) and then installs that in the
method dict and then executes the method:

(ReflectivityExamples>>#exampleMethod) createTwin.
(ReflectivityExamples>>#exampleMethod) invalidate.
self assert: (ReflectivityExamples>>#exampleMethod) class = ReflectiveMethod.
self assert: ReflectivityExamples new exampleMethod = 5.
self assert: (ReflectivityExamples>>#exampleMethod) class = CompiledMethod.

Which means that this gives us an in-image, on-demand JIT compiler AST->Bytecode. In 50 lines of code.

e.g. try on Morph:

Morph methods do: #createTwin.
Morph methods do: #invalidate.

Counting which twin is installed shows us the working set of Morph:

(Morph methods select: [ :each | each class = CompiledMethod ]) size

some 330 method out of nearly 900….

So what can one do with this? In essence this turns the AST into a reflective representation for Methods
(if you care to set up twin creation + invalidation correctly).

What will this allow us to do? stay tuned…

Marcus

The essential: many improvements daily

40512
14990 MonitorDelay>>#signalLock:afterMSecs:inMonitor:queue: should return MonitorDelay object
https://pharo.fogbugz.com/f/cases/14990

14984 Improve protocol names in ComposableModel and subclasses
https://pharo.fogbugz.com/f/cases/14984

14996 LinkedList>>#select:thenCollect: is slow
https://pharo.fogbugz.com/f/cases/14996

14995 script: Pragma is also acceptable for non-unary methods
https://pharo.fogbugz.com/f/cases/14995

40511
14991 ExampleSlotWithDefaultValue: allow default to be set in definition
https://pharo.fogbugz.com/f/cases/14991

14992 ScriptLoader: code path of Integrator needs to delete scripts, too
https://pharo.fogbugz.com/f/cases/14992

14982 Improved support for unknown bytecode
https://pharo.fogbugz.com/f/cases/14982

40510
– Scriptloader test

40509
14868 Unbound Globals (XBytecodeGenerator)
https://pharo.fogbugz.com/f/cases/14868

14989 Improve and simplify BlockClosure benchmarking
https://pharo.fogbugz.com/f/cases/14989

40508
14901 Matrix>>extent is missing
https://pharo.fogbugz.com/f/cases/14901

14359 ScriptLoader linesOfCode ==> 108740
https://pharo.fogbugz.com/f/cases/14359

14981 Fixes for SistaV1 bytecode set (part 2)
https://pharo.fogbugz.com/f/cases/14981

40507
14987 ShoreLine Reporter version 0.1.2
https://pharo.fogbugz.com/f/cases/14987

40506
14983 MorphicEventDispatcher>>#dispatchEvent:with: needs to nil morph instance
https://pharo.fogbugz.com/f/cases/14983

14862 /is/this/possible? asFileReference size
https://pharo.fogbugz.com/f/cases/14862

13004 Key Mapping should have a GUI interface to show all definitions
https://pharo.fogbugz.com/f/cases/13004

14965 #class:instanceVariableNames: not needed in OldClassBuilderAdapter
https://pharo.fogbugz.com/f/cases/14965

40505
14980 Method missing to decode bytecode set
https://pharo.fogbugz.com/f/cases/14980

14979 Fixes for SistaV1 bytecode set
https://pharo.fogbugz.com/f/cases/14979

40504
14964 deprecated #anonymousSubclassOf:
https://pharo.fogbugz.com/f/cases/14964

14975 Generate initialize methods should be in initialization protocol
https://pharo.fogbugz.com/f/cases/14975

14967 MCFileTreeRepository does not implement #versionInfoFromVersionNamed: correctly
https://pharo.fogbugz.com/f/cases/14967

40503
14954 load new configuration 2.9 (more morphic support)
https://pharo.fogbugz.com/f/cases/14954

14955 load new TxText configuration 2.8.3 (more morphic support)
https://pharo.fogbugz.com/f/cases/14955

40502
14960 Extend Duration with a human readable print option and some related accessors
https://pharo.fogbugz.com/f/cases/14960

14963 addInstVarNamed: should use addSlot:
https://pharo.fogbugz.com/f/cases/14963

14970 TheManifestBuilder>>removeManifestOf:(manifest is shadowed)
https://pharo.fogbugz.com/f/cases/14970

14914 #initializeSlots: should not skip hidden slots
https://pharo.fogbugz.com/f/cases/14914

40501
14942 Delay refactoring (part 2b) – clean out newCodeEnabled wrappers
https://pharo.fogbugz.com/f/cases/14942

40500
14631 DNU GLMThemeIcons >> overlayModificationIconContents
https://pharo.fogbugz.com/f/cases/14631

14941 isObsolete returns true for anonymous classes
https://pharo.fogbugz.com/f/cases/14941

14728 NBFFICalloutAPI option WinUnicode is not prefixed with opt, as all the other options
https://pharo.fogbugz.com/f/cases/14728

40498
14961 instantiation is misspelled in PharoSyntaxTutorial
https://pharo.fogbugz.com/f/cases/14961

14947 Missing allChildrenMatching:
https://pharo.fogbugz.com/f/cases/14947

14971 MorphicTransform: Better Argument Names
https://pharo.fogbugz.com/f/cases/14971

40497
14949 String>>asPackage
https://pharo.fogbugz.com/f/cases/14949

14957 Number>>#percent
https://pharo.fogbugz.com/f/cases/14957

14958 DateModel>>#initializeWidgets error
https://pharo.fogbugz.com/f/cases/14958

40495
14934 Load new Athens configuration 2.8
https://pharo.fogbugz.com/f/cases/14934
This fixes the following issues

case 14723 Make StrikeFonts working in Athens (font size related)
case 14710 AthensCairoCanvas setAA not implemented
case 14799 AthensCairoCanvas draws in empty rectangles

40496
14935 Load new configuratoin of TxText 2.8.2
https://pharo.fogbugz.com/f/cases/14935
with the following fixes
case 14778 TxAthensLayoutView should not impose a x offset minimal value
case 14774 TxHighlightRenderer shapes badly computed when scrolling horizontally
case 14719 TxTextLayout startPosition and TxTexLayoutView scrolling management
case 14715 TxTextEditorMorph modifies dragged morph position
case 14687 TxTextPosition moveDown: can only move one line down

40494
14940 timeToRunWithoutGC broken
https://pharo.fogbugz.com/f/cases/14940

14946 Replace senders of String>>#subStrings: in Tool-Finder
https://pharo.fogbugz.com/f/cases/14946

14937 better comments and test for Matrix
https://pharo.fogbugz.com/f/cases/14937

14060 MNU: receiver of “stepToCallee” is nil
https://pharo.fogbugz.com/f/cases/14060

40493
14943 really deprecated #leap
https://pharo.fogbugz.com/f/cases/14943

14897 Date isLeapYear equally defined in Dates superclass
https://pharo.fogbugz.com/f/cases/14897

14483 Extract the PragmaCollector into its own package
https://pharo.fogbugz.com/f/cases/14483

40492
14064 Improvements to checking termination of processes
https://pharo.fogbugz.com/f/cases/14064

40491
2649 dont let an empty Rectangle #intersects:
https://pharo.fogbugz.com/f/cases/2649

14938 missing addModelItemsToWindowMenu: in WindowModel
https://pharo.fogbugz.com/f/cases/14938

14939 example for SearchableList does not work (MNU)
https://pharo.fogbugz.com/f/cases/14939

40490
4795 Horizontal wheel events
https://pharo.fogbugz.com/f/cases/4795

14905 Missing test and clean code for SmalltalkImage>>#extractMinusParameters
https://pharo.fogbugz.com/f/cases/14905

40488
14852 TTLCache should allow for custom TTLAssociation that can compute their own expiration
https://pharo.fogbugz.com/f/cases/14852

14869 Repeated methods in Trait Composition
https://pharo.fogbugz.com/f/cases/14869

40486
14904 Slot: hand the correct class to slot in #buildNewClass
https://pharo.fogbugz.com/f/cases/14904

14899 add addSlot in testClassRespectsPolymorphismWithTrait
https://pharo.fogbugz.com/f/cases/14899

14874 WorldState>>#interCyclePause: failed
https://pharo.fogbugz.com/f/cases/14874

14895 Class Variable Refactoring -> Add produce error when pressing escape on dialog
https://pharo.fogbugz.com/f/cases/14895

40485
14892 Slots: when class is created, #installingIn: is not called
https://pharo.fogbugz.com/f/cases/14892

14893 Slots: allSlots should filter hidden slots
https://pharo.fogbugz.com/f/cases/14893

14888 Matrix>>rows:columns arguments are unclear
https://pharo.fogbugz.com/f/cases/14888

40484
14894 SimpleSwitchMorph lost onColor: aColor
https://pharo.fogbugz.com/f/cases/14894

14891 Slots: add #addSlot and #hasSlots
https://pharo.fogbugz.com/f/cases/14891

How Far We’ve Come!

Sean De Nigris (an early pharo adopter) wrote the following:

It was so much fun watching the Pharo Days videos! Thanks for recording them
and I hope to be there next time 🙂

(note videos are here https://www.youtube.com/channel/UCp3mNigANqkesFzdm058bvw/videos)

Somewhere halfway through the playlist, it hit me how easily I was
downloading all the projects and images being talked about. I was
copy/pasting one-line Metacello scripts out of github READMEs, clicking in
the Configuration Browser, or downloading the latest code from CI – and it
all “just worked”!!!

Remember not too long ago when we were passing around custom scripts to load
multiple dependent packages, and explaining to outsiders that “we don’t need
github because Smalltalk invented SCM” (or whatever) while we created the
future invisibly, hidden away from the rest of the world?

After laying down so many building blocks (like FileSystem) that take the
system out of the way of creative expression, it is exciting to finally be
tackling some of the high-impact things… you know the ones we’ve been
avoiding… like Morphic, development tools, and the text editors.

And the steady streams of new talent and funding seem likely to keep the
successes coming.

So CONGRATULATIONS, Pharo Community!!!! We deserve it.

Now get back to work – we’ve got a future to create 😉

GADM package for Pharo

I am pleased to announce the release of the GADM package for Pharo. GADM is a high-resolution spatial database of the location of the world’s administrative areas for use in Geographical Information Systems (GIS) and similar software.

The following post contains details about the release:

If anyone wish to extend it with the polygon data included in GADM, please feel free to request repository permission to upload changes.

Cheers,

Hernán

Pharo interface to the Stanford Named Entity Recognizer

Hello,

I am announcing the release of StNER. StNER provides a Pharo interface to the Stanford Named Entity Recognizer (NER). (http://nlp.stanford.edu/software/CRF-NER.shtml)

Installation and usage details are described in the following post:

http://80738163270632.blogspot.com.ar/2015/02/stner-interface-to-stanford-named.html

Cheers,

Hernán

PS: Only tested in Windows 8.1

phylogenetics analysis platform in Pharo

Hello,

Here I have new videos to show some of the features of PhyloclassTalk, developed in Pharo 3.0.

PhyloclassTalk is a phylogenetics analysis platform which includes several modules to perform different workflows related with bioinformatics analysis.

Video 1: GenBank Browser & PhyloclassTalk Classifier
https://vimeo.com/120312074

Video 2: Blast Query Builder

Greetings,

Hernán

Example implementation of associations with Slots in Pharo 4.0

With it you can link two slots together so an update on one side will also update the other side of the association/relationship.

I used these Movie and Person classes for testing:

Object subclass: #SlotExampleMovie
slots: {
#name.
#year.
ToOneAssociationSlot named: #director target: #SlotExamplePerson inverse: #directedMovies.
ToManyAssociationSlot named: #actors target: #SlotExamplePerson inverse: #actedInMovies }
classVariables: { }
category: ‘SlotAssociations-Tests-Example’

Object subclass: #SlotExamplePerson
slots: {
#name.
ToManyAssociationSlot named: #directedMovies target: #SlotExampleMovie inverse: #director.
ToManyAssociationSlot named: #actedInMovies target: #SlotExampleMovie inverse: #actors }
classVariables: { }
category: ‘SlotAssociations-Tests-Example’

With this definition the director of a Movie must be a Persion instance. When you set the director of a movie this movie is automatically added to the directedMovies collection of that person. Off course it also works the other way around.

It took very little code to add these association slots. I think Slots are a really nice addition to Pharo! If anyone wants to have a look at the code:

MCHttpRepository
location: ‘http://smalltalkhub.com/mc/JanVanDeSandt/Stuff/main’
user: ”
password: ”

Jan.

Pharo days 2015 video conferences

Here are the videos of PharoDays 2015
https://www.youtube.com/channel/UCp3mNigANqkesFzdm058bvw/videos
Thanks for the people who make them available (martin, santiago and marcus)

New rewrite tool for Pharo

Hi,

Video presentation of Rewrite Tool: http://screencast.com/t/LCEl0hFl
Also on blog: http://myfuncoding.blogspot.com/

Please, I need your feedback on tool, so download it and try to use it.
Any suggestions or questions are welcome!

Best,
Mark

Pharo Ubuntu 14.04.1 LTS 64-bit

Hi,

It seems some people are having trouble getting Pharo to work on Ubuntu 14.04.1 LTS 64-bit.

Here is one way to make things work.

Pharo (the VM) is a 32-bit executable dynamically linked to a number of libraries, each of which has to be present in its 32-bit variant in order to run Pharo and/or to use all features.

On a clean, stock, fully updated Ubuntu 14.04.1 LTS 64-bit, do the following (the X11, GL and asound libraries are not needed when you run headless on a server):

$ sudo apt-get install curl libc6:i386 libssl1.0.0:i386 libX11.6:i386 libGL.1:i386 libasound2:i386

$ curl get.pharo.org/40+vm | bash

$ ./pharo Pharo.image eval “ZnClient new get: ‘https://google.com'”

$ ./pharo-ui Pharo.image

HTH,

Sven

PS: You can use ldd to check if all dependencies of the VM and its plugins in the pharo-vm directory are satisfied