| 822 | |
| 823 | |
| 824 | StreamType PAR_context(CompilerScratch* csb, SSHORT* context_ptr) |
| 825 | { |
| 826 | /************************************** |
| 827 | * |
| 828 | * P A R _ c o n t e x t |
| 829 | * |
| 830 | ************************************** |
| 831 | * |
| 832 | * Functional description |
| 833 | * Introduce a new context into the system. This involves |
| 834 | * assigning a stream and possibly extending the compile |
| 835 | * scratch block. |
| 836 | * |
| 837 | **************************************/ |
| 838 | |
| 839 | // CVC: Bottleneck |
| 840 | const SSHORT context = (unsigned int) csb->csb_blr_reader.getByte(); |
| 841 | |
| 842 | if (context_ptr) |
| 843 | *context_ptr = context; |
| 844 | |
| 845 | CompilerScratch::csb_repeat* tail = CMP_csb_element(csb, context); |
| 846 | |
| 847 | if (tail->csb_flags & csb_used) |
| 848 | { |
| 849 | if (csb->csb_g_flags & csb_reuse_context) { |
| 850 | return tail->csb_stream; |
| 851 | } |
| 852 | |
| 853 | PAR_error(csb, Arg::Gds(isc_ctxinuse)); |
| 854 | } |
| 855 | |
| 856 | const StreamType stream = csb->nextStream(false); |
| 857 | if (stream >= MAX_STREAMS) |
| 858 | { |
| 859 | PAR_error(csb, Arg::Gds(isc_too_many_contexts)); |
| 860 | } |
| 861 | |
| 862 | tail->csb_flags |= csb_used; |
| 863 | tail->csb_stream = stream; |
| 864 | |
| 865 | CMP_csb_element(csb, stream); |
| 866 | |
| 867 | return stream; |
| 868 | } |
| 869 | |
| 870 | |
| 871 | void PAR_dependency(thread_db* tdbb, CompilerScratch* csb, StreamType stream, SSHORT id, |
no test coverage detected