paulk-asert opened a new pull request, #2674: URL: https://github.com/apache/groovy/pull/2674
Property writes were the last un-cached dispatch surface: even in indy mode they compiled to static ScriptBytecodeAdapter.setProperty calls, paying getMetaClass() plus a full MetaClassImpl.setProperty resolution walk on every write, in both indy and classic modes. Behind the compile-time flag groovy.indy.setproperty (default: off), AsmClassGenerator now diverts plain (non-safe, non-spread) property writes to a new CallSiteWriter.makeSetPropertySite hook. The default implementation is the classic adapter call, so classic mode and flag-off builds are unchanged; IndyCallSiteWriter overrides it to emit invokedynamic setProperty:(ReceiverType, ValueType)V with the receiver first, preserving the runtime's arguments[0]-is-receiver invariant. The new SetPropertySelector (replacing the 'not supported' GroovyBugError for CallType.SET) fast-paths only shapes whose resolution is provably sender- and metaclass-independent: a public setter whose backing field is private or absent (GROOVY-8283 field-precedence is sender-dependent), or a public non-final field, each accepting the runtime value type directly. Everything else — Maps (GROOVY-8065/11367), Class receivers, categories, overridden/mixed-in/expando setProperty (detected by both a reflection probe and a metaclass pickMethod probe; ExpandoMetaClass is excluded wholesale, mirroring the GET selector), value coercion, listeners, propertyMissing — binds the sender-aware ScriptBytecodeAdapter.setProperty as the call-site handle, making non-fast-path behavior identical to the classic path by construction. Guards, PIC, and hit-count promotion come free from the existing call-site machinery; the value participates in the argument-class guards so type changes at a site re-se lect correctly. Measured: ~42x on a hot property-write loop (6M mixed setter/field writes: ~435ms -> ~10ms, written state consumed and verified). Full root test suite (15678 tests) passes with the flag enabled for all test-code compilation; a 12-scenario semantic stress produces identical output compiled with and without the flag. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
