This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 251462 - AssertionError at com.sun.tools.javac.util.Assert.error(Assert.java:126)
Summary: AssertionError at com.sun.tools.javac.util.Assert.error(Assert.java:126)
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-27 15:13 UTC by henri127
Modified: 2015-04-16 06:36 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description henri127 2015-03-27 15:13:30 UTC
Product Version = NetBeans IDE 8.0.2 (Build 201411181905)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.8.0_20
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.20-b23


When converting c to java, in java source code hints will not be shown when lines occur in which the index of an array starts with an exclamation mark (!):

p.e. from libavcodec/rv23.c of ffmpeg, twice same code with and without the exclamation mark, line of occurence: qpel_mc[!is16x16][dxy](Y, srcY, s.linesize);

public static  void rv34_mc(RV34DecContext r, final int block_type,
                          final int xoff, final int yoff, int mv_off,
                          final int width, final int height, int dir,
                          final int thirdpel, int weighted,
                          Qpel_Mc_FuncInterface[] qpel_mc,
                          H264_Chroma_Mc_FuncInterface chroma_mc)
{
    MpegEncContext s = r.s;
    Uint8Array Y, U, V, srcY, srcU, srcV;
    int dxy, mx, my, umx, umy, lx, ly, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
    int mv_pos = s.mb_x * 2 + s.mb_y * 2 * s.b8_stride + mv_off;
    int is16x16 = 1;

    if(thirdpel){
        int chroma_mx, chroma_my;
        mx = (s.current_picture_ptr.motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24);
        my = (s.current_picture_ptr.motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24);
        lx = (s.current_picture_ptr.motion_val[dir][mv_pos][0] + (3 << 24)) % 3;
        ly = (s.current_picture_ptr.motion_val[dir][mv_pos][1] + (3 << 24)) % 3;
        chroma_mx = s.current_picture_ptr.motion_val[dir][mv_pos][0] / 2;
        chroma_my = s.current_picture_ptr.motion_val[dir][mv_pos][1] / 2;
        umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24);
        umy = (chroma_my + (3 << 24)) / 3 - (1 << 24);
        uvmx = chroma_coeffs[(chroma_mx + (3 << 24)) % 3];
        uvmy = chroma_coeffs[(chroma_my + (3 << 24)) % 3];
    }else{
        int cx, cy;
        mx = s.current_picture_ptr.motion_val[dir][mv_pos][0] >> 2;
        my = s.current_picture_ptr.motion_val[dir][mv_pos][1] >> 2;
        lx = s.current_picture_ptr.motion_val[dir][mv_pos][0] & 3;
        ly = s.current_picture_ptr.motion_val[dir][mv_pos][1] & 3;
        cx = s.current_picture_ptr.motion_val[dir][mv_pos][0] / 2;
        cy = s.current_picture_ptr.motion_val[dir][mv_pos][1] / 2;
        umx = cx >> 2;
        umy = cy >> 2;
        uvmx = (cx & 3) << 1;
        uvmy = (cy & 3) << 1;
        //due to some flaw RV40 uses the same MC compensation routine for H2V2 and H3V3
        if(uvmx == 6 && uvmy == 6)
            uvmx = uvmy = 4;
    }

    if (HAVE_THREADS && (s.avctx.active_thread_type & FF_THREAD_FRAME)) {
        /* wait for the referenced mb row to be finished */
        int mb_row = s.mb_y + ((yoff + my + 5 + 8 * height) >> 4);
        ThreadFrame *f = dir ? &s.next_picture_ptr.tf : &s.last_picture_ptr.tf;
        ff_thread_await_progress(f, mb_row, 0);
    }

    dxy = ly*4 + lx;
    srcY = dir ? s.next_picture_ptr.f.data[0] : s.last_picture_ptr.f.data[0];
    srcU = dir ? s.next_picture_ptr.f.data[1] : s.last_picture_ptr.f.data[1];
    srcV = dir ? s.next_picture_ptr.f.data[2] : s.last_picture_ptr.f.data[2];
    src_x = s.mb_x * 16 + xoff + mx;
    src_y = s.mb_y * 16 + yoff + my;
    uvsrc_x = s.mb_x * 8 + (xoff >> 1) + umx;
    uvsrc_y = s.mb_y * 8 + (yoff >> 1) + umy;
    srcY += src_y * s.linesize + src_x;
    srcU += uvsrc_y * s.uvlinesize + uvsrc_x;
    srcV += uvsrc_y * s.uvlinesize + uvsrc_x;
    if(s.h_edge_pos - (width << 3) < 6 || s.v_edge_pos - (height << 3) < 6 ||
       (unsigned)(src_x - !!lx*2) > s.h_edge_pos - !!lx*2 - (width <<3) - 4 ||
       (unsigned)(src_y - !!ly*2) > s.v_edge_pos - !!ly*2 - (height<<3) - 4) {
        Uint8Array uvbuf = s.edge_emu_buffer + 22 * s.linesize;

        srcY -= 2 + 2*s.linesize;
        s.vdsp.emulated_edge_mc(s.edge_emu_buffer, srcY, s.linesize, (width<<3)+6, (height<<3)+6,
                            src_x - 2, src_y - 2, s.h_edge_pos, s.v_edge_pos);
        srcY = s.edge_emu_buffer + 2 + 2*s.linesize;
        s.vdsp.emulated_edge_mc(uvbuf     , srcU, s.uvlinesize, (width<<2)+1, (height<<2)+1,
                            uvsrc_x, uvsrc_y, s.h_edge_pos >> 1, s.v_edge_pos >> 1);
        s.vdsp.emulated_edge_mc(uvbuf + 16, srcV, s.uvlinesize, (width<<2)+1, (height<<2)+1,
                            uvsrc_x, uvsrc_y, s.h_edge_pos >> 1, s.v_edge_pos >> 1);
        srcU = uvbuf;
        srcV = uvbuf + 16;
    }
    if(!weighted){
        Y = s.dest[0] + xoff      + yoff     *s.linesize;
        U = s.dest[1] + (xoff>>1) + (yoff>>1)*s.uvlinesize;
        V = s.dest[2] + (xoff>>1) + (yoff>>1)*s.uvlinesize;
    }else{
        Y = r.tmp_b_block_y [dir]     +  xoff     +  yoff    *s.linesize;
        U = r.tmp_b_block_uv[dir*2]   + (xoff>>1) + (yoff>>1)*s.uvlinesize;
        V = r.tmp_b_block_uv[dir*2+1] + (xoff>>1) + (yoff>>1)*s.uvlinesize;
    }

    if(block_type == RV34_MB_P_16x8){
        qpel_mc[1][dxy](Y, srcY, s.linesize);
        Y    += 8;
        srcY += 8;
    }else if(block_type == RV34_MB_P_8x16){
        qpel_mc[1][dxy](Y, srcY, s.linesize);
        Y    += 8 * s.linesize;
        srcY += 8 * s.linesize;
    }
    is16x16 = (block_type != RV34_MB_P_8x8) && (block_type != RV34_MB_P_16x8) && (block_type != RV34_MB_P_8x16);
    qpel_mc[!is16x16][dxy](Y, srcY, s.linesize);
    chroma_mc[2-width]   (U, srcU, s.uvlinesize, height*4, uvmx, uvmy);
    chroma_mc[2-width]   (V, srcV, s.uvlinesize, height*4, uvmx, uvmy);
}

results in an error while

replacing the code with:

public static  void rv34_mc(RV34DecContext r, final int block_type,
                          final int xoff, final int yoff, int mv_off,
                          final int width, final int height, int dir,
                          final int thirdpel, int weighted,
                          Qpel_Mc_FuncInterface[] qpel_mc,
                          H264_Chroma_Mc_FuncInterface chroma_mc)
{
    MpegEncContext s = r.s;
    Uint8Array Y, U, V, srcY, srcU, srcV;
    int dxy, mx, my, umx, umy, lx, ly, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
    int mv_pos = s.mb_x * 2 + s.mb_y * 2 * s.b8_stride + mv_off;
    int is16x16 = 1;

    if(thirdpel){
        int chroma_mx, chroma_my;
        mx = (s.current_picture_ptr.motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24);
        my = (s.current_picture_ptr.motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24);
        lx = (s.current_picture_ptr.motion_val[dir][mv_pos][0] + (3 << 24)) % 3;
        ly = (s.current_picture_ptr.motion_val[dir][mv_pos][1] + (3 << 24)) % 3;
        chroma_mx = s.current_picture_ptr.motion_val[dir][mv_pos][0] / 2;
        chroma_my = s.current_picture_ptr.motion_val[dir][mv_pos][1] / 2;
        umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24);
        umy = (chroma_my + (3 << 24)) / 3 - (1 << 24);
        uvmx = chroma_coeffs[(chroma_mx + (3 << 24)) % 3];
        uvmy = chroma_coeffs[(chroma_my + (3 << 24)) % 3];
    }else{
        int cx, cy;
        mx = s.current_picture_ptr.motion_val[dir][mv_pos][0] >> 2;
        my = s.current_picture_ptr.motion_val[dir][mv_pos][1] >> 2;
        lx = s.current_picture_ptr.motion_val[dir][mv_pos][0] & 3;
        ly = s.current_picture_ptr.motion_val[dir][mv_pos][1] & 3;
        cx = s.current_picture_ptr.motion_val[dir][mv_pos][0] / 2;
        cy = s.current_picture_ptr.motion_val[dir][mv_pos][1] / 2;
        umx = cx >> 2;
        umy = cy >> 2;
        uvmx = (cx & 3) << 1;
        uvmy = (cy & 3) << 1;
        //due to some flaw RV40 uses the same MC compensation routine for H2V2 and H3V3
        if(uvmx == 6 && uvmy == 6)
            uvmx = uvmy = 4;
    }

    if (HAVE_THREADS && (s.avctx.active_thread_type & FF_THREAD_FRAME)) {
        /* wait for the referenced mb row to be finished */
        int mb_row = s.mb_y + ((yoff + my + 5 + 8 * height) >> 4);
        ThreadFrame *f = dir ? &s.next_picture_ptr.tf : &s.last_picture_ptr.tf;
        ff_thread_await_progress(f, mb_row, 0);
    }

    dxy = ly*4 + lx;
    srcY = dir ? s.next_picture_ptr.f.data[0] : s.last_picture_ptr.f.data[0];
    srcU = dir ? s.next_picture_ptr.f.data[1] : s.last_picture_ptr.f.data[1];
    srcV = dir ? s.next_picture_ptr.f.data[2] : s.last_picture_ptr.f.data[2];
    src_x = s.mb_x * 16 + xoff + mx;
    src_y = s.mb_y * 16 + yoff + my;
    uvsrc_x = s.mb_x * 8 + (xoff >> 1) + umx;
    uvsrc_y = s.mb_y * 8 + (yoff >> 1) + umy;
    srcY += src_y * s.linesize + src_x;
    srcU += uvsrc_y * s.uvlinesize + uvsrc_x;
    srcV += uvsrc_y * s.uvlinesize + uvsrc_x;
    if(s.h_edge_pos - (width << 3) < 6 || s.v_edge_pos - (height << 3) < 6 ||
       (unsigned)(src_x - !!lx*2) > s.h_edge_pos - !!lx*2 - (width <<3) - 4 ||
       (unsigned)(src_y - !!ly*2) > s.v_edge_pos - !!ly*2 - (height<<3) - 4) {
        Uint8Array uvbuf = s.edge_emu_buffer + 22 * s.linesize;

        srcY -= 2 + 2*s.linesize;
        s.vdsp.emulated_edge_mc(s.edge_emu_buffer, srcY, s.linesize, (width<<3)+6, (height<<3)+6,
                            src_x - 2, src_y - 2, s.h_edge_pos, s.v_edge_pos);
        srcY = s.edge_emu_buffer + 2 + 2*s.linesize;
        s.vdsp.emulated_edge_mc(uvbuf     , srcU, s.uvlinesize, (width<<2)+1, (height<<2)+1,
                            uvsrc_x, uvsrc_y, s.h_edge_pos >> 1, s.v_edge_pos >> 1);
        s.vdsp.emulated_edge_mc(uvbuf + 16, srcV, s.uvlinesize, (width<<2)+1, (height<<2)+1,
                            uvsrc_x, uvsrc_y, s.h_edge_pos >> 1, s.v_edge_pos >> 1);
        srcU = uvbuf;
        srcV = uvbuf + 16;
    }
    if(!weighted){
        Y = s.dest[0] + xoff      + yoff     *s.linesize;
        U = s.dest[1] + (xoff>>1) + (yoff>>1)*s.uvlinesize;
        V = s.dest[2] + (xoff>>1) + (yoff>>1)*s.uvlinesize;
    }else{
        Y = r.tmp_b_block_y [dir]     +  xoff     +  yoff    *s.linesize;
        U = r.tmp_b_block_uv[dir*2]   + (xoff>>1) + (yoff>>1)*s.uvlinesize;
        V = r.tmp_b_block_uv[dir*2+1] + (xoff>>1) + (yoff>>1)*s.uvlinesize;
    }

    if(block_type == RV34_MB_P_16x8){
        qpel_mc[1][dxy](Y, srcY, s.linesize);
        Y    += 8;
        srcY += 8;
    }else if(block_type == RV34_MB_P_8x16){
        qpel_mc[1][dxy](Y, srcY, s.linesize);
        Y    += 8 * s.linesize;
        srcY += 8 * s.linesize;
    }
    is16x16 = (block_type != RV34_MB_P_8x8) && (block_type != RV34_MB_P_16x8) && (block_type != RV34_MB_P_8x16);
    qpel_mc[(is16x16 == 0 ? 1 : 0)][dxy](Y, srcY, s.linesize);
    chroma_mc[2-width]   (U, srcU, s.uvlinesize, height*4, uvmx, uvmy);
    chroma_mc[2-width]   (V, srcV, s.uvlinesize, height*4, uvmx, uvmy);
}

does not
Comment 1 Jiri Prox 2015-04-07 09:28:31 UTC
The code is invalid, '!' operator cannot be used on int and java does not support arrays of functions.
However the internal compiler crashes when compiling the source, so the errors are not highlighted





Caused: java.lang.AssertionError
	at com.sun.tools.javac.util.Assert.error(Assert.java:126)
	at com.sun.tools.javac.util.Assert.check(Assert.java:45)
	at com.sun.tools.javac.util.Bits.isMember(Bits.java:245)
	at com.sun.tools.javac.comp.Flow$AssignAnalyzer.checkInit(Flow.java:2528)
	at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.checkInit(Flow.java:1607)
	at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.

....
Comment 3 Quality Engineering 2015-04-16 06:36:13 UTC
Integrated into 'main-silver', will be available in build *201504160452* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/53a2a61a32fc
User: Dusan Balek <dbalek@netbeans.org>
Log: Issues #236354, #251462, #251477, and #251809 - fixed.