| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
| |
It's better to not add `self` positional argument if it's not needed, instead
of adding it and removing it laster on. `subList` invoaction results in more
allocations and CPU overhead when using positional args.
Closes #5812.
PiperOrigin-RevId: 208687360
|
|
|
|
|
|
|
|
|
|
|
| |
expressions.
This is probably only a theoretical problem, since a blocking struct field is probably a very bad idea.
Closes #5132.
Change-Id: Ie84a78ab4d9ce215f2806ac49bf8911de6959930
PiperOrigin-RevId: 207902766
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to JMH and JIT assembly generated for iterators and index
accesses, iterator methods like `hasNext` and `next` are not optimized
away and result in 3-4X slower execution.
Not using an iterator reduces Buck parse time for FB's internal Android
apps by 7%+.
Closes #5735.
PiperOrigin-RevId: 207073078
|
|
|
|
|
|
|
|
|
| |
Since this happens only every single Skylark method invocation CPU and memory
usage quickly adds up and shows up on profiler samples a lot.
Closes #5656.
PiperOrigin-RevId: 206935520
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This serves 2 purposes:
- better encapsulation and domain model.
- opens the door to optimizations like using `MethodHandle` instead of `Method`
and caching.
- performs one of the optimizations mentioned above - perform `setAccessible`
only once instead of on every method invocation. JMH suggests that this saves
~5% of CPU time.
Next steps are:
- evaluate peformance improvements for some of the optimizations listed above
- make PRs to apply optimizations that seem beneficial.
Closes #5704.
PiperOrigin-RevId: 206805670
|
|
|
|
|
|
|
|
|
|
| |
When `isLegacyNamed` is `true`, `named` is considered to be `true` as well,
so instead of going through an extra indirection and computation, just use
`named` field to store combined result.
Closes #5701.
PiperOrigin-RevId: 206800781
|
|
|
|
|
|
|
|
|
|
|
| |
This change is focused on 2 things:
- avoid creating builders in case they don't end up being used
- create builders using the maximum expected size to avoid intermediate
allocations to accommodate more elements
Closes #5694.
PiperOrigin-RevId: 206636046
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Java uses dynamically generated proxy classes to access annotation properties
and their methods are ~7X slower than plain getters. According to async-profiler
50%+ of `convertArgumentList` method time is spent in dynamic proxy methods, so
optimizing their performance makes sense.
This also makes the model less anemic, since POJOs can actually provide business
methods.
Closes #5666.
PiperOrigin-RevId: 206608812
|
|
|
|
|
|
|
|
|
| |
Param annotations only once.
This change has been manually verified to greatly reduce analysis time (~50%) on very large builds, as it mitigates a previous regression brought on by the migration of @SkylarkSignature to @SkylarkCallable.
RELNOTES: None.
PiperOrigin-RevId: 206063684
|
|
|
|
|
|
|
|
|
| |
`keyWordArgs` is already `ImmutableMap<String, Object>` and `copyOf` contains enough
overhead to show up on parse profiles.
Closes #5651.
PiperOrigin-RevId: 206051798
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 204505003
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 201748802
|
|
|
|
|
|
|
|
|
|
| |
useEnvironment
Unfortunately this doesn't work for all callers, namely NativeInfo objects, as they may have structField callables invoked from contexts that have no environment available.
RELNOTES[INC]: Skylark structs (using struct()) may no longer have to_json and to_proto overridden.
PiperOrigin-RevId: 201376969
|
|
|
|
|
|
|
|
|
|
|
|
| |
be treated as a callable skylark object.
This will allow Skylark Provider objects to be better specified.
For example, "JavaInfo" can have a fully-documented, fully-specified @SkylarkCallable method with selfCall=true to represent the method JavaInfo(), instead of being a subclass of BaseFunction and requiring a @SkylarkSignature annotation.
There are no usages of this pattern introduced in this CL, and also no updates to docgen to support the new pattern. These will be introduced in another CL.
RELNOTES: None.
PiperOrigin-RevId: 194088227
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 193370435
|
|
|
|
|
|
|
| |
StringModule is a special case in a number of places because it represents effectively methods which should be annotated on String.class. However, String may not be subclassed in Java. StringModule thus serves as a proxy module for String.
RELNOTES: None.
PiperOrigin-RevId: 192508607
|
|
|
|
|
|
|
|
|
|
| |
@SkylarkCallable.
@SkylarkSignature.parameters() treat named()=true for parameters regardless of whether named() was actually set to true, and thus for ease of migration we mark migrated parameters as legacyNamed() = true, which is currently semantically equivalent to named() = true.
We make a distinction so that it's easier to bulk fix these later.
RELNOTES: None.
PiperOrigin-RevId: 192477405
|
|
|
|
|
|
|
|
|
| |
parity with @SkylarkSignature.
This is necessary for several builtin functions that still use @SkylarkSignature, such as string format. These will be migrated in a future CL.
RELNOTES: None.
PiperOrigin-RevId: 192200282
|
|
|
|
|
|
|
| |
This involves enforcing additional compiletime restrictions on Param ordering and semantics.
RELNOTES: None.
PiperOrigin-RevId: 191927206
|
|
|
|
|
|
|
|
|
| |
@SkylarkSignature
Most notably, this involves introduction of a new function abstraction, BuiltinMethod, which can wrap a {objc, SkylarkCallable} pair into a BaseFunction for later calling. (This is required due to the current layer of indirection on the end "native" module)
RELNOTES: None.
PiperOrigin-RevId: 191642467
|
|
|
|
|
|
|
|
|
| |
* Skylark serialization was previously dropping location in error, which this fixes.
* Deletes a lot of codecs with fidelity issues (DynamicCodec has full fidelity).
* Deletes EnumRuntimeCodec which can now be replaced with the superior EnumCodec.
* This should eventually allow us to delete Serializable from all Blaze. The remaining blocker is NoSuchPackageExceptionCodec.
PiperOrigin-RevId: 191603929
|
|
|
|
|
|
|
|
|
|
|
| |
The number of *unique* Class instances that will be used as keys in these caches over the lifetime of a Bazel server is small-ish, and bounded by the size of the set of unique Classes used as the Java runtime representation of Skylark objects.
The bookkeeping done by LocalCache when the cache's size is bounded is therefore pure CPU overhead.
While we're here, just use the default capacity (16); a smaller initial capacity seems silly considering these caches are live for the duration of the Bazel server.
RELNOTES: None
PiperOrigin-RevId: 190238099
|
|
|
|
|
|
|
|
|
|
|
| |
specifically get a semantics object
This is slightly redundant with useEnvironment, yes (as one can easily obtain the semantics object with Environment), but we intend on restricting useEnvironment so that structField=true methods cannot specify useEnvironment, but *can* specify useSkylarkSemantics.
In general, we can also ween off non structField methods to use useSkylarkSemantics instead of useEnvironment in cases where this is feasible.
RELNOTES: None.
PiperOrigin-RevId: 190082547
|
|
|
|
|
|
|
|
|
| |
@SkylarkSignature more closely.
Also clarify the method representation in these error messages is for the attempted method *call*, not the actual method signature.
RELNOTES: None.
PiperOrigin-RevId: 189935148
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 188201686
|
|
|
|
|
|
|
|
| |
ObjectCodec into a MEMOIZE_AFTER MemoizingCodec. I think that this is safe, because all the codecs that are being wrapped this way weren't memoizing anything internally that I could see.
In order to @AutoCodec the WithValue type, which is generic and can have null elements in lists, add functionality to @AutoCodec to deal with generic type static instantiators, matching generic type arguments (although I'm not sure why that wasn't already working), and null elements in lists.
PiperOrigin-RevId: 187740461
|
|
|
|
|
|
|
| |
duplicate named arguments.
RELNOTES: None
PiperOrigin-RevId: 187236124
|
|
|
|
|
|
|
| |
compile time.
RELNOTES: None.
PiperOrigin-RevId: 185432867
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 184498836
|
|
|
|
|
|
|
|
|
|
|
| |
This covers all builtins in classes that use SkylarkSignatureProcessor#configureSkylarkFunctions. Generally this means things you define with @SkylarkSignature.
It is now an error to call configureSkylarkFunctions multiple times for the same class. It should only be called in static initializers.
Runtime's static knowledge of builtins has been factored into Runtime.BuiltinRegistry.
RELNOTES: None
PiperOrigin-RevId: 178295926
|
|
|
|
|
|
|
|
| |
Blaze had its own class to avoid GC from varargs array creation for the precondition happy path. Guava now (mostly) implements these, making it unnecessary to maintain our own.
This change was almost entirely automated by search-and-replace. A few BUILD files needed fixing up since I removed an export of preconditions from lib:util, which was all done by add_deps. There was one incorrect usage of Preconditions that was caught by error prone (which checks Guava's version of Preconditions) that I had to change manually.
PiperOrigin-RevId: 175033526
|
|
|
|
|
|
|
|
| |
Micro-optimize a few hot code paths which have a habit of iterating over short O(1)-access
lists.
RELNOTES: None
PiperOrigin-RevId: 171347524
|
|
|
|
|
|
|
| |
getMethods ordering is not guaranteed and actually change
depending on minor difference in the class path.
PiperOrigin-RevId: 171093246
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Relanding
https://github.com/bazelbuild/bazel/commit/17214ac78ffaec369d5d5bafe62a39730473cfaa
with fixes to 'repository_ctx.download()' and
'repository_ctx.download_and_extract()'.
I reviewed other usages of @ParamType annotation - I do not think there
are more issues.
Fixes #3714.
Change-Id: I17087ef3fc2d28ab99224740a2164675a49847d3
PiperOrigin-RevId: 169896223
|
|
|
|
|
|
| |
that were public because of skylark compilation.
PiperOrigin-RevId: 169739373
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*** Reason for rollback ***
Rolled back commit enforces stricter parameter checks. Will fix and roll forward
This creates several failures on the nightly build of Bazel:
ERROR: /home/ci/workspace/Global/rules_closure-node=linux-x86_64/closure/protobuf/test/BUILD:23:1: no such package '@com_google_protobuf_protoc//': Cannot convert parameter 'url' to type string or sequence of strings, in method download_and_extract(List, string, string, string, string) of 'repository_ctx' and referenced by '//closure/protobuf/test:example_proto_gen'.
ERROR: Analysis of target '//closure/protobuf/test:example_lib' failed; build aborted: no such package '@com_google_protobuf_protoc//': Cannot convert parameter 'url' to type string or sequence of strings, in method download_and_extract(List, string, string, string, string) of 'repository_ctx'.
*** Original change description ***
Check parameter types for methods when multiple types are allowed.
Fixes #3714
RELNOTES: None.
PiperOrigin-RevId: 169669802
|
|
|
|
|
|
| |
Fixes #3714
RELNOTES: None.
PiperOrigin-RevId: 169382686
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 166370036
|
|
|
|
|
|
|
| |
This is a simple refactoring, no change in behavior.
RELNOTES: None.
PiperOrigin-RevId: 165572028
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 165419360
|
|
|
|
|
|
|
|
| |
This allows more complex expressions to be called, not just identifiers.
For example, "x[0]()" is not a syntax error anymore.
RELNOTES: None
PiperOrigin-RevId: 165157981
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 164981071
|
|
|
|
|
|
|
|
|
| |
- changed field names and a couple accessors to consistently use full words ("statement" instead of "stmt")
- applied several local analyzers (from IntelliJ) to remove redundant modifiers, unnecessary explicit types (yay Java 8), etc.
RELNOTES: None
PiperOrigin-RevId: 161551096
|
|
|
|
|
|
|
|
|
|
|
| |
If --incompatible_descriptive_string_representations is passed, labels are converted
to strings using `repr` differently: `Label("//package:name")` instead of
`"//package:name"`
This CL doesn't affect representations of other object types but provides the
necessary infrastructure for it.
PiperOrigin-RevId: 160955284
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 160817326
|
|
|
|
|
|
|
| |
It's now easier to customize Printer if in different situations objects should
be printed differently. Also its API is cleaner now. Names of methods of SkylarkValue objects now reflect names of Skylark functions: SkylarkValue#repr and SkylarkPrintableValue#str.
PiperOrigin-RevId: 160635154
|
|
|
|
|
|
|
| |
This can be used to canonically compare ASTs for equality, e.g. in tests.
RELNOTES: None
PiperOrigin-RevId: 160283160
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, ClassObjects' SkylarkCallable struct fields worked
as expected (with values of the struct taking precedence), but
calling methods annotated with SkylarkCallable did not work at
all; methods were treated as if they were not present in the struct.
This adds some tests for the various ways of looking up fields
and methods, and rearranges the logic in FuncallExpression to
allow for callable methods on SkylarkClassObject's descendants.
--
PiperOrigin-RevId: 150876181
MOS_MIGRATED_REVID=150876181
|
|
|
|
|
|
|
|
| |
This was a bug, f(*4) was silently handled as f().
--
PiperOrigin-RevId: 148017021
MOS_MIGRATED_REVID=148017021
|
|
|
|
|
|
|
|
|
| |
The code has been untouched and unused for over a year (it's very likely
broken) and we have other priorities for now.
--
PiperOrigin-RevId: 145087310
MOS_MIGRATED_REVID=145087310
|