Avoiding getfield opcode
问题 In Java\'s String class, the trim method contains this: int off = offset; /* avoid getfield opcode */ char[] val = value; /* avoid getfield opcode */ I\'m a bit puzzled by the comment \"avoid getfield opcode\" ... What does this mean? (I take it this avoids the use of getfield in the bytecode but why is this a Good Thing [TM]?) Is it to prevent object creation in case trim doesn\'t do anything (and hence this is returned) or? 回答1: My guess is that the point is to copy the values into local