Bytecode troubles

Hello Masa, Sometimes ago I did report this problem but it was never replied.

I’ve prepared the short ROOT macro to demonstrate and reproduce the problem.

Start trhe macro attached

root testTable.C

It should produce the empty histogram and message
“Error: Bytecode compilation SelectionQWERTY”

Now

  1. I go to the
    root.cern.ch/root/htmldoc/src/TT … :EntryLoop

  2. comment out the line
    // #define BYTECODE

  3. recompile code.

  4. start the same macro again,.
    Now one can see non-empty histogram and no error message.

If you type ".t> folloed by the macro invokcation then it revelas the source code of the trouble autogenerated macro:

1 void SelectionQWERTY(float *results, float **address, int& i$, int& n$ )
2 {
3 float energy = *(address[0]);
4 results[0]=(float)(energy);
5 }
6 EOF
Error: Bytecode compilation SelectionQWERTY
File=/tmp/Selection.C.25115.tmp unloaded

I would appreciate you explain how one chnage the code in question to be able to use the bytecode optimization. his did work in past.

Thank you, Valeri
testTable.C (706 Bytes)

Hello Valeri,

Sorry for not responding. Looks like I totally overlooked your message.

The SelectionQWERTY function can be compiled as bytecode. There
is no problem. I do not know why you see the error message.

So far, I’ve only looked into SelectionQWERTY as an independent
function and haven’t looked at the whole thing yet.

Thank you
Masa Goto

Could you reproduce the problem?
Do you need any extra information?
Thank you

Hi Valeri,

I can not reproduce the problem with the latest ROOT.

You did not mention which version of ROOT you tried.
Could you please try with the latest ROOT and attach the fill output you are getting in both cases.

Cheers,
Philippe.

Hello Philippe
I quickly check my test with ROOT version from CERN AFS
and it does work from there.
I still doesn’t with any BNL/STAR build. Weird !!!
I’ll check thank you.

Valeri

I have discovered the problem is caused by

#pragma optimize 0

within STAR custom “rootlogon.C” script

To reproduce the problem one needs

  1. Start root
  2. turn the optimization OFF with either
    #pragma optimize 0
    or
    .O0
  3. start testTable.C script attached earlier.

Is it normal ?

Hi Valery,

The request ‘.O 0’ disable the generation of the bytecode and hence it is not available to run. You can either try to figure out where the bytecode is available before hand or force the optimization level before loading your temporary file.

Note that Masa is working on a re-implemetation of the CINT code execution layer which should solve this problem (same engine for all optimization level).

Cheers,
Philippe.

Is there any news?

I am still wondering if the code explcitly asks for the byte code why it can not be provided regardless of the currentdefault optimization level.

Or whether it is possible to query / set the current CINT optimization level by the user code.

This way I may have solved the problem nyslef.

Hello Valery,

Okey, I’ve got it. You mean you want to have a function compiled even in optimization level 0 if it is required explicitly. You have reason. I’ll make that change in next release.

In G__MethodInfo::GetBytecode(), bytecode compilation is done only if the optimization level is greater than 3. I’ll make it for all cases.

Thank you
Masa Goto