Re: [Sablevm-developer] pc++ to skip preparation address in (GET|PUT)(FIELD|STATIC)
Brought to you by:
egagnon
From: Chris P. <chr...@ma...> - 2004-01-27 05:30:40
|
>>I notice that instructions.m4.c in staging@r1503 no longer has a pc++ to >>skip the preparation address at the beginning of (GET|PUT)(FIELD|STATIC). >> >> >Right. > > > >>How does this address get skipped in the switch interpreter without >>inlinability testing? >> >>You have a some _svmf_no_inlining_increment_pc() function, but it's only >>turned on / defined for inlinability testing. >> >>The other instructions like INVOKE<X> still have the pc++ at the >>beginning. I checked in prepare_code.c and the preparation address is >>still being used, I'm just wondering where it gets skipped ... >> >> >First see two_modes.list - it list all two-mode instructions. > >Then see instructions_preparation.m4.c - there's all logic (or magic) >there. See m4svm_mark_start_and_skip macro which has two versions. >You're mainly interested in m4svm_mark_start_and_skip_normal. > >For any two-modes bytecode it generates this code: > > if (SVM_INLINEABLE_$1 != SVM_INTRP_FLAG_INLINEABLE) pc++; > >Note, that the result of the comparison is known at comile time >as both values are #defines so no real conditional here. >Also note, that it depends on the value of SVM_INLINEABLE_$1 of >certain bytecode for certain architecture so we don't hardcode >pc++ usage in two_modes.list. > >And for non-inlined engines it does pc++ for all two-modes instructions. > > > Thanks for the explanation. I put the above text in my instructions_preparation.m4.c working copy. It's not in my sandbox yet, but will be tomorrow. I think you should move your inlining stuff out of prepare_code.c into a separate file like "inlinability.c" or something, and just put it above prepare_code.c in libsablevm.c. The file is pushing 10000 lines now and your stuff doesn't tie in directly as one of the phases called in _svmf_prepare_code(). Just my opinion ... I'll let you know how things go tomorrow. I wrote up some short coding guidelines today, mostly based on the existing code, that I think would help everyone (especially newcomers), but I'll wait till I'm done to mail them. Cheers, Chris |