Reviewed By: ngorogiannis Differential Revision: D10105786 fbshipit-source-id: 0a8dc9b73master
parent
aca0b8e130
commit
b54307f5d0
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
class HoistIndirect {
|
||||
|
||||
class Test {
|
||||
|
||||
int a = 0;
|
||||
|
||||
void set_test(Test test) {
|
||||
test.a = 5;
|
||||
}
|
||||
|
||||
int get_test(Test test) {
|
||||
return test.a;
|
||||
}
|
||||
|
||||
int indirect_modification_dont_hoist_FP(int size) {
|
||||
int d = 0;
|
||||
Test t = new Test();
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
set_test(t);
|
||||
d = get_test(t); // don't hoist since t changes
|
||||
}
|
||||
return d;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue