Bug 189902 - offlineasm: fix macro scoping
Summary: offlineasm: fix macro scoping
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tadeu Zagallo
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-09-23 18:23 PDT by Tadeu Zagallo
Modified: 2018-09-24 16:00 PDT (History)
7 users (show)

See Also:


Attachments
Patch (4.33 KB, patch)
2018-09-23 18:28 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff
fix error reporting (6.36 KB, patch)
2018-09-24 12:50 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff
patch for landing (6.90 KB, patch)
2018-09-24 14:53 PDT, Tadeu Zagallo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tadeu Zagallo 2018-09-23 18:23:34 PDT
In the code below, the reference to `f` in `g`, which should refer to the outer macro definition will instead refer to the f argument of the anonymous macro passed to `g`. That leads to this code failing to compile (f expected 0 args but got 1).

```
macro f(x)
    move x, t0
end

macro g(fn)
    fn(macro () f(42) end)
end

g(macro(f) f() end)
```
Comment 1 Tadeu Zagallo 2018-09-23 18:28:27 PDT
Created attachment 350594 [details]
Patch
Comment 2 Tadeu Zagallo 2018-09-24 12:50:53 PDT
Created attachment 350670 [details]
fix error reporting
Comment 3 Mark Lam 2018-09-24 14:27:25 PDT
Comment on attachment 350670 [details]
fix error reporting

View in context: https://bugs.webkit.org/attachment.cgi?id=350670&action=review

r+ if your local testing doesn't show any issues and EWS bots are happy.

> Source/JavaScriptCore/offlineasm/transform.rb:137
> +$uniqueVarID = 0

nit: Let's name this uniqueMacroVarID since it's only used for macro vars.
Comment 4 Tadeu Zagallo 2018-09-24 14:53:19 PDT
Created attachment 350696 [details]
patch for landing
Comment 5 WebKit Commit Bot 2018-09-24 15:59:31 PDT
Comment on attachment 350696 [details]
patch for landing

Clearing flags on attachment: 350696

Committed r236434: <https://trac.webkit.org/changeset/236434>
Comment 6 WebKit Commit Bot 2018-09-24 15:59:32 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2018-09-24 16:00:42 PDT
<rdar://problem/44744036>