Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call the System initialize: method #129

Merged
merged 5 commits into from
Jun 3, 2020
Merged

Conversation

ltratt
Copy link
Member

@ltratt ltratt commented Jun 2, 2020

SOM runs programs by calling the initialize: method in System.som and having it load the user's class. This PR makes SOM do just this (f942f27). To get to that point, we have to do various bits of preparatory work, notably supporting the methods (c64f237) and signature (926cd5e) primitives.

Note that the methods primitive exposes a mutable array and we are thus currently subject to the same flaw as Java SOM in this regard (see SOM-st/SOM#35). Fixing that is for a later PR.

This requires changing `Class` to store a SOM `Array` of methods rather than a
Rust `Vec`. This forces a few changes on other things (e.g. we now move to
vaguely Self-like maps where you first look up a method's name and get its index
into the `methods` `Array`)). Because `get_method` is so critical to
performance, we jump through a few hoops to remove some pointless run-time
checks.
@ptersilie
Copy link
Member

There's two typos in the last commit:

SOM starts programs by running by calling the initialize:

bootstraping

@ptersilie
Copy link
Member

Rest looks good.

@ltratt
Copy link
Member Author

ltratt commented Jun 3, 2020

@ptersilie Should I force push? [If you don't tell me to, I don't know that I can!]

SOM starts programs by calling the initialize: method in System.som -- we now do
this in main.rs. This means that we now start SOM programs more-or-less in the
same way as other SOMs.

A few things needed tweaking to enable this, mostly making sure that we fix up
class references to method and class names after bootstrapping. The other major
addition is that SOM appears to treat String equality and reference equality as
being the same (or Java SOM might intern strings?), so we now do the same.
@ptersilie
Copy link
Member

Sorry, of course. Please do a force push.

@ltratt
Copy link
Member Author

ltratt commented Jun 3, 2020

Updated and force pushed.

@ptersilie
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 3, 2020

Build succeeded:

@bors bors bot merged commit 913214d into softdevteam:master Jun 3, 2020
@ltratt ltratt deleted the call_initialize branch June 3, 2020 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants