From d684ab0c50e3b0d22aaf1e46c0ce9ad80fd265cb Mon Sep 17 00:00:00 2001 From: Pascal Muetschard Date: Tue, 28 Jul 2020 14:09:42 -0700 Subject: [PATCH 1/5] [IL] Remove usage of 'master' where possible. --- core/git/log_test.go | 4 ++-- gapis/api/templates/README.md | 15 +-------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/core/git/log_test.go b/core/git/log_test.go index f05c9ff52..2a2bfa248 100644 --- a/core/git/log_test.go +++ b/core/git/log_test.go @@ -26,7 +26,7 @@ func TestParseLog(t *testing.T) { ǁf3cdfb4d9b662e0d66b5779d02370115e136a008ǀBen ClaytonǀUpdate freetype path and fix for breaking changes.ǀ ǁ92ee22e53df7b361224670cf0f5ce4b12cdbc040ǀBen Clayton ǀMerge pull request #154 from google/recreate_ctrlsǀAdd recreateControls flag to the OnDataChanged list/tree event. ǁ73c5a5ba67edfd06d20f9f52249b06984a324d0cǀMr4xǀUpdated Grid Layoutǀ - ǁ1d039c122e95122e68e5862aab3580bba15bd1adǀMr4xǀMerge pull request #1 from google/masterǀUpdate` + ǁ1d039c122e95122e68e5862aab3580bba15bd1adǀMr4xǀMerge pull request #1 from google/fooǀUpdate` expected := []ChangeList{ { SHA: SHA{0xa5, 0xea, 0xeb, 0xbe, 0x90, 0xd6, 0x0b, 0x56, 0x0e, 0x08, 0xa6, 0x75, 0x09, 0x58, 0x75, 0x5a, 0x58, 0xe6, 0xf9, 0x99}, @@ -53,7 +53,7 @@ func TestParseLog(t *testing.T) { { SHA: SHA{0x1d, 0x03, 0x9c, 0x12, 0x2e, 0x95, 0x12, 0x2e, 0x68, 0xe5, 0x86, 0x2a, 0xab, 0x35, 0x80, 0xbb, 0xa1, 0x5b, 0xd1, 0xad}, Author: "Mr4x", - Subject: "Merge pull request #1 from google/master", + Subject: "Merge pull request #1 from google/foo", Description: "Update", }, } diff --git a/gapis/api/templates/README.md b/gapis/api/templates/README.md index 03e67b278..a7012b57e 100644 --- a/gapis/api/templates/README.md +++ b/gapis/api/templates/README.md @@ -48,19 +48,6 @@ being the faster option: {{Template "Foocakes" "Hello world"}} ``` -## File macros - -AGI also adds support for emitting multiple files from a single `.tmpl` source using the `file` function. -`file` is identical to `Macro`, but it takes one additional argument for the output file name: - -```go -{{File filename macro-name single-arg}} -{{File filename macro-name arg0-key arg0-value arg1-key arg1-value...}} -``` - -The outputted file will created in the directory of the ‘master’ output file and -will adopt the same extension. - ## Special symbols To try and help with the formatting of the generated output, AGI's templates support a number of custom unicode symbols: @@ -97,4 +84,4 @@ Sometimes you want to produce extra new-lines to break up the emitted code. By d Like new-lines, sometimes you want to emit an extra whitespace for indentation. By default, whitespaces are consumed at the start of a new-line, so to forcefully emit a whitespace you can use the `•` symbol. -[template]: http://golang.org/pkg/text/template/ \ No newline at end of file +[template]: http://golang.org/pkg/text/template/ From 876a908fe7b4e68a3d5d5bebf079e71b02562ef7 Mon Sep 17 00:00:00 2001 From: Pascal Muetschard Date: Tue, 28 Jul 2020 14:13:05 -0700 Subject: [PATCH 2/5] [IL] Remove usage of 'blacklist'. --- cmd/agi/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/agi/main.go b/cmd/agi/main.go index 1df39838f..2091a274c 100644 --- a/cmd/agi/main.go +++ b/cmd/agi/main.go @@ -253,7 +253,7 @@ func (c *config) checkVM(java string, checkVersion bool) bool { versionStr := string(version) - // Blacklist the Google custom JDKs. + // Don't use the Google custom JDKs as they don't work with our JNI libs. if p := strings.Index(versionStr, googleInfix); p >= 0 { c.logIfVerbose("Not using " + java + ": is a Google JDK (go/gapid-jdk)") return false From 7d05da6202dcc660d972108cb3237729f4166084 Mon Sep 17 00:00:00 2001 From: Pascal Muetschard Date: Tue, 28 Jul 2020 14:14:41 -0700 Subject: [PATCH 3/5] [IL] Remove usage of 'first class'. --- gapil/semantic/function.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gapil/semantic/function.go b/gapil/semantic/function.go index 321dd0b4a..7ad14e646 100644 --- a/gapil/semantic/function.go +++ b/gapil/semantic/function.go @@ -80,7 +80,7 @@ func (*Observed) isExpression() {} // ExpressionType implements Expression for observed parameter lookup. func (e *Observed) ExpressionType() Type { return e.Parameter.Type } -// Callable wraps a Function declaration into a first class function value expression, +// Callable wraps a Function declaration into a function value expression, // optionally binding to an object if its a method. type Callable struct { Object Expression // the object to use as the this parameter for a method From 9fea7519b7fc51de849f0a0ce6bb64a03528dd99 Mon Sep 17 00:00:00 2001 From: Pascal Muetschard Date: Tue, 28 Jul 2020 15:08:10 -0700 Subject: [PATCH 4/5] [IL] Remove usage of 'crazy|blind|dumb|dummy|paranoid'. --- cmd/update-swt/main.go | 60 +++++++++---------- core/app/flags/repeated.go | 22 +++---- core/cc/linux/get_vulkan_proc_address.cpp | 4 +- core/data/dictionary/source.go | 4 +- core/memory_tracker/cc/memory_tracker.h | 2 +- .../memory_tracker/cc/memory_tracker_test.cpp | 32 +++++----- core/os/android/adb/forward.go | 6 +- core/os/device/deviceinfo/cc/query.h | 2 +- core/vulkan/cc/include/ggp_c/BUILD.bazel | 2 +- core/vulkan/cc/include/ggp_c/vulkan_types.h | 6 +- core/vulkan/tools/BUILD.bazel | 2 +- .../vulkan/vk_api_timing_layer/cc/BUILD.bazel | 2 +- .../cc/api_timing_android.exports | 2 +- .../cc/api_timing_desktop.exports | 2 +- .../vk_api_timing_layer/cc/layer_helpers.cpp | 25 ++++---- .../vk_debug_marker_layer/cc/BUILD.bazel | 2 +- .../cc/debug_marker_android.exports | 2 +- .../cc/debug_marker_desktop.exports | 2 +- .../cc/layer_helpers.cpp | 25 ++++---- .../vk_memory_tracker_layer/cc/BUILD.bazel | 2 +- .../cc/layer_helpers.cpp | 25 ++++---- .../cc/memory_tracker_android.exports | 2 +- .../cc/memory_tracker_desktop.exports | 2 +- .../cc/memory_tracker_layer.tmpl | 5 +- .../vk_virtual_swapchain/cc/BUILD.bazel | 2 +- .../src/main/com/google/gapid/MainWindow.java | 2 +- .../com/google/gapid/views/TracerDialog.java | 2 +- .../google/gapid/widgets/LinkifiedTree.java | 2 +- .../widgets/MeasuringViewLabelProvider.java | 2 +- .../com/google/gapid/glcanvas/GlCanvas.java | 14 ++--- gapii/cc/chunk_writer.cpp | 2 +- gapii/cc/connection_header.h | 2 +- gapii/cc/spy.cpp | 2 +- gapil/compiler/compiler_test.go | 4 +- gapil/compiler/storagetypes.go | 8 +-- gapil/resolver/resolve_test.go | 28 ++++----- gapil/runtime/cc/replay/replay.cpp | 4 +- gapil/semantic/node.go | 2 +- gapil/semantic/statement.go | 2 +- gapil/semantic/type.go | 4 +- gapir/cc/memory_allocator.cpp | 2 +- gapir/cc/memory_allocator.h | 8 +-- gapir/cc/resource_cache.cpp | 4 +- gapis/api/cmd_id_group.go | 2 +- gapis/api/templates/api.go.tmpl | 12 ++-- gapis/api/templates/go_ctypes.h.tmpl | 2 +- gapis/api/vulkan/drawCall.go | 4 +- gapis/memory/types.go | 8 +-- gapis/stringtable/README.md | 7 +-- 49 files changed, 183 insertions(+), 188 deletions(-) diff --git a/cmd/update-swt/main.go b/cmd/update-swt/main.go index ca14ee380..9e88f0fee 100644 --- a/cmd/update-swt/main.go +++ b/cmd/update-swt/main.go @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// This is a very dumb script (see imDumb()) that tries to update the swt.bzl +// This is a very brittle script (see giveUp()) that tries to update the swt.bzl // and jface.bzl files to upgrade SWT and JFace to a new Eclipse release // version. To update to a newer version, visit // https://download.eclipse.org/eclipse/downloads/, choose your version and // click on it. The version to pass to this script is the last URL segment and // should take the form "[RS]--". // This tool uses a bunch of regex's to parse HTML and the .bzl files, and does -// so in a dumb, but defensive manner. This means that trivial changes to the +// so in a rigid, but defensive manner. This means that trivial changes to the // Eclipse HTML or the .bzl files will likely make the parsing fail, but at // least if it succeeds, it's fairly confident that what it got is what it // thinks it got. @@ -107,8 +107,8 @@ func run(ctx context.Context) error { return nil } -func imDumb(ctx context.Context, cause error, fmt string, args ...interface{}) error { - log.E(ctx, "I'm a really dumb script and something may have changed. I give up.") +func giveUp(ctx context.Context, cause error, fmt string, args ...interface{}) error { + log.E(ctx, "My input parsing is very strict and some HTML may have changed. I give up.") return log.Errf(ctx, cause, fmt, args...) } @@ -131,40 +131,40 @@ func getRepo(ctx context.Context, version string) (*repo, error) { repoTable, err := extractTable(ctx, html, repoTableRegex) if err != nil { - return nil, imDumb(ctx, err, "Failed to extract repository table") + return nil, giveUp(ctx, err, "Failed to extract repository table") } if len(repoTable) != 2 || len(repoTable[1]) != 1 { - return nil, imDumb(ctx, err, "Repo table has unexpected dimensions (%v)", repoTable) + return nil, giveUp(ctx, err, "Repo table has unexpected dimensions (%v)", repoTable) } base, err := extractLink(ctx, repoUrl, repoTable[1][0]) if err != nil { - return nil, imDumb(ctx, err, "Failed to extract repo URL") + return nil, giveUp(ctx, err, "Failed to extract repo URL") } r := &repo{base: base} swtTable, err := extractTable(ctx, html, swtTableRegex) if err != nil { - return nil, imDumb(ctx, err, "Failed to extract SWT table") + return nil, giveUp(ctx, err, "Failed to extract SWT table") } if len(swtTable) < 2 { - return nil, imDumb(ctx, err, "SWT table has not enough rows (%v)", swtTable) + return nil, giveUp(ctx, err, "SWT table has not enough rows (%v)", swtTable) } for _, row := range swtTable[1:] { // skip over the table headers if len(row) != 3 { - return nil, imDumb(ctx, err, "SWT table has unexpected dimensions (%v)", swtTable) + return nil, giveUp(ctx, err, "SWT table has unexpected dimensions (%v)", swtTable) } link, err := extractLink(ctx, repoUrl, row[1]) if err != nil { - return nil, imDumb(ctx, err, "Failed to extract SWT URL") + return nil, giveUp(ctx, err, "Failed to extract SWT URL") } file := link.Query().Get("dropFile") if file == "" { - return nil, imDumb(ctx, nil, "URL %v didn't contain a dropFile query parameter", link) + return nil, giveUp(ctx, nil, "URL %v didn't contain a dropFile query parameter", link) } link, err = link.Parse(file) if err != nil { - return nil, imDumb(ctx, err, "Drop file '%s' caused an invalid URL", file) + return nil, giveUp(ctx, err, "Drop file '%s' caused an invalid URL", file) } switch row[0] { @@ -181,7 +181,7 @@ func getRepo(ctx context.Context, version string) (*repo, error) { } if r.swtLinux == nil || r.swtWindows == nil || r.swtMacOS == nil { - return nil, imDumb(ctx, nil, "Didn't find SWT for every OS: %v %v %v", r.swtLinux, r.swtWindows, r.swtMacOS) + return nil, giveUp(ctx, nil, "Didn't find SWT for every OS: %v %v %v", r.swtLinux, r.swtWindows, r.swtMacOS) } return r, nil @@ -206,11 +206,11 @@ func (r *repo) editSWTBazel(ctx context.Context) (err error) { src, err := ioutil.ReadFile(swtBzl) if err != nil { - return imDumb(ctx, err, "Failed to read swt.bzl at %s", swtBzl) + return giveUp(ctx, err, "Failed to read swt.bzl at %s", swtBzl) } matches := swtBzlRegex.FindAllSubmatchIndex(src, -1) if len(matches) != 6 { - return imDumb(ctx, err, "Failed to match the swt.bzl regex (%b)", matches) + return giveUp(ctx, err, "Failed to match the swt.bzl regex (%b)", matches) } var b bytes.Buffer @@ -238,11 +238,11 @@ func (r *repo) editSWTBazel(ctx context.Context) (err error) { for os, d := range data { if d.done != 3 { - return imDumb(ctx, nil, "Didn't find SHA/URL for OS %s (%d)", os, d.done) + return giveUp(ctx, nil, "Didn't find SHA/URL for OS %s (%d)", os, d.done) } } if err := ioutil.WriteFile(swtBzl, b.Bytes(), 0644); err != nil { - return imDumb(ctx, err, "Failed to write output to swt.bzl") + return giveUp(ctx, err, "Failed to write output to swt.bzl") } log.I(ctx, "I've updated %s successfully... I think.", swtBzl) @@ -257,29 +257,29 @@ func (r *repo) editJFaceBazel(ctx context.Context) error { } div, err := extractDiv(ctx, html, pluginsRegex) if err != nil { - return imDumb(ctx, err, "Failed to extract plugins file list") + return giveUp(ctx, err, "Failed to extract plugins file list") } links, err := extractLinks(ctx, base, div) if err != nil { - return imDumb(ctx, err, "Failed to extract plugins links") + return giveUp(ctx, err, "Failed to extract plugins links") } links = filterJars(links) src, err := ioutil.ReadFile(jfaceBzl) if err != nil { - return imDumb(ctx, err, "Failed to read jface.bzl at %s", jfaceBzl) + return giveUp(ctx, err, "Failed to read jface.bzl at %s", jfaceBzl) } matches := jfaceBaseRegex.FindAllIndex(src, -1) if len(matches) != 1 { - return imDumb(ctx, err, "Failed to match the base JFace regex (%v)", matches) + return giveUp(ctx, err, "Failed to match the base JFace regex (%v)", matches) } src = append(src[:matches[0][0]], append([]byte("_BASE = \""+base.String()+"\""), src[matches[0][1]:]...)...) matches = jfaceBzlRegex.FindAllSubmatchIndex(src, -1) if len(matches) == 0 { - return imDumb(ctx, nil, "Failed to match the JFace regex (%v)", matches) + return giveUp(ctx, nil, "Failed to match the JFace regex (%v)", matches) } if len(matches) != 8 { log.W(ctx, "I found %d JFace jars, but I expected 8. Closing my eyes and continuing...", len(matches)) @@ -301,16 +301,16 @@ func (r *repo) editJFaceBazel(ctx context.Context) error { } } if jar == nil || srcJar == nil { - return imDumb(ctx, nil, "Didn't find jar/src jar for %s", name) + return giveUp(ctx, nil, "Didn't find jar/src jar for %s", name) } version := jar.label[len(name)+1 : len(jar.label)-4] jarSha, err := sha(ctx, jar.url.String()) if err != nil { - return imDumb(ctx, err, "Failed to get SHA for JAR %s", jar.label) + return giveUp(ctx, err, "Failed to get SHA for JAR %s", jar.label) } srcSha, err := sha(ctx, srcJar.url.String()) if err != nil { - return imDumb(ctx, err, "Failed to get SHA for src JAR %s", srcJar.label) + return giveUp(ctx, err, "Failed to get SHA for src JAR %s", srcJar.label) } fmt.Println(jarSha + " " + srcSha) b.Write(src[loc[0]:loc[4]]) @@ -324,7 +324,7 @@ func (r *repo) editJFaceBazel(ctx context.Context) error { b.Write(src[last:]) if err := ioutil.WriteFile(jfaceBzl, b.Bytes(), 0644); err != nil { - return imDumb(ctx, err, "Failed to write output to jface.bzl") + return giveUp(ctx, err, "Failed to write output to jface.bzl") } log.I(ctx, "I've updated %s successfully... I think.", jfaceBzl) @@ -343,16 +343,16 @@ func fetch(ctx context.Context, url string) ([]byte, error) { log.I(ctx, "Fetching %s...", url) resp, err := http.Get(url) if err != nil { - return nil, imDumb(ctx, err, "Failed to download '%s'", url) + return nil, giveUp(ctx, err, "Failed to download '%s'", url) } defer resp.Body.Close() if resp.StatusCode < 200 || resp.StatusCode >= 300 { - return nil, imDumb(ctx, err, "Got a failure response (%d) from '%s'", resp.StatusCode, url) + return nil, giveUp(ctx, err, "Got a failure response (%d) from '%s'", resp.StatusCode, url) } data, err := ioutil.ReadAll(resp.Body) if err != nil { - return nil, imDumb(ctx, err, "Failed to read response from '%s'", url) + return nil, giveUp(ctx, err, "Failed to read response from '%s'", url) } return data, nil } diff --git a/core/app/flags/repeated.go b/core/app/flags/repeated.go index a5494055a..52d2546bf 100644 --- a/core/app/flags/repeated.go +++ b/core/app/flags/repeated.go @@ -29,7 +29,7 @@ type repeated struct { } const ( - dummyFlag = "dummy" + phFlag = "placeholder" ) func newRepeatedFlag(value reflect.Value) flag.Value { @@ -38,28 +38,28 @@ func newRepeatedFlag(value reflect.Value) flag.Value { single := reflect.New(value.Type().Elem()) switch s := single.Interface().(type) { case *bool: - fs.BoolVar(s, dummyFlag, *s, "") + fs.BoolVar(s, phFlag, *s, "") case *int: - fs.IntVar(s, dummyFlag, *s, "") + fs.IntVar(s, phFlag, *s, "") case *int64: - fs.Int64Var(s, dummyFlag, *s, "") + fs.Int64Var(s, phFlag, *s, "") case *uint: - fs.UintVar(s, dummyFlag, *s, "") + fs.UintVar(s, phFlag, *s, "") case *uint64: - fs.Uint64Var(s, dummyFlag, *s, "") + fs.Uint64Var(s, phFlag, *s, "") case *float64: - fs.Float64Var(s, dummyFlag, *s, "") + fs.Float64Var(s, phFlag, *s, "") case *string: - fs.StringVar(s, dummyFlag, *s, "") + fs.StringVar(s, phFlag, *s, "") case *time.Duration: - fs.DurationVar(s, dummyFlag, *s, "") + fs.DurationVar(s, phFlag, *s, "") case flag.Value: - fs.Var(s, dummyFlag, "") + fs.Var(s, phFlag, "") default: panic(fmt.Sprintf("Unhandled flag type: %v", single.Type())) } - return &repeated{value, single, fs.Lookup(dummyFlag).Value} + return &repeated{value, single, fs.Lookup(phFlag).Value} } func (f *repeated) String() string { diff --git a/core/cc/linux/get_vulkan_proc_address.cpp b/core/cc/linux/get_vulkan_proc_address.cpp index 52a429894..87ae74478 100644 --- a/core/cc/linux/get_vulkan_proc_address.cpp +++ b/core/cc/linux/get_vulkan_proc_address.cpp @@ -50,8 +50,8 @@ struct MesaLLVMOpener { void* getVulkanInstanceProcAddress(size_t instance, const char* name) { typedef PFN_vkVoidFunction (*VPAPROC)(VkInstance instance, const char* name); - static MesaLLVMOpener _dummy; - (void)_dummy; + static MesaLLVMOpener _dlopenAllMesaVersions; + (void)_dlopenAllMesaVersions; static DlLoader dylib("libvulkan.so", "libvulkan.so.1"); diff --git a/core/data/dictionary/source.go b/core/data/dictionary/source.go index a433214f2..6714101ae 100644 --- a/core/data/dictionary/source.go +++ b/core/data/dictionary/source.go @@ -33,8 +33,8 @@ var ( vTy = generic.T2Ty ) -// Source is a dummy interface used to prototype a generic dictionary type. -// K and V can be subsituted with a different type. +// Source is a placeholder interface used to prototype a generic dictionary +// type. K and V can be subsituted with a different type. type Source interface { // Get returns the value of the entry with the given key. Get(K) V diff --git a/core/memory_tracker/cc/memory_tracker.h b/core/memory_tracker/cc/memory_tracker.h index af914ee0b..dbb5613af 100644 --- a/core/memory_tracker/cc/memory_tracker.h +++ b/core/memory_tracker/cc/memory_tracker.h @@ -471,7 +471,7 @@ class MemoryTrackerImpl : public SpecificMemoryTracker { return result; } - // Dummy function that we can pass down to the specific memory tracker. + // Placeholder function that we can pass down to the specific memory tracker. bool DoHandleSegfault(void* v) { return HandleSegfault(v); } // A helper function that returns the first tracking range that overlaps with diff --git a/core/memory_tracker/cc/memory_tracker_test.cpp b/core/memory_tracker/cc/memory_tracker_test.cpp index e07220455..0de5cfae1 100644 --- a/core/memory_tracker/cc/memory_tracker_test.cpp +++ b/core/memory_tracker/cc/memory_tracker_test.cpp @@ -129,7 +129,7 @@ class TestFixture : public ::testing::Test { mutex_thread_init_order_.lock(); normal_thread_run_before_signal_handler_.lock(); m_.lock(); - dummy_lock_.store(false, std::memory_order_seq_cst); + fake_lock_.store(false, std::memory_order_seq_cst); deadlocked_.store(false, std::memory_order_seq_cst); unique_test_ = this; } @@ -150,29 +150,29 @@ class TestFixture : public ::testing::Test { thread_second.join(); } - // DoTask acquires the dummy lock and runs the given function. + // DoTask acquires the fake lock and runs the given function. void DoTask(std::function task) { - DummyLock(); + FakeLock(); normal_thread_run_before_signal_handler_ .unlock(); // This is to make sure the signal will only be send after // the normal threads task(); - DummyUnlock(); + FakeUnlock(); } // RegisterHandlerAndTriggerSignal does the following things: - // 1) Registers a signal handler to SIGUSR1 which acquires the dummy lock. - // 2) Creates a child thread which will acquire the dummy lock. + // 1) Registers a signal handler to SIGUSR1 which acquires the fake lock. + // 2) Creates a child thread which will acquire the fake lock. // 3) Waits for the child thread to run then sends a signal interrupt to the // child thread. // 4) Waits until the child thread finishes and clean up. void RegisterHandlerAndTriggerSignal(void* (*child_thread_func)(void*)) { auto handler_func = [](int, siginfo_t*, void*) { - // DummyLock is to simulate the case that the coherent memory tracker's + // FakeLock is to simulate the case that the coherent memory tracker's // signal handler needs to access shared data. - unique_test_->DummyLock(); + unique_test_->FakeLock(); ; - unique_test_->DummyUnlock(); + unique_test_->FakeUnlock(); }; struct sigaction orig_action; ASSERT_TRUE(RegisterSignalHandler(SIGUSR1, handler_func, &orig_action)); @@ -186,16 +186,16 @@ class TestFixture : public ::testing::Test { } protected: - // Acquires the dummy lock. If the dummy lock has already been locked, i.e. + // Acquires the fake lock. If the fake lock has already been locked, i.e. // its value is true, sets the deadlocked_ flag. - void DummyLock() { - if (dummy_lock_.load(std::memory_order_seq_cst)) { + void FakeLock() { + if (fake_lock_.load(std::memory_order_seq_cst)) { deadlocked_.exchange(true); } - dummy_lock_.exchange(true); + fake_lock_.exchange(true); } - // Releases the dummy lock by setting its value to false. - void DummyUnlock() { dummy_lock_.exchange(false); } + // Releases the fake lock by setting its value to false. + void FakeUnlock() { fake_lock_.exchange(false); } std::mutex normal_thread_run_before_signal_handler_; // A mutex to // guarantee the normal @@ -206,7 +206,7 @@ class TestFixture : public ::testing::Test { // initiated before the other one std::mutex m_; // A mutex for tuning execution order in tests std::atomic - dummy_lock_; // An atomic bool to simulate the lock/unlock state + fake_lock_; // An atomic bool to simulate the lock/unlock state std::atomic deadlocked_; // A flag to indicate deadlocked or not state static TestFixture* unique_test_; // A static pointer of this test fixture, diff --git a/core/os/android/adb/forward.go b/core/os/android/adb/forward.go index 28423ab87..4778b816f 100644 --- a/core/os/android/adb/forward.go +++ b/core/os/android/adb/forward.go @@ -47,12 +47,12 @@ func (p TCPPort) adbForwardString() string { // * The system _may_ hold on to the socket after it has been told to close. // Because of these issues, there is a potential for flakiness. func LocalFreeTCPPort() (TCPPort, error) { - dummy, err := net.Listen("tcp", ":0") + socket, err := net.Listen("tcp", ":0") if err != nil { return 0, err } - defer dummy.Close() - return TCPPort(dummy.Addr().(*net.TCPAddr).Port), nil + defer socket.Close() + return TCPPort(socket.Addr().(*net.TCPAddr).Port), nil } // NamedAbstractSocket represents an abstract UNIX domain socket name on either diff --git a/core/os/device/deviceinfo/cc/query.h b/core/os/device/deviceinfo/cc/query.h index b9f4b45a5..914eb4455 100644 --- a/core/os/device/deviceinfo/cc/query.h +++ b/core/os/device/deviceinfo/cc/query.h @@ -96,7 +96,7 @@ bool vkLayersAndExtensions( std::function get_inst_proc_addr = nullptr); // vkPhysicalDevices populates the VulkanPhysicalDevices fields in the -// given device::VulkanDriver and creates a dummy VkDevice. Returns true if +// given device::VulkanDriver and optionally creates a VkDevice. Returns true if // succeeded. If a vkGetInstanceProcAddress function is given, that function // will be used to resolve Vulkan API calls, otherwise Vulkan loader will be // used. diff --git a/core/vulkan/cc/include/ggp_c/BUILD.bazel b/core/vulkan/cc/include/ggp_c/BUILD.bazel index 30560b379..9d49518d2 100644 --- a/core/vulkan/cc/include/ggp_c/BUILD.bazel +++ b/core/vulkan/cc/include/ggp_c/BUILD.bazel @@ -13,7 +13,7 @@ # limitations under the License. cc_library( - name = "vulkan_ggp_dummy", + name = "vulkan_ggp_placeholder", hdrs = glob(["*.h"]), include_prefix = "ggp_c", visibility = ["//visibility:public"], diff --git a/core/vulkan/cc/include/ggp_c/vulkan_types.h b/core/vulkan/cc/include/ggp_c/vulkan_types.h index 85159c02b..714b515b9 100644 --- a/core/vulkan/cc/include/ggp_c/vulkan_types.h +++ b/core/vulkan/cc/include/ggp_c/vulkan_types.h @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef DUMMY_VULKAN_TYPES_H__ -#define DUMMY_VULKAN_TYPES_H__ +#ifndef GGP_PLACEHOLDER_VULKAN_TYPES_H__ +#define GGP_PLACEHOLDER_VULKAN_TYPES_H__ #include typedef uint32_t GgpStreamDescriptor; typedef uint64_t GgpFrameToken; -#endif // DUMMY_VULKAN_TYPES_H__ \ No newline at end of file +#endif // GGP_PLACEHOLDER_VULKAN_TYPES_H__ diff --git a/core/vulkan/tools/BUILD.bazel b/core/vulkan/tools/BUILD.bazel index f137c8fa6..816217a42 100644 --- a/core/vulkan/tools/BUILD.bazel +++ b/core/vulkan/tools/BUILD.bazel @@ -45,7 +45,7 @@ cc_library( }), visibility = ["//visibility:public"], deps = [ - "//core/vulkan/cc/include/ggp_c:vulkan_ggp_dummy", + "//core/vulkan/cc/include/ggp_c:vulkan_ggp_placeholder", "@stb", "@vulkan-headers//:vulkan", ], diff --git a/core/vulkan/vk_api_timing_layer/cc/BUILD.bazel b/core/vulkan/vk_api_timing_layer/cc/BUILD.bazel index 9bb25aa1f..afc033aef 100644 --- a/core/vulkan/vk_api_timing_layer/cc/BUILD.bazel +++ b/core/vulkan/vk_api_timing_layer/cc/BUILD.bazel @@ -72,7 +72,7 @@ cc_library( visibility = ["//visibility:public"], deps = [ "//core/cc", - "//core/vulkan/cc/include/ggp_c:vulkan_ggp_dummy", + "//core/vulkan/cc/include/ggp_c:vulkan_ggp_placeholder", "//core/vulkan/layer_helpers", "//core/vulkan/perfetto_producer", "@vulkan-headers//:vulkan", diff --git a/core/vulkan/vk_api_timing_layer/cc/api_timing_android.exports b/core/vulkan/vk_api_timing_layer/cc/api_timing_android.exports index 6e529d3c2..2a44f5e1b 100644 --- a/core/vulkan/vk_api_timing_layer/cc/api_timing_android.exports +++ b/core/vulkan/vk_api_timing_layer/cc/api_timing_android.exports @@ -4,4 +4,4 @@ vkEnumerateInstanceLayerProperties vkEnumerateInstanceExtensionProperties vkEnumerateDeviceLayerProperties vkEnumerateDeviceExtensionProperties -_layer_dummy_func__ \ No newline at end of file +_layer_keep_alive_func__ diff --git a/core/vulkan/vk_api_timing_layer/cc/api_timing_desktop.exports b/core/vulkan/vk_api_timing_layer/cc/api_timing_desktop.exports index 23f247524..9673a122c 100644 --- a/core/vulkan/vk_api_timing_layer/cc/api_timing_desktop.exports +++ b/core/vulkan/vk_api_timing_layer/cc/api_timing_desktop.exports @@ -1,3 +1,3 @@ CPUTimingGetDeviceProcAddr CPUTimingGetInstanceProcAddr -_layer_dummy_func__ \ No newline at end of file +_layer_keep_alive_func__ diff --git a/core/vulkan/vk_api_timing_layer/cc/layer_helpers.cpp b/core/vulkan/vk_api_timing_layer/cc/layer_helpers.cpp index 97f349dfc..be3cc1ee2 100644 --- a/core/vulkan/vk_api_timing_layer/cc/layer_helpers.cpp +++ b/core/vulkan/vk_api_timing_layer/cc/layer_helpers.cpp @@ -18,36 +18,35 @@ #include "core/cc/log.h" #include "core/cc/target.h" extern "C" { -__attribute__((constructor)) void _layer_dummy_func__(); +__attribute__((constructor)) void _layer_keep_alive_func__(); } #if (TARGET_OS == GAPID_OS_WINDOWS) || (TARGET_OS == GAPID_OS_OSX) -class dummy_struct {}; +class keep_alive_struct {}; #else #include #include #include -class dummy_struct { +class keep_alive_struct { public: - dummy_struct(); + keep_alive_struct(); }; -dummy_struct::dummy_struct() { - GAPID_ERROR("Loading dummy struct"); +keep_alive_struct::keep_alive_struct() { Dl_info info; - if (dladdr((void*)&_layer_dummy_func__, &info)) { + if (dladdr((void*)&_layer_keep_alive_func__, &info)) { dlopen(info.dli_fname, RTLD_NODELETE); } } #endif extern "C" { -// _layer_dummy_func__ is marked __attribute__((constructor)) +// _layer_keep_alive_func__ is marked __attribute__((constructor)) // this means on .so open, it will be called. Once that happens, -// we create a dummy struct, which on Android and Linux, -// Forces the layer to never be unloaded. There is some global -// state in perfetto producers that does not like being unloaded. -void _layer_dummy_func__() { - dummy_struct d; +// we create a struct, which on Android and Linux, forces the layer +// to never be unloaded. There is some global state in perfetto +// producers that does not like being unloaded. +void _layer_keep_alive_func__() { + keep_alive_struct d; (void)d; } } diff --git a/core/vulkan/vk_debug_marker_layer/cc/BUILD.bazel b/core/vulkan/vk_debug_marker_layer/cc/BUILD.bazel index 803a74cf0..f50d64ff4 100644 --- a/core/vulkan/vk_debug_marker_layer/cc/BUILD.bazel +++ b/core/vulkan/vk_debug_marker_layer/cc/BUILD.bazel @@ -72,7 +72,7 @@ cc_library( visibility = ["//visibility:public"], deps = [ "//core/cc", - "//core/vulkan/cc/include/ggp_c:vulkan_ggp_dummy", + "//core/vulkan/cc/include/ggp_c:vulkan_ggp_placeholder", "//core/vulkan/layer_helpers", "//core/vulkan/perfetto_producer", "@vulkan-headers//:vulkan", diff --git a/core/vulkan/vk_debug_marker_layer/cc/debug_marker_android.exports b/core/vulkan/vk_debug_marker_layer/cc/debug_marker_android.exports index be14bdd39..f2a4f73d4 100644 --- a/core/vulkan/vk_debug_marker_layer/cc/debug_marker_android.exports +++ b/core/vulkan/vk_debug_marker_layer/cc/debug_marker_android.exports @@ -4,4 +4,4 @@ vkEnumerateInstanceLayerProperties vkEnumerateInstanceExtensionProperties vkEnumerateDeviceLayerProperties vkEnumerateDeviceExtensionProperties -_layer_dummy_func__ +_layer_keep_alive_func__ diff --git a/core/vulkan/vk_debug_marker_layer/cc/debug_marker_desktop.exports b/core/vulkan/vk_debug_marker_layer/cc/debug_marker_desktop.exports index 0a9cca735..e60d8beec 100644 --- a/core/vulkan/vk_debug_marker_layer/cc/debug_marker_desktop.exports +++ b/core/vulkan/vk_debug_marker_layer/cc/debug_marker_desktop.exports @@ -1,3 +1,3 @@ DebugMarkerGetDeviceProcAddr DebugMarkerGetInstanceProcAddr -_layer_dummy_func__ +_layer_keep_alive_func__ diff --git a/core/vulkan/vk_debug_marker_layer/cc/layer_helpers.cpp b/core/vulkan/vk_debug_marker_layer/cc/layer_helpers.cpp index 25651942a..39b91aaa7 100644 --- a/core/vulkan/vk_debug_marker_layer/cc/layer_helpers.cpp +++ b/core/vulkan/vk_debug_marker_layer/cc/layer_helpers.cpp @@ -18,36 +18,35 @@ #include "core/cc/log.h" #include "core/cc/target.h" extern "C" { -__attribute__((constructor)) void _layer_dummy_func__(); +__attribute__((constructor)) void _layer_keep_alive_func__(); } #if (TARGET_OS == GAPID_OS_WINDOWS) || (TARGET_OS == GAPID_OS_OSX) -class dummy_struct {}; +class keep_alive_struct {}; #else #include #include #include -class dummy_struct { +class keep_alive_struct { public: - dummy_struct(); + keep_alive_struct(); }; -dummy_struct::dummy_struct() { - GAPID_ERROR("Loading dummy struct"); +keep_alive_struct::keep_alive_struct() { Dl_info info; - if (dladdr((void*)&_layer_dummy_func__, &info)) { + if (dladdr((void*)&_layer_keep_alive_func__, &info)) { dlopen(info.dli_fname, RTLD_NODELETE); } } #endif extern "C" { -// _layer_dummy_func__ is marked __attribute__((constructor)) +// _layer_keep_alive_func__ is marked __attribute__((constructor)) // this means on .so open, it will be called. Once that happens, -// we create a dummy struct, which on Android and Linux, -// Forces the layer to never be unloaded. There is some global -// state in perfetto producers that does not like being unloaded. -void _layer_dummy_func__() { - dummy_struct d; +// we create a struct, which on Android and Linux, forces the layer +// to never be unloaded. There is some global state in perfetto +// producers that does not like being unloaded. +void _layer_keep_alive_func__() { + keep_alive_struct d; (void)d; } } diff --git a/core/vulkan/vk_memory_tracker_layer/cc/BUILD.bazel b/core/vulkan/vk_memory_tracker_layer/cc/BUILD.bazel index de6522733..516b6c91d 100644 --- a/core/vulkan/vk_memory_tracker_layer/cc/BUILD.bazel +++ b/core/vulkan/vk_memory_tracker_layer/cc/BUILD.bazel @@ -71,7 +71,7 @@ cc_library( visibility = ["//visibility:public"], deps = [ "//core/cc", - "//core/vulkan/cc/include/ggp_c:vulkan_ggp_dummy", + "//core/vulkan/cc/include/ggp_c:vulkan_ggp_placeholder", "//core/vulkan/layer_helpers", "//core/vulkan/perfetto_producer", "@cityhash", diff --git a/core/vulkan/vk_memory_tracker_layer/cc/layer_helpers.cpp b/core/vulkan/vk_memory_tracker_layer/cc/layer_helpers.cpp index 97f349dfc..be3cc1ee2 100644 --- a/core/vulkan/vk_memory_tracker_layer/cc/layer_helpers.cpp +++ b/core/vulkan/vk_memory_tracker_layer/cc/layer_helpers.cpp @@ -18,36 +18,35 @@ #include "core/cc/log.h" #include "core/cc/target.h" extern "C" { -__attribute__((constructor)) void _layer_dummy_func__(); +__attribute__((constructor)) void _layer_keep_alive_func__(); } #if (TARGET_OS == GAPID_OS_WINDOWS) || (TARGET_OS == GAPID_OS_OSX) -class dummy_struct {}; +class keep_alive_struct {}; #else #include #include #include -class dummy_struct { +class keep_alive_struct { public: - dummy_struct(); + keep_alive_struct(); }; -dummy_struct::dummy_struct() { - GAPID_ERROR("Loading dummy struct"); +keep_alive_struct::keep_alive_struct() { Dl_info info; - if (dladdr((void*)&_layer_dummy_func__, &info)) { + if (dladdr((void*)&_layer_keep_alive_func__, &info)) { dlopen(info.dli_fname, RTLD_NODELETE); } } #endif extern "C" { -// _layer_dummy_func__ is marked __attribute__((constructor)) +// _layer_keep_alive_func__ is marked __attribute__((constructor)) // this means on .so open, it will be called. Once that happens, -// we create a dummy struct, which on Android and Linux, -// Forces the layer to never be unloaded. There is some global -// state in perfetto producers that does not like being unloaded. -void _layer_dummy_func__() { - dummy_struct d; +// we create a struct, which on Android and Linux, forces the layer +// to never be unloaded. There is some global state in perfetto +// producers that does not like being unloaded. +void _layer_keep_alive_func__() { + keep_alive_struct d; (void)d; } } diff --git a/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_android.exports b/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_android.exports index 04df6cf7b..42ae252e2 100644 --- a/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_android.exports +++ b/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_android.exports @@ -4,4 +4,4 @@ vkEnumerateInstanceLayerProperties vkEnumerateInstanceExtensionProperties vkEnumerateDeviceLayerProperties vkEnumerateDeviceExtensionProperties -_layer_dummy_func__ \ No newline at end of file +_layer_keep_alive_func__ diff --git a/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_desktop.exports b/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_desktop.exports index 51d77fa22..64f007cc2 100644 --- a/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_desktop.exports +++ b/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_desktop.exports @@ -1,3 +1,3 @@ MemoryTrackerGetDeviceProcAddr MemoryTrackerGetInstanceProcAddr -_layer_dummy_func__ \ No newline at end of file +_layer_keep_alive_func__ diff --git a/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_layer.tmpl b/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_layer.tmpl index d049eda65..34f0d4ae0 100644 --- a/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_layer.tmpl +++ b/core/vulkan/vk_memory_tracker_layer/cc/memory_tracker_layer.tmpl @@ -65,7 +65,7 @@ vkDestroyImage {{if (and (HasPrefix $.Name "vk") (Contains "pAllocator" (Macro "C++.CallArguments" $)) )}}true{{end}} {{end}} -{{Global "Vulkan.OverrideFunctions" "dummy\n"}} +{{Global "Vulkan.OverrideFunctions" "placeholder\n"}} {{/* We need to override all the functions that use allocation callback or relate to gpu allocation */}} {{range $c := AllCommands $}} {{if (or (Macro "DoesGpuAllocation" $c) (Macro "DoesHaveAllocatorParam" $c) )}} @@ -75,7 +75,7 @@ vkDestroyImage {{end}} {{Global "Vulkan.OverrideFunctions" ((Global "Vulkan.OverrideFunctions") | SplitEOL)}} -{{Global "Vulkan.OtherUsedFunctions" "dummy" "vkGetPhysicalDeviceMemoryProperties" "vkGetBufferMemoryRequirements" "vkGetImageMemoryRequirements"}} +{{Global "Vulkan.OtherUsedFunctions" "placeholder" "vkGetPhysicalDeviceMemoryProperties" "vkGetBufferMemoryRequirements" "vkGetImageMemoryRequirements"}} {{$ | Macro "AllocationCallbackTracking" | Reflow 4 | Write "allocation_callbacks_impl.cpp"}} @@ -106,4 +106,3 @@ extern MemoryTracker memory_tracker_instance; {{end}} {{Include "../../../../gapis/api/vulkan/templates/vulkan_layer.tmpl"}} - diff --git a/core/vulkan/vk_virtual_swapchain/cc/BUILD.bazel b/core/vulkan/vk_virtual_swapchain/cc/BUILD.bazel index c2cafe33a..81622486c 100644 --- a/core/vulkan/vk_virtual_swapchain/cc/BUILD.bazel +++ b/core/vulkan/vk_virtual_swapchain/cc/BUILD.bazel @@ -46,7 +46,7 @@ cc_library( }), visibility = ["//visibility:public"], deps = [ - "//core/vulkan/cc/include/ggp_c:vulkan_ggp_dummy", + "//core/vulkan/cc/include/ggp_c:vulkan_ggp_placeholder", "//core/vulkan/tools", "@vulkan-headers//:vulkan", ], diff --git a/gapic/src/main/com/google/gapid/MainWindow.java b/gapic/src/main/com/google/gapid/MainWindow.java index 9092bb229..2226ae3bf 100644 --- a/gapic/src/main/com/google/gapid/MainWindow.java +++ b/gapic/src/main/com/google/gapid/MainWindow.java @@ -280,7 +280,7 @@ public void showWelcomeScreen() { protected MenuManager createMenuManager() { MenuManager manager = new MenuManager(); - // Add a dummy file menu, so the UI doesn't move once the rest of the menus are created. + // Add a placeholder file menu, so the UI doesn't move once the rest of the menus are created. MenuManager file = new MenuManager("&File", MenuItems.FILE_ID); file.add(MenuItems.FileExit.create(this::close)); manager.add(file); diff --git a/gapic/src/main/com/google/gapid/views/TracerDialog.java b/gapic/src/main/com/google/gapid/views/TracerDialog.java index 12d78564b..bf61f29a2 100644 --- a/gapic/src/main/com/google/gapid/views/TracerDialog.java +++ b/gapic/src/main/com/google/gapid/views/TracerDialog.java @@ -357,7 +357,7 @@ public TraceInput(Composite parent, Models models, Widgets widgets, Runnable ref apiLabel = createLabel(mainGroup, "Type*:"); api = createApiDropDown(mainGroup); api.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - // dummy label to fill the 3rd column + // Placeholder label to fill the 3rd column createLabel(mainGroup, ""); validationStatusLoader = widgets.loading.createWidgetWithImage(mainGroup, widgets.theme.check(), widgets.theme.error()); diff --git a/gapic/src/main/com/google/gapid/widgets/LinkifiedTree.java b/gapic/src/main/com/google/gapid/widgets/LinkifiedTree.java index 2b4dbc143..691f15c49 100644 --- a/gapic/src/main/com/google/gapid/widgets/LinkifiedTree.java +++ b/gapic/src/main/com/google/gapid/widgets/LinkifiedTree.java @@ -458,7 +458,7 @@ public Path.Any getFollow(TreeItem item, Point location) { LinkableStyledString string = format(getElement(item), LinkableStyledString.create(theme), lastPrefetcher); string.endLink(); - string.append("dummy", string.defaultStyle()); + string.append("placeholder", string.defaultStyle()); updateLayout(string.getString(), false); Rectangle textBounds = layout.getBounds(); diff --git a/gapic/src/main/com/google/gapid/widgets/MeasuringViewLabelProvider.java b/gapic/src/main/com/google/gapid/widgets/MeasuringViewLabelProvider.java index 356867087..f0ad51f57 100644 --- a/gapic/src/main/com/google/gapid/widgets/MeasuringViewLabelProvider.java +++ b/gapic/src/main/com/google/gapid/widgets/MeasuringViewLabelProvider.java @@ -97,7 +97,7 @@ public Object getFollow(Point point) { LinkableStyledString string = format(cell.getItem(), cell.getElement(), LinkableStyledString.create(theme)); string.endLink(); - string.append("dummy", string.defaultStyle()); + string.append("placeholder", string.defaultStyle()); updateLayout(cell, string.getString()); Rectangle bounds = cell.getTextBounds(); diff --git a/gapic/src/platform/windows/com/google/gapid/glcanvas/GlCanvas.java b/gapic/src/platform/windows/com/google/gapid/glcanvas/GlCanvas.java index 8230d9f80..ca58858c8 100644 --- a/gapic/src/platform/windows/com/google/gapid/glcanvas/GlCanvas.java +++ b/gapic/src/platform/windows/com/google/gapid/glcanvas/GlCanvas.java @@ -51,19 +51,19 @@ public abstract class GlCanvas extends Canvas { public GlCanvas(Composite parent, int style) { super(parent, checkStyle(parent, style)); - Canvas dummy = new Canvas(parent, style); + Canvas initCanvas = new Canvas(parent, style); parent.getDisplay().setData(USE_OWNDC_KEY, Boolean.FALSE); - Context dummyContext = new Context(dummy.handle).createSimplePixelFormat(); - if (dummyContext == null) { + Context initContext = new Context(initCanvas.handle).createSimplePixelFormat(); + if (initContext == null) { context = 0; initialized = false; return; } Context actualContext; - if (dummyContext.createPixelFormat()) { - actualContext = new Context(handle).setPixelFormat(dummyContext.pixelFormat); + if (initContext.createPixelFormat()) { + actualContext = new Context(handle).setPixelFormat(initContext.pixelFormat); } else { actualContext = new Context(handle).createSimplePixelFormat(); } @@ -76,8 +76,8 @@ public GlCanvas(Composite parent, int style) { initialized = true; } - dummyContext.release(); - dummy.dispose(); + initContext.release(); + initCanvas.dispose(); if (initialized) { addListener(SWT.Dispose, e -> { diff --git a/gapii/cc/chunk_writer.cpp b/gapii/cc/chunk_writer.cpp index 5fe75a9cb..218b3c668 100644 --- a/gapii/cc/chunk_writer.cpp +++ b/gapii/cc/chunk_writer.cpp @@ -28,7 +28,7 @@ constexpr size_t kBufferSize = 32 * 1024; class ChunkWriterImpl : public gapii::ChunkWriter { public: ChunkWriterImpl(const std::shared_ptr& writer, - bool paranoid = false); + bool no_buffer = false); ~ChunkWriterImpl(); diff --git a/gapii/cc/connection_header.h b/gapii/cc/connection_header.h index de611323a..51ddfc98b 100644 --- a/gapii/cc/connection_header.h +++ b/gapii/cc/connection_header.h @@ -57,7 +57,7 @@ class ConnectionHeader { // on success or false on error. bool read(core::StreamReader* reader); - void read_dummy() { + void read_fake() { mMagic[0] = 's'; mMagic[1] = 'p'; mMagic[2] = 'y'; diff --git a/gapii/cc/spy.cpp b/gapii/cc/spy.cpp index eb022ce2f..bdb252c6a 100644 --- a/gapii/cc/spy.cpp +++ b/gapii/cc/spy.cpp @@ -123,7 +123,7 @@ Spy::Spy() GAPID_FATAL("Failed to read connection header"); } } else { - header.read_dummy(); + header.read_fake(); } GAPID_INFO("Connection header read"); diff --git a/gapil/compiler/compiler_test.go b/gapil/compiler/compiler_test.go index e23e0319c..4d9fc69ed 100644 --- a/gapil/compiler/compiler_test.go +++ b/gapil/compiler/compiler_test.go @@ -1631,7 +1631,7 @@ cmd void ClearMapOnFree() { // causing a "Instruction does not dominate all uses!" error. name: "RefCount.ReleaseInNestedScopes", src: ` -sub string CrazyNestedLogic(u32 i) { +sub string DeepNestedLogic(u32 i) { if i == 0 { s := "cat" switch(s) { @@ -1653,7 +1653,7 @@ sub string CrazyNestedLogic(u32 i) { return "the-end" } cmd void ReleaseInNestedScopes(u32 i) { - x := CrazyNestedLogic(i) + x := DeepNestedLogic(i) }`, cmds: []cmd{{ N: "ReleaseInNestedScopes", diff --git a/gapil/compiler/storagetypes.go b/gapil/compiler/storagetypes.go index ed3e87d4e..13d56df6d 100644 --- a/gapil/compiler/storagetypes.go +++ b/gapil/compiler/storagetypes.go @@ -64,14 +64,14 @@ func (c *C) StorageTypes(layout *device.MemoryLayout, prefix string) *StorageTyp for _, t := range toBuild { offset := uint64(0) fields := make([]codegen.Field, 0, len(t.Fields)) - dummyFields := 0 + paddingFields := 0 for _, f := range t.Fields { size := s.StrideOf(f.Type) alignment := s.AlignOf(f.Type) newOffset := (offset + (alignment - 1)) & ^(alignment - 1) if newOffset != offset { - nm := fmt.Sprintf("__dummy%d", dummyFields) - dummyFields++ + nm := fmt.Sprintf("__padding%d", paddingFields) + paddingFields++ fields = append(fields, codegen.Field{Name: nm, Type: c.T.Array(s.Get(semantic.Uint8Type), int(newOffset-offset))}) } offset = newOffset + size @@ -79,7 +79,7 @@ func (c *C) StorageTypes(layout *device.MemoryLayout, prefix string) *StorageTyp } totalSize := s.StrideOf(t) if totalSize != offset { - nm := fmt.Sprintf("__dummy%d", dummyFields) + nm := fmt.Sprintf("__padding%d", paddingFields) fields = append(fields, codegen.Field{Name: nm, Type: c.T.Array(s.Get(semantic.Uint8Type), int(totalSize-offset))}) } diff --git a/gapil/resolver/resolve_test.go b/gapil/resolver/resolve_test.go index cc06ff648..4fe4104f5 100644 --- a/gapil/resolver/resolve_test.go +++ b/gapil/resolver/resolve_test.go @@ -167,12 +167,12 @@ func TestMessages(t *testing.T) { type u32 GLuint // 32 bit, unsigned binary integer. type u64 GLuint64 // 64 bit, unsigned binary integer. - class ERR_DUMMY { + class ERR_FAKE { u32 big u64 bigger } - class ERR_DUMMY_PSEUDO { + class ERR_FAKE_PSEUDO { GLuint big GLuint64 bigger } @@ -181,46 +181,46 @@ func TestMessages(t *testing.T) { { name: "ref!class -> message implicit cast", source: boilerplate + ` - cmd void dummy() { - foo(new!ERR_DUMMY(big: 0, bigger: 1)) + cmd void fake() { + foo(new!ERR_FAKE(big: 0, bigger: 1)) }`, }, { name: "Actual -> pseudonym resolution as an argument in constructor", source: boilerplate + ` - cmd void dummy() { - foo(new!ERR_DUMMY_PSEUDO(big: 0, bigger: 1)) + cmd void fake() { + foo(new!ERR_FAKE_PSEUDO(big: 0, bigger: 1)) }`, }, { name: "Pseudonym -> actual resolution as an argument in constructor", source: boilerplate + ` - cmd void dummy() { + cmd void fake() { a := as!GLuint(-10) b := as!GLuint64(-1) - foo(new!ERR_DUMMY_PSEUDO(big: a, bigger: b)) + foo(new!ERR_FAKE_PSEUDO(big: a, bigger: b)) }`, }, { name: "Mixed pseudonym and actual resolution as an argument in constructor", source: boilerplate + ` - cmd void dummy() { + cmd void fake() { b := as!GLuint64(-1) - foo(new!ERR_DUMMY_PSEUDO(big: 10, bigger: b)) + foo(new!ERR_FAKE_PSEUDO(big: 10, bigger: b)) }`, }, { name: "Pseudonym -> actual resolution as an argument in constructor - wrong pseudonym", source: boilerplate + ` type s64 GLint64 // 64 bit, signed, two's complement binary integer. - cmd void dummy() { + cmd void fake() { a := as!GLuint(-10) b := as!GLint64(-1) - foo(new!ERR_DUMMY_PSEUDO(big: a, bigger: b)) + foo(new!ERR_FAKE_PSEUDO(big: a, bigger: b)) }`, errors: err("cannot assign GLint64 to field 'bigger' of type GLuint64"), }, { name: "Accept only create statements as message - pass local variable", source: boilerplate + ` - cmd void dummy() { - msg := new!ERR_DUMMY(big: 1, bigger: 10) + cmd void fake() { + msg := new!ERR_FAKE(big: 1, bigger: 10) foo(msg) }`, errors: err("Message arguments require a new class instance or forwarded message parameter, got: *semantic.Local"), diff --git a/gapil/runtime/cc/replay/replay.cpp b/gapil/runtime/cc/replay/replay.cpp index 06f7bcab9..d409e9889 100644 --- a/gapil/runtime/cc/replay/replay.cpp +++ b/gapil/runtime/cc/replay/replay.cpp @@ -40,8 +40,8 @@ using namespace gapil::runtime::replay; // Ensure that replay.cpp is not stripped from the final executable. // Typically the symbols defined by this compilation unit are only dynamically // referenced by the JIT'd code, so the linker may decide to strip it from the -// final executable. This is a dummy symbol referenced by builder.cpp (which -// is directly used by the GAPIS executable). +// final executable. This is a placeholder symbol referenced by builder.cpp +// (which is directly used by the GAPIS executable). int GAPIL_REPLAY_FORCE_LINK = 0; namespace { diff --git a/gapil/semantic/node.go b/gapil/semantic/node.go index 0599a972f..8ca342f17 100644 --- a/gapil/semantic/node.go +++ b/gapil/semantic/node.go @@ -18,7 +18,7 @@ import "github.com/google/gapid/gapil/ast" // Node represents any semantic-tree node type. type Node interface { - isNode() // A dummy function that's implemented by all semantic node types. + isNode() // A placeholder function that's implemented by all semantic node types. } // NamedNode represents any semantic-tree node that carries a name. diff --git a/gapil/semantic/statement.go b/gapil/semantic/statement.go index 0a1d4cf47..37b653597 100644 --- a/gapil/semantic/statement.go +++ b/gapil/semantic/statement.go @@ -20,7 +20,7 @@ import "github.com/google/gapid/core/data/slice" // Statement is the interface implemented by all statement types. type Statement interface { Node - isStatement() // A dummy function that's implemented by all semantic statements. + isStatement() // A placeholder function that's implemented by all semantic statements. } // Statements is a list of statements. diff --git a/gapil/semantic/type.go b/gapil/semantic/type.go index 006353843..74b4f8d9f 100644 --- a/gapil/semantic/type.go +++ b/gapil/semantic/type.go @@ -23,7 +23,7 @@ import ( // Type is the interface to any object that can act as a type to the api // language. type Type interface { - isType() // A dummy function that's implemented by all semantic types. + isType() // A placeholder function that's implemented by all semantic types. Owner } @@ -31,7 +31,7 @@ type Type interface { // language, it must be able to correctly report the type of value it would // return if executed. type Expression interface { - isExpression() // A dummy function that's implemented by all semantic types. + isExpression() // A placeholder function that's implemented by all semantic types. Node ExpressionType() Type // returns the expression value type. } diff --git a/gapir/cc/memory_allocator.cpp b/gapir/cc/memory_allocator.cpp index adcb85d25..599fc8d42 100644 --- a/gapir/cc/memory_allocator.cpp +++ b/gapir/cc/memory_allocator.cpp @@ -29,7 +29,7 @@ namespace gapir { std::map::iterator> - MemoryAllocator::Handle::_dummyMap; + MemoryAllocator::Handle::_emptyMap; std::unique_ptr MemoryAllocator::create(size_t heapSize) { return std::unique_ptr(new MemoryAllocator(heapSize)); diff --git a/gapir/cc/memory_allocator.h b/gapir/cc/memory_allocator.h index 08825f743..12bb5b3fe 100644 --- a/gapir/cc/memory_allocator.h +++ b/gapir/cc/memory_allocator.h @@ -68,15 +68,15 @@ class MemoryAllocator { // so you need to take care of that yourself for now! class Handle { public: - Handle() : _backing(_dummyMap.end()) {} + Handle() : _backing(_emptyMap.end()) {} bool operator!() const { return *this == nullptr; } bool operator==(unsigned char* rhs) const { - return (_backing == _dummyMap.end() ? nullptr + return (_backing == _emptyMap.end() ? nullptr : _backing->second->first) == rhs; } bool operator!=(unsigned char* rhs) const { - return (_backing == _dummyMap.end() ? nullptr + return (_backing == _emptyMap.end() ? nullptr : _backing->second->first) != rhs; } unsigned char& operator*() const { return *_backing->second->first; } @@ -96,7 +96,7 @@ class MemoryAllocator { static std::map::iterator> - _dummyMap; + _emptyMap; friend class MemoryAllocator; }; diff --git a/gapir/cc/resource_cache.cpp b/gapir/cc/resource_cache.cpp index 4d02c9abd..4d4d3029e 100644 --- a/gapir/cc/resource_cache.cpp +++ b/gapir/cc/resource_cache.cpp @@ -55,8 +55,8 @@ std::vector ResourceCache::anticipateNextResources( auto resMapIter = mResourceIterators.find(resource.getID()); if (resMapIter == mResourceIterators.end()) { - return expectedResources; // We don't know about this resource so we're - // blind. Return the empty vector. + // We don't know about this resource. Return the empty vector. + return expectedResources; } auto resIter = resMapIter->second; diff --git a/gapis/api/cmd_id_group.go b/gapis/api/cmd_id_group.go index 14c6602b0..0079d1d59 100644 --- a/gapis/api/cmd_id_group.go +++ b/gapis/api/cmd_id_group.go @@ -109,7 +109,7 @@ type Span interface { split(i uint64) (Span, Span) } -// SpanItem is a dummy interface exclusively implemented by CmdIDGroup, +// SpanItem is a placeholder interface exclusively implemented by CmdIDGroup, // SubCmdIdx and SubCmdRoot type SpanItem interface { isGroupOrIDOrRoot() diff --git a/gapis/api/templates/api.go.tmpl b/gapis/api/templates/api.go.tmpl index b9148ac79..2a22df7c8 100644 --- a/gapis/api/templates/api.go.tmpl +++ b/gapis/api/templates/api.go.tmpl @@ -234,8 +234,8 @@ import ( {{template "Go.CommentHeader" "API"}} {{Template "DeclareAPI" $}} ¶ - // uncompareable is a dummy function used in types that must not be used for - // go equality or as map keys. + // uncompareable is a placeholder function used in types that must not be used + // for go equality or as map keys. type uncompareable func() ¶ // constantArena is an arena used for globally persisted immutable values. @@ -1512,16 +1512,16 @@ import ( {{$to := Macro "Go.Type" $.To}} type {{$name}} {{$to}} {{if IsSize $ty}} - // Dummy function to make {{$name}} implement SizeTy interface + // Placeholder function to make {{$name}} implement SizeTy interface func ({{$name}}) IsMemorySize() {} {{else if IsChar $ty}} - // Dummy function to make {{$name}} implement CharTy interface + // Placeholder function to make {{$name}} implement CharTy interface func ({{$name}}) IsChar() {} {{else if IsInt $ty}} - // Dummy function to make {{$name}} implement IntTy interface + // Placeholder function to make {{$name}} implement IntTy interface func ({{$name}}) IsInt() {} {{else if IsUint $ty}} - // Dummy function to make {{$name}} implement UintTy interface + // Placeholder function to make {{$name}} implement UintTy interface func ({{$name}}) IsUint() {} {{end}} func Decode{{$name}}(ϟd *ϟmem.Decoder, ϟa arena.Arena) {{$name}} { diff --git a/gapis/api/templates/go_ctypes.h.tmpl b/gapis/api/templates/go_ctypes.h.tmpl index 87d59b0f3..bd9ff8478 100644 --- a/gapis/api/templates/go_ctypes.h.tmpl +++ b/gapis/api/templates/go_ctypes.h.tmpl @@ -107,7 +107,7 @@ {{Template "C.Type" $f}} {{CFieldName $f.Name}}; {{end}} {{if not (len $.Fields)}} - uint8_t dummy; // At least one field so Cgo sees the type. + uint8_t placeholder; // At least one field so Cgo sees the type. {{end}} } {{$name}};¶ {{end}} diff --git a/gapis/api/vulkan/drawCall.go b/gapis/api/vulkan/drawCall.go index 2dd1ef958..e2aaa4976 100644 --- a/gapis/api/vulkan/drawCall.go +++ b/gapis/api/vulkan/drawCall.go @@ -16,8 +16,8 @@ package vulkan import "github.com/google/gapid/gapis/api" -// A dummy interface for draw calls to conform the DrawCall annotation in API -// files. In Vulkan, all the drawing actually happens in the execution of +// A placeholder interface for draw calls to conform the DrawCall annotation in +// API files. In Vulkan, all the drawing actually happens in the execution of // vkQueueSubmit and all the drawing information should be found in the state // when vkQueueSubmit is called. type drawCall interface { diff --git a/gapis/memory/types.go b/gapis/memory/types.go index 5d8ff87dc..d4945d4bc 100644 --- a/gapis/memory/types.go +++ b/gapis/memory/types.go @@ -41,7 +41,7 @@ type IntTy interface { IsInt() } -// IsInt is a dummy function to make Int implement IntTy interface +// IsInt is a placeholder function to make Int implement IntTy interface func (Int) IsInt() {} // Uint is an unsigned integer type. @@ -52,7 +52,7 @@ type UintTy interface { IsUint() } -// IsUint is a dummy function to make Uint implement UintTy interface +// IsUint is a placeholder function to make Uint implement UintTy interface func (Uint) IsUint() {} // Char is the possibly signed but maybe unsigned C/C++ char. @@ -63,7 +63,7 @@ type CharTy interface { IsChar() } -// IsChar is a dummy function to make Char implement CharTy interface +// IsChar is a placeholder function to make Char implement CharTy interface func (Char) IsChar() {} // CharToBytes changes the Char values to their byte[] representation. @@ -83,7 +83,7 @@ type SizeTy interface { IsMemorySize() } -// IsMemorySize is a dummy function to make Size implement SizeTy interface +// IsMemorySize is a placeholder function to make Size implement SizeTy interface func (Size) IsMemorySize() {} // IsSize returns true if v is a Size or alias to a Size. diff --git a/gapis/stringtable/README.md b/gapis/stringtable/README.md index f387b8725..1c00416de 100644 --- a/gapis/stringtable/README.md +++ b/gapis/stringtable/README.md @@ -2,9 +2,8 @@ String tables provide a solution for displaying localized messages in the client(s) with the ability to include graphics API specific details. Given that -the clients are designed to be as dumb-terminal like as possible, and have no -graphics API knowledge, these string tables are provided by the server to the -clients via RPCs. +the clients are designed to be API-agnostic, these string tables are provided by +the server to the clients via RPCs to form detailed messages. String tables also provide support for rich-text formatting. @@ -195,4 +194,4 @@ Blah blah blah # MESSAGE_WITH_EMPHASIS I *really*, **really**, _really_ like emphasis! -``` \ No newline at end of file +``` From 6fe672332216182a895cf7d1bf8f7c8035dee967 Mon Sep 17 00:00:00 2001 From: Pascal Muetschard Date: Tue, 28 Jul 2020 15:09:06 -0700 Subject: [PATCH 5/5] [IL] Remove usage of 'sanity'. --- gapil/analysis/value.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gapil/analysis/value.go b/gapil/analysis/value.go index ad16d5c98..69618a30a 100644 --- a/gapil/analysis/value.go +++ b/gapil/analysis/value.go @@ -204,7 +204,7 @@ func UnionOf(vals ...Value) Value { // unknownOf returns the unbounded value for the given type. func (s *scope) unknownOf(ty semantic.Type) Value { - if ty == nil { // sanity check. + if ty == nil { panic("unknownOf passed nil type") } @@ -289,7 +289,7 @@ func (s *scope) unknownOf(ty semantic.Type) Value { // defaultOf returns the default value for the given type. func (s *scope) defaultOf(ty semantic.Type) (out Value) { - if ty == nil { // sanity check. + if ty == nil { panic("valueOf passed nil type") } @@ -372,7 +372,7 @@ type fieldHolder interface { // valueOf evaluates the expression n and returns a value and a function that // can change the value within the scope s. func (s *scope) valueOf(n semantic.Expression) (out Value, setter func(Value)) { - if n == nil { // sanity check. + if n == nil { panic("valueOf passed nil expression") }