New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizations for jss field accessors #56

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@alanruttenberg
Collaborator

alanruttenberg commented Jun 15, 2017

Optimizations for jss field accessors, including "==" scope for one-only lookup of fields. New doc:

JSS syntax for fields
#"[<scope>]<thing>.<field>"

<scope> is empty or "==". scope is only paid attention to when <field> is a literal string

<thing> is either {<lisp expression>} or a class name or abbreviation that find-java-class can use
  If <thing> is a lisp expression, then it is evaluated (in the lexical environment) and used as an instance
    when <scope> is "==" you promise that instance will always be of the same class, and so field lookup
    is done once and cached. 
  If <thing> is a class name the result of find-java-class is used and a static field access is done.
    when <scope> is "==" you promise the static field is final and so the result is wrapped in (load-time-value  ...)

<field> is either {<lisp expression} or string
  If <field> is a lisp expression it should evaluate to a string that names a field
  If <field> is a string (no quotes) it is used as the field name

eg. #"foo.bar.baz" -> (get-java-field (find-java-class 'foo.bar) "baz" t)
    #"{foo}.baz" -> (get-java-field (find-java-class foo) "baz" t)
    #"==foo.baz" -> (load-time-value (get-java-field (find-java-class "foo") "bar" t))
    #"=={foo}.baz" -> TL;DR (only look up baz field once based on class of foo, and cache)
Optimizations for jss field accessors, including == scope for one-onl…
…y lookup of fields. Revised doc at top of transform-to-field.lisp

easye pushed a commit that referenced this pull request Jun 17, 2017

mevenson@1c010e3e-69d0-11dd-93a8-456734b0d56f
jss: optimizations for jss field accessors
(Alan Ruttenberg)

Including '==' scope for one-only lookup of fields.

Revised doc at top of transform-to-field.lisp.

From <#56>.

Merges
<382a6db>.
@easye

This comment has been minimized.

Show comment
Hide comment
@easye

easye Jun 17, 2017

Collaborator

Merged with 9192422.

Collaborator

easye commented Jun 17, 2017

Merged with 9192422.

@easye easye closed this Jun 17, 2017

svn2github pushed a commit to svn2github/abcl that referenced this pull request Jun 17, 2017

mevenson
jss: optimizations for jss field accessors
(Alan Ruttenberg)

Including '==' scope for one-only lookup of fields.

Revised doc at top of transform-to-field.lisp.

From <armedbear/abcl#56>.

Merges
<armedbear/abcl@382a6db>.

git-svn-id: http://abcl.org/svn@15087 1c010e3e-69d0-11dd-93a8-456734b0d56f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment