Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Issue 438683004: bpf_dsl: support Switch/Case expressions (Closed)

Created:
6 years, 4 months ago by mdempsky
Modified:
6 years, 3 months ago
CC:
chromium-reviews, jln+watch_chromium.org
Project:
chromium
Visibility:
Public.

Description

bpf_dsl: support Switch/Case expressions This adds support for expressions like Switch(arg) .Case(1, result1) .CASES((2, 3), result2) .Default(result3) Currently these expressions are compiled simply as short-hand for If(arg == 1, result1) .ElseIf(arg == 2 || arg == 3, result2) .Else(result3) but in the future we should be able to optimize it better. The CASES macro ugliness is unfortunately necessary until we're allowed to use C++11. Later we'll be able to change it to real C++ code like "Cases({2, 3}, result2)" (which clang-format will then format a bit more nicely too). BUG=408845 R=jln@chromium.org, jorgelo@chromium.org Committed: https://chromium.googlesource.com/chromium/src/+/279b9aad9824c840e10382c2f6e4356d4c632774

Patch Set 1 #

Patch Set 2 : Rename multi-value Case to Cases; tweak implementation #

Patch Set 3 : Cleanup #

Patch Set 4 : Minor style tweak #

Patch Set 5 : Rename helper macro #

Patch Set 6 : Sync and resolve conflicts #

Total comments: 2

Patch Set 7 : Sync and resolve conflicts #

Unified diffs Side-by-side diffs Delta from patch set Stats (+202 lines, -28 lines) Patch
M sandbox/linux/bpf_dsl/bpf_dsl.h View 1 2 3 4 5 6 6 chunks +94 lines, -3 lines 0 comments Download
M sandbox/linux/bpf_dsl/bpf_dsl.cc View 1 2 3 4 5 2 chunks +22 lines, -0 lines 0 comments Download
M sandbox/linux/bpf_dsl/bpf_dsl_unittest.cc View 1 2 3 4 5 4 chunks +43 lines, -0 lines 0 comments Download
M sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc View 1 2 3 4 5 6 5 chunks +43 lines, -25 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
mdempsky
Just sharing as a proof-of-concept. I like the idea, and the resulting policy code seems ...
6 years, 4 months ago (2014-08-01 09:20:35 UTC) #1
Jorge Lucangeli Obes
On 2014/08/01 09:20:35, mdempsky wrote: > Just sharing as a proof-of-concept. I like the idea, ...
6 years, 4 months ago (2014-08-02 00:55:41 UTC) #2
mdempsky
I've cleaned this up some, so it should be ready for review and submission. PTAL
6 years, 3 months ago (2014-09-03 01:11:20 UTC) #3
Jorge Lucangeli Obes
lgtm. Arg filters look so much better.
6 years, 3 months ago (2014-09-03 15:35:19 UTC) #4
mdempsky
On 2014/09/03 15:35:19, Jorge Lucangeli Obes wrote: > lgtm. Arg filters look so much better. ...
6 years, 3 months ago (2014-09-03 21:36:51 UTC) #5
jln (very slow on Chromium)
lgtm I think the compiler optimization for these might be worth it in a few ...
6 years, 3 months ago (2014-09-05 22:48:39 UTC) #6
mdempsky
https://chromiumcodereview.appspot.com/438683004/diff/100001/sandbox/linux/bpf_dsl/bpf_dsl.h File sandbox/linux/bpf_dsl/bpf_dsl.h (right): https://chromiumcodereview.appspot.com/438683004/diff/100001/sandbox/linux/bpf_dsl/bpf_dsl.h#newcode344 sandbox/linux/bpf_dsl/bpf_dsl.h:344: for (Iter i = values.begin(), end = values.end(); i ...
6 years, 3 months ago (2014-09-05 23:08:31 UTC) #7
mdempsky
Committed patchset #7 (id:120001) manually as 279b9aa (presubmit successful).
6 years, 3 months ago (2014-09-06 01:19:33 UTC) #8
commit-bot: I haz the power
6 years, 3 months ago (2014-09-10 03:42:07 UTC) #9
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/279b9aad9824c840e10382c2f6e4356d4c632774
Cr-Commit-Position: refs/heads/master@{#293599}

Powered by Google App Engine
This is Rietveld 408576698